@metamask/solana-wallet-snap 2.3.2 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -1
- package/dist/bundle.js +1 -1
- package/dist/preinstalled-snap.json +1 -1
- package/package.json +1 -1
- package/snap.manifest.json +2 -2
package/dist/bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var e={33:(e,t,n)=>{var r=n(9968),o=n(9756),i=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];e.exports=function(e,t){return r(i,(function(n){var r="_."+n[0];t&n[1]&&!o(e,r)&&e.push(r)})),e.sort()}},88:(e,t,n)=>{var r=n(4700);e.exports=function(e){return r(this,e).get(e)}},125:(e,t,n)=>{var r=n(9032),o=n(5288);e.exports=function(e,t){return e&&r(t,o(t),e)}},155:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},195:(e,t,n)=>{var r=n(4882),o=n(8121),i=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return o(e);var t=[];for(var n in Object(e))i.call(e,n)&&"constructor"!=n&&t.push(n);return t}},282:e=>{e.exports=a,a.default=a,a.stable=l,a.stableStringify=l;var t="[...]",n="[Circular]",r=[],o=[];function i(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function a(e,t,n,a){var s;void 0===a&&(a=i()),c(e,"",0,[],void 0,0,a);try{s=0===o.length?JSON.stringify(e,t,n):JSON.stringify(e,f(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var u=r.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return s}function s(e,t,n,i){var a=Object.getOwnPropertyDescriptor(i,n);void 0!==a.get?a.configurable?(Object.defineProperty(i,n,{value:e}),r.push([i,n,t,a])):o.push([t,n,e]):(i[n]=e,r.push([i,n,t]))}function c(e,r,o,i,a,u,l){var d;if(u+=1,"object"==typeof e&&null!==e){for(d=0;d<i.length;d++)if(i[d]===e)return void s(n,e,r,a);if(void 0!==l.depthLimit&&u>l.depthLimit)return void s(t,e,r,a);if(void 0!==l.edgesLimit&&o+1>l.edgesLimit)return void s(t,e,r,a);if(i.push(e),Array.isArray(e))for(d=0;d<e.length;d++)c(e[d],d,d,i,e,u,l);else{var f=Object.keys(e);for(d=0;d<f.length;d++){var h=f[d];c(e[h],h,d,i,e,u,l)}}i.pop()}}function u(e,t){return e<t?-1:e>t?1:0}function l(e,t,n,a){void 0===a&&(a=i());var s,c=d(e,"",0,[],void 0,0,a)||e;try{s=0===o.length?JSON.stringify(c,t,n):JSON.stringify(c,f(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var u=r.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return s}function d(e,o,i,a,c,l,f){var h;if(l+=1,"object"==typeof e&&null!==e){for(h=0;h<a.length;h++)if(a[h]===e)return void s(n,e,o,c);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==f.depthLimit&&l>f.depthLimit)return void s(t,e,o,c);if(void 0!==f.edgesLimit&&i+1>f.edgesLimit)return void s(t,e,o,c);if(a.push(e),Array.isArray(e))for(h=0;h<e.length;h++)d(e[h],h,h,a,e,l,f);else{var p={},g=Object.keys(e).sort(u);for(h=0;h<g.length;h++){var m=g[h];d(e[m],m,h,a,e,l,f),p[m]=e[m]}if(void 0===c)return p;r.push([c,o,e]),c[o]=p}a.pop()}}function f(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(o.length>0)for(var r=0;r<o.length;r++){var i=o[r];if(i[1]===t&&i[0]===n){n=i[2],o.splice(r,1);break}}return e.call(this,t,n)}}},313:(e,t,n)=>{var r=n(1129),o=n(714);e.exports=function e(t,n,i,a,s){var c=-1,u=t.length;for(i||(i=o),s||(s=[]);++c<u;){var l=t[c];n>0&&i(l)?n>1?e(l,n-1,i,a,s):r(s,l):a||(s[s.length]=l)}return s}},353:(e,t,n)=>{var r=n(1340),o=n(3934),i=n(8861),a=n(1182),s=n(8486),c=n(3142),u=n(5853),l=n(8666),d="[object Arguments]",f="[object Array]",h="[object Object]",p=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,g,m,y){var v=c(e),w=c(t),A=v?f:s(e),b=w?f:s(t),S=(A=A==d?h:A)==h,E=(b=b==d?h:b)==h,k=A==b;if(k&&u(e)){if(!u(t))return!1;v=!0,S=!1}if(k&&!S)return y||(y=new r),v||l(e)?o(e,t,n,g,m,y):i(e,t,A,n,g,m,y);if(!(1&n)){var I=S&&p.call(e,"__wrapped__"),T=E&&p.call(t,"__wrapped__");if(I||T){var _=I?e.value():e,x=T?t.value():t;return y||(y=new r),m(_,x,n,g,y)}}return!!k&&(y||(y=new r),a(e,t,n,g,m,y))}},358:(e,t,n)=>{var r=n(6137),o=n(3283),i=n(3142),a=n(5853),s=n(9632),c=n(8666),u=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=i(e),l=!n&&o(e),d=!n&&!l&&a(e),f=!n&&!l&&!d&&c(e),h=n||l||d||f,p=h?r(e.length,String):[],g=p.length;for(var m in e)!t&&!u.call(e,m)||h&&("length"==m||d&&("offset"==m||"parent"==m)||f&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||s(m,g))||p.push(m);return p}},393:(e,t,n)=>{var r=n(8244),o=n(7979),i=n(1211);e.exports=function(e){return r(e,i,o)}},424:(e,t,n)=>{var r=n(8898),o=n(2480),i=n(8340),a=n(8069),s=n(2264);e.exports=function(e,t,n){var c=e.constructor;switch(t){case"[object ArrayBuffer]":return r(e);case"[object Boolean]":case"[object Date]":return new c(+e);case"[object DataView]":return o(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return s(e,n);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(e);case"[object RegExp]":return i(e);case"[object Symbol]":return a(e)}}},441:(e,t,n)=>{var r=n(7379),o=n(547),i=n(8360);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Error]"==t||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!i(e)}},528:(e,t,n)=>{var r=n(9747),o=n(5962);function i(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}i.prototype=r(o.prototype),i.prototype.constructor=i,e.exports=i},547:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},674:(e,t,n)=>{var r=n(7379),o=n(5387),i=n(547),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return i(e)&&o(e.length)&&!!a[r(e)]}},714:(e,t,n)=>{var r=n(5650),o=n(3283),i=n(3142),a=r?r.isConcatSpreadable:void 0;e.exports=function(e){return i(e)||o(e)||!!(a&&e&&e[a])}},777:(e,t,n)=>{var r=n(8486),o=n(547);e.exports=function(e){return o(e)&&"[object Map]"==r(e)}},796:(e,t,n)=>{var r=n(7403),o=n(3316)(r);e.exports=o},864:(e,t,n)=>{var r=n(8638),o=n(1439),i=o((function(e,t){return r(e,256,void 0,void 0,void 0,t)}));e.exports=i},961:(e,t,n)=>{var r=n(3476),o=Object.prototype.hasOwnProperty;e.exports=function(e){for(var t=e.name+"",n=r[t],i=o.call(r,t)?n.length:0;i--;){var a=n[i],s=a.func;if(null==s||s==e)return a.name}return t}},1048:(e,t,n)=>{"use strict";const r=n(7991),o=n(9318),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=c,t.IS=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=s(n);const o=r.write(e,t);o!==n&&(r=r.slice(0,o));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Z(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Z(e,ArrayBuffer)||e&&Z(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Z(e,SharedArrayBuffer)||e&&Z(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const o=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||J(e.length)?s(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),s(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=s(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function h(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,c.prototype),r}function p(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Z(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(o)return r?-1:K(e).length;t=(""+t).toLowerCase(),o=!0}}function m(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,n);case"utf8":case"utf-8":return T(this,t,n);case"ascii":return x(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),J(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:w(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):w(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function w(e,t,n,r,o){let i,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){let r=-1;for(i=n;i<s;i++)if(u(e,i)===u(t,-1===r?0:i-r)){if(-1===r&&(r=i),i-r+1===c)return r*a}else-1!==r&&(i-=i-r),r=-1}else for(n+c>s&&(n=s-c),i=n;i>=0;i--){let n=!0;for(let r=0;r<c;r++)if(u(e,i+r)!==u(t,r)){n=!1;break}if(n)return i}return-1}function A(e,t,n,r){n=Number(n)||0;const o=e.length-n;r?(r=Number(r))>o&&(r=o):r=o;const i=t.length;let a;for(r>i/2&&(r=i/2),a=0;a<r;++a){const r=parseInt(t.substr(2*a,2),16);if(J(r))return a;e[n+a]=r}return a}function b(e,t,n,r){return H(K(t,e.length-n),e,n,r)}function S(e,t,n,r){return H(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function E(e,t,n,r){return H(G(t),e,n,r)}function k(e,t,n,r){return H(function(e,t){let n,r,o;const i=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function I(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function T(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o<n;){const t=e[o];let i=null,a=t>239?4:t>223?3:t>191?2:1;if(o+a<=n){let n,r,s,c;switch(a){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],s=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=a}return function(e){const t=e.length;if(t<=_)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=_));return n}(r)}c.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,n){return u(e,t,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,n){return function(e,t,n){return l(e),e<=0?s(e):void 0!==t?"string"==typeof n?s(e).fill(t,n):s(e).fill(t):s(e)}(e,t,n)},c.allocUnsafe=function(e){return d(e)},c.allocUnsafeSlow=function(e){return d(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(Z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),Z(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let o=0,i=Math.min(n,r);o<i;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},c.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}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=c.allocUnsafe(t);let o=0;for(n=0;n<e.length;++n){let t=e[n];if(Z(t,Uint8Array))o+t.length>r.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)y(this,t,t+1);return this},c.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},c.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):m.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const n=t.IS;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if(Z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(i,a),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e<s;++e)if(u[e]!==l[e]){i=u[e],a=l[e];break}return i<a?-1:a<i?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return v(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return v(this,e,t,n,!1)},c.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return A(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const _=4096;function x(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(127&e[o]);return r}function C(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(e[o]);return r}function R(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let o="";for(let r=t;r<n;++r)o+=Y[e[r]];return o}function P(e,t,n){const r=e.slice(t,n);let o="";for(let e=0;e<r.length-1;e+=2)o+=String.fromCharCode(r[e]+256*r[e+1]);return o}function N(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function B(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function O(e,t,n,r,o){$(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function M(e,t,n,r,o){$(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function z(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(e,t,n,r,i){return t=+t,n>>>=0,i||z(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,i){return t=+t,n>>>=0,i||z(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(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);const r=this.subarray(e,t);return Object.setPrototypeOf(r,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){q(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<<BigInt(32))})),c.prototype.readBigUInt64BE=Q((function(e){q(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(o)})),c.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||N(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||N(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){q(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),c.prototype.readBigInt64BE=Q((function(e){q(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||N(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||N(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||N(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||N(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){B(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[t]=255&e;++i<n&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){B(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return M(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);B(this,e,t,n,r-1,-r)}let o=0,i=1,a=0;for(this[t]=255&e;++o<n&&(i*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/i>>0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);B(this,e,t,n,r-1,-r)}let o=n-1,i=1,a=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/i>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q((function(e,t=0){return O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return M(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return j(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return j(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const o=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),o},c.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{const i=c.isBuffer(e)?e:c.from(e,r),a=i.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-t;++o)this[o+t]=i[o%a]}return this};const D={};function L(e,t,n){D[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function F(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function $(e,t,n,r,o,i){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let o;throw o=i>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new D.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){q(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||W(t,e.length-(n+1))}(r,o,i)}function q(e,t){if("number"!=typeof e)throw new D.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,n){if(Math.floor(e)!==e)throw q(e,n),new D.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new D.ERR_BUFFER_OUT_OF_BOUNDS;throw new D.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}L("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),L("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),L("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=F(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=F(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function K(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let a=0;a<r;++a){if(n=e.charCodeAt(a),n>55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function G(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function H(e,t,n,r){let o;for(o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function Z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const Y=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function Q(e){return"undefined"==typeof BigInt?X:e}function X(){throw new Error("BigInt not supported")}},1112:(e,t,n)=>{var r=n(4497),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return o.call(t,e)?t[e]:void 0}},1129:e=>{e.exports=function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}},1182:(e,t,n)=>{var r=n(393),o=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,i,a,s){var c=1&n,u=r(e),l=u.length;if(l!=r(t).length&&!c)return!1;for(var d=l;d--;){var f=u[d];if(!(c?f in t:o.call(t,f)))return!1}var h=s.get(e),p=s.get(t);if(h&&p)return h==t&&p==e;var g=!0;s.set(e,t),s.set(t,e);for(var m=c;++d<l;){var y=e[f=u[d]],v=t[f];if(i)var w=c?i(v,y,f,t,e,s):i(y,v,f,e,t,s);if(!(void 0===w?y===v||a(y,v,n,i,s):w)){g=!1;break}m||(m="constructor"==f)}if(g&&!m){var A=e.constructor,b=t.constructor;A==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof A&&A instanceof A&&"function"==typeof b&&b instanceof b||(g=!1)}return s.delete(e),s.delete(t),g}},1187:(e,t,n)=>{var r=n(7379),o=n(547);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},1211:(e,t,n)=>{var r=n(358),o=n(195),i=n(6529);e.exports=function(e){return i(e)?r(e):o(e)}},1340:(e,t,n)=>{var r=n(1386),o=n(4103),i=n(1779),a=n(4162),s=n(7462),c=n(6638);function u(e){var t=this.__data__=new r(e);this.size=t.size}u.prototype.clear=o,u.prototype.delete=i,u.prototype.get=a,u.prototype.has=s,u.prototype.set=c,e.exports=u},1386:(e,t,n)=>{var r=n(2393),o=n(2049),i=n(7144),a=n(7452),s=n(3964);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=a,c.prototype.set=s,e.exports=c},1439:(e,t,n)=>{var r=n(5857),o=n(5234),i=n(796);e.exports=function(e){return i(o(e,void 0,r),e+"")}},1580:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},1623:(e,t,n)=>{var r=n(8942).Uint8Array;e.exports=r},1779:e=>{e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},1877:e=>{e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},1935:(e,t,n)=>{var r=n(8486),o=n(547);e.exports=function(e){return o(e)&&"[object Set]"==r(e)}},1942:(e,t,n)=>{var r=n(528),o=n(1439),i=n(5196),a=n(961),s=n(3142),c=n(6648);e.exports=function(e){return o((function(t){var n=t.length,o=n,u=r.prototype.thru;for(e&&t.reverse();o--;){var l=t[o];if("function"!=typeof l)throw new TypeError("Expected a function");if(u&&!d&&"wrapper"==a(l))var d=new r([],!0)}for(o=d?o:n;++o<n;){l=t[o];var f=a(l),h="wrapper"==f?i(l):void 0;d=h&&c(h[0])&&424==h[1]&&!h[4].length&&1==h[9]?d[a(h[0])].apply(d,h[3]):1==l.length&&c(l)?d[f]():d.thru(l)}return function(){var e=arguments,r=e[0];if(d&&1==e.length&&s(r))return d.plant(r).value();for(var o=0,i=n?t[o].apply(this,e):r;++o<n;)i=t[o].call(this,i);return i}}))}},1950:(e,t,n)=>{var r=n(8942)["__core-js_shared__"];e.exports=r},2049:(e,t,n)=>{var r=n(7034),o=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0)&&(n==t.length-1?t.pop():o.call(t,n,1),--this.size,!0)}},2053:e=>{e.exports=function(e){return e}},2264:(e,t,n)=>{var r=n(8898);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}},2291:(e,t,n)=>{var r=n(5650),o=n(5111),i=n(3142),a=n(1187),s=r?r.prototype:void 0,c=s?s.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(i(t))return o(t,e)+"";if(a(t))return c?c.call(t):"";var n=t+"";return"0"==n&&1/t==-Infinity?"-0":n}},2306:(e,t,n)=>{e=n.nmd(e);var r=n(4967),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o&&r.process,s=function(){try{var e=i&&i.require&&i.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=s},2343:(e,t,n)=>{var r=n(4687),o=n(6123),i=n(7276),a=n(5187),s=n(7267),c=n(3904),u=n(6040);e.exports=function(e,t){return a(e)&&s(t)?c(u(e),t):function(n){var a=o(n,e);return void 0===a&&a===t?i(n,e):r(t,a,3)}}},2393:e=>{e.exports=function(){this.__data__=[],this.size=0}},2443:(e,t,n)=>{var r=n(6912),o=n(4364),i=n(3504),a=n(4216),s=n(6850),c=n(8813),u=n(8942);e.exports=function(e,t,n){var l=o(e);return function o(){for(var d=arguments.length,f=Array(d),h=d,p=s(o);h--;)f[h]=arguments[h];var g=d<3&&f[0]!==p&&f[d-1]!==p?[]:c(f,p);return(d-=g.length)<n?a(e,t,i,o.placeholder,void 0,f,g,void 0,void 0,n-d):r(this&&this!==u&&this instanceof o?l:e,this,f)}}},2478:(e,t,n)=>{var r=n(7250),o=n(9454),i=n(7706);e.exports=function(e,t,n){return t==t?i(e,t,n):r(e,o,n)}},2480:(e,t,n)=>{var r=n(8898);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}},2532:(e,t,n)=>{var r=n(4715),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},2590:(e,t,n)=>{var r=n(9334),o=n(3334);e.exports=function(e){return o("function"==typeof e?e:r(e,1))}},2613:(e,t,n)=>{var r=n(5111),o=n(4354),i=n(3142),a=n(1187),s=n(6493),c=n(6040),u=n(5243);e.exports=function(e){return i(e)?r(e,c):a(e)?[e]:o(s(u(e)))}},2619:e=>{e.exports=function(e){return function(){return e}}},2673:(e,t,n)=>{var r=n(3579),o=n(8055);e.exports=function(e,t,n){return r(o,e,t,n)}},2762:e=>{e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},2784:(e,t,n)=>{var r=n(1580),o=n(4495),i=n(6131),a=Math.max,s=Math.min;e.exports=function(e,t,n){var c,u,l,d,f,h,p=0,g=!1,m=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var n=c,r=u;return c=u=void 0,p=t,d=e.apply(r,n)}function w(e){var n=e-h;return void 0===h||n>=t||n<0||m&&e-p>=l}function A(){var e=o();if(w(e))return b(e);f=setTimeout(A,function(e){var n=t-(e-h);return m?s(n,l-(e-p)):n}(e))}function b(e){return f=void 0,y&&c?v(e):(c=u=void 0,d)}function S(){var e=o(),n=w(e);if(c=arguments,u=this,h=e,n){if(void 0===f)return function(e){return p=e,f=setTimeout(A,t),g?v(e):d}(h);if(m)return clearTimeout(f),f=setTimeout(A,t),v(h)}return void 0===f&&(f=setTimeout(A,t)),d}return t=i(t)||0,r(n)&&(g=!!n.leading,l=(m="maxWait"in n)?a(i(n.maxWait)||0,t):l,y="trailing"in n?!!n.trailing:y),S.cancel=function(){void 0!==f&&clearTimeout(f),p=0,c=h=u=f=void 0},S.flush=function(){return void 0===f?d:b(o())},S}},2846:(e,t,n)=>{var r=n(9334);e.exports=function(e){return r(e,4)}},2879:(e,t,n)=>{var r=n(1942)();e.exports=r},2945:e=>{var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},2991:e=>{e.exports={}},3092:(e,t,n)=>{var r=n(2673)("flow",n(2879));r.placeholder=n(2991),e.exports=r},3103:(e,t,n)=>{var r=n(4715)(n(8942),"DataView");e.exports=r},3142:e=>{var t=Array.isArray;e.exports=t},3212:(e,t,n)=>{var r=n(8250),o=n(1877),i=n(8006);function a(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}a.prototype.add=a.prototype.push=o,a.prototype.has=i,e.exports=a},3282:(e,t,n)=>{var r=n(2762),o=n(8880),i=n(5187),a=n(6040);e.exports=function(e){return i(e)?r(a(e)):o(e)}},3283:(e,t,n)=>{var r=n(6027),o=n(547),i=Object.prototype,a=i.hasOwnProperty,s=i.propertyIsEnumerable,c=r(function(){return arguments}())?r:function(e){return o(e)&&a.call(e,"callee")&&!s.call(e,"callee")};e.exports=c},3301:(e,t,n)=>{var r=n(6131),o=1/0;e.exports=function(e){return e?(e=r(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},3305:(e,t,n)=>{var r=n(4497);e.exports=function(){this.__data__=r?r(null):{},this.size=0}},3316:e=>{var t=Date.now;e.exports=function(e){var n=0,r=0;return function(){var o=t(),i=16-(o-r);if(r=o,i>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}},3321:(e,t,n)=>{var r=n(7553),o=n(528),i=n(5962),a=n(3142),s=n(547),c=n(3410),u=Object.prototype.hasOwnProperty;function l(e){if(s(e)&&!a(e)&&!(e instanceof r)){if(e instanceof o)return e;if(u.call(e,"__wrapped__"))return c(e)}return new o(e)}l.prototype=i.prototype,l.prototype.constructor=l,e.exports=l},3334:(e,t,n)=>{var r=n(6526),o=n(2343),i=n(2053),a=n(3142),s=n(3282);e.exports=function(e){return"function"==typeof e?e:null==e?i:"object"==typeof e?a(e)?o(e[0],e[1]):r(e):s(e)}},3410:(e,t,n)=>{var r=n(7553),o=n(528),i=n(4354);e.exports=function(e){if(e instanceof r)return e.clone();var t=new o(e.__wrapped__,e.__chain__);return t.__actions__=i(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}},3422:(e,t,n)=>{var r=n(7073),o=n(6285),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var a=e[t];i.call(e,t)&&o(a,n)&&(void 0!==n||t in e)||r(e,t,n)}},3476:e=>{e.exports={}},3504:(e,t,n)=>{var r=n(4977),o=n(5755),i=n(3816),a=n(4364),s=n(4216),c=n(6850),u=n(6591),l=n(8813),d=n(8942);e.exports=function e(t,n,f,h,p,g,m,y,v,w){var A=128&n,b=1&n,S=2&n,E=24&n,k=512&n,I=S?void 0:a(t);return function T(){for(var _=arguments.length,x=Array(_),C=_;C--;)x[C]=arguments[C];if(E)var R=c(T),P=i(x,R);if(h&&(x=r(x,h,p,E)),g&&(x=o(x,g,m,E)),_-=P,E&&_<w){var N=l(x,R);return s(t,n,e,T.placeholder,f,x,N,y,v,w-_)}var B=b?f:this,O=S?B[t]:t;return _=x.length,y?x=u(x,y):k&&_>1&&x.reverse(),A&&v<_&&(x.length=v),this&&this!==d&&this instanceof T&&(O=I||a(O)),O.apply(B,x)}}},3526:(e,t,n)=>{var r=n(3142),o=n(5187),i=n(6493),a=n(5243);e.exports=function(e,t){return r(e)?e:o(e,t)?[e]:i(a(e))}},3546:(e,t,n)=>{var r=n(9032),o=n(7979);e.exports=function(e,t){return r(e,o(e),t)}},3565:(e,t)=>{t.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},t.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","rangeStep","rangeStepRight","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],4:["fill","setWith","updateWith"]},t.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},t.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},t.iterateeRearg={mapKeys:[1],reduceRight:[1,0]},t.methodRearg={assignInAllWith:[1,0],assignInWith:[1,2,0],assignAllWith:[1,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],rangeStep:[1,2,0],rangeStepRight:[1,2,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},t.methodSpread={assignAll:{start:0},assignAllWith:{start:0},assignInAll:{start:0},assignInAllWith:{start:0},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{start:0},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},t.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},t.realToAlias=function(){var e=Object.prototype.hasOwnProperty,n=t.aliasToReal,r={};for(var o in n){var i=n[o];e.call(r,i)?r[i].push(o):r[i]=[o]}return r}(),t.remap={assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",propertyOf:"get",rangeStep:"range",rangeStepRight:"rangeRight",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},t.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},t.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}},3579:(e,t,n)=>{var r=n(3565),o=n(2991),i=Array.prototype.push;function a(e,t){return 2==t?function(t,n){return e(t,n)}:function(t){return e(t)}}function s(e){for(var t=e?e.length:0,n=Array(t);t--;)n[t]=e[t];return n}function c(e,t){return function(){var n=arguments.length;if(n){for(var r=Array(n);n--;)r[n]=arguments[n];var o=r[0]=t.apply(void 0,r);return e.apply(void 0,r),o}}}e.exports=function e(t,n,u,l){var d="function"==typeof n,f=n===Object(n);if(f&&(l=u,u=n,n=void 0),null==u)throw new TypeError;l||(l={});var h={cap:!("cap"in l)||l.cap,curry:!("curry"in l)||l.curry,fixed:!("fixed"in l)||l.fixed,immutable:!("immutable"in l)||l.immutable,rearg:!("rearg"in l)||l.rearg},p=d?u:o,g="curry"in l&&l.curry,m="fixed"in l&&l.fixed,y="rearg"in l&&l.rearg,v=d?u.runInContext():void 0,w=d?u:{ary:t.ary,assign:t.assign,clone:t.clone,curry:t.curry,forEach:t.forEach,isArray:t.isArray,isError:t.isError,isFunction:t.isFunction,isWeakMap:t.isWeakMap,iteratee:t.iteratee,keys:t.keys,rearg:t.rearg,toInteger:t.toInteger,toPath:t.toPath},A=w.ary,b=w.assign,S=w.clone,E=w.curry,k=w.forEach,I=w.isArray,T=w.isError,_=w.isFunction,x=w.isWeakMap,C=w.keys,R=w.rearg,P=w.toInteger,N=w.toPath,B=C(r.aryMethod),O={castArray:function(e){return function(){var t=arguments[0];return I(t)?e(s(t)):e.apply(void 0,arguments)}},iteratee:function(e){return function(){var t=arguments[1],n=e(arguments[0],t),r=n.length;return h.cap&&"number"==typeof t?(t=t>2?t-2:1,r&&r<=t?n:a(n,t)):n}},mixin:function(e){return function(t){var n=this;if(!_(n))return e(n,Object(t));var r=[];return k(C(t),(function(e){_(t[e])&&r.push([e,n.prototype[e]])})),e(n,Object(t)),k(r,(function(e){var t=e[1];_(t)?n.prototype[e[0]]=t:delete n.prototype[e[0]]})),n}},nthArg:function(e){return function(t){var n=t<0?1:P(t)+1;return E(e(t),n)}},rearg:function(e){return function(t,n){var r=n?n.length:0;return E(e(t,n),r)}},runInContext:function(n){return function(r){return e(t,n(r),l)}}};function M(e,t){if(h.cap){var n=r.iterateeRearg[e];if(n)return function(e,t){return L(e,(function(e){var n=t.length;return function(e,t){return 2==t?function(t,n){return e.apply(void 0,arguments)}:function(t){return e.apply(void 0,arguments)}}(R(a(e,n),t),n)}))}(t,n);var o=!d&&r.iterateeAry[e];if(o)return function(e,t){return L(e,(function(e){return"function"==typeof e?a(e,t):e}))}(t,o)}return t}function z(e,t,n){if(h.fixed&&(m||!r.skipFixed[e])){var o=r.methodSpread[e],a=o&&o.start;return void 0===a?A(t,n):function(e,t){return function(){for(var n=arguments.length,r=n-1,o=Array(n);n--;)o[n]=arguments[n];var a=o[t],s=o.slice(0,t);return a&&i.apply(s,a),t!=r&&i.apply(s,o.slice(t+1)),e.apply(this,s)}}(t,a)}return t}function j(e,t,n){return h.rearg&&n>1&&(y||!r.skipRearg[e])?R(t,r.methodRearg[e]||r.aryRearg[n]):t}function U(e,t){for(var n=-1,r=(t=N(t)).length,o=r-1,i=S(Object(e)),a=i;null!=a&&++n<r;){var s=t[n],c=a[s];null==c||_(c)||T(c)||x(c)||(a[s]=S(n==o?c:Object(c))),a=a[s]}return i}function D(t,n){var o=r.aliasToReal[t]||t,i=r.remap[o]||o,a=l;return function(t){var r=d?v:w,s=d?v[i]:n,c=b(b({},a),t);return e(r,o,s,c)}}function L(e,t){return function(){var n=arguments.length;if(!n)return e();for(var r=Array(n);n--;)r[n]=arguments[n];var o=h.rearg?0:n-1;return r[o]=t(r[o]),e.apply(void 0,r)}}function F(e,t,n){var o,i=r.aliasToReal[e]||e,a=t,u=O[i];return u?a=u(t):h.immutable&&(r.mutate.array[i]?a=c(t,s):r.mutate.object[i]?a=c(t,function(e){return function(t){return e({},t)}}(t)):r.mutate.set[i]&&(a=c(t,U))),k(B,(function(e){return k(r.aryMethod[e],(function(t){if(i==t){var n=r.methodSpread[i],s=n&&n.afterRearg;return o=s?z(i,j(i,a,e),e):j(i,z(i,a,e),e),o=function(e,t,n){return g||h.curry&&n>1?E(t,n):t}(0,o=M(i,o),e),!1}})),!o})),o||(o=a),o==t&&(o=g?E(o,1):function(){return t.apply(this,arguments)}),o.convert=D(i,t),o.placeholder=t.placeholder=n,o}if(!f)return F(n,u,p);var $=u,q=[];return k(B,(function(e){k(r.aryMethod[e],(function(e){var t=$[r.remap[e]||e];t&&q.push([e,F(e,t,$)])}))})),k(C($),(function(e){var t=$[e];if("function"==typeof t){for(var n=q.length;n--;)if(q[n][0]==e)return;t.convert=D(e,t),q.push([e,t])}})),k(q,(function(e){$[e[0]]=e[1]})),$.convert=function(e){return $.runInContext.convert(e)(void 0)},$.placeholder=$,k(C($),(function(e){k(r.realToAlias[e]||[],(function(t){$[t]=$[e]}))})),$}},3636:e=>{e.exports=function(e,t){return null!=e&&t in Object(e)}},3650:(e,t,n)=>{var r=n(8244),o=n(5832),i=n(5288);e.exports=function(e){return r(e,i,o)}},3655:(e,t,n)=>{var r=n(7379),o=n(1580);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},3766:e=>{e.exports=function(e,t){return function(n){return e(t(n))}}},3804:(e,t,n)=>{e.exports=n(3092)},3816:e=>{e.exports=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}},3904:e=>{e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},3934:(e,t,n)=>{var r=n(3212),o=n(6465),i=n(5568);e.exports=function(e,t,n,a,s,c){var u=1&n,l=e.length,d=t.length;if(l!=d&&!(u&&d>l))return!1;var f=c.get(e),h=c.get(t);if(f&&h)return f==t&&h==e;var p=-1,g=!0,m=2&n?new r:void 0;for(c.set(e,t),c.set(t,e);++p<l;){var y=e[p],v=t[p];if(a)var w=u?a(v,y,p,t,e,c):a(y,v,p,e,t,c);if(void 0!==w){if(w)continue;g=!1;break}if(m){if(!o(t,(function(e,t){if(!i(m,t)&&(y===e||s(y,e,n,a,c)))return m.push(t)}))){g=!1;break}}else if(y!==v&&!s(y,v,n,a,c)){g=!1;break}}return c.delete(e),c.delete(t),g}},3943:(e,t,n)=>{var r=n(1935),o=n(9460),i=n(2306),a=i&&i.isSet,s=a?o(a):r;e.exports=s},3964:(e,t,n)=>{var r=n(7034);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},4066:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},4103:(e,t,n)=>{var r=n(1386);e.exports=function(){this.__data__=new r,this.size=0}},4162:e=>{e.exports=function(e){return this.__data__.get(e)}},4216:(e,t,n)=>{var r=n(6648),o=n(5512),i=n(5620);e.exports=function(e,t,n,a,s,c,u,l,d,f){var h=8&t;t|=h?32:64,4&(t&=~(h?64:32))||(t&=-4);var p=[e,t,s,h?c:void 0,h?u:void 0,h?void 0:c,h?void 0:u,l,d,f],g=n.apply(void 0,p);return r(e)&&o(g,p),g.placeholder=a,i(g,e,t)}},4255:(e,t,n)=>{var r=n(2673)("debounce",n(2784));r.placeholder=n(2991),e.exports=r},4354:e=>{e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}},4364:(e,t,n)=>{var r=n(9747),o=n(1580);e.exports=function(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=r(e.prototype),i=e.apply(n,t);return o(i)?i:n}}},4367:(e,t,n)=>{var r=n(7267),o=n(1211);e.exports=function(e){for(var t=o(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,r(a)]}return t}},4495:(e,t,n)=>{var r=n(8942);e.exports=function(){return r.Date.now()}},4497:(e,t,n)=>{var r=n(4715)(Object,"create");e.exports=r},4512:(e,t,n)=>{var r=n(4715)(n(8942),"Set");e.exports=r},4687:(e,t,n)=>{var r=n(353),o=n(547);e.exports=function e(t,n,i,a,s){return t===n||(null==t||null==n||!o(t)&&!o(n)?t!=t&&n!=n:r(t,n,i,a,e,s))}},4700:(e,t,n)=>{var r=n(9067);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},4715:(e,t,n)=>{var r=n(9624),o=n(155);e.exports=function(e,t){var n=o(e,t);return r(n)?n:void 0}},4732:(e,t,n)=>{var r=n(4700);e.exports=function(e){return r(this,e).has(e)}},4733:(e,t,n)=>{var r=n(9032),o=n(5832);e.exports=function(e,t){return r(e,o(e),t)}},4759:(e,t,n)=>{var r,o=n(1950),i=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!i&&i in e}},4772:e=>{e.exports=function(){return!1}},4784:(e,t,n)=>{var r=n(3766)(Object.getPrototypeOf,Object);e.exports=r},4882:e=>{var t=Object.prototype;e.exports=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||t)}},4943:(e,t,n)=>{var r=n(2053),o=n(6065),i=o?function(e,t){return o.set(e,t),e}:r;e.exports=i},4967:(e,t,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},4977:e=>{var t=Math.max;e.exports=function(e,n,r,o){for(var i=-1,a=e.length,s=r.length,c=-1,u=n.length,l=t(a-s,0),d=Array(u+l),f=!o;++c<u;)d[c]=n[c];for(;++i<s;)(f||i<a)&&(d[r[i]]=e[i]);for(;l--;)d[c++]=e[i++];return d}},5071:(e,t,n)=>{var r=n(4497);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},5098:(e,t,n)=>{var r=n(3305),o=n(9361),i=n(1112),a=n(5276),s=n(5071);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=a,c.prototype.set=s,e.exports=c},5111:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}},5187:(e,t,n)=>{var r=n(3142),o=n(1187),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!o(e))||(a.test(e)||!i.test(e)||null!=t&&e in Object(t))}},5196:(e,t,n)=>{var r=n(6065),o=n(9071),i=r?function(e){return r.get(e)}:o;e.exports=i},5234:(e,t,n)=>{var r=n(6912),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var i=arguments,a=-1,s=o(i.length-t,0),c=Array(s);++a<s;)c[a]=i[t+a];a=-1;for(var u=Array(t+1);++a<t;)u[a]=i[a];return u[t]=n(c),r(e,this,u)}}},5243:(e,t,n)=>{var r=n(2291);e.exports=function(e){return null==e?"":r(e)}},5250:function(e,t,n){var r;e=n.nmd(e),function(){var o,i="Expected a function",a="__lodash_hash_undefined__",s="__lodash_placeholder__",c=16,u=32,l=64,d=128,f=256,h=1/0,p=9007199254740991,g=NaN,m=4294967295,y=[["ary",d],["bind",1],["bindKey",2],["curry",8],["curryRight",c],["flip",512],["partial",u],["partialRight",l],["rearg",f]],v="[object Arguments]",w="[object Array]",A="[object Boolean]",b="[object Date]",S="[object Error]",E="[object Function]",k="[object GeneratorFunction]",I="[object Map]",T="[object Number]",_="[object Object]",x="[object Promise]",C="[object RegExp]",R="[object Set]",P="[object String]",N="[object Symbol]",B="[object WeakMap]",O="[object ArrayBuffer]",M="[object DataView]",z="[object Float32Array]",j="[object Float64Array]",U="[object Int8Array]",D="[object Int16Array]",L="[object Int32Array]",F="[object Uint8Array]",$="[object Uint8ClampedArray]",q="[object Uint16Array]",W="[object Uint32Array]",V=/\b__p \+= '';/g,K=/\b(__p \+=) '' \+/g,G=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,Z=/[&<>"']/g,J=RegExp(H.source),Y=RegExp(Z.source),Q=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,ee=/<%=([\s\S]+?)%>/g,te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ne=/^\w*$/,re=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,oe=/[\\^$.*+?()[\]{}|]/g,ie=RegExp(oe.source),ae=/^\s+/,se=/\s/,ce=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ue=/\{\n\/\* \[wrapped with (.+)\] \*/,le=/,? & /,de=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,fe=/[()=,{}\[\]\/\s]/,he=/\\(\\)?/g,pe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ge=/\w*$/,me=/^[-+]0x[0-9a-f]+$/i,ye=/^0b[01]+$/i,ve=/^\[object .+?Constructor\]$/,we=/^0o[0-7]+$/i,Ae=/^(?:0|[1-9]\d*)$/,be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Se=/($^)/,Ee=/['\n\r\u2028\u2029\\]/g,ke="\\ud800-\\udfff",Ie="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Te="\\u2700-\\u27bf",_e="a-z\\xdf-\\xf6\\xf8-\\xff",xe="A-Z\\xc0-\\xd6\\xd8-\\xde",Ce="\\ufe0e\\ufe0f",Re="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Pe="['’]",Ne="["+ke+"]",Be="["+Re+"]",Oe="["+Ie+"]",Me="\\d+",ze="["+Te+"]",je="["+_e+"]",Ue="[^"+ke+Re+Me+Te+_e+xe+"]",De="\\ud83c[\\udffb-\\udfff]",Le="[^"+ke+"]",Fe="(?:\\ud83c[\\udde6-\\uddff]){2}",$e="[\\ud800-\\udbff][\\udc00-\\udfff]",qe="["+xe+"]",We="\\u200d",Ve="(?:"+je+"|"+Ue+")",Ke="(?:"+qe+"|"+Ue+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",He="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ze="(?:"+Oe+"|"+De+")"+"?",Je="["+Ce+"]?",Ye=Je+Ze+("(?:"+We+"(?:"+[Le,Fe,$e].join("|")+")"+Je+Ze+")*"),Qe="(?:"+[ze,Fe,$e].join("|")+")"+Ye,Xe="(?:"+[Le+Oe+"?",Oe,Fe,$e,Ne].join("|")+")",et=RegExp(Pe,"g"),tt=RegExp(Oe,"g"),nt=RegExp(De+"(?="+De+")|"+Xe+Ye,"g"),rt=RegExp([qe+"?"+je+"+"+Ge+"(?="+[Be,qe,"$"].join("|")+")",Ke+"+"+He+"(?="+[Be,qe+Ve,"$"].join("|")+")",qe+"?"+Ve+"+"+Ge,qe+"+"+He,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Me,Qe].join("|"),"g"),ot=RegExp("["+We+ke+Ie+Ce+"]"),it=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,at=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],st=-1,ct={};ct[z]=ct[j]=ct[U]=ct[D]=ct[L]=ct[F]=ct[$]=ct[q]=ct[W]=!0,ct[v]=ct[w]=ct[O]=ct[A]=ct[M]=ct[b]=ct[S]=ct[E]=ct[I]=ct[T]=ct[_]=ct[C]=ct[R]=ct[P]=ct[B]=!1;var ut={};ut[v]=ut[w]=ut[O]=ut[M]=ut[A]=ut[b]=ut[z]=ut[j]=ut[U]=ut[D]=ut[L]=ut[I]=ut[T]=ut[_]=ut[C]=ut[R]=ut[P]=ut[N]=ut[F]=ut[$]=ut[q]=ut[W]=!0,ut[S]=ut[E]=ut[B]=!1;var lt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},dt=parseFloat,ft=parseInt,ht="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,pt="object"==typeof self&&self&&self.Object===Object&&self,gt=ht||pt||Function("return this")(),mt=t&&!t.nodeType&&t,yt=mt&&e&&!e.nodeType&&e,vt=yt&&yt.exports===mt,wt=vt&&ht.process,At=function(){try{var e=yt&&yt.require&&yt.require("util").types;return e||wt&&wt.binding&&wt.binding("util")}catch(e){}}(),bt=At&&At.isArrayBuffer,St=At&&At.isDate,Et=At&&At.isMap,kt=At&&At.isRegExp,It=At&&At.isSet,Tt=At&&At.isTypedArray;function _t(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function xt(e,t,n,r){for(var o=-1,i=null==e?0:e.length;++o<i;){var a=e[o];t(r,a,n(a),e)}return r}function Ct(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function Rt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Pt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function Nt(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var a=e[n];t(a,n,e)&&(i[o++]=a)}return i}function Bt(e,t){return!!(null==e?0:e.length)&&qt(e,t,0)>-1}function Ot(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1}function Mt(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}function zt(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function jt(e,t,n,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function Ut(e,t,n,r){var o=null==e?0:e.length;for(r&&o&&(n=e[--o]);o--;)n=t(n,e[o],o,e);return n}function Dt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Lt=Gt("length");function Ft(e,t,n){var r;return n(e,(function(e,n,o){if(t(e,n,o))return r=n,!1})),r}function $t(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function qt(e,t,n){return t==t?function(e,t,n){var r=n-1,o=e.length;for(;++r<o;)if(e[r]===t)return r;return-1}(e,t,n):$t(e,Vt,n)}function Wt(e,t,n,r){for(var o=n-1,i=e.length;++o<i;)if(r(e[o],t))return o;return-1}function Vt(e){return e!=e}function Kt(e,t){var n=null==e?0:e.length;return n?Jt(e,t)/n:g}function Gt(e){return function(t){return null==t?o:t[e]}}function Ht(e){return function(t){return null==e?o:e[t]}}function Zt(e,t,n,r,o){return o(e,(function(e,o,i){n=r?(r=!1,e):t(n,e,o,i)})),n}function Jt(e,t){for(var n,r=-1,i=e.length;++r<i;){var a=t(e[r]);a!==o&&(n=n===o?a:n+a)}return n}function Yt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Qt(e){return e?e.slice(0,mn(e)+1).replace(ae,""):e}function Xt(e){return function(t){return e(t)}}function en(e,t){return Mt(t,(function(t){return e[t]}))}function tn(e,t){return e.has(t)}function nn(e,t){for(var n=-1,r=e.length;++n<r&&qt(t,e[n],0)>-1;);return n}function rn(e,t){for(var n=e.length;n--&&qt(t,e[n],0)>-1;);return n}var on=Ht({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),an=Ht({"&":"&","<":"<",">":">",'"':""","'":"'"});function sn(e){return"\\"+lt[e]}function cn(e){return ot.test(e)}function un(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function ln(e,t){return function(n){return e(t(n))}}function dn(e,t){for(var n=-1,r=e.length,o=0,i=[];++n<r;){var a=e[n];a!==t&&a!==s||(e[n]=s,i[o++]=n)}return i}function fn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function hn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}function pn(e){return cn(e)?function(e){var t=nt.lastIndex=0;for(;nt.test(e);)++t;return t}(e):Lt(e)}function gn(e){return cn(e)?function(e){return e.match(nt)||[]}(e):function(e){return e.split("")}(e)}function mn(e){for(var t=e.length;t--&&se.test(e.charAt(t)););return t}var yn=Ht({"&":"&","<":"<",">":">",""":'"',"'":"'"});var vn=function e(t){var n,r=(t=null==t?gt:vn.defaults(gt.Object(),t,vn.pick(gt,at))).Array,se=t.Date,ke=t.Error,Ie=t.Function,Te=t.Math,_e=t.Object,xe=t.RegExp,Ce=t.String,Re=t.TypeError,Pe=r.prototype,Ne=Ie.prototype,Be=_e.prototype,Oe=t["__core-js_shared__"],Me=Ne.toString,ze=Be.hasOwnProperty,je=0,Ue=(n=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",De=Be.toString,Le=Me.call(_e),Fe=gt._,$e=xe("^"+Me.call(ze).replace(oe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qe=vt?t.Buffer:o,We=t.Symbol,Ve=t.Uint8Array,Ke=qe?qe.allocUnsafe:o,Ge=ln(_e.getPrototypeOf,_e),He=_e.create,Ze=Be.propertyIsEnumerable,Je=Pe.splice,Ye=We?We.isConcatSpreadable:o,Qe=We?We.iterator:o,Xe=We?We.toStringTag:o,nt=function(){try{var e=hi(_e,"defineProperty");return e({},"",{}),e}catch(e){}}(),ot=t.clearTimeout!==gt.clearTimeout&&t.clearTimeout,lt=se&&se.now!==gt.Date.now&&se.now,ht=t.setTimeout!==gt.setTimeout&&t.setTimeout,pt=Te.ceil,mt=Te.floor,yt=_e.getOwnPropertySymbols,wt=qe?qe.isBuffer:o,At=t.isFinite,Lt=Pe.join,Ht=ln(_e.keys,_e),wn=Te.max,An=Te.min,bn=se.now,Sn=t.parseInt,En=Te.random,kn=Pe.reverse,In=hi(t,"DataView"),Tn=hi(t,"Map"),_n=hi(t,"Promise"),xn=hi(t,"Set"),Cn=hi(t,"WeakMap"),Rn=hi(_e,"create"),Pn=Cn&&new Cn,Nn={},Bn=Di(In),On=Di(Tn),Mn=Di(_n),zn=Di(xn),jn=Di(Cn),Un=We?We.prototype:o,Dn=Un?Un.valueOf:o,Ln=Un?Un.toString:o;function Fn(e){if(ns(e)&&!Va(e)&&!(e instanceof Vn)){if(e instanceof Wn)return e;if(ze.call(e,"__wrapped__"))return Li(e)}return new Wn(e)}var $n=function(){function e(){}return function(t){if(!ts(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=o,n}}();function qn(){}function Wn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=o}function Vn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function Kn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Gn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Hn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Zn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Hn;++t<n;)this.add(e[t])}function Jn(e){var t=this.__data__=new Gn(e);this.size=t.size}function Yn(e,t){var n=Va(e),r=!n&&Wa(e),o=!n&&!r&&Za(e),i=!n&&!r&&!o&&ls(e),a=n||r||o||i,s=a?Yt(e.length,Ce):[],c=s.length;for(var u in e)!t&&!ze.call(e,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Ai(u,c))||s.push(u);return s}function Qn(e){var t=e.length;return t?e[Zr(0,t-1)]:o}function Xn(e,t){return zi(Po(e),cr(t,0,e.length))}function er(e){return zi(Po(e))}function tr(e,t,n){(n!==o&&!Fa(e[t],n)||n===o&&!(t in e))&&ar(e,t,n)}function nr(e,t,n){var r=e[t];ze.call(e,t)&&Fa(r,n)&&(n!==o||t in e)||ar(e,t,n)}function rr(e,t){for(var n=e.length;n--;)if(Fa(e[n][0],t))return n;return-1}function or(e,t,n,r){return hr(e,(function(e,o,i){t(r,e,n(e),i)})),r}function ir(e,t){return e&&No(t,Ns(t),e)}function ar(e,t,n){"__proto__"==t&&nt?nt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function sr(e,t){for(var n=-1,i=t.length,a=r(i),s=null==e;++n<i;)a[n]=s?o:_s(e,t[n]);return a}function cr(e,t,n){return e==e&&(n!==o&&(e=e<=n?e:n),t!==o&&(e=e>=t?e:t)),e}function ur(e,t,n,r,i,a){var s,c=1&t,u=2&t,l=4&t;if(n&&(s=i?n(e,r,i,a):n(e)),s!==o)return s;if(!ts(e))return e;var d=Va(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&ze.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!c)return Po(e,s)}else{var f=mi(e),h=f==E||f==k;if(Za(e))return Io(e,c);if(f==_||f==v||h&&!i){if(s=u||h?{}:vi(e),!c)return u?function(e,t){return No(e,gi(e),t)}(e,function(e,t){return e&&No(t,Bs(t),e)}(s,e)):function(e,t){return No(e,pi(e),t)}(e,ir(s,e))}else{if(!ut[f])return i?e:{};s=function(e,t,n){var r=e.constructor;switch(t){case O:return To(e);case A:case b:return new r(+e);case M:return function(e,t){var n=t?To(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case z:case j:case U:case D:case L:case F:case $:case q:case W:return _o(e,n);case I:return new r;case T:case P:return new r(e);case C:return function(e){var t=new e.constructor(e.source,ge.exec(e));return t.lastIndex=e.lastIndex,t}(e);case R:return new r;case N:return o=e,Dn?_e(Dn.call(o)):{}}var o}(e,f,c)}}a||(a=new Jn);var p=a.get(e);if(p)return p;a.set(e,s),ss(e)?e.forEach((function(r){s.add(ur(r,t,n,r,e,a))})):rs(e)&&e.forEach((function(r,o){s.set(o,ur(r,t,n,o,e,a))}));var g=d?o:(l?u?ai:ii:u?Bs:Ns)(e);return Ct(g||e,(function(r,o){g&&(r=e[o=r]),nr(s,o,ur(r,t,n,o,e,a))})),s}function lr(e,t,n){var r=n.length;if(null==e)return!r;for(e=_e(e);r--;){var i=n[r],a=t[i],s=e[i];if(s===o&&!(i in e)||!a(s))return!1}return!0}function dr(e,t,n){if("function"!=typeof e)throw new Re(i);return Ni((function(){e.apply(o,n)}),t)}function fr(e,t,n,r){var o=-1,i=Bt,a=!0,s=e.length,c=[],u=t.length;if(!s)return c;n&&(t=Mt(t,Xt(n))),r?(i=Ot,a=!1):t.length>=200&&(i=tn,a=!1,t=new Zn(t));e:for(;++o<s;){var l=e[o],d=null==n?l:n(l);if(l=r||0!==l?l:0,a&&d==d){for(var f=u;f--;)if(t[f]===d)continue e;c.push(l)}else i(t,d,r)||c.push(l)}return c}Fn.templateSettings={escape:Q,evaluate:X,interpolate:ee,variable:"",imports:{_:Fn}},Fn.prototype=qn.prototype,Fn.prototype.constructor=Fn,Wn.prototype=$n(qn.prototype),Wn.prototype.constructor=Wn,Vn.prototype=$n(qn.prototype),Vn.prototype.constructor=Vn,Kn.prototype.clear=function(){this.__data__=Rn?Rn(null):{},this.size=0},Kn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Kn.prototype.get=function(e){var t=this.__data__;if(Rn){var n=t[e];return n===a?o:n}return ze.call(t,e)?t[e]:o},Kn.prototype.has=function(e){var t=this.__data__;return Rn?t[e]!==o:ze.call(t,e)},Kn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Rn&&t===o?a:t,this},Gn.prototype.clear=function(){this.__data__=[],this.size=0},Gn.prototype.delete=function(e){var t=this.__data__,n=rr(t,e);return!(n<0)&&(n==t.length-1?t.pop():Je.call(t,n,1),--this.size,!0)},Gn.prototype.get=function(e){var t=this.__data__,n=rr(t,e);return n<0?o:t[n][1]},Gn.prototype.has=function(e){return rr(this.__data__,e)>-1},Gn.prototype.set=function(e,t){var n=this.__data__,r=rr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Kn,map:new(Tn||Gn),string:new Kn}},Hn.prototype.delete=function(e){var t=di(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return di(this,e).get(e)},Hn.prototype.has=function(e){return di(this,e).has(e)},Hn.prototype.set=function(e,t){var n=di(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Zn.prototype.add=Zn.prototype.push=function(e){return this.__data__.set(e,a),this},Zn.prototype.has=function(e){return this.__data__.has(e)},Jn.prototype.clear=function(){this.__data__=new Gn,this.size=0},Jn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Jn.prototype.get=function(e){return this.__data__.get(e)},Jn.prototype.has=function(e){return this.__data__.has(e)},Jn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Gn){var r=n.__data__;if(!Tn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var hr=Mo(br),pr=Mo(Sr,!0);function gr(e,t){var n=!0;return hr(e,(function(e,r,o){return n=!!t(e,r,o)})),n}function mr(e,t,n){for(var r=-1,i=e.length;++r<i;){var a=e[r],s=t(a);if(null!=s&&(c===o?s==s&&!us(s):n(s,c)))var c=s,u=a}return u}function yr(e,t){var n=[];return hr(e,(function(e,r,o){t(e,r,o)&&n.push(e)})),n}function vr(e,t,n,r,o){var i=-1,a=e.length;for(n||(n=wi),o||(o=[]);++i<a;){var s=e[i];t>0&&n(s)?t>1?vr(s,t-1,n,r,o):zt(o,s):r||(o[o.length]=s)}return o}var wr=zo(),Ar=zo(!0);function br(e,t){return e&&wr(e,t,Ns)}function Sr(e,t){return e&&Ar(e,t,Ns)}function Er(e,t){return Nt(t,(function(t){return Qa(e[t])}))}function kr(e,t){for(var n=0,r=(t=bo(t,e)).length;null!=e&&n<r;)e=e[Ui(t[n++])];return n&&n==r?e:o}function Ir(e,t,n){var r=t(e);return Va(e)?r:zt(r,n(e))}function Tr(e){return null==e?e===o?"[object Undefined]":"[object Null]":Xe&&Xe in _e(e)?function(e){var t=ze.call(e,Xe),n=e[Xe];try{e[Xe]=o;var r=!0}catch(e){}var i=De.call(e);r&&(t?e[Xe]=n:delete e[Xe]);return i}(e):function(e){return De.call(e)}(e)}function _r(e,t){return e>t}function xr(e,t){return null!=e&&ze.call(e,t)}function Cr(e,t){return null!=e&&t in _e(e)}function Rr(e,t,n){for(var i=n?Ot:Bt,a=e[0].length,s=e.length,c=s,u=r(s),l=1/0,d=[];c--;){var f=e[c];c&&t&&(f=Mt(f,Xt(t))),l=An(f.length,l),u[c]=!n&&(t||a>=120&&f.length>=120)?new Zn(c&&f):o}f=e[0];var h=-1,p=u[0];e:for(;++h<a&&d.length<l;){var g=f[h],m=t?t(g):g;if(g=n||0!==g?g:0,!(p?tn(p,m):i(d,m,n))){for(c=s;--c;){var y=u[c];if(!(y?tn(y,m):i(e[c],m,n)))continue e}p&&p.push(m),d.push(g)}}return d}function Pr(e,t,n){var r=null==(e=Ci(e,t=bo(t,e)))?e:e[Ui(Yi(t))];return null==r?o:_t(r,e,n)}function Nr(e){return ns(e)&&Tr(e)==v}function Br(e,t,n,r,i){return e===t||(null==e||null==t||!ns(e)&&!ns(t)?e!=e&&t!=t:function(e,t,n,r,i,a){var s=Va(e),c=Va(t),u=s?w:mi(e),l=c?w:mi(t),d=(u=u==v?_:u)==_,f=(l=l==v?_:l)==_,h=u==l;if(h&&Za(e)){if(!Za(t))return!1;s=!0,d=!1}if(h&&!d)return a||(a=new Jn),s||ls(e)?ri(e,t,n,r,i,a):function(e,t,n,r,o,i,a){switch(n){case M:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case O:return!(e.byteLength!=t.byteLength||!i(new Ve(e),new Ve(t)));case A:case b:case T:return Fa(+e,+t);case S:return e.name==t.name&&e.message==t.message;case C:case P:return e==t+"";case I:var s=un;case R:var c=1&r;if(s||(s=fn),e.size!=t.size&&!c)return!1;var u=a.get(e);if(u)return u==t;r|=2,a.set(e,t);var l=ri(s(e),s(t),r,o,i,a);return a.delete(e),l;case N:if(Dn)return Dn.call(e)==Dn.call(t)}return!1}(e,t,u,n,r,i,a);if(!(1&n)){var p=d&&ze.call(e,"__wrapped__"),g=f&&ze.call(t,"__wrapped__");if(p||g){var m=p?e.value():e,y=g?t.value():t;return a||(a=new Jn),i(m,y,n,r,a)}}if(!h)return!1;return a||(a=new Jn),function(e,t,n,r,i,a){var s=1&n,c=ii(e),u=c.length,l=ii(t),d=l.length;if(u!=d&&!s)return!1;var f=u;for(;f--;){var h=c[f];if(!(s?h in t:ze.call(t,h)))return!1}var p=a.get(e),g=a.get(t);if(p&&g)return p==t&&g==e;var m=!0;a.set(e,t),a.set(t,e);var y=s;for(;++f<u;){var v=e[h=c[f]],w=t[h];if(r)var A=s?r(w,v,h,t,e,a):r(v,w,h,e,t,a);if(!(A===o?v===w||i(v,w,n,r,a):A)){m=!1;break}y||(y="constructor"==h)}if(m&&!y){var b=e.constructor,S=t.constructor;b==S||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof S&&S instanceof S||(m=!1)}return a.delete(e),a.delete(t),m}(e,t,n,r,i,a)}(e,t,n,r,Br,i))}function Or(e,t,n,r){var i=n.length,a=i,s=!r;if(null==e)return!a;for(e=_e(e);i--;){var c=n[i];if(s&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++i<a;){var u=(c=n[i])[0],l=e[u],d=c[1];if(s&&c[2]){if(l===o&&!(u in e))return!1}else{var f=new Jn;if(r)var h=r(l,d,u,e,t,f);if(!(h===o?Br(d,l,3,r,f):h))return!1}}return!0}function Mr(e){return!(!ts(e)||(t=e,Ue&&Ue in t))&&(Qa(e)?$e:ve).test(Di(e));var t}function zr(e){return"function"==typeof e?e:null==e?oc:"object"==typeof e?Va(e)?$r(e[0],e[1]):Fr(e):hc(e)}function jr(e){if(!Ii(e))return Ht(e);var t=[];for(var n in _e(e))ze.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Ur(e){if(!ts(e))return function(e){var t=[];if(null!=e)for(var n in _e(e))t.push(n);return t}(e);var t=Ii(e),n=[];for(var r in e)("constructor"!=r||!t&&ze.call(e,r))&&n.push(r);return n}function Dr(e,t){return e<t}function Lr(e,t){var n=-1,o=Ga(e)?r(e.length):[];return hr(e,(function(e,r,i){o[++n]=t(e,r,i)})),o}function Fr(e){var t=fi(e);return 1==t.length&&t[0][2]?_i(t[0][0],t[0][1]):function(n){return n===e||Or(n,e,t)}}function $r(e,t){return Si(e)&&Ti(t)?_i(Ui(e),t):function(n){var r=_s(n,e);return r===o&&r===t?xs(n,e):Br(t,r,3)}}function qr(e,t,n,r,i){e!==t&&wr(t,(function(a,s){if(i||(i=new Jn),ts(a))!function(e,t,n,r,i,a,s){var c=Ri(e,n),u=Ri(t,n),l=s.get(u);if(l)return void tr(e,n,l);var d=a?a(c,u,n+"",e,t,s):o,f=d===o;if(f){var h=Va(u),p=!h&&Za(u),g=!h&&!p&&ls(u);d=u,h||p||g?Va(c)?d=c:Ha(c)?d=Po(c):p?(f=!1,d=Io(u,!0)):g?(f=!1,d=_o(u,!0)):d=[]:is(u)||Wa(u)?(d=c,Wa(c)?d=vs(c):ts(c)&&!Qa(c)||(d=vi(u))):f=!1}f&&(s.set(u,d),i(d,u,r,a,s),s.delete(u));tr(e,n,d)}(e,t,s,n,qr,r,i);else{var c=r?r(Ri(e,s),a,s+"",e,t,i):o;c===o&&(c=a),tr(e,s,c)}}),Bs)}function Wr(e,t){var n=e.length;if(n)return Ai(t+=t<0?n:0,n)?e[t]:o}function Vr(e,t,n){t=t.length?Mt(t,(function(e){return Va(e)?function(t){return kr(t,1===e.length?e[0]:e)}:e})):[oc];var r=-1;t=Mt(t,Xt(li()));var o=Lr(e,(function(e,n,o){var i=Mt(t,(function(t){return t(e)}));return{criteria:i,index:++r,value:e}}));return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(o,(function(e,t){return function(e,t,n){var r=-1,o=e.criteria,i=t.criteria,a=o.length,s=n.length;for(;++r<a;){var c=xo(o[r],i[r]);if(c)return r>=s?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function Kr(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var a=t[r],s=kr(e,a);n(s,a)&&eo(i,bo(a,e),s)}return i}function Gr(e,t,n,r){var o=r?Wt:qt,i=-1,a=t.length,s=e;for(e===t&&(t=Po(t)),n&&(s=Mt(e,Xt(n)));++i<a;)for(var c=0,u=t[i],l=n?n(u):u;(c=o(s,l,c,r))>-1;)s!==e&&Je.call(s,c,1),Je.call(e,c,1);return e}function Hr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var o=t[n];if(n==r||o!==i){var i=o;Ai(o)?Je.call(e,o,1):ho(e,o)}}return e}function Zr(e,t){return e+mt(En()*(t-e+1))}function Jr(e,t){var n="";if(!e||t<1||t>p)return n;do{t%2&&(n+=e),(t=mt(t/2))&&(e+=e)}while(t);return n}function Yr(e,t){return Bi(xi(e,t,oc),e+"")}function Qr(e){return Qn(Fs(e))}function Xr(e,t){var n=Fs(e);return zi(n,cr(t,0,n.length))}function eo(e,t,n,r){if(!ts(e))return e;for(var i=-1,a=(t=bo(t,e)).length,s=a-1,c=e;null!=c&&++i<a;){var u=Ui(t[i]),l=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(i!=s){var d=c[u];(l=r?r(d,u,c):o)===o&&(l=ts(d)?d:Ai(t[i+1])?[]:{})}nr(c,u,l),c=c[u]}return e}var to=Pn?function(e,t){return Pn.set(e,t),e}:oc,no=nt?function(e,t){return nt(e,"toString",{configurable:!0,enumerable:!1,value:tc(t),writable:!0})}:oc;function ro(e){return zi(Fs(e))}function oo(e,t,n){var o=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=r(i);++o<i;)a[o]=e[o+t];return a}function io(e,t){var n;return hr(e,(function(e,r,o){return!(n=t(e,r,o))})),!!n}function ao(e,t,n){var r=0,o=null==e?r:e.length;if("number"==typeof t&&t==t&&o<=2147483647){for(;r<o;){var i=r+o>>>1,a=e[i];null!==a&&!us(a)&&(n?a<=t:a<t)?r=i+1:o=i}return o}return so(e,t,oc,n)}function so(e,t,n,r){var i=0,a=null==e?0:e.length;if(0===a)return 0;for(var s=(t=n(t))!=t,c=null===t,u=us(t),l=t===o;i<a;){var d=mt((i+a)/2),f=n(e[d]),h=f!==o,p=null===f,g=f==f,m=us(f);if(s)var y=r||g;else y=l?g&&(r||h):c?g&&h&&(r||!p):u?g&&h&&!p&&(r||!m):!p&&!m&&(r?f<=t:f<t);y?i=d+1:a=d}return An(a,4294967294)}function co(e,t){for(var n=-1,r=e.length,o=0,i=[];++n<r;){var a=e[n],s=t?t(a):a;if(!n||!Fa(s,c)){var c=s;i[o++]=0===a?0:a}}return i}function uo(e){return"number"==typeof e?e:us(e)?g:+e}function lo(e){if("string"==typeof e)return e;if(Va(e))return Mt(e,lo)+"";if(us(e))return Ln?Ln.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function fo(e,t,n){var r=-1,o=Bt,i=e.length,a=!0,s=[],c=s;if(n)a=!1,o=Ot;else if(i>=200){var u=t?null:Yo(e);if(u)return fn(u);a=!1,o=tn,c=new Zn}else c=t?[]:s;e:for(;++r<i;){var l=e[r],d=t?t(l):l;if(l=n||0!==l?l:0,a&&d==d){for(var f=c.length;f--;)if(c[f]===d)continue e;t&&c.push(d),s.push(l)}else o(c,d,n)||(c!==s&&c.push(d),s.push(l))}return s}function ho(e,t){return null==(e=Ci(e,t=bo(t,e)))||delete e[Ui(Yi(t))]}function po(e,t,n,r){return eo(e,t,n(kr(e,t)),r)}function go(e,t,n,r){for(var o=e.length,i=r?o:-1;(r?i--:++i<o)&&t(e[i],i,e););return n?oo(e,r?0:i,r?i+1:o):oo(e,r?i+1:0,r?o:i)}function mo(e,t){var n=e;return n instanceof Vn&&(n=n.value()),jt(t,(function(e,t){return t.func.apply(t.thisArg,zt([e],t.args))}),n)}function yo(e,t,n){var o=e.length;if(o<2)return o?fo(e[0]):[];for(var i=-1,a=r(o);++i<o;)for(var s=e[i],c=-1;++c<o;)c!=i&&(a[i]=fr(a[i]||s,e[c],t,n));return fo(vr(a,1),t,n)}function vo(e,t,n){for(var r=-1,i=e.length,a=t.length,s={};++r<i;){var c=r<a?t[r]:o;n(s,e[r],c)}return s}function wo(e){return Ha(e)?e:[]}function Ao(e){return"function"==typeof e?e:oc}function bo(e,t){return Va(e)?e:Si(e,t)?[e]:ji(ws(e))}var So=Yr;function Eo(e,t,n){var r=e.length;return n=n===o?r:n,!t&&n>=r?e:oo(e,t,n)}var ko=ot||function(e){return gt.clearTimeout(e)};function Io(e,t){if(t)return e.slice();var n=e.length,r=Ke?Ke(n):new e.constructor(n);return e.copy(r),r}function To(e){var t=new e.constructor(e.byteLength);return new Ve(t).set(new Ve(e)),t}function _o(e,t){var n=t?To(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function xo(e,t){if(e!==t){var n=e!==o,r=null===e,i=e==e,a=us(e),s=t!==o,c=null===t,u=t==t,l=us(t);if(!c&&!l&&!a&&e>t||a&&s&&u&&!c&&!l||r&&s&&u||!n&&u||!i)return 1;if(!r&&!a&&!l&&e<t||l&&n&&i&&!r&&!a||c&&n&&i||!s&&i||!u)return-1}return 0}function Co(e,t,n,o){for(var i=-1,a=e.length,s=n.length,c=-1,u=t.length,l=wn(a-s,0),d=r(u+l),f=!o;++c<u;)d[c]=t[c];for(;++i<s;)(f||i<a)&&(d[n[i]]=e[i]);for(;l--;)d[c++]=e[i++];return d}function Ro(e,t,n,o){for(var i=-1,a=e.length,s=-1,c=n.length,u=-1,l=t.length,d=wn(a-c,0),f=r(d+l),h=!o;++i<d;)f[i]=e[i];for(var p=i;++u<l;)f[p+u]=t[u];for(;++s<c;)(h||i<a)&&(f[p+n[s]]=e[i++]);return f}function Po(e,t){var n=-1,o=e.length;for(t||(t=r(o));++n<o;)t[n]=e[n];return t}function No(e,t,n,r){var i=!n;n||(n={});for(var a=-1,s=t.length;++a<s;){var c=t[a],u=r?r(n[c],e[c],c,n,e):o;u===o&&(u=e[c]),i?ar(n,c,u):nr(n,c,u)}return n}function Bo(e,t){return function(n,r){var o=Va(n)?xt:or,i=t?t():{};return o(n,e,li(r,2),i)}}function Oo(e){return Yr((function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:o,s=i>2?n[2]:o;for(a=e.length>3&&"function"==typeof a?(i--,a):o,s&&bi(n[0],n[1],s)&&(a=i<3?o:a,i=1),t=_e(t);++r<i;){var c=n[r];c&&e(t,c,r,a)}return t}))}function Mo(e,t){return function(n,r){if(null==n)return n;if(!Ga(n))return e(n,r);for(var o=n.length,i=t?o:-1,a=_e(n);(t?i--:++i<o)&&!1!==r(a[i],i,a););return n}}function zo(e){return function(t,n,r){for(var o=-1,i=_e(t),a=r(t),s=a.length;s--;){var c=a[e?s:++o];if(!1===n(i[c],c,i))break}return t}}function jo(e){return function(t){var n=cn(t=ws(t))?gn(t):o,r=n?n[0]:t.charAt(0),i=n?Eo(n,1).join(""):t.slice(1);return r[e]()+i}}function Uo(e){return function(t){return jt(Qs(Ws(t).replace(et,"")),e,"")}}function Do(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=$n(e.prototype),r=e.apply(n,t);return ts(r)?r:n}}function Lo(e){return function(t,n,r){var i=_e(t);if(!Ga(t)){var a=li(n,3);t=Ns(t),n=function(e){return a(i[e],e,i)}}var s=e(t,n,r);return s>-1?i[a?t[s]:s]:o}}function Fo(e){return oi((function(t){var n=t.length,r=n,a=Wn.prototype.thru;for(e&&t.reverse();r--;){var s=t[r];if("function"!=typeof s)throw new Re(i);if(a&&!c&&"wrapper"==ci(s))var c=new Wn([],!0)}for(r=c?r:n;++r<n;){var u=ci(s=t[r]),l="wrapper"==u?si(s):o;c=l&&Ei(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?c[ci(l[0])].apply(c,l[3]):1==s.length&&Ei(s)?c[u]():c.thru(s)}return function(){var e=arguments,r=e[0];if(c&&1==e.length&&Va(r))return c.plant(r).value();for(var o=0,i=n?t[o].apply(this,e):r;++o<n;)i=t[o].call(this,i);return i}}))}function $o(e,t,n,i,a,s,c,u,l,f){var h=t&d,p=1&t,g=2&t,m=24&t,y=512&t,v=g?o:Do(e);return function d(){for(var w=arguments.length,A=r(w),b=w;b--;)A[b]=arguments[b];if(m)var S=ui(d),E=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(A,S);if(i&&(A=Co(A,i,a,m)),s&&(A=Ro(A,s,c,m)),w-=E,m&&w<f){var k=dn(A,S);return Zo(e,t,$o,d.placeholder,n,A,k,u,l,f-w)}var I=p?n:this,T=g?I[e]:e;return w=A.length,u?A=function(e,t){var n=e.length,r=An(t.length,n),i=Po(e);for(;r--;){var a=t[r];e[r]=Ai(a,n)?i[a]:o}return e}(A,u):y&&w>1&&A.reverse(),h&&l<w&&(A.length=l),this&&this!==gt&&this instanceof d&&(T=v||Do(T)),T.apply(I,A)}}function qo(e,t){return function(n,r){return function(e,t,n,r){return br(e,(function(e,o,i){t(r,n(e),o,i)})),r}(n,e,t(r),{})}}function Wo(e,t){return function(n,r){var i;if(n===o&&r===o)return t;if(n!==o&&(i=n),r!==o){if(i===o)return r;"string"==typeof n||"string"==typeof r?(n=lo(n),r=lo(r)):(n=uo(n),r=uo(r)),i=e(n,r)}return i}}function Vo(e){return oi((function(t){return t=Mt(t,Xt(li())),Yr((function(n){var r=this;return e(t,(function(e){return _t(e,r,n)}))}))}))}function Ko(e,t){var n=(t=t===o?" ":lo(t)).length;if(n<2)return n?Jr(t,e):t;var r=Jr(t,pt(e/pn(t)));return cn(t)?Eo(gn(r),0,e).join(""):r.slice(0,e)}function Go(e){return function(t,n,i){return i&&"number"!=typeof i&&bi(t,n,i)&&(n=i=o),t=ps(t),n===o?(n=t,t=0):n=ps(n),function(e,t,n,o){for(var i=-1,a=wn(pt((t-e)/(n||1)),0),s=r(a);a--;)s[o?a:++i]=e,e+=n;return s}(t,n,i=i===o?t<n?1:-1:ps(i),e)}}function Ho(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ys(t),n=ys(n)),e(t,n)}}function Zo(e,t,n,r,i,a,s,c,d,f){var h=8&t;t|=h?u:l,4&(t&=~(h?l:u))||(t&=-4);var p=[e,t,i,h?a:o,h?s:o,h?o:a,h?o:s,c,d,f],g=n.apply(o,p);return Ei(e)&&Pi(g,p),g.placeholder=r,Oi(g,e,t)}function Jo(e){var t=Te[e];return function(e,n){if(e=ys(e),(n=null==n?0:An(gs(n),292))&&At(e)){var r=(ws(e)+"e").split("e");return+((r=(ws(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Yo=xn&&1/fn(new xn([,-0]))[1]==h?function(e){return new xn(e)}:uc;function Qo(e){return function(t){var n=mi(t);return n==I?un(t):n==R?hn(t):function(e,t){return Mt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Xo(e,t,n,a,h,p,g,m){var y=2&t;if(!y&&"function"!=typeof e)throw new Re(i);var v=a?a.length:0;if(v||(t&=-97,a=h=o),g=g===o?g:wn(gs(g),0),m=m===o?m:gs(m),v-=h?h.length:0,t&l){var w=a,A=h;a=h=o}var b=y?o:si(e),S=[e,t,n,a,h,w,A,p,g,m];if(b&&function(e,t){var n=e[1],r=t[1],o=n|r,i=o<131,a=r==d&&8==n||r==d&&n==f&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!i&&!a)return e;1&r&&(e[2]=t[2],o|=1&n?0:4);var c=t[3];if(c){var u=e[3];e[3]=u?Co(u,c,t[4]):c,e[4]=u?dn(e[3],s):t[4]}(c=t[5])&&(u=e[5],e[5]=u?Ro(u,c,t[6]):c,e[6]=u?dn(e[5],s):t[6]);(c=t[7])&&(e[7]=c);r&d&&(e[8]=null==e[8]?t[8]:An(e[8],t[8]));null==e[9]&&(e[9]=t[9]);e[0]=t[0],e[1]=o}(S,b),e=S[0],t=S[1],n=S[2],a=S[3],h=S[4],!(m=S[9]=S[9]===o?y?0:e.length:wn(S[9]-v,0))&&24&t&&(t&=-25),t&&1!=t)E=8==t||t==c?function(e,t,n){var i=Do(e);return function a(){for(var s=arguments.length,c=r(s),u=s,l=ui(a);u--;)c[u]=arguments[u];var d=s<3&&c[0]!==l&&c[s-1]!==l?[]:dn(c,l);return(s-=d.length)<n?Zo(e,t,$o,a.placeholder,o,c,d,o,o,n-s):_t(this&&this!==gt&&this instanceof a?i:e,this,c)}}(e,t,m):t!=u&&33!=t||h.length?$o.apply(o,S):function(e,t,n,o){var i=1&t,a=Do(e);return function t(){for(var s=-1,c=arguments.length,u=-1,l=o.length,d=r(l+c),f=this&&this!==gt&&this instanceof t?a:e;++u<l;)d[u]=o[u];for(;c--;)d[u++]=arguments[++s];return _t(f,i?n:this,d)}}(e,t,n,a);else var E=function(e,t,n){var r=1&t,o=Do(e);return function t(){return(this&&this!==gt&&this instanceof t?o:e).apply(r?n:this,arguments)}}(e,t,n);return Oi((b?to:Pi)(E,S),e,t)}function ei(e,t,n,r){return e===o||Fa(e,Be[n])&&!ze.call(r,n)?t:e}function ti(e,t,n,r,i,a){return ts(e)&&ts(t)&&(a.set(t,e),qr(e,t,o,ti,a),a.delete(t)),e}function ni(e){return is(e)?o:e}function ri(e,t,n,r,i,a){var s=1&n,c=e.length,u=t.length;if(c!=u&&!(s&&u>c))return!1;var l=a.get(e),d=a.get(t);if(l&&d)return l==t&&d==e;var f=-1,h=!0,p=2&n?new Zn:o;for(a.set(e,t),a.set(t,e);++f<c;){var g=e[f],m=t[f];if(r)var y=s?r(m,g,f,t,e,a):r(g,m,f,e,t,a);if(y!==o){if(y)continue;h=!1;break}if(p){if(!Dt(t,(function(e,t){if(!tn(p,t)&&(g===e||i(g,e,n,r,a)))return p.push(t)}))){h=!1;break}}else if(g!==m&&!i(g,m,n,r,a)){h=!1;break}}return a.delete(e),a.delete(t),h}function oi(e){return Bi(xi(e,o,Ki),e+"")}function ii(e){return Ir(e,Ns,pi)}function ai(e){return Ir(e,Bs,gi)}var si=Pn?function(e){return Pn.get(e)}:uc;function ci(e){for(var t=e.name+"",n=Nn[t],r=ze.call(Nn,t)?n.length:0;r--;){var o=n[r],i=o.func;if(null==i||i==e)return o.name}return t}function ui(e){return(ze.call(Fn,"placeholder")?Fn:e).placeholder}function li(){var e=Fn.iteratee||ic;return e=e===ic?zr:e,arguments.length?e(arguments[0],arguments[1]):e}function di(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function fi(e){for(var t=Ns(e),n=t.length;n--;){var r=t[n],o=e[r];t[n]=[r,o,Ti(o)]}return t}function hi(e,t){var n=function(e,t){return null==e?o:e[t]}(e,t);return Mr(n)?n:o}var pi=yt?function(e){return null==e?[]:(e=_e(e),Nt(yt(e),(function(t){return Ze.call(e,t)})))}:mc,gi=yt?function(e){for(var t=[];e;)zt(t,pi(e)),e=Ge(e);return t}:mc,mi=Tr;function yi(e,t,n){for(var r=-1,o=(t=bo(t,e)).length,i=!1;++r<o;){var a=Ui(t[r]);if(!(i=null!=e&&n(e,a)))break;e=e[a]}return i||++r!=o?i:!!(o=null==e?0:e.length)&&es(o)&&Ai(a,o)&&(Va(e)||Wa(e))}function vi(e){return"function"!=typeof e.constructor||Ii(e)?{}:$n(Ge(e))}function wi(e){return Va(e)||Wa(e)||!!(Ye&&e&&e[Ye])}function Ai(e,t){var n=typeof e;return!!(t=null==t?p:t)&&("number"==n||"symbol"!=n&&Ae.test(e))&&e>-1&&e%1==0&&e<t}function bi(e,t,n){if(!ts(n))return!1;var r=typeof t;return!!("number"==r?Ga(n)&&Ai(t,n.length):"string"==r&&t in n)&&Fa(n[t],e)}function Si(e,t){if(Va(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!us(e))||(ne.test(e)||!te.test(e)||null!=t&&e in _e(t))}function Ei(e){var t=ci(e),n=Fn[t];if("function"!=typeof n||!(t in Vn.prototype))return!1;if(e===n)return!0;var r=si(n);return!!r&&e===r[0]}(In&&mi(new In(new ArrayBuffer(1)))!=M||Tn&&mi(new Tn)!=I||_n&&mi(_n.resolve())!=x||xn&&mi(new xn)!=R||Cn&&mi(new Cn)!=B)&&(mi=function(e){var t=Tr(e),n=t==_?e.constructor:o,r=n?Di(n):"";if(r)switch(r){case Bn:return M;case On:return I;case Mn:return x;case zn:return R;case jn:return B}return t});var ki=Oe?Qa:yc;function Ii(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Be)}function Ti(e){return e==e&&!ts(e)}function _i(e,t){return function(n){return null!=n&&(n[e]===t&&(t!==o||e in _e(n)))}}function xi(e,t,n){return t=wn(t===o?e.length-1:t,0),function(){for(var o=arguments,i=-1,a=wn(o.length-t,0),s=r(a);++i<a;)s[i]=o[t+i];i=-1;for(var c=r(t+1);++i<t;)c[i]=o[i];return c[t]=n(s),_t(e,this,c)}}function Ci(e,t){return t.length<2?e:kr(e,oo(t,0,-1))}function Ri(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Pi=Mi(to),Ni=ht||function(e,t){return gt.setTimeout(e,t)},Bi=Mi(no);function Oi(e,t,n){var r=t+"";return Bi(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ce,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Ct(y,(function(n){var r="_."+n[0];t&n[1]&&!Bt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ue);return t?t[1].split(le):[]}(r),n)))}function Mi(e){var t=0,n=0;return function(){var r=bn(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(o,arguments)}}function zi(e,t){var n=-1,r=e.length,i=r-1;for(t=t===o?r:t;++n<t;){var a=Zr(n,i),s=e[a];e[a]=e[n],e[n]=s}return e.length=t,e}var ji=function(e){var t=Ma(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(re,(function(e,n,r,o){t.push(r?o.replace(he,"$1"):n||e)})),t}));function Ui(e){if("string"==typeof e||us(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Di(e){if(null!=e){try{return Me.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Li(e){if(e instanceof Vn)return e.clone();var t=new Wn(e.__wrapped__,e.__chain__);return t.__actions__=Po(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Fi=Yr((function(e,t){return Ha(e)?fr(e,vr(t,1,Ha,!0)):[]})),$i=Yr((function(e,t){var n=Yi(t);return Ha(n)&&(n=o),Ha(e)?fr(e,vr(t,1,Ha,!0),li(n,2)):[]})),qi=Yr((function(e,t){var n=Yi(t);return Ha(n)&&(n=o),Ha(e)?fr(e,vr(t,1,Ha,!0),o,n):[]}));function Wi(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:gs(n);return o<0&&(o=wn(r+o,0)),$t(e,li(t,3),o)}function Vi(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r-1;return n!==o&&(i=gs(n),i=n<0?wn(r+i,0):An(i,r-1)),$t(e,li(t,3),i,!0)}function Ki(e){return(null==e?0:e.length)?vr(e,1):[]}function Gi(e){return e&&e.length?e[0]:o}var Hi=Yr((function(e){var t=Mt(e,wo);return t.length&&t[0]===e[0]?Rr(t):[]})),Zi=Yr((function(e){var t=Yi(e),n=Mt(e,wo);return t===Yi(n)?t=o:n.pop(),n.length&&n[0]===e[0]?Rr(n,li(t,2)):[]})),Ji=Yr((function(e){var t=Yi(e),n=Mt(e,wo);return(t="function"==typeof t?t:o)&&n.pop(),n.length&&n[0]===e[0]?Rr(n,o,t):[]}));function Yi(e){var t=null==e?0:e.length;return t?e[t-1]:o}var Qi=Yr(Xi);function Xi(e,t){return e&&e.length&&t&&t.length?Gr(e,t):e}var ea=oi((function(e,t){var n=null==e?0:e.length,r=sr(e,t);return Hr(e,Mt(t,(function(e){return Ai(e,n)?+e:e})).sort(xo)),r}));function ta(e){return null==e?e:kn.call(e)}var na=Yr((function(e){return fo(vr(e,1,Ha,!0))})),ra=Yr((function(e){var t=Yi(e);return Ha(t)&&(t=o),fo(vr(e,1,Ha,!0),li(t,2))})),oa=Yr((function(e){var t=Yi(e);return t="function"==typeof t?t:o,fo(vr(e,1,Ha,!0),o,t)}));function ia(e){if(!e||!e.length)return[];var t=0;return e=Nt(e,(function(e){if(Ha(e))return t=wn(e.length,t),!0})),Yt(t,(function(t){return Mt(e,Gt(t))}))}function aa(e,t){if(!e||!e.length)return[];var n=ia(e);return null==t?n:Mt(n,(function(e){return _t(t,o,e)}))}var sa=Yr((function(e,t){return Ha(e)?fr(e,t):[]})),ca=Yr((function(e){return yo(Nt(e,Ha))})),ua=Yr((function(e){var t=Yi(e);return Ha(t)&&(t=o),yo(Nt(e,Ha),li(t,2))})),la=Yr((function(e){var t=Yi(e);return t="function"==typeof t?t:o,yo(Nt(e,Ha),o,t)})),da=Yr(ia);var fa=Yr((function(e){var t=e.length,n=t>1?e[t-1]:o;return n="function"==typeof n?(e.pop(),n):o,aa(e,n)}));function ha(e){var t=Fn(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ga=oi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,i=function(t){return sr(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Vn&&Ai(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[i],thisArg:o}),new Wn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(o),e}))):this.thru(i)}));var ma=Bo((function(e,t,n){ze.call(e,n)?++e[n]:ar(e,n,1)}));var ya=Lo(Wi),va=Lo(Vi);function wa(e,t){return(Va(e)?Ct:hr)(e,li(t,3))}function Aa(e,t){return(Va(e)?Rt:pr)(e,li(t,3))}var ba=Bo((function(e,t,n){ze.call(e,n)?e[n].push(t):ar(e,n,[t])}));var Sa=Yr((function(e,t,n){var o=-1,i="function"==typeof t,a=Ga(e)?r(e.length):[];return hr(e,(function(e){a[++o]=i?_t(t,e,n):Pr(e,t,n)})),a})),Ea=Bo((function(e,t,n){ar(e,n,t)}));function ka(e,t){return(Va(e)?Mt:Lr)(e,li(t,3))}var Ia=Bo((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var Ta=Yr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&bi(e,t[0],t[1])?t=[]:n>2&&bi(t[0],t[1],t[2])&&(t=[t[0]]),Vr(e,vr(t,1),[])})),_a=lt||function(){return gt.Date.now()};function xa(e,t,n){return t=n?o:t,t=e&&null==t?e.length:t,Xo(e,d,o,o,o,o,t)}function Ca(e,t){var n;if("function"!=typeof t)throw new Re(i);return e=gs(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=o),n}}var Ra=Yr((function(e,t,n){var r=1;if(n.length){var o=dn(n,ui(Ra));r|=u}return Xo(e,r,t,n,o)})),Pa=Yr((function(e,t,n){var r=3;if(n.length){var o=dn(n,ui(Pa));r|=u}return Xo(t,r,e,n,o)}));function Na(e,t,n){var r,a,s,c,u,l,d=0,f=!1,h=!1,p=!0;if("function"!=typeof e)throw new Re(i);function g(t){var n=r,i=a;return r=a=o,d=t,c=e.apply(i,n)}function m(e){var n=e-l;return l===o||n>=t||n<0||h&&e-d>=s}function y(){var e=_a();if(m(e))return v(e);u=Ni(y,function(e){var n=t-(e-l);return h?An(n,s-(e-d)):n}(e))}function v(e){return u=o,p&&r?g(e):(r=a=o,c)}function w(){var e=_a(),n=m(e);if(r=arguments,a=this,l=e,n){if(u===o)return function(e){return d=e,u=Ni(y,t),f?g(e):c}(l);if(h)return ko(u),u=Ni(y,t),g(l)}return u===o&&(u=Ni(y,t)),c}return t=ys(t)||0,ts(n)&&(f=!!n.leading,s=(h="maxWait"in n)?wn(ys(n.maxWait)||0,t):s,p="trailing"in n?!!n.trailing:p),w.cancel=function(){u!==o&&ko(u),d=0,r=l=a=u=o},w.flush=function(){return u===o?c:v(_a())},w}var Ba=Yr((function(e,t){return dr(e,1,t)})),Oa=Yr((function(e,t,n){return dr(e,ys(t)||0,n)}));function Ma(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Re(i);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(Ma.Cache||Hn),n}function za(e){if("function"!=typeof e)throw new Re(i);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ma.Cache=Hn;var ja=So((function(e,t){var n=(t=1==t.length&&Va(t[0])?Mt(t[0],Xt(li())):Mt(vr(t,1),Xt(li()))).length;return Yr((function(r){for(var o=-1,i=An(r.length,n);++o<i;)r[o]=t[o].call(this,r[o]);return _t(e,this,r)}))})),Ua=Yr((function(e,t){var n=dn(t,ui(Ua));return Xo(e,u,o,t,n)})),Da=Yr((function(e,t){var n=dn(t,ui(Da));return Xo(e,l,o,t,n)})),La=oi((function(e,t){return Xo(e,f,o,o,o,t)}));function Fa(e,t){return e===t||e!=e&&t!=t}var $a=Ho(_r),qa=Ho((function(e,t){return e>=t})),Wa=Nr(function(){return arguments}())?Nr:function(e){return ns(e)&&ze.call(e,"callee")&&!Ze.call(e,"callee")},Va=r.isArray,Ka=bt?Xt(bt):function(e){return ns(e)&&Tr(e)==O};function Ga(e){return null!=e&&es(e.length)&&!Qa(e)}function Ha(e){return ns(e)&&Ga(e)}var Za=wt||yc,Ja=St?Xt(St):function(e){return ns(e)&&Tr(e)==b};function Ya(e){if(!ns(e))return!1;var t=Tr(e);return t==S||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!is(e)}function Qa(e){if(!ts(e))return!1;var t=Tr(e);return t==E||t==k||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Xa(e){return"number"==typeof e&&e==gs(e)}function es(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=p}function ts(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ns(e){return null!=e&&"object"==typeof e}var rs=Et?Xt(Et):function(e){return ns(e)&&mi(e)==I};function os(e){return"number"==typeof e||ns(e)&&Tr(e)==T}function is(e){if(!ns(e)||Tr(e)!=_)return!1;var t=Ge(e);if(null===t)return!0;var n=ze.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Me.call(n)==Le}var as=kt?Xt(kt):function(e){return ns(e)&&Tr(e)==C};var ss=It?Xt(It):function(e){return ns(e)&&mi(e)==R};function cs(e){return"string"==typeof e||!Va(e)&&ns(e)&&Tr(e)==P}function us(e){return"symbol"==typeof e||ns(e)&&Tr(e)==N}var ls=Tt?Xt(Tt):function(e){return ns(e)&&es(e.length)&&!!ct[Tr(e)]};var ds=Ho(Dr),fs=Ho((function(e,t){return e<=t}));function hs(e){if(!e)return[];if(Ga(e))return cs(e)?gn(e):Po(e);if(Qe&&e[Qe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Qe]());var t=mi(e);return(t==I?un:t==R?fn:Fs)(e)}function ps(e){return e?(e=ys(e))===h||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function gs(e){var t=ps(e),n=t%1;return t==t?n?t-n:t:0}function ms(e){return e?cr(gs(e),0,m):0}function ys(e){if("number"==typeof e)return e;if(us(e))return g;if(ts(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ts(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Qt(e);var n=ye.test(e);return n||we.test(e)?ft(e.slice(2),n?2:8):me.test(e)?g:+e}function vs(e){return No(e,Bs(e))}function ws(e){return null==e?"":lo(e)}var As=Oo((function(e,t){if(Ii(t)||Ga(t))No(t,Ns(t),e);else for(var n in t)ze.call(t,n)&&nr(e,n,t[n])})),bs=Oo((function(e,t){No(t,Bs(t),e)})),Ss=Oo((function(e,t,n,r){No(t,Bs(t),e,r)})),Es=Oo((function(e,t,n,r){No(t,Ns(t),e,r)})),ks=oi(sr);var Is=Yr((function(e,t){e=_e(e);var n=-1,r=t.length,i=r>2?t[2]:o;for(i&&bi(t[0],t[1],i)&&(r=1);++n<r;)for(var a=t[n],s=Bs(a),c=-1,u=s.length;++c<u;){var l=s[c],d=e[l];(d===o||Fa(d,Be[l])&&!ze.call(e,l))&&(e[l]=a[l])}return e})),Ts=Yr((function(e){return e.push(o,ti),_t(Ms,o,e)}));function _s(e,t,n){var r=null==e?o:kr(e,t);return r===o?n:r}function xs(e,t){return null!=e&&yi(e,t,Cr)}var Cs=qo((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),e[t]=n}),tc(oc)),Rs=qo((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),ze.call(e,t)?e[t].push(n):e[t]=[n]}),li),Ps=Yr(Pr);function Ns(e){return Ga(e)?Yn(e):jr(e)}function Bs(e){return Ga(e)?Yn(e,!0):Ur(e)}var Os=Oo((function(e,t,n){qr(e,t,n)})),Ms=Oo((function(e,t,n,r){qr(e,t,n,r)})),zs=oi((function(e,t){var n={};if(null==e)return n;var r=!1;t=Mt(t,(function(t){return t=bo(t,e),r||(r=t.length>1),t})),No(e,ai(e),n),r&&(n=ur(n,7,ni));for(var o=t.length;o--;)ho(n,t[o]);return n}));var js=oi((function(e,t){return null==e?{}:function(e,t){return Kr(e,t,(function(t,n){return xs(e,n)}))}(e,t)}));function Us(e,t){if(null==e)return{};var n=Mt(ai(e),(function(e){return[e]}));return t=li(t),Kr(e,n,(function(e,n){return t(e,n[0])}))}var Ds=Qo(Ns),Ls=Qo(Bs);function Fs(e){return null==e?[]:en(e,Ns(e))}var $s=Uo((function(e,t,n){return t=t.toLowerCase(),e+(n?qs(t):t)}));function qs(e){return Ys(ws(e).toLowerCase())}function Ws(e){return(e=ws(e))&&e.replace(be,on).replace(tt,"")}var Vs=Uo((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Ks=Uo((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Gs=jo("toLowerCase");var Hs=Uo((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var Zs=Uo((function(e,t,n){return e+(n?" ":"")+Ys(t)}));var Js=Uo((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Ys=jo("toUpperCase");function Qs(e,t,n){return e=ws(e),(t=n?o:t)===o?function(e){return it.test(e)}(e)?function(e){return e.match(rt)||[]}(e):function(e){return e.match(de)||[]}(e):e.match(t)||[]}var Xs=Yr((function(e,t){try{return _t(e,o,t)}catch(e){return Ya(e)?e:new ke(e)}})),ec=oi((function(e,t){return Ct(t,(function(t){t=Ui(t),ar(e,t,Ra(e[t],e))})),e}));function tc(e){return function(){return e}}var nc=Fo(),rc=Fo(!0);function oc(e){return e}function ic(e){return zr("function"==typeof e?e:ur(e,1))}var ac=Yr((function(e,t){return function(n){return Pr(n,e,t)}})),sc=Yr((function(e,t){return function(n){return Pr(e,n,t)}}));function cc(e,t,n){var r=Ns(t),o=Er(t,r);null!=n||ts(t)&&(o.length||!r.length)||(n=t,t=e,e=this,o=Er(t,Ns(t)));var i=!(ts(n)&&"chain"in n&&!n.chain),a=Qa(e);return Ct(o,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__);return(n.__actions__=Po(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,zt([this.value()],arguments))})})),e}function uc(){}var lc=Vo(Mt),dc=Vo(Pt),fc=Vo(Dt);function hc(e){return Si(e)?Gt(Ui(e)):function(e){return function(t){return kr(t,e)}}(e)}var pc=Go(),gc=Go(!0);function mc(){return[]}function yc(){return!1}var vc=Wo((function(e,t){return e+t}),0),wc=Jo("ceil"),Ac=Wo((function(e,t){return e/t}),1),bc=Jo("floor");var Sc,Ec=Wo((function(e,t){return e*t}),1),kc=Jo("round"),Ic=Wo((function(e,t){return e-t}),0);return Fn.after=function(e,t){if("function"!=typeof t)throw new Re(i);return e=gs(e),function(){if(--e<1)return t.apply(this,arguments)}},Fn.ary=xa,Fn.assign=As,Fn.assignIn=bs,Fn.assignInWith=Ss,Fn.assignWith=Es,Fn.at=ks,Fn.before=Ca,Fn.bind=Ra,Fn.bindAll=ec,Fn.bindKey=Pa,Fn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Va(e)?e:[e]},Fn.chain=ha,Fn.chunk=function(e,t,n){t=(n?bi(e,t,n):t===o)?1:wn(gs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,s=0,c=r(pt(i/t));a<i;)c[s++]=oo(e,a,a+=t);return c},Fn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,o=[];++t<n;){var i=e[t];i&&(o[r++]=i)}return o},Fn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=r(e-1),n=arguments[0],o=e;o--;)t[o-1]=arguments[o];return zt(Va(n)?Po(n):[n],vr(t,1))},Fn.cond=function(e){var t=null==e?0:e.length,n=li();return e=t?Mt(e,(function(e){if("function"!=typeof e[1])throw new Re(i);return[n(e[0]),e[1]]})):[],Yr((function(n){for(var r=-1;++r<t;){var o=e[r];if(_t(o[0],this,n))return _t(o[1],this,n)}}))},Fn.conforms=function(e){return function(e){var t=Ns(e);return function(n){return lr(n,e,t)}}(ur(e,1))},Fn.constant=tc,Fn.countBy=ma,Fn.create=function(e,t){var n=$n(e);return null==t?n:ir(n,t)},Fn.curry=function e(t,n,r){var i=Xo(t,8,o,o,o,o,o,n=r?o:n);return i.placeholder=e.placeholder,i},Fn.curryRight=function e(t,n,r){var i=Xo(t,c,o,o,o,o,o,n=r?o:n);return i.placeholder=e.placeholder,i},Fn.debounce=Na,Fn.defaults=Is,Fn.defaultsDeep=Ts,Fn.defer=Ba,Fn.delay=Oa,Fn.difference=Fi,Fn.differenceBy=$i,Fn.differenceWith=qi,Fn.drop=function(e,t,n){var r=null==e?0:e.length;return r?oo(e,(t=n||t===o?1:gs(t))<0?0:t,r):[]},Fn.dropRight=function(e,t,n){var r=null==e?0:e.length;return r?oo(e,0,(t=r-(t=n||t===o?1:gs(t)))<0?0:t):[]},Fn.dropRightWhile=function(e,t){return e&&e.length?go(e,li(t,3),!0,!0):[]},Fn.dropWhile=function(e,t){return e&&e.length?go(e,li(t,3),!0):[]},Fn.fill=function(e,t,n,r){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&bi(e,t,n)&&(n=0,r=i),function(e,t,n,r){var i=e.length;for((n=gs(n))<0&&(n=-n>i?0:i+n),(r=r===o||r>i?i:gs(r))<0&&(r+=i),r=n>r?0:ms(r);n<r;)e[n++]=t;return e}(e,t,n,r)):[]},Fn.filter=function(e,t){return(Va(e)?Nt:yr)(e,li(t,3))},Fn.flatMap=function(e,t){return vr(ka(e,t),1)},Fn.flatMapDeep=function(e,t){return vr(ka(e,t),h)},Fn.flatMapDepth=function(e,t,n){return n=n===o?1:gs(n),vr(ka(e,t),n)},Fn.flatten=Ki,Fn.flattenDeep=function(e){return(null==e?0:e.length)?vr(e,h):[]},Fn.flattenDepth=function(e,t){return(null==e?0:e.length)?vr(e,t=t===o?1:gs(t)):[]},Fn.flip=function(e){return Xo(e,512)},Fn.flow=nc,Fn.flowRight=rc,Fn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var o=e[t];r[o[0]]=o[1]}return r},Fn.functions=function(e){return null==e?[]:Er(e,Ns(e))},Fn.functionsIn=function(e){return null==e?[]:Er(e,Bs(e))},Fn.groupBy=ba,Fn.initial=function(e){return(null==e?0:e.length)?oo(e,0,-1):[]},Fn.intersection=Hi,Fn.intersectionBy=Zi,Fn.intersectionWith=Ji,Fn.invert=Cs,Fn.invertBy=Rs,Fn.invokeMap=Sa,Fn.iteratee=ic,Fn.keyBy=Ea,Fn.keys=Ns,Fn.keysIn=Bs,Fn.map=ka,Fn.mapKeys=function(e,t){var n={};return t=li(t,3),br(e,(function(e,r,o){ar(n,t(e,r,o),e)})),n},Fn.mapValues=function(e,t){var n={};return t=li(t,3),br(e,(function(e,r,o){ar(n,r,t(e,r,o))})),n},Fn.matches=function(e){return Fr(ur(e,1))},Fn.matchesProperty=function(e,t){return $r(e,ur(t,1))},Fn.memoize=Ma,Fn.merge=Os,Fn.mergeWith=Ms,Fn.method=ac,Fn.methodOf=sc,Fn.mixin=cc,Fn.negate=za,Fn.nthArg=function(e){return e=gs(e),Yr((function(t){return Wr(t,e)}))},Fn.omit=zs,Fn.omitBy=function(e,t){return Us(e,za(li(t)))},Fn.once=function(e){return Ca(2,e)},Fn.orderBy=function(e,t,n,r){return null==e?[]:(Va(t)||(t=null==t?[]:[t]),Va(n=r?o:n)||(n=null==n?[]:[n]),Vr(e,t,n))},Fn.over=lc,Fn.overArgs=ja,Fn.overEvery=dc,Fn.overSome=fc,Fn.partial=Ua,Fn.partialRight=Da,Fn.partition=Ia,Fn.pick=js,Fn.pickBy=Us,Fn.property=hc,Fn.propertyOf=function(e){return function(t){return null==e?o:kr(e,t)}},Fn.pull=Qi,Fn.pullAll=Xi,Fn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Gr(e,t,li(n,2)):e},Fn.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Gr(e,t,o,n):e},Fn.pullAt=ea,Fn.range=pc,Fn.rangeRight=gc,Fn.rearg=La,Fn.reject=function(e,t){return(Va(e)?Nt:yr)(e,za(li(t,3)))},Fn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,o=[],i=e.length;for(t=li(t,3);++r<i;){var a=e[r];t(a,r,e)&&(n.push(a),o.push(r))}return Hr(e,o),n},Fn.rest=function(e,t){if("function"!=typeof e)throw new Re(i);return Yr(e,t=t===o?t:gs(t))},Fn.reverse=ta,Fn.sampleSize=function(e,t,n){return t=(n?bi(e,t,n):t===o)?1:gs(t),(Va(e)?Xn:Xr)(e,t)},Fn.set=function(e,t,n){return null==e?e:eo(e,t,n)},Fn.setWith=function(e,t,n,r){return r="function"==typeof r?r:o,null==e?e:eo(e,t,n,r)},Fn.shuffle=function(e){return(Va(e)?er:ro)(e)},Fn.slice=function(e,t,n){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&bi(e,t,n)?(t=0,n=r):(t=null==t?0:gs(t),n=n===o?r:gs(n)),oo(e,t,n)):[]},Fn.sortBy=Ta,Fn.sortedUniq=function(e){return e&&e.length?co(e):[]},Fn.sortedUniqBy=function(e,t){return e&&e.length?co(e,li(t,2)):[]},Fn.split=function(e,t,n){return n&&"number"!=typeof n&&bi(e,t,n)&&(t=n=o),(n=n===o?m:n>>>0)?(e=ws(e))&&("string"==typeof t||null!=t&&!as(t))&&!(t=lo(t))&&cn(e)?Eo(gn(e),0,n):e.split(t,n):[]},Fn.spread=function(e,t){if("function"!=typeof e)throw new Re(i);return t=null==t?0:wn(gs(t),0),Yr((function(n){var r=n[t],o=Eo(n,0,t);return r&&zt(o,r),_t(e,this,o)}))},Fn.tail=function(e){var t=null==e?0:e.length;return t?oo(e,1,t):[]},Fn.take=function(e,t,n){return e&&e.length?oo(e,0,(t=n||t===o?1:gs(t))<0?0:t):[]},Fn.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?oo(e,(t=r-(t=n||t===o?1:gs(t)))<0?0:t,r):[]},Fn.takeRightWhile=function(e,t){return e&&e.length?go(e,li(t,3),!1,!0):[]},Fn.takeWhile=function(e,t){return e&&e.length?go(e,li(t,3)):[]},Fn.tap=function(e,t){return t(e),e},Fn.throttle=function(e,t,n){var r=!0,o=!0;if("function"!=typeof e)throw new Re(i);return ts(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),Na(e,t,{leading:r,maxWait:t,trailing:o})},Fn.thru=pa,Fn.toArray=hs,Fn.toPairs=Ds,Fn.toPairsIn=Ls,Fn.toPath=function(e){return Va(e)?Mt(e,Ui):us(e)?[e]:Po(ji(ws(e)))},Fn.toPlainObject=vs,Fn.transform=function(e,t,n){var r=Va(e),o=r||Za(e)||ls(e);if(t=li(t,4),null==n){var i=e&&e.constructor;n=o?r?new i:[]:ts(e)&&Qa(i)?$n(Ge(e)):{}}return(o?Ct:br)(e,(function(e,r,o){return t(n,e,r,o)})),n},Fn.unary=function(e){return xa(e,1)},Fn.union=na,Fn.unionBy=ra,Fn.unionWith=oa,Fn.uniq=function(e){return e&&e.length?fo(e):[]},Fn.uniqBy=function(e,t){return e&&e.length?fo(e,li(t,2)):[]},Fn.uniqWith=function(e,t){return t="function"==typeof t?t:o,e&&e.length?fo(e,o,t):[]},Fn.unset=function(e,t){return null==e||ho(e,t)},Fn.unzip=ia,Fn.unzipWith=aa,Fn.update=function(e,t,n){return null==e?e:po(e,t,Ao(n))},Fn.updateWith=function(e,t,n,r){return r="function"==typeof r?r:o,null==e?e:po(e,t,Ao(n),r)},Fn.values=Fs,Fn.valuesIn=function(e){return null==e?[]:en(e,Bs(e))},Fn.without=sa,Fn.words=Qs,Fn.wrap=function(e,t){return Ua(Ao(t),e)},Fn.xor=ca,Fn.xorBy=ua,Fn.xorWith=la,Fn.zip=da,Fn.zipObject=function(e,t){return vo(e||[],t||[],nr)},Fn.zipObjectDeep=function(e,t){return vo(e||[],t||[],eo)},Fn.zipWith=fa,Fn.entries=Ds,Fn.entriesIn=Ls,Fn.extend=bs,Fn.extendWith=Ss,cc(Fn,Fn),Fn.add=vc,Fn.attempt=Xs,Fn.camelCase=$s,Fn.capitalize=qs,Fn.ceil=wc,Fn.clamp=function(e,t,n){return n===o&&(n=t,t=o),n!==o&&(n=(n=ys(n))==n?n:0),t!==o&&(t=(t=ys(t))==t?t:0),cr(ys(e),t,n)},Fn.clone=function(e){return ur(e,4)},Fn.cloneDeep=function(e){return ur(e,5)},Fn.cloneDeepWith=function(e,t){return ur(e,5,t="function"==typeof t?t:o)},Fn.cloneWith=function(e,t){return ur(e,4,t="function"==typeof t?t:o)},Fn.conformsTo=function(e,t){return null==t||lr(e,t,Ns(t))},Fn.deburr=Ws,Fn.defaultTo=function(e,t){return null==e||e!=e?t:e},Fn.divide=Ac,Fn.endsWith=function(e,t,n){e=ws(e),t=lo(t);var r=e.length,i=n=n===o?r:cr(gs(n),0,r);return(n-=t.length)>=0&&e.slice(n,i)==t},Fn.eq=Fa,Fn.escape=function(e){return(e=ws(e))&&Y.test(e)?e.replace(Z,an):e},Fn.escapeRegExp=function(e){return(e=ws(e))&&ie.test(e)?e.replace(oe,"\\$&"):e},Fn.every=function(e,t,n){var r=Va(e)?Pt:gr;return n&&bi(e,t,n)&&(t=o),r(e,li(t,3))},Fn.find=ya,Fn.findIndex=Wi,Fn.findKey=function(e,t){return Ft(e,li(t,3),br)},Fn.findLast=va,Fn.findLastIndex=Vi,Fn.findLastKey=function(e,t){return Ft(e,li(t,3),Sr)},Fn.floor=bc,Fn.forEach=wa,Fn.forEachRight=Aa,Fn.forIn=function(e,t){return null==e?e:wr(e,li(t,3),Bs)},Fn.forInRight=function(e,t){return null==e?e:Ar(e,li(t,3),Bs)},Fn.forOwn=function(e,t){return e&&br(e,li(t,3))},Fn.forOwnRight=function(e,t){return e&&Sr(e,li(t,3))},Fn.get=_s,Fn.gt=$a,Fn.gte=qa,Fn.has=function(e,t){return null!=e&&yi(e,t,xr)},Fn.hasIn=xs,Fn.head=Gi,Fn.identity=oc,Fn.includes=function(e,t,n,r){e=Ga(e)?e:Fs(e),n=n&&!r?gs(n):0;var o=e.length;return n<0&&(n=wn(o+n,0)),cs(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&qt(e,t,n)>-1},Fn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:gs(n);return o<0&&(o=wn(r+o,0)),qt(e,t,o)},Fn.inRange=function(e,t,n){return t=ps(t),n===o?(n=t,t=0):n=ps(n),function(e,t,n){return e>=An(t,n)&&e<wn(t,n)}(e=ys(e),t,n)},Fn.invoke=Ps,Fn.isArguments=Wa,Fn.isArray=Va,Fn.isArrayBuffer=Ka,Fn.isArrayLike=Ga,Fn.isArrayLikeObject=Ha,Fn.isBoolean=function(e){return!0===e||!1===e||ns(e)&&Tr(e)==A},Fn.isBuffer=Za,Fn.isDate=Ja,Fn.isElement=function(e){return ns(e)&&1===e.nodeType&&!is(e)},Fn.isEmpty=function(e){if(null==e)return!0;if(Ga(e)&&(Va(e)||"string"==typeof e||"function"==typeof e.splice||Za(e)||ls(e)||Wa(e)))return!e.length;var t=mi(e);if(t==I||t==R)return!e.size;if(Ii(e))return!jr(e).length;for(var n in e)if(ze.call(e,n))return!1;return!0},Fn.isEqual=function(e,t){return Br(e,t)},Fn.isEqualWith=function(e,t,n){var r=(n="function"==typeof n?n:o)?n(e,t):o;return r===o?Br(e,t,o,n):!!r},Fn.isError=Ya,Fn.isFinite=function(e){return"number"==typeof e&&At(e)},Fn.isFunction=Qa,Fn.isInteger=Xa,Fn.isLength=es,Fn.isMap=rs,Fn.isMatch=function(e,t){return e===t||Or(e,t,fi(t))},Fn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:o,Or(e,t,fi(t),n)},Fn.isNaN=function(e){return os(e)&&e!=+e},Fn.isNative=function(e){if(ki(e))throw new ke("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Mr(e)},Fn.isNil=function(e){return null==e},Fn.isNull=function(e){return null===e},Fn.isNumber=os,Fn.isObject=ts,Fn.isObjectLike=ns,Fn.isPlainObject=is,Fn.isRegExp=as,Fn.isSafeInteger=function(e){return Xa(e)&&e>=-9007199254740991&&e<=p},Fn.isSet=ss,Fn.isString=cs,Fn.isSymbol=us,Fn.isTypedArray=ls,Fn.isUndefined=function(e){return e===o},Fn.isWeakMap=function(e){return ns(e)&&mi(e)==B},Fn.isWeakSet=function(e){return ns(e)&&"[object WeakSet]"==Tr(e)},Fn.join=function(e,t){return null==e?"":Lt.call(e,t)},Fn.kebabCase=Vs,Fn.last=Yi,Fn.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r;return n!==o&&(i=(i=gs(n))<0?wn(r+i,0):An(i,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,i):$t(e,Vt,i,!0)},Fn.lowerCase=Ks,Fn.lowerFirst=Gs,Fn.lt=ds,Fn.lte=fs,Fn.max=function(e){return e&&e.length?mr(e,oc,_r):o},Fn.maxBy=function(e,t){return e&&e.length?mr(e,li(t,2),_r):o},Fn.mean=function(e){return Kt(e,oc)},Fn.meanBy=function(e,t){return Kt(e,li(t,2))},Fn.min=function(e){return e&&e.length?mr(e,oc,Dr):o},Fn.minBy=function(e,t){return e&&e.length?mr(e,li(t,2),Dr):o},Fn.stubArray=mc,Fn.stubFalse=yc,Fn.stubObject=function(){return{}},Fn.stubString=function(){return""},Fn.stubTrue=function(){return!0},Fn.multiply=Ec,Fn.nth=function(e,t){return e&&e.length?Wr(e,gs(t)):o},Fn.noConflict=function(){return gt._===this&&(gt._=Fe),this},Fn.noop=uc,Fn.now=_a,Fn.pad=function(e,t,n){e=ws(e);var r=(t=gs(t))?pn(e):0;if(!t||r>=t)return e;var o=(t-r)/2;return Ko(mt(o),n)+e+Ko(pt(o),n)},Fn.padEnd=function(e,t,n){e=ws(e);var r=(t=gs(t))?pn(e):0;return t&&r<t?e+Ko(t-r,n):e},Fn.padStart=function(e,t,n){e=ws(e);var r=(t=gs(t))?pn(e):0;return t&&r<t?Ko(t-r,n)+e:e},Fn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),Sn(ws(e).replace(ae,""),t||0)},Fn.random=function(e,t,n){if(n&&"boolean"!=typeof n&&bi(e,t,n)&&(t=n=o),n===o&&("boolean"==typeof t?(n=t,t=o):"boolean"==typeof e&&(n=e,e=o)),e===o&&t===o?(e=0,t=1):(e=ps(e),t===o?(t=e,e=0):t=ps(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var i=En();return An(e+i*(t-e+dt("1e-"+((i+"").length-1))),t)}return Zr(e,t)},Fn.reduce=function(e,t,n){var r=Va(e)?jt:Zt,o=arguments.length<3;return r(e,li(t,4),n,o,hr)},Fn.reduceRight=function(e,t,n){var r=Va(e)?Ut:Zt,o=arguments.length<3;return r(e,li(t,4),n,o,pr)},Fn.repeat=function(e,t,n){return t=(n?bi(e,t,n):t===o)?1:gs(t),Jr(ws(e),t)},Fn.replace=function(){var e=arguments,t=ws(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Fn.result=function(e,t,n){var r=-1,i=(t=bo(t,e)).length;for(i||(i=1,e=o);++r<i;){var a=null==e?o:e[Ui(t[r])];a===o&&(r=i,a=n),e=Qa(a)?a.call(e):a}return e},Fn.round=kc,Fn.runInContext=e,Fn.sample=function(e){return(Va(e)?Qn:Qr)(e)},Fn.size=function(e){if(null==e)return 0;if(Ga(e))return cs(e)?pn(e):e.length;var t=mi(e);return t==I||t==R?e.size:jr(e).length},Fn.snakeCase=Hs,Fn.some=function(e,t,n){var r=Va(e)?Dt:io;return n&&bi(e,t,n)&&(t=o),r(e,li(t,3))},Fn.sortedIndex=function(e,t){return ao(e,t)},Fn.sortedIndexBy=function(e,t,n){return so(e,t,li(n,2))},Fn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ao(e,t);if(r<n&&Fa(e[r],t))return r}return-1},Fn.sortedLastIndex=function(e,t){return ao(e,t,!0)},Fn.sortedLastIndexBy=function(e,t,n){return so(e,t,li(n,2),!0)},Fn.sortedLastIndexOf=function(e,t){if(null==e?0:e.length){var n=ao(e,t,!0)-1;if(Fa(e[n],t))return n}return-1},Fn.startCase=Zs,Fn.startsWith=function(e,t,n){return e=ws(e),n=null==n?0:cr(gs(n),0,e.length),t=lo(t),e.slice(n,n+t.length)==t},Fn.subtract=Ic,Fn.sum=function(e){return e&&e.length?Jt(e,oc):0},Fn.sumBy=function(e,t){return e&&e.length?Jt(e,li(t,2)):0},Fn.template=function(e,t,n){var r=Fn.templateSettings;n&&bi(e,t,n)&&(t=o),e=ws(e),t=Ss({},t,r,ei);var i,a,s=Ss({},t.imports,r.imports,ei),c=Ns(s),u=en(s,c),l=0,d=t.interpolate||Se,f="__p += '",h=xe((t.escape||Se).source+"|"+d.source+"|"+(d===ee?pe:Se).source+"|"+(t.evaluate||Se).source+"|$","g"),p="//# sourceURL="+(ze.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++st+"]")+"\n";e.replace(h,(function(t,n,r,o,s,c){return r||(r=o),f+=e.slice(l,c).replace(Ee,sn),n&&(i=!0,f+="' +\n__e("+n+") +\n'"),s&&(a=!0,f+="';\n"+s+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=c+t.length,t})),f+="';\n";var g=ze.call(t,"variable")&&t.variable;if(g){if(fe.test(g))throw new ke("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(a?f.replace(V,""):f).replace(K,"$1").replace(G,"$1;"),f="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var m=Xs((function(){return Ie(c,p+"return "+f).apply(o,u)}));if(m.source=f,Ya(m))throw m;return m},Fn.times=function(e,t){if((e=gs(e))<1||e>p)return[];var n=m,r=An(e,m);t=li(t),e-=m;for(var o=Yt(r,t);++n<e;)t(n);return o},Fn.toFinite=ps,Fn.toInteger=gs,Fn.toLength=ms,Fn.toLower=function(e){return ws(e).toLowerCase()},Fn.toNumber=ys,Fn.toSafeInteger=function(e){return e?cr(gs(e),-9007199254740991,p):0===e?e:0},Fn.toString=ws,Fn.toUpper=function(e){return ws(e).toUpperCase()},Fn.trim=function(e,t,n){if((e=ws(e))&&(n||t===o))return Qt(e);if(!e||!(t=lo(t)))return e;var r=gn(e),i=gn(t);return Eo(r,nn(r,i),rn(r,i)+1).join("")},Fn.trimEnd=function(e,t,n){if((e=ws(e))&&(n||t===o))return e.slice(0,mn(e)+1);if(!e||!(t=lo(t)))return e;var r=gn(e);return Eo(r,0,rn(r,gn(t))+1).join("")},Fn.trimStart=function(e,t,n){if((e=ws(e))&&(n||t===o))return e.replace(ae,"");if(!e||!(t=lo(t)))return e;var r=gn(e);return Eo(r,nn(r,gn(t))).join("")},Fn.truncate=function(e,t){var n=30,r="...";if(ts(t)){var i="separator"in t?t.separator:i;n="length"in t?gs(t.length):n,r="omission"in t?lo(t.omission):r}var a=(e=ws(e)).length;if(cn(e)){var s=gn(e);a=s.length}if(n>=a)return e;var c=n-pn(r);if(c<1)return r;var u=s?Eo(s,0,c).join(""):e.slice(0,c);if(i===o)return u+r;if(s&&(c+=u.length-c),as(i)){if(e.slice(c).search(i)){var l,d=u;for(i.global||(i=xe(i.source,ws(ge.exec(i))+"g")),i.lastIndex=0;l=i.exec(d);)var f=l.index;u=u.slice(0,f===o?c:f)}}else if(e.indexOf(lo(i),c)!=c){var h=u.lastIndexOf(i);h>-1&&(u=u.slice(0,h))}return u+r},Fn.unescape=function(e){return(e=ws(e))&&J.test(e)?e.replace(H,yn):e},Fn.uniqueId=function(e){var t=++je;return ws(e)+t},Fn.upperCase=Js,Fn.upperFirst=Ys,Fn.each=wa,Fn.eachRight=Aa,Fn.first=Gi,cc(Fn,(Sc={},br(Fn,(function(e,t){ze.call(Fn.prototype,t)||(Sc[t]=e)})),Sc),{chain:!1}),Fn.VERSION="4.17.21",Ct(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Fn[e].placeholder=Fn})),Ct(["drop","take"],(function(e,t){Vn.prototype[e]=function(n){n=n===o?1:wn(gs(n),0);var r=this.__filtered__&&!t?new Vn(this):this.clone();return r.__filtered__?r.__takeCount__=An(n,r.__takeCount__):r.__views__.push({size:An(n,m),type:e+(r.__dir__<0?"Right":"")}),r},Vn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Ct(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Vn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:li(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),Ct(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Vn.prototype[e]=function(){return this[n](1).value()[0]}})),Ct(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Vn.prototype[e]=function(){return this.__filtered__?new Vn(this):this[n](1)}})),Vn.prototype.compact=function(){return this.filter(oc)},Vn.prototype.find=function(e){return this.filter(e).head()},Vn.prototype.findLast=function(e){return this.reverse().find(e)},Vn.prototype.invokeMap=Yr((function(e,t){return"function"==typeof e?new Vn(this):this.map((function(n){return Pr(n,e,t)}))})),Vn.prototype.reject=function(e){return this.filter(za(li(e)))},Vn.prototype.slice=function(e,t){e=gs(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Vn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==o&&(n=(t=gs(t))<0?n.dropRight(-t):n.take(t-e)),n)},Vn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Vn.prototype.toArray=function(){return this.take(m)},br(Vn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),i=Fn[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);i&&(Fn.prototype[t]=function(){var t=this.__wrapped__,s=r?[1]:arguments,c=t instanceof Vn,u=s[0],l=c||Va(t),d=function(e){var t=i.apply(Fn,zt([e],s));return r&&f?t[0]:t};l&&n&&"function"==typeof u&&1!=u.length&&(c=l=!1);var f=this.__chain__,h=!!this.__actions__.length,p=a&&!f,g=c&&!h;if(!a&&l){t=g?t:new Vn(this);var m=e.apply(t,s);return m.__actions__.push({func:pa,args:[d],thisArg:o}),new Wn(m,f)}return p&&g?e.apply(this,s):(m=this.thru(d),p?r?m.value()[0]:m.value():m)})})),Ct(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Pe[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Fn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var o=this.value();return t.apply(Va(o)?o:[],e)}return this[n]((function(n){return t.apply(Va(n)?n:[],e)}))}})),br(Vn.prototype,(function(e,t){var n=Fn[t];if(n){var r=n.name+"";ze.call(Nn,r)||(Nn[r]=[]),Nn[r].push({name:t,func:n})}})),Nn[$o(o,2).name]=[{name:"wrapper",func:o}],Vn.prototype.clone=function(){var e=new Vn(this.__wrapped__);return e.__actions__=Po(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Po(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Po(this.__views__),e},Vn.prototype.reverse=function(){if(this.__filtered__){var e=new Vn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Vn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Va(e),r=t<0,o=n?e.length:0,i=function(e,t,n){var r=-1,o=n.length;for(;++r<o;){var i=n[r],a=i.size;switch(i.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=An(t,e+a);break;case"takeRight":e=wn(e,t-a)}}return{start:e,end:t}}(0,o,this.__views__),a=i.start,s=i.end,c=s-a,u=r?s:a-1,l=this.__iteratees__,d=l.length,f=0,h=An(c,this.__takeCount__);if(!n||!r&&o==c&&h==c)return mo(e,this.__actions__);var p=[];e:for(;c--&&f<h;){for(var g=-1,m=e[u+=t];++g<d;){var y=l[g],v=y.iteratee,w=y.type,A=v(m);if(2==w)m=A;else if(!A){if(1==w)continue e;break e}}p[f++]=m}return p},Fn.prototype.at=ga,Fn.prototype.chain=function(){return ha(this)},Fn.prototype.commit=function(){return new Wn(this.value(),this.__chain__)},Fn.prototype.next=function(){this.__values__===o&&(this.__values__=hs(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?o:this.__values__[this.__index__++]}},Fn.prototype.plant=function(e){for(var t,n=this;n instanceof qn;){var r=Li(n);r.__index__=0,r.__values__=o,t?i.__wrapped__=r:t=r;var i=r;n=n.__wrapped__}return i.__wrapped__=e,t},Fn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Vn){var t=e;return this.__actions__.length&&(t=new Vn(this)),(t=t.reverse()).__actions__.push({func:pa,args:[ta],thisArg:o}),new Wn(t,this.__chain__)}return this.thru(ta)},Fn.prototype.toJSON=Fn.prototype.valueOf=Fn.prototype.value=function(){return mo(this.__wrapped__,this.__actions__)},Fn.prototype.first=Fn.prototype.head,Qe&&(Fn.prototype[Qe]=function(){return this}),Fn}();gt._=vn,(r=function(){return vn}.call(t,n,t,e))===o||(e.exports=r)}.call(this)},5276:(e,t,n)=>{var r=n(4497),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:o.call(t,e)}},5288:(e,t,n)=>{var r=n(358),o=n(7200),i=n(6529);e.exports=function(e){return i(e)?r(e,!0):o(e)}},5353:(e,t,n)=>{var r=n(8638);e.exports=function(e,t,n){return t=n?void 0:t,t=e&&null==t?e.length:t,r(e,128,void 0,void 0,void 0,void 0,t)}},5387:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},5512:(e,t,n)=>{var r=n(4943),o=n(3316)(r);e.exports=o},5568:e=>{e.exports=function(e,t){return e.has(t)}},5620:(e,t,n)=>{var r=n(8788),o=n(9141),i=n(796),a=n(33);e.exports=function(e,t,n){var s=t+"";return i(e,o(s,a(r(s),n)))}},5650:(e,t,n)=>{var r=n(8942).Symbol;e.exports=r},5681:(e,t,n)=>{var r=n(4700);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},5755:e=>{var t=Math.max;e.exports=function(e,n,r,o){for(var i=-1,a=e.length,s=-1,c=r.length,u=-1,l=n.length,d=t(a-c,0),f=Array(d+l),h=!o;++i<d;)f[i]=e[i];for(var p=i;++u<l;)f[p+u]=n[u];for(;++s<c;)(h||i<a)&&(f[p+r[s]]=e[i++]);return f}},5832:(e,t,n)=>{var r=n(1129),o=n(4784),i=n(7979),a=n(9306),s=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)r(t,i(e)),e=o(e);return t}:a;e.exports=s},5853:(e,t,n)=>{e=n.nmd(e);var r=n(8942),o=n(4772),i=t&&!t.nodeType&&t,a=i&&e&&!e.nodeType&&e,s=a&&a.exports===i?r.Buffer:void 0,c=(s?s.isBuffer:void 0)||o;e.exports=c},5857:(e,t,n)=>{var r=n(313);e.exports=function(e){return(null==e?0:e.length)?r(e,1):[]}},5894:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},5899:(e,t,n)=>{var r=n(3526),o=n(3283),i=n(3142),a=n(9632),s=n(5387),c=n(6040);e.exports=function(e,t,n){for(var u=-1,l=(t=r(t,e)).length,d=!1;++u<l;){var f=c(t[u]);if(!(d=null!=e&&n(e,f)))break;e=e[f]}return d||++u!=l?d:!!(l=null==e?0:e.length)&&s(l)&&a(f,l)&&(i(e)||o(e))}},5962:e=>{e.exports=function(){}},5964:(e,t,n)=>{var r=n(9747),o=n(4784),i=n(4882);e.exports=function(e){return"function"!=typeof e.constructor||i(e)?{}:r(o(e))}},6027:(e,t,n)=>{var r=n(7379),o=n(547);e.exports=function(e){return o(e)&&"[object Arguments]"==r(e)}},6040:(e,t,n)=>{var r=n(1187);e.exports=function(e){if("string"==typeof e||r(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t}},6065:(e,t,n)=>{var r=n(9270),o=r&&new r;e.exports=o},6123:(e,t,n)=>{var r=n(7923);e.exports=function(e,t,n){var o=null==e?void 0:r(e,t);return void 0===o?n:o}},6131:(e,t,n)=>{var r=n(6403),o=n(1580),i=n(1187),a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=s.test(e);return n||c.test(e)?u(e.slice(2),n?2:8):a.test(e)?NaN:+e}},6137:e=>{e.exports=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}},6285:e=>{e.exports=function(e,t){return e===t||e!=e&&t!=t}},6341:(e,t,n)=>{var r=n(6912),o=n(4364),i=n(8942);e.exports=function(e,t,n,a){var s=1&t,c=o(e);return function t(){for(var o=-1,u=arguments.length,l=-1,d=a.length,f=Array(d+u),h=this&&this!==i&&this instanceof t?c:e;++l<d;)f[l]=a[l];for(;u--;)f[l++]=arguments[++o];return r(h,s?n:this,f)}}},6403:(e,t,n)=>{var r=n(2945),o=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(o,""):e}},6465:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}},6493:(e,t,n)=>{var r=n(6853),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,a=r((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(o,(function(e,n,r,o){t.push(r?o.replace(i,"$1"):n||e)})),t}));e.exports=a},6526:(e,t,n)=>{var r=n(8330),o=n(4367),i=n(3904);e.exports=function(e){var t=o(e);return 1==t.length&&t[0][2]?i(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},6529:(e,t,n)=>{var r=n(3655),o=n(5387);e.exports=function(e){return null!=e&&o(e.length)&&!r(e)}},6591:(e,t,n)=>{var r=n(4354),o=n(9632),i=Math.min;e.exports=function(e,t){for(var n=e.length,a=i(t.length,n),s=r(e);a--;){var c=t[a];e[a]=o(c,n)?s[c]:void 0}return e}},6638:(e,t,n)=>{var r=n(1386),o=n(9770),i=n(8250);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var a=n.__data__;if(!o||a.length<199)return a.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(a)}return n.set(e,t),this.size=n.size,this}},6648:(e,t,n)=>{var r=n(7553),o=n(5196),i=n(961),a=n(3321);e.exports=function(e){var t=i(e),n=a[t];if("function"!=typeof n||!(t in r.prototype))return!1;if(e===n)return!0;var s=o(n);return!!s&&e===s[0]}},6713:(e,t,n)=>{var r=n(4364),o=n(8942);e.exports=function(e,t,n){var i=1&t,a=r(e);return function t(){return(this&&this!==o&&this instanceof t?a:e).apply(i?n:this,arguments)}}},6850:e=>{e.exports=function(e){return e.placeholder}},6853:(e,t,n)=>{var r=n(9011);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},6912:e=>{e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},7028:(e,t,n)=>{var r=n(4977),o=n(5755),i=n(8813),a="__lodash_placeholder__",s=128,c=Math.min;e.exports=function(e,t){var n=e[1],u=t[1],l=n|u,d=l<131,f=u==s&&8==n||u==s&&256==n&&e[7].length<=t[8]||384==u&&t[7].length<=t[8]&&8==n;if(!d&&!f)return e;1&u&&(e[2]=t[2],l|=1&n?0:4);var h=t[3];if(h){var p=e[3];e[3]=p?r(p,h,t[4]):h,e[4]=p?i(e[3],a):t[4]}return(h=t[5])&&(p=e[5],e[5]=p?o(p,h,t[6]):h,e[6]=p?i(e[5],a):t[6]),(h=t[7])&&(e[7]=h),u&s&&(e[8]=null==e[8]?t[8]:c(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=l,e}},7034:(e,t,n)=>{var r=n(6285);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},7073:(e,t,n)=>{var r=n(2532);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},7099:(e,t,n)=>{e=n.nmd(e);var r=n(8942),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o?r.Buffer:void 0,s=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=s?s(n):new e.constructor(n);return e.copy(r),r}},7144:(e,t,n)=>{var r=n(7034);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},7200:(e,t,n)=>{var r=n(1580),o=n(4882),i=n(8546),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return i(e);var t=o(e),n=[];for(var s in e)("constructor"!=s||!t&&a.call(e,s))&&n.push(s);return n}},7250:e=>{e.exports=function(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}},7267:(e,t,n)=>{var r=n(1580);e.exports=function(e){return e==e&&!r(e)}},7276:(e,t,n)=>{var r=n(3636),o=n(5899);e.exports=function(e,t){return null!=e&&o(e,t,r)}},7336:(e,t,n)=>{var r=n(8638);function o(e,t,n){var i=r(e,8,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return i.placeholder=o.placeholder,i}o.placeholder={},e.exports=o},7350:e=>{var t=Object.prototype.hasOwnProperty;e.exports=function(e){var n=e.length,r=new e.constructor(n);return n&&"string"==typeof e[0]&&t.call(e,"index")&&(r.index=e.index,r.input=e.input),r}},7379:(e,t,n)=>{var r=n(5650),o=n(8870),i=n(9005),a=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?o(e):i(e)}},7403:(e,t,n)=>{var r=n(2619),o=n(2532),i=n(2053),a=o?function(e,t){return o(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:i;e.exports=a},7452:(e,t,n)=>{var r=n(7034);e.exports=function(e){return r(this.__data__,e)>-1}},7462:e=>{e.exports=function(e){return this.__data__.has(e)}},7553:(e,t,n)=>{var r=n(9747),o=n(5962);function i(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}i.prototype=r(o.prototype),i.prototype.constructor=i,e.exports=i},7642:(e,t,n)=>{var r=n(3301);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},7681:(e,t,n)=>{var r=n(777),o=n(9460),i=n(2306),a=i&&i.isMap,s=a?o(a):r;e.exports=s},7706:e=>{e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}},7769:(e,t,n)=>{var r=n(8486),o=n(547);e.exports=function(e){return o(e)&&"[object WeakMap]"==r(e)}},7923:(e,t,n)=>{var r=n(3526),o=n(6040);e.exports=function(e,t){for(var n=0,i=(t=r(t,e)).length;null!=e&&n<i;)e=e[o(t[n++])];return n&&n==i?e:void 0}},7930:(e,t,n)=>{var r=n(9032),o=n(1211);e.exports=function(e,t){return e&&r(t,o(t),e)}},7979:(e,t,n)=>{var r=n(9847),o=n(9306),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols,s=a?function(e){return null==e?[]:(e=Object(e),r(a(e),(function(t){return i.call(e,t)})))}:o;e.exports=s},7991:(e,t)=>{"use strict";t.byteLength=function(e){var t=s(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,i=s(e),a=i[0],c=i[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,a,c)),l=0,d=c>0?a-4:a;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===c&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],a=16383,s=0,u=r-o;s<u;s+=a)i.push(c(e,s,s+a>u?u:s+a));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=i[a],r[i.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,r){for(var o,i,a=[],s=t;s<r;s+=3)o=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},8006:e=>{e.exports=function(e){return this.__data__.has(e)}},8055:(e,t,n)=>{e.exports={ary:n(5353),assign:n(7930),clone:n(2846),curry:n(7336),forEach:n(9968),isArray:n(3142),isError:n(441),isFunction:n(3655),isWeakMap:n(7769),iteratee:n(2590),keys:n(195),rearg:n(864),toInteger:n(7642),toPath:n(2613)}},8069:(e,t,n)=>{var r=n(5650),o=r?r.prototype:void 0,i=o?o.valueOf:void 0;e.exports=function(e){return i?Object(i.call(e)):{}}},8121:(e,t,n)=>{var r=n(3766)(Object.keys,Object);e.exports=r},8244:(e,t,n)=>{var r=n(1129),o=n(3142);e.exports=function(e,t,n){var i=t(e);return o(e)?i:r(i,n(e))}},8250:(e,t,n)=>{var r=n(9753),o=n(5681),i=n(88),a=n(4732),s=n(9068);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=a,c.prototype.set=s,e.exports=c},8330:(e,t,n)=>{var r=n(1340),o=n(4687);e.exports=function(e,t,n,i){var a=n.length,s=a,c=!i;if(null==e)return!s;for(e=Object(e);a--;){var u=n[a];if(c&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++a<s;){var l=(u=n[a])[0],d=e[l],f=u[1];if(c&&u[2]){if(void 0===d&&!(l in e))return!1}else{var h=new r;if(i)var p=i(d,f,l,e,t,h);if(!(void 0===p?o(f,d,3,i,h):p))return!1}}return!0}},8340:e=>{var t=/\w*$/;e.exports=function(e){var n=new e.constructor(e.source,t.exec(e));return n.lastIndex=e.lastIndex,n}},8360:(e,t,n)=>{var r=n(7379),o=n(4784),i=n(547),a=Function.prototype,s=Object.prototype,c=a.toString,u=s.hasOwnProperty,l=c.call(Object);e.exports=function(e){if(!i(e)||"[object Object]"!=r(e))return!1;var t=o(e);if(null===t)return!0;var n=u.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==l}},8486:(e,t,n)=>{var r=n(3103),o=n(9770),i=n(9413),a=n(4512),s=n(9270),c=n(7379),u=n(4066),l="[object Map]",d="[object Promise]",f="[object Set]",h="[object WeakMap]",p="[object DataView]",g=u(r),m=u(o),y=u(i),v=u(a),w=u(s),A=c;(r&&A(new r(new ArrayBuffer(1)))!=p||o&&A(new o)!=l||i&&A(i.resolve())!=d||a&&A(new a)!=f||s&&A(new s)!=h)&&(A=function(e){var t=c(e),n="[object Object]"==t?e.constructor:void 0,r=n?u(n):"";if(r)switch(r){case g:return p;case m:return l;case y:return d;case v:return f;case w:return h}return t}),e.exports=A},8546:e=>{e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},8638:(e,t,n)=>{var r=n(4943),o=n(6713),i=n(2443),a=n(3504),s=n(6341),c=n(5196),u=n(7028),l=n(5512),d=n(5620),f=n(7642),h=Math.max;e.exports=function(e,t,n,p,g,m,y,v){var w=2&t;if(!w&&"function"!=typeof e)throw new TypeError("Expected a function");var A=p?p.length:0;if(A||(t&=-97,p=g=void 0),y=void 0===y?y:h(f(y),0),v=void 0===v?v:f(v),A-=g?g.length:0,64&t){var b=p,S=g;p=g=void 0}var E=w?void 0:c(e),k=[e,t,n,p,g,b,S,m,y,v];if(E&&u(k,E),e=k[0],t=k[1],n=k[2],p=k[3],g=k[4],!(v=k[9]=void 0===k[9]?w?0:e.length:h(k[9]-A,0))&&24&t&&(t&=-25),t&&1!=t)I=8==t||16==t?i(e,t,v):32!=t&&33!=t||g.length?a.apply(void 0,k):s(e,t,n,p);else var I=o(e,t,n);return d((E?r:l)(I,k),e,t)}},8666:(e,t,n)=>{var r=n(674),o=n(9460),i=n(2306),a=i&&i.isTypedArray,s=a?o(a):r;e.exports=s},8788:e=>{var t=/\{\n\/\* \[wrapped with (.+)\] \*/,n=/,? & /;e.exports=function(e){var r=e.match(t);return r?r[1].split(n):[]}},8813:e=>{var t="__lodash_placeholder__";e.exports=function(e,n){for(var r=-1,o=e.length,i=0,a=[];++r<o;){var s=e[r];s!==n&&s!==t||(e[r]=t,a[i++]=r)}return a}},8861:(e,t,n)=>{var r=n(5650),o=n(1623),i=n(6285),a=n(3934),s=n(5894),c=n(9828),u=r?r.prototype:void 0,l=u?u.valueOf:void 0;e.exports=function(e,t,n,r,u,d,f){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!d(new o(e),new o(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var h=s;case"[object Set]":var p=1&r;if(h||(h=c),e.size!=t.size&&!p)return!1;var g=f.get(e);if(g)return g==t;r|=2,f.set(e,t);var m=a(h(e),h(t),r,u,d,f);return f.delete(e),m;case"[object Symbol]":if(l)return l.call(e)==l.call(t)}return!1}},8870:(e,t,n)=>{var r=n(5650),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,s=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(e){}var o=a.call(e);return r&&(t?e[s]=n:delete e[s]),o}},8880:(e,t,n)=>{var r=n(7923);e.exports=function(e){return function(t){return r(t,e)}}},8898:(e,t,n)=>{var r=n(1623);e.exports=function(e){var t=new e.constructor(e.byteLength);return new r(t).set(new r(e)),t}},8942:(e,t,n)=>{var r=n(4967),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},9005:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},9011:(e,t,n)=>{var r=n(8250);function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},9032:(e,t,n)=>{var r=n(3422),o=n(7073);e.exports=function(e,t,n,i){var a=!n;n||(n={});for(var s=-1,c=t.length;++s<c;){var u=t[s],l=i?i(n[u],e[u],u,n,e):void 0;void 0===l&&(l=e[u]),a?o(n,u,l):r(n,u,l)}return n}},9067:e=>{e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},9068:(e,t,n)=>{var r=n(4700);e.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}},9071:e=>{e.exports=function(){}},9141:e=>{var t=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;e.exports=function(e,n){var r=n.length;if(!r)return e;var o=r-1;return n[o]=(r>1?"& ":"")+n[o],n=n.join(r>2?", ":" "),e.replace(t,"{\n/* [wrapped with "+n+"] */\n")}},9270:(e,t,n)=>{var r=n(4715)(n(8942),"WeakMap");e.exports=r},9306:e=>{e.exports=function(){return[]}},9318:(e,t)=>{t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,c=(1<<s)-1,u=c>>1,l=-7,d=n?o-1:0,f=n?-1:1,h=e[t+d];for(d+=f,i=h&(1<<-l)-1,h>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=f,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=f,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),i-=u}return(h?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,c,u=8*i-o-1,l=(1<<u)-1,d=l>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+h]=255&s,h+=p,s/=256,o-=8);for(a=a<<o|s,u+=o;u>0;e[n+h]=255&a,h+=p,a/=256,u-=8);e[n+h-p]|=128*g}},9334:(e,t,n)=>{var r=n(1340),o=n(9968),i=n(3422),a=n(7930),s=n(125),c=n(7099),u=n(4354),l=n(3546),d=n(4733),f=n(393),h=n(3650),p=n(8486),g=n(7350),m=n(424),y=n(5964),v=n(3142),w=n(5853),A=n(7681),b=n(1580),S=n(3943),E=n(1211),k=n(5288),I="[object Arguments]",T="[object Function]",_="[object Object]",x={};x[I]=x["[object Array]"]=x["[object ArrayBuffer]"]=x["[object DataView]"]=x["[object Boolean]"]=x["[object Date]"]=x["[object Float32Array]"]=x["[object Float64Array]"]=x["[object Int8Array]"]=x["[object Int16Array]"]=x["[object Int32Array]"]=x["[object Map]"]=x["[object Number]"]=x[_]=x["[object RegExp]"]=x["[object Set]"]=x["[object String]"]=x["[object Symbol]"]=x["[object Uint8Array]"]=x["[object Uint8ClampedArray]"]=x["[object Uint16Array]"]=x["[object Uint32Array]"]=!0,x["[object Error]"]=x[T]=x["[object WeakMap]"]=!1,e.exports=function e(t,n,C,R,P,N){var B,O=1&n,M=2&n,z=4&n;if(C&&(B=P?C(t,R,P,N):C(t)),void 0!==B)return B;if(!b(t))return t;var j=v(t);if(j){if(B=g(t),!O)return u(t,B)}else{var U=p(t),D=U==T||"[object GeneratorFunction]"==U;if(w(t))return c(t,O);if(U==_||U==I||D&&!P){if(B=M||D?{}:y(t),!O)return M?d(t,s(B,t)):l(t,a(B,t))}else{if(!x[U])return P?t:{};B=m(t,U,O)}}N||(N=new r);var L=N.get(t);if(L)return L;N.set(t,B),S(t)?t.forEach((function(r){B.add(e(r,n,C,r,t,N))})):A(t)&&t.forEach((function(r,o){B.set(o,e(r,n,C,o,t,N))}));var F=j?void 0:(z?M?h:f:M?k:E)(t);return o(F||t,(function(r,o){F&&(r=t[o=r]),i(B,o,e(r,n,C,o,t,N))})),B}},9361:e=>{e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},9413:(e,t,n)=>{var r=n(4715)(n(8942),"Promise");e.exports=r},9454:e=>{e.exports=function(e){return e!=e}},9460:e=>{e.exports=function(e){return function(t){return e(t)}}},9624:(e,t,n)=>{var r=n(3655),o=n(4759),i=n(1580),a=n(4066),s=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,l=c.toString,d=u.hasOwnProperty,f=RegExp("^"+l.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||o(e))&&(r(e)?f:s).test(a(e))}},9632:e=>{var t=/^(?:0|[1-9]\d*)$/;e.exports=function(e,n){var r=typeof e;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&t.test(e))&&e>-1&&e%1==0&&e<n}},9747:(e,t,n)=>{var r=n(1580),o=Object.create,i=function(){function e(){}return function(t){if(!r(t))return{};if(o)return o(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();e.exports=i},9753:(e,t,n)=>{var r=n(5098),o=n(1386),i=n(9770);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||o),string:new r}}},9756:(e,t,n)=>{var r=n(2478);e.exports=function(e,t){return!!(null==e?0:e.length)&&r(e,t,0)>-1}},9770:(e,t,n)=>{var r=n(4715)(n(8942),"Map");e.exports=r},9828:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}},9847:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var a=e[n];t(a,n,e)&&(i[o++]=a)}return i}},9968:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";n.r(r),n.d(r,{onActive:()=>hI,onAssetHistoricalPrice:()=>sI,onAssetsConversion:()=>iI,onAssetsLookup:()=>oI,onAssetsMarketData:()=>mI,onClientRequest:()=>cI,onCronjob:()=>rI,onInactive:()=>pI,onInstall:()=>fI,onKeyringRequest:()=>tI,onNameLookup:()=>gI,onProtocolRequest:()=>aI,onRpcRequest:()=>eI,onStart:()=>lI,onUpdate:()=>dI,onUserInput:()=>nI,onWebSocketEvent:()=>uI});var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)},t="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";(()=>{const e=Array(256).fill(-1);for(let n=0;n<58;++n)e[t.charCodeAt(n)]=n})();var o,i,a=e=>{if(!e||"string"!=typeof e)throw new Error(`Expected base58 string but got “${e}”`);if(e.match(/[IOl0]/gmu))throw new Error(`Invalid base58 character “${e.match(/[IOl0]/gmu)}”`);const n=e.match(/^1+/gmu),r=n?n[0].length:0,o=(e.length-r)*(Math.log(58)/Math.log(256))+1>>>0;return new Uint8Array([...new Uint8Array(r),...e.match(/.{1}/gmu).map((e=>t.indexOf(e))).reduce(((e,t)=>e.map((e=>{const n=58*e+t;return t=n>>8,n}))),new Uint8Array(o)).reverse().filter((i=!1,e=>i=i||e))]);var i},s=(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.bech32m=t.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",r={};for(let e=0;e<32;e++){const t=n.charAt(e);r[t]=e}function o(e){const t=e>>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function i(e){let t=1;for(let n=0;n<e.length;++n){const r=e.charCodeAt(n);if(r<33||r>126)return"Invalid prefix ("+e+")";t=o(t)^r>>5}t=o(t);for(let n=0;n<e.length;++n){const r=e.charCodeAt(n);t=o(t)^31&r}return t}function a(e,t,n,r){let o=0,i=0;const a=(1<<n)-1,s=[];for(let r=0;r<e.length;++r)for(o=o<<t|e[r],i+=t;i>=n;)i-=n,s.push(o>>i&a);if(r)i>0&&s.push(o<<n-i&a);else{if(i>=t)return"Excess padding";if(o<<n-i&a)return"Non-zero padding"}return s}function s(e){return a(e,8,5,!0)}function c(e){const t=a(e,5,8,!1);if(Array.isArray(t))return t}function u(e){const t=a(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function l(e){let t;function a(e,n){if(n=n||90,e.length<8)return e+" too short";if(e.length>n)return"Exceeds length limit";const a=e.toLowerCase(),s=e.toUpperCase();if(e!==a&&e!==s)return"Mixed-case string "+e;const c=(e=a).lastIndexOf("1");if(-1===c)return"No separator character for "+e;if(0===c)return"Missing prefix for "+e;const u=e.slice(0,c),l=e.slice(c+1);if(l.length<6)return"Data too short";let d=i(u);if("string"==typeof d)return d;const f=[];for(let e=0;e<l.length;++e){const t=l.charAt(e),n=r[t];if(void 0===n)return"Unknown character "+t;d=o(d)^n,e+6>=l.length||f.push(n)}return d!==t?"Invalid checksum for "+e:{prefix:u,words:f}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){const n=a(e,t);if("object"==typeof n)return n},decode:function(e,t){const n=a(e,t);if("object"==typeof n)return n;throw new Error(n)},encode:function(e,r,a){if(a=a||90,e.length+7+r.length>a)throw new TypeError("Exceeds length limit");let s=i(e=e.toLowerCase());if("string"==typeof s)throw new Error(s);let c=e+"1";for(let e=0;e<r.length;++e){const t=r[e];if(t>>5!=0)throw new Error("Non 5-bit word");s=o(s)^t,c+=n.charAt(t)}for(let e=0;e<6;++e)s=o(s);s^=t;for(let e=0;e<6;++e)c+=n.charAt(s>>5*(5-e)&31);return c},toWords:s,fromWordsUnsafe:c,fromWords:u}}t.bech32=l("bech32"),t.bech32m=l("bech32m")}(o={exports:{}},o.exports),o.exports);(i=s)&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")&&i.default;var c=s.bech32m,u=s.bech32;const l=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998];class d{constructor(){this.A=1779033703,this.B=-1150833019,this.C=1013904242,this.D=-1521486534,this.E=1359893119,this.F=-1694144372,this.G=528734635,this.H=1541459225,this._size=0,this._sp=0,(!h||p>=8e3)&&(h=new ArrayBuffer(8e3),p=0),this._byte=new Uint8Array(h,p,80),this._word=new Int32Array(h,p,20),p+=80}update(e){if("string"==typeof e)return this._utf8(e);if(null==e)throw new TypeError("Invalid type: "+typeof e);const t=e.byteOffset,n=e.byteLength;let r=n/64|0,o=0;if(r&&!(3&t)&&!(this._size%64)){const n=new Int32Array(e.buffer,t,16*r);for(;r--;)this._int32(n,o>>2),o+=64;this._size+=o}if(1!==e.BYTES_PER_ELEMENT&&e.buffer){const r=new Uint8Array(e.buffer,t+o,n-o);return this._uint8(r)}return o===n?this:this._uint8(e,o)}_uint8(e,t){const{_byte:n,_word:r}=this,o=e.length;for(t|=0;t<o;){const i=this._size%64;let a=i;for(;t<o&&a<64;)n[a++]=e[t++];a>=64&&this._int32(r),this._size+=a-i}return this}_utf8(e){const{_byte:t,_word:n}=this,r=e.length;let o=this._sp;for(let i=0;i<r;){const a=this._size%64;let s=a;for(;i<r&&s<64;){let n=0|e.charCodeAt(i++);n<128?t[s++]=n:n<2048?(t[s++]=192|n>>>6,t[s++]=128|63&n):n<55296||n>57343?(t[s++]=224|n>>>12,t[s++]=128|n>>>6&63,t[s++]=128|63&n):o?(n=((1023&o)<<10)+(1023&n)+65536,t[s++]=240|n>>>18,t[s++]=128|n>>>12&63,t[s++]=128|n>>>6&63,t[s++]=128|63&n,o=0):o=n}s>=64&&(this._int32(n),n[0]=n[16]),this._size+=s-a}return this._sp=o,this}_int32(e,t){let{A:n,B:r,C:o,D:i,E:a,F:s,G:c,H:u}=this,d=0;for(t|=0;d<16;)f[d++]=m(e[t++]);for(d=16;d<64;d++)f[d]=S(f[d-2])+f[d-7]+b(f[d-15])+f[d-16]|0;for(d=0;d<64;d++){const e=u+A(a)+y(a,s,c)+l[d]+f[d]|0,t=w(n)+v(n,r,o)|0;u=c,c=s,s=a,a=i+e|0,i=o,o=r,r=n,n=e+t|0}this.A=n+this.A|0,this.B=r+this.B|0,this.C=o+this.C|0,this.D=i+this.D|0,this.E=a+this.E|0,this.F=s+this.F|0,this.G=c+this.G|0,this.H=u+this.H|0}digest(e){const{_byte:t,_word:n}=this;let r=this._size%64|0;for(t[r++]=128;3&r;)t[r++]=0;if(r>>=2,r>14){for(;r<16;)n[r++]=0;r=0,this._int32(n)}for(;r<16;)n[r++]=0;const o=8*this._size,i=(4294967295&o)>>>0,a=(o-i)/4294967296;return a&&(n[14]=m(a)),i&&(n[15]=m(i)),this._int32(n),"hex"===e?this._hex():this._bin()}_hex(){const{A:e,B:t,C:n,D:r,E:o,F:i,G:a,H:s}=this;return g(e)+g(t)+g(n)+g(r)+g(o)+g(i)+g(a)+g(s)}_bin(){const{A:e,B:t,C:n,D:r,E:o,F:i,G:a,H:s,_byte:c,_word:u}=this;return u[0]=m(e),u[1]=m(t),u[2]=m(n),u[3]=m(r),u[4]=m(o),u[5]=m(i),u[6]=m(a),u[7]=m(s),c.slice(0,32)}}const f=new Int32Array(64);let h,p=0;const g=e=>(e+4294967296).toString(16).substr(-8),m=254===new Uint8Array(new Uint16Array([65279]).buffer)[0]?e=>e:e=>e<<24&4278190080|e<<8&16711680|e>>8&65280|e>>24&255,y=(e,t,n)=>n^e&(t^n),v=(e,t,n)=>e&t|n&(e|t),w=e=>(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),A=e=>(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7),b=e=>(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3,S=e=>(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10;var E,k,I=function(e){return(new d).update(e).digest()};!function(e){e.mainnet="mainnet",e.testnet="testnet",e.regtest="regtest"}(E||(E={})),function(e){e.p2pkh="p2pkh",e.p2sh="p2sh",e.p2wpkh="p2wpkh",e.p2wsh="p2wsh",e.p2tr="p2tr"}(k||(k={}));var T={0:{type:k.p2pkh,network:E.mainnet},111:{type:k.p2pkh,network:E.testnet},5:{type:k.p2sh,network:E.mainnet},196:{type:k.p2sh,network:E.testnet}},_=function(t){var n,r=t.substr(0,2).toLowerCase();if("bc"===r||"tb"===r)return function(e){var t;try{t=e.startsWith("bc1p")||e.startsWith("tb1p")||e.startsWith("bcrt1p")?c.decode(e):u.decode(e)}catch(e){throw new Error("Invalid address")}var n={bc:E.mainnet,tb:E.testnet,bcrt:E.regtest}[t.prefix];if(void 0===n)throw new Error("Invalid address");var r=t.words[0];if(r<0||r>16)throw new Error("Invalid address");return{bech32:!0,network:n,address:e,type:20===u.fromWords(t.words.slice(1)).length?k.p2wpkh:1===r?k.p2tr:k.p2wsh}}(t);try{n=a(t)}catch(e){throw new Error("Invalid address")}var o=n.length;if(25!==o)throw new Error("Invalid address");var i=n[0],s=n.slice(o-4,o),l=n.slice(0,o-4),d=I(I(l)).slice(0,4);if(s.some((function(e,t){return e!==d[t]})))throw new Error("Invalid address");if(!Object.keys(T).map(Number).includes(i))throw new Error("Invalid address");return e(e({},T[i]),{address:t,bech32:!1})};class x extends TypeError{constructor(e,t){let n;const{message:r,explanation:o,...i}=e,{path:a}=e,s=0===a.length?r:`At path: ${a.join(".")} -- ${r}`;super(o??s),null!=o&&(this.cause=s),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function C(e){return"object"==typeof e&&null!==e}function R(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function P(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:o,branch:i}=t,{type:a}=n,{refinement:s,message:c=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${R(r)}\``}=e;return{value:r,type:a,refinement:s,key:o[o.length-1],path:o,branch:i,...e,message:c}}function*N(e,t,n,r){(function(e){return C(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const o of e){const e=P(o,t,n,r);e&&(yield e)}}function*B(e,t,n={}){const{path:r=[],branch:o=[e],coerce:i=!1,mask:a=!1}=n,s={path:r,branch:o};if(i&&(e=t.coercer(e,s),a&&"type"!==t.type&&C(t.schema)&&C(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let c="valid";for(const r of t.validator(e,s))r.explanation=n.message,c="not_valid",yield[r,void 0];for(let[u,l,d]of t.entries(e,s)){const t=B(l,d,{path:void 0===u?r:[...r,u],branch:void 0===u?o:[...o,l],coerce:i,mask:a,message:n.message});for(const n of t)n[0]?(c=null===n[0].refinement||void 0===n[0].refinement?"not_valid":"not_refined",yield[n[0],void 0]):i&&(l=n[1],void 0===u?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):C(e)&&(void 0!==l||u in e)&&(e[u]=l))}if("not_valid"!==c)for(const r of t.refiner(e,s))r.explanation=n.message,c="not_refined",yield[r,void 0];"valid"===c&&(yield[void 0,e])}class O{constructor(e){const{type:t,schema:n,validator:r,refiner:o,coercer:i=(e=>e),entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=i,this.validator=r?(e,t)=>N(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>N(o(e,t),t,this,e):()=>[]}assert(e,t){return M(e,this,t)}create(e,t){return z(e,this,t)}is(e){return j(e,this)}mask(e,t){return function(e,t,n){const r=U(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return U(e,this,t)}}function M(e,t,n){const r=U(e,t,{message:n});if(r[0])throw r[0]}function z(e,t,n){const r=U(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function j(e,t){return!U(e,t)[0]}function U(e,t,n={}){const r=B(e,t,n),o=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(o[0]){return[new x(o[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]}return[void 0,o[1]]}function D(e,t){return new O({type:e,schema:null,validator:t})}function L(e,t){return D(e,(e=>"string"==typeof e&&t.test(e)))}const F=L("UuidV4",/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu),$=F,q=D("Url",(e=>{try{const t=new URL(e);return"http:"===t.protocol||"https:"===t.protocol}catch{return!1}})),W=L("StringNumber",/^\d+(\.\d+)?$/u);function V(){return D("any",(()=>!0))}function K(e){return new O({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${R(e)}`})}function G(){return D("boolean",(e=>"boolean"==typeof e))}function H(e){const t={},n=e.map((e=>R(e))).join();for(const n of e)t[n]=n;return new O({type:"enums",schema:t,validator:t=>e.includes(t)||`Expected one of \`${n}\`, but received: ${R(t)}`})}function Z(){return D("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${R(e)}`))}function J(e){const t=R(e),n=typeof e;return new O({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${R(n)}`})}function Y(){return D("never",(()=>!1))}function Q(e){return new O({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function X(){return D("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${R(e)}`))}function ee(e){const t=e?Object.keys(e):[],n=Y();return new O({type:"object",schema:e??null,*entries(r){if(e&&C(r)){const o=new Set(Object.keys(r));for(const n of t)o.delete(n),yield[n,r[n],e[n]];for(const e of o)yield[e,r[e],n]}},validator:e=>C(e)||`Expected an object, but received: ${R(e)}`,coercer:e=>C(e)?{...e}:e})}function te(e){return new O({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function ne(e,t){return new O({type:"record",schema:null,*entries(n){if(C(n))for(const r in n){const o=n[r];yield[r,r,e],yield[r,o,t]}},validator:e=>C(e)||`Expected an object, but received: ${R(e)}`})}function re(){return D("string",(e=>"string"==typeof e||`Expected a string, but received: ${R(e)}`))}function oe(e){const t=Y();return new O({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const r=Math.max(e.length,n.length);for(let o=0;o<r;o++)yield[o,n[o],e[o]||t]}},validator:e=>Array.isArray(e)||`Expected an array, but received: ${R(e)}`})}function ie(e){const t=Object.keys(e);return new O({type:"type",schema:e,*entries(n){if(C(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>C(e)||`Expected an object, but received: ${R(e)}`,coercer:e=>C(e)?{...e}:e})}function ae(e){const t=e.map((e=>e.type)).join(" | ");return new O({type:"union",schema:null,coercer(t){for(const n of e){const[e,r]=n.validate(t,{coerce:!0});if(!e)return r}return t},validator(n,r){const o=[];for(const t of e){const[...e]=B(n,t,r),[i]=e;if(!i?.[0])return[];for(const[t]of e)t&&o.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${R(n)}`,...o]}})}function se(){return D("unknown",(()=>!0))}function ce(e){return ee(e)}function ue(e){return e.path[e.path.length-1]in e.branch[e.branch.length-2]}function le(e){return new O({...e,validator:(t,n)=>!ue(n)||e.validator(t,n),refiner:(t,n)=>!ue(n)||e.refiner(t,n)})}function de(e,t,n){return new O({...e,coercer:(r,o)=>j(r,t)?e.coercer(n(r,o),o):e.coercer(r,o)})}function fe(e){return e instanceof Map||e instanceof Set?e.size:e.length}function he(e,t,n={}){const{exclusive:r}=n;return me(e,"min",(n=>r?n>t:n>=t||`Expected a ${e.type} greater than ${r?"":"or equal to "}${t} but received \`${n}\``))}function pe(e){return me(e,"nonempty",(t=>fe(t)>0||`Expected a nonempty ${e.type} but received an empty one`))}function ge(e,t){return me(e,"pattern",(n=>t.test(n)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${n}"`))}function me(e,t,n){return new O({...e,*refiner(r,o){yield*e.refiner(r,o);const i=N(n(r,o),o,e,r);for(const e of i)yield{...e,refinement:t}}})}const ye=(e,t)=>Object.hasOwnProperty.call(e,t);var ve;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(ve=ve||(ve={}));const we=e=>ee(e);function Ae({path:e,branch:t}){const n=e[e.length-1];return ye(t[t.length-2],n)}function be(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Ae(n)||e.validator(t,n),refiner:(t,n)=>!Ae(n)||e.refiner(t,n)})}function Se(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!Se(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!Se(n[e][1])){t=!1;break}return t}return!1}const Ee=D("JSON",(e=>Se(e))),ke=de(Ee,me(V(),"JSON",(e=>j(e,Ee))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const Ie=J("2.0"),Te=Q(ae([X(),re()])),_e=we({code:Z(),message:re(),data:be(ke),stack:be(re())}),xe=ae([ne(re(),ke),K(ke)]);we({id:Te,jsonrpc:Ie,method:re(),params:be(xe)}),we({jsonrpc:Ie,method:re(),params:be(xe)});ee({id:Te,jsonrpc:Ie,result:te(se()),error:te(_e)});const Ce=we({id:Te,jsonrpc:Ie,result:ke}),Re=we({id:Te,jsonrpc:Ie,error:_e});ae([Ce,Re]);const Pe=ce({jsonrpc:J("2.0"),id:ae([re(),X(),J(null)]),method:re(),params:le(ae([K(ke),ne(re(),ke)]))});const Ne=(e,t)=>Object.hasOwnProperty.call(e,t);var Be;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(Be=Be||(Be={}));const Oe=e=>ee(e);function Me({path:e,branch:t}){const n=e[e.length-1];return Ne(t[t.length-2],n)}function ze(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Me(n)||e.validator(t,n),refiner:(t,n)=>!Me(n)||e.refiner(t,n)})}function je(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!je(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!je(n[e][1])){t=!1;break}return t}return!1}const Ue=D("JSON",(e=>je(e))),De=de(Ue,me(V(),"JSON",(e=>j(e,Ue))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const Le=J("2.0"),Fe=Q(ae([X(),re()])),$e=Oe({code:Z(),message:re(),data:ze(De),stack:ze(re())}),qe=ae([ne(re(),De),K(De)]);Oe({id:Fe,jsonrpc:Le,method:re(),params:ze(qe)}),Oe({jsonrpc:Le,method:re(),params:ze(qe)});ee({id:Fe,jsonrpc:Le,result:te(se()),error:te($e)});const We=Oe({id:Fe,jsonrpc:Le,result:De}),Ve=Oe({id:Fe,jsonrpc:Le,error:$e});ae([We,Ve]);function Ke(e,t){return D(e,(e=>"string"==typeof e&&t.test(e)))}const Ge=/^(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})$/u,He=/^[-a-z0-9]{3,8}$/u,Ze=/^[-_a-zA-Z0-9]{1,32}$/u,Je=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})):(?<accountAddress>[-.%a-zA-Z0-9]{1,128})$/u,Ye=/^[-.%a-zA-Z0-9]{1,128}$/u,Qe=/^[-a-z0-9]{3,8}$/u,Xe=/^[-.%a-zA-Z0-9]{1,128}$/u,et=/^[-.%a-zA-Z0-9]{1,78}$/u,tt=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u,nt=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u,rt=Ke("CaipChainId",Ge),ot=(Ke("CaipNamespace",He),Ke("CaipReference",Ze),Ke("CaipAccountId",Je)),it=(Ke("CaipAccountAddress",Ye),Ke("CaipAssetNamespace",Qe),Ke("CaipAssetReference",Xe),Ke("CaipTokenId",et),Ke("CaipAssetType",tt)),at=Ke("CaipAssetId",nt),st=Ke("CaipAssetTypeOrId",/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})(\/(?<tokenId>[-.%a-zA-Z0-9]{1,78}))?$/u);var ct,ut,lt,dt;!function(e){e.Bip122="bip122",e.Solana="solana",e.Eip155="eip155",e.Wallet="wallet"}(ct=ct||(ct={})),function(e){e.Eoa="eip155:eoa",e.Erc4337="eip155:erc4337"}(ut||(ut={})),function(e){e.P2pkh="bip122:p2pkh",e.P2sh="bip122:p2sh",e.P2wpkh="bip122:p2wpkh",e.P2tr="bip122:p2tr"}(lt||(lt={})),function(e){e.DataAccount="solana:data-account"}(dt||(dt={}));const ft=ce({id:$,type:H([`${ut.Eoa}`,`${ut.Erc4337}`,`${lt.P2pkh}`,`${lt.P2sh}`,`${lt.P2wpkh}`,`${lt.P2tr}`,`${dt.DataAccount}`]),address:re(),scopes:pe(K(rt)),options:ne(re(),De),methods:K(re())}),ht=(ee({address:ot}),ce({unit:re(),amount:W})),pt=ce({fungible:J(!0),type:it,...ht.schema}),gt=ce({fungible:J(!1),id:at}),mt=(yt=e=>function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}(e)&&!e.fungible?gt:pt,new O({type:"union",schema:null,*entries(e,t){yield*yt(e).entries(e,t)},*refiner(e,t){yield*yt(e).refiner(e,t)},coercer:(e,t)=>yt(e).coercer(e,t),validator:(e,t)=>yt(e).validator(e,t)}));var yt;const vt=ce({amount:W,unit:re()}),wt=Ke("DerivationPath",/^m(?:\/\d+'?)+$/u);var At;!function(e){e.Bip44="bip44"}(At||(At={}));const bt=ee({type:J(`${At.Bip44}`),scopes:K(rt),derivationPath:wt}),St=(ne(re(),De),ce({id:F,scope:re(),account:F,origin:re(),request:ce({method:re(),params:le(ae([K(De),ne(re(),De)]))})})),Et=(ae([ce({pending:J(!0),redirect:le(ce({message:le(re()),url:le(re())}))}),ce({pending:J(!1),result:De})]),ce({address:re(),asset:Q(mt)}));var kt;!function(e){e.Base="base",e.Priority="priority"}(kt||(kt={}));const It=ce({type:H([`${kt.Base}`,`${kt.Priority}`]),asset:mt});var Tt,_t;!function(e){e.Submitted="submitted",e.Unconfirmed="unconfirmed",e.Confirmed="confirmed",e.Failed="failed"}(Tt||(Tt={})),function(e){e.Send="send",e.Receive="receive",e.Swap="swap",e.BridgeSend="bridge:send",e.BridgeReceive="bridge:receive",e.Unknown="unknown"}(_t||(_t={}));const xt=ce({status:H([`${Tt.Submitted}`,`${Tt.Unconfirmed}`,`${Tt.Confirmed}`,`${Tt.Failed}`]),timestamp:Q(X())}),Ct=ce({id:re(),chain:rt,account:F,status:H([`${Tt.Submitted}`,`${Tt.Unconfirmed}`,`${Tt.Confirmed}`,`${Tt.Failed}`]),timestamp:Q(X()),type:H([`${_t.Send}`,`${_t.Receive}`,`${_t.Swap}`,`${_t.BridgeSend}`,`${_t.BridgeReceive}`,`${_t.Unknown}`]),from:K(Et),to:K(Et),fees:K(It),events:K(xt)}),Rt=(ce({data:K(Ct),next:Q(re())}),ce({limit:X(),next:le(Q(re()))})),Pt=ce({metamask:le(ce({correlationId:F}))});var Nt;!function(e){e.Mainnet="bip122:000000000019d6689c085ae165831e93",e.Testnet="bip122:000000000933ea01ad0ee984209779ba",e.Testnet4="bip122:00000000da84f2bafbbc53dee25a72ae",e.Signet="bip122:00000008819873e925422c1ff0f99f7c",e.Regtest="bip122:regtest"}(Nt||(Nt={}));const Bt=(e,t)=>{try{return _(e).type===t||new Error(`Invalid ${t} address`)}catch(e){return new Error(`Failed to decode ${t} address: ${e.message}`)}},Ot=me(re(),"BtcP2pkhAddressStruct",(e=>Bt(e,k.p2pkh))),Mt=me(re(),"BtcP2shAddressStruct",(e=>Bt(e,k.p2sh))),zt=me(re(),"BtcP2wpkhAddressStruct",(e=>Bt(e,k.p2wpkh))),jt=me(re(),"BtcP2trAddressStruct",(e=>Bt(e,k.p2tr)));var Ut;!function(e){e.SendBitcoin="sendBitcoin"}(Ut||(Ut={}));const Dt=ce({...ft.schema,scopes:pe(K(rt)),methods:K(H([`${Ut.SendBitcoin}`]))});ce({...Dt.schema,address:Ot,type:J(`${lt.P2pkh}`)}),ce({...Dt.schema,address:Mt,type:J(`${lt.P2sh}`)}),ce({...Dt.schema,address:zt,type:J(`${lt.P2wpkh}`)}),ce({...Dt.schema,address:jt,type:J(`${lt.P2tr}`)});var Lt;!function(e){e.Devnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",e.Mainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",e.Testnet="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"}(Lt||(Lt={}));const Ft=Ke("SolAddress",/^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu);var $t;!function(e){e.SendAndConfirmTransaction="sendAndConfirmTransaction",e.SignAndSendTransaction="signAndSendTransaction",e.SignTransaction="signTransaction",e.SignMessage="signMessage",e.SignIn="signIn"}($t||($t={}));ce({...ft.schema,address:Ft,type:J(`${dt.DataAccount}`),scopes:pe(K(rt)),methods:K(H(Object.values($t)))});var qt;!function(e){e.Eoa="eip155:0",e.Mainnet="eip155:1",e.Testnet="eip155:11155111"}(qt||(qt={}));const Wt=Ke("EthBytes",/^0x[0-9a-f]*$/iu),Vt=Ke("EthAddress",/^0x[0-9a-f]{40}$/iu),Kt=Ke("EthUint256",/^0x([1-9a-f][0-9a-f]*|0)$/iu);var Gt;!function(e){e.PersonalSign="personal_sign",e.Sign="eth_sign",e.SignTransaction="eth_signTransaction",e.SignTypedDataV1="eth_signTypedData_v1",e.SignTypedDataV3="eth_signTypedData_v3",e.SignTypedDataV4="eth_signTypedData_v4",e.PrepareUserOperation="eth_prepareUserOperation",e.PatchUserOperation="eth_patchUserOperation",e.SignUserOperation="eth_signUserOperation"}(Gt||(Gt={}));ce({...ft.schema,address:Vt,type:J(`${ut.Eoa}`),scopes:pe(K(J(qt.Eoa))),methods:K(H([`${Gt.PersonalSign}`,`${Gt.Sign}`,`${Gt.SignTransaction}`,`${Gt.SignTypedDataV1}`,`${Gt.SignTypedDataV3}`,`${Gt.SignTypedDataV4}`]))}),ce({...ft.schema,address:Vt,type:J(`${ut.Erc4337}`),scopes:pe(K(rt)),methods:K(H([`${Gt.PersonalSign}`,`${Gt.Sign}`,`${Gt.SignTypedDataV1}`,`${Gt.SignTypedDataV3}`,`${Gt.SignTypedDataV4}`,`${Gt.PrepareUserOperation}`,`${Gt.PatchUserOperation}`,`${Gt.SignUserOperation}`]))}),ce({sender:Vt,nonce:Kt,initCode:Wt,callData:Wt,callGasLimit:Kt,verificationGasLimit:Kt,preVerificationGas:Kt,maxFeePerGas:Kt,maxPriorityFeePerGas:Kt,paymasterAndData:Wt,signature:Wt}),ce({to:Vt,value:Kt,data:Wt}),ce({nonce:Kt,initCode:Wt,callData:Wt,gasLimits:le(ce({callGasLimit:Kt,verificationGasLimit:Kt,preVerificationGas:Kt})),dummyPaymasterAndData:Wt,dummySignature:Wt,bundlerUrl:q}),ce({paymasterAndData:Wt,callGasLimit:le(Kt),verificationGasLimit:le(Kt),preVerificationGas:le(Kt)});var Ht;!function(e){e.ListAccounts="keyring_listAccounts",e.GetAccount="keyring_getAccount",e.CreateAccount="keyring_createAccount",e.DiscoverAccounts="keyring_discoverAccounts",e.ListAccountAssets="keyring_listAccountAssets",e.ListAccountTransactions="keyring_listAccountTransactions",e.GetAccountBalances="keyring_getAccountBalances",e.ResolveAccountAddress="keyring_resolveAccountAddress",e.FilterAccountChains="keyring_filterAccountChains",e.UpdateAccount="keyring_updateAccount",e.DeleteAccount="keyring_deleteAccount",e.ExportAccount="keyring_exportAccount",e.ListRequests="keyring_listRequests",e.GetRequest="keyring_getRequest",e.SubmitRequest="keyring_submitRequest",e.ApproveRequest="keyring_approveRequest",e.RejectRequest="keyring_rejectRequest"}(Ht||(Ht={}));const Zt={jsonrpc:J("2.0"),id:ae([re(),X(),J(null)])},Jt=ce({...Zt,method:J("keyring_listAccounts")}),Yt=(K(ft),ce({...Zt,method:J("keyring_getAccount"),params:ce({id:F})})),Qt=ce({...Zt,method:J("keyring_createAccount"),params:ce({options:ne(re(),De)})}),Xt=ce({...Zt,method:J("keyring_discoverAccounts"),params:ce({scopes:K(rt),entropySource:re(),groupIndex:X()})}),en=(K(bt),ce({...Zt,method:J("keyring_listAccountTransactions"),params:ce({id:F,pagination:Rt})})),tn=ce({...Zt,method:J("keyring_listAccountAssets"),params:ce({id:F})}),nn=K(st),rn=ce({...Zt,method:J(`${Ht.GetAccountBalances}`),params:ce({id:F,assets:K(it)})}),on=(ne(it,vt),ce({...Zt,method:J("keyring_resolveAccountAddress"),params:ce({scope:rt,request:Pe})})),an=(Q(ce({address:ot})),ce({...Zt,method:J("keyring_filterAccountChains"),params:ce({id:F,chains:K(re())})})),sn=(K(re()),ce({...Zt,method:J("keyring_updateAccount"),params:ce({account:ft})})),cn=(J(null),ce({...Zt,method:J("keyring_deleteAccount"),params:ce({id:F})})),un=(J(null),ce({...Zt,method:J("keyring_exportAccount"),params:ce({id:F})})),ln=ce({...Zt,method:J("keyring_listRequests")}),dn=(K(St),ce({...Zt,method:J("keyring_getRequest"),params:ce({id:F})})),fn=ce({...Zt,method:J("keyring_submitRequest"),params:St}),hn=ce({...Zt,method:J("keyring_approveRequest"),params:ce({id:F,data:ne(re(),De)})}),pn=(J(null),ce({...Zt,method:J("keyring_rejectRequest"),params:ce({id:F})}));J(null);var gn;!function(e){e.AccountCreated="notify:accountCreated",e.AccountUpdated="notify:accountUpdated",e.AccountDeleted="notify:accountDeleted",e.RequestApproved="notify:requestApproved",e.RequestRejected="notify:requestRejected",e.AccountBalancesUpdated="notify:accountBalancesUpdated",e.AccountAssetListUpdated="notify:accountAssetListUpdated",e.AccountTransactionsUpdated="notify:accountTransactionsUpdated"}(gn||(gn={}));ce({method:J(`${gn.AccountCreated}`),params:ce({account:ft,accountNameSuggestion:le(re()),displayConfirmation:le(G()),displayAccountNameSuggestion:le(G()),...Pt.schema})}),ce({method:J(`${gn.AccountUpdated}`),params:ce({account:ft})}),ce({method:J(`${gn.AccountDeleted}`),params:ce({id:F})}),ce({method:J(`${gn.RequestApproved}`),params:ce({id:F,result:De})}),ce({method:J(`${gn.RequestRejected}`),params:ce({id:F})}),ce({method:J(`${gn.AccountBalancesUpdated}`),params:ce({balances:ne($,ne(it,ht))})}),ce({method:J(`${gn.AccountTransactionsUpdated}`),params:ce({transactions:ne($,K(Ct))})}),ce({method:J(`${gn.AccountAssetListUpdated}`),params:ce({assets:ne($,ce({added:K(st),removed:K(st)}))})});class mn extends Error{constructor(e){super(`Method not supported: ${e}`)}}async function yn(e,t){try{return await async function(e,t){switch(M(t,Pe),t.method){case`${Ht.ListAccounts}`:return M(t,Jt),e.listAccounts();case`${Ht.GetAccount}`:return M(t,Yt),e.getAccount(t.params.id);case`${Ht.CreateAccount}`:return M(t,Qt),e.createAccount(t.params.options);case`${Ht.DiscoverAccounts}`:if(void 0===e.discoverAccounts)throw new mn(t.method);return M(t,Xt),e.discoverAccounts(t.params.scopes,t.params.entropySource,t.params.groupIndex);case`${Ht.ListAccountTransactions}`:if(void 0===e.listAccountTransactions)throw new mn(t.method);return M(t,en),e.listAccountTransactions(t.params.id,t.params.pagination);case`${Ht.ListAccountAssets}`:if(void 0===e.listAccountAssets)throw new mn(t.method);return M(t,tn),e.listAccountAssets(t.params.id);case`${Ht.GetAccountBalances}`:if(void 0===e.getAccountBalances)throw new mn(t.method);return M(t,rn),e.getAccountBalances(t.params.id,t.params.assets);case`${Ht.ResolveAccountAddress}`:if(void 0===e.resolveAccountAddress)throw new mn(t.method);return M(t,on),e.resolveAccountAddress(t.params.scope,t.params.request);case`${Ht.FilterAccountChains}`:return M(t,an),e.filterAccountChains(t.params.id,t.params.chains);case`${Ht.UpdateAccount}`:return M(t,sn),e.updateAccount(t.params.account);case`${Ht.DeleteAccount}`:return M(t,cn),e.deleteAccount(t.params.id);case`${Ht.ExportAccount}`:if(void 0===e.exportAccount)throw new mn(t.method);return M(t,un),e.exportAccount(t.params.id);case`${Ht.ListRequests}`:if(void 0===e.listRequests)throw new mn(t.method);return M(t,ln),e.listRequests();case`${Ht.GetRequest}`:if(void 0===e.getRequest)throw new mn(t.method);return M(t,dn),e.getRequest(t.params.id);case`${Ht.SubmitRequest}`:return M(t,fn),e.submitRequest(t.params);case`${Ht.ApproveRequest}`:if(void 0===e.approveRequest)throw new mn(t.method);return M(t,hn),e.approveRequest(t.params.id,t.params.data);case`${Ht.RejectRequest}`:if(void 0===e.rejectRequest)throw new mn(t.method);return M(t,pn),e.rejectRequest(t.params.id);default:throw new mn(t.method)}}(e,t)}catch(e){const t=e instanceof Error&&"string"==typeof e.message?e.message:"An unknown error occurred while handling the keyring request";throw new Error(t)}}async function vn(e,t,n){await e.request({method:"snap_manageAccounts",params:{method:t,params:{...n}}})}function wn(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)}const An=(e,t)=>Object.hasOwnProperty.call(e,t);var bn;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(bn=bn||(bn={}));function Sn(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}var En=n(282);class kn extends TypeError{constructor(e,t){let n;const{message:r,explanation:o,...i}=e,{path:a}=e,s=0===a.length?r:`At path: ${a.join(".")} -- ${r}`;super(o??s),null!=o&&(this.cause=s),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function In(e){return"object"==typeof e&&null!==e}function Tn(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function _n(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:o,branch:i}=t,{type:a}=n,{refinement:s,message:c=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${Tn(r)}\``}=e;return{value:r,type:a,refinement:s,key:o[o.length-1],path:o,branch:i,...e,message:c}}function*xn(e,t,n,r){(function(e){return In(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const o of e){const e=_n(o,t,n,r);e&&(yield e)}}function*Cn(e,t,n={}){const{path:r=[],branch:o=[e],coerce:i=!1,mask:a=!1}=n,s={path:r,branch:o};if(i&&(e=t.coercer(e,s),a&&"type"!==t.type&&In(t.schema)&&In(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let c="valid";for(const r of t.validator(e,s))r.explanation=n.message,c="not_valid",yield[r,void 0];for(let[u,l,d]of t.entries(e,s)){const t=Cn(l,d,{path:void 0===u?r:[...r,u],branch:void 0===u?o:[...o,l],coerce:i,mask:a,message:n.message});for(const n of t)n[0]?(c=null===n[0].refinement||void 0===n[0].refinement?"not_valid":"not_refined",yield[n[0],void 0]):i&&(l=n[1],void 0===u?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):In(e)&&(void 0!==l||u in e)&&(e[u]=l))}if("not_valid"!==c)for(const r of t.refiner(e,s))r.explanation=n.message,c="not_refined",yield[r,void 0];"valid"===c&&(yield[void 0,e])}class Rn{constructor(e){const{type:t,schema:n,validator:r,refiner:o,coercer:i=(e=>e),entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=i,this.validator=r?(e,t)=>xn(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>xn(o(e,t),t,this,e):()=>[]}assert(e,t){return Pn(e,this,t)}create(e,t){return Nn(e,this,t)}is(e){return Bn(e,this)}mask(e,t){return function(e,t,n){const r=On(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return On(e,this,t)}}function Pn(e,t,n){const r=On(e,t,{message:n});if(r[0])throw r[0]}function Nn(e,t,n){const r=On(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function Bn(e,t){return!On(e,t)[0]}function On(e,t,n={}){const r=Cn(e,t,n),o=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(o[0]){return[new kn(o[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]}return[void 0,o[1]]}function Mn(e,t){return new Rn({type:e,schema:null,validator:t})}function zn(){return Mn("never",(()=>!1))}function jn(e){const t=e?Object.keys(e):[],n=zn();return new Rn({type:"object",schema:e??null,*entries(r){if(e&&In(r)){const o=new Set(Object.keys(r));for(const n of t)o.delete(n),yield[n,r[n],e[n]];for(const e of o)yield[e,r[e],n]}},validator:e=>In(e)||`Expected an object, but received: ${Tn(e)}`,coercer:e=>In(e)?{...e}:e})}function Un(e){return new Rn({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function Dn(){return Mn("string",(e=>"string"==typeof e||`Expected a string, but received: ${Tn(e)}`))}function Ln(e){const t=e.map((e=>e.type)).join(" | ");return new Rn({type:"union",schema:null,coercer(t){for(const n of e){const[e,r]=n.validate(t,{coerce:!0});if(!e)return r}return t},validator(n,r){const o=[];for(const t of e){const[...e]=Cn(n,t,r),[i]=e;if(!i?.[0])return[];for(const[t]of e)t&&o.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${Tn(n)}`,...o]}})}function Fn(e,t,n){return new Rn({...e,coercer:(r,o)=>Bn(r,t)?e.coercer(n(r,o),o):e.coercer(r,o)})}function $n(e,t,n){return new Rn({...e,*refiner(r,o){yield*e.refiner(r,o);const i=xn(n(r,o),o,e,r);for(const e of i)yield{...e,refinement:t}}})}const qn=e=>jn(e);function Wn({path:e,branch:t}){const n=e[e.length-1];return An(t[t.length-2],n)}function Vn(e){return new Rn({...e,type:`optional ${e.type}`,validator:(t,n)=>!Wn(n)||e.validator(t,n),refiner:(t,n)=>!Wn(n)||e.refiner(t,n)})}function Kn(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!Kn(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!Kn(n[e][1])){t=!1;break}return t}return!1}const Gn=Mn("JSON",(e=>Kn(e))),Hn=Fn(Gn,$n(Mn("any",(()=>!0)),"JSON",(e=>Bn(e,Gn))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));function Zn(e){try{return function(e){Nn(e,Hn)}(e),!0}catch{return!1}}const Jn=function(e){const t=Tn(e),n=typeof e;return new Rn({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${Tn(n)}`})}("2.0"),Yn=(Qn=Ln([Mn("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${Tn(e)}`)),Dn()]),new Rn({...Qn,validator:(e,t)=>null===e||Qn.validator(e,t),refiner:(e,t)=>null===e||Qn.refiner(e,t)}));var Qn;const Xn=qn({code:Mn("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${Tn(e)}`)),message:Dn(),data:Vn(Hn),stack:Vn(Dn())}),er=Ln([function(e,t){return new Rn({type:"record",schema:null,*entries(n){if(In(n))for(const r in n){const o=n[r];yield[r,r,e],yield[r,o,t]}},validator:e=>In(e)||`Expected an object, but received: ${Tn(e)}`})}(Dn(),Hn),(tr=Hn,new Rn({type:"array",schema:tr,*entries(e){if(tr&&Array.isArray(e))for(const[t,n]of e.entries())yield[t,n,tr]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${Tn(e)}`}))]);var tr;qn({id:Yn,jsonrpc:Jn,method:Dn(),params:Vn(er)}),qn({jsonrpc:Jn,method:Dn(),params:Vn(er)});jn({id:Yn,jsonrpc:Jn,result:Un(Mn("unknown",(()=>!0))),error:Un(Xn)});const nr=qn({id:Yn,jsonrpc:Jn,result:Hn}),rr=qn({id:Yn,jsonrpc:Jn,error:Xn});Ln([nr,rr]);const or={invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},ir={userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901},ar={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},sr=or.internal,cr="Unspecified error message. This is a bug, please report it.",ur=(lr(sr),"Unspecified server error.");function lr(e,t=cr){if(function(e){return Number.isInteger(e)}(e)){const t=e.toString();if(An(ar,t))return ar[t].message;if(function(e){return e>=-32099&&e<=-32e3}(e))return ur}return t}function dr(e){return Array.isArray(e)?e.map((e=>Zn(e)?e:wn(e)?fr(e):null)):wn(e)?fr(e):Zn(e)?e:null}function fr(e){return Object.getOwnPropertyNames(e).reduce(((t,n)=>{const r=e[n];return Zn(r)&&(t[n]=r),t}),{})}const hr=function(e){return e?.__esModule?e.default:e}(En);class pr extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a non-empty string.');!function(e){return wn(e)&&An(e,"cause")&&wn(e.cause)}(n)?super(t):(super(t,{cause:n.cause}),An(this,"cause")||Object.assign(this,{cause:n.cause})),void 0!==n&&(this.data=n),this.code=e}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data,Sn(this.data)&&(e.data.cause=dr(this.data.cause))),this.stack&&(e.stack=this.stack),e}toString(){return hr(this.serialize(),mr,2)}}class gr extends pr{constructor(e,t,n){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}}function mr(e,t){if("[Circular]"!==t)return t}const yr=e=>Br(or.parse,e),vr=e=>Br(or.invalidRequest,e),wr=e=>Br(or.invalidParams,e),Ar=e=>Br(or.methodNotFound,e),br=e=>Br(or.internal,e),Sr=e=>Br(or.invalidInput,e),Er=e=>Br(or.resourceNotFound,e),kr=e=>Br(or.resourceUnavailable,e),Ir=e=>Br(or.transactionRejected,e),Tr=e=>Br(or.methodNotSupported,e),_r=e=>Br(or.limitExceeded,e),xr=e=>Or(ir.userRejectedRequest,e),Cr=e=>Or(ir.unauthorized,e),Rr=e=>Or(ir.unsupportedMethod,e),Pr=e=>Or(ir.disconnected,e),Nr=e=>Or(ir.chainDisconnected,e);function Br(e,t){const[n,r]=Mr(t);return new pr(e,n??lr(e),r)}function Or(e,t){const[n,r]=Mr(t);return new gr(e,n??lr(e),r)}function Mr(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t??void 0,n]}}return[]}function zr(e,t,n=null){return wn(e)&&An(e,t)?e[t]:n}function jr(e,t,n=String(e)){const r=zr(e,t);return"string"==typeof r?r:n}function Ur(e){return jr(e,"message")}function Dr(e){return jr(e,"stack",null)}function Lr(e){return jr(e,"name",e instanceof Error?e.name:"Error")}function Fr(e){const t=zr(e,"data");return null!==t&&Zn(t)&&!Array.isArray(t)?t:{}}class $r extends Error{#e;#t;#n;#r;constructor(e,t={}){const n=Ur(e);super(n),this.#t=n,this.#e=function(e){const t=zr(e,"code");return"number"==typeof t&&Number.isInteger(t)?t:-32603}(e);const r={...Fr(e),...t};Object.keys(r).length>0&&(this.#n=r),this.#r=super.stack}get name(){return"SnapError"}get code(){return this.#e}get message(){return this.#t}get data(){return this.#n}get stack(){return this.#r}toJSON(){return{code:-31002,message:"Snap Error",data:{cause:{code:this.code,message:this.message,stack:this.stack,...this.data?{data:this.data}:{}}}}}serialize(){return this.toJSON()}}function qr(e){if("string"==typeof e)return{name:"Error",message:e,stack:null,cause:null};if(Bn(e,Xn))return{name:"JsonRpcError",message:Ur(e),stack:Dr(e)??Dr(e.data)??null,cause:null};const t=function(e){return zr(e,"cause")}(e);return{name:Lr(e),message:Ur(e),stack:Dr(e)??null,cause:null===t?null:qr(t)}}function Wr(e){return class extends $r{constructor(t,n){if("object"==typeof t){const n=e();return void super({code:n.code,message:n.message,data:t})}const r=e(t);super({code:r.code,message:r.message,data:n})}}}const Vr=Wr(br),Kr=Wr(Sr),Gr=Wr(wr),Hr=Wr(vr),Zr=Wr(_r),Jr=Wr(Ar),Yr=Wr(Tr),Qr=Wr(yr),Xr=Wr(Er),eo=Wr(kr),to=Wr(Ir),no=Wr(Nr),ro=Wr(Pr),oo=Wr(Cr),io=Wr(Rr),ao=Wr(xr);var so=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,co=Math.ceil,uo=Math.floor,lo="[BigNumber Error] ",fo=lo+"Number primitive has more than 15 significant digits: ",ho=1e14,po=14,go=9007199254740991,mo=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],yo=1e7,vo=1e9;function wo(e){var t=0|e;return e>0||e===t?t:t-1}function Ao(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=po-t.length;n--;t="0"+t);i+=t}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function bo(e,t){var n,r,o=e.c,i=t.c,a=e.s,s=t.s,c=e.e,u=t.e;if(!a||!s)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-s:a;if(a!=s)return a;if(n=a<0,r=c==u,!o||!i)return r?0:!o^n?1:-1;if(!r)return c>u^n?1:-1;for(s=(c=o.length)<(u=i.length)?c:u,a=0;a<s;a++)if(o[a]!=i[a])return o[a]>i[a]^n?1:-1;return c==u?0:c>u^n?1:-1}function So(e,t,n,r){if(e<t||e>n||e!==uo(e))throw Error(lo+(r||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Eo(e){var t=e.c.length-1;return wo(e.e/po)==t&&e.c[t]%2!=0}function ko(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Io(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(++t>(r=e.length)){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var To=function e(t){var n,r,o,i,a,s,c,u,l,d,f=T.prototype={constructor:T,toString:null,valueOf:null},h=new T(1),p=20,g=4,m=-7,y=21,v=-1e7,w=1e7,A=!1,b=1,S=0,E={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},k="0123456789abcdefghijklmnopqrstuvwxyz",I=!0;function T(e,t){var n,i,a,s,c,u,l,d,f=this;if(!(f instanceof T))return new T(e,t);if(null==t){if(e&&!0===e._isBigNumber)return f.s=e.s,void(!e.c||e.e>w?f.c=f.e=null:e.e<v?f.c=[f.e=0]:(f.e=e.e,f.c=e.c.slice()));if((u="number"==typeof e)&&0*e==0){if(f.s=1/e<0?(e=-e,-1):1,e===~~e){for(s=0,c=e;c>=10;c/=10,s++);return void(s>w?f.c=f.e=null:(f.e=s,f.c=[e]))}d=String(e)}else{if(!so.test(d=String(e)))return o(f,d,u);f.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(s=d.indexOf("."))>-1&&(d=d.replace(".","")),(c=d.search(/e/i))>0?(s<0&&(s=c),s+=+d.slice(c+1),d=d.substring(0,c)):s<0&&(s=d.length)}else{if(So(t,2,k.length,"Base"),10==t&&I)return R(f=new T(e),p+f.e+1,g);if(d=String(e),u="number"==typeof e){if(0*e!=0)return o(f,d,u,t);if(f.s=1/e<0?(d=d.slice(1),-1):1,T.DEBUG&&d.replace(/^0\.0*|\./,"").length>15)throw Error(fo+e)}else f.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(n=k.slice(0,t),s=c=0,l=d.length;c<l;c++)if(n.indexOf(i=d.charAt(c))<0){if("."==i){if(c>s){s=l;continue}}else if(!a&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){a=!0,c=-1,s=0;continue}return o(f,String(e),u,t)}u=!1,(s=(d=r(d,t,10,f.s)).indexOf("."))>-1?d=d.replace(".",""):s=d.length}for(c=0;48===d.charCodeAt(c);c++);for(l=d.length;48===d.charCodeAt(--l););if(d=d.slice(c,++l)){if(l-=c,u&&T.DEBUG&&l>15&&(e>go||e!==uo(e)))throw Error(fo+f.s*e);if((s=s-c-1)>w)f.c=f.e=null;else if(s<v)f.c=[f.e=0];else{if(f.e=s,f.c=[],c=(s+1)%po,s<0&&(c+=po),c<l){for(c&&f.c.push(+d.slice(0,c)),l-=po;c<l;)f.c.push(+d.slice(c,c+=po));c=po-(d=d.slice(c)).length}else c-=l;for(;c--;d+="0");f.c.push(+d)}}else f.c=[f.e=0]}function _(e,t,n,r){var o,i,a,s,c;if(null==n?n=g:So(n,0,8),!e.c)return e.toString();if(o=e.c[0],a=e.e,null==t)c=Ao(e.c),c=1==r||2==r&&(a<=m||a>=y)?ko(c,a):Io(c,a,"0");else if(i=(e=R(new T(e),t,n)).e,s=(c=Ao(e.c)).length,1==r||2==r&&(t<=i||i<=m)){for(;s<t;c+="0",s++);c=ko(c,i)}else if(t-=a,c=Io(c,i,"0"),i+1>s){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=i-s)>0)for(i+1==s&&(c+=".");t--;c+="0");return e.s<0&&o?"-"+c:c}function x(e,t){for(var n,r,o=1,i=new T(e[0]);o<e.length;o++)(!(r=new T(e[o])).s||(n=bo(i,r))===t||0===n&&i.s===t)&&(i=r);return i}function C(e,t,n){for(var r=1,o=t.length;!t[--o];t.pop());for(o=t[0];o>=10;o/=10,r++);return(n=r+n*po-1)>w?e.c=e.e=null:n<v?e.c=[e.e=0]:(e.e=n,e.c=t),e}function R(e,t,n,r){var o,i,a,s,c,u,l,d=e.c,f=mo;if(d){e:{for(o=1,s=d[0];s>=10;s/=10,o++);if((i=t-o)<0)i+=po,a=t,c=d[u=0],l=uo(c/f[o-a-1]%10);else if((u=co((i+1)/po))>=d.length){if(!r)break e;for(;d.length<=u;d.push(0));c=l=0,o=1,a=(i%=po)-po+1}else{for(c=s=d[u],o=1;s>=10;s/=10,o++);l=(a=(i%=po)-po+o)<0?0:uo(c/f[o-a-1]%10)}if(r=r||t<0||null!=d[u+1]||(a<0?c:c%f[o-a-1]),r=n<4?(l||r)&&(0==n||n==(e.s<0?3:2)):l>5||5==l&&(4==n||r||6==n&&(i>0?a>0?c/f[o-a]:0:d[u-1])%10&1||n==(e.s<0?8:7)),t<1||!d[0])return d.length=0,r?(t-=e.e+1,d[0]=f[(po-t%po)%po],e.e=-t||0):d[0]=e.e=0,e;if(0==i?(d.length=u,s=1,u--):(d.length=u+1,s=f[po-i],d[u]=a>0?uo(c/f[o-a]%f[a])*s:0),r)for(;;){if(0==u){for(i=1,a=d[0];a>=10;a/=10,i++);for(a=d[0]+=s,s=1;a>=10;a/=10,s++);i!=s&&(e.e++,d[0]==ho&&(d[0]=1));break}if(d[u]+=s,d[u]!=ho)break;d[u--]=0,s=1}for(i=d.length;0===d[--i];d.pop());}e.e>w?e.c=e.e=null:e.e<v&&(e.c=[e.e=0])}return e}function P(e){var t,n=e.e;return null===n?e.toString():(t=Ao(e.c),t=n<=m||n>=y?ko(t,n):Io(t,n,"0"),e.s<0?"-"+t:t)}return T.clone=e,T.ROUND_UP=0,T.ROUND_DOWN=1,T.ROUND_CEIL=2,T.ROUND_FLOOR=3,T.ROUND_HALF_UP=4,T.ROUND_HALF_DOWN=5,T.ROUND_HALF_EVEN=6,T.ROUND_HALF_CEIL=7,T.ROUND_HALF_FLOOR=8,T.EUCLID=9,T.config=T.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(lo+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(So(n=e[t],0,vo,t),p=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(So(n=e[t],0,8,t),g=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(So(n[0],-vo,0,t),So(n[1],0,vo,t),m=n[0],y=n[1]):(So(n,-vo,vo,t),m=-(y=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)So(n[0],-vo,-1,t),So(n[1],1,vo,t),v=n[0],w=n[1];else{if(So(n,-vo,vo,t),!n)throw Error(lo+t+" cannot be zero: "+n);v=-(w=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(lo+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw A=!n,Error(lo+"crypto unavailable");A=n}else A=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(So(n=e[t],0,9,t),b=n),e.hasOwnProperty(t="POW_PRECISION")&&(So(n=e[t],0,vo,t),S=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(lo+t+" not an object: "+n);E=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(lo+t+" invalid: "+n);I="0123456789"==n.slice(0,10),k=n}}return{DECIMAL_PLACES:p,ROUNDING_MODE:g,EXPONENTIAL_AT:[m,y],RANGE:[v,w],CRYPTO:A,MODULO_MODE:b,POW_PRECISION:S,FORMAT:E,ALPHABET:k}},T.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!T.DEBUG)return!0;var t,n,r=e.c,o=e.e,i=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===i||-1===i)&&o>=-vo&&o<=vo&&o===uo(o)){if(0===r[0]){if(0===o&&1===r.length)return!0;break e}if((t=(o+1)%po)<1&&(t+=po),String(r[0]).length==t){for(t=0;t<r.length;t++)if((n=r[t])<0||n>=ho||n!==uo(n))break e;if(0!==n)return!0}}}else if(null===r&&null===o&&(null===i||1===i||-1===i))return!0;throw Error(lo+"Invalid BigNumber: "+e)},T.maximum=T.max=function(){return x(arguments,-1)},T.minimum=T.min=function(){return x(arguments,1)},T.random=(i=9007199254740992,a=Math.random()*i&2097151?function(){return uo(Math.random()*i)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,o,i,s=0,c=[],u=new T(h);if(null==e?e=p:So(e,0,vo),o=co(e/po),A)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));s<o;)(i=131072*t[s]+(t[s+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[s]=n[0],t[s+1]=n[1]):(c.push(i%1e14),s+=2);s=o/2}else{if(!crypto.randomBytes)throw A=!1,Error(lo+"crypto unavailable");for(t=crypto.randomBytes(o*=7);s<o;)(i=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6])>=9e15?crypto.randomBytes(7).copy(t,s):(c.push(i%1e14),s+=7);s=o/7}if(!A)for(;s<o;)(i=a())<9e15&&(c[s++]=i%1e14);for(o=c[--s],e%=po,o&&e&&(i=mo[po-e],c[s]=uo(o/i)*i);0===c[s];c.pop(),s--);if(s<0)c=[r=0];else{for(r=-1;0===c[0];c.splice(0,1),r-=po);for(s=1,i=c[0];i>=10;i/=10,s++);s<po&&(r-=po-s)}return u.e=r,u.c=c,u}),T.sum=function(){for(var e=1,t=arguments,n=new T(t[0]);e<t.length;)n=n.plus(t[e++]);return n},r=function(){var e="0123456789";function t(e,t,n,r){for(var o,i,a=[0],s=0,c=e.length;s<c;){for(i=a.length;i--;a[i]*=t);for(a[0]+=r.indexOf(e.charAt(s++)),o=0;o<a.length;o++)a[o]>n-1&&(null==a[o+1]&&(a[o+1]=0),a[o+1]+=a[o]/n|0,a[o]%=n)}return a.reverse()}return function(r,o,i,a,s){var c,u,l,d,f,h,m,y,v=r.indexOf("."),w=p,A=g;for(v>=0&&(d=S,S=0,r=r.replace(".",""),h=(y=new T(o)).pow(r.length-v),S=d,y.c=t(Io(Ao(h.c),h.e,"0"),10,i,e),y.e=y.c.length),l=d=(m=t(r,o,i,s?(c=k,e):(c=e,k))).length;0==m[--d];m.pop());if(!m[0])return c.charAt(0);if(v<0?--l:(h.c=m,h.e=l,h.s=a,m=(h=n(h,y,w,A,i)).c,f=h.r,l=h.e),v=m[u=l+w+1],d=i/2,f=f||u<0||null!=m[u+1],f=A<4?(null!=v||f)&&(0==A||A==(h.s<0?3:2)):v>d||v==d&&(4==A||f||6==A&&1&m[u-1]||A==(h.s<0?8:7)),u<1||!m[0])r=f?Io(c.charAt(1),-w,c.charAt(0)):c.charAt(0);else{if(m.length=u,f)for(--i;++m[--u]>i;)m[u]=0,u||(++l,m=[1].concat(m));for(d=m.length;!m[--d];);for(v=0,r="";v<=d;r+=c.charAt(m[v++]));r=Io(r,l,c.charAt(0))}return r}}(),n=function(){function e(e,t,n){var r,o,i,a,s=0,c=e.length,u=t%yo,l=t/yo|0;for(e=e.slice();c--;)s=((o=u*(i=e[c]%yo)+(r=l*i+(a=e[c]/yo|0)*u)%yo*yo+s)/n|0)+(r/yo|0)+l*a,e[c]=o%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var o,i;if(n!=r)i=n>r?1:-1;else for(o=i=0;o<n;o++)if(e[o]!=t[o]){i=e[o]>t[o]?1:-1;break}return i}function n(e,t,n,r){for(var o=0;n--;)e[n]-=o,o=e[n]<t[n]?1:0,e[n]=o*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,o,i,a,s){var c,u,l,d,f,h,p,g,m,y,v,w,A,b,S,E,k,I=r.s==o.s?1:-1,_=r.c,x=o.c;if(!(_&&_[0]&&x&&x[0]))return new T(r.s&&o.s&&(_?!x||_[0]!=x[0]:x)?_&&0==_[0]||!x?0*I:I/0:NaN);for(m=(g=new T(I)).c=[],I=i+(u=r.e-o.e)+1,s||(s=ho,u=wo(r.e/po)-wo(o.e/po),I=I/po|0),l=0;x[l]==(_[l]||0);l++);if(x[l]>(_[l]||0)&&u--,I<0)m.push(1),d=!0;else{for(b=_.length,E=x.length,l=0,I+=2,(f=uo(s/(x[0]+1)))>1&&(x=e(x,f,s),_=e(_,f,s),E=x.length,b=_.length),A=E,v=(y=_.slice(0,E)).length;v<E;y[v++]=0);k=x.slice(),k=[0].concat(k),S=x[0],x[1]>=s/2&&S++;do{if(f=0,(c=t(x,y,E,v))<0){if(w=y[0],E!=v&&(w=w*s+(y[1]||0)),(f=uo(w/S))>1)for(f>=s&&(f=s-1),p=(h=e(x,f,s)).length,v=y.length;1==t(h,y,p,v);)f--,n(h,E<p?k:x,p,s),p=h.length,c=1;else 0==f&&(c=f=1),p=(h=x.slice()).length;if(p<v&&(h=[0].concat(h)),n(y,h,v,s),v=y.length,-1==c)for(;t(x,y,E,v)<1;)f++,n(y,E<v?k:x,v,s),v=y.length}else 0===c&&(f++,y=[0]);m[l++]=f,y[0]?y[v++]=_[A]||0:(y=[_[A]],v=1)}while((A++<b||null!=y[0])&&I--);d=null!=y[0],m[0]||m.splice(0,1)}if(s==ho){for(l=1,I=m[0];I>=10;I/=10,l++);R(g,i+(g.e=l+u*po-1)+1,a,d)}else g.e=u,g.r=+d;return g}}(),s=/^(-?)0([xbo])(?=\w[\w.]*$)/i,c=/^([^.]+)\.$/,u=/^\.([^.]+)$/,l=/^-?(Infinity|NaN)$/,d=/^\s*\+(?=[\w.])|^\s+|\s+$/g,o=function(e,t,n,r){var o,i=n?t:t.replace(d,"");if(l.test(i))e.s=isNaN(i)?null:i<0?-1:1;else{if(!n&&(i=i.replace(s,(function(e,t,n){return o="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=o?e:t})),r&&(o=r,i=i.replace(c,"$1").replace(u,"0.$1")),t!=i))return new T(i,o);if(T.DEBUG)throw Error(lo+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},f.absoluteValue=f.abs=function(){var e=new T(this);return e.s<0&&(e.s=1),e},f.comparedTo=function(e,t){return bo(this,new T(e,t))},f.decimalPlaces=f.dp=function(e,t){var n,r,o,i=this;if(null!=e)return So(e,0,vo),null==t?t=g:So(t,0,8),R(new T(i),e+i.e+1,t);if(!(n=i.c))return null;if(r=((o=n.length-1)-wo(this.e/po))*po,o=n[o])for(;o%10==0;o/=10,r--);return r<0&&(r=0),r},f.dividedBy=f.div=function(e,t){return n(this,new T(e,t),p,g)},f.dividedToIntegerBy=f.idiv=function(e,t){return n(this,new T(e,t),0,1)},f.exponentiatedBy=f.pow=function(e,t){var n,r,o,i,a,s,c,u,l=this;if((e=new T(e)).c&&!e.isInteger())throw Error(lo+"Exponent not an integer: "+P(e));if(null!=t&&(t=new T(t)),a=e.e>14,!l.c||!l.c[0]||1==l.c[0]&&!l.e&&1==l.c.length||!e.c||!e.c[0])return u=new T(Math.pow(+P(l),a?e.s*(2-Eo(e)):+P(e))),t?u.mod(t):u;if(s=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new T(NaN);(r=!s&&l.isInteger()&&t.isInteger())&&(l=l.mod(t))}else{if(e.e>9&&(l.e>0||l.e<-1||(0==l.e?l.c[0]>1||a&&l.c[1]>=24e7:l.c[0]<8e13||a&&l.c[0]<=9999975e7)))return i=l.s<0&&Eo(e)?-0:0,l.e>-1&&(i=1/i),new T(s?1/i:i);S&&(i=co(S/po+2))}for(a?(n=new T(.5),s&&(e.s=1),c=Eo(e)):c=(o=Math.abs(+P(e)))%2,u=new T(h);;){if(c){if(!(u=u.times(l)).c)break;i?u.c.length>i&&(u.c.length=i):r&&(u=u.mod(t))}if(o){if(0===(o=uo(o/2)))break;c=o%2}else if(R(e=e.times(n),e.e+1,1),e.e>14)c=Eo(e);else{if(0===(o=+P(e)))break;c=o%2}l=l.times(l),i?l.c&&l.c.length>i&&(l.c.length=i):r&&(l=l.mod(t))}return r?u:(s&&(u=h.div(u)),t?u.mod(t):i?R(u,S,g,undefined):u)},f.integerValue=function(e){var t=new T(this);return null==e?e=g:So(e,0,8),R(t,t.e+1,e)},f.isEqualTo=f.eq=function(e,t){return 0===bo(this,new T(e,t))},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(e,t){return bo(this,new T(e,t))>0},f.isGreaterThanOrEqualTo=f.gte=function(e,t){return 1===(t=bo(this,new T(e,t)))||0===t},f.isInteger=function(){return!!this.c&&wo(this.e/po)>this.c.length-2},f.isLessThan=f.lt=function(e,t){return bo(this,new T(e,t))<0},f.isLessThanOrEqualTo=f.lte=function(e,t){return-1===(t=bo(this,new T(e,t)))||0===t},f.isNaN=function(){return!this.s},f.isNegative=function(){return this.s<0},f.isPositive=function(){return this.s>0},f.isZero=function(){return!!this.c&&0==this.c[0]},f.minus=function(e,t){var n,r,o,i,a=this,s=a.s;if(t=(e=new T(e,t)).s,!s||!t)return new T(NaN);if(s!=t)return e.s=-t,a.plus(e);var c=a.e/po,u=e.e/po,l=a.c,d=e.c;if(!c||!u){if(!l||!d)return l?(e.s=-t,e):new T(d?a:NaN);if(!l[0]||!d[0])return d[0]?(e.s=-t,e):new T(l[0]?a:3==g?-0:0)}if(c=wo(c),u=wo(u),l=l.slice(),s=c-u){for((i=s<0)?(s=-s,o=l):(u=c,o=d),o.reverse(),t=s;t--;o.push(0));o.reverse()}else for(r=(i=(s=l.length)<(t=d.length))?s:t,s=t=0;t<r;t++)if(l[t]!=d[t]){i=l[t]<d[t];break}if(i&&(o=l,l=d,d=o,e.s=-e.s),(t=(r=d.length)-(n=l.length))>0)for(;t--;l[n++]=0);for(t=ho-1;r>s;){if(l[--r]<d[r]){for(n=r;n&&!l[--n];l[n]=t);--l[n],l[r]+=ho}l[r]-=d[r]}for(;0==l[0];l.splice(0,1),--u);return l[0]?C(e,l,u):(e.s=3==g?-1:1,e.c=[e.e=0],e)},f.modulo=f.mod=function(e,t){var r,o,i=this;return e=new T(e,t),!i.c||!e.s||e.c&&!e.c[0]?new T(NaN):!e.c||i.c&&!i.c[0]?new T(i):(9==b?(o=e.s,e.s=1,r=n(i,e,0,3),e.s=o,r.s*=o):r=n(i,e,0,b),(e=i.minus(r.times(e))).c[0]||1!=b||(e.s=i.s),e)},f.multipliedBy=f.times=function(e,t){var n,r,o,i,a,s,c,u,l,d,f,h,p,g,m,y=this,v=y.c,w=(e=new T(e,t)).c;if(!(v&&w&&v[0]&&w[0]))return!y.s||!e.s||v&&!v[0]&&!w||w&&!w[0]&&!v?e.c=e.e=e.s=null:(e.s*=y.s,v&&w?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=wo(y.e/po)+wo(e.e/po),e.s*=y.s,(c=v.length)<(d=w.length)&&(p=v,v=w,w=p,o=c,c=d,d=o),o=c+d,p=[];o--;p.push(0));for(g=ho,m=yo,o=d;--o>=0;){for(n=0,f=w[o]%m,h=w[o]/m|0,i=o+(a=c);i>o;)n=((u=f*(u=v[--a]%m)+(s=h*u+(l=v[a]/m|0)*f)%m*m+p[i]+n)/g|0)+(s/m|0)+h*l,p[i--]=u%g;p[i]=n}return n?++r:p.splice(0,1),C(e,p,r)},f.negated=function(){var e=new T(this);return e.s=-e.s||null,e},f.plus=function(e,t){var n,r=this,o=r.s;if(t=(e=new T(e,t)).s,!o||!t)return new T(NaN);if(o!=t)return e.s=-t,r.minus(e);var i=r.e/po,a=e.e/po,s=r.c,c=e.c;if(!i||!a){if(!s||!c)return new T(o/0);if(!s[0]||!c[0])return c[0]?e:new T(s[0]?r:0*o)}if(i=wo(i),a=wo(a),s=s.slice(),o=i-a){for(o>0?(a=i,n=c):(o=-o,n=s),n.reverse();o--;n.push(0));n.reverse()}for((o=s.length)-(t=c.length)<0&&(n=c,c=s,s=n,t=o),o=0;t;)o=(s[--t]=s[t]+c[t]+o)/ho|0,s[t]=ho===s[t]?0:s[t]%ho;return o&&(s=[o].concat(s),++a),C(e,s,a)},f.precision=f.sd=function(e,t){var n,r,o,i=this;if(null!=e&&e!==!!e)return So(e,1,vo),null==t?t=g:So(t,0,8),R(new T(i),e,t);if(!(n=i.c))return null;if(r=(o=n.length-1)*po+1,o=n[o]){for(;o%10==0;o/=10,r--);for(o=n[0];o>=10;o/=10,r++);}return e&&i.e+1>r&&(r=i.e+1),r},f.shiftedBy=function(e){return So(e,-9007199254740991,go),this.times("1e"+e)},f.squareRoot=f.sqrt=function(){var e,t,r,o,i,a=this,s=a.c,c=a.s,u=a.e,l=p+4,d=new T("0.5");if(1!==c||!s||!s[0])return new T(!c||c<0&&(!s||s[0])?NaN:s?a:1/0);if(0==(c=Math.sqrt(+P(a)))||c==1/0?(((t=Ao(s)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=wo((u+1)/2)-(u<0||u%2),r=new T(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):r=new T(c+""),r.c[0])for((c=(u=r.e)+l)<3&&(c=0);;)if(i=r,r=d.times(i.plus(n(a,i,l,1))),Ao(i.c).slice(0,c)===(t=Ao(r.c)).slice(0,c)){if(r.e<u&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(o||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(R(r,r.e+p+2,1),e=!r.times(r).eq(a));break}if(!o&&(R(i,i.e+p+2,0),i.times(i).eq(a))){r=i;break}l+=4,c+=4,o=1}return R(r,r.e+p+1,g,e)},f.toExponential=function(e,t){return null!=e&&(So(e,0,vo),e++),_(this,e,t,1)},f.toFixed=function(e,t){return null!=e&&(So(e,0,vo),e=e+this.e+1),_(this,e,t)},f.toFormat=function(e,t,n){var r,o=this;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=E;else if("object"!=typeof n)throw Error(lo+"Argument not an object: "+n);if(r=o.toFixed(e,t),o.c){var i,a=r.split("."),s=+n.groupSize,c=+n.secondaryGroupSize,u=n.groupSeparator||"",l=a[0],d=a[1],f=o.s<0,h=f?l.slice(1):l,p=h.length;if(c&&(i=s,s=c,c=i,p-=i),s>0&&p>0){for(i=p%s||s,l=h.substr(0,i);i<p;i+=s)l+=u+h.substr(i,s);c>0&&(l+=u+h.slice(i)),f&&(l="-"+l)}r=d?l+(n.decimalSeparator||"")+((c=+n.fractionGroupSize)?d.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):d):l}return(n.prefix||"")+r+(n.suffix||"")},f.toFraction=function(e){var t,r,o,i,a,s,c,u,l,d,f,p,m=this,y=m.c;if(null!=e&&(!(c=new T(e)).isInteger()&&(c.c||1!==c.s)||c.lt(h)))throw Error(lo+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+P(c));if(!y)return new T(m);for(t=new T(h),l=r=new T(h),o=u=new T(h),p=Ao(y),a=t.e=p.length-m.e-1,t.c[0]=mo[(s=a%po)<0?po+s:s],e=!e||c.comparedTo(t)>0?a>0?t:l:c,s=w,w=1/0,c=new T(p),u.c[0]=0;d=n(c,t,0,1),1!=(i=r.plus(d.times(o))).comparedTo(e);)r=o,o=i,l=u.plus(d.times(i=l)),u=i,t=c.minus(d.times(i=t)),c=i;return i=n(e.minus(r),o,0,1),u=u.plus(i.times(l)),r=r.plus(i.times(o)),u.s=l.s=m.s,f=n(l,o,a*=2,g).minus(m).abs().comparedTo(n(u,r,a,g).minus(m).abs())<1?[l,o]:[u,r],w=s,f},f.toNumber=function(){return+P(this)},f.toPrecision=function(e,t){return null!=e&&So(e,1,vo),_(this,e,t,2)},f.toString=function(e){var t,n=this,o=n.s,i=n.e;return null===i?o?(t="Infinity",o<0&&(t="-"+t)):t="NaN":(null==e?t=i<=m||i>=y?ko(Ao(n.c),i):Io(Ao(n.c),i,"0"):10===e&&I?t=Io(Ao((n=R(new T(n),p+i+1,g)).c),n.e,"0"):(So(e,2,k.length,"Base"),t=r(Io(Ao(n.c),i,"0"),10,e,o,!0)),o<0&&n.c[0]&&(t="-"+t)),t},f.valueOf=f.toJSON=function(){return P(this)},f._isBigNumber=!0,f[Symbol.toStringTag]="BigNumber",f[Symbol.for("nodejs.util.inspect.custom")]=f.valueOf,null!=t&&T.set(t),T}();const _o=To;function xo(e,t){return D(e,(e=>"string"==typeof e&&t.test(e)))}const Co=/^(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})$/u,Ro=/^[-a-z0-9]{3,8}$/u,Po=/^[-_a-zA-Z0-9]{1,32}$/u,No=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})):(?<accountAddress>[-.%a-zA-Z0-9]{1,128})$/u,Bo=/^[-.%a-zA-Z0-9]{1,128}$/u,Oo=/^[-a-z0-9]{3,8}$/u,Mo=/^[-.%a-zA-Z0-9]{1,128}$/u,zo=/^[-.%a-zA-Z0-9]{1,78}$/u,jo=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u,Uo=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u,Do=(xo("CaipChainId",Co),xo("CaipNamespace",Ro),xo("CaipReference",Po),xo("CaipAccountId",No),xo("CaipAccountAddress",Bo),xo("CaipAssetNamespace",Oo),xo("CaipAssetReference",Mo),xo("CaipTokenId",zo),xo("CaipAssetType",jo));xo("CaipAssetId",Uo),xo("CaipAssetTypeOrId",/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})(\/(?<tokenId>[-.%a-zA-Z0-9]{1,78}))?$/u);var Lo;function Fo(e){const t=jo.exec(e);if(!t?.groups)throw new Error("Invalid CAIP asset type.");return{assetNamespace:t.groups.assetNamespace,assetReference:t.groups.assetReference,chainId:t.groups.chainId,chain:{namespace:t.groups.namespace,reference:t.groups.reference}}}function $o(e,t){return n=e,Boolean("string"==typeof n?.prototype?.constructor?.name)?new e({message:t}):e({message:t});var n}!function(e){e.Bip122="bip122",e.Solana="solana",e.Eip155="eip155",e.Wallet="wallet"}(Lo=Lo||(Lo={}));class qo extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}function Wo(e,t="Assertion failed.",n=qo){if(!e){if(t instanceof Error)throw t;throw $o(n,t)}}var Vo=4,Ko=5,Go=6,Ho=10,Zo=-32700,Jo=-32603,Yo=-32602,Qo=-32601,Xo=-32600,ei=-32015,ti=-32014,ni=-32012,ri=-32010,oi=-32009,ii=-32007,ai=-32006,si=-32004,ci=-32002,ui=-32001,li=28e5,di=2800001,fi=2800003,hi=2800006,pi=2800007,gi=2800008,mi=2800009,yi=32300001,vi=3230004,wi=361e4,Ai=3610001,bi=3610003,Si=3610005,Ei=3610006,ki=3610007,Ii=3704001,Ti=3704002,_i=3704003,xi=4615e3,Ci=4615026,Ri=4615045,Pi=5508e3,Ni=5663e3,Bi=5663001,Oi=5663004,Mi=5663005,zi=5663006,ji=5663007,Ui=5663008,Di=5663009,Li=5663012,Fi=5663015,$i=5663016,qi=5663017,Wi=5663018,Vi=5663019,Ki=705e4,Gi=7050030,Hi=7050031,Zi=7050035,Ji=8078e3,Yi=8078001,Qi=8078002,Xi=8078004,ea=8078005,ta=8078006,na=8078007,ra=8078008,oa=8078010,ia=8078011,aa=8078012,sa=8078013,ca=8078014,ua=8078017,la=8078018,da=8078022,fa=81e5,ha=8100002,pa=8100003,ga=9900003;function ma(e){if(Array.isArray(e)){return"%5B"+e.map(ma).join("%2C%20")+"%5D"}return"bigint"==typeof e?`${e}n`:encodeURIComponent(String(null!=e&&null===Object.getPrototypeOf(e)?{...e}:e))}function ya([e,t]){return`${e}=${ma(t)}`}function va(e,t={}){{let n=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(n+=` '${function(e){const t=Object.entries(e).map(ya).join("&");return btoa(t)}(t)}'`),`${n}\``}}function wa(e,t){return!!(e instanceof Error&&"SolanaError"===e.name)&&(void 0===t||e.context.__code===t)}var Aa=class extends Error{cause=this.cause;context;constructor(...[e,t]){let n,r;if(t){const{cause:e,...o}=t;e&&(r={cause:e}),Object.keys(o).length>0&&(n=o)}super(va(e,n),r),this.context={__code:e,...n},this.name="SolanaError"}};function ba(...e){"captureStackTrace"in Error&&"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(...e)}function Sa({errorCodeBaseOffset:e,getErrorContext:t,orderedErrorNames:n,rpcEnumError:r},o){let i,a;"string"==typeof r?i=r:(i=Object.keys(r)[0],a=r[i]);const s=e+n.indexOf(i),c=t(s,i,a),u=new Aa(s,c);return ba(u,o),u}var Ea=["GenericError","InvalidArgument","InvalidInstructionData","InvalidAccountData","AccountDataTooSmall","InsufficientFunds","IncorrectProgramId","MissingRequiredSignature","AccountAlreadyInitialized","UninitializedAccount","UnbalancedInstruction","ModifiedProgramId","ExternalAccountLamportSpend","ExternalAccountDataModified","ReadonlyLamportChange","ReadonlyDataModified","DuplicateAccountIndex","ExecutableModified","RentEpochModified","NotEnoughAccountKeys","AccountDataSizeChanged","AccountNotExecutable","AccountBorrowFailed","AccountBorrowOutstanding","DuplicateAccountOutOfSync","Custom","InvalidError","ExecutableDataModified","ExecutableLamportChange","ExecutableAccountNotRentExempt","UnsupportedProgramId","CallDepth","MissingAccount","ReentrancyNotAllowed","MaxSeedLengthExceeded","InvalidSeeds","InvalidRealloc","ComputationalBudgetExceeded","PrivilegeEscalation","ProgramEnvironmentSetupFailure","ProgramFailedToComplete","ProgramFailedToCompile","Immutable","IncorrectAuthority","BorshIoError","AccountNotRentExempt","InvalidAccountOwner","ArithmeticOverflow","UnsupportedSysvar","IllegalOwner","MaxAccountsDataAllocationsExceeded","MaxAccountsExceeded","MaxInstructionTraceLengthExceeded","BuiltinProgramsMustConsumeComputeUnits"];function ka(e,t){const n=Number(e);return Sa({errorCodeBaseOffset:4615001,getErrorContext:(e,t,r)=>e===xi?{errorName:t,index:n,...void 0!==r?{instructionErrorContext:r}:null}:e===Ci?{code:Number(r),index:n}:e===Ri?{encodedData:r,index:n}:{index:n},orderedErrorNames:Ea,rpcEnumError:t},ka)}var Ia=["AccountInUse","AccountLoadedTwice","AccountNotFound","ProgramAccountNotFound","InsufficientFundsForFee","InvalidAccountForFee","AlreadyProcessed","BlockhashNotFound","CallChainTooDeep","MissingSignatureForFee","InvalidAccountIndex","SignatureFailure","InvalidProgramForExecution","SanitizeFailure","ClusterMaintenance","AccountBorrowOutstanding","WouldExceedMaxBlockCostLimit","UnsupportedVersion","InvalidWritableAccount","WouldExceedMaxAccountCostLimit","WouldExceedAccountDataBlockLimit","TooManyAccountLocks","AddressLookupTableNotFound","InvalidAddressLookupTableOwner","InvalidAddressLookupTableData","InvalidAddressLookupTableIndex","InvalidRentPayingAccount","WouldExceedMaxVoteCostLimit","WouldExceedAccountDataTotalLimit","DuplicateInstruction","InsufficientFundsForRent","MaxLoadedAccountsDataSizeExceeded","InvalidLoadedAccountsDataSizeLimit","ResanitizationNeeded","ProgramExecutionTemporarilyRestricted","UnbalancedTransaction"];function Ta(e){return"object"==typeof e&&"InstructionError"in e?ka(...e.InstructionError):Sa({errorCodeBaseOffset:7050001,getErrorContext:(e,t,n)=>e===Ki?{errorName:t,...void 0!==n?{transactionErrorContext:n}:null}:e===Gi?{index:Number(n)}:e===Hi||e===Zi?{accountIndex:Number(n.account_index)}:void 0,orderedErrorNames:Ia,rpcEnumError:e},Ta)}function _a(e){let t;if("object"==typeof(n=e)&&null!==n&&"code"in n&&"message"in n&&("number"==typeof n.code||"bigint"==typeof n.code)&&"string"==typeof n.message){const{code:n,data:r,message:o}=e,i=Number(n);if(i===ci){const{err:e,...n}=r,o=e?{cause:Ta(e)}:null;t=new Aa(ci,{...n,...o})}else{let e;switch(i){case Jo:case Yo:case Xo:case Qo:case Zo:case ni:case ui:case si:case ti:case ri:case oi:case ii:case ai:case ei:e={__serverMessage:o};break;default:"object"!=typeof r||Array.isArray(r)||(e=r)}t=new Aa(i,e)}}else{const n="object"==typeof e&&null!==e&&"message"in e&&"string"==typeof e.message?e.message:"Malformed JSON-RPC error with no message attribute";t=new Aa(Ho,{error:e,message:n})}var n;return ba(t,_a),t}var xa=(e,t)=>((e,t)=>{if(e.length>=t)return e;const n=new Uint8Array(t).fill(0);return n.set(e),n})(e.length<=t?e:e.slice(0,t),t);function Ca(e,t,n){const r=0===n&&e.length===t.length?e:e.slice(n,n+t.length);return r.length===t.length&&t.every(((e,t)=>e===r[t]))}function Ra(e,t){return"fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function Pa(e){return Object.freeze({...e,encode:t=>{const n=new Uint8Array(Ra(t,e));return e.write(t,n,0),n}})}function Na(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0]})}function Ba(e){return"fixedSize"in e&&"number"==typeof e.fixedSize}function Oa(e){if(!Ba(e))throw new Aa(Qi)}function Ma(e){return!Ba(e)}function za(e,t){if(Ba(e)!==Ba(t))throw new Aa(Xi);if(Ba(e)&&Ba(t)&&e.fixedSize!==t.fixedSize)throw new Aa(ea,{decoderFixedSize:t.fixedSize,encoderFixedSize:e.fixedSize});if(!Ba(e)&&!Ba(t)&&e.maxSize!==t.maxSize)throw new Aa(ta,{decoderMaxSize:t.maxSize,encoderMaxSize:e.maxSize});return{...t,...e,decode:t.decode,encode:e.encode,read:t.read,write:e.write}}function ja(e,t,n,r=0){const o=n.length-r;if(o<t)throw new Aa(Yi,{bytesLength:o,codecDescription:e,expected:t})}function Ua(e,t,n){if(t<0||t>n)throw new Aa(ca,{bytesLength:n,codecDescription:e,offset:t})}function Da(e,t){const n=(n,r,o)=>{const i=e.encode(n);return o=t.write(i.length,r,o),r.set(i,o),o+i.length};if(Ba(t)&&Ba(e))return Pa({...e,fixedSize:t.fixedSize+e.fixedSize,write:n});const r=Ba(t)?t.fixedSize:t.maxSize??null,o=Ba(e)?e.fixedSize:e.maxSize??null,i=null!==r&&null!==o?r+o:null;return Pa({...e,...null!==i?{maxSize:i}:{},getSizeFromValue:n=>{const r=Ra(n,e);return Ra(r,t)+r},write:n})}function La(e,t){const n=(n,r)=>{const[o,i]=t.read(n,r),a=Number(o);return((r=i)>0||n.length>a)&&(n=n.slice(r,r+a)),ja("addDecoderSizePrefix",a,n),[e.decode(n),r+a]};if(Ba(t)&&Ba(e))return Na({...e,fixedSize:t.fixedSize+e.fixedSize,read:n});const r=Ba(t)?t.fixedSize:t.maxSize??null,o=Ba(e)?e.fixedSize:e.maxSize??null,i=null!==r&&null!==o?r+o:null;return Na({...e,...null!==i?{maxSize:i}:{},read:n})}function Fa(e,t){return Pa({fixedSize:t,write:(n,r,o)=>{const i=e.encode(n),a=i.length>t?i.slice(0,t):i;return r.set(a,o),o+t}})}function $a(e,t){return Na({fixedSize:t,read:(n,r)=>{ja("fixCodecSize",t,n,r),(r>0||n.length>t)&&(n=n.slice(r,r+t)),Ba(e)&&(n=xa(n,e.fixedSize));const[o]=e.read(n,0);return[o,r+t]}})}function qa(e,t){return Na({...e,read:(n,r)=>{const o=e=>Wa(e,n.length),i=t.preOffset?t.preOffset({bytes:n,preOffset:r,wrapBytes:o}):r;Ua("offsetDecoder",i,n.length);const[a,s]=e.read(n,i),c=t.postOffset?t.postOffset({bytes:n,newPreOffset:i,postOffset:s,preOffset:r,wrapBytes:o}):s;return Ua("offsetDecoder",c,n.length),[a,c]}})}function Wa(e,t){return 0===t?0:(e%t+t)%t}function Va(e,t){if(Ba(e)){const n=t(e.fixedSize);if(n<0)throw new Aa(sa,{bytesLength:n,codecDescription:"resizeDecoder"});return Na({...e,fixedSize:n})}return e}function Ka(e,t){return qa(Va(e,(e=>e+t)),{postOffset:({postOffset:e})=>e+t})}function Ga(e,t){return Pa({...Ma(e)?{...e,getSizeFromValue:n=>e.getSizeFromValue(t(n))}:e,write:(n,r,o)=>e.write(t(n),r,o)})}function Ha(e,t){return Na({...e,read:(n,r)=>{const[o,i]=e.read(n,r);return[t(o,n,r),i]}})}function Za(e,t,n,r){if(r<t||r>n)throw new Aa(ia,{codecDescription:e,max:n,min:t,value:r})}var Ja,Ya=((Ja=Ya||{})[Ja.Little=0]="Little",Ja[Ja.Big=1]="Big",Ja);function Qa(e){return 1!==e?.endian}function Xa(e){return Pa({fixedSize:e.size,write(t,n,r){e.range&&Za(e.name,e.range[0],e.range[1],t);const o=new ArrayBuffer(e.size);return e.set(new DataView(o),t,Qa(e.config)),n.set(new Uint8Array(o),r),r+e.size}})}function es(e){return Na({fixedSize:e.size,read(t,n=0){!function(e,t,n=0){if(t.length-n<=0)throw new Aa(Ji,{codecDescription:e})}(e.name,t,n),ja(e.name,e.size,t,n);const r=new DataView(function(e,t,n){const r=e.byteOffset+(t??0),o=n??e.byteLength;return e.buffer.slice(r,r+o)}(t,n,e.size));return[e.get(r,Qa(e.config)),n+e.size]}})}var ts=(e={})=>es({config:e,get:(e,t)=>e.getFloat64(0,t),name:"f64",size:8}),ns=(e={})=>es({config:e,get:(e,t)=>e.getInt16(0,t),name:"i16",size:2}),rs=(e={})=>es({config:e,get:(e,t)=>e.getBigInt64(0,t),name:"i64",size:8}),os=()=>es({get:e=>e.getInt8(0),name:"i8",size:1}),is=()=>Pa({getSizeFromValue:e=>e<=127?1:e<=16383?2:3,maxSize:3,write:(e,t,n)=>{Za("shortU16",0,65535,e);const r=[0];for(let t=0;;t+=1){const n=Number(e)>>7*t;if(0===n)break;const o=127&n;r[t]=o,t>0&&(r[t-1]|=128)}return t.set(r,n),n+r.length}}),as=()=>Na({maxSize:3,read:(e,t)=>{let n=0,r=0;for(;++r;){const o=r-1,i=e[t+o];if(n|=(127&i)<<7*o,0==(128&i))break}return[n,t+r]}}),ss=(e={})=>es({config:e,get:(e,t)=>e.getUint16(0,t),name:"u16",size:2}),cs=(e={})=>Xa({config:e,name:"u32",range:[0,Number("0xffffffff")],set:(e,t,n)=>e.setUint32(0,Number(t),n),size:4}),us=(e={})=>es({config:e,get:(e,t)=>e.getUint32(0,t),name:"u32",size:4}),ls=(e={})=>Xa({config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,t,n)=>e.setBigUint64(0,BigInt(t),n),size:8}),ds=(e={})=>es({config:e,get:(e,t)=>e.getBigUint64(0,t),name:"u64",size:8}),fs=()=>Xa({name:"u8",range:[0,Number("0xff")],set:(e,t)=>e.setUint8(0,Number(t)),size:1}),hs=()=>es({get:e=>e.getUint8(0),name:"u8",size:1});var ps,gs=((ps=gs||{})[ps.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",ps[ps.READONLY_SIGNER=2]="READONLY_SIGNER",ps[ps.WRITABLE=1]="WRITABLE",ps[ps.READONLY=0]="READONLY",ps),ms=2,ys=1;function vs(e){return e>=2}function ws(e){return 0!=(e&ys)}function As(e,t){return e|t}function bs(e){return e|ms}function Ss(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new Aa(aa,{alphabet:e,base:e.length,value:n})}var Es=e=>Pa({getSizeFromValue:t=>{const[n,r]=Ts(t,e[0]);if(!r)return t.length;const o=_s(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(Ss(e,t),""===t)return r;const[o,i]=Ts(t,e[0]);if(!i)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let a=_s(i,e);const s=[];for(;a>0n;)s.unshift(Number(a%256n)),a/=256n;const c=[...Array(o.length).fill(0),...s];return n.set(c,r),r+c.length}}),ks=e=>Na({read(t,n){const r=0===n?t:t.slice(n);if(0===r.length)return["",0];let o=r.findIndex((e=>0!==e));o=-1===o?r.length:o;const i=e[0].repeat(o);if(o===r.length)return[i,t.length];const a=function(e,t){const n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}(r.slice(o).reduce(((e,t)=>256n*e+BigInt(t)),0n),e);return[i+a,t.length]}}),Is=e=>za(Es(e),ks(e));function Ts(e,t){const[n,r]=e.split(new RegExp(`((?!${t}).*)`));return[n,r]}function _s(e,t){const n=BigInt(t.length);let r=0n;for(const o of e)r*=n,r+=BigInt(t.indexOf(o));return r}var xs="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Cs=()=>Es(xs),Rs=()=>ks(xs),Ps=()=>Is(xs);var Ns,Bs,Os="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ms=()=>Pa({getSizeFromValue:e=>{try{return atob(e).length}catch{throw new Aa(aa,{alphabet:Os,base:64,value:e})}},write(e,t,n){try{const r=atob(e).split("").map((e=>e.charCodeAt(0)));return t.set(r,n),r.length+n}catch{throw new Aa(aa,{alphabet:Os,base:64,value:e})}}}),zs=()=>Na({read(e,t=0){const n=e.slice(t);return[btoa(String.fromCharCode(...n)),e.length]}}),js=()=>za(Ms(),zs()),Us=e=>e.replace(/\u0000/g,""),Ds=globalThis.TextDecoder,Ls=globalThis.TextEncoder,Fs=()=>{let e;return Na({read(t,n){const r=(e||=new Ds).decode(t.slice(n));return[Us(r),t.length]}})},$s=()=>za((()=>{let e;return Pa({getSizeFromValue:t=>(e||=new Ls).encode(t).length,write:(t,n,r)=>{const o=(e||=new Ls).encode(t);return n.set(o,r),r+o.length}})})(),Fs());function qs(){if(!globalThis.isSecureContext)throw new Aa(wi)}function Ws(){if(qs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.exportKey)throw new Aa(bi)}function Vs(){return Ns||(Ns=Cs()),Ns}function Ks(e){if(e.length<32||e.length>44)return!1;const t=Vs();try{return 32===t.encode(e).byteLength}catch{return!1}}function Gs(e){if(e.length<32||e.length>44)throw new Aa(di,{actualLength:e.length});const t=Vs().encode(e).byteLength;if(32!==t)throw new Aa(li,{actualLength:t})}function Hs(e){return Gs(e),e}function Zs(){return Ga(Fa(Vs(),32),(e=>Hs(e)))}function Js(){return $a((Bs||(Bs=Rs()),Bs),32)}function Ys(){return za(Zs(),Js())}function Qs(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}var Xs=37095705934669439343138083508754565189542113879843219016388785533085940283555n,ec=57896044618658097711785492504343953926634992332820282019728792003956564819949n,tc=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function nc(e){const t=e%ec;return t>=0n?t:ec+t}function rc(e,t){let n=e;for(;t-- >0n;)n*=n,n%=ec;return n}function oc(e,t){const n=nc(t*t*t),r=function(e){const t=e*e%ec*e%ec,n=rc(t,2n)*t%ec,r=rc(n,1n)*e%ec,o=rc(r,5n)*r%ec,i=rc(o,10n)*o%ec,a=rc(i,20n)*i%ec,s=rc(a,40n)*a%ec,c=rc(s,80n)*s%ec,u=rc(c,80n)*s%ec,l=rc(u,10n)*o%ec;return rc(l,2n)*e%ec}(e*nc(n*n*t));let o=nc(e*n*r);const i=nc(t*o*o),a=o,s=nc(o*tc),c=i===e,u=i===nc(-e),l=i===nc(-e*tc);return c&&(o=a),(u||l)&&(o=s),1n===(1n&nc(o))&&(o=nc(-o)),c||u?o:null}function ic(e){if(32!==e.byteLength)return!1;const t=function(e){const t=e.reduce(((e,t,n)=>`${function(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}(31===n?-129&t:t)}${e}`),"");return BigInt(`0x${t}`)}(e);return function(e,t){const n=nc(e*e),r=oc(nc(n-1n),nc(Xs*n+1n));return null!==r&&(0n!==r||!(0!=(128&t)))}(t,e[31])}var ac=32,sc=16,cc=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,100,114,101,115,115];async function uc({programAddress:e,seeds:t}){if(function(){if(qs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.digest)throw new Aa(Ai)}(),t.length>sc)throw new Aa(hi,{actual:t.length,maxSeeds:sc});let n;const r=t.reduce(((e,t,r)=>{const o="string"==typeof t?(n||=new TextEncoder).encode(t):t;if(o.byteLength>ac)throw new Aa(pi,{actual:o.byteLength,index:r,maxSeedLength:ac});return e.push(...o),e}),[]),o=Ys(),i=o.encode(e),a=await crypto.subtle.digest("SHA-256",new Uint8Array([...r,...i,...cc])),s=new Uint8Array(a);if(ic(s))throw new Aa(gi);return o.decode(s)}async function lc({programAddress:e,seeds:t}){let n=255;for(;n>0;)try{return[await uc({programAddress:e,seeds:[...t,new Uint8Array([n])]}),n]}catch(e){if(!wa(e,gi))throw e;n--}throw new Aa(mi)}async function dc(e){if(Ws(),"public"!==e.type||"Ed25519"!==e.algorithm.name)throw new Aa(fi);const t=await crypto.subtle.exportKey("raw",e);return Js().decode(new Uint8Array(t))}var fc,hc=Object.freeze({name:"Ed25519"});async function pc(e,t){const n=e.byteLength;if(32!==n)throw new Aa(Ii,{actualLength:n});const r=function(e){return new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32,...e])}(e);return await crypto.subtle.importKey("pkcs8",r,hc,t??!1,["sign"])}async function gc(e,t){!function(){if(qs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.sign)throw new Aa(Si)}();const n=await crypto.subtle.sign(hc,e,t);return new Uint8Array(n)}function mc(e){return function(e){if(fc||(fc=Cs()),e.length<64||e.length>88)throw new Aa(_i,{actualLength:e.length});const t=fc.encode(e).byteLength;if(64!==t)throw new Aa(Ti,{actualLength:t})}(e),e}async function yc(e,t,n){return function(){if(qs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.verify)throw new Aa(Ei)}(),await crypto.subtle.verify(hc,e,t,n)}async function vc(e,t=!1){const n=pc(e,t),[r,o]=await Promise.all([(t?n:pc(e,!0)).then((async e=>await async function(e,t=!1){if(Ws(),!1===e.extractable)throw new Aa(ki,{key:e});const n=await crypto.subtle.exportKey("jwk",e);return await crypto.subtle.importKey("jwk",{crv:"Ed25519",ext:t,key_ops:["verify"],kty:"OKP",x:n.x},"Ed25519",t,["verify"])}(e,!0))),n]);return{privateKey:o,publicKey:r}}function wc(e,t,n){if(t!==n)throw new Aa(na,{actual:n,codecDescription:e,expected:t})}function Ac(e){return e.reduce(((e,t)=>null===e||null===t?null:e+t),0)}function bc(e){return Ba(e)?e.fixedSize:null}function Sc(e){return Ba(e)?e.fixedSize:e.maxSize??null}function Ec(e,t={}){const n=t.size??cs(),r=Ic(n,bc(e)),o=Ic(n,Sc(e))??void 0;return Pa({...null!==r?{fixedSize:r}:{getSizeFromValue:t=>("object"==typeof n?Ra(t.length,n):0)+[...t].reduce(((t,n)=>t+Ra(n,e)),0),maxSize:o},write:(t,r,o)=>("number"==typeof n&&wc("array",n,t.length),"object"==typeof n&&(o=n.write(t.length,r,o)),t.forEach((t=>{o=e.write(t,r,o)})),o)})}function kc(e,t={}){const n=t.size??us(),r=bc(e),o=Ic(n,r),i=Ic(n,Sc(e))??void 0;return Na({...null!==o?{fixedSize:o}:{maxSize:i},read:(t,r)=>{const o=[];if("object"==typeof n&&0===t.slice(r).length)return[o,r];if("remainder"===n){for(;r<t.length;){const[n,i]=e.read(t,r);r=i,o.push(n)}return[o,r]}const[i,a]="number"==typeof n?[n,r]:n.read(t,r);r=a;for(let n=0;n<i;n+=1){const[n,i]=e.read(t,r);r=i,o.push(n)}return[o,r]}})}function Ic(e,t){return"number"!=typeof e?null:0===e?0:null===t?null:t*e}function Tc(e={}){return Ga(e.size??fs(),(e=>e?1:0))}function _c(e={}){return Ha(e.size??hs(),(e=>1===Number(e)))}function xc(){return Pa({getSizeFromValue:e=>e.length,write:(e,t,n)=>(t.set(e,n),n+e.length)})}function Cc(){return Na({read:(e,t)=>{const n=e.slice(t);return[n,t+n.length]}})}var Rc=()=>Na({read(e,t){const n=e.slice(t).reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),"");return[n,e.length]}});function Pc(e){return Pa({fixedSize:e.length,write:(t,n,r)=>(n.set(e,r),r+e.length)})}function Nc(e){return Na({fixedSize:e.length,read:(t,n)=>{const r=Rc();if(!Ca(t,e,n))throw new Aa(la,{constant:e,data:t,hexConstant:r.decode(e),hexData:r.decode(t),offset:n});return[void 0,n+e.length]}})}function Bc(e){const t=Ac(e.map(bc)),n=Ac(e.map(Sc))??void 0;return Pa({...null===t?{getSizeFromValue:t=>e.map(((e,n)=>Ra(t[n],e))).reduce(((e,t)=>e+t),0),maxSize:n}:{fixedSize:t},write:(t,n,r)=>(wc("tuple",e.length,t.length),e.forEach(((e,o)=>{r=e.write(t[o],n,r)})),r)})}function Oc(e){const t=Ac(e.map(bc)),n=Ac(e.map(Sc))??void 0;return Na({...null===t?{maxSize:n}:{fixedSize:t},read:(t,n)=>{const r=[];return e.forEach((e=>{const[o,i]=e.read(t,n);r.push(o),n=i})),[r,n]}})}function Mc(e,t){const n=Uc(e),r=(n,r,o)=>{const i=t(n);return jc(e,i),e[i].write(n,r,o)};if(null!==n)return Pa({fixedSize:n,write:r});const o=Dc(e);return Pa({...null!==o?{maxSize:o}:{},getSizeFromValue:n=>{const r=t(n);return jc(e,r),Ra(n,e[r])},write:r})}function zc(e,t){const n=Uc(e),r=(n,r)=>{const o=t(n,r);return jc(e,o),e[o].read(n,r)};if(null!==n)return Na({fixedSize:n,read:r});const o=Dc(e);return Na({...null!==o?{maxSize:o}:{},read:r})}function jc(e,t){if(void 0===e[t])throw new Aa(ua,{maxRange:e.length-1,minRange:0,variant:t})}function Uc(e){if(0===e.length)return 0;if(!Ba(e[0]))return null;const t=e[0].fixedSize;return e.every((e=>Ba(e)&&e.fixedSize===t))?t:null}function Dc(e){return e.map((e=>Sc(e))).reduce(((e,t)=>null===e||null===t?null:Math.max(e,t)),0)}function Lc(e,t={}){const n=t.discriminator??"__kind",r=t.size??hs();return zc(e.map((([e,t])=>Ha(Oc([r,t]),(([,t])=>({[n]:e,...t}))))),((e,t)=>Number(r.read(e,t)[0])))}function Fc(e){const t=[...new Set(Object.values(e).filter((e=>"number"==typeof e)))].sort(),n=Object.fromEntries(Object.entries(e).slice(t.length)),r=Object.keys(n),o=Object.values(n),i=[...new Set([...r,...o.filter((e=>"string"==typeof e))])];return{enumKeys:r,enumRecord:n,enumValues:o,numericalValues:t,stringValues:i}}function $c(e,t){let n=e.length;for(;n--;)if(t(e[n],n,e))return n;return-1}function qc(e){if(0===e.length)return"";let t=[e[0],e[0]];const n=[];for(let r=1;r<e.length;r++){const o=e[r];t[1]+1===o?t[1]=o:(n.push(t[0]===t[1]?`${t[0]}`:`${t[0]}-${t[1]}`),t=[o,o])}return n.push(t[0]===t[1]?`${t[0]}`:`${t[0]}-${t[1]}`),n.join(", ")}function Wc(e,t={}){const n=t.size??fs(),r=t.useValuesAsDiscriminators??!1,{enumKeys:o,enumValues:i,numericalValues:a,stringValues:s}=Fc(e);if(r&&i.some((e=>"string"==typeof e)))throw new Aa(da,{stringValues:i.filter((e=>"string"==typeof e))});return Ga(n,(e=>{const t=function({enumKeys:e,enumValues:t,variant:n}){const r=$c(t,(e=>e===n));return r>=0?r:e.findIndex((e=>e===n))}({enumKeys:o,enumValues:i,variant:e});if(t<0)throw new Aa(oa,{formattedNumericalValues:qc(a),numericalValues:a,stringValues:s,variant:e});return r?i[t]:t}))}function Vc(e,t={}){const n=t.size??hs(),r=t.useValuesAsDiscriminators??!1,{enumKeys:o,enumValues:i,numericalValues:a}=Fc(e);if(r&&i.some((e=>"string"==typeof e)))throw new Aa(da,{stringValues:i.filter((e=>"string"==typeof e))});return Ha(n,(e=>{const t=Number(e),n=function({discriminator:e,enumKeys:t,enumValues:n,useValuesAsDiscriminators:r}){return r?$c(n,(t=>t===e)):e>=0&&e<t.length?e:-1}({discriminator:t,enumKeys:o,enumValues:i,useValuesAsDiscriminators:r});if(n<0){const e=r?a:[...Array(o.length).keys()];throw new Aa(ra,{discriminator:t,formattedValidDiscriminators:qc(e),validDiscriminators:e})}return i[n]}))}var Kc;function Gc(){return Pa({fixedSize:0,write:(e,t,n)=>n})}function Hc(){return Na({fixedSize:0,read:(e,t)=>[void 0,t]})}function Zc(e){const t=e.map((([,e])=>e)),n=Ac(t.map(bc)),r=Ac(t.map(Sc))??void 0;return Pa({...null===n?{getSizeFromValue:t=>e.map((([e,n])=>Ra(t[e],n))).reduce(((e,t)=>e+t),0),maxSize:r}:{fixedSize:n},write:(t,n,r)=>(e.forEach((([e,o])=>{r=o.write(t[e],n,r)})),r)})}function Jc(e){const t=e.map((([,e])=>e)),n=Ac(t.map(bc)),r=Ac(t.map(Sc))??void 0;return Na({...null===n?{maxSize:r}:{fixedSize:n},read:(t,n)=>{const r={};return e.forEach((([e,o])=>{const[i,a]=o.read(t,n);n=a,r[e]=i})),[r,n]}})}function Yc(){return Kc||(Kc=Cs()),Kc}function Qc(e){if(e.length<32||e.length>44)throw new Aa(Vo,{actualLength:e.length});const t=Yc().encode(e).byteLength;if(32!==t)throw new Aa(Ko,{actualLength:t})}function Xc(e){switch(e){case"finalized":return 2;case"confirmed":return 1;case"processed":return 0;default:throw new Aa(ga,{unexpectedValue:e})}}var eu=18446744073709551615n;function tu(e){return function(e){if(e<0||e>eu)throw new Aa(Go)}(e),e}function nu(e,...t){return t.reduce(((e,t)=>t(e)),e)}function ru(e){if(!("lifetimeConstraint"in e&&"string"==typeof e.lifetimeConstraint.blockhash&&"bigint"==typeof e.lifetimeConstraint.lastValidBlockHeight))return!1;try{return Qc(e.lifetimeConstraint.blockhash),!0}catch{return!1}}function ou(e,t){if("lifetimeConstraint"in t&&t.lifetimeConstraint.blockhash===e.blockhash&&t.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight)return t;const n={...t,lifetimeConstraint:Object.freeze(e)};return Object.freeze(n),n}var iu=e=>Pa({getSizeFromValue:t=>{const[n,r]=su(t,e[0]);if(!r)return t.length;const o=cu(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(function(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new Aa(aa,{alphabet:e,base:e.length,value:n})}(e,t),""===t)return r;const[o,i]=su(t,e[0]);if(!i)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let a=cu(i,e);const s=[];for(;a>0n;)s.unshift(Number(a%256n)),a/=256n;const c=[...Array(o.length).fill(0),...s];return n.set(c,r),r+c.length}}),au=e=>Na({read(t,n){const r=0===n?t:t.slice(n);if(0===r.length)return["",0];let o=r.findIndex((e=>0!==e));o=-1===o?r.length:o;const i=e[0].repeat(o);if(o===r.length)return[i,t.length];const a=function(e,t){const n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}(r.slice(o).reduce(((e,t)=>256n*e+BigInt(t)),0n),e);return[i+a,t.length]}});function su(e,t){const[n,r]=e.split(new RegExp(`((?!${t}).*)`));return[n,r]}function cu(e,t){const n=BigInt(t.length);let r=0n;for(const o of e)r*=n,r+=BigInt(t.indexOf(o));return r}var uu,lu,du,fu,hu,pu,gu="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",mu=()=>iu(gu),yu=()=>au(gu);function vu(){return du||(du=fs()),du}function wu(){return fu||(fu=hs()),fu}var Au=128;function bu(){return Pa({getSizeFromValue:e=>"legacy"===e?0:1,maxSize:1,write:(e,t,n)=>{if("legacy"===e)return n;if(e<0||e>127)throw new Aa(Oi,{actualVersion:e});return t.set([e|Au],n),n+1}})}function Su(){return Na({maxSize:1,read:(e,t)=>{const n=e[t];if(0==(n&Au))return["legacy",t];return[n^Au,t+1]}})}function Eu(){return Zc(Iu())}function ku(){return Ga(Zc([...Iu(),["addressTableLookups",Ec((uu||(uu=Zc([["lookupTableAddress",Zs()],["writableIndices",Ec(fs(),{size:is()})],["readableIndices",Ec(fs(),{size:is()})]])),uu),{size:is()})]]),(e=>"legacy"===e.version?e:{...e,addressTableLookups:e.addressTableLookups??[]}))}function Iu(){return[["version",bu()],["header",Zc([["numSignerAccounts",vu()],["numReadonlySignerAccounts",vu()],["numReadonlyNonSignerAccounts",vu()]])],["staticAccounts",Ec(Zs(),{size:is()})],["lifetimeToken",Fa(mu(),32)],["instructions",Ec((hu||(hu=Ga(Zc([["programAddressIndex",fs()],["accountIndices",Ec(fs(),{size:is()})],["data",Da(xc(),is())]]),(e=>void 0!==e.accountIndices&&void 0!==e.data?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)}))),hu),{size:is()})]]}function Tu(){return Pa({getSizeFromValue:e=>"legacy"===e.version?Eu().getSizeFromValue(e):ku().getSizeFromValue(e),write:(e,t,n)=>"legacy"===e.version?Eu().write(e,t,n):ku().write(e,t,n)})}function _u(){return Ha(Jc([["version",Su()],["header",Jc([["numSignerAccounts",wu()],["numReadonlySignerAccounts",wu()],["numReadonlyNonSignerAccounts",wu()]])],["staticAccounts",kc(Js(),{size:as()})],["lifetimeToken",$a(yu(),32)],["instructions",kc((pu||(pu=Ha(Jc([["programAddressIndex",hs()],["accountIndices",kc(hs(),{size:as()})],["data",La(Cc(),as())]]),(e=>{if(e.accountIndices.length&&e.data.byteLength)return e;const{accountIndices:t,data:n,...r}=e;return{...r,...t.length?{accountIndices:t}:null,...n.byteLength?{data:n}:null}}))),pu),{size:as()})],["addressTableLookups",kc((lu||(lu=Jc([["lookupTableAddress",Js()],["writableIndices",kc(hs(),{size:as()})],["readableIndices",kc(hs(),{size:as()})]])),lu),{size:as()})]]),(({addressTableLookups:e,...t})=>"legacy"!==t.version&&e?.length?{...t,addressTableLookups:e}:t))}function xu(e,t,n){e[t]=n(e[t]??{role:gs.READONLY})}var Cu=Symbol("AddressMapTypeProperty");function Ru(e){const t={};for(const n of e){if(!("lookupTableAddress"in n))continue;const e=t[n.lookupTableAddress]||={readableIndices:[],writableIndices:[]};n.role===gs.WRITABLE?e.writableIndices.push(n.addressIndex):e.readableIndices.push(n.addressIndex)}return Object.keys(t).sort(Qs()).map((e=>({lookupTableAddress:e,...t[e]})))}function Pu(e){let t=0,n=0,r=0;for(const o of e){if("lookupTableAddress"in o)break;const e=ws(o.role);vs(o.role)?(r++,e||n++):e||t++}return{numReadonlyNonSignerAccounts:t,numReadonlySignerAccounts:n,numSignerAccounts:r}}function Nu(e,t){const n=function(e){const t={};for(const[n,r]of e.entries())t[r.address]=n;return t}(t);return e.map((({accounts:e,data:t,programAddress:r})=>({programAddressIndex:n[r],...e?{accountIndices:e.map((({address:e})=>n[e]))}:null,...t?{data:t}:null})))}function Bu(e){const t=e.findIndex((e=>"lookupTableAddress"in e));return(-1===t?e:e.slice(0,t)).map((({address:e})=>e))}function Ou(e){const t=function(e){let t;const n=Object.entries(e).sort((([e,n],[r,o])=>{if(n[Cu]!==o[Cu]){if(0===n[Cu])return-1;if(0===o[Cu])return 1;if(2===n[Cu])return-1;if(2===o[Cu])return 1}const i=vs(n.role);if(i!==vs(o.role))return i?-1:1;const a=ws(n.role);return a!==ws(o.role)?a?-1:1:(t||=Qs(),1===n[Cu]&&1===o[Cu]&&n.lookupTableAddress!==o.lookupTableAddress?t(n.lookupTableAddress,o.lookupTableAddress):t(e,r))})).map((([e,t])=>({address:e,...t})));return n}(function(e,t){const n={[e]:{[Cu]:0,role:gs.WRITABLE_SIGNER}},r=new Set;for(const e of t){let t;if(xu(n,e.programAddress,(t=>{if(r.add(e.programAddress),Cu in t){if(ws(t.role)){if(0===t[Cu])throw new Aa(Ni,{programAddress:e.programAddress});throw new Aa(Bi,{programAddress:e.programAddress})}if(2===t[Cu])return t}return{[Cu]:2,role:gs.READONLY}})),e.accounts)for(const o of e.accounts)xu(n,o.address,(e=>{const{address:n,...i}=o;if(Cu in e)switch(e[Cu]){case 0:return e;case 1:{const n=As(e.role,i.role);if("lookupTableAddress"in i){if(e.lookupTableAddress!==i.lookupTableAddress&&(t||=Qs())(i.lookupTableAddress,e.lookupTableAddress)<0)return{[Cu]:1,...i,role:n}}else if(vs(i.role))return{[Cu]:2,role:n};return e.role!==n?{...e,role:n}:e}case 2:{const t=As(e.role,i.role);if(r.has(o.address)){if(ws(i.role))throw new Aa(Bi,{programAddress:o.address});return e.role!==t?{...e,role:t}:e}return"lookupTableAddress"in i&&!vs(e.role)?{...i,[Cu]:1,role:t}:e.role!==t?{...e,role:t}:e}}return"lookupTableAddress"in i?{...i,[Cu]:1}:{...i,[Cu]:2}}))}return n}(e.feePayer.address,e.instructions));return{..."legacy"!==e.version?{addressTableLookups:Ru(t)}:null,header:Pu(t),instructions:Nu(e.instructions,t),lifetimeToken:(n=e.lifetimeConstraint,"nonce"in n?n.nonce:n.blockhash),staticAccounts:Bu(t),version:e.version};var n}function Mu({version:e}){return Object.freeze({instructions:Object.freeze([]),version:e})}var zu,ju="SysvarRecentB1ockHashes11111111111111111111",Uu="11111111111111111111111111111111";function Du(e,t){return{accounts:[{address:e,role:gs.WRITABLE},{address:ju,role:gs.READONLY},{address:t,role:gs.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:Uu}}function Lu(e){return e.programAddress===Uu&&null!=e.data&&(4===(t=e.data).byteLength&&4===t[0]&&0===t[1]&&0===t[2]&&0===t[3])&&3===e.accounts?.length&&null!=e.accounts[0].address&&e.accounts[0].role===gs.WRITABLE&&e.accounts[1].address===ju&&e.accounts[1].role===gs.READONLY&&null!=e.accounts[2].address&&vs(e.accounts[2].role);var t}function Fu(e){return"lifetimeConstraint"in e&&"string"==typeof e.lifetimeConstraint.nonce&&null!=e.instructions[0]&&Lu(e.instructions[0])}function $u(e,t){if("feePayer"in t&&e===t.feePayer?.address&&function(e){return!!e&&"address"in e&&"string"==typeof e.address&&1===Object.keys(e).length}(t.feePayer))return t;const n={...t,feePayer:Object.freeze({address:e})};return Object.freeze(n),n}function qu(e,t){return Wu([e],t)}function Wu(e,t){return Object.freeze({...t,instructions:Object.freeze([...t.instructions,...e])})}function Vu(e,t){return Object.freeze({...t,instructions:Object.freeze([...e,...t.instructions])})}function Ku(e,t){const n=e.staticAccounts[0];if(!n)throw new Aa(Ui);const r=[...function(e){const{header:t}=e,n=t.numSignerAccounts-t.numReadonlySignerAccounts,r=e.staticAccounts.length-t.numSignerAccounts-t.numReadonlyNonSignerAccounts,o=[];let i=0;for(let t=0;t<n;t++)o.push({address:e.staticAccounts[i],role:gs.WRITABLE_SIGNER}),i++;for(let n=0;n<t.numReadonlySignerAccounts;n++)o.push({address:e.staticAccounts[i],role:gs.READONLY_SIGNER}),i++;for(let t=0;t<r;t++)o.push({address:e.staticAccounts[i],role:gs.WRITABLE}),i++;for(let n=0;n<t.numReadonlyNonSignerAccounts;n++)o.push({address:e.staticAccounts[i],role:gs.READONLY}),i++;return o}(e),..."addressTableLookups"in e&&void 0!==e.addressTableLookups&&e.addressTableLookups.length>0?function(e,t){const n=e.map((e=>e.lookupTableAddress)).filter((e=>void 0===t[e]));if(n.length>0)throw new Aa(Mi,{lookupTableAddresses:n});const r=[],o=[];for(const n of e){const e=t[n.lookupTableAddress],i=Math.max(...n.readableIndices,...n.writableIndices);if(i>=e.length)throw new Aa(zi,{highestKnownIndex:e.length-1,highestRequestedIndex:i,lookupTableAddress:n.lookupTableAddress});const a=n.readableIndices.map((t=>({address:e[t],addressIndex:t,lookupTableAddress:n.lookupTableAddress,role:gs.READONLY})));r.push(...a);const s=n.writableIndices.map((t=>({address:e[t],addressIndex:t,lookupTableAddress:n.lookupTableAddress,role:gs.WRITABLE})));o.push(...s)}return[...o,...r]}(e.addressTableLookups,t?.addressesByLookupTableAddress??{}):[]],o=e.instructions.map((e=>function(e,t){const n=t[e.programAddressIndex]?.address;if(!n)throw new Aa(ji,{index:e.programAddressIndex});const r=e.accountIndices?.map((e=>t[e])),{data:o}=e;return Object.freeze({programAddress:n,...r&&r.length?{accounts:Object.freeze(r)}:{},...o&&o.length?{data:o}:{}})}(e,r))),i=o[0],a=function(e,t,n){if(t&&Lu(t)){const n=t.accounts[0].address;Gs(n);const r=t.accounts[2].address;return Gs(r),{nonce:e,nonceAccountAddress:n,nonceAuthorityAddress:r}}return{blockhash:e,lastValidBlockHeight:n??2n**64n-1n}}(e.lifetimeToken,i,t?.lastValidBlockHeight);return nu(Mu({version:e.version}),(e=>$u(n,e)),(e=>o.reduce(((e,t)=>qu(t,e)),e)),(e=>"blockhash"in a?ou(a,e):function({nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:n},r){let o;const i=r.instructions[0];if(i&&Lu(i))if(function(e,t,n){return e.accounts[0].address===t&&e.accounts[2].address===n}(i,t,n)){if(Fu(r)&&r.lifetimeConstraint.nonce===e)return r;o=[i,...r.instructions.slice(1)]}else o=[Object.freeze(Du(t,n)),...r.instructions.slice(1)];else o=[Object.freeze(Du(t,n)),...r.instructions];return Object.freeze({...r,instructions:Object.freeze(o),lifetimeConstraint:Object.freeze({nonce:e})})}(a,e)))}function Gu(e){const t=Object.values(e);if(0===t.length)throw new Aa($i);return t.map((e=>e||new Uint8Array(64).fill(0)))}function Hu(){return Zc([["signatures",Ga(Ec(Fa(xc(),64),{size:is()}),Gu)],["messageBytes",xc()]])}function Zu(){return Ha(Jc([["signatures",kc($a(Cc(),64),{size:as()})],["messageBytes",Cc()]]),Ju)}function Ju(e){const{messageBytes:t,signatures:n}=e,r=Oc([Su(),Ka(hs(),2),kc(Js(),{size:as()})]),[o,i,a]=r.decode(t),s=a.slice(0,i);if(s.length!==n.length)throw new Aa(qi,{numRequiredSignatures:i,signaturesLength:n.length,signerAddresses:s});const c={};return s.forEach(((e,t)=>{const r=n[t];r.every((e=>0===e))?c[e]=null:c[e]=r})),{messageBytes:t,signatures:Object.freeze(c)}}function Yu(e){const t=Ou(e),n=Tu().encode(t),r=t.staticAccounts.slice(0,t.header.numSignerAccounts),o={};for(const e of r)o[e]=null;let i;i=ru(e)?{blockhash:e.lifetimeConstraint.blockhash,lastValidBlockHeight:e.lifetimeConstraint.lastValidBlockHeight}:{nonce:e.lifetimeConstraint.nonce,nonceAccountAddress:e.instructions[0].accounts[0].address};const a={lifetimeConstraint:i,messageBytes:n,signatures:Object.freeze(o)};return Object.freeze(a)}function Qu(e){zu||(zu=Rs());const t=Object.values(e.signatures)[0];if(!t)throw new Aa(Li);return zu.decode(t)}async function Xu(e,t){let n,r;if(await Promise.all(e.map((async e=>{const o=await dc(e.publicKey),i=t.signatures[o];if(void 0===i)return r||=new Set,void r.add(o);if(r)return;const a=await gc(e.privateKey,t.messageBytes);var s,c;null!==i&&(c=i,(s=a).length===c.length&&s.every(((e,t)=>e===c[t])))||(n||={},n[o]=a)}))),r&&r.size>0){const e=Object.keys(t.signatures);throw new Aa(Fi,{expectedAddresses:e,unexpectedAddresses:[...r]})}return n?Object.freeze({...t,signatures:Object.freeze({...t.signatures,...n})}):t}function el(e){const t=[];if(Object.entries(e.signatures).forEach((([e,n])=>{n||t.push(e)})),t.length>0)throw new Aa(Di,{addresses:t})}function tl(e){const t=Hu().encode(e);return zs().decode(t)}function nl(e){const t={};return e.forEach((e=>{if(t[e.address]){if(t[e.address]!==e)throw new Aa(Pi,{address:e.address})}else t[e.address]=e})),Object.values(t)}function rl(e){return"modifyAndSignTransactions"in e&&"function"==typeof e.modifyAndSignTransactions}function ol(e){return"signTransactions"in e&&"function"==typeof e.signTransactions}function il(e){return"signAndSendTransactions"in e&&"function"==typeof e.signAndSendTransactions}function al(e){return ol(e)||rl(e)||il(e)}function sl(e){return nl((e.accounts??[]).flatMap((e=>"signer"in e?e.signer:[])))}function cl(e){return nl([...e.feePayer&&al(e.feePayer)?[e.feePayer]:[],...e.instructions.flatMap(sl)])}function ul(e,t){const n=(r=t)&&"feePayer"in r&&r.feePayer&&"string"==typeof r.feePayer.address&&!al(r.feePayer)?e.find((e=>e.address===t.feePayer.address)):void 0;var r;return n||0!==t.instructions.length?Object.freeze({...t,...n?{feePayer:n}:null,instructions:t.instructions.map((t=>function(e,t){if(!t.accounts||0===t.accounts.length)return t;const n=new Map(nl(e).map((e=>[e.address,e])));return Object.freeze({...t,accounts:t.accounts.map((e=>{const t=n.get(e.address);return vs(e.role)&&!("signer"in e)&&t?Object.freeze({...e,signer:t}):e}))})}(e,t)))}):t}async function ll(e){const t=await dc(e.publicKey),n={address:t,keyPair:e,signMessages:n=>Promise.all(n.map((async n=>Object.freeze({[t]:await gc(e.privateKey,n.content)})))),signTransactions:n=>Promise.all(n.map((async n=>{const r=await Xu([e],n);return Object.freeze({[t]:r.signatures[t]})})))};return Object.freeze(n)}async function dl(e,t){return await ll(await vc(e,t))}function fl(e){const t={address:e,signMessages:e=>Promise.resolve(e.map((()=>Object.freeze({})))),signTransactions:e=>Promise.resolve(e.map((()=>Object.freeze({}))))};return Object.freeze(t)}async function hl(e,t){const{partialSigners:n,modifyingSigners:r}=pl(nl(cl(e).filter(al)),{identifySendingSigner:!1});return await gl(e,r,n,t)}function pl(e,t={}){const n=t.identifySendingSigner??!0?function(e){const t=e.filter(il);if(0===t.length)return null;const n=t.filter((e=>!rl(e)&&!ol(e)));if(n.length>0)return n[0];return t[0]}(e):null,r=e.filter((e=>e!==n&&(rl(e)||ol(e)))),o=function(e){const t=e.filter(rl);if(0===t.length)return[];const n=t.filter((e=>!ol(e)));return n.length>0?n:[t[0]]}(r),i=r.filter(ol).filter((e=>!o.includes(e)));return Object.freeze({modifyingSigners:o,partialSigners:i,sendingSigner:n})}async function gl(e,t=[],n=[],r){const o=Yu(e),i=await t.reduce((async(e,t)=>{r?.abortSignal?.throwIfAborted();const[n]=await t.modifyAndSignTransactions([await e],r);return Object.freeze(n)}),Promise.resolve(o));r?.abortSignal?.throwIfAborted();const a=await Promise.all(n.map((async e=>{const[t]=await e.signTransactions([i],r);return t}))),s={...i,signatures:Object.freeze(a.reduce(((e,t)=>({...e,...t})),i.signatures??{}))};return Object.freeze(s)}var ml=globalThis.TextEncoder;var yl,vl=((yl=vl||{})[yl.Uninitialized=0]="Uninitialized",yl[yl.Initialized=1]="Initialized",yl);var wl,Al=((wl=Al||{})[wl.Legacy=0]="Legacy",wl[wl.Current=1]="Current",wl);var bl,Sl,El="11111111111111111111111111111111",kl=((bl=kl||{})[bl.Nonce=0]="Nonce",bl),Il=((Sl=Il||{})[Sl.CreateAccount=0]="CreateAccount",Sl[Sl.Assign=1]="Assign",Sl[Sl.TransferSol=2]="TransferSol",Sl[Sl.CreateAccountWithSeed=3]="CreateAccountWithSeed",Sl[Sl.AdvanceNonceAccount=4]="AdvanceNonceAccount",Sl[Sl.WithdrawNonceAccount=5]="WithdrawNonceAccount",Sl[Sl.InitializeNonceAccount=6]="InitializeNonceAccount",Sl[Sl.AuthorizeNonceAccount=7]="AuthorizeNonceAccount",Sl[Sl.Allocate=8]="Allocate",Sl[Sl.AllocateWithSeed=9]="AllocateWithSeed",Sl[Sl.AssignWithSeed=10]="AssignWithSeed",Sl[Sl.TransferSolWithSeed=11]="TransferSolWithSeed",Sl[Sl.UpgradeNonceAccount=12]="UpgradeNonceAccount",Sl);function Tl(e){if(!e)throw new Error("Expected a Address.");return"object"==typeof e&&"address"in e?e.address:Array.isArray(e)?e[0]:e}function _l(e,t){return t=>{if(!t.value)return Object.freeze({address:e,role:gs.READONLY});const n=t.isWritable?gs.WRITABLE:gs.READONLY;return Object.freeze({address:Tl(t.value),role:xl(t.value)?bs(n):n,...xl(t.value)?{signer:t.value}:{}})}}function xl(e){return!!e&&"object"==typeof e&&"address"in e&&al(e)}function Cl(){return Jc([["discriminator",us()]])}function Rl(){return Jc([["discriminator",us()],["space",ds()]])}function Pl(){return Jc([["discriminator",us()],["base",Js()],["seed",La(Fs(),ds())],["space",ds()],["programAddress",Js()]])}function Nl(){return Jc([["discriminator",us()],["programAddress",Js()]])}function Bl(){return Jc([["discriminator",us()],["base",Js()],["seed",La(Fs(),ds())],["programAddress",Js()]])}function Ol(){return Jc([["discriminator",us()],["newNonceAuthority",Js()]])}function Ml(){return Jc([["discriminator",us()],["lamports",ds()],["space",ds()],["programAddress",Js()]])}function zl(){return Jc([["discriminator",us()],["base",Js()],["seed",La(Fs(),ds())],["amount",ds()],["space",ds()],["programAddress",Js()]])}function jl(){return Jc([["discriminator",us()],["nonceAuthority",Js()]])}var Ul=2;function Dl(){return Ga(Zc([["discriminator",cs()],["amount",ls()]]),(e=>({...e,discriminator:Ul})))}function Ll(){return Jc([["discriminator",us()],["amount",ds()]])}function Fl(){return Jc([["discriminator",us()],["amount",ds()],["fromSeed",La(Fs(),ds())],["fromOwner",Js()]])}function $l(){return Jc([["discriminator",us()]])}function ql(){return Jc([["discriminator",us()],["withdrawAmount",ds()]])}const Wl={log:(console.log,(...e)=>{}),info:(console.info,(...e)=>{}),warn:(console.warn,(...e)=>{}),debug:(console.debug,(...e)=>{}),error:(console.error,(...e)=>{})};const Vl={log:()=>{},info:()=>{},warn:()=>{},debug:()=>{},error:()=>{}},Kl=(e,t)=>new Proxy(e,{get(e,n){const r=e[n];return"function"==typeof r?(n,...o)=>r.call(e,t,n,...o):r}}),Gl=Wl;const Hl=(e,t)=>`${e}:${t.map((e=>JSON.stringify(e))).join(":")}`,Zl=(e,t,{ttlMilliseconds:n,functionName:r,generateCacheKey:o})=>{const i=o??Hl,a=r??e.name??"anonymousFunction";return async(...r)=>{const o=i(a,r);try{const e=await t.get(o);if(void 0!==e)return e}catch(e){Gl.error(`Cache get error for key "${o}":`,e)}const s=await e(...r);return t.set(o,s,n).catch((e=>{Gl.error(`Cache set error for key "${o}":`,e)})),s}},Jl=1000000n,Yl=1e9,Ql="metamask";var Xl=function(e){return e.Mainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",e.Devnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",e.Testnet="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",e.Localnet="solana:123456789abcdef",e}({}),ed=function(e){return e.SolMainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501",e.SolDevnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501",e.SolTestnet="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501",e.SolLocalnet="solana:123456789abcdef/slip44:501",e.UsdcMainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",e.UsdcDevnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",e.UsdcLocalnet="solana:123456789abcdef/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",e.EurcMainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr",e.EurcDevnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr",e.EurcLocalnet="solana:123456789abcdef/token:HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr",e.Ai16zMainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:HeLp6NuQkmYB4pYWo2zYs22mESHXPQYzXbB8n4V98jwC",e}({});ge(re(),/^solana:[a-zA-Z0-9]+\/slip44:501$/u);const td=ge(re(),/^solana:[a-zA-Z0-9]+\/token:[a-zA-Z0-9]+$/u),nd=(ge(re(),/^solana:[a-zA-Z0-9]+\/nft:[a-zA-Z0-9]+$/u),D("TokenCaipAssetTypeFromString",(e=>{if("string"!=typeof e)return"Expected a string, but received: "+typeof e;const[t]=td.validate(e);return t||!0})));var rd=function(e){return e.SOL="slip44:501",e}({});const od={"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501":{symbol:"SOL",caip19Id:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501",address:"So11111111111111111111111111111111111111112",decimals:9},"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501":{symbol:"SOL",caip19Id:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501",address:"So11111111111111111111111111111111111111112",decimals:9},"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501":{symbol:"SOL",caip19Id:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501",address:"So11111111111111111111111111111111111111112",decimals:9},"solana:123456789abcdef/slip44:501":{symbol:"SOL",caip19Id:"solana:123456789abcdef/slip44:501",address:"So11111111111111111111111111111111111111112",decimals:9},"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":{symbol:"USDC",caip19Id:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",decimals:6},"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU":{symbol:"USDC",caip19Id:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",address:"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",decimals:6},"solana:123456789abcdef/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":{symbol:"USDC",caip19Id:"solana:123456789abcdef/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",decimals:6}},id={"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":{caip2Id:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",cluster:"mainnet",name:"Solana Mainnet",nativeToken:od["solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501"]},"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1":{caip2Id:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",cluster:"devnet",name:"Solana Devnet",nativeToken:od["solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501"]},"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":{caip2Id:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",cluster:"testnet",name:"Solana Testnet",nativeToken:od["solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501"]},"solana:123456789abcdef":{caip2Id:"solana:123456789abcdef",cluster:"local",name:"Solana Localnet",nativeToken:od["solana:123456789abcdef/slip44:501"]}},ad=ge(re(),/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u),sd=ge(re(),/^(?!0\d)(\d+(\.\d+)?)$/u),cd=me(re(),"safe-url",(e=>{try{const t=new URL(e),n=["http:","https:","wss:"];if(!n.includes(t.protocol))return`URL must use one of the following protocols: ${n}`;if(!e.match(/^(https?|wss):\/\/[^/]+\/?/u))return"Malformed URL - incorrect protocol format";const r=t.hostname.toLowerCase();if(!("localhost"===r||r.includes(".")&&/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/u.test(r)))return"Invalid hostname format";const o=decodeURIComponent(e.toLowerCase());if(e.includes("\\")||e.includes("@")||o.includes("\\")||o.includes("@")||e.toLowerCase().includes("%2f@")||e.toLowerCase().includes("%5c@"))return"URL contains protocol pollution attempts";const i=decodeURIComponent(r);if(r.includes("\\")||r.includes("@")||i.includes("/")||r.toLowerCase().includes("%2f"))return"Invalid hostname characters detected";if(e.includes("../")||e.includes("..%2f")||e.includes("..%2F"))return"Directory traversal attempts are not allowed";const a=[/<[^>]*>/u,/javascript:/u,/data:/u,/\\[@\\]/u,/%2f@/u,/[^\x20-\x7E]/u,/\$\{.*?\}/u,/#\{.*?\}/u,/[|;]/u,/%0[acd]|%0[acd]/u,/\/\/\w+@/u,/(?:[^a-z]|^)(?:union\s+(?:all\s+)?select|select\s+(?:.*\s+)?from|insert\s+into|update\s+.*\s+set|delete\s+from|drop\s+table|alter\s+table|create\s+table|exec(?:ute)?|union|where\s+[\d\w]\s*=\s*[\d\w]|\bor\b\s*[\d\w]\s*=\s*[\d\w])/iu,/'.*?(?:OR|UNION|SELECT|FROM|WHERE).*?'/iu,/%27.*?(?:OR|UNION|SELECT|FROM|WHERE).*?(?:%27|')/iu,/%20(?:OR|UNION|SELECT|FROM|WHERE)%20/iu,/[?&](?:url|redirect|next|return_to|return_url|goto|destination|continue|redirect_uri)=(?:[^&]*\/\/|https?:)/iu,/[?&](?:url|redirect|next|return_to|return_url|goto|destination|continue|redirect_uri)=%(?:[^&]*\/\/|https?:)/iu];for(const e of a)if(e.test(o))return"URL contains potentially malicious patterns";return!(t.port&&!/^\d+$/u.test(t.port))||"Invalid port number"}catch(e){return"Invalid URL format"}})),ud=ee({accountId:ad}),ld=ee({accountId:ad}),dd=ee({accountId:ad}),fd=ee({accountId:ad,assets:K(it)}),hd=ee({accountId:ad,pagination:ee({limit:Z(),next:te(Q(re()))})}),pd=ne(it,ee({amount:sd,unit:re()})),gd=(K(it),H(Object.values($t)),H(Object.values(Xl))),md=(H(["btc","eth","ltc","bch","bnb","eos","xrp","xlm","link","dot","yfi","usd","aed","ars","aud","bdt","bhd","bmd","brl","cad","chf","clp","cny","czk","dkk","eur","gbp","gel","hkd","huf","idr","ils","inr","jpy","krw","kwd","lkr","mmk","mxn","myr","ngn","nok","nzd","php","pkr","pln","rub","sar","sek","sgd","thb","try","twd","uah","vef","vnd","zar","xdr","xag","xau","bits","sats"]),ee({transaction:re(),scope:H(Object.values(Xl))})),yd=ee({value:Q(sd)}),vd=D("Base58",(e=>"string"!=typeof e?"Expected a string, but received: "+typeof e:!!/^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+$/u.test(e)||"Expected a Base58 encoded string, but received a string with invalid characters")),wd=ge(re(),/^(?:[A-Za-z0-9+/]{4})+(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u),Ad=ge(re(),/^m\/44'\/501'/u),bd=(ge(re(),/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/u),D("SolanaAddress",(e=>{if("string"!=typeof e)return"Expected a string, but received: "+typeof e;try{return Hs(e),!0}catch(e){return"Invalid Solana address"}})));function Sd(e){return e&&"string"==typeof e?e.replace(/[\u0000-\u0008\u000A-\u001F\u007F]/gu,""):""}function Ed(e,t=1e3){if(!e||"string"!=typeof e)return"";let n=Sd(e);return n.length>t&&(n=n.substring(0,t)),n=n.trim(),n}function kd(e){if(!e||"string"!=typeof e)return"";const t=Sd(e);return/^[1-9A-HJ-NP-Za-km-z]+$/u.test(t)?t.length<32||t.length>44?"":t:""}function Id(e){if(!e||"string"!=typeof e)return"";const t=Sd(e);try{const e=new URL(t);return["http:","https:","wss:","ipfs:"].includes(e.protocol)?t.length>2048?"":t:""}catch{return""}}function Td(e){const{baseUrl:t,path:n,pathParams:r,queryParams:o,encodePathParams:i=!0}=e,a=Id(t);if(""===a)throw new Error("Invalid URL format");M(a,cd);const s=n.replace(/\{(\w+)\}/gu,((e,t)=>{const n=r?.[t];if(void 0===n)throw new Error(`Path parameter ${t} is undefined`);const o=Sd(n);return i?encodeURIComponent(o):o})).replace(/^\/+/u,"").replace(/\/+/gu,"/").replace(/\/+$/u,""),c=new URL(s,a);Object.entries(o??{}).filter((([e,t])=>void 0!==t)).filter((([e,t])=>null!==t)).forEach((([e,t])=>{if(t){const n=Sd(t);c.searchParams.append(e,n)}}));const u=c.toString();return M(u,cd),u}var _d=n(5250);const xd=ae([H(["btc","eth","ltc","bch","bnb","eos","xrp","xlm","link","dot","yfi","bits","sats","sol","sei","sonic"]),H(["usd","aed","amd","ars","aud","bam","bdt","bhd","bmd","brl","cad","chf","clp","cny","cop","crc","czk","dkk","dop","eur","gbp","gel","gtq","hkd","hnl","huf","idr","ils","inr","jpy","kes","krw","kwd","lbp","lkr","mmk","mxn","myr","ngn","nok","nzd","pen","php","pkr","pln","ron","rub","sar","sek","sgd","svc","thb","try","twd","uah","vef","vnd","xdr","zar","zmw"]),H(["xag","xau"])]),Cd=ee({id:re(),price:he(X(),0),marketCap:te(Q(he(X(),0))),allTimeHigh:te(Q(he(X(),0))),allTimeLow:te(Q(he(X(),0))),totalVolume:te(Q(he(X(),0))),high1d:te(Q(he(X(),0))),low1d:te(Q(he(X(),0))),circulatingSupply:te(Q(he(X(),0))),dilutedMarketCap:te(Q(he(X(),0))),marketCapPercentChange1d:te(Q(X())),priceChange1d:te(Q(X())),pricePercentChange1h:te(Q(X())),pricePercentChange1d:te(Q(X())),pricePercentChange7d:te(Q(X())),pricePercentChange14d:te(Q(X())),pricePercentChange30d:te(Q(X())),pricePercentChange200d:te(Q(X())),pricePercentChange1y:te(Q(X())),bondingCurveProgressPercent:te(Q(X())),liquidity:te(Q(X())),totalSupply:te(Q(X())),holderCount:te(Q(X())),isMutable:te(Q(G()))}),Rd=ne(Do,Q(Cd)),Pd=xd,Nd=ee({assetType:Do,timePeriod:te(ge(re(),/^[1-9][0-9]*[dmy]$/u)),from:te(he(X(),0)),to:te(he(X(),0)),vsCurrency:te(Pd)}),Bd=ee({prices:K(oe([X(),X()])),marketCaps:K(oe([X(),X()])),totalVolumes:K(oe([X(),X()]))}),Od={prices:[],marketCaps:[],totalVolumes:[]};const Md=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let n=0;n<e.length;n++){const r=e.charAt(n),o=r.charCodeAt(0);if(255!==t[o])throw new TypeError(r+" is ambiguous");t[o]=n}const n=e.length,r=e.charAt(0),o=Math.log(n)/Math.log(256),i=Math.log(256)/Math.log(n);function a(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;let i=0,a=0,s=0;for(;e[i]===r;)a++,i++;const c=(e.length-i)*o+1>>>0,u=new Uint8Array(c);for(;e[i];){let r=t[e.charCodeAt(i)];if(255===r)return;let o=0;for(let e=c-1;(0!==r||o<s)&&-1!==e;e--,o++)r+=n*u[e]>>>0,u[e]=r%256>>>0,r=r/256>>>0;if(0!==r)throw new Error("Non-zero carry");s=o,i++}let l=c-s;for(;l!==c&&0===u[l];)l++;const d=new Uint8Array(a+(c-l));let f=a;for(;l!==c;)d[f++]=u[l++];return d}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";let o=0,a=0,s=0;const c=t.length;for(;s!==c&&0===t[s];)s++,o++;const u=(c-s)*i+1>>>0,l=new Uint8Array(u);for(;s!==c;){let e=t[s],r=0;for(let t=u-1;(0!==e||r<a)&&-1!==t;t--,r++)e+=256*l[t]>>>0,l[t]=e%n>>>0,e=e/n>>>0;if(0!==e)throw new Error("Non-zero carry");a=r,s++}let d=u-a;for(;d!==u&&0===l[d];)d++;let f=r.repeat(o);for(;d<u;++d)f+=e.charAt(l[d]);return f},decodeUnsafe:a,decode:function(e){const t=a(e);if(t)return t;throw new Error("Non-base"+n+" character")}}};const zd=Md("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var jd=n(1048).hp;const Ud={[Xl.Mainnet]:"mainnet",[Xl.Devnet]:"devnet",[Xl.Testnet]:"testnet",[Xl.Localnet]:"localnet"};const Dd=K(ee({decimals:Z(),assetId:nd,name:te(re()),symbol:te(re()),iconUrl:te(cd)}));class Ld{#o;#i;#a;#s;#c;static supportedNetworks=[Xl.Mainnet,Xl.Devnet];constructor(e,t=globalThis.fetch,n=Gl){this.#o=t,this.#i=n;const{tokenApi:r,staticApi:o}=e.get(),{baseUrl:i,chunkSize:a}=r;M(i,cd),this.#a=i,this.#s=a,this.#c=o.baseUrl}async#u(e){M(e,K(td));const t=Td({baseUrl:this.#a,path:"/v3/assets",queryParams:{assetIds:e.join(",")}}),n=await this.#o(t);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const r=await n.json();return M(r,Dd),r}async getTokenMetadataFromAddresses(e){try{M(e,K(Do));const t=e.filter((e=>{const{chainId:t}=Fo(e);return Ld.supportedNetworks.includes(t)}));t.length!==e.length&&this.#i.warn(`[TokenApiClient] Received some asset types on networks that the Token API doesn't support. They will be ignored. Supported networks: ${Ld.supportedNetworks.join(", ")}`);const n=[];for(let e=0;e<t.length;e+=this.#s)n.push(t.slice(e,e+this.#s));const r=await Promise.all(n.map((async e=>this.#u(e)))),o=new Map;return r.flat().forEach((e=>{const t=e?.symbol,n=e?.name??t,r=e?.decimals;t&&n?o.set(e.assetId,{name:n,symbol:t,fungible:!0,iconUrl:e?.iconUrl??Td({baseUrl:this.#c,path:"/api/v2/tokenIcons/assets/{assetId}.png",pathParams:{assetId:e.assetId.replace(/:/gu,"/")},encodePathParams:!1}),units:[{name:n,symbol:t,decimals:r}]}):this.#i.warn(`No metadata for ${e.assetId}`)})),Object.fromEntries(o)}catch(e){throw this.#i.error(e,"Error fetching token metadata"),e}}}const Fd=e=>_o(e.toString()).dividedBy(Yl),$d=e=>_o(e.toString()).multipliedBy(Yl).integerValue(_o.ROUND_DOWN);var qd=function(e){return e.SignAndSendTransactionWithoutConfirmation="signAndSendTransactionWithoutConfirmation",e.ConfirmSend="confirmSend",e.SignAndSendTransaction="signAndSendTransaction",e.ComputeFee="computeFee",e.OnAddressInput="onAddressInput",e.OnAmountInput="onAmountInput",e}({});class Wd extends TypeError{constructor(e,t){let n;const{message:r,explanation:o,...i}=e,{path:a}=e,s=0===a.length?r:`At path: ${a.join(".")} -- ${r}`;super(o??s),null!=o&&(this.cause=s),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function Vd(e){return"object"==typeof e&&null!==e}function Kd(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function Gd(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:o,branch:i}=t,{type:a}=n,{refinement:s,message:c=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${Kd(r)}\``}=e;return{value:r,type:a,refinement:s,key:o[o.length-1],path:o,branch:i,...e,message:c}}function*Hd(e,t,n,r){(function(e){return Vd(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const o of e){const e=Gd(o,t,n,r);e&&(yield e)}}function*Zd(e,t,n={}){const{path:r=[],branch:o=[e],coerce:i=!1,mask:a=!1}=n,s={path:r,branch:o};if(i&&(e=t.coercer(e,s),a&&"type"!==t.type&&Vd(t.schema)&&Vd(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let c="valid";for(const r of t.validator(e,s))r.explanation=n.message,c="not_valid",yield[r,void 0];for(let[u,l,d]of t.entries(e,s)){const t=Zd(l,d,{path:void 0===u?r:[...r,u],branch:void 0===u?o:[...o,l],coerce:i,mask:a,message:n.message});for(const n of t)n[0]?(c=null===n[0].refinement||void 0===n[0].refinement?"not_valid":"not_refined",yield[n[0],void 0]):i&&(l=n[1],void 0===u?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):Vd(e)&&(void 0!==l||u in e)&&(e[u]=l))}if("not_valid"!==c)for(const r of t.refiner(e,s))r.explanation=n.message,c="not_refined",yield[r,void 0];"valid"===c&&(yield[void 0,e])}class Jd{constructor(e){const{type:t,schema:n,validator:r,refiner:o,coercer:i=(e=>e),entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=i,this.validator=r?(e,t)=>Hd(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>Hd(o(e,t),t,this,e):()=>[]}assert(e,t){return function(e,t,n){const r=Xd(e,t,{message:n});if(r[0])throw r[0]}(e,this,t)}create(e,t){return function(e,t,n){const r=Xd(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}is(e){return function(e,t){const n=Xd(e,t);return!n[0]}(e,this)}mask(e,t){return function(e,t,n){const r=Xd(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return Xd(e,this,t)}}const Yd="EXACT_OPTIONAL";class Qd extends Jd{constructor(e){super({...e,type:`exact optional ${e.type}`}),this.brand=Yd}static isExactOptional(e){return Vd(e)&&"brand"in e&&e.brand===Yd}}function Xd(e,t,n={}){const r=Zd(e,t,n),o=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(o[0]){return[new Wd(o[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]}return[void 0,o[1]]}function ef(){return of("never",(()=>!1))}function tf(e){const t=e?Object.keys(e):[],n=ef();return new Jd({type:"object",schema:e??null,*entries(r){if(e&&Vd(r)){const o=new Set(Object.keys(r));for(const n of t){o.delete(n);const t=e[n];Qd.isExactOptional(t)&&!Object.prototype.hasOwnProperty.call(r,n)||(yield[n,r[n],e[n]])}for(const e of o)yield[e,r[e],n]}},validator:e=>Vd(e)||`Expected an object, but received: ${Kd(e)}`,coercer:e=>Vd(e)?{...e}:e})}function nf(){return of("string",(e=>"string"==typeof e||`Expected a string, but received: ${Kd(e)}`))}function rf(...e){const t="type"===e[0]?.type,n=e.map((({schema:e})=>e)),r=Object.assign({},...n);return t?function(e){const t=Object.keys(e);return new Jd({type:"type",schema:e,*entries(n){if(Vd(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>Vd(e)||`Expected an object, but received: ${Kd(e)}`,coercer:e=>Vd(e)?{...e}:e})}(r):tf(r)}function of(e,t){return new Jd({type:e,schema:null,validator:t})}function af(e){return of(JSON.stringify(e),function(e){const t=Kd(e),n=typeof e;return new Jd({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${Kd(n)}`})}(e).validator)}function sf(e){return null==e}const cf=(e,t)=>Object.hasOwnProperty.call(e,t);var uf;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(uf=uf||(uf={}));const lf=e=>ee(e);function df({path:e,branch:t}){const n=e[e.length-1];return cf(t[t.length-2],n)}function ff(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!df(n)||e.validator(t,n),refiner:(t,n)=>!df(n)||e.refiner(t,n)})}function hf(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!hf(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!hf(n[e][1])){t=!1;break}return t}return!1}const pf=D("JSON",(e=>hf(e))),gf=de(pf,me(V(),"JSON",(e=>j(e,pf))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const mf=J("2.0"),yf=Q(ae([X(),re()])),vf=lf({code:Z(),message:re(),data:ff(gf),stack:ff(re())}),wf=ae([ne(re(),gf),K(gf)]);lf({id:yf,jsonrpc:mf,method:re(),params:ff(wf)}),lf({jsonrpc:mf,method:re(),params:ff(wf)});ee({id:yf,jsonrpc:mf,result:te(se()),error:te(vf)});const Af=lf({id:yf,jsonrpc:mf,result:gf}),bf=lf({id:yf,jsonrpc:mf,error:vf});ae([Af,bf]);function Sf(e){return j(e,bf)}var Ef=function(e){return e.Required="Required",e.Invalid="Invalid",e.InsufficientBalanceToCoverFee="InsufficientBalanceToCoverFee",e.InsufficientBalance="InsufficientBalance",e}({});const kf=H(Object.values(Xl)),If=ie({address:de(re(),re(),(e=>{if(!e||""===e)throw new Error("Account address is required");const t=kd(e);if(""===t)throw new Error("Invalid Solana address format");return t}))}),Tf=J("ed25519"),_f=de(re(),re(),(e=>{const t=function(e){if(!e||"string"!=typeof e)return"";let t=Sd(e);const n=t.match(/^([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)+)/u);return n?.[1]&&(t=n[1]),/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)+$/u.test(t)?t.length>253?"":t.toLowerCase():""}(e);if(""===t)throw new Error("Invalid domain format");return t})),xf=de(re(),re(),(e=>{const t=kd(e);if(""===t)throw new Error("Invalid Solana address format");return t})),Cf=de(re(),re(),(e=>{const t=Ed(e,1e3);if(""===t)throw new Error("Statement cannot be empty. Control characters and excessive whitespace are removed for security. Please use plain text only.");return t})),Rf=de(re(),re(),(e=>Id(e))),Pf=de(re(),re(),(e=>Ed(e,10))),Nf=de(re(),re(),(e=>Ed(e,50))),Bf=de(re(),re(),(e=>Ed(e,100))),Of=de(re(),re(),(e=>function(e){if(!e||"string"!=typeof e)return"";const t=Sd(e);if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/u.test(t))return"";const n=new Date(t);return isNaN(n.getTime())?"":t}(e))),Mf=de(re(),re(),(e=>Ed(e,100))),zf=de(K(re()),K(re()),(e=>{var t;return t=e,Array.isArray(t)?t.filter((e=>"string"==typeof e)).map((e=>Id(e))).filter((e=>""!==e)):[]})),jf=ie({domain:te(_f),address:te(xf),statement:te(Cf),uri:te(Rf),version:te(Pf),chainId:te(Nf),nonce:te(Bf),issuedAt:te(Of),expirationTime:te(Of),notBefore:te(Of),requestId:te(Mf),resources:te(zf)}),Uf=ie({account:If,message:wd}),Df=H(["processed","confirmed","finalized"]),Lf=ie({preflightCommitment:te(Df),minContextSlot:te(X())}),Ff=ie({account:If,transaction:wd,scope:kf,options:te(Lf)}),$f=ie({...Lf.schema,commitment:te(Df),skipPreflight:te(G()),maxRetries:te(X())}),qf=ie({...Ff.schema,scope:kf,options:te($f)}),Wf=ee({method:H([$t.SignAndSendTransaction]),params:qf}),Vf=ee({method:H([$t.SignIn]),params:jf}),Kf=ee({method:H([$t.SignMessage]),params:Uf}),Gf=ee({method:H([$t.SignTransaction]),params:Ff}),Hf=ee({signature:vd}),Zf=ee({signedTransaction:wd}),Jf=ee({signature:vd,signedMessage:wd,signatureType:Tf}),Yf=ee({account:If,...Jf.schema}),Qf=ae([Wf,Vf,Kf,Gf]),Xf=ee({jsonrpc:mf,id:yf,method:af(qd.SignAndSendTransactionWithoutConfirmation),params:qf}),eh=ee({transaction:wd,accountId:ad,scope:kf,options:te($f)}),th=ee({jsonrpc:mf,id:yf,method:af(qd.SignAndSendTransaction),params:eh}),nh=ee({transactionId:vd}),rh=ee({fromAccountId:ad,toAddress:bd,amount:sd,assetId:Do}),oh=ee({jsonrpc:mf,id:yf,method:af(qd.ConfirmSend),params:rh}),ih=ee({value:re()}),ah=ee({jsonrpc:mf,id:yf,method:af(qd.OnAddressInput),params:ih}),sh=ee({value:sd,accountId:ad,assetId:Do}),ch=ee({jsonrpc:mf,id:yf,method:af(qd.OnAmountInput),params:sh}),uh=ee({valid:G(),errors:K(ee({code:H(Object.values(Ef))}))}),lh=ee({transaction:wd,accountId:ad,scope:kf}),dh=ee({jsonrpc:mf,id:yf,method:af(qd.ComputeFee),params:lh}),fh=K(ee({type:H(Object.values(kt)),asset:mt}));var hh,ph="ComputeBudget111111111111111111111111111111",gh=((hh=gh||{})[hh.RequestUnits=0]="RequestUnits",hh[hh.RequestHeapFrame=1]="RequestHeapFrame",hh[hh.SetComputeUnitLimit=2]="SetComputeUnitLimit",hh[hh.SetComputeUnitPrice=3]="SetComputeUnitPrice",hh[hh.SetLoadedAccountsDataSizeLimit=4]="SetLoadedAccountsDataSizeLimit",hh);function mh(e){const t="data"in e?e.data:e;if(Ca(t,fs().encode(0),0))return 0;if(Ca(t,fs().encode(1),0))return 1;if(Ca(t,fs().encode(2),0))return 2;if(Ca(t,fs().encode(3),0))return 3;if(Ca(t,fs().encode(4),0))return 4;throw new Error("The provided instruction could not be identified as a computeBudget instruction.")}function yh(){return Jc([["discriminator",hs()],["bytes",us()]])}function vh(){return Jc([["discriminator",hs()],["units",us()],["additionalFee",us()]])}var wh=2;function Ah(){return Ga(Zc([["discriminator",fs()],["units",cs()]]),(e=>({...e,discriminator:wh})))}function bh(){return Jc([["discriminator",hs()],["units",us()]])}function Sh(e,t){const n={...e};return{programAddress:t?.programAddress??ph,data:Ah().encode(n)}}var Eh=3;function kh(){return Ga(Zc([["discriminator",fs()],["microLamports",ls()]]),(e=>({...e,discriminator:Eh})))}function Ih(){return Jc([["discriminator",hs()],["microLamports",ds()]])}function Th(e,t){const n={...e};return{programAddress:t?.programAddress??ph,data:kh().encode(n)}}function _h(){return Jc([["discriminator",hs()],["accountDataSizeLimit",us()]])}var xh=e=>({__option:"Some",value:e}),Ch=()=>({__option:"None"}),Rh=e=>!!(e&&"object"==typeof e&&"__option"in e&&("Some"===e.__option&&"value"in e||"None"===e.__option)),Ph=e=>"Some"===e.__option;var Nh=e=>null!==e?xh(e):Ch();function Bh(e,t={}){const n=null===t.prefix?Ga(Gc(),(e=>{})):Tc({size:t.prefix??fs()});return Mc([Ga(Bc([n,"zeroes"===t.noneValue?(Oa(e),Fa(Gc(),e.fixedSize)):t.noneValue?Pc(t.noneValue):Gc()]),(e=>[!1,void 0])),Ga(Bc([n,e]),(e=>[!0,Rh(e)&&Ph(e)?e.value:e]))],(e=>{const t=Rh(e)?e:Nh(e);return Number(Ph(t))}))}function Oh(e,t={}){const n=null===t.prefix?Ha(Hc(),(()=>!1)):_c({size:t.prefix??hs()}),r="zeroes"===t.noneValue?(Oa(e),$a(Hc(),e.fixedSize)):t.noneValue?Nc(t.noneValue):Hc();return zc([Ha(Oc([n,r]),(()=>Ch())),Ha(Oc([n,e]),(([,e])=>xh(e)))],((e,o)=>{if(null===t.prefix&&!t.noneValue)return Number(o<e.length);if(null===t.prefix&&null!=t.noneValue){return Ca(e,"zeroes"===t.noneValue?new Uint8Array(r.fixedSize).fill(0):t.noneValue,o)?0:1}return Number(n.read(e,o)[0])}))}var Mh,zh=((Mh=zh||{})[Mh.Uninitialized=0]="Uninitialized",Mh[Mh.Initialized=1]="Initialized",Mh[Mh.Frozen=2]="Frozen",Mh);var jh,Uh=((jh=Uh||{})[jh.MintTokens=0]="MintTokens",jh[jh.FreezeAccount=1]="FreezeAccount",jh[jh.AccountOwner=2]="AccountOwner",jh[jh.CloseAccount=3]="CloseAccount",jh);function Dh(){return Vc(Uh)}var Lh,Fh="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",$h=((Lh=$h||{})[Lh.CreateAssociatedToken=0]="CreateAssociatedToken",Lh[Lh.CreateAssociatedTokenIdempotent=1]="CreateAssociatedTokenIdempotent",Lh[Lh.RecoverNestedAssociatedToken=2]="RecoverNestedAssociatedToken",Lh);var qh,Wh="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",Vh=((qh=Vh||{})[qh.Mint=0]="Mint",qh[qh.Token=1]="Token",qh[qh.Multisig=2]="Multisig",qh);var Kh,Gh=((Kh=Gh||{})[Kh.InitializeMint=0]="InitializeMint",Kh[Kh.InitializeAccount=1]="InitializeAccount",Kh[Kh.InitializeMultisig=2]="InitializeMultisig",Kh[Kh.Transfer=3]="Transfer",Kh[Kh.Approve=4]="Approve",Kh[Kh.Revoke=5]="Revoke",Kh[Kh.SetAuthority=6]="SetAuthority",Kh[Kh.MintTo=7]="MintTo",Kh[Kh.Burn=8]="Burn",Kh[Kh.CloseAccount=9]="CloseAccount",Kh[Kh.FreezeAccount=10]="FreezeAccount",Kh[Kh.ThawAccount=11]="ThawAccount",Kh[Kh.TransferChecked=12]="TransferChecked",Kh[Kh.ApproveChecked=13]="ApproveChecked",Kh[Kh.MintToChecked=14]="MintToChecked",Kh[Kh.BurnChecked=15]="BurnChecked",Kh[Kh.InitializeAccount2=16]="InitializeAccount2",Kh[Kh.SyncNative=17]="SyncNative",Kh[Kh.InitializeAccount3=18]="InitializeAccount3",Kh[Kh.InitializeMultisig2=19]="InitializeMultisig2",Kh[Kh.InitializeMint2=20]="InitializeMint2",Kh[Kh.GetAccountDataSize=21]="GetAccountDataSize",Kh[Kh.InitializeImmutableOwner=22]="InitializeImmutableOwner",Kh[Kh.AmountToUiAmount=23]="AmountToUiAmount",Kh[Kh.UiAmountToAmount=24]="UiAmountToAmount",Kh);function Hh(e){if(!e)throw new Error("Expected a Address.");return"object"==typeof e&&"address"in e?e.address:Array.isArray(e)?e[0]:e}function Zh(e,t){return t=>{if(!t.value)return Object.freeze({address:e,role:gs.READONLY});const n=t.isWritable?gs.WRITABLE:gs.READONLY;return Object.freeze({address:Hh(t.value),role:Jh(t.value)?bs(n):n,...Jh(t.value)?{signer:t.value}:{}})}}function Jh(e){return!!e&&"object"==typeof e&&"address"in e&&al(e)}function Yh(){return Jc([["discriminator",hs()],["amount",ds()]])}function Qh(){return Jc([["discriminator",hs()],["amount",ds()]])}function Xh(){return Jc([["discriminator",hs()],["amount",ds()],["decimals",hs()]])}function ep(){return Jc([["discriminator",hs()],["amount",ds()]])}function tp(){return Jc([["discriminator",hs()],["amount",ds()],["decimals",hs()]])}function np(){return Jc([["discriminator",hs()]])}async function rp(e,t={}){const{programAddress:n="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"}=t;return await lc({programAddress:n,seeds:[Zs().encode(e.owner),Zs().encode(e.tokenProgram),Zs().encode(e.mint)]})}var op=1;function ip(){return Ga(Zc([["discriminator",fs()]]),(e=>({...e,discriminator:op})))}function ap(e,t){const n=t?.programAddress??Fh,r={payer:{value:e.payer??null,isWritable:!0},ata:{value:e.ata??null,isWritable:!0},owner:{value:e.owner??null,isWritable:!1},mint:{value:e.mint??null,isWritable:!1},systemProgram:{value:e.systemProgram??null,isWritable:!1},tokenProgram:{value:e.tokenProgram??null,isWritable:!1}};r.tokenProgram.value||(r.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),r.systemProgram.value||(r.systemProgram.value="11111111111111111111111111111111");const o=Zh(n);return{accounts:[o(r.payer),o(r.ata),o(r.owner),o(r.mint),o(r.systemProgram),o(r.tokenProgram)],programAddress:n,data:ip().encode({})}}function sp(){return Jc([["discriminator",hs()]])}function cp(){return Jc([["discriminator",hs()]])}function up(){return Jc([["discriminator",hs()]])}function lp(){return Jc([["discriminator",hs()],["owner",Js()]])}function dp(){return Jc([["discriminator",hs()],["owner",Js()]])}function fp(){return Jc([["discriminator",hs()]])}function hp(){return Jc([["discriminator",hs()],["decimals",hs()],["mintAuthority",Js()],["freezeAuthority",Oh(Js())]])}function pp(){return Jc([["discriminator",hs()],["decimals",hs()],["mintAuthority",Js()],["freezeAuthority",Oh(Js())]])}function gp(){return Jc([["discriminator",hs()],["m",hs()]])}function mp(){return Jc([["discriminator",hs()],["m",hs()]])}function yp(){return Jc([["discriminator",hs()],["amount",ds()]])}function vp(){return Jc([["discriminator",hs()],["amount",ds()],["decimals",hs()]])}function wp(){return Jc([["discriminator",hs()]])}function Ap(){return Jc([["discriminator",hs()],["authorityType",Dh()],["newAuthority",Oh(Js())]])}function bp(){return Jc([["discriminator",hs()]])}function Sp(){return Jc([["discriminator",hs()]])}var Ep=3;function kp(){return Ga(Zc([["discriminator",fs()],["amount",ls()]]),(e=>({...e,discriminator:Ep})))}function Ip(){return Jc([["discriminator",hs()],["amount",ds()]])}function Tp(e,t){const n=t?.programAddress??Wh,r={source:{value:e.source??null,isWritable:!0},destination:{value:e.destination??null,isWritable:!0},authority:{value:e.authority??null,isWritable:!1}},o={...e},i=(o.multiSigners??[]).map((e=>({address:e.address,role:gs.READONLY_SIGNER,signer:e}))),a=Zh(n);return{accounts:[a(r.source),a(r.destination),a(r.authority),...i],programAddress:n,data:kp().encode(o)}}function _p(){return Jc([["discriminator",hs()],["amount",ds()],["decimals",hs()]])}function xp(){return Jc([["discriminator",hs()],["uiAmount",Fs()]])}var Cp=(e=>(e[e.Uninitialized=0]="Uninitialized",e[e.Initialized=1]="Initialized",e[e.Frozen=2]="Frozen",e))(Cp||{});function Rp(){return Vc(Cp)}var Pp=(e=>(e[e.MintTokens=0]="MintTokens",e[e.FreezeAccount=1]="FreezeAccount",e[e.AccountOwner=2]="AccountOwner",e[e.CloseAccount=3]="CloseAccount",e[e.TransferFeeConfig=4]="TransferFeeConfig",e[e.WithheldWithdraw=5]="WithheldWithdraw",e[e.CloseMint=6]="CloseMint",e[e.InterestRate=7]="InterestRate",e[e.PermanentDelegate=8]="PermanentDelegate",e[e.ConfidentialTransferMint=9]="ConfidentialTransferMint",e[e.TransferHookProgramId=10]="TransferHookProgramId",e[e.ConfidentialTransferFeeConfig=11]="ConfidentialTransferFeeConfig",e[e.MetadataPointer=12]="MetadataPointer",e[e.GroupPointer=13]="GroupPointer",e[e.GroupMemberPointer=14]="GroupMemberPointer",e[e.ScaledUiAmount=15]="ScaledUiAmount",e[e.Pause=16]="Pause",e))(Pp||{});function Np(){return Vc(Pp)}function Bp(){return $a(Cc(),36)}var Op,Mp=((Op=Mp||{})[Op.Uninitialized=0]="Uninitialized",Op[Op.TransferFeeConfig=1]="TransferFeeConfig",Op[Op.TransferFeeAmount=2]="TransferFeeAmount",Op[Op.MintCloseAuthority=3]="MintCloseAuthority",Op[Op.ConfidentialTransferMint=4]="ConfidentialTransferMint",Op[Op.ConfidentialTransferAccount=5]="ConfidentialTransferAccount",Op[Op.DefaultAccountState=6]="DefaultAccountState",Op[Op.ImmutableOwner=7]="ImmutableOwner",Op[Op.MemoTransfer=8]="MemoTransfer",Op[Op.NonTransferable=9]="NonTransferable",Op[Op.InterestBearingConfig=10]="InterestBearingConfig",Op[Op.CpiGuard=11]="CpiGuard",Op[Op.PermanentDelegate=12]="PermanentDelegate",Op[Op.NonTransferableAccount=13]="NonTransferableAccount",Op[Op.TransferHook=14]="TransferHook",Op[Op.TransferHookAccount=15]="TransferHookAccount",Op[Op.ConfidentialTransferFee=16]="ConfidentialTransferFee",Op[Op.ConfidentialTransferFeeAmount=17]="ConfidentialTransferFeeAmount",Op[Op.ScaledUiAmountConfig=18]="ScaledUiAmountConfig",Op[Op.PausableConfig=19]="PausableConfig",Op[Op.PausableAccount=20]="PausableAccount",Op[Op.MetadataPointer=21]="MetadataPointer",Op[Op.TokenMetadata=22]="TokenMetadata",Op[Op.GroupPointer=23]="GroupPointer",Op[Op.TokenGroup=24]="TokenGroup",Op[Op.GroupMemberPointer=25]="GroupMemberPointer",Op[Op.TokenGroupMember=26]="TokenGroupMember",Op);function zp(){return Vc(Mp,{size:ss()})}function jp(){return Lc([["Name",Hc()],["Symbol",Hc()],["Uri",Hc()],["Key",Jc([["fields",Oc([La(Fs(),us())])]])]])}var Up=(e=>(e[e.CreateAssociatedToken=0]="CreateAssociatedToken",e[e.CreateAssociatedTokenIdempotent=1]="CreateAssociatedTokenIdempotent",e[e.RecoverNestedAssociatedToken=2]="RecoverNestedAssociatedToken",e))(Up||{});var Dp,Lp="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",Fp=((Dp=Fp||{})[Dp.Mint=0]="Mint",Dp[Dp.Token=1]="Token",Dp[Dp.Multisig=2]="Multisig",Dp);var $p,qp=(($p=qp||{})[$p.InitializeMint=0]="InitializeMint",$p[$p.InitializeAccount=1]="InitializeAccount",$p[$p.InitializeMultisig=2]="InitializeMultisig",$p[$p.Transfer=3]="Transfer",$p[$p.Approve=4]="Approve",$p[$p.Revoke=5]="Revoke",$p[$p.SetAuthority=6]="SetAuthority",$p[$p.MintTo=7]="MintTo",$p[$p.Burn=8]="Burn",$p[$p.CloseAccount=9]="CloseAccount",$p[$p.FreezeAccount=10]="FreezeAccount",$p[$p.ThawAccount=11]="ThawAccount",$p[$p.TransferChecked=12]="TransferChecked",$p[$p.ApproveChecked=13]="ApproveChecked",$p[$p.MintToChecked=14]="MintToChecked",$p[$p.BurnChecked=15]="BurnChecked",$p[$p.InitializeAccount2=16]="InitializeAccount2",$p[$p.SyncNative=17]="SyncNative",$p[$p.InitializeAccount3=18]="InitializeAccount3",$p[$p.InitializeMultisig2=19]="InitializeMultisig2",$p[$p.InitializeMint2=20]="InitializeMint2",$p[$p.GetAccountDataSize=21]="GetAccountDataSize",$p[$p.InitializeImmutableOwner=22]="InitializeImmutableOwner",$p[$p.AmountToUiAmount=23]="AmountToUiAmount",$p[$p.UiAmountToAmount=24]="UiAmountToAmount",$p[$p.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",$p[$p.InitializeTransferFeeConfig=26]="InitializeTransferFeeConfig",$p[$p.TransferCheckedWithFee=27]="TransferCheckedWithFee",$p[$p.WithdrawWithheldTokensFromMint=28]="WithdrawWithheldTokensFromMint",$p[$p.WithdrawWithheldTokensFromAccounts=29]="WithdrawWithheldTokensFromAccounts",$p[$p.HarvestWithheldTokensToMint=30]="HarvestWithheldTokensToMint",$p[$p.SetTransferFee=31]="SetTransferFee",$p[$p.InitializeConfidentialTransferMint=32]="InitializeConfidentialTransferMint",$p[$p.UpdateConfidentialTransferMint=33]="UpdateConfidentialTransferMint",$p[$p.ConfigureConfidentialTransferAccount=34]="ConfigureConfidentialTransferAccount",$p[$p.ApproveConfidentialTransferAccount=35]="ApproveConfidentialTransferAccount",$p[$p.EmptyConfidentialTransferAccount=36]="EmptyConfidentialTransferAccount",$p[$p.ConfidentialDeposit=37]="ConfidentialDeposit",$p[$p.ConfidentialWithdraw=38]="ConfidentialWithdraw",$p[$p.ConfidentialTransfer=39]="ConfidentialTransfer",$p[$p.ApplyConfidentialPendingBalance=40]="ApplyConfidentialPendingBalance",$p[$p.EnableConfidentialCredits=41]="EnableConfidentialCredits",$p[$p.DisableConfidentialCredits=42]="DisableConfidentialCredits",$p[$p.EnableNonConfidentialCredits=43]="EnableNonConfidentialCredits",$p[$p.DisableNonConfidentialCredits=44]="DisableNonConfidentialCredits",$p[$p.ConfidentialTransferWithFee=45]="ConfidentialTransferWithFee",$p[$p.InitializeDefaultAccountState=46]="InitializeDefaultAccountState",$p[$p.UpdateDefaultAccountState=47]="UpdateDefaultAccountState",$p[$p.Reallocate=48]="Reallocate",$p[$p.EnableMemoTransfers=49]="EnableMemoTransfers",$p[$p.DisableMemoTransfers=50]="DisableMemoTransfers",$p[$p.CreateNativeMint=51]="CreateNativeMint",$p[$p.InitializeNonTransferableMint=52]="InitializeNonTransferableMint",$p[$p.InitializeInterestBearingMint=53]="InitializeInterestBearingMint",$p[$p.UpdateRateInterestBearingMint=54]="UpdateRateInterestBearingMint",$p[$p.EnableCpiGuard=55]="EnableCpiGuard",$p[$p.DisableCpiGuard=56]="DisableCpiGuard",$p[$p.InitializePermanentDelegate=57]="InitializePermanentDelegate",$p[$p.InitializeTransferHook=58]="InitializeTransferHook",$p[$p.UpdateTransferHook=59]="UpdateTransferHook",$p[$p.InitializeConfidentialTransferFee=60]="InitializeConfidentialTransferFee",$p[$p.WithdrawWithheldTokensFromMintForConfidentialTransferFee=61]="WithdrawWithheldTokensFromMintForConfidentialTransferFee",$p[$p.WithdrawWithheldTokensFromAccountsForConfidentialTransferFee=62]="WithdrawWithheldTokensFromAccountsForConfidentialTransferFee",$p[$p.HarvestWithheldTokensToMintForConfidentialTransferFee=63]="HarvestWithheldTokensToMintForConfidentialTransferFee",$p[$p.EnableHarvestToMint=64]="EnableHarvestToMint",$p[$p.DisableHarvestToMint=65]="DisableHarvestToMint",$p[$p.WithdrawExcessLamports=66]="WithdrawExcessLamports",$p[$p.InitializeMetadataPointer=67]="InitializeMetadataPointer",$p[$p.UpdateMetadataPointer=68]="UpdateMetadataPointer",$p[$p.InitializeGroupPointer=69]="InitializeGroupPointer",$p[$p.UpdateGroupPointer=70]="UpdateGroupPointer",$p[$p.InitializeGroupMemberPointer=71]="InitializeGroupMemberPointer",$p[$p.UpdateGroupMemberPointer=72]="UpdateGroupMemberPointer",$p[$p.InitializeScaledUiAmountMint=73]="InitializeScaledUiAmountMint",$p[$p.UpdateMultiplierScaledUiMint=74]="UpdateMultiplierScaledUiMint",$p[$p.InitializePausableConfig=75]="InitializePausableConfig",$p[$p.Pause=76]="Pause",$p[$p.Resume=77]="Resume",$p[$p.InitializeTokenMetadata=78]="InitializeTokenMetadata",$p[$p.UpdateTokenMetadataField=79]="UpdateTokenMetadataField",$p[$p.RemoveTokenMetadataKey=80]="RemoveTokenMetadataKey",$p[$p.UpdateTokenMetadataUpdateAuthority=81]="UpdateTokenMetadataUpdateAuthority",$p[$p.EmitTokenMetadata=82]="EmitTokenMetadata",$p[$p.InitializeTokenGroup=83]="InitializeTokenGroup",$p[$p.UpdateTokenGroupMaxSize=84]="UpdateTokenGroupMaxSize",$p[$p.UpdateTokenGroupUpdateAuthority=85]="UpdateTokenGroupUpdateAuthority",$p[$p.InitializeTokenGroupMember=86]="InitializeTokenGroupMember",$p);function Wp(){return Jc([["discriminator",hs()],["amount",ds()]])}function Vp(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["expectedPendingBalanceCreditCounter",ds()],["newDecryptableAvailableBalance",Bp()]])}function Kp(){return Jc([["discriminator",hs()],["amount",ds()]])}function Gp(){return Jc([["discriminator",hs()],["amount",ds()],["decimals",hs()]])}function Hp(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()]])}function Zp(){return Jc([["discriminator",hs()],["amount",ds()]])}function Jp(){return Jc([["discriminator",hs()],["amount",ds()],["decimals",hs()]])}function Yp(){return Jc([["discriminator",hs()]])}function Qp(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["amount",ds()],["decimals",hs()]])}function Xp(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["newSourceDecryptableAvailableBalance",Bp()],["equalityProofInstructionOffset",os()],["ciphertextValidityProofInstructionOffset",os()],["rangeProofInstructionOffset",os()]])}function eg(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["newSourceDecryptableAvailableBalance",Bp()],["equalityProofInstructionOffset",os()],["transferAmountCiphertextValidityProofInstructionOffset",os()],["feeSigmaProofInstructionOffset",os()],["feeCiphertextValidityProofInstructionOffset",os()],["rangeProofInstructionOffset",os()]])}function tg(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["amount",ds()],["decimals",hs()],["newDecryptableAvailableBalance",Bp()],["equalityProofInstructionOffset",os()],["rangeProofInstructionOffset",os()]])}function ng(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["decryptableZeroBalance",Bp()],["maximumPendingBalanceCreditCounter",ds()],["proofInstructionOffset",os()]])}function rg(){return Jc([["discriminator",hs()]])}function og(){return Jc([["discriminator",hs()]])}function ig(){return Jc([["discriminator",hs()]])}function ag(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()]])}function sg(){return Jc([["discriminator",hs()],["cpiGuardDiscriminator",hs()]])}function cg(){return Jc([["discriminator",hs()],["confidentialTransferFeeDiscriminator",hs()]])}function ug(){return Jc([["discriminator",hs()],["memoTransfersDiscriminator",hs()]])}function lg(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()]])}new Uint8Array([250,166,180,250,13,12,184,70]);function dg(){return Jc([["discriminator",Cc()],["start",Oh(ds())],["end",Oh(ds())]])}function fg(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["proofInstructionOffset",os()]])}function hg(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()]])}function pg(){return Jc([["discriminator",hs()],["cpiGuardDiscriminator",hs()]])}function gg(){return Jc([["discriminator",hs()],["confidentialTransferFeeDiscriminator",hs()]])}function mg(){return Jc([["discriminator",hs()],["memoTransfersDiscriminator",hs()]])}function yg(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()]])}function vg(){return Jc([["discriminator",hs()]])}function wg(){return Jc([["discriminator",hs()]])}function Ag(){return Jc([["discriminator",hs()],["transferFeeDiscriminator",hs()]])}function bg(){return Jc([["discriminator",hs()],["confidentialTransferFeeDiscriminator",hs()]])}function Sg(){return Jc([["discriminator",hs()]])}function Eg(){return Jc([["discriminator",hs()],["owner",Js()]])}function kg(){return Jc([["discriminator",hs()],["owner",Js()]])}function Ig(){return Jc([["discriminator",hs()],["confidentialTransferFeeDiscriminator",hs()],["authority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["withdrawWithheldAuthorityElGamalPubkey",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function Tg(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["authority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["autoApproveNewAccounts",_c()],["auditorElgamalPubkey",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function _g(){return Jc([["discriminator",hs()],["defaultAccountStateDiscriminator",hs()],["state",Rp()]])}function xg(){return Jc([["discriminator",hs()],["groupMemberPointerDiscriminator",hs()],["authority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["memberAddress",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function Cg(){return Jc([["discriminator",hs()],["groupPointerDiscriminator",hs()],["authority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["groupAddress",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function Rg(){return Jc([["discriminator",hs()]])}function Pg(){return Jc([["discriminator",hs()],["interestBearingMintDiscriminator",hs()],["rateAuthority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["rate",ns()]])}function Ng(){return Jc([["discriminator",hs()],["metadataPointerDiscriminator",hs()],["authority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["metadataAddress",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function Bg(){return Jc([["discriminator",hs()],["decimals",hs()],["mintAuthority",Js()],["freezeAuthority",Oh(Js())]])}function Og(){return Jc([["discriminator",hs()],["decimals",hs()],["mintAuthority",Js()],["freezeAuthority",Oh(Js())]])}function Mg(){return Jc([["discriminator",hs()],["closeAuthority",Oh(Js())]])}function zg(){return Jc([["discriminator",hs()],["m",hs()]])}function jg(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{multisig:n(),rent:n()},data:zg().decode(e.data)}}function Ug(){return Jc([["discriminator",hs()]])}function Dg(){return Jc([["discriminator",hs()],["pausableDiscriminator",hs()],["authority",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function Lg(){return Jc([["discriminator",hs()],["delegate",Js()]])}function Fg(){return Jc([["discriminator",hs()],["scaledUiAmountMintDiscriminator",hs()],["authority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["multiplier",ts()]])}new Uint8Array([121,113,108,39,54,51,0,4]);function $g(){return Jc([["discriminator",Cc()],["updateAuthority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["maxSize",ds()]])}new Uint8Array([152,32,222,176,223,237,116,134]);function qg(){return Jc([["discriminator",Cc()]])}new Uint8Array([210,225,30,162,88,184,77,141]);function Wg(){return Jc([["discriminator",Cc()],["name",La(Fs(),us())],["symbol",La(Fs(),us())],["uri",La(Fs(),us())]])}function Vg(){return Jc([["discriminator",hs()],["transferFeeDiscriminator",hs()],["transferFeeConfigAuthority",Oh(Js())],["withdrawWithheldAuthority",Oh(Js())],["transferFeeBasisPoints",ss()],["maximumFee",ds()]])}function Kg(){return Jc([["discriminator",hs()],["transferHookDiscriminator",hs()],["authority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["programId",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function Gg(){return Jc([["discriminator",hs()],["amount",ds()]])}function Hg(){return Jc([["discriminator",hs()],["amount",ds()],["decimals",hs()]])}function Zg(){return Jc([["discriminator",hs()],["pausableDiscriminator",hs()]])}function Jg(){return Jc([["discriminator",hs()],["newExtensionTypes",kc(zp(),{size:"remainder"})]])}function Yg(){return Jc([["discriminator",hs()]])}new Uint8Array([234,18,32,56,89,141,37,181]);function Qg(){return Jc([["discriminator",Cc()],["idempotent",_c()],["key",La(Fs(),us())]])}function Xg(){return Jc([["discriminator",hs()],["pausableDiscriminator",hs()]])}function em(){return Jc([["discriminator",hs()]])}function tm(){return Jc([["discriminator",hs()],["authorityType",Np()],["newAuthority",Oh(Js())]])}function nm(){return Jc([["discriminator",hs()],["transferFeeDiscriminator",hs()],["transferFeeBasisPoints",ss()],["maximumFee",ds()]])}function rm(){return Jc([["discriminator",hs()]])}function om(){return Jc([["discriminator",hs()]])}function im(){return Jc([["discriminator",hs()],["amount",ds()]])}function am(){return Jc([["discriminator",hs()],["amount",ds()],["decimals",hs()]])}function sm(){return Jc([["discriminator",hs()],["transferFeeDiscriminator",hs()],["amount",ds()],["decimals",hs()],["fee",ds()]])}function cm(){return Jc([["discriminator",hs()],["uiAmount",Fs()]])}function um(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["autoApproveNewAccounts",_c()],["auditorElgamalPubkey",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function lm(){return Jc([["discriminator",hs()],["defaultAccountStateDiscriminator",hs()],["state",Rp()]])}function dm(){return Jc([["discriminator",hs()],["groupMemberPointerDiscriminator",hs()],["memberAddress",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function fm(){return Jc([["discriminator",hs()],["groupPointerDiscriminator",hs()],["groupAddress",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function hm(){return Jc([["discriminator",hs()],["metadataPointerDiscriminator",hs()],["metadataAddress",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function pm(){return Jc([["discriminator",hs()],["scaledUiAmountMintDiscriminator",hs()],["multiplier",ts()],["effectiveTimestamp",rs()]])}function gm(){return Jc([["discriminator",hs()],["interestBearingMintDiscriminator",hs()],["rate",ns()]])}new Uint8Array([108,37,171,143,248,30,18,110]);function mm(){return Jc([["discriminator",Cc()],["maxSize",ds()]])}new Uint8Array([161,105,88,1,237,221,216,203]);function ym(){return Jc([["discriminator",Cc()],["newUpdateAuthority",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}new Uint8Array([221,233,49,45,181,202,220,200]);function vm(){return Jc([["discriminator",Cc()],["field",jp()],["value",La(Fs(),us())]])}new Uint8Array([215,228,166,228,84,100,86,123]);function wm(){return Jc([["discriminator",Cc()],["newUpdateAuthority",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function Am(){return Jc([["discriminator",hs()],["transferHookDiscriminator",hs()],["programId",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function bm(){return Jc([["discriminator",hs()]])}function Sm(){return Jc([["discriminator",hs()],["transferFeeDiscriminator",hs()],["numTokenAccounts",hs()]])}function Em(){return Jc([["discriminator",hs()],["confidentialTransferFeeDiscriminator",hs()],["numTokenAccounts",hs()],["proofInstructionOffset",os()],["newDecryptableAvailableBalance",Bp()]])}function km(){return Jc([["discriminator",hs()],["transferFeeDiscriminator",hs()]])}function Im(){return Jc([["discriminator",hs()],["confidentialTransferFeeDiscriminator",hs()],["proofInstructionOffset",os()],["newDecryptableAvailableBalance",Bp()]])}function Tm(e){return!("exists"in e)||"exists"in e&&e.exists}function _m(e,t){if(!t)return Object.freeze({address:e,exists:!1});const n=Ms().encode(t.data[0]);return Object.freeze({...Cm(t),address:e,data:n,exists:!0})}function xm(e,t){if(!t)return Object.freeze({address:e,exists:!1});const n=t.data.parsed.info;return Object.freeze({...Cm(t),address:e,data:n,exists:!0})}function Cm(e){return Object.freeze({executable:e.executable,lamports:e.lamports,programAddress:e.owner,space:e.space})}async function Rm(e,t,n={}){const{abortSignal:r,...o}=n;return _m(t,(await e.getAccountInfo(t,{...o,encoding:"base64"}).send({abortSignal:r})).value)}async function Pm(e,t,n={}){const{abortSignal:r,...o}=n;return(await e.getMultipleAccounts(t,{...o,encoding:"base64"}).send({abortSignal:r})).value.map(((e,n)=>_m(t[n],e)))}var Nm="ComputeBudget111111111111111111111111111111",Bm={blockhash:"11111111111111111111111111111111",lastValidBlockHeight:0n},Om=2;function Mm(e){return function(e,t){return e.programAddress===t}(e,Nm)&&function(e){return void 0!==e.data}(e)&&e.data[0]===Om}async function zm({abortSignal:e,rpc:t,transactionMessage:n,...r}){const o=Fu(n);let i;i=o||ru(n)?n:ou(Bm,n);const a=n.instructions.findIndex(Mm),s=function(e){const t=new Uint8Array(5);return t[0]=Om,cs().write(e,t,1),Object.freeze({data:t,programAddress:Nm})}(14e5);if(-1===a)i=qu(s,i);else{const e=[...i.instructions];e.splice(a,1,s),i=Object.freeze({...i,instructions:e})}const c=tl(Yu(i));try{const{value:{err:n,unitsConsumed:i}}=await t.simulateTransaction(c,{...r,encoding:"base64",replaceRecentBlockhash:!o,sigVerify:!1}).send({abortSignal:e});if(null==i)throw new Aa(Wi);const a=i>4294967295n?4294967295:Number(i);if(n)throw new Aa(Vi,{cause:n,unitsConsumed:a});return a}catch(e){if(wa(e,Vi))throw e;throw new Aa(Wi,{cause:e})}}function jm({rpc:e}){return async function(t,n){return await zm({...n,rpc:e,transactionMessage:t})}}async function Um(e,t,n){if(0===e.length)return{};const r=await async function(e,t,n={}){const{abortSignal:r,...o}=n;return(await e.getMultipleAccounts(t,{...o,encoding:"jsonParsed"}).send({abortSignal:r})).value.map(((e,n)=>e&&"object"==typeof e&&"parsed"in e.data?xm(t[n],e):_m(t[n],e)))}(t,e,n);return function(e){const t=e.filter((e=>Tm(e)&&e.data instanceof Uint8Array));if(t.length>0){const e=t.map((e=>e.address));throw new Aa(vi,{addresses:e})}}(r),function(e){const t=e.filter((e=>!e.exists));if(t.length>0){const e=t.map((e=>e.address));throw new Aa(yi,{addresses:e})}}(r),r.reduce(((e,t)=>({...e,[t.address]:t.data.addresses})),{})}async function Dm(e,t,n){const r=("addressTableLookups"in e&&void 0!==e.addressTableLookups&&e.addressTableLookups.length>0?e.addressTableLookups:[]).map((e=>e.lookupTableAddress)),{lastValidBlockHeight:o,...i}=n??{};return Ku(e,{addressesByLookupTableAddress:r.length>0?await Um(r,t,i):{},lastValidBlockHeight:o})}function Lm(e,t){return!t?.preflightCommitment&&function(e,t){return e===t?0:Xc(e)<Xc(t)?-1:1}(e,"finalized")<0?{...t,preflightCommitment:e}:t}async function Fm({abortSignal:e,commitment:t,rpc:n,transaction:r,...o}){const i=tl(r);return await n.sendTransaction(i,{...Lm(t,o),encoding:"base64"}).send({abortSignal:e})}const $m=async e=>nu(e,Ou,Tu().encode,zs().decode),qm=async(e,t,n)=>nu(e,Ms().encode,_u().decode,(async e=>Dm(e,t,n))),Wm=async(e,t,n)=>nu(e,_u().decode,(async e=>Dm(e,t,n))),Vm=async e=>nu(e,Ms().encode,Zu().decode),Km=async(e,t,n)=>(async e=>new Promise(((t,n)=>{if(0===e.length)return void n(new AggregateError([],"No promises to resolve"));let r=0;const o=[];e.forEach(((i,a)=>{Promise.resolve(i).then((e=>t(e)),(t=>{o[a]=t,r+=1,r===e.length&&n(new AggregateError(o,"All promises rejected"))}))}))})))([Vm(e),qm(e,t,n)]);const Gm={[El]:{identifier:function(e){const t="data"in e?e.data:e;if(Ca(t,cs().encode(0),0))return 0;if(Ca(t,cs().encode(1),0))return 1;if(Ca(t,cs().encode(2),0))return 2;if(Ca(t,cs().encode(3),0))return 3;if(Ca(t,cs().encode(4),0))return 4;if(Ca(t,cs().encode(5),0))return 5;if(Ca(t,cs().encode(6),0))return 6;if(Ca(t,cs().encode(7),0))return 7;if(Ca(t,cs().encode(8),0))return 8;if(Ca(t,cs().encode(9),0))return 9;if(Ca(t,cs().encode(10),0))return 10;if(Ca(t,cs().encode(11),0))return 11;if(Ca(t,cs().encode(12),0))return 12;throw new Error("The provided instruction could not be identified as a system instruction.")},instructionEnum:Il,typeToParserMap:{[Il.Assign]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Nl().decode(e.data)}},[Il.TransferSol]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),destination:n()},data:Ll().decode(e.data)}},[Il.CreateAccount]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),newAccount:n()},data:Ml().decode(e.data)}},[Il.CreateAccountWithSeed]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),newAccount:n(),baseAccount:n()},data:zl().decode(e.data)}},[Il.AdvanceNonceAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),recentBlockhashesSysvar:n(),nonceAuthority:n()},data:Cl().decode(e.data)}},[Il.WithdrawNonceAccount]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),recipientAccount:n(),recentBlockhashesSysvar:n(),rentSysvar:n(),nonceAuthority:n()},data:ql().decode(e.data)}},[Il.InitializeNonceAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),recentBlockhashesSysvar:n(),rentSysvar:n()},data:jl().decode(e.data)}},[Il.AuthorizeNonceAccount]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),nonceAuthority:n()},data:Ol().decode(e.data)}},[Il.Allocate]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{newAccount:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Rl().decode(e.data)}},[Il.AllocateWithSeed]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{newAccount:n(),baseAccount:n()},data:Pl().decode(e.data)}},[Il.AssignWithSeed]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),baseAccount:n()},data:Bl().decode(e.data)}},[Il.TransferSolWithSeed]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),baseAccount:n(),destination:n()},data:Fl().decode(e.data)}},[Il.UpgradeNonceAccount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{nonceAccount:(()=>{const n=e.accounts[t];return t+=1,n})()},data:$l().decode(e.data)}}}},[ph]:{identifier:mh,instructionEnum:gh,typeToParserMap:{[gh.RequestUnits]:function(e){return{programAddress:e.programAddress,data:vh().decode(e.data)}},[gh.RequestHeapFrame]:function(e){return{programAddress:e.programAddress,data:yh().decode(e.data)}},[gh.SetComputeUnitPrice]:function(e){return{programAddress:e.programAddress,data:Ih().decode(e.data)}},[gh.SetComputeUnitLimit]:function(e){return{programAddress:e.programAddress,data:bh().decode(e.data)}},[gh.SetLoadedAccountsDataSizeLimit]:function(e){return{programAddress:e.programAddress,data:_h().decode(e.data)}}}},[Wh]:{identifier:function(e){const t="data"in e?e.data:e;if(Ca(t,fs().encode(0),0))return 0;if(Ca(t,fs().encode(1),0))return 1;if(Ca(t,fs().encode(2),0))return 2;if(Ca(t,fs().encode(3),0))return 3;if(Ca(t,fs().encode(4),0))return 4;if(Ca(t,fs().encode(5),0))return 5;if(Ca(t,fs().encode(6),0))return 6;if(Ca(t,fs().encode(7),0))return 7;if(Ca(t,fs().encode(8),0))return 8;if(Ca(t,fs().encode(9),0))return 9;if(Ca(t,fs().encode(10),0))return 10;if(Ca(t,fs().encode(11),0))return 11;if(Ca(t,fs().encode(12),0))return 12;if(Ca(t,fs().encode(13),0))return 13;if(Ca(t,fs().encode(14),0))return 14;if(Ca(t,fs().encode(15),0))return 15;if(Ca(t,fs().encode(16),0))return 16;if(Ca(t,fs().encode(17),0))return 17;if(Ca(t,fs().encode(18),0))return 18;if(Ca(t,fs().encode(19),0))return 19;if(Ca(t,fs().encode(20),0))return 20;if(Ca(t,fs().encode(21),0))return 21;if(Ca(t,fs().encode(22),0))return 22;if(Ca(t,fs().encode(23),0))return 23;if(Ca(t,fs().encode(24),0))return 24;throw new Error("The provided instruction could not be identified as a token instruction.")},instructionEnum:Gh,typeToParserMap:{[Gh.InitializeMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),rent:n()},data:hp().decode(e.data)}},[Gh.InitializeAccount]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n(),rent:n()},data:up().decode(e.data)}},[Gh.InitializeMultisig]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{multisig:n(),rent:n()},data:gp().decode(e.data)}},[Gh.Transfer]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),destination:n(),authority:n()},data:Ip().decode(e.data)}},[Gh.Approve]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),delegate:n(),owner:n()},data:Qh().decode(e.data)}},[Gh.Revoke]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),owner:n()},data:wp().decode(e.data)}},[Gh.SetAuthority]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{owned:n(),owner:n()},data:Ap().decode(e.data)}},[Gh.MintTo]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:yp().decode(e.data)}},[Gh.Burn]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:ep().decode(e.data)}},[Gh.CloseAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),destination:n(),owner:n()},data:np().decode(e.data)}},[Gh.FreezeAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:sp().decode(e.data)}},[Gh.ThawAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:Sp().decode(e.data)}},[Gh.TransferChecked]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),destination:n(),authority:n()},data:_p().decode(e.data)}},[Gh.ApproveChecked]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),delegate:n(),owner:n()},data:Xh().decode(e.data)}},[Gh.MintToChecked]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:vp().decode(e.data)}},[Gh.BurnChecked]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:tp().decode(e.data)}},[Gh.InitializeAccount2]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),rent:n()},data:lp().decode(e.data)}},[Gh.SyncNative]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:bp().decode(e.data)}},[Gh.InitializeAccount3]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n()},data:dp().decode(e.data)}},[Gh.InitializeMultisig2]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{multisig:(()=>{const n=e.accounts[t];return t+=1,n})()},data:mp().decode(e.data)}},[Gh.InitializeMint2]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:pp().decode(e.data)}},[Gh.GetAccountDataSize]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:cp().decode(e.data)}},[Gh.InitializeImmutableOwner]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:fp().decode(e.data)}},[Gh.AmountToUiAmount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Yh().decode(e.data)}},[Gh.UiAmountToAmount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:xp().decode(e.data)}}}},[Lp]:{identifier:function(e){const t="data"in e?e.data:e;if(Ca(t,fs().encode(0),0))return 0;if(Ca(t,fs().encode(1),0))return 1;if(Ca(t,fs().encode(2),0))return 2;if(Ca(t,fs().encode(3),0))return 3;if(Ca(t,fs().encode(4),0))return 4;if(Ca(t,fs().encode(5),0))return 5;if(Ca(t,fs().encode(6),0))return 6;if(Ca(t,fs().encode(7),0))return 7;if(Ca(t,fs().encode(8),0))return 8;if(Ca(t,fs().encode(9),0))return 9;if(Ca(t,fs().encode(10),0))return 10;if(Ca(t,fs().encode(11),0))return 11;if(Ca(t,fs().encode(12),0))return 12;if(Ca(t,fs().encode(13),0))return 13;if(Ca(t,fs().encode(14),0))return 14;if(Ca(t,fs().encode(15),0))return 15;if(Ca(t,fs().encode(16),0))return 16;if(Ca(t,fs().encode(17),0))return 17;if(Ca(t,fs().encode(18),0))return 18;if(Ca(t,fs().encode(19),0))return 19;if(Ca(t,fs().encode(20),0))return 20;if(Ca(t,fs().encode(21),0))return 21;if(Ca(t,fs().encode(22),0))return 22;if(Ca(t,fs().encode(23),0))return 23;if(Ca(t,fs().encode(24),0))return 24;if(Ca(t,fs().encode(25),0))return 25;if(Ca(t,fs().encode(26),0)&&Ca(t,fs().encode(0),1))return 26;if(Ca(t,fs().encode(26),0)&&Ca(t,fs().encode(1),1))return 27;if(Ca(t,fs().encode(26),0)&&Ca(t,fs().encode(2),1))return 28;if(Ca(t,fs().encode(26),0)&&Ca(t,fs().encode(3),1))return 29;if(Ca(t,fs().encode(26),0)&&Ca(t,fs().encode(4),1))return 30;if(Ca(t,fs().encode(26),0)&&Ca(t,fs().encode(5),1))return 31;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(0),1))return 32;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(1),1))return 33;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(2),1))return 34;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(3),1))return 35;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(4),1))return 36;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(5),1))return 37;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(6),1))return 38;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(7),1))return 39;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(8),1))return 40;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(9),1))return 41;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(10),1))return 42;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(11),1))return 43;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(12),1))return 44;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(13),1))return 45;if(Ca(t,fs().encode(28),0)&&Ca(t,fs().encode(0),1))return 46;if(Ca(t,fs().encode(28),0)&&Ca(t,fs().encode(1),1))return 47;if(Ca(t,fs().encode(29),0))return 48;if(Ca(t,fs().encode(30),0)&&Ca(t,fs().encode(0),1))return 49;if(Ca(t,fs().encode(30),0)&&Ca(t,fs().encode(1),1))return 50;if(Ca(t,fs().encode(31),0))return 51;if(Ca(t,fs().encode(32),0))return 52;if(Ca(t,fs().encode(33),0)&&Ca(t,fs().encode(0),1))return 53;if(Ca(t,fs().encode(33),0)&&Ca(t,fs().encode(1),1))return 54;if(Ca(t,fs().encode(34),0)&&Ca(t,fs().encode(0),1))return 55;if(Ca(t,fs().encode(34),0)&&Ca(t,fs().encode(1),1))return 56;if(Ca(t,fs().encode(35),0))return 57;if(Ca(t,fs().encode(36),0)&&Ca(t,fs().encode(0),1))return 58;if(Ca(t,fs().encode(36),0)&&Ca(t,fs().encode(1),1))return 59;if(Ca(t,fs().encode(37),0)&&Ca(t,fs().encode(0),1))return 60;if(Ca(t,fs().encode(37),0)&&Ca(t,fs().encode(1),1))return 61;if(Ca(t,fs().encode(37),0)&&Ca(t,fs().encode(2),1))return 62;if(Ca(t,fs().encode(37),0)&&Ca(t,fs().encode(3),1))return 63;if(Ca(t,fs().encode(37),0)&&Ca(t,fs().encode(4),1))return 64;if(Ca(t,fs().encode(37),0)&&Ca(t,fs().encode(5),1))return 65;if(Ca(t,fs().encode(38),0))return 66;if(Ca(t,fs().encode(39),0)&&Ca(t,fs().encode(0),1))return 67;if(Ca(t,fs().encode(39),0)&&Ca(t,fs().encode(1),1))return 68;if(Ca(t,fs().encode(40),0)&&Ca(t,fs().encode(0),1))return 69;if(Ca(t,fs().encode(40),0)&&Ca(t,fs().encode(1),1))return 70;if(Ca(t,fs().encode(41),0)&&Ca(t,fs().encode(0),1))return 71;if(Ca(t,fs().encode(41),0)&&Ca(t,fs().encode(1),1))return 72;if(Ca(t,fs().encode(43),0)&&Ca(t,fs().encode(0),1))return 73;if(Ca(t,fs().encode(43),0)&&Ca(t,fs().encode(1),1))return 74;if(Ca(t,fs().encode(44),0)&&Ca(t,fs().encode(0),1))return 75;if(Ca(t,fs().encode(44),0)&&Ca(t,fs().encode(1),1))return 76;if(Ca(t,fs().encode(44),0)&&Ca(t,fs().encode(2),1))return 77;if(Ca(t,new Uint8Array([210,225,30,162,88,184,77,141]),0))return 78;if(Ca(t,new Uint8Array([221,233,49,45,181,202,220,200]),0))return 79;if(Ca(t,new Uint8Array([234,18,32,56,89,141,37,181]),0))return 80;if(Ca(t,new Uint8Array([215,228,166,228,84,100,86,123]),0))return 81;if(Ca(t,new Uint8Array([250,166,180,250,13,12,184,70]),0))return 82;if(Ca(t,new Uint8Array([121,113,108,39,54,51,0,4]),0))return 83;if(Ca(t,new Uint8Array([108,37,171,143,248,30,18,110]),0))return 84;if(Ca(t,new Uint8Array([161,105,88,1,237,221,216,203]),0))return 85;if(Ca(t,new Uint8Array([152,32,222,176,223,237,116,134]),0))return 86;throw new Error("The provided instruction could not be identified as a token-2022 instruction.")},instructionEnum:qp,typeToParserMap:{[qp.InitializeMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),rent:n()},data:Bg().decode(e.data)}},[qp.InitializeAccount]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n(),rent:n()},data:Sg().decode(e.data)}},[qp.InitializeMultisig]:jg,[qp.Transfer]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),destination:n(),authority:n()},data:im().decode(e.data)}},[qp.Approve]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),delegate:n(),owner:n()},data:Kp().decode(e.data)}},[qp.Revoke]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),owner:n()},data:em().decode(e.data)}},[qp.SetAuthority]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{owned:n(),owner:n()},data:tm().decode(e.data)}},[qp.MintTo]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:Gg().decode(e.data)}},[qp.Burn]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:Zp().decode(e.data)}},[qp.CloseAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),destination:n(),owner:n()},data:Yp().decode(e.data)}},[qp.FreezeAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:vg().decode(e.data)}},[qp.ThawAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:om().decode(e.data)}},[qp.TransferChecked]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),destination:n(),authority:n()},data:am().decode(e.data)}},[qp.ApproveChecked]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),delegate:n(),owner:n()},data:Gp().decode(e.data)}},[qp.MintToChecked]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:Hg().decode(e.data)}},[qp.BurnChecked]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:Jp().decode(e.data)}},[qp.InitializeAccount2]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),rent:n()},data:Eg().decode(e.data)}},[qp.SyncNative]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:rm().decode(e.data)}},[qp.InitializeAccount3]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n()},data:kg().decode(e.data)}},[qp.InitializeMultisig2]:jg,[qp.InitializeMint2]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Og().decode(e.data)}},[qp.GetAccountDataSize]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:wg().decode(e.data)}},[qp.InitializeImmutableOwner]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Rg().decode(e.data)}},[qp.AmountToUiAmount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Wp().decode(e.data)}},[qp.UiAmountToAmount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:cm().decode(e.data)}},[qp.InitializeMintCloseAuthority]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Mg().decode(e.data)}},[qp.InitializeTransferFeeConfig]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Vg().decode(e.data)}},[qp.TransferCheckedWithFee]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),destination:n(),authority:n()},data:sm().decode(e.data)}},[qp.WithdrawWithheldTokensFromMint]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),feeReceiver:n(),withdrawWithheldAuthority:n()},data:km().decode(e.data)}},[qp.WithdrawWithheldTokensFromAccounts]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),feeReceiver:n(),withdrawWithheldAuthority:n()},data:Sm().decode(e.data)}},[qp.HarvestWithheldTokensToMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ag().decode(e.data)}},[qp.SetTransferFee]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),transferFeeConfigAuthority:n()},data:nm().decode(e.data)}},[qp.InitializeConfidentialTransferMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Tg().decode(e.data)}},[qp.UpdateConfidentialTransferMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:um().decode(e.data)}},[qp.ConfigureConfidentialTransferAccount]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),instructionsSysvarOrContextState:n(),record:(()=>{const e=n();return e.address===Lp?void 0:e})(),authority:n()},data:ng().decode(e.data)}},[qp.ApproveConfidentialTransferAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),authority:n()},data:Hp().decode(e.data)}},[qp.EmptyConfidentialTransferAccount]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),instructionsSysvarOrContextState:n(),record:(()=>{const e=n();return e.address===Lp?void 0:e})(),authority:n()},data:fg().decode(e.data)}},[qp.ConfidentialDeposit]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),authority:n()},data:Qp().decode(e.data)}},[qp.ConfidentialWithdraw]:function(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n},r=()=>{const e=n();return e.address===Lp?void 0:e};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),instructionsSysvar:r(),equalityRecord:r(),rangeRecord:r(),authority:n()},data:tg().decode(e.data)}},[qp.ConfidentialTransfer]:function(e){if(e.accounts.length<8)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n},r=()=>{const e=n();return e.address===Lp?void 0:e};return{programAddress:e.programAddress,accounts:{sourceToken:n(),mint:n(),destinationToken:n(),instructionsSysvar:r(),equalityRecord:r(),ciphertextValidityRecord:r(),rangeRecord:r(),authority:n()},data:Xp().decode(e.data)}},[qp.ApplyConfidentialPendingBalance]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:Vp().decode(e.data)}},[qp.EnableConfidentialCredits]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:hg().decode(e.data)}},[qp.DisableConfidentialCredits]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:ag().decode(e.data)}},[qp.EnableNonConfidentialCredits]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:yg().decode(e.data)}},[qp.DisableNonConfidentialCredits]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:lg().decode(e.data)}},[qp.ConfidentialTransferWithFee]:function(e){if(e.accounts.length<10)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n},r=()=>{const e=n();return e.address===Lp?void 0:e};return{programAddress:e.programAddress,accounts:{sourceToken:n(),mint:n(),destinationToken:n(),instructionsSysvar:r(),equalityRecord:r(),transferAmountCiphertextValidityRecord:r(),feeSigmaRecord:r(),feeCiphertextValidityRecord:r(),rangeRecord:r(),authority:n()},data:eg().decode(e.data)}},[qp.InitializeDefaultAccountState]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:_g().decode(e.data)}},[qp.UpdateDefaultAccountState]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),freezeAuthority:n()},data:lm().decode(e.data)}},[qp.Reallocate]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),payer:n(),systemProgram:n(),owner:n()},data:Jg().decode(e.data)}},[qp.EnableMemoTransfers]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:mg().decode(e.data)}},[qp.DisableMemoTransfers]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:ug().decode(e.data)}},[qp.CreateNativeMint]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),nativeMint:n(),systemProgram:n()},data:ig().decode(e.data)}},[qp.InitializeNonTransferableMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ug().decode(e.data)}},[qp.InitializeInterestBearingMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Pg().decode(e.data)}},[qp.UpdateRateInterestBearingMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),rateAuthority:n()},data:gm().decode(e.data)}},[qp.EnableCpiGuard]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:pg().decode(e.data)}},[qp.DisableCpiGuard]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:sg().decode(e.data)}},[qp.InitializePermanentDelegate]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Lg().decode(e.data)}},[qp.InitializeTransferHook]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Kg().decode(e.data)}},[qp.UpdateTransferHook]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:Am().decode(e.data)}},[qp.InitializeConfidentialTransferFee]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ig().decode(e.data)}},[qp.WithdrawWithheldTokensFromMintForConfidentialTransferFee]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),destination:n(),instructionsSysvarOrContextState:n(),record:(()=>{const e=n();return e.address===Lp?void 0:e})(),authority:n()},data:Im().decode(e.data)}},[qp.WithdrawWithheldTokensFromAccountsForConfidentialTransferFee]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),destination:n(),instructionsSysvarOrContextState:n(),record:(()=>{const e=n();return e.address===Lp?void 0:e})(),authority:n()},data:Em().decode(e.data)}},[qp.HarvestWithheldTokensToMintForConfidentialTransferFee]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:bg().decode(e.data)}},[qp.EnableHarvestToMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:gg().decode(e.data)}},[qp.DisableHarvestToMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:cg().decode(e.data)}},[qp.WithdrawExcessLamports]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{sourceAccount:n(),destinationAccount:n(),authority:n()},data:bm().decode(e.data)}},[qp.InitializeMetadataPointer]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ng().decode(e.data)}},[qp.UpdateMetadataPointer]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),metadataPointerAuthority:n()},data:hm().decode(e.data)}},[qp.InitializeGroupPointer]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Cg().decode(e.data)}},[qp.UpdateGroupPointer]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),groupPointerAuthority:n()},data:fm().decode(e.data)}},[qp.InitializeGroupMemberPointer]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:xg().decode(e.data)}},[qp.UpdateGroupMemberPointer]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),groupMemberPointerAuthority:n()},data:dm().decode(e.data)}},[qp.InitializeScaledUiAmountMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Fg().decode(e.data)}},[qp.UpdateMultiplierScaledUiMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:pm().decode(e.data)}},[qp.InitializePausableConfig]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Dg().decode(e.data)}},[qp.Pause]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:Zg().decode(e.data)}},[qp.Resume]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:Xg().decode(e.data)}},[qp.InitializeTokenMetadata]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n(),mint:n(),mintAuthority:n()},data:Wg().decode(e.data)}},[qp.UpdateTokenMetadataField]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n()},data:vm().decode(e.data)}},[qp.RemoveTokenMetadataKey]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n()},data:Qg().decode(e.data)}},[qp.UpdateTokenMetadataUpdateAuthority]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n()},data:wm().decode(e.data)}},[qp.EmitTokenMetadata]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{metadata:(()=>{const n=e.accounts[t];return t+=1,n})()},data:dg().decode(e.data)}},[qp.InitializeTokenGroup]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{group:n(),mint:n(),mintAuthority:n()},data:$g().decode(e.data)}},[qp.UpdateTokenGroupMaxSize]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{group:n(),updateAuthority:n()},data:mm().decode(e.data)}},[qp.UpdateTokenGroupUpdateAuthority]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{group:n(),updateAuthority:n()},data:ym().decode(e.data)}},[qp.InitializeTokenGroupMember]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{member:n(),memberMint:n(),memberMintAuthority:n(),group:n(),groupUpdateAuthority:n()},data:qg().decode(e.data)}}}},[Fh]:{identifier:function(e){const t="data"in e?e.data:e;if(Ca(t,fs().encode(0),0))return 0;if(Ca(t,fs().encode(1),0))return 1;if(Ca(t,fs().encode(2),0))return 2;throw new Error("The provided instruction could not be identified as a associatedToken instruction.")},instructionEnum:Up,typeToParserMap:{[Up.CreateAssociatedToken]:function(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),ata:n(),owner:n(),mint:n(),systemProgram:n(),tokenProgram:n()},data:rg().decode(e.data)}},[Up.CreateAssociatedTokenIdempotent]:function(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),ata:n(),owner:n(),mint:n(),systemProgram:n(),tokenProgram:n()},data:og().decode(e.data)}},[Up.RecoverNestedAssociatedToken]:function(e){if(e.accounts.length<7)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nestedAssociatedAccountAddress:n(),nestedTokenMintAddress:n(),destinationAssociatedAccountAddress:n(),ownerAssociatedAccountAddress:n(),ownerTokenMintAddress:n(),walletAddress:n(),tokenProgram:n()},data:Yg().decode(e.data)}}}}},Hm=async(e,t)=>{const n=await Km(t,e),r="instructions"in n?n:await Wm(n.messageBytes,e),{instructions:o}=r;return o.map((e=>{const{programAddress:t}=e;return((e,t)=>{const n={...e,dataBase58:Ps().decode(e.data??new Uint8Array)};try{const r=Gm[t];if(!r)throw new Error("Unsupported program address");const{identifier:o,typeToParserMap:i,instructionEnum:a}=r,s=o(e),c=a[s],u=i[s];if(!u)throw new Error("Unsupported instruction type");return{type:c,encoded:n,parsed:u(e)}}catch(e){return{type:"Unknown",encoded:n,parsed:null}}})(e,t)}))};function Zm(e){const{type:t,id:n,address:r,options:o,methods:i,scopes:a}=e;return{type:t,id:n,address:r,options:o,methods:i,scopes:a}}const Jm={accountSubscribe:"accountUnsubscribe",programSubscribe:"programUnsubscribe",signatureSubscribe:"signatureUnsubscribe"},Ym=H(["processed","confirmed","finalized"]),Qm=ge(re(),/^(?:0x)?[0-9a-f]+$/iu);ge(re(),/^0x[0-9a-f]+$/iu),ge(re(),/^0x[0-9a-f]{40}$/u),ge(re(),/^0x[0-9a-fA-F]{40}$/u);function Xm(e){Wo(function(e){return j(e,Qm)}(e),"Value must be a hexadecimal string.")}function ey(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}n(1048).hp;const ty=48,ny=58,ry=87;!function(){const e=[]}();function oy(e){if("0x"===e?.toLowerCase?.())return new Uint8Array;Xm(e);const t=ey(e).toLowerCase(),n=t.length%2==0?t:`0${t}`,r=new Uint8Array(n.length/2);for(let e=0;e<r.length;e++){const t=n.charCodeAt(2*e),o=n.charCodeAt(2*e+1),i=t-(t<ny?ty:ry),a=o-(o<ny?ty:ry);r[e]=16*i+a}return r}async function iy({entropySource:e,derivationPath:t}){Gl.log({derivationPath:t},"Generating solana wallet"),M(t,Ad);const n=t.split("/");try{const t=await async function({entropySource:e,path:t,curve:n}){return await snap.request({method:"snap_getBip32Entropy",params:{path:t,curve:n,...e?{source:e}:{}}})}({entropySource:e,path:n,curve:"ed25519"});if(!t.privateKey||!t.publicKey)throw new Error("Unable to derive private key");return{privateKeyBytes:oy(t.privateKey),publicKeyBytes:oy(t.publicKey)}}catch(e){throw Gl.error({error:e},"Error deriving keypair"),new Error(e)}}const ay=e=>JSON.parse(JSON.stringify(e),((e,t)=>t?"undefined"!==t.__type?"BigNumber"===t.__type?new _o(t.value):"bigint"===t.__type?BigInt(t.value):"Uint8Array"===t.__type?js().encode(t.value):t:void 0:t)),sy=e=>(0,_d.cloneDeepWith)(e,(e=>void 0===e?{__type:"undefined"}:e instanceof _o?{__type:"BigNumber",value:e.toString()}:"bigint"==typeof e?{__type:"bigint",value:e.toString()}:e instanceof Uint8Array?{__type:"Uint8Array",value:js().decode(e)}:void 0)),cy="send-form",uy="confirm-sign-and-send-transaction";async function ly(e,t){const n=sy(t);return snap.request({method:"snap_createInterface",params:{ui:e,context:n}})}async function dy(e,t,n){const r=sy(n);return snap.request({method:"snap_updateInterface",params:{id:e,ui:t,context:r}})}async function fy(e,t){return snap.request({method:"snap_resolveInterface",params:{id:e,value:t}})}async function hy(e){return snap.request({method:"snap_dialog",params:{id:e}})}async function py(){return snap.request({method:"snap_getPreferences"})}async function gy(e){const t=await async function(e){const t=await snap.request({method:"snap_getInterfaceContext",params:{id:e}});return t?ay(t):null}(e);if(!t)throw new Error("Interface context not found");return t}async function my(){return await snap.request({method:"snap_getClientStatus"})}var yy=function(e){return e.GetGenesisHash="getGenesisHash",e.GetLatestBlockhash="getLatestBlockhash",e.GetMinimumBalanceForRentExemption="getMinimumBalanceForRentExemption",e}({});const vy=ee({jsonrpc:mf,id:yf,method:J("getGenesisHash"),params:te(K())}),wy=ee({jsonrpc:mf,id:yf,method:J("getLatestBlockhash")}),Ay=ee({jsonrpc:mf,id:yf,method:J("getMinimumBalanceForRentExemption"),params:oe([X(),te(ee())])});var by,Sy=function(e){return e.StartSendTransactionFlow="startSendTransactionFlow",e.GetFeeForTransaction="getFeeForTransaction",e}({}),Ey=function(e){return e.ListWebSockets="listWebSockets",e.ListSubscriptions="listSubscriptions",e.TestOnStart="testOnStart",e.TestOnInstall="testOnInstall",e.TestOnUpdate="testOnUpdate",e.SynchronizeAccounts="synchronizeAccounts",e}({});!function(e){e[e.Millisecond=1]="Millisecond",e[e.Second=1e3]="Second",e[e.Minute=6e4]="Minute",e[e.Hour=36e5]="Hour",e[e.Day=864e5]="Day",e[e.Week=6048e5]="Week",e[e.Year=31536e6]="Year"}(by=by||(by={}));const ky={production:[Xl.Mainnet],local:[Xl.Mainnet],test:[Xl.Localnet]},Iy=de(K(cd),re(),(e=>e.split(","))),Ty=de(K(re()),re(),(e=>e.split(","))),_y=ee({ENVIRONMENT:H(["local","test","production"]),RPC_URL_MAINNET_LIST:Iy,RPC_URL_DEVNET_LIST:Iy,RPC_URL_TESTNET_LIST:Iy,RPC_URL_LOCALNET_LIST:Ty,RPC_WEB_SOCKET_URL_MAINNET:cd,RPC_WEB_SOCKET_URL_DEVNET:cd,RPC_WEB_SOCKET_URL_TESTNET:cd,RPC_WEB_SOCKET_URL_LOCALNET:cd,EXPLORER_BASE_URL:cd,PRICE_API_BASE_URL:cd,TOKEN_API_BASE_URL:cd,STATIC_API_BASE_URL:cd,SECURITY_ALERTS_API_BASE_URL:cd,NFT_API_BASE_URL:cd,LOCAL_API_BASE_URL:re()});class xy{#l;constructor(){const e=this.#d();this.#l=this.#f(e)}#d(){return z({ENVIRONMENT:"production",RPC_URL_MAINNET_LIST:"https://solana-mainnet.infura.io/v3/5b98a22672004ef1bf40a80123c5c48d",RPC_URL_DEVNET_LIST:"https://solana-devnet.infura.io/v3/5b98a22672004ef1bf40a80123c5c48d",RPC_URL_TESTNET_LIST:"https://api.testnet.solana.com",RPC_URL_LOCALNET_LIST:"http://localhost:8899",RPC_WEB_SOCKET_URL_MAINNET:"wss://solana-mainnet.infura.io/ws/v3/5b98a22672004ef1bf40a80123c5c48d",RPC_WEB_SOCKET_URL_DEVNET:"wss://solana-devnet.infura.io/ws/v3/5b98a22672004ef1bf40a80123c5c48d",RPC_WEB_SOCKET_URL_TESTNET:"wss://api.testnet.solana.com",RPC_WEB_SOCKET_URL_LOCALNET:"wss://localhost:8899",EXPLORER_BASE_URL:"https://solscan.io",PRICE_API_BASE_URL:"https://price.api.cx.metamask.io",TOKEN_API_BASE_URL:"https://tokens.api.cx.metamask.io",STATIC_API_BASE_URL:"https://static.cx.metamask.io",SECURITY_ALERTS_API_BASE_URL:"https://security-alerts.api.cx.metamask.io",LOCAL_API_BASE_URL:"http://localhost:8899",NFT_API_BASE_URL:"https://nft.api.cx.metamask.io"},_y)}#f(e){return{environment:e.ENVIRONMENT,networks:[{...id[Xl.Mainnet],rpcUrls:e.RPC_URL_MAINNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_MAINNET},{...id[Xl.Devnet],rpcUrls:e.RPC_URL_DEVNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_DEVNET},{...id[Xl.Testnet],rpcUrls:e.RPC_URL_TESTNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_TESTNET},{...id[Xl.Localnet],rpcUrls:e.RPC_URL_LOCALNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_LOCALNET}],explorerBaseUrl:e.EXPLORER_BASE_URL,activeNetworks:ky[e.ENVIRONMENT],priceApi:{baseUrl:"test"===e.ENVIRONMENT?e.LOCAL_API_BASE_URL:e.PRICE_API_BASE_URL,chunkSize:50,cacheTtlsMilliseconds:{fiatExchangeRates:by.Minute,spotPrices:by.Minute,historicalPrices:by.Minute}},tokenApi:{baseUrl:"test"===e.ENVIRONMENT?e.LOCAL_API_BASE_URL:e.TOKEN_API_BASE_URL,chunkSize:50},staticApi:{baseUrl:e.STATIC_API_BASE_URL},transactions:{storageLimit:10},securityAlertsApi:{baseUrl:"test"===e.ENVIRONMENT?e.LOCAL_API_BASE_URL:e.SECURITY_ALERTS_API_BASE_URL},nftApi:{baseUrl:"test"===e.ENVIRONMENT?e.LOCAL_API_BASE_URL:e.NFT_API_BASE_URL,cacheTtlsMilliseconds:{listAddressSolanaNfts:by.Minute,getNftMetadata:by.Minute}},subscriptions:{maxReconnectAttempts:5,reconnectDelayMilliseconds:by.Second}}}get(){return this.#l}getNetworkBy(e,t){const n=this.get().networks.find((n=>n[e]===t));if(!n)throw new Error(`Network ${e} not found`);return n}}const Cy=(new xy).get(),Ry=["local","test"].includes(Cy.environment),Py=Ry?["http://localhost:3000"]:["https://portfolio.metamask.io"],Ny=Ry?new Set([Ht.ListAccounts,Ht.GetAccount,Ht.CreateAccount,Ht.FilterAccountChains,Ht.DeleteAccount,Ht.DiscoverAccounts,Ht.GetAccountBalances,Ht.SubmitRequest,Ht.ListAccountTransactions,Ht.ListAccountAssets,Sy.StartSendTransactionFlow,Sy.GetFeeForTransaction,yy.GetGenesisHash,yy.GetLatestBlockhash,qd.SignAndSendTransactionWithoutConfirmation,Ey.ListWebSockets,Ey.ListSubscriptions,Ey.TestOnStart,Ey.TestOnInstall,Ey.TestOnUpdate,Ey.SynchronizeAccounts]):new Set([]),By=new Set([Ht.ListAccounts,Ht.GetAccount,Ht.CreateAccount,Ht.DeleteAccount,Ht.DiscoverAccounts,Ht.GetAccountBalances,Ht.SubmitRequest,Ht.ListAccountTransactions,Ht.ListAccountAssets,Ht.ResolveAccountAddress,Sy.StartSendTransactionFlow,Sy.GetFeeForTransaction,qd.SignAndSendTransactionWithoutConfirmation]),Oy=new Map([]);for(const e of Py)Oy.set(e,Ny);Oy.set("metamask",By);const My=(e,t)=>{if(!e)throw new oo("Origin not found");if(!Oy.get(e)?.has(t))throw new oo("Permission denied")};function zy(e,t){try{M(e,t)}catch(e){throw new Gr(e.message)}}function jy(e,t){try{M(e,t)}catch(e){throw new $r("Invalid Response")}}var Uy=function(e){return e.OnTransactionAdded="onTransactionAdded",e.OnTransactionApproved="onTransactionApproved",e.OnTransactionRejected="onTransactionRejected",e.OnSyncAccountTransactions="onSyncAccountTransactions",e.RefreshSend="refreshSend",e.RefreshConfirmationEstimation="refreshConfirmationEstimation",e}({});const Dy=ee({...St.schema,scope:gd,request:Qf}),Ly=ee({scopes:pe(K(gd)),entropySource:re(),groupIndex:he(X(),0)});function Fy(e,t){return new _o(e.toString()).div(10**t).toFixed()}function $y(e){return e.split("/")[0]}function qy(e,t){return`${e}/token:${t}`}class Wy{#i;#h;#p;#g;#m;#y;#v;#w;#A;static cacheTtlsMilliseconds={tokenAccountsByOwner:5*by.Second};constructor({connection:e,logger:t,configProvider:n,assetsRepository:r,tokenMetadataService:o,tokenPricesService:i,cache:a,nftApiClient:s}){this.#i=Kl(t,"[🪙 AssetsService]"),this.#h=e,this.#p=n,this.#g=r,this.#m=o,this.#y=i,this.#v=a,this.#w=s,this.#A=n.get().activeNetworks}#b(e){return{nativeAssetTypes:e.filter((e=>e.endsWith(rd.SOL))),tokenAssetTypes:e.filter((e=>e.includes("/token:"))),nftAssetTypes:e.filter((e=>e.includes("/nft:")))}}#S(e){const t={};for(const n of e){const{chain:{namespace:e,reference:r},assetNamespace:o,assetReference:i}=Fo(n);t[n]={name:"Solana",symbol:"SOL",fungible:!0,iconUrl:`${this.#p.get().staticApi.baseUrl}/api/v2/tokenIcons/assets/${e}/${r}/${o}/${i}.png`,units:[{name:"Solana",symbol:"SOL",decimals:9}]}}return t}async#E(e){return await this.#m.getTokensMetadata(e)}async#k(e){const t=await this.#w.getNftsMetadata(e.map((e=>{const{assetReference:t}=Fo(e);return t}))),n={};return e.forEach(((e,r)=>{const o=t[r];if(!o)return;const i={name:o.name,symbol:o.name,imageUrl:o.imageUrl,description:o.description,fungible:!1,isPossibleSpam:!1,attributes:Object.fromEntries(o.attributes.map((e=>[e.key,e.value]))),collection:{name:o.collectionName,address:o.onchainCollectionAddress,symbol:o.collectionSymbol,tokenCount:o.collectionCount,creator:"",imageUrl:o.collectionImageUrl??""}};n[e]=i})),n}async getAssetsMetadata(e){this.#i.log("Fetching metadata for assets",e);const{nativeAssetTypes:t,tokenAssetTypes:n,nftAssetTypes:r}=this.#b(e),[o,i]=await Promise.all([this.#S(t),this.#E(n)]);return{...o,...i}}async#I(e,t=[Wh,Lp],n=[Xl.Mainnet]){if(0===t.length||0===n.length)return[];const r=e.flatMap((e=>t.flatMap((t=>n.map((n=>({account:e,programId:t,scope:n}))))))),o=Zl(this.#T.bind(this),this.#v,{functionName:"AssetsService:fetchTokenAccounts",ttlMilliseconds:Wy.cacheTtlsMilliseconds.tokenAccountsByOwner,generateCacheKey:(e,t)=>{const[n,r,o]=t;return`${e}:${n.id}:${r}:${o}`}});return(await Promise.allSettled(r.map((async({account:e,programId:t,scope:n})=>await o(e,t,n))))).flatMap((e=>"fulfilled"===e.status?e.value:[]))}async#T(e,t=Wh,n=Xl.Mainnet){return(await this.#h.getRpc(n).getTokenAccountsByOwner(Hs(e.address),{programId:t},{encoding:"jsonParsed"}).send()).value.map((t=>({token:t,scope:n,assetType:qy(n,t.account.data.parsed.info.mint),keyringAccount:e})))}async fetch(e){const[t,n]=await Promise.all([this.#_(e),this.#I([e],[Wh,Lp],this.#A)]),r=await this.#m.getTokensMetadata(n.map((e=>e.assetType)));return[...t,...n.filter((e=>e.assetType.includes("/token:"))).map((e=>{const{assetType:t}=e,{decimals:n,amount:o,uiAmountString:i}=e.token.account.data.parsed.info.tokenAmount;return{assetType:t,keyringAccountId:e.keyringAccount.id,network:e.scope,mint:e.token.account.data.parsed.info.mint,pubkey:e.token.pubkey,symbol:r[t]?.symbol??"UNKNOWN",decimals:n,rawAmount:o,uiAmount:i??Fy(o,n)}}))]}getNativeAssetTypes(){return this.#A.map((e=>`${e}/${rd.SOL}`))}async#_(e){const t=this.getNativeAssetTypes(),n=Hs(e.address),r=t.map((async t=>{const r=await this.#h.getRpc($y(t)).getBalance(n).send();return{assetType:t,keyringAccountId:e.id,network:$y(t),address:n,symbol:"SOL",decimals:9,rawAmount:r.value.toString(),uiAmount:Fy(r.value,9)}}));return(await Promise.allSettled(r)).flatMap((e=>"fulfilled"===e.status?e.value:[]))}async#x(e,t){const n=Hs(e.address),r=await this.#w.listAddressSolanaNfts(n),o={};for(const e of t){const{assetReference:t}=Fo(e),n=r.find((e=>e.tokenAddress===t));n&&(o[e]={unit:n.nftToken.name,amount:n.balance.toString()})}return o}async fetchAssetsMarketData(e){this.#i.info("Fetching market data for assets",e);return await this.#y.getMultipleTokensMarketData(e)}async save(e){await this.saveMany([e])}async saveMany(e){this.#i.info("Saving assets",e);const t=e=>"0"===e.rawAmount,n=e=>!t(e),r=await this.getAll();await this.#g.saveMany(e);const o=e=>!r.find((t=>t.keyringAccountId===e.keyringAccountId&&t.assetType===e.assetType)),i=e=>{const n=r.find((t=>t.keyringAccountId===e.keyringAccountId&&t.assetType===e.assetType));return n&&t(n)},a=e=>e.assetType.includes(rd.SOL),s=e.reduce(((e,r)=>({...e,[r.keyringAccountId]:{added:[...e[r.keyringAccountId]?.added??[],...(o(r)||i(r))&&n(r)?[r.assetType]:[]],removed:[...e[r.keyringAccountId]?.removed??[],...t(r)&&!a(r)?[r.assetType]:[]]}})),{});Object.values(s).map((e=>e.added.length+e.removed.length)).every((e=>0===e))||await vn(snap,gn.AccountAssetListUpdated,{assets:s});const c=e.filter(n).filter((e=>Wy.hasChanged(e,r))).reduce(((e,t)=>({...e,[t.keyringAccountId]:{...e[t.keyringAccountId]??{},[t.assetType]:{unit:t.symbol,amount:t.uiAmount}}})),{});Object.values(c).map((e=>Object.keys(e).length)).every((e=>0===e))||await vn(snap,gn.AccountBalancesUpdated,{balances:c})}static hasChanged(e,t){const n=t.find((t=>t.keyringAccountId===e.keyringAccountId&&t.assetType===e.assetType));return!n||n.rawAmount!==e.rawAmount}async getAll(){return this.#g.getAll()}async findByAccount(e){const{id:t,address:n}=e,r=await this.#g.findByKeyringAccountId(t),o=this.getNativeAssetTypes(),i=[];for(const t of o){if(!r.some((e=>e.assetType===t))){const r=$y(t);i.push({assetType:t,keyringAccountId:e.id,network:r,address:n,symbol:"SOL",decimals:9,rawAmount:"0",uiAmount:"0"})}}return[...r,...i]}}const Vy=(e,t)=>{const{to:n,type:r,status:o}=e,{address:i}=t;if(!(r===_t.Receive||o===Tt.Failed))return!1;const{hasReceivedSOL:a,receivedSOLAmount:s}=n.reduce(((e,t)=>t.address!==i||!t.asset?.fungible||t.asset.type!==ed.SolMainnet&&t.asset.type!==ed.SolDevnet?e:{hasReceivedSOL:!0,receivedSOLAmount:e.receivedSOLAmount.plus(t.asset.amount)}),{hasReceivedSOL:!1,receivedSOLAmount:new _o(0)});return a&&s.isLessThan(.001)};function Ky({scope:e,transactionData:t}){const n=function(e){const t=new _o(e.meta?.fee?.toString()??"0");return t.dividedBy(Yl)}(t),r=function(e){const t=e.transaction.signatures.length;return _o(5e3).dividedBy(Yl).multipliedBy(t)}(t),o=n.minus(r),i=[{type:"base",asset:{fungible:!0,type:id[e].nativeToken.caip19Id,unit:id[e].nativeToken.symbol,amount:r.toString()}}];return o?.isGreaterThan(0)&&i.push({type:"priority",asset:{fungible:!0,type:id[e].nativeToken.caip19Id,unit:id[e].nativeToken.symbol,amount:o.toString()}}),i}function Gy({scope:e,transactionData:t}){const n=Ky({scope:e,transactionData:t}),r=[],o=[],i=new Map(t.meta?.preBalances?.map(((e,t)=>[t,new _o(e.toString())]))??[]),a=new Map(t.meta?.postBalances?.map(((e,t)=>[t,new _o(e.toString())]))??[]),s=[...t.transaction.message.accountKeys,...t.meta?.loadedAddresses?.writable??[],...t.meta?.loadedAddresses?.readonly??[]],c=new Set([...Array.from(i.keys()),...Array.from(a.keys())]);for(const n of c){const c=s[n]?.toString();if(!c)continue;const u=i.get(n)??new _o(0),l=a.get(n)??new _o(0),d=0===n?Fd(t.meta?.fee??0):new _o(0),f=u.minus(l).dividedBy(new _o(Yl)).minus(d);if(f.isZero())continue;const h=f.absoluteValue().toString();u.isGreaterThan(l)&&r.push({address:c,asset:{fungible:!0,type:id[e].nativeToken.caip19Id,unit:id[e].nativeToken.symbol,amount:h}}),u.isLessThan(l)&&o.push({address:c,asset:{fungible:!0,type:id[e].nativeToken.caip19Id,unit:id[e].nativeToken.symbol,amount:h}})}const u=function({scope:e,transactionData:t}){const{instructions:n}=t.transaction.message,r=[],o=[],i=t.transaction.message.accountKeys.findIndex((e=>e===El));if(-1===i)return{from:r,to:o};return n.forEach((n=>{const{accounts:a,data:s,programIdIndex:c}=n;if(c!==i)return;const[u,l]=a;if(void 0===u||void 0===l||u!==l)return;const d=t.transaction.message.accountKeys[u],f=t.transaction.message.accountKeys[l];if(!d||!f||d!==f)return;const h=function(e){let t=BigInt(0);for(let n=4;n<12;n++)t|=BigInt(e[n]??0)<<BigInt(8*(n-4));return _o(t.toString()).dividedBy(Yl)}(zd.decode(s));r.push({address:d,asset:{amount:h.toString(),fungible:!0,type:id[e].nativeToken.caip19Id,unit:id[e].nativeToken.symbol}}),o.push({address:f,asset:{amount:h.toString(),fungible:!0,type:id[e].nativeToken.caip19Id,unit:id[e].nativeToken.symbol}})})),{from:r,to:o}}({scope:e,transactionData:t});return u.from.length>0&&r.push(...u.from),u.to.length>0&&o.push(...u.to),{fees:n,from:r,to:o}}function Hy({scope:e,transactionData:t}){const n=Ky({scope:e,transactionData:t}),r=[...t.transaction.message.accountKeys,...t.meta?.loadedAddresses?.writable??[],...t.meta?.loadedAddresses?.readonly??[]],o=[],i=[],{instructions:a}=t.transaction.message;a.forEach((t=>{const{accounts:n,data:a,programIdIndex:s}=t;if(r[s]!==El)return;const[c,u]=n;if(void 0===c||void 0===u)return;const l=r[c],d=r[u];if(!l||!d)return;const f=zd.decode(a),h=function(e){let t=BigInt(0);for(let n=0;n<4;n++)t|=BigInt(e[n]??0)<<BigInt(8*n);return Number(t)}(f);if(2!==h)return;const p=function(e){let t=BigInt(0);for(let n=4;n<12;n++)t|=BigInt(e[n]??0)<<BigInt(8*(n-4));return _o(t.toString()).dividedBy(Yl)}(f);o.push({address:l,asset:{amount:p.toString(),fungible:!0,type:id[e].nativeToken.caip19Id,unit:id[e].nativeToken.symbol}}),i.push({address:d,asset:{amount:p.toString(),fungible:!0,type:id[e].nativeToken.caip19Id,unit:id[e].nativeToken.symbol}})}));return{fees:n,from:Zy(o),to:Zy(i)}}function Zy(e){return e.reduce(((e,t)=>{const n=e.find((e=>!0===e?.asset?.fungible&&!0===t.asset?.fungible&&e.asset.type===t.asset.type&&e.address===t.address));if(n&&!0===n.asset?.fungible&&!0===t.asset?.fungible){const e=new _o(n.asset.amount).plus(t.asset.amount);n.asset.amount=e.toString()}else e.push(t);return e}),[])}function Jy({scope:e,transactionData:t}){const n=[],r=[],o=new Map(t.meta?.preTokenBalances?.map((e=>[e.accountIndex,new _o(e.uiTokenAmount.amount)]))??[]),i=new Map(t.meta?.postTokenBalances?.map((e=>[e.accountIndex,new _o(e.uiTokenAmount.amount)]))??[]),a=new Set([...t.meta?.preTokenBalances?.map((e=>e.accountIndex))??[],...t.meta?.postTokenBalances?.map((e=>e.accountIndex))??[]]);for(const s of a){const a=o.get(s)??new _o(0),c=(i.get(s)??new _o(0)).minus(a);if(c.isZero())continue;const u=t.meta?.preTokenBalances?.find((e=>e.accountIndex===s))??t.meta?.postTokenBalances?.find((e=>e.accountIndex===s));if(!u)continue;const{mint:l,uiTokenAmount:{decimals:d},owner:f}=u,h=qy(e,l);if(!f)continue;const p=c.absoluteValue().dividedBy(new _o(10).pow(d)).toString();c.isNegative()&&n.push({address:f,asset:{fungible:!0,type:h,unit:"",amount:p}}),c.isPositive()&&r.push({address:f,asset:{fungible:!0,type:h,unit:"",amount:p}})}const s=function({scope:e,transactionData:t}){const{instructions:n}=t.transaction.message,r=[],o=[],i=t.transaction.message.accountKeys.findIndex((e=>e===Wh));if(-1===i)return{from:r,to:o};return n.forEach((n=>{const{accounts:a,data:s,programIdIndex:c}=n;if(c!==i)return;let u,l;if(5===a.length?(u=a[0],l=a[2]):3===a.length&&(u=a[0],l=a[1]),void 0===u||void 0===l||u!==l)return;const d=t.transaction.message.accountKeys[u],f=t.transaction.message.accountKeys[l];if(!d||!f||d!==f)return;const h=function(e){let t=BigInt(0);for(let n=1;n<9;n++)t|=BigInt(e[n]??0)<<BigInt(8*(n-1));return _o(t.toString()).dividedBy(1e6)}(zd.decode(s)),p=t.meta?.preTokenBalances?.find((e=>e.accountIndex===u))?.mint,g=t.meta?.preTokenBalances?.find((e=>e.accountIndex===u))?.owner;if(!p||!g)return;const m=qy(e,p);r.push({address:g,asset:{amount:h.toString(),fungible:!0,type:m,unit:""}}),o.push({address:g,asset:{amount:h.toString(),fungible:!0,type:m,unit:""}})})),{from:r,to:o}}({scope:e,transactionData:t});return s.from.length>0&&n.push(...s.from),s.to.length>0&&r.push(...s.to),{from:n,to:r}}function Yy({transactionData:e,account:t,scope:n}){try{const{blockTime:r}=e,{id:o,address:i}=t,a=e.transaction.signatures[0];if(!a)throw new Error("Transaction ID is required");const s=Number(r),c=function(e){const t=e.meta?.err||e.meta?.status&&"Err"in e.meta.status,n=t?Tt.Failed:Tt.Confirmed;return n}(e);let u=[],l=[],d=[];const f=(c===Tt.Failed?Hy:Gy)({scope:n,transactionData:e});u=f.fees,l=f.from,d=f.to;const{from:h,to:p}=Jy({scope:n,transactionData:e});let g=[...h,...l],m=[...p,...d];const y=function({address:e,status:t,from:n,to:r}){if(0===n.length||0===r.length||t===Tt.Failed)return _t.Unknown;const o=n.filter((t=>t.address===e)),i=r.filter((t=>t.address===e)),a=o.length>0,s=i.length>0,c=n.every((t=>r.some((n=>n.address===e&&!0===t.asset?.fungible&&!0===n.asset?.fungible&&t.asset.type===n.asset.type)))),u=r.every((t=>n.some((n=>n.address===e&&!0===n.asset?.fungible&&!0===t.asset?.fungible&&n.asset.type===t.asset.type))));if(c&&u)return _t.Send;if(a&&s)return _t.Swap;if(a)return _t.Send;return _t.Receive}({address:Hs(i),status:c,from:g,to:m});return y===_t.Swap&&(g=g.filter((e=>e.address===i)),m=m.filter((e=>e.address===i))),y===_t.Receive&&(m=m.filter((e=>e.address===i)),u=[]),{id:a,account:o,timestamp:s,chain:n,status:c,type:y,from:g,to:m,fees:u,events:[{status:c,timestamp:s}]}}catch(e){return Gl.warn(e,"Error mapping transaction"),null}}function Qy(e,t,n){if("string"==typeof e)throw new Error(`An HTML element ("${String(e)}") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`);if(!e)throw new Error("A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.");return e({...t,key:n})}function Xy(e,t,n){return Qy(e,t,n)}const ev='<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><image width="16" height="16" href="data:image/png;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAUFBQUFBQUGBgUICAcICAsKCQkKCxEMDQwNDBEaEBMQEBMQGhcbFhUWGxcpIBwcICkvJyUnLzkzMzlHREddXX0BBQUFBQUFBQYGBQgIBwgICwoJCQoLEQwNDA0MERoQExAQExAaFxsWFRYbFykgHBwgKS8nJScvOTMzOUdER11dff/CABEIAPoA+gMBIgACEQEDEQH/xAA1AAEAAwEBAQEBAAAAAAAAAAAAAQIHBggEBQMBAQADAQEBAQAAAAAAAAAAAAACAwQBBQYH/9oADAMBAAIQAxAAAADxkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACx204cU3mdnnYLG+IQwNvsxhgLfrRh5/egLRh59egkYefXoRCPn6mv5BH2ajuwAAAACZdFZz6/SvzfofWfLWtS2jw7WpNGO01mjJaas+P+k0tRjtNbUY38Leccnq/DxFq5f2ao7cAAAAB+36W8/9p7+DZZxp6nl7LOM3qzbLOMqs2zzjF6suyzjNqqNlnGrU5NkY7zlHP75Wjzv0mg5pAAAAAAs6jqdsMuajacMsam5HLGqORytqkxjlTVbc5lLVpjDKGsfhQlwdb1p3QAAAAAADofSXk7q/cp9MT8n0/cebe1Jpx2tS2fJNqTRkvNLUY7TWaMdqXZ8vnHPvZHmrw/u+JTGL6EAAAAABMDuvQvkLQfo6PQU55P0WLRJztTl0Sc7U5tFnOppzaOzmacujTnSrLo3x8NNFOM8zsuM+H99Aq2AAAAAATMfpWPznbNXOJdqjHi47Wec4l2jnOLdo5zi57JFxrsp5HjadRy9d0CMgAAAAJPqm+j0X8fW/oV82rPvUWRNGObUmjHe1LUZLIUY7TDPk/opk2CP5uPy+U+1qKrwAAAAPo3zPdc+23fu2/BfYXdA/AmjL+/bn1GToZ55Tl6KedmjJ0c87anL0LnuZyUTgH9fm+Q9+Bk0AAAAAAWVdWVFlRZUWVFpo4uoLxV0HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH//EAEEQAAECAwQHBAgDBgcBAAAAAAECBAADBgURF1UQMUFRkpPSEiFSohYgIjBAYaPiBzLBEyRUYnCRFBVDRYGhstH/2gAIAQEAAT8A/qXdF0XRd8ou9a4R3aOz8AO+KUo95Uc1SyoyGcs+3OIvvPhQDrMYUWPmbzhRGFFj5m74URhRY2Zu+FEYT2NmbvhRGE1jZm84URhNY2ZvOFEYTWNmjzhRGEti5o84URhLYuaPP7IjCWxc0ecKIwksXM3nCiMJLFzN5wojCSxczd/2RGEliZm8/siKt/DthYNkTLRbWlNUqWtIKJwA7Xa8JHwFK0w6qN6EJvQ1lkGfO2AeEb1HZDRq2YNpLVrJTLkyk9lCAO4D9TtJ2nQIv0C/QDAOgGL9Lp22Yt5rl1NTLky03rWrUB+p+W2KyqubUr72SpDOSSJEonzKHiPv6dsB7UT1LduLkJuM2afyy0bzvO4RZdmtbIZSGTRHZlS069qlbVK3k6AYGkQDA0DQDonTpTaVMnTpqUSkJKlrUbkhI1kmK3rJdQuRIaKUiz5BPYB7jMV41CD3++sWx3ltv5LNqm9au9Sj+VCRrUo7hFg2IzsBhLZthftmzCO+Yvao7vkNA0AxfA0A6RAMCCpKUqJUAALySbgBFeVsLXUuzbPWQxQr25m2coH/AMiFa/f0rVK6ZmO1hkiemehIIKuwoFBvFyrjGLByIc89MYsnIxz/ALIxZORjn/ZGLJyMc89MYspyP6/2xi0nIvr/AGxi2nI/r/bGLYyL6/2xi5LyM8/7Yxbl5Gef9sYuSsjPPHTGLkrI1c8dMYuSMjXzh0xi63yRfOHTFR/iO9tpktk1bBpJWLpp7fbWtPh1CCTBJPwN3udfqk6vgKcph7Ui3KW02VKEhIK1zL9atQFwJjCu1szZ+fpjCy18zZ+fpjCu1syZefpjCu1syZefpjCq18yZ+fpjCq18yZ+fpjCm18zZ+fpjCi1s0Z+fpjCe1szZ+fpjCe1s0Z+fpjCa180Z+fpjCa1szZ+fpjCa1szZefpjCW1s0Zefpi36Etan2gdrVKcSAblqlX+wTvBAMKB7ou9/T9vPKffJctriki6bLP5Vo3H9DFl2m1tdlIetV9qXMGralW1KtxGgGAYvgQDoBi+L9A0TZUtxKmSp0tK5cwFK0K7wUnWCIrWjlU+4DltethOPsE95lK8CjB+ApipnVPPAtN62yyBPk7FDeNyhsMNHbZ+2kum04TJMxPaSobR+hG0bIEXwDpB0AwIHqO2rZ+2nNXMlM2TMR2VoVqI/Q7jsisKWn049ISVTGc4kyJvy1lCvmII9+DdFH1VNsB0JThalMJyh+1RrKD40jeIkzpLiVLnSZqZkqYkKQtJvSUnUQdAOi+BF+gHQNA0WjZzO1Wc5m8lCZKmC4jaDsUk7FDYYqWnHtOv1t56SqUq8yJwHctH/ANG2B78G4xR1ZKsLttXiVzGSzeAk3mUraUg6wdojEum9zzkp64xMprc85KeuMTKa8Lzkp64xMprwvOSnrjE2mvC85KeuMTaa8LzlJ64xNprwveSnrjE6mvC95KeuMT6Z3POSnrjE+mdzzlJ6oxOpnc85Q6oxPpjc85SeqMT6YOx5yU9cYn0xue8lPXFY1tYFuWKtk1kT1zzNQpCpqAkIuPeoHtHX8APWv9S+L4vGjVo/4+Bs6zHtquA3ZN1TphBNydgG0k9wEYfVR/Ao5qIw9qj+BRzURh/VWXDmojD6qsuHNRGH1VZcOaiMPqqy4c1EYf1Xlf1ZfVGH9WZX9VHVGH1WZX9WX1Rh9VeWfVl9UYf1blJ5qOqMP6tyo81HVGH1W5T9VHVGH1XZSeajqi0qSt+yGxdPrPXLkhQSV9pKgCd/ZJ+As6z3dpu5LVrKMybMNwA/7JOwDaYpun29PMBIRcufMuLib41bh/KNnq3iL4ECO6Bd6m0d0fiBWMp6ldj2esKkBX7xOGpage5Cd6RtPvhDRrPeOJTeRKVMnTFBKEDWSYpSmJNPNSVkLezUj9rM2Aa+wn5DadI9QQDovgQNAivK2S2TPsezZl80jsOZwP5AdaE/PeYJJ99KlrmrQhAJWSAABeSdwikaTRYklLp0Ap/MRcdolJOwfPeY1QDov0iBoBi+AdNb1l/k6FWcwX+/LR7ax/oAjZ/OYUpSiSSSSbyT3kn39BubFZv5860ZqJc5KB/h1zPyJO0/JW6PSanh/vTXjj0mp7OmvHAqens6a8celFO501449Kacztrxx6U05nbXjj0ppzPGnHHpTTeeNOOPSqnM8accelVN54044FVU3njTjj0rprPWnHAqums8accelVNZ4044qav7PYNDLsp0hy7mC4LR3oljxE7VbhE+dNcTVzpswrmLUVKUokqJOsknWfgAbovMXnfF/wAzHai+L4vMdo747R3x2jvgKO+O18zHa+cXnfBJ/rX/AP/EADQRAAEDAQUFBAkFAAAAAAAAAAIAAQQDBRIUU5IREzBCVBUjMkMGICExM0RQUqIQImFyof/aAAgBAgEBPwD6pTpnVK6A3iT2fJ+z/U8GQ3InhyG5FhqzcqehUbkW7qfYnE25eBTA6piADeIlCgNFD2/ELxIhRCiFEKIUQqq93gWXXs+NT3lQu+/qitWC/m/i6e04b+annxcxFOi5iKZGfmRSo78yORS2ftJETk+1+BRgTK4bylQMhT2XO6U12ZOb5c12dMyDTwJWQawUnKNYORlIo9YG2vS4NkWoUM92fwS/H+UziY3hRCiFEKIUQog2+9S4z0ivD4eDY9rYd9xXLu+UvtRWlA6oEVowepBFPhZ4IpsPPBFMiZ4IpUbNBHXjG2x6oKsICbsBXh4AAVQhAAvES7Om9Kel1gJnSnpdYGY3y56Vg5TeQelYSVkHpWGkZJ6Vh6+UaISF9hD64iREIj73Vh2Jg6bSKw98X4ohRCiFEKIUQqVWCPTvEq1YqxuRev6Nw4Aji5MgN5yARN7EU6D1YamRTYXVBqZFMh9QGpkUqJ1AamRSonUBqZFJi54amVaXGpgRb0FKlHKqXn8PLwNqvOrzra6vP+u36t//xAA2EQABBAEBAwkECwEAAAAAAAACAAEDBAWiEjFDBhETFDAyQkRSICFBkhYjM1BTVGBhcrHB0f/aAAgBAwEBPwD70llCGMpJC2RT5jHtxtLp85jm42l0/KDFtvsaXT8pMS3mdLp+U+HbzOl0/KvCN5vS6+l+Cbfb0uqOQq5KBp6x7Ufd7rt/ftkTA3O+5ZC0dk9lvsxRgjBGCMEYI41hMBLl7PpgDvn/AIq1aGpBHBCGzGDcw+3binmbZDuosbYfwo8VbfhosNdfhamR4PIPwtTIsBkX4GpkfJzKPug1MoOSuSmmAZI+jDxntMqVOvQrhBCGyI6v3fsHkAX95J7ELeNPbr/GVddqNxl1+m3HBPk6Db7QJ8tjvjaBRZOhNIMYWgci7GWPbZHGjBGCMFJGjBOxCTEKwmYG4HQTF9cOrsZYtv3sjryP4UdSV+EjpWH4SPH2X3QGjxlx+AaPE338qaHFZSIwOOuYkKoS2ZawPZi6OT4/97F3ZOYN4l0sbeNl08P4oJ7EDcUF1mv+YD5l1uq3mA+ZkMkcjc4GxD2DROze9GCMFICMEYIwVelJbl2B3KtWjqxDFHub260cXNtmYI3i9aNg9aMWRx86OE/Qjry+hdSnM+ZgVatHWjYQb+X6F//Z" /></svg>';function tv(e){return Object.fromEntries(Object.entries(e).filter((([,e])=>void 0!==e)))}function nv(e){return t=>{const{key:n=null,...r}=t;return{type:e,props:tv(r),key:n}}}const rv=nv("Container"),ov=nv("Box"),iv=nv("Heading"),av=nv("Text"),sv=nv("Section"),cv=nv("Row"),uv=nv("Address"),lv=nv("Image"),dv=nv("Footer"),fv=nv("Button"),hv=nv("Link");function pv(e,t,n){const{cluster:r}=id[e];return Td({baseUrl:"https://solscan.io",path:`/${t}/${n}`,queryParams:r?{cluster:r}:void 0})}const gv=({domain:e,scope:t,address:n})=>Qy(ov,{direction:"horizontal",alignment:"center",children:Qy(hv,{href:pv(t,"address",n),children:e})});function mv(e,t){return`${e}:${t}`}const yv=JSON.parse('{"D":{"send.title":{"message":"Send"},"send.balance":{"message":"Balance"},"send.maxButton":{"message":"Max"},"send.cancelButton":{"message":"Cancel"},"send.continueButton":{"message":"Continue"},"send.fromField":{"message":"From"},"send.toField":{"message":"To"},"send.amountField":{"message":"Amount"},"send.assetField":{"message":"Token"},"send.toPlaceholder":{"message":"Enter public address or domain name"},"send.fromRequiredError":{"message":"Account is required"},"send.amountRequiredError":{"message":"Amount is required"},"send.amountGreatherThanMinimumBalanceForRentExemptionError":{"message":"Amount must be greater than {minimumValue}"},"send.insuffientSolToCoverFee":{"message":"Insufficient SOL balance to cover the transaction fee"},"send.toRequiredError":{"message":"To address is required"},"send.toInvalidError":{"message":"Invalid Solana address or domain name"},"send.toInvalidErrorDomain":{"message":"Unable to resolve domain name"},"send.toDomainResolutionStatus.initial":{"message":"Domain"},"send.toDomainResolutionStatus.fetching":{"message":"Resolving domain name..."},"send.toDomainResolutionStatus.fetched":{"message":"Domain name resolved."},"send.toDomainResolutionStatus.error":{"message":"Unable to resolve domain name."},"send.insufficientBalance":{"message":"Insufficient balance"},"send.simulationTitleAPIError":{"message":"Because of an error, we couldn\'t check for security alerts."},"send.simulationMessageAPIError":{"message":"Only continue if you trust every address involved."},"send.simulationTitleError":{"message":"Transaction simulation failed"},"send.simulationMessageError":{"message":"This transaction was reverted during simulation."},"send.selectedTokenPriceNotAvailable":{"message":"Prices for tokens in {currency} are currently not available. You are still able to send tokens."},"send.confirmation.title":{"message":"Review"},"send.confirmation.from":{"message":"From"},"send.confirmation.recipient":{"message":"Recipient"},"send.confirmation.network":{"message":"Network"},"send.confirmation.transactionSpeed":{"message":"Transaction speed"},"send.confirmation.fee":{"message":"Network fee"},"send.confirmation.sendButton":{"message":"Send"},"send.confirmation.cancelButton":{"message":"Cancel"},"send.confirmation.viewTransaction":{"message":"View transaction"},"send.send-pending.title":{"message":"Sending..."},"send.send-pending.subtitle":{"message":"Your transaction was submitted."},"send.transaction-success.title":{"message":"Sent"},"send.transaction-success.subtitle":{"message":"{amount} {tokenSymbol} was successfully sent"},"send.transaction-failure.title":{"message":"Transaction failed"},"send.transaction-failure.subtitle":{"message":"Unable to send {amount} {tokenSymbol}"},"confirmation.account":{"message":"Account"},"confirmation.network":{"message":"Network"},"confirmation.estimatedChanges":{"message":"Estimated changes"},"confirmation.estimatedChanges.send":{"message":"You send"},"confirmation.estimatedChanges.receive":{"message":"You receive"},"confirmation.estimatedChanges.notAvailable":{"message":"Not available"},"confirmation.estimatedChanges.noChanges":{"message":"No changes"},"confirmation.estimatedChanges.tooltip":{"message":"Estimated changes are what might happen if you go through with this transaction. This is just a prediction, not a guarantee."},"confirmation.advanced.show":{"message":"Show advanced"},"confirmation.advanced.hide":{"message":"Hide advanced"},"confirmation.cancelButton":{"message":"Cancel"},"confirmation.confirmButton":{"message":"Confirm"},"confirmation.signAndSendTransaction.title":{"message":"Transaction request"},"confirmation.signTransaction.title":{"message":"Signing request"},"confirmation.sendAndConfirmTransaction.title":{"message":"Sending and confirming transaction"},"confirmation.advanced.unknownInstruction":{"message":"Unknown"},"confirmation.advanced.programId":{"message":"Program ID"},"confirmation.advanced.data":{"message":"Data"},"confirmation.fee":{"message":"Network fee"},"confirmation.feeError":{"message":"Unable to estimate fee"},"confirmation.origin":{"message":"Request from"},"confirmation.origin.tooltip":{"message":"This is the site asking for your confirmation."},"confirmation.simulationErrorTitle":{"message":"This transaction was reverted during simulation."},"confirmation.simulationErrorSubtitle":{"message":"{reason}"},"confirmation.validationErrorTitle":{"message":"This is a deceptive request"},"confirmation.validationErrorSubtitle":{"message":"If you approve this request, a third party known for scams will take all your assets."},"confirmation.validationErrorLearnMore":{"message":"Learn more"},"confirmation.validationErrorSecurityAdviced":{"message":"Security advice by"},"confirmation.signMessage.title":{"message":"Sign message"},"confirmation.signMessage.message":{"message":"Message"},"confirmation.signIn.title":{"message":"Sign-in request"},"confirmation.signIn.description":{"message":"A site wants you to sign in to prove you own this account."},"confirmation.signIn.domain":{"message":"Domain"},"confirmation.signIn.unknownDomain":{"message":"Unknown domain"},"confirmation.signIn.signingInWith":{"message":"Signing in with"},"confirmation.signIn.badAccount":{"message":"This site is asking you to sign in using the wrong account."},"confirmation.signIn.message":{"message":"Message"},"confirmation.signIn.statement":{"message":"Statement"},"confirmation.signIn.version":{"message":"Version"},"confirmation.signIn.chainId":{"message":"Chain ID"},"confirmation.signIn.nonce":{"message":"Nonce"},"confirmation.signIn.issuedAt":{"message":"Issued at"},"confirmation.signIn.expirationTime":{"message":"Expiration time"},"confirmation.signIn.notBefore":{"message":"Not before"},"confirmation.signIn.requestId":{"message":"Request ID"},"confirmation.signIn.resources":{"message":"Resources"},"confirmation.signIn.badDomain":{"message":"This site is asking you to sign in using the wrong domain."},"transactionScan.errors.accountAlreadyInUse":{"message":"An account with the same address already exists."},"transactionScan.errors.insufficientSol":{"message":"Account does not have enough SOL to perform the operation."},"transactionScan.errors.slippageToleranceExceeded":{"message":"The transaction was reverted because the slippage tolerance was exceeded."},"transactionScan.errors.unknownError":{"message":"An unknown error occurred."}}}'),vv=JSON.parse('{"D":{"send.title":{"message":"Enviar"},"send.balance":{"message":"Saldo"},"send.maxButton":{"message":"Máx."},"send.cancelButton":{"message":"Cancelar"},"send.continueButton":{"message":"Continuar"},"send.fromField":{"message":"De"},"send.toField":{"message":"Para"},"send.amountField":{"message":"Monto"},"send.assetField":{"message":"Token"},"send.toPlaceholder":{"message":"Introduzca la dirección pública"},"send.fromRequiredError":{"message":"La cuenta es obligatoria"},"send.amountRequiredError":{"message":"El monto es obligatorio"},"send.amountGreatherThanMinimumBalanceForRentExemptionError":{"message":"El valor debe ser superior a {minimumValue}"},"send.insuffientSolToCoverFee":{"message":"Saldo de SOL insuficiente para cubrir la tarifa de transacción"},"send.toRequiredError":{"message":"La dirección del destinatario es obligatoria"},"send.toInvalidError":{"message":"Dirección de Solana no válida"},"send.insufficientBalance":{"message":"Saldo insuficiente"},"send.simulationTitleAPIError":{"message":"Debido a un error, no pudimos verificar las alertas de seguridad."},"send.simulationMessageAPIError":{"message":"Continúa solo si confías en todas las direcciones involucradas."},"send.simulationTitleError":{"message":"Simulación de transacción fallida"},"send.simulationMessageError":{"message":"Esta transacción se revirtió durante la simulación."},"send.selectedTokenPriceNotAvailable":{"message":"Los precios de los tokens en {currency} no están disponibles actualmente. Aún puede enviar tokens."},"send.confirmation.title":{"message":"Revisar"},"send.confirmation.from":{"message":"De"},"send.confirmation.recipient":{"message":"Destinatario"},"send.confirmation.network":{"message":"Red"},"send.confirmation.transactionSpeed":{"message":"Velocidad de la transacción"},"send.confirmation.fee":{"message":"Tarifa de red"},"send.confirmation.sendButton":{"message":"Enviar"},"send.confirmation.cancelButton":{"message":"Cancelar"},"send.confirmation.viewTransaction":{"message":"Ver transacción"},"send.send-pending.title":{"message":"Enviando..."},"send.send-pending.subtitle":{"message":"Se envió su transacción."},"send.transaction-success.title":{"message":"Enviado"},"send.transaction-success.subtitle":{"message":"El envío de {amount} {tokenSymbol} se realizó correctamente"},"send.transaction-failure.title":{"message":"Transacción fallida"},"send.transaction-failure.subtitle":{"message":"Error al enviar {amount} {tokenSymbol}"},"confirmation.account":{"message":"Cuenta"},"confirmation.network":{"message":"Red"},"confirmation.estimatedChanges":{"message":"Cambios estimados"},"confirmation.estimatedChanges.send":{"message":"Usted envía"},"confirmation.estimatedChanges.receive":{"message":"Usted recibe"},"confirmation.estimatedChanges.notAvailable":{"message":"No disponible"},"confirmation.estimatedChanges.noChanges":{"message":"Sin cambios"},"confirmation.estimatedChanges.tooltip":{"message":"Los cambios estimados son los que podrían producirse si sigue adelante con esta transacción. Esto es solo una predicción, no una garantía."},"confirmation.advanced.show":{"message":"Mostrar avanzadas"},"confirmation.advanced.hide":{"message":"Ocultar avanzadas"},"confirmation.cancelButton":{"message":"Cancelar"},"confirmation.confirmButton":{"message":"Confirmar"},"confirmation.signAndSendTransaction.title":{"message":"Solicitud de transacción"},"confirmation.signTransaction.title":{"message":"Signing request"},"confirmation.sendAndConfirmTransaction.title":{"message":"Sending and confirming transaction"},"confirmation.advanced.unknownInstruction":{"message":"Desconocida"},"confirmation.advanced.programId":{"message":"ID del programa"},"confirmation.advanced.data":{"message":"Datos"},"confirmation.fee":{"message":"Tarifa de red"},"confirmation.feeError":{"message":"No se puede calcular la tarifa"},"confirmation.origin":{"message":"Solicitud de"},"confirmation.origin.tooltip":{"message":"This is the site asking for your confirmation."},"confirmation.simulationErrorTitle":{"message":"Esta transacción se revirtió durante la simulación."},"confirmation.simulationErrorSubtitle":{"message":"Motivo: {reason}"},"confirmation.validationErrorTitle":{"message":"Esta es una solicitud engañosa"},"confirmation.validationErrorSubtitle":{"message":"Si aprueba esta solicitud, un tercero conocido por sus estafas se quedará con todos sus activos."},"confirmation.validationErrorLearnMore":{"message":"Conozca más"},"confirmation.validationErrorSecurityAdviced":{"message":"Asesoramiento de seguridad por"},"confirmation.signMessage.title":{"message":"Firmar mensaje"},"confirmation.signMessage.message":{"message":"Mensaje"},"confirmation.signIn.title":{"message":"Solicitud de inicio de sesión"},"confirmation.signIn.description":{"message":"Un sitio quiere que inicie sesión para demostrar que usted es el titular de esta cuenta."},"confirmation.signIn.domain":{"message":"Domain"},"confirmation.signIn.unknownDomain":{"message":"Dominio desconocido"},"confirmation.signIn.signingInWith":{"message":"Iniciar sesión con"},"confirmation.signIn.badAccount":{"message":"Este sitio le pide que inicie sesión con la cuenta incorrecta."},"confirmation.signIn.message":{"message":"Mensaje"},"confirmation.signIn.statement":{"message":"Declaración"},"confirmation.signIn.version":{"message":"Versión"},"confirmation.signIn.chainId":{"message":"ID de cadena"},"confirmation.signIn.nonce":{"message":"Nonce"},"confirmation.signIn.issuedAt":{"message":"Emitido a las"},"confirmation.signIn.expirationTime":{"message":"Hora de caducidad"},"confirmation.signIn.notBefore":{"message":"No antes de"},"confirmation.signIn.requestId":{"message":"ID de solicitud"},"confirmation.signIn.resources":{"message":"Recursos"},"confirmation.signIn.badDomain":{"message":"This site is asking you to sign in using the wrong domain."},"transactionScan.errors.accountAlreadyInUse":{"message":"Ya existe una cuenta con la misma dirección."},"transactionScan.errors.insufficientSol":{"message":"La cuenta no tiene suficiente SOL para realizar la operación."},"transactionScan.errors.slippageToleranceExceeded":{"message":"La transacción se revirtió porque se superó la tolerancia de deslizamiento."},"transactionScan.errors.unknownError":{"message":"An unknown error occurred."}}}'),wv={en:yv.D,es:vv.D},Av="en";function bv(e){const t=wv[e]??wv[Av];return(e,n)=>{let r=t?.[e]?.message??e;return n&&r&&Object.keys(n).forEach((e=>{const t=new RegExp(`\\{${e}\\}`,"gu");r=r.replace(t,n[e]??"")})),r}}function Sv(e){if(e===Ql)return"MetaMask";try{return new URL(e).hostname}catch(e){throw new Error("Invalid URL")}}const Ev=({label:e,value:t})=>null!=t?Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:e}),Qy(av,{children:t})]}):null,kv=1e-6,Iv=3,Tv="0",_v=new _o(kv).decimalPlaces();function xv(e,t){const[n]=t.split("_");try{const r=new _o(e);if(r.isNaN())return Tv;if(r.isZero())return Tv;if(r.abs().lt(kv))return`<${function(e,t){const n=new _o(t),r=n.decimalPlaces(),o=n.toFixed(r??0),[i]=e.split("_"),[a,s]=o.split("."),c=new Intl.NumberFormat(i).format(a);return s?`${c}.${s}`:c}(t,kv)}`;if(r.abs().lt(1))return new Intl.NumberFormat(n,{maximumSignificantDigits:Iv}).format(Number(r.toFixed(_v??0)));const o=r.abs().integerValue().toString().length,i=Math.max(0,Iv-o+1);return new Intl.NumberFormat(t,{maximumFractionDigits:i}).format(r.toFixed(i))}catch(e){return Gl.error(e),Tv}}function Cv(e,t,n){const r=new _o(e).toNumber(),[o]=n.split("_");return r.toLocaleString(o,{style:"currency",currency:t,maximumFractionDigits:2,minimumFractionDigits:2})}const Rv=({asset:e,preferences:t})=>{const n=e.type;return Xy(ov,{direction:"vertical",crossAlignment:"end",children:[Xy(ov,{direction:"horizontal",alignment:"center",children:[Xy(av,{color:"in"===n?"success":"error",children:["in"===n?"+":"-",xv(e.value??0,t.locale)]}),e.imageSvg?Qy(ov,{alignment:"center",center:!0,children:Qy(lv,{borderRadius:"full",src:e.imageSvg})}):null,Qy(av,{children:e.symbol??""})]}),e.price?Qy(av,{color:"muted",children:Cv(e.price.toString(),t.currency,t.locale)}):null]})},Pv=nv("Tooltip");var Nv;!function(e){e.AddSquare="add-square",e.Add="add",e.Arrow2Down="arrow-2-down",e.Arrow2Left="arrow-2-left",e.Arrow2Right="arrow-2-right",e.Arrow2Up="arrow-2-up",e.Arrow2UpRight="arrow-2-up-right",e.ArrowDoubleLeft="arrow-double-left",e.ArrowDoubleRight="arrow-double-right",e.ArrowDown="arrow-down",e.ArrowLeft="arrow-left",e.ArrowRight="arrow-right",e.ArrowUp="arrow-up",e.BankToken="bank-token",e.Bank="bank",e.Book="book",e.Bookmark="bookmark",e.Bridge="bridge",e.Calculator="calculator",e.CardPos="card-pos",e.CardToken="card-token",e.Card="card",e.Category="category",e.Chart="chart",e.CheckBold="check-bold",e.Check="check",e.Clock="clock",e.Close="close",e.CodeCircle="code-circle",e.Coin="coin",e.Confirmation="confirmation",e.Connect="connect",e.CopySuccess="copy-success",e.Copy="copy",e.Customize="customize",e.Danger="danger",e.Dark="dark",e.Data="data",e.Diagram="diagram",e.DocumentCode="document-code",e.DragDrop="drag-drop",e.DraggingAnimation="dragging-animation",e.PinningAnimation="pinning-animation",e.Edit="edit",e.Eraser="eraser",e.Ethereum="ethereum",e.Expand="expand",e.Explore="explore",e.Export="export",e.EyeSlash="eye-slash",e.Eye="eye",e.Filter="filter",e.Flag="flag",e.FlashSlash="flash-slash",e.Flash="flash",e.FullCircle="full-circle",e.Gas="gas",e.GlobalSearch="global-search",e.Global="global",e.Graph="graph",e.Hardware="hardware",e.Heart="heart",e.Hierarchy="hierarchy",e.Home="home",e.Import="import",e.Info="info",e.Key="key",e.Light="light",e.Link="link",e.Loading="loading",e.LockCircle="lock-circle",e.LockSlash="lock-slash",e.Lock="lock",e.Login="login",e.Logout="logout",e.Menu="menu",e.MessageQuestion="message-question",e.Messages="messages",e.MinusBold="minus-bold",e.MinusSquare="minus-square",e.Minus="minus",e.Mobile="mobile",e.Money="money",e.Monitor="monitor",e.MoreHorizontal="more-horizontal",e.MoreVertical="more-vertical",e.NotificationCircle="notification-circle",e.Notification="notification",e.PasswordCheck="password-check",e.People="people",e.Pin="pin",e.ProgrammingArrows="programming-arrows",e.Custody="custody",e.Question="question",e.Received="received",e.Refresh="refresh",e.Save="save",e.ScanBarcode="scan-barcode",e.ScanFocus="scan-focus",e.Scan="scan",e.Scroll="scroll",e.Search="search",e.SecurityCard="security-card",e.SecurityCross="security-cross",e.SecurityKey="security-key",e.SecuritySearch="security-search",e.SecuritySlash="security-slash",e.SecurityTick="security-tick",e.SecurityTime="security-time",e.SecurityUser="security-user",e.Security="security",e.Send1="send-1",e.Send2="send-2",e.Setting="setting",e.Slash="slash",e.SnapsMobile="snaps-mobile",e.SnapsPlus="snaps-plus",e.Snaps="snaps",e.Speedometer="speedometer",e.Star="star",e.Stake="stake",e.Student="student",e.SwapHorizontal="swap-horizontal",e.SwapVertical="swap-vertical",e.Tag="tag",e.Tilde="tilde",e.Timer="timer",e.Trash="trash",e.TrendDown="trend-down",e.TrendUp="trend-up",e.UserCircleAdd="user-circle-add",e.UserCircleLink="user-circle-link",e.UserCircleRemove="user-circle-remove",e.UserCircle="user-circle",e.User="user",e.WalletCard="wallet-card",e.WalletMoney="wallet-money",e.Wallet="wallet",e.Warning="warning",e.Twitter="twitter",e.QrCode="qr-code",e.UserCheck="user-check",e.Unpin="unpin",e.Ban="ban",e.Bold="bold",e.CircleX="circle-x",e.Download="download",e.FileIcon="file",e.Flask="flask",e.Plug="plug",e.Share="share",e.Square="square",e.Tint="tint",e.Upload="upload",e.Usb="usb",e.Wifi="wifi",e.PlusMinus="plus-minus"}(Nv||(Nv={}));const Bv=nv("Icon"),Ov=({preferences:e})=>{const t=bv(e.locale);return Xy(ov,{direction:"horizontal",center:!0,children:[Qy(av,{fontWeight:"medium",children:t("confirmation.estimatedChanges")}),Qy(Pv,{content:t("confirmation.estimatedChanges.tooltip"),children:Qy(Bv,{name:"info"})})]})},Mv=nv("Skeleton"),zv=({preferences:e})=>{const t=bv(e.locale);return Xy(sv,{direction:"vertical",children:[Qy(Ov,{preferences:e}),Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:t("confirmation.estimatedChanges.send")}),Qy(ov,{children:Xy(ov,{direction:"vertical",crossAlignment:"end",children:[Qy(Mv,{width:100,height:20}),Qy(Mv,{width:40,height:20})]})})]}),Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:t("confirmation.estimatedChanges.receive")}),Qy(ov,{children:Xy(ov,{direction:"vertical",crossAlignment:"end",children:[Qy(Mv,{width:100,height:20}),Qy(Mv,{width:40,height:20})]})})]})]})},jv=({changes:e,preferences:t,scanFetchStatus:n,scanStatus:r})=>{const o=bv(t.locale),i="fetched"===n,a="error"===n;if("fetching"===n)return Qy(zv,{preferences:t});if(a||i&&"ERROR"===r)return Xy(sv,{direction:"vertical",children:[Qy(Ov,{preferences:t}),Qy(av,{color:"alternative",children:o("confirmation.estimatedChanges.notAvailable")})]});const s=e?.assets.filter((e=>"out"===e.type))??[],c=e?.assets.filter((e=>"in"===e.type))??[],u=s.length>0||c.length>0;return Xy(sv,i&&!u?{direction:"vertical",children:[Qy(Ov,{preferences:t}),Qy(av,{color:"alternative",children:o("confirmation.estimatedChanges.noChanges")})]}:{children:[Qy(Ov,{preferences:t}),s?.length>0?Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:o("confirmation.estimatedChanges.send")}),Qy(ov,{children:Qy(ov,{children:s?.map((e=>Qy(Rv,{asset:e,preferences:t})))})})]}):null,Qy(ov,{children:null}),c?.length>0?Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:o("confirmation.estimatedChanges.receive")}),Qy(ov,{children:Qy(ov,{children:c?.map((e=>Qy(Rv,{asset:e,preferences:t})))})})]}):null]})};var Uv=function(e){return e.Cancel="confirm-sign-in-cancel",e.Confirm="confirm-sign-in-confirm",e}({});const Dv={"confirm-sign-in-cancel":async function({id:e}){await fy(e,!1)},"confirm-sign-in-confirm":async function({id:e}){await fy(e,!0)}},Lv=({params:e,origin:t,account:n,scope:r,preferences:o,networkImage:i})=>{const a=bv(o.locale),s=t?Sv(t):null,{domain:c,statement:u,uri:l,version:d,chainId:f,nonce:h,issuedAt:p,expirationTime:g,notBefore:m,requestId:y,resources:v,address:w}=e,A=mv(r,n.address),b=w?mv(r,w):null,S=b!==A,E=c!==s;return Xy(rv,{children:[Xy(ov,{children:[Xy(ov,{alignment:"center",center:!0,children:[Qy(ov,{children:null}),Qy(iv,{size:"lg",children:a("confirmation.signIn.title")}),Qy(av,{color:"muted",alignment:"center",children:a("confirmation.signIn.description")})]}),o.simulateOnChainActions?Qy(jv,{changes:null,scanStatus:null,preferences:o,scanFetchStatus:"fetched"}):null,Xy(sv,{children:[s?Qy(cv,{label:a("confirmation.origin"),tooltip:a("confirmation.origin.tooltip"),children:Qy(av,{children:s})}):null,Qy(cv,{variant:E?"critical":"default",label:a("confirmation.signIn.domain"),tooltip:E?a("confirmation.signIn.badDomain"):void 0,children:Qy(av,{children:c??a("confirmation.signIn.unknownDomain")})}),Qy(cv,{label:a("confirmation.signIn.signingInWith"),tooltip:S?a("confirmation.signIn.badAccount"):void 0,variant:S?"warning":"default",children:n.domain?Qy(gv,{domain:n.domain,scope:r,address:n.address}):Qy(uv,{address:A,truncate:!0,displayName:!0,avatar:!0})})]}),Xy(sv,{children:[Qy(av,{fontWeight:"medium",children:a("confirmation.signIn.message")}),Qy(av,{children:u??""}),Qy(Ev,{label:"URL",value:l??""}),Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:a("confirmation.network")}),Xy(ov,{direction:"horizontal",alignment:"center",children:[Qy(ov,{alignment:"center",center:!0,children:Qy(lv,{borderRadius:"medium",src:i??ev})}),Qy(av,{children:id[r].name})]})]}),b?Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:a("confirmation.account")}),Qy(uv,{address:b,truncate:!0,displayName:!0,avatar:!0})]}):null,Qy(Ev,{label:a("confirmation.signIn.version"),value:d??""}),Qy(Ev,{label:a("confirmation.signIn.chainId"),value:f??""}),Qy(Ev,{label:a("confirmation.signIn.nonce"),value:h??""}),Qy(Ev,{label:a("confirmation.signIn.issuedAt"),value:p??""}),Qy(Ev,{label:a("confirmation.signIn.expirationTime"),value:g??""}),Qy(Ev,{label:a("confirmation.signIn.notBefore"),value:m??""}),Qy(Ev,{label:a("confirmation.signIn.requestId"),value:y??""}),v&&v.length>0?Xy(ov,{alignment:"space-between",direction:"vertical",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:a("confirmation.signIn.resources")}),Qy(ov,{direction:"vertical",children:v.map((e=>Qy(av,{children:e},e)))})]}):null]})]}),Xy(dv,{children:[Qy(fv,{name:Uv.Cancel,children:a("confirmation.cancelButton")}),Qy(fv,{name:Uv.Confirm,variant:E?"destructive":"primary",children:a("confirmation.confirmButton")})]})]})};var Fv=function(e){return e.Cancel="confirm-sign-message-cancel",e.Confirm="confirm-sign-message-confirm",e}({});const $v={"confirm-sign-message-cancel":async function({id:e}){await fy(e,!1)},"confirm-sign-message-confirm":async function({id:e}){await fy(e,!0)}},qv=({message:e,account:t,scope:n,locale:r,networkImage:o,origin:i})=>{const a=bv(r),{address:s}=t,c=i?Sv(i):null,u=mv(n,s);return Xy(rv,{children:[Xy(ov,{children:[Xy(ov,{alignment:"center",center:!0,children:[Qy(ov,{children:null}),Qy(iv,{size:"lg",children:a("confirmation.signMessage.title")})]}),Xy(sv,{children:[Qy(ov,{direction:"horizontal",center:!0,children:Qy(av,{fontWeight:"medium",children:a("confirmation.signMessage.message")})}),Qy(ov,{alignment:"space-between",children:Qy(av,{children:e})})]}),Xy(sv,{children:[c?Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Xy(ov,{alignment:"space-between",direction:"horizontal",center:!0,children:[Qy(av,{fontWeight:"medium",color:"alternative",children:a("confirmation.origin")}),Qy(Pv,{content:a("confirmation.origin.tooltip"),children:Qy(Bv,{name:"question",color:"muted"})})]}),Qy(av,{children:c})]}):null,Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:a("confirmation.account")}),t.domain?Qy(gv,{domain:t.domain,scope:n,address:s}):Qy(uv,{address:u,truncate:!0,displayName:!0,avatar:!0})]}),Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:a("confirmation.network")}),Xy(ov,{direction:"horizontal",alignment:"center",children:[Qy(ov,{alignment:"center",center:!0,children:Qy(lv,{borderRadius:"medium",src:o??ev})}),Qy(av,{children:id[n].name})]})]})]})]}),Xy(dv,{children:[Qy(fv,{name:Fv.Cancel,children:a("confirmation.cancelButton")}),Qy(fv,{name:Fv.Confirm,children:a("confirmation.confirmButton")})]})]})};var Wv=function(e){return e.ShowAdvanced="confirm-sign-and-send-transaction-show-advanced",e.Cancel="confirm-sign-and-send-transaction-cancel",e.Confirm="confirm-sign-and-send-transaction-confirm",e}({});const Vv={"confirm-sign-and-send-transaction-show-advanced":async function({id:e,context:t}){const n={...t,advanced:{...t.advanced,shown:!t.advanced.shown}};await dy(e,Qy(ow,{context:n}),n)},"confirm-sign-and-send-transaction-cancel":async function({id:e}){await fy(e,!1)},"confirm-sign-and-send-transaction-confirm":async function({id:e}){await fy(e,!0)}},Kv=e=>e.replace(/([A-Z])/gu," $1").trim().replace(/^./u,(e=>e.toUpperCase())),Gv=({address:e,scope:t})=>Qy(hv,{href:pv(t,"address",e),children:Qy(uv,{avatar:!1,address:mv(t,e),truncate:!0})}),Hv=({instruction:e,scope:t,locale:n})=>{const r=bv(n),{type:o,encoded:i,parsed:a}=e,{programAddress:s,dataBase58:c}=i,u=null!==a,l=Kv(o);return Xy(sv,{alignment:"start",children:[Qy(av,{color:"alternative",fontWeight:"bold",children:l}),Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{color:"alternative",alignment:"start",children:r("confirmation.advanced.programId")}),Qy(Gv,{address:s,scope:t})]}),u&&Object.entries(a.accounts??{}).map((([e,n])=>Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{color:"alternative",children:Kv(e)}),Ks(n.address)?Qy(Gv,{address:n.address,scope:t}):Qy(av,{children:ay(n.address)?.toString()??""})]}))),u&&Object.entries(a.data).map((([e,n])=>Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{color:"alternative",children:Kv(e)}),Ks(n)?Qy(Gv,{address:n,scope:t}):Qy(av,{children:ay(n)?.toString()??""})]}))),!u&&Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{color:"alternative",children:r("confirmation.advanced.data")}),Qy(av,{children:(d=c,d.length>12?`${d.slice(0,5)}...${d.slice(-5)}`:d)})]})]});var d},Zv=({instructions:e,showInstructions:t,locale:n,scope:r})=>{const o=bv(n),i=t?"hide":"show",a=t?"arrow-up":"arrow-down";return Xy(ov,{alignment:"start",children:[Xy(fv,{name:Wv.ShowAdvanced,children:[o(`confirmation.advanced.${i}`)," ",Qy(Bv,{name:a,color:"primary"})]}),t&&Qy(ov,{children:e.map((e=>Qy(Hv,{locale:n,scope:r,instruction:e})))})]})},Jv=nv("Banner"),Yv={AccountAlreadyInUse:"transactionScan.errors.accountAlreadyInUse",ResultWithNegativeLamports:"transactionScan.errors.insufficientSol",SlippageToleranceExceeded:"transactionScan.errors.slippageToleranceExceeded",ExceededDesiredSlippageLimit:"transactionScan.errors.slippageToleranceExceeded"};function Qv(e,t){const n=bv(t.locale),{code:r}=e;return n((r&&Yv[r])??"transactionScan.errors.unknownError")}const Xv={Malicious:"danger",Warning:"warning"},ew=({preferences:e,validation:t,error:n,scanFetchStatus:r})=>{const o=bv(e.locale);if("error"===r)return Qy(Jv,{title:o("send.simulationTitleAPIError"),severity:"danger",children:Qy(av,{children:o("send.simulationMessageAPIError")})});if(!n&&!t)return Qy(ov,{children:null});if(n)return Qy(Jv,{title:o("confirmation.simulationErrorTitle"),severity:"warning",children:Qy(av,{children:o("confirmation.simulationErrorSubtitle",{reason:Qv(n,e)})})});if(!t)return Qy(ov,{children:null});const i=t?.type?Xv[t.type]:void 0;return i?Xy(Jv,{title:o("confirmation.validationErrorTitle"),severity:i,children:[Qy(av,{children:o("confirmation.validationErrorSubtitle")}),Qy(av,{size:"sm",children:Qy(hv,{href:"https://support.metamask.io/configure/wallet/how-to-turn-on-security-alerts/",children:o("confirmation.validationErrorLearnMore")})}),Xy(av,{size:"sm",children:[Qy(Bv,{color:"primary",name:"security-tick"})," ",o("confirmation.validationErrorSecurityAdviced")," ",Qy(hv,{href:"https://www.blockaid.io",children:"Blockaid"})]})]}):Qy(ov,{children:null})};function tw(e,t,n){return`${xv(e,n)} ${t}`}function nw(e,t){return new _o(e).multipliedBy(t).toString()}const rw=({origin:e,accountAddress:t,scope:n,feeInSol:r,nativePrice:o,fetchingPricesStatus:i,preferences:a,networkImage:s})=>{const{currency:c,locale:u}=a,l=bv(u),d=e?Sv(e):null,f="fetching"===i,h=r&&o&&!("error"===i)?Cv(nw(r,o),c,u):"";return Xy(sv,{children:[d?Xy(ov,{children:[Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Xy(ov,{alignment:"space-between",direction:"horizontal",center:!0,children:[Qy(av,{fontWeight:"medium",color:"alternative",children:l("confirmation.origin")}),Qy(Pv,{content:l("confirmation.origin.tooltip"),children:Qy(Bv,{name:"question",color:"muted"})})]}),Qy(av,{children:d})]}),Qy(ov,{children:null})]}):null,Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:l("confirmation.account")}),Qy(uv,{address:mv(n,t),truncate:!0,displayName:!0,avatar:!0})]}),Qy(ov,{children:null}),Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:l("confirmation.network")}),Xy(ov,{direction:"horizontal",alignment:"center",children:[Qy(ov,{alignment:"center",center:!0,children:Qy(lv,{borderRadius:"medium",src:s??""})}),Qy(av,{children:id[n].name})]})]}),Qy(ov,{children:null}),Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:l("confirmation.fee")}),r?Xy(ov,{direction:"horizontal",alignment:"center",children:[f?Qy(Mv,{width:80}):Qy(av,{color:"muted",children:h}),Qy(av,{children:tw(r,id[n].nativeToken.symbol,u)})]}):Qy(Pv,{content:l("confirmation.feeError"),children:Qy(Bv,{name:"warning"})})]})]})},ow=({context:e})=>{const t=bv(e.preferences.locale),n=e.feeEstimatedInSol,{nativeToken:r}=id[e.scope],o=e.tokenPrices[r.caip19Id]?.price??null,i="fetching"===e.scanFetchStatus||"ERROR"===e.scan?.status;return Xy(rv,{children:[Xy(ov,{children:[e.preferences.useSecurityAlerts?Qy(ew,{scanFetchStatus:e.scanFetchStatus,validation:e.scan?.validation??null,error:e.scan?.error??null,preferences:e.preferences}):null,Xy(ov,{alignment:"center",center:!0,children:[Qy(ov,{children:null}),Qy(iv,{size:"lg",children:t(`confirmation.${e.method}.title`)}),Qy(ov,{children:null})]}),e.preferences.simulateOnChainActions?Qy(jv,{scanStatus:e.scan?.status??null,scanFetchStatus:e.scanFetchStatus,changes:e.scan?.estimatedChanges??null,preferences:e.preferences}):null,Qy(rw,{accountAddress:e.account?.address??null,scope:e.scope,feeInSol:n,nativePrice:o,fetchingPricesStatus:e.tokenPricesFetchStatus,preferences:e.preferences,networkImage:e.networkImage,origin:e.origin}),Qy(Zv,{instructions:e.advanced.instructions,showInstructions:e.advanced.shown,locale:e.preferences.locale,scope:e.scope})]}),Xy(dv,{children:[Qy(fv,{name:Wv.Cancel,children:t("confirmation.cancelButton")}),Qy(fv,{name:Wv.Confirm,disabled:i,children:t("confirmation.confirmButton")})]})]})},iw={method:$t.SignAndSendTransaction,scope:Xl.Mainnet,networkImage:ev,account:null,transaction:"",scan:null,scanFetchStatus:"fetching",feeEstimatedInSol:"0",tokenPrices:{},tokenPricesFetchStatus:"fetching",origin:"",preferences:{locale:"en",currency:"usd",hideBalances:!1,useSecurityAlerts:!0,useExternalPricingData:!0,simulateOnChainActions:!0,useTokenDetection:!0,batchCheckBalances:!0,displayNftMedia:!0,useNftDetection:!0},advanced:{shown:!1,instructions:[]}};function aw(e){return JSON.parse(function(e){const t=[];let n=!1;for(let r=0;r<e.length;r++){let o=!1;if("\\"===e[r]&&(t.push(e[r++]),o=!o),'"'!==e[r]){if(!n){const n=sw(e,r);if(n?.length){r+=n.length-1,n.match(/\.|[eE]-/)?t.push(n):t.push(cw(n));continue}}t.push(e[r])}else t.push(e[r]),o||(n=!n)}return t.join("")}(e),((e,t)=>function(e){return!!e&&"object"==typeof e&&"$n"in e&&"string"==typeof e.$n}(t)?function({$n:e}){if(e.match(/[eE]/)){const[t,n]=e.split(/[eE]/);return BigInt(t)*BigInt(10)**BigInt(n)}return BigInt(e)}(t):t))}function sw(e,t){if(!e[t]?.match(/[-\d]/))return null;const n=e.slice(t).match(/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/);return n?n[0]:null}function cw(e){return`{"$n":"${e}"}`}var uw=0n;function lw(){const e=uw;return uw++,e.toString()}function dw(e){return function(e){return new Proxy(e.api,{defineProperty:()=>!1,deleteProperty:()=>!1,get:(t,n,r)=>function(...o){const i=n.toString(),a=Reflect.get(t,i,r);if(!a)throw new Aa(pa,{method:i,params:o});const s=a(...o);return function({transport:e},t){return{send:async n=>await t.execute({signal:n?.abortSignal,transport:e})}}(e,s)}})}(e)}function fw(e){return new Proxy({},{defineProperty:()=>!1,deleteProperty:()=>!1,get(...t){const[n,r]=t,o=r.toString();return function(...t){const n=Object.freeze({methodName:o,params:t}),r=e?.requestTransformer?e?.requestTransformer(n):n;return Object.freeze({execute:async({signal:t,transport:n})=>{const o=function(e){return{id:lw(),jsonrpc:"2.0",method:e.methodName,params:e.params}}(r),i=await n({payload:o,signal:t});return e?.responseTransformer?e.responseTransformer(i,r):i}})}}})}function hw(e){return null!=e&&"object"==typeof e&&!Array.isArray(e)&&("jsonrpc"in e&&"2.0"===e.jsonrpc&&"method"in e&&"string"==typeof e.method&&"params"in e)}var pw={};function gw(e){return function t(n,r){if(Array.isArray(n))return n.map(((e,n)=>{const o={...r,keyPath:[...r.keyPath,n]};return t(e,o)}));if("object"==typeof n&&null!==n){const e={};for(const o in n){if(!Object.prototype.hasOwnProperty.call(n,o))continue;const i={...r,keyPath:[...r.keyPath,o]};e[o]=t(n[o],i)}return e}return e.reduce(((e,t)=>t(e,r)),n)}}function mw(e,t){return n=>{const r=gw(e);return Object.freeze({...n,params:r(n.params,t)})}}function yw(e){return"bigint"==typeof e?Number(e):e}function vw({commitmentPropertyName:e,params:t,optionsObjectPositionInParams:n,overrideCommitment:r}){const o=t[n];if(void 0===o||o&&"object"==typeof o&&!Array.isArray(o))if(o&&e in o){if(!o[e]||"finalized"===o[e]){const r=[...t],{[e]:i,...a}=o;return Object.keys(a).length>0?r[n]=a:n===r.length-1?r.length--:r[n]=void 0,r}}else if("finalized"!==r){const i=[...t];return i[n]={...o,[e]:r},i}return t}function ww(e){return(t,{keyPath:n})=>("bigint"==typeof t&&e&&(t>Number.MAX_SAFE_INTEGER||t<-Number.MAX_SAFE_INTEGER)&&e(n,t),t)}var Aw={accountNotifications:1,blockNotifications:1,getAccountInfo:1,getBalance:1,getBlock:1,getBlockHeight:0,getBlockProduction:0,getBlocks:2,getBlocksWithLimit:2,getEpochInfo:0,getFeeForMessage:1,getInflationGovernor:0,getInflationReward:1,getLargestAccounts:0,getLatestBlockhash:0,getLeaderSchedule:1,getMinimumBalanceForRentExemption:1,getMultipleAccounts:1,getProgramAccounts:1,getSignaturesForAddress:1,getSlot:0,getSlotLeader:0,getStakeMinimumDelegation:0,getSupply:0,getTokenAccountBalance:1,getTokenAccountsByDelegate:2,getTokenAccountsByOwner:2,getTokenLargestAccounts:1,getTokenSupply:1,getTransaction:1,getTransactionCount:0,getVoteAccounts:0,isBlockhashValid:1,logsNotifications:1,programNotifications:1,requestAirdrop:2,sendTransaction:1,signatureNotifications:1,simulateTransaction:1};function bw(e){const t=e?.onIntegerOverflow;return n=>{return nu(n,t?(r=t,e=>mw([ww(((...t)=>r(e,...t)))],{keyPath:[]})(e)):e=>e,mw([yw],{keyPath:[]}),function({defaultCommitment:e,optionsObjectPositionByMethod:t}){return n=>{const{params:r,methodName:o}=n;if(!Array.isArray(r))return n;const i=t[o];return null==i?n:Object.freeze({methodName:o,params:vw({commitmentPropertyName:"sendTransaction"===o?"preflightCommitment":"commitment",optionsObjectPositionInParams:i,overrideCommitment:e,params:r})})}}({defaultCommitment:e?.defaultCommitment,optionsObjectPositionByMethod:Aw}));var r}}function Sw(e){return t=[Ew(e)],n={keyPath:[]},e=>gw(t)(e,n);var t,n}function Ew(e){return function(t,{keyPath:n}){return"number"==typeof t&&Number.isInteger(t)||"bigint"==typeof t?function(e,t){return t.some((t=>{if(t.length!==e.length)return!1;for(let n=e.length-1;n>=0;n--){const r=e[n],o=t[n];if(o!==r&&(o!==pw||"number"!=typeof r))return!1}return!0}))}(n,e)?Number(t):BigInt(t):t}}function kw(e){return(t,n)=>{const r=n.methodName,o=e?.allowedNumericKeyPaths&&r?e.allowedNumericKeyPaths[r]:void 0;return nu(t,(e=>(e=>{const t=e;if("error"in t)throw _a(t.error);return t})(e)),(e=>e.result),(e=>Sw(o??[])(e,n)))}}var Iw,Tw=[["data","parsed","info","tokenAmount","decimals"],["data","parsed","info","tokenAmount","uiAmount"],["data","parsed","info","rentExemptReserve","decimals"],["data","parsed","info","rentExemptReserve","uiAmount"],["data","parsed","info","delegatedAmount","decimals"],["data","parsed","info","delegatedAmount","uiAmount"],["data","parsed","info","extensions",pw,"state","olderTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",pw,"state","newerTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",pw,"state","preUpdateAverageRate"],["data","parsed","info","extensions",pw,"state","currentRate"]],_w=[...Tw,["data","parsed","info","lastExtendedSlotStartIndex"],["data","parsed","info","slashPenalty"],["data","parsed","info","warmupCooldownRate"],["data","parsed","info","decimals"],["data","parsed","info","numRequiredSigners"],["data","parsed","info","numValidSigners"],["data","parsed","info","stake","delegation","warmupCooldownRate"],["data","parsed","info","exemptionThreshold"],["data","parsed","info","burnPercent"],["data","parsed","info","commission"],["data","parsed","info","votes",pw,"confirmationCount"]],xw=[["index"],["instructions",pw,"accounts",pw],["instructions",pw,"programIdIndex"],["instructions",pw,"stackHeight"]],Cw=[["addressTableLookups",pw,"writableIndexes",pw],["addressTableLookups",pw,"readonlyIndexes",pw],["header","numReadonlySignedAccounts"],["header","numReadonlyUnsignedAccounts"],["header","numRequiredSignatures"],["instructions",pw,"accounts",pw],["instructions",pw,"programIdIndex"],["instructions",pw,"stackHeight"]];function Rw(e){return fw({requestTransformer:bw(e),responseTransformer:kw({allowedNumericKeyPaths:Pw()})})}function Pw(){return Iw||(Iw={getAccountInfo:_w.map((e=>["value",...e])),getBlock:[["transactions",pw,"meta","preTokenBalances",pw,"accountIndex"],["transactions",pw,"meta","preTokenBalances",pw,"uiTokenAmount","decimals"],["transactions",pw,"meta","postTokenBalances",pw,"accountIndex"],["transactions",pw,"meta","postTokenBalances",pw,"uiTokenAmount","decimals"],["transactions",pw,"meta","rewards",pw,"commission"],...xw.map((e=>["transactions",pw,"meta","innerInstructions",pw,...e])),...Cw.map((e=>["transactions",pw,"transaction","message",...e])),["rewards",pw,"commission"]],getClusterNodes:[[pw,"featureSet"],[pw,"shredVersion"]],getInflationGovernor:[["initial"],["foundation"],["foundationTerm"],["taper"],["terminal"]],getInflationRate:[["foundation"],["total"],["validator"]],getInflationReward:[[pw,"commission"]],getMultipleAccounts:_w.map((e=>["value",pw,...e])),getProgramAccounts:_w.flatMap((e=>[["value",pw,"account",...e],[pw,"account",...e]])),getRecentPerformanceSamples:[[pw,"samplePeriodSecs"]],getTokenAccountBalance:[["value","decimals"],["value","uiAmount"]],getTokenAccountsByDelegate:Tw.map((e=>["value",pw,"account",...e])),getTokenAccountsByOwner:Tw.map((e=>["value",pw,"account",...e])),getTokenLargestAccounts:[["value",pw,"decimals"],["value",pw,"uiAmount"]],getTokenSupply:[["value","decimals"],["value","uiAmount"]],getTransaction:[["meta","preTokenBalances",pw,"accountIndex"],["meta","preTokenBalances",pw,"uiTokenAmount","decimals"],["meta","postTokenBalances",pw,"accountIndex"],["meta","postTokenBalances",pw,"uiTokenAmount","decimals"],["meta","rewards",pw,"commission"],...xw.map((e=>["meta","innerInstructions",pw,...e])),...Cw.map((e=>["transaction","message",...e]))],getVersion:[["feature-set"]],getVoteAccounts:[["current",pw,"commission"],["delinquent",pw,"commission"]],simulateTransaction:[..._w.map((e=>["value","accounts",pw,...e])),...xw.map((e=>["value","innerInstructions",pw,...e]))]}),Iw}Object.assign({"accept-charset":!0,"access-control-request-headers":!0,"access-control-request-method":!0,connection:!0,"content-length":!0,cookie:!0,date:!0,dnt:!0,expect:!0,host:!0,"keep-alive":!0,origin:!0,"permissions-policy":!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,via:!0},{"accept-encoding":!0});var Nw=["getAccountInfo","getBalance","getBlock","getBlockCommitment","getBlockHeight","getBlockProduction","getBlocks","getBlocksWithLimit","getBlockTime","getClusterNodes","getEpochInfo","getEpochSchedule","getFeeForMessage","getFirstAvailableBlock","getGenesisHash","getHealth","getHighestSnapshotSlot","getIdentity","getInflationGovernor","getInflationRate","getInflationReward","getLargestAccounts","getLatestBlockhash","getLeaderSchedule","getMaxRetransmitSlot","getMaxShredInsertSlot","getMinimumBalanceForRentExemption","getMultipleAccounts","getProgramAccounts","getRecentPerformanceSamples","getRecentPrioritizationFees","getSignaturesForAddress","getSignatureStatuses","getSlot","getSlotLeader","getSlotLeaders","getStakeMinimumDelegation","getSupply","getTokenAccountBalance","getTokenAccountsByDelegate","getTokenAccountsByOwner","getTokenLargestAccounts","getTokenSupply","getTransaction","getTransactionCount","getVersion","getVoteAccounts","index","isBlockhashValid","minimumLedgerSlot","requestAirdrop","sendTransaction","simulateTransaction"];function Bw(e){return hw(e)&&Nw.includes(e.method)}function Ow(e){return function(e){const{fromJson:t,headers:n,toJson:r,url:o}=e,i=n&&function(e){const t={};for(const n in e)t[n.toLowerCase()]=e[n];return t}(n);return async function({payload:e,signal:n}){const a=r?r(e):JSON.stringify(e),s={body:a,headers:{...i,accept:"application/json","content-length":a.length.toString(),"content-type":"application/json; charset=utf-8"},method:"POST",signal:n},c=await fetch(o,s);if(!c.ok)throw new Aa(ha,{headers:c.headers,message:c.statusText,statusCode:c.status});return t?t(await c.text(),e):await c.json()}}({...e,fromJson:(e,t)=>Bw(t)?aw(e):JSON.parse(e),toJson:e=>{return Bw(e)?(t=e,function(e){return e.replace(/\{\s*"\$n"\s*:\s*"(-?\d+)"\s*\}/g,"$1")}(JSON.stringify(t,((e,t)=>"bigint"==typeof t?function(e){return{$n:`${e}`}}(t):t),n))):JSON.stringify(e);var t,n}})}var Mw=Object.prototype.toString,zw=Object.keys||function(e){const t=[];for(const n in e)t.push(n);return t};function jw(e,t){let n,r,o,i,a,s,c;if(!0===e)return"true";if(!1===e)return"false";switch(typeof e){case"object":if(null===e)return null;if("toJSON"in e&&"function"==typeof e.toJSON)return jw(e.toJSON(),t);if(c=Mw.call(e),"[object Array]"===c){for(o="[",r=e.length-1,n=0;n<r;n++)o+=jw(e[n],!0)+",";return r>-1&&(o+=jw(e[n],!0)),o+"]"}if("[object Object]"===c){for(i=zw(e).sort(),r=i.length,o="",n=0;n<r;)a=i[n],s=jw(e[a],!1),void 0!==s&&(o&&(o+=","),o+=JSON.stringify(a)+":"+s),n++;return"{"+o+"}"}return JSON.stringify(e);case"function":case"undefined":return t?null:void 0;case"bigint":return`${e.toString()}n`;case"string":return JSON.stringify(e);default:return isFinite(e)?e:null}}function Uw(e){const t=jw(e,!1);if(void 0!==t)return""+t}function Dw(e,t,n){let r="";if("number"==typeof t[0]){const e=t[0]+1,n=e%10,o=e%100;r=1==n&&11!=o?e+"st":2==n&&12!=o?e+"nd":3==n&&13!=o?e+"rd":e+"th"}else r=`\`${t[0].toString()}\``;const o=t.length>1?t.slice(1).map((e=>"number"==typeof e?`[${e}]`:e)).join("."):void 0,i=new Aa(fa,{argumentLabel:r,keyPath:t,methodName:e,optionalPathLabel:o?` at path \`${o}\``:"",value:n,...void 0!==o?{path:o}:void 0});return ba(i,Dw),i}var Lw,Fw={defaultCommitment:"confirmed",onIntegerOverflow(e,t,n){throw Dw(e.methodName,t,n)}},$w=globalThis.AbortController;function qw(e){return hw(e)?Uw([e.method,e.params]):void 0}function Ww(e){const t={};for(const n in e)t[n.toLowerCase()]=e[n];return t}function Vw(e){return nu(Ow({...e,headers:{...!1,...e.headers?Ww(e.headers):void 0,"solana-client":"js/2.1.0"}}),(e=>function(e,t){let n;return async function(r){const{payload:o,signal:i}=r,a=t(o);if(void 0===a)return await e(r);if(n||(queueMicrotask((()=>{n=void 0})),n={}),null==n[a]){const t=new $w,o=(async()=>{try{return await e({...r,signal:t.signal})}catch(e){if(e===(Lw||={}))return;throw e}})();n[a]={abortController:t,numConsumers:0,responsePromise:o}}const s=n[a];if(s.numConsumers++,i){const e=s.responsePromise;return await new Promise(((t,n)=>{const r=e=>{i.removeEventListener("abort",r),s.numConsumers-=1,queueMicrotask((()=>{0===s.numConsumers&&s.abortController.abort(Lw||={})})),n(e.target.reason)};i.addEventListener("abort",r),e.then(t).catch(n).finally((()=>{i.removeEventListener("abort",r)}))}))}return await s.responsePromise}}(e,qw)))}function Kw(e){return dw({api:Rw(Fw),transport:e})}const Gw=Vl,Hw=["getTransaction","getSignaturesForAddress"],Zw=e=>{const t=Vw({url:e}),n=Vw({url:e,headers:{"x-bigtable":"disabled"}});return async(...e)=>{const{payload:r}=e[0],{method:o}=r,i=Hw.includes(o);return Gw.info(`[🚌 ToggleInfuraBigtableLookupsTransport] RPC method is ${o}. ${i?"Enabling":"Disabling"} BigTable lookups.`),i?t(...e):n(...e)}},Jw=Vl;async function Yw(e){try{await snap.request({method:"snap_trackError",params:{error:qr(new Error(JSON.stringify(e)))}}),Jw.info(`[🚌 ErrorTrackingTransport] Error tracked: ${e.method} - ${e.errorMessage}`)}catch(e){Jw.warn(`[🚌 ErrorTrackingTransport] Failed to track error: ${e}`)}}function Qw(e){return!(!j(e,vf)&&!Sf(e))||!!wa(e)}const Xw=e=>async(...t)=>{const{payload:n}=t[0],{method:r}=n;try{Jw.info(`[🚌 ErrorTrackingTransport] Making RPC request: ${r}`);const o=await e(...t);if(Qw(o)){const e={method:r,errorMessage:`RPC error in response: ${JSON.stringify(o)}`,responseData:o,requestParams:n};return await Yw(e),o}return o}catch(e){const t=function(e,t){const n={method:t,errorMessage:"Unknown error"};return e?.currentUrl&&(n.url=e.currentUrl),e instanceof Error?(n.errorMessage=e.message,n.errorStack=e.stack):"string"==typeof e?n.errorMessage=e:e?.message?n.errorMessage=e.message:e?.error&&(n.errorMessage="string"==typeof e.error?e.error:JSON.stringify(e.error)),e?.status?n.statusCode=e.status:e?.statusCode&&(n.statusCode=e.statusCode),e?.response?n.responseData=e.response:e?.data&&(n.responseData=e.data),n}(e,r);throw await Yw(t),e instanceof Error?e:new Error(t.errorMessage)}},eA=Vl;async function tA(e){return new Promise((t=>setTimeout(t,e)))}const nA=Vl;const rA=e=>async(...t)=>{const{payload:n}=t[0],{method:r}=n;let o;for(let n=0;n<4;n++)try{return nA.info(`[🚌 RetryingTransport] Attempt "${r}" ${n+1} of 4`),await e(...t)}catch(e){if(nA.error(`[🚌 RetryingTransport] Error during attempt "${r}" ${n+1} of 4: ${e}`),o=e,n<3){const e=(i=n,Math.min(400*Math.pow(2,i),1500));nA.info(`[🚌 RetryingTransport] Sleeping for ${e}ms`),await tA(e)}}var i;throw o},oA=e=>{return nu(e,(t=Zw,e=>e.map(t)),(t=>((e,t)=>async(...n)=>{let r;const o=e.length;for(const[i,a]of e.entries())try{const e=t[i];return eA.info(`[🚌 FailoverTransport] Attempting to use transport ${i+1} of ${o} (URL: ${e})`),await a(...n)}catch(e){const n=t[i];r=e;const a=i===o-1;eA.error(`[🚌 FailoverTransport] Transport failed (URL: ${n}): ${e}. ${a?"No more transports to try.":"Trying next transport..."}`),e instanceof Error&&(e.currentUrl=n)}throw r})(t,e)),rA,(e=>Xw(e)));var t};const iA=(e,t)=>(e=>Boolean(e.feePayer))(t)?t:$u(e,t),aA=e=>e.programAddress===ph&&mh({data:new Uint8Array,...e})===gh.SetComputeUnitPrice,sA=e=>e.instructions.filter(Boolean).some(aA),cA=e=>e.programAddress===ph&&mh({data:new Uint8Array,...e})===gh.SetComputeUnitLimit,uA=e=>e.instructions.filter(Boolean).some(cA);class lA{#h;#i;static defaultComputeUnitPriceInMicroLamportsPerComputeUnit=10000n;constructor(e,t){this.#h=e,this.#i=t}async getLatestBlockhash(e){try{return(await this.#h.getRpc(e).getLatestBlockhash().send()).value}catch(e){throw this.#i.error(e),e}}async getComputeUnitEstimate(e,t){const n=jm({rpc:this.#h.getRpc(t)});return await n(e)}async getFeeFromBase64StringInLamports(e,t){try{M(e,wd);const n=await Km(e,this.#h.getRpc(t)),r="instructions"in n?e:js().decode(n.messageBytes),o=this.#h.getRpc(t),i=await o.getFeeForMessage(r,{commitment:"confirmed"}).send();return this.#i.log(`Transaction is estimated to cost ${i.value} lamports`),i.value}catch(e){return this.#i.error(e),null}}async waitForTransactionCommitment(e,t,n){M(e,vd);const r=this.#h.getRpc(n);return async function(e,t){const n=t?.maxAttempts??10,r=t?.delayMs??1e3;let o=0;for(;o<n;)try{return await e()}catch(e){if(o+=1,o===n)throw e;await new Promise((e=>setTimeout(e,r)))}throw new Error("Unreachable")}((async()=>{this.#i.log(`🔎 Checking if transaction ${e} has reached commitment level ${t}`);const n=await r.getTransaction(mc(e),{commitment:t,maxSupportedTransactionVersion:0}).send();if(n)return this.#i.log(`🎉 Transaction ${e} has reached commitment level ${t}`),n;const o=`⚠️ Transaction with signature ${e} not found or has not yet reached requested commitment level: ${t}`;throw this.#i.warn(o),new Error(o)}),{delayMs:200})}async partiallySignBase64String(e,t,n,r){const o=this.#h.getRpc(n),i=await Km(e,o,r);if("instructions"in i)return this.#C(i,t,n);if(Object.values(i.signatures).every((e=>!e))){const{messageBytes:e}=i,a=await Wm(e,o,r);return this.#C(a,t,n)}return this.#R(i,t)}async#C(e,t,n){const r=ru(e)?e.lifetimeConstraint:await this.getLatestBlockhash(n),o=sA(e),i=lA.defaultComputeUnitPriceInMicroLamportsPerComputeUnit,a=!uA(e)||!o,{privateKeyBytes:s}=await iy({entropySource:t.entropySource,derivationPath:t.derivationPath}),c=await dl(s),u=await nu(e,(e=>iA(c.address,e)),(e=>{return t=r,ru(n=e)?n:ou(t,n);var t,n}),(e=>((e,t,n)=>sA(e)?e:Vu([Th(t,n)],e))(e,{microLamports:i})),(async e=>a?(async(e,t,n)=>{try{const r=e.instructions.filter(Boolean),o=jm({rpc:t}),i=await o(e,n?.getComputeUnitEstimateConfig).catch((e=>{if(wa(e,Vi))return e.context.unitsConsumed;throw e}));return{...(0,_d.cloneDeep)(e),instructions:[...r.filter((e=>!cA(e))),Sh({units:i},n?.getSetComputeUnitLimitInstructionConfig)]}}catch(t){return e}})(e,this.#h.getRpc(n)):e)),l=ul([c],u);return await hl(l)}async#R(e,t){const{privateKeyBytes:n}=await iy({entropySource:t.entropySource,derivationPath:t.derivationPath});return Xu([await vc(n)],e)}}var dA,fA=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],hA=function(){function e(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return e.prototype.resize_if_necessary=function(e){if(this.buffer_size-this.offset<e){this.buffer_size=Math.max(2*this.buffer_size,this.buffer_size+e);var t=new ArrayBuffer(this.buffer_size);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t,this.view=new DataView(t)}},e.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},e.prototype.store_value=function(e,t){var n=t.substring(1),r=parseInt(n)/8;this.resize_if_necessary(r);var o="f"===t[0]?"setFloat".concat(n):"i"===t[0]?"setInt".concat(n):"setUint".concat(n);this.view[o](this.offset,e,!0),this.offset+=r},e.prototype.store_bytes=function(e){this.resize_if_necessary(e.length),new Uint8Array(this.buffer).set(new Uint8Array(e),this.offset),this.offset+=e.length},e}(),pA=function(){function e(e){this.offset=0,this.buffer_size=e.length,this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e),this.view=new DataView(this.buffer)}return e.prototype.assert_enough_buffer=function(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},e.prototype.consume_value=function(e){var t=e.substring(1),n=parseInt(t)/8;this.assert_enough_buffer(n);var r="f"===e[0]?"getFloat".concat(t):"i"===e[0]?"getInt".concat(t):"getUint".concat(t),o=this.view[r](this.offset,!0);return this.offset+=n,o},e.prototype.consume_bytes=function(e){this.assert_enough_buffer(e);var t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t},e}(),gA=(dA=function(e,t){return dA=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},dA(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}dA(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});function mA(e,t,n){if(typeof e!==t)throw new Error("Expected ".concat(t," not ").concat(typeof e,"(").concat(e,") at ").concat(n.join(".")))}function yA(e,t,n){if(e!==t)throw new Error("Array length ".concat(e," does not match schema length ").concat(t," at ").concat(n.join(".")))}var vA=fA.concat(["bool","string"]),wA=["option","enum","array","set","map","struct"],AA=function(e){function t(t,n){var r="Invalid schema: ".concat(JSON.stringify(t)," expected ").concat(n);return e.call(this,r)||this}return gA(t,e),t}(Error);function bA(e){if("string"!=typeof e||!vA.includes(e)){if(e&&"object"==typeof e){var t=Object.keys(e);if(1===t.length&&wA.includes(t[0])){var n=t[0];if("option"===n)return bA(e[n]);if("enum"===n)return function(e){if(!Array.isArray(e))throw new AA(e,"Array");for(var t=0,n=e;t<n.length;t++){var r=n[t];if("object"!=typeof r||!("struct"in r))throw new Error('Missing "struct" key in enum schema');if("object"!=typeof r.struct||1!==Object.keys(r.struct).length)throw new Error('The "struct" in each enum must have a single key');bA({struct:r.struct})}}(e[n]);if("array"===n)return function(e){if("object"!=typeof e)throw new AA(e,"{ type, len? }");if(e.len&&"number"!=typeof e.len)throw new Error("Invalid schema: ".concat(e));if("type"in e)return bA(e.type);throw new AA(e,"{ type, len? }")}(e[n]);if("set"===n)return bA(e[n]);if("map"===n)return function(e){if("object"!=typeof e||!("key"in e)||!("value"in e))throw new AA(e,"{ key, value }");bA(e.key),bA(e.value)}(e[n]);if("struct"===n)return function(e){if("object"!=typeof e)throw new AA(e,"object");for(var t in e)bA(e[t])}(e[n])}}throw new AA(e,wA.join(", ")+" or "+vA.join(", "))}}!function(){function e(e){this.encoded=new hA,this.fieldPath=["value"],this.checkTypes=e}e.prototype.encode=function(e,t){return this.encode_value(e,t),this.encoded.get_used_buffer()},e.prototype.encode_value=function(e,t){if("string"==typeof t){if(fA.includes(t))return this.encode_integer(e,t);if("string"===t)return this.encode_string(e);if("bool"===t)return this.encode_boolean(e)}if("object"==typeof t){if("option"in t)return this.encode_option(e,t);if("enum"in t)return this.encode_enum(e,t);if("array"in t)return this.encode_array(e,t);if("set"in t)return this.encode_set(e,t);if("map"in t)return this.encode_map(e,t);if("struct"in t)return this.encode_struct(e,t)}},e.prototype.encode_integer=function(e,t){var n=parseInt(t.substring(1));n<=32||"f64"==t?(this.checkTypes&&mA(e,"number",this.fieldPath),this.encoded.store_value(e,t)):(this.checkTypes&&function(e,t){if(!(["number","string","bigint","boolean"].includes(typeof e)||"object"==typeof e&&null!==e&&"toString"in e))throw new Error("Expected bigint, number, boolean or string not ".concat(typeof e,"(").concat(e,") at ").concat(t.join(".")))}(e,this.fieldPath),this.encode_bigint(BigInt(e),n))},e.prototype.encode_bigint=function(e,t){for(var n=t/8,r=new Uint8Array(n),o=0;o<n;o++)r[o]=Number(e&BigInt(255)),e>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(r))},e.prototype.encode_string=function(e){this.checkTypes&&mA(e,"string",this.fieldPath);for(var t=e,n=[],r=0;r<t.length;r++){var o=t.charCodeAt(r);o<128?n.push(o):o<2048?n.push(192|o>>6,128|63&o):o<55296||o>=57344?n.push(224|o>>12,128|o>>6&63,128|63&o):(r++,o=65536+((1023&o)<<10|1023&t.charCodeAt(r)),n.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o))}this.encoded.store_value(n.length,"u32"),this.encoded.store_bytes(new Uint8Array(n))},e.prototype.encode_boolean=function(e){this.checkTypes&&mA(e,"boolean",this.fieldPath),this.encoded.store_value(e?1:0,"u8")},e.prototype.encode_option=function(e,t){null==e?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(e,t.option))},e.prototype.encode_enum=function(e,t){this.checkTypes&&function(e,t){if("object"!=typeof e||null===e)throw new Error("Expected object not ".concat(typeof e,"(").concat(e,") at ").concat(t.join(".")))}(e,this.fieldPath);for(var n=Object.keys(e)[0],r=0;r<t.enum.length;r++){var o=t.enum[r];if(n===Object.keys(o.struct)[0])return this.encoded.store_value(r,"u8"),this.encode_struct(e,o)}throw new Error("Enum key (".concat(n,") not found in enum schema: ").concat(JSON.stringify(t)," at ").concat(this.fieldPath.join(".")))},e.prototype.encode_array=function(e,t){if(function(e){return Array.isArray(e)||!!e&&"object"==typeof e&&"length"in e&&"number"==typeof e.length&&(0===e.length||e.length>0&&e.length-1 in e)}(e))return this.encode_arraylike(e,t);if(e instanceof ArrayBuffer)return this.encode_buffer(e,t);throw new Error("Expected Array-like not ".concat(typeof e,"(").concat(e,") at ").concat(this.fieldPath.join(".")))},e.prototype.encode_arraylike=function(e,t){t.array.len?yA(e.length,t.array.len,this.fieldPath):this.encoded.store_value(e.length,"u32");for(var n=0;n<e.length;n++)this.encode_value(e[n],t.array.type)},e.prototype.encode_buffer=function(e,t){t.array.len?yA(e.byteLength,t.array.len,this.fieldPath):this.encoded.store_value(e.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(e))},e.prototype.encode_set=function(e,t){this.checkTypes&&mA(e,"object",this.fieldPath);var n=e instanceof Set?Array.from(e.values()):Object.values(e);this.encoded.store_value(n.length,"u32");for(var r=0,o=n;r<o.length;r++){var i=o[r];this.encode_value(i,t.set)}},e.prototype.encode_map=function(e,t){this.checkTypes&&mA(e,"object",this.fieldPath);var n=e instanceof Map,r=n?Array.from(e.keys()):Object.keys(e);this.encoded.store_value(r.length,"u32");for(var o=0,i=r;o<i.length;o++){var a=i[o];this.encode_value(a,t.map.key),this.encode_value(n?e.get(a):e[a],t.map.value)}},e.prototype.encode_struct=function(e,t){this.checkTypes&&mA(e,"object",this.fieldPath);for(var n=0,r=Object.keys(t.struct);n<r.length;n++){var o=r[n];this.fieldPath.push(o),this.encode_value(e[o],t.struct[o]),this.fieldPath.pop()}}}();var SA=function(){function e(e){this.buffer=new pA(e)}return e.prototype.decode=function(e){return this.decode_value(e)},e.prototype.decode_value=function(e){if("string"==typeof e){if(fA.includes(e))return this.decode_integer(e);if("string"===e)return this.decode_string();if("bool"===e)return this.decode_boolean()}if("object"==typeof e){if("option"in e)return this.decode_option(e);if("enum"in e)return this.decode_enum(e);if("array"in e)return this.decode_array(e);if("set"in e)return this.decode_set(e);if("map"in e)return this.decode_map(e);if("struct"in e)return this.decode_struct(e)}throw new Error("Unsupported type: ".concat(e))},e.prototype.decode_integer=function(e){var t=parseInt(e.substring(1));return t<=32||"f64"==e?this.buffer.consume_value(e):this.decode_bigint(t,e.startsWith("i"))},e.prototype.decode_bigint=function(e,t){void 0===t&&(t=!1);var n=e/8,r=new Uint8Array(this.buffer.consume_bytes(n)),o=r.reduceRight((function(e,t){return e+t.toString(16).padStart(2,"0")}),"");return t&&r[n-1]?BigInt.asIntN(e,BigInt("0x".concat(o))):BigInt("0x".concat(o))},e.prototype.decode_string=function(){for(var e=this.decode_integer("u32"),t=new Uint8Array(this.buffer.consume_bytes(e)),n=[],r=0;r<e;++r){var o=t[r];if(o<128)n.push(o);else if(o<224)n.push((31&o)<<6|63&t[++r]);else if(o<240)n.push((15&o)<<12|(63&t[++r])<<6|63&t[++r]);else{var i=(7&o)<<18|(63&t[++r])<<12|(63&t[++r])<<6|63&t[++r];n.push(i)}}return String.fromCodePoint.apply(String,n)},e.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},e.prototype.decode_option=function(e){var t=this.buffer.consume_value("u8");if(1===t)return this.decode_value(e.option);if(0!==t)throw new Error("Invalid option ".concat(t));return null},e.prototype.decode_enum=function(e){var t,n=this.buffer.consume_value("u8");if(n>e.enum.length)throw new Error("Enum option ".concat(n," is not available"));var r=e.enum[n].struct,o=Object.keys(r)[0];return(t={})[o]=this.decode_value(r[o]),t},e.prototype.decode_array=function(e){for(var t=[],n=e.array.len?e.array.len:this.decode_integer("u32"),r=0;r<n;++r)t.push(this.decode_value(e.array.type));return t},e.prototype.decode_set=function(e){for(var t=this.decode_integer("u32"),n=new Set,r=0;r<t;++r)n.add(this.decode_value(e.set));return n},e.prototype.decode_map=function(e){for(var t=this.decode_integer("u32"),n=new Map,r=0;r<t;++r){var o=this.decode_value(e.map.key),i=this.decode_value(e.map.value);n.set(o,i)}return n},e.prototype.decode_struct=function(e){var t={};for(var n in e.struct)t[n]=this.decode_value(e.struct[n]);return t},e}();function EA(e,t,n){return void 0===n&&(n=!0),n&&bA(e),new SA(t).decode(e)}var kA=(e=>(e[e.Uninitialized=0]="Uninitialized",e[e.Initialized=1]="Initialized",e[e.Frozen=2]="Frozen",e))(kA||{});const IA=Ys(),TA=(Ps(),js()),_A=$s(),xA=za(Zc([["mint",Zs()],["owner",Zs()],["amount",ls()],["delegate",Bh(Zs(),{prefix:cs(),noneValue:"zeroes"})],["state",Wc(kA)],["isNative",Bh(ls(),{prefix:cs(),noneValue:"zeroes"})],["delegatedAmount",ls()],["closeAuthority",Bh(Zs(),{prefix:cs(),noneValue:"zeroes"})]]),Jc([["mint",Js()],["owner",Js()],["amount",ds()],["delegate",Oh(Js(),{prefix:us(),noneValue:"zeroes"})],["state",Vc(kA)],["isNative",Oh(ds(),{prefix:us(),noneValue:"zeroes"})],["delegatedAmount",ds()],["closeAuthority",Oh(Js(),{prefix:us(),noneValue:"zeroes"})]]));var CA;!function(e){e.SymbolNotFound="SymbolNotFound",e.InvalidSubdomain="InvalidSubdomain",e.PrimaryDomainNotFound="PrimaryDomainNotFound",e.MissingParentOwner="MissingParentOwner",e.U32Overflow="U32Overflow",e.InvalidBufferLength="InvalidBufferLength",e.U64Overflow="U64Overflow",e.NoRecordData="NoRecordData",e.InvalidRecordData="InvalidRecordData",e.UnsupportedRecord="UnsupportedRecord",e.InvalidEvmAddress="InvalidEvmAddress",e.InvalidInjectiveAddress="InvalidInjectiveAddress",e.InvalidARecord="InvalidARecord",e.InvalidAAAARecord="InvalidAAAARecord",e.InvalidRecordInput="InvalidRecordInput",e.InvalidSignature="InvalidSignature",e.AccountDoesNotExist="AccountDoesNotExist",e.MultipleRegistries="MultipleRegistries",e.InvalidReverseTwitter="InvalidReverseTwitter",e.NoAccountData="NoAccountData",e.InvalidInput="InvalidInput",e.InvalidDomain="InvalidDomain",e.InvalidCustomBg="InvalidCustomBackground",e.UnsupportedSignature="UnsupportedSignature",e.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",e.RecordIsNotSigned="RecordIsNotSigned",e.UnsupportedSignatureType="UnsupportedSignatureType",e.InvalidSolRecordV2="InvalidSolRecordV2",e.MissingVerifier="MissingVerifier",e.PythFeedNotFound="PythFeedNotFound",e.InvalidRoA="InvalidRoA",e.InvalidPda="InvalidPda",e.InvalidParent="InvalidParent",e.NftAccountNotFound="NftRecordNotFound",e.PdaOwnerNotAllowed="PdaOwnerNotAllowed",e.DomainDoesNotExist="DomainDoesNotExist",e.RecordMalformed="RecordMalformed",e.CouldNotFindNftOwner="CouldNotFindNftOwner",e.InvalidValidation="InvalidValidation",e.InvalidSerializedData="InvalidSerializedData"}(CA||(CA={}));class RA extends Error{type;constructor(e,t){super(t),this.name="SNSError",this.type=e,Error.captureStackTrace&&Error.captureStackTrace(this,RA)}}class PA extends RA{constructor(e){super(CA.PrimaryDomainNotFound,e)}}class NA extends RA{constructor(e){super(CA.NoRecordData,e)}}class BA extends RA{constructor(e){super(CA.AccountDoesNotExist,e)}}class OA extends RA{constructor(e){super(CA.NoAccountData,e)}}class MA extends RA{constructor(e){super(CA.InvalidInput,e)}}class zA extends RA{constructor(e){super(CA.InvalidRoA,e)}}class jA extends RA{constructor(e){super(CA.NftAccountNotFound,e)}}class UA extends RA{constructor(e){super(CA.PdaOwnerNotAllowed,e)}}class DA extends RA{constructor(e){super(CA.DomainDoesNotExist,e)}}class LA extends RA{constructor(e){super(CA.RecordMalformed,e)}}class FA extends RA{constructor(e){super(CA.CouldNotFindNftOwner,e)}}class $A extends RA{constructor(e){super(CA.InvalidValidation,e)}}class qA extends RA{constructor(e){super(CA.InvalidSerializedData,e)}}class WA{static HEADER_LEN=96;parentName;owner;class;data;static schema={struct:{parentName:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},class:{array:{type:"u8",len:32}}}};constructor(e){this.parentName=IA.decode(e.parentName),this.owner=IA.decode(e.owner),this.class=IA.decode(e.class)}static deserialize(e){try{const t=new WA(EA(this.schema,e));return t.data=e?.slice(this.HEADER_LEN),t}catch{throw new Error("Failed to deserialize RegistryState data")}}static async retrieve(e,t){const n=await Rm(e,t);if(!n.exists)throw new BA("The domain account does not exist");return this.deserialize(n.data)}static async _retrieveBatch(e,t){return(await Pm(e,t)).map((e=>e.exists?this.deserialize(e.data):void 0))}static async retrieveBatch(e,t){const n=[],r=[...t];for(;r.length>0;)n.push(...await this._retrieveBatch(e,r.splice(0,100)));return n}}const VA="58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx",KA="nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk",GA="33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z",HA="2pMnqHvei2N5oDcVGCRdZx48gqti199wr5CsyTTafsbo",ZA=async(e,t,n)=>{const r=await(async e=>{const t=_A.encode("SPL Name Service"+e),n=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(n)})(e);return await(async(e,t,n)=>{const r=[e];r.push(n?IA.encode(n):new Uint8Array(32)),r.push(t?IA.encode(t):new Uint8Array(32));const[o]=await lc({programAddress:"namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX",seeds:r});return o})(r,t,n)};var JA;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.CentralState=1]="CentralState",e[e.ActiveRecord=2]="ActiveRecord",e[e.InactiveRecord=3]="InactiveRecord"}(JA||(JA={}));class YA{tag;nonce;nameAccount;owner;nftMint;static LEN=98;static schema={struct:{tag:"u8",nonce:"u8",nameAccount:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},nftMint:{array:{type:"u8",len:32}}}};constructor(e){this.tag=e.tag,this.nonce=e.nonce,this.nameAccount=IA.decode(e.nameAccount),this.owner=IA.decode(e.owner),this.nftMint=IA.decode(e.nftMint)}static deserialize(e){try{return new YA(EA(this.schema,e))}catch{throw new qA("Failed to deserialize NftState data")}}static async retrieve(e,t){const n=await Rm(e,t);if(!n.exists)throw new jA(`NFT not found: ${t}`);return this.deserialize(n.data)}static async retrieveFromMint(e,t){const n=await e.getProgramAccounts(KA,{encoding:"base64",filters:[{dataSize:BigInt(YA.LEN)},{memcmp:{offset:BigInt(0),bytes:"3",encoding:"base58"}},{memcmp:{offset:BigInt(66),bytes:t,encoding:"base58"}}]}).send();if(1!==n.length)throw new jA(`NFT not found: ${t}`);return this.deserialize(TA.encode(n[0].account.data[0]))}static async getAddress(e){const[t]=await lc({programAddress:KA,seeds:[_A.encode("nft_record"),IA.encode(e)]});return t}}const QA=_A.encode("tokenized_name"),XA=async(e,t)=>{try{const n=await(async e=>{const[t]=await lc({programAddress:KA,seeds:[QA,IA.encode(e)]});return t})(t),r=await e.getTokenLargestAccounts(n).send();if(0===r.value.length)return null;const o=await Rm(e,r.value[0].address);if(!o.exists)return null;const i=xA.decode(o.data);return"1"===i.amount.toString()?i.owner:null}catch(e){if(wa(e,Yo))return null;throw e}};class eb{tag;nameAccount;static schema={struct:{tag:"u8",nameAccount:{array:{type:"u8",len:32}}}};constructor(e){this.tag=e.tag,this.nameAccount=IA.decode(e.nameAccount)}static deserialize(e){try{return new eb(EA(this.schema,e))}catch{throw new qA("Failed to deserialize PrimaryDomainState data")}}static async retrieve(e,t){const n=await Rm(e,t);if(!n.exists)throw new PA("The favourite account does not exist");return this.deserialize(n.data)}static async _retrieveBatch(e,t){return(await Pm(e,t)).map((e=>e.exists?this.deserialize(e.data):void 0))}static async retrieveBatch(e,t){const n=[],r=[...t];for(;r.length>0;)n.push(...await this._retrieveBatch(e,r.splice(0,100)));return n}static async getAddress(e,t){const[n]=await lc({programAddress:e,seeds:[_A.encode("favourite_domain"),IA.encode(t)]});return n}}async function tb(e,t,n){const r=await(async(e,t)=>await ZA(e,t,GA))(t,n),o=await WA.retrieve(e,r);if(!o.data)throw new OA("The registry data is empty");return function(e,t=!1){if(!e)return;const n=new DataView(e.buffer).getUint32(0,!0);return _A.decode(e.subarray(4,4+n)).replace(/^\0/,t?"":"\0")}(o.data,!!n)}var nb;!function(e){e.IPFS="IPFS",e.ARWV="ARWV",e.SOL="SOL",e.ETH="ETH",e.BTC="BTC",e.LTC="LTC",e.DOGE="DOGE",e.Email="email",e.Url="url",e.Discord="discord",e.Github="github",e.Reddit="reddit",e.Twitter="twitter",e.Telegram="telegram",e.Pic="pic",e.SHDW="SHDW",e.POINT="POINT",e.BSC="BSC",e.Injective="INJ",e.Backpack="backpack",e.A="A",e.AAAA="AAAA",e.CNAME="CNAME",e.TXT="TXT",e.Background="background",e.BASE="BASE",e.IPNS="IPNS"}(nb||(nb={}));new Map([[nb.SOL,96],[nb.ETH,20],[nb.BSC,20],[nb.Injective,20],[nb.A,4],[nb.AAAA,16],[nb.Background,32]]);var rb;!function(e){e[e.V1=1]="V1",e[e.V2=2]="V2"}(rb||(rb={}));const ob=async(e,t)=>{e.endsWith(".sol")&&(e=e.slice(0,-4));const n=t===rb.V2?HA:void 0,r={[rb.V2]:"",[rb.V1]:""}[t]||"\0",o=e.split(".");if(2===o.length){const e=await ZA(o[1],VA);return{address:await ZA(r+o[0],e,n),parentAddress:e,isSub:!0}}if(3===o.length&&t){const e=await ZA(o[2],VA),t=await ZA("\0"+o[1],e);return{address:await ZA(r+o[0],t,n),parentAddress:e,isSub:!0,isSubRecord:!0}}if(o.length>=3)throw new MA("The domain is malformed");return{address:await ZA(e,VA),isSub:!1}};function ib(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function ab(e,t){return!!Array.isArray(t)&&(0===t.length||(e?t.every((e=>"string"==typeof e)):t.every((e=>Number.isSafeInteger(e)))))}function sb(e,t){if("string"!=typeof t)throw new Error(`${e}: string expected`);return!0}function cb(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function ub(e){if(!Array.isArray(e))throw new Error("array expected")}function lb(e,t){if(!ab(!0,t))throw new Error(`${e}: array of strings expected`)}function db(e,t){if(!ab(!1,t))throw new Error(`${e}: array of numbers expected`)}const fb=(e,t)=>0===t?e:fb(t,e%t),hb=(e,t)=>e+(t-fb(e,t)),pb=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function gb(e,t,n,r){if(ub(e),t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(hb(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${hb(t,n)}`);let o=0,i=0;const a=pb[t],s=pb[n]-1,c=[];for(const r of e){if(cb(r),r>=a)throw new Error(`convertRadix2: invalid data word=${r} from=${t}`);if(o=o<<t|r,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=n;i-=n)c.push((o>>i-n&s)>>>0);const e=pb[i];if(void 0===e)throw new Error("invalid carry");o&=e-1}if(o=o<<n-i&s,!r&&i>=t)throw new Error("Excess padding");if(!r&&o>0)throw new Error(`Non-zero padding: ${o}`);return r&&i>0&&c.push(o>>>0),c}function mb(e){return function(e){if("function"!=typeof e)throw new Error("function expected")}(e),function(...t){try{return e.apply(null,t)}catch(e){}}}const yb=function(...e){const t=e=>e,n=(e,t)=>n=>e(t(n));return{encode:e.map((e=>e.encode)).reduceRight(n,t),decode:e.map((e=>e.decode)).reduce(n,t)}}(function(e){const t=e.split(""),n=t.length;lb("alphabet",t);const r=new Map(t.map(((e,t)=>[e,t])));return{encode:r=>(ub(r),r.map((r=>{if(!Number.isSafeInteger(r)||r<0||r>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${r}". Allowed: ${e}`);return t[r]}))),decode:t=>(ub(t),t.map((t=>{sb("alphabet.decode",t);const n=r.get(t);if(void 0===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n})))}}("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),function(e=""){return sb("join",e),{encode:t=>(lb("join.decode",t),t.join(e)),decode:t=>(sb("join.decode",t),t.split(e))}}("")),vb=[996825010,642813549,513874426,1027748829,705979059];function wb(e){const t=e>>25;let n=(33554431&e)<<5;for(let e=0;e<vb.length;e++)1==(t>>e&1)&&(n^=vb[e]);return n}function Ab(e,t,n=1){const r=e.length;let o=1;for(let t=0;t<r;t++){const n=e.charCodeAt(t);if(n<33||n>126)throw new Error(`Invalid prefix (${e})`);o=wb(o)^n>>5}o=wb(o);for(let t=0;t<r;t++)o=wb(o)^31&e.charCodeAt(t);for(let e of t)o=wb(o)^e;for(let e=0;e<6;e++)o=wb(o);return o^=n,yb.encode(gb([o%pb[30]],30,5,!1))}!function(e){const t=function(e,t=!1){if(cb(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(hb(8,e)>32||hb(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!ib(n))throw new Error("radix2.encode input should be Uint8Array");return gb(Array.from(n),8,e,!t)},decode:n=>(db("radix2.decode",n),Uint8Array.from(gb(n,e,8,t)))}}(5),n=t.decode,r=t.encode,o=mb(n);function i(e,t,n=90){sb("bech32.encode prefix",e),ib(t)&&Array.from(t),db("bech32.encode",t);const r=e.length;if(0===r)throw new TypeError(`Invalid prefix length ${r}`);const o=r+7+t.length;if(!1!==n&&o>n)throw new TypeError(`Length ${o} exceeds limit ${n}`);const i=e.toLowerCase(),a=Ab(i,t,1);return`${i}1${yb.encode(t)}${a}`}function a(e,t=90){sb("bech32.decode input",e);const n=e.length;if(n<8||!1!==t&&n>t)throw new TypeError(`invalid string length: ${n} (${e}). Expected (8..${t})`);const r=e.toLowerCase();if(e!==r&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const o=r.lastIndexOf("1");if(0===o||-1===o)throw new Error('Letter "1" must be present between prefix and data only');const i=r.slice(0,o),a=r.slice(o+1);if(a.length<6)throw new Error("Data must be at least 6 characters long");const s=yb.decode(a).slice(0,-6),c=Ab(i,s,1);if(!a.endsWith(c))throw new Error(`Invalid checksum in ${e}: expected "${c}"`);return{prefix:i,words:s}}mb(a)}();var bb,Sb={exports:{}},Eb=Sb.exports;!function(){return bb||(bb=1,e=Sb,function(t){const n="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,"i"),threeOctet:new RegExp(`^${n}\\.${n}\\.${n}$`,"i"),twoOctet:new RegExp(`^${n}\\.${n}$`,"i"),longValue:new RegExp(`^${n}$`,"i")},o=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${n}\\.${n}\\.${n}\\.${n}(${a})?$`,"i")};function u(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let n,r,o=0,i=-1,a=(e.match(c.zoneIndex)||[])[0];for(a&&(a=a.substring(1),e=e.replace(/%.+$/,""));(i=e.indexOf(":",i+1))>=0;)o++;if("::"===e.substr(0,2)&&o--,"::"===e.substr(-2,2)&&o--,o>t)return null;for(r=t-o,n=":";r--;)n+="0:";return":"===(e=e.replace("::",n))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),{parts:t=function(){const t=e.split(":"),n=[];for(let e=0;e<t.length;e++)n.push(parseInt(t[e],16));return n}(),zoneId:a}}function l(e,t,n,r){if(e.length!==t.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let o,i=0;for(;r>0;){if(o=n-r,o<0&&(o=0),e[i]>>o!=t[i]>>o)return!1;r-=n,i+=1}return!0}function d(e){if(i.test(e))return parseInt(e,16);if("0"===e[0]&&!isNaN(parseInt(e[1],10))){if(o.test(e))return parseInt(e,8);throw new Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function f(e,t){for(;e.length<t;)e=`0${e}`;return e}const h={};h.IPv4=function(){function e(e){if(4!==e.length)throw new Error("ipaddr: ipv4 octet count should be 4");let t,n;for(t=0;t<e.length;t++)if(n=e[t],!(0<=n&&n<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return"ipv4"},e.prototype.match=function(e,t){let n;if(void 0===t&&(n=e,e=n[0],t=n[1]),"ipv4"!==e.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return l(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const n={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let r,o,i;for(r=3;r>=0;r-=1){if(o=this.octets[r],!(o in n))return null;if(i=n[o],t&&0!==i)return null;8!==i&&(t=!0),e+=i}return 32-e},e.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return h.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),h.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[];let i=0;for(;i<4;)o.push(parseInt(n[i],10)|255^parseInt(r[i],10)),i++;return new this(o)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.isIPv4=function(e){return null!==this.parser(e)},h.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(e){return!1}},h.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch(e){return!1}},h.IPv4.isValidFourPartDecimal=function(e){return!(!h.IPv4.isValid(e)||!e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},h.IPv4.networkAddressFromCIDR=function(e){let t,n,r,o,i;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[],n=0;n<4;)o.push(parseInt(r[n],10)&parseInt(i[n],10)),n++;return new this(o)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.parse=function(e){const t=this.parser(e);if(null===t)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},h.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const e=parseInt(t[2]);if(e>=0&&e<=32){const n=[this.parse(t[1]),e];return Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},h.IPv4.parser=function(e){let t,n,o;if(t=e.match(r.fourOctet))return function(){const e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(d(n));return r}();if(t=e.match(r.longValue)){if(o=d(t[1]),o>4294967295||o<0)throw new Error("ipaddr: address outside defined range");return function(){const e=[];let t;for(t=0;t<=24;t+=8)e.push(o>>t&255);return e}().reverse()}return(t=e.match(r.twoOctet))?function(){const e=t.slice(1,4),n=[];if(o=d(e[1]),o>16777215||o<0)throw new Error("ipaddr: address outside defined range");return n.push(d(e[0])),n.push(o>>16&255),n.push(o>>8&255),n.push(255&o),n}():(t=e.match(r.threeOctet))?function(){const e=t.slice(1,5),n=[];if(o=d(e[2]),o>65535||o<0)throw new Error("ipaddr: address outside defined range");return n.push(d(e[0])),n.push(d(e[1])),n.push(o>>8&255),n.push(255&o),n}():null},h.IPv4.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let n=0;const r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<4&&(t[r]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},h.IPv6=function(){function e(e,t){let n,r;if(16===e.length)for(this.parts=[],n=0;n<=14;n+=2)this.parts.push(e[n]<<8|e[n+1]);else{if(8!==e.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=e}for(n=0;n<this.parts.length;n++)if(r=this.parts[n],!(0<=r&&r<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[new e([100,65435,0,0,0,0,0,0]),96],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32]]},e.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},e.prototype.kind=function(){return"ipv6"},e.prototype.match=function(e,t){let n;if(void 0===t&&(n=e,e=n[0],t=n[1]),"ipv6"!==e.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return l(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const n={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let r,o;for(let i=7;i>=0;i-=1){if(r=this.parts[i],!(r in n))return null;if(o=n[r],t&&0!==o)return null;16!==o&&(t=!0),e+=o}return 128-e},e.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e;const t=[],n=this.parts;for(let r=0;r<n.length;r++)e=n[r],t.push(e>>8),t.push(255&e);return t},e.prototype.toFixedLengthString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(f(this.parts[t].toString(16),4));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const e=this.parts.slice(-2),t=e[0],n=e[1];return new h.IPv4([t>>8,255&t,n>>8,255&n])},e.prototype.toNormalizedString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){const e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString();let n,r=0,o=-1;for(;n=e.exec(t);)n[0].length>o&&(r=n.index,o=n[0].length);return o<0?t:`${t.substring(0,r)}::${t.substring(r+o)}`},e.prototype.toString=function(){return this.toRFC5952String()},e}(),h.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[];let i=0;for(;i<16;)o.push(parseInt(n[i],10)|255^parseInt(r[i],10)),i++;return new this(o)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},h.IPv6.isIPv6=function(e){return null!==this.parser(e)},h.IPv6.isValid=function(e){if("string"==typeof e&&-1===e.indexOf(":"))return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch(e){return!1}},h.IPv6.isValidCIDR=function(e){if("string"==typeof e&&-1===e.indexOf(":"))return!1;try{return this.parseCIDR(e),!0}catch(e){return!1}},h.IPv6.networkAddressFromCIDR=function(e){let t,n,r,o,i;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[],n=0;n<16;)o.push(parseInt(r[n],10)&parseInt(i[n],10)),n++;return new this(o)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},h.IPv6.parse=function(e){const t=this.parser(e);if(null===t.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},h.IPv6.parseCIDR=function(e){let t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},h.IPv6.parser=function(e){let t,n,r,o,i,a;if(r=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${r[1]}`);if(c.native.test(e))return u(e,8);if((r=e.match(c.transitional))&&(a=r[6]||"",t=r[1],r[1].endsWith("::")||(t=t.slice(0,-1)),t=u(t+a,6),t.parts)){for(i=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],n=0;n<i.length;n++)if(o=i[n],!(0<=o&&o<=255))return null;return t.parts.push(i[0]<<8|i[1]),t.parts.push(i[2]<<8|i[3]),{parts:t.parts,zoneId:t.zoneId}}return null},h.IPv6.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let n=0;const r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<16&&(t[r]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},h.fromByteArray=function(e){const t=e.length;if(4===t)return new h.IPv4(e);if(16===t)return new h.IPv6(e);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},h.isValid=function(e){return h.IPv6.isValid(e)||h.IPv4.isValid(e)},h.isValidCIDR=function(e){return h.IPv6.isValidCIDR(e)||h.IPv4.isValidCIDR(e)},h.parse=function(e){if(h.IPv6.isValid(e))return h.IPv6.parse(e);if(h.IPv4.isValid(e))return h.IPv4.parse(e);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},h.parseCIDR=function(e){try{return h.IPv6.parseCIDR(e)}catch(t){try{return h.IPv4.parseCIDR(e)}catch(e){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},h.process=function(e){const t=this.parse(e);return"ipv6"===t.kind()&&t.isIPv4MappedAddress()?t.toIPv4Address():t},h.subnetMatch=function(e,t,n){let r,o,i,a;for(o in null==n&&(n="unicast"),t)if(Object.prototype.hasOwnProperty.call(t,o))for(i=t[o],!i[0]||i[0]instanceof Array||(i=[i]),r=0;r<i.length;r++)if(a=i[r],e.kind()===a[0].kind()&&e.match.apply(e,a))return o;return n},e.exports?e.exports=h:t.ipaddr=h}(Eb)),Sb.exports;var e}();Math.floor,String.fromCharCode;new Map([[nb.CNAME,"ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3"],[nb.Url,"ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3"]]),new Set([nb.BASE,nb.BSC,nb.ETH,nb.Injective]),new Set([nb.BASE,nb.BSC,nb.ETH]),new Set([nb.ARWV,nb.Backpack,nb.BTC,nb.CNAME,nb.Discord,nb.DOGE,nb.Email,nb.Github,nb.IPFS,nb.IPNS,nb.LTC,nb.Pic,nb.POINT,nb.Reddit,nb.SHDW,nb.Telegram,nb.Twitter,nb.TXT,nb.Url]),new Set([nb.BASE,nb.BSC,nb.ETH,nb.Injective,nb.SOL]);new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",[234,160,32,198,28,196,121,113,40,19,70,28,225,83,137,74,150,166,192,11,33,237,12,252,39,152,209,249,169,233,201,74]],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",[43,137,185,220,143,223,159,52,112,154,91,16,107,71,47,15,57,187,108,169,206,4,176,253,127,46,151,22,136,226,229,59]],["So11111111111111111111111111111111111111112",[239,13,139,111,218,44,235,164,29,161,93,64,149,209,218,57,42,13,47,142,208,198,199,188,15,76,250,200,194,128,181,109]],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",[200,6,87,183,246,243,234,194,114,24,208,157,90,78,84,228,123,37,118,141,159,94,16,172,21,254,44,249,0,136,20,0]],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",[194,40,154,106,67,210,206,145,198,245,92,174,195,112,244,172,195,138,46,212,119,245,136,19,51,76,109,3,116,159,242,164]],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",[114,176,33,33,124,163,254,104,146,42,25,170,249,144,16,156,185,216,78,154,208,4,180,210,2,90,214,245,41,49,68,25]],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz",[142,134,15,183,78,96,229,115,107,69,93,130,246,11,55,40,4,156,52,142,148,150,26,221,95,150,27,2,253,238,37,53]],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3",[11,191,40,233,168,65,161,204,120,143,106,54,27,23,202,7,45,14,163,9,138,30,93,241,195,146,45,6,113,149,121,255]],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1",[137,135,83,121,231,15,143,186,220,23,174,243,21,173,243,168,213,209,96,184,17,67,85,55,224,60,151,232,170,201,125,156]],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB",[122,91,193,210,181,106,208,41,4,140,214,57,100,179,173,39,118,234,223,129,46,220,26,67,163,20,6,203,84,191,245,146]],["6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN",[135,149,81,2,24,83,238,199,167,220,130,117,120,232,230,157,167,228,250,129,72,51,154,160,211,213,41,100,5,190,75,26]]]);var kb;!function(e){e[e.None=0]="None",e[e.Solana=1]="Solana",e[e.Ethereum=2]="Ethereum",e[e.UnverifiedSolana=3]="UnverifiedSolana"}(kb||(kb={}));const Ib=e=>{switch(e){case kb.None:return 0;case kb.Ethereum:return 20;case kb.Solana:case kb.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class Tb{stalenessValidation;rightOfAssociationValidation;contentLength;static LEN=8;static schema={struct:{stalenessValidation:"u16",rightOfAssociationValidation:"u16",contentLength:"u32"}};constructor(e){this.stalenessValidation=e.stalenessValidation,this.rightOfAssociationValidation=e.rightOfAssociationValidation,this.contentLength=e.contentLength}static deserialize(e){return new Tb(EA(this.schema,e,!0))}static async retrieve(e,t){const n=await Rm(e,t);if(!n.exists)throw new Error("Record header account not found");return this.deserialize(n.data.slice(96,96+this.LEN))}}class _b{header;data;constructor(e,t){this.data=t,this.header=e}static deserialize(e){const t=Tb.deserialize(e.slice(96,96+Tb.LEN));return new _b(t,e.slice(96+Tb.LEN))}static async retrieve(e,t){const n=await Rm(e,t);if(!n.exists)throw new NA("Record account not found");return this.deserialize(n.data)}static async retrieveBatch(e,t){return(await Pm(e,t)).map((e=>e.exists?this.deserialize(e.data):void 0))}getContent(){const e=Ib(this.header.stalenessValidation)+Ib(this.header.rightOfAssociationValidation);return this.data.slice(e)}getStalenessId(){const e=Ib(this.header.stalenessValidation);return this.data.slice(0,e)}getRoAId(){const e=Ib(this.header.stalenessValidation),t=e+Ib(this.header.rightOfAssociationValidation);return this.data.slice(e,t)}}const xb=57896044618658097711785492504343953926634992332820282019728792003956564819949n,Cb=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function Rb(e){const t=e%xb;return t>=0n?t:xb+t}function Pb(e,t){let n=e;for(;t-- >0n;)n*=n,n%=xb;return n}function Nb(e,t){const n=Rb(e*e),r=function(e,t){const n=Rb(t*t*t),r=function(e){const t=e*e%xb*e%xb,n=Pb(t,2n)*t%xb,r=Pb(n,1n)*e%xb,o=Pb(r,5n)*r%xb,i=Pb(o,10n)*o%xb,a=Pb(i,20n)*i%xb,s=Pb(a,40n)*a%xb,c=Pb(s,80n)*s%xb,u=Pb(c,80n)*s%xb,l=Pb(u,10n)*o%xb;return Pb(l,2n)*e%xb}(e*Rb(n*n*t));let o=Rb(e*n*r);const i=Rb(t*o*o),a=o,s=Rb(o*Cb),c=i===e,u=i===Rb(-e),l=i===Rb(-e*Cb);return c&&(o=a),(u||l)&&(o=s),1n===(1n&Rb(o))&&(o=Rb(-o)),c||u?o:null}(Rb(n-1n),Rb(37095705934669439343138083508754565189542113879843219016388785533085940283555n*n+1n));return null!==r&&(0n!==r||!(128&t))}const Bb=async(e,t,n={allowPda:!1})=>{const{address:r}=await ob(t),o=await YA.getAddress(r),i=await(async(e,t)=>{const{address:n}=await ob(t+"."+e,rb.V1);return n})(t,nb.SOL),a=await(async(e,t)=>{const{address:n}=await ob(e);return await ZA(`${t}`,n,HA)})(t,nb.SOL),[s,c,u,l]=await Pm(e,[r,o,i,a]);if(!s.exists)throw new DA(`Domain ${t} does not exist`);const d=WA.deserialize(s.data);if(c.exists&&YA.deserialize(c.data).tag===JA.ActiveRecord){const t=await XA(e,r);if(!t)throw new FA;return t}e:if(l.exists){const e=_b.deserialize(l.data),t=e.getStalenessId(),n=e.getRoAId(),r=e.getContent();if(32!==r.length)throw new LA("Record is malformed");if(e.header.rightOfAssociationValidation!==kb.Solana||e.header.stalenessValidation!==kb.Solana)throw new $A;if(d.owner!==IA.decode(t))break e;if(((e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])))(n,r))return IA.decode(r);throw new zA(`The RoA ID shoudl be ${IA.decode(r)} but is ${IA.decode(n)} `)}if(u.exists){const e=new Uint8Array([...u.data.slice(WA.HEADER_LEN,WA.HEADER_LEN+32),...IA.encode(i)]),t=u.data.slice(WA.HEADER_LEN+32,WA.HEADER_LEN+32+64),n=await(async({data:e,signature:t,address:n})=>{const r=await async function(e){const t=Zs().encode(e);return await crypto.subtle.importKey("raw",t,{name:"Ed25519"},!0,["verify"])}(n),o=_A.encode((e=>Array.from(e).map((e=>e.toString(16).padStart(2,"0"))).join(""))(e));return await crypto.subtle.verify({name:"Ed25519"},r,t,o)})({data:e,signature:t,address:d.owner});if(n)return IA.decode(u.data.slice(WA.HEADER_LEN,WA.HEADER_LEN+32))}if(!function(e){const t=IA.encode(e);if(32!==t.byteLength)return!1;return Nb(function(e){const t=e.reduce(((e,t,n)=>`${function(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}(31===n?-129&t:t)}${e}`),"");return BigInt(`0x${t}`)}(t),t[31])}(d.owner)){if("any"===n.allowPda)return d.owner;if(n.allowPda){const t=await Rm(e,d.owner);if(!t.exists)throw new UA("Invalid domain owner account");const r=n.programIds?.some((e=>t.programAddress===e));if(r)return d.owner;throw new UA(`The program ${t.programAddress} is not allowed`)}throw new UA}return d.owner};const Ob=tu(5000n);class Mb{#P;constructor(e){this.#P=e}#N(){const e=this.#P.getComputeUnitLimit(),t=this.#P.getComputeUnitPriceMicroLamportsPerComputeUnit();return nu(e,(e=>_o(e)),(e=>e.multipliedBy(t.toString())),(e=>e.dividedToIntegerBy(Jl.toString())),(e=>e.toString()),BigInt,tu)}getFee(){const e=this.#N();return tu(Ob+e)}}Error;function zb(e){return function(e){return function(e){return"object"==typeof e&&null!==e&&"message"in e}(e)&&"string"==typeof e.message?e.message:null==e?"":String(e)}(e).replace(/\.$/u,"")}function jb(e,t){return n=e,Boolean("string"==typeof n?.prototype?.constructor?.name)?new e({message:t}):e({message:t});var n}class Ub extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}function Db(e,t="Assertion failed.",n=Ub){if(!e){if(t instanceof Error)throw t;throw jb(n,t)}}function Lb(e,t,n="Assertion failed",r=Ub){try{Pn(e,t)}catch(e){throw jb(r,`${n}: ${zb(e)}.`)}}function Fb(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function $b(...e){const t=(e,t)=>n=>e(t(n));return{encode:Array.from(e).reverse().reduce(((e,n)=>e?t(e,n.encode):n.encode),void 0),decode:e.reduce(((e,n)=>e?t(e,n.decode):n.decode),void 0)}}function qb(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map((t=>{if(Fb(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]}))},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map((t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const n=e.indexOf(t);if(-1===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n}))}}}function Wb(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function Vb(e,t="="){if(Fb(e),"string"!=typeof t)throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;n.length*e%8;)n.push(t);return n},decode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let r=n.length;if(r*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--)if(!((r-1)*e%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,r)}}}function Kb(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function Gb(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let r=0;const o=[],i=Array.from(e);for(i.forEach((e=>{if(Fb(e),e<0||e>=t)throw new Error(`Wrong integer: ${e}`)}));;){let e=0,a=!0;for(let o=r;o<i.length;o++){const s=i[o],c=t*e+s;if(!Number.isSafeInteger(c)||t*e/t!==e||c-s!=t*e)throw new Error("convertRadix: carry overflow");e=c%n;const u=Math.floor(c/n);if(i[o]=u,!Number.isSafeInteger(u)||u*n+e!==c)throw new Error("convertRadix: carry overflow");a&&(u?a=!1:r=o)}if(o.push(e),a)break}for(let t=0;t<e.length-1&&0===e[t];t++)o.push(0);return o.reverse()}const Hb=(e,t)=>t?Hb(t,e%t):e,Zb=(e,t)=>e+(t-Hb(e,t));function Jb(e,t,n,r){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(Zb(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${Zb(t,n)}`);let o=0,i=0;const a=2**n-1,s=[];for(const r of e){if(Fb(r),r>=2**t)throw new Error(`convertRadix2: invalid data word=${r} from=${t}`);if(o=o<<t|r,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=n;i-=n)s.push((o>>i-n&a)>>>0);o&=2**i-1}if(o=o<<n-i&a,!r&&i>=t)throw new Error("Excess padding");if(!r&&o)throw new Error(`Non-zero padding: ${o}`);return r&&i>0&&s.push(o>>>0),s}function Yb(e){return Fb(e),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return Gb(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(Gb(t,e,256))}}}function Qb(e,t=!1){if(Fb(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(Zb(8,e)>32||Zb(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!(n instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return Jb(Array.from(n),8,e,!t)},decode:n=>{if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(Jb(n,e,8,t))}}}const Xb=$b(Qb(4),qb("0123456789ABCDEF"),Wb("")),eS=$b(Qb(5),qb("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Vb(5),Wb("")),tS=($b(Qb(5),qb("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Vb(5),Wb("")),$b(Qb(5),qb("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),Wb(""),Kb((e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),$b(Qb(6),qb("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Vb(6),Wb(""))),nS=$b(Qb(6),qb("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Vb(6),Wb("")),rS=($b(Qb(6),qb("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Wb("")),e=>$b(Yb(58),qb(e),Wb(""))),oS=rS("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),iS=[0,2,3,5,6,7,9,10,11],aS={encode(e){let t="";for(let n=0;n<e.length;n+=8){const r=e.subarray(n,n+8);t+=oS.encode(r).padStart(iS[r.length],"1")}return t},decode(e){let t=[];for(let n=0;n<e.length;n+=11){const r=e.slice(n,n+11),o=iS.indexOf(r.length),i=oS.decode(r);for(let e=0;e<i.length-o;e++)if(0!==i[e])throw new Error("base58xmr: wrong padding");t=t.concat(Array.from(i.slice(i.length-o)))}return Uint8Array.from(t)}};$b(qb("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),Wb(""));const sS={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)};$b(Qb(4),qb("0123456789abcdef"),Wb(""),Kb((e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})));n(1048).hp;!function(){const e=[]}();function cS(e){return e instanceof Uint8Array}function uS(e){Db(cS(e),"Value must be a Uint8Array.")}function lS(e,t,n){return new Jd({...e,*refiner(r,o){yield*e.refiner(r,o);const i=Hd(n(r,o),o,e,r);for(const e of i)yield{...e,refinement:t}}})}var dS;!function(e){e.Copyable="copyable",e.Divider="divider",e.Heading="heading",e.Panel="panel",e.Spinner="spinner",e.Text="text",e.Image="image",e.Row="row",e.Address="address",e.Button="button",e.Input="input",e.Form="form"}(dS||(dS={}));const fS=tf({type:nf()}),hS=(rf(fS,tf({value:of("unknown",(()=>!0))})),rf(fS,tf({type:af(dS.Image),value:lS(nf(),"SVG",(e=>!!e.includes("<svg")||"Value is not a valid SVG."))}))),pS=function(e,t,n=[]){return(...r)=>{if(1===r.length&&Sn(r[0])){const n={...r[0],type:e};return Lb(n,t,`Invalid ${e} component`),n}const o=n.reduce(((e,t,n)=>void 0!==r[n]?{...e,[t]:r[n]}:e),{type:e});return Lb(o,t,`Invalid ${e} component`),o}}(dS.Image,hS,["value"]);async function gS(e,t){const n=await async function(e,t){if("function"!=typeof fetch)throw new Error(`Failed to fetch image data from "${e}": Using this function requires the "endowment:network-access" permission.`);return fetch(e,t).then((async t=>{if(!t.ok)throw new Error(`Failed to fetch image data from "${e}": ${t.status} ${t.statusText}`);const n=await t.blob();return Db("image/jpeg"===n.type||"image/png"===n.type,"Expected image data to be a JPEG or PNG image."),n}))}(e,t),r=new Uint8Array(await n.arrayBuffer());return`data:${n.type};base64,${function(e){return uS(e),tS.encode(e)}(r)}`}const mS='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48">\n <path fill="#999999" d="M42.75 24c0 10.59375-8.53125 19.21875-19.125 19.21875-10.6875 0-19.21875-8.625-19.21875-19.21875 0-10.59375 8.53125-19.21875 19.21875-19.21875 10.59375 0 19.125 8.625 19.125 19.21875zM23.625 14.0625c-3.09375 0-5.90625 2.25-5.90625 5.4375 0 0.84375 0.75 1.59375 1.59375 1.59375 0.84375 0 1.59375-0.75 1.59375-1.59375 0-1.125 1.03125-2.25 2.71875-2.25 1.59375 0 2.625 1.125 2.625 2.25 0 0.5625-0.375 1.03125-1.3125 1.59375l0 0c-1.125 0.75-3 1.96875-3 4.5l0 0.46875c0 0.84375 0.75 1.59375 1.6875 1.59375 0.84375 0 1.59375-0.75 1.59375-1.59375l0-0.46875c0-0.65625 0.28125-1.125 1.40625-1.78125 1.03125-0.65625 2.8125-1.875 2.8125-4.3125 0-3.1875-2.8125-5.4375-5.8125-5.4375zM23.53125 31.875c-0.84375 0-1.59375 0.65625-1.59375 1.59375 0 0.84375 0.75 1.59375 1.59375 1.59375l0.09375 0c0.84375 0 1.59375-0.75 1.59375-1.59375 0-0.9375-0.75-1.59375-1.59375-1.59375z"/>\n</svg>';function yS(e){return e.includes("swift:0/iso4217:")}var vS=function(e){return e.Benign="Benign",e.Warning="Warning",e.Malicious="Malicious",e}({}),wS=function(e){return e.SUCCESS="SUCCESS",e.ERROR="ERROR",e}({});class AS{#h;#B;#i;#O=4e4;#M=10000n;constructor(e,t,n){this.#h=e,this.#B=t,this.#i=n}async buildTransactionMessage(e){this.#i.log("Build transfer SPL token transaction message");const{from:t,to:n,mint:r,amount:o,network:i}=e;Wo(r,"Mint is required");const a=await this.getTokenAccount({mint:r,network:i});AS.assertAccountExists(a);const s=a.programAddress,c=function(e,t){const n=new _o(e.toString());if(n.isNegative())throw new Error("Token amount cannot be negative");const r=n.times(10**t).integerValue(_o.ROUND_DOWN);return BigInt(r.toString())}(o,this.getDecimals(a)),u=await this.#B.getLatestBlockhash(i),{privateKeyBytes:l}=await iy({entropySource:t.entropySource,derivationPath:t.derivationPath}),d=await dl(l),[f,h]=await Promise.all([AS.deriveAssociatedTokenAccountAddress({mint:r,owner:d.address,tokenProgram:s}),AS.deriveAssociatedTokenAccountAddress({mint:r,owner:n,tokenProgram:s})]),p=nu(Mu({version:0}),(e=>$u(d.address,e)),(e=>ou(u,e)),(e=>Wu([ap({mint:r,payer:d,tokenProgram:s,owner:n,ata:h}),Tp({source:f,destination:h,authority:d,amount:c},{programAddress:s})],e)));return Vu([Sh({units:this.#O}),Th({microLamports:this.#M})],p)}static async deriveAssociatedTokenAccountAddress({mint:e,owner:t,tokenProgram:n}){return(await rp({mint:e,owner:t,tokenProgram:n}))[0]}async getTokenAccount({mint:e,network:t}){const n=this.#h.getRpc(t),r=await async function(e,t,n={}){const{abortSignal:r,...o}=n,{value:i}=await e.getAccountInfo(t,{...o,encoding:"jsonParsed"}).send({abortSignal:r});return i&&"object"==typeof i&&"parsed"in i.data?xm(t,i):_m(t,i)}(n,e);return r}getDecimals(e){AS.assertAccountExists(e),AS.assertAccountDecoded(e);const{decimals:t}=e.data;if(!t)throw new Error(`Decimals not found for ${e}`);return t}static isAccountExists(e){return e.exists}static assertAccountExists(e){if(!AS.isAccountExists(e))throw new Error("Token account does not exist")}static assertAccountNotExists(e){if(AS.isAccountExists(e))throw new Error("Token account exists")}static isAccountDecoded(e){return AS.assertAccountExists(e),!(e.data instanceof Uint8Array)}static assertAccountDecoded(e){if(AS.assertAccountExists(e),!AS.isAccountDecoded(e))throw new Error("Token account is encoded. Implement a decoder.")}getComputeUnitLimit(){return this.#O}getComputeUnitPriceMicroLamportsPerComputeUnit(){return this.#M}}const bS=new xy,SS=new class{#i;#z=new Map;constructor(e){this.#i=Kl(e,"[⚡ EventEmitter]")}on(e,t){this.#i.info(`Adding listener for event ${e}`),this.#z.has(e)||this.#z.set(e,new Set),this.#z.get(e)?.add(t)}off(e,t){this.#i.info(`Removing listener for event ${e}`);const n=this.#z.get(e);n&&(n.delete(t),0===n.size&&this.#z.delete(e))}async emitSync(e,t){this.#i.info(`Emitting event ${e}`);const n=this.#z.get(e);if(n){const e=Array.from(n).map((async e=>await e(t)));await Promise.allSettled(e)}}removeAllListeners(e){e?(this.#i.info(`Removing all listeners for event ${e}`),this.#z.delete(e)):(this.#i.info("Removing all listeners for all events"),this.#z.clear())}listenerCount(e){const t=this.#z.get(e);return t?t.size:0}eventNames(){return Array.from(this.#z.keys())}}(Gl),ES=new class{#l;constructor(e,t){this.#l=t,e.on("onStart",this.#j.bind(this)),e.on("onUpdate",this.#j.bind(this)),e.on("onInstall",this.#j.bind(this))}async#j(){await this.update((e=>(0,_d.omit)(e,["assets"])))}async get(){const e=await snap.request({method:"snap_getState",params:{encrypted:this.#l.encrypted}}),t=ay(e??{});var n,r;return n=this.#l.defaultState,r=t,{...n,...Object.fromEntries(Object.entries(r).filter((([e,t])=>null!=t&&(!t||"object"!=typeof t||Object.keys(t).length>0))))}}async getKey(e){const t=await snap.request({method:"snap_getState",params:{key:e,encrypted:this.#l.encrypted}});if(null!==t)return ay(t)}async setKey(e,t){await snap.request({method:"snap_setState",params:{key:e,value:sy(t),encrypted:this.#l.encrypted}})}async update(e){return this.get().then((async t=>{const n=e(t);return await snap.request({method:"snap_manageState",params:{operation:"update",newState:sy(n),encrypted:this.#l.encrypted}}),n}))}async deleteKey(e){await this.update((t=>((0,_d.unset)(t,e),t)))}async deleteKeys(e){await this.update((t=>(e.forEach((e=>{(0,_d.unset)(t,e)})),t)))}}(SS,{encrypted:!1,defaultState:{keyringAccounts:{},mapInterfaceNameToId:{},transactions:{},signatures:{},assetEntities:{},tokenPrices:{},subscriptions:{}}}),kS=new class{#U;prefix;logger;constructor(e,t=console,n="__cache__default"){this.#U=e,this.logger=t,this.prefix=n}async get(e){return(await this.mget([e]))[e]}async set(e,t,n=Number.MAX_SAFE_INTEGER){this.#D(n),await this.#U.setKey(`${this.prefix}.${e}`,{value:t,expiresAt:Math.min(Date.now()+(n??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})}#D(e){if(void 0!==e){if("number"!=typeof e)throw new Error("TTL must be a number");if(e<0)throw new Error("TTL must be positive");if(e>Number.MAX_SAFE_INTEGER)throw new Error("TTL must be less than 2^53 - 1")}}async delete(e){return(await this.mdelete([e]))[e]??!1}async clear(){await this.#U.setKey(this.prefix,{})}async has(e){return void 0!==await this.get(e)}async keys(){const e=await this.#U.getKey(this.prefix);return Object.keys(e??{})}async size(){const e=await this.#U.getKey(this.prefix);return Object.keys(e??{}).length}async peek(e){const t=await this.#U.getKey(this.prefix),n=t?.[e];return n?.value}async mget(e){const t=await this.#U.getKey(this.prefix),n=Object.entries(t??{}).filter((([t])=>e.includes(t))),r=n.filter((([e,t])=>t&&t.expiresAt<Date.now()));return await this.mdelete(r.map((([e])=>e))),n.reduce(((e,[t,n])=>void 0===n?(this.logger.info(`[StateCache] ❌ Cache miss for key "${t}"`),e):(n.expiresAt<Date.now()?(this.logger.info(`[StateCache] ⌛ Cache expired for key "${t}"`),e[t]=void 0):(this.logger.info(`[StateCache] 🎉 Cache hit for key "${t}"`),e[t]=n.value),e)),{})}async mset(e){if(0!==e.length)if(1!==e.length)e.forEach((({ttlMilliseconds:e})=>{this.#D(e)})),await this.#U.update((t=>{const n=t[this.prefix]??{};return e.forEach((({key:e,value:t,ttlMilliseconds:r})=>{void 0!==t&&(n[e]={value:t,expiresAt:Math.min(Date.now()+(r??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})})),t[this.prefix]=n,t}));else{Wo(e[0]);const{key:t,value:n,ttlMilliseconds:r}=e[0];await this.set(t,n,r)}}async mdelete(e){const t={};return await this.#U.update((n=>{const r=n[this.prefix]??{};return e.forEach((e=>{void 0===r[e]?t[e]=!1:(delete r[e],t[e]=!0)})),n[this.prefix]=r,n})),t}}(ES,Gl),IS=new class{#v=new Map;logger;constructor(e){this.logger=Kl(e,"[💾 InMemoryCache]")}#D(e){if(void 0!==e){if("number"!=typeof e)throw new Error("TTL must be a number");if(e<0)throw new Error("TTL must be positive");if(e>Number.MAX_SAFE_INTEGER)throw new Error("TTL must be less than 2^53 - 1")}}#L(e){return e.expiresAt<Date.now()}async#F(){const e=[];for(const[t,n]of this.#v.entries())this.#L(n)&&e.push(t);await this.mdelete(e)}async get(e){return(await this.mget([e]))[e]}async set(e,t,n=Number.MAX_SAFE_INTEGER){this.#D(n),this.#v.set(e,{value:t,expiresAt:Math.min(Date.now()+(n??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})}async delete(e){return(await this.mdelete([e]))[e]??!1}async clear(){this.#v.clear()}async has(e){const t=this.#v.get(e);return!!t&&(!this.#L(t)||(this.#v.delete(e),!1))}async keys(){return await this.#F(),Array.from(this.#v.keys())}async size(){return await this.#F(),this.#v.size}async peek(e){const t=this.#v.get(e);if(t){if(!this.#L(t))return t.value;this.#v.delete(e)}}async mget(e){await this.#F();const t={};for(const n of e){const e=this.#v.get(n);e?(this.logger.info(`🎉 Cache hit for key "${n}"`),t[n]=e.value):(this.logger.info(`❌ Cache miss for key "${n}"`),t[n]=void 0)}return t}async mset(e){if(0!==e.length)if(1!==e.length)e.forEach((({ttlMilliseconds:e})=>{this.#D(e)})),e.forEach((({key:e,value:t,ttlMilliseconds:n})=>{void 0!==t&&this.#v.set(e,{value:t,expiresAt:Math.min(Date.now()+(n??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})}));else{Wo(e[0]);const{key:t,value:n,ttlMilliseconds:r}=e[0];await this.set(t,n,r)}}async mdelete(e){return Object.fromEntries(e.map((e=>[e,this.#v.delete(e)])))}}(Vl),TS=new class{#i;constructor(e=Gl){this.#i=Kl(e,"[📣 AnalyticsService]")}async#$(e,t){await snap.request({method:"snap_trackEvent",params:{event:{event:e,properties:t}}})}async trackEventTransactionAdded(e,t){try{this.#i.log("Tracking event transaction added"),await this.#$("Transaction Added",{message:"Snap transaction added",origin:t.origin,account_id:e.id,account_address:e.address,account_type:e.type,chain_id:t.scope})}catch(e){this.#i.warn("Error tracking event transaction added",{error:e,metadata:t})}}async trackEventTransactionApproved(e,t){try{this.#i.log("Tracking event transaction approved"),await this.#$("Transaction Approved",{message:"Snap transaction approved",origin:t.origin,account_id:e.id,account_address:e.address,account_type:e.type,chain_id:t.scope})}catch(e){this.#i.warn("Error tracking event transaction approved",{error:e,metadata:t})}}async trackEventTransactionSubmitted(e,t,n){try{this.#i.log("Tracking event transaction submitted"),await this.#$("Transaction Submitted",{message:"Snap transaction submitted",origin:n.origin,account_id:e.id,account_address:e.address,account_type:e.type,chain_id:n.scope})}catch(e){this.#i.warn("Error tracking event transaction submitted",{error:e,signature:t,metadata:n})}}async trackEventTransactionFinalized(e,t,n){try{this.#i.log("Tracking event transaction finalized"),await this.#$("Transaction Finalized",{message:"Snap transaction finalized",origin:n.origin,account_id:e.id,account_address:e.address,account_type:e.type,chain_id:t.chain,transaction_status:t.status,transaction_type:t.type})}catch(e){this.#i.warn("Error tracking event transaction finalized",{error:e,transaction:t,metadata:n})}}async trackEventTransactionRejected(e,t){try{this.#i.log("Tracking event transaction rejected"),await this.#$("Transaction Rejected",{message:"Snap transaction rejected",origin:t.origin,account_id:e.id,account_address:e.address,account_type:e.type,chain_id:t.scope})}catch(e){this.#i.warn("Error tracking event transaction rejected",{error:e,metadata:t})}}async trackEventSecurityAlertDetected(e,t,n,r,o,i){try{this.#i.log("Tracking event security alert detected"),await this.#$("Security Alert Detected",{message:"Snap security alert detected",origin:t,account_id:e.id,account_address:e.address,account_type:e.type,chain_id:n,security_alert_response:r,security_alert_reason:o,security_alert_description:i})}catch(e){this.#i.warn("Error tracking event security alert detected",{error:e,origin:t,scope:n,securityAlertResponse:r,securityAlertReason:o,securityAlertDescription:i})}}async trackEventSecurityScanCompleted(e,t,n,r,o){try{this.#i.log("Tracking event security scan completed"),await this.#$("Security Scan Completed",{message:"Snap security scan completed",origin:t,account_id:e.id,account_address:e.address,account_type:e.type,chain_id:n,scan_status:r,has_security_alerts:o})}catch(e){this.#i.warn("Error tracking event security scan completed",{error:e,origin:t,scope:n,scanStatus:r,hasSecurityAlerts:o})}}}(Gl),_S=new class{#p;#q=new Map;constructor(e){this.#p=e}#W(e){const t=this.#p.getNetworkBy("caip2Id",e),n=Kw(oA(t.rpcUrls));return this.#q.set(e,n),n}getRpc(e){return M(e,gd),this.#q.get(e)??this.#W(e)}}(bS),xS=new class{#p;constructor(e){this.#p=e}async getAll(){return(await snap.request({method:"snap_getWebSockets"})).map((e=>({...e,network:this.#V(e.url)})))}async getById(e){return(await this.getAll()).find((t=>t.id===e))??null}async findByNetwork(e){return(await this.getAll()).find((t=>t.network===e))??null}async save(e){const{url:t,protocols:n}=e,r=await snap.request({method:"snap_openWebSocket",params:{url:t,...n?{protocols:n}:{}}});return{...e,id:r}}async delete(e){await snap.request({method:"snap_closeWebSocket",params:{id:e}})}#V(e){const t=this.#p.getNetworkBy("webSocketUrl",e);if(!t)throw new Error(`No network found for WebSocket URL: ${e}`);return t.caip2Id}}(bS),CS=new class{#p;#K;#G;#i;#H;#Z;#J=new Map;#Y=new Map;constructor(e,t,n,r){const{maxReconnectAttempts:o,reconnectDelayMilliseconds:i}=t.get().subscriptions;this.#K=e,this.#p=t,this.#G=n,this.#i=Kl(r,"[🔌 WebSocketConnectionService]"),this.#H=o,this.#Z=i,this.#Q()}#Q(){const e=this.#X.bind(this),t=this.#ee.bind(this),n=this.#te.bind(this),r=this.#ne.bind(this),o=this.#re.bind(this);this.#G.on("onStart",e),this.#G.on("onUpdate",e),this.#G.on("onInstall",e),this.#G.on("onActive",t),this.#G.on("onInactive",n),this.#G.on("onWebSocketEvent",o),this.#G.on("onListWebSockets",r)}async#X(){this.#i.log("Setting up connections");const{active:e}=await my();e?await this.#ee():await this.#te()}async#ee(){this.#i.log("Opening connections for active networks");const{activeNetworks:e}=this.#p.get();this.#Y.clear(),await Promise.allSettled(e.map((async e=>{await this.openConnection(e)})))}async openConnection(e){this.#i.log(`Opening connection for network ${e}`);const t=this.#p.getNetworkBy("caip2Id",e),{webSocketUrl:n}=t;await this.#K.findByNetwork(e)?this.#i.log(`✅ Connection for network ${e} already exists`):await this.#K.save({network:e,url:n,protocols:[]})}async#te(){this.#i.log("Closing all connections");const e=await this.#K.getAll();await Promise.allSettled(e.map(this.#oe.bind(this)))}async#oe(e){this.#i.log(`Closing connection for network ${e.network}`),await this.#K.delete(e.id)}onConnectionRecovery(e,t){const n=this.#J.get(e)??[];this.#J.set(e,[...n,t])}async findByNetwork(e){return await this.#K.findByNetwork(e)??null}async findById(e){return this.#K.getById(e)}async#re(e){if("open"!==e.type&&"close"!==e.type)return;const{id:t,type:n}=e;switch(this.#i.log(`Handling connection event "${n}" for ${t}`,e),n){case"open":await this.#ie(e);break;case"close":await this.#ae(e);break;default:this.#i.warn(`Unknown connection event type: ${n}`)}}async#ie(e){const{id:t}=e,n=await this.#K.getById(t);if(!n)return void this.#i.warn(`No connection found with id: ${t}`);this.#i.log(`✅ Connected to ${t}`,e);const{network:r}=n;this.#Y.delete(r);const o=this.#J.get(r)??[];this.#i.log(`Triggering ${o.length} connection recovery handlers`,r);const i=o.map((async e=>{try{await e(r)}catch(e){this.#i.error("Error in connection recovery handler",e)}}))??[];await Promise.allSettled(i)}async#ae(e){const{wasClean:t}=e;if(t)return void this.#i.log("✅ Connection closed cleanly",e);const{origin:n}=e,{networks:r}=this.#p.get(),o=r.find((e=>e.webSocketUrl.startsWith(n)));o?await this.#se(o.caip2Id):this.#i.warn("No network found for origin",n)}async#se(e){const t=this.#Y.get(e)??0,n=t+1;if(this.#Y.set(e,n),n>this.#H)return void this.#i.error(`❌ Failed to reconnect to ${e} after ${this.#H}/${this.#H} attempts. Giving up.`);const r=this.#Z*Math.pow(2,t);this.#i.warn(`❌ Disconnected from ${e}. Will try reconnecting in ${r}ms (attempt ${n}/${this.#H})`),await new Promise((t=>{setTimeout((()=>{this.openConnection(e).catch((t=>{this.#i.info(`Error opening connection for ${e}`,t)})).finally((()=>t()))}),r)}))}async#ne(){const e=await this.#K.getAll();this.#i.log("All connections",{connections:e,connectionRecoveryHandlers:this.#J})}}(xS,bS,SS,Gl),RS=new class{#U;#ce="subscriptions";constructor(e){this.#U=e}async getAll(){const e=await this.#U.getKey(`${this.#ce}`);return Object.values(e??{})}async getById(e){return await this.#U.getKey(`${this.#ce}.${e}`)}async save(e){await this.#U.setKey(`${this.#ce}.${e.id}`,e)}async delete(e){await this.#U.deleteKey(`${this.#ce}.${e}`)}async deleteMany(e){const t=e.map((e=>`${this.#ce}.${e}`));await this.#U.deleteKeys(t)}async update(e){await this.#U.setKey(`${this.#ce}.${e.id}`,e)}async findBy(e,t){const n=await this.getAll();if(0!==n.length)return n.find((n=>e in n&&n[e]===t))}async clear(){await this.#U.deleteKey(`${this.#ce}`)}}(ES),PS=new class{#ue;#le;#p;#G;#i;#de=new Map;constructor(e,t,n,r,o){this.#ue=e,this.#le=t,this.#p=n,this.#G=r,this.#i=Kl(o,"[🔔 SubscriptionService]"),this.#Q()}#Q(){this.#G.on("onWebSocketEvent",this.#re.bind(this)),this.#G.on("onListSubscriptions",this.#fe.bind(this));const{activeNetworks:e}=this.#p.get();e.forEach((e=>{this.#ue.onConnectionRecovery(e,this.#he.bind(this))}))}registerNotificationHandler(e,t,n){this.#i.info("Registering notification handler",{network:t,method:e,handler:n});const r=`${e}:${t}`;this.#de.has(r)||this.#de.set(r,new Set),this.#de.get(r).add(n)}registerConnectionRecoveryHandler(e,t){this.#ue.onConnectionRecovery(e,t)}async subscribe(e){this.#i.info("New subscription request",e);const{method:t,params:n,network:r}=e,o=await this.#pe(e),i=await this.#le.getById(o);if(i){if("confirmed"===i.status)return o;await this.#le.delete(o)}const a={...e,id:o,status:"pending",requestId:o,createdAt:(new Date).toISOString()};await this.#le.save(a);const s=await this.#ue.findByNetwork(r),c=async e=>{const r={jsonrpc:"2.0",id:o,method:t,params:n};e&&await this.#ge(e,r)};return s&&await c(s.id),a.id}async unsubscribe(e){this.#i.info("Unsubscribing from",e);const t=await this.#le.getById(e);if(!t)return void this.#i.warn(`Subscription not found: ${e}`);const{id:n,network:r,method:o}=t,i=Jm[o];if("confirmed"===t.status){const e=await this.#ue.findByNetwork(r);e&&await this.#ge(e.id,{jsonrpc:"2.0",id:globalThis.crypto.randomUUID(),method:i,params:[t.rpcSubscriptionId]})}await this.#le.delete(n)}async getAll(){return this.#le.getAll()}async#re(e){if("message"!==e.type)return;const t=(e=>{const{data:t}=e;let n;if(t&&"object"==typeof t&&"type"in t)if("text"===t.type)n="string"==typeof t.message?JSON.parse(t.message):t.message;else{if("binary"!==t.type)throw new Error("Unknown message data");{const e=t.message,r=String.fromCharCode(...e);n=JSON.parse(r)}}else n="string"==typeof t?JSON.parse(t):t;return n})(e),n=await this.#ue.findById(e.id);if(n)switch(this.#i.info("Received message",e),t.method){case"accountNotification":case"programNotification":case"signatureNotification":await this.#me(t,n.network);break;default:this.#ye(t)?await this.#ve(t):Sf(t)?await this.#we(t):this.#i.warn("Received unknown message",t)}}async#me(e,t){const{subscription:n}=e.params,r=await this.#le.findBy("rpcSubscriptionId",n);if(!r)return void this.#i.warn("No subscription found for RPC ID:",n);const o=`${r.method}:${t}`,i=this.#de.get(o);if(i&&i.size>0){(await Promise.allSettled(Array.from(i).map((async t=>t(e,r))))).forEach((e=>{"rejected"===e.status&&this.#i.error(`Handler failed for ${r.method}:`,e.reason)}))}}async#ge(e,t){this.#i.info(`Sending message to connection ${e}`,t),await snap.request({method:"snap_sendWebSocketMessage",params:{id:e,message:JSON.stringify(t)}})}#ye(e){return"jsonrpc"in e&&"2.0"===e.jsonrpc&&"id"in e&&"result"in e}async#ve(e){const{id:t,result:n}=e,r=await this.#le.getById(String(t));r?"confirmed"!==r.status?(await this.#le.update({...r,status:"confirmed",rpcSubscriptionId:n,confirmedAt:(new Date).toISOString()}),this.#i.info(`Subscription confirmed: request ID: ${t} -> RPC ID: ${n}`)):this.#i.warn(`Received subscription confirmation, but the subscription is already confirmed for request ID: ${t}.`):this.#i.warn(`Received subscription confirmation, but no matching pending subscription found for subscription ID: ${t}.`)}async#we(e){if("id"in e&&void 0!==e.id){const t=await this.#le.getById(String(e.id));"pending"===t?.status?(await this.#le.delete(t.id),this.#i.error(`Subscription establishment failed for ${t.id}:`,e.error)):this.#i.error(`Received error for request ID: ${e.id}`,e.error)}else this.#i.error("Connection-level error:",e.error)}async#pe(e){const t={method:e.method,params:e.params,network:e.network,metadata:e.metadata??null},n=this.#Ae(t),r=(new TextEncoder).encode(n),o=await globalThis.crypto.subtle.digest("SHA-256",r),i=Array.from(new Uint8Array(o)).map((e=>e.toString(16).padStart(2,"0"))).join("");return i}#Ae(e){if(null==e)return JSON.stringify(e);if("object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map((e=>this.#Ae(e))).join(",")}]`;const t=Object.keys(e).sort(((e,t)=>e.localeCompare(t)));return`{${t.map((t=>`"${t}":${this.#Ae(e[t])}`)).join(",")}}`}async#fe(){const e=await this.#le.getAll();this.#i.info("Subscriptions",{subscriptions:e,notificationHandlers:this.#de})}#be(e){return{method:e.method,params:e.params,network:e.network,...e.metadata?{metadata:e.metadata}:{}}}async#he(e){this.#i.info(`Re-subscribing to all subscriptions for network ${e}`);const t=(await this.#le.getAll()).filter((t=>t.network===e)),n=t.map((e=>e.id));await this.#le.deleteMany(n),await Promise.allSettled(t.map((async e=>{await this.subscribe(this.#be(e))})))}}(CS,RS,bS,SS,Gl),NS=new lA(_S,Gl),BS=new class{#h;#i;#O=450;#M=10000n;constructor(e,t){this.#h=e,this.#i=t}async buildTransactionMessage(e){try{const{from:t,to:n,amount:r,network:o}=e,i=Hs(t.address),a=BigInt($d(r).toString()),s=(await this.#h.getRpc(o).getLatestBlockhash().send()).value,c=nu(Mu({version:0}),(e=>$u(i,e)),(e=>ou(s,e)),(e=>qu(function(e,t){const n=t?.programAddress??El,r={source:{value:e.source??null,isWritable:!0},destination:{value:e.destination??null,isWritable:!0}},o={...e},i=_l(n);return{accounts:[i(r.source),i(r.destination)],programAddress:n,data:Dl().encode(o)}}({amount:a,destination:n,source:fl(i)}),e)));return Vu([Sh({units:this.#O}),Th({microLamports:this.#M})],c)}catch(e){throw this.#i.error({error:e},"Error building transaction message"),e}}getComputeUnitLimit(){return this.#O}getComputeUnitPriceMicroLamportsPerComputeUnit(){return this.#M}}(_S,Gl),OS=new AS(_S,NS,Gl),MS=new class{#o;#i;#a;#s;#v;cacheTtlsMilliseconds;constructor(e,t,n=globalThis.fetch,r=Gl){const{baseUrl:o,chunkSize:i,cacheTtlsMilliseconds:a}=e.get().priceApi;M(o,cd),this.#o=n,this.#i=r,this.#a=o,this.#s=i,this.cacheTtlsMilliseconds=a,this.#v=t}async getFiatExchangeRates(){try{const e=await this.#o(`${this.#a}/v1/exchange-rates/fiat`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch(e){throw this.#i.error(e,"Error fetching fiat exchange rates"),e}}async#Se(e,t="usd"){try{if(M(e,K(Do)),M(t,Pd),0===e.length)return{};const n=[...new Set(e)],r=[];for(let e=0;e<n.length;e+=this.#s)r.push(n.slice(e,e+this.#s));const o=await Promise.all(r.map((async e=>{const n=Td({baseUrl:this.#a,path:"/v3/spot-prices",queryParams:{vsCurrency:t,assetIds:e.join(","),includeMarketData:"true"}}),r=await this.#o(n);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const o=await r.json();return M(o,Rd),o}))),i=o.reduce(((e,t)=>({...e,...t})),{});return await this.#v.mset(e.map((e=>({key:`PriceApiClient:getMultipleSpotPrices:${e}:${t}`,value:i[e],ttlMilliseconds:this.cacheTtlsMilliseconds.spotPrices})))),i}catch(e){throw this.#i.error(e,"Error fetching spot prices"),e}}async#Ee(e,t="usd"){const n=[...new Set(e)],r="PriceApiClient:getMultipleSpotPrices",o=e=>`${r}:${e}:${t}`,i=await this.#v.mget(n.map(o)),a=(0,_d.mapKeys)(i,((e,t)=>(e=>{const t=new RegExp(`^${r}:(.+):(.+)$`,"u"),n=e.match(t);if(!n)throw new Error("Invalid cache key");return n})(t)[1])),s=n.filter((e=>void 0===a[e]));if(0===s.length)return a;const c=await this.#Se(s,t);return await this.#v.mset(Object.entries(c).map((([e,t])=>({key:o(e),value:t,ttlMilliseconds:this.cacheTtlsMilliseconds.spotPrices})))),{...a,...c}}async getMultipleSpotPrices(e,t="usd"){return this.#Ee(e,t)}async#ke(e){M(e,Nd);const t=Td({baseUrl:this.#a,path:"/v3/historical-prices/{assetType}",pathParams:{assetType:e.assetType},encodePathParams:!1,queryParams:{...e.timePeriod&&{timePeriod:e.timePeriod},...e.from&&{from:e.from.toString()},...e.to&&{to:e.to.toString()},...e.vsCurrency&&{vsCurrency:e.vsCurrency}}}),n=await this.#o(t),r=await n.json();return M(r,Bd),r}async getHistoricalPrices(e){return Zl(this.#ke.bind(this),this.#v,{functionName:"PriceApiClient:getHistoricalPrices",ttlMilliseconds:this.cacheTtlsMilliseconds.historicalPrices})(e)}}(bS,IS),zS=new Ld(bS),jS=new class{#o;#i;#a;#v;#Ie;constructor(e,t,n=globalThis.fetch,r=Gl){const{baseUrl:o,cacheTtlsMilliseconds:i}=e.get().nftApi;M(o,cd),this.#o=n,this.#i=r,this.#a=o,this.#Ie=i,this.#v=t}#Te(e){return{cursor:e.cursor,error:e.error,items:e.items.map((e=>({chain:e.chain,address:e.address,tokenAddress:e.token_address,tokenId:e.token_id,balance:e.balance,acquiredAt:e.acquired_at,isSpam:e.isSpam,nftToken:this.#_e(e.nft_token)})))}}async#xe(e){let t,n=[];do{const r=Td({baseUrl:this.#a,path:`/users/${e}/solana-tokens`,queryParams:t?{cursor:t}:void 0}),o=await this.#o(r,{headers:{"Content-Type":"application/json",accept:"application/json",version:"1"}}),i=await o.json(),a=this.#Te(i);n=[...n,...a.items],t=a.cursor??void 0}while(t);return n}async listAddressSolanaNfts(e){return Zl(this.#xe.bind(this),this.#v,{functionName:"NftApiClient:listAddressSolanaNfts",ttlMilliseconds:this.#Ie.listAddressSolanaNfts})(e)}#_e(e){return{address:e.address,tokenId:e.token_id,tokenStandard:e.token_standard,name:e.name,description:e.description,metadata:e.metadata,imageUrl:e.image_url,mediaUrl:e.media_url,externalUrl:e.external_url,attributes:e.attributes.map((e=>({key:e.key,value:e.value}))),tokenAccountAddress:e.token_account_address,creators:e.creators.map((e=>({address:e.address,share:e.share,verified:e.verified}))),collectionName:e.collection_name,collectionSymbol:e.collection_symbol,collectionCount:e.collection_count,collectionImageUrl:e.collection_image_url,onchainCollectionAddress:e.onchain_collection_address,floorPrice:e.floor_price?{asset:{type:e.floor_price.asset.type,name:e.floor_price.asset.name,symbol:e.floor_price.asset.symbol,decimals:e.floor_price.asset.decimals,tokenId:e.floor_price.asset.token_id},amount:{rawAmount:e.floor_price.amount.raw_amount,amount:e.floor_price.amount.amount}}:null,lastSalePrice:e.last_sale_price?{asset:{type:e.last_sale_price.asset.type,name:e.last_sale_price.asset.name,symbol:e.last_sale_price.asset.symbol,decimals:e.last_sale_price.asset.decimals,tokenId:e.last_sale_price.asset.token_id},amount:{rawAmount:e.last_sale_price.amount.raw_amount,amount:e.last_sale_price.amount.amount}}:null,rarity:e.rarity?{ranking:{source:e.rarity.ranking.source,value:e.rarity.ranking.value},metadata:{howrare:{rank:e.rarity.metadata.howrare.rank},moonrank:{rank:e.rarity.metadata.moonrank.rank}}}:null}}async#Ce(e){try{const t=Td({baseUrl:this.#a,path:`/nfts/contracts/solana/${e}/1`}),n=await this.#o(t,{headers:{"Content-Type":"application/json",accept:"application/json",version:"1"}}),r=await n.json();return this.#_e(r)}catch(e){return null}}async getNftMetadata(e){return Zl(this.#Ce.bind(this),this.#v,{functionName:"NftApiClient:getNftMetadata",ttlMilliseconds:this.#Ie.getNftMetadata})(e)}async getNftsMetadata(e){return await Promise.all(e.map((async e=>this.getNftMetadata(e))))}}(bS,IS),US=new class{#Re;#i;constructor({tokenApiClient:e,logger:t}){this.#Re=e,this.#i=t}async getTokensMetadata(e){if(0===e.length)return this.#i.warn(`No tokens to get metadata for ${e.join(", ")}`),{};return await this.#Re.getTokenMetadataFromAddresses(e)}async generateImageComponent(e,t=48,n=48){return e?async function(e,{width:t,height:n=t,request:r}){Db("number"==typeof t&&t>0,"Expected width to be a number greater than 0."),Db("number"==typeof n&&n>0,"Expected height to be a number greater than 0.");const o=await gS(e,r),i=`width="${t}" height="${n}"`;return pS(`<svg ${i.trim()} xmlns="http://www.w3.org/2000/svg"><image ${i.trim()} href="${o}" /></svg>`)}(e,{width:t,height:n}).then((e=>e.value)).catch((()=>mS)):mS}}({tokenApiClient:zS,logger:Gl}),DS=new class{#Pe;#i;cacheTtlsMilliseconds;constructor({configProvider:e,priceApiClient:t,logger:n}){this.#Pe=t,this.#i=n;const{cacheTtlsMilliseconds:r}=e.get().priceApi;this.cacheTtlsMilliseconds=r}#Ne(e){if(!yS(e))throw new Error("Passed caipAssetType is not a fiat asset");return Fo(e).assetReference.toLowerCase()}async#Be(e){const t=e.filter((e=>!yS(e))),[n,r]=await Promise.all([this.#Pe.getFiatExchangeRates(),this.#Pe.getMultipleSpotPrices(t,"usd")]);return{fiatExchangeRates:n,cryptoPrices:r}}async getMultipleTokenConversions(e){if(0===e.length)return{};const t=e.flatMap((e=>[e.from,e.to])),{fiatExchangeRates:n,cryptoPrices:r}=await this.#Be(t),o={};return e.forEach((e=>{const{from:t,to:i}=e;let a,s;if(o[t]||(o[t]={}),yS(t)){const e=n[this.#Ne(t)]?.value;if(!e)return void(o[t][i]=null);a=new _o(1).dividedBy(e)}else a=new _o(r[t]?.price??0);if(yS(i)){const e=n[this.#Ne(i)]?.value;if(!e)return void(o[t][i]=null);s=new _o(1).dividedBy(e)}else s=new _o(r[i]?.price??0);if(a.isZero()||s.isZero())return void(o[t][i]=null);const c=a.dividedBy(s).toString(),u=Date.now();o[t][i]={rate:c,conversionTime:u,expirationTime:u+this.cacheTtlsMilliseconds.historicalPrices}})),o}#Oe(e,t){const n=(0,_d.pick)(e,["marketCap","totalVolume","circulatingSupply","allTimeHigh","allTimeLow","pricePercentChange1h","pricePercentChange1d","pricePercentChange7d","pricePercentChange14d","pricePercentChange30d","pricePercentChange200d","pricePercentChange1y"]),r=e=>null==e?"":new _o(e).dividedBy(t).toString(),o=(e,t)=>null==t?{}:{[e]:t},i={...o("PT1H",n.pricePercentChange1h),...o("P1D",n.pricePercentChange1d),...o("P7D",n.pricePercentChange7d),...o("P14D",n.pricePercentChange14d),...o("P30D",n.pricePercentChange30d),...o("P200D",n.pricePercentChange200d),...o("P1Y",n.pricePercentChange1y)};return{fungible:!0,marketCap:r(n.marketCap),totalVolume:r(n.totalVolume),circulatingSupply:(n.circulatingSupply??0).toString(),allTimeHigh:r(n.allTimeHigh),allTimeLow:r(n.allTimeLow),...Object.keys(i).length>0?{pricePercentChange:i}:{}}}async getMultipleTokensMarketData(e){if(0===e.length)return{};const t=e.flatMap((e=>[e.asset,e.unit])),{fiatExchangeRates:n,cryptoPrices:r}=await this.#Be(t),o={};return e.forEach((e=>{const{asset:t,unit:i}=e;if(!r[t])return;let a;if(yS(i)){const e=n[this.#Ne(i)]?.value;if(!e)return;a=new _o(1).dividedBy(e)}else a=new _o(r[i]?.price??0);a.isZero()||(o[t]||(o[t]={}),o[t][i]=this.#Oe(r[t],a))})),o}async getHistoricalPrice(e,t){M(e,it),M(t,it);const n=Fo(t).assetReference.toLowerCase();M(n,Pd);const r=["1d","7d","1m","3m","1y","1000y"].map((async r=>this.#Pe.getHistoricalPrices({assetType:e,timePeriod:r,vsCurrency:n}).then((e=>({timePeriod:r,response:e}))).catch((n=>(this.#i.warn(`Error fetching historical prices for ${e} to ${t} with time period ${r}. Returning null object.`,n),{timePeriod:r,response:Od}))))),o=(await Promise.all(r)).reduce(((e,{timePeriod:t,response:n})=>(e[`P${t.toUpperCase()}`]=n.prices.map((e=>[e[0],e[1].toString()])),e)),{}),i=Date.now();return{intervals:o,updateTime:i,expirationTime:i+this.cacheTtlsMilliseconds.historicalPrices}}}({configProvider:bS,priceApiClient:MS,logger:Gl}),LS=new class{#h;#i;constructor(e,t){this.#h=e,this.#i=t}async resolveDomain(e,t){const n=this.#h.getRpc(e);return Bb(n,t)}async resolveAddress(e,t){try{const n=this.#h.getRpc(e);return`${(await(async(e,t)=>{const n=await eb.getAddress("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29",t),r=await eb.retrieve(e,n),[o,i]=await Promise.all([WA.retrieve(e,r.nameAccount),XA(e,r.nameAccount)]),a=i||o.owner,s=o.parentName!==VA,c=[tb(e,r.nameAccount,s?o.parentName:void 0)];s&&c.push(tb(e,o.parentName));const u=(await Promise.all(c)).join(".");return{domainAddress:r.nameAccount,domainName:u,stale:t!==a}})(n,Hs(t))).domainName}.sol`}catch(e){return this.#i.error("Error resolving address",e),null}}}(_S,Gl),FS=new class{#U;constructor(e){this.#U=e}async findByKeyringAccountId(e){return await this.#U.getKey(`assetEntities.${e}`)??[]}async getAll(){const e=await this.#U.getKey("assetEntities")??{};return Object.values(e).flat()}async saveMany(e){await this.#U.update((t=>{const n=(0,_d.cloneDeep)(t);for(const t of e){const{keyringAccountId:e}=t,r=(0,_d.cloneDeep)(n.assetEntities[e]??[]),o=r.findIndex((e=>e.assetType===t.assetType&&e.keyringAccountId===t.keyringAccountId));-1===o?r.push(t):r[o]=t,n.assetEntities[e]=r}return n}))}}(ES),$S=new Wy({connection:_S,logger:Gl,configProvider:bS,assetsRepository:FS,tokenMetadataService:US,cache:IS,tokenPricesService:DS,nftApiClient:jS}),qS=new class{#U;constructor(e){this.#U=e}async getAll(){const e=await this.#U.getKey("keyringAccounts");return Object.values(e??{})}async findById(e){return(await this.getAll()).find((t=>t.id===e))??null}async findByAddress(e){return(await this.getAll()).find((t=>t.address===e))??null}async save(e){await this.#U.setKey(`keyringAccounts.${e.id}`,e)}async delete(e){await this.#U.deleteKey(`keyringAccounts.${e}`)}}(ES),WS=new class{#Me;constructor(e){this.#Me=e}async getAll(){return this.#Me.getAll()}async findById(e){return this.#Me.findById(e)}async findByAddress(e){return this.#Me.findByAddress(e)}async save(e){return this.#Me.save(e)}async delete(e){return this.#Me.delete(e)}}(qS),VS=new class{#U;#ce="transactions";constructor(e){this.#U=e}async getAll(){const e=await this.#U.getKey(this.#ce);return Object.values(e??{}).flat()}async findByAccountId(e){return await this.#U.getKey(`${this.#ce}.${e}`)??[]}async save(e){await this.saveMany([e])}async saveMany(e){await this.#U.update((t=>{const n=t[this.#ce];return e.forEach((e=>{const r=e.id,o=e.account,i=n[o]??[],a=i.findIndex((e=>e.id===r));-1!==a&&(i[a]=e);const s=(0,_d.chain)([...i,e]).uniqBy("id").sortBy((e=>-(e.timestamp??0))).value();t[this.#ce][o]=s})),t}))}}(ES),KS=new class{#ze;#je;#Ue;#h;#i;constructor(e,t,n,r,o){this.#ze=e,this.#je=t,this.#Ue=n,this.#h=r,this.#i=Kl(o,"[💱 TransactionsService]")}async fetchBySignature(e,t,n){const r=await this.#h.getRpc(n).getTransaction(mc(e),{maxSupportedTransactionVersion:0}).send();return this.#De(r,t,n)}async fetchAssetsTransactions(e,t){const n=await this.#je.getAll(),r=e=>n.find((t=>t.id===e)),o=e.map((e=>e.assetType)),i=await this.#Ue.getAssetsMetadata(o),a=await this.#ze.getAll(),s=(await Promise.all(e.map((async e=>{const{network:t}=e,n="pubkey"in e?e.pubkey:e.address,r=await(async e=>{const{network:t}=e,n="mint"in e?e.mint:e.address,r=a.sort(((e,t)=>(t.timestamp??0)-(e.timestamp??0))).find((e=>e.from.some((e=>qy(t,n)===(0,_d.get)(e,"asset.type")))||e.to.some((e=>qy(t,n)===(0,_d.get)(e,"asset.type")))));return r||null})(e),o=r?mc(r?.id):void 0;return(await this.#h.getRpc(t).getSignaturesForAddress(Hs(n),{limit:5,...o?{until:o}:{}}).send()).map((t=>({signatureResponse:{signature:t.signature,blockTime:Number(t.blockTime??0)},asset:e})))})))).flat(),c=t?.limit?s.sort(((e,t)=>(t.signatureResponse.blockTime??0)-(e.signatureResponse.blockTime??0))).slice(0,t.limit):s,u=(await Promise.all(c.map((async e=>{try{const{signatureResponse:t,asset:n}=e;return{transaction:await this.#h.getRpc(n.network).getTransaction(mc(t.signature),{maxSupportedTransactionVersion:0}).send(),asset:n}}catch(e){return null}})))).filter((e=>null!==e));return(await Promise.all(u.map((async e=>{const{transaction:t,asset:n}=e;if(!t)return null;const o=r(n.keyringAccountId);return o?this.#De(t,o,n.network,i):null})))).filter((e=>null!==e)).filter((e=>{const t=r(e.account);return!!t&&!function(e,t){return[Vy].some((n=>n(e,t)))}(e,t)}))}async fetchLatestSignatures(e,t,n){return(await this.#h.getRpc(e).getSignaturesForAddress(t,n).send()).map((({signature:e})=>e))}async findByAccounts(e){return(await Promise.all(e.map((async e=>this.#ze.findByAccountId(e.id))))).flat()}async save(e){await this.saveMany([e])}async saveMany(e){await this.#ze.saveMany(e);const t=(0,_d.groupBy)(e,"account");await vn(snap,gn.AccountTransactionsUpdated,{transactions:t})}async#De(e,t,n,r){if(!e)return null;const o=Yy({transactionData:e,account:t,scope:n});if(!o)return null;const i=[...new Set([...o.from,...o.to].filter((e=>e.asset?.fungible)).map((e=>e.asset.type)))],a=r??await this.#Ue.getAssetsMetadata(i);return o.from.forEach((e=>{e.asset?.fungible&&a[e.asset.type]&&(e.asset.unit=a[e.asset.type]?.symbol??"")})),o.to.forEach((e=>{e.asset?.fungible&&a[e.asset.type]&&(e.asset.unit=a[e.asset.type]?.symbol??"")})),o}}(VS,WS,$S,_S,Gl),GS=new class{#je;#Ue;#Le;#i;constructor(e,t,n,r){this.#je=e,this.#Ue=t,this.#Le=n,this.#i=Kl(r,"[🔄 AccountsSynchronizer]")}async synchronize(e){const t=e??await this.#je.getAll();this.#i.info("Synchronizing accounts",t);const n=(await Promise.allSettled(t.map((async e=>this.#Ue.fetch(e))))).map((e=>"fulfilled"===e.status?e.value:[])).flat(),r=await this.#Ue.getAll(),o=n.filter((e=>Wy.hasChanged(e,r)));await this.#Ue.saveMany(o);const i=await this.#Le.fetchAssetsTransactions(o,{limit:20});await this.#Le.saveMany(i)}}(WS,$S,KS,Gl),HS=new class{#Fe;#i;#m;#$e;constructor(e,t,n,r){this.#Fe=e,this.#m=t,this.#$e=n,this.#i=r}async scanTransaction({method:e,accountAddress:t,transaction:n,scope:r,origin:o,options:i=["simulation","validation"],account:a}){try{const s=await this.#Fe.scanTransactions({method:e,accountAddress:t,transactions:[n],scope:r,origin:o===Ql?"https://metamask.io":o,options:i}),c=this.#qe(s);if(!c?.status)return this.#i.warn("Invalid scan result received from security alerts API"),a&&await this.#$e.trackEventSecurityScanCompleted(a,o,r,wS.ERROR,!1),null;if(a){const e=Object.values(wS).includes(c.status)?c.status:wS.ERROR,t=Boolean(c.validation?.type&&c.validation.type!==vS.Benign),n=[this.#$e.trackEventSecurityScanCompleted(a,o,r,e,t)];if(t){const e=Object.values(vS).includes(c.validation.type)?c.validation.type:vS.Warning;n.push(this.#$e.trackEventSecurityAlertDetected(a,o,r,e,c.validation.reason??"unknown",this.#We(c.validation)))}await Promise.all(n)}if(!c?.estimatedChanges?.assets)return null;const u={...c},l=c.estimatedChanges.assets.map((async(e,t)=>{const{logo:n}=e;if(n)return this.#m.generateImageComponent(n,16,16).then((e=>{e&&u?.estimatedChanges?.assets?.[t]&&(u.estimatedChanges.assets[t].imageSvg=e)})).catch((()=>null))}));return await Promise.all(l??[]),u}catch(e){return this.#i.error(e),a&&await this.#$e.trackEventSecurityScanCompleted(a,o,r,wS.ERROR,!1),null}}#We(e){if(!e?.reason)return"Security alert: Unknown reason";return{unfair_trade:"Unfair trade of assets, without adequate compensation to the owner's account",transfer_farming:"Substantial transfer of the account's assets to untrusted entities",writable_accounts_farming:"Transaction exposes unused writable account, can be utilized in BIT-FLIP attacks patterns",native_ownership_change:"The account transferred ownership of its native SOL to untrusted entities",spl_token_ownership_change:"The account transferred ownership of its SPL tokens to untrusted entities",exposure_farming:"The account delegates ownership, thereby exposing its assets to untrusted spenders",known_attacker:"A known attacker's account is involved in the transaction",invalid_signature:"One of the transactions provided contains non valid signatures, that can lead misleading simulation results",honeypot:"The account invests funds in a token that is part of an orchestrated honeypot scheme",other:"The transaction was marked as malicious for other reason, further details would be described in features field"}[e.reason]??`Security alert: ${e.reason}`}#qe(e){return e?{status:"SUCCESS"===e.status||"ERROR"===e.status?e.status:"ERROR",estimatedChanges:{assets:e.result?.simulation?.account_summary?.account_assets_diff?.map((e=>({type:e.in?"in":"out",symbol:"symbol"in e.asset?e.asset.symbol:e.asset_type,name:"name"in e.asset?e.asset.name:e.asset_type,logo:"logo"in e.asset?e.asset.logo:null,value:e.in?.value??e.out?.value??null,price:e.in?.usd_price??e.out?.usd_price??null,imageSvg:null})))??[]},validation:{type:e.result?.validation?.result_type??null,reason:e.result?.validation?.reason??null},error:e?.error_details?{type:"type"in e.error_details?e.error_details.type:null,code:"code"in e.error_details?e.error_details.code:null}:null}:null}}(new class{#o;#i;#a;constructor(e,t=globalThis.fetch,n=Gl){const{baseUrl:r}=e.get().securityAlertsApi;this.#o=t,this.#i=n,this.#a=r}async scanTransactions({method:e,accountAddress:t,transactions:n,scope:r,origin:o,options:i}){const a=jd.from(zd.decode(t)).toString("base64");this.#i.info("Scanning transaction");return(await this.#o(`${this.#a}/solana/message/scan`,{headers:{"Content-Type":"application/json",accept:"application/json"},method:"POST",body:JSON.stringify({method:e,encoding:"base64",account_address:a,metadata:{url:o},chain:Ud[r],transactions:n,options:i})})).json()}}(bS),US,TS,Gl),ZS=new class{async handleKeyringRequest(e,t){const{request:{method:n}}=e;switch(n){case $t.SignAndSendTransaction:case $t.SignTransaction:return this.#Ve(e,t);case $t.SignMessage:return this.#Ke(e,t);case $t.SignIn:return this.#Ge(e,t);default:throw new Error(`Unsupported method: ${n}`)}}async#Ve(e,t){M(e.request,ae([Wf,Gf]));const{request:{method:n,params:{transaction:r}},scope:o,account:i,origin:a}=e;await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:Uy.OnTransactionAdded,params:{accountId:i,metadata:{scope:o,origin:a}}}}});return await async function(e){const t={...iw,...e},n=py().then((e=>{t.preferences=e})).catch((()=>{t.preferences=iw.preferences})),r=Hm(_S.getRpc(t.scope),t.transaction).then((e=>{t.advanced.instructions=e})).catch((e=>{Gl.error(e),t.advanced.instructions=[]}));await Promise.all([n,r]);const{currency:o,useExternalPricingData:i,useSecurityAlerts:a,simulateOnChainActions:s}=t.preferences,c=await ly(Qy(ow,{context:t}),t),u=hy(c),l={...t},d=[id[t.scope].nativeToken.caip19Id];let f;i?f=MS.getMultipleSpotPrices(d,o).then((e=>{l.tokenPrices=e,l.tokenPricesFetchStatus="fetched"})).catch((()=>{l.tokenPricesFetchStatus="error"})):(l.tokenPricesFetchStatus="fetched",l.tokenPrices={});const h=NS.getFeeFromBase64StringInLamports(t.transaction,l.scope).then((e=>{l.feeEstimatedInSol=e?Fd(e).toString():null})).catch((()=>{l.feeEstimatedInSol=null}));await Promise.all([f,h]),await dy(c,Qy(ow,{context:l}),l);const p={...l},g=[];if(s&&g.push("simulation"),a&&g.push("validation"),s||a){const e=HS.scanTransaction({method:p.method,accountAddress:p.account?.address??"",transaction:p.transaction,scope:p.scope,origin:p.origin,options:g}).then((async e=>{p.scan=e,p.scanFetchStatus=e?"fetched":"error"})).catch((()=>{p.scan=null,p.scanFetchStatus="error"}));await Promise.all([e])}else p.scanFetchStatus="fetched",p.scan=null;return await dy(c,Qy(ow,{context:p}),p),await ES.setKey(`mapInterfaceNameToId.${uy}`,c),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT20S",request:{method:"refreshConfirmationEstimation"}}}),u}({...iw,scope:o,method:n,origin:e.origin,transaction:r,account:t})?(await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:Uy.OnTransactionApproved,params:{accountId:i,metadata:{scope:o,origin:a}}}}}),!0):(await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:Uy.OnTransactionRejected,params:{accountId:i,metadata:{scope:o,origin:a}}}}}),!1)}async#Ke(e,t){const n=await async function(e,t){M(e.request,Kf);const{request:{params:{message:n}},scope:r,origin:o}=e,i=js().encode(n),a=$s().decode(i),s=await py().then((e=>e.locale)).catch((()=>Av));return hy(await ly(Qy(qv,{message:a,account:t,scope:r,locale:s,networkImage:ev,origin:o}),{}))}(e,t);return Boolean(n)}async#Ge(e,t){const n=await async function(e,t){M(e.request,Vf);const{request:{params:n},scope:r,origin:o}=e,i=await py();return hy(await ly(Qy(Lv,{params:n,account:t,scope:r,preferences:i,networkImage:ev,origin:o}),{}))}(e,t);return Boolean(n)}},JS=new class{#He;#Ze;#Le;#$e;#h;#p;#i;#Je=new Map;constructor(e,t,n,r,o,i,a){this.#He=e,this.#Ze=t,this.#Le=n,this.#$e=r,this.#h=o,this.#p=i,this.#i=Kl(a,"[✍️ SignatureMonitor]"),this.#Q()}#Q(){const{activeNetworks:e}=this.#p.get();e.forEach((e=>{this.#He.registerNotificationHandler("signatureSubscribe",e,this.#Ye.bind(this)),this.#He.registerConnectionRecoveryHandler(e,this.#Qe.bind(this))}))}async monitor(e,t,n,r,o){this.#i.info("Monitoring signature",{signature:e,accountId:t,commitment:n,network:r,origin:o});const i={method:"signatureSubscribe",network:r,params:[e,{commitment:n,enableReceivedNotification:!1}],metadata:{accountId:t,origin:o}},a=await this.#He.subscribe(i);this.#Je.set(a,i)}async#Ye(e,t){try{const{network:e}=t,n=(0,_d.get)(t,"params[0]");M(n,re());const r=(0,_d.get)(t,"params[1].commitment");M(r,Ym);const o=t.metadata?.accountId;M(o,re());const i=t.metadata?.origin;M(i,re());const a=await this.#Ze.findById(o);if(!a)throw new Error(`Account not found: ${o}`);const s=await this.#Le.fetchBySignature(n,a,e);if(!s)throw new Error(`Transaction with signature ${n} not found on network ${e}`);switch(r){case"processed":await this.#Le.save(s),await this.#$e.trackEventTransactionSubmitted(a,n,{scope:e,origin:i});break;case"confirmed":case"finalized":await this.#Le.save(s),await this.#$e.trackEventTransactionFinalized(a,s,{scope:e,origin:i});break;default:this.#i.warn(`⚠️ Commitment ${r} not supported`)}}catch(e){this.#i.error("Error handling signature notification",e)}finally{await this.#He.unsubscribe(t.id),this.#Je.delete(t.id)}}async#Qe(){this.#i.info("Handling connection recovery"),await Promise.all(Array.from(this.#Je.entries()).map((async([e,t])=>{await this.#Xe(t,e)})))}async#Xe(e,t){try{const{network:n}=e;M(n,re());const r=(0,_d.get)(e,"params[0]");M(r,re());const o=(0,_d.get)(e,"params[1].commitment");M(o,Ym);const i=await this.#et(r,n);if(!i)throw new Error(`Signature ${r} not found via HTTP fetch during connection recovery`);if(!this.#tt(i,o))return void this.#i.info("Signature did not reach the desired commitment while connection was down. Skipping.");const a={jsonrpc:"2.0",method:"signatureNotification",params:{subscription:1,result:{context:{slot:BigInt(0)},value:{err:null}}}},s={...e,id:t};await this.#Ye(a,s),this.#Je.delete(t)}catch(e){this.#i.error("Error handling connection recovery",e)}}async#et(e,t){const n=await this.#h.getRpc(t).getSignatureStatuses([mc(e)],{searchTransactionHistory:!0}).send(),r=n.value[0]?.confirmationStatus;if(!r)throw new Error(`Signature ${e} not found via HTTP fetch during connection recovery`);return r}#tt(e,t){return t===e||"processed"===t&&("confirmed"===e||"finalized"===e)||"confirmed"===t&&"finalized"===e}}(PS,WS,KS,TS,_S,bS,Gl),YS=new class{#He;#Ze;#Ue;#Le;#nt;#p;#G;#i;#rt=new Map;#ot=[Wh,Lp];constructor(e,t,n,r,o,i,a,s){this.#He=e,this.#Ze=t,this.#Ue=n,this.#Le=r,this.#nt=o,this.#p=i,this.#G=a,this.#i=Kl(s,"[🗝️ KeyringAccountMonitor]"),this.#Q()}#Q(){this.#i.info("Binding handlers"),this.#G.on("onStart",this.#it.bind(this)),this.#G.on("onUpdate",this.#it.bind(this)),this.#G.on("onInstall",this.#it.bind(this));const{activeNetworks:e}=this.#p.get();e.forEach((e=>{this.#He.registerNotificationHandler("accountSubscribe",e,this.#at.bind(this)),this.#He.registerNotificationHandler("programSubscribe",e,this.#st.bind(this))})),e.forEach((e=>{this.#He.registerConnectionRecoveryHandler(e,this.#Qe.bind(this))}))}async#it(){this.#i.info("Handling onStart/onUpdate/onInstall");const e=await this.#Ze.getAll(),t=Array.from(this.#rt.keys());await Promise.allSettled(t.map((async t=>{const n=e.find((e=>e.id===t));n&&await this.stopMonitorKeyringAccount(n)}))),await Promise.allSettled(e.map((async e=>{await this.monitorKeyringAccount(e)})))}async monitorKeyringAccount(e){try{this.#i.log("Monitoring keyring account",e);const{id:t}=e,{activeNetworks:n}=this.#p.get();if(this.#rt.has(t))return void this.#i.log("Account is already being monitored",e);const r=t=>e.scopes.includes(t),o=n.filter(r).map((async t=>this.#ct(e,t))),i=n.filter(r).map((async t=>{await Promise.all(this.#ot.map((async n=>this.#ut(e,n,t))))}));await Promise.all([...i,...o])}catch(t){throw this.#i.error("Error monitoring keyring account",t),await this.stopMonitorKeyringAccount(e),t}}async stopMonitorKeyringAccount(e){this.#i.log("Stopping to monitor all assets of account",e);const{id:t}=e,n=this.#rt.get(t);n&&await Promise.allSettled(Array.from(n).map((async e=>this.#He.unsubscribe(e)))),this.#rt.delete(t)}async#ct(e,t){this.#i.log("Monitoring native asset balance",{account:e,network:t});const{address:n,id:r}=e,o=await this.#He.subscribe({method:"accountSubscribe",network:t,params:[n,{commitment:"confirmed",encoding:"jsonParsed"}]});this.#lt(r,o)}async#ut(e,t,n){this.#i.log("Monitoring token program by owner",{account:e,tokenProgramAddress:t,network:n});const{address:r,id:o}=e,i=await this.#He.subscribe({method:"programSubscribe",network:n,params:[t,{commitment:"confirmed",encoding:"jsonParsed",filters:[{memcmp:{offset:32,bytes:r,encoding:"base58"}}]}]});this.#lt(o,i)}async#at(e,t){this.#i.info("Account notification received",{notification:e,subscription:t});const{network:n}=t,r=(0,_d.get)(t,"params[0]");M(r,re());const o=await this.#Ze.findByAddress(r);if(!o)throw new Error(`No keyring account found for address: ${r}`);const{lamports:i}=e.params.result.value;M(i,X());await Promise.all([this.#Ue.save({assetType:`${n}/${rd.SOL}`,keyringAccountId:o.id,network:n,address:r,symbol:"SOL",decimals:9,rawAmount:i.toString(),uiAmount:Fy(i,9)}),this.#dt(o,n,r)])}async#st(e,t){this.#i.info("Handling program notification",{notification:e,subscription:t});const{network:n}=t,r=(0,_d.get)(t,"params[0]");if(M(r,re()),r!==Wh&&r!==Lp)throw new Error(`Program not supported: ${r}`);const{owner:o}=e.params.result.value.account.data.parsed.info;M(o,re());const{mint:i}=e.params.result.value.account.data.parsed.info;M(i,re());const{amount:a,decimals:s,uiAmountString:c}=e.params.result.value.account.data.parsed.info.tokenAmount;M(a,re()),M(s,X()),M(c,re());const{pubkey:u}=e.params.result.value;M(u,re());const l=qy(n,i),d=await this.#Ze.findByAddress(o);if(!d)throw new Error(`No keyring account found with address: ${o}`);await Promise.all([this.#Ue.save({assetType:l,keyringAccountId:d.id,network:n,mint:i,pubkey:u,symbol:"",decimals:s,rawAmount:a,uiAmount:c}),this.#dt(d,n,u)])}async#dt(e,t,n){const r=(await this.#Le.fetchLatestSignatures(t,Hs(n),{limit:1}))?.[0];if(!r)throw new Error("No signature found");const o=await this.#Le.fetchBySignature(r,e,t);if(!o)throw new Error("No transaction found");await this.#Le.save(o)}#lt(e,t){this.#rt.has(e)||this.#rt.set(e,new Set),this.#rt.get(e)?.add(t)}async#Qe(e){this.#i.info("Handling connection recovery",{network:e});const t=await this.#Ze.getAll(),n=(await this.#He.getAll()).filter((t=>t.network===e&&"accountSubscribe"===t.method)),r=t.filter((e=>n.some((t=>(0,_d.get)(t,"params[0]")===e.address))));r.length&&await this.#nt.synchronize(r)}}(PS,WS,$S,KS,GS,bS,SS,Gl),QS=new class{#h;#B;#ft;#i;constructor(e,t,n,r=Gl){this.#h=e,this.#B=t,this.#ft=n,this.#i=Kl(r,"[👛 WalletService]")}async resolveAccountAddress(e,t,n){this.#i.log("Resolving account address",{keyringAccounts:e,scope:t,request:n});const{method:r,params:o}=n,i=e.filter((e=>e.scopes.includes(t)));if(0===i.length)throw new Error("No accounts with this scope");let a;switch(r){case $t.SignIn:{const{address:e}=o;if(!e)throw new Error("No address");a=e;break}case $t.SignAndSendTransaction:case $t.SignMessage:case $t.SignTransaction:{const{account:e}=o;a=e.address;break}default:throw this.#i.warn({method:r},"Unsupported method"),new Error("Unsupported method")}if(!i.find((e=>e.address===a)))throw new Error("Account not found");return mv(t,a)}#ht(e,t){const{address:n}=e,{account:r}=t.request.params;try{Hs(r.address)}catch{throw new Error("Invalid Solana address format")}if(r.address!==n)throw new Error("The requested account and/or method has not been authorized by the user.")}async signTransaction(e,t){this.#i.log("Signing transaction",{account:e,request:t}),M(t.request,Gf),M(t.scope,gd),this.#ht(e,t);const{transaction:n,scope:r,options:o}=t.request.params,i=o?.minContextSlot?{minContextSlot:BigInt(o.minContextSlot)}:void 0,a=await this.#B.partiallySignBase64String(n,e,r,i),s=(e=>nu(e,Hu().encode,zs().decode))(a),c={signedTransaction:s};M(c,Zf);const u=Qu(a);return await this.#ft.monitor(u,e.id,"confirmed",r,t.origin),c}async signAndSendTransaction(e,t,n,r,o){this.#i.log("Signing and sending transaction",e);const i=o?.minContextSlot?{minContextSlot:BigInt(o.minContextSlot)}:void 0,a=await this.#B.partiallySignBase64String(t,e,n,i),s=Qu(a),c=function({rpc:e}){return async function(t,n){await Fm({...n,rpc:e,transaction:t})}}({rpc:this.#h.getRpc(n)}),u=pv(n,"tx",s);this.#i.info(`Sending transaction: ${u}`),el(a);const l={...o?.preflightCommitment?{preflightCommitment:o.preflightCommitment}:{},...o?.minContextSlot?{minContextSlot:BigInt(o.minContextSlot)}:{},...o?.maxRetries?{maxRetries:BigInt(o.maxRetries)}:{},skipPreflight:o?.skipPreflight??!0,commitment:"confirmed"};await c(a,l),await this.#ft.monitor(s,e.id,o?.commitment??"confirmed",n,r);const d={signature:s};return M(d,Hf),d}async signMessage(e,t){this.#i.log("Signing message",e,t),M(t.request,Kf);const{address:n,entropySource:r,derivationPath:o}=e,i=Hs(n),{scope:a}=t;M(a,gd),this.#ht(e,t);const{message:s}=t.request.params,c=js().encode(s),u=function(e,t={}){return Object.freeze({content:"string"==typeof e?(new ml).encode(e):e,signatures:Object.freeze({...t})})}($s().decode(c)),{privateKeyBytes:l}=await iy({entropySource:r,derivationPath:o}),d=await dl(l),[f]=await d.signMessages([u]);M(f,ee());const h=f[i];var p;M(h,(p=Uint8Array,D("instance",(e=>e instanceof p||`Expected a \`${p.name}\` instance, but received: ${R(e)}`))));const g={signature:Rs().decode(h),signedMessage:s,signatureType:"ed25519"};return M(g,Jf),g}async signIn(e,t){this.#i.log("Signing in",e,t),M(t.request,Vf);const{address:n}=e,{params:r}=t.request,o=this.#pt(r),i=$s().encode(o),a=js().decode(i),s={id:globalThis.crypto.randomUUID(),scope:t.scope,account:e.id,origin:t.origin,request:{method:$t.SignMessage,params:{account:{address:n},message:a}}},c={account:{address:n},...await this.signMessage(e,s)};return M(c,Yf),c}async verifySignature(e,t,n){this.#i.log("Verifying signature",{account:e,signatureBase58:t,messageBase64:n}),M(t,vd),M(n,wd);const r=Ps().encode(t),o=js().encode(n),{privateKeyBytes:i}=await iy({entropySource:e.entropySource,derivationPath:e.derivationPath}),a=await dl(i);return await yc(a.keyPair.publicKey,r,o)}#pt(e){const{domain:t,address:n,statement:r,uri:o,version:i,chainId:a,nonce:s,issuedAt:c,expirationTime:u,notBefore:l,requestId:d,resources:f}=e;let h=`${t??""} wants you to sign in with your Solana account:\n`;h+=`${n??""}`,r&&(h+=`\n\n${r}`);const p=[];if(o&&p.push(`URI: ${o}`),i&&p.push(`Version: ${i}`),a&&p.push(`Chain ID: ${a}`),s&&p.push(`Nonce: ${s}`),c&&p.push(`Issued At: ${c}`),u&&p.push(`Expiration Time: ${u}`),l&&p.push(`Not Before: ${l}`),d&&p.push(`Request ID: ${d}`),f&&f.length>0){p.push("Resources:");for(const e of f)p.push(`- ${e}`)}return p.length&&(h+=`\n\n${p.join("\n")}`),h}}(_S,NS,JS,Gl),XS=new class{#U;#i;#Le;#Ue;#gt;#mt;#yt;#vt;constructor({state:e,logger:t,transactionsService:n,assetsService:r,walletService:o,confirmationHandler:i,keyringAccountMonitor:a,nameResolutionService:s}){this.#U=e,this.#i=Kl(t,"[🔑 Keyring]"),this.#Le=n,this.#Ue=r,this.#gt=o,this.#mt=i,this.#yt=a,this.#vt=s}async listAccounts(){try{const e=await this.#U.getKey("keyringAccounts")??{};return(0,_d.sortBy)(Object.values(e),["entropySource","index"])}catch(e){throw this.#i.error({error:e},"Error listing accounts"),new Error("Error listing accounts")}}async getAccount(e){try{zy({accountId:e},ud);const t=await this.#U.getKey(`keyringAccounts.${e}`);return t&&(t.domain=await this.#vt.resolveAddress(Xl.Mainnet,t.address)),t}catch(e){throw this.#i.error({error:e},"Error getting account"),new $r(e)}}async getAccountOrThrow(e){const t=await this.getAccount(e);if(!t)throw new Error(`Account "${e}" not found`);return t}#wt(e,t){return function(e){if(0===e.length)return 0;const t=e.map((e=>e.index)).sort(((e,t)=>e-t));let n=0;for(const e of t){if(e!==n)break;n+=1}return n}(e.filter((e=>e.entropySource===t)))}#At(e){return`m/44'/501'/${e}'/0'`}#bt(e){const t=e.split("/")[3];if(!t)throw new Error("Invalid derivation path");const n=parseInt(t.replace("'",""),10);return M(n,Z()),n}async#St(){const e=(await async function(){return await snap.request({method:"snap_listEntropySources"})}()).find((({primary:e})=>e));if(!e)throw new Error("No default entropy source found - this can never happen");return e.id}async createAccount(e){const t=globalThis.crypto.randomUUID();try{const n=await this.listAccounts(),r=e?.entropySource??await this.#St(),o=e?.derivationPath?this.#bt(e.derivationPath):this.#wt(n,r),i=e?.derivationPath?e.derivationPath:this.#At(o),a=n.find((e=>e.derivationPath===i&&e.entropySource===r));if(a)return this.#i.warn("An account already exists with the same derivation path and entropy source. Skipping account creation."),Zm(a);const{publicKeyBytes:s}=await iy({entropySource:r,derivationPath:i}),c=Js().decode(s.slice(1)),{importedAccount:u,accountNameSuggestion:l,metamask:d,...f}=e??{},h={id:t,entropySource:r,derivationPath:i,index:o,type:dt.DataAccount,address:c,domain:null,scopes:[Lt.Mainnet,Lt.Testnet,Lt.Devnet],options:{...f,entropySource:r,derivationPath:i,index:o},methods:[$t.SignAndSendTransaction,$t.SignTransaction,$t.SignMessage,$t.SignIn]};await this.#U.setKey(`keyringAccounts.${h.id}`,h);const p=await this.#Ue.fetch(h);await this.#Ue.saveMany(p),await this.#yt.monitorKeyringAccount(h);const g=Zm(h);return await this.emitEvent(gn.AccountCreated,{account:g,accountNameSuggestion:l??`Solana Account ${o+1}`,displayAccountNameSuggestion:!l,displayConfirmation:!1,...d?{metamask:d}:{}}),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:Uy.OnSyncAccountTransactions,params:{accountId:t}}}}),g}catch(e){throw this.#i.error({error:e},"Error creating account"),await this.#Et(t),new Error(`Error creating account: ${e.message}`)}}async#Et(e){await Promise.all([this.#U.deleteKey(`keyringAccounts.${e}`),this.#U.deleteKey(`transactions.${e}`),this.#U.deleteKey(`assets.${e}`)])}async deleteAccount(e){try{zy({accountId:e},ld);const t=await this.getAccountOrThrow(e);await this.emitEvent(gn.AccountDeleted,{id:e}),await Promise.allSettled([this.#Et(e),this.#yt.stopMonitorKeyringAccount(t)])}catch(e){throw this.#i.error({error:e},"Error deleting account"),e}}async listAccountAssets(e){try{zy({accountId:e},dd);const t=await this.getAccountOrThrow(e),n=(await this.#Ue.findByAccount(t)).filter((e=>e.assetType.endsWith(rd.SOL)||Number(e.rawAmount)>0)).map((e=>e.assetType));return jy(n,nn),n}catch(e){throw this.#i.error({error:e},"Error listing account assets"),e}}async getAccountBalances(e,t){try{zy({accountId:e,assets:t},fd);const n=await this.getAccountOrThrow(e),r=(await this.#Ue.findByAccount(n)).filter((e=>t.includes(e.assetType))).filter((e=>e.assetType.endsWith(rd.SOL)||Number(e.rawAmount)>0)).reduce(((e,t)=>(e[t.assetType]={unit:t.symbol,amount:t.uiAmount},e)),{});return jy(r,pd),r}catch(e){throw this.#i.error({error:e},"Error getting account balances"),e}}async emitEvent(e,t){await vn(snap,e,t)}async filterAccountChains(e,t){throw new Error(`Implement me! ${e} ${t.toString()}`)}async updateAccount(e){throw new Error(`Implement me! ${JSON.stringify(e)}`)}async submitRequest(e){return{pending:!1,result:await this.#kt(e)}}async#kt(e){M(e,Dy);const{request:{method:t,params:n},scope:r,account:o,origin:i}=e,a=await this.getAccountOrThrow(o);if(!a.scopes.includes(r))throw new Error(`Scope "${r}" is not allowed for this account`);if(!a.methods.includes(t))throw new Error(`Method "${t}" is not allowed for this account`);if("scope"in n&&r!==n.scope)throw new Error(`Scope "${r}" does not match "${n.scope}" in request.params`);if(!await this.#mt.handleKeyringRequest(e,a))throw new ao;switch(t){case $t.SignAndSendTransaction:{const{transaction:e,options:t}=n;return this.#gt.signAndSendTransaction(a,e,r,i,t)}case $t.SignTransaction:return this.#gt.signTransaction(a,e);case $t.SignMessage:return this.#gt.signMessage(a,e);case $t.SignIn:return this.#gt.signIn(a,e);default:throw new Jr(`Unsupported method: ${t}`)}}async listAccountTransactions(e,t){try{zy({accountId:e,pagination:t},hd);const{limit:n,next:r}=t,o=await this.getAccount(e);if(!o)throw new Error("Account not found");const i=await this.#Le.findByAccounts([o]),a=r?i.findIndex((e=>e.id===r)):0,s=i.slice(a,a+n),c=a+t.limit<i.length;return{data:s,next:c?i[a+t.limit]?.id??null:null}}catch(e){throw this.#i.error({error:e},"Error listing account transactions"),e}}async resolveAccountAddress(e,t){try{M(e,gd);const{method:n,params:r}=t,o={method:n,params:r};M(o,Qf);const i=await this.listAccounts();return{address:await this.#gt.resolveAccountAddress(i,e,o)}}catch(e){return this.#i.error({error:e},"Error resolving account address"),null}}async discoverAccounts(e,t,n){try{M({scopes:e,entropySource:t,groupIndex:n},Ly);const r=this.#At(n),{publicKeyBytes:o}=await iy({entropySource:t,derivationPath:r}),i=Js().decode(o.slice(1)),a=[];for(const t of e)a.push(this.#Le.fetchLatestSignatures(t,i,{limit:1}));const s=await Promise.all(a);return s.some((e=>e.length>0))?[{type:"bip44",scopes:e,derivationPath:r}]:[]}catch(e){throw this.#i.error({error:e},"Error discovering accounts"),e}}}({state:ES,transactionsService:KS,logger:Gl,assetsService:$S,walletService:QS,confirmationHandler:ZS,keyringAccountMonitor:YS,nameResolutionService:LS}),eE=new class{#h;#i;constructor(e,t=Gl){this.#h=e,this.#i=t}static isMaybeNonFungible(e){const{tokenAmount:t}=e,{decimals:n}=t;return!1}}(_S,Gl),tE=new class{#h;#It;#i;#v;#Tt;#_t;#Ue;#Ie={minimumBalanceForRentExemption:5*by.Minute};constructor(e,t,n,r,o,i,a){this.#h=e,this.#It=t,this.#v=r,this.#i=Kl(n,"[📬 SendService]"),this.#Tt=o,this.#_t=i,this.#Ue=a}async#xt(e){return Zl((async t=>this.#h.getRpc(e).getMinimumBalanceForRentExemption(BigInt(0)).send().then((e=>To(e.toString())))),this.#v,{functionName:"SendService:getMinimumBalanceForRentExemption",ttlMilliseconds:this.#Ie.minimumBalanceForRentExemption,generateCacheKey:(e,t)=>{const[n]=t;return`${e}:${n}`}})(e)}async confirmSend(e){const{fromAccountId:t,toAddress:n,amount:r,assetId:o}=e.params,i=await this.#It.getAccountOrThrow(t),{chainId:a,assetReference:s}=Fo(o),c=a,u=o===id[c].nativeToken.caip19Id,l=u?this.#Tt:this.#_t;this.#i.log("Confirming send transaction",{fromAccountId:t,toAddress:n,amount:r,assetId:o});const d={from:i,to:Hs(n),amount:r,network:c,...u?{}:{mint:Hs(s)}},f=await l.buildTransactionMessage(d),h=await $m(f),p={id:globalThis.crypto.randomUUID(),scope:c,account:t,origin:Ql,request:{method:$t.SignAndSendTransaction,params:{account:{address:i.address},transaction:h,scope:c}}};return this.#i.log("Submitting keyring request",p),this.#It.submitRequest(p)}async onAddressInput(e){const{params:{value:t}}=e;if(""===t)return{valid:!1,errors:[{code:Ef.Required}]};try{return Hs(t),{valid:!0,errors:[]}}catch(e){return{valid:!1,errors:[{code:Ef.Invalid}]}}}async onAmountInput(e){const{params:{value:t,accountId:n,assetId:r}}=e,o=await this.#It.getAccountOrThrow(n),{chainId:i}=Fo(r),a=i,s=id[a].nativeToken.caip19Id,c=r===s,u=await this.#Ue.findByAccount(o),l=u.find((e=>e.assetType===r)),d=u.find((e=>e.assetType===s));if(!l)throw new Error(`Balance not found for asset ${r} and account ${n}`);if(""===t)return{valid:!1,errors:[{code:Ef.Required}]};const f=$d(l.uiAmount??"0"),h=$d(d?.uiAmount??"0"),p=$d(t),g=await this.#xt(a),m=c?this.#Tt:this.#_t,y=new Mb(m).getFee(),v=To(y.toString());if(h.isZero())return{valid:!1,errors:[{code:Ef.InsufficientBalance}]};if(c){if(p.gt(h))return{valid:!1,errors:[{code:Ef.InsufficientBalance}]};if(p.plus(v).plus(g).gt(h))return{valid:!1,errors:[{code:Ef.InsufficientBalanceToCoverFee}]}}else{if(p.gt(f))return{valid:!1,errors:[{code:Ef.InsufficientBalance}]};if(v.plus(g).gt(h))return{valid:!1,errors:[{code:Ef.InsufficientBalanceToCoverFee}]}}return{valid:!0,errors:[]}}}(_S,XS,Gl,IS,BS,OS,$S),nE=new class{#It;#gt;#i;#Ct;#B;constructor(e,t,n,r,o){this.#It=e,this.#gt=t,this.#i=Kl(n,"[👋 ClientRequestHandler]"),this.#Ct=r,this.#B=o}async handle(e){this.#i.log("Handling client request",e);const{method:t}=e;switch(t){case qd.SignAndSendTransactionWithoutConfirmation:return this.#Rt(e);case qd.ConfirmSend:return this.#Pt(e);case qd.SignAndSendTransaction:return this.#Nt(e);case qd.ComputeFee:return this.#Bt(e);case qd.OnAddressInput:return this.#Ot(e);case qd.OnAmountInput:return this.#Mt(e);default:throw new Jr}}async#Rt(e){try{M(e,Xf)}catch(e){const t=new Gr;throw t.cause=e,t}const{params:{transaction:t,options:n,account:{address:r},scope:o}}=e,i=(await this.#It.listAccounts()).find((e=>e.address===r));if(!i)throw new Gr(`Account not found: ${r}`);return this.#gt.signAndSendTransaction(i,t,o,Ql,n)}async#Nt(e){try{M(e,th)}catch(e){const t=new Gr;throw t.cause=e,t}const{params:{transaction:t,options:n,accountId:r,scope:o}}=e,i=await this.#It.getAccountOrThrow(r),{signature:a}=await this.#gt.signAndSendTransaction(i,t,o,Ql,n),s={transactionId:a};return M(s,nh),s}async#Pt(e){try{M(e,oh)}catch(e){const t=new Gr;throw t.cause=e,t}return await this.#Ct.confirmSend(e)}async#Bt(e){try{M(e,dh)}catch(e){const t=new Gr;throw t.cause=e,t}const{params:{transaction:t,scope:n}}=e,r=await this.#B.getFeeFromBase64StringInLamports(t,n);if(null===r)throw new Error("Failed to get fee for transaction");const o=[{type:kt.Base,asset:{unit:id[n].nativeToken.symbol,type:id[n].nativeToken.caip19Id,amount:Fd(r).toString(),fungible:!0}}];return M(o,fh),o}async#Ot(e){try{M(e,ah)}catch(e){const t=new Gr;throw t.cause=e,t}const t=await this.#Ct.onAddressInput(e);return M(t,uh),t}async#Mt(e){try{M(e,ch)}catch(e){const t=new Gr;throw t.cause=e,t}const t=await this.#Ct.onAmountInput(e);return M(t,uh),t}}(XS,QS,Gl,tE,NS),rE={configProvider:bS,connection:_S,keyring:XS,priceApiClient:MS,state:ES,cache:kS,assetsService:$S,tokenPricesService:DS,transactionHelper:NS,transactionsService:KS,sendSolBuilder:BS,sendSplTokenBuilder:OS,walletService:QS,transactionScanService:HS,analyticsService:TS,confirmationHandler:ZS,nftService:eE,clientRequestHandler:nE,webSocketConnectionService:CS,subscriptionService:PS,eventEmitter:SS,nameResolutionService:LS,accountsService:WS,accountsSynchronizer:GS},oE=ee({id:re(),jsonrpc:J("2.0"),method:J(Uy.OnSyncAccountTransactions),params:ee({accountId:ad})}),iE=ee({id:re(),jsonrpc:J("2.0"),method:J(Uy.OnTransactionAdded),params:ee({accountId:ad,metadata:ee({scope:gd,origin:re()})})}),aE=ee({id:re(),jsonrpc:J("2.0"),method:J(Uy.OnTransactionApproved),params:ee({accountId:ad,metadata:ee({scope:gd,origin:re()})})}),sE=ee({id:re(),jsonrpc:J("2.0"),method:J(Uy.OnTransactionRejected),params:ee({accountId:ad,metadata:ee({scope:gd,origin:re()})})}),cE=nv("Form"),uE=nv("Field"),lE=nv("AccountSelector"),dE=nv("AssetSelector"),fE=({title:e,backButtonName:t})=>Xy(ov,{direction:"horizontal",alignment:"space-between",center:!0,children:[t?Qy(fv,{name:t,children:Qy(Bv,{name:"arrow-left",color:"primary",size:"md"})}):null,Qy(iv,{size:"sm",children:e}),Xy(ov,{direction:"horizontal",children:[Qy(ov,{children:null}),Qy(ov,{children:null}),Qy(ov,{children:null}),Qy(ov,{children:null})]})]}),hE=nv("Input");var pE=function(e){return e.Form="send-form",e.DestinationAccountInput="send-to",e.BackButton="send-back-button",e.SourceAccountSelector="send-account-selector",e.AmountInput="send-amount-input",e.AssetSelector="send-asset-selector",e.SwapCurrencyButton="send-swap-currency",e.MaxAmountButton="send-amount-input-max",e.CancelButton="send-cancel-button",e.SendButton="send-submit-button",e.ClearButton="send-clear-button",e.CloseButton="send-close-button",e}({}),gE=function(e){return e.TOKEN="TOKEN",e.FIAT="USD",e}({});const mE=({name:e,value:t,tokenSymbol:n,currency:r,currencyType:o,locale:i,swapCurrencyButtonDisabled:a=!1})=>{const s=bv(i),c=o===gE.FIAT?r.toUpperCase():n;return Xy(uE,{label:s("send.amountField"),children:[Qy(hE,{name:e,type:"number",min:0,placeholder:"0",step:.01,value:t??void 0}),Xy(ov,{direction:"horizontal",center:!0,children:[Qy(ov,{direction:"vertical",alignment:"center",children:Qy(av,{size:"sm",children:c})}),Qy(fv,{name:pE.SwapCurrencyButton,disabled:a,children:Qy(Bv,{name:"swap-vertical",color:a?"muted":"primary",size:"md"})})]})]})},yE={initial:null,fetching:"default",fetched:"success",error:null},vE=({name:e,value:t,error:n,locale:r,showClearButton:o,disabled:i,domainResolutionStatus:a})=>{const s=bv(r);return Xy(ov,{children:[Xy(uE,{label:s("send.toField"),error:n,children:[Qy(hE,{name:e,placeholder:i?"":s("send.toPlaceholder"),value:t??void 0,disabled:i}),o?Qy(ov,{children:Qy(fv,{name:pE.ClearButton,children:Qy(Bv,{name:Nv.Close,color:"primary"})})}):null]}),a&&null!==yE[a]&&Qy(av,{size:"sm",color:yE[a],children:s(`send.toDomainResolutionStatus.${a}`)})]})},wE=e=>{const{amount:t,tokenPrices:n,tokenCaipId:r,currencyType:o}=e,i=n?.[r]?.price;if(o===gE.TOKEN)return t;if(void 0===i)throw new Error("Token price is undefined, cannot convert to fiat amount.");return null===t?null:_o(t).dividedBy(_o(i)).toString()},AE=e=>{const{selectedTokenMetadata:t}=e;return{...t??{},tokenSymbol:t?.symbol??"UNKNOWN",tokenImage:t?.imageSvg??mS}},bE=e=>{const{tokenCaipId:t,tokenPrices:n}=e;return n?.[t]?.price},SE=e=>{const{balances:t,fromAccountId:n,tokenCaipId:r}=e;return t?.[n]?.[r]?.amount??"0"},EE=e=>{const{tokenCaipId:t,scope:n}=e;return t===id[n]?.nativeToken?.caip19Id},kE=nv("Spinner"),IE=({title:e,subtitle:t,iconSrc:n,isLoading:r})=>Xy(ov,{alignment:"center",center:!0,children:[Xy(ov,{direction:"horizontal",center:!0,children:[r?Qy(kE,{}):null,n&&!r?Qy(lv,{borderRadius:"full",src:n}):null]}),Qy(iv,{size:"lg",children:e}),t?Qy(av,{color:"muted",children:t}):null]}),TE=nv("Value"),_E=({context:e})=>{const{scope:t,fromAccountId:n,toAddress:r,accounts:o,feeEstimatedInSol:i,preferences:{locale:a,currency:s},transaction:c,feePaidInSol:u,tokenPrices:l,fromDomain:d,toDomain:f}=e,h=bv(a),p=id[t],g=o.find((e=>e.id===n))?.address,m=mv(t,g),y=p.name,v=p.nativeToken.symbol,w=l[p.nativeToken.caip19Id]?.price,A=c?u:i,b=A?tw(A,v,a):"",S=void 0===w||null===A?"":Cv(nw(A,w),s,a);return Xy(ov,{children:[Xy(sv,{children:[Qy(cv,{label:h("send.confirmation.from"),children:d?Qy(gv,{domain:d,scope:t,address:g}):Qy(hv,{href:pv(t,"address",g),children:Qy(uv,{address:m,displayName:!0})})}),r?Qy(cv,{label:h("send.confirmation.recipient"),children:f?Qy(gv,{domain:f,scope:t,address:r}):Qy(hv,{href:pv(t,"address",r),children:Qy(uv,{address:mv(t,r),displayName:!0})})}):null]}),Xy(sv,{children:[Qy(cv,{label:h("send.confirmation.network"),children:Qy(av,{children:y})}),Qy(cv,{label:h("send.confirmation.transactionSpeed"),children:Qy(av,{children:"<1s"})}),Qy(cv,{label:h("send.confirmation.fee"),children:Qy(TE,{extra:S,value:b})})]})]})};var xE=function(e){return e.BackButton="transaction-confirmation-back-button",e.CancelButton="transaction-confirmation-cancel-button",e.ConfirmButton="transaction-confirmation-submit-button",e}({});const CE={"send-form":({context:e,inputToAddress:t,inputAmount:n})=>{const{accounts:r,fromAccountId:o,amount:i,destinationAddressOrDomain:a,domainResolutionStatus:s,validation:c,currencyType:u,tokenCaipId:l,scope:d,balances:f,tokenPricesFetchStatus:h,buildingTransaction:p,error:g,loading:m,transactionMessage:y,preferences:{locale:v,currency:w}}=e,A=bv(v),b=f[o]?.[l],S=b?.amount,E=b?.unit??"",k=void 0!==S,I=r.find((e=>e.id===o)),T=I?.address?mv(d,I.address):void 0,_=bE(e),x=void 0===S||"0"===S,C=void 0===_,R="error"===h||"fetched"===h&&C,P=(k?{[gE.FIAT]:Cv(nw(S,_??0),w,v),[gE.TOKEN]:tw(S,E,v)}:{[gE.FIAT]:"",[gE.TOKEN]:""})[u],N=o.length>0&&!!a&&a.length>0&&sf(c?.[pE.DestinationAccountInput]),B=!sf(y)&&""!==y,O=Boolean(a&&a.length>0),M=Boolean(c?.[pE.AmountInput]?.message),z=M?c?.[pE.AmountInput]?.message??"":`${A("send.balance")}: ${P}`,j=o.length>0&&!!i&&i.length>0&&!!a&&a.length>0&&Object.values(c).every(sf)&&k&&!p&&B;return Xy(rv,{backgroundColor:"alternative",children:[Xy(ov,{children:[Qy(fE,{title:A("send.title"),backButtonName:pE.BackButton}),Xy(cE,{name:pE.Form,children:[R&&Qy(Jv,{title:"",severity:"info",children:Qy(av,{children:A("send.selectedTokenPriceNotAvailable",{currency:w})})}),Qy(ov,{children:null}),Qy(ov,{children:null}),Qy(ov,{children:null}),Qy(uE,{label:A("send.fromField"),error:c?.[pE.SourceAccountSelector]?.message??"",children:Qy(lE,{name:pE.SourceAccountSelector,chainIds:[d],value:T??void 0,hideExternalAccounts:!0,switchGlobalAccount:!0})}),Qy(ov,{children:null}),Qy(ov,{children:null}),Qy(ov,{children:null}),Qy(vE,{locale:v,disabled:m,name:pE.DestinationAccountInput,value:t??null,showClearButton:O,domainResolutionStatus:s,error:c?.[pE.DestinationAccountInput]?.message??""}),N&&Xy(ov,{children:[Qy(ov,{children:null}),Qy(ov,{children:null}),Qy(ov,{children:null}),Xy(ov,{direction:"horizontal",children:[Qy(uE,{label:A("send.assetField"),children:Qy(dE,{chainIds:[d],value:l,name:pE.AssetSelector,addresses:T?[T]:[]})}),Qy(mE,{name:pE.AmountInput,currencyType:u,tokenSymbol:E,currency:w,value:n??null,locale:v,swapCurrencyButtonDisabled:C||x})]}),Xy(ov,{direction:"horizontal",alignment:"space-between",crossAlignment:"start",children:[Qy(ov,{direction:"vertical",alignment:"start",children:Qy(av,{size:"sm",color:M?"error":"muted",children:z})}),Qy(fv,{size:"sm",name:pE.MaxAmountButton,disabled:x,children:A("send.maxButton")})]})]}),g&&Xy(ov,{children:[Qy(ov,{children:null}),Qy(Jv,{title:A(g.title),severity:"warning",children:Qy(av,{children:A(g.message)})})]})]})]}),Xy(dv,{children:[Qy(fv,{name:pE.CancelButton,children:A("send.cancelButton")}),Qy(fv,{name:pE.SendButton,disabled:!j,loading:p,children:A("send.continueButton")})]})]})},"transaction-confirmation":({context:e})=>{const{preferences:{currency:t,locale:n}}=e,r=bv(n),{tokenImage:o,tokenSymbol:i}=AE(e),a=wE(e),s=bE(e),c=void 0===s?"":Cv(nw(a??"0",s),t,n);return Xy(rv,{children:[Xy(ov,{children:[Qy(fE,{title:r("send.confirmation.title"),backButtonName:"transaction-confirmation-back-button"}),Qy(IE,{title:tw(a??"0",i,n),subtitle:c,iconSrc:o}),Qy(_E,{context:e})]}),Xy(dv,{children:[Qy(fv,{name:"transaction-confirmation-cancel-button",children:r("send.confirmation.cancelButton")}),Qy(fv,{name:"transaction-confirmation-submit-button",loading:e.loading,disabled:e.loading,children:r("send.confirmation.sendButton")})]})]})},"send-pending":({context:e})=>{const t=bv(e.preferences.locale);return Qy(rv,{children:Xy(ov,{children:[Qy(ov,{children:null}),Qy(IE,{title:t("send.send-pending.title"),subtitle:t("send.send-pending.subtitle"),isLoading:!0}),Qy(_E,{context:e})]})})},"transaction-success":({context:e})=>{const{preferences:t,transaction:n,scope:r}=e,o=bv(t.locale),{tokenSymbol:i}=AE(e),a=wE(e);return Qy(rv,{children:Xy(ov,{children:[Qy(ov,{children:null}),Qy(IE,{title:o("send.transaction-success.title"),subtitle:o("send.transaction-success.subtitle",{amount:xv(a??"0",t.locale),tokenSymbol:i}),iconSrc:'<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M24.0002 3.99902C12.9802 3.99902 4.00024 12.979 4.00024 23.999C4.00024 35.019 12.9802 43.999 24.0002 43.999C35.0202 43.999 44.0002 35.019 44.0002 23.999C44.0002 12.979 35.0202 3.99902 24.0002 3.99902ZM33.5602 19.399L22.2202 30.739C21.9402 31.019 21.5602 31.179 21.1602 31.179C20.7602 31.179 20.3802 31.019 20.1002 30.739L14.4402 25.079C13.8602 24.499 13.8602 23.539 14.4402 22.959C15.0202 22.379 15.9802 22.379 16.5602 22.959L21.1602 27.559L31.4402 17.279C32.0202 16.699 32.9802 16.699 33.5602 17.279C34.1402 17.859 34.1402 18.799 33.5602 19.399Z" fill="#1C8234"/>\n</svg>\n'}),Qy(_E,{context:e}),n?.signature?Qy(ov,{alignment:"center",center:!0,children:Qy(hv,{href:pv(r,"tx",n?.signature),children:o("send.confirmation.viewTransaction")})}):null]})})},"transaction-failure":({context:e})=>{const{preferences:t}=e,n=bv(t.locale),{tokenSymbol:r}=AE(e),o=wE(e);return Qy(rv,{children:Xy(ov,{children:[Qy(ov,{children:null}),Qy(IE,{title:n("send.transaction-failure.title"),subtitle:n("send.transaction-failure.subtitle",{amount:o??"0",tokenSymbol:r}),iconSrc:'<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M40.8277 29.5283L29.7931 8.40143C28.3104 5.55884 26.2586 4 24 4C21.7414 4 19.6896 5.55884 18.2069 8.40143L7.17228 29.5283C5.77572 32.2241 5.62055 34.81 6.74125 36.8456C7.86194 38.8813 10.0689 40 12.9654 40H35.0346C37.9311 40 40.1381 38.8813 41.2588 36.8456C42.3795 34.81 42.2243 32.2058 40.8277 29.5283ZM22.7069 16.8375C22.7069 16.0856 23.2931 15.462 24 15.462C24.7069 15.462 25.2931 16.0856 25.2931 16.8375V26.0071C25.2931 26.759 24.7069 27.3826 24 27.3826C23.2931 27.3826 22.7069 26.759 22.7069 26.0071V16.8375ZM25.2241 32.811C25.1379 32.8844 25.0517 32.9577 24.9655 33.0311C24.8621 33.1044 24.7586 33.1595 24.6552 33.1961C24.5517 33.2511 24.4483 33.2878 24.3276 33.3062C24.2241 33.3245 24.1034 33.3428 24 33.3428C23.8965 33.3428 23.7759 33.3245 23.6552 33.3062C23.5517 33.2878 23.4483 33.2511 23.3448 33.1961C23.2414 33.1595 23.1379 33.1044 23.0345 33.0311C22.9483 32.9577 22.8621 32.8844 22.7759 32.811C22.4655 32.4626 22.2758 31.9857 22.2758 31.5089C22.2758 31.0321 22.4655 30.5553 22.7759 30.2068C22.8621 30.1335 22.9483 30.0601 23.0345 29.9868C23.1379 29.9134 23.2414 29.8584 23.3448 29.8217C23.4483 29.7667 23.5517 29.73 23.6552 29.7117C23.8793 29.6567 24.1207 29.6567 24.3276 29.7117C24.4483 29.73 24.5517 29.7667 24.6552 29.8217C24.7586 29.8584 24.8621 29.9134 24.9655 29.9868C25.0517 30.0601 25.1379 30.1335 25.2241 30.2068C25.5345 30.5553 25.7241 31.0321 25.7241 31.5089C25.7241 31.9857 25.5345 32.4626 25.2241 32.811Z" fill="#BF5208"/>\n</svg>\n'}),Qy(_E,{context:e})]})})}},RE=({context:e,inputToAddress:t,inputAmount:n})=>{const r=e.stage??"send-form";return Qy(CE[r],{context:e,inputToAddress:t,inputAmount:n})};function PE(e){if(!e)return!1;return/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*\.sol$/u.test(e)}function NE(e,t,n){return n[e]?n[e]?.map((e=>e(t))).find((e=>null!==e))??null:null}function BE(e){const t=UE(e),n={[pE.SourceAccountSelector]:e.fromAccountId,[pE.AmountInput]:e.amount,[pE.DestinationAccountInput]:e.toAddress};return Object.entries(t).every((([e,t])=>{const r=n[e];return!!r&&t.every((e=>null===e(r)))}))}const OE=(e,t)=>{const n=bv(t);return t=>{const r=""===t?{message:n(e),value:t}:null;return r?{message:r.message,value:t}:null}},ME=(e,t)=>{const n=bv(t);return t=>{try{return PE(t)||Hs(t),null}catch{return{message:n(e),value:t}}}},zE=e=>{const{minimumBalanceForRentExemptionSol:t,preferences:{locale:n},feeEstimatedInSol:r,selectedTokenMetadata:o}=e,i=bv(n);return n=>{if(""===n)return{message:"",value:n};const a=wE({...e,amount:n}),s=$d(a??"0"),c=SE(e),u=$d(c),l=$d(r??"0"),d=$d(t??"0"),f=(e=>SE({...e,tokenCaipId:id[e.scope].nativeToken.caip19Id}))(e),h=$d(f),p=EE(e);if(s.gt(u))return{message:`${i("send.insufficientBalance")}: ${c} ${o?.symbol??""}`,value:n};if(p){if(s.lt(d))return{message:i("send.amountGreatherThanMinimumBalanceForRentExemptionError",{minimumValue:t}),value:n};if(s.plus(l).plus(d).gt(u))return{message:i("send.insuffientSolToCoverFee"),value:n}}else{if(l.plus(d).gt(h))return{message:i("send.insuffientSolToCoverFee"),value:n}}return s.isZero()?{message:"",value:n}:h.isZero()?{message:i("send.insuffientSolToCoverFee"),value:n}:null}},jE=ee({scope:H([...Object.values(Xl)]),account:ad,assetId:te(Do)}),UE=e=>({[pE.SourceAccountSelector]:[OE("send.fromRequiredError",e.preferences.locale)],[pE.AmountInput]:[zE(e),OE("send.amountRequiredError",e.preferences.locale)],[pE.DestinationAccountInput]:[OE("send.toRequiredError",e.preferences.locale),ME("send.toInvalidError",e.preferences.locale)]}),DE={scope:Xl.Mainnet,fromAccountId:"",fromDomain:null,amount:"",destinationAddressOrDomain:null,toDomain:null,toAddress:null,domainResolutionStatus:null,feeEstimatedInSol:"0",feePaidInSol:"0",tokenCaipId:ed.SolMainnet,accounts:[],currencyType:gE.TOKEN,validation:{},balances:{},assets:[],tokenPrices:{},selectedTokenMetadata:null,tokenPricesFetchStatus:"initial",preferences:{locale:"en",currency:"usd",hideBalances:!1,useSecurityAlerts:!0,useExternalPricingData:!0,simulateOnChainActions:!0,useTokenDetection:!0,batchCheckBalances:!0,displayNftMedia:!0,useNftDetection:!0},error:null,buildingTransaction:!1,transactionMessage:null,transaction:null,stage:"send-form",minimumBalanceForRentExemptionSol:"0.002",loading:!0},LE={[Uy.OnTransactionAdded]:async({request:e})=>{try{Gl.info("[onTransactionAdded] Cronjob triggered",e),M(e,iE);const{accountId:t,metadata:n}=e.params,r=await XS.getAccountOrThrow(t);await TS.trackEventTransactionAdded(r,n)}catch(e){throw Gl.error(e),new Vr(e)}},[Uy.OnTransactionApproved]:async({request:e})=>{try{Gl.info("[onTransactionApproved] Cronjob triggered",e),M(e,aE);const{accountId:t,metadata:n}=e.params,r=await XS.getAccountOrThrow(t);await TS.trackEventTransactionApproved(r,n)}catch(e){throw Gl.error(e),new Vr(e)}},[Uy.OnTransactionRejected]:async({request:e})=>{try{Gl.info("[onTransactionRejected] Cronjob triggered",e),M(e,sE);const{accountId:t,metadata:n}=e.params,r=await XS.getAccountOrThrow(t);await TS.trackEventTransactionRejected(r,n)}catch(e){throw Gl.error(e),new Vr(e)}},[Uy.OnSyncAccountTransactions]:async({request:e})=>{M(e,oE);const{accountId:t}=e.params,n=await WS.findById(t);if(!n)throw new Error("Account not found");const r=await $S.fetch(n),o=await KS.fetchAssetsTransactions(r,{limit:20});await KS.saveMany(o)},[Uy.RefreshSend]:async()=>{const e=Kl(Gl,"[refreshSend]");e.info("Background event triggered");const[t,n,r]=await Promise.all([$S.getAll(),ES.getKey("mapInterfaceNameToId"),py().catch((()=>DE.preferences))]),o=t.flatMap((e=>e.assetType)),i=n?.[cy];if(!i)return void e.info("No send form interface found");const a=await gy(i),s=await MS.getMultipleSpotPrices(o,r.currency);await ES.setKey("tokenPrices",s);const c={...a,tokenPrices:{...a.tokenPrices,...s}};await dy(i,Qy(RE,{context:c}),c),e.info("✅ Background event suceeded"),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT30S",request:{method:"refreshSend"}}})},[Uy.RefreshConfirmationEstimation]:async()=>{const e=Kl(Gl,"[refreshConfirmationEstimation]");e.info("Background event triggered");const t=(await ES.getKey("mapInterfaceNameToId")??{})[uy];if(!t)return void e.info("No interface context found");const n=await gy(t);try{if(!(n.account?.address&&n.transaction&&n.scope&&n.method))return void e.info("Context is missing required fields");if(!n.preferences?.simulateOnChainActions)return void e.info("Transaction simulation is disabled in preferences");const r={...n,scanFetchStatus:"fetching"};await dy(t,Qy(ow,{context:r}),r);const[o,i]=await Promise.all([HS.scanTransaction({method:n.method,accountAddress:n.account.address,transaction:n.transaction,scope:n.scope,origin:n.origin,account:n.account}),gy(t)]),a={...i,scanFetchStatus:"fetched",scan:o};e.info("New scan fetched"),await dy(t,Qy(ow,{context:a}),a),e.info("Background event suceeded"),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT20S",request:{method:"refreshConfirmationEstimation"}}})}catch(n){const r={...await gy(t),scanFetchStatus:"fetched"};await dy(t,Qy(ow,{context:r}),r),e.warn({error:n},"Could not update the interface. But rolled back status to fetched.")}}},FE={...LE};var $E={};const qE=ee({chainId:gd,domain:te(re()),address:te(re())}),WE="Solana Name Service",VE={[Sy.GetFeeForTransaction]:async({request:e})=>{M(e.params,md);const{transaction:t,scope:n}=e.params;try{const e=await NS.getFeeFromBase64StringInLamports(t,n);if(null===e)throw new Error("Failed to get fee for transaction");const r={value:e.toString()};return M(r,yd),r}catch(e){throw Gl.error(e),new Vr(e)}},[Sy.StartSendTransactionFlow]:async({request:e})=>{const{params:t}=e;M(t,jE);const{scope:n,account:r}=t,o=t.assetId??id[n].nativeToken.caip19Id,i={...DE,scope:n,fromAccountId:r,tokenCaipId:o,loading:!0},[a,s,c,u]=await Promise.all([$S.getAll(),WS.getAll(),ES.getKey("tokenPrices"),py().catch((()=>DE.preferences))]);i.balances=function(e,t){return t.filter((t=>{const n=t.assetType===id[e].nativeToken.caip19Id,r=t.assetType.startsWith(e),o="0"!==t.rawAmount;return n||r&&o})).reduce(((e,t)=>(e[t.keyringAccountId]={...e[t.keyringAccountId],[t.assetType]:{unit:t.symbol,amount:t.uiAmount}},e)),{})}(n,a),i.assets=a.map((e=>e.assetType)),i.accounts=s,i.preferences=u,i.tokenPrices=c??{};const l=await ly(Qy(RE,{context:i}),i),d=hy(l),f=$S.getAssetsMetadata([i.tokenCaipId]).then((e=>{const t=e[i.tokenCaipId];t?.symbol&&t?.name&&(i.selectedTokenMetadata={symbol:t.symbol,name:t.name,asset:i.tokenCaipId,imageSvg:null})})).catch((()=>null));let h;i.preferences.useExternalPricingData?h=MS.getMultipleSpotPrices(i.assets,i.preferences.currency).then((e=>{i.tokenPrices={...i.tokenPrices,...e},i.tokenPricesFetchStatus="fetched"})).catch((()=>{i.tokenPricesFetchStatus="error"})):i.tokenPricesFetchStatus="fetched";const p=_S.getRpc(n).getMinimumBalanceForRentExemption(BigInt(0)).send().then((e=>{i.minimumBalanceForRentExemptionSol=Fd(e).toString()})).catch((()=>{}));return i.loading=!0,await dy(l,Qy(RE,{context:i}),i),i.loading=!1,await Promise.all([h,f,p]),await dy(l,Qy(RE,{context:i}),i),await ES.setKey(`mapInterfaceNameToId.${cy}`,l),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT30S",request:{method:"refreshSend"}}}),d},[Ey.ListWebSockets]:async()=>(await SS.emitSync("onListWebSockets"),null),[Ey.ListSubscriptions]:async()=>(await SS.emitSync("onListSubscriptions"),null),[Ey.TestOnStart]:async()=>(await SS.emitSync("onStart"),null),[Ey.TestOnInstall]:async()=>(await SS.emitSync("onInstall"),null),[Ey.TestOnUpdate]:async()=>(await SS.emitSync("onUpdate"),null),[Ey.SynchronizeAccounts]:async()=>(await GS.synchronize(),null)};const KE=async e=>{try{return await e()}catch(e){const t=function(e){return[$r,Jr,ao,Yr,Jr,Qr,Xr,eo,to,no,ro,oo,io,Vr,Kr,Gr,Hr,Zr].some((t=>e instanceof t))}(e)?e:new $r(e);throw Gl.error({error:t},`[SnapError] ${JSON.stringify(t.toJSON(),null,2)}`),t}};var GE=n(4255),HE=n.n(GE),ZE=n(3804),JE=n.n(ZE);class YE extends Error{constructor(e="Operation cancelled"){super(e),this.name="CancellationError"}}const QE=JE()((async(e,t)=>{try{if(!BE(t))return;const n={buildingTransaction:!0,transactionMessage:null,feeEstimatedInSol:null};await dy(e,Qy(RE,{context:{...t,...n}}),{...t,...n});const{feeInLamports:r,base64EncodedTransactionMessage:o}=await(async e=>{const{fromAccountId:t,tokenCaipId:n,scope:r,toAddress:o}=e,i=wE(e),a=await XS.getAccountOrThrow(t);if(!o||!i)throw new Error("Invalid transaction parameters");const s=n===id[r].nativeToken.caip19Id,c=s?BS:OS,u=new Mb(c),l={from:a,to:Hs(o),amount:i,network:r,...s?{}:{mint:Hs(Fo(n).assetReference)}},d=await c.buildTransactionMessage(l),f=await $m(d);return{feeInLamports:u.getFee(),base64EncodedTransactionMessage:f}})(t),i={transactionMessage:o,feeEstimatedInSol:r?Fd(r).toString():null,buildingTransaction:!1},a=await gy(e);await dy(e,Qy(RE,{context:{...a,...i}}),{...a,...i})}catch(t){Gl.error("Could not build the send transaction",t);const n={error:{title:"send.simulationTitleError",message:"send.simulationMessageError"},transactionMessage:null,feeEstimatedInSol:null,buildingTransaction:!1},r=await gy(e);await dy(e,Qy(RE,{context:{...r,...n}}),{...r,...n})}}),(function(e){const t=(e=>(...t)=>{const n=new AbortController,r=[...t];r.some((e=>e instanceof AbortSignal))||r.push(n.signal);const o=Promise.race([e(...r),new Promise(((e,t)=>{n.signal.addEventListener("abort",(()=>{t(new YE)}))}))]);return o.cancel=()=>n.abort(),o})(e);let n=null;return async(...e)=>{if(n&&"function"==typeof n.cancel){const e="Cancelling previous task";Gl.warn(e),n.cancel()}const r=t(...e);n=r;try{return await r}finally{n===r&&(n=null)}}}),HE()(500));const XE={[pE.BackButton]:async function({id:e}){await fy(e,!1),await ES.deleteKey(`mapInterfaceNameToId.${cy}`)},[pE.SourceAccountSelector]:async function({id:e,event:t,context:n}){const r=t.value;n.fromAccountId=r.accountId,n.error=null,n.validation[pE.SourceAccountSelector]=NE(pE.SourceAccountSelector,n.fromAccountId,UE(n)),n.amount&&(n.validation[pE.AmountInput]=NE(pE.AmountInput,n.amount,UE(n))),await dy(e,Qy(RE,{context:n}),n),await QE(e,n)},[pE.AmountInput]:async function({id:e,event:t,context:n}){const r={...n};r.amount=t.value,r.error=null;const o=NE(pE.AmountInput,r.amount,UE(r));if(o&&r.validation[pE.AmountInput]?.message!==o?.message)return r.validation[pE.AmountInput]=o,void await dy(e,Qy(RE,{context:r}),r);null===o&&(r.validation[pE.AmountInput]=null,await dy(e,Qy(RE,{context:r}),r),await QE(e,r))},[pE.AssetSelector]:async function({id:e,event:t,context:n}){if("object"!=typeof t.value||!("asset"in t.value))return;const r=t.value.asset;if(n.tokenCaipId===r)return;const o=r===id[n.scope].nativeToken.caip19Id?BS:OS,i=new Mb(o).getFee(),a={tokenCaipId:r,feeEstimatedInSol:Fd(i).toString(),selectedTokenMetadata:{symbol:t.value.symbol,name:t.value.name,asset:t.value.asset,imageSvg:null},amount:"",error:null},s=(0,_d.merge)(n,a);await dy(e,Qy(RE,{context:s,inputAmount:""}),s),await QE(e,n)},[pE.SwapCurrencyButton]:async function({id:e,context:t}){if(t.error=null,t.currencyType=t.currencyType===gE.TOKEN?gE.FIAT:gE.TOKEN,!t.amount)return void await dy(e,Qy(RE,{context:t}),t);const n=_o(t.amount??"0"),{price:r}=t.tokenPrices[t.tokenCaipId]??{price:0};t.currencyType===gE.TOKEN&&(t.amount=n.dividedBy(r).toString()),t.currencyType===gE.FIAT&&(t.amount=n.multipliedBy(r).toString()),await dy(e,Qy(RE,{context:t,inputAmount:t.amount}),t)},[pE.MaxAmountButton]:async function({id:e,context:t}){const{currencyType:n,minimumBalanceForRentExemptionSol:r,tokenCaipId:o,tokenPrices:i}=t,a={...t},s=SE(t);if(EE(t)){const e=$d(s),t=new Mb(BS).getFee().toString(),n=$d(r),o=e.minus(t).minus(n).minus(1),i=_o.maximum(o,o.isNegative()?e:_o(0)),c=Fd(i);a.amount=c.toString()}else a.amount=s;if(n===gE.FIAT){const{price:e}=i[o]??{price:0};a.amount=nw(a.amount,e)}a.error=null,a.validation[pE.AmountInput]=NE(pE.AmountInput,a.amount,UE(a)),await dy(e,Qy(RE,{context:a,inputAmount:a.amount}),a),await QE(e,a)},[pE.DestinationAccountInput]:async function({id:e,event:t,context:n}){const r={...n};r.destinationAddressOrDomain=t.value,r.domainResolutionStatus=null,r.error=null;const o=NE(pE.DestinationAccountInput,r.destinationAddressOrDomain,UE(r));r.validation[pE.DestinationAccountInput]=o,PE(r?.destinationAddressOrDomain)?(r.domainResolutionStatus="fetching",await dy(e,Qy(RE,{context:r}),r),r.toAddress=await LS.resolveDomain(r.scope,r.destinationAddressOrDomain).catch((()=>{const e=bv(r.preferences.locale);return r.validation[pE.DestinationAccountInput]={message:e("send.toInvalidErrorDomain"),value:r.destinationAddressOrDomain??""},null})),r.domainResolutionStatus=r.toAddress?"fetched":"error"):r.toAddress=r.destinationAddressOrDomain,await dy(e,Qy(RE,{context:r}),r),null===o&&await QE(e,r)},[pE.ClearButton]:async function({id:e,context:t}){t.destinationAddressOrDomain="",t.toAddress="",t.domainResolutionStatus=null,t.error=null,t.validation[pE.DestinationAccountInput]=null,await dy(e,Qy(RE,{context:t,inputToAddress:t.toAddress}),t)},[pE.CancelButton]:async function({id:e}){await fy(e,!1),await ES.deleteKey(`mapInterfaceNameToId.${cy}`)},[pE.SendButton]:async function({id:e,context:t}){if(!BE(t))return;const n={...t};n.stage="transaction-confirmation",n.loading=!0,await dy(e,Qy(RE,{context:n}),n);const r=t.accounts.find((e=>e.id===t.fromAccountId))?.address,[o,i,a,s]=await Promise.all([r?LS.resolveAddress(t.scope,r):null,t.toAddress?LS.resolveAddress(t.scope,t.toAddress):null,MS.getMultipleSpotPrices(t.assets,t.preferences.currency).then((e=>e)).catch((()=>null)),t.selectedTokenMetadata?US.generateImageComponent(Td({baseUrl:bS.get().staticApi.baseUrl,path:"/api/v2/tokenIcons/assets/{assetId}.png",pathParams:{assetId:t.selectedTokenMetadata?.asset.replace(/:/gu,"/")},encodePathParams:!1})):null]);n.fromDomain=o,n.toDomain=i,a&&(n.tokenPrices=a),s&&t.selectedTokenMetadata&&(n.selectedTokenMetadata={...t.selectedTokenMetadata,imageSvg:s}),n.loading=!1,await dy(e,Qy(RE,{context:n}),n),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:Uy.OnTransactionAdded,params:{accountId:t.fromAccountId,metadata:{scope:t.scope,origin:Ql}}}}})}};const ek={[xE.BackButton]:async function({id:e,context:t}){const n={...t,stage:"send-form"};await dy(e,Qy(RE,{context:n,inputAmount:t.amount??"",inputToAddress:t.destinationAddressOrDomain??""}),n)},[xE.CancelButton]:async function({id:e,context:t}){const{fromAccountId:n,transactionMessage:r,scope:o}=t;await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:Uy.OnTransactionRejected,params:{accountId:n,metadata:{scope:o,origin:Ql}}}}}),await fy(e,!1),await ES.deleteKey(`mapInterfaceNameToId.${cy}`)},[xE.ConfirmButton]:async function({id:e,context:t}){const{scope:n,fromAccountId:r,feeEstimatedInSol:o,transactionMessage:i}=t;if(t.error=null,!i)return t.stage="send-form",void await dy(e,Qy(RE,{context:t}),t);await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:Uy.OnTransactionApproved,params:{accountId:t.fromAccountId,metadata:{scope:t.scope,origin:Ql}}}}});const a={...t,stage:"send-pending"};await dy(e,Qy(RE,{context:a}),a);let s=null;try{const e=await XS.getAccountOrThrow(r);s=(await QS.signAndSendTransaction(e,i,n,Ql)).signature}catch(e){Gl.error({error:e},"Error submitting request")}const c={...t,stage:s?"transaction-success":"transaction-failure",feePaidInSol:o,transaction:{result:s?"success":"failure",signature:s}};await dy(e,Qy(RE,{context:c}),c),await ES.deleteKey(`mapInterfaceNameToId.${cy}`)}};const tk=2n**255n-19n,nk=2n**252n+27742317777372353535851937790883648493n,rk=0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,ok=0x6666666666666666666666666666666666666666666666666666666666666658n,ik={a:-1n,d:37095705934669439343138083508754565189542113879843219016388785533085940283555n,p:tk,n:nk,h:8,Gx:rk,Gy:ok},ak=(e="")=>{throw new Error(e)},sk=e=>"string"==typeof e,ck=(e,t)=>!(e=>e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name)(e)||"number"==typeof t&&t>0&&e.length!==t?ak("Uint8Array of valid length expected"):e,uk=e=>new Uint8Array(e),lk=(e,t)=>ck(sk(e)?vk(e):uk(ck(e)),t),dk=(e,t=tk)=>{let n=e%t;return n>=0n?n:t+n},fk=e=>e instanceof hk?e:ak("Point expected");class hk{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r}static fromAffine(e){return new hk(e.x,e.y,1n,dk(e.x*e.y))}static fromHex(e,t=!1){const{d:n}=ik,r=(e=lk(e,32)).slice(),o=e[31];r[31]=-129&o;const i=Ak(r);!t||0n<=i&&i<2n**256n||ak("bad y coord 1"),t||0n<=i&&i<tk||ak("bad y coord 2");const a=dk(i*i),s=dk(a-1n),c=dk(n*a+1n);let{isValid:u,value:l}=Ik(s,c);u||ak("bad y coordinate 3");const d=1n===(1n&l),f=0!=(128&o);return!t&&0n===l&&f&&ak("bad y coord 3"),f!==d&&(l=dk(-l)),new hk(l,i,1n,dk(l*i))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}equals(e){const{ex:t,ey:n,ez:r}=this,{ex:o,ey:i,ez:a}=fk(e),s=dk(t*a),c=dk(o*r),u=dk(n*a),l=dk(i*r);return s===c&&u===l}is0(){return this.equals(gk)}negate(){return new hk(dk(-this.ex),this.ey,this.ez,dk(-this.et))}double(){const{ex:e,ey:t,ez:n}=this,{a:r}=ik,o=dk(e*e),i=dk(t*t),a=dk(2n*dk(n*n)),s=dk(r*o),c=e+t,u=dk(dk(c*c)-o-i),l=s+i,d=l-a,f=s-i,h=dk(u*d),p=dk(l*f),g=dk(u*f),m=dk(d*l);return new hk(h,p,m,g)}add(e){const{ex:t,ey:n,ez:r,et:o}=this,{ex:i,ey:a,ez:s,et:c}=fk(e),{a:u,d:l}=ik,d=dk(t*i),f=dk(n*a),h=dk(o*l*c),p=dk(r*s),g=dk((t+n)*(i+a)-d-f),m=dk(p-h),y=dk(p+h),v=dk(f-u*d),w=dk(g*m),A=dk(y*v),b=dk(g*v),S=dk(m*y);return new hk(w,A,S,b)}mul(e,t=!0){if(0n===e)return!0===t?ak("cannot multiply by 0"):gk;if("bigint"==typeof e&&0n<e&&e<nk||ak("invalid scalar, must be < L"),!t&&this.is0()||1n===e)return this;if(this.equals(pk))return Wk(e).p;let n=gk,r=pk;for(let o=this;e>0n;o=o.double(),e>>=1n)1n&e?n=n.add(o):t&&(r=r.add(o));return n}multiply(e){return this.mul(e)}clearCofactor(){return this.mul(BigInt(ik.h),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let e=this.mul(nk/2n,!1).double();return nk%2n&&(e=e.add(this)),e.is0()}toAffine(){const{ex:e,ey:t,ez:n}=this;if(this.equals(gk))return{x:0n,y:1n};const r=Sk(n);return 1n!==dk(n*r)&&ak("invalid inverse"),{x:dk(e*r),y:dk(t*r)}}toRawBytes(){const{x:e,y:t}=this.toAffine(),n=wk(t);return n[31]|=1n&e?128:0,n}toHex(){return yk(this.toRawBytes())}}hk.BASE=new hk(rk,ok,1n,dk(rk*ok)),hk.ZERO=new hk(0n,1n,1n,0n);const{BASE:pk,ZERO:gk}=hk,mk=(e,t)=>e.toString(16).padStart(t,"0"),yk=e=>Array.from(e).map((e=>mk(e,2))).join(""),vk=e=>{const t=e.length;(!sk(e)||t%2)&&ak("hex invalid 1");const n=uk(t/2);for(let t=0;t<n.length;t++){const r=2*t,o=e.slice(r,r+2),i=Number.parseInt(o,16);(Number.isNaN(i)||i<0)&&ak("hex invalid 2"),n[t]=i}return n},wk=e=>vk(mk(e,64)).reverse(),Ak=e=>BigInt("0x"+yk(uk(ck(e)).reverse())),bk=(...e)=>{const t=uk(e.reduce(((e,t)=>e+ck(t).length),0));let n=0;return e.forEach((e=>{t.set(e,n),n+=e.length})),t},Sk=(e,t=tk)=>{(0n===e||t<=0n)&&ak("no inverse n="+e+" mod="+t);let n=dk(e,t),r=t,o=0n,i=1n,a=1n,s=0n;for(;0n!==n;){const e=r/n,t=r%n,c=o-a*e,u=i-s*e;r=n,n=t,o=a,i=s,a=c,s=u}return 1n===r?dk(o,t):ak("no inverse")},Ek=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=tk;return n},kk=19681161376707505956807079304988542015446066515923890162744021073123829784752n,Ik=(e,t)=>{const n=dk(t*t*t),r=(e=>{const t=e*e%tk*e%tk,n=Ek(t,2n)*t%tk,r=Ek(n,1n)*e%tk,o=Ek(r,5n)*r%tk,i=Ek(o,10n)*o%tk,a=Ek(i,20n)*i%tk,s=Ek(a,40n)*a%tk,c=Ek(s,80n)*s%tk,u=Ek(c,80n)*s%tk,l=Ek(u,10n)*o%tk;return{pow_p_5_8:Ek(l,2n)*e%tk,b2:t}})(e*dk(n*n*t)).pow_p_5_8;let o=dk(e*n*r);const i=dk(t*o*o),a=o,s=dk(o*kk),c=i===e,u=i===dk(-e),l=i===dk(-e*kk);return c&&(o=a),(u||l)&&(o=s),1n===(1n&dk(o))&&(o=dk(-o)),{isValid:c||u,value:o}},Tk=e=>dk(Ak(e),nk);let _k;const xk=(...e)=>Fk.sha512Async(...e),Ck=(...e)=>"function"==typeof _k?_k(...e):ak("etc.sha512Sync not set"),Rk=e=>{const t=e.slice(0,32);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(32,64),r=Tk(t),o=pk.mul(r),i=o.toRawBytes();return{head:t,prefix:n,scalar:r,point:o,pointBytes:i}},Pk=e=>xk(lk(e,32)).then(Rk),Nk=e=>Rk(Ck(lk(e,32))),Bk=e=>Pk(e).then((e=>e.pointBytes));function Ok(e,t){return e?xk(t.hashable).then(t.finish):t.finish(Ck(t.hashable))}const Mk=(e,t,n)=>{const{pointBytes:r,scalar:o}=e,i=Tk(t),a=pk.mul(i).toRawBytes();return{hashable:bk(a,r,n),finish:e=>{const t=dk(i+Tk(e)*o,nk);return ck(bk(a,wk(t)),64)}}},zk=async(e,t)=>{const n=lk(e),r=await Pk(t),o=await xk(r.prefix,n);return Ok(!0,Mk(r,o,n))},jk={zip215:!0},Uk=(e,t,n,r=jk)=>{t=lk(t),e=lk(e,64);const{zip215:o}=r;let i,a,s,c,u=new Uint8Array;try{i=hk.fromHex(n,o),a=hk.fromHex(e.slice(0,32),o),s=Ak(e.slice(32,64)),c=pk.mul(s,!1),u=bk(a.toRawBytes(),i.toRawBytes(),t)}catch(e){}return{hashable:u,finish:e=>{if(null==c)return!1;if(!o&&i.isSmallOrder())return!1;const t=Tk(e);return a.add(i.mul(t,!1)).add(c.negate()).clearCofactor().is0()}}},Dk=async(e,t,n,r=jk)=>Ok(!0,Uk(e,t,n,r)),Lk=()=>"object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,Fk={bytesToHex:yk,hexToBytes:vk,concatBytes:bk,mod:dk,invert:Sk,randomBytes:(e=32)=>{const t=Lk();return t&&t.getRandomValues||ak("crypto.getRandomValues must be defined"),t.getRandomValues(uk(e))},sha512Async:async(...e)=>{const t=Lk();t&&t.subtle||ak("crypto.subtle or etc.sha512Async must be defined");const n=bk(...e);return uk(await t.subtle.digest("SHA-512",n.buffer))},sha512Sync:void 0};Object.defineProperties(Fk,{sha512Sync:{configurable:!1,get:()=>_k,set(e){_k||(_k=e)}}});const $k={getExtendedPublicKeyAsync:Pk,getExtendedPublicKey:Nk,randomPrivateKey:()=>Fk.randomBytes(32),precompute:(e=8,t=pk)=>(t.multiply(3n),t)};let qk;const Wk=e=>{const t=qk||(qk=(()=>{const e=[];let t=pk,n=t;for(let r=0;r<33;r++){n=t,e.push(n);for(let r=1;r<128;r++)n=n.add(t),e.push(n);t=n.double()}return e})()),n=(e,t)=>{let n=t.negate();return e?n:t};let r=gk,o=pk;const i=BigInt(255),a=BigInt(8);for(let s=0;s<33;s++){const c=128*s;let u=Number(e&i);e>>=a,u>128&&(u-=256,e+=1n);const l=c,d=c+Math.abs(u)-1,f=s%2!=0,h=u<0;0===u?o=o.add(n(f,t[l])):r=r.add(n(h,t[d]))}return{p:r,f:o}};function Vk(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var Kk=n(1048).hp;const Gk="8d9df0f7-1363-4d2c-8152-ce4ed78f27d8",Hk=[48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32];function Zk(e){return Kk.from(e).toString("base64").replace(/\+/gu,"-").replace(/\//gu,"_").replace(/[=]/gu,"")}function Jk(e){const t=e.replace(/-/gu,"+").replace(/_/gu,"/");return new Uint8Array(Kk.from(t,"base64"))}function Yk(e){return"Ed25519"===e||"object"==typeof e&&"Ed25519"===e.name}function Qk(){const{subtle:e}=globalThis.crypto;Object.defineProperty(globalThis,"isSecureContext",{value:!0,writable:!0,configurable:!0}),Object.defineProperty(e,"generateKey",{value:async(...e)=>Yk(e[0])?await async function(e,t,n){const r=$k.randomPrivateKey(),o=await Bk(r),i=Array.from(n);return{privateKey:{algorithm:{name:"Ed25519"},extractable:t,type:"private",usages:i,[Gk]:r},publicKey:{algorithm:{name:"Ed25519"},extractable:!0,type:"public",usages:i,[Gk]:o}}}(...e):await globalThis.crypto.subtle.generateKey(...e),writable:!0,configurable:!0}),Object.defineProperty(e,"exportKey",{value:async(...e)=>Yk(e[1].algorithm)?await async function(e,t){if(!t.extractable)throw new DOMException("key is not extractable","InvalidAccessException");const n=t[Gk];switch(e){case"raw":if("public"!==t.type)throw new DOMException("Unable to export a raw Ed25519 private key","InvalidAccessError");return n.buffer;case"pkcs8":if("private"!==t.type)throw new DOMException("Unable to export a pkcs8 Ed25519 public key","InvalidAccessError");return new Uint8Array([...Hk,...n]).buffer;case"jwk":{const e={crv:"Ed25519",ext:t.extractable,key_ops:t.usages,kty:"OKP"};if("private"===t.type){const t=await Bk(n);return Object.freeze({...e,d:Zk(n),x:Zk(t)})}return Object.freeze({...e,x:Zk(n)})}case"spki":{if("public"!==t.type)throw new DOMException("Only public keys can be exported as SPKI","InvalidAccessError");const e=new Uint8Array([48,5,6,3,43,101,112]),r=new Uint8Array([3,n.length+1,0,...n]);return new Uint8Array([48,e.length+r.length,...e,...r]).buffer}default:throw new Error(`Unsupported export format: ${e}`)}}(...e):await globalThis.crypto.subtle.exportKey(...e),writable:!0,configurable:!0}),Object.defineProperty(e,"sign",{value:async(...e)=>{const[t,n]=e;return Yk(t)&&Yk(n.algorithm)?await async function(e,t,n){if("private"!==t.type)throw new DOMException("Key is not private","NotAllowedError");if(!t.usages.includes("sign"))throw new DOMException("Key usage not allowed","NotAllowedError");const r=Vk(n),o=t[Gk],i=function(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteLength)}(await zk(r,o));return i}(...e):await globalThis.crypto.subtle.sign(...e)},writable:!0,configurable:!0}),Object.defineProperty(e,"verify",{value:async(...e)=>{const[t,n]=e;return Yk(t)&&Yk(n.algorithm)?await async function(e,t,n,r){if("public"!==t.type)throw new DOMException("Key is not public","NotAllowedError");if(!t.usages.includes("verify"))throw new DOMException("Key usage not allowed","NotAllowedError");const o=Vk(n),i=Vk(r),a=t[Gk];return await Dk(o,i,a)}(...e):await globalThis.crypto.subtle.verify(...e)},writable:!0,configurable:!0}),Object.defineProperty(e,"importKey",{value:async(...e)=>Yk(e[2])?await async function(e,t,n,r,o){const i=Array.from(o);switch(e){case"raw":{const e=Vk(t);if(32!==e.length)throw new DOMException("Ed25519 raw keys must be exactly 32-bytes","DataError");return{algorithm:{name:"Ed25519"},extractable:r,type:"public",usages:i.filter((e=>"verify"===e)),[Gk]:e}}case"pkcs8":{const e=Vk(t);if(48!==e.length)throw new DOMException("Invalid PKCS8 key data length","DataError");if(!e.slice(0,16).every(((e,t)=>e===Hk[t])))throw new DOMException("Invalid PKCS8 header","DataError");return{algorithm:{name:"Ed25519"},extractable:r,type:"private",usages:i.filter((e=>"sign"===e)),[Gk]:e.slice(16)}}case"jwk":{const e=t;if("OKP"!==e.kty||"Ed25519"!==e.crv)throw new DOMException("Invalid Ed25519 JWK","DataError");const n="d"in e?"private":"public";if("public"===n&&!e.x)throw new DOMException("Ed25519 JWK is missing public key","DataError");if(!("private"!==n||e.d&&e.x))throw new DOMException("Ed25519 JWK is missing key data","DataError");const o="private"===n?e.d:e.x;return{algorithm:{name:"Ed25519"},extractable:r,type:n,usages:i.filter((e=>"private"===n?"sign"===e:"verify"===e)),[Gk]:Jk(o)}}case"spki":{const e=Vk(t);if(48!==e[0])throw new DOMException("Invalid SPKI format","DataError");const n=2;if(48!==e[n]||6!==e[n+2]||3!==e[n+3]||43!==e[n+4]||101!==e[n+5]||112!==e[n+6])throw new DOMException("Not an Ed25519 key","DataError");const r=n+7+2;return{algorithm:{name:"Ed25519"},extractable:!0,type:"public",usages:i.filter((e=>"verify"===e)),[Gk]:e.slice(r)}}default:throw new Error(`Unsupported import format: ${e}`)}}(...e):await globalThis.crypto.subtle.importKey(...e),writable:!0,configurable:!0})}const Xk=async e=>Promise.resolve().then(e);Object.defineProperty(globalThis,"DOMException",{value:Error,writable:!0,configurable:!0,enumerable:!0}),Qk(),Object.defineProperty(globalThis,"queueMicrotask",{value:Xk,writable:!0,configurable:!0,enumerable:!0}),_o.config({EXPONENTIAL_AT:16});const eI=async({origin:e,request:t})=>{Gl.log("[🔄 onRpcRequest]",t.method,t);const{method:n}=t;My(e,n);const r=VE[n];if(!r)throw new Jr(`RpcRequest method ${n} not found. Available methods: ${Object.values(Sy).toString()}`);return await KE((async()=>r({origin:e,request:t})))??null},tI=async({origin:e,request:t})=>{Gl.log("[🔑 onKeyringRequest]",t.method,t),My(e,t.method),t.method===Ht.SubmitRequest&&t.params&&!("origin"in t.params)&&(t.params.origin="https://metamask.io");return await KE((async()=>yn(XS,t)))??null},nI=async({id:e,event:t,context:n})=>{if(Gl.log("[👇 onUserInput]",e,t),!t.name)return;const r={...XE,...ek,...Vv,...$v,...Dv}[t.name];r&&await KE((async()=>r({id:e,event:t,context:n,snapContext:rE})))},rI=async({request:e})=>{const t=Kl(Gl,"[⏱️ onCronjob]");t.log(e.method,e);const{method:n}=e;M(n,H([...Object.values($E),...Object.values(Uy)]));return await KE((async()=>{const{locked:r,active:o}=await my();if(t.log("Client status",{locked:r,active:o}),r||!o)return Promise.resolve();t.log("Running cronjob",{method:n});const i=FE[n];if(!i)throw new Jr(`Cronjob / ScheduleBackgroundEvent method ${n} not found. Available methods: ${Object.values([...Object.values($E),...Object.values(Uy)]).toString()}`);return i({request:e})}))??null},oI=async e=>{const t=await KE((async()=>(async e=>{Gl.log("[🔍 onAssetsLookup]",e);const{assets:t}=e,n=t.filter((e=>{const{assetNamespace:t}=Fo(e);return"token"===t||"slip44"===t}));return{assets:await $S.getAssetsMetadata(n)}})(e)));return t??null},iI=async e=>{const t=await KE((async()=>(async e=>{Gl.log("[💱 onAssetsConversion]",e);const{conversions:t}=e;return{conversionRates:await DS.getMultipleTokenConversions(t)}})(e)));return t??null},aI=async e=>{const{origin:t,request:n}=e;My(t,n.method);const r=await KE((async()=>(async({scope:e,request:t})=>{switch(M(e,gd),t.method){case yy.GetGenesisHash:return M(t,vy),_S.getRpc(e).getGenesisHash().send();case yy.GetLatestBlockhash:return M(t,wy),(await _S.getRpc(e).getLatestBlockhash().send()).value.blockhash;case yy.GetMinimumBalanceForRentExemption:return M(t,Ay),(await _S.getRpc(e).getMinimumBalanceForRentExemption(BigInt(t.params[0]),t.params[1]).send()).toString();default:throw new Error(`Unsupported method: ${t.method}`)}})(e)));return r??null},sI=async e=>{const t=await KE((async()=>(async e=>{Gl.log("[📈 onAssetHistoricalPrice]",e);const{from:t,to:n}=e;return M(t,Do),M(n,Do),{historicalPrice:await DS.getHistoricalPrice(t,n)}})(e)));return t??null},cI=async({request:e})=>await KE((async()=>nE.handle(e)))??null,uI=async({event:e})=>KE((async()=>{await SS.emitSync("onWebSocketEvent",e)})),lI=async()=>KE((async()=>{await SS.emitSync("onStart")})),dI=async()=>KE((async()=>{await SS.emitSync("onUpdate")})),fI=async()=>KE((async()=>{await SS.emitSync("onInstall")})),hI=async()=>KE((async()=>{await SS.emitSync("onActive")})),pI=async()=>KE((async()=>{await SS.emitSync("onInactive")})),gI=async e=>{const t=await KE((async()=>(async e=>{M(e,qE);const{chainId:t,domain:n,address:r}=e;if(n){const e=await LS.resolveDomain(t,n);if(e)return{resolvedAddresses:[{resolvedAddress:e,protocol:WE,domainName:n}]}}if(r){const e=await LS.resolveAddress(t,r);if(e)return{resolvedDomains:[{resolvedDomain:e,protocol:WE}]}}return null})(e)));return t??null},mI=async e=>{const t=await KE((async()=>(async e=>{Gl.log("[💰 onAssetsMarketData]",e);const{assets:t}=e;return{marketData:await $S.fetchAssetsMarketData(t)}})(e)));return t??null}})(),module.exports=r})();
|
|
1
|
+
(()=>{var e={33:(e,t,n)=>{var r=n(9968),o=n(9756),i=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];e.exports=function(e,t){return r(i,(function(n){var r="_."+n[0];t&n[1]&&!o(e,r)&&e.push(r)})),e.sort()}},88:(e,t,n)=>{var r=n(4700);e.exports=function(e){return r(this,e).get(e)}},125:(e,t,n)=>{var r=n(9032),o=n(5288);e.exports=function(e,t){return e&&r(t,o(t),e)}},155:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},195:(e,t,n)=>{var r=n(4882),o=n(8121),i=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return o(e);var t=[];for(var n in Object(e))i.call(e,n)&&"constructor"!=n&&t.push(n);return t}},282:e=>{e.exports=a,a.default=a,a.stable=l,a.stableStringify=l;var t="[...]",n="[Circular]",r=[],o=[];function i(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function a(e,t,n,a){var s;void 0===a&&(a=i()),c(e,"",0,[],void 0,0,a);try{s=0===o.length?JSON.stringify(e,t,n):JSON.stringify(e,f(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var u=r.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return s}function s(e,t,n,i){var a=Object.getOwnPropertyDescriptor(i,n);void 0!==a.get?a.configurable?(Object.defineProperty(i,n,{value:e}),r.push([i,n,t,a])):o.push([t,n,e]):(i[n]=e,r.push([i,n,t]))}function c(e,r,o,i,a,u,l){var d;if(u+=1,"object"==typeof e&&null!==e){for(d=0;d<i.length;d++)if(i[d]===e)return void s(n,e,r,a);if(void 0!==l.depthLimit&&u>l.depthLimit)return void s(t,e,r,a);if(void 0!==l.edgesLimit&&o+1>l.edgesLimit)return void s(t,e,r,a);if(i.push(e),Array.isArray(e))for(d=0;d<e.length;d++)c(e[d],d,d,i,e,u,l);else{var f=Object.keys(e);for(d=0;d<f.length;d++){var h=f[d];c(e[h],h,d,i,e,u,l)}}i.pop()}}function u(e,t){return e<t?-1:e>t?1:0}function l(e,t,n,a){void 0===a&&(a=i());var s,c=d(e,"",0,[],void 0,0,a)||e;try{s=0===o.length?JSON.stringify(c,t,n):JSON.stringify(c,f(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var u=r.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return s}function d(e,o,i,a,c,l,f){var h;if(l+=1,"object"==typeof e&&null!==e){for(h=0;h<a.length;h++)if(a[h]===e)return void s(n,e,o,c);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==f.depthLimit&&l>f.depthLimit)return void s(t,e,o,c);if(void 0!==f.edgesLimit&&i+1>f.edgesLimit)return void s(t,e,o,c);if(a.push(e),Array.isArray(e))for(h=0;h<e.length;h++)d(e[h],h,h,a,e,l,f);else{var p={},g=Object.keys(e).sort(u);for(h=0;h<g.length;h++){var m=g[h];d(e[m],m,h,a,e,l,f),p[m]=e[m]}if(void 0===c)return p;r.push([c,o,e]),c[o]=p}a.pop()}}function f(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(o.length>0)for(var r=0;r<o.length;r++){var i=o[r];if(i[1]===t&&i[0]===n){n=i[2],o.splice(r,1);break}}return e.call(this,t,n)}}},313:(e,t,n)=>{var r=n(1129),o=n(714);e.exports=function e(t,n,i,a,s){var c=-1,u=t.length;for(i||(i=o),s||(s=[]);++c<u;){var l=t[c];n>0&&i(l)?n>1?e(l,n-1,i,a,s):r(s,l):a||(s[s.length]=l)}return s}},353:(e,t,n)=>{var r=n(1340),o=n(3934),i=n(8861),a=n(1182),s=n(8486),c=n(3142),u=n(5853),l=n(8666),d="[object Arguments]",f="[object Array]",h="[object Object]",p=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,g,m,y){var v=c(e),w=c(t),A=v?f:s(e),b=w?f:s(t),S=(A=A==d?h:A)==h,E=(b=b==d?h:b)==h,k=A==b;if(k&&u(e)){if(!u(t))return!1;v=!0,S=!1}if(k&&!S)return y||(y=new r),v||l(e)?o(e,t,n,g,m,y):i(e,t,A,n,g,m,y);if(!(1&n)){var I=S&&p.call(e,"__wrapped__"),T=E&&p.call(t,"__wrapped__");if(I||T){var _=I?e.value():e,x=T?t.value():t;return y||(y=new r),m(_,x,n,g,y)}}return!!k&&(y||(y=new r),a(e,t,n,g,m,y))}},358:(e,t,n)=>{var r=n(6137),o=n(3283),i=n(3142),a=n(5853),s=n(9632),c=n(8666),u=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=i(e),l=!n&&o(e),d=!n&&!l&&a(e),f=!n&&!l&&!d&&c(e),h=n||l||d||f,p=h?r(e.length,String):[],g=p.length;for(var m in e)!t&&!u.call(e,m)||h&&("length"==m||d&&("offset"==m||"parent"==m)||f&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||s(m,g))||p.push(m);return p}},393:(e,t,n)=>{var r=n(8244),o=n(7979),i=n(1211);e.exports=function(e){return r(e,i,o)}},424:(e,t,n)=>{var r=n(8898),o=n(2480),i=n(8340),a=n(8069),s=n(2264);e.exports=function(e,t,n){var c=e.constructor;switch(t){case"[object ArrayBuffer]":return r(e);case"[object Boolean]":case"[object Date]":return new c(+e);case"[object DataView]":return o(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return s(e,n);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(e);case"[object RegExp]":return i(e);case"[object Symbol]":return a(e)}}},441:(e,t,n)=>{var r=n(7379),o=n(547),i=n(8360);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Error]"==t||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!i(e)}},528:(e,t,n)=>{var r=n(9747),o=n(5962);function i(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}i.prototype=r(o.prototype),i.prototype.constructor=i,e.exports=i},547:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},674:(e,t,n)=>{var r=n(7379),o=n(5387),i=n(547),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return i(e)&&o(e.length)&&!!a[r(e)]}},714:(e,t,n)=>{var r=n(5650),o=n(3283),i=n(3142),a=r?r.isConcatSpreadable:void 0;e.exports=function(e){return i(e)||o(e)||!!(a&&e&&e[a])}},777:(e,t,n)=>{var r=n(8486),o=n(547);e.exports=function(e){return o(e)&&"[object Map]"==r(e)}},796:(e,t,n)=>{var r=n(7403),o=n(3316)(r);e.exports=o},864:(e,t,n)=>{var r=n(8638),o=n(1439),i=o((function(e,t){return r(e,256,void 0,void 0,void 0,t)}));e.exports=i},961:(e,t,n)=>{var r=n(3476),o=Object.prototype.hasOwnProperty;e.exports=function(e){for(var t=e.name+"",n=r[t],i=o.call(r,t)?n.length:0;i--;){var a=n[i],s=a.func;if(null==s||s==e)return a.name}return t}},1048:(e,t,n)=>{"use strict";const r=n(7991),o=n(9318),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=c,t.IS=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=s(n);const o=r.write(e,t);o!==n&&(r=r.slice(0,o));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Z(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Z(e,ArrayBuffer)||e&&Z(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Z(e,SharedArrayBuffer)||e&&Z(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const o=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||J(e.length)?s(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),s(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=s(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function h(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,c.prototype),r}function p(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Z(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(o)return r?-1:K(e).length;t=(""+t).toLowerCase(),o=!0}}function m(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,n);case"utf8":case"utf-8":return T(this,t,n);case"ascii":return x(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),J(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:w(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):w(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function w(e,t,n,r,o){let i,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){let r=-1;for(i=n;i<s;i++)if(u(e,i)===u(t,-1===r?0:i-r)){if(-1===r&&(r=i),i-r+1===c)return r*a}else-1!==r&&(i-=i-r),r=-1}else for(n+c>s&&(n=s-c),i=n;i>=0;i--){let n=!0;for(let r=0;r<c;r++)if(u(e,i+r)!==u(t,r)){n=!1;break}if(n)return i}return-1}function A(e,t,n,r){n=Number(n)||0;const o=e.length-n;r?(r=Number(r))>o&&(r=o):r=o;const i=t.length;let a;for(r>i/2&&(r=i/2),a=0;a<r;++a){const r=parseInt(t.substr(2*a,2),16);if(J(r))return a;e[n+a]=r}return a}function b(e,t,n,r){return H(K(t,e.length-n),e,n,r)}function S(e,t,n,r){return H(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function E(e,t,n,r){return H(G(t),e,n,r)}function k(e,t,n,r){return H(function(e,t){let n,r,o;const i=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function I(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function T(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o<n;){const t=e[o];let i=null,a=t>239?4:t>223?3:t>191?2:1;if(o+a<=n){let n,r,s,c;switch(a){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],s=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=a}return function(e){const t=e.length;if(t<=_)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=_));return n}(r)}c.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,n){return u(e,t,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,n){return function(e,t,n){return l(e),e<=0?s(e):void 0!==t?"string"==typeof n?s(e).fill(t,n):s(e).fill(t):s(e)}(e,t,n)},c.allocUnsafe=function(e){return d(e)},c.allocUnsafeSlow=function(e){return d(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(Z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),Z(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let o=0,i=Math.min(n,r);o<i;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},c.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}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=c.allocUnsafe(t);let o=0;for(n=0;n<e.length;++n){let t=e[n];if(Z(t,Uint8Array))o+t.length>r.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)y(this,t,t+1);return this},c.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},c.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):m.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const n=t.IS;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if(Z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(i,a),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e<s;++e)if(u[e]!==l[e]){i=u[e],a=l[e];break}return i<a?-1:a<i?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return v(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return v(this,e,t,n,!1)},c.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return A(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const _=4096;function x(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(127&e[o]);return r}function C(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(e[o]);return r}function R(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let o="";for(let r=t;r<n;++r)o+=Y[e[r]];return o}function P(e,t,n){const r=e.slice(t,n);let o="";for(let e=0;e<r.length-1;e+=2)o+=String.fromCharCode(r[e]+256*r[e+1]);return o}function N(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function B(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function O(e,t,n,r,o){$(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function M(e,t,n,r,o){$(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function z(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(e,t,n,r,i){return t=+t,n>>>=0,i||z(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,i){return t=+t,n>>>=0,i||z(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(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);const r=this.subarray(e,t);return Object.setPrototypeOf(r,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){q(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<<BigInt(32))})),c.prototype.readBigUInt64BE=Q((function(e){q(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(o)})),c.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||N(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||N(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){q(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),c.prototype.readBigInt64BE=Q((function(e){q(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||N(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||N(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||N(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||N(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){B(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[t]=255&e;++i<n&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){B(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return M(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);B(this,e,t,n,r-1,-r)}let o=0,i=1,a=0;for(this[t]=255&e;++o<n&&(i*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/i>>0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);B(this,e,t,n,r-1,-r)}let o=n-1,i=1,a=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/i>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||B(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q((function(e,t=0){return O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return M(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return j(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return j(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const o=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),o},c.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{const i=c.isBuffer(e)?e:c.from(e,r),a=i.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-t;++o)this[o+t]=i[o%a]}return this};const D={};function L(e,t,n){D[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function F(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function $(e,t,n,r,o,i){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let o;throw o=i>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new D.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){q(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||W(t,e.length-(n+1))}(r,o,i)}function q(e,t){if("number"!=typeof e)throw new D.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,n){if(Math.floor(e)!==e)throw q(e,n),new D.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new D.ERR_BUFFER_OUT_OF_BOUNDS;throw new D.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}L("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),L("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),L("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=F(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=F(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function K(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let a=0;a<r;++a){if(n=e.charCodeAt(a),n>55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function G(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function H(e,t,n,r){let o;for(o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function Z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const Y=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function Q(e){return"undefined"==typeof BigInt?X:e}function X(){throw new Error("BigInt not supported")}},1112:(e,t,n)=>{var r=n(4497),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return o.call(t,e)?t[e]:void 0}},1129:e=>{e.exports=function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}},1182:(e,t,n)=>{var r=n(393),o=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,i,a,s){var c=1&n,u=r(e),l=u.length;if(l!=r(t).length&&!c)return!1;for(var d=l;d--;){var f=u[d];if(!(c?f in t:o.call(t,f)))return!1}var h=s.get(e),p=s.get(t);if(h&&p)return h==t&&p==e;var g=!0;s.set(e,t),s.set(t,e);for(var m=c;++d<l;){var y=e[f=u[d]],v=t[f];if(i)var w=c?i(v,y,f,t,e,s):i(y,v,f,e,t,s);if(!(void 0===w?y===v||a(y,v,n,i,s):w)){g=!1;break}m||(m="constructor"==f)}if(g&&!m){var A=e.constructor,b=t.constructor;A==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof A&&A instanceof A&&"function"==typeof b&&b instanceof b||(g=!1)}return s.delete(e),s.delete(t),g}},1187:(e,t,n)=>{var r=n(7379),o=n(547);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},1211:(e,t,n)=>{var r=n(358),o=n(195),i=n(6529);e.exports=function(e){return i(e)?r(e):o(e)}},1340:(e,t,n)=>{var r=n(1386),o=n(4103),i=n(1779),a=n(4162),s=n(7462),c=n(6638);function u(e){var t=this.__data__=new r(e);this.size=t.size}u.prototype.clear=o,u.prototype.delete=i,u.prototype.get=a,u.prototype.has=s,u.prototype.set=c,e.exports=u},1386:(e,t,n)=>{var r=n(2393),o=n(2049),i=n(7144),a=n(7452),s=n(3964);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=a,c.prototype.set=s,e.exports=c},1439:(e,t,n)=>{var r=n(5857),o=n(5234),i=n(796);e.exports=function(e){return i(o(e,void 0,r),e+"")}},1580:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},1623:(e,t,n)=>{var r=n(8942).Uint8Array;e.exports=r},1779:e=>{e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},1877:e=>{e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},1935:(e,t,n)=>{var r=n(8486),o=n(547);e.exports=function(e){return o(e)&&"[object Set]"==r(e)}},1942:(e,t,n)=>{var r=n(528),o=n(1439),i=n(5196),a=n(961),s=n(3142),c=n(6648);e.exports=function(e){return o((function(t){var n=t.length,o=n,u=r.prototype.thru;for(e&&t.reverse();o--;){var l=t[o];if("function"!=typeof l)throw new TypeError("Expected a function");if(u&&!d&&"wrapper"==a(l))var d=new r([],!0)}for(o=d?o:n;++o<n;){l=t[o];var f=a(l),h="wrapper"==f?i(l):void 0;d=h&&c(h[0])&&424==h[1]&&!h[4].length&&1==h[9]?d[a(h[0])].apply(d,h[3]):1==l.length&&c(l)?d[f]():d.thru(l)}return function(){var e=arguments,r=e[0];if(d&&1==e.length&&s(r))return d.plant(r).value();for(var o=0,i=n?t[o].apply(this,e):r;++o<n;)i=t[o].call(this,i);return i}}))}},1950:(e,t,n)=>{var r=n(8942)["__core-js_shared__"];e.exports=r},2049:(e,t,n)=>{var r=n(7034),o=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0)&&(n==t.length-1?t.pop():o.call(t,n,1),--this.size,!0)}},2053:e=>{e.exports=function(e){return e}},2264:(e,t,n)=>{var r=n(8898);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}},2291:(e,t,n)=>{var r=n(5650),o=n(5111),i=n(3142),a=n(1187),s=r?r.prototype:void 0,c=s?s.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(i(t))return o(t,e)+"";if(a(t))return c?c.call(t):"";var n=t+"";return"0"==n&&1/t==-Infinity?"-0":n}},2306:(e,t,n)=>{e=n.nmd(e);var r=n(4967),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o&&r.process,s=function(){try{var e=i&&i.require&&i.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=s},2343:(e,t,n)=>{var r=n(4687),o=n(6123),i=n(7276),a=n(5187),s=n(7267),c=n(3904),u=n(6040);e.exports=function(e,t){return a(e)&&s(t)?c(u(e),t):function(n){var a=o(n,e);return void 0===a&&a===t?i(n,e):r(t,a,3)}}},2393:e=>{e.exports=function(){this.__data__=[],this.size=0}},2443:(e,t,n)=>{var r=n(6912),o=n(4364),i=n(3504),a=n(4216),s=n(6850),c=n(8813),u=n(8942);e.exports=function(e,t,n){var l=o(e);return function o(){for(var d=arguments.length,f=Array(d),h=d,p=s(o);h--;)f[h]=arguments[h];var g=d<3&&f[0]!==p&&f[d-1]!==p?[]:c(f,p);return(d-=g.length)<n?a(e,t,i,o.placeholder,void 0,f,g,void 0,void 0,n-d):r(this&&this!==u&&this instanceof o?l:e,this,f)}}},2478:(e,t,n)=>{var r=n(7250),o=n(9454),i=n(7706);e.exports=function(e,t,n){return t==t?i(e,t,n):r(e,o,n)}},2480:(e,t,n)=>{var r=n(8898);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}},2532:(e,t,n)=>{var r=n(4715),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},2590:(e,t,n)=>{var r=n(9334),o=n(3334);e.exports=function(e){return o("function"==typeof e?e:r(e,1))}},2613:(e,t,n)=>{var r=n(5111),o=n(4354),i=n(3142),a=n(1187),s=n(6493),c=n(6040),u=n(5243);e.exports=function(e){return i(e)?r(e,c):a(e)?[e]:o(s(u(e)))}},2619:e=>{e.exports=function(e){return function(){return e}}},2673:(e,t,n)=>{var r=n(3579),o=n(8055);e.exports=function(e,t,n){return r(o,e,t,n)}},2762:e=>{e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},2784:(e,t,n)=>{var r=n(1580),o=n(4495),i=n(6131),a=Math.max,s=Math.min;e.exports=function(e,t,n){var c,u,l,d,f,h,p=0,g=!1,m=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var n=c,r=u;return c=u=void 0,p=t,d=e.apply(r,n)}function w(e){var n=e-h;return void 0===h||n>=t||n<0||m&&e-p>=l}function A(){var e=o();if(w(e))return b(e);f=setTimeout(A,function(e){var n=t-(e-h);return m?s(n,l-(e-p)):n}(e))}function b(e){return f=void 0,y&&c?v(e):(c=u=void 0,d)}function S(){var e=o(),n=w(e);if(c=arguments,u=this,h=e,n){if(void 0===f)return function(e){return p=e,f=setTimeout(A,t),g?v(e):d}(h);if(m)return clearTimeout(f),f=setTimeout(A,t),v(h)}return void 0===f&&(f=setTimeout(A,t)),d}return t=i(t)||0,r(n)&&(g=!!n.leading,l=(m="maxWait"in n)?a(i(n.maxWait)||0,t):l,y="trailing"in n?!!n.trailing:y),S.cancel=function(){void 0!==f&&clearTimeout(f),p=0,c=h=u=f=void 0},S.flush=function(){return void 0===f?d:b(o())},S}},2846:(e,t,n)=>{var r=n(9334);e.exports=function(e){return r(e,4)}},2879:(e,t,n)=>{var r=n(1942)();e.exports=r},2945:e=>{var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},2991:e=>{e.exports={}},3092:(e,t,n)=>{var r=n(2673)("flow",n(2879));r.placeholder=n(2991),e.exports=r},3103:(e,t,n)=>{var r=n(4715)(n(8942),"DataView");e.exports=r},3142:e=>{var t=Array.isArray;e.exports=t},3212:(e,t,n)=>{var r=n(8250),o=n(1877),i=n(8006);function a(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}a.prototype.add=a.prototype.push=o,a.prototype.has=i,e.exports=a},3282:(e,t,n)=>{var r=n(2762),o=n(8880),i=n(5187),a=n(6040);e.exports=function(e){return i(e)?r(a(e)):o(e)}},3283:(e,t,n)=>{var r=n(6027),o=n(547),i=Object.prototype,a=i.hasOwnProperty,s=i.propertyIsEnumerable,c=r(function(){return arguments}())?r:function(e){return o(e)&&a.call(e,"callee")&&!s.call(e,"callee")};e.exports=c},3301:(e,t,n)=>{var r=n(6131),o=1/0;e.exports=function(e){return e?(e=r(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},3305:(e,t,n)=>{var r=n(4497);e.exports=function(){this.__data__=r?r(null):{},this.size=0}},3316:e=>{var t=Date.now;e.exports=function(e){var n=0,r=0;return function(){var o=t(),i=16-(o-r);if(r=o,i>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}},3321:(e,t,n)=>{var r=n(7553),o=n(528),i=n(5962),a=n(3142),s=n(547),c=n(3410),u=Object.prototype.hasOwnProperty;function l(e){if(s(e)&&!a(e)&&!(e instanceof r)){if(e instanceof o)return e;if(u.call(e,"__wrapped__"))return c(e)}return new o(e)}l.prototype=i.prototype,l.prototype.constructor=l,e.exports=l},3334:(e,t,n)=>{var r=n(6526),o=n(2343),i=n(2053),a=n(3142),s=n(3282);e.exports=function(e){return"function"==typeof e?e:null==e?i:"object"==typeof e?a(e)?o(e[0],e[1]):r(e):s(e)}},3410:(e,t,n)=>{var r=n(7553),o=n(528),i=n(4354);e.exports=function(e){if(e instanceof r)return e.clone();var t=new o(e.__wrapped__,e.__chain__);return t.__actions__=i(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}},3422:(e,t,n)=>{var r=n(7073),o=n(6285),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var a=e[t];i.call(e,t)&&o(a,n)&&(void 0!==n||t in e)||r(e,t,n)}},3476:e=>{e.exports={}},3504:(e,t,n)=>{var r=n(4977),o=n(5755),i=n(3816),a=n(4364),s=n(4216),c=n(6850),u=n(6591),l=n(8813),d=n(8942);e.exports=function e(t,n,f,h,p,g,m,y,v,w){var A=128&n,b=1&n,S=2&n,E=24&n,k=512&n,I=S?void 0:a(t);return function T(){for(var _=arguments.length,x=Array(_),C=_;C--;)x[C]=arguments[C];if(E)var R=c(T),P=i(x,R);if(h&&(x=r(x,h,p,E)),g&&(x=o(x,g,m,E)),_-=P,E&&_<w){var N=l(x,R);return s(t,n,e,T.placeholder,f,x,N,y,v,w-_)}var B=b?f:this,O=S?B[t]:t;return _=x.length,y?x=u(x,y):k&&_>1&&x.reverse(),A&&v<_&&(x.length=v),this&&this!==d&&this instanceof T&&(O=I||a(O)),O.apply(B,x)}}},3526:(e,t,n)=>{var r=n(3142),o=n(5187),i=n(6493),a=n(5243);e.exports=function(e,t){return r(e)?e:o(e,t)?[e]:i(a(e))}},3546:(e,t,n)=>{var r=n(9032),o=n(7979);e.exports=function(e,t){return r(e,o(e),t)}},3565:(e,t)=>{t.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},t.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","rangeStep","rangeStepRight","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],4:["fill","setWith","updateWith"]},t.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},t.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},t.iterateeRearg={mapKeys:[1],reduceRight:[1,0]},t.methodRearg={assignInAllWith:[1,0],assignInWith:[1,2,0],assignAllWith:[1,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],rangeStep:[1,2,0],rangeStepRight:[1,2,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},t.methodSpread={assignAll:{start:0},assignAllWith:{start:0},assignInAll:{start:0},assignInAllWith:{start:0},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{start:0},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},t.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},t.realToAlias=function(){var e=Object.prototype.hasOwnProperty,n=t.aliasToReal,r={};for(var o in n){var i=n[o];e.call(r,i)?r[i].push(o):r[i]=[o]}return r}(),t.remap={assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",propertyOf:"get",rangeStep:"range",rangeStepRight:"rangeRight",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},t.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},t.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}},3579:(e,t,n)=>{var r=n(3565),o=n(2991),i=Array.prototype.push;function a(e,t){return 2==t?function(t,n){return e(t,n)}:function(t){return e(t)}}function s(e){for(var t=e?e.length:0,n=Array(t);t--;)n[t]=e[t];return n}function c(e,t){return function(){var n=arguments.length;if(n){for(var r=Array(n);n--;)r[n]=arguments[n];var o=r[0]=t.apply(void 0,r);return e.apply(void 0,r),o}}}e.exports=function e(t,n,u,l){var d="function"==typeof n,f=n===Object(n);if(f&&(l=u,u=n,n=void 0),null==u)throw new TypeError;l||(l={});var h={cap:!("cap"in l)||l.cap,curry:!("curry"in l)||l.curry,fixed:!("fixed"in l)||l.fixed,immutable:!("immutable"in l)||l.immutable,rearg:!("rearg"in l)||l.rearg},p=d?u:o,g="curry"in l&&l.curry,m="fixed"in l&&l.fixed,y="rearg"in l&&l.rearg,v=d?u.runInContext():void 0,w=d?u:{ary:t.ary,assign:t.assign,clone:t.clone,curry:t.curry,forEach:t.forEach,isArray:t.isArray,isError:t.isError,isFunction:t.isFunction,isWeakMap:t.isWeakMap,iteratee:t.iteratee,keys:t.keys,rearg:t.rearg,toInteger:t.toInteger,toPath:t.toPath},A=w.ary,b=w.assign,S=w.clone,E=w.curry,k=w.forEach,I=w.isArray,T=w.isError,_=w.isFunction,x=w.isWeakMap,C=w.keys,R=w.rearg,P=w.toInteger,N=w.toPath,B=C(r.aryMethod),O={castArray:function(e){return function(){var t=arguments[0];return I(t)?e(s(t)):e.apply(void 0,arguments)}},iteratee:function(e){return function(){var t=arguments[1],n=e(arguments[0],t),r=n.length;return h.cap&&"number"==typeof t?(t=t>2?t-2:1,r&&r<=t?n:a(n,t)):n}},mixin:function(e){return function(t){var n=this;if(!_(n))return e(n,Object(t));var r=[];return k(C(t),(function(e){_(t[e])&&r.push([e,n.prototype[e]])})),e(n,Object(t)),k(r,(function(e){var t=e[1];_(t)?n.prototype[e[0]]=t:delete n.prototype[e[0]]})),n}},nthArg:function(e){return function(t){var n=t<0?1:P(t)+1;return E(e(t),n)}},rearg:function(e){return function(t,n){var r=n?n.length:0;return E(e(t,n),r)}},runInContext:function(n){return function(r){return e(t,n(r),l)}}};function M(e,t){if(h.cap){var n=r.iterateeRearg[e];if(n)return function(e,t){return L(e,(function(e){var n=t.length;return function(e,t){return 2==t?function(t,n){return e.apply(void 0,arguments)}:function(t){return e.apply(void 0,arguments)}}(R(a(e,n),t),n)}))}(t,n);var o=!d&&r.iterateeAry[e];if(o)return function(e,t){return L(e,(function(e){return"function"==typeof e?a(e,t):e}))}(t,o)}return t}function z(e,t,n){if(h.fixed&&(m||!r.skipFixed[e])){var o=r.methodSpread[e],a=o&&o.start;return void 0===a?A(t,n):function(e,t){return function(){for(var n=arguments.length,r=n-1,o=Array(n);n--;)o[n]=arguments[n];var a=o[t],s=o.slice(0,t);return a&&i.apply(s,a),t!=r&&i.apply(s,o.slice(t+1)),e.apply(this,s)}}(t,a)}return t}function j(e,t,n){return h.rearg&&n>1&&(y||!r.skipRearg[e])?R(t,r.methodRearg[e]||r.aryRearg[n]):t}function U(e,t){for(var n=-1,r=(t=N(t)).length,o=r-1,i=S(Object(e)),a=i;null!=a&&++n<r;){var s=t[n],c=a[s];null==c||_(c)||T(c)||x(c)||(a[s]=S(n==o?c:Object(c))),a=a[s]}return i}function D(t,n){var o=r.aliasToReal[t]||t,i=r.remap[o]||o,a=l;return function(t){var r=d?v:w,s=d?v[i]:n,c=b(b({},a),t);return e(r,o,s,c)}}function L(e,t){return function(){var n=arguments.length;if(!n)return e();for(var r=Array(n);n--;)r[n]=arguments[n];var o=h.rearg?0:n-1;return r[o]=t(r[o]),e.apply(void 0,r)}}function F(e,t,n){var o,i=r.aliasToReal[e]||e,a=t,u=O[i];return u?a=u(t):h.immutable&&(r.mutate.array[i]?a=c(t,s):r.mutate.object[i]?a=c(t,function(e){return function(t){return e({},t)}}(t)):r.mutate.set[i]&&(a=c(t,U))),k(B,(function(e){return k(r.aryMethod[e],(function(t){if(i==t){var n=r.methodSpread[i],s=n&&n.afterRearg;return o=s?z(i,j(i,a,e),e):j(i,z(i,a,e),e),o=function(e,t,n){return g||h.curry&&n>1?E(t,n):t}(0,o=M(i,o),e),!1}})),!o})),o||(o=a),o==t&&(o=g?E(o,1):function(){return t.apply(this,arguments)}),o.convert=D(i,t),o.placeholder=t.placeholder=n,o}if(!f)return F(n,u,p);var $=u,q=[];return k(B,(function(e){k(r.aryMethod[e],(function(e){var t=$[r.remap[e]||e];t&&q.push([e,F(e,t,$)])}))})),k(C($),(function(e){var t=$[e];if("function"==typeof t){for(var n=q.length;n--;)if(q[n][0]==e)return;t.convert=D(e,t),q.push([e,t])}})),k(q,(function(e){$[e[0]]=e[1]})),$.convert=function(e){return $.runInContext.convert(e)(void 0)},$.placeholder=$,k(C($),(function(e){k(r.realToAlias[e]||[],(function(t){$[t]=$[e]}))})),$}},3636:e=>{e.exports=function(e,t){return null!=e&&t in Object(e)}},3650:(e,t,n)=>{var r=n(8244),o=n(5832),i=n(5288);e.exports=function(e){return r(e,i,o)}},3655:(e,t,n)=>{var r=n(7379),o=n(1580);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},3766:e=>{e.exports=function(e,t){return function(n){return e(t(n))}}},3804:(e,t,n)=>{e.exports=n(3092)},3816:e=>{e.exports=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}},3904:e=>{e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},3934:(e,t,n)=>{var r=n(3212),o=n(6465),i=n(5568);e.exports=function(e,t,n,a,s,c){var u=1&n,l=e.length,d=t.length;if(l!=d&&!(u&&d>l))return!1;var f=c.get(e),h=c.get(t);if(f&&h)return f==t&&h==e;var p=-1,g=!0,m=2&n?new r:void 0;for(c.set(e,t),c.set(t,e);++p<l;){var y=e[p],v=t[p];if(a)var w=u?a(v,y,p,t,e,c):a(y,v,p,e,t,c);if(void 0!==w){if(w)continue;g=!1;break}if(m){if(!o(t,(function(e,t){if(!i(m,t)&&(y===e||s(y,e,n,a,c)))return m.push(t)}))){g=!1;break}}else if(y!==v&&!s(y,v,n,a,c)){g=!1;break}}return c.delete(e),c.delete(t),g}},3943:(e,t,n)=>{var r=n(1935),o=n(9460),i=n(2306),a=i&&i.isSet,s=a?o(a):r;e.exports=s},3964:(e,t,n)=>{var r=n(7034);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},4066:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},4103:(e,t,n)=>{var r=n(1386);e.exports=function(){this.__data__=new r,this.size=0}},4162:e=>{e.exports=function(e){return this.__data__.get(e)}},4216:(e,t,n)=>{var r=n(6648),o=n(5512),i=n(5620);e.exports=function(e,t,n,a,s,c,u,l,d,f){var h=8&t;t|=h?32:64,4&(t&=~(h?64:32))||(t&=-4);var p=[e,t,s,h?c:void 0,h?u:void 0,h?void 0:c,h?void 0:u,l,d,f],g=n.apply(void 0,p);return r(e)&&o(g,p),g.placeholder=a,i(g,e,t)}},4255:(e,t,n)=>{var r=n(2673)("debounce",n(2784));r.placeholder=n(2991),e.exports=r},4354:e=>{e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}},4364:(e,t,n)=>{var r=n(9747),o=n(1580);e.exports=function(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=r(e.prototype),i=e.apply(n,t);return o(i)?i:n}}},4367:(e,t,n)=>{var r=n(7267),o=n(1211);e.exports=function(e){for(var t=o(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,r(a)]}return t}},4495:(e,t,n)=>{var r=n(8942);e.exports=function(){return r.Date.now()}},4497:(e,t,n)=>{var r=n(4715)(Object,"create");e.exports=r},4512:(e,t,n)=>{var r=n(4715)(n(8942),"Set");e.exports=r},4687:(e,t,n)=>{var r=n(353),o=n(547);e.exports=function e(t,n,i,a,s){return t===n||(null==t||null==n||!o(t)&&!o(n)?t!=t&&n!=n:r(t,n,i,a,e,s))}},4700:(e,t,n)=>{var r=n(9067);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},4715:(e,t,n)=>{var r=n(9624),o=n(155);e.exports=function(e,t){var n=o(e,t);return r(n)?n:void 0}},4732:(e,t,n)=>{var r=n(4700);e.exports=function(e){return r(this,e).has(e)}},4733:(e,t,n)=>{var r=n(9032),o=n(5832);e.exports=function(e,t){return r(e,o(e),t)}},4759:(e,t,n)=>{var r,o=n(1950),i=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!i&&i in e}},4772:e=>{e.exports=function(){return!1}},4784:(e,t,n)=>{var r=n(3766)(Object.getPrototypeOf,Object);e.exports=r},4882:e=>{var t=Object.prototype;e.exports=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||t)}},4943:(e,t,n)=>{var r=n(2053),o=n(6065),i=o?function(e,t){return o.set(e,t),e}:r;e.exports=i},4967:(e,t,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},4977:e=>{var t=Math.max;e.exports=function(e,n,r,o){for(var i=-1,a=e.length,s=r.length,c=-1,u=n.length,l=t(a-s,0),d=Array(u+l),f=!o;++c<u;)d[c]=n[c];for(;++i<s;)(f||i<a)&&(d[r[i]]=e[i]);for(;l--;)d[c++]=e[i++];return d}},5071:(e,t,n)=>{var r=n(4497);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},5098:(e,t,n)=>{var r=n(3305),o=n(9361),i=n(1112),a=n(5276),s=n(5071);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=a,c.prototype.set=s,e.exports=c},5111:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}},5187:(e,t,n)=>{var r=n(3142),o=n(1187),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!o(e))||(a.test(e)||!i.test(e)||null!=t&&e in Object(t))}},5196:(e,t,n)=>{var r=n(6065),o=n(9071),i=r?function(e){return r.get(e)}:o;e.exports=i},5234:(e,t,n)=>{var r=n(6912),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var i=arguments,a=-1,s=o(i.length-t,0),c=Array(s);++a<s;)c[a]=i[t+a];a=-1;for(var u=Array(t+1);++a<t;)u[a]=i[a];return u[t]=n(c),r(e,this,u)}}},5243:(e,t,n)=>{var r=n(2291);e.exports=function(e){return null==e?"":r(e)}},5250:function(e,t,n){var r;e=n.nmd(e),function(){var o,i="Expected a function",a="__lodash_hash_undefined__",s="__lodash_placeholder__",c=16,u=32,l=64,d=128,f=256,h=1/0,p=9007199254740991,g=NaN,m=4294967295,y=[["ary",d],["bind",1],["bindKey",2],["curry",8],["curryRight",c],["flip",512],["partial",u],["partialRight",l],["rearg",f]],v="[object Arguments]",w="[object Array]",A="[object Boolean]",b="[object Date]",S="[object Error]",E="[object Function]",k="[object GeneratorFunction]",I="[object Map]",T="[object Number]",_="[object Object]",x="[object Promise]",C="[object RegExp]",R="[object Set]",P="[object String]",N="[object Symbol]",B="[object WeakMap]",O="[object ArrayBuffer]",M="[object DataView]",z="[object Float32Array]",j="[object Float64Array]",U="[object Int8Array]",D="[object Int16Array]",L="[object Int32Array]",F="[object Uint8Array]",$="[object Uint8ClampedArray]",q="[object Uint16Array]",W="[object Uint32Array]",V=/\b__p \+= '';/g,K=/\b(__p \+=) '' \+/g,G=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,Z=/[&<>"']/g,J=RegExp(H.source),Y=RegExp(Z.source),Q=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,ee=/<%=([\s\S]+?)%>/g,te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ne=/^\w*$/,re=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,oe=/[\\^$.*+?()[\]{}|]/g,ie=RegExp(oe.source),ae=/^\s+/,se=/\s/,ce=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ue=/\{\n\/\* \[wrapped with (.+)\] \*/,le=/,? & /,de=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,fe=/[()=,{}\[\]\/\s]/,he=/\\(\\)?/g,pe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ge=/\w*$/,me=/^[-+]0x[0-9a-f]+$/i,ye=/^0b[01]+$/i,ve=/^\[object .+?Constructor\]$/,we=/^0o[0-7]+$/i,Ae=/^(?:0|[1-9]\d*)$/,be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Se=/($^)/,Ee=/['\n\r\u2028\u2029\\]/g,ke="\\ud800-\\udfff",Ie="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Te="\\u2700-\\u27bf",_e="a-z\\xdf-\\xf6\\xf8-\\xff",xe="A-Z\\xc0-\\xd6\\xd8-\\xde",Ce="\\ufe0e\\ufe0f",Re="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Pe="['’]",Ne="["+ke+"]",Be="["+Re+"]",Oe="["+Ie+"]",Me="\\d+",ze="["+Te+"]",je="["+_e+"]",Ue="[^"+ke+Re+Me+Te+_e+xe+"]",De="\\ud83c[\\udffb-\\udfff]",Le="[^"+ke+"]",Fe="(?:\\ud83c[\\udde6-\\uddff]){2}",$e="[\\ud800-\\udbff][\\udc00-\\udfff]",qe="["+xe+"]",We="\\u200d",Ve="(?:"+je+"|"+Ue+")",Ke="(?:"+qe+"|"+Ue+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",He="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ze="(?:"+Oe+"|"+De+")"+"?",Je="["+Ce+"]?",Ye=Je+Ze+("(?:"+We+"(?:"+[Le,Fe,$e].join("|")+")"+Je+Ze+")*"),Qe="(?:"+[ze,Fe,$e].join("|")+")"+Ye,Xe="(?:"+[Le+Oe+"?",Oe,Fe,$e,Ne].join("|")+")",et=RegExp(Pe,"g"),tt=RegExp(Oe,"g"),nt=RegExp(De+"(?="+De+")|"+Xe+Ye,"g"),rt=RegExp([qe+"?"+je+"+"+Ge+"(?="+[Be,qe,"$"].join("|")+")",Ke+"+"+He+"(?="+[Be,qe+Ve,"$"].join("|")+")",qe+"?"+Ve+"+"+Ge,qe+"+"+He,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Me,Qe].join("|"),"g"),ot=RegExp("["+We+ke+Ie+Ce+"]"),it=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,at=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],st=-1,ct={};ct[z]=ct[j]=ct[U]=ct[D]=ct[L]=ct[F]=ct[$]=ct[q]=ct[W]=!0,ct[v]=ct[w]=ct[O]=ct[A]=ct[M]=ct[b]=ct[S]=ct[E]=ct[I]=ct[T]=ct[_]=ct[C]=ct[R]=ct[P]=ct[B]=!1;var ut={};ut[v]=ut[w]=ut[O]=ut[M]=ut[A]=ut[b]=ut[z]=ut[j]=ut[U]=ut[D]=ut[L]=ut[I]=ut[T]=ut[_]=ut[C]=ut[R]=ut[P]=ut[N]=ut[F]=ut[$]=ut[q]=ut[W]=!0,ut[S]=ut[E]=ut[B]=!1;var lt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},dt=parseFloat,ft=parseInt,ht="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,pt="object"==typeof self&&self&&self.Object===Object&&self,gt=ht||pt||Function("return this")(),mt=t&&!t.nodeType&&t,yt=mt&&e&&!e.nodeType&&e,vt=yt&&yt.exports===mt,wt=vt&&ht.process,At=function(){try{var e=yt&&yt.require&&yt.require("util").types;return e||wt&&wt.binding&&wt.binding("util")}catch(e){}}(),bt=At&&At.isArrayBuffer,St=At&&At.isDate,Et=At&&At.isMap,kt=At&&At.isRegExp,It=At&&At.isSet,Tt=At&&At.isTypedArray;function _t(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function xt(e,t,n,r){for(var o=-1,i=null==e?0:e.length;++o<i;){var a=e[o];t(r,a,n(a),e)}return r}function Ct(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function Rt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Pt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function Nt(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var a=e[n];t(a,n,e)&&(i[o++]=a)}return i}function Bt(e,t){return!!(null==e?0:e.length)&&qt(e,t,0)>-1}function Ot(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1}function Mt(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}function zt(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function jt(e,t,n,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function Ut(e,t,n,r){var o=null==e?0:e.length;for(r&&o&&(n=e[--o]);o--;)n=t(n,e[o],o,e);return n}function Dt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Lt=Gt("length");function Ft(e,t,n){var r;return n(e,(function(e,n,o){if(t(e,n,o))return r=n,!1})),r}function $t(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function qt(e,t,n){return t==t?function(e,t,n){var r=n-1,o=e.length;for(;++r<o;)if(e[r]===t)return r;return-1}(e,t,n):$t(e,Vt,n)}function Wt(e,t,n,r){for(var o=n-1,i=e.length;++o<i;)if(r(e[o],t))return o;return-1}function Vt(e){return e!=e}function Kt(e,t){var n=null==e?0:e.length;return n?Jt(e,t)/n:g}function Gt(e){return function(t){return null==t?o:t[e]}}function Ht(e){return function(t){return null==e?o:e[t]}}function Zt(e,t,n,r,o){return o(e,(function(e,o,i){n=r?(r=!1,e):t(n,e,o,i)})),n}function Jt(e,t){for(var n,r=-1,i=e.length;++r<i;){var a=t(e[r]);a!==o&&(n=n===o?a:n+a)}return n}function Yt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Qt(e){return e?e.slice(0,mn(e)+1).replace(ae,""):e}function Xt(e){return function(t){return e(t)}}function en(e,t){return Mt(t,(function(t){return e[t]}))}function tn(e,t){return e.has(t)}function nn(e,t){for(var n=-1,r=e.length;++n<r&&qt(t,e[n],0)>-1;);return n}function rn(e,t){for(var n=e.length;n--&&qt(t,e[n],0)>-1;);return n}var on=Ht({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),an=Ht({"&":"&","<":"<",">":">",'"':""","'":"'"});function sn(e){return"\\"+lt[e]}function cn(e){return ot.test(e)}function un(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function ln(e,t){return function(n){return e(t(n))}}function dn(e,t){for(var n=-1,r=e.length,o=0,i=[];++n<r;){var a=e[n];a!==t&&a!==s||(e[n]=s,i[o++]=n)}return i}function fn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function hn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}function pn(e){return cn(e)?function(e){var t=nt.lastIndex=0;for(;nt.test(e);)++t;return t}(e):Lt(e)}function gn(e){return cn(e)?function(e){return e.match(nt)||[]}(e):function(e){return e.split("")}(e)}function mn(e){for(var t=e.length;t--&&se.test(e.charAt(t)););return t}var yn=Ht({"&":"&","<":"<",">":">",""":'"',"'":"'"});var vn=function e(t){var n,r=(t=null==t?gt:vn.defaults(gt.Object(),t,vn.pick(gt,at))).Array,se=t.Date,ke=t.Error,Ie=t.Function,Te=t.Math,_e=t.Object,xe=t.RegExp,Ce=t.String,Re=t.TypeError,Pe=r.prototype,Ne=Ie.prototype,Be=_e.prototype,Oe=t["__core-js_shared__"],Me=Ne.toString,ze=Be.hasOwnProperty,je=0,Ue=(n=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",De=Be.toString,Le=Me.call(_e),Fe=gt._,$e=xe("^"+Me.call(ze).replace(oe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qe=vt?t.Buffer:o,We=t.Symbol,Ve=t.Uint8Array,Ke=qe?qe.allocUnsafe:o,Ge=ln(_e.getPrototypeOf,_e),He=_e.create,Ze=Be.propertyIsEnumerable,Je=Pe.splice,Ye=We?We.isConcatSpreadable:o,Qe=We?We.iterator:o,Xe=We?We.toStringTag:o,nt=function(){try{var e=hi(_e,"defineProperty");return e({},"",{}),e}catch(e){}}(),ot=t.clearTimeout!==gt.clearTimeout&&t.clearTimeout,lt=se&&se.now!==gt.Date.now&&se.now,ht=t.setTimeout!==gt.setTimeout&&t.setTimeout,pt=Te.ceil,mt=Te.floor,yt=_e.getOwnPropertySymbols,wt=qe?qe.isBuffer:o,At=t.isFinite,Lt=Pe.join,Ht=ln(_e.keys,_e),wn=Te.max,An=Te.min,bn=se.now,Sn=t.parseInt,En=Te.random,kn=Pe.reverse,In=hi(t,"DataView"),Tn=hi(t,"Map"),_n=hi(t,"Promise"),xn=hi(t,"Set"),Cn=hi(t,"WeakMap"),Rn=hi(_e,"create"),Pn=Cn&&new Cn,Nn={},Bn=Di(In),On=Di(Tn),Mn=Di(_n),zn=Di(xn),jn=Di(Cn),Un=We?We.prototype:o,Dn=Un?Un.valueOf:o,Ln=Un?Un.toString:o;function Fn(e){if(ns(e)&&!Va(e)&&!(e instanceof Vn)){if(e instanceof Wn)return e;if(ze.call(e,"__wrapped__"))return Li(e)}return new Wn(e)}var $n=function(){function e(){}return function(t){if(!ts(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=o,n}}();function qn(){}function Wn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=o}function Vn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function Kn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Gn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Hn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Zn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Hn;++t<n;)this.add(e[t])}function Jn(e){var t=this.__data__=new Gn(e);this.size=t.size}function Yn(e,t){var n=Va(e),r=!n&&Wa(e),o=!n&&!r&&Za(e),i=!n&&!r&&!o&&ls(e),a=n||r||o||i,s=a?Yt(e.length,Ce):[],c=s.length;for(var u in e)!t&&!ze.call(e,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Ai(u,c))||s.push(u);return s}function Qn(e){var t=e.length;return t?e[Zr(0,t-1)]:o}function Xn(e,t){return zi(Po(e),cr(t,0,e.length))}function er(e){return zi(Po(e))}function tr(e,t,n){(n!==o&&!Fa(e[t],n)||n===o&&!(t in e))&&ar(e,t,n)}function nr(e,t,n){var r=e[t];ze.call(e,t)&&Fa(r,n)&&(n!==o||t in e)||ar(e,t,n)}function rr(e,t){for(var n=e.length;n--;)if(Fa(e[n][0],t))return n;return-1}function or(e,t,n,r){return hr(e,(function(e,o,i){t(r,e,n(e),i)})),r}function ir(e,t){return e&&No(t,Ns(t),e)}function ar(e,t,n){"__proto__"==t&&nt?nt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function sr(e,t){for(var n=-1,i=t.length,a=r(i),s=null==e;++n<i;)a[n]=s?o:_s(e,t[n]);return a}function cr(e,t,n){return e==e&&(n!==o&&(e=e<=n?e:n),t!==o&&(e=e>=t?e:t)),e}function ur(e,t,n,r,i,a){var s,c=1&t,u=2&t,l=4&t;if(n&&(s=i?n(e,r,i,a):n(e)),s!==o)return s;if(!ts(e))return e;var d=Va(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&ze.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!c)return Po(e,s)}else{var f=mi(e),h=f==E||f==k;if(Za(e))return Io(e,c);if(f==_||f==v||h&&!i){if(s=u||h?{}:vi(e),!c)return u?function(e,t){return No(e,gi(e),t)}(e,function(e,t){return e&&No(t,Bs(t),e)}(s,e)):function(e,t){return No(e,pi(e),t)}(e,ir(s,e))}else{if(!ut[f])return i?e:{};s=function(e,t,n){var r=e.constructor;switch(t){case O:return To(e);case A:case b:return new r(+e);case M:return function(e,t){var n=t?To(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case z:case j:case U:case D:case L:case F:case $:case q:case W:return _o(e,n);case I:return new r;case T:case P:return new r(e);case C:return function(e){var t=new e.constructor(e.source,ge.exec(e));return t.lastIndex=e.lastIndex,t}(e);case R:return new r;case N:return o=e,Dn?_e(Dn.call(o)):{}}var o}(e,f,c)}}a||(a=new Jn);var p=a.get(e);if(p)return p;a.set(e,s),ss(e)?e.forEach((function(r){s.add(ur(r,t,n,r,e,a))})):rs(e)&&e.forEach((function(r,o){s.set(o,ur(r,t,n,o,e,a))}));var g=d?o:(l?u?ai:ii:u?Bs:Ns)(e);return Ct(g||e,(function(r,o){g&&(r=e[o=r]),nr(s,o,ur(r,t,n,o,e,a))})),s}function lr(e,t,n){var r=n.length;if(null==e)return!r;for(e=_e(e);r--;){var i=n[r],a=t[i],s=e[i];if(s===o&&!(i in e)||!a(s))return!1}return!0}function dr(e,t,n){if("function"!=typeof e)throw new Re(i);return Ni((function(){e.apply(o,n)}),t)}function fr(e,t,n,r){var o=-1,i=Bt,a=!0,s=e.length,c=[],u=t.length;if(!s)return c;n&&(t=Mt(t,Xt(n))),r?(i=Ot,a=!1):t.length>=200&&(i=tn,a=!1,t=new Zn(t));e:for(;++o<s;){var l=e[o],d=null==n?l:n(l);if(l=r||0!==l?l:0,a&&d==d){for(var f=u;f--;)if(t[f]===d)continue e;c.push(l)}else i(t,d,r)||c.push(l)}return c}Fn.templateSettings={escape:Q,evaluate:X,interpolate:ee,variable:"",imports:{_:Fn}},Fn.prototype=qn.prototype,Fn.prototype.constructor=Fn,Wn.prototype=$n(qn.prototype),Wn.prototype.constructor=Wn,Vn.prototype=$n(qn.prototype),Vn.prototype.constructor=Vn,Kn.prototype.clear=function(){this.__data__=Rn?Rn(null):{},this.size=0},Kn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Kn.prototype.get=function(e){var t=this.__data__;if(Rn){var n=t[e];return n===a?o:n}return ze.call(t,e)?t[e]:o},Kn.prototype.has=function(e){var t=this.__data__;return Rn?t[e]!==o:ze.call(t,e)},Kn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Rn&&t===o?a:t,this},Gn.prototype.clear=function(){this.__data__=[],this.size=0},Gn.prototype.delete=function(e){var t=this.__data__,n=rr(t,e);return!(n<0)&&(n==t.length-1?t.pop():Je.call(t,n,1),--this.size,!0)},Gn.prototype.get=function(e){var t=this.__data__,n=rr(t,e);return n<0?o:t[n][1]},Gn.prototype.has=function(e){return rr(this.__data__,e)>-1},Gn.prototype.set=function(e,t){var n=this.__data__,r=rr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Kn,map:new(Tn||Gn),string:new Kn}},Hn.prototype.delete=function(e){var t=di(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return di(this,e).get(e)},Hn.prototype.has=function(e){return di(this,e).has(e)},Hn.prototype.set=function(e,t){var n=di(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Zn.prototype.add=Zn.prototype.push=function(e){return this.__data__.set(e,a),this},Zn.prototype.has=function(e){return this.__data__.has(e)},Jn.prototype.clear=function(){this.__data__=new Gn,this.size=0},Jn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Jn.prototype.get=function(e){return this.__data__.get(e)},Jn.prototype.has=function(e){return this.__data__.has(e)},Jn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Gn){var r=n.__data__;if(!Tn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var hr=Mo(br),pr=Mo(Sr,!0);function gr(e,t){var n=!0;return hr(e,(function(e,r,o){return n=!!t(e,r,o)})),n}function mr(e,t,n){for(var r=-1,i=e.length;++r<i;){var a=e[r],s=t(a);if(null!=s&&(c===o?s==s&&!us(s):n(s,c)))var c=s,u=a}return u}function yr(e,t){var n=[];return hr(e,(function(e,r,o){t(e,r,o)&&n.push(e)})),n}function vr(e,t,n,r,o){var i=-1,a=e.length;for(n||(n=wi),o||(o=[]);++i<a;){var s=e[i];t>0&&n(s)?t>1?vr(s,t-1,n,r,o):zt(o,s):r||(o[o.length]=s)}return o}var wr=zo(),Ar=zo(!0);function br(e,t){return e&&wr(e,t,Ns)}function Sr(e,t){return e&&Ar(e,t,Ns)}function Er(e,t){return Nt(t,(function(t){return Qa(e[t])}))}function kr(e,t){for(var n=0,r=(t=bo(t,e)).length;null!=e&&n<r;)e=e[Ui(t[n++])];return n&&n==r?e:o}function Ir(e,t,n){var r=t(e);return Va(e)?r:zt(r,n(e))}function Tr(e){return null==e?e===o?"[object Undefined]":"[object Null]":Xe&&Xe in _e(e)?function(e){var t=ze.call(e,Xe),n=e[Xe];try{e[Xe]=o;var r=!0}catch(e){}var i=De.call(e);r&&(t?e[Xe]=n:delete e[Xe]);return i}(e):function(e){return De.call(e)}(e)}function _r(e,t){return e>t}function xr(e,t){return null!=e&&ze.call(e,t)}function Cr(e,t){return null!=e&&t in _e(e)}function Rr(e,t,n){for(var i=n?Ot:Bt,a=e[0].length,s=e.length,c=s,u=r(s),l=1/0,d=[];c--;){var f=e[c];c&&t&&(f=Mt(f,Xt(t))),l=An(f.length,l),u[c]=!n&&(t||a>=120&&f.length>=120)?new Zn(c&&f):o}f=e[0];var h=-1,p=u[0];e:for(;++h<a&&d.length<l;){var g=f[h],m=t?t(g):g;if(g=n||0!==g?g:0,!(p?tn(p,m):i(d,m,n))){for(c=s;--c;){var y=u[c];if(!(y?tn(y,m):i(e[c],m,n)))continue e}p&&p.push(m),d.push(g)}}return d}function Pr(e,t,n){var r=null==(e=Ci(e,t=bo(t,e)))?e:e[Ui(Yi(t))];return null==r?o:_t(r,e,n)}function Nr(e){return ns(e)&&Tr(e)==v}function Br(e,t,n,r,i){return e===t||(null==e||null==t||!ns(e)&&!ns(t)?e!=e&&t!=t:function(e,t,n,r,i,a){var s=Va(e),c=Va(t),u=s?w:mi(e),l=c?w:mi(t),d=(u=u==v?_:u)==_,f=(l=l==v?_:l)==_,h=u==l;if(h&&Za(e)){if(!Za(t))return!1;s=!0,d=!1}if(h&&!d)return a||(a=new Jn),s||ls(e)?ri(e,t,n,r,i,a):function(e,t,n,r,o,i,a){switch(n){case M:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case O:return!(e.byteLength!=t.byteLength||!i(new Ve(e),new Ve(t)));case A:case b:case T:return Fa(+e,+t);case S:return e.name==t.name&&e.message==t.message;case C:case P:return e==t+"";case I:var s=un;case R:var c=1&r;if(s||(s=fn),e.size!=t.size&&!c)return!1;var u=a.get(e);if(u)return u==t;r|=2,a.set(e,t);var l=ri(s(e),s(t),r,o,i,a);return a.delete(e),l;case N:if(Dn)return Dn.call(e)==Dn.call(t)}return!1}(e,t,u,n,r,i,a);if(!(1&n)){var p=d&&ze.call(e,"__wrapped__"),g=f&&ze.call(t,"__wrapped__");if(p||g){var m=p?e.value():e,y=g?t.value():t;return a||(a=new Jn),i(m,y,n,r,a)}}if(!h)return!1;return a||(a=new Jn),function(e,t,n,r,i,a){var s=1&n,c=ii(e),u=c.length,l=ii(t),d=l.length;if(u!=d&&!s)return!1;var f=u;for(;f--;){var h=c[f];if(!(s?h in t:ze.call(t,h)))return!1}var p=a.get(e),g=a.get(t);if(p&&g)return p==t&&g==e;var m=!0;a.set(e,t),a.set(t,e);var y=s;for(;++f<u;){var v=e[h=c[f]],w=t[h];if(r)var A=s?r(w,v,h,t,e,a):r(v,w,h,e,t,a);if(!(A===o?v===w||i(v,w,n,r,a):A)){m=!1;break}y||(y="constructor"==h)}if(m&&!y){var b=e.constructor,S=t.constructor;b==S||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof S&&S instanceof S||(m=!1)}return a.delete(e),a.delete(t),m}(e,t,n,r,i,a)}(e,t,n,r,Br,i))}function Or(e,t,n,r){var i=n.length,a=i,s=!r;if(null==e)return!a;for(e=_e(e);i--;){var c=n[i];if(s&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++i<a;){var u=(c=n[i])[0],l=e[u],d=c[1];if(s&&c[2]){if(l===o&&!(u in e))return!1}else{var f=new Jn;if(r)var h=r(l,d,u,e,t,f);if(!(h===o?Br(d,l,3,r,f):h))return!1}}return!0}function Mr(e){return!(!ts(e)||(t=e,Ue&&Ue in t))&&(Qa(e)?$e:ve).test(Di(e));var t}function zr(e){return"function"==typeof e?e:null==e?oc:"object"==typeof e?Va(e)?$r(e[0],e[1]):Fr(e):hc(e)}function jr(e){if(!Ii(e))return Ht(e);var t=[];for(var n in _e(e))ze.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Ur(e){if(!ts(e))return function(e){var t=[];if(null!=e)for(var n in _e(e))t.push(n);return t}(e);var t=Ii(e),n=[];for(var r in e)("constructor"!=r||!t&&ze.call(e,r))&&n.push(r);return n}function Dr(e,t){return e<t}function Lr(e,t){var n=-1,o=Ga(e)?r(e.length):[];return hr(e,(function(e,r,i){o[++n]=t(e,r,i)})),o}function Fr(e){var t=fi(e);return 1==t.length&&t[0][2]?_i(t[0][0],t[0][1]):function(n){return n===e||Or(n,e,t)}}function $r(e,t){return Si(e)&&Ti(t)?_i(Ui(e),t):function(n){var r=_s(n,e);return r===o&&r===t?xs(n,e):Br(t,r,3)}}function qr(e,t,n,r,i){e!==t&&wr(t,(function(a,s){if(i||(i=new Jn),ts(a))!function(e,t,n,r,i,a,s){var c=Ri(e,n),u=Ri(t,n),l=s.get(u);if(l)return void tr(e,n,l);var d=a?a(c,u,n+"",e,t,s):o,f=d===o;if(f){var h=Va(u),p=!h&&Za(u),g=!h&&!p&&ls(u);d=u,h||p||g?Va(c)?d=c:Ha(c)?d=Po(c):p?(f=!1,d=Io(u,!0)):g?(f=!1,d=_o(u,!0)):d=[]:is(u)||Wa(u)?(d=c,Wa(c)?d=vs(c):ts(c)&&!Qa(c)||(d=vi(u))):f=!1}f&&(s.set(u,d),i(d,u,r,a,s),s.delete(u));tr(e,n,d)}(e,t,s,n,qr,r,i);else{var c=r?r(Ri(e,s),a,s+"",e,t,i):o;c===o&&(c=a),tr(e,s,c)}}),Bs)}function Wr(e,t){var n=e.length;if(n)return Ai(t+=t<0?n:0,n)?e[t]:o}function Vr(e,t,n){t=t.length?Mt(t,(function(e){return Va(e)?function(t){return kr(t,1===e.length?e[0]:e)}:e})):[oc];var r=-1;t=Mt(t,Xt(li()));var o=Lr(e,(function(e,n,o){var i=Mt(t,(function(t){return t(e)}));return{criteria:i,index:++r,value:e}}));return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(o,(function(e,t){return function(e,t,n){var r=-1,o=e.criteria,i=t.criteria,a=o.length,s=n.length;for(;++r<a;){var c=xo(o[r],i[r]);if(c)return r>=s?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function Kr(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var a=t[r],s=kr(e,a);n(s,a)&&eo(i,bo(a,e),s)}return i}function Gr(e,t,n,r){var o=r?Wt:qt,i=-1,a=t.length,s=e;for(e===t&&(t=Po(t)),n&&(s=Mt(e,Xt(n)));++i<a;)for(var c=0,u=t[i],l=n?n(u):u;(c=o(s,l,c,r))>-1;)s!==e&&Je.call(s,c,1),Je.call(e,c,1);return e}function Hr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var o=t[n];if(n==r||o!==i){var i=o;Ai(o)?Je.call(e,o,1):ho(e,o)}}return e}function Zr(e,t){return e+mt(En()*(t-e+1))}function Jr(e,t){var n="";if(!e||t<1||t>p)return n;do{t%2&&(n+=e),(t=mt(t/2))&&(e+=e)}while(t);return n}function Yr(e,t){return Bi(xi(e,t,oc),e+"")}function Qr(e){return Qn(Fs(e))}function Xr(e,t){var n=Fs(e);return zi(n,cr(t,0,n.length))}function eo(e,t,n,r){if(!ts(e))return e;for(var i=-1,a=(t=bo(t,e)).length,s=a-1,c=e;null!=c&&++i<a;){var u=Ui(t[i]),l=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(i!=s){var d=c[u];(l=r?r(d,u,c):o)===o&&(l=ts(d)?d:Ai(t[i+1])?[]:{})}nr(c,u,l),c=c[u]}return e}var to=Pn?function(e,t){return Pn.set(e,t),e}:oc,no=nt?function(e,t){return nt(e,"toString",{configurable:!0,enumerable:!1,value:tc(t),writable:!0})}:oc;function ro(e){return zi(Fs(e))}function oo(e,t,n){var o=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=r(i);++o<i;)a[o]=e[o+t];return a}function io(e,t){var n;return hr(e,(function(e,r,o){return!(n=t(e,r,o))})),!!n}function ao(e,t,n){var r=0,o=null==e?r:e.length;if("number"==typeof t&&t==t&&o<=2147483647){for(;r<o;){var i=r+o>>>1,a=e[i];null!==a&&!us(a)&&(n?a<=t:a<t)?r=i+1:o=i}return o}return so(e,t,oc,n)}function so(e,t,n,r){var i=0,a=null==e?0:e.length;if(0===a)return 0;for(var s=(t=n(t))!=t,c=null===t,u=us(t),l=t===o;i<a;){var d=mt((i+a)/2),f=n(e[d]),h=f!==o,p=null===f,g=f==f,m=us(f);if(s)var y=r||g;else y=l?g&&(r||h):c?g&&h&&(r||!p):u?g&&h&&!p&&(r||!m):!p&&!m&&(r?f<=t:f<t);y?i=d+1:a=d}return An(a,4294967294)}function co(e,t){for(var n=-1,r=e.length,o=0,i=[];++n<r;){var a=e[n],s=t?t(a):a;if(!n||!Fa(s,c)){var c=s;i[o++]=0===a?0:a}}return i}function uo(e){return"number"==typeof e?e:us(e)?g:+e}function lo(e){if("string"==typeof e)return e;if(Va(e))return Mt(e,lo)+"";if(us(e))return Ln?Ln.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function fo(e,t,n){var r=-1,o=Bt,i=e.length,a=!0,s=[],c=s;if(n)a=!1,o=Ot;else if(i>=200){var u=t?null:Yo(e);if(u)return fn(u);a=!1,o=tn,c=new Zn}else c=t?[]:s;e:for(;++r<i;){var l=e[r],d=t?t(l):l;if(l=n||0!==l?l:0,a&&d==d){for(var f=c.length;f--;)if(c[f]===d)continue e;t&&c.push(d),s.push(l)}else o(c,d,n)||(c!==s&&c.push(d),s.push(l))}return s}function ho(e,t){return null==(e=Ci(e,t=bo(t,e)))||delete e[Ui(Yi(t))]}function po(e,t,n,r){return eo(e,t,n(kr(e,t)),r)}function go(e,t,n,r){for(var o=e.length,i=r?o:-1;(r?i--:++i<o)&&t(e[i],i,e););return n?oo(e,r?0:i,r?i+1:o):oo(e,r?i+1:0,r?o:i)}function mo(e,t){var n=e;return n instanceof Vn&&(n=n.value()),jt(t,(function(e,t){return t.func.apply(t.thisArg,zt([e],t.args))}),n)}function yo(e,t,n){var o=e.length;if(o<2)return o?fo(e[0]):[];for(var i=-1,a=r(o);++i<o;)for(var s=e[i],c=-1;++c<o;)c!=i&&(a[i]=fr(a[i]||s,e[c],t,n));return fo(vr(a,1),t,n)}function vo(e,t,n){for(var r=-1,i=e.length,a=t.length,s={};++r<i;){var c=r<a?t[r]:o;n(s,e[r],c)}return s}function wo(e){return Ha(e)?e:[]}function Ao(e){return"function"==typeof e?e:oc}function bo(e,t){return Va(e)?e:Si(e,t)?[e]:ji(ws(e))}var So=Yr;function Eo(e,t,n){var r=e.length;return n=n===o?r:n,!t&&n>=r?e:oo(e,t,n)}var ko=ot||function(e){return gt.clearTimeout(e)};function Io(e,t){if(t)return e.slice();var n=e.length,r=Ke?Ke(n):new e.constructor(n);return e.copy(r),r}function To(e){var t=new e.constructor(e.byteLength);return new Ve(t).set(new Ve(e)),t}function _o(e,t){var n=t?To(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function xo(e,t){if(e!==t){var n=e!==o,r=null===e,i=e==e,a=us(e),s=t!==o,c=null===t,u=t==t,l=us(t);if(!c&&!l&&!a&&e>t||a&&s&&u&&!c&&!l||r&&s&&u||!n&&u||!i)return 1;if(!r&&!a&&!l&&e<t||l&&n&&i&&!r&&!a||c&&n&&i||!s&&i||!u)return-1}return 0}function Co(e,t,n,o){for(var i=-1,a=e.length,s=n.length,c=-1,u=t.length,l=wn(a-s,0),d=r(u+l),f=!o;++c<u;)d[c]=t[c];for(;++i<s;)(f||i<a)&&(d[n[i]]=e[i]);for(;l--;)d[c++]=e[i++];return d}function Ro(e,t,n,o){for(var i=-1,a=e.length,s=-1,c=n.length,u=-1,l=t.length,d=wn(a-c,0),f=r(d+l),h=!o;++i<d;)f[i]=e[i];for(var p=i;++u<l;)f[p+u]=t[u];for(;++s<c;)(h||i<a)&&(f[p+n[s]]=e[i++]);return f}function Po(e,t){var n=-1,o=e.length;for(t||(t=r(o));++n<o;)t[n]=e[n];return t}function No(e,t,n,r){var i=!n;n||(n={});for(var a=-1,s=t.length;++a<s;){var c=t[a],u=r?r(n[c],e[c],c,n,e):o;u===o&&(u=e[c]),i?ar(n,c,u):nr(n,c,u)}return n}function Bo(e,t){return function(n,r){var o=Va(n)?xt:or,i=t?t():{};return o(n,e,li(r,2),i)}}function Oo(e){return Yr((function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:o,s=i>2?n[2]:o;for(a=e.length>3&&"function"==typeof a?(i--,a):o,s&&bi(n[0],n[1],s)&&(a=i<3?o:a,i=1),t=_e(t);++r<i;){var c=n[r];c&&e(t,c,r,a)}return t}))}function Mo(e,t){return function(n,r){if(null==n)return n;if(!Ga(n))return e(n,r);for(var o=n.length,i=t?o:-1,a=_e(n);(t?i--:++i<o)&&!1!==r(a[i],i,a););return n}}function zo(e){return function(t,n,r){for(var o=-1,i=_e(t),a=r(t),s=a.length;s--;){var c=a[e?s:++o];if(!1===n(i[c],c,i))break}return t}}function jo(e){return function(t){var n=cn(t=ws(t))?gn(t):o,r=n?n[0]:t.charAt(0),i=n?Eo(n,1).join(""):t.slice(1);return r[e]()+i}}function Uo(e){return function(t){return jt(Qs(Ws(t).replace(et,"")),e,"")}}function Do(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=$n(e.prototype),r=e.apply(n,t);return ts(r)?r:n}}function Lo(e){return function(t,n,r){var i=_e(t);if(!Ga(t)){var a=li(n,3);t=Ns(t),n=function(e){return a(i[e],e,i)}}var s=e(t,n,r);return s>-1?i[a?t[s]:s]:o}}function Fo(e){return oi((function(t){var n=t.length,r=n,a=Wn.prototype.thru;for(e&&t.reverse();r--;){var s=t[r];if("function"!=typeof s)throw new Re(i);if(a&&!c&&"wrapper"==ci(s))var c=new Wn([],!0)}for(r=c?r:n;++r<n;){var u=ci(s=t[r]),l="wrapper"==u?si(s):o;c=l&&Ei(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?c[ci(l[0])].apply(c,l[3]):1==s.length&&Ei(s)?c[u]():c.thru(s)}return function(){var e=arguments,r=e[0];if(c&&1==e.length&&Va(r))return c.plant(r).value();for(var o=0,i=n?t[o].apply(this,e):r;++o<n;)i=t[o].call(this,i);return i}}))}function $o(e,t,n,i,a,s,c,u,l,f){var h=t&d,p=1&t,g=2&t,m=24&t,y=512&t,v=g?o:Do(e);return function d(){for(var w=arguments.length,A=r(w),b=w;b--;)A[b]=arguments[b];if(m)var S=ui(d),E=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(A,S);if(i&&(A=Co(A,i,a,m)),s&&(A=Ro(A,s,c,m)),w-=E,m&&w<f){var k=dn(A,S);return Zo(e,t,$o,d.placeholder,n,A,k,u,l,f-w)}var I=p?n:this,T=g?I[e]:e;return w=A.length,u?A=function(e,t){var n=e.length,r=An(t.length,n),i=Po(e);for(;r--;){var a=t[r];e[r]=Ai(a,n)?i[a]:o}return e}(A,u):y&&w>1&&A.reverse(),h&&l<w&&(A.length=l),this&&this!==gt&&this instanceof d&&(T=v||Do(T)),T.apply(I,A)}}function qo(e,t){return function(n,r){return function(e,t,n,r){return br(e,(function(e,o,i){t(r,n(e),o,i)})),r}(n,e,t(r),{})}}function Wo(e,t){return function(n,r){var i;if(n===o&&r===o)return t;if(n!==o&&(i=n),r!==o){if(i===o)return r;"string"==typeof n||"string"==typeof r?(n=lo(n),r=lo(r)):(n=uo(n),r=uo(r)),i=e(n,r)}return i}}function Vo(e){return oi((function(t){return t=Mt(t,Xt(li())),Yr((function(n){var r=this;return e(t,(function(e){return _t(e,r,n)}))}))}))}function Ko(e,t){var n=(t=t===o?" ":lo(t)).length;if(n<2)return n?Jr(t,e):t;var r=Jr(t,pt(e/pn(t)));return cn(t)?Eo(gn(r),0,e).join(""):r.slice(0,e)}function Go(e){return function(t,n,i){return i&&"number"!=typeof i&&bi(t,n,i)&&(n=i=o),t=ps(t),n===o?(n=t,t=0):n=ps(n),function(e,t,n,o){for(var i=-1,a=wn(pt((t-e)/(n||1)),0),s=r(a);a--;)s[o?a:++i]=e,e+=n;return s}(t,n,i=i===o?t<n?1:-1:ps(i),e)}}function Ho(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ys(t),n=ys(n)),e(t,n)}}function Zo(e,t,n,r,i,a,s,c,d,f){var h=8&t;t|=h?u:l,4&(t&=~(h?l:u))||(t&=-4);var p=[e,t,i,h?a:o,h?s:o,h?o:a,h?o:s,c,d,f],g=n.apply(o,p);return Ei(e)&&Pi(g,p),g.placeholder=r,Oi(g,e,t)}function Jo(e){var t=Te[e];return function(e,n){if(e=ys(e),(n=null==n?0:An(gs(n),292))&&At(e)){var r=(ws(e)+"e").split("e");return+((r=(ws(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Yo=xn&&1/fn(new xn([,-0]))[1]==h?function(e){return new xn(e)}:uc;function Qo(e){return function(t){var n=mi(t);return n==I?un(t):n==R?hn(t):function(e,t){return Mt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Xo(e,t,n,a,h,p,g,m){var y=2&t;if(!y&&"function"!=typeof e)throw new Re(i);var v=a?a.length:0;if(v||(t&=-97,a=h=o),g=g===o?g:wn(gs(g),0),m=m===o?m:gs(m),v-=h?h.length:0,t&l){var w=a,A=h;a=h=o}var b=y?o:si(e),S=[e,t,n,a,h,w,A,p,g,m];if(b&&function(e,t){var n=e[1],r=t[1],o=n|r,i=o<131,a=r==d&&8==n||r==d&&n==f&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!i&&!a)return e;1&r&&(e[2]=t[2],o|=1&n?0:4);var c=t[3];if(c){var u=e[3];e[3]=u?Co(u,c,t[4]):c,e[4]=u?dn(e[3],s):t[4]}(c=t[5])&&(u=e[5],e[5]=u?Ro(u,c,t[6]):c,e[6]=u?dn(e[5],s):t[6]);(c=t[7])&&(e[7]=c);r&d&&(e[8]=null==e[8]?t[8]:An(e[8],t[8]));null==e[9]&&(e[9]=t[9]);e[0]=t[0],e[1]=o}(S,b),e=S[0],t=S[1],n=S[2],a=S[3],h=S[4],!(m=S[9]=S[9]===o?y?0:e.length:wn(S[9]-v,0))&&24&t&&(t&=-25),t&&1!=t)E=8==t||t==c?function(e,t,n){var i=Do(e);return function a(){for(var s=arguments.length,c=r(s),u=s,l=ui(a);u--;)c[u]=arguments[u];var d=s<3&&c[0]!==l&&c[s-1]!==l?[]:dn(c,l);return(s-=d.length)<n?Zo(e,t,$o,a.placeholder,o,c,d,o,o,n-s):_t(this&&this!==gt&&this instanceof a?i:e,this,c)}}(e,t,m):t!=u&&33!=t||h.length?$o.apply(o,S):function(e,t,n,o){var i=1&t,a=Do(e);return function t(){for(var s=-1,c=arguments.length,u=-1,l=o.length,d=r(l+c),f=this&&this!==gt&&this instanceof t?a:e;++u<l;)d[u]=o[u];for(;c--;)d[u++]=arguments[++s];return _t(f,i?n:this,d)}}(e,t,n,a);else var E=function(e,t,n){var r=1&t,o=Do(e);return function t(){return(this&&this!==gt&&this instanceof t?o:e).apply(r?n:this,arguments)}}(e,t,n);return Oi((b?to:Pi)(E,S),e,t)}function ei(e,t,n,r){return e===o||Fa(e,Be[n])&&!ze.call(r,n)?t:e}function ti(e,t,n,r,i,a){return ts(e)&&ts(t)&&(a.set(t,e),qr(e,t,o,ti,a),a.delete(t)),e}function ni(e){return is(e)?o:e}function ri(e,t,n,r,i,a){var s=1&n,c=e.length,u=t.length;if(c!=u&&!(s&&u>c))return!1;var l=a.get(e),d=a.get(t);if(l&&d)return l==t&&d==e;var f=-1,h=!0,p=2&n?new Zn:o;for(a.set(e,t),a.set(t,e);++f<c;){var g=e[f],m=t[f];if(r)var y=s?r(m,g,f,t,e,a):r(g,m,f,e,t,a);if(y!==o){if(y)continue;h=!1;break}if(p){if(!Dt(t,(function(e,t){if(!tn(p,t)&&(g===e||i(g,e,n,r,a)))return p.push(t)}))){h=!1;break}}else if(g!==m&&!i(g,m,n,r,a)){h=!1;break}}return a.delete(e),a.delete(t),h}function oi(e){return Bi(xi(e,o,Ki),e+"")}function ii(e){return Ir(e,Ns,pi)}function ai(e){return Ir(e,Bs,gi)}var si=Pn?function(e){return Pn.get(e)}:uc;function ci(e){for(var t=e.name+"",n=Nn[t],r=ze.call(Nn,t)?n.length:0;r--;){var o=n[r],i=o.func;if(null==i||i==e)return o.name}return t}function ui(e){return(ze.call(Fn,"placeholder")?Fn:e).placeholder}function li(){var e=Fn.iteratee||ic;return e=e===ic?zr:e,arguments.length?e(arguments[0],arguments[1]):e}function di(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function fi(e){for(var t=Ns(e),n=t.length;n--;){var r=t[n],o=e[r];t[n]=[r,o,Ti(o)]}return t}function hi(e,t){var n=function(e,t){return null==e?o:e[t]}(e,t);return Mr(n)?n:o}var pi=yt?function(e){return null==e?[]:(e=_e(e),Nt(yt(e),(function(t){return Ze.call(e,t)})))}:mc,gi=yt?function(e){for(var t=[];e;)zt(t,pi(e)),e=Ge(e);return t}:mc,mi=Tr;function yi(e,t,n){for(var r=-1,o=(t=bo(t,e)).length,i=!1;++r<o;){var a=Ui(t[r]);if(!(i=null!=e&&n(e,a)))break;e=e[a]}return i||++r!=o?i:!!(o=null==e?0:e.length)&&es(o)&&Ai(a,o)&&(Va(e)||Wa(e))}function vi(e){return"function"!=typeof e.constructor||Ii(e)?{}:$n(Ge(e))}function wi(e){return Va(e)||Wa(e)||!!(Ye&&e&&e[Ye])}function Ai(e,t){var n=typeof e;return!!(t=null==t?p:t)&&("number"==n||"symbol"!=n&&Ae.test(e))&&e>-1&&e%1==0&&e<t}function bi(e,t,n){if(!ts(n))return!1;var r=typeof t;return!!("number"==r?Ga(n)&&Ai(t,n.length):"string"==r&&t in n)&&Fa(n[t],e)}function Si(e,t){if(Va(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!us(e))||(ne.test(e)||!te.test(e)||null!=t&&e in _e(t))}function Ei(e){var t=ci(e),n=Fn[t];if("function"!=typeof n||!(t in Vn.prototype))return!1;if(e===n)return!0;var r=si(n);return!!r&&e===r[0]}(In&&mi(new In(new ArrayBuffer(1)))!=M||Tn&&mi(new Tn)!=I||_n&&mi(_n.resolve())!=x||xn&&mi(new xn)!=R||Cn&&mi(new Cn)!=B)&&(mi=function(e){var t=Tr(e),n=t==_?e.constructor:o,r=n?Di(n):"";if(r)switch(r){case Bn:return M;case On:return I;case Mn:return x;case zn:return R;case jn:return B}return t});var ki=Oe?Qa:yc;function Ii(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Be)}function Ti(e){return e==e&&!ts(e)}function _i(e,t){return function(n){return null!=n&&(n[e]===t&&(t!==o||e in _e(n)))}}function xi(e,t,n){return t=wn(t===o?e.length-1:t,0),function(){for(var o=arguments,i=-1,a=wn(o.length-t,0),s=r(a);++i<a;)s[i]=o[t+i];i=-1;for(var c=r(t+1);++i<t;)c[i]=o[i];return c[t]=n(s),_t(e,this,c)}}function Ci(e,t){return t.length<2?e:kr(e,oo(t,0,-1))}function Ri(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Pi=Mi(to),Ni=ht||function(e,t){return gt.setTimeout(e,t)},Bi=Mi(no);function Oi(e,t,n){var r=t+"";return Bi(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ce,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Ct(y,(function(n){var r="_."+n[0];t&n[1]&&!Bt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ue);return t?t[1].split(le):[]}(r),n)))}function Mi(e){var t=0,n=0;return function(){var r=bn(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(o,arguments)}}function zi(e,t){var n=-1,r=e.length,i=r-1;for(t=t===o?r:t;++n<t;){var a=Zr(n,i),s=e[a];e[a]=e[n],e[n]=s}return e.length=t,e}var ji=function(e){var t=Ma(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(re,(function(e,n,r,o){t.push(r?o.replace(he,"$1"):n||e)})),t}));function Ui(e){if("string"==typeof e||us(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Di(e){if(null!=e){try{return Me.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Li(e){if(e instanceof Vn)return e.clone();var t=new Wn(e.__wrapped__,e.__chain__);return t.__actions__=Po(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Fi=Yr((function(e,t){return Ha(e)?fr(e,vr(t,1,Ha,!0)):[]})),$i=Yr((function(e,t){var n=Yi(t);return Ha(n)&&(n=o),Ha(e)?fr(e,vr(t,1,Ha,!0),li(n,2)):[]})),qi=Yr((function(e,t){var n=Yi(t);return Ha(n)&&(n=o),Ha(e)?fr(e,vr(t,1,Ha,!0),o,n):[]}));function Wi(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:gs(n);return o<0&&(o=wn(r+o,0)),$t(e,li(t,3),o)}function Vi(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r-1;return n!==o&&(i=gs(n),i=n<0?wn(r+i,0):An(i,r-1)),$t(e,li(t,3),i,!0)}function Ki(e){return(null==e?0:e.length)?vr(e,1):[]}function Gi(e){return e&&e.length?e[0]:o}var Hi=Yr((function(e){var t=Mt(e,wo);return t.length&&t[0]===e[0]?Rr(t):[]})),Zi=Yr((function(e){var t=Yi(e),n=Mt(e,wo);return t===Yi(n)?t=o:n.pop(),n.length&&n[0]===e[0]?Rr(n,li(t,2)):[]})),Ji=Yr((function(e){var t=Yi(e),n=Mt(e,wo);return(t="function"==typeof t?t:o)&&n.pop(),n.length&&n[0]===e[0]?Rr(n,o,t):[]}));function Yi(e){var t=null==e?0:e.length;return t?e[t-1]:o}var Qi=Yr(Xi);function Xi(e,t){return e&&e.length&&t&&t.length?Gr(e,t):e}var ea=oi((function(e,t){var n=null==e?0:e.length,r=sr(e,t);return Hr(e,Mt(t,(function(e){return Ai(e,n)?+e:e})).sort(xo)),r}));function ta(e){return null==e?e:kn.call(e)}var na=Yr((function(e){return fo(vr(e,1,Ha,!0))})),ra=Yr((function(e){var t=Yi(e);return Ha(t)&&(t=o),fo(vr(e,1,Ha,!0),li(t,2))})),oa=Yr((function(e){var t=Yi(e);return t="function"==typeof t?t:o,fo(vr(e,1,Ha,!0),o,t)}));function ia(e){if(!e||!e.length)return[];var t=0;return e=Nt(e,(function(e){if(Ha(e))return t=wn(e.length,t),!0})),Yt(t,(function(t){return Mt(e,Gt(t))}))}function aa(e,t){if(!e||!e.length)return[];var n=ia(e);return null==t?n:Mt(n,(function(e){return _t(t,o,e)}))}var sa=Yr((function(e,t){return Ha(e)?fr(e,t):[]})),ca=Yr((function(e){return yo(Nt(e,Ha))})),ua=Yr((function(e){var t=Yi(e);return Ha(t)&&(t=o),yo(Nt(e,Ha),li(t,2))})),la=Yr((function(e){var t=Yi(e);return t="function"==typeof t?t:o,yo(Nt(e,Ha),o,t)})),da=Yr(ia);var fa=Yr((function(e){var t=e.length,n=t>1?e[t-1]:o;return n="function"==typeof n?(e.pop(),n):o,aa(e,n)}));function ha(e){var t=Fn(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ga=oi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,i=function(t){return sr(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Vn&&Ai(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[i],thisArg:o}),new Wn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(o),e}))):this.thru(i)}));var ma=Bo((function(e,t,n){ze.call(e,n)?++e[n]:ar(e,n,1)}));var ya=Lo(Wi),va=Lo(Vi);function wa(e,t){return(Va(e)?Ct:hr)(e,li(t,3))}function Aa(e,t){return(Va(e)?Rt:pr)(e,li(t,3))}var ba=Bo((function(e,t,n){ze.call(e,n)?e[n].push(t):ar(e,n,[t])}));var Sa=Yr((function(e,t,n){var o=-1,i="function"==typeof t,a=Ga(e)?r(e.length):[];return hr(e,(function(e){a[++o]=i?_t(t,e,n):Pr(e,t,n)})),a})),Ea=Bo((function(e,t,n){ar(e,n,t)}));function ka(e,t){return(Va(e)?Mt:Lr)(e,li(t,3))}var Ia=Bo((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var Ta=Yr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&bi(e,t[0],t[1])?t=[]:n>2&&bi(t[0],t[1],t[2])&&(t=[t[0]]),Vr(e,vr(t,1),[])})),_a=lt||function(){return gt.Date.now()};function xa(e,t,n){return t=n?o:t,t=e&&null==t?e.length:t,Xo(e,d,o,o,o,o,t)}function Ca(e,t){var n;if("function"!=typeof t)throw new Re(i);return e=gs(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=o),n}}var Ra=Yr((function(e,t,n){var r=1;if(n.length){var o=dn(n,ui(Ra));r|=u}return Xo(e,r,t,n,o)})),Pa=Yr((function(e,t,n){var r=3;if(n.length){var o=dn(n,ui(Pa));r|=u}return Xo(t,r,e,n,o)}));function Na(e,t,n){var r,a,s,c,u,l,d=0,f=!1,h=!1,p=!0;if("function"!=typeof e)throw new Re(i);function g(t){var n=r,i=a;return r=a=o,d=t,c=e.apply(i,n)}function m(e){var n=e-l;return l===o||n>=t||n<0||h&&e-d>=s}function y(){var e=_a();if(m(e))return v(e);u=Ni(y,function(e){var n=t-(e-l);return h?An(n,s-(e-d)):n}(e))}function v(e){return u=o,p&&r?g(e):(r=a=o,c)}function w(){var e=_a(),n=m(e);if(r=arguments,a=this,l=e,n){if(u===o)return function(e){return d=e,u=Ni(y,t),f?g(e):c}(l);if(h)return ko(u),u=Ni(y,t),g(l)}return u===o&&(u=Ni(y,t)),c}return t=ys(t)||0,ts(n)&&(f=!!n.leading,s=(h="maxWait"in n)?wn(ys(n.maxWait)||0,t):s,p="trailing"in n?!!n.trailing:p),w.cancel=function(){u!==o&&ko(u),d=0,r=l=a=u=o},w.flush=function(){return u===o?c:v(_a())},w}var Ba=Yr((function(e,t){return dr(e,1,t)})),Oa=Yr((function(e,t,n){return dr(e,ys(t)||0,n)}));function Ma(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Re(i);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(Ma.Cache||Hn),n}function za(e){if("function"!=typeof e)throw new Re(i);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ma.Cache=Hn;var ja=So((function(e,t){var n=(t=1==t.length&&Va(t[0])?Mt(t[0],Xt(li())):Mt(vr(t,1),Xt(li()))).length;return Yr((function(r){for(var o=-1,i=An(r.length,n);++o<i;)r[o]=t[o].call(this,r[o]);return _t(e,this,r)}))})),Ua=Yr((function(e,t){var n=dn(t,ui(Ua));return Xo(e,u,o,t,n)})),Da=Yr((function(e,t){var n=dn(t,ui(Da));return Xo(e,l,o,t,n)})),La=oi((function(e,t){return Xo(e,f,o,o,o,t)}));function Fa(e,t){return e===t||e!=e&&t!=t}var $a=Ho(_r),qa=Ho((function(e,t){return e>=t})),Wa=Nr(function(){return arguments}())?Nr:function(e){return ns(e)&&ze.call(e,"callee")&&!Ze.call(e,"callee")},Va=r.isArray,Ka=bt?Xt(bt):function(e){return ns(e)&&Tr(e)==O};function Ga(e){return null!=e&&es(e.length)&&!Qa(e)}function Ha(e){return ns(e)&&Ga(e)}var Za=wt||yc,Ja=St?Xt(St):function(e){return ns(e)&&Tr(e)==b};function Ya(e){if(!ns(e))return!1;var t=Tr(e);return t==S||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!is(e)}function Qa(e){if(!ts(e))return!1;var t=Tr(e);return t==E||t==k||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Xa(e){return"number"==typeof e&&e==gs(e)}function es(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=p}function ts(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ns(e){return null!=e&&"object"==typeof e}var rs=Et?Xt(Et):function(e){return ns(e)&&mi(e)==I};function os(e){return"number"==typeof e||ns(e)&&Tr(e)==T}function is(e){if(!ns(e)||Tr(e)!=_)return!1;var t=Ge(e);if(null===t)return!0;var n=ze.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Me.call(n)==Le}var as=kt?Xt(kt):function(e){return ns(e)&&Tr(e)==C};var ss=It?Xt(It):function(e){return ns(e)&&mi(e)==R};function cs(e){return"string"==typeof e||!Va(e)&&ns(e)&&Tr(e)==P}function us(e){return"symbol"==typeof e||ns(e)&&Tr(e)==N}var ls=Tt?Xt(Tt):function(e){return ns(e)&&es(e.length)&&!!ct[Tr(e)]};var ds=Ho(Dr),fs=Ho((function(e,t){return e<=t}));function hs(e){if(!e)return[];if(Ga(e))return cs(e)?gn(e):Po(e);if(Qe&&e[Qe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Qe]());var t=mi(e);return(t==I?un:t==R?fn:Fs)(e)}function ps(e){return e?(e=ys(e))===h||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function gs(e){var t=ps(e),n=t%1;return t==t?n?t-n:t:0}function ms(e){return e?cr(gs(e),0,m):0}function ys(e){if("number"==typeof e)return e;if(us(e))return g;if(ts(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ts(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Qt(e);var n=ye.test(e);return n||we.test(e)?ft(e.slice(2),n?2:8):me.test(e)?g:+e}function vs(e){return No(e,Bs(e))}function ws(e){return null==e?"":lo(e)}var As=Oo((function(e,t){if(Ii(t)||Ga(t))No(t,Ns(t),e);else for(var n in t)ze.call(t,n)&&nr(e,n,t[n])})),bs=Oo((function(e,t){No(t,Bs(t),e)})),Ss=Oo((function(e,t,n,r){No(t,Bs(t),e,r)})),Es=Oo((function(e,t,n,r){No(t,Ns(t),e,r)})),ks=oi(sr);var Is=Yr((function(e,t){e=_e(e);var n=-1,r=t.length,i=r>2?t[2]:o;for(i&&bi(t[0],t[1],i)&&(r=1);++n<r;)for(var a=t[n],s=Bs(a),c=-1,u=s.length;++c<u;){var l=s[c],d=e[l];(d===o||Fa(d,Be[l])&&!ze.call(e,l))&&(e[l]=a[l])}return e})),Ts=Yr((function(e){return e.push(o,ti),_t(Ms,o,e)}));function _s(e,t,n){var r=null==e?o:kr(e,t);return r===o?n:r}function xs(e,t){return null!=e&&yi(e,t,Cr)}var Cs=qo((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),e[t]=n}),tc(oc)),Rs=qo((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),ze.call(e,t)?e[t].push(n):e[t]=[n]}),li),Ps=Yr(Pr);function Ns(e){return Ga(e)?Yn(e):jr(e)}function Bs(e){return Ga(e)?Yn(e,!0):Ur(e)}var Os=Oo((function(e,t,n){qr(e,t,n)})),Ms=Oo((function(e,t,n,r){qr(e,t,n,r)})),zs=oi((function(e,t){var n={};if(null==e)return n;var r=!1;t=Mt(t,(function(t){return t=bo(t,e),r||(r=t.length>1),t})),No(e,ai(e),n),r&&(n=ur(n,7,ni));for(var o=t.length;o--;)ho(n,t[o]);return n}));var js=oi((function(e,t){return null==e?{}:function(e,t){return Kr(e,t,(function(t,n){return xs(e,n)}))}(e,t)}));function Us(e,t){if(null==e)return{};var n=Mt(ai(e),(function(e){return[e]}));return t=li(t),Kr(e,n,(function(e,n){return t(e,n[0])}))}var Ds=Qo(Ns),Ls=Qo(Bs);function Fs(e){return null==e?[]:en(e,Ns(e))}var $s=Uo((function(e,t,n){return t=t.toLowerCase(),e+(n?qs(t):t)}));function qs(e){return Ys(ws(e).toLowerCase())}function Ws(e){return(e=ws(e))&&e.replace(be,on).replace(tt,"")}var Vs=Uo((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Ks=Uo((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Gs=jo("toLowerCase");var Hs=Uo((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var Zs=Uo((function(e,t,n){return e+(n?" ":"")+Ys(t)}));var Js=Uo((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Ys=jo("toUpperCase");function Qs(e,t,n){return e=ws(e),(t=n?o:t)===o?function(e){return it.test(e)}(e)?function(e){return e.match(rt)||[]}(e):function(e){return e.match(de)||[]}(e):e.match(t)||[]}var Xs=Yr((function(e,t){try{return _t(e,o,t)}catch(e){return Ya(e)?e:new ke(e)}})),ec=oi((function(e,t){return Ct(t,(function(t){t=Ui(t),ar(e,t,Ra(e[t],e))})),e}));function tc(e){return function(){return e}}var nc=Fo(),rc=Fo(!0);function oc(e){return e}function ic(e){return zr("function"==typeof e?e:ur(e,1))}var ac=Yr((function(e,t){return function(n){return Pr(n,e,t)}})),sc=Yr((function(e,t){return function(n){return Pr(e,n,t)}}));function cc(e,t,n){var r=Ns(t),o=Er(t,r);null!=n||ts(t)&&(o.length||!r.length)||(n=t,t=e,e=this,o=Er(t,Ns(t)));var i=!(ts(n)&&"chain"in n&&!n.chain),a=Qa(e);return Ct(o,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__);return(n.__actions__=Po(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,zt([this.value()],arguments))})})),e}function uc(){}var lc=Vo(Mt),dc=Vo(Pt),fc=Vo(Dt);function hc(e){return Si(e)?Gt(Ui(e)):function(e){return function(t){return kr(t,e)}}(e)}var pc=Go(),gc=Go(!0);function mc(){return[]}function yc(){return!1}var vc=Wo((function(e,t){return e+t}),0),wc=Jo("ceil"),Ac=Wo((function(e,t){return e/t}),1),bc=Jo("floor");var Sc,Ec=Wo((function(e,t){return e*t}),1),kc=Jo("round"),Ic=Wo((function(e,t){return e-t}),0);return Fn.after=function(e,t){if("function"!=typeof t)throw new Re(i);return e=gs(e),function(){if(--e<1)return t.apply(this,arguments)}},Fn.ary=xa,Fn.assign=As,Fn.assignIn=bs,Fn.assignInWith=Ss,Fn.assignWith=Es,Fn.at=ks,Fn.before=Ca,Fn.bind=Ra,Fn.bindAll=ec,Fn.bindKey=Pa,Fn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Va(e)?e:[e]},Fn.chain=ha,Fn.chunk=function(e,t,n){t=(n?bi(e,t,n):t===o)?1:wn(gs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,s=0,c=r(pt(i/t));a<i;)c[s++]=oo(e,a,a+=t);return c},Fn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,o=[];++t<n;){var i=e[t];i&&(o[r++]=i)}return o},Fn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=r(e-1),n=arguments[0],o=e;o--;)t[o-1]=arguments[o];return zt(Va(n)?Po(n):[n],vr(t,1))},Fn.cond=function(e){var t=null==e?0:e.length,n=li();return e=t?Mt(e,(function(e){if("function"!=typeof e[1])throw new Re(i);return[n(e[0]),e[1]]})):[],Yr((function(n){for(var r=-1;++r<t;){var o=e[r];if(_t(o[0],this,n))return _t(o[1],this,n)}}))},Fn.conforms=function(e){return function(e){var t=Ns(e);return function(n){return lr(n,e,t)}}(ur(e,1))},Fn.constant=tc,Fn.countBy=ma,Fn.create=function(e,t){var n=$n(e);return null==t?n:ir(n,t)},Fn.curry=function e(t,n,r){var i=Xo(t,8,o,o,o,o,o,n=r?o:n);return i.placeholder=e.placeholder,i},Fn.curryRight=function e(t,n,r){var i=Xo(t,c,o,o,o,o,o,n=r?o:n);return i.placeholder=e.placeholder,i},Fn.debounce=Na,Fn.defaults=Is,Fn.defaultsDeep=Ts,Fn.defer=Ba,Fn.delay=Oa,Fn.difference=Fi,Fn.differenceBy=$i,Fn.differenceWith=qi,Fn.drop=function(e,t,n){var r=null==e?0:e.length;return r?oo(e,(t=n||t===o?1:gs(t))<0?0:t,r):[]},Fn.dropRight=function(e,t,n){var r=null==e?0:e.length;return r?oo(e,0,(t=r-(t=n||t===o?1:gs(t)))<0?0:t):[]},Fn.dropRightWhile=function(e,t){return e&&e.length?go(e,li(t,3),!0,!0):[]},Fn.dropWhile=function(e,t){return e&&e.length?go(e,li(t,3),!0):[]},Fn.fill=function(e,t,n,r){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&bi(e,t,n)&&(n=0,r=i),function(e,t,n,r){var i=e.length;for((n=gs(n))<0&&(n=-n>i?0:i+n),(r=r===o||r>i?i:gs(r))<0&&(r+=i),r=n>r?0:ms(r);n<r;)e[n++]=t;return e}(e,t,n,r)):[]},Fn.filter=function(e,t){return(Va(e)?Nt:yr)(e,li(t,3))},Fn.flatMap=function(e,t){return vr(ka(e,t),1)},Fn.flatMapDeep=function(e,t){return vr(ka(e,t),h)},Fn.flatMapDepth=function(e,t,n){return n=n===o?1:gs(n),vr(ka(e,t),n)},Fn.flatten=Ki,Fn.flattenDeep=function(e){return(null==e?0:e.length)?vr(e,h):[]},Fn.flattenDepth=function(e,t){return(null==e?0:e.length)?vr(e,t=t===o?1:gs(t)):[]},Fn.flip=function(e){return Xo(e,512)},Fn.flow=nc,Fn.flowRight=rc,Fn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var o=e[t];r[o[0]]=o[1]}return r},Fn.functions=function(e){return null==e?[]:Er(e,Ns(e))},Fn.functionsIn=function(e){return null==e?[]:Er(e,Bs(e))},Fn.groupBy=ba,Fn.initial=function(e){return(null==e?0:e.length)?oo(e,0,-1):[]},Fn.intersection=Hi,Fn.intersectionBy=Zi,Fn.intersectionWith=Ji,Fn.invert=Cs,Fn.invertBy=Rs,Fn.invokeMap=Sa,Fn.iteratee=ic,Fn.keyBy=Ea,Fn.keys=Ns,Fn.keysIn=Bs,Fn.map=ka,Fn.mapKeys=function(e,t){var n={};return t=li(t,3),br(e,(function(e,r,o){ar(n,t(e,r,o),e)})),n},Fn.mapValues=function(e,t){var n={};return t=li(t,3),br(e,(function(e,r,o){ar(n,r,t(e,r,o))})),n},Fn.matches=function(e){return Fr(ur(e,1))},Fn.matchesProperty=function(e,t){return $r(e,ur(t,1))},Fn.memoize=Ma,Fn.merge=Os,Fn.mergeWith=Ms,Fn.method=ac,Fn.methodOf=sc,Fn.mixin=cc,Fn.negate=za,Fn.nthArg=function(e){return e=gs(e),Yr((function(t){return Wr(t,e)}))},Fn.omit=zs,Fn.omitBy=function(e,t){return Us(e,za(li(t)))},Fn.once=function(e){return Ca(2,e)},Fn.orderBy=function(e,t,n,r){return null==e?[]:(Va(t)||(t=null==t?[]:[t]),Va(n=r?o:n)||(n=null==n?[]:[n]),Vr(e,t,n))},Fn.over=lc,Fn.overArgs=ja,Fn.overEvery=dc,Fn.overSome=fc,Fn.partial=Ua,Fn.partialRight=Da,Fn.partition=Ia,Fn.pick=js,Fn.pickBy=Us,Fn.property=hc,Fn.propertyOf=function(e){return function(t){return null==e?o:kr(e,t)}},Fn.pull=Qi,Fn.pullAll=Xi,Fn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Gr(e,t,li(n,2)):e},Fn.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Gr(e,t,o,n):e},Fn.pullAt=ea,Fn.range=pc,Fn.rangeRight=gc,Fn.rearg=La,Fn.reject=function(e,t){return(Va(e)?Nt:yr)(e,za(li(t,3)))},Fn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,o=[],i=e.length;for(t=li(t,3);++r<i;){var a=e[r];t(a,r,e)&&(n.push(a),o.push(r))}return Hr(e,o),n},Fn.rest=function(e,t){if("function"!=typeof e)throw new Re(i);return Yr(e,t=t===o?t:gs(t))},Fn.reverse=ta,Fn.sampleSize=function(e,t,n){return t=(n?bi(e,t,n):t===o)?1:gs(t),(Va(e)?Xn:Xr)(e,t)},Fn.set=function(e,t,n){return null==e?e:eo(e,t,n)},Fn.setWith=function(e,t,n,r){return r="function"==typeof r?r:o,null==e?e:eo(e,t,n,r)},Fn.shuffle=function(e){return(Va(e)?er:ro)(e)},Fn.slice=function(e,t,n){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&bi(e,t,n)?(t=0,n=r):(t=null==t?0:gs(t),n=n===o?r:gs(n)),oo(e,t,n)):[]},Fn.sortBy=Ta,Fn.sortedUniq=function(e){return e&&e.length?co(e):[]},Fn.sortedUniqBy=function(e,t){return e&&e.length?co(e,li(t,2)):[]},Fn.split=function(e,t,n){return n&&"number"!=typeof n&&bi(e,t,n)&&(t=n=o),(n=n===o?m:n>>>0)?(e=ws(e))&&("string"==typeof t||null!=t&&!as(t))&&!(t=lo(t))&&cn(e)?Eo(gn(e),0,n):e.split(t,n):[]},Fn.spread=function(e,t){if("function"!=typeof e)throw new Re(i);return t=null==t?0:wn(gs(t),0),Yr((function(n){var r=n[t],o=Eo(n,0,t);return r&&zt(o,r),_t(e,this,o)}))},Fn.tail=function(e){var t=null==e?0:e.length;return t?oo(e,1,t):[]},Fn.take=function(e,t,n){return e&&e.length?oo(e,0,(t=n||t===o?1:gs(t))<0?0:t):[]},Fn.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?oo(e,(t=r-(t=n||t===o?1:gs(t)))<0?0:t,r):[]},Fn.takeRightWhile=function(e,t){return e&&e.length?go(e,li(t,3),!1,!0):[]},Fn.takeWhile=function(e,t){return e&&e.length?go(e,li(t,3)):[]},Fn.tap=function(e,t){return t(e),e},Fn.throttle=function(e,t,n){var r=!0,o=!0;if("function"!=typeof e)throw new Re(i);return ts(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),Na(e,t,{leading:r,maxWait:t,trailing:o})},Fn.thru=pa,Fn.toArray=hs,Fn.toPairs=Ds,Fn.toPairsIn=Ls,Fn.toPath=function(e){return Va(e)?Mt(e,Ui):us(e)?[e]:Po(ji(ws(e)))},Fn.toPlainObject=vs,Fn.transform=function(e,t,n){var r=Va(e),o=r||Za(e)||ls(e);if(t=li(t,4),null==n){var i=e&&e.constructor;n=o?r?new i:[]:ts(e)&&Qa(i)?$n(Ge(e)):{}}return(o?Ct:br)(e,(function(e,r,o){return t(n,e,r,o)})),n},Fn.unary=function(e){return xa(e,1)},Fn.union=na,Fn.unionBy=ra,Fn.unionWith=oa,Fn.uniq=function(e){return e&&e.length?fo(e):[]},Fn.uniqBy=function(e,t){return e&&e.length?fo(e,li(t,2)):[]},Fn.uniqWith=function(e,t){return t="function"==typeof t?t:o,e&&e.length?fo(e,o,t):[]},Fn.unset=function(e,t){return null==e||ho(e,t)},Fn.unzip=ia,Fn.unzipWith=aa,Fn.update=function(e,t,n){return null==e?e:po(e,t,Ao(n))},Fn.updateWith=function(e,t,n,r){return r="function"==typeof r?r:o,null==e?e:po(e,t,Ao(n),r)},Fn.values=Fs,Fn.valuesIn=function(e){return null==e?[]:en(e,Bs(e))},Fn.without=sa,Fn.words=Qs,Fn.wrap=function(e,t){return Ua(Ao(t),e)},Fn.xor=ca,Fn.xorBy=ua,Fn.xorWith=la,Fn.zip=da,Fn.zipObject=function(e,t){return vo(e||[],t||[],nr)},Fn.zipObjectDeep=function(e,t){return vo(e||[],t||[],eo)},Fn.zipWith=fa,Fn.entries=Ds,Fn.entriesIn=Ls,Fn.extend=bs,Fn.extendWith=Ss,cc(Fn,Fn),Fn.add=vc,Fn.attempt=Xs,Fn.camelCase=$s,Fn.capitalize=qs,Fn.ceil=wc,Fn.clamp=function(e,t,n){return n===o&&(n=t,t=o),n!==o&&(n=(n=ys(n))==n?n:0),t!==o&&(t=(t=ys(t))==t?t:0),cr(ys(e),t,n)},Fn.clone=function(e){return ur(e,4)},Fn.cloneDeep=function(e){return ur(e,5)},Fn.cloneDeepWith=function(e,t){return ur(e,5,t="function"==typeof t?t:o)},Fn.cloneWith=function(e,t){return ur(e,4,t="function"==typeof t?t:o)},Fn.conformsTo=function(e,t){return null==t||lr(e,t,Ns(t))},Fn.deburr=Ws,Fn.defaultTo=function(e,t){return null==e||e!=e?t:e},Fn.divide=Ac,Fn.endsWith=function(e,t,n){e=ws(e),t=lo(t);var r=e.length,i=n=n===o?r:cr(gs(n),0,r);return(n-=t.length)>=0&&e.slice(n,i)==t},Fn.eq=Fa,Fn.escape=function(e){return(e=ws(e))&&Y.test(e)?e.replace(Z,an):e},Fn.escapeRegExp=function(e){return(e=ws(e))&&ie.test(e)?e.replace(oe,"\\$&"):e},Fn.every=function(e,t,n){var r=Va(e)?Pt:gr;return n&&bi(e,t,n)&&(t=o),r(e,li(t,3))},Fn.find=ya,Fn.findIndex=Wi,Fn.findKey=function(e,t){return Ft(e,li(t,3),br)},Fn.findLast=va,Fn.findLastIndex=Vi,Fn.findLastKey=function(e,t){return Ft(e,li(t,3),Sr)},Fn.floor=bc,Fn.forEach=wa,Fn.forEachRight=Aa,Fn.forIn=function(e,t){return null==e?e:wr(e,li(t,3),Bs)},Fn.forInRight=function(e,t){return null==e?e:Ar(e,li(t,3),Bs)},Fn.forOwn=function(e,t){return e&&br(e,li(t,3))},Fn.forOwnRight=function(e,t){return e&&Sr(e,li(t,3))},Fn.get=_s,Fn.gt=$a,Fn.gte=qa,Fn.has=function(e,t){return null!=e&&yi(e,t,xr)},Fn.hasIn=xs,Fn.head=Gi,Fn.identity=oc,Fn.includes=function(e,t,n,r){e=Ga(e)?e:Fs(e),n=n&&!r?gs(n):0;var o=e.length;return n<0&&(n=wn(o+n,0)),cs(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&qt(e,t,n)>-1},Fn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:gs(n);return o<0&&(o=wn(r+o,0)),qt(e,t,o)},Fn.inRange=function(e,t,n){return t=ps(t),n===o?(n=t,t=0):n=ps(n),function(e,t,n){return e>=An(t,n)&&e<wn(t,n)}(e=ys(e),t,n)},Fn.invoke=Ps,Fn.isArguments=Wa,Fn.isArray=Va,Fn.isArrayBuffer=Ka,Fn.isArrayLike=Ga,Fn.isArrayLikeObject=Ha,Fn.isBoolean=function(e){return!0===e||!1===e||ns(e)&&Tr(e)==A},Fn.isBuffer=Za,Fn.isDate=Ja,Fn.isElement=function(e){return ns(e)&&1===e.nodeType&&!is(e)},Fn.isEmpty=function(e){if(null==e)return!0;if(Ga(e)&&(Va(e)||"string"==typeof e||"function"==typeof e.splice||Za(e)||ls(e)||Wa(e)))return!e.length;var t=mi(e);if(t==I||t==R)return!e.size;if(Ii(e))return!jr(e).length;for(var n in e)if(ze.call(e,n))return!1;return!0},Fn.isEqual=function(e,t){return Br(e,t)},Fn.isEqualWith=function(e,t,n){var r=(n="function"==typeof n?n:o)?n(e,t):o;return r===o?Br(e,t,o,n):!!r},Fn.isError=Ya,Fn.isFinite=function(e){return"number"==typeof e&&At(e)},Fn.isFunction=Qa,Fn.isInteger=Xa,Fn.isLength=es,Fn.isMap=rs,Fn.isMatch=function(e,t){return e===t||Or(e,t,fi(t))},Fn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:o,Or(e,t,fi(t),n)},Fn.isNaN=function(e){return os(e)&&e!=+e},Fn.isNative=function(e){if(ki(e))throw new ke("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Mr(e)},Fn.isNil=function(e){return null==e},Fn.isNull=function(e){return null===e},Fn.isNumber=os,Fn.isObject=ts,Fn.isObjectLike=ns,Fn.isPlainObject=is,Fn.isRegExp=as,Fn.isSafeInteger=function(e){return Xa(e)&&e>=-9007199254740991&&e<=p},Fn.isSet=ss,Fn.isString=cs,Fn.isSymbol=us,Fn.isTypedArray=ls,Fn.isUndefined=function(e){return e===o},Fn.isWeakMap=function(e){return ns(e)&&mi(e)==B},Fn.isWeakSet=function(e){return ns(e)&&"[object WeakSet]"==Tr(e)},Fn.join=function(e,t){return null==e?"":Lt.call(e,t)},Fn.kebabCase=Vs,Fn.last=Yi,Fn.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r;return n!==o&&(i=(i=gs(n))<0?wn(r+i,0):An(i,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,i):$t(e,Vt,i,!0)},Fn.lowerCase=Ks,Fn.lowerFirst=Gs,Fn.lt=ds,Fn.lte=fs,Fn.max=function(e){return e&&e.length?mr(e,oc,_r):o},Fn.maxBy=function(e,t){return e&&e.length?mr(e,li(t,2),_r):o},Fn.mean=function(e){return Kt(e,oc)},Fn.meanBy=function(e,t){return Kt(e,li(t,2))},Fn.min=function(e){return e&&e.length?mr(e,oc,Dr):o},Fn.minBy=function(e,t){return e&&e.length?mr(e,li(t,2),Dr):o},Fn.stubArray=mc,Fn.stubFalse=yc,Fn.stubObject=function(){return{}},Fn.stubString=function(){return""},Fn.stubTrue=function(){return!0},Fn.multiply=Ec,Fn.nth=function(e,t){return e&&e.length?Wr(e,gs(t)):o},Fn.noConflict=function(){return gt._===this&&(gt._=Fe),this},Fn.noop=uc,Fn.now=_a,Fn.pad=function(e,t,n){e=ws(e);var r=(t=gs(t))?pn(e):0;if(!t||r>=t)return e;var o=(t-r)/2;return Ko(mt(o),n)+e+Ko(pt(o),n)},Fn.padEnd=function(e,t,n){e=ws(e);var r=(t=gs(t))?pn(e):0;return t&&r<t?e+Ko(t-r,n):e},Fn.padStart=function(e,t,n){e=ws(e);var r=(t=gs(t))?pn(e):0;return t&&r<t?Ko(t-r,n)+e:e},Fn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),Sn(ws(e).replace(ae,""),t||0)},Fn.random=function(e,t,n){if(n&&"boolean"!=typeof n&&bi(e,t,n)&&(t=n=o),n===o&&("boolean"==typeof t?(n=t,t=o):"boolean"==typeof e&&(n=e,e=o)),e===o&&t===o?(e=0,t=1):(e=ps(e),t===o?(t=e,e=0):t=ps(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var i=En();return An(e+i*(t-e+dt("1e-"+((i+"").length-1))),t)}return Zr(e,t)},Fn.reduce=function(e,t,n){var r=Va(e)?jt:Zt,o=arguments.length<3;return r(e,li(t,4),n,o,hr)},Fn.reduceRight=function(e,t,n){var r=Va(e)?Ut:Zt,o=arguments.length<3;return r(e,li(t,4),n,o,pr)},Fn.repeat=function(e,t,n){return t=(n?bi(e,t,n):t===o)?1:gs(t),Jr(ws(e),t)},Fn.replace=function(){var e=arguments,t=ws(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Fn.result=function(e,t,n){var r=-1,i=(t=bo(t,e)).length;for(i||(i=1,e=o);++r<i;){var a=null==e?o:e[Ui(t[r])];a===o&&(r=i,a=n),e=Qa(a)?a.call(e):a}return e},Fn.round=kc,Fn.runInContext=e,Fn.sample=function(e){return(Va(e)?Qn:Qr)(e)},Fn.size=function(e){if(null==e)return 0;if(Ga(e))return cs(e)?pn(e):e.length;var t=mi(e);return t==I||t==R?e.size:jr(e).length},Fn.snakeCase=Hs,Fn.some=function(e,t,n){var r=Va(e)?Dt:io;return n&&bi(e,t,n)&&(t=o),r(e,li(t,3))},Fn.sortedIndex=function(e,t){return ao(e,t)},Fn.sortedIndexBy=function(e,t,n){return so(e,t,li(n,2))},Fn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ao(e,t);if(r<n&&Fa(e[r],t))return r}return-1},Fn.sortedLastIndex=function(e,t){return ao(e,t,!0)},Fn.sortedLastIndexBy=function(e,t,n){return so(e,t,li(n,2),!0)},Fn.sortedLastIndexOf=function(e,t){if(null==e?0:e.length){var n=ao(e,t,!0)-1;if(Fa(e[n],t))return n}return-1},Fn.startCase=Zs,Fn.startsWith=function(e,t,n){return e=ws(e),n=null==n?0:cr(gs(n),0,e.length),t=lo(t),e.slice(n,n+t.length)==t},Fn.subtract=Ic,Fn.sum=function(e){return e&&e.length?Jt(e,oc):0},Fn.sumBy=function(e,t){return e&&e.length?Jt(e,li(t,2)):0},Fn.template=function(e,t,n){var r=Fn.templateSettings;n&&bi(e,t,n)&&(t=o),e=ws(e),t=Ss({},t,r,ei);var i,a,s=Ss({},t.imports,r.imports,ei),c=Ns(s),u=en(s,c),l=0,d=t.interpolate||Se,f="__p += '",h=xe((t.escape||Se).source+"|"+d.source+"|"+(d===ee?pe:Se).source+"|"+(t.evaluate||Se).source+"|$","g"),p="//# sourceURL="+(ze.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++st+"]")+"\n";e.replace(h,(function(t,n,r,o,s,c){return r||(r=o),f+=e.slice(l,c).replace(Ee,sn),n&&(i=!0,f+="' +\n__e("+n+") +\n'"),s&&(a=!0,f+="';\n"+s+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=c+t.length,t})),f+="';\n";var g=ze.call(t,"variable")&&t.variable;if(g){if(fe.test(g))throw new ke("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(a?f.replace(V,""):f).replace(K,"$1").replace(G,"$1;"),f="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var m=Xs((function(){return Ie(c,p+"return "+f).apply(o,u)}));if(m.source=f,Ya(m))throw m;return m},Fn.times=function(e,t){if((e=gs(e))<1||e>p)return[];var n=m,r=An(e,m);t=li(t),e-=m;for(var o=Yt(r,t);++n<e;)t(n);return o},Fn.toFinite=ps,Fn.toInteger=gs,Fn.toLength=ms,Fn.toLower=function(e){return ws(e).toLowerCase()},Fn.toNumber=ys,Fn.toSafeInteger=function(e){return e?cr(gs(e),-9007199254740991,p):0===e?e:0},Fn.toString=ws,Fn.toUpper=function(e){return ws(e).toUpperCase()},Fn.trim=function(e,t,n){if((e=ws(e))&&(n||t===o))return Qt(e);if(!e||!(t=lo(t)))return e;var r=gn(e),i=gn(t);return Eo(r,nn(r,i),rn(r,i)+1).join("")},Fn.trimEnd=function(e,t,n){if((e=ws(e))&&(n||t===o))return e.slice(0,mn(e)+1);if(!e||!(t=lo(t)))return e;var r=gn(e);return Eo(r,0,rn(r,gn(t))+1).join("")},Fn.trimStart=function(e,t,n){if((e=ws(e))&&(n||t===o))return e.replace(ae,"");if(!e||!(t=lo(t)))return e;var r=gn(e);return Eo(r,nn(r,gn(t))).join("")},Fn.truncate=function(e,t){var n=30,r="...";if(ts(t)){var i="separator"in t?t.separator:i;n="length"in t?gs(t.length):n,r="omission"in t?lo(t.omission):r}var a=(e=ws(e)).length;if(cn(e)){var s=gn(e);a=s.length}if(n>=a)return e;var c=n-pn(r);if(c<1)return r;var u=s?Eo(s,0,c).join(""):e.slice(0,c);if(i===o)return u+r;if(s&&(c+=u.length-c),as(i)){if(e.slice(c).search(i)){var l,d=u;for(i.global||(i=xe(i.source,ws(ge.exec(i))+"g")),i.lastIndex=0;l=i.exec(d);)var f=l.index;u=u.slice(0,f===o?c:f)}}else if(e.indexOf(lo(i),c)!=c){var h=u.lastIndexOf(i);h>-1&&(u=u.slice(0,h))}return u+r},Fn.unescape=function(e){return(e=ws(e))&&J.test(e)?e.replace(H,yn):e},Fn.uniqueId=function(e){var t=++je;return ws(e)+t},Fn.upperCase=Js,Fn.upperFirst=Ys,Fn.each=wa,Fn.eachRight=Aa,Fn.first=Gi,cc(Fn,(Sc={},br(Fn,(function(e,t){ze.call(Fn.prototype,t)||(Sc[t]=e)})),Sc),{chain:!1}),Fn.VERSION="4.17.21",Ct(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Fn[e].placeholder=Fn})),Ct(["drop","take"],(function(e,t){Vn.prototype[e]=function(n){n=n===o?1:wn(gs(n),0);var r=this.__filtered__&&!t?new Vn(this):this.clone();return r.__filtered__?r.__takeCount__=An(n,r.__takeCount__):r.__views__.push({size:An(n,m),type:e+(r.__dir__<0?"Right":"")}),r},Vn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Ct(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Vn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:li(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),Ct(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Vn.prototype[e]=function(){return this[n](1).value()[0]}})),Ct(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Vn.prototype[e]=function(){return this.__filtered__?new Vn(this):this[n](1)}})),Vn.prototype.compact=function(){return this.filter(oc)},Vn.prototype.find=function(e){return this.filter(e).head()},Vn.prototype.findLast=function(e){return this.reverse().find(e)},Vn.prototype.invokeMap=Yr((function(e,t){return"function"==typeof e?new Vn(this):this.map((function(n){return Pr(n,e,t)}))})),Vn.prototype.reject=function(e){return this.filter(za(li(e)))},Vn.prototype.slice=function(e,t){e=gs(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Vn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==o&&(n=(t=gs(t))<0?n.dropRight(-t):n.take(t-e)),n)},Vn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Vn.prototype.toArray=function(){return this.take(m)},br(Vn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),i=Fn[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);i&&(Fn.prototype[t]=function(){var t=this.__wrapped__,s=r?[1]:arguments,c=t instanceof Vn,u=s[0],l=c||Va(t),d=function(e){var t=i.apply(Fn,zt([e],s));return r&&f?t[0]:t};l&&n&&"function"==typeof u&&1!=u.length&&(c=l=!1);var f=this.__chain__,h=!!this.__actions__.length,p=a&&!f,g=c&&!h;if(!a&&l){t=g?t:new Vn(this);var m=e.apply(t,s);return m.__actions__.push({func:pa,args:[d],thisArg:o}),new Wn(m,f)}return p&&g?e.apply(this,s):(m=this.thru(d),p?r?m.value()[0]:m.value():m)})})),Ct(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Pe[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Fn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var o=this.value();return t.apply(Va(o)?o:[],e)}return this[n]((function(n){return t.apply(Va(n)?n:[],e)}))}})),br(Vn.prototype,(function(e,t){var n=Fn[t];if(n){var r=n.name+"";ze.call(Nn,r)||(Nn[r]=[]),Nn[r].push({name:t,func:n})}})),Nn[$o(o,2).name]=[{name:"wrapper",func:o}],Vn.prototype.clone=function(){var e=new Vn(this.__wrapped__);return e.__actions__=Po(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Po(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Po(this.__views__),e},Vn.prototype.reverse=function(){if(this.__filtered__){var e=new Vn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Vn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Va(e),r=t<0,o=n?e.length:0,i=function(e,t,n){var r=-1,o=n.length;for(;++r<o;){var i=n[r],a=i.size;switch(i.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=An(t,e+a);break;case"takeRight":e=wn(e,t-a)}}return{start:e,end:t}}(0,o,this.__views__),a=i.start,s=i.end,c=s-a,u=r?s:a-1,l=this.__iteratees__,d=l.length,f=0,h=An(c,this.__takeCount__);if(!n||!r&&o==c&&h==c)return mo(e,this.__actions__);var p=[];e:for(;c--&&f<h;){for(var g=-1,m=e[u+=t];++g<d;){var y=l[g],v=y.iteratee,w=y.type,A=v(m);if(2==w)m=A;else if(!A){if(1==w)continue e;break e}}p[f++]=m}return p},Fn.prototype.at=ga,Fn.prototype.chain=function(){return ha(this)},Fn.prototype.commit=function(){return new Wn(this.value(),this.__chain__)},Fn.prototype.next=function(){this.__values__===o&&(this.__values__=hs(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?o:this.__values__[this.__index__++]}},Fn.prototype.plant=function(e){for(var t,n=this;n instanceof qn;){var r=Li(n);r.__index__=0,r.__values__=o,t?i.__wrapped__=r:t=r;var i=r;n=n.__wrapped__}return i.__wrapped__=e,t},Fn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Vn){var t=e;return this.__actions__.length&&(t=new Vn(this)),(t=t.reverse()).__actions__.push({func:pa,args:[ta],thisArg:o}),new Wn(t,this.__chain__)}return this.thru(ta)},Fn.prototype.toJSON=Fn.prototype.valueOf=Fn.prototype.value=function(){return mo(this.__wrapped__,this.__actions__)},Fn.prototype.first=Fn.prototype.head,Qe&&(Fn.prototype[Qe]=function(){return this}),Fn}();gt._=vn,(r=function(){return vn}.call(t,n,t,e))===o||(e.exports=r)}.call(this)},5276:(e,t,n)=>{var r=n(4497),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:o.call(t,e)}},5288:(e,t,n)=>{var r=n(358),o=n(7200),i=n(6529);e.exports=function(e){return i(e)?r(e,!0):o(e)}},5353:(e,t,n)=>{var r=n(8638);e.exports=function(e,t,n){return t=n?void 0:t,t=e&&null==t?e.length:t,r(e,128,void 0,void 0,void 0,void 0,t)}},5387:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},5512:(e,t,n)=>{var r=n(4943),o=n(3316)(r);e.exports=o},5568:e=>{e.exports=function(e,t){return e.has(t)}},5620:(e,t,n)=>{var r=n(8788),o=n(9141),i=n(796),a=n(33);e.exports=function(e,t,n){var s=t+"";return i(e,o(s,a(r(s),n)))}},5650:(e,t,n)=>{var r=n(8942).Symbol;e.exports=r},5681:(e,t,n)=>{var r=n(4700);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},5755:e=>{var t=Math.max;e.exports=function(e,n,r,o){for(var i=-1,a=e.length,s=-1,c=r.length,u=-1,l=n.length,d=t(a-c,0),f=Array(d+l),h=!o;++i<d;)f[i]=e[i];for(var p=i;++u<l;)f[p+u]=n[u];for(;++s<c;)(h||i<a)&&(f[p+r[s]]=e[i++]);return f}},5832:(e,t,n)=>{var r=n(1129),o=n(4784),i=n(7979),a=n(9306),s=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)r(t,i(e)),e=o(e);return t}:a;e.exports=s},5853:(e,t,n)=>{e=n.nmd(e);var r=n(8942),o=n(4772),i=t&&!t.nodeType&&t,a=i&&e&&!e.nodeType&&e,s=a&&a.exports===i?r.Buffer:void 0,c=(s?s.isBuffer:void 0)||o;e.exports=c},5857:(e,t,n)=>{var r=n(313);e.exports=function(e){return(null==e?0:e.length)?r(e,1):[]}},5894:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},5899:(e,t,n)=>{var r=n(3526),o=n(3283),i=n(3142),a=n(9632),s=n(5387),c=n(6040);e.exports=function(e,t,n){for(var u=-1,l=(t=r(t,e)).length,d=!1;++u<l;){var f=c(t[u]);if(!(d=null!=e&&n(e,f)))break;e=e[f]}return d||++u!=l?d:!!(l=null==e?0:e.length)&&s(l)&&a(f,l)&&(i(e)||o(e))}},5962:e=>{e.exports=function(){}},5964:(e,t,n)=>{var r=n(9747),o=n(4784),i=n(4882);e.exports=function(e){return"function"!=typeof e.constructor||i(e)?{}:r(o(e))}},6027:(e,t,n)=>{var r=n(7379),o=n(547);e.exports=function(e){return o(e)&&"[object Arguments]"==r(e)}},6040:(e,t,n)=>{var r=n(1187);e.exports=function(e){if("string"==typeof e||r(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t}},6065:(e,t,n)=>{var r=n(9270),o=r&&new r;e.exports=o},6123:(e,t,n)=>{var r=n(7923);e.exports=function(e,t,n){var o=null==e?void 0:r(e,t);return void 0===o?n:o}},6131:(e,t,n)=>{var r=n(6403),o=n(1580),i=n(1187),a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=s.test(e);return n||c.test(e)?u(e.slice(2),n?2:8):a.test(e)?NaN:+e}},6137:e=>{e.exports=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}},6285:e=>{e.exports=function(e,t){return e===t||e!=e&&t!=t}},6341:(e,t,n)=>{var r=n(6912),o=n(4364),i=n(8942);e.exports=function(e,t,n,a){var s=1&t,c=o(e);return function t(){for(var o=-1,u=arguments.length,l=-1,d=a.length,f=Array(d+u),h=this&&this!==i&&this instanceof t?c:e;++l<d;)f[l]=a[l];for(;u--;)f[l++]=arguments[++o];return r(h,s?n:this,f)}}},6403:(e,t,n)=>{var r=n(2945),o=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(o,""):e}},6465:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}},6493:(e,t,n)=>{var r=n(6853),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,a=r((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(o,(function(e,n,r,o){t.push(r?o.replace(i,"$1"):n||e)})),t}));e.exports=a},6526:(e,t,n)=>{var r=n(8330),o=n(4367),i=n(3904);e.exports=function(e){var t=o(e);return 1==t.length&&t[0][2]?i(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},6529:(e,t,n)=>{var r=n(3655),o=n(5387);e.exports=function(e){return null!=e&&o(e.length)&&!r(e)}},6591:(e,t,n)=>{var r=n(4354),o=n(9632),i=Math.min;e.exports=function(e,t){for(var n=e.length,a=i(t.length,n),s=r(e);a--;){var c=t[a];e[a]=o(c,n)?s[c]:void 0}return e}},6638:(e,t,n)=>{var r=n(1386),o=n(9770),i=n(8250);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var a=n.__data__;if(!o||a.length<199)return a.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(a)}return n.set(e,t),this.size=n.size,this}},6648:(e,t,n)=>{var r=n(7553),o=n(5196),i=n(961),a=n(3321);e.exports=function(e){var t=i(e),n=a[t];if("function"!=typeof n||!(t in r.prototype))return!1;if(e===n)return!0;var s=o(n);return!!s&&e===s[0]}},6713:(e,t,n)=>{var r=n(4364),o=n(8942);e.exports=function(e,t,n){var i=1&t,a=r(e);return function t(){return(this&&this!==o&&this instanceof t?a:e).apply(i?n:this,arguments)}}},6850:e=>{e.exports=function(e){return e.placeholder}},6853:(e,t,n)=>{var r=n(9011);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},6912:e=>{e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},7028:(e,t,n)=>{var r=n(4977),o=n(5755),i=n(8813),a="__lodash_placeholder__",s=128,c=Math.min;e.exports=function(e,t){var n=e[1],u=t[1],l=n|u,d=l<131,f=u==s&&8==n||u==s&&256==n&&e[7].length<=t[8]||384==u&&t[7].length<=t[8]&&8==n;if(!d&&!f)return e;1&u&&(e[2]=t[2],l|=1&n?0:4);var h=t[3];if(h){var p=e[3];e[3]=p?r(p,h,t[4]):h,e[4]=p?i(e[3],a):t[4]}return(h=t[5])&&(p=e[5],e[5]=p?o(p,h,t[6]):h,e[6]=p?i(e[5],a):t[6]),(h=t[7])&&(e[7]=h),u&s&&(e[8]=null==e[8]?t[8]:c(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=l,e}},7034:(e,t,n)=>{var r=n(6285);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},7073:(e,t,n)=>{var r=n(2532);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},7099:(e,t,n)=>{e=n.nmd(e);var r=n(8942),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o?r.Buffer:void 0,s=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=s?s(n):new e.constructor(n);return e.copy(r),r}},7144:(e,t,n)=>{var r=n(7034);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},7200:(e,t,n)=>{var r=n(1580),o=n(4882),i=n(8546),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return i(e);var t=o(e),n=[];for(var s in e)("constructor"!=s||!t&&a.call(e,s))&&n.push(s);return n}},7250:e=>{e.exports=function(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}},7267:(e,t,n)=>{var r=n(1580);e.exports=function(e){return e==e&&!r(e)}},7276:(e,t,n)=>{var r=n(3636),o=n(5899);e.exports=function(e,t){return null!=e&&o(e,t,r)}},7336:(e,t,n)=>{var r=n(8638);function o(e,t,n){var i=r(e,8,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return i.placeholder=o.placeholder,i}o.placeholder={},e.exports=o},7350:e=>{var t=Object.prototype.hasOwnProperty;e.exports=function(e){var n=e.length,r=new e.constructor(n);return n&&"string"==typeof e[0]&&t.call(e,"index")&&(r.index=e.index,r.input=e.input),r}},7379:(e,t,n)=>{var r=n(5650),o=n(8870),i=n(9005),a=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?o(e):i(e)}},7403:(e,t,n)=>{var r=n(2619),o=n(2532),i=n(2053),a=o?function(e,t){return o(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:i;e.exports=a},7452:(e,t,n)=>{var r=n(7034);e.exports=function(e){return r(this.__data__,e)>-1}},7462:e=>{e.exports=function(e){return this.__data__.has(e)}},7553:(e,t,n)=>{var r=n(9747),o=n(5962);function i(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}i.prototype=r(o.prototype),i.prototype.constructor=i,e.exports=i},7642:(e,t,n)=>{var r=n(3301);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},7681:(e,t,n)=>{var r=n(777),o=n(9460),i=n(2306),a=i&&i.isMap,s=a?o(a):r;e.exports=s},7706:e=>{e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}},7769:(e,t,n)=>{var r=n(8486),o=n(547);e.exports=function(e){return o(e)&&"[object WeakMap]"==r(e)}},7923:(e,t,n)=>{var r=n(3526),o=n(6040);e.exports=function(e,t){for(var n=0,i=(t=r(t,e)).length;null!=e&&n<i;)e=e[o(t[n++])];return n&&n==i?e:void 0}},7930:(e,t,n)=>{var r=n(9032),o=n(1211);e.exports=function(e,t){return e&&r(t,o(t),e)}},7979:(e,t,n)=>{var r=n(9847),o=n(9306),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols,s=a?function(e){return null==e?[]:(e=Object(e),r(a(e),(function(t){return i.call(e,t)})))}:o;e.exports=s},7991:(e,t)=>{"use strict";t.byteLength=function(e){var t=s(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,i=s(e),a=i[0],c=i[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,a,c)),l=0,d=c>0?a-4:a;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===c&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],a=16383,s=0,u=r-o;s<u;s+=a)i.push(c(e,s,s+a>u?u:s+a));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=i[a],r[i.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,r){for(var o,i,a=[],s=t;s<r;s+=3)o=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},8006:e=>{e.exports=function(e){return this.__data__.has(e)}},8055:(e,t,n)=>{e.exports={ary:n(5353),assign:n(7930),clone:n(2846),curry:n(7336),forEach:n(9968),isArray:n(3142),isError:n(441),isFunction:n(3655),isWeakMap:n(7769),iteratee:n(2590),keys:n(195),rearg:n(864),toInteger:n(7642),toPath:n(2613)}},8069:(e,t,n)=>{var r=n(5650),o=r?r.prototype:void 0,i=o?o.valueOf:void 0;e.exports=function(e){return i?Object(i.call(e)):{}}},8121:(e,t,n)=>{var r=n(3766)(Object.keys,Object);e.exports=r},8244:(e,t,n)=>{var r=n(1129),o=n(3142);e.exports=function(e,t,n){var i=t(e);return o(e)?i:r(i,n(e))}},8250:(e,t,n)=>{var r=n(9753),o=n(5681),i=n(88),a=n(4732),s=n(9068);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=a,c.prototype.set=s,e.exports=c},8330:(e,t,n)=>{var r=n(1340),o=n(4687);e.exports=function(e,t,n,i){var a=n.length,s=a,c=!i;if(null==e)return!s;for(e=Object(e);a--;){var u=n[a];if(c&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++a<s;){var l=(u=n[a])[0],d=e[l],f=u[1];if(c&&u[2]){if(void 0===d&&!(l in e))return!1}else{var h=new r;if(i)var p=i(d,f,l,e,t,h);if(!(void 0===p?o(f,d,3,i,h):p))return!1}}return!0}},8340:e=>{var t=/\w*$/;e.exports=function(e){var n=new e.constructor(e.source,t.exec(e));return n.lastIndex=e.lastIndex,n}},8360:(e,t,n)=>{var r=n(7379),o=n(4784),i=n(547),a=Function.prototype,s=Object.prototype,c=a.toString,u=s.hasOwnProperty,l=c.call(Object);e.exports=function(e){if(!i(e)||"[object Object]"!=r(e))return!1;var t=o(e);if(null===t)return!0;var n=u.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==l}},8486:(e,t,n)=>{var r=n(3103),o=n(9770),i=n(9413),a=n(4512),s=n(9270),c=n(7379),u=n(4066),l="[object Map]",d="[object Promise]",f="[object Set]",h="[object WeakMap]",p="[object DataView]",g=u(r),m=u(o),y=u(i),v=u(a),w=u(s),A=c;(r&&A(new r(new ArrayBuffer(1)))!=p||o&&A(new o)!=l||i&&A(i.resolve())!=d||a&&A(new a)!=f||s&&A(new s)!=h)&&(A=function(e){var t=c(e),n="[object Object]"==t?e.constructor:void 0,r=n?u(n):"";if(r)switch(r){case g:return p;case m:return l;case y:return d;case v:return f;case w:return h}return t}),e.exports=A},8546:e=>{e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},8638:(e,t,n)=>{var r=n(4943),o=n(6713),i=n(2443),a=n(3504),s=n(6341),c=n(5196),u=n(7028),l=n(5512),d=n(5620),f=n(7642),h=Math.max;e.exports=function(e,t,n,p,g,m,y,v){var w=2&t;if(!w&&"function"!=typeof e)throw new TypeError("Expected a function");var A=p?p.length:0;if(A||(t&=-97,p=g=void 0),y=void 0===y?y:h(f(y),0),v=void 0===v?v:f(v),A-=g?g.length:0,64&t){var b=p,S=g;p=g=void 0}var E=w?void 0:c(e),k=[e,t,n,p,g,b,S,m,y,v];if(E&&u(k,E),e=k[0],t=k[1],n=k[2],p=k[3],g=k[4],!(v=k[9]=void 0===k[9]?w?0:e.length:h(k[9]-A,0))&&24&t&&(t&=-25),t&&1!=t)I=8==t||16==t?i(e,t,v):32!=t&&33!=t||g.length?a.apply(void 0,k):s(e,t,n,p);else var I=o(e,t,n);return d((E?r:l)(I,k),e,t)}},8666:(e,t,n)=>{var r=n(674),o=n(9460),i=n(2306),a=i&&i.isTypedArray,s=a?o(a):r;e.exports=s},8788:e=>{var t=/\{\n\/\* \[wrapped with (.+)\] \*/,n=/,? & /;e.exports=function(e){var r=e.match(t);return r?r[1].split(n):[]}},8813:e=>{var t="__lodash_placeholder__";e.exports=function(e,n){for(var r=-1,o=e.length,i=0,a=[];++r<o;){var s=e[r];s!==n&&s!==t||(e[r]=t,a[i++]=r)}return a}},8861:(e,t,n)=>{var r=n(5650),o=n(1623),i=n(6285),a=n(3934),s=n(5894),c=n(9828),u=r?r.prototype:void 0,l=u?u.valueOf:void 0;e.exports=function(e,t,n,r,u,d,f){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!d(new o(e),new o(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var h=s;case"[object Set]":var p=1&r;if(h||(h=c),e.size!=t.size&&!p)return!1;var g=f.get(e);if(g)return g==t;r|=2,f.set(e,t);var m=a(h(e),h(t),r,u,d,f);return f.delete(e),m;case"[object Symbol]":if(l)return l.call(e)==l.call(t)}return!1}},8870:(e,t,n)=>{var r=n(5650),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,s=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(e){}var o=a.call(e);return r&&(t?e[s]=n:delete e[s]),o}},8880:(e,t,n)=>{var r=n(7923);e.exports=function(e){return function(t){return r(t,e)}}},8898:(e,t,n)=>{var r=n(1623);e.exports=function(e){var t=new e.constructor(e.byteLength);return new r(t).set(new r(e)),t}},8942:(e,t,n)=>{var r=n(4967),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},9005:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},9011:(e,t,n)=>{var r=n(8250);function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},9032:(e,t,n)=>{var r=n(3422),o=n(7073);e.exports=function(e,t,n,i){var a=!n;n||(n={});for(var s=-1,c=t.length;++s<c;){var u=t[s],l=i?i(n[u],e[u],u,n,e):void 0;void 0===l&&(l=e[u]),a?o(n,u,l):r(n,u,l)}return n}},9067:e=>{e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},9068:(e,t,n)=>{var r=n(4700);e.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}},9071:e=>{e.exports=function(){}},9141:e=>{var t=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;e.exports=function(e,n){var r=n.length;if(!r)return e;var o=r-1;return n[o]=(r>1?"& ":"")+n[o],n=n.join(r>2?", ":" "),e.replace(t,"{\n/* [wrapped with "+n+"] */\n")}},9270:(e,t,n)=>{var r=n(4715)(n(8942),"WeakMap");e.exports=r},9306:e=>{e.exports=function(){return[]}},9318:(e,t)=>{t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,c=(1<<s)-1,u=c>>1,l=-7,d=n?o-1:0,f=n?-1:1,h=e[t+d];for(d+=f,i=h&(1<<-l)-1,h>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=f,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=f,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),i-=u}return(h?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,c,u=8*i-o-1,l=(1<<u)-1,d=l>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+h]=255&s,h+=p,s/=256,o-=8);for(a=a<<o|s,u+=o;u>0;e[n+h]=255&a,h+=p,a/=256,u-=8);e[n+h-p]|=128*g}},9334:(e,t,n)=>{var r=n(1340),o=n(9968),i=n(3422),a=n(7930),s=n(125),c=n(7099),u=n(4354),l=n(3546),d=n(4733),f=n(393),h=n(3650),p=n(8486),g=n(7350),m=n(424),y=n(5964),v=n(3142),w=n(5853),A=n(7681),b=n(1580),S=n(3943),E=n(1211),k=n(5288),I="[object Arguments]",T="[object Function]",_="[object Object]",x={};x[I]=x["[object Array]"]=x["[object ArrayBuffer]"]=x["[object DataView]"]=x["[object Boolean]"]=x["[object Date]"]=x["[object Float32Array]"]=x["[object Float64Array]"]=x["[object Int8Array]"]=x["[object Int16Array]"]=x["[object Int32Array]"]=x["[object Map]"]=x["[object Number]"]=x[_]=x["[object RegExp]"]=x["[object Set]"]=x["[object String]"]=x["[object Symbol]"]=x["[object Uint8Array]"]=x["[object Uint8ClampedArray]"]=x["[object Uint16Array]"]=x["[object Uint32Array]"]=!0,x["[object Error]"]=x[T]=x["[object WeakMap]"]=!1,e.exports=function e(t,n,C,R,P,N){var B,O=1&n,M=2&n,z=4&n;if(C&&(B=P?C(t,R,P,N):C(t)),void 0!==B)return B;if(!b(t))return t;var j=v(t);if(j){if(B=g(t),!O)return u(t,B)}else{var U=p(t),D=U==T||"[object GeneratorFunction]"==U;if(w(t))return c(t,O);if(U==_||U==I||D&&!P){if(B=M||D?{}:y(t),!O)return M?d(t,s(B,t)):l(t,a(B,t))}else{if(!x[U])return P?t:{};B=m(t,U,O)}}N||(N=new r);var L=N.get(t);if(L)return L;N.set(t,B),S(t)?t.forEach((function(r){B.add(e(r,n,C,r,t,N))})):A(t)&&t.forEach((function(r,o){B.set(o,e(r,n,C,o,t,N))}));var F=j?void 0:(z?M?h:f:M?k:E)(t);return o(F||t,(function(r,o){F&&(r=t[o=r]),i(B,o,e(r,n,C,o,t,N))})),B}},9361:e=>{e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},9413:(e,t,n)=>{var r=n(4715)(n(8942),"Promise");e.exports=r},9454:e=>{e.exports=function(e){return e!=e}},9460:e=>{e.exports=function(e){return function(t){return e(t)}}},9624:(e,t,n)=>{var r=n(3655),o=n(4759),i=n(1580),a=n(4066),s=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,l=c.toString,d=u.hasOwnProperty,f=RegExp("^"+l.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||o(e))&&(r(e)?f:s).test(a(e))}},9632:e=>{var t=/^(?:0|[1-9]\d*)$/;e.exports=function(e,n){var r=typeof e;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&t.test(e))&&e>-1&&e%1==0&&e<n}},9747:(e,t,n)=>{var r=n(1580),o=Object.create,i=function(){function e(){}return function(t){if(!r(t))return{};if(o)return o(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();e.exports=i},9753:(e,t,n)=>{var r=n(5098),o=n(1386),i=n(9770);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||o),string:new r}}},9756:(e,t,n)=>{var r=n(2478);e.exports=function(e,t){return!!(null==e?0:e.length)&&r(e,t,0)>-1}},9770:(e,t,n)=>{var r=n(4715)(n(8942),"Map");e.exports=r},9828:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}},9847:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var a=e[n];t(a,n,e)&&(i[o++]=a)}return i}},9968:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";n.r(r),n.d(r,{onActive:()=>gI,onAssetHistoricalPrice:()=>uI,onAssetsConversion:()=>sI,onAssetsLookup:()=>aI,onAssetsMarketData:()=>vI,onClientRequest:()=>lI,onCronjob:()=>iI,onInactive:()=>mI,onInstall:()=>pI,onKeyringRequest:()=>rI,onNameLookup:()=>yI,onProtocolRequest:()=>cI,onRpcRequest:()=>nI,onStart:()=>fI,onUpdate:()=>hI,onUserInput:()=>oI,onWebSocketEvent:()=>dI});var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)},t="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";(()=>{const e=Array(256).fill(-1);for(let n=0;n<58;++n)e[t.charCodeAt(n)]=n})();var o,i,a=e=>{if(!e||"string"!=typeof e)throw new Error(`Expected base58 string but got “${e}”`);if(e.match(/[IOl0]/gmu))throw new Error(`Invalid base58 character “${e.match(/[IOl0]/gmu)}”`);const n=e.match(/^1+/gmu),r=n?n[0].length:0,o=(e.length-r)*(Math.log(58)/Math.log(256))+1>>>0;return new Uint8Array([...new Uint8Array(r),...e.match(/.{1}/gmu).map((e=>t.indexOf(e))).reduce(((e,t)=>e.map((e=>{const n=58*e+t;return t=n>>8,n}))),new Uint8Array(o)).reverse().filter((i=!1,e=>i=i||e))]);var i},s=(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.bech32m=t.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",r={};for(let e=0;e<32;e++){const t=n.charAt(e);r[t]=e}function o(e){const t=e>>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function i(e){let t=1;for(let n=0;n<e.length;++n){const r=e.charCodeAt(n);if(r<33||r>126)return"Invalid prefix ("+e+")";t=o(t)^r>>5}t=o(t);for(let n=0;n<e.length;++n){const r=e.charCodeAt(n);t=o(t)^31&r}return t}function a(e,t,n,r){let o=0,i=0;const a=(1<<n)-1,s=[];for(let r=0;r<e.length;++r)for(o=o<<t|e[r],i+=t;i>=n;)i-=n,s.push(o>>i&a);if(r)i>0&&s.push(o<<n-i&a);else{if(i>=t)return"Excess padding";if(o<<n-i&a)return"Non-zero padding"}return s}function s(e){return a(e,8,5,!0)}function c(e){const t=a(e,5,8,!1);if(Array.isArray(t))return t}function u(e){const t=a(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function l(e){let t;function a(e,n){if(n=n||90,e.length<8)return e+" too short";if(e.length>n)return"Exceeds length limit";const a=e.toLowerCase(),s=e.toUpperCase();if(e!==a&&e!==s)return"Mixed-case string "+e;const c=(e=a).lastIndexOf("1");if(-1===c)return"No separator character for "+e;if(0===c)return"Missing prefix for "+e;const u=e.slice(0,c),l=e.slice(c+1);if(l.length<6)return"Data too short";let d=i(u);if("string"==typeof d)return d;const f=[];for(let e=0;e<l.length;++e){const t=l.charAt(e),n=r[t];if(void 0===n)return"Unknown character "+t;d=o(d)^n,e+6>=l.length||f.push(n)}return d!==t?"Invalid checksum for "+e:{prefix:u,words:f}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){const n=a(e,t);if("object"==typeof n)return n},decode:function(e,t){const n=a(e,t);if("object"==typeof n)return n;throw new Error(n)},encode:function(e,r,a){if(a=a||90,e.length+7+r.length>a)throw new TypeError("Exceeds length limit");let s=i(e=e.toLowerCase());if("string"==typeof s)throw new Error(s);let c=e+"1";for(let e=0;e<r.length;++e){const t=r[e];if(t>>5!=0)throw new Error("Non 5-bit word");s=o(s)^t,c+=n.charAt(t)}for(let e=0;e<6;++e)s=o(s);s^=t;for(let e=0;e<6;++e)c+=n.charAt(s>>5*(5-e)&31);return c},toWords:s,fromWordsUnsafe:c,fromWords:u}}t.bech32=l("bech32"),t.bech32m=l("bech32m")}(o={exports:{}},o.exports),o.exports);(i=s)&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")&&i.default;var c=s.bech32m,u=s.bech32;const l=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998];class d{constructor(){this.A=1779033703,this.B=-1150833019,this.C=1013904242,this.D=-1521486534,this.E=1359893119,this.F=-1694144372,this.G=528734635,this.H=1541459225,this._size=0,this._sp=0,(!h||p>=8e3)&&(h=new ArrayBuffer(8e3),p=0),this._byte=new Uint8Array(h,p,80),this._word=new Int32Array(h,p,20),p+=80}update(e){if("string"==typeof e)return this._utf8(e);if(null==e)throw new TypeError("Invalid type: "+typeof e);const t=e.byteOffset,n=e.byteLength;let r=n/64|0,o=0;if(r&&!(3&t)&&!(this._size%64)){const n=new Int32Array(e.buffer,t,16*r);for(;r--;)this._int32(n,o>>2),o+=64;this._size+=o}if(1!==e.BYTES_PER_ELEMENT&&e.buffer){const r=new Uint8Array(e.buffer,t+o,n-o);return this._uint8(r)}return o===n?this:this._uint8(e,o)}_uint8(e,t){const{_byte:n,_word:r}=this,o=e.length;for(t|=0;t<o;){const i=this._size%64;let a=i;for(;t<o&&a<64;)n[a++]=e[t++];a>=64&&this._int32(r),this._size+=a-i}return this}_utf8(e){const{_byte:t,_word:n}=this,r=e.length;let o=this._sp;for(let i=0;i<r;){const a=this._size%64;let s=a;for(;i<r&&s<64;){let n=0|e.charCodeAt(i++);n<128?t[s++]=n:n<2048?(t[s++]=192|n>>>6,t[s++]=128|63&n):n<55296||n>57343?(t[s++]=224|n>>>12,t[s++]=128|n>>>6&63,t[s++]=128|63&n):o?(n=((1023&o)<<10)+(1023&n)+65536,t[s++]=240|n>>>18,t[s++]=128|n>>>12&63,t[s++]=128|n>>>6&63,t[s++]=128|63&n,o=0):o=n}s>=64&&(this._int32(n),n[0]=n[16]),this._size+=s-a}return this._sp=o,this}_int32(e,t){let{A:n,B:r,C:o,D:i,E:a,F:s,G:c,H:u}=this,d=0;for(t|=0;d<16;)f[d++]=m(e[t++]);for(d=16;d<64;d++)f[d]=S(f[d-2])+f[d-7]+b(f[d-15])+f[d-16]|0;for(d=0;d<64;d++){const e=u+A(a)+y(a,s,c)+l[d]+f[d]|0,t=w(n)+v(n,r,o)|0;u=c,c=s,s=a,a=i+e|0,i=o,o=r,r=n,n=e+t|0}this.A=n+this.A|0,this.B=r+this.B|0,this.C=o+this.C|0,this.D=i+this.D|0,this.E=a+this.E|0,this.F=s+this.F|0,this.G=c+this.G|0,this.H=u+this.H|0}digest(e){const{_byte:t,_word:n}=this;let r=this._size%64|0;for(t[r++]=128;3&r;)t[r++]=0;if(r>>=2,r>14){for(;r<16;)n[r++]=0;r=0,this._int32(n)}for(;r<16;)n[r++]=0;const o=8*this._size,i=(4294967295&o)>>>0,a=(o-i)/4294967296;return a&&(n[14]=m(a)),i&&(n[15]=m(i)),this._int32(n),"hex"===e?this._hex():this._bin()}_hex(){const{A:e,B:t,C:n,D:r,E:o,F:i,G:a,H:s}=this;return g(e)+g(t)+g(n)+g(r)+g(o)+g(i)+g(a)+g(s)}_bin(){const{A:e,B:t,C:n,D:r,E:o,F:i,G:a,H:s,_byte:c,_word:u}=this;return u[0]=m(e),u[1]=m(t),u[2]=m(n),u[3]=m(r),u[4]=m(o),u[5]=m(i),u[6]=m(a),u[7]=m(s),c.slice(0,32)}}const f=new Int32Array(64);let h,p=0;const g=e=>(e+4294967296).toString(16).substr(-8),m=254===new Uint8Array(new Uint16Array([65279]).buffer)[0]?e=>e:e=>e<<24&4278190080|e<<8&16711680|e>>8&65280|e>>24&255,y=(e,t,n)=>n^e&(t^n),v=(e,t,n)=>e&t|n&(e|t),w=e=>(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),A=e=>(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7),b=e=>(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3,S=e=>(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10;var E,k,I=function(e){return(new d).update(e).digest()};!function(e){e.mainnet="mainnet",e.testnet="testnet",e.regtest="regtest"}(E||(E={})),function(e){e.p2pkh="p2pkh",e.p2sh="p2sh",e.p2wpkh="p2wpkh",e.p2wsh="p2wsh",e.p2tr="p2tr"}(k||(k={}));var T={0:{type:k.p2pkh,network:E.mainnet},111:{type:k.p2pkh,network:E.testnet},5:{type:k.p2sh,network:E.mainnet},196:{type:k.p2sh,network:E.testnet}},_=function(t){var n,r=t.substr(0,2).toLowerCase();if("bc"===r||"tb"===r)return function(e){var t;try{t=e.startsWith("bc1p")||e.startsWith("tb1p")||e.startsWith("bcrt1p")?c.decode(e):u.decode(e)}catch(e){throw new Error("Invalid address")}var n={bc:E.mainnet,tb:E.testnet,bcrt:E.regtest}[t.prefix];if(void 0===n)throw new Error("Invalid address");var r=t.words[0];if(r<0||r>16)throw new Error("Invalid address");return{bech32:!0,network:n,address:e,type:20===u.fromWords(t.words.slice(1)).length?k.p2wpkh:1===r?k.p2tr:k.p2wsh}}(t);try{n=a(t)}catch(e){throw new Error("Invalid address")}var o=n.length;if(25!==o)throw new Error("Invalid address");var i=n[0],s=n.slice(o-4,o),l=n.slice(0,o-4),d=I(I(l)).slice(0,4);if(s.some((function(e,t){return e!==d[t]})))throw new Error("Invalid address");if(!Object.keys(T).map(Number).includes(i))throw new Error("Invalid address");return e(e({},T[i]),{address:t,bech32:!1})};class x extends TypeError{constructor(e,t){let n;const{message:r,explanation:o,...i}=e,{path:a}=e,s=0===a.length?r:`At path: ${a.join(".")} -- ${r}`;super(o??s),null!=o&&(this.cause=s),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function C(e){return"object"==typeof e&&null!==e}function R(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function P(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:o,branch:i}=t,{type:a}=n,{refinement:s,message:c=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${R(r)}\``}=e;return{value:r,type:a,refinement:s,key:o[o.length-1],path:o,branch:i,...e,message:c}}function*N(e,t,n,r){(function(e){return C(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const o of e){const e=P(o,t,n,r);e&&(yield e)}}function*B(e,t,n={}){const{path:r=[],branch:o=[e],coerce:i=!1,mask:a=!1}=n,s={path:r,branch:o};if(i&&(e=t.coercer(e,s),a&&"type"!==t.type&&C(t.schema)&&C(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let c="valid";for(const r of t.validator(e,s))r.explanation=n.message,c="not_valid",yield[r,void 0];for(let[u,l,d]of t.entries(e,s)){const t=B(l,d,{path:void 0===u?r:[...r,u],branch:void 0===u?o:[...o,l],coerce:i,mask:a,message:n.message});for(const n of t)n[0]?(c=null===n[0].refinement||void 0===n[0].refinement?"not_valid":"not_refined",yield[n[0],void 0]):i&&(l=n[1],void 0===u?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):C(e)&&(void 0!==l||u in e)&&(e[u]=l))}if("not_valid"!==c)for(const r of t.refiner(e,s))r.explanation=n.message,c="not_refined",yield[r,void 0];"valid"===c&&(yield[void 0,e])}class O{constructor(e){const{type:t,schema:n,validator:r,refiner:o,coercer:i=(e=>e),entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=i,this.validator=r?(e,t)=>N(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>N(o(e,t),t,this,e):()=>[]}assert(e,t){return M(e,this,t)}create(e,t){return z(e,this,t)}is(e){return j(e,this)}mask(e,t){return function(e,t,n){const r=U(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return U(e,this,t)}}function M(e,t,n){const r=U(e,t,{message:n});if(r[0])throw r[0]}function z(e,t,n){const r=U(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function j(e,t){return!U(e,t)[0]}function U(e,t,n={}){const r=B(e,t,n),o=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(o[0]){return[new x(o[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]}return[void 0,o[1]]}function D(e,t){return new O({type:e,schema:null,validator:t})}function L(e,t){return D(e,(e=>"string"==typeof e&&t.test(e)))}const F=L("UuidV4",/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu),$=F,q=D("Url",(e=>{try{const t=new URL(e);return"http:"===t.protocol||"https:"===t.protocol}catch{return!1}})),W=L("StringNumber",/^\d+(\.\d+)?$/u);function V(){return D("any",(()=>!0))}function K(e){return new O({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${R(e)}`})}function G(){return D("boolean",(e=>"boolean"==typeof e))}function H(e){const t={},n=e.map((e=>R(e))).join();for(const n of e)t[n]=n;return new O({type:"enums",schema:t,validator:t=>e.includes(t)||`Expected one of \`${n}\`, but received: ${R(t)}`})}function Z(){return D("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${R(e)}`))}function J(e){const t=R(e),n=typeof e;return new O({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${R(n)}`})}function Y(){return D("never",(()=>!1))}function Q(e){return new O({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function X(){return D("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${R(e)}`))}function ee(e){const t=e?Object.keys(e):[],n=Y();return new O({type:"object",schema:e??null,*entries(r){if(e&&C(r)){const o=new Set(Object.keys(r));for(const n of t)o.delete(n),yield[n,r[n],e[n]];for(const e of o)yield[e,r[e],n]}},validator:e=>C(e)||`Expected an object, but received: ${R(e)}`,coercer:e=>C(e)?{...e}:e})}function te(e){return new O({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function ne(e,t){return new O({type:"record",schema:null,*entries(n){if(C(n))for(const r in n){const o=n[r];yield[r,r,e],yield[r,o,t]}},validator:e=>C(e)||`Expected an object, but received: ${R(e)}`})}function re(){return D("string",(e=>"string"==typeof e||`Expected a string, but received: ${R(e)}`))}function oe(e){const t=Y();return new O({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const r=Math.max(e.length,n.length);for(let o=0;o<r;o++)yield[o,n[o],e[o]||t]}},validator:e=>Array.isArray(e)||`Expected an array, but received: ${R(e)}`})}function ie(e){const t=Object.keys(e);return new O({type:"type",schema:e,*entries(n){if(C(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>C(e)||`Expected an object, but received: ${R(e)}`,coercer:e=>C(e)?{...e}:e})}function ae(e){const t=e.map((e=>e.type)).join(" | ");return new O({type:"union",schema:null,coercer(t){for(const n of e){const[e,r]=n.validate(t,{coerce:!0});if(!e)return r}return t},validator(n,r){const o=[];for(const t of e){const[...e]=B(n,t,r),[i]=e;if(!i?.[0])return[];for(const[t]of e)t&&o.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${R(n)}`,...o]}})}function se(){return D("unknown",(()=>!0))}function ce(e){return ee(e)}function ue(e){return e.path[e.path.length-1]in e.branch[e.branch.length-2]}function le(e){return new O({...e,validator:(t,n)=>!ue(n)||e.validator(t,n),refiner:(t,n)=>!ue(n)||e.refiner(t,n)})}function de(e,t,n){return new O({...e,coercer:(r,o)=>j(r,t)?e.coercer(n(r,o),o):e.coercer(r,o)})}function fe(e){return e instanceof Map||e instanceof Set?e.size:e.length}function he(e,t,n={}){const{exclusive:r}=n;return me(e,"min",(n=>r?n>t:n>=t||`Expected a ${e.type} greater than ${r?"":"or equal to "}${t} but received \`${n}\``))}function pe(e){return me(e,"nonempty",(t=>fe(t)>0||`Expected a nonempty ${e.type} but received an empty one`))}function ge(e,t){return me(e,"pattern",(n=>t.test(n)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${n}"`))}function me(e,t,n){return new O({...e,*refiner(r,o){yield*e.refiner(r,o);const i=N(n(r,o),o,e,r);for(const e of i)yield{...e,refinement:t}}})}const ye=(e,t)=>Object.hasOwnProperty.call(e,t);var ve;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(ve=ve||(ve={}));const we=e=>ee(e);function Ae({path:e,branch:t}){const n=e[e.length-1];return ye(t[t.length-2],n)}function be(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Ae(n)||e.validator(t,n),refiner:(t,n)=>!Ae(n)||e.refiner(t,n)})}function Se(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!Se(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!Se(n[e][1])){t=!1;break}return t}return!1}const Ee=D("JSON",(e=>Se(e))),ke=de(Ee,me(V(),"JSON",(e=>j(e,Ee))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const Ie=J("2.0"),Te=Q(ae([X(),re()])),_e=we({code:Z(),message:re(),data:be(ke),stack:be(re())}),xe=ae([ne(re(),ke),K(ke)]);we({id:Te,jsonrpc:Ie,method:re(),params:be(xe)}),we({jsonrpc:Ie,method:re(),params:be(xe)});ee({id:Te,jsonrpc:Ie,result:te(se()),error:te(_e)});const Ce=we({id:Te,jsonrpc:Ie,result:ke}),Re=we({id:Te,jsonrpc:Ie,error:_e});ae([Ce,Re]);const Pe=ce({jsonrpc:J("2.0"),id:ae([re(),X(),J(null)]),method:re(),params:le(ae([K(ke),ne(re(),ke)]))});const Ne=(e,t)=>Object.hasOwnProperty.call(e,t);var Be;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(Be=Be||(Be={}));const Oe=e=>ee(e);function Me({path:e,branch:t}){const n=e[e.length-1];return Ne(t[t.length-2],n)}function ze(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!Me(n)||e.validator(t,n),refiner:(t,n)=>!Me(n)||e.refiner(t,n)})}function je(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!je(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!je(n[e][1])){t=!1;break}return t}return!1}const Ue=D("JSON",(e=>je(e))),De=de(Ue,me(V(),"JSON",(e=>j(e,Ue))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const Le=J("2.0"),Fe=Q(ae([X(),re()])),$e=Oe({code:Z(),message:re(),data:ze(De),stack:ze(re())}),qe=ae([ne(re(),De),K(De)]);Oe({id:Fe,jsonrpc:Le,method:re(),params:ze(qe)}),Oe({jsonrpc:Le,method:re(),params:ze(qe)});ee({id:Fe,jsonrpc:Le,result:te(se()),error:te($e)});const We=Oe({id:Fe,jsonrpc:Le,result:De}),Ve=Oe({id:Fe,jsonrpc:Le,error:$e});ae([We,Ve]);function Ke(e,t){return D(e,(e=>"string"==typeof e&&t.test(e)))}const Ge=/^(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})$/u,He=/^[-a-z0-9]{3,8}$/u,Ze=/^[-_a-zA-Z0-9]{1,32}$/u,Je=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})):(?<accountAddress>[-.%a-zA-Z0-9]{1,128})$/u,Ye=/^[-.%a-zA-Z0-9]{1,128}$/u,Qe=/^[-a-z0-9]{3,8}$/u,Xe=/^[-.%a-zA-Z0-9]{1,128}$/u,et=/^[-.%a-zA-Z0-9]{1,78}$/u,tt=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u,nt=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u,rt=Ke("CaipChainId",Ge),ot=(Ke("CaipNamespace",He),Ke("CaipReference",Ze),Ke("CaipAccountId",Je)),it=(Ke("CaipAccountAddress",Ye),Ke("CaipAssetNamespace",Qe),Ke("CaipAssetReference",Xe),Ke("CaipTokenId",et),Ke("CaipAssetType",tt)),at=Ke("CaipAssetId",nt),st=Ke("CaipAssetTypeOrId",/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})(\/(?<tokenId>[-.%a-zA-Z0-9]{1,78}))?$/u);var ct,ut,lt,dt;!function(e){e.Bip122="bip122",e.Solana="solana",e.Eip155="eip155",e.Wallet="wallet"}(ct=ct||(ct={})),function(e){e.Eoa="eip155:eoa",e.Erc4337="eip155:erc4337"}(ut||(ut={})),function(e){e.P2pkh="bip122:p2pkh",e.P2sh="bip122:p2sh",e.P2wpkh="bip122:p2wpkh",e.P2tr="bip122:p2tr"}(lt||(lt={})),function(e){e.DataAccount="solana:data-account"}(dt||(dt={}));const ft=ce({id:$,type:H([`${ut.Eoa}`,`${ut.Erc4337}`,`${lt.P2pkh}`,`${lt.P2sh}`,`${lt.P2wpkh}`,`${lt.P2tr}`,`${dt.DataAccount}`]),address:re(),scopes:pe(K(rt)),options:ne(re(),De),methods:K(re())}),ht=(ee({address:ot}),ce({unit:re(),amount:W})),pt=ce({fungible:J(!0),type:it,...ht.schema}),gt=ce({fungible:J(!1),id:at}),mt=(yt=e=>function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}(e)&&!e.fungible?gt:pt,new O({type:"union",schema:null,*entries(e,t){yield*yt(e).entries(e,t)},*refiner(e,t){yield*yt(e).refiner(e,t)},coercer:(e,t)=>yt(e).coercer(e,t),validator:(e,t)=>yt(e).validator(e,t)}));var yt;const vt=ce({amount:W,unit:re()}),wt=Ke("DerivationPath",/^m(?:\/\d+'?)+$/u);var At;!function(e){e.Bip44="bip44"}(At||(At={}));const bt=ee({type:J(`${At.Bip44}`),scopes:K(rt),derivationPath:wt}),St=(ne(re(),De),ce({id:F,scope:re(),account:F,origin:re(),request:ce({method:re(),params:le(ae([K(De),ne(re(),De)]))})})),Et=(ae([ce({pending:J(!0),redirect:le(ce({message:le(re()),url:le(re())}))}),ce({pending:J(!1),result:De})]),ce({address:re(),asset:Q(mt)}));var kt;!function(e){e.Base="base",e.Priority="priority"}(kt||(kt={}));const It=ce({type:H([`${kt.Base}`,`${kt.Priority}`]),asset:mt});var Tt,_t;!function(e){e.Submitted="submitted",e.Unconfirmed="unconfirmed",e.Confirmed="confirmed",e.Failed="failed"}(Tt||(Tt={})),function(e){e.Send="send",e.Receive="receive",e.Swap="swap",e.BridgeSend="bridge:send",e.BridgeReceive="bridge:receive",e.Unknown="unknown"}(_t||(_t={}));const xt=ce({status:H([`${Tt.Submitted}`,`${Tt.Unconfirmed}`,`${Tt.Confirmed}`,`${Tt.Failed}`]),timestamp:Q(X())}),Ct=ce({id:re(),chain:rt,account:F,status:H([`${Tt.Submitted}`,`${Tt.Unconfirmed}`,`${Tt.Confirmed}`,`${Tt.Failed}`]),timestamp:Q(X()),type:H([`${_t.Send}`,`${_t.Receive}`,`${_t.Swap}`,`${_t.BridgeSend}`,`${_t.BridgeReceive}`,`${_t.Unknown}`]),from:K(Et),to:K(Et),fees:K(It),events:K(xt)}),Rt=(ce({data:K(Ct),next:Q(re())}),ce({limit:X(),next:le(Q(re()))})),Pt=ce({metamask:le(ce({correlationId:F}))});var Nt;!function(e){e.Mainnet="bip122:000000000019d6689c085ae165831e93",e.Testnet="bip122:000000000933ea01ad0ee984209779ba",e.Testnet4="bip122:00000000da84f2bafbbc53dee25a72ae",e.Signet="bip122:00000008819873e925422c1ff0f99f7c",e.Regtest="bip122:regtest"}(Nt||(Nt={}));const Bt=(e,t)=>{try{return _(e).type===t||new Error(`Invalid ${t} address`)}catch(e){return new Error(`Failed to decode ${t} address: ${e.message}`)}},Ot=me(re(),"BtcP2pkhAddressStruct",(e=>Bt(e,k.p2pkh))),Mt=me(re(),"BtcP2shAddressStruct",(e=>Bt(e,k.p2sh))),zt=me(re(),"BtcP2wpkhAddressStruct",(e=>Bt(e,k.p2wpkh))),jt=me(re(),"BtcP2trAddressStruct",(e=>Bt(e,k.p2tr)));var Ut;!function(e){e.SendBitcoin="sendBitcoin"}(Ut||(Ut={}));const Dt=ce({...ft.schema,scopes:pe(K(rt)),methods:K(H([`${Ut.SendBitcoin}`]))});ce({...Dt.schema,address:Ot,type:J(`${lt.P2pkh}`)}),ce({...Dt.schema,address:Mt,type:J(`${lt.P2sh}`)}),ce({...Dt.schema,address:zt,type:J(`${lt.P2wpkh}`)}),ce({...Dt.schema,address:jt,type:J(`${lt.P2tr}`)});var Lt;!function(e){e.Devnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",e.Mainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",e.Testnet="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"}(Lt||(Lt={}));const Ft=Ke("SolAddress",/^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu);var $t;!function(e){e.SendAndConfirmTransaction="sendAndConfirmTransaction",e.SignAndSendTransaction="signAndSendTransaction",e.SignTransaction="signTransaction",e.SignMessage="signMessage",e.SignIn="signIn"}($t||($t={}));ce({...ft.schema,address:Ft,type:J(`${dt.DataAccount}`),scopes:pe(K(rt)),methods:K(H(Object.values($t)))});var qt;!function(e){e.Eoa="eip155:0",e.Mainnet="eip155:1",e.Testnet="eip155:11155111"}(qt||(qt={}));const Wt=Ke("EthBytes",/^0x[0-9a-f]*$/iu),Vt=Ke("EthAddress",/^0x[0-9a-f]{40}$/iu),Kt=Ke("EthUint256",/^0x([1-9a-f][0-9a-f]*|0)$/iu);var Gt;!function(e){e.PersonalSign="personal_sign",e.Sign="eth_sign",e.SignTransaction="eth_signTransaction",e.SignTypedDataV1="eth_signTypedData_v1",e.SignTypedDataV3="eth_signTypedData_v3",e.SignTypedDataV4="eth_signTypedData_v4",e.PrepareUserOperation="eth_prepareUserOperation",e.PatchUserOperation="eth_patchUserOperation",e.SignUserOperation="eth_signUserOperation"}(Gt||(Gt={}));ce({...ft.schema,address:Vt,type:J(`${ut.Eoa}`),scopes:pe(K(J(qt.Eoa))),methods:K(H([`${Gt.PersonalSign}`,`${Gt.Sign}`,`${Gt.SignTransaction}`,`${Gt.SignTypedDataV1}`,`${Gt.SignTypedDataV3}`,`${Gt.SignTypedDataV4}`]))}),ce({...ft.schema,address:Vt,type:J(`${ut.Erc4337}`),scopes:pe(K(rt)),methods:K(H([`${Gt.PersonalSign}`,`${Gt.Sign}`,`${Gt.SignTypedDataV1}`,`${Gt.SignTypedDataV3}`,`${Gt.SignTypedDataV4}`,`${Gt.PrepareUserOperation}`,`${Gt.PatchUserOperation}`,`${Gt.SignUserOperation}`]))}),ce({sender:Vt,nonce:Kt,initCode:Wt,callData:Wt,callGasLimit:Kt,verificationGasLimit:Kt,preVerificationGas:Kt,maxFeePerGas:Kt,maxPriorityFeePerGas:Kt,paymasterAndData:Wt,signature:Wt}),ce({to:Vt,value:Kt,data:Wt}),ce({nonce:Kt,initCode:Wt,callData:Wt,gasLimits:le(ce({callGasLimit:Kt,verificationGasLimit:Kt,preVerificationGas:Kt})),dummyPaymasterAndData:Wt,dummySignature:Wt,bundlerUrl:q}),ce({paymasterAndData:Wt,callGasLimit:le(Kt),verificationGasLimit:le(Kt),preVerificationGas:le(Kt)});var Ht;!function(e){e.ListAccounts="keyring_listAccounts",e.GetAccount="keyring_getAccount",e.CreateAccount="keyring_createAccount",e.DiscoverAccounts="keyring_discoverAccounts",e.ListAccountAssets="keyring_listAccountAssets",e.ListAccountTransactions="keyring_listAccountTransactions",e.GetAccountBalances="keyring_getAccountBalances",e.ResolveAccountAddress="keyring_resolveAccountAddress",e.FilterAccountChains="keyring_filterAccountChains",e.UpdateAccount="keyring_updateAccount",e.DeleteAccount="keyring_deleteAccount",e.ExportAccount="keyring_exportAccount",e.ListRequests="keyring_listRequests",e.GetRequest="keyring_getRequest",e.SubmitRequest="keyring_submitRequest",e.ApproveRequest="keyring_approveRequest",e.RejectRequest="keyring_rejectRequest"}(Ht||(Ht={}));const Zt={jsonrpc:J("2.0"),id:ae([re(),X(),J(null)])},Jt=ce({...Zt,method:J("keyring_listAccounts")}),Yt=(K(ft),ce({...Zt,method:J("keyring_getAccount"),params:ce({id:F})})),Qt=ce({...Zt,method:J("keyring_createAccount"),params:ce({options:ne(re(),De)})}),Xt=ce({...Zt,method:J("keyring_discoverAccounts"),params:ce({scopes:K(rt),entropySource:re(),groupIndex:X()})}),en=(K(bt),ce({...Zt,method:J("keyring_listAccountTransactions"),params:ce({id:F,pagination:Rt})})),tn=ce({...Zt,method:J("keyring_listAccountAssets"),params:ce({id:F})}),nn=K(st),rn=ce({...Zt,method:J(`${Ht.GetAccountBalances}`),params:ce({id:F,assets:K(it)})}),on=(ne(it,vt),ce({...Zt,method:J("keyring_resolveAccountAddress"),params:ce({scope:rt,request:Pe})})),an=(Q(ce({address:ot})),ce({...Zt,method:J("keyring_filterAccountChains"),params:ce({id:F,chains:K(re())})})),sn=(K(re()),ce({...Zt,method:J("keyring_updateAccount"),params:ce({account:ft})})),cn=(J(null),ce({...Zt,method:J("keyring_deleteAccount"),params:ce({id:F})})),un=(J(null),ce({...Zt,method:J("keyring_exportAccount"),params:ce({id:F})})),ln=ce({...Zt,method:J("keyring_listRequests")}),dn=(K(St),ce({...Zt,method:J("keyring_getRequest"),params:ce({id:F})})),fn=ce({...Zt,method:J("keyring_submitRequest"),params:St}),hn=ce({...Zt,method:J("keyring_approveRequest"),params:ce({id:F,data:ne(re(),De)})}),pn=(J(null),ce({...Zt,method:J("keyring_rejectRequest"),params:ce({id:F})}));J(null);var gn;!function(e){e.AccountCreated="notify:accountCreated",e.AccountUpdated="notify:accountUpdated",e.AccountDeleted="notify:accountDeleted",e.RequestApproved="notify:requestApproved",e.RequestRejected="notify:requestRejected",e.AccountBalancesUpdated="notify:accountBalancesUpdated",e.AccountAssetListUpdated="notify:accountAssetListUpdated",e.AccountTransactionsUpdated="notify:accountTransactionsUpdated"}(gn||(gn={}));ce({method:J(`${gn.AccountCreated}`),params:ce({account:ft,accountNameSuggestion:le(re()),displayConfirmation:le(G()),displayAccountNameSuggestion:le(G()),...Pt.schema})}),ce({method:J(`${gn.AccountUpdated}`),params:ce({account:ft})}),ce({method:J(`${gn.AccountDeleted}`),params:ce({id:F})}),ce({method:J(`${gn.RequestApproved}`),params:ce({id:F,result:De})}),ce({method:J(`${gn.RequestRejected}`),params:ce({id:F})}),ce({method:J(`${gn.AccountBalancesUpdated}`),params:ce({balances:ne($,ne(it,ht))})}),ce({method:J(`${gn.AccountTransactionsUpdated}`),params:ce({transactions:ne($,K(Ct))})}),ce({method:J(`${gn.AccountAssetListUpdated}`),params:ce({assets:ne($,ce({added:K(st),removed:K(st)}))})});class mn extends Error{constructor(e){super(`Method not supported: ${e}`)}}async function yn(e,t){try{return await async function(e,t){switch(M(t,Pe),t.method){case`${Ht.ListAccounts}`:return M(t,Jt),e.listAccounts();case`${Ht.GetAccount}`:return M(t,Yt),e.getAccount(t.params.id);case`${Ht.CreateAccount}`:return M(t,Qt),e.createAccount(t.params.options);case`${Ht.DiscoverAccounts}`:if(void 0===e.discoverAccounts)throw new mn(t.method);return M(t,Xt),e.discoverAccounts(t.params.scopes,t.params.entropySource,t.params.groupIndex);case`${Ht.ListAccountTransactions}`:if(void 0===e.listAccountTransactions)throw new mn(t.method);return M(t,en),e.listAccountTransactions(t.params.id,t.params.pagination);case`${Ht.ListAccountAssets}`:if(void 0===e.listAccountAssets)throw new mn(t.method);return M(t,tn),e.listAccountAssets(t.params.id);case`${Ht.GetAccountBalances}`:if(void 0===e.getAccountBalances)throw new mn(t.method);return M(t,rn),e.getAccountBalances(t.params.id,t.params.assets);case`${Ht.ResolveAccountAddress}`:if(void 0===e.resolveAccountAddress)throw new mn(t.method);return M(t,on),e.resolveAccountAddress(t.params.scope,t.params.request);case`${Ht.FilterAccountChains}`:return M(t,an),e.filterAccountChains(t.params.id,t.params.chains);case`${Ht.UpdateAccount}`:return M(t,sn),e.updateAccount(t.params.account);case`${Ht.DeleteAccount}`:return M(t,cn),e.deleteAccount(t.params.id);case`${Ht.ExportAccount}`:if(void 0===e.exportAccount)throw new mn(t.method);return M(t,un),e.exportAccount(t.params.id);case`${Ht.ListRequests}`:if(void 0===e.listRequests)throw new mn(t.method);return M(t,ln),e.listRequests();case`${Ht.GetRequest}`:if(void 0===e.getRequest)throw new mn(t.method);return M(t,dn),e.getRequest(t.params.id);case`${Ht.SubmitRequest}`:return M(t,fn),e.submitRequest(t.params);case`${Ht.ApproveRequest}`:if(void 0===e.approveRequest)throw new mn(t.method);return M(t,hn),e.approveRequest(t.params.id,t.params.data);case`${Ht.RejectRequest}`:if(void 0===e.rejectRequest)throw new mn(t.method);return M(t,pn),e.rejectRequest(t.params.id);default:throw new mn(t.method)}}(e,t)}catch(e){const t=e instanceof Error&&"string"==typeof e.message?e.message:"An unknown error occurred while handling the keyring request";throw new Error(t)}}async function vn(e,t,n){await e.request({method:"snap_manageAccounts",params:{method:t,params:{...n}}})}function wn(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)}const An=(e,t)=>Object.hasOwnProperty.call(e,t);var bn;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(bn=bn||(bn={}));function Sn(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}var En=n(282);class kn extends TypeError{constructor(e,t){let n;const{message:r,explanation:o,...i}=e,{path:a}=e,s=0===a.length?r:`At path: ${a.join(".")} -- ${r}`;super(o??s),null!=o&&(this.cause=s),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function In(e){return"object"==typeof e&&null!==e}function Tn(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function _n(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:o,branch:i}=t,{type:a}=n,{refinement:s,message:c=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${Tn(r)}\``}=e;return{value:r,type:a,refinement:s,key:o[o.length-1],path:o,branch:i,...e,message:c}}function*xn(e,t,n,r){(function(e){return In(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const o of e){const e=_n(o,t,n,r);e&&(yield e)}}function*Cn(e,t,n={}){const{path:r=[],branch:o=[e],coerce:i=!1,mask:a=!1}=n,s={path:r,branch:o};if(i&&(e=t.coercer(e,s),a&&"type"!==t.type&&In(t.schema)&&In(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let c="valid";for(const r of t.validator(e,s))r.explanation=n.message,c="not_valid",yield[r,void 0];for(let[u,l,d]of t.entries(e,s)){const t=Cn(l,d,{path:void 0===u?r:[...r,u],branch:void 0===u?o:[...o,l],coerce:i,mask:a,message:n.message});for(const n of t)n[0]?(c=null===n[0].refinement||void 0===n[0].refinement?"not_valid":"not_refined",yield[n[0],void 0]):i&&(l=n[1],void 0===u?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):In(e)&&(void 0!==l||u in e)&&(e[u]=l))}if("not_valid"!==c)for(const r of t.refiner(e,s))r.explanation=n.message,c="not_refined",yield[r,void 0];"valid"===c&&(yield[void 0,e])}class Rn{constructor(e){const{type:t,schema:n,validator:r,refiner:o,coercer:i=(e=>e),entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=i,this.validator=r?(e,t)=>xn(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>xn(o(e,t),t,this,e):()=>[]}assert(e,t){return Pn(e,this,t)}create(e,t){return Nn(e,this,t)}is(e){return Bn(e,this)}mask(e,t){return function(e,t,n){const r=On(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return On(e,this,t)}}function Pn(e,t,n){const r=On(e,t,{message:n});if(r[0])throw r[0]}function Nn(e,t,n){const r=On(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function Bn(e,t){return!On(e,t)[0]}function On(e,t,n={}){const r=Cn(e,t,n),o=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(o[0]){return[new kn(o[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]}return[void 0,o[1]]}function Mn(e,t){return new Rn({type:e,schema:null,validator:t})}function zn(){return Mn("never",(()=>!1))}function jn(e){const t=e?Object.keys(e):[],n=zn();return new Rn({type:"object",schema:e??null,*entries(r){if(e&&In(r)){const o=new Set(Object.keys(r));for(const n of t)o.delete(n),yield[n,r[n],e[n]];for(const e of o)yield[e,r[e],n]}},validator:e=>In(e)||`Expected an object, but received: ${Tn(e)}`,coercer:e=>In(e)?{...e}:e})}function Un(e){return new Rn({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function Dn(){return Mn("string",(e=>"string"==typeof e||`Expected a string, but received: ${Tn(e)}`))}function Ln(e){const t=e.map((e=>e.type)).join(" | ");return new Rn({type:"union",schema:null,coercer(t){for(const n of e){const[e,r]=n.validate(t,{coerce:!0});if(!e)return r}return t},validator(n,r){const o=[];for(const t of e){const[...e]=Cn(n,t,r),[i]=e;if(!i?.[0])return[];for(const[t]of e)t&&o.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${Tn(n)}`,...o]}})}function Fn(e,t,n){return new Rn({...e,coercer:(r,o)=>Bn(r,t)?e.coercer(n(r,o),o):e.coercer(r,o)})}function $n(e,t,n){return new Rn({...e,*refiner(r,o){yield*e.refiner(r,o);const i=xn(n(r,o),o,e,r);for(const e of i)yield{...e,refinement:t}}})}const qn=e=>jn(e);function Wn({path:e,branch:t}){const n=e[e.length-1];return An(t[t.length-2],n)}function Vn(e){return new Rn({...e,type:`optional ${e.type}`,validator:(t,n)=>!Wn(n)||e.validator(t,n),refiner:(t,n)=>!Wn(n)||e.refiner(t,n)})}function Kn(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!Kn(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!Kn(n[e][1])){t=!1;break}return t}return!1}const Gn=Mn("JSON",(e=>Kn(e))),Hn=Fn(Gn,$n(Mn("any",(()=>!0)),"JSON",(e=>Bn(e,Gn))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));function Zn(e){try{return function(e){Nn(e,Hn)}(e),!0}catch{return!1}}const Jn=function(e){const t=Tn(e),n=typeof e;return new Rn({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${Tn(n)}`})}("2.0"),Yn=(Qn=Ln([Mn("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${Tn(e)}`)),Dn()]),new Rn({...Qn,validator:(e,t)=>null===e||Qn.validator(e,t),refiner:(e,t)=>null===e||Qn.refiner(e,t)}));var Qn;const Xn=qn({code:Mn("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${Tn(e)}`)),message:Dn(),data:Vn(Hn),stack:Vn(Dn())}),er=Ln([function(e,t){return new Rn({type:"record",schema:null,*entries(n){if(In(n))for(const r in n){const o=n[r];yield[r,r,e],yield[r,o,t]}},validator:e=>In(e)||`Expected an object, but received: ${Tn(e)}`})}(Dn(),Hn),(tr=Hn,new Rn({type:"array",schema:tr,*entries(e){if(tr&&Array.isArray(e))for(const[t,n]of e.entries())yield[t,n,tr]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${Tn(e)}`}))]);var tr;qn({id:Yn,jsonrpc:Jn,method:Dn(),params:Vn(er)}),qn({jsonrpc:Jn,method:Dn(),params:Vn(er)});jn({id:Yn,jsonrpc:Jn,result:Un(Mn("unknown",(()=>!0))),error:Un(Xn)});const nr=qn({id:Yn,jsonrpc:Jn,result:Hn}),rr=qn({id:Yn,jsonrpc:Jn,error:Xn});Ln([nr,rr]);const or={invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},ir={userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901},ar={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},sr=or.internal,cr="Unspecified error message. This is a bug, please report it.",ur=(lr(sr),"Unspecified server error.");function lr(e,t=cr){if(function(e){return Number.isInteger(e)}(e)){const t=e.toString();if(An(ar,t))return ar[t].message;if(function(e){return e>=-32099&&e<=-32e3}(e))return ur}return t}function dr(e){return Array.isArray(e)?e.map((e=>Zn(e)?e:wn(e)?fr(e):null)):wn(e)?fr(e):Zn(e)?e:null}function fr(e){return Object.getOwnPropertyNames(e).reduce(((t,n)=>{const r=e[n];return Zn(r)&&(t[n]=r),t}),{})}const hr=function(e){return e?.__esModule?e.default:e}(En);class pr extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a non-empty string.');!function(e){return wn(e)&&An(e,"cause")&&wn(e.cause)}(n)?super(t):(super(t,{cause:n.cause}),An(this,"cause")||Object.assign(this,{cause:n.cause})),void 0!==n&&(this.data=n),this.code=e}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data,Sn(this.data)&&(e.data.cause=dr(this.data.cause))),this.stack&&(e.stack=this.stack),e}toString(){return hr(this.serialize(),mr,2)}}class gr extends pr{constructor(e,t,n){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}}function mr(e,t){if("[Circular]"!==t)return t}const yr=e=>Br(or.parse,e),vr=e=>Br(or.invalidRequest,e),wr=e=>Br(or.invalidParams,e),Ar=e=>Br(or.methodNotFound,e),br=e=>Br(or.internal,e),Sr=e=>Br(or.invalidInput,e),Er=e=>Br(or.resourceNotFound,e),kr=e=>Br(or.resourceUnavailable,e),Ir=e=>Br(or.transactionRejected,e),Tr=e=>Br(or.methodNotSupported,e),_r=e=>Br(or.limitExceeded,e),xr=e=>Or(ir.userRejectedRequest,e),Cr=e=>Or(ir.unauthorized,e),Rr=e=>Or(ir.unsupportedMethod,e),Pr=e=>Or(ir.disconnected,e),Nr=e=>Or(ir.chainDisconnected,e);function Br(e,t){const[n,r]=Mr(t);return new pr(e,n??lr(e),r)}function Or(e,t){const[n,r]=Mr(t);return new gr(e,n??lr(e),r)}function Mr(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t??void 0,n]}}return[]}function zr(e,t,n=null){return wn(e)&&An(e,t)?e[t]:n}function jr(e,t,n=String(e)){const r=zr(e,t);return"string"==typeof r?r:n}function Ur(e){return jr(e,"message")}function Dr(e){return jr(e,"stack",null)}function Lr(e){return jr(e,"name",e instanceof Error?e.name:"Error")}function Fr(e){const t=zr(e,"data");return null!==t&&Zn(t)&&!Array.isArray(t)?t:{}}class $r extends Error{#e;#t;#n;#r;constructor(e,t={}){const n=Ur(e);super(n),this.#t=n,this.#e=function(e){const t=zr(e,"code");return"number"==typeof t&&Number.isInteger(t)?t:-32603}(e);const r={...Fr(e),...t};Object.keys(r).length>0&&(this.#n=r),this.#r=super.stack}get name(){return"SnapError"}get code(){return this.#e}get message(){return this.#t}get data(){return this.#n}get stack(){return this.#r}toJSON(){return{code:-31002,message:"Snap Error",data:{cause:{code:this.code,message:this.message,stack:this.stack,...this.data?{data:this.data}:{}}}}}serialize(){return this.toJSON()}}function qr(e){if("string"==typeof e)return{name:"Error",message:e,stack:null,cause:null};if(Bn(e,Xn))return{name:"JsonRpcError",message:Ur(e),stack:Dr(e)??Dr(e.data)??null,cause:null};const t=function(e){return zr(e,"cause")}(e);return{name:Lr(e),message:Ur(e),stack:Dr(e)??null,cause:null===t?null:qr(t)}}function Wr(e){return class extends $r{constructor(t,n){if("object"==typeof t){const n=e();return void super({code:n.code,message:n.message,data:t})}const r=e(t);super({code:r.code,message:r.message,data:n})}}}const Vr=Wr(br),Kr=Wr(Sr),Gr=Wr(wr),Hr=Wr(vr),Zr=Wr(_r),Jr=Wr(Ar),Yr=Wr(Tr),Qr=Wr(yr),Xr=Wr(Er),eo=Wr(kr),to=Wr(Ir),no=Wr(Nr),ro=Wr(Pr),oo=Wr(Cr),io=Wr(Rr),ao=Wr(xr);var so=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,co=Math.ceil,uo=Math.floor,lo="[BigNumber Error] ",fo=lo+"Number primitive has more than 15 significant digits: ",ho=1e14,po=14,go=9007199254740991,mo=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],yo=1e7,vo=1e9;function wo(e){var t=0|e;return e>0||e===t?t:t-1}function Ao(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=po-t.length;n--;t="0"+t);i+=t}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function bo(e,t){var n,r,o=e.c,i=t.c,a=e.s,s=t.s,c=e.e,u=t.e;if(!a||!s)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-s:a;if(a!=s)return a;if(n=a<0,r=c==u,!o||!i)return r?0:!o^n?1:-1;if(!r)return c>u^n?1:-1;for(s=(c=o.length)<(u=i.length)?c:u,a=0;a<s;a++)if(o[a]!=i[a])return o[a]>i[a]^n?1:-1;return c==u?0:c>u^n?1:-1}function So(e,t,n,r){if(e<t||e>n||e!==uo(e))throw Error(lo+(r||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Eo(e){var t=e.c.length-1;return wo(e.e/po)==t&&e.c[t]%2!=0}function ko(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Io(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(++t>(r=e.length)){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var To=function e(t){var n,r,o,i,a,s,c,u,l,d,f=T.prototype={constructor:T,toString:null,valueOf:null},h=new T(1),p=20,g=4,m=-7,y=21,v=-1e7,w=1e7,A=!1,b=1,S=0,E={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},k="0123456789abcdefghijklmnopqrstuvwxyz",I=!0;function T(e,t){var n,i,a,s,c,u,l,d,f=this;if(!(f instanceof T))return new T(e,t);if(null==t){if(e&&!0===e._isBigNumber)return f.s=e.s,void(!e.c||e.e>w?f.c=f.e=null:e.e<v?f.c=[f.e=0]:(f.e=e.e,f.c=e.c.slice()));if((u="number"==typeof e)&&0*e==0){if(f.s=1/e<0?(e=-e,-1):1,e===~~e){for(s=0,c=e;c>=10;c/=10,s++);return void(s>w?f.c=f.e=null:(f.e=s,f.c=[e]))}d=String(e)}else{if(!so.test(d=String(e)))return o(f,d,u);f.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(s=d.indexOf("."))>-1&&(d=d.replace(".","")),(c=d.search(/e/i))>0?(s<0&&(s=c),s+=+d.slice(c+1),d=d.substring(0,c)):s<0&&(s=d.length)}else{if(So(t,2,k.length,"Base"),10==t&&I)return R(f=new T(e),p+f.e+1,g);if(d=String(e),u="number"==typeof e){if(0*e!=0)return o(f,d,u,t);if(f.s=1/e<0?(d=d.slice(1),-1):1,T.DEBUG&&d.replace(/^0\.0*|\./,"").length>15)throw Error(fo+e)}else f.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(n=k.slice(0,t),s=c=0,l=d.length;c<l;c++)if(n.indexOf(i=d.charAt(c))<0){if("."==i){if(c>s){s=l;continue}}else if(!a&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){a=!0,c=-1,s=0;continue}return o(f,String(e),u,t)}u=!1,(s=(d=r(d,t,10,f.s)).indexOf("."))>-1?d=d.replace(".",""):s=d.length}for(c=0;48===d.charCodeAt(c);c++);for(l=d.length;48===d.charCodeAt(--l););if(d=d.slice(c,++l)){if(l-=c,u&&T.DEBUG&&l>15&&(e>go||e!==uo(e)))throw Error(fo+f.s*e);if((s=s-c-1)>w)f.c=f.e=null;else if(s<v)f.c=[f.e=0];else{if(f.e=s,f.c=[],c=(s+1)%po,s<0&&(c+=po),c<l){for(c&&f.c.push(+d.slice(0,c)),l-=po;c<l;)f.c.push(+d.slice(c,c+=po));c=po-(d=d.slice(c)).length}else c-=l;for(;c--;d+="0");f.c.push(+d)}}else f.c=[f.e=0]}function _(e,t,n,r){var o,i,a,s,c;if(null==n?n=g:So(n,0,8),!e.c)return e.toString();if(o=e.c[0],a=e.e,null==t)c=Ao(e.c),c=1==r||2==r&&(a<=m||a>=y)?ko(c,a):Io(c,a,"0");else if(i=(e=R(new T(e),t,n)).e,s=(c=Ao(e.c)).length,1==r||2==r&&(t<=i||i<=m)){for(;s<t;c+="0",s++);c=ko(c,i)}else if(t-=a,c=Io(c,i,"0"),i+1>s){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=i-s)>0)for(i+1==s&&(c+=".");t--;c+="0");return e.s<0&&o?"-"+c:c}function x(e,t){for(var n,r,o=1,i=new T(e[0]);o<e.length;o++)(!(r=new T(e[o])).s||(n=bo(i,r))===t||0===n&&i.s===t)&&(i=r);return i}function C(e,t,n){for(var r=1,o=t.length;!t[--o];t.pop());for(o=t[0];o>=10;o/=10,r++);return(n=r+n*po-1)>w?e.c=e.e=null:n<v?e.c=[e.e=0]:(e.e=n,e.c=t),e}function R(e,t,n,r){var o,i,a,s,c,u,l,d=e.c,f=mo;if(d){e:{for(o=1,s=d[0];s>=10;s/=10,o++);if((i=t-o)<0)i+=po,a=t,c=d[u=0],l=uo(c/f[o-a-1]%10);else if((u=co((i+1)/po))>=d.length){if(!r)break e;for(;d.length<=u;d.push(0));c=l=0,o=1,a=(i%=po)-po+1}else{for(c=s=d[u],o=1;s>=10;s/=10,o++);l=(a=(i%=po)-po+o)<0?0:uo(c/f[o-a-1]%10)}if(r=r||t<0||null!=d[u+1]||(a<0?c:c%f[o-a-1]),r=n<4?(l||r)&&(0==n||n==(e.s<0?3:2)):l>5||5==l&&(4==n||r||6==n&&(i>0?a>0?c/f[o-a]:0:d[u-1])%10&1||n==(e.s<0?8:7)),t<1||!d[0])return d.length=0,r?(t-=e.e+1,d[0]=f[(po-t%po)%po],e.e=-t||0):d[0]=e.e=0,e;if(0==i?(d.length=u,s=1,u--):(d.length=u+1,s=f[po-i],d[u]=a>0?uo(c/f[o-a]%f[a])*s:0),r)for(;;){if(0==u){for(i=1,a=d[0];a>=10;a/=10,i++);for(a=d[0]+=s,s=1;a>=10;a/=10,s++);i!=s&&(e.e++,d[0]==ho&&(d[0]=1));break}if(d[u]+=s,d[u]!=ho)break;d[u--]=0,s=1}for(i=d.length;0===d[--i];d.pop());}e.e>w?e.c=e.e=null:e.e<v&&(e.c=[e.e=0])}return e}function P(e){var t,n=e.e;return null===n?e.toString():(t=Ao(e.c),t=n<=m||n>=y?ko(t,n):Io(t,n,"0"),e.s<0?"-"+t:t)}return T.clone=e,T.ROUND_UP=0,T.ROUND_DOWN=1,T.ROUND_CEIL=2,T.ROUND_FLOOR=3,T.ROUND_HALF_UP=4,T.ROUND_HALF_DOWN=5,T.ROUND_HALF_EVEN=6,T.ROUND_HALF_CEIL=7,T.ROUND_HALF_FLOOR=8,T.EUCLID=9,T.config=T.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(lo+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(So(n=e[t],0,vo,t),p=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(So(n=e[t],0,8,t),g=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(So(n[0],-vo,0,t),So(n[1],0,vo,t),m=n[0],y=n[1]):(So(n,-vo,vo,t),m=-(y=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)So(n[0],-vo,-1,t),So(n[1],1,vo,t),v=n[0],w=n[1];else{if(So(n,-vo,vo,t),!n)throw Error(lo+t+" cannot be zero: "+n);v=-(w=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(lo+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw A=!n,Error(lo+"crypto unavailable");A=n}else A=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(So(n=e[t],0,9,t),b=n),e.hasOwnProperty(t="POW_PRECISION")&&(So(n=e[t],0,vo,t),S=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(lo+t+" not an object: "+n);E=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(lo+t+" invalid: "+n);I="0123456789"==n.slice(0,10),k=n}}return{DECIMAL_PLACES:p,ROUNDING_MODE:g,EXPONENTIAL_AT:[m,y],RANGE:[v,w],CRYPTO:A,MODULO_MODE:b,POW_PRECISION:S,FORMAT:E,ALPHABET:k}},T.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!T.DEBUG)return!0;var t,n,r=e.c,o=e.e,i=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===i||-1===i)&&o>=-vo&&o<=vo&&o===uo(o)){if(0===r[0]){if(0===o&&1===r.length)return!0;break e}if((t=(o+1)%po)<1&&(t+=po),String(r[0]).length==t){for(t=0;t<r.length;t++)if((n=r[t])<0||n>=ho||n!==uo(n))break e;if(0!==n)return!0}}}else if(null===r&&null===o&&(null===i||1===i||-1===i))return!0;throw Error(lo+"Invalid BigNumber: "+e)},T.maximum=T.max=function(){return x(arguments,-1)},T.minimum=T.min=function(){return x(arguments,1)},T.random=(i=9007199254740992,a=Math.random()*i&2097151?function(){return uo(Math.random()*i)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,o,i,s=0,c=[],u=new T(h);if(null==e?e=p:So(e,0,vo),o=co(e/po),A)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));s<o;)(i=131072*t[s]+(t[s+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[s]=n[0],t[s+1]=n[1]):(c.push(i%1e14),s+=2);s=o/2}else{if(!crypto.randomBytes)throw A=!1,Error(lo+"crypto unavailable");for(t=crypto.randomBytes(o*=7);s<o;)(i=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6])>=9e15?crypto.randomBytes(7).copy(t,s):(c.push(i%1e14),s+=7);s=o/7}if(!A)for(;s<o;)(i=a())<9e15&&(c[s++]=i%1e14);for(o=c[--s],e%=po,o&&e&&(i=mo[po-e],c[s]=uo(o/i)*i);0===c[s];c.pop(),s--);if(s<0)c=[r=0];else{for(r=-1;0===c[0];c.splice(0,1),r-=po);for(s=1,i=c[0];i>=10;i/=10,s++);s<po&&(r-=po-s)}return u.e=r,u.c=c,u}),T.sum=function(){for(var e=1,t=arguments,n=new T(t[0]);e<t.length;)n=n.plus(t[e++]);return n},r=function(){var e="0123456789";function t(e,t,n,r){for(var o,i,a=[0],s=0,c=e.length;s<c;){for(i=a.length;i--;a[i]*=t);for(a[0]+=r.indexOf(e.charAt(s++)),o=0;o<a.length;o++)a[o]>n-1&&(null==a[o+1]&&(a[o+1]=0),a[o+1]+=a[o]/n|0,a[o]%=n)}return a.reverse()}return function(r,o,i,a,s){var c,u,l,d,f,h,m,y,v=r.indexOf("."),w=p,A=g;for(v>=0&&(d=S,S=0,r=r.replace(".",""),h=(y=new T(o)).pow(r.length-v),S=d,y.c=t(Io(Ao(h.c),h.e,"0"),10,i,e),y.e=y.c.length),l=d=(m=t(r,o,i,s?(c=k,e):(c=e,k))).length;0==m[--d];m.pop());if(!m[0])return c.charAt(0);if(v<0?--l:(h.c=m,h.e=l,h.s=a,m=(h=n(h,y,w,A,i)).c,f=h.r,l=h.e),v=m[u=l+w+1],d=i/2,f=f||u<0||null!=m[u+1],f=A<4?(null!=v||f)&&(0==A||A==(h.s<0?3:2)):v>d||v==d&&(4==A||f||6==A&&1&m[u-1]||A==(h.s<0?8:7)),u<1||!m[0])r=f?Io(c.charAt(1),-w,c.charAt(0)):c.charAt(0);else{if(m.length=u,f)for(--i;++m[--u]>i;)m[u]=0,u||(++l,m=[1].concat(m));for(d=m.length;!m[--d];);for(v=0,r="";v<=d;r+=c.charAt(m[v++]));r=Io(r,l,c.charAt(0))}return r}}(),n=function(){function e(e,t,n){var r,o,i,a,s=0,c=e.length,u=t%yo,l=t/yo|0;for(e=e.slice();c--;)s=((o=u*(i=e[c]%yo)+(r=l*i+(a=e[c]/yo|0)*u)%yo*yo+s)/n|0)+(r/yo|0)+l*a,e[c]=o%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var o,i;if(n!=r)i=n>r?1:-1;else for(o=i=0;o<n;o++)if(e[o]!=t[o]){i=e[o]>t[o]?1:-1;break}return i}function n(e,t,n,r){for(var o=0;n--;)e[n]-=o,o=e[n]<t[n]?1:0,e[n]=o*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,o,i,a,s){var c,u,l,d,f,h,p,g,m,y,v,w,A,b,S,E,k,I=r.s==o.s?1:-1,_=r.c,x=o.c;if(!(_&&_[0]&&x&&x[0]))return new T(r.s&&o.s&&(_?!x||_[0]!=x[0]:x)?_&&0==_[0]||!x?0*I:I/0:NaN);for(m=(g=new T(I)).c=[],I=i+(u=r.e-o.e)+1,s||(s=ho,u=wo(r.e/po)-wo(o.e/po),I=I/po|0),l=0;x[l]==(_[l]||0);l++);if(x[l]>(_[l]||0)&&u--,I<0)m.push(1),d=!0;else{for(b=_.length,E=x.length,l=0,I+=2,(f=uo(s/(x[0]+1)))>1&&(x=e(x,f,s),_=e(_,f,s),E=x.length,b=_.length),A=E,v=(y=_.slice(0,E)).length;v<E;y[v++]=0);k=x.slice(),k=[0].concat(k),S=x[0],x[1]>=s/2&&S++;do{if(f=0,(c=t(x,y,E,v))<0){if(w=y[0],E!=v&&(w=w*s+(y[1]||0)),(f=uo(w/S))>1)for(f>=s&&(f=s-1),p=(h=e(x,f,s)).length,v=y.length;1==t(h,y,p,v);)f--,n(h,E<p?k:x,p,s),p=h.length,c=1;else 0==f&&(c=f=1),p=(h=x.slice()).length;if(p<v&&(h=[0].concat(h)),n(y,h,v,s),v=y.length,-1==c)for(;t(x,y,E,v)<1;)f++,n(y,E<v?k:x,v,s),v=y.length}else 0===c&&(f++,y=[0]);m[l++]=f,y[0]?y[v++]=_[A]||0:(y=[_[A]],v=1)}while((A++<b||null!=y[0])&&I--);d=null!=y[0],m[0]||m.splice(0,1)}if(s==ho){for(l=1,I=m[0];I>=10;I/=10,l++);R(g,i+(g.e=l+u*po-1)+1,a,d)}else g.e=u,g.r=+d;return g}}(),s=/^(-?)0([xbo])(?=\w[\w.]*$)/i,c=/^([^.]+)\.$/,u=/^\.([^.]+)$/,l=/^-?(Infinity|NaN)$/,d=/^\s*\+(?=[\w.])|^\s+|\s+$/g,o=function(e,t,n,r){var o,i=n?t:t.replace(d,"");if(l.test(i))e.s=isNaN(i)?null:i<0?-1:1;else{if(!n&&(i=i.replace(s,(function(e,t,n){return o="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=o?e:t})),r&&(o=r,i=i.replace(c,"$1").replace(u,"0.$1")),t!=i))return new T(i,o);if(T.DEBUG)throw Error(lo+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},f.absoluteValue=f.abs=function(){var e=new T(this);return e.s<0&&(e.s=1),e},f.comparedTo=function(e,t){return bo(this,new T(e,t))},f.decimalPlaces=f.dp=function(e,t){var n,r,o,i=this;if(null!=e)return So(e,0,vo),null==t?t=g:So(t,0,8),R(new T(i),e+i.e+1,t);if(!(n=i.c))return null;if(r=((o=n.length-1)-wo(this.e/po))*po,o=n[o])for(;o%10==0;o/=10,r--);return r<0&&(r=0),r},f.dividedBy=f.div=function(e,t){return n(this,new T(e,t),p,g)},f.dividedToIntegerBy=f.idiv=function(e,t){return n(this,new T(e,t),0,1)},f.exponentiatedBy=f.pow=function(e,t){var n,r,o,i,a,s,c,u,l=this;if((e=new T(e)).c&&!e.isInteger())throw Error(lo+"Exponent not an integer: "+P(e));if(null!=t&&(t=new T(t)),a=e.e>14,!l.c||!l.c[0]||1==l.c[0]&&!l.e&&1==l.c.length||!e.c||!e.c[0])return u=new T(Math.pow(+P(l),a?e.s*(2-Eo(e)):+P(e))),t?u.mod(t):u;if(s=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new T(NaN);(r=!s&&l.isInteger()&&t.isInteger())&&(l=l.mod(t))}else{if(e.e>9&&(l.e>0||l.e<-1||(0==l.e?l.c[0]>1||a&&l.c[1]>=24e7:l.c[0]<8e13||a&&l.c[0]<=9999975e7)))return i=l.s<0&&Eo(e)?-0:0,l.e>-1&&(i=1/i),new T(s?1/i:i);S&&(i=co(S/po+2))}for(a?(n=new T(.5),s&&(e.s=1),c=Eo(e)):c=(o=Math.abs(+P(e)))%2,u=new T(h);;){if(c){if(!(u=u.times(l)).c)break;i?u.c.length>i&&(u.c.length=i):r&&(u=u.mod(t))}if(o){if(0===(o=uo(o/2)))break;c=o%2}else if(R(e=e.times(n),e.e+1,1),e.e>14)c=Eo(e);else{if(0===(o=+P(e)))break;c=o%2}l=l.times(l),i?l.c&&l.c.length>i&&(l.c.length=i):r&&(l=l.mod(t))}return r?u:(s&&(u=h.div(u)),t?u.mod(t):i?R(u,S,g,undefined):u)},f.integerValue=function(e){var t=new T(this);return null==e?e=g:So(e,0,8),R(t,t.e+1,e)},f.isEqualTo=f.eq=function(e,t){return 0===bo(this,new T(e,t))},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(e,t){return bo(this,new T(e,t))>0},f.isGreaterThanOrEqualTo=f.gte=function(e,t){return 1===(t=bo(this,new T(e,t)))||0===t},f.isInteger=function(){return!!this.c&&wo(this.e/po)>this.c.length-2},f.isLessThan=f.lt=function(e,t){return bo(this,new T(e,t))<0},f.isLessThanOrEqualTo=f.lte=function(e,t){return-1===(t=bo(this,new T(e,t)))||0===t},f.isNaN=function(){return!this.s},f.isNegative=function(){return this.s<0},f.isPositive=function(){return this.s>0},f.isZero=function(){return!!this.c&&0==this.c[0]},f.minus=function(e,t){var n,r,o,i,a=this,s=a.s;if(t=(e=new T(e,t)).s,!s||!t)return new T(NaN);if(s!=t)return e.s=-t,a.plus(e);var c=a.e/po,u=e.e/po,l=a.c,d=e.c;if(!c||!u){if(!l||!d)return l?(e.s=-t,e):new T(d?a:NaN);if(!l[0]||!d[0])return d[0]?(e.s=-t,e):new T(l[0]?a:3==g?-0:0)}if(c=wo(c),u=wo(u),l=l.slice(),s=c-u){for((i=s<0)?(s=-s,o=l):(u=c,o=d),o.reverse(),t=s;t--;o.push(0));o.reverse()}else for(r=(i=(s=l.length)<(t=d.length))?s:t,s=t=0;t<r;t++)if(l[t]!=d[t]){i=l[t]<d[t];break}if(i&&(o=l,l=d,d=o,e.s=-e.s),(t=(r=d.length)-(n=l.length))>0)for(;t--;l[n++]=0);for(t=ho-1;r>s;){if(l[--r]<d[r]){for(n=r;n&&!l[--n];l[n]=t);--l[n],l[r]+=ho}l[r]-=d[r]}for(;0==l[0];l.splice(0,1),--u);return l[0]?C(e,l,u):(e.s=3==g?-1:1,e.c=[e.e=0],e)},f.modulo=f.mod=function(e,t){var r,o,i=this;return e=new T(e,t),!i.c||!e.s||e.c&&!e.c[0]?new T(NaN):!e.c||i.c&&!i.c[0]?new T(i):(9==b?(o=e.s,e.s=1,r=n(i,e,0,3),e.s=o,r.s*=o):r=n(i,e,0,b),(e=i.minus(r.times(e))).c[0]||1!=b||(e.s=i.s),e)},f.multipliedBy=f.times=function(e,t){var n,r,o,i,a,s,c,u,l,d,f,h,p,g,m,y=this,v=y.c,w=(e=new T(e,t)).c;if(!(v&&w&&v[0]&&w[0]))return!y.s||!e.s||v&&!v[0]&&!w||w&&!w[0]&&!v?e.c=e.e=e.s=null:(e.s*=y.s,v&&w?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=wo(y.e/po)+wo(e.e/po),e.s*=y.s,(c=v.length)<(d=w.length)&&(p=v,v=w,w=p,o=c,c=d,d=o),o=c+d,p=[];o--;p.push(0));for(g=ho,m=yo,o=d;--o>=0;){for(n=0,f=w[o]%m,h=w[o]/m|0,i=o+(a=c);i>o;)n=((u=f*(u=v[--a]%m)+(s=h*u+(l=v[a]/m|0)*f)%m*m+p[i]+n)/g|0)+(s/m|0)+h*l,p[i--]=u%g;p[i]=n}return n?++r:p.splice(0,1),C(e,p,r)},f.negated=function(){var e=new T(this);return e.s=-e.s||null,e},f.plus=function(e,t){var n,r=this,o=r.s;if(t=(e=new T(e,t)).s,!o||!t)return new T(NaN);if(o!=t)return e.s=-t,r.minus(e);var i=r.e/po,a=e.e/po,s=r.c,c=e.c;if(!i||!a){if(!s||!c)return new T(o/0);if(!s[0]||!c[0])return c[0]?e:new T(s[0]?r:0*o)}if(i=wo(i),a=wo(a),s=s.slice(),o=i-a){for(o>0?(a=i,n=c):(o=-o,n=s),n.reverse();o--;n.push(0));n.reverse()}for((o=s.length)-(t=c.length)<0&&(n=c,c=s,s=n,t=o),o=0;t;)o=(s[--t]=s[t]+c[t]+o)/ho|0,s[t]=ho===s[t]?0:s[t]%ho;return o&&(s=[o].concat(s),++a),C(e,s,a)},f.precision=f.sd=function(e,t){var n,r,o,i=this;if(null!=e&&e!==!!e)return So(e,1,vo),null==t?t=g:So(t,0,8),R(new T(i),e,t);if(!(n=i.c))return null;if(r=(o=n.length-1)*po+1,o=n[o]){for(;o%10==0;o/=10,r--);for(o=n[0];o>=10;o/=10,r++);}return e&&i.e+1>r&&(r=i.e+1),r},f.shiftedBy=function(e){return So(e,-9007199254740991,go),this.times("1e"+e)},f.squareRoot=f.sqrt=function(){var e,t,r,o,i,a=this,s=a.c,c=a.s,u=a.e,l=p+4,d=new T("0.5");if(1!==c||!s||!s[0])return new T(!c||c<0&&(!s||s[0])?NaN:s?a:1/0);if(0==(c=Math.sqrt(+P(a)))||c==1/0?(((t=Ao(s)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=wo((u+1)/2)-(u<0||u%2),r=new T(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):r=new T(c+""),r.c[0])for((c=(u=r.e)+l)<3&&(c=0);;)if(i=r,r=d.times(i.plus(n(a,i,l,1))),Ao(i.c).slice(0,c)===(t=Ao(r.c)).slice(0,c)){if(r.e<u&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(o||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(R(r,r.e+p+2,1),e=!r.times(r).eq(a));break}if(!o&&(R(i,i.e+p+2,0),i.times(i).eq(a))){r=i;break}l+=4,c+=4,o=1}return R(r,r.e+p+1,g,e)},f.toExponential=function(e,t){return null!=e&&(So(e,0,vo),e++),_(this,e,t,1)},f.toFixed=function(e,t){return null!=e&&(So(e,0,vo),e=e+this.e+1),_(this,e,t)},f.toFormat=function(e,t,n){var r,o=this;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=E;else if("object"!=typeof n)throw Error(lo+"Argument not an object: "+n);if(r=o.toFixed(e,t),o.c){var i,a=r.split("."),s=+n.groupSize,c=+n.secondaryGroupSize,u=n.groupSeparator||"",l=a[0],d=a[1],f=o.s<0,h=f?l.slice(1):l,p=h.length;if(c&&(i=s,s=c,c=i,p-=i),s>0&&p>0){for(i=p%s||s,l=h.substr(0,i);i<p;i+=s)l+=u+h.substr(i,s);c>0&&(l+=u+h.slice(i)),f&&(l="-"+l)}r=d?l+(n.decimalSeparator||"")+((c=+n.fractionGroupSize)?d.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):d):l}return(n.prefix||"")+r+(n.suffix||"")},f.toFraction=function(e){var t,r,o,i,a,s,c,u,l,d,f,p,m=this,y=m.c;if(null!=e&&(!(c=new T(e)).isInteger()&&(c.c||1!==c.s)||c.lt(h)))throw Error(lo+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+P(c));if(!y)return new T(m);for(t=new T(h),l=r=new T(h),o=u=new T(h),p=Ao(y),a=t.e=p.length-m.e-1,t.c[0]=mo[(s=a%po)<0?po+s:s],e=!e||c.comparedTo(t)>0?a>0?t:l:c,s=w,w=1/0,c=new T(p),u.c[0]=0;d=n(c,t,0,1),1!=(i=r.plus(d.times(o))).comparedTo(e);)r=o,o=i,l=u.plus(d.times(i=l)),u=i,t=c.minus(d.times(i=t)),c=i;return i=n(e.minus(r),o,0,1),u=u.plus(i.times(l)),r=r.plus(i.times(o)),u.s=l.s=m.s,f=n(l,o,a*=2,g).minus(m).abs().comparedTo(n(u,r,a,g).minus(m).abs())<1?[l,o]:[u,r],w=s,f},f.toNumber=function(){return+P(this)},f.toPrecision=function(e,t){return null!=e&&So(e,1,vo),_(this,e,t,2)},f.toString=function(e){var t,n=this,o=n.s,i=n.e;return null===i?o?(t="Infinity",o<0&&(t="-"+t)):t="NaN":(null==e?t=i<=m||i>=y?ko(Ao(n.c),i):Io(Ao(n.c),i,"0"):10===e&&I?t=Io(Ao((n=R(new T(n),p+i+1,g)).c),n.e,"0"):(So(e,2,k.length,"Base"),t=r(Io(Ao(n.c),i,"0"),10,e,o,!0)),o<0&&n.c[0]&&(t="-"+t)),t},f.valueOf=f.toJSON=function(){return P(this)},f._isBigNumber=!0,f[Symbol.toStringTag]="BigNumber",f[Symbol.for("nodejs.util.inspect.custom")]=f.valueOf,null!=t&&T.set(t),T}();const _o=To;function xo(e,t){return D(e,(e=>"string"==typeof e&&t.test(e)))}const Co=/^(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})$/u,Ro=/^[-a-z0-9]{3,8}$/u,Po=/^[-_a-zA-Z0-9]{1,32}$/u,No=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})):(?<accountAddress>[-.%a-zA-Z0-9]{1,128})$/u,Bo=/^[-.%a-zA-Z0-9]{1,128}$/u,Oo=/^[-a-z0-9]{3,8}$/u,Mo=/^[-.%a-zA-Z0-9]{1,128}$/u,zo=/^[-.%a-zA-Z0-9]{1,78}$/u,jo=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u,Uo=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u,Do=(xo("CaipChainId",Co),xo("CaipNamespace",Ro),xo("CaipReference",Po),xo("CaipAccountId",No),xo("CaipAccountAddress",Bo),xo("CaipAssetNamespace",Oo),xo("CaipAssetReference",Mo),xo("CaipTokenId",zo),xo("CaipAssetType",jo));xo("CaipAssetId",Uo),xo("CaipAssetTypeOrId",/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})(\/(?<tokenId>[-.%a-zA-Z0-9]{1,78}))?$/u);var Lo;function Fo(e){const t=jo.exec(e);if(!t?.groups)throw new Error("Invalid CAIP asset type.");return{assetNamespace:t.groups.assetNamespace,assetReference:t.groups.assetReference,chainId:t.groups.chainId,chain:{namespace:t.groups.namespace,reference:t.groups.reference}}}function $o(e,t){return n=e,Boolean("string"==typeof n?.prototype?.constructor?.name)?new e({message:t}):e({message:t});var n}!function(e){e.Bip122="bip122",e.Solana="solana",e.Eip155="eip155",e.Wallet="wallet"}(Lo=Lo||(Lo={}));class qo extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}function Wo(e,t="Assertion failed.",n=qo){if(!e){if(t instanceof Error)throw t;throw $o(n,t)}}var Vo=4,Ko=5,Go=6,Ho=10,Zo=-32700,Jo=-32603,Yo=-32602,Qo=-32601,Xo=-32600,ei=-32015,ti=-32014,ni=-32012,ri=-32010,oi=-32009,ii=-32007,ai=-32006,si=-32004,ci=-32002,ui=-32001,li=28e5,di=2800001,fi=2800003,hi=2800006,pi=2800007,gi=2800008,mi=2800009,yi=32300001,vi=3230004,wi=361e4,Ai=3610001,bi=3610003,Si=3610005,Ei=3610006,ki=3610007,Ii=3704001,Ti=3704002,_i=3704003,xi=4615e3,Ci=4615026,Ri=4615045,Pi=5508e3,Ni=5663e3,Bi=5663001,Oi=5663004,Mi=5663005,zi=5663006,ji=5663007,Ui=5663008,Di=5663009,Li=5663012,Fi=5663015,$i=5663016,qi=5663017,Wi=5663018,Vi=5663019,Ki=705e4,Gi=7050030,Hi=7050031,Zi=7050035,Ji=8078e3,Yi=8078001,Qi=8078002,Xi=8078004,ea=8078005,ta=8078006,na=8078007,ra=8078008,oa=8078010,ia=8078011,aa=8078012,sa=8078013,ca=8078014,ua=8078017,la=8078018,da=8078022,fa=81e5,ha=8100002,pa=8100003,ga=9900003;function ma(e){if(Array.isArray(e)){return"%5B"+e.map(ma).join("%2C%20")+"%5D"}return"bigint"==typeof e?`${e}n`:encodeURIComponent(String(null!=e&&null===Object.getPrototypeOf(e)?{...e}:e))}function ya([e,t]){return`${e}=${ma(t)}`}function va(e,t={}){{let n=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(n+=` '${function(e){const t=Object.entries(e).map(ya).join("&");return btoa(t)}(t)}'`),`${n}\``}}function wa(e,t){return!!(e instanceof Error&&"SolanaError"===e.name)&&(void 0===t||e.context.__code===t)}var Aa=class extends Error{cause=this.cause;context;constructor(...[e,t]){let n,r;if(t){const{cause:e,...o}=t;e&&(r={cause:e}),Object.keys(o).length>0&&(n=o)}super(va(e,n),r),this.context={__code:e,...n},this.name="SolanaError"}};function ba(...e){"captureStackTrace"in Error&&"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(...e)}function Sa({errorCodeBaseOffset:e,getErrorContext:t,orderedErrorNames:n,rpcEnumError:r},o){let i,a;"string"==typeof r?i=r:(i=Object.keys(r)[0],a=r[i]);const s=e+n.indexOf(i),c=t(s,i,a),u=new Aa(s,c);return ba(u,o),u}var Ea=["GenericError","InvalidArgument","InvalidInstructionData","InvalidAccountData","AccountDataTooSmall","InsufficientFunds","IncorrectProgramId","MissingRequiredSignature","AccountAlreadyInitialized","UninitializedAccount","UnbalancedInstruction","ModifiedProgramId","ExternalAccountLamportSpend","ExternalAccountDataModified","ReadonlyLamportChange","ReadonlyDataModified","DuplicateAccountIndex","ExecutableModified","RentEpochModified","NotEnoughAccountKeys","AccountDataSizeChanged","AccountNotExecutable","AccountBorrowFailed","AccountBorrowOutstanding","DuplicateAccountOutOfSync","Custom","InvalidError","ExecutableDataModified","ExecutableLamportChange","ExecutableAccountNotRentExempt","UnsupportedProgramId","CallDepth","MissingAccount","ReentrancyNotAllowed","MaxSeedLengthExceeded","InvalidSeeds","InvalidRealloc","ComputationalBudgetExceeded","PrivilegeEscalation","ProgramEnvironmentSetupFailure","ProgramFailedToComplete","ProgramFailedToCompile","Immutable","IncorrectAuthority","BorshIoError","AccountNotRentExempt","InvalidAccountOwner","ArithmeticOverflow","UnsupportedSysvar","IllegalOwner","MaxAccountsDataAllocationsExceeded","MaxAccountsExceeded","MaxInstructionTraceLengthExceeded","BuiltinProgramsMustConsumeComputeUnits"];function ka(e,t){const n=Number(e);return Sa({errorCodeBaseOffset:4615001,getErrorContext:(e,t,r)=>e===xi?{errorName:t,index:n,...void 0!==r?{instructionErrorContext:r}:null}:e===Ci?{code:Number(r),index:n}:e===Ri?{encodedData:r,index:n}:{index:n},orderedErrorNames:Ea,rpcEnumError:t},ka)}var Ia=["AccountInUse","AccountLoadedTwice","AccountNotFound","ProgramAccountNotFound","InsufficientFundsForFee","InvalidAccountForFee","AlreadyProcessed","BlockhashNotFound","CallChainTooDeep","MissingSignatureForFee","InvalidAccountIndex","SignatureFailure","InvalidProgramForExecution","SanitizeFailure","ClusterMaintenance","AccountBorrowOutstanding","WouldExceedMaxBlockCostLimit","UnsupportedVersion","InvalidWritableAccount","WouldExceedMaxAccountCostLimit","WouldExceedAccountDataBlockLimit","TooManyAccountLocks","AddressLookupTableNotFound","InvalidAddressLookupTableOwner","InvalidAddressLookupTableData","InvalidAddressLookupTableIndex","InvalidRentPayingAccount","WouldExceedMaxVoteCostLimit","WouldExceedAccountDataTotalLimit","DuplicateInstruction","InsufficientFundsForRent","MaxLoadedAccountsDataSizeExceeded","InvalidLoadedAccountsDataSizeLimit","ResanitizationNeeded","ProgramExecutionTemporarilyRestricted","UnbalancedTransaction"];function Ta(e){return"object"==typeof e&&"InstructionError"in e?ka(...e.InstructionError):Sa({errorCodeBaseOffset:7050001,getErrorContext:(e,t,n)=>e===Ki?{errorName:t,...void 0!==n?{transactionErrorContext:n}:null}:e===Gi?{index:Number(n)}:e===Hi||e===Zi?{accountIndex:Number(n.account_index)}:void 0,orderedErrorNames:Ia,rpcEnumError:e},Ta)}function _a(e){let t;if("object"==typeof(n=e)&&null!==n&&"code"in n&&"message"in n&&("number"==typeof n.code||"bigint"==typeof n.code)&&"string"==typeof n.message){const{code:n,data:r,message:o}=e,i=Number(n);if(i===ci){const{err:e,...n}=r,o=e?{cause:Ta(e)}:null;t=new Aa(ci,{...n,...o})}else{let e;switch(i){case Jo:case Yo:case Xo:case Qo:case Zo:case ni:case ui:case si:case ti:case ri:case oi:case ii:case ai:case ei:e={__serverMessage:o};break;default:"object"!=typeof r||Array.isArray(r)||(e=r)}t=new Aa(i,e)}}else{const n="object"==typeof e&&null!==e&&"message"in e&&"string"==typeof e.message?e.message:"Malformed JSON-RPC error with no message attribute";t=new Aa(Ho,{error:e,message:n})}var n;return ba(t,_a),t}var xa=(e,t)=>((e,t)=>{if(e.length>=t)return e;const n=new Uint8Array(t).fill(0);return n.set(e),n})(e.length<=t?e:e.slice(0,t),t);function Ca(e,t,n){const r=0===n&&e.length===t.length?e:e.slice(n,n+t.length);return r.length===t.length&&t.every(((e,t)=>e===r[t]))}function Ra(e,t){return"fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function Pa(e){return Object.freeze({...e,encode:t=>{const n=new Uint8Array(Ra(t,e));return e.write(t,n,0),n}})}function Na(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0]})}function Ba(e){return"fixedSize"in e&&"number"==typeof e.fixedSize}function Oa(e){if(!Ba(e))throw new Aa(Qi)}function Ma(e){return!Ba(e)}function za(e,t){if(Ba(e)!==Ba(t))throw new Aa(Xi);if(Ba(e)&&Ba(t)&&e.fixedSize!==t.fixedSize)throw new Aa(ea,{decoderFixedSize:t.fixedSize,encoderFixedSize:e.fixedSize});if(!Ba(e)&&!Ba(t)&&e.maxSize!==t.maxSize)throw new Aa(ta,{decoderMaxSize:t.maxSize,encoderMaxSize:e.maxSize});return{...t,...e,decode:t.decode,encode:e.encode,read:t.read,write:e.write}}function ja(e,t,n,r=0){const o=n.length-r;if(o<t)throw new Aa(Yi,{bytesLength:o,codecDescription:e,expected:t})}function Ua(e,t,n){if(t<0||t>n)throw new Aa(ca,{bytesLength:n,codecDescription:e,offset:t})}function Da(e,t){const n=(n,r,o)=>{const i=e.encode(n);return o=t.write(i.length,r,o),r.set(i,o),o+i.length};if(Ba(t)&&Ba(e))return Pa({...e,fixedSize:t.fixedSize+e.fixedSize,write:n});const r=Ba(t)?t.fixedSize:t.maxSize??null,o=Ba(e)?e.fixedSize:e.maxSize??null,i=null!==r&&null!==o?r+o:null;return Pa({...e,...null!==i?{maxSize:i}:{},getSizeFromValue:n=>{const r=Ra(n,e);return Ra(r,t)+r},write:n})}function La(e,t){const n=(n,r)=>{const[o,i]=t.read(n,r),a=Number(o);return((r=i)>0||n.length>a)&&(n=n.slice(r,r+a)),ja("addDecoderSizePrefix",a,n),[e.decode(n),r+a]};if(Ba(t)&&Ba(e))return Na({...e,fixedSize:t.fixedSize+e.fixedSize,read:n});const r=Ba(t)?t.fixedSize:t.maxSize??null,o=Ba(e)?e.fixedSize:e.maxSize??null,i=null!==r&&null!==o?r+o:null;return Na({...e,...null!==i?{maxSize:i}:{},read:n})}function Fa(e,t){return Pa({fixedSize:t,write:(n,r,o)=>{const i=e.encode(n),a=i.length>t?i.slice(0,t):i;return r.set(a,o),o+t}})}function $a(e,t){return Na({fixedSize:t,read:(n,r)=>{ja("fixCodecSize",t,n,r),(r>0||n.length>t)&&(n=n.slice(r,r+t)),Ba(e)&&(n=xa(n,e.fixedSize));const[o]=e.read(n,0);return[o,r+t]}})}function qa(e,t){return Na({...e,read:(n,r)=>{const o=e=>Wa(e,n.length),i=t.preOffset?t.preOffset({bytes:n,preOffset:r,wrapBytes:o}):r;Ua("offsetDecoder",i,n.length);const[a,s]=e.read(n,i),c=t.postOffset?t.postOffset({bytes:n,newPreOffset:i,postOffset:s,preOffset:r,wrapBytes:o}):s;return Ua("offsetDecoder",c,n.length),[a,c]}})}function Wa(e,t){return 0===t?0:(e%t+t)%t}function Va(e,t){if(Ba(e)){const n=t(e.fixedSize);if(n<0)throw new Aa(sa,{bytesLength:n,codecDescription:"resizeDecoder"});return Na({...e,fixedSize:n})}return e}function Ka(e,t){return qa(Va(e,(e=>e+t)),{postOffset:({postOffset:e})=>e+t})}function Ga(e,t){return Pa({...Ma(e)?{...e,getSizeFromValue:n=>e.getSizeFromValue(t(n))}:e,write:(n,r,o)=>e.write(t(n),r,o)})}function Ha(e,t){return Na({...e,read:(n,r)=>{const[o,i]=e.read(n,r);return[t(o,n,r),i]}})}function Za(e,t,n,r){if(r<t||r>n)throw new Aa(ia,{codecDescription:e,max:n,min:t,value:r})}var Ja,Ya=((Ja=Ya||{})[Ja.Little=0]="Little",Ja[Ja.Big=1]="Big",Ja);function Qa(e){return 1!==e?.endian}function Xa(e){return Pa({fixedSize:e.size,write(t,n,r){e.range&&Za(e.name,e.range[0],e.range[1],t);const o=new ArrayBuffer(e.size);return e.set(new DataView(o),t,Qa(e.config)),n.set(new Uint8Array(o),r),r+e.size}})}function es(e){return Na({fixedSize:e.size,read(t,n=0){!function(e,t,n=0){if(t.length-n<=0)throw new Aa(Ji,{codecDescription:e})}(e.name,t,n),ja(e.name,e.size,t,n);const r=new DataView(function(e,t,n){const r=e.byteOffset+(t??0),o=n??e.byteLength;return e.buffer.slice(r,r+o)}(t,n,e.size));return[e.get(r,Qa(e.config)),n+e.size]}})}var ts=(e={})=>es({config:e,get:(e,t)=>e.getFloat64(0,t),name:"f64",size:8}),ns=(e={})=>es({config:e,get:(e,t)=>e.getInt16(0,t),name:"i16",size:2}),rs=(e={})=>es({config:e,get:(e,t)=>e.getBigInt64(0,t),name:"i64",size:8}),os=()=>es({get:e=>e.getInt8(0),name:"i8",size:1}),is=()=>Pa({getSizeFromValue:e=>e<=127?1:e<=16383?2:3,maxSize:3,write:(e,t,n)=>{Za("shortU16",0,65535,e);const r=[0];for(let t=0;;t+=1){const n=Number(e)>>7*t;if(0===n)break;const o=127&n;r[t]=o,t>0&&(r[t-1]|=128)}return t.set(r,n),n+r.length}}),as=()=>Na({maxSize:3,read:(e,t)=>{let n=0,r=0;for(;++r;){const o=r-1,i=e[t+o];if(n|=(127&i)<<7*o,0==(128&i))break}return[n,t+r]}}),ss=(e={})=>es({config:e,get:(e,t)=>e.getUint16(0,t),name:"u16",size:2}),cs=(e={})=>Xa({config:e,name:"u32",range:[0,Number("0xffffffff")],set:(e,t,n)=>e.setUint32(0,Number(t),n),size:4}),us=(e={})=>es({config:e,get:(e,t)=>e.getUint32(0,t),name:"u32",size:4}),ls=(e={})=>Xa({config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,t,n)=>e.setBigUint64(0,BigInt(t),n),size:8}),ds=(e={})=>es({config:e,get:(e,t)=>e.getBigUint64(0,t),name:"u64",size:8}),fs=()=>Xa({name:"u8",range:[0,Number("0xff")],set:(e,t)=>e.setUint8(0,Number(t)),size:1}),hs=()=>es({get:e=>e.getUint8(0),name:"u8",size:1});var ps,gs=((ps=gs||{})[ps.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",ps[ps.READONLY_SIGNER=2]="READONLY_SIGNER",ps[ps.WRITABLE=1]="WRITABLE",ps[ps.READONLY=0]="READONLY",ps),ms=2,ys=1;function vs(e){return e>=2}function ws(e){return 0!=(e&ys)}function As(e,t){return e|t}function bs(e){return e|ms}function Ss(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new Aa(aa,{alphabet:e,base:e.length,value:n})}var Es=e=>Pa({getSizeFromValue:t=>{const[n,r]=Ts(t,e[0]);if(!r)return t.length;const o=_s(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(Ss(e,t),""===t)return r;const[o,i]=Ts(t,e[0]);if(!i)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let a=_s(i,e);const s=[];for(;a>0n;)s.unshift(Number(a%256n)),a/=256n;const c=[...Array(o.length).fill(0),...s];return n.set(c,r),r+c.length}}),ks=e=>Na({read(t,n){const r=0===n?t:t.slice(n);if(0===r.length)return["",0];let o=r.findIndex((e=>0!==e));o=-1===o?r.length:o;const i=e[0].repeat(o);if(o===r.length)return[i,t.length];const a=function(e,t){const n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}(r.slice(o).reduce(((e,t)=>256n*e+BigInt(t)),0n),e);return[i+a,t.length]}}),Is=e=>za(Es(e),ks(e));function Ts(e,t){const[n,r]=e.split(new RegExp(`((?!${t}).*)`));return[n,r]}function _s(e,t){const n=BigInt(t.length);let r=0n;for(const o of e)r*=n,r+=BigInt(t.indexOf(o));return r}var xs="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Cs=()=>Es(xs),Rs=()=>ks(xs),Ps=()=>Is(xs);var Ns,Bs,Os="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ms=()=>Pa({getSizeFromValue:e=>{try{return atob(e).length}catch{throw new Aa(aa,{alphabet:Os,base:64,value:e})}},write(e,t,n){try{const r=atob(e).split("").map((e=>e.charCodeAt(0)));return t.set(r,n),r.length+n}catch{throw new Aa(aa,{alphabet:Os,base:64,value:e})}}}),zs=()=>Na({read(e,t=0){const n=e.slice(t);return[btoa(String.fromCharCode(...n)),e.length]}}),js=()=>za(Ms(),zs()),Us=e=>e.replace(/\u0000/g,""),Ds=globalThis.TextDecoder,Ls=globalThis.TextEncoder,Fs=()=>{let e;return Na({read(t,n){const r=(e||=new Ds).decode(t.slice(n));return[Us(r),t.length]}})},$s=()=>za((()=>{let e;return Pa({getSizeFromValue:t=>(e||=new Ls).encode(t).length,write:(t,n,r)=>{const o=(e||=new Ls).encode(t);return n.set(o,r),r+o.length}})})(),Fs());function qs(){if(!globalThis.isSecureContext)throw new Aa(wi)}function Ws(){if(qs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.exportKey)throw new Aa(bi)}function Vs(){return Ns||(Ns=Cs()),Ns}function Ks(e){if(e.length<32||e.length>44)return!1;const t=Vs();try{return 32===t.encode(e).byteLength}catch{return!1}}function Gs(e){if(e.length<32||e.length>44)throw new Aa(di,{actualLength:e.length});const t=Vs().encode(e).byteLength;if(32!==t)throw new Aa(li,{actualLength:t})}function Hs(e){return Gs(e),e}function Zs(){return Ga(Fa(Vs(),32),(e=>Hs(e)))}function Js(){return $a((Bs||(Bs=Rs()),Bs),32)}function Ys(){return za(Zs(),Js())}function Qs(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}var Xs=37095705934669439343138083508754565189542113879843219016388785533085940283555n,ec=57896044618658097711785492504343953926634992332820282019728792003956564819949n,tc=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function nc(e){const t=e%ec;return t>=0n?t:ec+t}function rc(e,t){let n=e;for(;t-- >0n;)n*=n,n%=ec;return n}function oc(e,t){const n=nc(t*t*t),r=function(e){const t=e*e%ec*e%ec,n=rc(t,2n)*t%ec,r=rc(n,1n)*e%ec,o=rc(r,5n)*r%ec,i=rc(o,10n)*o%ec,a=rc(i,20n)*i%ec,s=rc(a,40n)*a%ec,c=rc(s,80n)*s%ec,u=rc(c,80n)*s%ec,l=rc(u,10n)*o%ec;return rc(l,2n)*e%ec}(e*nc(n*n*t));let o=nc(e*n*r);const i=nc(t*o*o),a=o,s=nc(o*tc),c=i===e,u=i===nc(-e),l=i===nc(-e*tc);return c&&(o=a),(u||l)&&(o=s),1n===(1n&nc(o))&&(o=nc(-o)),c||u?o:null}function ic(e){if(32!==e.byteLength)return!1;const t=function(e){const t=e.reduce(((e,t,n)=>`${function(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}(31===n?-129&t:t)}${e}`),"");return BigInt(`0x${t}`)}(e);return function(e,t){const n=nc(e*e),r=oc(nc(n-1n),nc(Xs*n+1n));return null!==r&&(0n!==r||!(0!=(128&t)))}(t,e[31])}var ac=32,sc=16,cc=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,100,114,101,115,115];async function uc({programAddress:e,seeds:t}){if(function(){if(qs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.digest)throw new Aa(Ai)}(),t.length>sc)throw new Aa(hi,{actual:t.length,maxSeeds:sc});let n;const r=t.reduce(((e,t,r)=>{const o="string"==typeof t?(n||=new TextEncoder).encode(t):t;if(o.byteLength>ac)throw new Aa(pi,{actual:o.byteLength,index:r,maxSeedLength:ac});return e.push(...o),e}),[]),o=Ys(),i=o.encode(e),a=await crypto.subtle.digest("SHA-256",new Uint8Array([...r,...i,...cc])),s=new Uint8Array(a);if(ic(s))throw new Aa(gi);return o.decode(s)}async function lc({programAddress:e,seeds:t}){let n=255;for(;n>0;)try{return[await uc({programAddress:e,seeds:[...t,new Uint8Array([n])]}),n]}catch(e){if(!wa(e,gi))throw e;n--}throw new Aa(mi)}async function dc(e){if(Ws(),"public"!==e.type||"Ed25519"!==e.algorithm.name)throw new Aa(fi);const t=await crypto.subtle.exportKey("raw",e);return Js().decode(new Uint8Array(t))}var fc,hc=Object.freeze({name:"Ed25519"});async function pc(e,t){const n=e.byteLength;if(32!==n)throw new Aa(Ii,{actualLength:n});const r=function(e){return new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32,...e])}(e);return await crypto.subtle.importKey("pkcs8",r,hc,t??!1,["sign"])}async function gc(e,t){!function(){if(qs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.sign)throw new Aa(Si)}();const n=await crypto.subtle.sign(hc,e,t);return new Uint8Array(n)}function mc(e){return function(e){if(fc||(fc=Cs()),e.length<64||e.length>88)throw new Aa(_i,{actualLength:e.length});const t=fc.encode(e).byteLength;if(64!==t)throw new Aa(Ti,{actualLength:t})}(e),e}async function yc(e,t,n){return function(){if(qs(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.verify)throw new Aa(Ei)}(),await crypto.subtle.verify(hc,e,t,n)}async function vc(e,t=!1){const n=pc(e,t),[r,o]=await Promise.all([(t?n:pc(e,!0)).then((async e=>await async function(e,t=!1){if(Ws(),!1===e.extractable)throw new Aa(ki,{key:e});const n=await crypto.subtle.exportKey("jwk",e);return await crypto.subtle.importKey("jwk",{crv:"Ed25519",ext:t,key_ops:["verify"],kty:"OKP",x:n.x},"Ed25519",t,["verify"])}(e,!0))),n]);return{privateKey:o,publicKey:r}}function wc(e,t,n){if(t!==n)throw new Aa(na,{actual:n,codecDescription:e,expected:t})}function Ac(e){return e.reduce(((e,t)=>null===e||null===t?null:e+t),0)}function bc(e){return Ba(e)?e.fixedSize:null}function Sc(e){return Ba(e)?e.fixedSize:e.maxSize??null}function Ec(e,t={}){const n=t.size??cs(),r=Ic(n,bc(e)),o=Ic(n,Sc(e))??void 0;return Pa({...null!==r?{fixedSize:r}:{getSizeFromValue:t=>("object"==typeof n?Ra(t.length,n):0)+[...t].reduce(((t,n)=>t+Ra(n,e)),0),maxSize:o},write:(t,r,o)=>("number"==typeof n&&wc("array",n,t.length),"object"==typeof n&&(o=n.write(t.length,r,o)),t.forEach((t=>{o=e.write(t,r,o)})),o)})}function kc(e,t={}){const n=t.size??us(),r=bc(e),o=Ic(n,r),i=Ic(n,Sc(e))??void 0;return Na({...null!==o?{fixedSize:o}:{maxSize:i},read:(t,r)=>{const o=[];if("object"==typeof n&&0===t.slice(r).length)return[o,r];if("remainder"===n){for(;r<t.length;){const[n,i]=e.read(t,r);r=i,o.push(n)}return[o,r]}const[i,a]="number"==typeof n?[n,r]:n.read(t,r);r=a;for(let n=0;n<i;n+=1){const[n,i]=e.read(t,r);r=i,o.push(n)}return[o,r]}})}function Ic(e,t){return"number"!=typeof e?null:0===e?0:null===t?null:t*e}function Tc(e={}){return Ga(e.size??fs(),(e=>e?1:0))}function _c(e={}){return Ha(e.size??hs(),(e=>1===Number(e)))}function xc(){return Pa({getSizeFromValue:e=>e.length,write:(e,t,n)=>(t.set(e,n),n+e.length)})}function Cc(){return Na({read:(e,t)=>{const n=e.slice(t);return[n,t+n.length]}})}var Rc=()=>Na({read(e,t){const n=e.slice(t).reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),"");return[n,e.length]}});function Pc(e){return Pa({fixedSize:e.length,write:(t,n,r)=>(n.set(e,r),r+e.length)})}function Nc(e){return Na({fixedSize:e.length,read:(t,n)=>{const r=Rc();if(!Ca(t,e,n))throw new Aa(la,{constant:e,data:t,hexConstant:r.decode(e),hexData:r.decode(t),offset:n});return[void 0,n+e.length]}})}function Bc(e){const t=Ac(e.map(bc)),n=Ac(e.map(Sc))??void 0;return Pa({...null===t?{getSizeFromValue:t=>e.map(((e,n)=>Ra(t[n],e))).reduce(((e,t)=>e+t),0),maxSize:n}:{fixedSize:t},write:(t,n,r)=>(wc("tuple",e.length,t.length),e.forEach(((e,o)=>{r=e.write(t[o],n,r)})),r)})}function Oc(e){const t=Ac(e.map(bc)),n=Ac(e.map(Sc))??void 0;return Na({...null===t?{maxSize:n}:{fixedSize:t},read:(t,n)=>{const r=[];return e.forEach((e=>{const[o,i]=e.read(t,n);r.push(o),n=i})),[r,n]}})}function Mc(e,t){const n=Uc(e),r=(n,r,o)=>{const i=t(n);return jc(e,i),e[i].write(n,r,o)};if(null!==n)return Pa({fixedSize:n,write:r});const o=Dc(e);return Pa({...null!==o?{maxSize:o}:{},getSizeFromValue:n=>{const r=t(n);return jc(e,r),Ra(n,e[r])},write:r})}function zc(e,t){const n=Uc(e),r=(n,r)=>{const o=t(n,r);return jc(e,o),e[o].read(n,r)};if(null!==n)return Na({fixedSize:n,read:r});const o=Dc(e);return Na({...null!==o?{maxSize:o}:{},read:r})}function jc(e,t){if(void 0===e[t])throw new Aa(ua,{maxRange:e.length-1,minRange:0,variant:t})}function Uc(e){if(0===e.length)return 0;if(!Ba(e[0]))return null;const t=e[0].fixedSize;return e.every((e=>Ba(e)&&e.fixedSize===t))?t:null}function Dc(e){return e.map((e=>Sc(e))).reduce(((e,t)=>null===e||null===t?null:Math.max(e,t)),0)}function Lc(e,t={}){const n=t.discriminator??"__kind",r=t.size??hs();return zc(e.map((([e,t])=>Ha(Oc([r,t]),(([,t])=>({[n]:e,...t}))))),((e,t)=>Number(r.read(e,t)[0])))}function Fc(e){const t=[...new Set(Object.values(e).filter((e=>"number"==typeof e)))].sort(),n=Object.fromEntries(Object.entries(e).slice(t.length)),r=Object.keys(n),o=Object.values(n),i=[...new Set([...r,...o.filter((e=>"string"==typeof e))])];return{enumKeys:r,enumRecord:n,enumValues:o,numericalValues:t,stringValues:i}}function $c(e,t){let n=e.length;for(;n--;)if(t(e[n],n,e))return n;return-1}function qc(e){if(0===e.length)return"";let t=[e[0],e[0]];const n=[];for(let r=1;r<e.length;r++){const o=e[r];t[1]+1===o?t[1]=o:(n.push(t[0]===t[1]?`${t[0]}`:`${t[0]}-${t[1]}`),t=[o,o])}return n.push(t[0]===t[1]?`${t[0]}`:`${t[0]}-${t[1]}`),n.join(", ")}function Wc(e,t={}){const n=t.size??fs(),r=t.useValuesAsDiscriminators??!1,{enumKeys:o,enumValues:i,numericalValues:a,stringValues:s}=Fc(e);if(r&&i.some((e=>"string"==typeof e)))throw new Aa(da,{stringValues:i.filter((e=>"string"==typeof e))});return Ga(n,(e=>{const t=function({enumKeys:e,enumValues:t,variant:n}){const r=$c(t,(e=>e===n));return r>=0?r:e.findIndex((e=>e===n))}({enumKeys:o,enumValues:i,variant:e});if(t<0)throw new Aa(oa,{formattedNumericalValues:qc(a),numericalValues:a,stringValues:s,variant:e});return r?i[t]:t}))}function Vc(e,t={}){const n=t.size??hs(),r=t.useValuesAsDiscriminators??!1,{enumKeys:o,enumValues:i,numericalValues:a}=Fc(e);if(r&&i.some((e=>"string"==typeof e)))throw new Aa(da,{stringValues:i.filter((e=>"string"==typeof e))});return Ha(n,(e=>{const t=Number(e),n=function({discriminator:e,enumKeys:t,enumValues:n,useValuesAsDiscriminators:r}){return r?$c(n,(t=>t===e)):e>=0&&e<t.length?e:-1}({discriminator:t,enumKeys:o,enumValues:i,useValuesAsDiscriminators:r});if(n<0){const e=r?a:[...Array(o.length).keys()];throw new Aa(ra,{discriminator:t,formattedValidDiscriminators:qc(e),validDiscriminators:e})}return i[n]}))}var Kc;function Gc(){return Pa({fixedSize:0,write:(e,t,n)=>n})}function Hc(){return Na({fixedSize:0,read:(e,t)=>[void 0,t]})}function Zc(e){const t=e.map((([,e])=>e)),n=Ac(t.map(bc)),r=Ac(t.map(Sc))??void 0;return Pa({...null===n?{getSizeFromValue:t=>e.map((([e,n])=>Ra(t[e],n))).reduce(((e,t)=>e+t),0),maxSize:r}:{fixedSize:n},write:(t,n,r)=>(e.forEach((([e,o])=>{r=o.write(t[e],n,r)})),r)})}function Jc(e){const t=e.map((([,e])=>e)),n=Ac(t.map(bc)),r=Ac(t.map(Sc))??void 0;return Na({...null===n?{maxSize:r}:{fixedSize:n},read:(t,n)=>{const r={};return e.forEach((([e,o])=>{const[i,a]=o.read(t,n);n=a,r[e]=i})),[r,n]}})}function Yc(){return Kc||(Kc=Cs()),Kc}function Qc(e){if(e.length<32||e.length>44)throw new Aa(Vo,{actualLength:e.length});const t=Yc().encode(e).byteLength;if(32!==t)throw new Aa(Ko,{actualLength:t})}function Xc(e){switch(e){case"finalized":return 2;case"confirmed":return 1;case"processed":return 0;default:throw new Aa(ga,{unexpectedValue:e})}}var eu=18446744073709551615n;function tu(e){return function(e){if(e<0||e>eu)throw new Aa(Go)}(e),e}function nu(e,...t){return t.reduce(((e,t)=>t(e)),e)}function ru(e){if(!("lifetimeConstraint"in e&&"string"==typeof e.lifetimeConstraint.blockhash&&"bigint"==typeof e.lifetimeConstraint.lastValidBlockHeight))return!1;try{return Qc(e.lifetimeConstraint.blockhash),!0}catch{return!1}}function ou(e,t){if("lifetimeConstraint"in t&&t.lifetimeConstraint.blockhash===e.blockhash&&t.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight)return t;const n={...t,lifetimeConstraint:Object.freeze(e)};return Object.freeze(n),n}var iu=e=>Pa({getSizeFromValue:t=>{const[n,r]=su(t,e[0]);if(!r)return t.length;const o=cu(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(function(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new Aa(aa,{alphabet:e,base:e.length,value:n})}(e,t),""===t)return r;const[o,i]=su(t,e[0]);if(!i)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let a=cu(i,e);const s=[];for(;a>0n;)s.unshift(Number(a%256n)),a/=256n;const c=[...Array(o.length).fill(0),...s];return n.set(c,r),r+c.length}}),au=e=>Na({read(t,n){const r=0===n?t:t.slice(n);if(0===r.length)return["",0];let o=r.findIndex((e=>0!==e));o=-1===o?r.length:o;const i=e[0].repeat(o);if(o===r.length)return[i,t.length];const a=function(e,t){const n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}(r.slice(o).reduce(((e,t)=>256n*e+BigInt(t)),0n),e);return[i+a,t.length]}});function su(e,t){const[n,r]=e.split(new RegExp(`((?!${t}).*)`));return[n,r]}function cu(e,t){const n=BigInt(t.length);let r=0n;for(const o of e)r*=n,r+=BigInt(t.indexOf(o));return r}var uu,lu,du,fu,hu,pu,gu="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",mu=()=>iu(gu),yu=()=>au(gu);function vu(){return du||(du=fs()),du}function wu(){return fu||(fu=hs()),fu}var Au=128;function bu(){return Pa({getSizeFromValue:e=>"legacy"===e?0:1,maxSize:1,write:(e,t,n)=>{if("legacy"===e)return n;if(e<0||e>127)throw new Aa(Oi,{actualVersion:e});return t.set([e|Au],n),n+1}})}function Su(){return Na({maxSize:1,read:(e,t)=>{const n=e[t];if(0==(n&Au))return["legacy",t];return[n^Au,t+1]}})}function Eu(){return Zc(Iu())}function ku(){return Ga(Zc([...Iu(),["addressTableLookups",Ec((uu||(uu=Zc([["lookupTableAddress",Zs()],["writableIndices",Ec(fs(),{size:is()})],["readableIndices",Ec(fs(),{size:is()})]])),uu),{size:is()})]]),(e=>"legacy"===e.version?e:{...e,addressTableLookups:e.addressTableLookups??[]}))}function Iu(){return[["version",bu()],["header",Zc([["numSignerAccounts",vu()],["numReadonlySignerAccounts",vu()],["numReadonlyNonSignerAccounts",vu()]])],["staticAccounts",Ec(Zs(),{size:is()})],["lifetimeToken",Fa(mu(),32)],["instructions",Ec((hu||(hu=Ga(Zc([["programAddressIndex",fs()],["accountIndices",Ec(fs(),{size:is()})],["data",Da(xc(),is())]]),(e=>void 0!==e.accountIndices&&void 0!==e.data?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)}))),hu),{size:is()})]]}function Tu(){return Pa({getSizeFromValue:e=>"legacy"===e.version?Eu().getSizeFromValue(e):ku().getSizeFromValue(e),write:(e,t,n)=>"legacy"===e.version?Eu().write(e,t,n):ku().write(e,t,n)})}function _u(){return Ha(Jc([["version",Su()],["header",Jc([["numSignerAccounts",wu()],["numReadonlySignerAccounts",wu()],["numReadonlyNonSignerAccounts",wu()]])],["staticAccounts",kc(Js(),{size:as()})],["lifetimeToken",$a(yu(),32)],["instructions",kc((pu||(pu=Ha(Jc([["programAddressIndex",hs()],["accountIndices",kc(hs(),{size:as()})],["data",La(Cc(),as())]]),(e=>{if(e.accountIndices.length&&e.data.byteLength)return e;const{accountIndices:t,data:n,...r}=e;return{...r,...t.length?{accountIndices:t}:null,...n.byteLength?{data:n}:null}}))),pu),{size:as()})],["addressTableLookups",kc((lu||(lu=Jc([["lookupTableAddress",Js()],["writableIndices",kc(hs(),{size:as()})],["readableIndices",kc(hs(),{size:as()})]])),lu),{size:as()})]]),(({addressTableLookups:e,...t})=>"legacy"!==t.version&&e?.length?{...t,addressTableLookups:e}:t))}function xu(e,t,n){e[t]=n(e[t]??{role:gs.READONLY})}var Cu=Symbol("AddressMapTypeProperty");function Ru(e){const t={};for(const n of e){if(!("lookupTableAddress"in n))continue;const e=t[n.lookupTableAddress]||={readableIndices:[],writableIndices:[]};n.role===gs.WRITABLE?e.writableIndices.push(n.addressIndex):e.readableIndices.push(n.addressIndex)}return Object.keys(t).sort(Qs()).map((e=>({lookupTableAddress:e,...t[e]})))}function Pu(e){let t=0,n=0,r=0;for(const o of e){if("lookupTableAddress"in o)break;const e=ws(o.role);vs(o.role)?(r++,e||n++):e||t++}return{numReadonlyNonSignerAccounts:t,numReadonlySignerAccounts:n,numSignerAccounts:r}}function Nu(e,t){const n=function(e){const t={};for(const[n,r]of e.entries())t[r.address]=n;return t}(t);return e.map((({accounts:e,data:t,programAddress:r})=>({programAddressIndex:n[r],...e?{accountIndices:e.map((({address:e})=>n[e]))}:null,...t?{data:t}:null})))}function Bu(e){const t=e.findIndex((e=>"lookupTableAddress"in e));return(-1===t?e:e.slice(0,t)).map((({address:e})=>e))}function Ou(e){const t=function(e){let t;const n=Object.entries(e).sort((([e,n],[r,o])=>{if(n[Cu]!==o[Cu]){if(0===n[Cu])return-1;if(0===o[Cu])return 1;if(2===n[Cu])return-1;if(2===o[Cu])return 1}const i=vs(n.role);if(i!==vs(o.role))return i?-1:1;const a=ws(n.role);return a!==ws(o.role)?a?-1:1:(t||=Qs(),1===n[Cu]&&1===o[Cu]&&n.lookupTableAddress!==o.lookupTableAddress?t(n.lookupTableAddress,o.lookupTableAddress):t(e,r))})).map((([e,t])=>({address:e,...t})));return n}(function(e,t){const n={[e]:{[Cu]:0,role:gs.WRITABLE_SIGNER}},r=new Set;for(const e of t){let t;if(xu(n,e.programAddress,(t=>{if(r.add(e.programAddress),Cu in t){if(ws(t.role)){if(0===t[Cu])throw new Aa(Ni,{programAddress:e.programAddress});throw new Aa(Bi,{programAddress:e.programAddress})}if(2===t[Cu])return t}return{[Cu]:2,role:gs.READONLY}})),e.accounts)for(const o of e.accounts)xu(n,o.address,(e=>{const{address:n,...i}=o;if(Cu in e)switch(e[Cu]){case 0:return e;case 1:{const n=As(e.role,i.role);if("lookupTableAddress"in i){if(e.lookupTableAddress!==i.lookupTableAddress&&(t||=Qs())(i.lookupTableAddress,e.lookupTableAddress)<0)return{[Cu]:1,...i,role:n}}else if(vs(i.role))return{[Cu]:2,role:n};return e.role!==n?{...e,role:n}:e}case 2:{const t=As(e.role,i.role);if(r.has(o.address)){if(ws(i.role))throw new Aa(Bi,{programAddress:o.address});return e.role!==t?{...e,role:t}:e}return"lookupTableAddress"in i&&!vs(e.role)?{...i,[Cu]:1,role:t}:e.role!==t?{...e,role:t}:e}}return"lookupTableAddress"in i?{...i,[Cu]:1}:{...i,[Cu]:2}}))}return n}(e.feePayer.address,e.instructions));return{..."legacy"!==e.version?{addressTableLookups:Ru(t)}:null,header:Pu(t),instructions:Nu(e.instructions,t),lifetimeToken:(n=e.lifetimeConstraint,"nonce"in n?n.nonce:n.blockhash),staticAccounts:Bu(t),version:e.version};var n}function Mu({version:e}){return Object.freeze({instructions:Object.freeze([]),version:e})}var zu,ju="SysvarRecentB1ockHashes11111111111111111111",Uu="11111111111111111111111111111111";function Du(e,t){return{accounts:[{address:e,role:gs.WRITABLE},{address:ju,role:gs.READONLY},{address:t,role:gs.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:Uu}}function Lu(e){return e.programAddress===Uu&&null!=e.data&&(4===(t=e.data).byteLength&&4===t[0]&&0===t[1]&&0===t[2]&&0===t[3])&&3===e.accounts?.length&&null!=e.accounts[0].address&&e.accounts[0].role===gs.WRITABLE&&e.accounts[1].address===ju&&e.accounts[1].role===gs.READONLY&&null!=e.accounts[2].address&&vs(e.accounts[2].role);var t}function Fu(e){return"lifetimeConstraint"in e&&"string"==typeof e.lifetimeConstraint.nonce&&null!=e.instructions[0]&&Lu(e.instructions[0])}function $u(e,t){if("feePayer"in t&&e===t.feePayer?.address&&function(e){return!!e&&"address"in e&&"string"==typeof e.address&&1===Object.keys(e).length}(t.feePayer))return t;const n={...t,feePayer:Object.freeze({address:e})};return Object.freeze(n),n}function qu(e,t){return Wu([e],t)}function Wu(e,t){return Object.freeze({...t,instructions:Object.freeze([...t.instructions,...e])})}function Vu(e,t){return Object.freeze({...t,instructions:Object.freeze([...e,...t.instructions])})}function Ku(e,t){const n=e.staticAccounts[0];if(!n)throw new Aa(Ui);const r=[...function(e){const{header:t}=e,n=t.numSignerAccounts-t.numReadonlySignerAccounts,r=e.staticAccounts.length-t.numSignerAccounts-t.numReadonlyNonSignerAccounts,o=[];let i=0;for(let t=0;t<n;t++)o.push({address:e.staticAccounts[i],role:gs.WRITABLE_SIGNER}),i++;for(let n=0;n<t.numReadonlySignerAccounts;n++)o.push({address:e.staticAccounts[i],role:gs.READONLY_SIGNER}),i++;for(let t=0;t<r;t++)o.push({address:e.staticAccounts[i],role:gs.WRITABLE}),i++;for(let n=0;n<t.numReadonlyNonSignerAccounts;n++)o.push({address:e.staticAccounts[i],role:gs.READONLY}),i++;return o}(e),..."addressTableLookups"in e&&void 0!==e.addressTableLookups&&e.addressTableLookups.length>0?function(e,t){const n=e.map((e=>e.lookupTableAddress)).filter((e=>void 0===t[e]));if(n.length>0)throw new Aa(Mi,{lookupTableAddresses:n});const r=[],o=[];for(const n of e){const e=t[n.lookupTableAddress],i=Math.max(...n.readableIndices,...n.writableIndices);if(i>=e.length)throw new Aa(zi,{highestKnownIndex:e.length-1,highestRequestedIndex:i,lookupTableAddress:n.lookupTableAddress});const a=n.readableIndices.map((t=>({address:e[t],addressIndex:t,lookupTableAddress:n.lookupTableAddress,role:gs.READONLY})));r.push(...a);const s=n.writableIndices.map((t=>({address:e[t],addressIndex:t,lookupTableAddress:n.lookupTableAddress,role:gs.WRITABLE})));o.push(...s)}return[...o,...r]}(e.addressTableLookups,t?.addressesByLookupTableAddress??{}):[]],o=e.instructions.map((e=>function(e,t){const n=t[e.programAddressIndex]?.address;if(!n)throw new Aa(ji,{index:e.programAddressIndex});const r=e.accountIndices?.map((e=>t[e])),{data:o}=e;return Object.freeze({programAddress:n,...r&&r.length?{accounts:Object.freeze(r)}:{},...o&&o.length?{data:o}:{}})}(e,r))),i=o[0],a=function(e,t,n){if(t&&Lu(t)){const n=t.accounts[0].address;Gs(n);const r=t.accounts[2].address;return Gs(r),{nonce:e,nonceAccountAddress:n,nonceAuthorityAddress:r}}return{blockhash:e,lastValidBlockHeight:n??2n**64n-1n}}(e.lifetimeToken,i,t?.lastValidBlockHeight);return nu(Mu({version:e.version}),(e=>$u(n,e)),(e=>o.reduce(((e,t)=>qu(t,e)),e)),(e=>"blockhash"in a?ou(a,e):function({nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:n},r){let o;const i=r.instructions[0];if(i&&Lu(i))if(function(e,t,n){return e.accounts[0].address===t&&e.accounts[2].address===n}(i,t,n)){if(Fu(r)&&r.lifetimeConstraint.nonce===e)return r;o=[i,...r.instructions.slice(1)]}else o=[Object.freeze(Du(t,n)),...r.instructions.slice(1)];else o=[Object.freeze(Du(t,n)),...r.instructions];return Object.freeze({...r,instructions:Object.freeze(o),lifetimeConstraint:Object.freeze({nonce:e})})}(a,e)))}function Gu(e){const t=Object.values(e);if(0===t.length)throw new Aa($i);return t.map((e=>e||new Uint8Array(64).fill(0)))}function Hu(){return Zc([["signatures",Ga(Ec(Fa(xc(),64),{size:is()}),Gu)],["messageBytes",xc()]])}function Zu(){return Ha(Jc([["signatures",kc($a(Cc(),64),{size:as()})],["messageBytes",Cc()]]),Ju)}function Ju(e){const{messageBytes:t,signatures:n}=e,r=Oc([Su(),Ka(hs(),2),kc(Js(),{size:as()})]),[o,i,a]=r.decode(t),s=a.slice(0,i);if(s.length!==n.length)throw new Aa(qi,{numRequiredSignatures:i,signaturesLength:n.length,signerAddresses:s});const c={};return s.forEach(((e,t)=>{const r=n[t];r.every((e=>0===e))?c[e]=null:c[e]=r})),{messageBytes:t,signatures:Object.freeze(c)}}function Yu(e){const t=Ou(e),n=Tu().encode(t),r=t.staticAccounts.slice(0,t.header.numSignerAccounts),o={};for(const e of r)o[e]=null;let i;i=ru(e)?{blockhash:e.lifetimeConstraint.blockhash,lastValidBlockHeight:e.lifetimeConstraint.lastValidBlockHeight}:{nonce:e.lifetimeConstraint.nonce,nonceAccountAddress:e.instructions[0].accounts[0].address};const a={lifetimeConstraint:i,messageBytes:n,signatures:Object.freeze(o)};return Object.freeze(a)}function Qu(e){zu||(zu=Rs());const t=Object.values(e.signatures)[0];if(!t)throw new Aa(Li);return zu.decode(t)}async function Xu(e,t){let n,r;if(await Promise.all(e.map((async e=>{const o=await dc(e.publicKey),i=t.signatures[o];if(void 0===i)return r||=new Set,void r.add(o);if(r)return;const a=await gc(e.privateKey,t.messageBytes);var s,c;null!==i&&(c=i,(s=a).length===c.length&&s.every(((e,t)=>e===c[t])))||(n||={},n[o]=a)}))),r&&r.size>0){const e=Object.keys(t.signatures);throw new Aa(Fi,{expectedAddresses:e,unexpectedAddresses:[...r]})}return n?Object.freeze({...t,signatures:Object.freeze({...t.signatures,...n})}):t}function el(e){const t=[];if(Object.entries(e.signatures).forEach((([e,n])=>{n||t.push(e)})),t.length>0)throw new Aa(Di,{addresses:t})}function tl(e){const t=Hu().encode(e);return zs().decode(t)}function nl(e){const t={};return e.forEach((e=>{if(t[e.address]){if(t[e.address]!==e)throw new Aa(Pi,{address:e.address})}else t[e.address]=e})),Object.values(t)}function rl(e){return"modifyAndSignTransactions"in e&&"function"==typeof e.modifyAndSignTransactions}function ol(e){return"signTransactions"in e&&"function"==typeof e.signTransactions}function il(e){return"signAndSendTransactions"in e&&"function"==typeof e.signAndSendTransactions}function al(e){return ol(e)||rl(e)||il(e)}function sl(e){return nl((e.accounts??[]).flatMap((e=>"signer"in e?e.signer:[])))}function cl(e){return nl([...e.feePayer&&al(e.feePayer)?[e.feePayer]:[],...e.instructions.flatMap(sl)])}function ul(e,t){const n=(r=t)&&"feePayer"in r&&r.feePayer&&"string"==typeof r.feePayer.address&&!al(r.feePayer)?e.find((e=>e.address===t.feePayer.address)):void 0;var r;return n||0!==t.instructions.length?Object.freeze({...t,...n?{feePayer:n}:null,instructions:t.instructions.map((t=>function(e,t){if(!t.accounts||0===t.accounts.length)return t;const n=new Map(nl(e).map((e=>[e.address,e])));return Object.freeze({...t,accounts:t.accounts.map((e=>{const t=n.get(e.address);return vs(e.role)&&!("signer"in e)&&t?Object.freeze({...e,signer:t}):e}))})}(e,t)))}):t}async function ll(e){const t=await dc(e.publicKey),n={address:t,keyPair:e,signMessages:n=>Promise.all(n.map((async n=>Object.freeze({[t]:await gc(e.privateKey,n.content)})))),signTransactions:n=>Promise.all(n.map((async n=>{const r=await Xu([e],n);return Object.freeze({[t]:r.signatures[t]})})))};return Object.freeze(n)}async function dl(e,t){return await ll(await vc(e,t))}function fl(e){const t={address:e,signMessages:e=>Promise.resolve(e.map((()=>Object.freeze({})))),signTransactions:e=>Promise.resolve(e.map((()=>Object.freeze({}))))};return Object.freeze(t)}async function hl(e,t){const{partialSigners:n,modifyingSigners:r}=pl(nl(cl(e).filter(al)),{identifySendingSigner:!1});return await gl(e,r,n,t)}function pl(e,t={}){const n=t.identifySendingSigner??!0?function(e){const t=e.filter(il);if(0===t.length)return null;const n=t.filter((e=>!rl(e)&&!ol(e)));if(n.length>0)return n[0];return t[0]}(e):null,r=e.filter((e=>e!==n&&(rl(e)||ol(e)))),o=function(e){const t=e.filter(rl);if(0===t.length)return[];const n=t.filter((e=>!ol(e)));return n.length>0?n:[t[0]]}(r),i=r.filter(ol).filter((e=>!o.includes(e)));return Object.freeze({modifyingSigners:o,partialSigners:i,sendingSigner:n})}async function gl(e,t=[],n=[],r){const o=Yu(e),i=await t.reduce((async(e,t)=>{r?.abortSignal?.throwIfAborted();const[n]=await t.modifyAndSignTransactions([await e],r);return Object.freeze(n)}),Promise.resolve(o));r?.abortSignal?.throwIfAborted();const a=await Promise.all(n.map((async e=>{const[t]=await e.signTransactions([i],r);return t}))),s={...i,signatures:Object.freeze(a.reduce(((e,t)=>({...e,...t})),i.signatures??{}))};return Object.freeze(s)}var ml=globalThis.TextEncoder;var yl,vl=((yl=vl||{})[yl.Uninitialized=0]="Uninitialized",yl[yl.Initialized=1]="Initialized",yl);var wl,Al=((wl=Al||{})[wl.Legacy=0]="Legacy",wl[wl.Current=1]="Current",wl);var bl,Sl,El="11111111111111111111111111111111",kl=((bl=kl||{})[bl.Nonce=0]="Nonce",bl),Il=((Sl=Il||{})[Sl.CreateAccount=0]="CreateAccount",Sl[Sl.Assign=1]="Assign",Sl[Sl.TransferSol=2]="TransferSol",Sl[Sl.CreateAccountWithSeed=3]="CreateAccountWithSeed",Sl[Sl.AdvanceNonceAccount=4]="AdvanceNonceAccount",Sl[Sl.WithdrawNonceAccount=5]="WithdrawNonceAccount",Sl[Sl.InitializeNonceAccount=6]="InitializeNonceAccount",Sl[Sl.AuthorizeNonceAccount=7]="AuthorizeNonceAccount",Sl[Sl.Allocate=8]="Allocate",Sl[Sl.AllocateWithSeed=9]="AllocateWithSeed",Sl[Sl.AssignWithSeed=10]="AssignWithSeed",Sl[Sl.TransferSolWithSeed=11]="TransferSolWithSeed",Sl[Sl.UpgradeNonceAccount=12]="UpgradeNonceAccount",Sl);function Tl(e){if(!e)throw new Error("Expected a Address.");return"object"==typeof e&&"address"in e?e.address:Array.isArray(e)?e[0]:e}function _l(e,t){return t=>{if(!t.value)return Object.freeze({address:e,role:gs.READONLY});const n=t.isWritable?gs.WRITABLE:gs.READONLY;return Object.freeze({address:Tl(t.value),role:xl(t.value)?bs(n):n,...xl(t.value)?{signer:t.value}:{}})}}function xl(e){return!!e&&"object"==typeof e&&"address"in e&&al(e)}function Cl(){return Jc([["discriminator",us()]])}function Rl(){return Jc([["discriminator",us()],["space",ds()]])}function Pl(){return Jc([["discriminator",us()],["base",Js()],["seed",La(Fs(),ds())],["space",ds()],["programAddress",Js()]])}function Nl(){return Jc([["discriminator",us()],["programAddress",Js()]])}function Bl(){return Jc([["discriminator",us()],["base",Js()],["seed",La(Fs(),ds())],["programAddress",Js()]])}function Ol(){return Jc([["discriminator",us()],["newNonceAuthority",Js()]])}function Ml(){return Jc([["discriminator",us()],["lamports",ds()],["space",ds()],["programAddress",Js()]])}function zl(){return Jc([["discriminator",us()],["base",Js()],["seed",La(Fs(),ds())],["amount",ds()],["space",ds()],["programAddress",Js()]])}function jl(){return Jc([["discriminator",us()],["nonceAuthority",Js()]])}var Ul=2;function Dl(){return Ga(Zc([["discriminator",cs()],["amount",ls()]]),(e=>({...e,discriminator:Ul})))}function Ll(){return Jc([["discriminator",us()],["amount",ds()]])}function Fl(){return Jc([["discriminator",us()],["amount",ds()],["fromSeed",La(Fs(),ds())],["fromOwner",Js()]])}function $l(){return Jc([["discriminator",us()]])}function ql(){return Jc([["discriminator",us()],["withdrawAmount",ds()]])}const Wl={log:(console.log,(...e)=>{}),info:(console.info,(...e)=>{}),warn:(console.warn,(...e)=>{}),debug:(console.debug,(...e)=>{}),error:(console.error,(...e)=>{})};const Vl={log:()=>{},info:()=>{},warn:()=>{},debug:()=>{},error:()=>{}},Kl=(e,t)=>new Proxy(e,{get(e,n){const r=e[n];return"function"==typeof r?(n,...o)=>r.call(e,t,n,...o):r}}),Gl=Wl;const Hl=(e,t)=>`${e}:${t.map((e=>JSON.stringify(e))).join(":")}`,Zl=(e,t,{ttlMilliseconds:n,functionName:r,generateCacheKey:o})=>{const i=o??Hl,a=r??e.name??"anonymousFunction";return async(...r)=>{const o=i(a,r);try{const e=await t.get(o);if(void 0!==e)return e}catch(e){Gl.error(`Cache get error for key "${o}":`,e)}const s=await e(...r);return t.set(o,s,n).catch((e=>{Gl.error(`Cache set error for key "${o}":`,e)})),s}},Jl=1000000n,Yl=1e9,Ql="metamask";var Xl=function(e){return e.Mainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",e.Devnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",e.Testnet="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",e.Localnet="solana:123456789abcdef",e}({}),ed=function(e){return e.SolMainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501",e.SolDevnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501",e.SolTestnet="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501",e.SolLocalnet="solana:123456789abcdef/slip44:501",e.UsdcMainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",e.UsdcDevnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",e.UsdcLocalnet="solana:123456789abcdef/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",e.EurcMainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr",e.EurcDevnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr",e.EurcLocalnet="solana:123456789abcdef/token:HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr",e.Ai16zMainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:HeLp6NuQkmYB4pYWo2zYs22mESHXPQYzXbB8n4V98jwC",e}({});ge(re(),/^solana:[a-zA-Z0-9]+\/slip44:501$/u);const td=ge(re(),/^solana:[a-zA-Z0-9]+\/token:[a-zA-Z0-9]+$/u),nd=(ge(re(),/^solana:[a-zA-Z0-9]+\/nft:[a-zA-Z0-9]+$/u),D("TokenCaipAssetTypeFromString",(e=>{if("string"!=typeof e)return"Expected a string, but received: "+typeof e;const[t]=td.validate(e);return t||!0})));var rd=function(e){return e.SOL="slip44:501",e}({});const od={"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501":{symbol:"SOL",caip19Id:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501",address:"So11111111111111111111111111111111111111112",decimals:9},"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501":{symbol:"SOL",caip19Id:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501",address:"So11111111111111111111111111111111111111112",decimals:9},"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501":{symbol:"SOL",caip19Id:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501",address:"So11111111111111111111111111111111111111112",decimals:9},"solana:123456789abcdef/slip44:501":{symbol:"SOL",caip19Id:"solana:123456789abcdef/slip44:501",address:"So11111111111111111111111111111111111111112",decimals:9},"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":{symbol:"USDC",caip19Id:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",decimals:6},"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU":{symbol:"USDC",caip19Id:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",address:"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",decimals:6},"solana:123456789abcdef/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":{symbol:"USDC",caip19Id:"solana:123456789abcdef/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",decimals:6}},id={"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":{caip2Id:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",cluster:"mainnet",name:"Solana Mainnet",nativeToken:od["solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501"]},"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1":{caip2Id:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",cluster:"devnet",name:"Solana Devnet",nativeToken:od["solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/slip44:501"]},"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":{caip2Id:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",cluster:"testnet",name:"Solana Testnet",nativeToken:od["solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z/slip44:501"]},"solana:123456789abcdef":{caip2Id:"solana:123456789abcdef",cluster:"local",name:"Solana Localnet",nativeToken:od["solana:123456789abcdef/slip44:501"]}},ad=ge(re(),/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u),sd=ge(re(),/^(?!0\d)(\d+(\.\d+)?)$/u),cd=me(re(),"safe-url",(e=>{try{const t=new URL(e),n=["http:","https:","wss:"];if(!n.includes(t.protocol))return`URL must use one of the following protocols: ${n}`;if(!e.match(/^(https?|wss):\/\/[^/]+\/?/u))return"Malformed URL - incorrect protocol format";const r=t.hostname.toLowerCase();if(!("localhost"===r||r.includes(".")&&/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/u.test(r)))return"Invalid hostname format";const o=decodeURIComponent(e.toLowerCase());if(e.includes("\\")||e.includes("@")||o.includes("\\")||o.includes("@")||e.toLowerCase().includes("%2f@")||e.toLowerCase().includes("%5c@"))return"URL contains protocol pollution attempts";const i=decodeURIComponent(r);if(r.includes("\\")||r.includes("@")||i.includes("/")||r.toLowerCase().includes("%2f"))return"Invalid hostname characters detected";if(e.includes("../")||e.includes("..%2f")||e.includes("..%2F"))return"Directory traversal attempts are not allowed";const a=[/<[^>]*>/u,/javascript:/u,/data:/u,/\\[@\\]/u,/%2f@/u,/[^\x20-\x7E]/u,/\$\{.*?\}/u,/#\{.*?\}/u,/[|;]/u,/%0[acd]|%0[acd]/u,/\/\/\w+@/u,/(?:[^a-z]|^)(?:union\s+(?:all\s+)?select|select\s+(?:.*\s+)?from|insert\s+into|update\s+.*\s+set|delete\s+from|drop\s+table|alter\s+table|create\s+table|exec(?:ute)?|union|where\s+[\d\w]\s*=\s*[\d\w]|\bor\b\s*[\d\w]\s*=\s*[\d\w])/iu,/'.*?(?:OR|UNION|SELECT|FROM|WHERE).*?'/iu,/%27.*?(?:OR|UNION|SELECT|FROM|WHERE).*?(?:%27|')/iu,/%20(?:OR|UNION|SELECT|FROM|WHERE)%20/iu,/[?&](?:url|redirect|next|return_to|return_url|goto|destination|continue|redirect_uri)=(?:[^&]*\/\/|https?:)/iu,/[?&](?:url|redirect|next|return_to|return_url|goto|destination|continue|redirect_uri)=%(?:[^&]*\/\/|https?:)/iu];for(const e of a)if(e.test(o))return"URL contains potentially malicious patterns";return!(t.port&&!/^\d+$/u.test(t.port))||"Invalid port number"}catch(e){return"Invalid URL format"}})),ud=ee({accountId:ad}),ld=ee({accountId:ad}),dd=ee({accountId:ad}),fd=ee({accountId:ad,assets:K(it)}),hd=ee({accountId:ad,pagination:ee({limit:Z(),next:te(Q(re()))})}),pd=ne(it,ee({amount:sd,unit:re()})),gd=(K(it),H(Object.values($t)),H(Object.values(Xl))),md=(H(["btc","eth","ltc","bch","bnb","eos","xrp","xlm","link","dot","yfi","usd","aed","ars","aud","bdt","bhd","bmd","brl","cad","chf","clp","cny","czk","dkk","eur","gbp","gel","hkd","huf","idr","ils","inr","jpy","krw","kwd","lkr","mmk","mxn","myr","ngn","nok","nzd","php","pkr","pln","rub","sar","sek","sgd","thb","try","twd","uah","vef","vnd","zar","xdr","xag","xau","bits","sats"]),ee({transaction:re(),scope:H(Object.values(Xl))})),yd=ee({value:Q(sd)}),vd=D("Base58",(e=>"string"!=typeof e?"Expected a string, but received: "+typeof e:!!/^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+$/u.test(e)||"Expected a Base58 encoded string, but received a string with invalid characters")),wd=ge(re(),/^(?:[A-Za-z0-9+/]{4})+(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u),Ad=ge(re(),/^m\/44'\/501'/u),bd=(ge(re(),/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/u),D("SolanaAddress",(e=>{if("string"!=typeof e)return"Expected a string, but received: "+typeof e;try{return Hs(e),!0}catch(e){return"Invalid Solana address"}})));function Sd(e){return e&&"string"==typeof e?e.replace(/[\u0000-\u0008\u000A-\u001F\u007F]/gu,""):""}function Ed(e,t=1e3){if(!e||"string"!=typeof e)return"";let n=Sd(e);return n.length>t&&(n=n.substring(0,t)),n=n.trim(),n}function kd(e){if(!e||"string"!=typeof e)return"";const t=Sd(e);return/^[1-9A-HJ-NP-Za-km-z]+$/u.test(t)?t.length<32||t.length>44?"":t:""}function Id(e){if(!e||"string"!=typeof e)return"";const t=Sd(e);try{const e=new URL(t);return["http:","https:","wss:","ipfs:"].includes(e.protocol)?t.length>2048?"":t:""}catch{return""}}function Td(e){const{baseUrl:t,path:n,pathParams:r,queryParams:o,encodePathParams:i=!0}=e,a=Id(t);if(""===a)throw new Error("Invalid URL format");M(a,cd);const s=n.replace(/\{(\w+)\}/gu,((e,t)=>{const n=r?.[t];if(void 0===n)throw new Error(`Path parameter ${t} is undefined`);const o=Sd(n);return i?encodeURIComponent(o):o})).replace(/^\/+/u,"").replace(/\/+/gu,"/").replace(/\/+$/u,""),c=new URL(s,a);Object.entries(o??{}).filter((([e,t])=>void 0!==t)).filter((([e,t])=>null!==t)).forEach((([e,t])=>{if(t){const n=Sd(t);c.searchParams.append(e,n)}}));const u=c.toString();return M(u,cd),u}var _d=n(5250);const xd=ae([H(["btc","eth","ltc","bch","bnb","eos","xrp","xlm","link","dot","yfi","bits","sats","sol","sei","sonic"]),H(["usd","aed","amd","ars","aud","bam","bdt","bhd","bmd","brl","cad","chf","clp","cny","cop","crc","czk","dkk","dop","eur","gbp","gel","gtq","hkd","hnl","huf","idr","ils","inr","jpy","kes","krw","kwd","lbp","lkr","mmk","mxn","myr","ngn","nok","nzd","pen","php","pkr","pln","ron","rub","sar","sek","sgd","svc","thb","try","twd","uah","vef","vnd","xdr","zar","zmw"]),H(["xag","xau"])]),Cd=ee({id:re(),price:he(X(),0),marketCap:te(Q(he(X(),0))),allTimeHigh:te(Q(he(X(),0))),allTimeLow:te(Q(he(X(),0))),totalVolume:te(Q(he(X(),0))),high1d:te(Q(he(X(),0))),low1d:te(Q(he(X(),0))),circulatingSupply:te(Q(he(X(),0))),dilutedMarketCap:te(Q(he(X(),0))),marketCapPercentChange1d:te(Q(X())),priceChange1d:te(Q(X())),pricePercentChange1h:te(Q(X())),pricePercentChange1d:te(Q(X())),pricePercentChange7d:te(Q(X())),pricePercentChange14d:te(Q(X())),pricePercentChange30d:te(Q(X())),pricePercentChange200d:te(Q(X())),pricePercentChange1y:te(Q(X())),bondingCurveProgressPercent:te(Q(X())),liquidity:te(Q(X())),totalSupply:te(Q(X())),holderCount:te(Q(X())),isMutable:te(Q(G()))}),Rd=ne(Do,Q(Cd)),Pd=xd,Nd=ee({assetType:Do,timePeriod:te(ge(re(),/^[1-9][0-9]*[dmy]$/u)),from:te(he(X(),0)),to:te(he(X(),0)),vsCurrency:te(Pd)}),Bd=ee({prices:K(oe([X(),X()])),marketCaps:K(oe([X(),X()])),totalVolumes:K(oe([X(),X()]))}),Od={prices:[],marketCaps:[],totalVolumes:[]};const Md=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let n=0;n<e.length;n++){const r=e.charAt(n),o=r.charCodeAt(0);if(255!==t[o])throw new TypeError(r+" is ambiguous");t[o]=n}const n=e.length,r=e.charAt(0),o=Math.log(n)/Math.log(256),i=Math.log(256)/Math.log(n);function a(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;let i=0,a=0,s=0;for(;e[i]===r;)a++,i++;const c=(e.length-i)*o+1>>>0,u=new Uint8Array(c);for(;e[i];){let r=t[e.charCodeAt(i)];if(255===r)return;let o=0;for(let e=c-1;(0!==r||o<s)&&-1!==e;e--,o++)r+=n*u[e]>>>0,u[e]=r%256>>>0,r=r/256>>>0;if(0!==r)throw new Error("Non-zero carry");s=o,i++}let l=c-s;for(;l!==c&&0===u[l];)l++;const d=new Uint8Array(a+(c-l));let f=a;for(;l!==c;)d[f++]=u[l++];return d}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";let o=0,a=0,s=0;const c=t.length;for(;s!==c&&0===t[s];)s++,o++;const u=(c-s)*i+1>>>0,l=new Uint8Array(u);for(;s!==c;){let e=t[s],r=0;for(let t=u-1;(0!==e||r<a)&&-1!==t;t--,r++)e+=256*l[t]>>>0,l[t]=e%n>>>0,e=e/n>>>0;if(0!==e)throw new Error("Non-zero carry");a=r,s++}let d=u-a;for(;d!==u&&0===l[d];)d++;let f=r.repeat(o);for(;d<u;++d)f+=e.charAt(l[d]);return f},decodeUnsafe:a,decode:function(e){const t=a(e);if(t)return t;throw new Error("Non-base"+n+" character")}}};const zd=Md("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var jd=n(1048).hp;const Ud={[Xl.Mainnet]:"mainnet",[Xl.Devnet]:"devnet",[Xl.Testnet]:"testnet",[Xl.Localnet]:"localnet"};const Dd=K(ee({decimals:Z(),assetId:nd,name:te(re()),symbol:te(re()),iconUrl:te(cd)}));class Ld{#o;#i;#a;#s;#c;static supportedNetworks=[Xl.Mainnet,Xl.Devnet];constructor(e,t=globalThis.fetch,n=Gl){this.#o=t,this.#i=n;const{tokenApi:r,staticApi:o}=e.get(),{baseUrl:i,chunkSize:a}=r;M(i,cd),this.#a=i,this.#s=a,this.#c=o.baseUrl}async#u(e){M(e,K(td));const t=Td({baseUrl:this.#a,path:"/v3/assets",queryParams:{assetIds:e.join(",")}}),n=await this.#o(t);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const r=await n.json();return M(r,Dd),r}async getTokenMetadataFromAddresses(e){try{M(e,K(Do));const t=e.filter((e=>{const{chainId:t}=Fo(e);return Ld.supportedNetworks.includes(t)}));t.length!==e.length&&this.#i.warn(`[TokenApiClient] Received some asset types on networks that the Token API doesn't support. They will be ignored. Supported networks: ${Ld.supportedNetworks.join(", ")}`);const n=[];for(let e=0;e<t.length;e+=this.#s)n.push(t.slice(e,e+this.#s));const r=await Promise.all(n.map((async e=>this.#u(e)))),o=new Map;return r.flat().forEach((e=>{const t=e?.symbol,n=e?.name??t,r=e?.decimals;t&&n?o.set(e.assetId,{name:n,symbol:t,fungible:!0,iconUrl:e?.iconUrl??Td({baseUrl:this.#c,path:"/api/v2/tokenIcons/assets/{assetId}.png",pathParams:{assetId:e.assetId.replace(/:/gu,"/")},encodePathParams:!1}),units:[{name:n,symbol:t,decimals:r}]}):this.#i.warn(`No metadata for ${e.assetId}`)})),Object.fromEntries(o)}catch(e){throw this.#i.error(e,"Error fetching token metadata"),e}}}const Fd=e=>_o(e.toString()).dividedBy(Yl),$d=e=>_o(e.toString()).multipliedBy(Yl).integerValue(_o.ROUND_DOWN);var qd=function(e){return e.SignAndSendTransactionWithoutConfirmation="signAndSendTransactionWithoutConfirmation",e.ConfirmSend="confirmSend",e.SignAndSendTransaction="signAndSendTransaction",e.ComputeFee="computeFee",e.OnAddressInput="onAddressInput",e.OnAmountInput="onAmountInput",e}({});class Wd extends TypeError{constructor(e,t){let n;const{message:r,explanation:o,...i}=e,{path:a}=e,s=0===a.length?r:`At path: ${a.join(".")} -- ${r}`;super(o??s),null!=o&&(this.cause=s),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function Vd(e){return"object"==typeof e&&null!==e}function Kd(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function Gd(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:o,branch:i}=t,{type:a}=n,{refinement:s,message:c=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${Kd(r)}\``}=e;return{value:r,type:a,refinement:s,key:o[o.length-1],path:o,branch:i,...e,message:c}}function*Hd(e,t,n,r){(function(e){return Vd(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const o of e){const e=Gd(o,t,n,r);e&&(yield e)}}function*Zd(e,t,n={}){const{path:r=[],branch:o=[e],coerce:i=!1,mask:a=!1}=n,s={path:r,branch:o};if(i&&(e=t.coercer(e,s),a&&"type"!==t.type&&Vd(t.schema)&&Vd(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let c="valid";for(const r of t.validator(e,s))r.explanation=n.message,c="not_valid",yield[r,void 0];for(let[u,l,d]of t.entries(e,s)){const t=Zd(l,d,{path:void 0===u?r:[...r,u],branch:void 0===u?o:[...o,l],coerce:i,mask:a,message:n.message});for(const n of t)n[0]?(c=null===n[0].refinement||void 0===n[0].refinement?"not_valid":"not_refined",yield[n[0],void 0]):i&&(l=n[1],void 0===u?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):Vd(e)&&(void 0!==l||u in e)&&(e[u]=l))}if("not_valid"!==c)for(const r of t.refiner(e,s))r.explanation=n.message,c="not_refined",yield[r,void 0];"valid"===c&&(yield[void 0,e])}class Jd{constructor(e){const{type:t,schema:n,validator:r,refiner:o,coercer:i=(e=>e),entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=i,this.validator=r?(e,t)=>Hd(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>Hd(o(e,t),t,this,e):()=>[]}assert(e,t){return function(e,t,n){const r=Xd(e,t,{message:n});if(r[0])throw r[0]}(e,this,t)}create(e,t){return function(e,t,n){const r=Xd(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}is(e){return function(e,t){const n=Xd(e,t);return!n[0]}(e,this)}mask(e,t){return function(e,t,n){const r=Xd(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return Xd(e,this,t)}}const Yd="EXACT_OPTIONAL";class Qd extends Jd{constructor(e){super({...e,type:`exact optional ${e.type}`}),this.brand=Yd}static isExactOptional(e){return Vd(e)&&"brand"in e&&e.brand===Yd}}function Xd(e,t,n={}){const r=Zd(e,t,n),o=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(o[0]){return[new Wd(o[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]}return[void 0,o[1]]}function ef(){return of("never",(()=>!1))}function tf(e){const t=e?Object.keys(e):[],n=ef();return new Jd({type:"object",schema:e??null,*entries(r){if(e&&Vd(r)){const o=new Set(Object.keys(r));for(const n of t){o.delete(n);const t=e[n];Qd.isExactOptional(t)&&!Object.prototype.hasOwnProperty.call(r,n)||(yield[n,r[n],e[n]])}for(const e of o)yield[e,r[e],n]}},validator:e=>Vd(e)||`Expected an object, but received: ${Kd(e)}`,coercer:e=>Vd(e)?{...e}:e})}function nf(){return of("string",(e=>"string"==typeof e||`Expected a string, but received: ${Kd(e)}`))}function rf(...e){const t="type"===e[0]?.type,n=e.map((({schema:e})=>e)),r=Object.assign({},...n);return t?function(e){const t=Object.keys(e);return new Jd({type:"type",schema:e,*entries(n){if(Vd(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>Vd(e)||`Expected an object, but received: ${Kd(e)}`,coercer:e=>Vd(e)?{...e}:e})}(r):tf(r)}function of(e,t){return new Jd({type:e,schema:null,validator:t})}function af(e){return of(JSON.stringify(e),function(e){const t=Kd(e),n=typeof e;return new Jd({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${Kd(n)}`})}(e).validator)}function sf(e){return null==e}const cf=(e,t)=>Object.hasOwnProperty.call(e,t);var uf;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(uf=uf||(uf={}));const lf=e=>ee(e);function df({path:e,branch:t}){const n=e[e.length-1];return cf(t[t.length-2],n)}function ff(e){return new O({...e,type:`optional ${e.type}`,validator:(t,n)=>!df(n)||e.validator(t,n),refiner:(t,n)=>!df(n)||e.refiner(t,n)})}function hf(e){if(null===e||"boolean"==typeof e||"string"==typeof e)return!0;if("number"==typeof e&&Number.isFinite(e))return!0;if("object"==typeof e){let t=!0;if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(!hf(e[n])){t=!1;break}return t}const n=Object.entries(e);for(let e=0;e<n.length;e++)if("string"!=typeof n[e][0]||!hf(n[e][1])){t=!1;break}return t}return!1}const pf=D("JSON",(e=>hf(e))),gf=de(pf,me(V(),"JSON",(e=>j(e,pf))),(e=>JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))));const mf=J("2.0"),yf=Q(ae([X(),re()])),vf=lf({code:Z(),message:re(),data:ff(gf),stack:ff(re())}),wf=ae([ne(re(),gf),K(gf)]);lf({id:yf,jsonrpc:mf,method:re(),params:ff(wf)}),lf({jsonrpc:mf,method:re(),params:ff(wf)});ee({id:yf,jsonrpc:mf,result:te(se()),error:te(vf)});const Af=lf({id:yf,jsonrpc:mf,result:gf}),bf=lf({id:yf,jsonrpc:mf,error:vf});ae([Af,bf]);function Sf(e){return j(e,bf)}var Ef=function(e){return e.Required="Required",e.Invalid="Invalid",e.InsufficientBalanceToCoverFee="InsufficientBalanceToCoverFee",e.InsufficientBalance="InsufficientBalance",e}({});const kf=H(Object.values(Xl)),If=ie({address:de(re(),re(),(e=>{if(!e||""===e)throw new Error("Account address is required");const t=kd(e);if(""===t)throw new Error("Invalid Solana address format");return t}))}),Tf=J("ed25519"),_f=de(re(),re(),(e=>{const t=function(e){if(!e||"string"!=typeof e)return"";let t=Sd(e);const n=t.match(/^([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)+)/u);return n?.[1]&&(t=n[1]),/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)+$/u.test(t)?t.length>253?"":t.toLowerCase():""}(e);if(""===t)throw new Error("Invalid domain format");return t})),xf=de(re(),re(),(e=>{const t=kd(e);if(""===t)throw new Error("Invalid Solana address format");return t})),Cf=de(re(),re(),(e=>{const t=Ed(e,1e3);if(""===t)throw new Error("Statement cannot be empty. Control characters and excessive whitespace are removed for security. Please use plain text only.");return t})),Rf=de(re(),re(),(e=>Id(e))),Pf=de(re(),re(),(e=>Ed(e,10))),Nf=de(re(),re(),(e=>Ed(e,50))),Bf=de(re(),re(),(e=>Ed(e,100))),Of=de(re(),re(),(e=>function(e){if(!e||"string"!=typeof e)return"";const t=Sd(e);if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/u.test(t))return"";const n=new Date(t);return isNaN(n.getTime())?"":t}(e))),Mf=de(re(),re(),(e=>Ed(e,100))),zf=de(K(re()),K(re()),(e=>{var t;return t=e,Array.isArray(t)?t.filter((e=>"string"==typeof e)).map((e=>Id(e))).filter((e=>""!==e)):[]})),jf=ie({domain:te(_f),address:te(xf),statement:te(Cf),uri:te(Rf),version:te(Pf),chainId:te(Nf),nonce:te(Bf),issuedAt:te(Of),expirationTime:te(Of),notBefore:te(Of),requestId:te(Mf),resources:te(zf)}),Uf=ie({account:If,message:wd}),Df=H(["processed","confirmed","finalized"]),Lf=ie({preflightCommitment:te(Df),minContextSlot:te(X())}),Ff=ie({account:If,transaction:wd,scope:kf,options:te(Lf)}),$f=ie({...Lf.schema,commitment:te(Df),skipPreflight:te(G()),maxRetries:te(X())}),qf=ie({...Ff.schema,scope:kf,options:te($f)}),Wf=ee({method:H([$t.SignAndSendTransaction]),params:qf}),Vf=ee({method:H([$t.SignIn]),params:jf}),Kf=ee({method:H([$t.SignMessage]),params:Uf}),Gf=ee({method:H([$t.SignTransaction]),params:Ff}),Hf=ee({signature:vd}),Zf=ee({signedTransaction:wd}),Jf=ee({signature:vd,signedMessage:wd,signatureType:Tf}),Yf=ee({account:If,...Jf.schema}),Qf=ae([Wf,Vf,Kf,Gf]),Xf=ee({jsonrpc:mf,id:yf,method:af(qd.SignAndSendTransactionWithoutConfirmation),params:qf}),eh=ee({transaction:wd,accountId:ad,scope:kf,options:te($f)}),th=ee({jsonrpc:mf,id:yf,method:af(qd.SignAndSendTransaction),params:eh}),nh=ee({transactionId:vd}),rh=ee({fromAccountId:ad,toAddress:bd,amount:sd,assetId:Do}),oh=ee({jsonrpc:mf,id:yf,method:af(qd.ConfirmSend),params:rh}),ih=ee({value:re()}),ah=ee({jsonrpc:mf,id:yf,method:af(qd.OnAddressInput),params:ih}),sh=ee({value:sd,accountId:ad,assetId:Do}),ch=ee({jsonrpc:mf,id:yf,method:af(qd.OnAmountInput),params:sh}),uh=ee({valid:G(),errors:K(ee({code:H(Object.values(Ef))}))}),lh=ee({transaction:wd,accountId:ad,scope:kf}),dh=ee({jsonrpc:mf,id:yf,method:af(qd.ComputeFee),params:lh}),fh=K(ee({type:H(Object.values(kt)),asset:mt}));var hh,ph="ComputeBudget111111111111111111111111111111",gh=((hh=gh||{})[hh.RequestUnits=0]="RequestUnits",hh[hh.RequestHeapFrame=1]="RequestHeapFrame",hh[hh.SetComputeUnitLimit=2]="SetComputeUnitLimit",hh[hh.SetComputeUnitPrice=3]="SetComputeUnitPrice",hh[hh.SetLoadedAccountsDataSizeLimit=4]="SetLoadedAccountsDataSizeLimit",hh);function mh(e){const t="data"in e?e.data:e;if(Ca(t,fs().encode(0),0))return 0;if(Ca(t,fs().encode(1),0))return 1;if(Ca(t,fs().encode(2),0))return 2;if(Ca(t,fs().encode(3),0))return 3;if(Ca(t,fs().encode(4),0))return 4;throw new Error("The provided instruction could not be identified as a computeBudget instruction.")}function yh(){return Jc([["discriminator",hs()],["bytes",us()]])}function vh(){return Jc([["discriminator",hs()],["units",us()],["additionalFee",us()]])}var wh=2;function Ah(){return Ga(Zc([["discriminator",fs()],["units",cs()]]),(e=>({...e,discriminator:wh})))}function bh(){return Jc([["discriminator",hs()],["units",us()]])}function Sh(e,t){const n={...e};return{programAddress:t?.programAddress??ph,data:Ah().encode(n)}}var Eh=3;function kh(){return Ga(Zc([["discriminator",fs()],["microLamports",ls()]]),(e=>({...e,discriminator:Eh})))}function Ih(){return Jc([["discriminator",hs()],["microLamports",ds()]])}function Th(e,t){const n={...e};return{programAddress:t?.programAddress??ph,data:kh().encode(n)}}function _h(){return Jc([["discriminator",hs()],["accountDataSizeLimit",us()]])}var xh=e=>({__option:"Some",value:e}),Ch=()=>({__option:"None"}),Rh=e=>!!(e&&"object"==typeof e&&"__option"in e&&("Some"===e.__option&&"value"in e||"None"===e.__option)),Ph=e=>"Some"===e.__option;var Nh=e=>null!==e?xh(e):Ch();function Bh(e,t={}){const n=null===t.prefix?Ga(Gc(),(e=>{})):Tc({size:t.prefix??fs()});return Mc([Ga(Bc([n,"zeroes"===t.noneValue?(Oa(e),Fa(Gc(),e.fixedSize)):t.noneValue?Pc(t.noneValue):Gc()]),(e=>[!1,void 0])),Ga(Bc([n,e]),(e=>[!0,Rh(e)&&Ph(e)?e.value:e]))],(e=>{const t=Rh(e)?e:Nh(e);return Number(Ph(t))}))}function Oh(e,t={}){const n=null===t.prefix?Ha(Hc(),(()=>!1)):_c({size:t.prefix??hs()}),r="zeroes"===t.noneValue?(Oa(e),$a(Hc(),e.fixedSize)):t.noneValue?Nc(t.noneValue):Hc();return zc([Ha(Oc([n,r]),(()=>Ch())),Ha(Oc([n,e]),(([,e])=>xh(e)))],((e,o)=>{if(null===t.prefix&&!t.noneValue)return Number(o<e.length);if(null===t.prefix&&null!=t.noneValue){return Ca(e,"zeroes"===t.noneValue?new Uint8Array(r.fixedSize).fill(0):t.noneValue,o)?0:1}return Number(n.read(e,o)[0])}))}var Mh,zh=((Mh=zh||{})[Mh.Uninitialized=0]="Uninitialized",Mh[Mh.Initialized=1]="Initialized",Mh[Mh.Frozen=2]="Frozen",Mh);var jh,Uh=((jh=Uh||{})[jh.MintTokens=0]="MintTokens",jh[jh.FreezeAccount=1]="FreezeAccount",jh[jh.AccountOwner=2]="AccountOwner",jh[jh.CloseAccount=3]="CloseAccount",jh);function Dh(){return Vc(Uh)}var Lh,Fh="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",$h=((Lh=$h||{})[Lh.CreateAssociatedToken=0]="CreateAssociatedToken",Lh[Lh.CreateAssociatedTokenIdempotent=1]="CreateAssociatedTokenIdempotent",Lh[Lh.RecoverNestedAssociatedToken=2]="RecoverNestedAssociatedToken",Lh);var qh,Wh="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",Vh=((qh=Vh||{})[qh.Mint=0]="Mint",qh[qh.Token=1]="Token",qh[qh.Multisig=2]="Multisig",qh);var Kh,Gh=((Kh=Gh||{})[Kh.InitializeMint=0]="InitializeMint",Kh[Kh.InitializeAccount=1]="InitializeAccount",Kh[Kh.InitializeMultisig=2]="InitializeMultisig",Kh[Kh.Transfer=3]="Transfer",Kh[Kh.Approve=4]="Approve",Kh[Kh.Revoke=5]="Revoke",Kh[Kh.SetAuthority=6]="SetAuthority",Kh[Kh.MintTo=7]="MintTo",Kh[Kh.Burn=8]="Burn",Kh[Kh.CloseAccount=9]="CloseAccount",Kh[Kh.FreezeAccount=10]="FreezeAccount",Kh[Kh.ThawAccount=11]="ThawAccount",Kh[Kh.TransferChecked=12]="TransferChecked",Kh[Kh.ApproveChecked=13]="ApproveChecked",Kh[Kh.MintToChecked=14]="MintToChecked",Kh[Kh.BurnChecked=15]="BurnChecked",Kh[Kh.InitializeAccount2=16]="InitializeAccount2",Kh[Kh.SyncNative=17]="SyncNative",Kh[Kh.InitializeAccount3=18]="InitializeAccount3",Kh[Kh.InitializeMultisig2=19]="InitializeMultisig2",Kh[Kh.InitializeMint2=20]="InitializeMint2",Kh[Kh.GetAccountDataSize=21]="GetAccountDataSize",Kh[Kh.InitializeImmutableOwner=22]="InitializeImmutableOwner",Kh[Kh.AmountToUiAmount=23]="AmountToUiAmount",Kh[Kh.UiAmountToAmount=24]="UiAmountToAmount",Kh);function Hh(e){if(!e)throw new Error("Expected a Address.");return"object"==typeof e&&"address"in e?e.address:Array.isArray(e)?e[0]:e}function Zh(e,t){return t=>{if(!t.value)return Object.freeze({address:e,role:gs.READONLY});const n=t.isWritable?gs.WRITABLE:gs.READONLY;return Object.freeze({address:Hh(t.value),role:Jh(t.value)?bs(n):n,...Jh(t.value)?{signer:t.value}:{}})}}function Jh(e){return!!e&&"object"==typeof e&&"address"in e&&al(e)}function Yh(){return Jc([["discriminator",hs()],["amount",ds()]])}function Qh(){return Jc([["discriminator",hs()],["amount",ds()]])}function Xh(){return Jc([["discriminator",hs()],["amount",ds()],["decimals",hs()]])}function ep(){return Jc([["discriminator",hs()],["amount",ds()]])}function tp(){return Jc([["discriminator",hs()],["amount",ds()],["decimals",hs()]])}function np(){return Jc([["discriminator",hs()]])}async function rp(e,t={}){const{programAddress:n="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"}=t;return await lc({programAddress:n,seeds:[Zs().encode(e.owner),Zs().encode(e.tokenProgram),Zs().encode(e.mint)]})}var op=1;function ip(){return Ga(Zc([["discriminator",fs()]]),(e=>({...e,discriminator:op})))}function ap(e,t){const n=t?.programAddress??Fh,r={payer:{value:e.payer??null,isWritable:!0},ata:{value:e.ata??null,isWritable:!0},owner:{value:e.owner??null,isWritable:!1},mint:{value:e.mint??null,isWritable:!1},systemProgram:{value:e.systemProgram??null,isWritable:!1},tokenProgram:{value:e.tokenProgram??null,isWritable:!1}};r.tokenProgram.value||(r.tokenProgram.value="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),r.systemProgram.value||(r.systemProgram.value="11111111111111111111111111111111");const o=Zh(n);return{accounts:[o(r.payer),o(r.ata),o(r.owner),o(r.mint),o(r.systemProgram),o(r.tokenProgram)],programAddress:n,data:ip().encode({})}}function sp(){return Jc([["discriminator",hs()]])}function cp(){return Jc([["discriminator",hs()]])}function up(){return Jc([["discriminator",hs()]])}function lp(){return Jc([["discriminator",hs()],["owner",Js()]])}function dp(){return Jc([["discriminator",hs()],["owner",Js()]])}function fp(){return Jc([["discriminator",hs()]])}function hp(){return Jc([["discriminator",hs()],["decimals",hs()],["mintAuthority",Js()],["freezeAuthority",Oh(Js())]])}function pp(){return Jc([["discriminator",hs()],["decimals",hs()],["mintAuthority",Js()],["freezeAuthority",Oh(Js())]])}function gp(){return Jc([["discriminator",hs()],["m",hs()]])}function mp(){return Jc([["discriminator",hs()],["m",hs()]])}function yp(){return Jc([["discriminator",hs()],["amount",ds()]])}function vp(){return Jc([["discriminator",hs()],["amount",ds()],["decimals",hs()]])}function wp(){return Jc([["discriminator",hs()]])}function Ap(){return Jc([["discriminator",hs()],["authorityType",Dh()],["newAuthority",Oh(Js())]])}function bp(){return Jc([["discriminator",hs()]])}function Sp(){return Jc([["discriminator",hs()]])}function Ep(){return Jc([["discriminator",hs()],["amount",ds()]])}var kp=12;function Ip(){return Ga(Zc([["discriminator",fs()],["amount",ls()],["decimals",fs()]]),(e=>({...e,discriminator:kp})))}function Tp(){return Jc([["discriminator",hs()],["amount",ds()],["decimals",hs()]])}function _p(e,t){const n=t?.programAddress??Wh,r={source:{value:e.source??null,isWritable:!0},mint:{value:e.mint??null,isWritable:!1},destination:{value:e.destination??null,isWritable:!0},authority:{value:e.authority??null,isWritable:!1}},o={...e},i=(o.multiSigners??[]).map((e=>({address:e.address,role:gs.READONLY_SIGNER,signer:e}))),a=Zh(n);return{accounts:[a(r.source),a(r.mint),a(r.destination),a(r.authority),...i],programAddress:n,data:Ip().encode(o)}}function xp(){return Jc([["discriminator",hs()],["uiAmount",Fs()]])}var Cp=(e=>(e[e.Uninitialized=0]="Uninitialized",e[e.Initialized=1]="Initialized",e[e.Frozen=2]="Frozen",e))(Cp||{});function Rp(){return Vc(Cp)}var Pp=(e=>(e[e.MintTokens=0]="MintTokens",e[e.FreezeAccount=1]="FreezeAccount",e[e.AccountOwner=2]="AccountOwner",e[e.CloseAccount=3]="CloseAccount",e[e.TransferFeeConfig=4]="TransferFeeConfig",e[e.WithheldWithdraw=5]="WithheldWithdraw",e[e.CloseMint=6]="CloseMint",e[e.InterestRate=7]="InterestRate",e[e.PermanentDelegate=8]="PermanentDelegate",e[e.ConfidentialTransferMint=9]="ConfidentialTransferMint",e[e.TransferHookProgramId=10]="TransferHookProgramId",e[e.ConfidentialTransferFeeConfig=11]="ConfidentialTransferFeeConfig",e[e.MetadataPointer=12]="MetadataPointer",e[e.GroupPointer=13]="GroupPointer",e[e.GroupMemberPointer=14]="GroupMemberPointer",e[e.ScaledUiAmount=15]="ScaledUiAmount",e[e.Pause=16]="Pause",e))(Pp||{});function Np(){return Vc(Pp)}function Bp(){return $a(Cc(),36)}var Op,Mp=((Op=Mp||{})[Op.Uninitialized=0]="Uninitialized",Op[Op.TransferFeeConfig=1]="TransferFeeConfig",Op[Op.TransferFeeAmount=2]="TransferFeeAmount",Op[Op.MintCloseAuthority=3]="MintCloseAuthority",Op[Op.ConfidentialTransferMint=4]="ConfidentialTransferMint",Op[Op.ConfidentialTransferAccount=5]="ConfidentialTransferAccount",Op[Op.DefaultAccountState=6]="DefaultAccountState",Op[Op.ImmutableOwner=7]="ImmutableOwner",Op[Op.MemoTransfer=8]="MemoTransfer",Op[Op.NonTransferable=9]="NonTransferable",Op[Op.InterestBearingConfig=10]="InterestBearingConfig",Op[Op.CpiGuard=11]="CpiGuard",Op[Op.PermanentDelegate=12]="PermanentDelegate",Op[Op.NonTransferableAccount=13]="NonTransferableAccount",Op[Op.TransferHook=14]="TransferHook",Op[Op.TransferHookAccount=15]="TransferHookAccount",Op[Op.ConfidentialTransferFee=16]="ConfidentialTransferFee",Op[Op.ConfidentialTransferFeeAmount=17]="ConfidentialTransferFeeAmount",Op[Op.ScaledUiAmountConfig=18]="ScaledUiAmountConfig",Op[Op.PausableConfig=19]="PausableConfig",Op[Op.PausableAccount=20]="PausableAccount",Op[Op.MetadataPointer=21]="MetadataPointer",Op[Op.TokenMetadata=22]="TokenMetadata",Op[Op.GroupPointer=23]="GroupPointer",Op[Op.TokenGroup=24]="TokenGroup",Op[Op.GroupMemberPointer=25]="GroupMemberPointer",Op[Op.TokenGroupMember=26]="TokenGroupMember",Op);function zp(){return Vc(Mp,{size:ss()})}function jp(){return Lc([["Name",Hc()],["Symbol",Hc()],["Uri",Hc()],["Key",Jc([["fields",Oc([La(Fs(),us())])]])]])}var Up=(e=>(e[e.CreateAssociatedToken=0]="CreateAssociatedToken",e[e.CreateAssociatedTokenIdempotent=1]="CreateAssociatedTokenIdempotent",e[e.RecoverNestedAssociatedToken=2]="RecoverNestedAssociatedToken",e))(Up||{});var Dp,Lp="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",Fp=((Dp=Fp||{})[Dp.Mint=0]="Mint",Dp[Dp.Token=1]="Token",Dp[Dp.Multisig=2]="Multisig",Dp);var $p,qp=(($p=qp||{})[$p.InitializeMint=0]="InitializeMint",$p[$p.InitializeAccount=1]="InitializeAccount",$p[$p.InitializeMultisig=2]="InitializeMultisig",$p[$p.Transfer=3]="Transfer",$p[$p.Approve=4]="Approve",$p[$p.Revoke=5]="Revoke",$p[$p.SetAuthority=6]="SetAuthority",$p[$p.MintTo=7]="MintTo",$p[$p.Burn=8]="Burn",$p[$p.CloseAccount=9]="CloseAccount",$p[$p.FreezeAccount=10]="FreezeAccount",$p[$p.ThawAccount=11]="ThawAccount",$p[$p.TransferChecked=12]="TransferChecked",$p[$p.ApproveChecked=13]="ApproveChecked",$p[$p.MintToChecked=14]="MintToChecked",$p[$p.BurnChecked=15]="BurnChecked",$p[$p.InitializeAccount2=16]="InitializeAccount2",$p[$p.SyncNative=17]="SyncNative",$p[$p.InitializeAccount3=18]="InitializeAccount3",$p[$p.InitializeMultisig2=19]="InitializeMultisig2",$p[$p.InitializeMint2=20]="InitializeMint2",$p[$p.GetAccountDataSize=21]="GetAccountDataSize",$p[$p.InitializeImmutableOwner=22]="InitializeImmutableOwner",$p[$p.AmountToUiAmount=23]="AmountToUiAmount",$p[$p.UiAmountToAmount=24]="UiAmountToAmount",$p[$p.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",$p[$p.InitializeTransferFeeConfig=26]="InitializeTransferFeeConfig",$p[$p.TransferCheckedWithFee=27]="TransferCheckedWithFee",$p[$p.WithdrawWithheldTokensFromMint=28]="WithdrawWithheldTokensFromMint",$p[$p.WithdrawWithheldTokensFromAccounts=29]="WithdrawWithheldTokensFromAccounts",$p[$p.HarvestWithheldTokensToMint=30]="HarvestWithheldTokensToMint",$p[$p.SetTransferFee=31]="SetTransferFee",$p[$p.InitializeConfidentialTransferMint=32]="InitializeConfidentialTransferMint",$p[$p.UpdateConfidentialTransferMint=33]="UpdateConfidentialTransferMint",$p[$p.ConfigureConfidentialTransferAccount=34]="ConfigureConfidentialTransferAccount",$p[$p.ApproveConfidentialTransferAccount=35]="ApproveConfidentialTransferAccount",$p[$p.EmptyConfidentialTransferAccount=36]="EmptyConfidentialTransferAccount",$p[$p.ConfidentialDeposit=37]="ConfidentialDeposit",$p[$p.ConfidentialWithdraw=38]="ConfidentialWithdraw",$p[$p.ConfidentialTransfer=39]="ConfidentialTransfer",$p[$p.ApplyConfidentialPendingBalance=40]="ApplyConfidentialPendingBalance",$p[$p.EnableConfidentialCredits=41]="EnableConfidentialCredits",$p[$p.DisableConfidentialCredits=42]="DisableConfidentialCredits",$p[$p.EnableNonConfidentialCredits=43]="EnableNonConfidentialCredits",$p[$p.DisableNonConfidentialCredits=44]="DisableNonConfidentialCredits",$p[$p.ConfidentialTransferWithFee=45]="ConfidentialTransferWithFee",$p[$p.InitializeDefaultAccountState=46]="InitializeDefaultAccountState",$p[$p.UpdateDefaultAccountState=47]="UpdateDefaultAccountState",$p[$p.Reallocate=48]="Reallocate",$p[$p.EnableMemoTransfers=49]="EnableMemoTransfers",$p[$p.DisableMemoTransfers=50]="DisableMemoTransfers",$p[$p.CreateNativeMint=51]="CreateNativeMint",$p[$p.InitializeNonTransferableMint=52]="InitializeNonTransferableMint",$p[$p.InitializeInterestBearingMint=53]="InitializeInterestBearingMint",$p[$p.UpdateRateInterestBearingMint=54]="UpdateRateInterestBearingMint",$p[$p.EnableCpiGuard=55]="EnableCpiGuard",$p[$p.DisableCpiGuard=56]="DisableCpiGuard",$p[$p.InitializePermanentDelegate=57]="InitializePermanentDelegate",$p[$p.InitializeTransferHook=58]="InitializeTransferHook",$p[$p.UpdateTransferHook=59]="UpdateTransferHook",$p[$p.InitializeConfidentialTransferFee=60]="InitializeConfidentialTransferFee",$p[$p.WithdrawWithheldTokensFromMintForConfidentialTransferFee=61]="WithdrawWithheldTokensFromMintForConfidentialTransferFee",$p[$p.WithdrawWithheldTokensFromAccountsForConfidentialTransferFee=62]="WithdrawWithheldTokensFromAccountsForConfidentialTransferFee",$p[$p.HarvestWithheldTokensToMintForConfidentialTransferFee=63]="HarvestWithheldTokensToMintForConfidentialTransferFee",$p[$p.EnableHarvestToMint=64]="EnableHarvestToMint",$p[$p.DisableHarvestToMint=65]="DisableHarvestToMint",$p[$p.WithdrawExcessLamports=66]="WithdrawExcessLamports",$p[$p.InitializeMetadataPointer=67]="InitializeMetadataPointer",$p[$p.UpdateMetadataPointer=68]="UpdateMetadataPointer",$p[$p.InitializeGroupPointer=69]="InitializeGroupPointer",$p[$p.UpdateGroupPointer=70]="UpdateGroupPointer",$p[$p.InitializeGroupMemberPointer=71]="InitializeGroupMemberPointer",$p[$p.UpdateGroupMemberPointer=72]="UpdateGroupMemberPointer",$p[$p.InitializeScaledUiAmountMint=73]="InitializeScaledUiAmountMint",$p[$p.UpdateMultiplierScaledUiMint=74]="UpdateMultiplierScaledUiMint",$p[$p.InitializePausableConfig=75]="InitializePausableConfig",$p[$p.Pause=76]="Pause",$p[$p.Resume=77]="Resume",$p[$p.InitializeTokenMetadata=78]="InitializeTokenMetadata",$p[$p.UpdateTokenMetadataField=79]="UpdateTokenMetadataField",$p[$p.RemoveTokenMetadataKey=80]="RemoveTokenMetadataKey",$p[$p.UpdateTokenMetadataUpdateAuthority=81]="UpdateTokenMetadataUpdateAuthority",$p[$p.EmitTokenMetadata=82]="EmitTokenMetadata",$p[$p.InitializeTokenGroup=83]="InitializeTokenGroup",$p[$p.UpdateTokenGroupMaxSize=84]="UpdateTokenGroupMaxSize",$p[$p.UpdateTokenGroupUpdateAuthority=85]="UpdateTokenGroupUpdateAuthority",$p[$p.InitializeTokenGroupMember=86]="InitializeTokenGroupMember",$p);function Wp(){return Jc([["discriminator",hs()],["amount",ds()]])}function Vp(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["expectedPendingBalanceCreditCounter",ds()],["newDecryptableAvailableBalance",Bp()]])}function Kp(){return Jc([["discriminator",hs()],["amount",ds()]])}function Gp(){return Jc([["discriminator",hs()],["amount",ds()],["decimals",hs()]])}function Hp(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()]])}function Zp(){return Jc([["discriminator",hs()],["amount",ds()]])}function Jp(){return Jc([["discriminator",hs()],["amount",ds()],["decimals",hs()]])}function Yp(){return Jc([["discriminator",hs()]])}function Qp(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["amount",ds()],["decimals",hs()]])}function Xp(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["newSourceDecryptableAvailableBalance",Bp()],["equalityProofInstructionOffset",os()],["ciphertextValidityProofInstructionOffset",os()],["rangeProofInstructionOffset",os()]])}function eg(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["newSourceDecryptableAvailableBalance",Bp()],["equalityProofInstructionOffset",os()],["transferAmountCiphertextValidityProofInstructionOffset",os()],["feeSigmaProofInstructionOffset",os()],["feeCiphertextValidityProofInstructionOffset",os()],["rangeProofInstructionOffset",os()]])}function tg(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["amount",ds()],["decimals",hs()],["newDecryptableAvailableBalance",Bp()],["equalityProofInstructionOffset",os()],["rangeProofInstructionOffset",os()]])}function ng(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["decryptableZeroBalance",Bp()],["maximumPendingBalanceCreditCounter",ds()],["proofInstructionOffset",os()]])}function rg(){return Jc([["discriminator",hs()]])}function og(){return Jc([["discriminator",hs()]])}function ig(){return Jc([["discriminator",hs()]])}function ag(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()]])}function sg(){return Jc([["discriminator",hs()],["cpiGuardDiscriminator",hs()]])}function cg(){return Jc([["discriminator",hs()],["confidentialTransferFeeDiscriminator",hs()]])}function ug(){return Jc([["discriminator",hs()],["memoTransfersDiscriminator",hs()]])}function lg(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()]])}new Uint8Array([250,166,180,250,13,12,184,70]);function dg(){return Jc([["discriminator",Cc()],["start",Oh(ds())],["end",Oh(ds())]])}function fg(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["proofInstructionOffset",os()]])}function hg(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()]])}function pg(){return Jc([["discriminator",hs()],["cpiGuardDiscriminator",hs()]])}function gg(){return Jc([["discriminator",hs()],["confidentialTransferFeeDiscriminator",hs()]])}function mg(){return Jc([["discriminator",hs()],["memoTransfersDiscriminator",hs()]])}function yg(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()]])}function vg(){return Jc([["discriminator",hs()]])}function wg(){return Jc([["discriminator",hs()]])}function Ag(){return Jc([["discriminator",hs()],["transferFeeDiscriminator",hs()]])}function bg(){return Jc([["discriminator",hs()],["confidentialTransferFeeDiscriminator",hs()]])}function Sg(){return Jc([["discriminator",hs()]])}function Eg(){return Jc([["discriminator",hs()],["owner",Js()]])}function kg(){return Jc([["discriminator",hs()],["owner",Js()]])}function Ig(){return Jc([["discriminator",hs()],["confidentialTransferFeeDiscriminator",hs()],["authority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["withdrawWithheldAuthorityElGamalPubkey",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function Tg(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["authority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["autoApproveNewAccounts",_c()],["auditorElgamalPubkey",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function _g(){return Jc([["discriminator",hs()],["defaultAccountStateDiscriminator",hs()],["state",Rp()]])}function xg(){return Jc([["discriminator",hs()],["groupMemberPointerDiscriminator",hs()],["authority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["memberAddress",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function Cg(){return Jc([["discriminator",hs()],["groupPointerDiscriminator",hs()],["authority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["groupAddress",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function Rg(){return Jc([["discriminator",hs()]])}function Pg(){return Jc([["discriminator",hs()],["interestBearingMintDiscriminator",hs()],["rateAuthority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["rate",ns()]])}function Ng(){return Jc([["discriminator",hs()],["metadataPointerDiscriminator",hs()],["authority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["metadataAddress",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function Bg(){return Jc([["discriminator",hs()],["decimals",hs()],["mintAuthority",Js()],["freezeAuthority",Oh(Js())]])}function Og(){return Jc([["discriminator",hs()],["decimals",hs()],["mintAuthority",Js()],["freezeAuthority",Oh(Js())]])}function Mg(){return Jc([["discriminator",hs()],["closeAuthority",Oh(Js())]])}function zg(){return Jc([["discriminator",hs()],["m",hs()]])}function jg(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{multisig:n(),rent:n()},data:zg().decode(e.data)}}function Ug(){return Jc([["discriminator",hs()]])}function Dg(){return Jc([["discriminator",hs()],["pausableDiscriminator",hs()],["authority",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function Lg(){return Jc([["discriminator",hs()],["delegate",Js()]])}function Fg(){return Jc([["discriminator",hs()],["scaledUiAmountMintDiscriminator",hs()],["authority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["multiplier",ts()]])}new Uint8Array([121,113,108,39,54,51,0,4]);function $g(){return Jc([["discriminator",Cc()],["updateAuthority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["maxSize",ds()]])}new Uint8Array([152,32,222,176,223,237,116,134]);function qg(){return Jc([["discriminator",Cc()]])}new Uint8Array([210,225,30,162,88,184,77,141]);function Wg(){return Jc([["discriminator",Cc()],["name",La(Fs(),us())],["symbol",La(Fs(),us())],["uri",La(Fs(),us())]])}function Vg(){return Jc([["discriminator",hs()],["transferFeeDiscriminator",hs()],["transferFeeConfigAuthority",Oh(Js())],["withdrawWithheldAuthority",Oh(Js())],["transferFeeBasisPoints",ss()],["maximumFee",ds()]])}function Kg(){return Jc([["discriminator",hs()],["transferHookDiscriminator",hs()],["authority",Oh(Js(),{prefix:null,noneValue:"zeroes"})],["programId",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function Gg(){return Jc([["discriminator",hs()],["amount",ds()]])}function Hg(){return Jc([["discriminator",hs()],["amount",ds()],["decimals",hs()]])}function Zg(){return Jc([["discriminator",hs()],["pausableDiscriminator",hs()]])}function Jg(){return Jc([["discriminator",hs()],["newExtensionTypes",kc(zp(),{size:"remainder"})]])}function Yg(){return Jc([["discriminator",hs()]])}new Uint8Array([234,18,32,56,89,141,37,181]);function Qg(){return Jc([["discriminator",Cc()],["idempotent",_c()],["key",La(Fs(),us())]])}function Xg(){return Jc([["discriminator",hs()],["pausableDiscriminator",hs()]])}function em(){return Jc([["discriminator",hs()]])}function tm(){return Jc([["discriminator",hs()],["authorityType",Np()],["newAuthority",Oh(Js())]])}function nm(){return Jc([["discriminator",hs()],["transferFeeDiscriminator",hs()],["transferFeeBasisPoints",ss()],["maximumFee",ds()]])}function rm(){return Jc([["discriminator",hs()]])}function om(){return Jc([["discriminator",hs()]])}function im(){return Jc([["discriminator",hs()],["amount",ds()]])}function am(){return Jc([["discriminator",hs()],["amount",ds()],["decimals",hs()]])}function sm(){return Jc([["discriminator",hs()],["transferFeeDiscriminator",hs()],["amount",ds()],["decimals",hs()],["fee",ds()]])}function cm(){return Jc([["discriminator",hs()],["uiAmount",Fs()]])}function um(){return Jc([["discriminator",hs()],["confidentialTransferDiscriminator",hs()],["autoApproveNewAccounts",_c()],["auditorElgamalPubkey",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function lm(){return Jc([["discriminator",hs()],["defaultAccountStateDiscriminator",hs()],["state",Rp()]])}function dm(){return Jc([["discriminator",hs()],["groupMemberPointerDiscriminator",hs()],["memberAddress",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function fm(){return Jc([["discriminator",hs()],["groupPointerDiscriminator",hs()],["groupAddress",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function hm(){return Jc([["discriminator",hs()],["metadataPointerDiscriminator",hs()],["metadataAddress",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function pm(){return Jc([["discriminator",hs()],["scaledUiAmountMintDiscriminator",hs()],["multiplier",ts()],["effectiveTimestamp",rs()]])}function gm(){return Jc([["discriminator",hs()],["interestBearingMintDiscriminator",hs()],["rate",ns()]])}new Uint8Array([108,37,171,143,248,30,18,110]);function mm(){return Jc([["discriminator",Cc()],["maxSize",ds()]])}new Uint8Array([161,105,88,1,237,221,216,203]);function ym(){return Jc([["discriminator",Cc()],["newUpdateAuthority",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}new Uint8Array([221,233,49,45,181,202,220,200]);function vm(){return Jc([["discriminator",Cc()],["field",jp()],["value",La(Fs(),us())]])}new Uint8Array([215,228,166,228,84,100,86,123]);function wm(){return Jc([["discriminator",Cc()],["newUpdateAuthority",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function Am(){return Jc([["discriminator",hs()],["transferHookDiscriminator",hs()],["programId",Oh(Js(),{prefix:null,noneValue:"zeroes"})]])}function bm(){return Jc([["discriminator",hs()]])}function Sm(){return Jc([["discriminator",hs()],["transferFeeDiscriminator",hs()],["numTokenAccounts",hs()]])}function Em(){return Jc([["discriminator",hs()],["confidentialTransferFeeDiscriminator",hs()],["numTokenAccounts",hs()],["proofInstructionOffset",os()],["newDecryptableAvailableBalance",Bp()]])}function km(){return Jc([["discriminator",hs()],["transferFeeDiscriminator",hs()]])}function Im(){return Jc([["discriminator",hs()],["confidentialTransferFeeDiscriminator",hs()],["proofInstructionOffset",os()],["newDecryptableAvailableBalance",Bp()]])}function Tm(e){return!("exists"in e)||"exists"in e&&e.exists}function _m(e,t){if(!t)return Object.freeze({address:e,exists:!1});const n=Ms().encode(t.data[0]);return Object.freeze({...Cm(t),address:e,data:n,exists:!0})}function xm(e,t){if(!t)return Object.freeze({address:e,exists:!1});const n=t.data.parsed.info;return Object.freeze({...Cm(t),address:e,data:n,exists:!0})}function Cm(e){return Object.freeze({executable:e.executable,lamports:e.lamports,programAddress:e.owner,space:e.space})}async function Rm(e,t,n={}){const{abortSignal:r,...o}=n;return _m(t,(await e.getAccountInfo(t,{...o,encoding:"base64"}).send({abortSignal:r})).value)}async function Pm(e,t,n={}){const{abortSignal:r,...o}=n;return(await e.getMultipleAccounts(t,{...o,encoding:"base64"}).send({abortSignal:r})).value.map(((e,n)=>_m(t[n],e)))}var Nm="ComputeBudget111111111111111111111111111111",Bm={blockhash:"11111111111111111111111111111111",lastValidBlockHeight:0n},Om=2;function Mm(e){return function(e,t){return e.programAddress===t}(e,Nm)&&function(e){return void 0!==e.data}(e)&&e.data[0]===Om}async function zm({abortSignal:e,rpc:t,transactionMessage:n,...r}){const o=Fu(n);let i;i=o||ru(n)?n:ou(Bm,n);const a=n.instructions.findIndex(Mm),s=function(e){const t=new Uint8Array(5);return t[0]=Om,cs().write(e,t,1),Object.freeze({data:t,programAddress:Nm})}(14e5);if(-1===a)i=qu(s,i);else{const e=[...i.instructions];e.splice(a,1,s),i=Object.freeze({...i,instructions:e})}const c=tl(Yu(i));try{const{value:{err:n,unitsConsumed:i}}=await t.simulateTransaction(c,{...r,encoding:"base64",replaceRecentBlockhash:!o,sigVerify:!1}).send({abortSignal:e});if(null==i)throw new Aa(Wi);const a=i>4294967295n?4294967295:Number(i);if(n)throw new Aa(Vi,{cause:n,unitsConsumed:a});return a}catch(e){if(wa(e,Vi))throw e;throw new Aa(Wi,{cause:e})}}function jm({rpc:e}){return async function(t,n){return await zm({...n,rpc:e,transactionMessage:t})}}async function Um(e,t,n){if(0===e.length)return{};const r=await async function(e,t,n={}){const{abortSignal:r,...o}=n;return(await e.getMultipleAccounts(t,{...o,encoding:"jsonParsed"}).send({abortSignal:r})).value.map(((e,n)=>e&&"object"==typeof e&&"parsed"in e.data?xm(t[n],e):_m(t[n],e)))}(t,e,n);return function(e){const t=e.filter((e=>Tm(e)&&e.data instanceof Uint8Array));if(t.length>0){const e=t.map((e=>e.address));throw new Aa(vi,{addresses:e})}}(r),function(e){const t=e.filter((e=>!e.exists));if(t.length>0){const e=t.map((e=>e.address));throw new Aa(yi,{addresses:e})}}(r),r.reduce(((e,t)=>({...e,[t.address]:t.data.addresses})),{})}async function Dm(e,t,n){const r=("addressTableLookups"in e&&void 0!==e.addressTableLookups&&e.addressTableLookups.length>0?e.addressTableLookups:[]).map((e=>e.lookupTableAddress)),{lastValidBlockHeight:o,...i}=n??{};return Ku(e,{addressesByLookupTableAddress:r.length>0?await Um(r,t,i):{},lastValidBlockHeight:o})}function Lm(e,t){return!t?.preflightCommitment&&function(e,t){return e===t?0:Xc(e)<Xc(t)?-1:1}(e,"finalized")<0?{...t,preflightCommitment:e}:t}async function Fm({abortSignal:e,commitment:t,rpc:n,transaction:r,...o}){const i=tl(r);return await n.sendTransaction(i,{...Lm(t,o),encoding:"base64"}).send({abortSignal:e})}const $m=async(e,t,n)=>nu(e,Ms().encode,_u().decode,(async e=>Dm(e,t,n))),qm=async(e,t,n)=>nu(e,_u().decode,(async e=>Dm(e,t,n))),Wm=e=>nu(e,Hu().encode,zs().decode),Vm=async e=>nu(e,Ms().encode,Zu().decode),Km=async(e,t,n)=>(async e=>new Promise(((t,n)=>{if(0===e.length)return void n(new AggregateError([],"No promises to resolve"));let r=0;const o=[];e.forEach(((i,a)=>{Promise.resolve(i).then((e=>t(e)),(t=>{o[a]=t,r+=1,r===e.length&&n(new AggregateError(o,"All promises rejected"))}))}))})))([Vm(e),$m(e,t,n)]);const Gm={[El]:{identifier:function(e){const t="data"in e?e.data:e;if(Ca(t,cs().encode(0),0))return 0;if(Ca(t,cs().encode(1),0))return 1;if(Ca(t,cs().encode(2),0))return 2;if(Ca(t,cs().encode(3),0))return 3;if(Ca(t,cs().encode(4),0))return 4;if(Ca(t,cs().encode(5),0))return 5;if(Ca(t,cs().encode(6),0))return 6;if(Ca(t,cs().encode(7),0))return 7;if(Ca(t,cs().encode(8),0))return 8;if(Ca(t,cs().encode(9),0))return 9;if(Ca(t,cs().encode(10),0))return 10;if(Ca(t,cs().encode(11),0))return 11;if(Ca(t,cs().encode(12),0))return 12;throw new Error("The provided instruction could not be identified as a system instruction.")},instructionEnum:Il,typeToParserMap:{[Il.Assign]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Nl().decode(e.data)}},[Il.TransferSol]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),destination:n()},data:Ll().decode(e.data)}},[Il.CreateAccount]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),newAccount:n()},data:Ml().decode(e.data)}},[Il.CreateAccountWithSeed]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),newAccount:n(),baseAccount:n()},data:zl().decode(e.data)}},[Il.AdvanceNonceAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),recentBlockhashesSysvar:n(),nonceAuthority:n()},data:Cl().decode(e.data)}},[Il.WithdrawNonceAccount]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),recipientAccount:n(),recentBlockhashesSysvar:n(),rentSysvar:n(),nonceAuthority:n()},data:ql().decode(e.data)}},[Il.InitializeNonceAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),recentBlockhashesSysvar:n(),rentSysvar:n()},data:jl().decode(e.data)}},[Il.AuthorizeNonceAccount]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nonceAccount:n(),nonceAuthority:n()},data:Ol().decode(e.data)}},[Il.Allocate]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{newAccount:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Rl().decode(e.data)}},[Il.AllocateWithSeed]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{newAccount:n(),baseAccount:n()},data:Pl().decode(e.data)}},[Il.AssignWithSeed]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),baseAccount:n()},data:Bl().decode(e.data)}},[Il.TransferSolWithSeed]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),baseAccount:n(),destination:n()},data:Fl().decode(e.data)}},[Il.UpgradeNonceAccount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{nonceAccount:(()=>{const n=e.accounts[t];return t+=1,n})()},data:$l().decode(e.data)}}}},[ph]:{identifier:mh,instructionEnum:gh,typeToParserMap:{[gh.RequestUnits]:function(e){return{programAddress:e.programAddress,data:vh().decode(e.data)}},[gh.RequestHeapFrame]:function(e){return{programAddress:e.programAddress,data:yh().decode(e.data)}},[gh.SetComputeUnitPrice]:function(e){return{programAddress:e.programAddress,data:Ih().decode(e.data)}},[gh.SetComputeUnitLimit]:function(e){return{programAddress:e.programAddress,data:bh().decode(e.data)}},[gh.SetLoadedAccountsDataSizeLimit]:function(e){return{programAddress:e.programAddress,data:_h().decode(e.data)}}}},[Wh]:{identifier:function(e){const t="data"in e?e.data:e;if(Ca(t,fs().encode(0),0))return 0;if(Ca(t,fs().encode(1),0))return 1;if(Ca(t,fs().encode(2),0))return 2;if(Ca(t,fs().encode(3),0))return 3;if(Ca(t,fs().encode(4),0))return 4;if(Ca(t,fs().encode(5),0))return 5;if(Ca(t,fs().encode(6),0))return 6;if(Ca(t,fs().encode(7),0))return 7;if(Ca(t,fs().encode(8),0))return 8;if(Ca(t,fs().encode(9),0))return 9;if(Ca(t,fs().encode(10),0))return 10;if(Ca(t,fs().encode(11),0))return 11;if(Ca(t,fs().encode(12),0))return 12;if(Ca(t,fs().encode(13),0))return 13;if(Ca(t,fs().encode(14),0))return 14;if(Ca(t,fs().encode(15),0))return 15;if(Ca(t,fs().encode(16),0))return 16;if(Ca(t,fs().encode(17),0))return 17;if(Ca(t,fs().encode(18),0))return 18;if(Ca(t,fs().encode(19),0))return 19;if(Ca(t,fs().encode(20),0))return 20;if(Ca(t,fs().encode(21),0))return 21;if(Ca(t,fs().encode(22),0))return 22;if(Ca(t,fs().encode(23),0))return 23;if(Ca(t,fs().encode(24),0))return 24;throw new Error("The provided instruction could not be identified as a token instruction.")},instructionEnum:Gh,typeToParserMap:{[Gh.InitializeMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),rent:n()},data:hp().decode(e.data)}},[Gh.InitializeAccount]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n(),rent:n()},data:up().decode(e.data)}},[Gh.InitializeMultisig]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{multisig:n(),rent:n()},data:gp().decode(e.data)}},[Gh.Transfer]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),destination:n(),authority:n()},data:Ep().decode(e.data)}},[Gh.Approve]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),delegate:n(),owner:n()},data:Qh().decode(e.data)}},[Gh.Revoke]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),owner:n()},data:wp().decode(e.data)}},[Gh.SetAuthority]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{owned:n(),owner:n()},data:Ap().decode(e.data)}},[Gh.MintTo]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:yp().decode(e.data)}},[Gh.Burn]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:ep().decode(e.data)}},[Gh.CloseAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),destination:n(),owner:n()},data:np().decode(e.data)}},[Gh.FreezeAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:sp().decode(e.data)}},[Gh.ThawAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:Sp().decode(e.data)}},[Gh.TransferChecked]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),destination:n(),authority:n()},data:Tp().decode(e.data)}},[Gh.ApproveChecked]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),delegate:n(),owner:n()},data:Xh().decode(e.data)}},[Gh.MintToChecked]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:vp().decode(e.data)}},[Gh.BurnChecked]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:tp().decode(e.data)}},[Gh.InitializeAccount2]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),rent:n()},data:lp().decode(e.data)}},[Gh.SyncNative]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:bp().decode(e.data)}},[Gh.InitializeAccount3]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n()},data:dp().decode(e.data)}},[Gh.InitializeMultisig2]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{multisig:(()=>{const n=e.accounts[t];return t+=1,n})()},data:mp().decode(e.data)}},[Gh.InitializeMint2]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:pp().decode(e.data)}},[Gh.GetAccountDataSize]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:cp().decode(e.data)}},[Gh.InitializeImmutableOwner]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:fp().decode(e.data)}},[Gh.AmountToUiAmount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Yh().decode(e.data)}},[Gh.UiAmountToAmount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:xp().decode(e.data)}}}},[Lp]:{identifier:function(e){const t="data"in e?e.data:e;if(Ca(t,fs().encode(0),0))return 0;if(Ca(t,fs().encode(1),0))return 1;if(Ca(t,fs().encode(2),0))return 2;if(Ca(t,fs().encode(3),0))return 3;if(Ca(t,fs().encode(4),0))return 4;if(Ca(t,fs().encode(5),0))return 5;if(Ca(t,fs().encode(6),0))return 6;if(Ca(t,fs().encode(7),0))return 7;if(Ca(t,fs().encode(8),0))return 8;if(Ca(t,fs().encode(9),0))return 9;if(Ca(t,fs().encode(10),0))return 10;if(Ca(t,fs().encode(11),0))return 11;if(Ca(t,fs().encode(12),0))return 12;if(Ca(t,fs().encode(13),0))return 13;if(Ca(t,fs().encode(14),0))return 14;if(Ca(t,fs().encode(15),0))return 15;if(Ca(t,fs().encode(16),0))return 16;if(Ca(t,fs().encode(17),0))return 17;if(Ca(t,fs().encode(18),0))return 18;if(Ca(t,fs().encode(19),0))return 19;if(Ca(t,fs().encode(20),0))return 20;if(Ca(t,fs().encode(21),0))return 21;if(Ca(t,fs().encode(22),0))return 22;if(Ca(t,fs().encode(23),0))return 23;if(Ca(t,fs().encode(24),0))return 24;if(Ca(t,fs().encode(25),0))return 25;if(Ca(t,fs().encode(26),0)&&Ca(t,fs().encode(0),1))return 26;if(Ca(t,fs().encode(26),0)&&Ca(t,fs().encode(1),1))return 27;if(Ca(t,fs().encode(26),0)&&Ca(t,fs().encode(2),1))return 28;if(Ca(t,fs().encode(26),0)&&Ca(t,fs().encode(3),1))return 29;if(Ca(t,fs().encode(26),0)&&Ca(t,fs().encode(4),1))return 30;if(Ca(t,fs().encode(26),0)&&Ca(t,fs().encode(5),1))return 31;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(0),1))return 32;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(1),1))return 33;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(2),1))return 34;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(3),1))return 35;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(4),1))return 36;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(5),1))return 37;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(6),1))return 38;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(7),1))return 39;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(8),1))return 40;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(9),1))return 41;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(10),1))return 42;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(11),1))return 43;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(12),1))return 44;if(Ca(t,fs().encode(27),0)&&Ca(t,fs().encode(13),1))return 45;if(Ca(t,fs().encode(28),0)&&Ca(t,fs().encode(0),1))return 46;if(Ca(t,fs().encode(28),0)&&Ca(t,fs().encode(1),1))return 47;if(Ca(t,fs().encode(29),0))return 48;if(Ca(t,fs().encode(30),0)&&Ca(t,fs().encode(0),1))return 49;if(Ca(t,fs().encode(30),0)&&Ca(t,fs().encode(1),1))return 50;if(Ca(t,fs().encode(31),0))return 51;if(Ca(t,fs().encode(32),0))return 52;if(Ca(t,fs().encode(33),0)&&Ca(t,fs().encode(0),1))return 53;if(Ca(t,fs().encode(33),0)&&Ca(t,fs().encode(1),1))return 54;if(Ca(t,fs().encode(34),0)&&Ca(t,fs().encode(0),1))return 55;if(Ca(t,fs().encode(34),0)&&Ca(t,fs().encode(1),1))return 56;if(Ca(t,fs().encode(35),0))return 57;if(Ca(t,fs().encode(36),0)&&Ca(t,fs().encode(0),1))return 58;if(Ca(t,fs().encode(36),0)&&Ca(t,fs().encode(1),1))return 59;if(Ca(t,fs().encode(37),0)&&Ca(t,fs().encode(0),1))return 60;if(Ca(t,fs().encode(37),0)&&Ca(t,fs().encode(1),1))return 61;if(Ca(t,fs().encode(37),0)&&Ca(t,fs().encode(2),1))return 62;if(Ca(t,fs().encode(37),0)&&Ca(t,fs().encode(3),1))return 63;if(Ca(t,fs().encode(37),0)&&Ca(t,fs().encode(4),1))return 64;if(Ca(t,fs().encode(37),0)&&Ca(t,fs().encode(5),1))return 65;if(Ca(t,fs().encode(38),0))return 66;if(Ca(t,fs().encode(39),0)&&Ca(t,fs().encode(0),1))return 67;if(Ca(t,fs().encode(39),0)&&Ca(t,fs().encode(1),1))return 68;if(Ca(t,fs().encode(40),0)&&Ca(t,fs().encode(0),1))return 69;if(Ca(t,fs().encode(40),0)&&Ca(t,fs().encode(1),1))return 70;if(Ca(t,fs().encode(41),0)&&Ca(t,fs().encode(0),1))return 71;if(Ca(t,fs().encode(41),0)&&Ca(t,fs().encode(1),1))return 72;if(Ca(t,fs().encode(43),0)&&Ca(t,fs().encode(0),1))return 73;if(Ca(t,fs().encode(43),0)&&Ca(t,fs().encode(1),1))return 74;if(Ca(t,fs().encode(44),0)&&Ca(t,fs().encode(0),1))return 75;if(Ca(t,fs().encode(44),0)&&Ca(t,fs().encode(1),1))return 76;if(Ca(t,fs().encode(44),0)&&Ca(t,fs().encode(2),1))return 77;if(Ca(t,new Uint8Array([210,225,30,162,88,184,77,141]),0))return 78;if(Ca(t,new Uint8Array([221,233,49,45,181,202,220,200]),0))return 79;if(Ca(t,new Uint8Array([234,18,32,56,89,141,37,181]),0))return 80;if(Ca(t,new Uint8Array([215,228,166,228,84,100,86,123]),0))return 81;if(Ca(t,new Uint8Array([250,166,180,250,13,12,184,70]),0))return 82;if(Ca(t,new Uint8Array([121,113,108,39,54,51,0,4]),0))return 83;if(Ca(t,new Uint8Array([108,37,171,143,248,30,18,110]),0))return 84;if(Ca(t,new Uint8Array([161,105,88,1,237,221,216,203]),0))return 85;if(Ca(t,new Uint8Array([152,32,222,176,223,237,116,134]),0))return 86;throw new Error("The provided instruction could not be identified as a token-2022 instruction.")},instructionEnum:qp,typeToParserMap:{[qp.InitializeMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),rent:n()},data:Bg().decode(e.data)}},[qp.InitializeAccount]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n(),rent:n()},data:Sg().decode(e.data)}},[qp.InitializeMultisig]:jg,[qp.Transfer]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),destination:n(),authority:n()},data:im().decode(e.data)}},[qp.Approve]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),delegate:n(),owner:n()},data:Kp().decode(e.data)}},[qp.Revoke]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),owner:n()},data:em().decode(e.data)}},[qp.SetAuthority]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{owned:n(),owner:n()},data:tm().decode(e.data)}},[qp.MintTo]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:Gg().decode(e.data)}},[qp.Burn]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:Zp().decode(e.data)}},[qp.CloseAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),destination:n(),owner:n()},data:Yp().decode(e.data)}},[qp.FreezeAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:vg().decode(e.data)}},[qp.ThawAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),owner:n()},data:om().decode(e.data)}},[qp.TransferChecked]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),destination:n(),authority:n()},data:am().decode(e.data)}},[qp.ApproveChecked]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),delegate:n(),owner:n()},data:Gp().decode(e.data)}},[qp.MintToChecked]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),token:n(),mintAuthority:n()},data:Hg().decode(e.data)}},[qp.BurnChecked]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),authority:n()},data:Jp().decode(e.data)}},[qp.InitializeAccount2]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n(),rent:n()},data:Eg().decode(e.data)}},[qp.SyncNative]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:rm().decode(e.data)}},[qp.InitializeAccount3]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{account:n(),mint:n()},data:kg().decode(e.data)}},[qp.InitializeMultisig2]:jg,[qp.InitializeMint2]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Og().decode(e.data)}},[qp.GetAccountDataSize]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:wg().decode(e.data)}},[qp.InitializeImmutableOwner]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{account:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Rg().decode(e.data)}},[qp.AmountToUiAmount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Wp().decode(e.data)}},[qp.UiAmountToAmount]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:cm().decode(e.data)}},[qp.InitializeMintCloseAuthority]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Mg().decode(e.data)}},[qp.InitializeTransferFeeConfig]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Vg().decode(e.data)}},[qp.TransferCheckedWithFee]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{source:n(),mint:n(),destination:n(),authority:n()},data:sm().decode(e.data)}},[qp.WithdrawWithheldTokensFromMint]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),feeReceiver:n(),withdrawWithheldAuthority:n()},data:km().decode(e.data)}},[qp.WithdrawWithheldTokensFromAccounts]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),feeReceiver:n(),withdrawWithheldAuthority:n()},data:Sm().decode(e.data)}},[qp.HarvestWithheldTokensToMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ag().decode(e.data)}},[qp.SetTransferFee]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),transferFeeConfigAuthority:n()},data:nm().decode(e.data)}},[qp.InitializeConfidentialTransferMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Tg().decode(e.data)}},[qp.UpdateConfidentialTransferMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:um().decode(e.data)}},[qp.ConfigureConfidentialTransferAccount]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),instructionsSysvarOrContextState:n(),record:(()=>{const e=n();return e.address===Lp?void 0:e})(),authority:n()},data:ng().decode(e.data)}},[qp.ApproveConfidentialTransferAccount]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),authority:n()},data:Hp().decode(e.data)}},[qp.EmptyConfidentialTransferAccount]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),instructionsSysvarOrContextState:n(),record:(()=>{const e=n();return e.address===Lp?void 0:e})(),authority:n()},data:fg().decode(e.data)}},[qp.ConfidentialDeposit]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),authority:n()},data:Qp().decode(e.data)}},[qp.ConfidentialWithdraw]:function(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n},r=()=>{const e=n();return e.address===Lp?void 0:e};return{programAddress:e.programAddress,accounts:{token:n(),mint:n(),instructionsSysvar:r(),equalityRecord:r(),rangeRecord:r(),authority:n()},data:tg().decode(e.data)}},[qp.ConfidentialTransfer]:function(e){if(e.accounts.length<8)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n},r=()=>{const e=n();return e.address===Lp?void 0:e};return{programAddress:e.programAddress,accounts:{sourceToken:n(),mint:n(),destinationToken:n(),instructionsSysvar:r(),equalityRecord:r(),ciphertextValidityRecord:r(),rangeRecord:r(),authority:n()},data:Xp().decode(e.data)}},[qp.ApplyConfidentialPendingBalance]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:Vp().decode(e.data)}},[qp.EnableConfidentialCredits]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:hg().decode(e.data)}},[qp.DisableConfidentialCredits]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:ag().decode(e.data)}},[qp.EnableNonConfidentialCredits]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:yg().decode(e.data)}},[qp.DisableNonConfidentialCredits]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),authority:n()},data:lg().decode(e.data)}},[qp.ConfidentialTransferWithFee]:function(e){if(e.accounts.length<10)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n},r=()=>{const e=n();return e.address===Lp?void 0:e};return{programAddress:e.programAddress,accounts:{sourceToken:n(),mint:n(),destinationToken:n(),instructionsSysvar:r(),equalityRecord:r(),transferAmountCiphertextValidityRecord:r(),feeSigmaRecord:r(),feeCiphertextValidityRecord:r(),rangeRecord:r(),authority:n()},data:eg().decode(e.data)}},[qp.InitializeDefaultAccountState]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:_g().decode(e.data)}},[qp.UpdateDefaultAccountState]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),freezeAuthority:n()},data:lm().decode(e.data)}},[qp.Reallocate]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),payer:n(),systemProgram:n(),owner:n()},data:Jg().decode(e.data)}},[qp.EnableMemoTransfers]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:mg().decode(e.data)}},[qp.DisableMemoTransfers]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:ug().decode(e.data)}},[qp.CreateNativeMint]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),nativeMint:n(),systemProgram:n()},data:ig().decode(e.data)}},[qp.InitializeNonTransferableMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ug().decode(e.data)}},[qp.InitializeInterestBearingMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Pg().decode(e.data)}},[qp.UpdateRateInterestBearingMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),rateAuthority:n()},data:gm().decode(e.data)}},[qp.EnableCpiGuard]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:pg().decode(e.data)}},[qp.DisableCpiGuard]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{token:n(),owner:n()},data:sg().decode(e.data)}},[qp.InitializePermanentDelegate]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Lg().decode(e.data)}},[qp.InitializeTransferHook]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Kg().decode(e.data)}},[qp.UpdateTransferHook]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:Am().decode(e.data)}},[qp.InitializeConfidentialTransferFee]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ig().decode(e.data)}},[qp.WithdrawWithheldTokensFromMintForConfidentialTransferFee]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),destination:n(),instructionsSysvarOrContextState:n(),record:(()=>{const e=n();return e.address===Lp?void 0:e})(),authority:n()},data:Im().decode(e.data)}},[qp.WithdrawWithheldTokensFromAccountsForConfidentialTransferFee]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),destination:n(),instructionsSysvarOrContextState:n(),record:(()=>{const e=n();return e.address===Lp?void 0:e})(),authority:n()},data:Em().decode(e.data)}},[qp.HarvestWithheldTokensToMintForConfidentialTransferFee]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:bg().decode(e.data)}},[qp.EnableHarvestToMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:gg().decode(e.data)}},[qp.DisableHarvestToMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:cg().decode(e.data)}},[qp.WithdrawExcessLamports]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{sourceAccount:n(),destinationAccount:n(),authority:n()},data:bm().decode(e.data)}},[qp.InitializeMetadataPointer]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Ng().decode(e.data)}},[qp.UpdateMetadataPointer]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),metadataPointerAuthority:n()},data:hm().decode(e.data)}},[qp.InitializeGroupPointer]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Cg().decode(e.data)}},[qp.UpdateGroupPointer]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),groupPointerAuthority:n()},data:fm().decode(e.data)}},[qp.InitializeGroupMemberPointer]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:xg().decode(e.data)}},[qp.UpdateGroupMemberPointer]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),groupMemberPointerAuthority:n()},data:dm().decode(e.data)}},[qp.InitializeScaledUiAmountMint]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Fg().decode(e.data)}},[qp.UpdateMultiplierScaledUiMint]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:pm().decode(e.data)}},[qp.InitializePausableConfig]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{mint:(()=>{const n=e.accounts[t];return t+=1,n})()},data:Dg().decode(e.data)}},[qp.Pause]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:Zg().decode(e.data)}},[qp.Resume]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{mint:n(),authority:n()},data:Xg().decode(e.data)}},[qp.InitializeTokenMetadata]:function(e){if(e.accounts.length<4)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n(),mint:n(),mintAuthority:n()},data:Wg().decode(e.data)}},[qp.UpdateTokenMetadataField]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n()},data:vm().decode(e.data)}},[qp.RemoveTokenMetadataKey]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n()},data:Qg().decode(e.data)}},[qp.UpdateTokenMetadataUpdateAuthority]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{metadata:n(),updateAuthority:n()},data:wm().decode(e.data)}},[qp.EmitTokenMetadata]:function(e){if(e.accounts.length<1)throw new Error("Not enough accounts");let t=0;return{programAddress:e.programAddress,accounts:{metadata:(()=>{const n=e.accounts[t];return t+=1,n})()},data:dg().decode(e.data)}},[qp.InitializeTokenGroup]:function(e){if(e.accounts.length<3)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{group:n(),mint:n(),mintAuthority:n()},data:$g().decode(e.data)}},[qp.UpdateTokenGroupMaxSize]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{group:n(),updateAuthority:n()},data:mm().decode(e.data)}},[qp.UpdateTokenGroupUpdateAuthority]:function(e){if(e.accounts.length<2)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{group:n(),updateAuthority:n()},data:ym().decode(e.data)}},[qp.InitializeTokenGroupMember]:function(e){if(e.accounts.length<5)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{member:n(),memberMint:n(),memberMintAuthority:n(),group:n(),groupUpdateAuthority:n()},data:qg().decode(e.data)}}}},[Fh]:{identifier:function(e){const t="data"in e?e.data:e;if(Ca(t,fs().encode(0),0))return 0;if(Ca(t,fs().encode(1),0))return 1;if(Ca(t,fs().encode(2),0))return 2;throw new Error("The provided instruction could not be identified as a associatedToken instruction.")},instructionEnum:Up,typeToParserMap:{[Up.CreateAssociatedToken]:function(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),ata:n(),owner:n(),mint:n(),systemProgram:n(),tokenProgram:n()},data:rg().decode(e.data)}},[Up.CreateAssociatedTokenIdempotent]:function(e){if(e.accounts.length<6)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{payer:n(),ata:n(),owner:n(),mint:n(),systemProgram:n(),tokenProgram:n()},data:og().decode(e.data)}},[Up.RecoverNestedAssociatedToken]:function(e){if(e.accounts.length<7)throw new Error("Not enough accounts");let t=0;const n=()=>{const n=e.accounts[t];return t+=1,n};return{programAddress:e.programAddress,accounts:{nestedAssociatedAccountAddress:n(),nestedTokenMintAddress:n(),destinationAssociatedAccountAddress:n(),ownerAssociatedAccountAddress:n(),ownerTokenMintAddress:n(),walletAddress:n(),tokenProgram:n()},data:Yg().decode(e.data)}}}}},Hm=e=>{const{programAddress:t}=e,n={...e,dataBase58:Ps().decode(e.data??new Uint8Array)};try{const r=Gm[t];if(!r)throw new Error("Unsupported program address");const{identifier:o,typeToParserMap:i,instructionEnum:a}=r,s=o(e),c=a[s],u=i[s];if(!u)throw new Error("Unsupported instruction type");return{type:c,encoded:n,parsed:u(e)}}catch(e){return{type:"Unknown",encoded:n,parsed:null}}};function Zm(e){const{type:t,id:n,address:r,options:o,methods:i,scopes:a}=e;return{type:t,id:n,address:r,options:o,methods:i,scopes:a}}const Jm={accountSubscribe:"accountUnsubscribe",programSubscribe:"programUnsubscribe",signatureSubscribe:"signatureUnsubscribe"},Ym=H(["processed","confirmed","finalized"]),Qm=ge(re(),/^(?:0x)?[0-9a-f]+$/iu);ge(re(),/^0x[0-9a-f]+$/iu),ge(re(),/^0x[0-9a-f]{40}$/u),ge(re(),/^0x[0-9a-fA-F]{40}$/u);function Xm(e){Wo(function(e){return j(e,Qm)}(e),"Value must be a hexadecimal string.")}function ey(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}n(1048).hp;const ty=48,ny=58,ry=87;!function(){const e=[]}();function oy(e){if("0x"===e?.toLowerCase?.())return new Uint8Array;Xm(e);const t=ey(e).toLowerCase(),n=t.length%2==0?t:`0${t}`,r=new Uint8Array(n.length/2);for(let e=0;e<r.length;e++){const t=n.charCodeAt(2*e),o=n.charCodeAt(2*e+1),i=t-(t<ny?ty:ry),a=o-(o<ny?ty:ry);r[e]=16*i+a}return r}async function iy({entropySource:e,derivationPath:t}){Gl.log({derivationPath:t},"Generating solana wallet"),M(t,Ad);const n=t.split("/");try{const t=await async function({entropySource:e,path:t,curve:n}){return await snap.request({method:"snap_getBip32Entropy",params:{path:t,curve:n,...e?{source:e}:{}}})}({entropySource:e,path:n,curve:"ed25519"});if(!t.privateKey||!t.publicKey)throw new Error("Unable to derive private key");return{privateKeyBytes:oy(t.privateKey),publicKeyBytes:oy(t.publicKey)}}catch(e){throw Gl.error({error:e},"Error deriving keypair"),new Error(e)}}const ay=e=>JSON.parse(JSON.stringify(e),((e,t)=>t?"undefined"!==t.__type?"BigNumber"===t.__type?new _o(t.value):"bigint"===t.__type?BigInt(t.value):"Uint8Array"===t.__type?js().encode(t.value):t:void 0:t)),sy=e=>(0,_d.cloneDeepWith)(e,(e=>void 0===e?{__type:"undefined"}:e instanceof _o?{__type:"BigNumber",value:e.toString()}:"bigint"==typeof e?{__type:"bigint",value:e.toString()}:e instanceof Uint8Array?{__type:"Uint8Array",value:js().decode(e)}:void 0)),cy="send-form",uy="confirm-sign-and-send-transaction";async function ly(e,t){const n=sy(t);return snap.request({method:"snap_createInterface",params:{ui:e,context:n}})}async function dy(e,t,n){const r=sy(n);return snap.request({method:"snap_updateInterface",params:{id:e,ui:t,context:r}})}async function fy(e,t){return snap.request({method:"snap_resolveInterface",params:{id:e,value:t}})}async function hy(e){return snap.request({method:"snap_dialog",params:{id:e}})}async function py(){return snap.request({method:"snap_getPreferences"})}async function gy(e){const t=await async function(e){const t=await snap.request({method:"snap_getInterfaceContext",params:{id:e}});return t?ay(t):null}(e);if(!t)throw new Error("Interface context not found");return t}var my=function(e){return e.GetGenesisHash="getGenesisHash",e.GetLatestBlockhash="getLatestBlockhash",e.GetMinimumBalanceForRentExemption="getMinimumBalanceForRentExemption",e}({});const yy=ee({jsonrpc:mf,id:yf,method:J("getGenesisHash"),params:te(K())}),vy=ee({jsonrpc:mf,id:yf,method:J("getLatestBlockhash")}),wy=ee({jsonrpc:mf,id:yf,method:J("getMinimumBalanceForRentExemption"),params:oe([X(),te(ee())])});var Ay,by=function(e){return e.StartSendTransactionFlow="startSendTransactionFlow",e.GetFeeForTransaction="getFeeForTransaction",e}({}),Sy=function(e){return e.ListWebSockets="listWebSockets",e.ListSubscriptions="listSubscriptions",e.TestOnStart="testOnStart",e.TestOnInstall="testOnInstall",e.TestOnUpdate="testOnUpdate",e.SynchronizeAccounts="synchronizeAccounts",e}({});!function(e){e[e.Millisecond=1]="Millisecond",e[e.Second=1e3]="Second",e[e.Minute=6e4]="Minute",e[e.Hour=36e5]="Hour",e[e.Day=864e5]="Day",e[e.Week=6048e5]="Week",e[e.Year=31536e6]="Year"}(Ay=Ay||(Ay={}));const Ey={production:[Xl.Mainnet],local:[Xl.Mainnet],test:[Xl.Localnet]},ky=de(K(cd),re(),(e=>e.split(","))),Iy=de(K(re()),re(),(e=>e.split(","))),Ty=ee({ENVIRONMENT:H(["local","test","production"]),RPC_URL_MAINNET_LIST:ky,RPC_URL_DEVNET_LIST:ky,RPC_URL_TESTNET_LIST:ky,RPC_URL_LOCALNET_LIST:Iy,RPC_WEB_SOCKET_URL_MAINNET:cd,RPC_WEB_SOCKET_URL_DEVNET:cd,RPC_WEB_SOCKET_URL_TESTNET:cd,RPC_WEB_SOCKET_URL_LOCALNET:cd,EXPLORER_BASE_URL:cd,PRICE_API_BASE_URL:cd,TOKEN_API_BASE_URL:cd,STATIC_API_BASE_URL:cd,SECURITY_ALERTS_API_BASE_URL:cd,NFT_API_BASE_URL:cd,LOCAL_API_BASE_URL:re()});class _y{#l;constructor(){const e=this.#d();this.#l=this.#f(e)}#d(){return z({ENVIRONMENT:"production",RPC_URL_MAINNET_LIST:"https://solana-mainnet.infura.io/v3/5b98a22672004ef1bf40a80123c5c48d",RPC_URL_DEVNET_LIST:"https://solana-devnet.infura.io/v3/5b98a22672004ef1bf40a80123c5c48d",RPC_URL_TESTNET_LIST:"https://api.testnet.solana.com",RPC_URL_LOCALNET_LIST:"http://localhost:8899",RPC_WEB_SOCKET_URL_MAINNET:"wss://solana-mainnet.infura.io/ws/v3/5b98a22672004ef1bf40a80123c5c48d",RPC_WEB_SOCKET_URL_DEVNET:"wss://solana-devnet.infura.io/ws/v3/5b98a22672004ef1bf40a80123c5c48d",RPC_WEB_SOCKET_URL_TESTNET:"wss://api.testnet.solana.com",RPC_WEB_SOCKET_URL_LOCALNET:"wss://localhost:8899",EXPLORER_BASE_URL:"https://solscan.io",PRICE_API_BASE_URL:"https://price.api.cx.metamask.io",TOKEN_API_BASE_URL:"https://tokens.api.cx.metamask.io",STATIC_API_BASE_URL:"https://static.cx.metamask.io",SECURITY_ALERTS_API_BASE_URL:"https://security-alerts.api.cx.metamask.io",LOCAL_API_BASE_URL:"http://localhost:8899",NFT_API_BASE_URL:"https://nft.api.cx.metamask.io"},Ty)}#f(e){return{environment:e.ENVIRONMENT,networks:[{...id[Xl.Mainnet],rpcUrls:e.RPC_URL_MAINNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_MAINNET},{...id[Xl.Devnet],rpcUrls:e.RPC_URL_DEVNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_DEVNET},{...id[Xl.Testnet],rpcUrls:e.RPC_URL_TESTNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_TESTNET},{...id[Xl.Localnet],rpcUrls:e.RPC_URL_LOCALNET_LIST,webSocketUrl:e.RPC_WEB_SOCKET_URL_LOCALNET}],explorerBaseUrl:e.EXPLORER_BASE_URL,activeNetworks:Ey[e.ENVIRONMENT],priceApi:{baseUrl:"test"===e.ENVIRONMENT?e.LOCAL_API_BASE_URL:e.PRICE_API_BASE_URL,chunkSize:50,cacheTtlsMilliseconds:{fiatExchangeRates:Ay.Minute,spotPrices:Ay.Minute,historicalPrices:Ay.Minute}},tokenApi:{baseUrl:"test"===e.ENVIRONMENT?e.LOCAL_API_BASE_URL:e.TOKEN_API_BASE_URL,chunkSize:50},staticApi:{baseUrl:e.STATIC_API_BASE_URL},transactions:{storageLimit:10},securityAlertsApi:{baseUrl:"test"===e.ENVIRONMENT?e.LOCAL_API_BASE_URL:e.SECURITY_ALERTS_API_BASE_URL},nftApi:{baseUrl:"test"===e.ENVIRONMENT?e.LOCAL_API_BASE_URL:e.NFT_API_BASE_URL,cacheTtlsMilliseconds:{listAddressSolanaNfts:Ay.Minute,getNftMetadata:Ay.Minute}},subscriptions:{maxReconnectAttempts:5,reconnectDelayMilliseconds:Ay.Second,closeConnectionsGracePeriodMilliseconds:5*Ay.Minute}}}get(){return this.#l}getNetworkBy(e,t){const n=this.get().networks.find((n=>n[e]===t));if(!n)throw new Error(`Network ${e} not found`);return n}}const xy=(new _y).get(),Cy=["local","test"].includes(xy.environment),Ry=Cy?["http://localhost:3000"]:["https://portfolio.metamask.io"],Py=Cy?new Set([Ht.ListAccounts,Ht.GetAccount,Ht.CreateAccount,Ht.FilterAccountChains,Ht.DeleteAccount,Ht.DiscoverAccounts,Ht.GetAccountBalances,Ht.SubmitRequest,Ht.ListAccountTransactions,Ht.ListAccountAssets,by.StartSendTransactionFlow,by.GetFeeForTransaction,my.GetGenesisHash,my.GetLatestBlockhash,qd.SignAndSendTransactionWithoutConfirmation,Sy.ListWebSockets,Sy.ListSubscriptions,Sy.TestOnStart,Sy.TestOnInstall,Sy.TestOnUpdate,Sy.SynchronizeAccounts]):new Set([]),Ny=new Set([Ht.ListAccounts,Ht.GetAccount,Ht.CreateAccount,Ht.DeleteAccount,Ht.DiscoverAccounts,Ht.GetAccountBalances,Ht.SubmitRequest,Ht.ListAccountTransactions,Ht.ListAccountAssets,Ht.ResolveAccountAddress,by.StartSendTransactionFlow,by.GetFeeForTransaction,qd.SignAndSendTransactionWithoutConfirmation]),By=new Map([]);for(const e of Ry)By.set(e,Py);By.set("metamask",Ny);const Oy=(e,t)=>{if(!e)throw new oo("Origin not found");if(!By.get(e)?.has(t))throw new oo("Permission denied")};function My(e,t){try{M(e,t)}catch(e){throw new Gr(e.message)}}function zy(e,t){try{M(e,t)}catch(e){throw new $r("Invalid Response")}}var jy=function(e){return e.OnTransactionAdded="onTransactionAdded",e.OnTransactionApproved="onTransactionApproved",e.OnTransactionRejected="onTransactionRejected",e.OnSyncAccountTransactions="onSyncAccountTransactions",e.RefreshSend="refreshSend",e.RefreshConfirmationEstimation="refreshConfirmationEstimation",e.CloseWebSocketConnections="closeWebSocketConnections",e}({});const Uy=ee({...St.schema,scope:gd,request:Qf}),Dy=ee({scopes:pe(K(gd)),entropySource:re(),groupIndex:he(X(),0)});function Ly(e,t){return new _o(e.toString()).div(10**t).toFixed()}function Fy(e){return e.split("/")[0]}function $y(e,t){return`${e}/token:${t}`}class qy{#i;#h;#p;#g;#m;#y;#v;#w;#A;static cacheTtlsMilliseconds={tokenAccountsByOwner:5*Ay.Second};constructor({connection:e,logger:t,configProvider:n,assetsRepository:r,tokenMetadataService:o,tokenPricesService:i,cache:a,nftApiClient:s}){this.#i=Kl(t,"[🪙 AssetsService]"),this.#h=e,this.#p=n,this.#g=r,this.#m=o,this.#y=i,this.#v=a,this.#w=s,this.#A=n.get().activeNetworks}#b(e){return{nativeAssetTypes:e.filter((e=>e.endsWith(rd.SOL))),tokenAssetTypes:e.filter((e=>e.includes("/token:"))),nftAssetTypes:e.filter((e=>e.includes("/nft:")))}}#S(e){const t={};for(const n of e){const{chain:{namespace:e,reference:r},assetNamespace:o,assetReference:i}=Fo(n);t[n]={name:"Solana",symbol:"SOL",fungible:!0,iconUrl:`${this.#p.get().staticApi.baseUrl}/api/v2/tokenIcons/assets/${e}/${r}/${o}/${i}.png`,units:[{name:"Solana",symbol:"SOL",decimals:9}]}}return t}async#E(e){return await this.#m.getTokensMetadata(e)}async#k(e){const t=await this.#w.getNftsMetadata(e.map((e=>{const{assetReference:t}=Fo(e);return t}))),n={};return e.forEach(((e,r)=>{const o=t[r];if(!o)return;const i={name:o.name,symbol:o.name,imageUrl:o.imageUrl,description:o.description,fungible:!1,isPossibleSpam:!1,attributes:Object.fromEntries(o.attributes.map((e=>[e.key,e.value]))),collection:{name:o.collectionName,address:o.onchainCollectionAddress,symbol:o.collectionSymbol,tokenCount:o.collectionCount,creator:"",imageUrl:o.collectionImageUrl??""}};n[e]=i})),n}async getAssetsMetadata(e){this.#i.log("Fetching metadata for assets",e);const{nativeAssetTypes:t,tokenAssetTypes:n,nftAssetTypes:r}=this.#b(e),[o,i]=await Promise.all([this.#S(t),this.#E(n)]);return{...o,...i}}async#I(e,t=[Wh,Lp],n=[Xl.Mainnet]){if(0===t.length||0===n.length)return[];const r=e.flatMap((e=>t.flatMap((t=>n.map((n=>({account:e,programId:t,scope:n}))))))),o=Zl(this.#T.bind(this),this.#v,{functionName:"AssetsService:fetchTokenAccounts",ttlMilliseconds:qy.cacheTtlsMilliseconds.tokenAccountsByOwner,generateCacheKey:(e,t)=>{const[n,r,o]=t;return`${e}:${n.id}:${r}:${o}`}});return(await Promise.allSettled(r.map((async({account:e,programId:t,scope:n})=>await o(e,t,n))))).flatMap((e=>"fulfilled"===e.status?e.value:[]))}async#T(e,t=Wh,n=Xl.Mainnet){return(await this.#h.getRpc(n).getTokenAccountsByOwner(Hs(e.address),{programId:t},{encoding:"jsonParsed"}).send()).value.map((t=>({token:t,scope:n,assetType:$y(n,t.account.data.parsed.info.mint),keyringAccount:e})))}async fetch(e){const[t,n]=await Promise.all([this.#_(e),this.#I([e],[Wh,Lp],this.#A)]),r=await this.#m.getTokensMetadata(n.map((e=>e.assetType)));return[...t,...n.filter((e=>e.assetType.includes("/token:"))).map((e=>{const{assetType:t}=e,{decimals:n,amount:o,uiAmountString:i}=e.token.account.data.parsed.info.tokenAmount;return{assetType:t,keyringAccountId:e.keyringAccount.id,network:e.scope,mint:e.token.account.data.parsed.info.mint,pubkey:e.token.pubkey,symbol:r[t]?.symbol??"UNKNOWN",decimals:n,rawAmount:o,uiAmount:i??Ly(o,n)}}))]}getNativeAssetTypes(){return this.#A.map((e=>`${e}/${rd.SOL}`))}async#_(e){const t=this.getNativeAssetTypes(),n=Hs(e.address),r=t.map((async t=>{const r=await this.#h.getRpc(Fy(t)).getBalance(n).send();return{assetType:t,keyringAccountId:e.id,network:Fy(t),address:n,symbol:"SOL",decimals:9,rawAmount:r.value.toString(),uiAmount:Ly(r.value,9)}}));return(await Promise.allSettled(r)).flatMap((e=>"fulfilled"===e.status?e.value:[]))}async#x(e,t){const n=Hs(e.address),r=await this.#w.listAddressSolanaNfts(n),o={};for(const e of t){const{assetReference:t}=Fo(e),n=r.find((e=>e.tokenAddress===t));n&&(o[e]={unit:n.nftToken.name,amount:n.balance.toString()})}return o}async fetchAssetsMarketData(e){this.#i.info("Fetching market data for assets",e);return await this.#y.getMultipleTokensMarketData(e)}async save(e){await this.saveMany([e])}async saveMany(e){this.#i.info("Saving assets",e);const t=e=>"0"===e.rawAmount,n=e=>!t(e),r=await this.getAll();await this.#g.saveMany(e);const o=e=>!r.find((t=>t.keyringAccountId===e.keyringAccountId&&t.assetType===e.assetType)),i=e=>{const n=r.find((t=>t.keyringAccountId===e.keyringAccountId&&t.assetType===e.assetType));return n&&t(n)},a=e=>e.assetType.includes(rd.SOL),s=e.reduce(((e,r)=>({...e,[r.keyringAccountId]:{added:[...e[r.keyringAccountId]?.added??[],...(o(r)||i(r))&&n(r)?[r.assetType]:[]],removed:[...e[r.keyringAccountId]?.removed??[],...t(r)&&!a(r)?[r.assetType]:[]]}})),{});Object.values(s).map((e=>e.added.length+e.removed.length)).every((e=>0===e))||await vn(snap,gn.AccountAssetListUpdated,{assets:s});const c=e.filter(n).filter((e=>qy.hasChanged(e,r))).reduce(((e,t)=>({...e,[t.keyringAccountId]:{...e[t.keyringAccountId]??{},[t.assetType]:{unit:t.symbol,amount:t.uiAmount}}})),{});Object.values(c).map((e=>Object.keys(e).length)).every((e=>0===e))||await vn(snap,gn.AccountBalancesUpdated,{balances:c})}static hasChanged(e,t){const n=t.find((t=>t.keyringAccountId===e.keyringAccountId&&t.assetType===e.assetType));return!n||n.rawAmount!==e.rawAmount}async getAll(){return this.#g.getAll()}async findByAccount(e){const{id:t,address:n}=e,r=await this.#g.findByKeyringAccountId(t),o=this.getNativeAssetTypes(),i=[];for(const t of o){if(!r.some((e=>e.assetType===t))){const r=Fy(t);i.push({assetType:t,keyringAccountId:e.id,network:r,address:n,symbol:"SOL",decimals:9,rawAmount:"0",uiAmount:"0"})}}return[...r,...i]}}const Wy=(e,t)=>{const{to:n,type:r,status:o}=e,{address:i}=t;if(!(r===_t.Receive||o===Tt.Failed))return!1;const{hasReceivedSOL:a,receivedSOLAmount:s}=n.reduce(((e,t)=>t.address!==i||!t.asset?.fungible||t.asset.type!==ed.SolMainnet&&t.asset.type!==ed.SolDevnet?e:{hasReceivedSOL:!0,receivedSOLAmount:e.receivedSOLAmount.plus(t.asset.amount)}),{hasReceivedSOL:!1,receivedSOLAmount:new _o(0)});return a&&s.isLessThan(.001)};function Vy({scope:e,transactionData:t}){const n=function(e){const t=new _o(e.meta?.fee?.toString()??"0");return t.dividedBy(Yl)}(t),r=function(e){const t=e.transaction.signatures.length;return _o(5e3).dividedBy(Yl).multipliedBy(t)}(t),o=n.minus(r),i=[{type:"base",asset:{fungible:!0,type:id[e].nativeToken.caip19Id,unit:id[e].nativeToken.symbol,amount:r.toString()}}];return o?.isGreaterThan(0)&&i.push({type:"priority",asset:{fungible:!0,type:id[e].nativeToken.caip19Id,unit:id[e].nativeToken.symbol,amount:o.toString()}}),i}function Ky({scope:e,transactionData:t}){const n=Vy({scope:e,transactionData:t}),r=[],o=[],i=new Map(t.meta?.preBalances?.map(((e,t)=>[t,new _o(e.toString())]))??[]),a=new Map(t.meta?.postBalances?.map(((e,t)=>[t,new _o(e.toString())]))??[]),s=[...t.transaction.message.accountKeys,...t.meta?.loadedAddresses?.writable??[],...t.meta?.loadedAddresses?.readonly??[]],c=new Set([...Array.from(i.keys()),...Array.from(a.keys())]);for(const n of c){const c=s[n]?.toString();if(!c)continue;const u=i.get(n)??new _o(0),l=a.get(n)??new _o(0),d=0===n?Fd(t.meta?.fee??0):new _o(0),f=u.minus(l).dividedBy(new _o(Yl)).minus(d);if(f.isZero())continue;const h=f.absoluteValue().toString();u.isGreaterThan(l)&&r.push({address:c,asset:{fungible:!0,type:id[e].nativeToken.caip19Id,unit:id[e].nativeToken.symbol,amount:h}}),u.isLessThan(l)&&o.push({address:c,asset:{fungible:!0,type:id[e].nativeToken.caip19Id,unit:id[e].nativeToken.symbol,amount:h}})}const u=function({scope:e,transactionData:t}){const{instructions:n}=t.transaction.message,r=[],o=[],i=t.transaction.message.accountKeys.findIndex((e=>e===El));if(-1===i)return{from:r,to:o};return n.forEach((n=>{const{accounts:a,data:s,programIdIndex:c}=n;if(c!==i)return;const[u,l]=a;if(void 0===u||void 0===l||u!==l)return;const d=t.transaction.message.accountKeys[u],f=t.transaction.message.accountKeys[l];if(!d||!f||d!==f)return;const h=function(e){let t=BigInt(0);for(let n=4;n<12;n++)t|=BigInt(e[n]??0)<<BigInt(8*(n-4));return _o(t.toString()).dividedBy(Yl)}(zd.decode(s));r.push({address:d,asset:{amount:h.toString(),fungible:!0,type:id[e].nativeToken.caip19Id,unit:id[e].nativeToken.symbol}}),o.push({address:f,asset:{amount:h.toString(),fungible:!0,type:id[e].nativeToken.caip19Id,unit:id[e].nativeToken.symbol}})})),{from:r,to:o}}({scope:e,transactionData:t});return u.from.length>0&&r.push(...u.from),u.to.length>0&&o.push(...u.to),{fees:n,from:r,to:o}}function Gy({scope:e,transactionData:t}){const n=Vy({scope:e,transactionData:t}),r=[...t.transaction.message.accountKeys,...t.meta?.loadedAddresses?.writable??[],...t.meta?.loadedAddresses?.readonly??[]],o=[],i=[],{instructions:a}=t.transaction.message;a.forEach((t=>{const{accounts:n,data:a,programIdIndex:s}=t;if(r[s]!==El)return;const[c,u]=n;if(void 0===c||void 0===u)return;const l=r[c],d=r[u];if(!l||!d)return;const f=zd.decode(a),h=function(e){let t=BigInt(0);for(let n=0;n<4;n++)t|=BigInt(e[n]??0)<<BigInt(8*n);return Number(t)}(f);if(2!==h)return;const p=function(e){let t=BigInt(0);for(let n=4;n<12;n++)t|=BigInt(e[n]??0)<<BigInt(8*(n-4));return _o(t.toString()).dividedBy(Yl)}(f);o.push({address:l,asset:{amount:p.toString(),fungible:!0,type:id[e].nativeToken.caip19Id,unit:id[e].nativeToken.symbol}}),i.push({address:d,asset:{amount:p.toString(),fungible:!0,type:id[e].nativeToken.caip19Id,unit:id[e].nativeToken.symbol}})}));return{fees:n,from:Hy(o),to:Hy(i)}}function Hy(e){return e.reduce(((e,t)=>{const n=e.find((e=>!0===e?.asset?.fungible&&!0===t.asset?.fungible&&e.asset.type===t.asset.type&&e.address===t.address));if(n&&!0===n.asset?.fungible&&!0===t.asset?.fungible){const e=new _o(n.asset.amount).plus(t.asset.amount);n.asset.amount=e.toString()}else e.push(t);return e}),[])}function Zy({scope:e,transactionData:t}){const n=[],r=[],o=new Map(t.meta?.preTokenBalances?.map((e=>[e.accountIndex,new _o(e.uiTokenAmount.amount)]))??[]),i=new Map(t.meta?.postTokenBalances?.map((e=>[e.accountIndex,new _o(e.uiTokenAmount.amount)]))??[]),a=new Set([...t.meta?.preTokenBalances?.map((e=>e.accountIndex))??[],...t.meta?.postTokenBalances?.map((e=>e.accountIndex))??[]]);for(const s of a){const a=o.get(s)??new _o(0),c=(i.get(s)??new _o(0)).minus(a);if(c.isZero())continue;const u=t.meta?.preTokenBalances?.find((e=>e.accountIndex===s))??t.meta?.postTokenBalances?.find((e=>e.accountIndex===s));if(!u)continue;const{mint:l,uiTokenAmount:{decimals:d},owner:f}=u,h=$y(e,l);if(!f)continue;const p=c.absoluteValue().dividedBy(new _o(10).pow(d)).toString();c.isNegative()&&n.push({address:f,asset:{fungible:!0,type:h,unit:"",amount:p}}),c.isPositive()&&r.push({address:f,asset:{fungible:!0,type:h,unit:"",amount:p}})}const s=function({scope:e,transactionData:t}){const{instructions:n}=t.transaction.message,r=[],o=[],i=n.map((e=>function(e,t){const n=e=>e<t.transaction.message.accountKeys.length,r=e.accounts.filter(n).map((e=>({address:t.transaction.message.accountKeys[e],role:0}))),o=t.transaction.message.accountKeys[e.programIdIndex];if(!o)throw new Error("Program address not found");const i={accounts:r,data:Ps().encode(e.data),programAddress:o};return i}(e,t))).map(Hm).filter(Jy);return i.forEach((n=>{const i=(0,_d.get)(n,"parsed.accounts.authority.address"),a=(0,_d.get)(n,"parsed.accounts.source.address");if(!i||!a)return;const s=t.transaction.message.accountKeys.indexOf(Hs(a)),{mint:c,uiTokenAmount:{decimals:u}={}}=t.meta?.preTokenBalances?.find((e=>e.accountIndex===s))??{};if(!c||void 0===u)return;const l=n.parsed?.data.amount,d=_o(l).dividedBy(new _o(10).pow(u)).toString(),f=$y(e,c);r.push({address:i,asset:{amount:d,fungible:!0,type:f,unit:""}}),o.push({address:i,asset:{amount:d,fungible:!0,type:f,unit:""}})})),{from:r,to:o}}({scope:e,transactionData:t});return s.from.length>0&&n.push(...s.from),s.to.length>0&&r.push(...s.to),{from:n,to:r}}function Jy(e){if("Transfer"!==e.type&&"TransferChecked"!==e.type)return!1;if(!e.parsed)return!1;const{source:t,destination:n,authority:r}=e.parsed.accounts??{};return!!(t&&n&&r)&&t.address===n.address}function Yy({transactionData:e,account:t,scope:n}){try{const{blockTime:r}=e,{id:o,address:i}=t,a=e.transaction.signatures[0];if(!a)throw new Error("Transaction ID is required");const s=Number(r),c=function(e){const t=e.meta?.err||e.meta?.status&&"Err"in e.meta.status,n=t?Tt.Failed:Tt.Confirmed;return n}(e);let u=[],l=[],d=[];const f=(c===Tt.Failed?Gy:Ky)({scope:n,transactionData:e});u=f.fees,l=f.from,d=f.to;const{from:h,to:p}=Zy({scope:n,transactionData:e});let g=[...h,...l],m=[...p,...d];const y=function({address:e,status:t,from:n,to:r}){if(0===n.length||0===r.length||t===Tt.Failed)return _t.Unknown;const o=n.filter((t=>t.address===e)),i=r.filter((t=>t.address===e)),a=o.length>0,s=i.length>0,c=n.every((t=>r.some((n=>n.address===e&&!0===t.asset?.fungible&&!0===n.asset?.fungible&&t.asset.type===n.asset.type)))),u=r.every((t=>n.some((n=>n.address===e&&!0===n.asset?.fungible&&!0===t.asset?.fungible&&n.asset.type===t.asset.type)))),l=c&&u;if(l)return _t.Send;if(a&&s)return _t.Swap;if(a)return _t.Send;return _t.Receive}({address:Hs(i),status:c,from:g,to:m});return y===_t.Swap&&(g=g.filter((e=>e.address===i)),m=m.filter((e=>e.address===i))),y===_t.Receive&&(m=m.filter((e=>e.address===i)),u=[]),{id:a,account:o,timestamp:s,chain:n,status:c,type:y,from:g,to:m,fees:u,events:[{status:c,timestamp:s}]}}catch(e){return Gl.warn(e,"Error mapping transaction"),null}}function Qy(e,t,n){if("string"==typeof e)throw new Error(`An HTML element ("${String(e)}") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`);if(!e)throw new Error("A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.");return e({...t,key:n})}function Xy(e,t,n){return Qy(e,t,n)}const ev='<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><image width="16" height="16" href="data:image/png;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAUFBQUFBQUGBgUICAcICAsKCQkKCxEMDQwNDBEaEBMQEBMQGhcbFhUWGxcpIBwcICkvJyUnLzkzMzlHREddXX0BBQUFBQUFBQYGBQgIBwgICwoJCQoLEQwNDA0MERoQExAQExAaFxsWFRYbFykgHBwgKS8nJScvOTMzOUdER11dff/CABEIAPoA+gMBIgACEQEDEQH/xAA1AAEAAwEBAQEBAAAAAAAAAAAAAQIHBggEBQMBAQADAQEBAQAAAAAAAAAAAAACAwQBBQYH/9oADAMBAAIQAxAAAADxkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACx204cU3mdnnYLG+IQwNvsxhgLfrRh5/egLRh59egkYefXoRCPn6mv5BH2ajuwAAAACZdFZz6/SvzfofWfLWtS2jw7WpNGO01mjJaas+P+k0tRjtNbUY38Leccnq/DxFq5f2ao7cAAAAB+36W8/9p7+DZZxp6nl7LOM3qzbLOMqs2zzjF6suyzjNqqNlnGrU5NkY7zlHP75Wjzv0mg5pAAAAAAs6jqdsMuajacMsam5HLGqORytqkxjlTVbc5lLVpjDKGsfhQlwdb1p3QAAAAAADofSXk7q/cp9MT8n0/cebe1Jpx2tS2fJNqTRkvNLUY7TWaMdqXZ8vnHPvZHmrw/u+JTGL6EAAAAABMDuvQvkLQfo6PQU55P0WLRJztTl0Sc7U5tFnOppzaOzmacujTnSrLo3x8NNFOM8zsuM+H99Aq2AAAAAATMfpWPznbNXOJdqjHi47Wec4l2jnOLdo5zi57JFxrsp5HjadRy9d0CMgAAAAJPqm+j0X8fW/oV82rPvUWRNGObUmjHe1LUZLIUY7TDPk/opk2CP5uPy+U+1qKrwAAAAPo3zPdc+23fu2/BfYXdA/AmjL+/bn1GToZ55Tl6KedmjJ0c87anL0LnuZyUTgH9fm+Q9+Bk0AAAAAAWVdWVFlRZUWVFpo4uoLxV0HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH//EAEEQAAECAwQHBAgDBgcBAAAAAAECBAADBgURF1UQMUFRkpPSEiFSohYgIjBAYaPiBzLBEyRUYnCRFBVDRYGhstH/2gAIAQEAAT8A/qXdF0XRd8ou9a4R3aOz8AO+KUo95Uc1SyoyGcs+3OIvvPhQDrMYUWPmbzhRGFFj5m74URhRY2Zu+FEYT2NmbvhRGE1jZm84URhNY2ZvOFEYTWNmjzhRGEti5o84URhLYuaPP7IjCWxc0ecKIwksXM3nCiMJLFzN5wojCSxczd/2RGEliZm8/siKt/DthYNkTLRbWlNUqWtIKJwA7Xa8JHwFK0w6qN6EJvQ1lkGfO2AeEb1HZDRq2YNpLVrJTLkyk9lCAO4D9TtJ2nQIv0C/QDAOgGL9Lp22Yt5rl1NTLky03rWrUB+p+W2KyqubUr72SpDOSSJEonzKHiPv6dsB7UT1LduLkJuM2afyy0bzvO4RZdmtbIZSGTRHZlS069qlbVK3k6AYGkQDA0DQDonTpTaVMnTpqUSkJKlrUbkhI1kmK3rJdQuRIaKUiz5BPYB7jMV41CD3++sWx3ltv5LNqm9au9Sj+VCRrUo7hFg2IzsBhLZthftmzCO+Yvao7vkNA0AxfA0A6RAMCCpKUqJUAALySbgBFeVsLXUuzbPWQxQr25m2coH/AMiFa/f0rVK6ZmO1hkiemehIIKuwoFBvFyrjGLByIc89MYsnIxz/ALIxZORjn/ZGLJyMc89MYspyP6/2xi0nIvr/AGxi2nI/r/bGLYyL6/2xi5LyM8/7Yxbl5Gef9sYuSsjPPHTGLkrI1c8dMYuSMjXzh0xi63yRfOHTFR/iO9tpktk1bBpJWLpp7fbWtPh1CCTBJPwN3udfqk6vgKcph7Ui3KW02VKEhIK1zL9atQFwJjCu1szZ+fpjCy18zZ+fpjCu1syZefpjCu1syZefpjCq18yZ+fpjCq18yZ+fpjCm18zZ+fpjCi1s0Z+fpjCe1szZ+fpjCe1s0Z+fpjCa180Z+fpjCa1szZ+fpjCa1szZefpjCW1s0Zefpi36Etan2gdrVKcSAblqlX+wTvBAMKB7ou9/T9vPKffJctriki6bLP5Vo3H9DFl2m1tdlIetV9qXMGralW1KtxGgGAYvgQDoBi+L9A0TZUtxKmSp0tK5cwFK0K7wUnWCIrWjlU+4DltethOPsE95lK8CjB+ApipnVPPAtN62yyBPk7FDeNyhsMNHbZ+2kum04TJMxPaSobR+hG0bIEXwDpB0AwIHqO2rZ+2nNXMlM2TMR2VoVqI/Q7jsisKWn049ISVTGc4kyJvy1lCvmII9+DdFH1VNsB0JThalMJyh+1RrKD40jeIkzpLiVLnSZqZkqYkKQtJvSUnUQdAOi+BF+gHQNA0WjZzO1Wc5m8lCZKmC4jaDsUk7FDYYqWnHtOv1t56SqUq8yJwHctH/ANG2B78G4xR1ZKsLttXiVzGSzeAk3mUraUg6wdojEum9zzkp64xMprc85KeuMTKa8Lzkp64xMprwvOSnrjE2mvC85KeuMTaa8LzlJ64xNprwveSnrjE6mvC95KeuMT6Z3POSnrjE+mdzzlJ6oxOpnc85Q6oxPpjc85SeqMT6YOx5yU9cYn0xue8lPXFY1tYFuWKtk1kT1zzNQpCpqAkIuPeoHtHX8APWv9S+L4vGjVo/4+Bs6zHtquA3ZN1TphBNydgG0k9wEYfVR/Ao5qIw9qj+BRzURh/VWXDmojD6qsuHNRGH1VZcOaiMPqqy4c1EYf1Xlf1ZfVGH9WZX9VHVGH1WZX9WX1Rh9VeWfVl9UYf1blJ5qOqMP6tyo81HVGH1W5T9VHVGH1XZSeajqi0qSt+yGxdPrPXLkhQSV9pKgCd/ZJ+As6z3dpu5LVrKMybMNwA/7JOwDaYpun29PMBIRcufMuLib41bh/KNnq3iL4ECO6Bd6m0d0fiBWMp6ldj2esKkBX7xOGpage5Cd6RtPvhDRrPeOJTeRKVMnTFBKEDWSYpSmJNPNSVkLezUj9rM2Aa+wn5DadI9QQDovgQNAivK2S2TPsezZl80jsOZwP5AdaE/PeYJJ99KlrmrQhAJWSAABeSdwikaTRYklLp0Ap/MRcdolJOwfPeY1QDov0iBoBi+AdNb1l/k6FWcwX+/LR7ax/oAjZ/OYUpSiSSSSbyT3kn39BubFZv5860ZqJc5KB/h1zPyJO0/JW6PSanh/vTXjj0mp7OmvHAqens6a8celFO501449Kacztrxx6U05nbXjj0ppzPGnHHpTTeeNOOPSqnM8accelVN54044FVU3njTjj0rprPWnHAqums8accelVNZ4044qav7PYNDLsp0hy7mC4LR3oljxE7VbhE+dNcTVzpswrmLUVKUokqJOsknWfgAbovMXnfF/wAzHai+L4vMdo747R3x2jvgKO+O18zHa+cXnfBJ/rX/AP/EADQRAAEDAQUFBAkFAAAAAAAAAAIAAQQDBRIUU5IREzBCVBUjMkMGICExM0RQUqIQImFyof/aAAgBAgEBPwD6pTpnVK6A3iT2fJ+z/U8GQ3InhyG5FhqzcqehUbkW7qfYnE25eBTA6piADeIlCgNFD2/ELxIhRCiFEKIUQqq93gWXXs+NT3lQu+/qitWC/m/i6e04b+annxcxFOi5iKZGfmRSo78yORS2ftJETk+1+BRgTK4bylQMhT2XO6U12ZOb5c12dMyDTwJWQawUnKNYORlIo9YG2vS4NkWoUM92fwS/H+UziY3hRCiFEKIUQog2+9S4z0ivD4eDY9rYd9xXLu+UvtRWlA6oEVowepBFPhZ4IpsPPBFMiZ4IpUbNBHXjG2x6oKsICbsBXh4AAVQhAAvES7Om9Kel1gJnSnpdYGY3y56Vg5TeQelYSVkHpWGkZJ6Vh6+UaISF9hD64iREIj73Vh2Jg6bSKw98X4ohRCiFEKIUQqVWCPTvEq1YqxuRev6Nw4Aji5MgN5yARN7EU6D1YamRTYXVBqZFMh9QGpkUqJ1AamRSonUBqZFJi54amVaXGpgRb0FKlHKqXn8PLwNqvOrzra6vP+u36t//xAA2EQABBAEBAwkECwEAAAAAAAACAAEDBAWiEjFDBhETFDAyQkRSICFBkhYjM1BTVGBhcrHB0f/aAAgBAwEBPwD70llCGMpJC2RT5jHtxtLp85jm42l0/KDFtvsaXT8pMS3mdLp+U+HbzOl0/KvCN5vS6+l+Cbfb0uqOQq5KBp6x7Ufd7rt/ftkTA3O+5ZC0dk9lvsxRgjBGCMEYI41hMBLl7PpgDvn/AIq1aGpBHBCGzGDcw+3binmbZDuosbYfwo8VbfhosNdfhamR4PIPwtTIsBkX4GpkfJzKPug1MoOSuSmmAZI+jDxntMqVOvQrhBCGyI6v3fsHkAX95J7ELeNPbr/GVddqNxl1+m3HBPk6Db7QJ8tjvjaBRZOhNIMYWgci7GWPbZHGjBGCMFJGjBOxCTEKwmYG4HQTF9cOrsZYtv3sjryP4UdSV+EjpWH4SPH2X3QGjxlx+AaPE338qaHFZSIwOOuYkKoS2ZawPZi6OT4/97F3ZOYN4l0sbeNl08P4oJ7EDcUF1mv+YD5l1uq3mA+ZkMkcjc4GxD2DROze9GCMFICMEYIwVelJbl2B3KtWjqxDFHub260cXNtmYI3i9aNg9aMWRx86OE/Qjry+hdSnM+ZgVatHWjYQb+X6F//Z" /></svg>';function tv(e){return Object.fromEntries(Object.entries(e).filter((([,e])=>void 0!==e)))}function nv(e){return t=>{const{key:n=null,...r}=t;return{type:e,props:tv(r),key:n}}}const rv=nv("Container"),ov=nv("Box"),iv=nv("Heading"),av=nv("Text"),sv=nv("Section"),cv=nv("Row"),uv=nv("Address"),lv=nv("Image"),dv=nv("Footer"),fv=nv("Button"),hv=nv("Link");function pv(e,t,n){const{cluster:r}=id[e];return Td({baseUrl:"https://solscan.io",path:`/${t}/${n}`,queryParams:r?{cluster:r}:void 0})}const gv=({domain:e,scope:t,address:n})=>Qy(ov,{direction:"horizontal",alignment:"center",children:Qy(hv,{href:pv(t,"address",n),children:e})});function mv(e,t){return`${e}:${t}`}const yv=JSON.parse('{"D":{"send.title":{"message":"Send"},"send.balance":{"message":"Balance"},"send.maxButton":{"message":"Max"},"send.cancelButton":{"message":"Cancel"},"send.continueButton":{"message":"Continue"},"send.fromField":{"message":"From"},"send.toField":{"message":"To"},"send.amountField":{"message":"Amount"},"send.assetField":{"message":"Token"},"send.toPlaceholder":{"message":"Enter public address or domain name"},"send.fromRequiredError":{"message":"Account is required"},"send.amountRequiredError":{"message":"Amount is required"},"send.amountGreatherThanMinimumBalanceForRentExemptionError":{"message":"Amount must be greater than {minimumValue}"},"send.insuffientSolToCoverFee":{"message":"Insufficient SOL balance to cover the transaction fee"},"send.toRequiredError":{"message":"To address is required"},"send.toInvalidError":{"message":"Invalid Solana address or domain name"},"send.toInvalidErrorDomain":{"message":"Unable to resolve domain name"},"send.toDomainResolutionStatus.initial":{"message":"Domain"},"send.toDomainResolutionStatus.fetching":{"message":"Resolving domain name..."},"send.toDomainResolutionStatus.fetched":{"message":"Domain name resolved."},"send.toDomainResolutionStatus.error":{"message":"Unable to resolve domain name."},"send.insufficientBalance":{"message":"Insufficient balance"},"send.simulationTitleAPIError":{"message":"Because of an error, we couldn\'t check for security alerts."},"send.simulationMessageAPIError":{"message":"Only continue if you trust every address involved."},"send.simulationTitleError":{"message":"Transaction simulation failed"},"send.simulationMessageError":{"message":"This transaction was reverted during simulation."},"send.selectedTokenPriceNotAvailable":{"message":"Prices for tokens in {currency} are currently not available. You are still able to send tokens."},"send.confirmation.title":{"message":"Review"},"send.confirmation.from":{"message":"From"},"send.confirmation.recipient":{"message":"Recipient"},"send.confirmation.network":{"message":"Network"},"send.confirmation.transactionSpeed":{"message":"Transaction speed"},"send.confirmation.fee":{"message":"Network fee"},"send.confirmation.sendButton":{"message":"Send"},"send.confirmation.cancelButton":{"message":"Cancel"},"send.confirmation.viewTransaction":{"message":"View transaction"},"send.send-pending.title":{"message":"Sending..."},"send.send-pending.subtitle":{"message":"Your transaction was submitted."},"send.transaction-success.title":{"message":"Sent"},"send.transaction-success.subtitle":{"message":"{amount} {tokenSymbol} was successfully sent"},"send.transaction-failure.title":{"message":"Transaction failed"},"send.transaction-failure.subtitle":{"message":"Unable to send {amount} {tokenSymbol}"},"confirmation.account":{"message":"Account"},"confirmation.network":{"message":"Network"},"confirmation.estimatedChanges":{"message":"Estimated changes"},"confirmation.estimatedChanges.send":{"message":"You send"},"confirmation.estimatedChanges.receive":{"message":"You receive"},"confirmation.estimatedChanges.notAvailable":{"message":"Not available"},"confirmation.estimatedChanges.noChanges":{"message":"No changes"},"confirmation.estimatedChanges.tooltip":{"message":"Estimated changes are what might happen if you go through with this transaction. This is just a prediction, not a guarantee."},"confirmation.advanced.show":{"message":"Show advanced"},"confirmation.advanced.hide":{"message":"Hide advanced"},"confirmation.cancelButton":{"message":"Cancel"},"confirmation.confirmButton":{"message":"Confirm"},"confirmation.signAndSendTransaction.title":{"message":"Transaction request"},"confirmation.signTransaction.title":{"message":"Signing request"},"confirmation.sendAndConfirmTransaction.title":{"message":"Sending and confirming transaction"},"confirmation.advanced.unknownInstruction":{"message":"Unknown"},"confirmation.advanced.programId":{"message":"Program ID"},"confirmation.advanced.data":{"message":"Data"},"confirmation.fee":{"message":"Network fee"},"confirmation.feeError":{"message":"Unable to estimate fee"},"confirmation.origin":{"message":"Request from"},"confirmation.origin.tooltip":{"message":"This is the site asking for your confirmation."},"confirmation.simulationErrorTitle":{"message":"This transaction was reverted during simulation."},"confirmation.simulationErrorSubtitle":{"message":"{reason}"},"confirmation.validationErrorTitle":{"message":"This is a deceptive request"},"confirmation.validationErrorSubtitle":{"message":"If you approve this request, a third party known for scams will take all your assets."},"confirmation.validationErrorLearnMore":{"message":"Learn more"},"confirmation.validationErrorSecurityAdviced":{"message":"Security advice by"},"confirmation.signMessage.title":{"message":"Sign message"},"confirmation.signMessage.message":{"message":"Message"},"confirmation.signIn.title":{"message":"Sign-in request"},"confirmation.signIn.description":{"message":"A site wants you to sign in to prove you own this account."},"confirmation.signIn.domain":{"message":"Domain"},"confirmation.signIn.unknownDomain":{"message":"Unknown domain"},"confirmation.signIn.signingInWith":{"message":"Signing in with"},"confirmation.signIn.badAccount":{"message":"This site is asking you to sign in using the wrong account."},"confirmation.signIn.message":{"message":"Message"},"confirmation.signIn.statement":{"message":"Statement"},"confirmation.signIn.version":{"message":"Version"},"confirmation.signIn.chainId":{"message":"Chain ID"},"confirmation.signIn.nonce":{"message":"Nonce"},"confirmation.signIn.issuedAt":{"message":"Issued at"},"confirmation.signIn.expirationTime":{"message":"Expiration time"},"confirmation.signIn.notBefore":{"message":"Not before"},"confirmation.signIn.requestId":{"message":"Request ID"},"confirmation.signIn.resources":{"message":"Resources"},"confirmation.signIn.badDomain":{"message":"This site is asking you to sign in using the wrong domain."},"transactionScan.errors.accountAlreadyInUse":{"message":"An account with the same address already exists."},"transactionScan.errors.insufficientSol":{"message":"Account does not have enough SOL to perform the operation."},"transactionScan.errors.slippageToleranceExceeded":{"message":"The transaction was reverted because the slippage tolerance was exceeded."},"transactionScan.errors.unknownError":{"message":"An unknown error occurred."}}}'),vv=JSON.parse('{"D":{"send.title":{"message":"Enviar"},"send.balance":{"message":"Saldo"},"send.maxButton":{"message":"Máx."},"send.cancelButton":{"message":"Cancelar"},"send.continueButton":{"message":"Continuar"},"send.fromField":{"message":"De"},"send.toField":{"message":"Para"},"send.amountField":{"message":"Monto"},"send.assetField":{"message":"Token"},"send.toPlaceholder":{"message":"Introduzca la dirección pública"},"send.fromRequiredError":{"message":"La cuenta es obligatoria"},"send.amountRequiredError":{"message":"El monto es obligatorio"},"send.amountGreatherThanMinimumBalanceForRentExemptionError":{"message":"El valor debe ser superior a {minimumValue}"},"send.insuffientSolToCoverFee":{"message":"Saldo de SOL insuficiente para cubrir la tarifa de transacción"},"send.toRequiredError":{"message":"La dirección del destinatario es obligatoria"},"send.toInvalidError":{"message":"Dirección de Solana no válida"},"send.insufficientBalance":{"message":"Saldo insuficiente"},"send.simulationTitleAPIError":{"message":"Debido a un error, no pudimos verificar las alertas de seguridad."},"send.simulationMessageAPIError":{"message":"Continúa solo si confías en todas las direcciones involucradas."},"send.simulationTitleError":{"message":"Simulación de transacción fallida"},"send.simulationMessageError":{"message":"Esta transacción se revirtió durante la simulación."},"send.selectedTokenPriceNotAvailable":{"message":"Los precios de los tokens en {currency} no están disponibles actualmente. Aún puede enviar tokens."},"send.confirmation.title":{"message":"Revisar"},"send.confirmation.from":{"message":"De"},"send.confirmation.recipient":{"message":"Destinatario"},"send.confirmation.network":{"message":"Red"},"send.confirmation.transactionSpeed":{"message":"Velocidad de la transacción"},"send.confirmation.fee":{"message":"Tarifa de red"},"send.confirmation.sendButton":{"message":"Enviar"},"send.confirmation.cancelButton":{"message":"Cancelar"},"send.confirmation.viewTransaction":{"message":"Ver transacción"},"send.send-pending.title":{"message":"Enviando..."},"send.send-pending.subtitle":{"message":"Se envió su transacción."},"send.transaction-success.title":{"message":"Enviado"},"send.transaction-success.subtitle":{"message":"El envío de {amount} {tokenSymbol} se realizó correctamente"},"send.transaction-failure.title":{"message":"Transacción fallida"},"send.transaction-failure.subtitle":{"message":"Error al enviar {amount} {tokenSymbol}"},"confirmation.account":{"message":"Cuenta"},"confirmation.network":{"message":"Red"},"confirmation.estimatedChanges":{"message":"Cambios estimados"},"confirmation.estimatedChanges.send":{"message":"Usted envía"},"confirmation.estimatedChanges.receive":{"message":"Usted recibe"},"confirmation.estimatedChanges.notAvailable":{"message":"No disponible"},"confirmation.estimatedChanges.noChanges":{"message":"Sin cambios"},"confirmation.estimatedChanges.tooltip":{"message":"Los cambios estimados son los que podrían producirse si sigue adelante con esta transacción. Esto es solo una predicción, no una garantía."},"confirmation.advanced.show":{"message":"Mostrar avanzadas"},"confirmation.advanced.hide":{"message":"Ocultar avanzadas"},"confirmation.cancelButton":{"message":"Cancelar"},"confirmation.confirmButton":{"message":"Confirmar"},"confirmation.signAndSendTransaction.title":{"message":"Solicitud de transacción"},"confirmation.signTransaction.title":{"message":"Signing request"},"confirmation.sendAndConfirmTransaction.title":{"message":"Sending and confirming transaction"},"confirmation.advanced.unknownInstruction":{"message":"Desconocida"},"confirmation.advanced.programId":{"message":"ID del programa"},"confirmation.advanced.data":{"message":"Datos"},"confirmation.fee":{"message":"Tarifa de red"},"confirmation.feeError":{"message":"No se puede calcular la tarifa"},"confirmation.origin":{"message":"Solicitud de"},"confirmation.origin.tooltip":{"message":"This is the site asking for your confirmation."},"confirmation.simulationErrorTitle":{"message":"Esta transacción se revirtió durante la simulación."},"confirmation.simulationErrorSubtitle":{"message":"Motivo: {reason}"},"confirmation.validationErrorTitle":{"message":"Esta es una solicitud engañosa"},"confirmation.validationErrorSubtitle":{"message":"Si aprueba esta solicitud, un tercero conocido por sus estafas se quedará con todos sus activos."},"confirmation.validationErrorLearnMore":{"message":"Conozca más"},"confirmation.validationErrorSecurityAdviced":{"message":"Asesoramiento de seguridad por"},"confirmation.signMessage.title":{"message":"Firmar mensaje"},"confirmation.signMessage.message":{"message":"Mensaje"},"confirmation.signIn.title":{"message":"Solicitud de inicio de sesión"},"confirmation.signIn.description":{"message":"Un sitio quiere que inicie sesión para demostrar que usted es el titular de esta cuenta."},"confirmation.signIn.domain":{"message":"Domain"},"confirmation.signIn.unknownDomain":{"message":"Dominio desconocido"},"confirmation.signIn.signingInWith":{"message":"Iniciar sesión con"},"confirmation.signIn.badAccount":{"message":"Este sitio le pide que inicie sesión con la cuenta incorrecta."},"confirmation.signIn.message":{"message":"Mensaje"},"confirmation.signIn.statement":{"message":"Declaración"},"confirmation.signIn.version":{"message":"Versión"},"confirmation.signIn.chainId":{"message":"ID de cadena"},"confirmation.signIn.nonce":{"message":"Nonce"},"confirmation.signIn.issuedAt":{"message":"Emitido a las"},"confirmation.signIn.expirationTime":{"message":"Hora de caducidad"},"confirmation.signIn.notBefore":{"message":"No antes de"},"confirmation.signIn.requestId":{"message":"ID de solicitud"},"confirmation.signIn.resources":{"message":"Recursos"},"confirmation.signIn.badDomain":{"message":"This site is asking you to sign in using the wrong domain."},"transactionScan.errors.accountAlreadyInUse":{"message":"Ya existe una cuenta con la misma dirección."},"transactionScan.errors.insufficientSol":{"message":"La cuenta no tiene suficiente SOL para realizar la operación."},"transactionScan.errors.slippageToleranceExceeded":{"message":"La transacción se revirtió porque se superó la tolerancia de deslizamiento."},"transactionScan.errors.unknownError":{"message":"An unknown error occurred."}}}'),wv={en:yv.D,es:vv.D},Av="en";function bv(e){const t=wv[e]??wv[Av];return(e,n)=>{let r=t?.[e]?.message??e;return n&&r&&Object.keys(n).forEach((e=>{const t=new RegExp(`\\{${e}\\}`,"gu");r=r.replace(t,n[e]??"")})),r}}function Sv(e){if(e===Ql)return"MetaMask";try{return new URL(e).hostname}catch(e){throw new Error("Invalid URL")}}const Ev=({label:e,value:t})=>null!=t?Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:e}),Qy(av,{children:t})]}):null,kv=1e-6,Iv=3,Tv="0",_v=new _o(kv).decimalPlaces();function xv(e,t){const[n]=t.split("_");try{const r=new _o(e);if(r.isNaN())return Tv;if(r.isZero())return Tv;if(r.abs().lt(kv))return`<${function(e,t){const n=new _o(t),r=n.decimalPlaces(),o=n.toFixed(r??0),[i]=e.split("_"),[a,s]=o.split("."),c=new Intl.NumberFormat(i).format(a);return s?`${c}.${s}`:c}(t,kv)}`;if(r.abs().lt(1))return new Intl.NumberFormat(n,{maximumSignificantDigits:Iv}).format(Number(r.toFixed(_v??0)));const o=r.abs().integerValue().toString().length,i=Math.max(0,Iv-o+1);return new Intl.NumberFormat(t,{maximumFractionDigits:i}).format(r.toFixed(i))}catch(e){return Gl.error(e),Tv}}function Cv(e,t,n){const r=new _o(e).toNumber(),[o]=n.split("_");return r.toLocaleString(o,{style:"currency",currency:t,maximumFractionDigits:2,minimumFractionDigits:2})}const Rv=({asset:e,preferences:t})=>{const n=e.type;return Xy(ov,{direction:"vertical",crossAlignment:"end",children:[Xy(ov,{direction:"horizontal",alignment:"center",children:[Xy(av,{color:"in"===n?"success":"error",children:["in"===n?"+":"-",xv(e.value??0,t.locale)]}),e.imageSvg?Qy(ov,{alignment:"center",center:!0,children:Qy(lv,{borderRadius:"full",src:e.imageSvg})}):null,Qy(av,{children:e.symbol??""})]}),e.price?Qy(av,{color:"muted",children:Cv(e.price.toString(),t.currency,t.locale)}):null]})},Pv=nv("Tooltip");var Nv;!function(e){e.AddSquare="add-square",e.Add="add",e.Arrow2Down="arrow-2-down",e.Arrow2Left="arrow-2-left",e.Arrow2Right="arrow-2-right",e.Arrow2Up="arrow-2-up",e.Arrow2UpRight="arrow-2-up-right",e.ArrowDoubleLeft="arrow-double-left",e.ArrowDoubleRight="arrow-double-right",e.ArrowDown="arrow-down",e.ArrowLeft="arrow-left",e.ArrowRight="arrow-right",e.ArrowUp="arrow-up",e.BankToken="bank-token",e.Bank="bank",e.Book="book",e.Bookmark="bookmark",e.Bridge="bridge",e.Calculator="calculator",e.CardPos="card-pos",e.CardToken="card-token",e.Card="card",e.Category="category",e.Chart="chart",e.CheckBold="check-bold",e.Check="check",e.Clock="clock",e.Close="close",e.CodeCircle="code-circle",e.Coin="coin",e.Confirmation="confirmation",e.Connect="connect",e.CopySuccess="copy-success",e.Copy="copy",e.Customize="customize",e.Danger="danger",e.Dark="dark",e.Data="data",e.Diagram="diagram",e.DocumentCode="document-code",e.DragDrop="drag-drop",e.DraggingAnimation="dragging-animation",e.PinningAnimation="pinning-animation",e.Edit="edit",e.Eraser="eraser",e.Ethereum="ethereum",e.Expand="expand",e.Explore="explore",e.Export="export",e.EyeSlash="eye-slash",e.Eye="eye",e.Filter="filter",e.Flag="flag",e.FlashSlash="flash-slash",e.Flash="flash",e.FullCircle="full-circle",e.Gas="gas",e.GlobalSearch="global-search",e.Global="global",e.Graph="graph",e.Hardware="hardware",e.Heart="heart",e.Hierarchy="hierarchy",e.Home="home",e.Import="import",e.Info="info",e.Key="key",e.Light="light",e.Link="link",e.Loading="loading",e.LockCircle="lock-circle",e.LockSlash="lock-slash",e.Lock="lock",e.Login="login",e.Logout="logout",e.Menu="menu",e.MessageQuestion="message-question",e.Messages="messages",e.MinusBold="minus-bold",e.MinusSquare="minus-square",e.Minus="minus",e.Mobile="mobile",e.Money="money",e.Monitor="monitor",e.MoreHorizontal="more-horizontal",e.MoreVertical="more-vertical",e.NotificationCircle="notification-circle",e.Notification="notification",e.PasswordCheck="password-check",e.People="people",e.Pin="pin",e.ProgrammingArrows="programming-arrows",e.Custody="custody",e.Question="question",e.Received="received",e.Refresh="refresh",e.Save="save",e.ScanBarcode="scan-barcode",e.ScanFocus="scan-focus",e.Scan="scan",e.Scroll="scroll",e.Search="search",e.SecurityCard="security-card",e.SecurityCross="security-cross",e.SecurityKey="security-key",e.SecuritySearch="security-search",e.SecuritySlash="security-slash",e.SecurityTick="security-tick",e.SecurityTime="security-time",e.SecurityUser="security-user",e.Security="security",e.Send1="send-1",e.Send2="send-2",e.Setting="setting",e.Slash="slash",e.SnapsMobile="snaps-mobile",e.SnapsPlus="snaps-plus",e.Snaps="snaps",e.Speedometer="speedometer",e.Star="star",e.Stake="stake",e.Student="student",e.SwapHorizontal="swap-horizontal",e.SwapVertical="swap-vertical",e.Tag="tag",e.Tilde="tilde",e.Timer="timer",e.Trash="trash",e.TrendDown="trend-down",e.TrendUp="trend-up",e.UserCircleAdd="user-circle-add",e.UserCircleLink="user-circle-link",e.UserCircleRemove="user-circle-remove",e.UserCircle="user-circle",e.User="user",e.WalletCard="wallet-card",e.WalletMoney="wallet-money",e.Wallet="wallet",e.Warning="warning",e.Twitter="twitter",e.QrCode="qr-code",e.UserCheck="user-check",e.Unpin="unpin",e.Ban="ban",e.Bold="bold",e.CircleX="circle-x",e.Download="download",e.FileIcon="file",e.Flask="flask",e.Plug="plug",e.Share="share",e.Square="square",e.Tint="tint",e.Upload="upload",e.Usb="usb",e.Wifi="wifi",e.PlusMinus="plus-minus"}(Nv||(Nv={}));const Bv=nv("Icon"),Ov=({preferences:e})=>{const t=bv(e.locale);return Xy(ov,{direction:"horizontal",center:!0,children:[Qy(av,{fontWeight:"medium",children:t("confirmation.estimatedChanges")}),Qy(Pv,{content:t("confirmation.estimatedChanges.tooltip"),children:Qy(Bv,{name:"info"})})]})},Mv=nv("Skeleton"),zv=({preferences:e})=>{const t=bv(e.locale);return Xy(sv,{direction:"vertical",children:[Qy(Ov,{preferences:e}),Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:t("confirmation.estimatedChanges.send")}),Qy(ov,{children:Xy(ov,{direction:"vertical",crossAlignment:"end",children:[Qy(Mv,{width:100,height:20}),Qy(Mv,{width:40,height:20})]})})]}),Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:t("confirmation.estimatedChanges.receive")}),Qy(ov,{children:Xy(ov,{direction:"vertical",crossAlignment:"end",children:[Qy(Mv,{width:100,height:20}),Qy(Mv,{width:40,height:20})]})})]})]})},jv=({changes:e,preferences:t,scanFetchStatus:n,scanStatus:r})=>{const o=bv(t.locale),i="fetched"===n,a="error"===n;if("fetching"===n)return Qy(zv,{preferences:t});if(a||i&&"ERROR"===r)return Xy(sv,{direction:"vertical",children:[Qy(Ov,{preferences:t}),Qy(av,{color:"alternative",children:o("confirmation.estimatedChanges.notAvailable")})]});const s=e?.assets.filter((e=>"out"===e.type))??[],c=e?.assets.filter((e=>"in"===e.type))??[],u=s.length>0||c.length>0;return Xy(sv,i&&!u?{direction:"vertical",children:[Qy(Ov,{preferences:t}),Qy(av,{color:"alternative",children:o("confirmation.estimatedChanges.noChanges")})]}:{children:[Qy(Ov,{preferences:t}),s?.length>0?Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:o("confirmation.estimatedChanges.send")}),Qy(ov,{children:Qy(ov,{children:s?.map((e=>Qy(Rv,{asset:e,preferences:t})))})})]}):null,Qy(ov,{children:null}),c?.length>0?Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:o("confirmation.estimatedChanges.receive")}),Qy(ov,{children:Qy(ov,{children:c?.map((e=>Qy(Rv,{asset:e,preferences:t})))})})]}):null]})};var Uv=function(e){return e.Cancel="confirm-sign-in-cancel",e.Confirm="confirm-sign-in-confirm",e}({});const Dv={"confirm-sign-in-cancel":async function({id:e}){await fy(e,!1)},"confirm-sign-in-confirm":async function({id:e}){await fy(e,!0)}},Lv=({params:e,origin:t,account:n,scope:r,preferences:o,networkImage:i})=>{const a=bv(o.locale),s=t?Sv(t):null,{domain:c,statement:u,uri:l,version:d,chainId:f,nonce:h,issuedAt:p,expirationTime:g,notBefore:m,requestId:y,resources:v,address:w}=e,A=mv(r,n.address),b=w?mv(r,w):null,S=b!==A,E=c!==s;return Xy(rv,{children:[Xy(ov,{children:[Xy(ov,{alignment:"center",center:!0,children:[Qy(ov,{children:null}),Qy(iv,{size:"lg",children:a("confirmation.signIn.title")}),Qy(av,{color:"muted",alignment:"center",children:a("confirmation.signIn.description")})]}),o.simulateOnChainActions?Qy(jv,{changes:null,scanStatus:null,preferences:o,scanFetchStatus:"fetched"}):null,Xy(sv,{children:[s?Qy(cv,{label:a("confirmation.origin"),tooltip:a("confirmation.origin.tooltip"),children:Qy(av,{children:s})}):null,Qy(cv,{variant:E?"critical":"default",label:a("confirmation.signIn.domain"),tooltip:E?a("confirmation.signIn.badDomain"):void 0,children:Qy(av,{children:c??a("confirmation.signIn.unknownDomain")})}),Qy(cv,{label:a("confirmation.signIn.signingInWith"),tooltip:S?a("confirmation.signIn.badAccount"):void 0,variant:S?"warning":"default",children:n.domain?Qy(gv,{domain:n.domain,scope:r,address:n.address}):Qy(uv,{address:A,truncate:!0,displayName:!0,avatar:!0})})]}),Xy(sv,{children:[Qy(av,{fontWeight:"medium",children:a("confirmation.signIn.message")}),Qy(av,{children:u??""}),Qy(Ev,{label:"URL",value:l??""}),Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:a("confirmation.network")}),Xy(ov,{direction:"horizontal",alignment:"center",children:[Qy(ov,{alignment:"center",center:!0,children:Qy(lv,{borderRadius:"medium",src:i??ev})}),Qy(av,{children:id[r].name})]})]}),b?Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:a("confirmation.account")}),Qy(uv,{address:b,truncate:!0,displayName:!0,avatar:!0})]}):null,Qy(Ev,{label:a("confirmation.signIn.version"),value:d??""}),Qy(Ev,{label:a("confirmation.signIn.chainId"),value:f??""}),Qy(Ev,{label:a("confirmation.signIn.nonce"),value:h??""}),Qy(Ev,{label:a("confirmation.signIn.issuedAt"),value:p??""}),Qy(Ev,{label:a("confirmation.signIn.expirationTime"),value:g??""}),Qy(Ev,{label:a("confirmation.signIn.notBefore"),value:m??""}),Qy(Ev,{label:a("confirmation.signIn.requestId"),value:y??""}),v&&v.length>0?Xy(ov,{alignment:"space-between",direction:"vertical",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:a("confirmation.signIn.resources")}),Qy(ov,{direction:"vertical",children:v.map((e=>Qy(av,{children:e},e)))})]}):null]})]}),Xy(dv,{children:[Qy(fv,{name:Uv.Cancel,children:a("confirmation.cancelButton")}),Qy(fv,{name:Uv.Confirm,variant:E?"destructive":"primary",children:a("confirmation.confirmButton")})]})]})};var Fv=function(e){return e.Cancel="confirm-sign-message-cancel",e.Confirm="confirm-sign-message-confirm",e}({});const $v={"confirm-sign-message-cancel":async function({id:e}){await fy(e,!1)},"confirm-sign-message-confirm":async function({id:e}){await fy(e,!0)}},qv=({message:e,account:t,scope:n,locale:r,networkImage:o,origin:i})=>{const a=bv(r),{address:s}=t,c=i?Sv(i):null,u=mv(n,s);return Xy(rv,{children:[Xy(ov,{children:[Xy(ov,{alignment:"center",center:!0,children:[Qy(ov,{children:null}),Qy(iv,{size:"lg",children:a("confirmation.signMessage.title")})]}),Xy(sv,{children:[Qy(ov,{direction:"horizontal",center:!0,children:Qy(av,{fontWeight:"medium",children:a("confirmation.signMessage.message")})}),Qy(ov,{alignment:"space-between",children:Qy(av,{children:e})})]}),Xy(sv,{children:[c?Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Xy(ov,{alignment:"space-between",direction:"horizontal",center:!0,children:[Qy(av,{fontWeight:"medium",color:"alternative",children:a("confirmation.origin")}),Qy(Pv,{content:a("confirmation.origin.tooltip"),children:Qy(Bv,{name:"question",color:"muted"})})]}),Qy(av,{children:c})]}):null,Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:a("confirmation.account")}),t.domain?Qy(gv,{domain:t.domain,scope:n,address:s}):Qy(uv,{address:u,truncate:!0,displayName:!0,avatar:!0})]}),Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:a("confirmation.network")}),Xy(ov,{direction:"horizontal",alignment:"center",children:[Qy(ov,{alignment:"center",center:!0,children:Qy(lv,{borderRadius:"medium",src:o??ev})}),Qy(av,{children:id[n].name})]})]})]})]}),Xy(dv,{children:[Qy(fv,{name:Fv.Cancel,children:a("confirmation.cancelButton")}),Qy(fv,{name:Fv.Confirm,children:a("confirmation.confirmButton")})]})]})};var Wv=function(e){return e.ShowAdvanced="confirm-sign-and-send-transaction-show-advanced",e.Cancel="confirm-sign-and-send-transaction-cancel",e.Confirm="confirm-sign-and-send-transaction-confirm",e}({});const Vv={"confirm-sign-and-send-transaction-show-advanced":async function({id:e,context:t}){const n={...t,advanced:{...t.advanced,shown:!t.advanced.shown}};await dy(e,Qy(ow,{context:n}),n)},"confirm-sign-and-send-transaction-cancel":async function({id:e}){await fy(e,!1)},"confirm-sign-and-send-transaction-confirm":async function({id:e}){await fy(e,!0)}},Kv=e=>e.replace(/([A-Z])/gu," $1").trim().replace(/^./u,(e=>e.toUpperCase())),Gv=({address:e,scope:t})=>Qy(hv,{href:pv(t,"address",e),children:Qy(uv,{avatar:!1,address:mv(t,e),truncate:!0})}),Hv=({instruction:e,scope:t,locale:n})=>{const r=bv(n),{type:o,encoded:i,parsed:a}=e,{programAddress:s,dataBase58:c}=i,u=null!==a,l=Kv(o);return Xy(sv,{alignment:"start",children:[Qy(av,{color:"alternative",fontWeight:"bold",children:l}),Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{color:"alternative",alignment:"start",children:r("confirmation.advanced.programId")}),Qy(Gv,{address:s,scope:t})]}),u&&Object.entries(a.accounts??{}).map((([e,n])=>Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{color:"alternative",children:Kv(e)}),Ks(n.address)?Qy(Gv,{address:n.address,scope:t}):Qy(av,{children:ay(n.address)?.toString()??""})]}))),u&&Object.entries(a.data).map((([e,n])=>Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{color:"alternative",children:Kv(e)}),Ks(n)?Qy(Gv,{address:n,scope:t}):Qy(av,{children:ay(n)?.toString()??""})]}))),!u&&Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{color:"alternative",children:r("confirmation.advanced.data")}),Qy(av,{children:(d=c,d.length>12?`${d.slice(0,5)}...${d.slice(-5)}`:d)})]})]});var d},Zv=({instructions:e,showInstructions:t,locale:n,scope:r})=>{const o=bv(n),i=t?"hide":"show",a=t?"arrow-up":"arrow-down";return Xy(ov,{alignment:"start",children:[Xy(fv,{name:Wv.ShowAdvanced,children:[o(`confirmation.advanced.${i}`)," ",Qy(Bv,{name:a,color:"primary"})]}),t&&Qy(ov,{children:e.map((e=>Qy(Hv,{locale:n,scope:r,instruction:e})))})]})},Jv=nv("Banner"),Yv={AccountAlreadyInUse:"transactionScan.errors.accountAlreadyInUse",ResultWithNegativeLamports:"transactionScan.errors.insufficientSol",SlippageToleranceExceeded:"transactionScan.errors.slippageToleranceExceeded",ExceededDesiredSlippageLimit:"transactionScan.errors.slippageToleranceExceeded"};function Qv(e,t){const n=bv(t.locale),{code:r}=e;return n((r&&Yv[r])??"transactionScan.errors.unknownError")}const Xv={Malicious:"danger",Warning:"warning"},ew=({preferences:e,validation:t,error:n,scanFetchStatus:r})=>{const o=bv(e.locale);if("error"===r)return Qy(Jv,{title:o("send.simulationTitleAPIError"),severity:"danger",children:Qy(av,{children:o("send.simulationMessageAPIError")})});if(!n&&!t)return Qy(ov,{children:null});if(n)return Qy(Jv,{title:o("confirmation.simulationErrorTitle"),severity:"warning",children:Qy(av,{children:o("confirmation.simulationErrorSubtitle",{reason:Qv(n,e)})})});if(!t)return Qy(ov,{children:null});const i=t?.type?Xv[t.type]:void 0;return i?Xy(Jv,{title:o("confirmation.validationErrorTitle"),severity:i,children:[Qy(av,{children:o("confirmation.validationErrorSubtitle")}),Qy(av,{size:"sm",children:Qy(hv,{href:"https://support.metamask.io/configure/wallet/how-to-turn-on-security-alerts/",children:o("confirmation.validationErrorLearnMore")})}),Xy(av,{size:"sm",children:[Qy(Bv,{color:"primary",name:"security-tick"})," ",o("confirmation.validationErrorSecurityAdviced")," ",Qy(hv,{href:"https://www.blockaid.io",children:"Blockaid"})]})]}):Qy(ov,{children:null})};function tw(e,t,n){return`${xv(e,n)} ${t}`}function nw(e,t){return new _o(e).multipliedBy(t).toString()}const rw=({origin:e,accountAddress:t,scope:n,feeInSol:r,nativePrice:o,fetchingPricesStatus:i,preferences:a,networkImage:s})=>{const{currency:c,locale:u}=a,l=bv(u),d=e?Sv(e):null,f="fetching"===i,h=r&&o&&!("error"===i)?Cv(nw(r,o),c,u):"";return Xy(sv,{children:[d?Xy(ov,{children:[Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Xy(ov,{alignment:"space-between",direction:"horizontal",center:!0,children:[Qy(av,{fontWeight:"medium",color:"alternative",children:l("confirmation.origin")}),Qy(Pv,{content:l("confirmation.origin.tooltip"),children:Qy(Bv,{name:"question",color:"muted"})})]}),Qy(av,{children:d})]}),Qy(ov,{children:null})]}):null,Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:l("confirmation.account")}),Qy(uv,{address:mv(n,t),truncate:!0,displayName:!0,avatar:!0})]}),Qy(ov,{children:null}),Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:l("confirmation.network")}),Xy(ov,{direction:"horizontal",alignment:"center",children:[Qy(ov,{alignment:"center",center:!0,children:Qy(lv,{borderRadius:"medium",src:s??""})}),Qy(av,{children:id[n].name})]})]}),Qy(ov,{children:null}),Xy(ov,{alignment:"space-between",direction:"horizontal",children:[Qy(av,{fontWeight:"medium",color:"alternative",children:l("confirmation.fee")}),r?Xy(ov,{direction:"horizontal",alignment:"center",children:[f?Qy(Mv,{width:80}):Qy(av,{color:"muted",children:h}),Qy(av,{children:tw(r,id[n].nativeToken.symbol,u)})]}):Qy(Pv,{content:l("confirmation.feeError"),children:Qy(Bv,{name:"warning"})})]})]})},ow=({context:e})=>{const t=bv(e.preferences.locale),n=e.feeEstimatedInSol,{nativeToken:r}=id[e.scope],o=e.tokenPrices[r.caip19Id]?.price??null,i="fetching"===e.scanFetchStatus||"ERROR"===e.scan?.status;return Xy(rv,{children:[Xy(ov,{children:[e.preferences.useSecurityAlerts?Qy(ew,{scanFetchStatus:e.scanFetchStatus,validation:e.scan?.validation??null,error:e.scan?.error??null,preferences:e.preferences}):null,Xy(ov,{alignment:"center",center:!0,children:[Qy(ov,{children:null}),Qy(iv,{size:"lg",children:t(`confirmation.${e.method}.title`)}),Qy(ov,{children:null})]}),e.preferences.simulateOnChainActions?Qy(jv,{scanStatus:e.scan?.status??null,scanFetchStatus:e.scanFetchStatus,changes:e.scan?.estimatedChanges??null,preferences:e.preferences}):null,Qy(rw,{accountAddress:e.account?.address??null,scope:e.scope,feeInSol:n,nativePrice:o,fetchingPricesStatus:e.tokenPricesFetchStatus,preferences:e.preferences,networkImage:e.networkImage,origin:e.origin}),Qy(Zv,{instructions:e.advanced.instructions,showInstructions:e.advanced.shown,locale:e.preferences.locale,scope:e.scope})]}),Xy(dv,{children:[Qy(fv,{name:Wv.Cancel,children:t("confirmation.cancelButton")}),Qy(fv,{name:Wv.Confirm,disabled:i,children:t("confirmation.confirmButton")})]})]})},iw={method:$t.SignAndSendTransaction,scope:Xl.Mainnet,networkImage:ev,account:null,transaction:"",scan:null,scanFetchStatus:"fetching",feeEstimatedInSol:"0",tokenPrices:{},tokenPricesFetchStatus:"fetching",origin:"",preferences:{locale:"en",currency:"usd",hideBalances:!1,useSecurityAlerts:!0,useExternalPricingData:!0,simulateOnChainActions:!0,useTokenDetection:!0,batchCheckBalances:!0,displayNftMedia:!0,useNftDetection:!0},advanced:{shown:!1,instructions:[]}};async function aw(e){const t={...iw,...e},n=py().then((e=>{t.preferences=e})).catch((()=>{t.preferences=iw.preferences})),r=(async(e,t)=>{const n=await Km(t,e),r="instructions"in n?n:await qm(n.messageBytes,e),{instructions:o}=r;return o.map(Hm)})(xS.getRpc(t.scope),t.transaction).then((e=>{t.advanced.instructions=e})).catch((e=>{Gl.error(e),t.advanced.instructions=[]}));await Promise.all([n,r]);const{currency:o,useExternalPricingData:i,useSecurityAlerts:a,simulateOnChainActions:s}=t.preferences,c=await ly(Qy(ow,{context:t}),t),u=hy(c),l={...t},d=[id[t.scope].nativeToken.caip19Id];let f;i?f=zS.getMultipleSpotPrices(d,o).then((e=>{l.tokenPrices=e,l.tokenPricesFetchStatus="fetched"})).catch((()=>{l.tokenPricesFetchStatus="error"})):(l.tokenPricesFetchStatus="fetched",l.tokenPrices={});const h=BS.getFeeFromBase64StringInLamports(t.transaction,l.scope).then((e=>{l.feeEstimatedInSol=e?Fd(e).toString():null})).catch((()=>{l.feeEstimatedInSol=null}));await Promise.all([f,h]),await dy(c,Qy(ow,{context:l}),l);const p={...l},g=[];if(s&&g.push("simulation"),a&&g.push("validation"),s||a){const e=ZS.scanTransaction({method:p.method,accountAddress:p.account?.address??"",transaction:p.transaction,scope:p.scope,origin:p.origin,options:g}).then((async e=>{p.scan=e,p.scanFetchStatus=e?"fetched":"error"})).catch((()=>{p.scan=null,p.scanFetchStatus="error"}));await Promise.all([e])}else p.scanFetchStatus="fetched",p.scan=null;return await dy(c,Qy(ow,{context:p}),p),await kS.setKey(`mapInterfaceNameToId.${uy}`,c),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT20S",request:{method:"refreshConfirmationEstimation"}}}),u}function sw(e){return JSON.parse(function(e){const t=[];let n=!1;for(let r=0;r<e.length;r++){let o=!1;if("\\"===e[r]&&(t.push(e[r++]),o=!o),'"'!==e[r]){if(!n){const n=cw(e,r);if(n?.length){r+=n.length-1,n.match(/\.|[eE]-/)?t.push(n):t.push(uw(n));continue}}t.push(e[r])}else t.push(e[r]),o||(n=!n)}return t.join("")}(e),((e,t)=>function(e){return!!e&&"object"==typeof e&&"$n"in e&&"string"==typeof e.$n}(t)?function({$n:e}){if(e.match(/[eE]/)){const[t,n]=e.split(/[eE]/);return BigInt(t)*BigInt(10)**BigInt(n)}return BigInt(e)}(t):t))}function cw(e,t){if(!e[t]?.match(/[-\d]/))return null;const n=e.slice(t).match(/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/);return n?n[0]:null}function uw(e){return`{"$n":"${e}"}`}var lw=0n;function dw(){const e=lw;return lw++,e.toString()}function fw(e){return function(e){return new Proxy(e.api,{defineProperty:()=>!1,deleteProperty:()=>!1,get:(t,n,r)=>function(...o){const i=n.toString(),a=Reflect.get(t,i,r);if(!a)throw new Aa(pa,{method:i,params:o});const s=a(...o);return function({transport:e},t){return{send:async n=>await t.execute({signal:n?.abortSignal,transport:e})}}(e,s)}})}(e)}function hw(e){return new Proxy({},{defineProperty:()=>!1,deleteProperty:()=>!1,get(...t){const[n,r]=t,o=r.toString();return function(...t){const n=Object.freeze({methodName:o,params:t}),r=e?.requestTransformer?e?.requestTransformer(n):n;return Object.freeze({execute:async({signal:t,transport:n})=>{const o=function(e){return{id:dw(),jsonrpc:"2.0",method:e.methodName,params:e.params}}(r),i=await n({payload:o,signal:t});return e?.responseTransformer?e.responseTransformer(i,r):i}})}}})}function pw(e){return null!=e&&"object"==typeof e&&!Array.isArray(e)&&("jsonrpc"in e&&"2.0"===e.jsonrpc&&"method"in e&&"string"==typeof e.method&&"params"in e)}var gw={};function mw(e){return function t(n,r){if(Array.isArray(n))return n.map(((e,n)=>{const o={...r,keyPath:[...r.keyPath,n]};return t(e,o)}));if("object"==typeof n&&null!==n){const e={};for(const o in n){if(!Object.prototype.hasOwnProperty.call(n,o))continue;const i={...r,keyPath:[...r.keyPath,o]};e[o]=t(n[o],i)}return e}return e.reduce(((e,t)=>t(e,r)),n)}}function yw(e,t){return n=>{const r=mw(e);return Object.freeze({...n,params:r(n.params,t)})}}function vw(e){return"bigint"==typeof e?Number(e):e}function ww({commitmentPropertyName:e,params:t,optionsObjectPositionInParams:n,overrideCommitment:r}){const o=t[n];if(void 0===o||o&&"object"==typeof o&&!Array.isArray(o))if(o&&e in o){if(!o[e]||"finalized"===o[e]){const r=[...t],{[e]:i,...a}=o;return Object.keys(a).length>0?r[n]=a:n===r.length-1?r.length--:r[n]=void 0,r}}else if("finalized"!==r){const i=[...t];return i[n]={...o,[e]:r},i}return t}function Aw(e){return(t,{keyPath:n})=>("bigint"==typeof t&&e&&(t>Number.MAX_SAFE_INTEGER||t<-Number.MAX_SAFE_INTEGER)&&e(n,t),t)}var bw={accountNotifications:1,blockNotifications:1,getAccountInfo:1,getBalance:1,getBlock:1,getBlockHeight:0,getBlockProduction:0,getBlocks:2,getBlocksWithLimit:2,getEpochInfo:0,getFeeForMessage:1,getInflationGovernor:0,getInflationReward:1,getLargestAccounts:0,getLatestBlockhash:0,getLeaderSchedule:1,getMinimumBalanceForRentExemption:1,getMultipleAccounts:1,getProgramAccounts:1,getSignaturesForAddress:1,getSlot:0,getSlotLeader:0,getStakeMinimumDelegation:0,getSupply:0,getTokenAccountBalance:1,getTokenAccountsByDelegate:2,getTokenAccountsByOwner:2,getTokenLargestAccounts:1,getTokenSupply:1,getTransaction:1,getTransactionCount:0,getVoteAccounts:0,isBlockhashValid:1,logsNotifications:1,programNotifications:1,requestAirdrop:2,sendTransaction:1,signatureNotifications:1,simulateTransaction:1};function Sw(e){const t=e?.onIntegerOverflow;return n=>{return nu(n,t?(r=t,e=>yw([Aw(((...t)=>r(e,...t)))],{keyPath:[]})(e)):e=>e,yw([vw],{keyPath:[]}),function({defaultCommitment:e,optionsObjectPositionByMethod:t}){return n=>{const{params:r,methodName:o}=n;if(!Array.isArray(r))return n;const i=t[o];return null==i?n:Object.freeze({methodName:o,params:ww({commitmentPropertyName:"sendTransaction"===o?"preflightCommitment":"commitment",optionsObjectPositionInParams:i,overrideCommitment:e,params:r})})}}({defaultCommitment:e?.defaultCommitment,optionsObjectPositionByMethod:bw}));var r}}function Ew(e){return t=[kw(e)],n={keyPath:[]},e=>mw(t)(e,n);var t,n}function kw(e){return function(t,{keyPath:n}){return"number"==typeof t&&Number.isInteger(t)||"bigint"==typeof t?function(e,t){return t.some((t=>{if(t.length!==e.length)return!1;for(let n=e.length-1;n>=0;n--){const r=e[n],o=t[n];if(o!==r&&(o!==gw||"number"!=typeof r))return!1}return!0}))}(n,e)?Number(t):BigInt(t):t}}function Iw(e){return(t,n)=>{const r=n.methodName,o=e?.allowedNumericKeyPaths&&r?e.allowedNumericKeyPaths[r]:void 0;return nu(t,(e=>(e=>{const t=e;if("error"in t)throw _a(t.error);return t})(e)),(e=>e.result),(e=>Ew(o??[])(e,n)))}}var Tw,_w=[["data","parsed","info","tokenAmount","decimals"],["data","parsed","info","tokenAmount","uiAmount"],["data","parsed","info","rentExemptReserve","decimals"],["data","parsed","info","rentExemptReserve","uiAmount"],["data","parsed","info","delegatedAmount","decimals"],["data","parsed","info","delegatedAmount","uiAmount"],["data","parsed","info","extensions",gw,"state","olderTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",gw,"state","newerTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",gw,"state","preUpdateAverageRate"],["data","parsed","info","extensions",gw,"state","currentRate"]],xw=[..._w,["data","parsed","info","lastExtendedSlotStartIndex"],["data","parsed","info","slashPenalty"],["data","parsed","info","warmupCooldownRate"],["data","parsed","info","decimals"],["data","parsed","info","numRequiredSigners"],["data","parsed","info","numValidSigners"],["data","parsed","info","stake","delegation","warmupCooldownRate"],["data","parsed","info","exemptionThreshold"],["data","parsed","info","burnPercent"],["data","parsed","info","commission"],["data","parsed","info","votes",gw,"confirmationCount"]],Cw=[["index"],["instructions",gw,"accounts",gw],["instructions",gw,"programIdIndex"],["instructions",gw,"stackHeight"]],Rw=[["addressTableLookups",gw,"writableIndexes",gw],["addressTableLookups",gw,"readonlyIndexes",gw],["header","numReadonlySignedAccounts"],["header","numReadonlyUnsignedAccounts"],["header","numRequiredSignatures"],["instructions",gw,"accounts",gw],["instructions",gw,"programIdIndex"],["instructions",gw,"stackHeight"]];function Pw(e){return hw({requestTransformer:Sw(e),responseTransformer:Iw({allowedNumericKeyPaths:Nw()})})}function Nw(){return Tw||(Tw={getAccountInfo:xw.map((e=>["value",...e])),getBlock:[["transactions",gw,"meta","preTokenBalances",gw,"accountIndex"],["transactions",gw,"meta","preTokenBalances",gw,"uiTokenAmount","decimals"],["transactions",gw,"meta","postTokenBalances",gw,"accountIndex"],["transactions",gw,"meta","postTokenBalances",gw,"uiTokenAmount","decimals"],["transactions",gw,"meta","rewards",gw,"commission"],...Cw.map((e=>["transactions",gw,"meta","innerInstructions",gw,...e])),...Rw.map((e=>["transactions",gw,"transaction","message",...e])),["rewards",gw,"commission"]],getClusterNodes:[[gw,"featureSet"],[gw,"shredVersion"]],getInflationGovernor:[["initial"],["foundation"],["foundationTerm"],["taper"],["terminal"]],getInflationRate:[["foundation"],["total"],["validator"]],getInflationReward:[[gw,"commission"]],getMultipleAccounts:xw.map((e=>["value",gw,...e])),getProgramAccounts:xw.flatMap((e=>[["value",gw,"account",...e],[gw,"account",...e]])),getRecentPerformanceSamples:[[gw,"samplePeriodSecs"]],getTokenAccountBalance:[["value","decimals"],["value","uiAmount"]],getTokenAccountsByDelegate:_w.map((e=>["value",gw,"account",...e])),getTokenAccountsByOwner:_w.map((e=>["value",gw,"account",...e])),getTokenLargestAccounts:[["value",gw,"decimals"],["value",gw,"uiAmount"]],getTokenSupply:[["value","decimals"],["value","uiAmount"]],getTransaction:[["meta","preTokenBalances",gw,"accountIndex"],["meta","preTokenBalances",gw,"uiTokenAmount","decimals"],["meta","postTokenBalances",gw,"accountIndex"],["meta","postTokenBalances",gw,"uiTokenAmount","decimals"],["meta","rewards",gw,"commission"],...Cw.map((e=>["meta","innerInstructions",gw,...e])),...Rw.map((e=>["transaction","message",...e]))],getVersion:[["feature-set"]],getVoteAccounts:[["current",gw,"commission"],["delinquent",gw,"commission"]],simulateTransaction:[...xw.map((e=>["value","accounts",gw,...e])),...Cw.map((e=>["value","innerInstructions",gw,...e]))]}),Tw}Object.assign({"accept-charset":!0,"access-control-request-headers":!0,"access-control-request-method":!0,connection:!0,"content-length":!0,cookie:!0,date:!0,dnt:!0,expect:!0,host:!0,"keep-alive":!0,origin:!0,"permissions-policy":!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,via:!0},{"accept-encoding":!0});var Bw=["getAccountInfo","getBalance","getBlock","getBlockCommitment","getBlockHeight","getBlockProduction","getBlocks","getBlocksWithLimit","getBlockTime","getClusterNodes","getEpochInfo","getEpochSchedule","getFeeForMessage","getFirstAvailableBlock","getGenesisHash","getHealth","getHighestSnapshotSlot","getIdentity","getInflationGovernor","getInflationRate","getInflationReward","getLargestAccounts","getLatestBlockhash","getLeaderSchedule","getMaxRetransmitSlot","getMaxShredInsertSlot","getMinimumBalanceForRentExemption","getMultipleAccounts","getProgramAccounts","getRecentPerformanceSamples","getRecentPrioritizationFees","getSignaturesForAddress","getSignatureStatuses","getSlot","getSlotLeader","getSlotLeaders","getStakeMinimumDelegation","getSupply","getTokenAccountBalance","getTokenAccountsByDelegate","getTokenAccountsByOwner","getTokenLargestAccounts","getTokenSupply","getTransaction","getTransactionCount","getVersion","getVoteAccounts","index","isBlockhashValid","minimumLedgerSlot","requestAirdrop","sendTransaction","simulateTransaction"];function Ow(e){return pw(e)&&Bw.includes(e.method)}function Mw(e){return function(e){const{fromJson:t,headers:n,toJson:r,url:o}=e,i=n&&function(e){const t={};for(const n in e)t[n.toLowerCase()]=e[n];return t}(n);return async function({payload:e,signal:n}){const a=r?r(e):JSON.stringify(e),s={body:a,headers:{...i,accept:"application/json","content-length":a.length.toString(),"content-type":"application/json; charset=utf-8"},method:"POST",signal:n},c=await fetch(o,s);if(!c.ok)throw new Aa(ha,{headers:c.headers,message:c.statusText,statusCode:c.status});return t?t(await c.text(),e):await c.json()}}({...e,fromJson:(e,t)=>Ow(t)?sw(e):JSON.parse(e),toJson:e=>{return Ow(e)?(t=e,function(e){return e.replace(/\{\s*"\$n"\s*:\s*"(-?\d+)"\s*\}/g,"$1")}(JSON.stringify(t,((e,t)=>"bigint"==typeof t?function(e){return{$n:`${e}`}}(t):t),n))):JSON.stringify(e);var t,n}})}var zw=Object.prototype.toString,jw=Object.keys||function(e){const t=[];for(const n in e)t.push(n);return t};function Uw(e,t){let n,r,o,i,a,s,c;if(!0===e)return"true";if(!1===e)return"false";switch(typeof e){case"object":if(null===e)return null;if("toJSON"in e&&"function"==typeof e.toJSON)return Uw(e.toJSON(),t);if(c=zw.call(e),"[object Array]"===c){for(o="[",r=e.length-1,n=0;n<r;n++)o+=Uw(e[n],!0)+",";return r>-1&&(o+=Uw(e[n],!0)),o+"]"}if("[object Object]"===c){for(i=jw(e).sort(),r=i.length,o="",n=0;n<r;)a=i[n],s=Uw(e[a],!1),void 0!==s&&(o&&(o+=","),o+=JSON.stringify(a)+":"+s),n++;return"{"+o+"}"}return JSON.stringify(e);case"function":case"undefined":return t?null:void 0;case"bigint":return`${e.toString()}n`;case"string":return JSON.stringify(e);default:return isFinite(e)?e:null}}function Dw(e){const t=Uw(e,!1);if(void 0!==t)return""+t}function Lw(e,t,n){let r="";if("number"==typeof t[0]){const e=t[0]+1,n=e%10,o=e%100;r=1==n&&11!=o?e+"st":2==n&&12!=o?e+"nd":3==n&&13!=o?e+"rd":e+"th"}else r=`\`${t[0].toString()}\``;const o=t.length>1?t.slice(1).map((e=>"number"==typeof e?`[${e}]`:e)).join("."):void 0,i=new Aa(fa,{argumentLabel:r,keyPath:t,methodName:e,optionalPathLabel:o?` at path \`${o}\``:"",value:n,...void 0!==o?{path:o}:void 0});return ba(i,Lw),i}var Fw,$w={defaultCommitment:"confirmed",onIntegerOverflow(e,t,n){throw Lw(e.methodName,t,n)}},qw=globalThis.AbortController;function Ww(e){return pw(e)?Dw([e.method,e.params]):void 0}function Vw(e){const t={};for(const n in e)t[n.toLowerCase()]=e[n];return t}function Kw(e){return nu(Mw({...e,headers:{...!1,...e.headers?Vw(e.headers):void 0,"solana-client":"js/2.1.0"}}),(e=>function(e,t){let n;return async function(r){const{payload:o,signal:i}=r,a=t(o);if(void 0===a)return await e(r);if(n||(queueMicrotask((()=>{n=void 0})),n={}),null==n[a]){const t=new qw,o=(async()=>{try{return await e({...r,signal:t.signal})}catch(e){if(e===(Fw||={}))return;throw e}})();n[a]={abortController:t,numConsumers:0,responsePromise:o}}const s=n[a];if(s.numConsumers++,i){const e=s.responsePromise;return await new Promise(((t,n)=>{const r=e=>{i.removeEventListener("abort",r),s.numConsumers-=1,queueMicrotask((()=>{0===s.numConsumers&&s.abortController.abort(Fw||={})})),n(e.target.reason)};i.addEventListener("abort",r),e.then(t).catch(n).finally((()=>{i.removeEventListener("abort",r)}))}))}return await s.responsePromise}}(e,Ww)))}function Gw(e){return fw({api:Pw($w),transport:e})}const Hw=Vl,Zw=["getTransaction","getSignaturesForAddress"],Jw=e=>{const t=Kw({url:e}),n=Kw({url:e,headers:{"x-bigtable":"disabled"}});return async(...e)=>{const{payload:r}=e[0],{method:o}=r,i=Zw.includes(o);return Hw.info(`[🚌 ToggleInfuraBigtableLookupsTransport] RPC method is ${o}. ${i?"Enabling":"Disabling"} BigTable lookups.`),i?t(...e):n(...e)}},Yw=Vl;async function Qw(e){try{await snap.request({method:"snap_trackError",params:{error:qr(new Error(JSON.stringify(e)))}}),Yw.info(`[🚌 ErrorTrackingTransport] Error tracked: ${e.method} - ${e.errorMessage}`)}catch(e){Yw.warn(`[🚌 ErrorTrackingTransport] Failed to track error: ${e}`)}}function Xw(e){return!(!j(e,vf)&&!Sf(e))||!!wa(e)}const eA=e=>async(...t)=>{const{payload:n}=t[0],{method:r}=n;try{Yw.info(`[🚌 ErrorTrackingTransport] Making RPC request: ${r}`);const o=await e(...t);if(Xw(o)){const e={method:r,errorMessage:`RPC error in response: ${JSON.stringify(o)}`,responseData:o,requestParams:n};return await Qw(e),o}return o}catch(e){const t=function(e,t){const n={method:t,errorMessage:"Unknown error"};return e?.currentUrl&&(n.url=e.currentUrl),e instanceof Error?(n.errorMessage=e.message,n.errorStack=e.stack):"string"==typeof e?n.errorMessage=e:e?.message?n.errorMessage=e.message:e?.error&&(n.errorMessage="string"==typeof e.error?e.error:JSON.stringify(e.error)),e?.status?n.statusCode=e.status:e?.statusCode&&(n.statusCode=e.statusCode),e?.response?n.responseData=e.response:e?.data&&(n.responseData=e.data),n}(e,r);throw await Qw(t),e instanceof Error?e:new Error(t.errorMessage)}},tA=Vl;async function nA(e){return new Promise((t=>setTimeout(t,e)))}const rA=Vl;const oA=e=>async(...t)=>{const{payload:n}=t[0],{method:r}=n;let o;for(let n=0;n<4;n++)try{return rA.info(`[🚌 RetryingTransport] Attempt "${r}" ${n+1} of 4`),await e(...t)}catch(e){if(rA.error(`[🚌 RetryingTransport] Error during attempt "${r}" ${n+1} of 4: ${e}`),o=e,n<3){const e=(i=n,Math.min(400*Math.pow(2,i),1500));rA.info(`[🚌 RetryingTransport] Sleeping for ${e}ms`),await nA(e)}}var i;throw o},iA=e=>{return nu(e,(t=Jw,e=>e.map(t)),(t=>((e,t)=>async(...n)=>{let r;const o=e.length;for(const[i,a]of e.entries())try{const e=t[i];return tA.info(`[🚌 FailoverTransport] Attempting to use transport ${i+1} of ${o} (URL: ${e})`),await a(...n)}catch(e){const n=t[i];r=e;const a=i===o-1;tA.error(`[🚌 FailoverTransport] Transport failed (URL: ${n}): ${e}. ${a?"No more transports to try.":"Trying next transport..."}`),e instanceof Error&&(e.currentUrl=n)}throw r})(t,e)),oA,(e=>eA(e)));var t};const aA=(e,t)=>(e=>Boolean(e.feePayer))(t)?t:$u(e,t),sA=e=>e.programAddress===ph&&mh({data:new Uint8Array,...e})===gh.SetComputeUnitPrice,cA=e=>e.instructions.filter(Boolean).some(sA),uA=e=>e.programAddress===ph&&mh({data:new Uint8Array,...e})===gh.SetComputeUnitLimit,lA=e=>e.instructions.filter(Boolean).some(uA);class dA{#h;#i;static defaultComputeUnitPriceInMicroLamportsPerComputeUnit=10000n;constructor(e,t){this.#h=e,this.#i=t}async getLatestBlockhash(e){try{return(await this.#h.getRpc(e).getLatestBlockhash().send()).value}catch(e){throw this.#i.error(e),e}}async getComputeUnitEstimate(e,t){const n=jm({rpc:this.#h.getRpc(t)});return await n(e)}async getFeeFromBase64StringInLamports(e,t){try{M(e,wd);const n=await Km(e,this.#h.getRpc(t)),r="instructions"in n?e:js().decode(n.messageBytes),o=this.#h.getRpc(t),i=await o.getFeeForMessage(r,{commitment:"confirmed"}).send();return this.#i.log(`Transaction is estimated to cost ${i.value} lamports`),i.value}catch(e){return this.#i.error(e),null}}async waitForTransactionCommitment(e,t,n){M(e,vd);const r=this.#h.getRpc(n);return async function(e,t){const n=t?.maxAttempts??10,r=t?.delayMs??1e3;let o=0;for(;o<n;)try{return await e()}catch(e){if(o+=1,o===n)throw e;await new Promise((e=>setTimeout(e,r)))}throw new Error("Unreachable")}((async()=>{this.#i.log(`🔎 Checking if transaction ${e} has reached commitment level ${t}`);const n=await r.getTransaction(mc(e),{commitment:t,maxSupportedTransactionVersion:0}).send();if(n)return this.#i.log(`🎉 Transaction ${e} has reached commitment level ${t}`),n;const o=`⚠️ Transaction with signature ${e} not found or has not yet reached requested commitment level: ${t}`;throw this.#i.warn(o),new Error(o)}),{delayMs:200})}async partiallySignBase64String(e,t,n,r){const o=this.#h.getRpc(n),i=await Km(e,o,r);if("instructions"in i)return this.#C(i,t,n);if(Object.values(i.signatures).every((e=>!e))){const{messageBytes:e}=i,a=await qm(e,o,r);return this.#C(a,t,n)}return this.#R(i,t)}async#C(e,t,n){const r=ru(e)?e.lifetimeConstraint:await this.getLatestBlockhash(n),o=cA(e),i=dA.defaultComputeUnitPriceInMicroLamportsPerComputeUnit,a=!lA(e)||!o,{privateKeyBytes:s}=await iy({entropySource:t.entropySource,derivationPath:t.derivationPath}),c=await dl(s),u=await nu(e,(e=>aA(c.address,e)),(e=>{return t=r,ru(n=e)?n:ou(t,n);var t,n}),(e=>((e,t,n)=>cA(e)?e:Vu([Th(t,n)],e))(e,{microLamports:i})),(async e=>a?(async(e,t,n)=>{try{const r=e.instructions.filter(Boolean),o=jm({rpc:t}),i=await o(e,n?.getComputeUnitEstimateConfig).catch((e=>{if(wa(e,Vi))return e.context.unitsConsumed;throw e}));return{...(0,_d.cloneDeep)(e),instructions:[...r.filter((e=>!uA(e))),Sh({units:i},n?.getSetComputeUnitLimitInstructionConfig)]}}catch(t){return e}})(e,this.#h.getRpc(n)):e)),l=ul([c],u);return await hl(l)}async#R(e,t){const{privateKeyBytes:n}=await iy({entropySource:t.entropySource,derivationPath:t.derivationPath});return Xu([await vc(n)],e)}}var fA,hA=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],pA=function(){function e(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return e.prototype.resize_if_necessary=function(e){if(this.buffer_size-this.offset<e){this.buffer_size=Math.max(2*this.buffer_size,this.buffer_size+e);var t=new ArrayBuffer(this.buffer_size);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t,this.view=new DataView(t)}},e.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},e.prototype.store_value=function(e,t){var n=t.substring(1),r=parseInt(n)/8;this.resize_if_necessary(r);var o="f"===t[0]?"setFloat".concat(n):"i"===t[0]?"setInt".concat(n):"setUint".concat(n);this.view[o](this.offset,e,!0),this.offset+=r},e.prototype.store_bytes=function(e){this.resize_if_necessary(e.length),new Uint8Array(this.buffer).set(new Uint8Array(e),this.offset),this.offset+=e.length},e}(),gA=function(){function e(e){this.offset=0,this.buffer_size=e.length,this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e),this.view=new DataView(this.buffer)}return e.prototype.assert_enough_buffer=function(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},e.prototype.consume_value=function(e){var t=e.substring(1),n=parseInt(t)/8;this.assert_enough_buffer(n);var r="f"===e[0]?"getFloat".concat(t):"i"===e[0]?"getInt".concat(t):"getUint".concat(t),o=this.view[r](this.offset,!0);return this.offset+=n,o},e.prototype.consume_bytes=function(e){this.assert_enough_buffer(e);var t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t},e}(),mA=(fA=function(e,t){return fA=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},fA(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}fA(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});function yA(e,t,n){if(typeof e!==t)throw new Error("Expected ".concat(t," not ").concat(typeof e,"(").concat(e,") at ").concat(n.join(".")))}function vA(e,t,n){if(e!==t)throw new Error("Array length ".concat(e," does not match schema length ").concat(t," at ").concat(n.join(".")))}var wA=hA.concat(["bool","string"]),AA=["option","enum","array","set","map","struct"],bA=function(e){function t(t,n){var r="Invalid schema: ".concat(JSON.stringify(t)," expected ").concat(n);return e.call(this,r)||this}return mA(t,e),t}(Error);function SA(e){if("string"!=typeof e||!wA.includes(e)){if(e&&"object"==typeof e){var t=Object.keys(e);if(1===t.length&&AA.includes(t[0])){var n=t[0];if("option"===n)return SA(e[n]);if("enum"===n)return function(e){if(!Array.isArray(e))throw new bA(e,"Array");for(var t=0,n=e;t<n.length;t++){var r=n[t];if("object"!=typeof r||!("struct"in r))throw new Error('Missing "struct" key in enum schema');if("object"!=typeof r.struct||1!==Object.keys(r.struct).length)throw new Error('The "struct" in each enum must have a single key');SA({struct:r.struct})}}(e[n]);if("array"===n)return function(e){if("object"!=typeof e)throw new bA(e,"{ type, len? }");if(e.len&&"number"!=typeof e.len)throw new Error("Invalid schema: ".concat(e));if("type"in e)return SA(e.type);throw new bA(e,"{ type, len? }")}(e[n]);if("set"===n)return SA(e[n]);if("map"===n)return function(e){if("object"!=typeof e||!("key"in e)||!("value"in e))throw new bA(e,"{ key, value }");SA(e.key),SA(e.value)}(e[n]);if("struct"===n)return function(e){if("object"!=typeof e)throw new bA(e,"object");for(var t in e)SA(e[t])}(e[n])}}throw new bA(e,AA.join(", ")+" or "+wA.join(", "))}}!function(){function e(e){this.encoded=new pA,this.fieldPath=["value"],this.checkTypes=e}e.prototype.encode=function(e,t){return this.encode_value(e,t),this.encoded.get_used_buffer()},e.prototype.encode_value=function(e,t){if("string"==typeof t){if(hA.includes(t))return this.encode_integer(e,t);if("string"===t)return this.encode_string(e);if("bool"===t)return this.encode_boolean(e)}if("object"==typeof t){if("option"in t)return this.encode_option(e,t);if("enum"in t)return this.encode_enum(e,t);if("array"in t)return this.encode_array(e,t);if("set"in t)return this.encode_set(e,t);if("map"in t)return this.encode_map(e,t);if("struct"in t)return this.encode_struct(e,t)}},e.prototype.encode_integer=function(e,t){var n=parseInt(t.substring(1));n<=32||"f64"==t?(this.checkTypes&&yA(e,"number",this.fieldPath),this.encoded.store_value(e,t)):(this.checkTypes&&function(e,t){if(!(["number","string","bigint","boolean"].includes(typeof e)||"object"==typeof e&&null!==e&&"toString"in e))throw new Error("Expected bigint, number, boolean or string not ".concat(typeof e,"(").concat(e,") at ").concat(t.join(".")))}(e,this.fieldPath),this.encode_bigint(BigInt(e),n))},e.prototype.encode_bigint=function(e,t){for(var n=t/8,r=new Uint8Array(n),o=0;o<n;o++)r[o]=Number(e&BigInt(255)),e>>=BigInt(8);this.encoded.store_bytes(new Uint8Array(r))},e.prototype.encode_string=function(e){this.checkTypes&&yA(e,"string",this.fieldPath);for(var t=e,n=[],r=0;r<t.length;r++){var o=t.charCodeAt(r);o<128?n.push(o):o<2048?n.push(192|o>>6,128|63&o):o<55296||o>=57344?n.push(224|o>>12,128|o>>6&63,128|63&o):(r++,o=65536+((1023&o)<<10|1023&t.charCodeAt(r)),n.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o))}this.encoded.store_value(n.length,"u32"),this.encoded.store_bytes(new Uint8Array(n))},e.prototype.encode_boolean=function(e){this.checkTypes&&yA(e,"boolean",this.fieldPath),this.encoded.store_value(e?1:0,"u8")},e.prototype.encode_option=function(e,t){null==e?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(e,t.option))},e.prototype.encode_enum=function(e,t){this.checkTypes&&function(e,t){if("object"!=typeof e||null===e)throw new Error("Expected object not ".concat(typeof e,"(").concat(e,") at ").concat(t.join(".")))}(e,this.fieldPath);for(var n=Object.keys(e)[0],r=0;r<t.enum.length;r++){var o=t.enum[r];if(n===Object.keys(o.struct)[0])return this.encoded.store_value(r,"u8"),this.encode_struct(e,o)}throw new Error("Enum key (".concat(n,") not found in enum schema: ").concat(JSON.stringify(t)," at ").concat(this.fieldPath.join(".")))},e.prototype.encode_array=function(e,t){if(function(e){return Array.isArray(e)||!!e&&"object"==typeof e&&"length"in e&&"number"==typeof e.length&&(0===e.length||e.length>0&&e.length-1 in e)}(e))return this.encode_arraylike(e,t);if(e instanceof ArrayBuffer)return this.encode_buffer(e,t);throw new Error("Expected Array-like not ".concat(typeof e,"(").concat(e,") at ").concat(this.fieldPath.join(".")))},e.prototype.encode_arraylike=function(e,t){t.array.len?vA(e.length,t.array.len,this.fieldPath):this.encoded.store_value(e.length,"u32");for(var n=0;n<e.length;n++)this.encode_value(e[n],t.array.type)},e.prototype.encode_buffer=function(e,t){t.array.len?vA(e.byteLength,t.array.len,this.fieldPath):this.encoded.store_value(e.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(e))},e.prototype.encode_set=function(e,t){this.checkTypes&&yA(e,"object",this.fieldPath);var n=e instanceof Set?Array.from(e.values()):Object.values(e);this.encoded.store_value(n.length,"u32");for(var r=0,o=n;r<o.length;r++){var i=o[r];this.encode_value(i,t.set)}},e.prototype.encode_map=function(e,t){this.checkTypes&&yA(e,"object",this.fieldPath);var n=e instanceof Map,r=n?Array.from(e.keys()):Object.keys(e);this.encoded.store_value(r.length,"u32");for(var o=0,i=r;o<i.length;o++){var a=i[o];this.encode_value(a,t.map.key),this.encode_value(n?e.get(a):e[a],t.map.value)}},e.prototype.encode_struct=function(e,t){this.checkTypes&&yA(e,"object",this.fieldPath);for(var n=0,r=Object.keys(t.struct);n<r.length;n++){var o=r[n];this.fieldPath.push(o),this.encode_value(e[o],t.struct[o]),this.fieldPath.pop()}}}();var EA=function(){function e(e){this.buffer=new gA(e)}return e.prototype.decode=function(e){return this.decode_value(e)},e.prototype.decode_value=function(e){if("string"==typeof e){if(hA.includes(e))return this.decode_integer(e);if("string"===e)return this.decode_string();if("bool"===e)return this.decode_boolean()}if("object"==typeof e){if("option"in e)return this.decode_option(e);if("enum"in e)return this.decode_enum(e);if("array"in e)return this.decode_array(e);if("set"in e)return this.decode_set(e);if("map"in e)return this.decode_map(e);if("struct"in e)return this.decode_struct(e)}throw new Error("Unsupported type: ".concat(e))},e.prototype.decode_integer=function(e){var t=parseInt(e.substring(1));return t<=32||"f64"==e?this.buffer.consume_value(e):this.decode_bigint(t,e.startsWith("i"))},e.prototype.decode_bigint=function(e,t){void 0===t&&(t=!1);var n=e/8,r=new Uint8Array(this.buffer.consume_bytes(n)),o=r.reduceRight((function(e,t){return e+t.toString(16).padStart(2,"0")}),"");return t&&r[n-1]?BigInt.asIntN(e,BigInt("0x".concat(o))):BigInt("0x".concat(o))},e.prototype.decode_string=function(){for(var e=this.decode_integer("u32"),t=new Uint8Array(this.buffer.consume_bytes(e)),n=[],r=0;r<e;++r){var o=t[r];if(o<128)n.push(o);else if(o<224)n.push((31&o)<<6|63&t[++r]);else if(o<240)n.push((15&o)<<12|(63&t[++r])<<6|63&t[++r]);else{var i=(7&o)<<18|(63&t[++r])<<12|(63&t[++r])<<6|63&t[++r];n.push(i)}}return String.fromCodePoint.apply(String,n)},e.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},e.prototype.decode_option=function(e){var t=this.buffer.consume_value("u8");if(1===t)return this.decode_value(e.option);if(0!==t)throw new Error("Invalid option ".concat(t));return null},e.prototype.decode_enum=function(e){var t,n=this.buffer.consume_value("u8");if(n>e.enum.length)throw new Error("Enum option ".concat(n," is not available"));var r=e.enum[n].struct,o=Object.keys(r)[0];return(t={})[o]=this.decode_value(r[o]),t},e.prototype.decode_array=function(e){for(var t=[],n=e.array.len?e.array.len:this.decode_integer("u32"),r=0;r<n;++r)t.push(this.decode_value(e.array.type));return t},e.prototype.decode_set=function(e){for(var t=this.decode_integer("u32"),n=new Set,r=0;r<t;++r)n.add(this.decode_value(e.set));return n},e.prototype.decode_map=function(e){for(var t=this.decode_integer("u32"),n=new Map,r=0;r<t;++r){var o=this.decode_value(e.map.key),i=this.decode_value(e.map.value);n.set(o,i)}return n},e.prototype.decode_struct=function(e){var t={};for(var n in e.struct)t[n]=this.decode_value(e.struct[n]);return t},e}();function kA(e,t,n){return void 0===n&&(n=!0),n&&SA(e),new EA(t).decode(e)}var IA=(e=>(e[e.Uninitialized=0]="Uninitialized",e[e.Initialized=1]="Initialized",e[e.Frozen=2]="Frozen",e))(IA||{});const TA=Ys(),_A=(Ps(),js()),xA=$s(),CA=za(Zc([["mint",Zs()],["owner",Zs()],["amount",ls()],["delegate",Bh(Zs(),{prefix:cs(),noneValue:"zeroes"})],["state",Wc(IA)],["isNative",Bh(ls(),{prefix:cs(),noneValue:"zeroes"})],["delegatedAmount",ls()],["closeAuthority",Bh(Zs(),{prefix:cs(),noneValue:"zeroes"})]]),Jc([["mint",Js()],["owner",Js()],["amount",ds()],["delegate",Oh(Js(),{prefix:us(),noneValue:"zeroes"})],["state",Vc(IA)],["isNative",Oh(ds(),{prefix:us(),noneValue:"zeroes"})],["delegatedAmount",ds()],["closeAuthority",Oh(Js(),{prefix:us(),noneValue:"zeroes"})]]));var RA;!function(e){e.SymbolNotFound="SymbolNotFound",e.InvalidSubdomain="InvalidSubdomain",e.PrimaryDomainNotFound="PrimaryDomainNotFound",e.MissingParentOwner="MissingParentOwner",e.U32Overflow="U32Overflow",e.InvalidBufferLength="InvalidBufferLength",e.U64Overflow="U64Overflow",e.NoRecordData="NoRecordData",e.InvalidRecordData="InvalidRecordData",e.UnsupportedRecord="UnsupportedRecord",e.InvalidEvmAddress="InvalidEvmAddress",e.InvalidInjectiveAddress="InvalidInjectiveAddress",e.InvalidARecord="InvalidARecord",e.InvalidAAAARecord="InvalidAAAARecord",e.InvalidRecordInput="InvalidRecordInput",e.InvalidSignature="InvalidSignature",e.AccountDoesNotExist="AccountDoesNotExist",e.MultipleRegistries="MultipleRegistries",e.InvalidReverseTwitter="InvalidReverseTwitter",e.NoAccountData="NoAccountData",e.InvalidInput="InvalidInput",e.InvalidDomain="InvalidDomain",e.InvalidCustomBg="InvalidCustomBackground",e.UnsupportedSignature="UnsupportedSignature",e.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",e.RecordIsNotSigned="RecordIsNotSigned",e.UnsupportedSignatureType="UnsupportedSignatureType",e.InvalidSolRecordV2="InvalidSolRecordV2",e.MissingVerifier="MissingVerifier",e.PythFeedNotFound="PythFeedNotFound",e.InvalidRoA="InvalidRoA",e.InvalidPda="InvalidPda",e.InvalidParent="InvalidParent",e.NftAccountNotFound="NftRecordNotFound",e.PdaOwnerNotAllowed="PdaOwnerNotAllowed",e.DomainDoesNotExist="DomainDoesNotExist",e.RecordMalformed="RecordMalformed",e.CouldNotFindNftOwner="CouldNotFindNftOwner",e.InvalidValidation="InvalidValidation",e.InvalidSerializedData="InvalidSerializedData"}(RA||(RA={}));class PA extends Error{type;constructor(e,t){super(t),this.name="SNSError",this.type=e,Error.captureStackTrace&&Error.captureStackTrace(this,PA)}}class NA extends PA{constructor(e){super(RA.PrimaryDomainNotFound,e)}}class BA extends PA{constructor(e){super(RA.NoRecordData,e)}}class OA extends PA{constructor(e){super(RA.AccountDoesNotExist,e)}}class MA extends PA{constructor(e){super(RA.NoAccountData,e)}}class zA extends PA{constructor(e){super(RA.InvalidInput,e)}}class jA extends PA{constructor(e){super(RA.InvalidRoA,e)}}class UA extends PA{constructor(e){super(RA.NftAccountNotFound,e)}}class DA extends PA{constructor(e){super(RA.PdaOwnerNotAllowed,e)}}class LA extends PA{constructor(e){super(RA.DomainDoesNotExist,e)}}class FA extends PA{constructor(e){super(RA.RecordMalformed,e)}}class $A extends PA{constructor(e){super(RA.CouldNotFindNftOwner,e)}}class qA extends PA{constructor(e){super(RA.InvalidValidation,e)}}class WA extends PA{constructor(e){super(RA.InvalidSerializedData,e)}}class VA{static HEADER_LEN=96;parentName;owner;class;data;static schema={struct:{parentName:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},class:{array:{type:"u8",len:32}}}};constructor(e){this.parentName=TA.decode(e.parentName),this.owner=TA.decode(e.owner),this.class=TA.decode(e.class)}static deserialize(e){try{const t=new VA(kA(this.schema,e));return t.data=e?.slice(this.HEADER_LEN),t}catch{throw new Error("Failed to deserialize RegistryState data")}}static async retrieve(e,t){const n=await Rm(e,t);if(!n.exists)throw new OA("The domain account does not exist");return this.deserialize(n.data)}static async _retrieveBatch(e,t){return(await Pm(e,t)).map((e=>e.exists?this.deserialize(e.data):void 0))}static async retrieveBatch(e,t){const n=[],r=[...t];for(;r.length>0;)n.push(...await this._retrieveBatch(e,r.splice(0,100)));return n}}const KA="58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx",GA="nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk",HA="33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z",ZA="2pMnqHvei2N5oDcVGCRdZx48gqti199wr5CsyTTafsbo",JA=async(e,t,n)=>{const r=await(async e=>{const t=xA.encode("SPL Name Service"+e),n=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(n)})(e);return await(async(e,t,n)=>{const r=[e];r.push(n?TA.encode(n):new Uint8Array(32)),r.push(t?TA.encode(t):new Uint8Array(32));const[o]=await lc({programAddress:"namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX",seeds:r});return o})(r,t,n)};var YA;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.CentralState=1]="CentralState",e[e.ActiveRecord=2]="ActiveRecord",e[e.InactiveRecord=3]="InactiveRecord"}(YA||(YA={}));class QA{tag;nonce;nameAccount;owner;nftMint;static LEN=98;static schema={struct:{tag:"u8",nonce:"u8",nameAccount:{array:{type:"u8",len:32}},owner:{array:{type:"u8",len:32}},nftMint:{array:{type:"u8",len:32}}}};constructor(e){this.tag=e.tag,this.nonce=e.nonce,this.nameAccount=TA.decode(e.nameAccount),this.owner=TA.decode(e.owner),this.nftMint=TA.decode(e.nftMint)}static deserialize(e){try{return new QA(kA(this.schema,e))}catch{throw new WA("Failed to deserialize NftState data")}}static async retrieve(e,t){const n=await Rm(e,t);if(!n.exists)throw new UA(`NFT not found: ${t}`);return this.deserialize(n.data)}static async retrieveFromMint(e,t){const n=await e.getProgramAccounts(GA,{encoding:"base64",filters:[{dataSize:BigInt(QA.LEN)},{memcmp:{offset:BigInt(0),bytes:"3",encoding:"base58"}},{memcmp:{offset:BigInt(66),bytes:t,encoding:"base58"}}]}).send();if(1!==n.length)throw new UA(`NFT not found: ${t}`);return this.deserialize(_A.encode(n[0].account.data[0]))}static async getAddress(e){const[t]=await lc({programAddress:GA,seeds:[xA.encode("nft_record"),TA.encode(e)]});return t}}const XA=xA.encode("tokenized_name"),eb=async(e,t)=>{try{const n=await(async e=>{const[t]=await lc({programAddress:GA,seeds:[XA,TA.encode(e)]});return t})(t),r=await e.getTokenLargestAccounts(n).send();if(0===r.value.length)return null;const o=await Rm(e,r.value[0].address);if(!o.exists)return null;const i=CA.decode(o.data);return"1"===i.amount.toString()?i.owner:null}catch(e){if(wa(e,Yo))return null;throw e}};class tb{tag;nameAccount;static schema={struct:{tag:"u8",nameAccount:{array:{type:"u8",len:32}}}};constructor(e){this.tag=e.tag,this.nameAccount=TA.decode(e.nameAccount)}static deserialize(e){try{return new tb(kA(this.schema,e))}catch{throw new WA("Failed to deserialize PrimaryDomainState data")}}static async retrieve(e,t){const n=await Rm(e,t);if(!n.exists)throw new NA("The favourite account does not exist");return this.deserialize(n.data)}static async _retrieveBatch(e,t){return(await Pm(e,t)).map((e=>e.exists?this.deserialize(e.data):void 0))}static async retrieveBatch(e,t){const n=[],r=[...t];for(;r.length>0;)n.push(...await this._retrieveBatch(e,r.splice(0,100)));return n}static async getAddress(e,t){const[n]=await lc({programAddress:e,seeds:[xA.encode("favourite_domain"),TA.encode(t)]});return n}}async function nb(e,t,n){const r=await(async(e,t)=>await JA(e,t,HA))(t,n),o=await VA.retrieve(e,r);if(!o.data)throw new MA("The registry data is empty");return function(e,t=!1){if(!e)return;const n=new DataView(e.buffer).getUint32(0,!0);return xA.decode(e.subarray(4,4+n)).replace(/^\0/,t?"":"\0")}(o.data,!!n)}var rb;!function(e){e.IPFS="IPFS",e.ARWV="ARWV",e.SOL="SOL",e.ETH="ETH",e.BTC="BTC",e.LTC="LTC",e.DOGE="DOGE",e.Email="email",e.Url="url",e.Discord="discord",e.Github="github",e.Reddit="reddit",e.Twitter="twitter",e.Telegram="telegram",e.Pic="pic",e.SHDW="SHDW",e.POINT="POINT",e.BSC="BSC",e.Injective="INJ",e.Backpack="backpack",e.A="A",e.AAAA="AAAA",e.CNAME="CNAME",e.TXT="TXT",e.Background="background",e.BASE="BASE",e.IPNS="IPNS"}(rb||(rb={}));new Map([[rb.SOL,96],[rb.ETH,20],[rb.BSC,20],[rb.Injective,20],[rb.A,4],[rb.AAAA,16],[rb.Background,32]]);var ob;!function(e){e[e.V1=1]="V1",e[e.V2=2]="V2"}(ob||(ob={}));const ib=async(e,t)=>{e.endsWith(".sol")&&(e=e.slice(0,-4));const n=t===ob.V2?ZA:void 0,r={[ob.V2]:"",[ob.V1]:""}[t]||"\0",o=e.split(".");if(2===o.length){const e=await JA(o[1],KA);return{address:await JA(r+o[0],e,n),parentAddress:e,isSub:!0}}if(3===o.length&&t){const e=await JA(o[2],KA),t=await JA("\0"+o[1],e);return{address:await JA(r+o[0],t,n),parentAddress:e,isSub:!0,isSubRecord:!0}}if(o.length>=3)throw new zA("The domain is malformed");return{address:await JA(e,KA),isSub:!1}};function ab(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function sb(e,t){return!!Array.isArray(t)&&(0===t.length||(e?t.every((e=>"string"==typeof e)):t.every((e=>Number.isSafeInteger(e)))))}function cb(e,t){if("string"!=typeof t)throw new Error(`${e}: string expected`);return!0}function ub(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function lb(e){if(!Array.isArray(e))throw new Error("array expected")}function db(e,t){if(!sb(!0,t))throw new Error(`${e}: array of strings expected`)}function fb(e,t){if(!sb(!1,t))throw new Error(`${e}: array of numbers expected`)}const hb=(e,t)=>0===t?e:hb(t,e%t),pb=(e,t)=>e+(t-hb(e,t)),gb=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function mb(e,t,n,r){if(lb(e),t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(pb(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${pb(t,n)}`);let o=0,i=0;const a=gb[t],s=gb[n]-1,c=[];for(const r of e){if(ub(r),r>=a)throw new Error(`convertRadix2: invalid data word=${r} from=${t}`);if(o=o<<t|r,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=n;i-=n)c.push((o>>i-n&s)>>>0);const e=gb[i];if(void 0===e)throw new Error("invalid carry");o&=e-1}if(o=o<<n-i&s,!r&&i>=t)throw new Error("Excess padding");if(!r&&o>0)throw new Error(`Non-zero padding: ${o}`);return r&&i>0&&c.push(o>>>0),c}function yb(e){return function(e){if("function"!=typeof e)throw new Error("function expected")}(e),function(...t){try{return e.apply(null,t)}catch(e){}}}const vb=function(...e){const t=e=>e,n=(e,t)=>n=>e(t(n));return{encode:e.map((e=>e.encode)).reduceRight(n,t),decode:e.map((e=>e.decode)).reduce(n,t)}}(function(e){const t=e.split(""),n=t.length;db("alphabet",t);const r=new Map(t.map(((e,t)=>[e,t])));return{encode:r=>(lb(r),r.map((r=>{if(!Number.isSafeInteger(r)||r<0||r>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${r}". Allowed: ${e}`);return t[r]}))),decode:t=>(lb(t),t.map((t=>{cb("alphabet.decode",t);const n=r.get(t);if(void 0===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n})))}}("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),function(e=""){return cb("join",e),{encode:t=>(db("join.decode",t),t.join(e)),decode:t=>(cb("join.decode",t),t.split(e))}}("")),wb=[996825010,642813549,513874426,1027748829,705979059];function Ab(e){const t=e>>25;let n=(33554431&e)<<5;for(let e=0;e<wb.length;e++)1==(t>>e&1)&&(n^=wb[e]);return n}function bb(e,t,n=1){const r=e.length;let o=1;for(let t=0;t<r;t++){const n=e.charCodeAt(t);if(n<33||n>126)throw new Error(`Invalid prefix (${e})`);o=Ab(o)^n>>5}o=Ab(o);for(let t=0;t<r;t++)o=Ab(o)^31&e.charCodeAt(t);for(let e of t)o=Ab(o)^e;for(let e=0;e<6;e++)o=Ab(o);return o^=n,vb.encode(mb([o%gb[30]],30,5,!1))}!function(e){const t=function(e,t=!1){if(ub(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(pb(8,e)>32||pb(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!ab(n))throw new Error("radix2.encode input should be Uint8Array");return mb(Array.from(n),8,e,!t)},decode:n=>(fb("radix2.decode",n),Uint8Array.from(mb(n,e,8,t)))}}(5),n=t.decode,r=t.encode,o=yb(n);function i(e,t,n=90){cb("bech32.encode prefix",e),ab(t)&&Array.from(t),fb("bech32.encode",t);const r=e.length;if(0===r)throw new TypeError(`Invalid prefix length ${r}`);const o=r+7+t.length;if(!1!==n&&o>n)throw new TypeError(`Length ${o} exceeds limit ${n}`);const i=e.toLowerCase(),a=bb(i,t,1);return`${i}1${vb.encode(t)}${a}`}function a(e,t=90){cb("bech32.decode input",e);const n=e.length;if(n<8||!1!==t&&n>t)throw new TypeError(`invalid string length: ${n} (${e}). Expected (8..${t})`);const r=e.toLowerCase();if(e!==r&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const o=r.lastIndexOf("1");if(0===o||-1===o)throw new Error('Letter "1" must be present between prefix and data only');const i=r.slice(0,o),a=r.slice(o+1);if(a.length<6)throw new Error("Data must be at least 6 characters long");const s=vb.decode(a).slice(0,-6),c=bb(i,s,1);if(!a.endsWith(c))throw new Error(`Invalid checksum in ${e}: expected "${c}"`);return{prefix:i,words:s}}yb(a)}();var Sb,Eb={exports:{}},kb=Eb.exports;!function(){return Sb||(Sb=1,e=Eb,function(t){const n="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,"i"),threeOctet:new RegExp(`^${n}\\.${n}\\.${n}$`,"i"),twoOctet:new RegExp(`^${n}\\.${n}$`,"i"),longValue:new RegExp(`^${n}$`,"i")},o=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${n}\\.${n}\\.${n}\\.${n}(${a})?$`,"i")};function u(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let n,r,o=0,i=-1,a=(e.match(c.zoneIndex)||[])[0];for(a&&(a=a.substring(1),e=e.replace(/%.+$/,""));(i=e.indexOf(":",i+1))>=0;)o++;if("::"===e.substr(0,2)&&o--,"::"===e.substr(-2,2)&&o--,o>t)return null;for(r=t-o,n=":";r--;)n+="0:";return":"===(e=e.replace("::",n))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),{parts:t=function(){const t=e.split(":"),n=[];for(let e=0;e<t.length;e++)n.push(parseInt(t[e],16));return n}(),zoneId:a}}function l(e,t,n,r){if(e.length!==t.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let o,i=0;for(;r>0;){if(o=n-r,o<0&&(o=0),e[i]>>o!=t[i]>>o)return!1;r-=n,i+=1}return!0}function d(e){if(i.test(e))return parseInt(e,16);if("0"===e[0]&&!isNaN(parseInt(e[1],10))){if(o.test(e))return parseInt(e,8);throw new Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function f(e,t){for(;e.length<t;)e=`0${e}`;return e}const h={};h.IPv4=function(){function e(e){if(4!==e.length)throw new Error("ipaddr: ipv4 octet count should be 4");let t,n;for(t=0;t<e.length;t++)if(n=e[t],!(0<=n&&n<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return"ipv4"},e.prototype.match=function(e,t){let n;if(void 0===t&&(n=e,e=n[0],t=n[1]),"ipv4"!==e.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return l(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const n={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let r,o,i;for(r=3;r>=0;r-=1){if(o=this.octets[r],!(o in n))return null;if(i=n[o],t&&0!==i)return null;8!==i&&(t=!0),e+=i}return 32-e},e.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return h.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),h.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[];let i=0;for(;i<4;)o.push(parseInt(n[i],10)|255^parseInt(r[i],10)),i++;return new this(o)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.isIPv4=function(e){return null!==this.parser(e)},h.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(e){return!1}},h.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch(e){return!1}},h.IPv4.isValidFourPartDecimal=function(e){return!(!h.IPv4.isValid(e)||!e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},h.IPv4.networkAddressFromCIDR=function(e){let t,n,r,o,i;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[],n=0;n<4;)o.push(parseInt(r[n],10)&parseInt(i[n],10)),n++;return new this(o)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.parse=function(e){const t=this.parser(e);if(null===t)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},h.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const e=parseInt(t[2]);if(e>=0&&e<=32){const n=[this.parse(t[1]),e];return Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},h.IPv4.parser=function(e){let t,n,o;if(t=e.match(r.fourOctet))return function(){const e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(d(n));return r}();if(t=e.match(r.longValue)){if(o=d(t[1]),o>4294967295||o<0)throw new Error("ipaddr: address outside defined range");return function(){const e=[];let t;for(t=0;t<=24;t+=8)e.push(o>>t&255);return e}().reverse()}return(t=e.match(r.twoOctet))?function(){const e=t.slice(1,4),n=[];if(o=d(e[1]),o>16777215||o<0)throw new Error("ipaddr: address outside defined range");return n.push(d(e[0])),n.push(o>>16&255),n.push(o>>8&255),n.push(255&o),n}():(t=e.match(r.threeOctet))?function(){const e=t.slice(1,5),n=[];if(o=d(e[2]),o>65535||o<0)throw new Error("ipaddr: address outside defined range");return n.push(d(e[0])),n.push(d(e[1])),n.push(o>>8&255),n.push(255&o),n}():null},h.IPv4.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let n=0;const r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<4&&(t[r]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},h.IPv6=function(){function e(e,t){let n,r;if(16===e.length)for(this.parts=[],n=0;n<=14;n+=2)this.parts.push(e[n]<<8|e[n+1]);else{if(8!==e.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=e}for(n=0;n<this.parts.length;n++)if(r=this.parts[n],!(0<=r&&r<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[new e([100,65435,0,0,0,0,0,0]),96],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32]]},e.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},e.prototype.kind=function(){return"ipv6"},e.prototype.match=function(e,t){let n;if(void 0===t&&(n=e,e=n[0],t=n[1]),"ipv6"!==e.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return l(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const n={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let r,o;for(let i=7;i>=0;i-=1){if(r=this.parts[i],!(r in n))return null;if(o=n[r],t&&0!==o)return null;16!==o&&(t=!0),e+=o}return 128-e},e.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e;const t=[],n=this.parts;for(let r=0;r<n.length;r++)e=n[r],t.push(e>>8),t.push(255&e);return t},e.prototype.toFixedLengthString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(f(this.parts[t].toString(16),4));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const e=this.parts.slice(-2),t=e[0],n=e[1];return new h.IPv4([t>>8,255&t,n>>8,255&n])},e.prototype.toNormalizedString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}.call(this).join(":");let t="";return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){const e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString();let n,r=0,o=-1;for(;n=e.exec(t);)n[0].length>o&&(r=n.index,o=n[0].length);return o<0?t:`${t.substring(0,r)}::${t.substring(r+o)}`},e.prototype.toString=function(){return this.toRFC5952String()},e}(),h.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[];let i=0;for(;i<16;)o.push(parseInt(n[i],10)|255^parseInt(r[i],10)),i++;return new this(o)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},h.IPv6.isIPv6=function(e){return null!==this.parser(e)},h.IPv6.isValid=function(e){if("string"==typeof e&&-1===e.indexOf(":"))return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch(e){return!1}},h.IPv6.isValidCIDR=function(e){if("string"==typeof e&&-1===e.indexOf(":"))return!1;try{return this.parseCIDR(e),!0}catch(e){return!1}},h.IPv6.networkAddressFromCIDR=function(e){let t,n,r,o,i;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),i=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),o=[],n=0;n<16;)o.push(parseInt(r[n],10)&parseInt(i[n],10)),n++;return new this(o)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},h.IPv6.parse=function(e){const t=this.parser(e);if(null===t.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},h.IPv6.parseCIDR=function(e){let t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},h.IPv6.parser=function(e){let t,n,r,o,i,a;if(r=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${r[1]}`);if(c.native.test(e))return u(e,8);if((r=e.match(c.transitional))&&(a=r[6]||"",t=r[1],r[1].endsWith("::")||(t=t.slice(0,-1)),t=u(t+a,6),t.parts)){for(i=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],n=0;n<i.length;n++)if(o=i[n],!(0<=o&&o<=255))return null;return t.parts.push(i[0]<<8|i[1]),t.parts.push(i[2]<<8|i[3]),{parts:t.parts,zoneId:t.zoneId}}return null},h.IPv6.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let n=0;const r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<16&&(t[r]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},h.fromByteArray=function(e){const t=e.length;if(4===t)return new h.IPv4(e);if(16===t)return new h.IPv6(e);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},h.isValid=function(e){return h.IPv6.isValid(e)||h.IPv4.isValid(e)},h.isValidCIDR=function(e){return h.IPv6.isValidCIDR(e)||h.IPv4.isValidCIDR(e)},h.parse=function(e){if(h.IPv6.isValid(e))return h.IPv6.parse(e);if(h.IPv4.isValid(e))return h.IPv4.parse(e);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},h.parseCIDR=function(e){try{return h.IPv6.parseCIDR(e)}catch(t){try{return h.IPv4.parseCIDR(e)}catch(e){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},h.process=function(e){const t=this.parse(e);return"ipv6"===t.kind()&&t.isIPv4MappedAddress()?t.toIPv4Address():t},h.subnetMatch=function(e,t,n){let r,o,i,a;for(o in null==n&&(n="unicast"),t)if(Object.prototype.hasOwnProperty.call(t,o))for(i=t[o],!i[0]||i[0]instanceof Array||(i=[i]),r=0;r<i.length;r++)if(a=i[r],e.kind()===a[0].kind()&&e.match.apply(e,a))return o;return n},e.exports?e.exports=h:t.ipaddr=h}(kb)),Eb.exports;var e}();Math.floor,String.fromCharCode;new Map([[rb.CNAME,"ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3"],[rb.Url,"ExXjtfdQe8JacoqP9Z535WzQKjF4CzW1TTRKRgpxvya3"]]),new Set([rb.BASE,rb.BSC,rb.ETH,rb.Injective]),new Set([rb.BASE,rb.BSC,rb.ETH]),new Set([rb.ARWV,rb.Backpack,rb.BTC,rb.CNAME,rb.Discord,rb.DOGE,rb.Email,rb.Github,rb.IPFS,rb.IPNS,rb.LTC,rb.Pic,rb.POINT,rb.Reddit,rb.SHDW,rb.Telegram,rb.Twitter,rb.TXT,rb.Url]),new Set([rb.BASE,rb.BSC,rb.ETH,rb.Injective,rb.SOL]);new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",[234,160,32,198,28,196,121,113,40,19,70,28,225,83,137,74,150,166,192,11,33,237,12,252,39,152,209,249,169,233,201,74]],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",[43,137,185,220,143,223,159,52,112,154,91,16,107,71,47,15,57,187,108,169,206,4,176,253,127,46,151,22,136,226,229,59]],["So11111111111111111111111111111111111111112",[239,13,139,111,218,44,235,164,29,161,93,64,149,209,218,57,42,13,47,142,208,198,199,188,15,76,250,200,194,128,181,109]],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",[200,6,87,183,246,243,234,194,114,24,208,157,90,78,84,228,123,37,118,141,159,94,16,172,21,254,44,249,0,136,20,0]],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",[194,40,154,106,67,210,206,145,198,245,92,174,195,112,244,172,195,138,46,212,119,245,136,19,51,76,109,3,116,159,242,164]],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",[114,176,33,33,124,163,254,104,146,42,25,170,249,144,16,156,185,216,78,154,208,4,180,210,2,90,214,245,41,49,68,25]],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz",[142,134,15,183,78,96,229,115,107,69,93,130,246,11,55,40,4,156,52,142,148,150,26,221,95,150,27,2,253,238,37,53]],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3",[11,191,40,233,168,65,161,204,120,143,106,54,27,23,202,7,45,14,163,9,138,30,93,241,195,146,45,6,113,149,121,255]],["bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1",[137,135,83,121,231,15,143,186,220,23,174,243,21,173,243,168,213,209,96,184,17,67,85,55,224,60,151,232,170,201,125,156]],["6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB",[122,91,193,210,181,106,208,41,4,140,214,57,100,179,173,39,118,234,223,129,46,220,26,67,163,20,6,203,84,191,245,146]],["6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN",[135,149,81,2,24,83,238,199,167,220,130,117,120,232,230,157,167,228,250,129,72,51,154,160,211,213,41,100,5,190,75,26]]]);var Ib;!function(e){e[e.None=0]="None",e[e.Solana=1]="Solana",e[e.Ethereum=2]="Ethereum",e[e.UnverifiedSolana=3]="UnverifiedSolana"}(Ib||(Ib={}));const Tb=e=>{switch(e){case Ib.None:return 0;case Ib.Ethereum:return 20;case Ib.Solana:case Ib.UnverifiedSolana:return 32;default:throw new Error("Invalid validation enum")}};class _b{stalenessValidation;rightOfAssociationValidation;contentLength;static LEN=8;static schema={struct:{stalenessValidation:"u16",rightOfAssociationValidation:"u16",contentLength:"u32"}};constructor(e){this.stalenessValidation=e.stalenessValidation,this.rightOfAssociationValidation=e.rightOfAssociationValidation,this.contentLength=e.contentLength}static deserialize(e){return new _b(kA(this.schema,e,!0))}static async retrieve(e,t){const n=await Rm(e,t);if(!n.exists)throw new Error("Record header account not found");return this.deserialize(n.data.slice(96,96+this.LEN))}}class xb{header;data;constructor(e,t){this.data=t,this.header=e}static deserialize(e){const t=_b.deserialize(e.slice(96,96+_b.LEN));return new xb(t,e.slice(96+_b.LEN))}static async retrieve(e,t){const n=await Rm(e,t);if(!n.exists)throw new BA("Record account not found");return this.deserialize(n.data)}static async retrieveBatch(e,t){return(await Pm(e,t)).map((e=>e.exists?this.deserialize(e.data):void 0))}getContent(){const e=Tb(this.header.stalenessValidation)+Tb(this.header.rightOfAssociationValidation);return this.data.slice(e)}getStalenessId(){const e=Tb(this.header.stalenessValidation);return this.data.slice(0,e)}getRoAId(){const e=Tb(this.header.stalenessValidation),t=e+Tb(this.header.rightOfAssociationValidation);return this.data.slice(e,t)}}const Cb=57896044618658097711785492504343953926634992332820282019728792003956564819949n,Rb=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function Pb(e){const t=e%Cb;return t>=0n?t:Cb+t}function Nb(e,t){let n=e;for(;t-- >0n;)n*=n,n%=Cb;return n}function Bb(e,t){const n=Pb(e*e),r=function(e,t){const n=Pb(t*t*t),r=function(e){const t=e*e%Cb*e%Cb,n=Nb(t,2n)*t%Cb,r=Nb(n,1n)*e%Cb,o=Nb(r,5n)*r%Cb,i=Nb(o,10n)*o%Cb,a=Nb(i,20n)*i%Cb,s=Nb(a,40n)*a%Cb,c=Nb(s,80n)*s%Cb,u=Nb(c,80n)*s%Cb,l=Nb(u,10n)*o%Cb;return Nb(l,2n)*e%Cb}(e*Pb(n*n*t));let o=Pb(e*n*r);const i=Pb(t*o*o),a=o,s=Pb(o*Rb),c=i===e,u=i===Pb(-e),l=i===Pb(-e*Rb);return c&&(o=a),(u||l)&&(o=s),1n===(1n&Pb(o))&&(o=Pb(-o)),c||u?o:null}(Pb(n-1n),Pb(37095705934669439343138083508754565189542113879843219016388785533085940283555n*n+1n));return null!==r&&(0n!==r||!(128&t))}const Ob=async(e,t,n={allowPda:!1})=>{const{address:r}=await ib(t),o=await QA.getAddress(r),i=await(async(e,t)=>{const{address:n}=await ib(t+"."+e,ob.V1);return n})(t,rb.SOL),a=await(async(e,t)=>{const{address:n}=await ib(e);return await JA(`${t}`,n,ZA)})(t,rb.SOL),[s,c,u,l]=await Pm(e,[r,o,i,a]);if(!s.exists)throw new LA(`Domain ${t} does not exist`);const d=VA.deserialize(s.data);if(c.exists&&QA.deserialize(c.data).tag===YA.ActiveRecord){const t=await eb(e,r);if(!t)throw new $A;return t}e:if(l.exists){const e=xb.deserialize(l.data),t=e.getStalenessId(),n=e.getRoAId(),r=e.getContent();if(32!==r.length)throw new FA("Record is malformed");if(e.header.rightOfAssociationValidation!==Ib.Solana||e.header.stalenessValidation!==Ib.Solana)throw new qA;if(d.owner!==TA.decode(t))break e;if(((e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])))(n,r))return TA.decode(r);throw new jA(`The RoA ID shoudl be ${TA.decode(r)} but is ${TA.decode(n)} `)}if(u.exists){const e=new Uint8Array([...u.data.slice(VA.HEADER_LEN,VA.HEADER_LEN+32),...TA.encode(i)]),t=u.data.slice(VA.HEADER_LEN+32,VA.HEADER_LEN+32+64),n=await(async({data:e,signature:t,address:n})=>{const r=await async function(e){const t=Zs().encode(e);return await crypto.subtle.importKey("raw",t,{name:"Ed25519"},!0,["verify"])}(n),o=xA.encode((e=>Array.from(e).map((e=>e.toString(16).padStart(2,"0"))).join(""))(e));return await crypto.subtle.verify({name:"Ed25519"},r,t,o)})({data:e,signature:t,address:d.owner});if(n)return TA.decode(u.data.slice(VA.HEADER_LEN,VA.HEADER_LEN+32))}if(!function(e){const t=TA.encode(e);if(32!==t.byteLength)return!1;return Bb(function(e){const t=e.reduce(((e,t,n)=>`${function(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}(31===n?-129&t:t)}${e}`),"");return BigInt(`0x${t}`)}(t),t[31])}(d.owner)){if("any"===n.allowPda)return d.owner;if(n.allowPda){const t=await Rm(e,d.owner);if(!t.exists)throw new DA("Invalid domain owner account");const r=n.programIds?.some((e=>t.programAddress===e));if(r)return d.owner;throw new DA(`The program ${t.programAddress} is not allowed`)}throw new DA}return d.owner};const Mb=tu(5000n);class zb{#P;constructor(e){this.#P=e}#N(){const e=this.#P.getComputeUnitLimit(),t=this.#P.getComputeUnitPriceMicroLamportsPerComputeUnit();return nu(e,(e=>_o(e)),(e=>e.multipliedBy(t.toString())),(e=>e.dividedToIntegerBy(Jl.toString())),(e=>e.toString()),BigInt,tu)}getFee(){const e=this.#N();return tu(Mb+e)}}Error;function jb(e){return function(e){return function(e){return"object"==typeof e&&null!==e&&"message"in e}(e)&&"string"==typeof e.message?e.message:null==e?"":String(e)}(e).replace(/\.$/u,"")}function Ub(e,t){return n=e,Boolean("string"==typeof n?.prototype?.constructor?.name)?new e({message:t}):e({message:t});var n}class Db extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}function Lb(e,t="Assertion failed.",n=Db){if(!e){if(t instanceof Error)throw t;throw Ub(n,t)}}function Fb(e,t,n="Assertion failed",r=Db){try{Pn(e,t)}catch(e){throw Ub(r,`${n}: ${jb(e)}.`)}}function $b(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function qb(...e){const t=(e,t)=>n=>e(t(n));return{encode:Array.from(e).reverse().reduce(((e,n)=>e?t(e,n.encode):n.encode),void 0),decode:e.reduce(((e,n)=>e?t(e,n.decode):n.decode),void 0)}}function Wb(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map((t=>{if($b(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]}))},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map((t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const n=e.indexOf(t);if(-1===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n}))}}}function Vb(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function Kb(e,t="="){if($b(e),"string"!=typeof t)throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;n.length*e%8;)n.push(t);return n},decode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let r=n.length;if(r*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--)if(!((r-1)*e%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,r)}}}function Gb(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function Hb(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let r=0;const o=[],i=Array.from(e);for(i.forEach((e=>{if($b(e),e<0||e>=t)throw new Error(`Wrong integer: ${e}`)}));;){let e=0,a=!0;for(let o=r;o<i.length;o++){const s=i[o],c=t*e+s;if(!Number.isSafeInteger(c)||t*e/t!==e||c-s!=t*e)throw new Error("convertRadix: carry overflow");e=c%n;const u=Math.floor(c/n);if(i[o]=u,!Number.isSafeInteger(u)||u*n+e!==c)throw new Error("convertRadix: carry overflow");a&&(u?a=!1:r=o)}if(o.push(e),a)break}for(let t=0;t<e.length-1&&0===e[t];t++)o.push(0);return o.reverse()}const Zb=(e,t)=>t?Zb(t,e%t):e,Jb=(e,t)=>e+(t-Zb(e,t));function Yb(e,t,n,r){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(Jb(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${Jb(t,n)}`);let o=0,i=0;const a=2**n-1,s=[];for(const r of e){if($b(r),r>=2**t)throw new Error(`convertRadix2: invalid data word=${r} from=${t}`);if(o=o<<t|r,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=n;i-=n)s.push((o>>i-n&a)>>>0);o&=2**i-1}if(o=o<<n-i&a,!r&&i>=t)throw new Error("Excess padding");if(!r&&o)throw new Error(`Non-zero padding: ${o}`);return r&&i>0&&s.push(o>>>0),s}function Qb(e){return $b(e),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return Hb(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(Hb(t,e,256))}}}function Xb(e,t=!1){if($b(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(Jb(8,e)>32||Jb(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!(n instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return Yb(Array.from(n),8,e,!t)},decode:n=>{if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(Yb(n,e,8,t))}}}const eS=qb(Xb(4),Wb("0123456789ABCDEF"),Vb("")),tS=qb(Xb(5),Wb("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Kb(5),Vb("")),nS=(qb(Xb(5),Wb("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Kb(5),Vb("")),qb(Xb(5),Wb("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),Vb(""),Gb((e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),qb(Xb(6),Wb("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Kb(6),Vb(""))),rS=qb(Xb(6),Wb("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Kb(6),Vb("")),oS=(qb(Xb(6),Wb("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Vb("")),e=>qb(Qb(58),Wb(e),Vb(""))),iS=oS("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),aS=[0,2,3,5,6,7,9,10,11],sS={encode(e){let t="";for(let n=0;n<e.length;n+=8){const r=e.subarray(n,n+8);t+=iS.encode(r).padStart(aS[r.length],"1")}return t},decode(e){let t=[];for(let n=0;n<e.length;n+=11){const r=e.slice(n,n+11),o=aS.indexOf(r.length),i=iS.decode(r);for(let e=0;e<i.length-o;e++)if(0!==i[e])throw new Error("base58xmr: wrong padding");t=t.concat(Array.from(i.slice(i.length-o)))}return Uint8Array.from(t)}};qb(Wb("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),Vb(""));const cS={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)};qb(Xb(4),Wb("0123456789abcdef"),Vb(""),Gb((e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})));n(1048).hp;!function(){const e=[]}();function uS(e){return e instanceof Uint8Array}function lS(e){Lb(uS(e),"Value must be a Uint8Array.")}function dS(e,t,n){return new Jd({...e,*refiner(r,o){yield*e.refiner(r,o);const i=Hd(n(r,o),o,e,r);for(const e of i)yield{...e,refinement:t}}})}var fS;!function(e){e.Copyable="copyable",e.Divider="divider",e.Heading="heading",e.Panel="panel",e.Spinner="spinner",e.Text="text",e.Image="image",e.Row="row",e.Address="address",e.Button="button",e.Input="input",e.Form="form"}(fS||(fS={}));const hS=tf({type:nf()}),pS=(rf(hS,tf({value:of("unknown",(()=>!0))})),rf(hS,tf({type:af(fS.Image),value:dS(nf(),"SVG",(e=>!!e.includes("<svg")||"Value is not a valid SVG."))}))),gS=function(e,t,n=[]){return(...r)=>{if(1===r.length&&Sn(r[0])){const n={...r[0],type:e};return Fb(n,t,`Invalid ${e} component`),n}const o=n.reduce(((e,t,n)=>void 0!==r[n]?{...e,[t]:r[n]}:e),{type:e});return Fb(o,t,`Invalid ${e} component`),o}}(fS.Image,pS,["value"]);async function mS(e,t){const n=await async function(e,t){if("function"!=typeof fetch)throw new Error(`Failed to fetch image data from "${e}": Using this function requires the "endowment:network-access" permission.`);return fetch(e,t).then((async t=>{if(!t.ok)throw new Error(`Failed to fetch image data from "${e}": ${t.status} ${t.statusText}`);const n=await t.blob();return Lb("image/jpeg"===n.type||"image/png"===n.type,"Expected image data to be a JPEG or PNG image."),n}))}(e,t),r=new Uint8Array(await n.arrayBuffer());return`data:${n.type};base64,${function(e){return lS(e),nS.encode(e)}(r)}`}const yS='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48">\n <path fill="#999999" d="M42.75 24c0 10.59375-8.53125 19.21875-19.125 19.21875-10.6875 0-19.21875-8.625-19.21875-19.21875 0-10.59375 8.53125-19.21875 19.21875-19.21875 10.59375 0 19.125 8.625 19.125 19.21875zM23.625 14.0625c-3.09375 0-5.90625 2.25-5.90625 5.4375 0 0.84375 0.75 1.59375 1.59375 1.59375 0.84375 0 1.59375-0.75 1.59375-1.59375 0-1.125 1.03125-2.25 2.71875-2.25 1.59375 0 2.625 1.125 2.625 2.25 0 0.5625-0.375 1.03125-1.3125 1.59375l0 0c-1.125 0.75-3 1.96875-3 4.5l0 0.46875c0 0.84375 0.75 1.59375 1.6875 1.59375 0.84375 0 1.59375-0.75 1.59375-1.59375l0-0.46875c0-0.65625 0.28125-1.125 1.40625-1.78125 1.03125-0.65625 2.8125-1.875 2.8125-4.3125 0-3.1875-2.8125-5.4375-5.8125-5.4375zM23.53125 31.875c-0.84375 0-1.59375 0.65625-1.59375 1.59375 0 0.84375 0.75 1.59375 1.59375 1.59375l0.09375 0c0.84375 0 1.59375-0.75 1.59375-1.59375 0-0.9375-0.75-1.59375-1.59375-1.59375z"/>\n</svg>';function vS(e){return e.includes("swift:0/iso4217:")}var wS=function(e){return e.Benign="Benign",e.Warning="Warning",e.Malicious="Malicious",e}({}),AS=function(e){return e.SUCCESS="SUCCESS",e.ERROR="ERROR",e}({});class bS{#h;#B;#i;#O=4e4;#M=10000n;constructor(e,t,n){this.#h=e,this.#B=t,this.#i=n}async buildTransactionMessage(e){this.#i.log("Build transfer SPL token transaction message");const{from:t,to:n,mint:r,amount:o,network:i}=e;Wo(r,"Mint is required");const a=await this.getTokenAccount({mint:r,network:i});bS.assertAccountExists(a);const s=a.programAddress,c=this.getDecimals(a),u=function(e,t){const n=new _o(e.toString());if(n.isNegative())throw new Error("Token amount cannot be negative");const r=n.times(10**t).integerValue(_o.ROUND_DOWN);return BigInt(r.toString())}(o,c),l=await this.#B.getLatestBlockhash(i),{privateKeyBytes:d}=await iy({entropySource:t.entropySource,derivationPath:t.derivationPath}),f=await dl(d),[h,p]=await Promise.all([bS.deriveAssociatedTokenAccountAddress({mint:r,owner:f.address,tokenProgram:s}),bS.deriveAssociatedTokenAccountAddress({mint:r,owner:n,tokenProgram:s})]),g=nu(Mu({version:0}),(e=>$u(f.address,e)),(e=>ou(l,e)),(e=>Wu([ap({mint:r,payer:f,tokenProgram:s,owner:n,ata:p}),_p({source:h,mint:r,destination:p,authority:f,amount:u,decimals:c},{programAddress:s})],e)));return Vu([Sh({units:this.#O}),Th({microLamports:this.#M})],g)}static async deriveAssociatedTokenAccountAddress({mint:e,owner:t,tokenProgram:n}){return(await rp({mint:e,owner:t,tokenProgram:n}))[0]}async getTokenAccount({mint:e,network:t}){const n=this.#h.getRpc(t),r=await async function(e,t,n={}){const{abortSignal:r,...o}=n,{value:i}=await e.getAccountInfo(t,{...o,encoding:"jsonParsed"}).send({abortSignal:r});return i&&"object"==typeof i&&"parsed"in i.data?xm(t,i):_m(t,i)}(n,e);return r}getDecimals(e){bS.assertAccountExists(e),bS.assertAccountDecoded(e);const{decimals:t}=e.data;if(!t)throw new Error(`Decimals not found for ${e}`);return t}static isAccountExists(e){return e.exists}static assertAccountExists(e){if(!bS.isAccountExists(e))throw new Error("Token account does not exist")}static assertAccountNotExists(e){if(bS.isAccountExists(e))throw new Error("Token account exists")}static isAccountDecoded(e){return bS.assertAccountExists(e),!(e.data instanceof Uint8Array)}static assertAccountDecoded(e){if(bS.assertAccountExists(e),!bS.isAccountDecoded(e))throw new Error("Token account is encoded. Implement a decoder.")}getComputeUnitLimit(){return this.#O}getComputeUnitPriceMicroLamportsPerComputeUnit(){return this.#M}}const SS=new _y,ES=new class{#i;#z=new Map;constructor(e){this.#i=Kl(e,"[⚡ EventEmitter]")}on(e,t){this.#i.info(`Adding listener for event ${e}`),this.#z.has(e)||this.#z.set(e,new Set),this.#z.get(e)?.add(t)}off(e,t){this.#i.info(`Removing listener for event ${e}`);const n=this.#z.get(e);n&&(n.delete(t),0===n.size&&this.#z.delete(e))}async emitSync(e,t){this.#i.info(`Emitting event ${e}`);const n=this.#z.get(e);if(n){const e=Array.from(n).map((async e=>await e(t)));await Promise.allSettled(e)}}removeAllListeners(e){e?(this.#i.info(`Removing all listeners for event ${e}`),this.#z.delete(e)):(this.#i.info("Removing all listeners for all events"),this.#z.clear())}listenerCount(e){const t=this.#z.get(e);return t?t.size:0}eventNames(){return Array.from(this.#z.keys())}}(Gl),kS=new class{#l;constructor(e,t){this.#l=t,e.on("onStart",this.#j.bind(this)),e.on("onUpdate",this.#j.bind(this)),e.on("onInstall",this.#j.bind(this))}async#j(){await this.update((e=>(0,_d.omit)(e,["assets"])))}async get(){const e=await snap.request({method:"snap_getState",params:{encrypted:this.#l.encrypted}}),t=ay(e??{});var n,r;return n=this.#l.defaultState,r=t,{...n,...Object.fromEntries(Object.entries(r).filter((([e,t])=>null!=t&&(!t||"object"!=typeof t||Object.keys(t).length>0))))}}async getKey(e){const t=await snap.request({method:"snap_getState",params:{key:e,encrypted:this.#l.encrypted}});if(null!==t)return ay(t)}async setKey(e,t){await snap.request({method:"snap_setState",params:{key:e,value:sy(t),encrypted:this.#l.encrypted}})}async update(e){return this.get().then((async t=>{const n=e(t);return await snap.request({method:"snap_manageState",params:{operation:"update",newState:sy(n),encrypted:this.#l.encrypted}}),n}))}async deleteKey(e){await this.update((t=>((0,_d.unset)(t,e),t)))}async deleteKeys(e){await this.update((t=>(e.forEach((e=>{(0,_d.unset)(t,e)})),t)))}}(ES,{encrypted:!1,defaultState:{keyringAccounts:{},mapInterfaceNameToId:{},transactions:{},signatures:{},assetEntities:{},tokenPrices:{},subscriptions:{},webSocketConnections:{closeWebSocketConnectionsBackgroundEventId:null}}}),IS=new class{#U;prefix;logger;constructor(e,t=console,n="__cache__default"){this.#U=e,this.logger=t,this.prefix=n}async get(e){return(await this.mget([e]))[e]}async set(e,t,n=Number.MAX_SAFE_INTEGER){this.#D(n),await this.#U.setKey(`${this.prefix}.${e}`,{value:t,expiresAt:Math.min(Date.now()+(n??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})}#D(e){if(void 0!==e){if("number"!=typeof e)throw new Error("TTL must be a number");if(e<0)throw new Error("TTL must be positive");if(e>Number.MAX_SAFE_INTEGER)throw new Error("TTL must be less than 2^53 - 1")}}async delete(e){return(await this.mdelete([e]))[e]??!1}async clear(){await this.#U.setKey(this.prefix,{})}async has(e){return void 0!==await this.get(e)}async keys(){const e=await this.#U.getKey(this.prefix);return Object.keys(e??{})}async size(){const e=await this.#U.getKey(this.prefix);return Object.keys(e??{}).length}async peek(e){const t=await this.#U.getKey(this.prefix),n=t?.[e];return n?.value}async mget(e){const t=await this.#U.getKey(this.prefix),n=Object.entries(t??{}).filter((([t])=>e.includes(t))),r=n.filter((([e,t])=>t&&t.expiresAt<Date.now()));return await this.mdelete(r.map((([e])=>e))),n.reduce(((e,[t,n])=>void 0===n?(this.logger.info(`[StateCache] ❌ Cache miss for key "${t}"`),e):(n.expiresAt<Date.now()?(this.logger.info(`[StateCache] ⌛ Cache expired for key "${t}"`),e[t]=void 0):(this.logger.info(`[StateCache] 🎉 Cache hit for key "${t}"`),e[t]=n.value),e)),{})}async mset(e){if(0!==e.length)if(1!==e.length)e.forEach((({ttlMilliseconds:e})=>{this.#D(e)})),await this.#U.update((t=>{const n=t[this.prefix]??{};return e.forEach((({key:e,value:t,ttlMilliseconds:r})=>{void 0!==t&&(n[e]={value:t,expiresAt:Math.min(Date.now()+(r??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})})),t[this.prefix]=n,t}));else{Wo(e[0]);const{key:t,value:n,ttlMilliseconds:r}=e[0];await this.set(t,n,r)}}async mdelete(e){const t={};return await this.#U.update((n=>{const r=n[this.prefix]??{};return e.forEach((e=>{void 0===r[e]?t[e]=!1:(delete r[e],t[e]=!0)})),n[this.prefix]=r,n})),t}}(kS,Gl),TS=new class{#v=new Map;logger;constructor(e){this.logger=Kl(e,"[💾 InMemoryCache]")}#D(e){if(void 0!==e){if("number"!=typeof e)throw new Error("TTL must be a number");if(e<0)throw new Error("TTL must be positive");if(e>Number.MAX_SAFE_INTEGER)throw new Error("TTL must be less than 2^53 - 1")}}#L(e){return e.expiresAt<Date.now()}async#F(){const e=[];for(const[t,n]of this.#v.entries())this.#L(n)&&e.push(t);await this.mdelete(e)}async get(e){return(await this.mget([e]))[e]}async set(e,t,n=Number.MAX_SAFE_INTEGER){this.#D(n),this.#v.set(e,{value:t,expiresAt:Math.min(Date.now()+(n??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})}async delete(e){return(await this.mdelete([e]))[e]??!1}async clear(){this.#v.clear()}async has(e){const t=this.#v.get(e);return!!t&&(!this.#L(t)||(this.#v.delete(e),!1))}async keys(){return await this.#F(),Array.from(this.#v.keys())}async size(){return await this.#F(),this.#v.size}async peek(e){const t=this.#v.get(e);if(t){if(!this.#L(t))return t.value;this.#v.delete(e)}}async mget(e){await this.#F();const t={};for(const n of e){const e=this.#v.get(n);e?(this.logger.info(`🎉 Cache hit for key "${n}"`),t[n]=e.value):(this.logger.info(`❌ Cache miss for key "${n}"`),t[n]=void 0)}return t}async mset(e){if(0!==e.length)if(1!==e.length)e.forEach((({ttlMilliseconds:e})=>{this.#D(e)})),e.forEach((({key:e,value:t,ttlMilliseconds:n})=>{void 0!==t&&this.#v.set(e,{value:t,expiresAt:Math.min(Date.now()+(n??Number.MAX_SAFE_INTEGER),Number.MAX_SAFE_INTEGER)})}));else{Wo(e[0]);const{key:t,value:n,ttlMilliseconds:r}=e[0];await this.set(t,n,r)}}async mdelete(e){return Object.fromEntries(e.map((e=>[e,this.#v.delete(e)])))}}(Vl),_S=new class{#i;constructor(e=Gl){this.#i=Kl(e,"[📣 AnalyticsService]")}async#$(e,t){await snap.request({method:"snap_trackEvent",params:{event:{event:e,properties:t}}})}async trackEventTransactionAdded(e,t){try{this.#i.log("Tracking event transaction added"),await this.#$("Transaction Added",{message:"Snap transaction added",origin:t.origin,account_id:e.id,account_address:e.address,account_type:e.type,chain_id:t.scope})}catch(e){this.#i.warn("Error tracking event transaction added",{error:e,metadata:t})}}async trackEventTransactionApproved(e,t){try{this.#i.log("Tracking event transaction approved"),await this.#$("Transaction Approved",{message:"Snap transaction approved",origin:t.origin,account_id:e.id,account_address:e.address,account_type:e.type,chain_id:t.scope})}catch(e){this.#i.warn("Error tracking event transaction approved",{error:e,metadata:t})}}async trackEventTransactionSubmitted(e,t,n){try{this.#i.log("Tracking event transaction submitted"),await this.#$("Transaction Submitted",{message:"Snap transaction submitted",origin:n.origin,account_id:e.id,account_address:e.address,account_type:e.type,chain_id:n.scope})}catch(e){this.#i.warn("Error tracking event transaction submitted",{error:e,signature:t,metadata:n})}}async trackEventTransactionFinalized(e,t,n){try{this.#i.log("Tracking event transaction finalized"),await this.#$("Transaction Finalized",{message:"Snap transaction finalized",origin:n.origin,account_id:e.id,account_address:e.address,account_type:e.type,chain_id:t.chain,transaction_status:t.status,transaction_type:t.type})}catch(e){this.#i.warn("Error tracking event transaction finalized",{error:e,transaction:t,metadata:n})}}async trackEventTransactionRejected(e,t){try{this.#i.log("Tracking event transaction rejected"),await this.#$("Transaction Rejected",{message:"Snap transaction rejected",origin:t.origin,account_id:e.id,account_address:e.address,account_type:e.type,chain_id:t.scope})}catch(e){this.#i.warn("Error tracking event transaction rejected",{error:e,metadata:t})}}async trackEventSecurityAlertDetected(e,t,n,r,o,i){try{this.#i.log("Tracking event security alert detected"),await this.#$("Security Alert Detected",{message:"Snap security alert detected",origin:t,account_id:e.id,account_address:e.address,account_type:e.type,chain_id:n,security_alert_response:r,security_alert_reason:o,security_alert_description:i})}catch(e){this.#i.warn("Error tracking event security alert detected",{error:e,origin:t,scope:n,securityAlertResponse:r,securityAlertReason:o,securityAlertDescription:i})}}async trackEventSecurityScanCompleted(e,t,n,r,o){try{this.#i.log("Tracking event security scan completed"),await this.#$("Security Scan Completed",{message:"Snap security scan completed",origin:t,account_id:e.id,account_address:e.address,account_type:e.type,chain_id:n,scan_status:r,has_security_alerts:o})}catch(e){this.#i.warn("Error tracking event security scan completed",{error:e,origin:t,scope:n,scanStatus:r,hasSecurityAlerts:o})}}}(Gl),xS=new class{#p;#q=new Map;constructor(e){this.#p=e}#W(e){const t=this.#p.getNetworkBy("caip2Id",e),n=Gw(iA(t.rpcUrls));return this.#q.set(e,n),n}getRpc(e){return M(e,gd),this.#q.get(e)??this.#W(e)}}(SS),CS=new class{#p;constructor(e){this.#p=e}async getAll(){return(await snap.request({method:"snap_getWebSockets"})).map((e=>({...e,network:this.#V(e.url)})))}async getById(e){return(await this.getAll()).find((t=>t.id===e))??null}async findByNetwork(e){return(await this.getAll()).find((t=>t.network===e))??null}async save(e){const{url:t,protocols:n}=e,r=await snap.request({method:"snap_openWebSocket",params:{url:t,...n?{protocols:n}:{}}});return{...e,id:r}}async delete(e){await snap.request({method:"snap_closeWebSocket",params:{id:e}})}#V(e){const t=this.#p.getNetworkBy("webSocketUrl",e);if(!t)throw new Error(`No network found for WebSocket URL: ${e}`);return t.caip2Id}}(SS),RS=new class{#K;#p;#U;#G;#i;#H;#Z;#J=new Map;#Y=new Map;#Q;#X="webSocketConnections";constructor(e,t,n,r,o){const{maxReconnectAttempts:i,reconnectDelayMilliseconds:a,closeConnectionsGracePeriodMilliseconds:s}=t.get().subscriptions;this.#K=e,this.#p=t,this.#U=n,this.#G=r,this.#i=Kl(o,"[🔌 WebSocketConnectionService]"),this.#H=i,this.#Z=a,this.#Q=s,this.#ee()}#ee(){const e=this.#te.bind(this),t=this.#ne.bind(this),n=this.#re.bind(this),r=this.#oe.bind(this),o=this.#ie.bind(this);this.#G.on("onStart",e),this.#G.on("onUpdate",e),this.#G.on("onInstall",e),this.#G.on("onActive",t),this.#G.on("onInactive",n),this.#G.on("onWebSocketEvent",o),this.#G.on("onListWebSockets",r)}async#te(){this.#i.log("Setting up connections");const{active:e}=await async function(){return await snap.request({method:"snap_getClientStatus"})}();e?await this.#ae():await this.closeAllConnections()}async#ae(){this.#i.log("Opening connections for active networks");const{activeNetworks:e}=this.#p.get();this.#Y.clear(),await Promise.allSettled(e.map((async e=>{await this.openConnection(e)})))}async openConnection(e){this.#i.log(`Opening connection for network ${e}`);const t=this.#p.getNetworkBy("caip2Id",e),{webSocketUrl:n}=t;await this.#K.findByNetwork(e)?this.#i.log(`✅ Connection for network ${e} already exists`):await this.#K.save({network:e,url:n,protocols:[]})}async closeAllConnections(){this.#i.log("Closing all connections");const e=await this.#K.getAll();await Promise.allSettled(e.map(this.#se.bind(this))),await this.#U.setKey(`${this.#X}.closeWebSocketConnectionsBackgroundEventId`,null)}async#se(e){this.#i.log(`Closing connection for network ${e.network}`),await this.#K.delete(e.id)}onConnectionRecovery(e,t){const n=this.#J.get(e)??[];this.#J.set(e,[...n,t])}async findByNetwork(e){return await this.#K.findByNetwork(e)??null}async findById(e){return this.#K.getById(e)}async#ie(e){if("open"!==e.type&&"close"!==e.type)return;const{id:t,type:n}=e;switch(this.#i.log(`Handling connection event "${n}" for ${t}`,e),n){case"open":await this.#ce(e);break;case"close":await this.#ue(e);break;default:this.#i.warn(`Unknown connection event type: ${n}`)}}async#ce(e){const{id:t}=e,n=await this.#K.getById(t);if(!n)return void this.#i.warn(`No connection found with id: ${t}`);this.#i.log(`✅ Connected to ${t}`,e);const{network:r}=n;this.#Y.delete(r);const o=this.#J.get(r)??[];this.#i.log(`Triggering ${o.length} connection recovery handlers`,r);const i=o.map((async e=>{try{await e(r)}catch(e){this.#i.error("Error in connection recovery handler",e)}}))??[];await Promise.allSettled(i)}async#ue(e){const{wasClean:t}=e;if(t)return void this.#i.log("✅ Connection closed cleanly",e);const{origin:n}=e,{networks:r}=this.#p.get(),o=r.find((e=>e.webSocketUrl.startsWith(n)));o?await this.#le(o.caip2Id):this.#i.warn("No network found for origin",n)}async#le(e){const t=this.#Y.get(e)??0,n=t+1;if(this.#Y.set(e,n),n>this.#H)return void this.#i.error(`❌ Failed to reconnect to ${e} after ${this.#H}/${this.#H} attempts. Giving up.`);const r=this.#Z*Math.pow(2,t);this.#i.warn(`❌ Disconnected from ${e}. Will try reconnecting in ${r}ms (attempt ${n}/${this.#H})`),await new Promise((t=>{setTimeout((()=>{this.openConnection(e).catch((t=>{this.#i.info(`Error opening connection for ${e}`,t)})).finally((()=>t()))}),r)}))}async#oe(){const e=await this.#K.getAll();this.#i.log("All connections",{connections:e,connectionRecoveryHandlers:this.#J})}async#ne(){this.#i.log("Client became active"),await this.#de(),await this.#ae()}async#re(){this.#i.log("Client became inactive"),await this.#de();const e=Math.floor(this.#Q/1e3),t=await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:`PT${e}S`,request:{method:"closeWebSocketConnections"}}});await this.#U.setKey(`${this.#X}.closeWebSocketConnectionsBackgroundEventId`,t),this.#i.log(`Scheduled background event to close connections after ${e}s`,t)}async#de(){try{const e=await this.#U.getKey(`${this.#X}.closeWebSocketConnectionsBackgroundEventId`);if(!e)return;await snap.request({method:"snap_cancelBackgroundEvent",params:{id:e}}),this.#i.log("🫸 Cancelled background event to close connections",e)}catch(e){this.#i.warn("Failed to cancel background event",e)}finally{await this.#U.setKey(`${this.#X}.closeWebSocketConnectionsBackgroundEventId`,null)}}}(CS,SS,kS,ES,Gl),PS=new class{#U;#X="subscriptions";constructor(e){this.#U=e}async getAll(){const e=await this.#U.getKey(`${this.#X}`);return Object.values(e??{})}async getById(e){return await this.#U.getKey(`${this.#X}.${e}`)}async save(e){await this.#U.setKey(`${this.#X}.${e.id}`,e)}async delete(e){await this.#U.deleteKey(`${this.#X}.${e}`)}async deleteMany(e){const t=e.map((e=>`${this.#X}.${e}`));await this.#U.deleteKeys(t)}async update(e){await this.#U.setKey(`${this.#X}.${e.id}`,e)}async findBy(e,t){const n=await this.getAll();if(0!==n.length)return n.find((n=>e in n&&n[e]===t))}async clear(){await this.#U.deleteKey(`${this.#X}`)}}(kS),NS=new class{#fe;#he;#p;#G;#i;#pe=new Map;constructor(e,t,n,r,o){this.#fe=e,this.#he=t,this.#p=n,this.#G=r,this.#i=Kl(o,"[🔔 SubscriptionService]"),this.#ee()}#ee(){this.#G.on("onWebSocketEvent",this.#ie.bind(this)),this.#G.on("onListSubscriptions",this.#ge.bind(this));const{activeNetworks:e}=this.#p.get();e.forEach((e=>{this.#fe.onConnectionRecovery(e,this.#me.bind(this))}))}registerNotificationHandler(e,t,n){this.#i.info("Registering notification handler",{network:t,method:e,handler:n});const r=`${e}:${t}`;this.#pe.has(r)||this.#pe.set(r,new Set),this.#pe.get(r).add(n)}registerConnectionRecoveryHandler(e,t){this.#fe.onConnectionRecovery(e,t)}async subscribe(e){this.#i.info("New subscription request",e);const{method:t,params:n,network:r}=e,o=await this.#ye(e),i=await this.#he.getById(o);if(i){if("confirmed"===i.status)return o;await this.#he.delete(o)}const a={...e,id:o,status:"pending",requestId:o,createdAt:(new Date).toISOString()};await this.#he.save(a);const s=await this.#fe.findByNetwork(r),c=async e=>{const r={jsonrpc:"2.0",id:o,method:t,params:n};e&&await this.#ve(e,r)};return s&&await c(s.id),a.id}async unsubscribe(e){this.#i.info("Unsubscribing from",e);const t=await this.#he.getById(e);if(!t)return void this.#i.warn(`Subscription not found: ${e}`);const{id:n,network:r,method:o}=t,i=Jm[o];if("confirmed"===t.status){const e=await this.#fe.findByNetwork(r);e&&await this.#ve(e.id,{jsonrpc:"2.0",id:globalThis.crypto.randomUUID(),method:i,params:[t.rpcSubscriptionId]})}await this.#he.delete(n)}async getAll(){return this.#he.getAll()}async#ie(e){if("message"!==e.type)return;const t=(e=>{const{data:t}=e;let n;if(t&&"object"==typeof t&&"type"in t)if("text"===t.type)n="string"==typeof t.message?JSON.parse(t.message):t.message;else{if("binary"!==t.type)throw new Error("Unknown message data");{const e=t.message,r=String.fromCharCode(...e);n=JSON.parse(r)}}else n="string"==typeof t?JSON.parse(t):t;return n})(e),n=await this.#fe.findById(e.id);if(n)switch(this.#i.info("Received message",e),t.method){case"accountNotification":case"programNotification":case"signatureNotification":await this.#we(t,n.network);break;default:this.#Ae(t)?await this.#be(t):Sf(t)?await this.#Se(t):this.#i.warn("Received unknown message",t)}}async#we(e,t){const{subscription:n}=e.params,r=await this.#he.findBy("rpcSubscriptionId",n);if(!r)return void this.#i.warn("No subscription found for RPC ID:",n);const o=`${r.method}:${t}`,i=this.#pe.get(o);if(i&&i.size>0){(await Promise.allSettled(Array.from(i).map((async t=>t(e,r))))).forEach((e=>{"rejected"===e.status&&this.#i.error(`Handler failed for ${r.method}:`,e.reason)}))}}async#ve(e,t){this.#i.info(`Sending message to connection ${e}`,t),await snap.request({method:"snap_sendWebSocketMessage",params:{id:e,message:JSON.stringify(t)}})}#Ae(e){return"jsonrpc"in e&&"2.0"===e.jsonrpc&&"id"in e&&"result"in e}async#be(e){const{id:t,result:n}=e,r=await this.#he.getById(String(t));r?"confirmed"!==r.status?(await this.#he.update({...r,status:"confirmed",rpcSubscriptionId:n,confirmedAt:(new Date).toISOString()}),this.#i.info(`Subscription confirmed: request ID: ${t} -> RPC ID: ${n}`)):this.#i.warn(`Received subscription confirmation, but the subscription is already confirmed for request ID: ${t}.`):this.#i.warn(`Received subscription confirmation, but no matching pending subscription found for subscription ID: ${t}.`)}async#Se(e){if("id"in e&&void 0!==e.id){const t=await this.#he.getById(String(e.id));"pending"===t?.status?(await this.#he.delete(t.id),this.#i.error(`Subscription establishment failed for ${t.id}:`,e.error)):this.#i.error(`Received error for request ID: ${e.id}`,e.error)}else this.#i.error("Connection-level error:",e.error)}async#ye(e){const t={method:e.method,params:e.params,network:e.network,metadata:e.metadata??null},n=this.#Ee(t),r=(new TextEncoder).encode(n),o=await globalThis.crypto.subtle.digest("SHA-256",r),i=Array.from(new Uint8Array(o)).map((e=>e.toString(16).padStart(2,"0"))).join("");return i}#Ee(e){if(null==e)return JSON.stringify(e);if("object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map((e=>this.#Ee(e))).join(",")}]`;const t=Object.keys(e).sort(((e,t)=>e.localeCompare(t)));return`{${t.map((t=>`"${t}":${this.#Ee(e[t])}`)).join(",")}}`}async#ge(){const e=await this.#he.getAll();this.#i.info("Subscriptions",{subscriptions:e,notificationHandlers:this.#pe})}#ke(e){return{method:e.method,params:e.params,network:e.network,...e.metadata?{metadata:e.metadata}:{}}}async#me(e){this.#i.info(`Re-subscribing to all subscriptions for network ${e}`);const t=(await this.#he.getAll()).filter((t=>t.network===e)),n=t.map((e=>e.id));await this.#he.deleteMany(n),await Promise.allSettled(t.map((async e=>{await this.subscribe(this.#ke(e))})))}}(RS,PS,SS,ES,Gl),BS=new dA(xS,Gl),OS=new class{#h;#i;#O=450;#M=10000n;constructor(e,t){this.#h=e,this.#i=t}async buildTransactionMessage(e){try{const{from:t,to:n,amount:r,network:o}=e,i=Hs(t.address),a=BigInt($d(r).toString()),s=(await this.#h.getRpc(o).getLatestBlockhash().send()).value,c=nu(Mu({version:0}),(e=>$u(i,e)),(e=>ou(s,e)),(e=>qu(function(e,t){const n=t?.programAddress??El,r={source:{value:e.source??null,isWritable:!0},destination:{value:e.destination??null,isWritable:!0}},o={...e},i=_l(n);return{accounts:[i(r.source),i(r.destination)],programAddress:n,data:Dl().encode(o)}}({amount:a,destination:n,source:fl(i)}),e)));return Vu([Sh({units:this.#O}),Th({microLamports:this.#M})],c)}catch(e){throw this.#i.error({error:e},"Error building transaction message"),e}}getComputeUnitLimit(){return this.#O}getComputeUnitPriceMicroLamportsPerComputeUnit(){return this.#M}}(xS,Gl),MS=new bS(xS,BS,Gl),zS=new class{#o;#i;#a;#s;#v;cacheTtlsMilliseconds;constructor(e,t,n=globalThis.fetch,r=Gl){const{baseUrl:o,chunkSize:i,cacheTtlsMilliseconds:a}=e.get().priceApi;M(o,cd),this.#o=n,this.#i=r,this.#a=o,this.#s=i,this.cacheTtlsMilliseconds=a,this.#v=t}async getFiatExchangeRates(){try{const e=await this.#o(`${this.#a}/v1/exchange-rates/fiat`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch(e){throw this.#i.error(e,"Error fetching fiat exchange rates"),e}}async#Ie(e,t="usd"){try{if(M(e,K(Do)),M(t,Pd),0===e.length)return{};const n=[...new Set(e)],r=[];for(let e=0;e<n.length;e+=this.#s)r.push(n.slice(e,e+this.#s));const o=await Promise.all(r.map((async e=>{const n=Td({baseUrl:this.#a,path:"/v3/spot-prices",queryParams:{vsCurrency:t,assetIds:e.join(","),includeMarketData:"true"}}),r=await this.#o(n);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const o=await r.json();return M(o,Rd),o}))),i=o.reduce(((e,t)=>({...e,...t})),{});return await this.#v.mset(e.map((e=>({key:`PriceApiClient:getMultipleSpotPrices:${e}:${t}`,value:i[e],ttlMilliseconds:this.cacheTtlsMilliseconds.spotPrices})))),i}catch(e){throw this.#i.error(e,"Error fetching spot prices"),e}}async#Te(e,t="usd"){const n=[...new Set(e)],r="PriceApiClient:getMultipleSpotPrices",o=e=>`${r}:${e}:${t}`,i=await this.#v.mget(n.map(o)),a=(0,_d.mapKeys)(i,((e,t)=>(e=>{const t=new RegExp(`^${r}:(.+):(.+)$`,"u"),n=e.match(t);if(!n)throw new Error("Invalid cache key");return n})(t)[1])),s=n.filter((e=>void 0===a[e]));if(0===s.length)return a;const c=await this.#Ie(s,t);return await this.#v.mset(Object.entries(c).map((([e,t])=>({key:o(e),value:t,ttlMilliseconds:this.cacheTtlsMilliseconds.spotPrices})))),{...a,...c}}async getMultipleSpotPrices(e,t="usd"){return this.#Te(e,t)}async#_e(e){M(e,Nd);const t=Td({baseUrl:this.#a,path:"/v3/historical-prices/{assetType}",pathParams:{assetType:e.assetType},encodePathParams:!1,queryParams:{...e.timePeriod&&{timePeriod:e.timePeriod},...e.from&&{from:e.from.toString()},...e.to&&{to:e.to.toString()},...e.vsCurrency&&{vsCurrency:e.vsCurrency}}}),n=await this.#o(t),r=await n.json();return M(r,Bd),r}async getHistoricalPrices(e){return Zl(this.#_e.bind(this),this.#v,{functionName:"PriceApiClient:getHistoricalPrices",ttlMilliseconds:this.cacheTtlsMilliseconds.historicalPrices})(e)}}(SS,TS),jS=new Ld(SS),US=new class{#o;#i;#a;#v;#xe;constructor(e,t,n=globalThis.fetch,r=Gl){const{baseUrl:o,cacheTtlsMilliseconds:i}=e.get().nftApi;M(o,cd),this.#o=n,this.#i=r,this.#a=o,this.#xe=i,this.#v=t}#Ce(e){return{cursor:e.cursor,error:e.error,items:e.items.map((e=>({chain:e.chain,address:e.address,tokenAddress:e.token_address,tokenId:e.token_id,balance:e.balance,acquiredAt:e.acquired_at,isSpam:e.isSpam,nftToken:this.#Re(e.nft_token)})))}}async#Pe(e){let t,n=[];do{const r=Td({baseUrl:this.#a,path:`/users/${e}/solana-tokens`,queryParams:t?{cursor:t}:void 0}),o=await this.#o(r,{headers:{"Content-Type":"application/json",accept:"application/json",version:"1"}}),i=await o.json(),a=this.#Ce(i);n=[...n,...a.items],t=a.cursor??void 0}while(t);return n}async listAddressSolanaNfts(e){return Zl(this.#Pe.bind(this),this.#v,{functionName:"NftApiClient:listAddressSolanaNfts",ttlMilliseconds:this.#xe.listAddressSolanaNfts})(e)}#Re(e){return{address:e.address,tokenId:e.token_id,tokenStandard:e.token_standard,name:e.name,description:e.description,metadata:e.metadata,imageUrl:e.image_url,mediaUrl:e.media_url,externalUrl:e.external_url,attributes:e.attributes.map((e=>({key:e.key,value:e.value}))),tokenAccountAddress:e.token_account_address,creators:e.creators.map((e=>({address:e.address,share:e.share,verified:e.verified}))),collectionName:e.collection_name,collectionSymbol:e.collection_symbol,collectionCount:e.collection_count,collectionImageUrl:e.collection_image_url,onchainCollectionAddress:e.onchain_collection_address,floorPrice:e.floor_price?{asset:{type:e.floor_price.asset.type,name:e.floor_price.asset.name,symbol:e.floor_price.asset.symbol,decimals:e.floor_price.asset.decimals,tokenId:e.floor_price.asset.token_id},amount:{rawAmount:e.floor_price.amount.raw_amount,amount:e.floor_price.amount.amount}}:null,lastSalePrice:e.last_sale_price?{asset:{type:e.last_sale_price.asset.type,name:e.last_sale_price.asset.name,symbol:e.last_sale_price.asset.symbol,decimals:e.last_sale_price.asset.decimals,tokenId:e.last_sale_price.asset.token_id},amount:{rawAmount:e.last_sale_price.amount.raw_amount,amount:e.last_sale_price.amount.amount}}:null,rarity:e.rarity?{ranking:{source:e.rarity.ranking.source,value:e.rarity.ranking.value},metadata:{howrare:{rank:e.rarity.metadata.howrare.rank},moonrank:{rank:e.rarity.metadata.moonrank.rank}}}:null}}async#Ne(e){try{const t=Td({baseUrl:this.#a,path:`/nfts/contracts/solana/${e}/1`}),n=await this.#o(t,{headers:{"Content-Type":"application/json",accept:"application/json",version:"1"}}),r=await n.json();return this.#Re(r)}catch(e){return null}}async getNftMetadata(e){return Zl(this.#Ne.bind(this),this.#v,{functionName:"NftApiClient:getNftMetadata",ttlMilliseconds:this.#xe.getNftMetadata})(e)}async getNftsMetadata(e){return await Promise.all(e.map((async e=>this.getNftMetadata(e))))}}(SS,TS),DS=new class{#Be;#i;constructor({tokenApiClient:e,logger:t}){this.#Be=e,this.#i=t}async getTokensMetadata(e){if(0===e.length)return this.#i.warn(`No tokens to get metadata for ${e.join(", ")}`),{};return await this.#Be.getTokenMetadataFromAddresses(e)}async generateImageComponent(e,t=48,n=48){return e?async function(e,{width:t,height:n=t,request:r}){Lb("number"==typeof t&&t>0,"Expected width to be a number greater than 0."),Lb("number"==typeof n&&n>0,"Expected height to be a number greater than 0.");const o=await mS(e,r),i=`width="${t}" height="${n}"`;return gS(`<svg ${i.trim()} xmlns="http://www.w3.org/2000/svg"><image ${i.trim()} href="${o}" /></svg>`)}(e,{width:t,height:n}).then((e=>e.value)).catch((()=>yS)):yS}}({tokenApiClient:jS,logger:Gl}),LS=new class{#Oe;#i;cacheTtlsMilliseconds;constructor({configProvider:e,priceApiClient:t,logger:n}){this.#Oe=t,this.#i=n;const{cacheTtlsMilliseconds:r}=e.get().priceApi;this.cacheTtlsMilliseconds=r}#Me(e){if(!vS(e))throw new Error("Passed caipAssetType is not a fiat asset");return Fo(e).assetReference.toLowerCase()}async#ze(e){const t=e.filter((e=>!vS(e))),[n,r]=await Promise.all([this.#Oe.getFiatExchangeRates(),this.#Oe.getMultipleSpotPrices(t,"usd")]);return{fiatExchangeRates:n,cryptoPrices:r}}async getMultipleTokenConversions(e){if(0===e.length)return{};const t=e.flatMap((e=>[e.from,e.to])),{fiatExchangeRates:n,cryptoPrices:r}=await this.#ze(t),o={};return e.forEach((e=>{const{from:t,to:i}=e;let a,s;if(o[t]||(o[t]={}),vS(t)){const e=n[this.#Me(t)]?.value;if(!e)return void(o[t][i]=null);a=new _o(1).dividedBy(e)}else a=new _o(r[t]?.price??0);if(vS(i)){const e=n[this.#Me(i)]?.value;if(!e)return void(o[t][i]=null);s=new _o(1).dividedBy(e)}else s=new _o(r[i]?.price??0);if(a.isZero()||s.isZero())return void(o[t][i]=null);const c=a.dividedBy(s).toString(),u=Date.now();o[t][i]={rate:c,conversionTime:u,expirationTime:u+this.cacheTtlsMilliseconds.historicalPrices}})),o}#je(e,t){const n=(0,_d.pick)(e,["marketCap","totalVolume","circulatingSupply","allTimeHigh","allTimeLow","pricePercentChange1h","pricePercentChange1d","pricePercentChange7d","pricePercentChange14d","pricePercentChange30d","pricePercentChange200d","pricePercentChange1y"]),r=e=>null==e?"":new _o(e).dividedBy(t).toString(),o=(e,t)=>null==t?{}:{[e]:t},i={...o("PT1H",n.pricePercentChange1h),...o("P1D",n.pricePercentChange1d),...o("P7D",n.pricePercentChange7d),...o("P14D",n.pricePercentChange14d),...o("P30D",n.pricePercentChange30d),...o("P200D",n.pricePercentChange200d),...o("P1Y",n.pricePercentChange1y)};return{fungible:!0,marketCap:r(n.marketCap),totalVolume:r(n.totalVolume),circulatingSupply:(n.circulatingSupply??0).toString(),allTimeHigh:r(n.allTimeHigh),allTimeLow:r(n.allTimeLow),...Object.keys(i).length>0?{pricePercentChange:i}:{}}}async getMultipleTokensMarketData(e){if(0===e.length)return{};const t=e.flatMap((e=>[e.asset,e.unit])),{fiatExchangeRates:n,cryptoPrices:r}=await this.#ze(t),o={};return e.forEach((e=>{const{asset:t,unit:i}=e;if(!r[t])return;let a;if(vS(i)){const e=n[this.#Me(i)]?.value;if(!e)return;a=new _o(1).dividedBy(e)}else a=new _o(r[i]?.price??0);a.isZero()||(o[t]||(o[t]={}),o[t][i]=this.#je(r[t],a))})),o}async getHistoricalPrice(e,t){M(e,it),M(t,it);const n=Fo(t).assetReference.toLowerCase();M(n,Pd);const r=["1d","7d","1m","3m","1y","1000y"].map((async r=>this.#Oe.getHistoricalPrices({assetType:e,timePeriod:r,vsCurrency:n}).then((e=>({timePeriod:r,response:e}))).catch((n=>(this.#i.warn(`Error fetching historical prices for ${e} to ${t} with time period ${r}. Returning null object.`,n),{timePeriod:r,response:Od}))))),o=(await Promise.all(r)).reduce(((e,{timePeriod:t,response:n})=>(e[`P${t.toUpperCase()}`]=n.prices.map((e=>[e[0],e[1].toString()])),e)),{}),i=Date.now();return{intervals:o,updateTime:i,expirationTime:i+this.cacheTtlsMilliseconds.historicalPrices}}}({configProvider:SS,priceApiClient:zS,logger:Gl}),FS=new class{#h;#i;constructor(e,t){this.#h=e,this.#i=t}async resolveDomain(e,t){const n=this.#h.getRpc(e);return Ob(n,t)}async resolveAddress(e,t){try{const n=this.#h.getRpc(e);return`${(await(async(e,t)=>{const n=await tb.getAddress("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29",t),r=await tb.retrieve(e,n),[o,i]=await Promise.all([VA.retrieve(e,r.nameAccount),eb(e,r.nameAccount)]),a=i||o.owner,s=o.parentName!==KA,c=[nb(e,r.nameAccount,s?o.parentName:void 0)];s&&c.push(nb(e,o.parentName));const u=(await Promise.all(c)).join(".");return{domainAddress:r.nameAccount,domainName:u,stale:t!==a}})(n,Hs(t))).domainName}.sol`}catch(e){return this.#i.error("Error resolving address",e),null}}}(xS,Gl),$S=new class{#U;constructor(e){this.#U=e}async findByKeyringAccountId(e){return await this.#U.getKey(`assetEntities.${e}`)??[]}async getAll(){const e=await this.#U.getKey("assetEntities")??{};return Object.values(e).flat()}async saveMany(e){await this.#U.update((t=>{const n=(0,_d.cloneDeep)(t);for(const t of e){const{keyringAccountId:e}=t,r=(0,_d.cloneDeep)(n.assetEntities[e]??[]),o=r.findIndex((e=>e.assetType===t.assetType&&e.keyringAccountId===t.keyringAccountId));-1===o?r.push(t):r[o]=t,n.assetEntities[e]=r}return n}))}}(kS),qS=new qy({connection:xS,logger:Gl,configProvider:SS,assetsRepository:$S,tokenMetadataService:DS,cache:TS,tokenPricesService:LS,nftApiClient:US}),WS=new class{#U;constructor(e){this.#U=e}async getAll(){const e=await this.#U.getKey("keyringAccounts");return Object.values(e??{})}async findById(e){return(await this.getAll()).find((t=>t.id===e))??null}async findByAddress(e){return(await this.getAll()).find((t=>t.address===e))??null}async save(e){await this.#U.setKey(`keyringAccounts.${e.id}`,e)}async delete(e){await this.#U.deleteKey(`keyringAccounts.${e}`)}}(kS),VS=new class{#Ue;constructor(e){this.#Ue=e}async getAll(){return this.#Ue.getAll()}async findById(e){return this.#Ue.findById(e)}async findByAddress(e){return this.#Ue.findByAddress(e)}async save(e){return this.#Ue.save(e)}async delete(e){return this.#Ue.delete(e)}}(WS),KS=new class{#U;#X="transactions";constructor(e){this.#U=e}async getAll(){const e=await this.#U.getKey(this.#X);return Object.values(e??{}).flat()}async findByAccountId(e){return await this.#U.getKey(`${this.#X}.${e}`)??[]}async save(e){await this.saveMany([e])}async saveMany(e){await this.#U.update((t=>{const n=t[this.#X];return e.forEach((e=>{const r=e.id,o=e.account,i=n[o]??[],a=i.findIndex((e=>e.id===r));-1!==a&&(i[a]=e);const s=(0,_d.chain)([...i,e]).uniqBy("id").sortBy((e=>-(e.timestamp??0))).value();t[this.#X][o]=s})),t}))}}(kS),GS=new class{#De;#Le;#Fe;#h;#i;constructor(e,t,n,r,o){this.#De=e,this.#Le=t,this.#Fe=n,this.#h=r,this.#i=Kl(o,"[💱 TransactionsService]")}async fetchBySignature(e,t,n){const r=await this.#h.getRpc(n).getTransaction(mc(e),{maxSupportedTransactionVersion:0}).send();return this.#$e(r,t,n)}async fetchAssetsTransactions(e,t){const n=await this.#Le.getAll(),r=e=>n.find((t=>t.id===e)),o=e.map((e=>e.assetType)),i=await this.#Fe.getAssetsMetadata(o),a=await this.#De.getAll(),s=(await Promise.all(e.map((async e=>{const{network:t}=e,n="pubkey"in e?e.pubkey:e.address,r=await(async e=>{const{network:t}=e,n="mint"in e?e.mint:e.address,r=a.sort(((e,t)=>(t.timestamp??0)-(e.timestamp??0))).find((e=>e.from.some((e=>$y(t,n)===(0,_d.get)(e,"asset.type")))||e.to.some((e=>$y(t,n)===(0,_d.get)(e,"asset.type")))));return r||null})(e),o=r?mc(r?.id):void 0;return(await this.#h.getRpc(t).getSignaturesForAddress(Hs(n),{limit:5,...o?{until:o}:{}}).send()).map((t=>({signatureResponse:{signature:t.signature,blockTime:Number(t.blockTime??0)},asset:e})))})))).flat(),c=t?.limit?s.sort(((e,t)=>(t.signatureResponse.blockTime??0)-(e.signatureResponse.blockTime??0))).slice(0,t.limit):s,u=(await Promise.all(c.map((async e=>{try{const{signatureResponse:t,asset:n}=e;return{transaction:await this.#h.getRpc(n.network).getTransaction(mc(t.signature),{maxSupportedTransactionVersion:0}).send(),asset:n}}catch(e){return null}})))).filter((e=>null!==e));return(await Promise.all(u.map((async e=>{const{transaction:t,asset:n}=e;if(!t)return null;const o=r(n.keyringAccountId);return o?this.#$e(t,o,n.network,i):null})))).filter((e=>null!==e)).filter((e=>{const t=r(e.account);return!!t&&!function(e,t){return[Wy].some((n=>n(e,t)))}(e,t)}))}async fetchLatestSignatures(e,t,n){return(await this.#h.getRpc(e).getSignaturesForAddress(t,n).send()).map((({signature:e})=>e))}async findByAccounts(e){return(await Promise.all(e.map((async e=>this.#De.findByAccountId(e.id))))).flat()}async save(e){await this.saveMany([e])}async saveMany(e){await this.#De.saveMany(e);const t=(0,_d.groupBy)(e,"account");await vn(snap,gn.AccountTransactionsUpdated,{transactions:t})}async#$e(e,t,n,r){if(!e)return null;const o=Yy({transactionData:e,account:t,scope:n});if(!o)return null;const i=[...new Set([...o.from,...o.to].filter((e=>e.asset?.fungible)).map((e=>e.asset.type)))],a=r??await this.#Fe.getAssetsMetadata(i);return o.from.forEach((e=>{e.asset?.fungible&&a[e.asset.type]&&(e.asset.unit=a[e.asset.type]?.symbol??"")})),o.to.forEach((e=>{e.asset?.fungible&&a[e.asset.type]&&(e.asset.unit=a[e.asset.type]?.symbol??"")})),o}}(KS,VS,qS,xS,Gl),HS=new class{#Le;#Fe;#qe;#i;constructor(e,t,n,r){this.#Le=e,this.#Fe=t,this.#qe=n,this.#i=Kl(r,"[🔄 AccountsSynchronizer]")}async synchronize(e){const t=e??await this.#Le.getAll();this.#i.info("Synchronizing accounts",t);const n=(await Promise.allSettled(t.map((async e=>this.#Fe.fetch(e))))).map((e=>"fulfilled"===e.status?e.value:[])).flat(),r=await this.#Fe.getAll(),o=n.filter((e=>qy.hasChanged(e,r)));await this.#Fe.saveMany(o);const i=await this.#qe.fetchAssetsTransactions(o,{limit:20});await this.#qe.saveMany(i)}}(VS,qS,GS,Gl),ZS=new class{#We;#i;#m;#Ve;constructor(e,t,n,r){this.#We=e,this.#m=t,this.#Ve=n,this.#i=r}async scanTransaction({method:e,accountAddress:t,transaction:n,scope:r,origin:o,options:i=["simulation","validation"],account:a}){try{const s=await this.#We.scanTransactions({method:e,accountAddress:t,transactions:[n],scope:r,origin:o===Ql?"https://metamask.io":o,options:i}),c=this.#Ke(s);if(!c?.status)return this.#i.warn("Invalid scan result received from security alerts API"),a&&await this.#Ve.trackEventSecurityScanCompleted(a,o,r,AS.ERROR,!1),null;if(a){const e=Object.values(AS).includes(c.status)?c.status:AS.ERROR,t=Boolean(c.validation?.type&&c.validation.type!==wS.Benign),n=[this.#Ve.trackEventSecurityScanCompleted(a,o,r,e,t)];if(t){const e=Object.values(wS).includes(c.validation.type)?c.validation.type:wS.Warning;n.push(this.#Ve.trackEventSecurityAlertDetected(a,o,r,e,c.validation.reason??"unknown",this.#Ge(c.validation)))}await Promise.all(n)}if(!c?.estimatedChanges?.assets)return null;const u={...c},l=c.estimatedChanges.assets.map((async(e,t)=>{const{logo:n}=e;if(n)return this.#m.generateImageComponent(n,16,16).then((e=>{e&&u?.estimatedChanges?.assets?.[t]&&(u.estimatedChanges.assets[t].imageSvg=e)})).catch((()=>null))}));return await Promise.all(l??[]),u}catch(e){return this.#i.error(e),a&&await this.#Ve.trackEventSecurityScanCompleted(a,o,r,AS.ERROR,!1),null}}#Ge(e){if(!e?.reason)return"Security alert: Unknown reason";return{unfair_trade:"Unfair trade of assets, without adequate compensation to the owner's account",transfer_farming:"Substantial transfer of the account's assets to untrusted entities",writable_accounts_farming:"Transaction exposes unused writable account, can be utilized in BIT-FLIP attacks patterns",native_ownership_change:"The account transferred ownership of its native SOL to untrusted entities",spl_token_ownership_change:"The account transferred ownership of its SPL tokens to untrusted entities",exposure_farming:"The account delegates ownership, thereby exposing its assets to untrusted spenders",known_attacker:"A known attacker's account is involved in the transaction",invalid_signature:"One of the transactions provided contains non valid signatures, that can lead misleading simulation results",honeypot:"The account invests funds in a token that is part of an orchestrated honeypot scheme",other:"The transaction was marked as malicious for other reason, further details would be described in features field"}[e.reason]??`Security alert: ${e.reason}`}#Ke(e){return e?{status:"SUCCESS"===e.status||"ERROR"===e.status?e.status:"ERROR",estimatedChanges:{assets:e.result?.simulation?.account_summary?.account_assets_diff?.map((e=>({type:e.in?"in":"out",symbol:"symbol"in e.asset?e.asset.symbol:e.asset_type,name:"name"in e.asset?e.asset.name:e.asset_type,logo:"logo"in e.asset?e.asset.logo:null,value:e.in?.value??e.out?.value??null,price:e.in?.usd_price??e.out?.usd_price??null,imageSvg:null})))??[]},validation:{type:e.result?.validation?.result_type??null,reason:e.result?.validation?.reason??null},error:e?.error_details?{type:"type"in e.error_details?e.error_details.type:null,code:"code"in e.error_details?e.error_details.code:null}:null}:null}}(new class{#o;#i;#a;constructor(e,t=globalThis.fetch,n=Gl){const{baseUrl:r}=e.get().securityAlertsApi;this.#o=t,this.#i=n,this.#a=r}async scanTransactions({method:e,accountAddress:t,transactions:n,scope:r,origin:o,options:i}){const a=jd.from(zd.decode(t)).toString("base64");this.#i.info("Scanning transaction");return(await this.#o(`${this.#a}/solana/message/scan`,{headers:{"Content-Type":"application/json",accept:"application/json"},method:"POST",body:JSON.stringify({method:e,encoding:"base64",account_address:a,metadata:{url:o},chain:Ud[r],transactions:n,options:i})})).json()}}(SS),DS,_S,Gl),JS=new class{async handleKeyringRequest(e,t){const{request:{method:n}}=e;switch(n){case $t.SignAndSendTransaction:case $t.SignTransaction:return this.#He(e,t);case $t.SignMessage:return this.#Ze(e,t);case $t.SignIn:return this.#Je(e,t);default:throw new Error(`Unsupported method: ${n}`)}}async#He(e,t){M(e.request,ae([Wf,Gf]));const{request:{method:n,params:{transaction:r}},scope:o,account:i,origin:a}=e;await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:jy.OnTransactionAdded,params:{accountId:i,metadata:{scope:o,origin:a}}}}});return await aw({...iw,scope:o,method:n,origin:e.origin,transaction:r,account:t})?(await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:jy.OnTransactionApproved,params:{accountId:i,metadata:{scope:o,origin:a}}}}}),!0):(await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:jy.OnTransactionRejected,params:{accountId:i,metadata:{scope:o,origin:a}}}}}),!1)}async#Ze(e,t){const n=await async function(e,t){M(e.request,Kf);const{request:{params:{message:n}},scope:r,origin:o}=e,i=js().encode(n),a=$s().decode(i),s=await py().then((e=>e.locale)).catch((()=>Av));return hy(await ly(Qy(qv,{message:a,account:t,scope:r,locale:s,networkImage:ev,origin:o}),{}))}(e,t);return Boolean(n)}async#Je(e,t){const n=await async function(e,t){M(e.request,Vf);const{request:{params:n},scope:r,origin:o}=e,i=await py();return hy(await ly(Qy(Lv,{params:n,account:t,scope:r,preferences:i,networkImage:ev,origin:o}),{}))}(e,t);return Boolean(n)}},YS=new class{#Ye;#Qe;#qe;#Ve;#h;#p;#i;#Xe=new Map;constructor(e,t,n,r,o,i,a){this.#Ye=e,this.#Qe=t,this.#qe=n,this.#Ve=r,this.#h=o,this.#p=i,this.#i=Kl(a,"[✍️ SignatureMonitor]"),this.#ee()}#ee(){const{activeNetworks:e}=this.#p.get();e.forEach((e=>{this.#Ye.registerNotificationHandler("signatureSubscribe",e,this.#et.bind(this)),this.#Ye.registerConnectionRecoveryHandler(e,this.#tt.bind(this))}))}async monitor(e,t,n,r,o){this.#i.info("Monitoring signature",{signature:e,accountId:t,commitment:n,network:r,origin:o});const i={method:"signatureSubscribe",network:r,params:[e,{commitment:n,enableReceivedNotification:!1}],metadata:{accountId:t,origin:o}},a=await this.#Ye.subscribe(i);this.#Xe.set(a,i)}async#et(e,t){try{const{network:e}=t,n=(0,_d.get)(t,"params[0]");M(n,re());const r=(0,_d.get)(t,"params[1].commitment");M(r,Ym);const o=t.metadata?.accountId;M(o,re());const i=t.metadata?.origin;M(i,re());const a=await this.#Qe.findById(o);if(!a)throw new Error(`Account not found: ${o}`);const s=await this.#qe.fetchBySignature(n,a,e);if(!s)throw new Error(`Transaction with signature ${n} not found on network ${e}`);switch(r){case"processed":await this.#qe.save(s),await this.#Ve.trackEventTransactionSubmitted(a,n,{scope:e,origin:i});break;case"confirmed":case"finalized":await this.#qe.save(s),await this.#Ve.trackEventTransactionFinalized(a,s,{scope:e,origin:i});break;default:this.#i.warn(`⚠️ Commitment ${r} not supported`)}}catch(e){this.#i.error("Error handling signature notification",e)}finally{await this.#Ye.unsubscribe(t.id),this.#Xe.delete(t.id)}}async#tt(){this.#i.info("Handling connection recovery"),await Promise.all(Array.from(this.#Xe.entries()).map((async([e,t])=>{await this.#nt(t,e)})))}async#nt(e,t){try{const{network:n}=e;M(n,re());const r=(0,_d.get)(e,"params[0]");M(r,re());const o=(0,_d.get)(e,"params[1].commitment");M(o,Ym);const i=await this.#rt(r,n);if(!i)throw new Error(`Signature ${r} not found via HTTP fetch during connection recovery`);if(!this.#ot(i,o))return void this.#i.info("Signature did not reach the desired commitment while connection was down. Skipping.");const a={jsonrpc:"2.0",method:"signatureNotification",params:{subscription:1,result:{context:{slot:BigInt(0)},value:{err:null}}}},s={...e,id:t};await this.#et(a,s),this.#Xe.delete(t)}catch(e){this.#i.error("Error handling connection recovery",e)}}async#rt(e,t){const n=await this.#h.getRpc(t).getSignatureStatuses([mc(e)],{searchTransactionHistory:!0}).send(),r=n.value[0]?.confirmationStatus;if(!r)throw new Error(`Signature ${e} not found via HTTP fetch during connection recovery`);return r}#ot(e,t){return t===e||"processed"===t&&("confirmed"===e||"finalized"===e)||"confirmed"===t&&"finalized"===e}}(NS,VS,GS,_S,xS,SS,Gl),QS=new class{#Ye;#Qe;#Fe;#qe;#it;#p;#G;#i;#at=new Map;#st=[Wh,Lp];constructor(e,t,n,r,o,i,a,s){this.#Ye=e,this.#Qe=t,this.#Fe=n,this.#qe=r,this.#it=o,this.#p=i,this.#G=a,this.#i=Kl(s,"[🗝️ KeyringAccountMonitor]"),this.#ee()}#ee(){this.#i.info("Binding handlers"),this.#G.on("onStart",this.#ct.bind(this)),this.#G.on("onUpdate",this.#ct.bind(this)),this.#G.on("onInstall",this.#ct.bind(this));const{activeNetworks:e}=this.#p.get();e.forEach((e=>{this.#Ye.registerNotificationHandler("accountSubscribe",e,this.#ut.bind(this)),this.#Ye.registerNotificationHandler("programSubscribe",e,this.#lt.bind(this))})),e.forEach((e=>{this.#Ye.registerConnectionRecoveryHandler(e,this.#tt.bind(this))}))}async#ct(){this.#i.info("Handling onStart/onUpdate/onInstall");const e=await this.#Qe.getAll(),t=Array.from(this.#at.keys());await Promise.allSettled(t.map((async t=>{const n=e.find((e=>e.id===t));n&&await this.stopMonitorKeyringAccount(n)}))),await Promise.allSettled(e.map((async e=>{await this.monitorKeyringAccount(e)})))}async monitorKeyringAccount(e){try{this.#i.log("Monitoring keyring account",e);const{id:t}=e,{activeNetworks:n}=this.#p.get();if(this.#at.has(t))return void this.#i.log("Account is already being monitored",e);const r=t=>e.scopes.includes(t),o=n.filter(r).map((async t=>this.#dt(e,t))),i=n.filter(r).map((async t=>{await Promise.all(this.#st.map((async n=>this.#ft(e,n,t))))}));await Promise.all([...i,...o])}catch(t){throw this.#i.error("Error monitoring keyring account",t),await this.stopMonitorKeyringAccount(e),t}}async stopMonitorKeyringAccount(e){this.#i.log("Stopping to monitor all assets of account",e);const{id:t}=e,n=this.#at.get(t);n&&await Promise.allSettled(Array.from(n).map((async e=>this.#Ye.unsubscribe(e)))),this.#at.delete(t)}async#dt(e,t){this.#i.log("Monitoring native asset balance",{account:e,network:t});const{address:n,id:r}=e,o=await this.#Ye.subscribe({method:"accountSubscribe",network:t,params:[n,{commitment:"confirmed",encoding:"jsonParsed"}]});this.#ht(r,o)}async#ft(e,t,n){this.#i.log("Monitoring token program by owner",{account:e,tokenProgramAddress:t,network:n});const{address:r,id:o}=e,i=await this.#Ye.subscribe({method:"programSubscribe",network:n,params:[t,{commitment:"confirmed",encoding:"jsonParsed",filters:[{memcmp:{offset:32,bytes:r,encoding:"base58"}}]}]});this.#ht(o,i)}async#ut(e,t){this.#i.info("Account notification received",{notification:e,subscription:t});const{network:n}=t,r=(0,_d.get)(t,"params[0]");M(r,re());const o=await this.#Qe.findByAddress(r);if(!o)throw new Error(`No keyring account found for address: ${r}`);const{lamports:i}=e.params.result.value;M(i,X());await Promise.all([this.#Fe.save({assetType:`${n}/${rd.SOL}`,keyringAccountId:o.id,network:n,address:r,symbol:"SOL",decimals:9,rawAmount:i.toString(),uiAmount:Ly(i,9)}),this.#pt(o,n,r)])}async#lt(e,t){this.#i.info("Handling program notification",{notification:e,subscription:t});const{network:n}=t,r=(0,_d.get)(t,"params[0]");if(M(r,re()),r!==Wh&&r!==Lp)throw new Error(`Program not supported: ${r}`);const{owner:o}=e.params.result.value.account.data.parsed.info;M(o,re());const{mint:i}=e.params.result.value.account.data.parsed.info;M(i,re());const{amount:a,decimals:s,uiAmountString:c}=e.params.result.value.account.data.parsed.info.tokenAmount;M(a,re()),M(s,X()),M(c,re());const{pubkey:u}=e.params.result.value;M(u,re());const l=$y(n,i),d=await this.#Qe.findByAddress(o);if(!d)throw new Error(`No keyring account found with address: ${o}`);await Promise.all([this.#Fe.save({assetType:l,keyringAccountId:d.id,network:n,mint:i,pubkey:u,symbol:"",decimals:s,rawAmount:a,uiAmount:c}),this.#pt(d,n,u)])}async#pt(e,t,n){const r=(await this.#qe.fetchLatestSignatures(t,Hs(n),{limit:1}))?.[0];if(!r)throw new Error("No signature found");const o=await this.#qe.fetchBySignature(r,e,t);if(!o)throw new Error("No transaction found");await this.#qe.save(o)}#ht(e,t){this.#at.has(e)||this.#at.set(e,new Set),this.#at.get(e)?.add(t)}async#tt(e){this.#i.info("Handling connection recovery",{network:e});const t=await this.#Qe.getAll(),n=(await this.#Ye.getAll()).filter((t=>t.network===e&&"accountSubscribe"===t.method)),r=t.filter((e=>n.some((t=>(0,_d.get)(t,"params[0]")===e.address))));r.length&&await this.#it.synchronize(r)}}(NS,VS,qS,GS,HS,SS,ES,Gl),XS=new class{#h;#B;#gt;#i;constructor(e,t,n,r=Gl){this.#h=e,this.#B=t,this.#gt=n,this.#i=Kl(r,"[👛 WalletService]")}async resolveAccountAddress(e,t,n){this.#i.log("Resolving account address",{keyringAccounts:e,scope:t,request:n});const{method:r,params:o}=n,i=e.filter((e=>e.scopes.includes(t)));if(0===i.length)throw new Error("No accounts with this scope");let a;switch(r){case $t.SignIn:{const{address:e}=o;if(!e)throw new Error("No address");a=e;break}case $t.SignAndSendTransaction:case $t.SignMessage:case $t.SignTransaction:{const{account:e}=o;a=e.address;break}default:throw this.#i.warn({method:r},"Unsupported method"),new Error("Unsupported method")}if(!i.find((e=>e.address===a)))throw new Error("Account not found");return mv(t,a)}#mt(e,t){const{address:n}=e,{account:r}=t.request.params;try{Hs(r.address)}catch{throw new Error("Invalid Solana address format")}if(r.address!==n)throw new Error("The requested account and/or method has not been authorized by the user.")}async signTransaction(e,t){this.#i.log("Signing transaction",{account:e,request:t}),M(t.request,Gf),M(t.scope,gd),this.#mt(e,t);const{transaction:n,scope:r,options:o}=t.request.params,i=o?.minContextSlot?{minContextSlot:BigInt(o.minContextSlot)}:void 0,a=await this.#B.partiallySignBase64String(n,e,r,i),s={signedTransaction:Wm(a)};M(s,Zf);const c=Qu(a);return await this.#gt.monitor(c,e.id,"confirmed",r,t.origin),s}async signAndSendTransaction(e,t,n,r,o){this.#i.log("Signing and sending transaction",e);const i=o?.minContextSlot?{minContextSlot:BigInt(o.minContextSlot)}:void 0,a=await this.#B.partiallySignBase64String(t,e,n,i),s=Qu(a),c=function({rpc:e}){return async function(t,n){await Fm({...n,rpc:e,transaction:t})}}({rpc:this.#h.getRpc(n)}),u=pv(n,"tx",s);this.#i.info(`Sending transaction: ${u}`),el(a);const l={...o?.preflightCommitment?{preflightCommitment:o.preflightCommitment}:{},...o?.minContextSlot?{minContextSlot:BigInt(o.minContextSlot)}:{},...o?.maxRetries?{maxRetries:BigInt(o.maxRetries)}:{},skipPreflight:o?.skipPreflight??!0,commitment:"confirmed"};await c(a,l),await this.#gt.monitor(s,e.id,o?.commitment??"confirmed",n,r);const d={signature:s};return M(d,Hf),d}async signMessage(e,t){this.#i.log("Signing message",e,t),M(t.request,Kf);const{address:n,entropySource:r,derivationPath:o}=e,i=Hs(n),{scope:a}=t;M(a,gd),this.#mt(e,t);const{message:s}=t.request.params,c=js().encode(s),u=function(e,t={}){return Object.freeze({content:"string"==typeof e?(new ml).encode(e):e,signatures:Object.freeze({...t})})}($s().decode(c)),{privateKeyBytes:l}=await iy({entropySource:r,derivationPath:o}),d=await dl(l),[f]=await d.signMessages([u]);M(f,ee());const h=f[i];var p;M(h,(p=Uint8Array,D("instance",(e=>e instanceof p||`Expected a \`${p.name}\` instance, but received: ${R(e)}`))));const g={signature:Rs().decode(h),signedMessage:s,signatureType:"ed25519"};return M(g,Jf),g}async signIn(e,t){this.#i.log("Signing in",e,t),M(t.request,Vf);const{address:n}=e,{params:r}=t.request,o=this.#yt(r),i=$s().encode(o),a=js().decode(i),s={id:globalThis.crypto.randomUUID(),scope:t.scope,account:e.id,origin:t.origin,request:{method:$t.SignMessage,params:{account:{address:n},message:a}}},c={account:{address:n},...await this.signMessage(e,s)};return M(c,Yf),c}async verifySignature(e,t,n){this.#i.log("Verifying signature",{account:e,signatureBase58:t,messageBase64:n}),M(t,vd),M(n,wd);const r=Ps().encode(t),o=js().encode(n),{privateKeyBytes:i}=await iy({entropySource:e.entropySource,derivationPath:e.derivationPath}),a=await dl(i);return await yc(a.keyPair.publicKey,r,o)}#yt(e){const{domain:t,address:n,statement:r,uri:o,version:i,chainId:a,nonce:s,issuedAt:c,expirationTime:u,notBefore:l,requestId:d,resources:f}=e;let h=`${t??""} wants you to sign in with your Solana account:\n`;h+=`${n??""}`,r&&(h+=`\n\n${r}`);const p=[];if(o&&p.push(`URI: ${o}`),i&&p.push(`Version: ${i}`),a&&p.push(`Chain ID: ${a}`),s&&p.push(`Nonce: ${s}`),c&&p.push(`Issued At: ${c}`),u&&p.push(`Expiration Time: ${u}`),l&&p.push(`Not Before: ${l}`),d&&p.push(`Request ID: ${d}`),f&&f.length>0){p.push("Resources:");for(const e of f)p.push(`- ${e}`)}return p.length&&(h+=`\n\n${p.join("\n")}`),h}}(xS,BS,YS,Gl),eE=new class{#U;#i;#qe;#Fe;#vt;#wt;#At;#bt;constructor({state:e,logger:t,transactionsService:n,assetsService:r,walletService:o,confirmationHandler:i,keyringAccountMonitor:a,nameResolutionService:s}){this.#U=e,this.#i=Kl(t,"[🔑 Keyring]"),this.#qe=n,this.#Fe=r,this.#vt=o,this.#wt=i,this.#At=a,this.#bt=s}async listAccounts(){try{const e=await this.#U.getKey("keyringAccounts")??{};return(0,_d.sortBy)(Object.values(e),["entropySource","index"])}catch(e){throw this.#i.error({error:e},"Error listing accounts"),new Error("Error listing accounts")}}async getAccount(e){try{My({accountId:e},ud);const t=await this.#U.getKey(`keyringAccounts.${e}`);return t&&(t.domain=await this.#bt.resolveAddress(Xl.Mainnet,t.address)),t}catch(e){throw this.#i.error({error:e},"Error getting account"),new $r(e)}}async getAccountOrThrow(e){const t=await this.getAccount(e);if(!t)throw new Error(`Account "${e}" not found`);return t}#St(e,t){return function(e){if(0===e.length)return 0;const t=e.map((e=>e.index)).sort(((e,t)=>e-t));let n=0;for(const e of t){if(e!==n)break;n+=1}return n}(e.filter((e=>e.entropySource===t)))}#Et(e){return`m/44'/501'/${e}'/0'`}#kt(e){const t=e.split("/")[3];if(!t)throw new Error("Invalid derivation path");const n=parseInt(t.replace("'",""),10);return M(n,Z()),n}async#It(){const e=(await async function(){return await snap.request({method:"snap_listEntropySources"})}()).find((({primary:e})=>e));if(!e)throw new Error("No default entropy source found - this can never happen");return e.id}async createAccount(e){const t=globalThis.crypto.randomUUID();try{const n=await this.listAccounts(),r=e?.entropySource??await this.#It(),o=e?.derivationPath?this.#kt(e.derivationPath):this.#St(n,r),i=e?.derivationPath?e.derivationPath:this.#Et(o),a=n.find((e=>e.derivationPath===i&&e.entropySource===r));if(a)return this.#i.warn("An account already exists with the same derivation path and entropy source. Skipping account creation."),Zm(a);const{publicKeyBytes:s}=await iy({entropySource:r,derivationPath:i}),c=Js().decode(s.slice(1)),{importedAccount:u,accountNameSuggestion:l,metamask:d,...f}=e??{},h={id:t,entropySource:r,derivationPath:i,index:o,type:dt.DataAccount,address:c,domain:null,scopes:[Lt.Mainnet,Lt.Testnet,Lt.Devnet],options:{...f,entropySource:r,derivationPath:i,index:o},methods:[$t.SignAndSendTransaction,$t.SignTransaction,$t.SignMessage,$t.SignIn]};await this.#U.setKey(`keyringAccounts.${h.id}`,h);const p=await this.#Fe.fetch(h);await this.#Fe.saveMany(p),await this.#At.monitorKeyringAccount(h);const g=Zm(h);return await this.emitEvent(gn.AccountCreated,{account:g,accountNameSuggestion:l??`Solana Account ${o+1}`,displayAccountNameSuggestion:!l,displayConfirmation:!1,...d?{metamask:d}:{}}),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:jy.OnSyncAccountTransactions,params:{accountId:t}}}}),g}catch(e){throw this.#i.error({error:e},"Error creating account"),await this.#Tt(t),new Error(`Error creating account: ${e.message}`)}}async#Tt(e){await Promise.all([this.#U.deleteKey(`keyringAccounts.${e}`),this.#U.deleteKey(`transactions.${e}`),this.#U.deleteKey(`assets.${e}`)])}async deleteAccount(e){try{My({accountId:e},ld);const t=await this.getAccountOrThrow(e);await this.emitEvent(gn.AccountDeleted,{id:e}),await Promise.allSettled([this.#Tt(e),this.#At.stopMonitorKeyringAccount(t)])}catch(e){throw this.#i.error({error:e},"Error deleting account"),e}}async listAccountAssets(e){try{My({accountId:e},dd);const t=await this.getAccountOrThrow(e),n=(await this.#Fe.findByAccount(t)).filter((e=>e.assetType.endsWith(rd.SOL)||Number(e.rawAmount)>0)).map((e=>e.assetType));return zy(n,nn),n}catch(e){throw this.#i.error({error:e},"Error listing account assets"),e}}async getAccountBalances(e,t){try{My({accountId:e,assets:t},fd);const n=await this.getAccountOrThrow(e),r=(await this.#Fe.findByAccount(n)).filter((e=>t.includes(e.assetType))).filter((e=>e.assetType.endsWith(rd.SOL)||Number(e.rawAmount)>0)).reduce(((e,t)=>(e[t.assetType]={unit:t.symbol,amount:t.uiAmount},e)),{});return zy(r,pd),r}catch(e){throw this.#i.error({error:e},"Error getting account balances"),e}}async emitEvent(e,t){await vn(snap,e,t)}async filterAccountChains(e,t){throw new Error(`Implement me! ${e} ${t.toString()}`)}async updateAccount(e){throw new Error(`Implement me! ${JSON.stringify(e)}`)}async submitRequest(e){return{pending:!1,result:await this.#_t(e)}}async#_t(e){M(e,Uy);const{request:{method:t,params:n},scope:r,account:o,origin:i}=e,a=await this.getAccountOrThrow(o);if(!a.scopes.includes(r))throw new Error(`Scope "${r}" is not allowed for this account`);if(!a.methods.includes(t))throw new Error(`Method "${t}" is not allowed for this account`);if("scope"in n&&r!==n.scope)throw new Error(`Scope "${r}" does not match "${n.scope}" in request.params`);if(!await this.#wt.handleKeyringRequest(e,a))throw new ao;switch(t){case $t.SignAndSendTransaction:{const{transaction:e,options:t}=n;return this.#vt.signAndSendTransaction(a,e,r,i,t)}case $t.SignTransaction:return this.#vt.signTransaction(a,e);case $t.SignMessage:return this.#vt.signMessage(a,e);case $t.SignIn:return this.#vt.signIn(a,e);default:throw new Jr(`Unsupported method: ${t}`)}}async listAccountTransactions(e,t){try{My({accountId:e,pagination:t},hd);const{limit:n,next:r}=t,o=await this.getAccount(e);if(!o)throw new Error("Account not found");const i=await this.#qe.findByAccounts([o]),a=r?i.findIndex((e=>e.id===r)):0,s=i.slice(a,a+n),c=a+t.limit<i.length;return{data:s,next:c?i[a+t.limit]?.id??null:null}}catch(e){throw this.#i.error({error:e},"Error listing account transactions"),e}}async resolveAccountAddress(e,t){try{M(e,gd);const{method:n,params:r}=t,o={method:n,params:r};M(o,Qf);const i=await this.listAccounts();return{address:await this.#vt.resolveAccountAddress(i,e,o)}}catch(e){return this.#i.error({error:e},"Error resolving account address"),null}}async discoverAccounts(e,t,n){try{M({scopes:e,entropySource:t,groupIndex:n},Dy);const r=this.#Et(n),{publicKeyBytes:o}=await iy({entropySource:t,derivationPath:r}),i=Js().decode(o.slice(1)),a=[];for(const t of e)a.push(this.#qe.fetchLatestSignatures(t,i,{limit:1}));const s=await Promise.all(a);return s.some((e=>e.length>0))?[{type:"bip44",scopes:e,derivationPath:r}]:[]}catch(e){throw this.#i.error({error:e},"Error discovering accounts"),e}}}({state:kS,transactionsService:GS,logger:Gl,assetsService:qS,walletService:XS,confirmationHandler:JS,keyringAccountMonitor:QS,nameResolutionService:FS}),tE=new class{#h;#i;constructor(e,t=Gl){this.#h=e,this.#i=t}static isMaybeNonFungible(e){const{tokenAmount:t}=e,{decimals:n}=t;return!1}}(xS,Gl),nE=new class{#h;#xt;#i;#v;#Ct;#Rt;#Fe;#xe={minimumBalanceForRentExemption:5*Ay.Minute};constructor(e,t,n,r,o,i,a){this.#h=e,this.#xt=t,this.#v=r,this.#i=Kl(n,"[📬 SendService]"),this.#Ct=o,this.#Rt=i,this.#Fe=a}async#Pt(e){return Zl((async t=>this.#h.getRpc(e).getMinimumBalanceForRentExemption(BigInt(0)).send().then((e=>To(e.toString())))),this.#v,{functionName:"SendService:getMinimumBalanceForRentExemption",ttlMilliseconds:this.#xe.minimumBalanceForRentExemption,generateCacheKey:(e,t)=>{const[n]=t;return`${e}:${n}`}})(e)}async confirmSend(e){const{fromAccountId:t,toAddress:n,amount:r,assetId:o}=e.params,i=await this.#xt.getAccountOrThrow(t),{chainId:a,assetReference:s}=Fo(o),c=a,u=o===id[c].nativeToken.caip19Id,l=u?this.#Ct:this.#Rt;this.#i.log("Confirming send transaction",{fromAccountId:t,toAddress:n,amount:r,assetId:o});const d={from:i,to:Hs(n),amount:r,network:c,...u?{}:{mint:Hs(s)}},f=Yu(await l.buildTransactionMessage(d)),h=Wm(f),p={id:globalThis.crypto.randomUUID(),scope:c,account:t,origin:Ql,request:{method:$t.SignAndSendTransaction,params:{account:{address:i.address},transaction:h,scope:c}}};return this.#i.log("Submitting keyring request",p),this.#xt.submitRequest(p)}async onAddressInput(e){const{params:{value:t}}=e;if(""===t)return{valid:!1,errors:[{code:Ef.Required}]};try{return Hs(t),{valid:!0,errors:[]}}catch(e){return{valid:!1,errors:[{code:Ef.Invalid}]}}}async onAmountInput(e){const{params:{value:t,accountId:n,assetId:r}}=e,o=await this.#xt.getAccountOrThrow(n),{chainId:i}=Fo(r),a=i,s=id[a].nativeToken.caip19Id,c=r===s,u=await this.#Fe.findByAccount(o),l=u.find((e=>e.assetType===r)),d=u.find((e=>e.assetType===s));if(!l)throw new Error(`Balance not found for asset ${r} and account ${n}`);if(""===t)return{valid:!1,errors:[{code:Ef.Required}]};const f=$d(l.uiAmount??"0"),h=$d(d?.uiAmount??"0"),p=$d(t),g=await this.#Pt(a),m=c?this.#Ct:this.#Rt,y=new zb(m).getFee(),v=To(y.toString());if(h.isZero())return{valid:!1,errors:[{code:Ef.InsufficientBalance}]};if(c){if(p.gt(h))return{valid:!1,errors:[{code:Ef.InsufficientBalance}]};if(p.plus(v).plus(g).gt(h))return{valid:!1,errors:[{code:Ef.InsufficientBalanceToCoverFee}]}}else{if(p.gt(f))return{valid:!1,errors:[{code:Ef.InsufficientBalance}]};if(v.plus(g).gt(h))return{valid:!1,errors:[{code:Ef.InsufficientBalanceToCoverFee}]}}return{valid:!0,errors:[]}}}(xS,eE,Gl,TS,OS,MS,qS),rE=new class{#xt;#vt;#i;#Nt;#B;constructor(e,t,n,r,o){this.#xt=e,this.#vt=t,this.#i=Kl(n,"[👋 ClientRequestHandler]"),this.#Nt=r,this.#B=o}async handle(e){this.#i.log("Handling client request",e);const{method:t}=e;switch(t){case qd.SignAndSendTransactionWithoutConfirmation:return this.#Bt(e);case qd.ConfirmSend:return this.#Ot(e);case qd.SignAndSendTransaction:return this.#Mt(e);case qd.ComputeFee:return this.#zt(e);case qd.OnAddressInput:return this.#jt(e);case qd.OnAmountInput:return this.#Ut(e);default:throw new Jr}}async#Bt(e){try{M(e,Xf)}catch(e){const t=new Gr;throw t.cause=e,t}const{params:{transaction:t,options:n,account:{address:r},scope:o}}=e,i=(await this.#xt.listAccounts()).find((e=>e.address===r));if(!i)throw new Gr(`Account not found: ${r}`);return this.#vt.signAndSendTransaction(i,t,o,Ql,n)}async#Mt(e){try{M(e,th)}catch(e){const t=new Gr;throw t.cause=e,t}const{params:{transaction:t,options:n,accountId:r,scope:o}}=e,i=await this.#xt.getAccountOrThrow(r),{signature:a}=await this.#vt.signAndSendTransaction(i,t,o,Ql,n),s={transactionId:a};return M(s,nh),s}async#Ot(e){try{M(e,oh)}catch(e){const t=new Gr;throw t.cause=e,t}return await this.#Nt.confirmSend(e)}async#zt(e){try{M(e,dh)}catch(e){const t=new Gr;throw t.cause=e,t}const{params:{transaction:t,scope:n}}=e,r=await this.#B.getFeeFromBase64StringInLamports(t,n);if(null===r)throw new Error("Failed to get fee for transaction");const o=[{type:kt.Base,asset:{unit:id[n].nativeToken.symbol,type:id[n].nativeToken.caip19Id,amount:Fd(r).toString(),fungible:!0}}];return M(o,fh),o}async#jt(e){try{M(e,ah)}catch(e){const t=new Gr;throw t.cause=e,t}const t=await this.#Nt.onAddressInput(e);return M(t,uh),t}async#Ut(e){try{M(e,ch)}catch(e){const t=new Gr;throw t.cause=e,t}const t=await this.#Nt.onAmountInput(e);return M(t,uh),t}}(eE,XS,Gl,nE,BS),oE={configProvider:SS,connection:xS,keyring:eE,priceApiClient:zS,state:kS,cache:IS,assetsService:qS,tokenPricesService:LS,transactionHelper:BS,transactionsService:GS,sendSolBuilder:OS,sendSplTokenBuilder:MS,walletService:XS,transactionScanService:ZS,analyticsService:_S,confirmationHandler:JS,nftService:tE,clientRequestHandler:rE,webSocketConnectionService:RS,subscriptionService:NS,eventEmitter:ES,nameResolutionService:FS,accountsService:VS,accountsSynchronizer:HS},iE=ee({id:re(),jsonrpc:J("2.0"),method:J(jy.OnSyncAccountTransactions),params:ee({accountId:ad})}),aE=ee({id:re(),jsonrpc:J("2.0"),method:J(jy.OnTransactionAdded),params:ee({accountId:ad,metadata:ee({scope:gd,origin:re()})})}),sE=ee({id:re(),jsonrpc:J("2.0"),method:J(jy.OnTransactionApproved),params:ee({accountId:ad,metadata:ee({scope:gd,origin:re()})})}),cE=ee({id:re(),jsonrpc:J("2.0"),method:J(jy.OnTransactionRejected),params:ee({accountId:ad,metadata:ee({scope:gd,origin:re()})})}),uE=nv("Form"),lE=nv("Field"),dE=nv("AccountSelector"),fE=nv("AssetSelector"),hE=({title:e,backButtonName:t})=>Xy(ov,{direction:"horizontal",alignment:"space-between",center:!0,children:[t?Qy(fv,{name:t,children:Qy(Bv,{name:"arrow-left",color:"primary",size:"md"})}):null,Qy(iv,{size:"sm",children:e}),Xy(ov,{direction:"horizontal",children:[Qy(ov,{children:null}),Qy(ov,{children:null}),Qy(ov,{children:null}),Qy(ov,{children:null})]})]}),pE=nv("Input");var gE=function(e){return e.Form="send-form",e.DestinationAccountInput="send-to",e.BackButton="send-back-button",e.SourceAccountSelector="send-account-selector",e.AmountInput="send-amount-input",e.AssetSelector="send-asset-selector",e.SwapCurrencyButton="send-swap-currency",e.MaxAmountButton="send-amount-input-max",e.CancelButton="send-cancel-button",e.SendButton="send-submit-button",e.ClearButton="send-clear-button",e.CloseButton="send-close-button",e}({}),mE=function(e){return e.TOKEN="TOKEN",e.FIAT="USD",e}({});const yE=({name:e,value:t,tokenSymbol:n,currency:r,currencyType:o,locale:i,swapCurrencyButtonDisabled:a=!1})=>{const s=bv(i),c=o===mE.FIAT?r.toUpperCase():n;return Xy(lE,{label:s("send.amountField"),children:[Qy(pE,{name:e,type:"number",min:0,placeholder:"0",step:.01,value:t??void 0}),Xy(ov,{direction:"horizontal",center:!0,children:[Qy(ov,{direction:"vertical",alignment:"center",children:Qy(av,{size:"sm",children:c})}),Qy(fv,{name:gE.SwapCurrencyButton,disabled:a,children:Qy(Bv,{name:"swap-vertical",color:a?"muted":"primary",size:"md"})})]})]})},vE={initial:null,fetching:"default",fetched:"success",error:null},wE=({name:e,value:t,error:n,locale:r,showClearButton:o,disabled:i,domainResolutionStatus:a})=>{const s=bv(r);return Xy(ov,{children:[Xy(lE,{label:s("send.toField"),error:n,children:[Qy(pE,{name:e,placeholder:i?"":s("send.toPlaceholder"),value:t??void 0,disabled:i}),o?Qy(ov,{children:Qy(fv,{name:gE.ClearButton,children:Qy(Bv,{name:Nv.Close,color:"primary"})})}):null]}),a&&null!==vE[a]&&Qy(av,{size:"sm",color:vE[a],children:s(`send.toDomainResolutionStatus.${a}`)})]})},AE=e=>{const{amount:t,tokenPrices:n,tokenCaipId:r,currencyType:o}=e,i=n?.[r]?.price;if(o===mE.TOKEN)return t;if(void 0===i)throw new Error("Token price is undefined, cannot convert to fiat amount.");return null===t?null:_o(t).dividedBy(_o(i)).toString()},bE=e=>{const{selectedTokenMetadata:t}=e;return{...t??{},tokenSymbol:t?.symbol??"UNKNOWN",tokenImage:t?.imageSvg??yS}},SE=e=>{const{tokenCaipId:t,tokenPrices:n}=e;return n?.[t]?.price},EE=e=>{const{balances:t,fromAccountId:n,tokenCaipId:r}=e;return t?.[n]?.[r]?.amount??"0"},kE=e=>{const{tokenCaipId:t,scope:n}=e;return t===id[n]?.nativeToken?.caip19Id},IE=nv("Spinner"),TE=({title:e,subtitle:t,iconSrc:n,isLoading:r})=>Xy(ov,{alignment:"center",center:!0,children:[Xy(ov,{direction:"horizontal",center:!0,children:[r?Qy(IE,{}):null,n&&!r?Qy(lv,{borderRadius:"full",src:n}):null]}),Qy(iv,{size:"lg",children:e}),t?Qy(av,{color:"muted",children:t}):null]}),_E=nv("Value"),xE=({context:e})=>{const{scope:t,fromAccountId:n,toAddress:r,accounts:o,feeEstimatedInSol:i,preferences:{locale:a,currency:s},transaction:c,feePaidInSol:u,tokenPrices:l,fromDomain:d,toDomain:f}=e,h=bv(a),p=id[t],g=o.find((e=>e.id===n))?.address,m=mv(t,g),y=p.name,v=p.nativeToken.symbol,w=l[p.nativeToken.caip19Id]?.price,A=c?u:i,b=A?tw(A,v,a):"",S=void 0===w||null===A?"":Cv(nw(A,w),s,a);return Xy(ov,{children:[Xy(sv,{children:[Qy(cv,{label:h("send.confirmation.from"),children:d?Qy(gv,{domain:d,scope:t,address:g}):Qy(hv,{href:pv(t,"address",g),children:Qy(uv,{address:m,displayName:!0})})}),r?Qy(cv,{label:h("send.confirmation.recipient"),children:f?Qy(gv,{domain:f,scope:t,address:r}):Qy(hv,{href:pv(t,"address",r),children:Qy(uv,{address:mv(t,r),displayName:!0})})}):null]}),Xy(sv,{children:[Qy(cv,{label:h("send.confirmation.network"),children:Qy(av,{children:y})}),Qy(cv,{label:h("send.confirmation.transactionSpeed"),children:Qy(av,{children:"<1s"})}),Qy(cv,{label:h("send.confirmation.fee"),children:Qy(_E,{extra:S,value:b})})]})]})};var CE=function(e){return e.BackButton="transaction-confirmation-back-button",e.CancelButton="transaction-confirmation-cancel-button",e.ConfirmButton="transaction-confirmation-submit-button",e}({});const RE={"send-form":({context:e,inputToAddress:t,inputAmount:n})=>{const{accounts:r,fromAccountId:o,amount:i,destinationAddressOrDomain:a,domainResolutionStatus:s,validation:c,currencyType:u,tokenCaipId:l,scope:d,balances:f,tokenPricesFetchStatus:h,buildingTransaction:p,error:g,loading:m,transactionMessage:y,preferences:{locale:v,currency:w}}=e,A=bv(v),b=f[o]?.[l],S=b?.amount,E=b?.unit??"",k=void 0!==S,I=r.find((e=>e.id===o)),T=I?.address?mv(d,I.address):void 0,_=SE(e),x=void 0===S||"0"===S,C=void 0===_,R="error"===h||"fetched"===h&&C,P=(k?{[mE.FIAT]:Cv(nw(S,_??0),w,v),[mE.TOKEN]:tw(S,E,v)}:{[mE.FIAT]:"",[mE.TOKEN]:""})[u],N=o.length>0&&!!a&&a.length>0&&sf(c?.[gE.DestinationAccountInput]),B=!sf(y)&&""!==y,O=Boolean(a&&a.length>0),M=Boolean(c?.[gE.AmountInput]?.message),z=M?c?.[gE.AmountInput]?.message??"":`${A("send.balance")}: ${P}`,j=o.length>0&&!!i&&i.length>0&&!!a&&a.length>0&&Object.values(c).every(sf)&&k&&!p&&B;return Xy(rv,{backgroundColor:"alternative",children:[Xy(ov,{children:[Qy(hE,{title:A("send.title"),backButtonName:gE.BackButton}),Xy(uE,{name:gE.Form,children:[R&&Qy(Jv,{title:"",severity:"info",children:Qy(av,{children:A("send.selectedTokenPriceNotAvailable",{currency:w})})}),Qy(ov,{children:null}),Qy(ov,{children:null}),Qy(ov,{children:null}),Qy(lE,{label:A("send.fromField"),error:c?.[gE.SourceAccountSelector]?.message??"",children:Qy(dE,{name:gE.SourceAccountSelector,chainIds:[d],value:T??void 0,hideExternalAccounts:!0,switchGlobalAccount:!0})}),Qy(ov,{children:null}),Qy(ov,{children:null}),Qy(ov,{children:null}),Qy(wE,{locale:v,disabled:m,name:gE.DestinationAccountInput,value:t??null,showClearButton:O,domainResolutionStatus:s,error:c?.[gE.DestinationAccountInput]?.message??""}),N&&Xy(ov,{children:[Qy(ov,{children:null}),Qy(ov,{children:null}),Qy(ov,{children:null}),Xy(ov,{direction:"horizontal",children:[Qy(lE,{label:A("send.assetField"),children:Qy(fE,{chainIds:[d],value:l,name:gE.AssetSelector,addresses:T?[T]:[]})}),Qy(yE,{name:gE.AmountInput,currencyType:u,tokenSymbol:E,currency:w,value:n??null,locale:v,swapCurrencyButtonDisabled:C||x})]}),Xy(ov,{direction:"horizontal",alignment:"space-between",crossAlignment:"start",children:[Qy(ov,{direction:"vertical",alignment:"start",children:Qy(av,{size:"sm",color:M?"error":"muted",children:z})}),Qy(fv,{size:"sm",name:gE.MaxAmountButton,disabled:x,children:A("send.maxButton")})]})]}),g&&Xy(ov,{children:[Qy(ov,{children:null}),Qy(Jv,{title:A(g.title),severity:"warning",children:Qy(av,{children:A(g.message)})})]})]})]}),Xy(dv,{children:[Qy(fv,{name:gE.CancelButton,children:A("send.cancelButton")}),Qy(fv,{name:gE.SendButton,disabled:!j,loading:p,children:A("send.continueButton")})]})]})},"transaction-confirmation":({context:e})=>{const{preferences:{currency:t,locale:n}}=e,r=bv(n),{tokenImage:o,tokenSymbol:i}=bE(e),a=AE(e),s=SE(e),c=void 0===s?"":Cv(nw(a??"0",s),t,n);return Xy(rv,{children:[Xy(ov,{children:[Qy(hE,{title:r("send.confirmation.title"),backButtonName:"transaction-confirmation-back-button"}),Qy(TE,{title:tw(a??"0",i,n),subtitle:c,iconSrc:o}),Qy(xE,{context:e})]}),Xy(dv,{children:[Qy(fv,{name:"transaction-confirmation-cancel-button",children:r("send.confirmation.cancelButton")}),Qy(fv,{name:"transaction-confirmation-submit-button",loading:e.loading,disabled:e.loading,children:r("send.confirmation.sendButton")})]})]})},"send-pending":({context:e})=>{const t=bv(e.preferences.locale);return Qy(rv,{children:Xy(ov,{children:[Qy(ov,{children:null}),Qy(TE,{title:t("send.send-pending.title"),subtitle:t("send.send-pending.subtitle"),isLoading:!0}),Qy(xE,{context:e})]})})},"transaction-success":({context:e})=>{const{preferences:t,transaction:n,scope:r}=e,o=bv(t.locale),{tokenSymbol:i}=bE(e),a=AE(e);return Qy(rv,{children:Xy(ov,{children:[Qy(ov,{children:null}),Qy(TE,{title:o("send.transaction-success.title"),subtitle:o("send.transaction-success.subtitle",{amount:xv(a??"0",t.locale),tokenSymbol:i}),iconSrc:'<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M24.0002 3.99902C12.9802 3.99902 4.00024 12.979 4.00024 23.999C4.00024 35.019 12.9802 43.999 24.0002 43.999C35.0202 43.999 44.0002 35.019 44.0002 23.999C44.0002 12.979 35.0202 3.99902 24.0002 3.99902ZM33.5602 19.399L22.2202 30.739C21.9402 31.019 21.5602 31.179 21.1602 31.179C20.7602 31.179 20.3802 31.019 20.1002 30.739L14.4402 25.079C13.8602 24.499 13.8602 23.539 14.4402 22.959C15.0202 22.379 15.9802 22.379 16.5602 22.959L21.1602 27.559L31.4402 17.279C32.0202 16.699 32.9802 16.699 33.5602 17.279C34.1402 17.859 34.1402 18.799 33.5602 19.399Z" fill="#1C8234"/>\n</svg>\n'}),Qy(xE,{context:e}),n?.signature?Qy(ov,{alignment:"center",center:!0,children:Qy(hv,{href:pv(r,"tx",n?.signature),children:o("send.confirmation.viewTransaction")})}):null]})})},"transaction-failure":({context:e})=>{const{preferences:t}=e,n=bv(t.locale),{tokenSymbol:r}=bE(e),o=AE(e);return Qy(rv,{children:Xy(ov,{children:[Qy(ov,{children:null}),Qy(TE,{title:n("send.transaction-failure.title"),subtitle:n("send.transaction-failure.subtitle",{amount:o??"0",tokenSymbol:r}),iconSrc:'<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M40.8277 29.5283L29.7931 8.40143C28.3104 5.55884 26.2586 4 24 4C21.7414 4 19.6896 5.55884 18.2069 8.40143L7.17228 29.5283C5.77572 32.2241 5.62055 34.81 6.74125 36.8456C7.86194 38.8813 10.0689 40 12.9654 40H35.0346C37.9311 40 40.1381 38.8813 41.2588 36.8456C42.3795 34.81 42.2243 32.2058 40.8277 29.5283ZM22.7069 16.8375C22.7069 16.0856 23.2931 15.462 24 15.462C24.7069 15.462 25.2931 16.0856 25.2931 16.8375V26.0071C25.2931 26.759 24.7069 27.3826 24 27.3826C23.2931 27.3826 22.7069 26.759 22.7069 26.0071V16.8375ZM25.2241 32.811C25.1379 32.8844 25.0517 32.9577 24.9655 33.0311C24.8621 33.1044 24.7586 33.1595 24.6552 33.1961C24.5517 33.2511 24.4483 33.2878 24.3276 33.3062C24.2241 33.3245 24.1034 33.3428 24 33.3428C23.8965 33.3428 23.7759 33.3245 23.6552 33.3062C23.5517 33.2878 23.4483 33.2511 23.3448 33.1961C23.2414 33.1595 23.1379 33.1044 23.0345 33.0311C22.9483 32.9577 22.8621 32.8844 22.7759 32.811C22.4655 32.4626 22.2758 31.9857 22.2758 31.5089C22.2758 31.0321 22.4655 30.5553 22.7759 30.2068C22.8621 30.1335 22.9483 30.0601 23.0345 29.9868C23.1379 29.9134 23.2414 29.8584 23.3448 29.8217C23.4483 29.7667 23.5517 29.73 23.6552 29.7117C23.8793 29.6567 24.1207 29.6567 24.3276 29.7117C24.4483 29.73 24.5517 29.7667 24.6552 29.8217C24.7586 29.8584 24.8621 29.9134 24.9655 29.9868C25.0517 30.0601 25.1379 30.1335 25.2241 30.2068C25.5345 30.5553 25.7241 31.0321 25.7241 31.5089C25.7241 31.9857 25.5345 32.4626 25.2241 32.811Z" fill="#BF5208"/>\n</svg>\n'}),Qy(xE,{context:e})]})})}},PE=({context:e,inputToAddress:t,inputAmount:n})=>{const r=e.stage??"send-form";return Qy(RE[r],{context:e,inputToAddress:t,inputAmount:n})};function NE(e){if(!e)return!1;return/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*\.sol$/u.test(e)}function BE(e,t,n){return n[e]?n[e]?.map((e=>e(t))).find((e=>null!==e))??null:null}function OE(e){const t=DE(e),n={[gE.SourceAccountSelector]:e.fromAccountId,[gE.AmountInput]:e.amount,[gE.DestinationAccountInput]:e.toAddress};return Object.entries(t).every((([e,t])=>{const r=n[e];return!!r&&t.every((e=>null===e(r)))}))}const ME=(e,t)=>{const n=bv(t);return t=>{const r=""===t?{message:n(e),value:t}:null;return r?{message:r.message,value:t}:null}},zE=(e,t)=>{const n=bv(t);return t=>{try{return NE(t)||Hs(t),null}catch{return{message:n(e),value:t}}}},jE=e=>{const{minimumBalanceForRentExemptionSol:t,preferences:{locale:n},feeEstimatedInSol:r,selectedTokenMetadata:o}=e,i=bv(n);return n=>{if(""===n)return{message:"",value:n};const a=AE({...e,amount:n}),s=$d(a??"0"),c=EE(e),u=$d(c),l=$d(r??"0"),d=$d(t??"0"),f=(e=>EE({...e,tokenCaipId:id[e.scope].nativeToken.caip19Id}))(e),h=$d(f),p=kE(e);if(s.gt(u))return{message:`${i("send.insufficientBalance")}: ${c} ${o?.symbol??""}`,value:n};if(p){if(s.lt(d))return{message:i("send.amountGreatherThanMinimumBalanceForRentExemptionError",{minimumValue:t}),value:n};if(s.plus(l).plus(d).gt(u))return{message:i("send.insuffientSolToCoverFee"),value:n}}else{if(l.plus(d).gt(h))return{message:i("send.insuffientSolToCoverFee"),value:n}}return s.isZero()?{message:"",value:n}:h.isZero()?{message:i("send.insuffientSolToCoverFee"),value:n}:null}},UE=ee({scope:H([...Object.values(Xl)]),account:ad,assetId:te(Do)}),DE=e=>({[gE.SourceAccountSelector]:[ME("send.fromRequiredError",e.preferences.locale)],[gE.AmountInput]:[jE(e),ME("send.amountRequiredError",e.preferences.locale)],[gE.DestinationAccountInput]:[ME("send.toRequiredError",e.preferences.locale),zE("send.toInvalidError",e.preferences.locale)]}),LE={scope:Xl.Mainnet,fromAccountId:"",fromDomain:null,amount:"",destinationAddressOrDomain:null,toDomain:null,toAddress:null,domainResolutionStatus:null,feeEstimatedInSol:"0",feePaidInSol:"0",tokenCaipId:ed.SolMainnet,accounts:[],currencyType:mE.TOKEN,validation:{},balances:{},assets:[],tokenPrices:{},selectedTokenMetadata:null,tokenPricesFetchStatus:"initial",preferences:{locale:"en",currency:"usd",hideBalances:!1,useSecurityAlerts:!0,useExternalPricingData:!0,simulateOnChainActions:!0,useTokenDetection:!0,batchCheckBalances:!0,displayNftMedia:!0,useNftDetection:!0},error:null,buildingTransaction:!1,transactionMessage:null,transaction:null,stage:"send-form",minimumBalanceForRentExemptionSol:"0.002",loading:!0},FE={[jy.OnTransactionAdded]:async({request:e})=>{try{Gl.info("[onTransactionAdded] Cronjob triggered",e),M(e,aE);const{accountId:t,metadata:n}=e.params,r=await eE.getAccountOrThrow(t);await _S.trackEventTransactionAdded(r,n)}catch(e){throw Gl.error(e),new Vr(e)}},[jy.OnTransactionApproved]:async({request:e})=>{try{Gl.info("[onTransactionApproved] Cronjob triggered",e),M(e,sE);const{accountId:t,metadata:n}=e.params,r=await eE.getAccountOrThrow(t);await _S.trackEventTransactionApproved(r,n)}catch(e){throw Gl.error(e),new Vr(e)}},[jy.OnTransactionRejected]:async({request:e})=>{try{Gl.info("[onTransactionRejected] Cronjob triggered",e),M(e,cE);const{accountId:t,metadata:n}=e.params,r=await eE.getAccountOrThrow(t);await _S.trackEventTransactionRejected(r,n)}catch(e){throw Gl.error(e),new Vr(e)}},[jy.OnSyncAccountTransactions]:async({request:e})=>{M(e,iE);const{accountId:t}=e.params,n=await VS.findById(t);if(!n)throw new Error("Account not found");const r=await qS.fetch(n),o=await GS.fetchAssetsTransactions(r,{limit:20});await GS.saveMany(o)},[jy.RefreshSend]:async()=>{const e=Kl(Gl,"[refreshSend]");e.info("Background event triggered");const[t,n,r]=await Promise.all([qS.getAll(),kS.getKey("mapInterfaceNameToId"),py().catch((()=>LE.preferences))]),o=t.flatMap((e=>e.assetType)),i=n?.[cy];if(!i)return void e.info("No send form interface found");const a=await gy(i),s=await zS.getMultipleSpotPrices(o,r.currency);await kS.setKey("tokenPrices",s);const c={...a,tokenPrices:{...a.tokenPrices,...s}};await dy(i,Qy(PE,{context:c}),c),e.info("✅ Background event suceeded"),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT30S",request:{method:"refreshSend"}}})},[jy.RefreshConfirmationEstimation]:async()=>{const e=Kl(Gl,"[refreshConfirmationEstimation]");e.info("Background event triggered");const t=(await kS.getKey("mapInterfaceNameToId")??{})[uy];if(!t)return void e.info("No interface context found");const n=await gy(t);try{if(!(n.account?.address&&n.transaction&&n.scope&&n.method))return void e.info("Context is missing required fields");if(!n.preferences?.simulateOnChainActions)return void e.info("Transaction simulation is disabled in preferences");const r={...n,scanFetchStatus:"fetching"};await dy(t,Qy(ow,{context:r}),r);const[o,i]=await Promise.all([ZS.scanTransaction({method:n.method,accountAddress:n.account.address,transaction:n.transaction,scope:n.scope,origin:n.origin,account:n.account}),gy(t)]),a={...i,scanFetchStatus:"fetched",scan:o};e.info("New scan fetched"),await dy(t,Qy(ow,{context:a}),a),e.info("Background event suceeded"),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT20S",request:{method:"refreshConfirmationEstimation"}}})}catch(n){const r={...await gy(t),scanFetchStatus:"fetched"};await dy(t,Qy(ow,{context:r}),r),e.warn({error:n},"Could not update the interface. But rolled back status to fetched.")}},[jy.CloseWebSocketConnections]:async()=>{Gl.info("Closing all WebSocket connections via background event"),await RS.closeAllConnections()}},$E={...FE};var qE={};const WE=ee({chainId:gd,domain:te(re()),address:te(re())}),VE="Solana Name Service",KE={[by.GetFeeForTransaction]:async({request:e})=>{M(e.params,md);const{transaction:t,scope:n}=e.params;try{const e=await BS.getFeeFromBase64StringInLamports(t,n);if(null===e)throw new Error("Failed to get fee for transaction");const r={value:e.toString()};return M(r,yd),r}catch(e){throw Gl.error(e),new Vr(e)}},[by.StartSendTransactionFlow]:async({request:e})=>{const{params:t}=e;M(t,UE);const{scope:n,account:r}=t,o=t.assetId??id[n].nativeToken.caip19Id,i={...LE,scope:n,fromAccountId:r,tokenCaipId:o,loading:!0},[a,s,c,u]=await Promise.all([qS.getAll(),VS.getAll(),kS.getKey("tokenPrices"),py().catch((()=>LE.preferences))]);i.balances=function(e,t){return t.filter((t=>{const n=t.assetType===id[e].nativeToken.caip19Id,r=t.assetType.startsWith(e),o="0"!==t.rawAmount;return n||r&&o})).reduce(((e,t)=>(e[t.keyringAccountId]={...e[t.keyringAccountId],[t.assetType]:{unit:t.symbol,amount:t.uiAmount}},e)),{})}(n,a),i.assets=a.map((e=>e.assetType)),i.accounts=s,i.preferences=u,i.tokenPrices=c??{};const l=await ly(Qy(PE,{context:i}),i),d=hy(l),f=qS.getAssetsMetadata([i.tokenCaipId]).then((e=>{const t=e[i.tokenCaipId];t?.symbol&&t?.name&&(i.selectedTokenMetadata={symbol:t.symbol,name:t.name,asset:i.tokenCaipId,imageSvg:null})})).catch((()=>null));let h;i.preferences.useExternalPricingData?h=zS.getMultipleSpotPrices(i.assets,i.preferences.currency).then((e=>{i.tokenPrices={...i.tokenPrices,...e},i.tokenPricesFetchStatus="fetched"})).catch((()=>{i.tokenPricesFetchStatus="error"})):i.tokenPricesFetchStatus="fetched";const p=xS.getRpc(n).getMinimumBalanceForRentExemption(BigInt(0)).send().then((e=>{i.minimumBalanceForRentExemptionSol=Fd(e).toString()})).catch((()=>{}));return i.loading=!0,await dy(l,Qy(PE,{context:i}),i),i.loading=!1,await Promise.all([h,f,p]),await dy(l,Qy(PE,{context:i}),i),await kS.setKey(`mapInterfaceNameToId.${cy}`,l),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT30S",request:{method:"refreshSend"}}}),d},[Sy.ListWebSockets]:async()=>(await ES.emitSync("onListWebSockets"),null),[Sy.ListSubscriptions]:async()=>(await ES.emitSync("onListSubscriptions"),null),[Sy.TestOnStart]:async()=>(await ES.emitSync("onStart"),null),[Sy.TestOnInstall]:async()=>(await ES.emitSync("onInstall"),null),[Sy.TestOnUpdate]:async()=>(await ES.emitSync("onUpdate"),null),[Sy.SynchronizeAccounts]:async()=>(await HS.synchronize(),null)};const GE=async e=>{try{return await e()}catch(e){const t=function(e){return[$r,Jr,ao,Yr,Jr,Qr,Xr,eo,to,no,ro,oo,io,Vr,Kr,Gr,Hr,Zr].some((t=>e instanceof t))}(e)?e:new $r(e);throw Gl.error({error:t},`[SnapError] ${JSON.stringify(t.toJSON(),null,2)}`),t}};var HE=n(4255),ZE=n.n(HE),JE=n(3804),YE=n.n(JE);class QE extends Error{constructor(e="Operation cancelled"){super(e),this.name="CancellationError"}}const XE=async e=>{const{fromAccountId:t,tokenCaipId:n,scope:r,toAddress:o}=e,i=AE(e),a=await eE.getAccountOrThrow(t);if(!o||!i)throw new Error("Invalid transaction parameters");const s=n===id[r].nativeToken.caip19Id,c=s?OS:MS,u=new zb(c),l={from:a,to:Hs(o),amount:i,network:r,...s?{}:{mint:Hs(Fo(n).assetReference)}},d=await c.buildTransactionMessage(l),f=await(async e=>nu(e,Ou,Tu().encode,zs().decode))(d);return{feeInLamports:u.getFee(),base64EncodedTransactionMessage:f}},ek=YE()((async(e,t)=>{try{if(!OE(t))return;const n={buildingTransaction:!0,transactionMessage:null,feeEstimatedInSol:null};await dy(e,Qy(PE,{context:{...t,...n}}),{...t,...n});const{feeInLamports:r,base64EncodedTransactionMessage:o}=await XE(t),i={transactionMessage:o,feeEstimatedInSol:r?Fd(r).toString():null,buildingTransaction:!1},a=await gy(e);await dy(e,Qy(PE,{context:{...a,...i}}),{...a,...i})}catch(t){Gl.error("Could not build the send transaction",t);const n={error:{title:"send.simulationTitleError",message:"send.simulationMessageError"},transactionMessage:null,feeEstimatedInSol:null,buildingTransaction:!1},r=await gy(e);await dy(e,Qy(PE,{context:{...r,...n}}),{...r,...n})}}),(function(e){const t=(e=>(...t)=>{const n=new AbortController,r=[...t];r.some((e=>e instanceof AbortSignal))||r.push(n.signal);const o=Promise.race([e(...r),new Promise(((e,t)=>{n.signal.addEventListener("abort",(()=>{t(new QE)}))}))]);return o.cancel=()=>n.abort(),o})(e);let n=null;return async(...e)=>{if(n&&"function"==typeof n.cancel){const e="Cancelling previous task";Gl.warn(e),n.cancel()}const r=t(...e);n=r;try{return await r}finally{n===r&&(n=null)}}}),ZE()(500));const tk={[gE.BackButton]:async function({id:e}){await fy(e,!1),await kS.deleteKey(`mapInterfaceNameToId.${cy}`)},[gE.SourceAccountSelector]:async function({id:e,event:t,context:n}){const r=t.value;n.fromAccountId=r.accountId,n.error=null,n.validation[gE.SourceAccountSelector]=BE(gE.SourceAccountSelector,n.fromAccountId,DE(n)),n.amount&&(n.validation[gE.AmountInput]=BE(gE.AmountInput,n.amount,DE(n))),await dy(e,Qy(PE,{context:n}),n),await ek(e,n)},[gE.AmountInput]:async function({id:e,event:t,context:n}){const r={...n};r.amount=t.value,r.error=null;const o=BE(gE.AmountInput,r.amount,DE(r));if(o&&r.validation[gE.AmountInput]?.message!==o?.message)return r.validation[gE.AmountInput]=o,void await dy(e,Qy(PE,{context:r}),r);null===o&&(r.validation[gE.AmountInput]=null,await dy(e,Qy(PE,{context:r}),r),await ek(e,r))},[gE.AssetSelector]:async function({id:e,event:t,context:n}){if("object"!=typeof t.value||!("asset"in t.value))return;const r=t.value.asset;if(n.tokenCaipId===r)return;const o=r===id[n.scope].nativeToken.caip19Id?OS:MS,i=new zb(o).getFee(),a={tokenCaipId:r,feeEstimatedInSol:Fd(i).toString(),selectedTokenMetadata:{symbol:t.value.symbol,name:t.value.name,asset:t.value.asset,imageSvg:null},amount:"",error:null},s=(0,_d.merge)(n,a);await dy(e,Qy(PE,{context:s,inputAmount:""}),s),await ek(e,n)},[gE.SwapCurrencyButton]:async function({id:e,context:t}){if(t.error=null,t.currencyType=t.currencyType===mE.TOKEN?mE.FIAT:mE.TOKEN,!t.amount)return void await dy(e,Qy(PE,{context:t}),t);const n=_o(t.amount??"0"),{price:r}=t.tokenPrices[t.tokenCaipId]??{price:0};t.currencyType===mE.TOKEN&&(t.amount=n.dividedBy(r).toString()),t.currencyType===mE.FIAT&&(t.amount=n.multipliedBy(r).toString()),await dy(e,Qy(PE,{context:t,inputAmount:t.amount}),t)},[gE.MaxAmountButton]:async function({id:e,context:t}){const{currencyType:n,minimumBalanceForRentExemptionSol:r,tokenCaipId:o,tokenPrices:i}=t,a={...t},s=EE(t);if(kE(t)){const e=$d(s),t=new zb(OS).getFee().toString(),n=$d(r),o=e.minus(t).minus(n).minus(1),i=_o.maximum(o,o.isNegative()?e:_o(0)),c=Fd(i);a.amount=c.toString()}else a.amount=s;if(n===mE.FIAT){const{price:e}=i[o]??{price:0};a.amount=nw(a.amount,e)}a.error=null,a.validation[gE.AmountInput]=BE(gE.AmountInput,a.amount,DE(a)),await dy(e,Qy(PE,{context:a,inputAmount:a.amount}),a),await ek(e,a)},[gE.DestinationAccountInput]:async function({id:e,event:t,context:n}){const r={...n};r.destinationAddressOrDomain=t.value,r.domainResolutionStatus=null,r.error=null;const o=BE(gE.DestinationAccountInput,r.destinationAddressOrDomain,DE(r));r.validation[gE.DestinationAccountInput]=o,NE(r?.destinationAddressOrDomain)?(r.domainResolutionStatus="fetching",await dy(e,Qy(PE,{context:r}),r),r.toAddress=await FS.resolveDomain(r.scope,r.destinationAddressOrDomain).catch((()=>{const e=bv(r.preferences.locale);return r.validation[gE.DestinationAccountInput]={message:e("send.toInvalidErrorDomain"),value:r.destinationAddressOrDomain??""},null})),r.domainResolutionStatus=r.toAddress?"fetched":"error"):r.toAddress=r.destinationAddressOrDomain,await dy(e,Qy(PE,{context:r}),r),null===o&&await ek(e,r)},[gE.ClearButton]:async function({id:e,context:t}){t.destinationAddressOrDomain="",t.toAddress="",t.domainResolutionStatus=null,t.error=null,t.validation[gE.DestinationAccountInput]=null,await dy(e,Qy(PE,{context:t,inputToAddress:t.toAddress}),t)},[gE.CancelButton]:async function({id:e}){await fy(e,!1),await kS.deleteKey(`mapInterfaceNameToId.${cy}`)},[gE.SendButton]:async function({id:e,context:t}){if(!OE(t))return;const n={...t};n.stage="transaction-confirmation",n.loading=!0,await dy(e,Qy(PE,{context:n}),n);const r=t.accounts.find((e=>e.id===t.fromAccountId))?.address,[o,i,a,s]=await Promise.all([r?FS.resolveAddress(t.scope,r):null,t.toAddress?FS.resolveAddress(t.scope,t.toAddress):null,zS.getMultipleSpotPrices(t.assets,t.preferences.currency).then((e=>e)).catch((()=>null)),t.selectedTokenMetadata?DS.generateImageComponent(Td({baseUrl:SS.get().staticApi.baseUrl,path:"/api/v2/tokenIcons/assets/{assetId}.png",pathParams:{assetId:t.selectedTokenMetadata?.asset.replace(/:/gu,"/")},encodePathParams:!1})):null]);n.fromDomain=o,n.toDomain=i,a&&(n.tokenPrices=a),s&&t.selectedTokenMetadata&&(n.selectedTokenMetadata={...t.selectedTokenMetadata,imageSvg:s}),n.loading=!1,await dy(e,Qy(PE,{context:n}),n),await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:jy.OnTransactionAdded,params:{accountId:t.fromAccountId,metadata:{scope:t.scope,origin:Ql}}}}})}};const nk={[CE.BackButton]:async function({id:e,context:t}){const n={...t,stage:"send-form"};await dy(e,Qy(PE,{context:n,inputAmount:t.amount??"",inputToAddress:t.destinationAddressOrDomain??""}),n)},[CE.CancelButton]:async function({id:e,context:t}){const{fromAccountId:n,transactionMessage:r,scope:o}=t;await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:jy.OnTransactionRejected,params:{accountId:n,metadata:{scope:o,origin:Ql}}}}}),await fy(e,!1),await kS.deleteKey(`mapInterfaceNameToId.${cy}`)},[CE.ConfirmButton]:async function({id:e,context:t}){const{scope:n,fromAccountId:r,feeEstimatedInSol:o,transactionMessage:i}=t;if(t.error=null,!i)return t.stage="send-form",void await dy(e,Qy(PE,{context:t}),t);await snap.request({method:"snap_scheduleBackgroundEvent",params:{duration:"PT1S",request:{method:jy.OnTransactionApproved,params:{accountId:t.fromAccountId,metadata:{scope:t.scope,origin:Ql}}}}});const a={...t,stage:"send-pending"};await dy(e,Qy(PE,{context:a}),a);let s=null;try{const e=await eE.getAccountOrThrow(r);s=(await XS.signAndSendTransaction(e,i,n,Ql)).signature}catch(e){Gl.error({error:e},"Error submitting request")}const c={...t,stage:s?"transaction-success":"transaction-failure",feePaidInSol:o,transaction:{result:s?"success":"failure",signature:s}};await dy(e,Qy(PE,{context:c}),c),await kS.deleteKey(`mapInterfaceNameToId.${cy}`)}};const rk=2n**255n-19n,ok=2n**252n+27742317777372353535851937790883648493n,ik=0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,ak=0x6666666666666666666666666666666666666666666666666666666666666658n,sk={a:-1n,d:37095705934669439343138083508754565189542113879843219016388785533085940283555n,p:rk,n:ok,h:8,Gx:ik,Gy:ak},ck=(e="")=>{throw new Error(e)},uk=e=>"string"==typeof e,lk=(e,t)=>!(e=>e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name)(e)||"number"==typeof t&&t>0&&e.length!==t?ck("Uint8Array of valid length expected"):e,dk=e=>new Uint8Array(e),fk=(e,t)=>lk(uk(e)?Ak(e):dk(lk(e)),t),hk=(e,t=rk)=>{let n=e%t;return n>=0n?n:t+n},pk=e=>e instanceof gk?e:ck("Point expected");class gk{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r}static fromAffine(e){return new gk(e.x,e.y,1n,hk(e.x*e.y))}static fromHex(e,t=!1){const{d:n}=sk,r=(e=fk(e,32)).slice(),o=e[31];r[31]=-129&o;const i=Sk(r);!t||0n<=i&&i<2n**256n||ck("bad y coord 1"),t||0n<=i&&i<rk||ck("bad y coord 2");const a=hk(i*i),s=hk(a-1n),c=hk(n*a+1n);let{isValid:u,value:l}=_k(s,c);u||ck("bad y coordinate 3");const d=1n===(1n&l),f=0!=(128&o);return!t&&0n===l&&f&&ck("bad y coord 3"),f!==d&&(l=hk(-l)),new gk(l,i,1n,hk(l*i))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}equals(e){const{ex:t,ey:n,ez:r}=this,{ex:o,ey:i,ez:a}=pk(e),s=hk(t*a),c=hk(o*r),u=hk(n*a),l=hk(i*r);return s===c&&u===l}is0(){return this.equals(yk)}negate(){return new gk(hk(-this.ex),this.ey,this.ez,hk(-this.et))}double(){const{ex:e,ey:t,ez:n}=this,{a:r}=sk,o=hk(e*e),i=hk(t*t),a=hk(2n*hk(n*n)),s=hk(r*o),c=e+t,u=hk(hk(c*c)-o-i),l=s+i,d=l-a,f=s-i,h=hk(u*d),p=hk(l*f),g=hk(u*f),m=hk(d*l);return new gk(h,p,m,g)}add(e){const{ex:t,ey:n,ez:r,et:o}=this,{ex:i,ey:a,ez:s,et:c}=pk(e),{a:u,d:l}=sk,d=hk(t*i),f=hk(n*a),h=hk(o*l*c),p=hk(r*s),g=hk((t+n)*(i+a)-d-f),m=hk(p-h),y=hk(p+h),v=hk(f-u*d),w=hk(g*m),A=hk(y*v),b=hk(g*v),S=hk(m*y);return new gk(w,A,S,b)}mul(e,t=!0){if(0n===e)return!0===t?ck("cannot multiply by 0"):yk;if("bigint"==typeof e&&0n<e&&e<ok||ck("invalid scalar, must be < L"),!t&&this.is0()||1n===e)return this;if(this.equals(mk))return Kk(e).p;let n=yk,r=mk;for(let o=this;e>0n;o=o.double(),e>>=1n)1n&e?n=n.add(o):t&&(r=r.add(o));return n}multiply(e){return this.mul(e)}clearCofactor(){return this.mul(BigInt(sk.h),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let e=this.mul(ok/2n,!1).double();return ok%2n&&(e=e.add(this)),e.is0()}toAffine(){const{ex:e,ey:t,ez:n}=this;if(this.equals(yk))return{x:0n,y:1n};const r=kk(n);return 1n!==hk(n*r)&&ck("invalid inverse"),{x:hk(e*r),y:hk(t*r)}}toRawBytes(){const{x:e,y:t}=this.toAffine(),n=bk(t);return n[31]|=1n&e?128:0,n}toHex(){return wk(this.toRawBytes())}}gk.BASE=new gk(ik,ak,1n,hk(ik*ak)),gk.ZERO=new gk(0n,1n,1n,0n);const{BASE:mk,ZERO:yk}=gk,vk=(e,t)=>e.toString(16).padStart(t,"0"),wk=e=>Array.from(e).map((e=>vk(e,2))).join(""),Ak=e=>{const t=e.length;(!uk(e)||t%2)&&ck("hex invalid 1");const n=dk(t/2);for(let t=0;t<n.length;t++){const r=2*t,o=e.slice(r,r+2),i=Number.parseInt(o,16);(Number.isNaN(i)||i<0)&&ck("hex invalid 2"),n[t]=i}return n},bk=e=>Ak(vk(e,64)).reverse(),Sk=e=>BigInt("0x"+wk(dk(lk(e)).reverse())),Ek=(...e)=>{const t=dk(e.reduce(((e,t)=>e+lk(t).length),0));let n=0;return e.forEach((e=>{t.set(e,n),n+=e.length})),t},kk=(e,t=rk)=>{(0n===e||t<=0n)&&ck("no inverse n="+e+" mod="+t);let n=hk(e,t),r=t,o=0n,i=1n,a=1n,s=0n;for(;0n!==n;){const e=r/n,t=r%n,c=o-a*e,u=i-s*e;r=n,n=t,o=a,i=s,a=c,s=u}return 1n===r?hk(o,t):ck("no inverse")},Ik=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=rk;return n},Tk=19681161376707505956807079304988542015446066515923890162744021073123829784752n,_k=(e,t)=>{const n=hk(t*t*t),r=(e=>{const t=e*e%rk*e%rk,n=Ik(t,2n)*t%rk,r=Ik(n,1n)*e%rk,o=Ik(r,5n)*r%rk,i=Ik(o,10n)*o%rk,a=Ik(i,20n)*i%rk,s=Ik(a,40n)*a%rk,c=Ik(s,80n)*s%rk,u=Ik(c,80n)*s%rk,l=Ik(u,10n)*o%rk;return{pow_p_5_8:Ik(l,2n)*e%rk,b2:t}})(e*hk(n*n*t)).pow_p_5_8;let o=hk(e*n*r);const i=hk(t*o*o),a=o,s=hk(o*Tk),c=i===e,u=i===hk(-e),l=i===hk(-e*Tk);return c&&(o=a),(u||l)&&(o=s),1n===(1n&hk(o))&&(o=hk(-o)),{isValid:c||u,value:o}},xk=e=>hk(Sk(e),ok);let Ck;const Rk=(...e)=>qk.sha512Async(...e),Pk=(...e)=>"function"==typeof Ck?Ck(...e):ck("etc.sha512Sync not set"),Nk=e=>{const t=e.slice(0,32);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(32,64),r=xk(t),o=mk.mul(r),i=o.toRawBytes();return{head:t,prefix:n,scalar:r,point:o,pointBytes:i}},Bk=e=>Rk(fk(e,32)).then(Nk),Ok=e=>Nk(Pk(fk(e,32))),Mk=e=>Bk(e).then((e=>e.pointBytes));function zk(e,t){return e?Rk(t.hashable).then(t.finish):t.finish(Pk(t.hashable))}const jk=(e,t,n)=>{const{pointBytes:r,scalar:o}=e,i=xk(t),a=mk.mul(i).toRawBytes();return{hashable:Ek(a,r,n),finish:e=>{const t=hk(i+xk(e)*o,ok);return lk(Ek(a,bk(t)),64)}}},Uk=async(e,t)=>{const n=fk(e),r=await Bk(t),o=await Rk(r.prefix,n);return zk(!0,jk(r,o,n))},Dk={zip215:!0},Lk=(e,t,n,r=Dk)=>{t=fk(t),e=fk(e,64);const{zip215:o}=r;let i,a,s,c,u=new Uint8Array;try{i=gk.fromHex(n,o),a=gk.fromHex(e.slice(0,32),o),s=Sk(e.slice(32,64)),c=mk.mul(s,!1),u=Ek(a.toRawBytes(),i.toRawBytes(),t)}catch(e){}return{hashable:u,finish:e=>{if(null==c)return!1;if(!o&&i.isSmallOrder())return!1;const t=xk(e);return a.add(i.mul(t,!1)).add(c.negate()).clearCofactor().is0()}}},Fk=async(e,t,n,r=Dk)=>zk(!0,Lk(e,t,n,r)),$k=()=>"object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,qk={bytesToHex:wk,hexToBytes:Ak,concatBytes:Ek,mod:hk,invert:kk,randomBytes:(e=32)=>{const t=$k();return t&&t.getRandomValues||ck("crypto.getRandomValues must be defined"),t.getRandomValues(dk(e))},sha512Async:async(...e)=>{const t=$k();t&&t.subtle||ck("crypto.subtle or etc.sha512Async must be defined");const n=Ek(...e);return dk(await t.subtle.digest("SHA-512",n.buffer))},sha512Sync:void 0};Object.defineProperties(qk,{sha512Sync:{configurable:!1,get:()=>Ck,set(e){Ck||(Ck=e)}}});const Wk={getExtendedPublicKeyAsync:Bk,getExtendedPublicKey:Ok,randomPrivateKey:()=>qk.randomBytes(32),precompute:(e=8,t=mk)=>(t.multiply(3n),t)};let Vk;const Kk=e=>{const t=Vk||(Vk=(()=>{const e=[];let t=mk,n=t;for(let r=0;r<33;r++){n=t,e.push(n);for(let r=1;r<128;r++)n=n.add(t),e.push(n);t=n.double()}return e})()),n=(e,t)=>{let n=t.negate();return e?n:t};let r=yk,o=mk;const i=BigInt(255),a=BigInt(8);for(let s=0;s<33;s++){const c=128*s;let u=Number(e&i);e>>=a,u>128&&(u-=256,e+=1n);const l=c,d=c+Math.abs(u)-1,f=s%2!=0,h=u<0;0===u?o=o.add(n(f,t[l])):r=r.add(n(h,t[d]))}return{p:r,f:o}};function Gk(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var Hk=n(1048).hp;const Zk="8d9df0f7-1363-4d2c-8152-ce4ed78f27d8",Jk=[48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32];function Yk(e){return Hk.from(e).toString("base64").replace(/\+/gu,"-").replace(/\//gu,"_").replace(/[=]/gu,"")}function Qk(e){const t=e.replace(/-/gu,"+").replace(/_/gu,"/");return new Uint8Array(Hk.from(t,"base64"))}function Xk(e){return"Ed25519"===e||"object"==typeof e&&"Ed25519"===e.name}function eI(){const{subtle:e}=globalThis.crypto;Object.defineProperty(globalThis,"isSecureContext",{value:!0,writable:!0,configurable:!0}),Object.defineProperty(e,"generateKey",{value:async(...e)=>Xk(e[0])?await async function(e,t,n){const r=Wk.randomPrivateKey(),o=await Mk(r),i=Array.from(n);return{privateKey:{algorithm:{name:"Ed25519"},extractable:t,type:"private",usages:i,[Zk]:r},publicKey:{algorithm:{name:"Ed25519"},extractable:!0,type:"public",usages:i,[Zk]:o}}}(...e):await globalThis.crypto.subtle.generateKey(...e),writable:!0,configurable:!0}),Object.defineProperty(e,"exportKey",{value:async(...e)=>Xk(e[1].algorithm)?await async function(e,t){if(!t.extractable)throw new DOMException("key is not extractable","InvalidAccessException");const n=t[Zk];switch(e){case"raw":if("public"!==t.type)throw new DOMException("Unable to export a raw Ed25519 private key","InvalidAccessError");return n.buffer;case"pkcs8":if("private"!==t.type)throw new DOMException("Unable to export a pkcs8 Ed25519 public key","InvalidAccessError");return new Uint8Array([...Jk,...n]).buffer;case"jwk":{const e={crv:"Ed25519",ext:t.extractable,key_ops:t.usages,kty:"OKP"};if("private"===t.type){const t=await Mk(n);return Object.freeze({...e,d:Yk(n),x:Yk(t)})}return Object.freeze({...e,x:Yk(n)})}case"spki":{if("public"!==t.type)throw new DOMException("Only public keys can be exported as SPKI","InvalidAccessError");const e=new Uint8Array([48,5,6,3,43,101,112]),r=new Uint8Array([3,n.length+1,0,...n]);return new Uint8Array([48,e.length+r.length,...e,...r]).buffer}default:throw new Error(`Unsupported export format: ${e}`)}}(...e):await globalThis.crypto.subtle.exportKey(...e),writable:!0,configurable:!0}),Object.defineProperty(e,"sign",{value:async(...e)=>{const[t,n]=e;return Xk(t)&&Xk(n.algorithm)?await async function(e,t,n){if("private"!==t.type)throw new DOMException("Key is not private","NotAllowedError");if(!t.usages.includes("sign"))throw new DOMException("Key usage not allowed","NotAllowedError");const r=Gk(n),o=t[Zk],i=function(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteLength)}(await Uk(r,o));return i}(...e):await globalThis.crypto.subtle.sign(...e)},writable:!0,configurable:!0}),Object.defineProperty(e,"verify",{value:async(...e)=>{const[t,n]=e;return Xk(t)&&Xk(n.algorithm)?await async function(e,t,n,r){if("public"!==t.type)throw new DOMException("Key is not public","NotAllowedError");if(!t.usages.includes("verify"))throw new DOMException("Key usage not allowed","NotAllowedError");const o=Gk(n),i=Gk(r),a=t[Zk];return await Fk(o,i,a)}(...e):await globalThis.crypto.subtle.verify(...e)},writable:!0,configurable:!0}),Object.defineProperty(e,"importKey",{value:async(...e)=>Xk(e[2])?await async function(e,t,n,r,o){const i=Array.from(o);switch(e){case"raw":{const e=Gk(t);if(32!==e.length)throw new DOMException("Ed25519 raw keys must be exactly 32-bytes","DataError");return{algorithm:{name:"Ed25519"},extractable:r,type:"public",usages:i.filter((e=>"verify"===e)),[Zk]:e}}case"pkcs8":{const e=Gk(t);if(48!==e.length)throw new DOMException("Invalid PKCS8 key data length","DataError");if(!e.slice(0,16).every(((e,t)=>e===Jk[t])))throw new DOMException("Invalid PKCS8 header","DataError");return{algorithm:{name:"Ed25519"},extractable:r,type:"private",usages:i.filter((e=>"sign"===e)),[Zk]:e.slice(16)}}case"jwk":{const e=t;if("OKP"!==e.kty||"Ed25519"!==e.crv)throw new DOMException("Invalid Ed25519 JWK","DataError");const n="d"in e?"private":"public";if("public"===n&&!e.x)throw new DOMException("Ed25519 JWK is missing public key","DataError");if(!("private"!==n||e.d&&e.x))throw new DOMException("Ed25519 JWK is missing key data","DataError");const o="private"===n?e.d:e.x;return{algorithm:{name:"Ed25519"},extractable:r,type:n,usages:i.filter((e=>"private"===n?"sign"===e:"verify"===e)),[Zk]:Qk(o)}}case"spki":{const e=Gk(t);if(48!==e[0])throw new DOMException("Invalid SPKI format","DataError");const n=2;if(48!==e[n]||6!==e[n+2]||3!==e[n+3]||43!==e[n+4]||101!==e[n+5]||112!==e[n+6])throw new DOMException("Not an Ed25519 key","DataError");const r=n+7+2;return{algorithm:{name:"Ed25519"},extractable:!0,type:"public",usages:i.filter((e=>"verify"===e)),[Zk]:e.slice(r)}}default:throw new Error(`Unsupported import format: ${e}`)}}(...e):await globalThis.crypto.subtle.importKey(...e),writable:!0,configurable:!0})}const tI=async e=>Promise.resolve().then(e);Object.defineProperty(globalThis,"DOMException",{value:Error,writable:!0,configurable:!0,enumerable:!0}),eI(),Object.defineProperty(globalThis,"queueMicrotask",{value:tI,writable:!0,configurable:!0,enumerable:!0}),_o.config({EXPONENTIAL_AT:16});const nI=async({origin:e,request:t})=>{Gl.log("[🔄 onRpcRequest]",t.method,t);const{method:n}=t;Oy(e,n);const r=KE[n];if(!r)throw new Jr(`RpcRequest method ${n} not found. Available methods: ${Object.values(by).toString()}`);return await GE((async()=>r({origin:e,request:t})))??null},rI=async({origin:e,request:t})=>{Gl.log("[🔑 onKeyringRequest]",t.method,t),Oy(e,t.method),t.method===Ht.SubmitRequest&&t.params&&!("origin"in t.params)&&(t.params.origin="https://metamask.io");return await GE((async()=>yn(eE,t)))??null},oI=async({id:e,event:t,context:n})=>{if(Gl.log("[👇 onUserInput]",e,t),!t.name)return;const r={...tk,...nk,...Vv,...$v,...Dv}[t.name];r&&await GE((async()=>r({id:e,event:t,context:n,snapContext:oE})))},iI=async({request:e})=>{const t=Kl(Gl,"[⏱️ onCronjob]");t.log(e.method,e);const{method:n}=e;M(n,H([...Object.values(qE),...Object.values(jy)]));return await GE((async()=>{t.log("Running cronjob",{method:n});const r=$E[n];if(!r)throw new Jr(`Cronjob / ScheduleBackgroundEvent method ${n} not found. Available methods: ${Object.values([...Object.values(qE),...Object.values(jy)]).toString()}`);return r({request:e})}))??null},aI=async e=>{const t=await GE((async()=>(async e=>{Gl.log("[🔍 onAssetsLookup]",e);const{assets:t}=e,n=t.filter((e=>{const{assetNamespace:t}=Fo(e);return"token"===t||"slip44"===t}));return{assets:await qS.getAssetsMetadata(n)}})(e)));return t??null},sI=async e=>{const t=await GE((async()=>(async e=>{Gl.log("[💱 onAssetsConversion]",e);const{conversions:t}=e;return{conversionRates:await LS.getMultipleTokenConversions(t)}})(e)));return t??null},cI=async e=>{const{origin:t,request:n}=e;Oy(t,n.method);const r=await GE((async()=>(async({scope:e,request:t})=>{switch(M(e,gd),t.method){case my.GetGenesisHash:return M(t,yy),xS.getRpc(e).getGenesisHash().send();case my.GetLatestBlockhash:return M(t,vy),(await xS.getRpc(e).getLatestBlockhash().send()).value.blockhash;case my.GetMinimumBalanceForRentExemption:return M(t,wy),(await xS.getRpc(e).getMinimumBalanceForRentExemption(BigInt(t.params[0]),t.params[1]).send()).toString();default:throw new Error(`Unsupported method: ${t.method}`)}})(e)));return r??null},uI=async e=>{const t=await GE((async()=>(async e=>{Gl.log("[📈 onAssetHistoricalPrice]",e);const{from:t,to:n}=e;return M(t,Do),M(n,Do),{historicalPrice:await LS.getHistoricalPrice(t,n)}})(e)));return t??null},lI=async({request:e})=>await GE((async()=>rE.handle(e)))??null,dI=async({event:e})=>GE((async()=>{await ES.emitSync("onWebSocketEvent",e)})),fI=async()=>GE((async()=>{await ES.emitSync("onStart")})),hI=async()=>GE((async()=>{await ES.emitSync("onUpdate")})),pI=async()=>GE((async()=>{await ES.emitSync("onInstall")})),gI=async()=>GE((async()=>{await ES.emitSync("onActive")})),mI=async()=>GE((async()=>{await ES.emitSync("onInactive")})),yI=async e=>{const t=await GE((async()=>(async e=>{M(e,WE);const{chainId:t,domain:n,address:r}=e;if(n){const e=await FS.resolveDomain(t,n);if(e)return{resolvedAddresses:[{resolvedAddress:e,protocol:VE,domainName:n}]}}if(r){const e=await FS.resolveAddress(t,r);if(e)return{resolvedDomains:[{resolvedDomain:e,protocol:VE}]}}return null})(e)));return t??null},vI=async e=>{const t=await GE((async()=>(async e=>{Gl.log("[💰 onAssetsMarketData]",e);const{assets:t}=e;return{marketData:await qS.fetchAssetsMarketData(t)}})(e)));return t??null}})(),module.exports=r})();
|