@dodoex/wallet-web3 0.0.3-3 → 0.0.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.
Files changed (45) hide show
  1. package/dist/cjs/controllers/ConnectController.d.ts +6 -5
  2. package/dist/cjs/core/index.d.ts +0 -1
  3. package/dist/cjs/{index-1613ac94.cjs → index-0eeb697b.cjs} +2 -2
  4. package/dist/cjs/{index-613571b4.cjs → index-3a14a931.cjs} +1 -1
  5. package/dist/cjs/index-a26b6945.cjs +1 -0
  6. package/dist/cjs/index-a9081fe4.cjs +1 -0
  7. package/dist/cjs/index.cjs +1 -1
  8. package/dist/cjs/index.d.ts +1 -1
  9. package/dist/cjs/portis-8c790653.cjs +1 -0
  10. package/dist/cjs/provider-95f3425c.cjs +1 -0
  11. package/dist/cjs/state.d.ts +12 -3
  12. package/dist/cjs/uAuth-692ecdf6.cjs +1 -0
  13. package/dist/cjs/walletConnect-14d9d490.cjs +1 -0
  14. package/dist/cjs/walletLink-b99948b8.cjs +1 -0
  15. package/dist/controllers/ConnectController.d.ts +6 -5
  16. package/dist/core/index.d.ts +0 -1
  17. package/dist/{index-201c01d8.js → index-3a9d1d45.js} +2 -2
  18. package/dist/{index-cecc22f4.js → index-9af08480.js} +1 -1
  19. package/dist/index-a2c8f38f.js +1 -0
  20. package/dist/index-afc4ce88.js +1 -0
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/portis-f89a1cba.js +1 -0
  24. package/dist/provider-1ecbc0fa.js +1 -0
  25. package/dist/state.d.ts +12 -3
  26. package/dist/uAuth-1f7b3a0a.js +1 -0
  27. package/dist/walletConnect-ac756ff6.js +1 -0
  28. package/dist/walletLink-c286f908.js +1 -0
  29. package/package.json +2 -2
  30. package/dist/cjs/controllers/StateController.d.ts +0 -27
  31. package/dist/cjs/index-0494ffbc.cjs +0 -1
  32. package/dist/cjs/index-b63f2913.cjs +0 -19
  33. package/dist/cjs/portis-09fea9b2.cjs +0 -1
  34. package/dist/cjs/provider-653a6c4b.cjs +0 -1
  35. package/dist/cjs/uAuth-e46c0332.cjs +0 -1
  36. package/dist/cjs/walletConnect-a74c7523.cjs +0 -1
  37. package/dist/cjs/walletLink-5a993e87.cjs +0 -1
  38. package/dist/controllers/StateController.d.ts +0 -27
  39. package/dist/index-b6a46a6d.js +0 -1
  40. package/dist/index-b869aac9.js +0 -19
  41. package/dist/portis-3b5726bc.js +0 -1
  42. package/dist/provider-847fb9d1.js +0 -1
  43. package/dist/uAuth-458fbce7.js +0 -1
  44. package/dist/walletConnect-643e147f.js +0 -1
  45. package/dist/walletLink-fd84e70b.js +0 -1
@@ -1 +0,0 @@
1
- import{_ as e,a as t,d as r,c as n,w as i}from"./index-b869aac9.js";import{c as s,g as o,a}from"./_commonjsHelpers-70de2c37.js";import{n as u}from"./node-ponyfill-bda9b4f4.js";import{BaseContract as h,Contract as f,ContractFactory as l}from"@ethersproject/contracts";import{defineReadOnly as c,deepCopy as d,shallowCopy as p,resolveProperties as m,Description as g,checkProperties as y,getStatic as v}from"@ethersproject/properties";import{L as A,v as w,B as b,i as M,t as E,a as S,b as C,U as I,_ as T,k as P,c as _,A as B,d as x,F as R,C as k,E as D,e as O,f as N,P as F,g as L,h as U,I as H,j as q,T as G,l as K,m as j,n as z,o as Q,q as W}from"./interface-36a3c8cf.js";import{getAddress as J,getIcapAddress as V,getContractAddress as Y,getCreate2Address as X,isAddress as Z}from"@ethersproject/address";import{hexZeroPad as $,arrayify as ee,isBytes as te,hexlify as re,concat as ne,hexConcat as ie,isHexString as se,hexDataLength as oe,splitSignature as ae,hexDataSlice as ue,joinSignature as he,zeroPad as fe,isBytesLike as le,stripZeros as ce,hexStripZeros as de,hexValue as pe}from"@ethersproject/bytes";import{h as me}from"./hash-4b8ad136.js";import{computeAddress as ge,serialize as ye,recoverAddress as ve,accessListify as Ae,parse as we,TransactionTypes as be}from"@ethersproject/transactions";import*as Me from"@ethersproject/constants";import{HashZero as Ee}from"@ethersproject/constants";import*as Se from"@ethersproject/providers";import{getDefaultProvider as Ce}from"@ethersproject/providers";import{i as Ie,r as Te}from"./index-9547c0cf.js";import Pe from"events";import"valtio";import"stream";import"http";import"url";import"https";import"zlib";import"punycode";import"./sha3-a5661517.js";import"./inherits-e2363129.js";const _e=new A(w),Be={},xe=b.from(0),Re=b.from(-1);function ke(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),_e.throwError(e,A.errors.NUMERIC_FAULT,i)}let De="0";for(;De.length<256;)De+=De;function Oe(e){if("number"!=typeof e)try{e=b.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+De.substring(0,e):_e.throwArgumentError("invalid decimal size","decimals",e)}function Ne(e,t){null==t&&(t=0);const r=Oe(t),n=(e=b.from(e)).lt(xe);n&&(e=e.mul(Re));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=e.div(r).toString();return e=1===r.length?s:s+"."+i,n&&(e="-"+e),e}function Fe(e,t){null==t&&(t=0);const r=Oe(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||_e.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&_e.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&_e.throwArgumentError("too many decimal points","value",e);let s=i[0],o=i[1];for(s||(s="0"),o||(o="0");"0"===o[o.length-1];)o=o.substring(0,o.length-1);for(o.length>r.length-1&&ke("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const a=b.from(s),u=b.from(o);let h=a.mul(r).add(u);return n&&(h=h.mul(Re)),h}class Le{constructor(e,t,r,n){e!==Be&&_e.throwError("cannot use FixedFormat constructor; use FixedFormat.from",A.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=r,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=Oe(n),Object.freeze(this)}static from(e){if(e instanceof Le)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,r=128,n=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||_e.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],r=parseInt(i[2]),n=parseInt(i[3])}else if(e){const i=(t,r,n)=>null==e[t]?n:(typeof e[t]!==r&&_e.throwArgumentError("invalid fixed format ("+t+" not "+r+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&_e.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&_e.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new Le(Be,t,r,n)}}class Ue{constructor(e,t,r,n){e!==Be&&_e.throwError("cannot use FixedNumber constructor; use FixedNumber.from",A.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&_e.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=Fe(this._value,this.format.decimals),r=Fe(e._value,e.format.decimals);return Ue.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=Fe(this._value,this.format.decimals),r=Fe(e._value,e.format.decimals);return Ue.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=Fe(this._value,this.format.decimals),r=Fe(e._value,e.format.decimals);return Ue.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=Fe(this._value,this.format.decimals),r=Fe(e._value,e.format.decimals);return Ue.fromValue(t.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=Ue.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(He.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=Ue.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(He.toFormat(t.format))),t}round(e){null==e&&(e=0);const t=this.toString().split(".");if(1===t.length&&t.push("0"),(e<0||e>80||e%1)&&_e.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=Ue.from("1"+De.substring(0,e),this.format),n=qe.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&_e.throwArgumentError("invalid byte width","width",e);const t=b.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return $(t,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Ue.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||M(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),Ue.fromString(Ne(e,t),Le.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=Le.from(t),n=Fe(e,r.decimals);!r.signed&&n.lt(xe)&&ke("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=$(i,r.width/8));const s=Ne(n,r.decimals);return new Ue(Be,i,s,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=Le.from(t);if(ee(e).length>r.width/8)throw new Error("overflow");let n=b.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),s=Ne(n,r.decimals);return new Ue(Be,i,s,r)}static from(e,t){if("string"==typeof e)return Ue.fromString(e,t);if(te(e))return Ue.fromBytes(e,t);try{return Ue.fromValue(e,0,t)}catch(e){if(e.code!==A.errors.INVALID_ARGUMENT)throw e}return _e.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const He=Ue.from(1),qe=Ue.from("0.5");function Ge(e,t){t||(t=function(e){return[parseInt(e,16)]});let r=0,n={};return e.split(",").forEach((e=>{let i=e.split(":");r+=parseInt(i[0],16),n[r]=t(i[1])})),n}function Ke(e){let t=0;return e.split(",").map((e=>{let r=e.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=t+parseInt(r[0],16);return t=parseInt(r[1],16),{l:n,h:t}}))}function je(e,t){let r=0;for(let n=0;n<t.length;n++){let i=t[n];if(r+=i.l,e>=r&&e<=r+i.h&&(e-r)%(i.d||1)==0){if(i.e&&-1!==i.e.indexOf(e-r))continue;return i}}return null}const ze=Ke("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),Qe="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((e=>parseInt(e,16))),We=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],Je=Ge("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),Ve=Ge("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),Ye=Ge("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(e){if(e.length%4!=0)throw new Error("bad data");let t=[];for(let r=0;r<e.length;r+=4)t.push(parseInt(e.substring(r,r+4),16));return t})),Xe=Ke("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");const Ze="hash/5.7.0";function $e(e){e=atob(e);const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return ee(t)}function et(e){e=ee(e);let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}var tt=Object.freeze({__proto__:null,decode:$e,encode:et});function rt(e,t){null==t&&(t=1);const r=[],n=r.forEach,i=function(e,t){n.call(e,(function(e){t>0&&Array.isArray(e)?i(e,t-1):r.push(e)}))};return i(e,t),r}function nt(e){return function(e){let t=0;return()=>e[t++]}(function(e){let t=0;function r(){return e[t++]<<8|e[t++]}let n=r(),i=1,s=[0,1];for(let e=1;e<n;e++)s.push(i+=r());let o=r(),a=t;t+=o;let u=0,h=0;function f(){return 0==u&&(h=h<<8|e[t++],u=8),h>>--u&1}const l=Math.pow(2,31),c=l>>>1,d=c>>1,p=l-1;let m=0;for(let e=0;e<31;e++)m=m<<1|f();let g=[],y=0,v=l;for(;;){let e=Math.floor(((m-y+1)*i-1)/v),t=0,r=n;for(;r-t>1;){let n=t+r>>>1;e<s[n]?r=n:t=n}if(0==t)break;g.push(t);let o=y+Math.floor(v*s[t]/i),a=y+Math.floor(v*s[t+1]/i)-1;for(;0==((o^a)&c);)m=m<<1&p|f(),o=o<<1&p,a=a<<1&p|1;for(;o&~a&d;)m=m&c|m<<1&p>>>1|f(),o=o<<1^c,a=(a^c)<<1|c|1;y=o,v=1+a-o}let A=n-4;return g.map((t=>{switch(t-A){case 3:return A+65792+(e[a++]<<16|e[a++]<<8|e[a++]);case 2:return A+256+(e[a++]<<8|e[a++]);case 1:return A+e[a++];default:return t-1}}))}(e))}function it(e){return 1&e?~e>>1:e>>1}function st(e,t){let r=Array(e);for(let n=0,i=-1;n<e;n++)r[n]=i+=1+t();return r}function ot(e,t){let r=Array(e);for(let n=0,i=0;n<e;n++)r[n]=i+=it(t());return r}function at(e,t){let r=st(e(),e),n=e(),i=st(n,e),s=function(e,t){let r=Array(e);for(let n=0;n<e;n++)r[n]=1+t();return r}(n,e);for(let e=0;e<n;e++)for(let t=0;t<s[e];t++)r.push(i[e]+t);return t?r.map((e=>t[e])):r}function ut(e,t,r){let n=Array(e).fill(void 0).map((()=>[]));for(let i=0;i<t;i++)ot(e,r).forEach(((e,t)=>n[t].push(e)));return n}function ht(e,t){let r=1+t(),n=t(),i=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(r)}return t}(t);return rt(ut(i.length,1+e,t).map(((e,t)=>{const s=e[0],o=e.slice(1);return Array(i[t]).fill(void 0).map(((e,t)=>{let i=t*n;return[s+t*r,o.map((e=>e+i))]}))})))}function ft(e,t){return ut(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}const lt=nt($e("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")),ct=new Set(at(lt)),dt=new Set(at(lt)),pt=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(ht(r,e))}for(;;){let r=e()-1;if(r<0)break;t.push(ft(r,e))}return function(e){const t={};for(let r=0;r<e.length;r++){const n=e[r];t[n[0]]=n[1]}return t}(rt(t))}(lt),mt=function(e){let t=at(e).sort(((e,t)=>e-t));return function r(){let n=[];for(;;){let i=at(e,t);if(0==i.length)break;n.push({set:new Set(i),node:r()})}n.sort(((e,t)=>t.set.size-e.set.size));let i=e(),s=i%3;i=i/3|0;let o=!!(1&i);return i>>=1,{branches:n,valid:s,fe0f:o,save:1==i,check:2==i}}()}(lt),gt=45,yt=95;function vt(e){return C(e)}function At(e){return e.filter((e=>65039!=e))}function wt(e){for(let t of e.split(".")){let e=vt(t);try{for(let t=e.lastIndexOf(yt)-1;t>=0;t--)if(e[t]!==yt)throw new Error("underscore only allowed at start");if(e.length>=4&&e.every((e=>e<128))&&e[2]===gt&&e[3]===gt)throw new Error("invalid label extension")}catch(e){throw new Error(`Invalid label "${t}": ${e.message}`)}}return e}function bt(e){return wt(function(e,t){let r=vt(e).reverse(),n=[];for(;r.length;){let e=Mt(r);if(e){n.push(...t(e));continue}let i=r.pop();if(ct.has(i)){n.push(i);continue}if(dt.has(i))continue;let s=pt[i];if(!s)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);n.push(...s)}return wt((i=String.fromCodePoint(...n),i.normalize("NFC")));var i}(e,At))}function Mt(e,t){var r;let n,i,s=mt,o=[],a=e.length;for(t&&(t.length=0);a;){let u=e[--a];if(s=null===(r=s.branches.find((e=>e.set.has(u))))||void 0===r?void 0:r.node,!s)break;if(s.save)i=u;else if(s.check&&u===i)break;o.push(u),s.fe0f&&(o.push(65039),a>0&&65039==e[a-1]&&a--),s.valid&&(n=o.slice(),2==s.valid&&n.splice(1,1),t&&t.push(...e.slice(a).reverse()),e.length=a)}return n}const Et=new A(Ze),St=new Uint8Array(32);function Ct(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function It(e){const t=E(bt(e)),r=[];if(0===e.length)return r;let n=0;for(let e=0;e<t.length;e++){46===t[e]&&(r.push(Ct(t.slice(n,e))),n=e+1)}if(n>=t.length)throw new Error("invalid ENS name; empty component");return r.push(Ct(t.slice(n))),r}St.fill(0);const Tt="Ethereum Signed Message:\n";function Pt(e){return"string"==typeof e&&(e=E(e)),P(ne([E(Tt),E(String(e.length)),e]))}var _t=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))};const Bt=new A(Ze),xt=new Uint8Array(32);xt.fill(0);const Rt=b.from(-1),kt=b.from(0),Dt=b.from(1),Ot=b.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Nt=$(Dt.toHexString(),32),Ft=$(kt.toHexString(),32),Lt={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Ut=["name","version","chainId","verifyingContract","salt"];function Ht(e){return function(t){return"string"!=typeof t&&Bt.throwArgumentError(`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const qt={name:Ht("name"),version:Ht("version"),chainId:function(e){try{return b.from(e).toString()}catch(e){}return Bt.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return J(e).toLowerCase()}catch(e){}return Bt.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=ee(e);if(32!==t.length)throw new Error("bad length");return re(t)}catch(e){}return Bt.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function Gt(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const r=""===t[1],n=parseInt(t[2]||"256");(n%8!=0||n>256||t[2]&&t[2]!==String(n))&&Bt.throwArgumentError("invalid numeric width","type",e);const i=Ot.mask(r?n-1:n),s=r?i.add(Dt).mul(Rt):kt;return function(t){const r=b.from(t);return(r.lt(s)||r.gt(i))&&Bt.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),$(r.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(0===r||r>32||t[1]!==String(r))&&Bt.throwArgumentError("invalid bytes width","type",e),function(t){return ee(t).length!==r&&Bt.throwArgumentError(`invalid length for ${e}`,"value",t),function(e){const t=ee(e),r=t.length%32;return r?ie([t,xt.slice(r)]):re(t)}(t)}}}switch(e){case"address":return function(e){return $(J(e),32)};case"bool":return function(e){return e?Nt:Ft};case"bytes":return function(e){return P(e)};case"string":return function(e){return _(e)}}return null}function Kt(e,t){return`${e}(${t.map((({name:e,type:t})=>t+" "+e)).join(",")})`}class jt{constructor(e){c(this,"types",Object.freeze(d(e))),c(this,"_encoderCache",{}),c(this,"_types",{});const t={},r={},n={};Object.keys(e).forEach((e=>{t[e]={},r[e]=[],n[e]={}}));for(const n in e){const i={};e[n].forEach((s=>{i[s.name]&&Bt.throwArgumentError(`duplicate variable name ${JSON.stringify(s.name)} in ${JSON.stringify(n)}`,"types",e),i[s.name]=!0;const o=s.type.match(/^([^\x5b]*)(\x5b|$)/)[1];o===n&&Bt.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",e);Gt(o)||(r[o]||Bt.throwArgumentError(`unknown type ${JSON.stringify(o)}`,"types",e),r[o].push(n),t[n][o]=!0)}))}const i=Object.keys(r).filter((e=>0===r[e].length));0===i.length?Bt.throwArgumentError("missing primary type","types",e):i.length>1&&Bt.throwArgumentError(`ambiguous primary types or unused types: ${i.map((e=>JSON.stringify(e))).join(", ")}`,"types",e),c(this,"primaryType",i[0]),function i(s,o){o[s]&&Bt.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",e),o[s]=!0,Object.keys(t[s]).forEach((e=>{r[e]&&(i(e,o),Object.keys(o).forEach((t=>{n[t][e]=!0})))})),delete o[s]}(this.primaryType,{});for(const t in n){const r=Object.keys(n[t]);r.sort(),this._types[t]=Kt(t,e[t])+r.map((t=>Kt(t,e[t]))).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const t=Gt(e);if(t)return t}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const e=t[1],r=this.getEncoder(e),n=parseInt(t[3]);return t=>{n>=0&&t.length!==n&&Bt.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t);let i=t.map(r);return this._types[e]&&(i=i.map(P)),P(ie(i))}}const r=this.types[e];if(r){const t=_(this._types[e]);return e=>{const n=r.map((({name:t,type:r})=>{const n=this.getEncoder(r)(e[t]);return this._types[r]?P(n):n}));return n.unshift(t),ie(n)}}return Bt.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||Bt.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return P(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(Gt(e))return r(e,t);const n=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const e=n[1],i=parseInt(n[3]);return i>=0&&t.length!==i&&Bt.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((t=>this._visit(e,t,r)))}const i=this.types[e];return i?i.reduce(((e,{name:n,type:i})=>(e[n]=this._visit(i,t[n],r),e)),{}):Bt.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new jt(e)}static getPrimaryType(e){return jt.from(e).primaryType}static hashStruct(e,t,r){return jt.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const n=Lt[r];n||Bt.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:n})}return t.sort(((e,t)=>Ut.indexOf(e.name)-Ut.indexOf(t.name))),jt.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return ie(["0x1901",jt.hashDomain(e),jt.from(t).hash(r)])}static hash(e,t,r){return P(jt.encode(e,t,r))}static resolveNames(e,t,r,n){return _t(this,void 0,void 0,(function*(){e=p(e);const i={};e.verifyingContract&&!se(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const s=jt.from(t);s.visit(r,((e,t)=>("address"!==e||se(t,20)||(i[t]="0x"),t)));for(const e in i)i[e]=yield n(e);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),r=s.visit(r,((e,t)=>"address"===e&&i[t]?i[t]:t)),{domain:e,value:r}}))}static getPayload(e,t,r){jt.hashDomain(e);const n={},i=[];Ut.forEach((t=>{const r=e[t];null!=r&&(n[t]=qt[t](r),i.push({name:t,type:Lt[t]}))}));const s=jt.from(t),o=p(t);return o.EIP712Domain?Bt.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):o.EIP712Domain=i,s.encode(r),{types:o,domain:n,primaryType:s.primaryType,message:s.visit(r,((e,t)=>{if(e.match(/^bytes(\d*)/))return re(ee(t));if(e.match(/^u?int/))return b.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!=typeof t&&Bt.throwArgumentError("invalid string","value",t),t}return Bt.throwArgumentError("unsupported type","type",e)}))}}}var zt={},Qt={},Wt={},Jt={},Vt={},Yt={name:"@safe-global/safe-apps-sdk",version:"7.10.1",description:"SDK developed to integrate third-party apps with Safe app.",main:"dist/src/index.js",typings:"dist/src/index.d.ts",_files:["dist/**/*","src/**/*","CHANGELOG.md","README.md"],keywords:["Safe","sdk","apps"],scripts:{test:"jest","format-dist":"sed -i '' 's/\"files\":/\"_files\":/' dist/package.json",build:"yarn rimraf dist && tsc && yarn format-dist"},author:"Safe (https://safe.global)",license:"MIT",dependencies:{"@safe-global/safe-gateway-typescript-sdk":"^3.5.3",ethers:"^5.7.2"},devDependencies:{rimraf:"^3.0.2"},repository:{type:"git",url:"git+https://github.com/safe-global/safe-apps-sdk.git"},bugs:{url:"https://github.com/safe-global/safe-apps-sdk/issues"},homepage:"https://github.com/safe-global/safe-apps-sdk#readme",publishConfig:{access:"public"}},Xt=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.getSDKVersion=void 0;const Zt=Xt(Yt);Vt.getSDKVersion=()=>Zt.default.version.split("-")[0];var $t={};Object.defineProperty($t,"__esModule",{value:!0}),$t.generateRequestId=void 0;const er=e=>e.toString(16).padStart(2,"0");$t.generateRequestId=()=>"undefined"!=typeof window?(e=>{const t=new Uint8Array((e||40)/2);return window.crypto.getRandomValues(t),Array.from(t,er).join("")})(10):(new Date).getTime().toString(36),Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.MessageFormatter=void 0;const tr=Vt,rr=$t;class nr{}Jt.MessageFormatter=nr,nr.makeRequest=(e,t)=>({id:(0,rr.generateRequestId)(),method:e,params:t,env:{sdkVersion:(0,tr.getSDKVersion)()}}),nr.makeResponse=(e,t,r)=>({id:e,success:!0,version:r,data:t}),nr.makeErrorResponse=(e,t,r)=>({id:e,success:!1,error:t,version:r});var ir,sr,or={};ir=or,Object.defineProperty(ir,"__esModule",{value:!0}),ir.RestrictedMethods=ir.Methods=void 0,(sr=ir.Methods||(ir.Methods={})).sendTransactions="sendTransactions",sr.rpcCall="rpcCall",sr.getChainInfo="getChainInfo",sr.getSafeInfo="getSafeInfo",sr.getTxBySafeTxHash="getTxBySafeTxHash",sr.getSafeBalances="getSafeBalances",sr.signMessage="signMessage",sr.signTypedMessage="signTypedMessage",sr.getEnvironmentInfo="getEnvironmentInfo",sr.getOffChainSignature="getOffChainSignature",sr.requestAddressBook="requestAddressBook",sr.wallet_getPermissions="wallet_getPermissions",sr.wallet_requestPermissions="wallet_requestPermissions",(ir.RestrictedMethods||(ir.RestrictedMethods={})).requestAddressBook="requestAddressBook",function(e){var t=s&&s.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=s&&s.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0});const n=Jt;e.default=class{constructor(e=null,t=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer="undefined"==typeof window,this.isValidMessage=({origin:e,data:t,source:r})=>{const n=!t,i=!this.isServer&&r===window.parent,s=(void 0!==t.version&&parseInt(t.version.split(".")[0]))>=1;let o=!0;return Array.isArray(this.allowedOrigins)&&(o=void 0!==this.allowedOrigins.find((t=>t.test(e)))),!n&&i&&s&&o},this.logIncomingMessage=e=>{console.info(`Safe Apps SDK v1: A message was received from origin ${e.origin}. `,e.data)},this.onParentMessage=e=>{this.isValidMessage(e)&&(this.debugMode&&this.logIncomingMessage(e),this.handleIncomingMessage(e.data))},this.handleIncomingMessage=e=>{const{id:t}=e,r=this.callbacks.get(t);r&&(r(e),this.callbacks.delete(t))},this.send=(e,t)=>{const r=n.MessageFormatter.makeRequest(e,t);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(r,"*"),new Promise(((e,t)=>{this.callbacks.set(r.id,(r=>{r.success?e(r):t(new Error(r.error))}))}))},this.allowedOrigins=e,this.debugMode=t,this.isServer||window.addEventListener("message",this.onParentMessage)}},r(or,e)}(Wt);var ar={},ur={},hr={};Object.defineProperty(hr,"__esModule",{value:!0}),hr.isObjectEIP712TypedData=void 0;hr.isObjectEIP712TypedData=e=>"object"==typeof e&&null!=e&&"domain"in e&&"types"in e&&"message"in e;var fr={};Object.defineProperty(fr,"__esModule",{value:!0});var lr={},cr={},dr={},pr={},mr=s&&s.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))},gr=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(pr,"__esModule",{value:!0}),pr.fetchData=pr.stringifyQuery=pr.insertParams=void 0;const yr=gr(u.exports);pr.insertParams=function(e,t){return t?Object.keys(t).reduce(((e,r)=>function(e,t,r){return e.replace(new RegExp(`\\{${t}\\}`,"g"),r)}(e,r,String(t[r]))),e):e},pr.stringifyQuery=function(e){if(!e)return"";const t=new URLSearchParams;Object.keys(e).forEach((r=>{null!=e[r]&&t.append(r,String(e[r]))}));const r=t.toString();return r?`?${r}`:""},pr.fetchData=function(e,t){return mr(this,void 0,void 0,(function*(){let r;null!=t&&(r={method:"POST",body:"string"==typeof t?t:JSON.stringify(t),headers:{"Content-Type":"application/json"}});const n=yield(0,yr.default)(e,r);let i;try{i=yield n.json()}catch(e){if(n.headers&&"0"!==n.headers.get("content-length"))throw new Error(`Invalid response content: ${n.statusText}`)}if(!n.ok){const e="object"==typeof(s=i)&&null!==s&&"code"in s&&"message"in s?`${i.code}: ${i.message}`:n.statusText;throw new Error(e)}var s;return i}))},Object.defineProperty(dr,"__esModule",{value:!0}),dr.getEndpoint=dr.postEndpoint=void 0;const vr=pr;function Ar(e,t,r,n){return`${e}${(0,vr.insertParams)(t,r)}${(0,vr.stringifyQuery)(n)}`}dr.postEndpoint=function(e,t,r){const n=Ar(e,t,null==r?void 0:r.path,null==r?void 0:r.query);return(0,vr.fetchData)(n,null==r?void 0:r.body)},dr.getEndpoint=function(e,t,r,n){if(n)return(0,vr.fetchData)(n);const i=Ar(e,t,null==r?void 0:r.path,null==r?void 0:r.query);return(0,vr.fetchData)(i)};var wr={};Object.defineProperty(wr,"__esModule",{value:!0}),wr.DEFAULT_BASE_URL=void 0,wr.DEFAULT_BASE_URL="https://safe-client.safe.global";var br={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationVersionState=void 0,(t=e.ImplementationVersionState||(e.ImplementationVersionState={})).UP_TO_DATE="UP_TO_DATE",t.OUTDATED="OUTDATED",t.UNKNOWN="UNKNOWN"}(br);var Mr={};!function(e){var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppSocialPlatforms=e.SafeAppFeatures=e.SafeAppAccessPolicyTypes=void 0,(t=e.SafeAppAccessPolicyTypes||(e.SafeAppAccessPolicyTypes={})).NoRestrictions="NO_RESTRICTIONS",t.DomainAllowlist="DOMAIN_ALLOWLIST",(e.SafeAppFeatures||(e.SafeAppFeatures={})).BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS",(r=e.SafeAppSocialPlatforms||(e.SafeAppSocialPlatforms={})).TWITTER="TWITTER",r.GITHUB="GITHUB",r.DISCORD="DISCORD"}(Mr);var Er={};!function(e){var t,r,n,i,s,o,a,u,h,f;Object.defineProperty(e,"__esModule",{value:!0}),e.LabelValue=e.DetailedExecutionInfoType=e.TransactionListItemType=e.ConflictType=e.TransactionInfoType=e.SettingsInfoType=e.TransactionTokenType=e.TransferDirection=e.TransactionStatus=e.Operation=void 0,(t=e.Operation||(e.Operation={}))[t.CALL=0]="CALL",t[t.DELEGATE=1]="DELEGATE",(r=e.TransactionStatus||(e.TransactionStatus={})).AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",r.AWAITING_EXECUTION="AWAITING_EXECUTION",r.CANCELLED="CANCELLED",r.FAILED="FAILED",r.SUCCESS="SUCCESS",(n=e.TransferDirection||(e.TransferDirection={})).INCOMING="INCOMING",n.OUTGOING="OUTGOING",n.UNKNOWN="UNKNOWN",(i=e.TransactionTokenType||(e.TransactionTokenType={})).ERC20="ERC20",i.ERC721="ERC721",i.NATIVE_COIN="NATIVE_COIN",(s=e.SettingsInfoType||(e.SettingsInfoType={})).SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",s.ADD_OWNER="ADD_OWNER",s.REMOVE_OWNER="REMOVE_OWNER",s.SWAP_OWNER="SWAP_OWNER",s.CHANGE_THRESHOLD="CHANGE_THRESHOLD",s.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",s.ENABLE_MODULE="ENABLE_MODULE",s.DISABLE_MODULE="DISABLE_MODULE",s.SET_GUARD="SET_GUARD",s.DELETE_GUARD="DELETE_GUARD",(o=e.TransactionInfoType||(e.TransactionInfoType={})).TRANSFER="Transfer",o.SETTINGS_CHANGE="SettingsChange",o.CUSTOM="Custom",o.CREATION="Creation",(a=e.ConflictType||(e.ConflictType={})).NONE="None",a.HAS_NEXT="HasNext",a.END="End",(u=e.TransactionListItemType||(e.TransactionListItemType={})).TRANSACTION="TRANSACTION",u.LABEL="LABEL",u.CONFLICT_HEADER="CONFLICT_HEADER",u.DATE_LABEL="DATE_LABEL",(h=e.DetailedExecutionInfoType||(e.DetailedExecutionInfoType={})).MULTISIG="MULTISIG",h.MODULE="MODULE",(f=e.LabelValue||(e.LabelValue={})).Queued="Queued",f.Next="Next"}(Er);var Sr={};!function(e){var t,r,n;Object.defineProperty(e,"__esModule",{value:!0}),e.FEATURES=e.GAS_PRICE_TYPE=e.RPC_AUTHENTICATION=void 0,(t=e.RPC_AUTHENTICATION||(e.RPC_AUTHENTICATION={})).API_KEY_PATH="API_KEY_PATH",t.NO_AUTHENTICATION="NO_AUTHENTICATION",t.UNKNOWN="UNKNOWN",(r=e.GAS_PRICE_TYPE||(e.GAS_PRICE_TYPE={})).ORACLE="ORACLE",r.FIXED="FIXED",r.UNKNOWN="UNKNOWN",(n=e.FEATURES||(e.FEATURES={})).ERC721="ERC721",n.SAFE_APPS="SAFE_APPS",n.CONTRACT_INTERACTION="CONTRACT_INTERACTION",n.DOMAIN_LOOKUP="DOMAIN_LOOKUP",n.SPENDING_LIMIT="SPENDING_LIMIT",n.EIP1559="EIP1559",n.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",n.TX_SIMULATION="TX_SIMULATION",n.EIP1271="EIP1271"}(Sr);var Cr={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.TokenType=void 0,(t=e.TokenType||(e.TokenType={})).ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_TOKEN="NATIVE_TOKEN"}(Cr);var Ir={};Object.defineProperty(Ir,"__esModule",{value:!0});var Tr={};Object.defineProperty(Tr,"__esModule",{value:!0});var Pr={};!function(e){var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.SafeMessageStatus=e.SafeMessageListItemType=void 0,(t=e.SafeMessageListItemType||(e.SafeMessageListItemType={})).DATE_LABEL="DATE_LABEL",t.MESSAGE="MESSAGE",(r=e.SafeMessageStatus||(e.SafeMessageStatus={})).NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",r.CONFIRMED="CONFIRMED"}(Pr),function(e){var t=s&&s.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=s&&s.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.confirmSafeMessage=e.proposeSafeMessage=e.getSafeMessage=e.getSafeMessages=e.getDecodedData=e.getMasterCopies=e.getSafeApps=e.getChainConfig=e.getChainsConfig=e.proposeTransaction=e.postSafeGasEstimation=e.getTransactionDetails=e.getTransactionQueue=e.getTransactionHistory=e.getCollectiblesPage=e.getCollectibles=e.getOwnedSafes=e.getFiatCurrencies=e.getBalances=e.getMultisigTransactions=e.getModuleTransactions=e.getIncomingTransfers=e.getSafeInfo=e.setBaseUrl=void 0;const n=dr,i=wr;r(br,e),r(Mr,e),r(Er,e),r(Sr,e),r(Cr,e),r(Ir,e),r(Tr,e),r(Pr,e);let o=i.DEFAULT_BASE_URL;e.setBaseUrl=e=>{o=e},e.getSafeInfo=function(e,t){return(0,n.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:e,address:t}})},e.getIncomingTransfers=function(e,t,r,i){return(0,n.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:e,address:t},query:r},i)},e.getModuleTransactions=function(e,t,r,i){return(0,n.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:e,address:t},query:r},i)},e.getMultisigTransactions=function(e,t,r,i){return(0,n.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:e,address:t},query:r},i)},e.getBalances=function(e,t,r="usd",i={}){return(0,n.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:e,address:t,currency:r},query:i})},e.getFiatCurrencies=function(){return(0,n.getEndpoint)(o,"/v1/balances/supported-fiat-codes")},e.getOwnedSafes=function(e,t){return(0,n.getEndpoint)(o,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:e,address:t}})},e.getCollectibles=function(e,t,r={}){return(0,n.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:e,address:t},query:r})},e.getCollectiblesPage=function(e,t,r={},i){return(0,n.getEndpoint)(o,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:e,address:t},query:r},i)},e.getTransactionHistory=function(e,t,r){return(0,n.getEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:e,safe_address:t},query:{}},r)},e.getTransactionQueue=function(e,t,r,i){return(0,n.getEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:e,safe_address:t},query:{trusted:i}},r)},e.getTransactionDetails=function(e,t){return(0,n.getEndpoint)(o,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:e,transactionId:t}})},e.postSafeGasEstimation=function(e,t,r){return(0,n.postEndpoint)(o,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:e,safe_address:t},body:r})},e.proposeTransaction=function(e,t,r){return(0,n.postEndpoint)(o,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:e,safe_address:t},body:r})},e.getChainsConfig=function(e){return(0,n.getEndpoint)(o,"/v1/chains",{query:e})},e.getChainConfig=function(e){return(0,n.getEndpoint)(o,"/v1/chains/{chainId}",{path:{chainId:e}})},e.getSafeApps=function(e,t={}){return(0,n.getEndpoint)(o,"/v1/chains/{chainId}/safe-apps",{path:{chainId:e},query:t})},e.getMasterCopies=function(e){return(0,n.getEndpoint)(o,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:e}})},e.getDecodedData=function(e,t){return(0,n.postEndpoint)(o,"/v1/chains/{chainId}/data-decoder",{path:{chainId:e},body:{data:t}})},e.getSafeMessages=function(e,t,r){return(0,n.getEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:e,safe_address:t},query:{}},r)},e.getSafeMessage=function(e,t){return(0,n.getEndpoint)(o,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:e,message_hash:t}})},e.proposeSafeMessage=function(e,t,r){return(0,n.postEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:e,safe_address:t},body:r})},e.confirmSafeMessage=function(e,t,r){return(0,n.postEndpoint)(o,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:e,message_hash:t},body:r})}}(cr),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TransferDirection=e.TransactionStatus=e.TokenType=e.Operation=void 0;var t=cr;Object.defineProperty(e,"Operation",{enumerable:!0,get:function(){return t.Operation}}),Object.defineProperty(e,"TokenType",{enumerable:!0,get:function(){return t.TokenType}}),Object.defineProperty(e,"TransactionStatus",{enumerable:!0,get:function(){return t.TransactionStatus}}),Object.defineProperty(e,"TransferDirection",{enumerable:!0,get:function(){return t.TransferDirection}})}(lr);var _r={};Object.defineProperty(_r,"__esModule",{value:!0}),function(e){var t=s&&s.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=s&&s.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(hr,e),r(fr,e),r(lr,e),r(_r,e)}(ur),Object.defineProperty(ar,"__esModule",{value:!0}),ar.TXs=void 0;const Br=or,xr=ur;ar.TXs=class{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw new Error("Invalid safeTxHash");return(await this.communicator.send(Br.Methods.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){const t={message:e};return(await this.communicator.send(Br.Methods.signMessage,t)).data}async signTypedMessage(e){if(!(0,xr.isObjectEIP712TypedData)(e))throw new Error("Invalid typed data");return(await this.communicator.send(Br.Methods.signTypedMessage,{typedData:e})).data}async send({txs:e,params:t}){if(!e||!e.length)throw new Error("No transactions were passed");const r={txs:e,params:t};return(await this.communicator.send(Br.Methods.sendTransactions,r)).data}};var Rr={},kr={};Object.defineProperty(kr,"__esModule",{value:!0}),kr.RPC_CALLS=void 0,kr.RPC_CALLS={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"},Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.Eth=void 0;const Dr=kr,Or=or,Nr={defaultBlockParam:(e="latest")=>e,returnFullTxObjectParam:(e=!1)=>e,blockNumberToHex:e=>Number.isInteger(e)?`0x${e.toString(16)}`:e};Rr.Eth=class{constructor(e){this.communicator=e,this.call=this.buildRequest({call:Dr.RPC_CALLS.eth_call,formatters:[null,Nr.defaultBlockParam]}),this.getBalance=this.buildRequest({call:Dr.RPC_CALLS.eth_getBalance,formatters:[null,Nr.defaultBlockParam]}),this.getCode=this.buildRequest({call:Dr.RPC_CALLS.eth_getCode,formatters:[null,Nr.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:Dr.RPC_CALLS.eth_getStorageAt,formatters:[null,Nr.blockNumberToHex,Nr.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:Dr.RPC_CALLS.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:Dr.RPC_CALLS.eth_getBlockByHash,formatters:[null,Nr.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:Dr.RPC_CALLS.eth_getBlockByNumber,formatters:[Nr.blockNumberToHex,Nr.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:Dr.RPC_CALLS.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:Dr.RPC_CALLS.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:Dr.RPC_CALLS.eth_getTransactionCount,formatters:[null,Nr.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:Dr.RPC_CALLS.eth_gasPrice}),this.getEstimateGas=e=>this.buildRequest({call:Dr.RPC_CALLS.eth_estimateGas})([e]),this.setSafeSettings=this.buildRequest({call:Dr.RPC_CALLS.safe_setSettings})}buildRequest(e){const{call:t,formatters:r}=e;return async e=>{r&&Array.isArray(e)&&r.forEach(((t,r)=>{t&&(e[r]=t(e[r]))}));const n={call:t,params:e||[]};return(await this.communicator.send(Or.Methods.rpcCall,n)).data}}};var Fr={};var Lr=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))};const Ur=new A("abstract-signer/5.7.0"),Hr=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],qr=[A.errors.INSUFFICIENT_FUNDS,A.errors.NONCE_EXPIRED,A.errors.REPLACEMENT_UNDERPRICED];class Gr{constructor(){Ur.checkAbstract(new.target,Gr),c(this,"_isSigner",!0)}getBalance(e){return Lr(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)}))}getTransactionCount(e){return Lr(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)}))}estimateGas(e){return Lr(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const t=yield m(this.checkTransaction(e));return yield this.provider.estimateGas(t)}))}call(e,t){return Lr(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield m(this.checkTransaction(e));return yield this.provider.call(r,t)}))}sendTransaction(e){return Lr(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),r=yield this.signTransaction(t);return yield this.provider.sendTransaction(r)}))}getChainId(){return Lr(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return Lr(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return Lr(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(e){return Lr(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)}))}checkTransaction(e){for(const t in e)-1===Hr.indexOf(t)&&Ur.throwArgumentError("invalid transaction key: "+t,"transaction",e);const t=p(e);return null==t.from?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then((t=>(t[0].toLowerCase()!==t[1].toLowerCase()&&Ur.throwArgumentError("from address mismatch","transaction",e),t[0]))),t}populateTransaction(e){return Lr(this,void 0,void 0,(function*(){const t=yield m(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then((e=>Lr(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&Ur.throwArgumentError("provided ENS name resolves to null","tx.to",e),t})))),t.to.catch((e=>{})));const r=null!=t.maxFeePerGas||null!=t.maxPriorityFeePerGas;if(null==t.gasPrice||2!==t.type&&!r?0!==t.type&&1!==t.type||!r||Ur.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):Ur.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e),2!==t.type&&null!=t.type||null==t.maxFeePerGas||null==t.maxPriorityFeePerGas)if(0===t.type||1===t.type)null==t.gasPrice&&(t.gasPrice=this.getGasPrice());else{const e=yield this.getFeeData();if(null==t.type)if(null!=e.maxFeePerGas&&null!=e.maxPriorityFeePerGas)if(t.type=2,null!=t.gasPrice){const e=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=e,t.maxPriorityFeePerGas=e}else null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas);else null!=e.gasPrice?(r&&Ur.throwError("network does not support EIP-1559",A.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):Ur.throwError("failed to get consistent fee data",A.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===t.type&&(null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else t.type=2;return null==t.nonce&&(t.nonce=this.getTransactionCount("pending")),null==t.gasLimit&&(t.gasLimit=this.estimateGas(t).catch((e=>{if(qr.indexOf(e.code)>=0)throw e;return Ur.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",A.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,tx:t})}))),null==t.chainId?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then((t=>(0!==t[1]&&t[0]!==t[1]&&Ur.throwArgumentError("chainId address mismatch","transaction",e),t[0]))),yield m(t)}))}_checkProvider(e){this.provider||Ur.throwError("missing provider",A.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}}class Kr extends Gr{constructor(e,t){super(),c(this,"address",e),c(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then((()=>{Ur.throwError(e,A.errors.UNSUPPORTED_OPERATION,{operation:t})}))}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new Kr(this.address,e)}}var jr=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))};const zr=new A("abstract-provider/5.7.0");class Qr{constructor(){zr.checkAbstract(new.target,Qr),c(this,"_isProvider",!0)}getFeeData(){return jr(this,void 0,void 0,(function*(){const{block:e,gasPrice:t}=yield m({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((e=>null))});let r=null,n=null,i=null;return e&&e.baseFeePerGas&&(r=e.baseFeePerGas,i=b.from("1500000000"),n=e.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:r,maxFeePerGas:n,maxPriorityFeePerGas:i,gasPrice:t}}))}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!(!e||!e._isProvider)}}class Wr{constructor(e){c(this,"alphabet",e),c(this,"base",e.length),c(this,"_alphabetMap",{}),c(this,"_leader",e.charAt(0));for(let t=0;t<e.length;t++)this._alphabetMap[e.charAt(t)]=t}encode(e){let t=ee(e);if(0===t.length)return"";let r=[0];for(let e=0;e<t.length;++e){let n=t[e];for(let e=0;e<r.length;++e)n+=r[e]<<8,r[e]=n%this.base,n=n/this.base|0;for(;n>0;)r.push(n%this.base),n=n/this.base|0}let n="";for(let e=0;0===t[e]&&e<t.length-1;++e)n+=this._leader;for(let e=r.length-1;e>=0;--e)n+=this.alphabet[r[e]];return n}decode(e){if("string"!=typeof e)throw new TypeError("Expected String");let t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(let r=0;r<e.length;r++){let n=this._alphabetMap[e[r]];if(void 0===n)throw new Error("Non-base"+this.base+" character");let i=n;for(let e=0;e<t.length;++e)i+=t[e]*this.base,t[e]=255&i,i>>=8;for(;i>0;)t.push(255&i),i>>=8}for(let r=0;e[r]===this._leader&&r<e.length-1;++r)t.push(0);return ee(new Uint8Array(t.reverse()))}}new Wr("abcdefghijklmnopqrstuvwxyz234567");const Jr=new Wr("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var Vr;!function(e){e.sha256="sha256",e.sha512="sha512"}(Vr||(Vr={}));const Yr=new A("sha2/5.7.0");function Xr(e){return"0x"+me.ripemd160().update(ee(e)).digest("hex")}function Zr(e){return"0x"+me.sha256().update(ee(e)).digest("hex")}function $r(e,t,r){return Vr[e]||Yr.throwError("unsupported algorithm "+e,A.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:e}),"0x"+me.hmac(me[e],ee(t)).update(ee(r)).digest("hex")}function en(e,t,r,n,i){let s;e=ee(e),t=ee(t);let o=1;const a=new Uint8Array(n),u=new Uint8Array(t.length+4);let h,f;u.set(t);for(let l=1;l<=o;l++){u[t.length]=l>>24&255,u[t.length+1]=l>>16&255,u[t.length+2]=l>>8&255,u[t.length+3]=255&l;let c=ee($r(i,e,u));s||(s=c.length,f=new Uint8Array(s),o=Math.ceil(n/s),h=n-(o-1)*s),f.set(c);for(let t=1;t<r;t++){c=ee($r(i,e,c));for(let e=0;e<s;e++)f[e]^=c[e]}const d=(l-1)*s,p=l===o?h:s;a.set(ee(f).slice(0,p),d)}return re(a)}var tn={exports:{}};!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var s;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require("buffer").Buffer}catch(e){}function o(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function a(e,t,r){var n=o(e,r);return r-1>=t&&(n|=o(e,r-1)<<4),n}function u(e,t,n,i){for(var s=0,o=0,a=Math.min(e.length,n),u=t;u<a;u++){var h=e.charCodeAt(u)-48;s*=i,o=h>=49?h-49+10:h>=17?h-17+10:h,r(h>=0&&o<i,"Invalid character"),s+=o}return s}function h(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,n):(this._parseBase(e,t,i),"le"===n&&this._initArray(this.toArray(),t,n)))},i.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var s,o,a=0;if("be"===n)for(i=e.length-1,s=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===n)for(i=0,s=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this._strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,s=0,o=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=a(e,t,n)<<s,this.words[o]|=67108863&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=a(e,t,n)<<s,this.words[o]|=67108863&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;this._strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var s=e.length-r,o=s%n,a=Math.min(s,s-o)+r,h=0,f=r;f<a;f+=n)h=u(e,f,f+n,t),this.imuln(i),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h);if(0!==o){var l=1;for(h=u(e,f,e.length,t),f=0;f<o;f++)l*=t;this.imuln(l),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){h(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(e){i.prototype.inspect=f}else i.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function p(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],s=0|t.words[0],o=i*s,a=67108863&o,u=o/67108864|0;r.words[0]=a;for(var h=1;h<n;h++){for(var f=u>>>26,l=67108863&u,c=Math.min(h,t.length-1),d=Math.max(0,h-e.length+1);d<=c;d++){var p=h-d|0;f+=(o=(i=0|e.words[p])*(s=0|t.words[d])+l)/67108864|0,l=67108863&o}r.words[h]=0|l,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r._strip()}i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,s=0,o=0;o<this.length;o++){var a=this.words[o],u=(16777215&(a<<i|s)).toString(16);s=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,o--),n=0!==s||o!==this.length-1?l[6-u.length]+u+n:u+n}for(0!==s&&(n=s.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var h=c[e],f=d[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(f).toString(e);n=(p=p.idivn(f)).isZero()?m+n:l[h-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},s&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(s,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),s=n||Math.max(1,i);r(i<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,s);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,i),o},i.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,s=0;i<this.length;i++){var o=this.words[i]<<s|n;e[r++]=255&o,r<e.length&&(e[r++]=o>>8&255),r<e.length&&(e[r++]=o>>16&255),6===s?(r<e.length&&(e[r++]=o>>24&255),n=0,s=0):(n=o>>>24,s+=2)}if(r<e.length)for(e[r++]=n;r<e.length;)e[r++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,n=0,i=0,s=0;i<this.length;i++){var o=this.words[i]<<s|n;e[r--]=255&o,r>=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===s?(r>=0&&(e[r--]=o>>24&255),n=0,s=0):(n=o>>>24,s+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var i=0,s=0;s<n.length;s++)t=(0|r.words[s])+(0|n.words[s])+i,this.words[s]=67108863&t,i=t>>>26;for(;0!==i&&s<r.length;s++)t=(0|r.words[s])+i,this.words[s]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var s=0,o=0;o<n.length;o++)s=(t=(0|r.words[o])-(0|n.words[o])+s)>>26,this.words[o]=67108863&t;for(;0!==s&&o<r.length;o++)s=(t=(0|r.words[o])+s)>>26,this.words[o]=67108863&t;if(0===s&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,r){var n,i,s,o=e.words,a=t.words,u=r.words,h=0,f=0|o[0],l=8191&f,c=f>>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],y=8191&g,v=g>>>13,A=0|o[3],w=8191&A,b=A>>>13,M=0|o[4],E=8191&M,S=M>>>13,C=0|o[5],I=8191&C,T=C>>>13,P=0|o[6],_=8191&P,B=P>>>13,x=0|o[7],R=8191&x,k=x>>>13,D=0|o[8],O=8191&D,N=D>>>13,F=0|o[9],L=8191&F,U=F>>>13,H=0|a[0],q=8191&H,G=H>>>13,K=0|a[1],j=8191&K,z=K>>>13,Q=0|a[2],W=8191&Q,J=Q>>>13,V=0|a[3],Y=8191&V,X=V>>>13,Z=0|a[4],$=8191&Z,ee=Z>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],se=8191&ie,oe=ie>>>13,ae=0|a[7],ue=8191&ae,he=ae>>>13,fe=0|a[8],le=8191&fe,ce=fe>>>13,de=0|a[9],pe=8191&de,me=de>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(h+(n=Math.imul(l,q))|0)+((8191&(i=(i=Math.imul(l,G))+Math.imul(c,q)|0))<<13)|0;h=((s=Math.imul(c,G))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,G))+Math.imul(m,q)|0,s=Math.imul(m,G);var ye=(h+(n=n+Math.imul(l,j)|0)|0)+((8191&(i=(i=i+Math.imul(l,z)|0)+Math.imul(c,j)|0))<<13)|0;h=((s=s+Math.imul(c,z)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,q),i=(i=Math.imul(y,G))+Math.imul(v,q)|0,s=Math.imul(v,G),n=n+Math.imul(p,j)|0,i=(i=i+Math.imul(p,z)|0)+Math.imul(m,j)|0,s=s+Math.imul(m,z)|0;var ve=(h+(n=n+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,J)|0)+Math.imul(c,W)|0))<<13)|0;h=((s=s+Math.imul(c,J)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,G))+Math.imul(b,q)|0,s=Math.imul(b,G),n=n+Math.imul(y,j)|0,i=(i=i+Math.imul(y,z)|0)+Math.imul(v,j)|0,s=s+Math.imul(v,z)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(m,W)|0,s=s+Math.imul(m,J)|0;var Ae=(h+(n=n+Math.imul(l,Y)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(c,Y)|0))<<13)|0;h=((s=s+Math.imul(c,X)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(E,q),i=(i=Math.imul(E,G))+Math.imul(S,q)|0,s=Math.imul(S,G),n=n+Math.imul(w,j)|0,i=(i=i+Math.imul(w,z)|0)+Math.imul(b,j)|0,s=s+Math.imul(b,z)|0,n=n+Math.imul(y,W)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(v,W)|0,s=s+Math.imul(v,J)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Y)|0,s=s+Math.imul(m,X)|0;var we=(h+(n=n+Math.imul(l,$)|0)|0)+((8191&(i=(i=i+Math.imul(l,ee)|0)+Math.imul(c,$)|0))<<13)|0;h=((s=s+Math.imul(c,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,G))+Math.imul(T,q)|0,s=Math.imul(T,G),n=n+Math.imul(E,j)|0,i=(i=i+Math.imul(E,z)|0)+Math.imul(S,j)|0,s=s+Math.imul(S,z)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(b,W)|0,s=s+Math.imul(b,J)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(v,Y)|0,s=s+Math.imul(v,X)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,ee)|0;var be=(h+(n=n+Math.imul(l,re)|0)|0)+((8191&(i=(i=i+Math.imul(l,ne)|0)+Math.imul(c,re)|0))<<13)|0;h=((s=s+Math.imul(c,ne)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(_,q),i=(i=Math.imul(_,G))+Math.imul(B,q)|0,s=Math.imul(B,G),n=n+Math.imul(I,j)|0,i=(i=i+Math.imul(I,z)|0)+Math.imul(T,j)|0,s=s+Math.imul(T,z)|0,n=n+Math.imul(E,W)|0,i=(i=i+Math.imul(E,J)|0)+Math.imul(S,W)|0,s=s+Math.imul(S,J)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(b,Y)|0,s=s+Math.imul(b,X)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(v,$)|0,s=s+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(m,re)|0,s=s+Math.imul(m,ne)|0;var Me=(h+(n=n+Math.imul(l,se)|0)|0)+((8191&(i=(i=i+Math.imul(l,oe)|0)+Math.imul(c,se)|0))<<13)|0;h=((s=s+Math.imul(c,oe)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(R,q),i=(i=Math.imul(R,G))+Math.imul(k,q)|0,s=Math.imul(k,G),n=n+Math.imul(_,j)|0,i=(i=i+Math.imul(_,z)|0)+Math.imul(B,j)|0,s=s+Math.imul(B,z)|0,n=n+Math.imul(I,W)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(T,W)|0,s=s+Math.imul(T,J)|0,n=n+Math.imul(E,Y)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(S,Y)|0,s=s+Math.imul(S,X)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(b,$)|0,s=s+Math.imul(b,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(v,re)|0,s=s+Math.imul(v,ne)|0,n=n+Math.imul(p,se)|0,i=(i=i+Math.imul(p,oe)|0)+Math.imul(m,se)|0,s=s+Math.imul(m,oe)|0;var Ee=(h+(n=n+Math.imul(l,ue)|0)|0)+((8191&(i=(i=i+Math.imul(l,he)|0)+Math.imul(c,ue)|0))<<13)|0;h=((s=s+Math.imul(c,he)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(O,q),i=(i=Math.imul(O,G))+Math.imul(N,q)|0,s=Math.imul(N,G),n=n+Math.imul(R,j)|0,i=(i=i+Math.imul(R,z)|0)+Math.imul(k,j)|0,s=s+Math.imul(k,z)|0,n=n+Math.imul(_,W)|0,i=(i=i+Math.imul(_,J)|0)+Math.imul(B,W)|0,s=s+Math.imul(B,J)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(T,Y)|0,s=s+Math.imul(T,X)|0,n=n+Math.imul(E,$)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,$)|0,s=s+Math.imul(S,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(b,re)|0,s=s+Math.imul(b,ne)|0,n=n+Math.imul(y,se)|0,i=(i=i+Math.imul(y,oe)|0)+Math.imul(v,se)|0,s=s+Math.imul(v,oe)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,he)|0)+Math.imul(m,ue)|0,s=s+Math.imul(m,he)|0;var Se=(h+(n=n+Math.imul(l,le)|0)|0)+((8191&(i=(i=i+Math.imul(l,ce)|0)+Math.imul(c,le)|0))<<13)|0;h=((s=s+Math.imul(c,ce)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(L,q),i=(i=Math.imul(L,G))+Math.imul(U,q)|0,s=Math.imul(U,G),n=n+Math.imul(O,j)|0,i=(i=i+Math.imul(O,z)|0)+Math.imul(N,j)|0,s=s+Math.imul(N,z)|0,n=n+Math.imul(R,W)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(k,W)|0,s=s+Math.imul(k,J)|0,n=n+Math.imul(_,Y)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(B,Y)|0,s=s+Math.imul(B,X)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(T,$)|0,s=s+Math.imul(T,ee)|0,n=n+Math.imul(E,re)|0,i=(i=i+Math.imul(E,ne)|0)+Math.imul(S,re)|0,s=s+Math.imul(S,ne)|0,n=n+Math.imul(w,se)|0,i=(i=i+Math.imul(w,oe)|0)+Math.imul(b,se)|0,s=s+Math.imul(b,oe)|0,n=n+Math.imul(y,ue)|0,i=(i=i+Math.imul(y,he)|0)+Math.imul(v,ue)|0,s=s+Math.imul(v,he)|0,n=n+Math.imul(p,le)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(m,le)|0,s=s+Math.imul(m,ce)|0;var Ce=(h+(n=n+Math.imul(l,pe)|0)|0)+((8191&(i=(i=i+Math.imul(l,me)|0)+Math.imul(c,pe)|0))<<13)|0;h=((s=s+Math.imul(c,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(L,j),i=(i=Math.imul(L,z))+Math.imul(U,j)|0,s=Math.imul(U,z),n=n+Math.imul(O,W)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(N,W)|0,s=s+Math.imul(N,J)|0,n=n+Math.imul(R,Y)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(k,Y)|0,s=s+Math.imul(k,X)|0,n=n+Math.imul(_,$)|0,i=(i=i+Math.imul(_,ee)|0)+Math.imul(B,$)|0,s=s+Math.imul(B,ee)|0,n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(T,re)|0,s=s+Math.imul(T,ne)|0,n=n+Math.imul(E,se)|0,i=(i=i+Math.imul(E,oe)|0)+Math.imul(S,se)|0,s=s+Math.imul(S,oe)|0,n=n+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,he)|0)+Math.imul(b,ue)|0,s=s+Math.imul(b,he)|0,n=n+Math.imul(y,le)|0,i=(i=i+Math.imul(y,ce)|0)+Math.imul(v,le)|0,s=s+Math.imul(v,ce)|0;var Ie=(h+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;h=((s=s+Math.imul(m,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(L,W),i=(i=Math.imul(L,J))+Math.imul(U,W)|0,s=Math.imul(U,J),n=n+Math.imul(O,Y)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,X)|0,n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(k,$)|0,s=s+Math.imul(k,ee)|0,n=n+Math.imul(_,re)|0,i=(i=i+Math.imul(_,ne)|0)+Math.imul(B,re)|0,s=s+Math.imul(B,ne)|0,n=n+Math.imul(I,se)|0,i=(i=i+Math.imul(I,oe)|0)+Math.imul(T,se)|0,s=s+Math.imul(T,oe)|0,n=n+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,he)|0)+Math.imul(S,ue)|0,s=s+Math.imul(S,he)|0,n=n+Math.imul(w,le)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(b,le)|0,s=s+Math.imul(b,ce)|0;var Te=(h+(n=n+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,me)|0)+Math.imul(v,pe)|0))<<13)|0;h=((s=s+Math.imul(v,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(L,Y),i=(i=Math.imul(L,X))+Math.imul(U,Y)|0,s=Math.imul(U,X),n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,ee)|0,n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(k,re)|0,s=s+Math.imul(k,ne)|0,n=n+Math.imul(_,se)|0,i=(i=i+Math.imul(_,oe)|0)+Math.imul(B,se)|0,s=s+Math.imul(B,oe)|0,n=n+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,he)|0)+Math.imul(T,ue)|0,s=s+Math.imul(T,he)|0,n=n+Math.imul(E,le)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(S,le)|0,s=s+Math.imul(S,ce)|0;var Pe=(h+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(b,pe)|0))<<13)|0;h=((s=s+Math.imul(b,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(L,$),i=(i=Math.imul(L,ee))+Math.imul(U,$)|0,s=Math.imul(U,ee),n=n+Math.imul(O,re)|0,i=(i=i+Math.imul(O,ne)|0)+Math.imul(N,re)|0,s=s+Math.imul(N,ne)|0,n=n+Math.imul(R,se)|0,i=(i=i+Math.imul(R,oe)|0)+Math.imul(k,se)|0,s=s+Math.imul(k,oe)|0,n=n+Math.imul(_,ue)|0,i=(i=i+Math.imul(_,he)|0)+Math.imul(B,ue)|0,s=s+Math.imul(B,he)|0,n=n+Math.imul(I,le)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(T,le)|0,s=s+Math.imul(T,ce)|0;var _e=(h+(n=n+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(S,pe)|0))<<13)|0;h=((s=s+Math.imul(S,me)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(L,re),i=(i=Math.imul(L,ne))+Math.imul(U,re)|0,s=Math.imul(U,ne),n=n+Math.imul(O,se)|0,i=(i=i+Math.imul(O,oe)|0)+Math.imul(N,se)|0,s=s+Math.imul(N,oe)|0,n=n+Math.imul(R,ue)|0,i=(i=i+Math.imul(R,he)|0)+Math.imul(k,ue)|0,s=s+Math.imul(k,he)|0,n=n+Math.imul(_,le)|0,i=(i=i+Math.imul(_,ce)|0)+Math.imul(B,le)|0,s=s+Math.imul(B,ce)|0;var Be=(h+(n=n+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(T,pe)|0))<<13)|0;h=((s=s+Math.imul(T,me)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(L,se),i=(i=Math.imul(L,oe))+Math.imul(U,se)|0,s=Math.imul(U,oe),n=n+Math.imul(O,ue)|0,i=(i=i+Math.imul(O,he)|0)+Math.imul(N,ue)|0,s=s+Math.imul(N,he)|0,n=n+Math.imul(R,le)|0,i=(i=i+Math.imul(R,ce)|0)+Math.imul(k,le)|0,s=s+Math.imul(k,ce)|0;var xe=(h+(n=n+Math.imul(_,pe)|0)|0)+((8191&(i=(i=i+Math.imul(_,me)|0)+Math.imul(B,pe)|0))<<13)|0;h=((s=s+Math.imul(B,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(L,ue),i=(i=Math.imul(L,he))+Math.imul(U,ue)|0,s=Math.imul(U,he),n=n+Math.imul(O,le)|0,i=(i=i+Math.imul(O,ce)|0)+Math.imul(N,le)|0,s=s+Math.imul(N,ce)|0;var Re=(h+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,me)|0)+Math.imul(k,pe)|0))<<13)|0;h=((s=s+Math.imul(k,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(L,le),i=(i=Math.imul(L,ce))+Math.imul(U,le)|0,s=Math.imul(U,ce);var ke=(h+(n=n+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,me)|0)+Math.imul(N,pe)|0))<<13)|0;h=((s=s+Math.imul(N,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863;var De=(h+(n=Math.imul(L,pe))|0)+((8191&(i=(i=Math.imul(L,me))+Math.imul(U,pe)|0))<<13)|0;return h=((s=Math.imul(U,me))+(i>>>13)|0)+(De>>>26)|0,De&=67108863,u[0]=ge,u[1]=ye,u[2]=ve,u[3]=Ae,u[4]=we,u[5]=be,u[6]=Me,u[7]=Ee,u[8]=Se,u[9]=Ce,u[10]=Ie,u[11]=Te,u[12]=Pe,u[13]=_e,u[14]=Be,u[15]=xe,u[16]=Re,u[17]=ke,u[18]=De,0!==h&&(u[19]=h,r.length++),r};function g(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,s=0;s<r.length-1;s++){var o=i;i=0;for(var a=67108863&n,u=Math.min(s,t.length-1),h=Math.max(0,s-e.length+1);h<=u;h++){var f=s-h,l=(0|e.words[f])*(0|t.words[h]),c=67108863&l;a=67108863&(c=c+a|0),i+=(o=(o=o+(l/67108864|0)|0)+(c>>>26)|0)>>>26,o&=67108863}r.words[s]=a,n=o,o=i}return 0!==n?r.words[s]=n:r.length--,r._strip()}function y(e,t,r){return g(e,t,r)}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?p(this,e,t):r<1024?g(this,e,t):y(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),y(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),r("number"==typeof e),r(e<67108864);for(var n=0,i=0;i<this.length;i++){var s=(0|this.words[i])*e,o=(67108863&s)+(67108863&n);n>>=26,n+=s/67108864|0,n+=o>>>26,this.words[i]=67108863&o}return 0!==n&&(this.words[i]=n,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,i=r%26;t[r]=e.words[n]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var s=r.sqr();n<t.length;n++,s=s.sqr())0!==t[n]&&(r=r.mul(s));return r},i.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,s=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(t=0;t<this.length;t++){var a=this.words[t]&s,u=(0|this.words[t])-a<<n;this.words[t]=u|o,o=a>>>26-n}o&&(this.words[t]=o,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var s=e%26,o=Math.min((e-s)/26,this.length),a=67108863^67108863>>>s<<s,u=n;if(i-=o,i=Math.max(0,i),u){for(var h=0;h<o;h++)u.words[h]=this.words[h];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,h=0;h<this.length;h++)this.words[h]=this.words[h+o];else this.words[0]=0,this.length=1;var f=0;for(h=this.length-1;h>=0&&(0!==f||h>=i);h--){var l=0|this.words[h];this.words[h]=f<<26-s|l>>>s,f=l&a}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n||!(this.words[n]&i))},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,n){var i,s,o=e.length+n;this._expand(o);var a=0;for(i=0;i<e.length;i++){s=(0|this.words[i+n])+a;var u=(0|e.words[i])*t;a=((s-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&s}for(;i<this.length-n;i++)a=(s=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&s;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(s=-(0|this.words[i])+a)>>26,this.words[i]=67108863&s;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),s=e,o=0|s.words[s.length-1];0!=(r=26-this._countBits(o))&&(s=s.ushln(r),n.iushln(r),o=0|s.words[s.length-1]);var a,u=n.length-s.length;if("mod"!==t){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h<a.length;h++)a.words[h]=0}var f=n.clone()._ishlnsubmul(s,1,u);0===f.negative&&(n=f,a&&(a.words[u]=1));for(var l=u-1;l>=0;l--){var c=67108864*(0|n.words[s.length+l])+(0|n.words[s.length+l-1]);for(c=Math.min(c/o|0,67108863),n._ishlnsubmul(s,c,l);0!==n.negative;)c--,n.negative=0,n._ishlnsubmul(s,1,l),n.isZero()||(n.negative^=1);a&&(a.words[l]=c)}return a&&a._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(s=a.div.neg()),"div"!==t&&(o=a.mod.neg(),n&&0!==o.negative&&o.iadd(e)),{div:s,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(s=a.div.neg()),{div:s,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(o=a.mod.neg(),n&&0!==o.negative&&o.isub(e)),{div:a.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var s,o,a},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),s=r.cmp(n);return s<0||1===i&&0===s?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,s=this.length-1;s>=0;s--)i=(n*i+(0|this.words[s]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var s=(0|this.words[i])+67108864*n;this.words[i]=s/e|0,n=s%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var s=new i(1),o=new i(0),a=new i(0),u=new i(1),h=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++h;for(var f=n.clone(),l=t.clone();!t.isZero();){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)(s.isOdd()||o.isOdd())&&(s.iadd(f),o.isub(l)),s.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(l)),a.iushrn(1),u.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a),o.isub(u)):(n.isub(t),a.isub(s),u.isub(o))}return{a:a,b:u,gcd:n.iushln(h)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var s,o=new i(1),a=new i(0),u=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var h=0,f=1;0==(t.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(t.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var l=0,c=1;0==(n.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(a)):(n.isub(t),a.isub(o))}return(s=0===t.cmpn(1)?o:a).cmpn(0)<0&&s.iadd(e),s},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var s=t;t=r,r=s}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var s=i,o=n;0!==s&&o<this.length;o++){var a=0|this.words[o];s=(a+=s)>>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new S(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function A(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){A.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){A.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){A.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){A.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function C(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}A.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},A.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},A.prototype.split=function(e,t){e.iushrn(this.n,0,t)},A.prototype.imulK=function(e){return e.imul(this.k)},n(w,A),w.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var s=e.words[9];for(t.words[t.length++]=s&r,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&r)<<4|s>>>22,s=o}s>>>=22,e.words[i-10]=s,0===s&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(b,A),n(M,A),n(E,A),E.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new b;else if("p192"===e)t=new M;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return v[e]=t,t},S.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(h(e,e.umod(this.m)._forceRed(this)),e)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var s=this.m.subn(1),o=0;!s.isZero()&&0===s.andln(1);)o++,s.iushrn(1);r(!s.isZero());var a=new i(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,s),c=this.pow(e,s.addn(1).iushrn(1)),d=this.pow(e,s),p=o;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(l,new i(1).iushln(p-g-1));c=c.redMul(y),l=y.redSqr(),d=d.redMul(l),p=g}return c},S.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},S.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var s=r[0],o=0,a=0,u=t.bitLength()%26;for(0===u&&(u=26),n=t.length-1;n>=0;n--){for(var h=t.words[n],f=u-1;f>=0;f--){var l=h>>f&1;s!==r[0]&&(s=this.sqr(s)),0!==l||0!==o?(o<<=1,o|=l,(4==++a||0===n&&0===f)&&(s=this.mul(s,r[o]),a=0,o=0)):a=0}u=26}return s},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new C(e)},n(C,S),C.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},C.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},C.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},C.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(n).iushrn(this.shift),o=s;return s.cmp(this.m)>=0?o=s.isub(this.m):s.cmpn(0)<0&&(o=s.iadd(this.m)),o._forceRed(this)},C.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(tn,s);var rn=tn.exports;function nn(e,t,r){return r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},e(r,r.exports),r.exports}var sn=on;function on(e,t){if(!e)throw new Error(t||"Assertion failed")}on.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var an=nn((function(e,t){var r=t;function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(n=0;n<e.length;n++){var i=e.charCodeAt(n),s=i>>8,o=255&i;s?r.push(s,o):r.push(o)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}})),un=nn((function(e,t){var r=t;r.assert=sn,r.toArray=an.toArray,r.zero2=an.zero2,r.toHex=an.toHex,r.encode=an.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<<t+1,s=e.clone(),o=0;o<n.length;o++){var a,u=s.andln(i-1);s.isOdd()?(a=u>(i>>1)-1?(i>>1)-u:u,s.isubn(a)):a=0,n[o]=a,s.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,s=0;e.cmpn(-i)>0||t.cmpn(-s)>0;){var o,a,u=e.andln(3)+i&3,h=t.andln(3)+s&3;3===u&&(u=-1),3===h&&(h=-1),o=0==(1&u)?0:3!==(n=e.andln(7)+i&7)&&5!==n||2!==h?u:-u,r[0].push(o),a=0==(1&h)?0:3!==(n=t.andln(7)+s&7)&&5!==n||2!==u?h:-h,r[1].push(a),2*i===o+1&&(i=1-i),2*s===a+1&&(s=1-s),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new rn(e,"hex","le")}})),hn=un.getNAF,fn=un.getJSF,ln=un.assert;function cn(e,t){this.type=e,this.p=new rn(t.p,16),this.red=t.prime?rn.red(t.prime):rn.mont(this.p),this.zero=new rn(0).toRed(this.red),this.one=new rn(1).toRed(this.red),this.two=new rn(2).toRed(this.red),this.n=t.n&&new rn(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var dn=cn;function pn(e,t){this.curve=e,this.type=t,this.precomputed=null}cn.prototype.point=function(){throw new Error("Not implemented")},cn.prototype.validate=function(){throw new Error("Not implemented")},cn.prototype._fixedNafMul=function(e,t){ln(e.precomputed);var r=e._getDoubles(),n=hn(t,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var s,o,a=[];for(s=0;s<n.length;s+=r.step){o=0;for(var u=s+r.step-1;u>=s;u--)o=(o<<1)+n[u];a.push(o)}for(var h=this.jpoint(null,null,null),f=this.jpoint(null,null,null),l=i;l>0;l--){for(s=0;s<a.length;s++)(o=a[s])===l?f=f.mixedAdd(r.points[s]):o===-l&&(f=f.mixedAdd(r.points[s].neg()));h=h.add(f)}return h.toP()},cn.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var i=n.points,s=hn(t,r,this._bitLength),o=this.jpoint(null,null,null),a=s.length-1;a>=0;a--){for(var u=0;a>=0&&0===s[a];a--)u++;if(a>=0&&u++,o=o.dblp(u),a<0)break;var h=s[a];ln(0!==h),o="affine"===e.type?h>0?o.mixedAdd(i[h-1>>1]):o.mixedAdd(i[-h-1>>1].neg()):h>0?o.add(i[h-1>>1]):o.add(i[-h-1>>1].neg())}return"affine"===e.type?o.toP():o},cn.prototype._wnafMulAdd=function(e,t,r,n,i){var s,o,a,u=this._wnafT1,h=this._wnafT2,f=this._wnafT3,l=0;for(s=0;s<n;s++){var c=(a=t[s])._getNAFPoints(e);u[s]=c.wnd,h[s]=c.points}for(s=n-1;s>=1;s-=2){var d=s-1,p=s;if(1===u[d]&&1===u[p]){var m=[t[d],null,null,t[p]];0===t[d].y.cmp(t[p].y)?(m[1]=t[d].add(t[p]),m[2]=t[d].toJ().mixedAdd(t[p].neg())):0===t[d].y.cmp(t[p].y.redNeg())?(m[1]=t[d].toJ().mixedAdd(t[p]),m[2]=t[d].add(t[p].neg())):(m[1]=t[d].toJ().mixedAdd(t[p]),m[2]=t[d].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=fn(r[d],r[p]);for(l=Math.max(y[0].length,l),f[d]=new Array(l),f[p]=new Array(l),o=0;o<l;o++){var v=0|y[0][o],A=0|y[1][o];f[d][o]=g[3*(v+1)+(A+1)],f[p][o]=0,h[d]=m}}else f[d]=hn(r[d],u[d],this._bitLength),f[p]=hn(r[p],u[p],this._bitLength),l=Math.max(f[d].length,l),l=Math.max(f[p].length,l)}var w=this.jpoint(null,null,null),b=this._wnafT4;for(s=l;s>=0;s--){for(var M=0;s>=0;){var E=!0;for(o=0;o<n;o++)b[o]=0|f[o][s],0!==b[o]&&(E=!1);if(!E)break;M++,s--}if(s>=0&&M++,w=w.dblp(M),s<0)break;for(o=0;o<n;o++){var S=b[o];0!==S&&(S>0?a=h[o][S-1>>1]:S<0&&(a=h[o][-S-1>>1].neg()),w="affine"===a.type?w.mixedAdd(a):w.add(a))}}for(s=0;s<n;s++)h[s]=null;return i?w:w.toP()},cn.BasePoint=pn,pn.prototype.eq=function(){throw new Error("Not implemented")},pn.prototype.validate=function(){return this.curve.validate(this)},cn.prototype.decodePoint=function(e,t){e=un.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?ln(e[e.length-1]%2==0):7===e[0]&&ln(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},pn.prototype.encodeCompressed=function(e){return this.encode(e,!0)},pn.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},pn.prototype.encode=function(e,t){return un.encode(this._encode(t),e)},pn.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},pn.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},pn.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<t;i+=e){for(var s=0;s<e;s++)n=n.dbl();r.push(n)}return{step:e,points:r}},pn.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)t[i]=t[i-1].add(n);return{wnd:e,points:t}},pn.prototype._getBeta=function(){return null},pn.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var mn=nn((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}})),gn=un.assert;function yn(e){dn.call(this,"short",e),this.a=new rn(e.a,16).toRed(this.red),this.b=new rn(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}mn(yn,dn);var vn=yn;function An(e,t,r,n){dn.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new rn(t,16),this.y=new rn(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function wn(e,t,r,n){dn.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new rn(0)):(this.x=new rn(t,16),this.y=new rn(r,16),this.z=new rn(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}yn.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new rn(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new rn(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?r=i[0]:(r=i[1],gn(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new rn(e.a,16),b:new rn(e.b,16)}})):this._getEndoBasis(r)}}},yn.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:rn.mont(e),r=new rn(2).toRed(t).redInvm(),n=r.redNeg(),i=new rn(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},yn.prototype._getEndoBasis=function(e){for(var t,r,n,i,s,o,a,u,h,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=e,c=this.n.clone(),d=new rn(1),p=new rn(0),m=new rn(0),g=new rn(1),y=0;0!==l.cmpn(0);){var v=c.div(l);u=c.sub(v.mul(l)),h=m.sub(v.mul(d));var A=g.sub(v.mul(p));if(!n&&u.cmp(f)<0)t=a.neg(),r=d,n=u.neg(),i=h;else if(n&&2==++y)break;a=u,c=l,l=u,m=d,d=h,g=p,p=A}s=u.neg(),o=h;var w=n.sqr().add(i.sqr());return s.sqr().add(o.sqr()).cmp(w)>=0&&(s=t,o=r),n.negative&&(n=n.neg(),i=i.neg()),s.negative&&(s=s.neg(),o=o.neg()),[{a:n,b:i},{a:s,b:o}]},yn.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),s=r.b.neg().mul(e).divRound(this.n),o=i.mul(r.a),a=s.mul(n.a),u=i.mul(r.b),h=s.mul(n.b);return{k1:e.sub(o).sub(a),k2:u.add(h).neg()}},yn.prototype.pointFromX=function(e,t){(e=new rn(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},yn.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},yn.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s<e.length;s++){var o=this._endoSplit(t[s]),a=e[s],u=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),u=u.neg(!0)),n[2*s]=a,n[2*s+1]=u,i[2*s]=o.k1,i[2*s+1]=o.k2}for(var h=this._wnafMulAdd(1,n,i,2*s,r),f=0;f<2*s;f++)n[f]=null,i[f]=null;return h},mn(An,dn.BasePoint),yn.prototype.point=function(e,t,r){return new An(this,e,t,r)},yn.prototype.pointFromJSON=function(e,t){return An.fromJSON(this,e,t)},An.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},An.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},An.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function i(t){return e.point(t[0],t[1],r)}var s=t[2];return n.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[n].concat(s.doubles.points.map(i))},naf:s.naf&&{wnd:s.naf.wnd,points:[n].concat(s.naf.points.map(i))}},n},An.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},An.prototype.isInfinity=function(){return this.inf},An.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},An.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},An.prototype.getX=function(){return this.x.fromRed()},An.prototype.getY=function(){return this.y.fromRed()},An.prototype.mul=function(e){return e=new rn(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},An.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},An.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},An.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},An.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},An.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},mn(wn,dn.BasePoint),yn.prototype.jpoint=function(e,t,r){return new wn(this,e,t,r)},wn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},wn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},wn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),s=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=s.redSub(o);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=a.redSqr(),f=h.redMul(a),l=n.redMul(h),c=u.redSqr().redIAdd(f).redISub(l).redISub(l),d=u.redMul(l.redISub(c)).redISub(s.redMul(f)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(c,d,p)},wn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,s=e.y.redMul(t).redMul(this.z),o=r.redSub(n),a=i.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=o.redSqr(),h=u.redMul(o),f=r.redMul(u),l=a.redSqr().redIAdd(h).redISub(f).redISub(f),c=a.redMul(f.redISub(l)).redISub(i.redMul(h)),d=this.z.redMul(o);return this.curve.jpoint(l,c,d)},wn.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,s=this.x,o=this.y,a=this.z,u=a.redSqr().redSqr(),h=o.redAdd(o);for(t=0;t<e;t++){var f=s.redSqr(),l=h.redSqr(),c=l.redSqr(),d=f.redAdd(f).redIAdd(f).redIAdd(n.redMul(u)),p=s.redMul(l),m=d.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),y=d.redMul(g);y=y.redIAdd(y).redISub(c);var v=h.redMul(a);t+1<e&&(u=u.redMul(c)),s=m,a=v,h=y}return this.curve.jpoint(s,h.redMul(i),a)},wn.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},wn.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(n).redISub(s);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n),u=a.redSqr().redISub(o).redISub(o),h=s.redIAdd(s);h=(h=h.redIAdd(h)).redIAdd(h),e=u,t=a.redMul(o.redISub(u)).redISub(h),r=this.y.redAdd(this.y)}else{var f=this.x.redSqr(),l=this.y.redSqr(),c=l.redSqr(),d=this.x.redAdd(l).redSqr().redISub(f).redISub(c);d=d.redIAdd(d);var p=f.redAdd(f).redIAdd(f),m=p.redSqr(),g=c.redIAdd(c);g=(g=g.redIAdd(g)).redIAdd(g),e=m.redISub(d).redISub(d),t=p.redMul(d.redISub(e)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},wn.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(n).redISub(s);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=a.redSqr().redISub(o).redISub(o);e=u;var h=s.redIAdd(s);h=(h=h.redIAdd(h)).redIAdd(h),t=a.redMul(o.redISub(u)).redISub(h),r=this.y.redAdd(this.y)}else{var f=this.z.redSqr(),l=this.y.redSqr(),c=this.x.redMul(l),d=this.x.redSub(f).redMul(this.x.redAdd(f));d=d.redAdd(d).redIAdd(d);var p=c.redIAdd(c),m=(p=p.redIAdd(p)).redAdd(p);e=d.redSqr().redISub(m),r=this.y.redAdd(this.z).redSqr().redISub(l).redISub(f);var g=l.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=d.redMul(p.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,r)},wn.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),s=t.redSqr(),o=r.redSqr(),a=s.redAdd(s).redIAdd(s).redIAdd(e.redMul(i)),u=t.redAdd(t),h=(u=u.redIAdd(u)).redMul(o),f=a.redSqr().redISub(h.redAdd(h)),l=h.redISub(f),c=o.redSqr();c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var d=a.redMul(l).redISub(c),p=r.redAdd(r).redMul(n);return this.curve.jpoint(f,d,p)},wn.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),i=e.redAdd(e).redIAdd(e),s=i.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(n),a=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(s)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var h=i.redIAdd(o).redSqr().redISub(s).redISub(a).redISub(u),f=t.redMul(h);f=(f=f.redIAdd(f)).redIAdd(f);var l=this.x.redMul(a).redISub(f);l=(l=l.redIAdd(l)).redIAdd(l);var c=this.y.redMul(h.redMul(u.redISub(h)).redISub(o.redMul(a)));c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var d=this.z.redAdd(o).redSqr().redISub(r).redISub(a);return this.curve.jpoint(l,c,d)},wn.prototype.mul=function(e,t){return e=new rn(e,t),this.curve._wnafMul(this,e)},wn.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),i=r.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(n)).cmpn(0)},wn.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),i=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},wn.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},wn.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var bn=nn((function(e,t){var r=t;r.base=dn,r.short=vn,r.mont=null,r.edwards=null})),Mn=nn((function(e,t){var r,n=t,i=un.assert;function s(e){"short"===e.type?this.curve=new bn.short(e):"edwards"===e.type?this.curve=new bn.edwards(e):this.curve=new bn.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function o(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new s(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=s,o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:me.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:me.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:me.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:me.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:me.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:me.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:me.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(e){r=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:me.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function En(e){if(!(this instanceof En))return new En(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=an.toArray(e.entropy,e.entropyEnc||"hex"),r=an.toArray(e.nonce,e.nonceEnc||"hex"),n=an.toArray(e.pers,e.persEnc||"hex");sn(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var Sn=En;En.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},En.prototype._hmac=function(){return new me.hmac(this.hash,this.K)},En.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},En.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=an.toArray(e,t),r=an.toArray(r,n),sn(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},En.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=an.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var s=i.slice(0,e);return this._update(r),this._reseed++,an.encode(s,t)};var Cn=un.assert;function In(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var Tn=In;In.fromPublic=function(e,t,r){return t instanceof In?t:new In(e,{pub:t,pubEnc:r})},In.fromPrivate=function(e,t,r){return t instanceof In?t:new In(e,{priv:t,privEnc:r})},In.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},In.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},In.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},In.prototype._importPrivate=function(e,t){this.priv=new rn(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},In.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?Cn(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||Cn(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},In.prototype.derive=function(e){return e.validate()||Cn(e.validate(),"public point not validated"),e.mul(this.priv).getX()},In.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},In.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},In.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Pn=un.assert;function _n(e,t){if(e instanceof _n)return e;this._importDER(e,t)||(Pn(e.r&&e.s,"Signature without r or s"),this.r=new rn(e.r,16),this.s=new rn(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var Bn=_n;function xn(){this.place=0}function Rn(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,s=0,o=t.place;s<n;s++,o++)i<<=8,i|=e[o],i>>>=0;return!(i<=127)&&(t.place=o,i)}function kn(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function Dn(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}_n.prototype._importDER=function(e,t){e=un.toArray(e,t);var r=new xn;if(48!==e[r.place++])return!1;var n=Rn(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=Rn(e,r);if(!1===i)return!1;var s=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var o=Rn(e,r);if(!1===o)return!1;if(e.length!==o+r.place)return!1;var a=e.slice(r.place,o+r.place);if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new rn(s),this.s=new rn(a),this.recoveryParam=null,!0},_n.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=kn(t),r=kn(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];Dn(n,t.length),(n=n.concat(t)).push(2),Dn(n,r.length);var i=n.concat(r),s=[48];return Dn(s,i.length),s=s.concat(i),un.encode(s,e)};var On=function(){throw new Error("unsupported")},Nn=un.assert;function Fn(e){if(!(this instanceof Fn))return new Fn(e);"string"==typeof e&&(Nn(Object.prototype.hasOwnProperty.call(Mn,e),"Unknown curve "+e),e=Mn[e]),e instanceof Mn.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var Ln=Fn;Fn.prototype.keyPair=function(e){return new Tn(this,e)},Fn.prototype.keyFromPrivate=function(e,t){return Tn.fromPrivate(this,e,t)},Fn.prototype.keyFromPublic=function(e,t){return Tn.fromPublic(this,e,t)},Fn.prototype.genKeyPair=function(e){e||(e={});for(var t=new Sn({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||On(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new rn(2));;){var i=new rn(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Fn.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},Fn.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new rn(e,16));for(var i=this.n.byteLength(),s=t.getPrivate().toArray("be",i),o=e.toArray("be",i),a=new Sn({hash:this.hash,entropy:s,nonce:o,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new rn(1)),h=0;;h++){var f=n.k?n.k(h):new rn(a.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(u)>=0)){var l=this.g.mul(f);if(!l.isInfinity()){var c=l.getX(),d=c.umod(this.n);if(0!==d.cmpn(0)){var p=f.invm(this.n).mul(d.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(l.getY().isOdd()?1:0)|(0!==c.cmp(d)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new Bn({r:d,s:p,recoveryParam:m})}}}}}},Fn.prototype.verify=function(e,t,r,n){e=this._truncateToN(new rn(e,16)),r=this.keyFromPublic(r,n);var i=(t=new Bn(t,"hex")).r,s=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var o,a=s.invm(this.n),u=a.mul(e).umod(this.n),h=a.mul(i).umod(this.n);return this.curve._maxwellTrick?!(o=this.g.jmulAdd(u,r.getPublic(),h)).isInfinity()&&o.eqXToP(i):!(o=this.g.mulAdd(u,r.getPublic(),h)).isInfinity()&&0===o.getX().umod(this.n).cmp(i)},Fn.prototype.recoverPubKey=function(e,t,r,n){Nn((3&r)===r,"The recovery param is more than two bits"),t=new Bn(t,n);var i=this.n,s=new rn(e),o=t.r,a=t.s,u=1&r,h=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");o=h?this.curve.pointFromX(o.add(this.curve.n),u):this.curve.pointFromX(o,u);var f=t.r.invm(i),l=i.sub(s).mul(f).umod(i),c=a.mul(f).umod(i);return this.g.mulAdd(l,o,c)},Fn.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new Bn(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(e,t,i)}catch(e){continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var Un=nn((function(e,t){var r=t;r.version="6.5.4",r.utils=un,r.rand=function(){throw new Error("unsupported")},r.curve=bn,r.curves=Mn,r.ec=Ln,r.eddsa=null})),Hn=Un.ec;const qn=new A("signing-key/5.7.0");let Gn=null;function Kn(){return Gn||(Gn=new Hn("secp256k1")),Gn}class jn{constructor(e){c(this,"curve","secp256k1"),c(this,"privateKey",re(e)),32!==oe(this.privateKey)&&qn.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Kn().keyFromPrivate(ee(this.privateKey));c(this,"publicKey","0x"+t.getPublic(!1,"hex")),c(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),c(this,"_isSigningKey",!0)}_addPoint(e){const t=Kn().keyFromPublic(ee(this.publicKey)),r=Kn().keyFromPublic(ee(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=Kn().keyFromPrivate(ee(this.privateKey)),r=ee(e);32!==r.length&&qn.throwArgumentError("bad digest length","digest",e);const n=t.sign(r,{canonical:!0});return ae({recoveryParam:n.recoveryParam,r:$("0x"+n.r.toString(16),32),s:$("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=Kn().keyFromPrivate(ee(this.privateKey)),r=Kn().keyFromPublic(ee(zn(e)));return $("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function zn(e,t){const r=ee(e);if(32===r.length){const e=new jn(r);return t?"0x"+Kn().keyFromPrivate(r).getPublic(!0,"hex"):e.publicKey}return 33===r.length?t?re(r):"0x"+Kn().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?t?"0x"+Kn().keyFromPublic(r).getPublic(!0,"hex"):re(r):qn.throwArgumentError("invalid public or private key","key","[REDACTED]")}const Qn=new A("wordlists/5.7.0");class Wn{constructor(e){Qn.checkAbstract(new.target,Wn),c(this,"locale",e)}split(e){return e.toLowerCase().split(/ +/g)}join(e){return e.join(" ")}static check(e){const t=[];for(let r=0;r<2048;r++){const n=e.getWord(r);if(r!==e.getWordIndex(n))return"0x";t.push(n)}return _(t.join("\n")+"\n")}static register(e,t){t||(t=e.locale)}}let Jn=null;function Vn(e){if(null==Jn&&(Jn="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==Wn.check(e)))throw Jn=null,new Error("BIP39 Wordlist for en (English) FAILED")}const Yn=new class extends Wn{constructor(){super("en")}getWord(e){return Vn(this),Jn[e]}getWordIndex(e){return Vn(this),Jn.indexOf(e)}};Wn.register(Yn);const Xn={en:Yn},Zn=new A("hdnode/5.7.0"),$n=b.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),ei=E("Bitcoin seed"),ti=2147483648;function ri(e){return(1<<e)-1<<8-e}function ni(e){return $(re(e),32)}function ii(e){return Jr.encode(ne([e,ue(Zr(Zr(e)),0,4)]))}function si(e){if(null==e)return Xn.en;if("string"==typeof e){const t=Xn[e];return null==t&&Zn.throwArgumentError("unknown locale","wordlist",e),t}return e}const oi={},ai="m/44'/60'/0'/0/0";class ui{constructor(e,t,r,n,i,s,o,a){if(e!==oi)throw new Error("HDNode constructor cannot be called directly");if(t){const e=new jn(t);c(this,"privateKey",e.privateKey),c(this,"publicKey",e.compressedPublicKey)}else c(this,"privateKey",null),c(this,"publicKey",re(r));c(this,"parentFingerprint",n),c(this,"fingerprint",ue(Xr(Zr(this.publicKey)),0,4)),c(this,"address",ge(this.publicKey)),c(this,"chainCode",i),c(this,"index",s),c(this,"depth",o),null==a?(c(this,"mnemonic",null),c(this,"path",null)):"string"==typeof a?(c(this,"mnemonic",null),c(this,"path",a)):(c(this,"mnemonic",a),c(this,"path",a.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return ii(ne([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",re(this.depth),this.parentFingerprint,$(re(this.index),4),this.chainCode,null!=this.privateKey?ne(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new ui(oi,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(e){if(e>4294967295)throw new Error("invalid index - "+String(e));let t=this.path;t&&(t+="/"+(2147483647&e));const r=new Uint8Array(37);if(e&ti){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set(ee(this.privateKey),1),t&&(t+="'")}else r.set(ee(this.publicKey));for(let t=24;t>=0;t-=8)r[33+(t>>3)]=e>>24-t&255;const n=ee($r(Vr.sha512,this.chainCode,r)),i=n.slice(0,32),s=n.slice(32);let o=null,a=null;if(this.privateKey)o=ni(b.from(i).add(this.privateKey).mod($n));else{a=new jn(re(i))._addPoint(this.publicKey)}let u=t;const h=this.mnemonic;return h&&(u=Object.freeze({phrase:h.phrase,path:t,locale:h.locale||"en"})),new ui(oi,o,a,this.fingerprint,ni(s),e,this.depth+1,u)}derivePath(e){const t=e.split("/");if(0===t.length||"m"===t[0]&&0!==this.depth)throw new Error("invalid path - "+e);"m"===t[0]&&t.shift();let r=this;for(let e=0;e<t.length;e++){const n=t[e];if(n.match(/^[0-9]+'$/)){const e=parseInt(n.substring(0,n.length-1));if(e>=ti)throw new Error("invalid path index - "+n);r=r._derive(ti+e)}else{if(!n.match(/^[0-9]+$/))throw new Error("invalid path component - "+n);{const e=parseInt(n);if(e>=ti)throw new Error("invalid path index - "+n);r=r._derive(e)}}}return r}static _fromSeed(e,t){const r=ee(e);if(r.length<16||r.length>64)throw new Error("invalid seed");const n=ee($r(Vr.sha512,ei,r));return new ui(oi,ni(n.slice(0,32)),null,"0x00000000",ni(n.slice(32)),0,0,t)}static fromMnemonic(e,t,r){return e=li(fi(e,r=si(r)),r),ui._fromSeed(hi(e,t),{phrase:e,path:"m",locale:r.locale})}static fromSeed(e){return ui._fromSeed(e,null)}static fromExtendedKey(e){const t=Jr.decode(e);82===t.length&&ii(t.slice(0,78))===e||Zn.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const r=t[4],n=re(t.slice(5,9)),i=parseInt(re(t.slice(9,13)).substring(2),16),s=re(t.slice(13,45)),o=t.slice(45,78);switch(re(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new ui(oi,null,re(o),n,s,i,r,null);case"0x0488ade4":case"0x04358394 ":if(0!==o[0])break;return new ui(oi,re(o.slice(1)),null,n,s,i,r,null)}return Zn.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function hi(e,t){t||(t="");const r=E("mnemonic"+t,I.NFKD);return en(E(e,I.NFKD),r,2048,64,"sha512")}function fi(e,t){t=si(t),Zn.checkNormalize();const r=t.split(e);if(r.length%3!=0)throw new Error("invalid mnemonic");const n=ee(new Uint8Array(Math.ceil(11*r.length/8)));let i=0;for(let e=0;e<r.length;e++){let s=t.getWordIndex(r[e].normalize("NFKD"));if(-1===s)throw new Error("invalid mnemonic");for(let e=0;e<11;e++)s&1<<10-e&&(n[i>>3]|=1<<7-i%8),i++}const s=32*r.length/3,o=ri(r.length/3);if((ee(Zr(n.slice(0,s/8)))[0]&o)!==(n[n.length-1]&o))throw new Error("invalid checksum");return re(n.slice(0,s/8))}function li(e,t){if(t=si(t),(e=ee(e)).length%4!=0||e.length<16||e.length>32)throw new Error("invalid entropy");const r=[0];let n=11;for(let t=0;t<e.length;t++)n>8?(r[r.length-1]<<=8,r[r.length-1]|=e[t],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=e[t]>>8-n,r.push(e[t]&(1<<8-n)-1),n+=3);const i=e.length/4,s=ee(Zr(e))[0]&ri(i);return r[r.length-1]<<=i,r[r.length-1]|=s>>8-i,t.join(r.map((e=>t.getWord(e))))}const ci=new A("random/5.7.0");const di=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}();let pi=di.crypto||di.msCrypto;function mi(e){(e<=0||e>1024||e%1||e!=e)&&ci.throwArgumentError("invalid length","length",e);const t=new Uint8Array(e);return pi.getRandomValues(t),ee(t)}pi&&pi.getRandomValues||(ci.warn("WARNING: Missing strong random number source"),pi={getRandomValues:function(e){return ci.throwError("no secure random source avaialble",A.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});var gi,yi={exports:{}};gi=yi,function(e){function t(e){return parseInt(e)===e}function r(e){if(!t(e.length))return!1;for(var r=0;r<e.length;r++)if(!t(e[r])||e[r]<0||e[r]>255)return!1;return!0}function n(e,n){if(e.buffer&&ArrayBuffer.isView(e)&&"Uint8Array"===e.name)return n&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!r(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(t(e.length)&&r(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function i(e){return new Uint8Array(e)}function s(e,t,r,n,i){null==n&&null==i||(e=e.slice?e.slice(n,i):Array.prototype.slice.call(e,n,i)),t.set(e,r)}var o,a={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r<e.length;){var i=e.charCodeAt(r++);37===i?(t.push(parseInt(e.substr(r,2),16)),r+=2):t.push(i)}return n(t)},fromBytes:function(e){for(var t=[],r=0;r<e.length;){var n=e[r];n<128?(t.push(String.fromCharCode(n)),r++):n>191&&n<224?(t.push(String.fromCharCode((31&n)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&n)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},u=(o="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(parseInt(e.substr(r,2),16));return t},fromBytes:function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];t.push(o[(240&n)>>4]+o[15&n])}return t.join("")}}),h={16:10,24:12,32:14},f=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],l=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],c=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],d=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],p=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],m=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],g=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],y=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],v=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],A=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],w=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],b=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],M=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],E=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],S=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function C(e){for(var t=[],r=0;r<e.length;r+=4)t.push(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]);return t}var I=function(e){if(!(this instanceof I))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:n(e,!0)}),this._prepare()};I.prototype._prepare=function(){var e=h[this.key.length];if(null==e)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var t=0;t<=e;t++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var r,n=4*(e+1),i=this.key.length/4,s=C(this.key);for(t=0;t<i;t++)r=t>>2,this._Ke[r][t%4]=s[t],this._Kd[e-r][t%4]=s[t];for(var o,a=0,u=i;u<n;){if(o=s[i-1],s[0]^=l[o>>16&255]<<24^l[o>>8&255]<<16^l[255&o]<<8^l[o>>24&255]^f[a]<<24,a+=1,8!=i)for(t=1;t<i;t++)s[t]^=s[t-1];else{for(t=1;t<i/2;t++)s[t]^=s[t-1];for(o=s[i/2-1],s[i/2]^=l[255&o]^l[o>>8&255]<<8^l[o>>16&255]<<16^l[o>>24&255]<<24,t=i/2+1;t<i;t++)s[t]^=s[t-1]}for(t=0;t<i&&u<n;)c=u>>2,d=u%4,this._Ke[c][d]=s[t],this._Kd[e-c][d]=s[t++],u++}for(var c=1;c<e;c++)for(var d=0;d<4;d++)o=this._Kd[c][d],this._Kd[c][d]=b[o>>24&255]^M[o>>16&255]^E[o>>8&255]^S[255&o]},I.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],n=C(e),s=0;s<4;s++)n[s]^=this._Ke[0][s];for(var o=1;o<t;o++){for(s=0;s<4;s++)r[s]=d[n[s]>>24&255]^p[n[(s+1)%4]>>16&255]^m[n[(s+2)%4]>>8&255]^g[255&n[(s+3)%4]]^this._Ke[o][s];n=r.slice()}var a,u=i(16);for(s=0;s<4;s++)a=this._Ke[t][s],u[4*s]=255&(l[n[s]>>24&255]^a>>24),u[4*s+1]=255&(l[n[(s+1)%4]>>16&255]^a>>16),u[4*s+2]=255&(l[n[(s+2)%4]>>8&255]^a>>8),u[4*s+3]=255&(l[255&n[(s+3)%4]]^a);return u},I.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],n=C(e),s=0;s<4;s++)n[s]^=this._Kd[0][s];for(var o=1;o<t;o++){for(s=0;s<4;s++)r[s]=y[n[s]>>24&255]^v[n[(s+3)%4]>>16&255]^A[n[(s+2)%4]>>8&255]^w[255&n[(s+1)%4]]^this._Kd[o][s];n=r.slice()}var a,u=i(16);for(s=0;s<4;s++)a=this._Kd[t][s],u[4*s]=255&(c[n[s]>>24&255]^a>>24),u[4*s+1]=255&(c[n[(s+3)%4]>>16&255]^a>>16),u[4*s+2]=255&(c[n[(s+2)%4]>>8&255]^a>>8),u[4*s+3]=255&(c[255&n[(s+1)%4]]^a);return u};var T=function(e){if(!(this instanceof T))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new I(e)};T.prototype.encrypt=function(e){if((e=n(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=i(e.length),r=i(16),o=0;o<e.length;o+=16)s(e,r,0,o,o+16),s(r=this._aes.encrypt(r),t,o);return t},T.prototype.decrypt=function(e){if((e=n(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=i(e.length),r=i(16),o=0;o<e.length;o+=16)s(e,r,0,o,o+16),s(r=this._aes.decrypt(r),t,o);return t};var P=function(e,t){if(!(this instanceof P))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=i(16);this._lastCipherblock=n(t,!0),this._aes=new I(e)};P.prototype.encrypt=function(e){if((e=n(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=i(e.length),r=i(16),o=0;o<e.length;o+=16){s(e,r,0,o,o+16);for(var a=0;a<16;a++)r[a]^=this._lastCipherblock[a];this._lastCipherblock=this._aes.encrypt(r),s(this._lastCipherblock,t,o)}return t},P.prototype.decrypt=function(e){if((e=n(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=i(e.length),r=i(16),o=0;o<e.length;o+=16){s(e,r,0,o,o+16),r=this._aes.decrypt(r);for(var a=0;a<16;a++)t[o+a]=r[a]^this._lastCipherblock[a];s(e,this._lastCipherblock,0,o,o+16)}return t};var _=function(e,t,r){if(!(this instanceof _))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 size)")}else t=i(16);r||(r=1),this.segmentSize=r,this._shiftRegister=n(t,!0),this._aes=new I(e)};_.prototype.encrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t,r=n(e,!0),i=0;i<r.length;i+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var o=0;o<this.segmentSize;o++)r[i+o]^=t[o];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(r,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return r},_.prototype.decrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var t,r=n(e,!0),i=0;i<r.length;i+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var o=0;o<this.segmentSize;o++)r[i+o]^=t[o];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(e,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return r};var B=function(e,t){if(!(this instanceof B))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=i(16);this._lastPrecipher=n(t,!0),this._lastPrecipherIndex=16,this._aes=new I(e)};B.prototype.encrypt=function(e){for(var t=n(e,!0),r=0;r<t.length;r++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),t[r]^=this._lastPrecipher[this._lastPrecipherIndex++];return t},B.prototype.decrypt=B.prototype.encrypt;var x=function(e){if(!(this instanceof x))throw Error("Counter must be instanitated with `new`");0===e||e||(e=1),"number"==typeof e?(this._counter=i(16),this.setValue(e)):this.setBytes(e)};x.prototype.setValue=function(e){if("number"!=typeof e||parseInt(e)!=e)throw new Error("invalid counter value (must be an integer)");for(var t=15;t>=0;--t)this._counter[t]=e%256,e>>=8},x.prototype.setBytes=function(e){if(16!=(e=n(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},x.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var R=function(e,t){if(!(this instanceof R))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof x||(t=new x(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new I(e)};R.prototype.encrypt=function(e){for(var t=n(e,!0),r=0;r<t.length;r++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),t[r]^=this._remainingCounter[this._remainingCounterIndex++];return t},R.prototype.decrypt=R.prototype.encrypt;var k={AES:I,Counter:x,ModeOfOperation:{ecb:T,cbc:P,cfb:_,ofb:B,ctr:R},utils:{hex:u,utf8:a},padding:{pkcs7:{pad:function(e){var t=16-(e=n(e,!0)).length%16,r=i(e.length+t);s(e,r);for(var o=e.length;o<r.length;o++)r[o]=t;return r},strip:function(e){if((e=n(e,!0)).length<16)throw new Error("PKCS#7 invalid length");var t=e[e.length-1];if(t>16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,o=0;o<t;o++)if(e[r+o]!==t)throw new Error("PKCS#7 invalid padding byte");var a=i(r);return s(e,a,0,0,r),a}}},_arrayTest:{coerceArray:n,createArray:i,copyArray:s}};gi.exports=k}();var vi=yi.exports;const Ai="json-wallets/5.7.0";function wi(e){return"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),ee(e)}function bi(e,t){for(e=String(e);e.length<t;)e="0"+e;return e}function Mi(e){return"string"==typeof e?E(e,I.NFKC):ee(e)}function Ei(e,t){let r=e;const n=t.toLowerCase().split("/");for(let e=0;e<n.length;e++){let t=null;for(const i in r)if(i.toLowerCase()===n[e]){t=r[i];break}if(null===t)return null;r=t}return r}function Si(e){const t=ee(e);t[6]=15&t[6]|64,t[8]=63&t[8]|128;const r=re(t);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}const Ci=new A(Ai);class Ii extends g{isCrowdsaleAccount(e){return!(!e||!e._isCrowdsaleAccount)}}function Ti(e,t){const r=JSON.parse(e);t=Mi(t);const n=J(Ei(r,"ethaddr")),i=wi(Ei(r,"encseed"));i&&i.length%16==0||Ci.throwArgumentError("invalid encseed","json",e);const s=ee(en(t,t,2e3,32,"sha256")).slice(0,16),o=i.slice(0,16),a=i.slice(16),u=new vi.ModeOfOperation.cbc(s,o),h=vi.padding.pkcs7.strip(ee(u.decrypt(a)));let f="";for(let e=0;e<h.length;e++)f+=String.fromCharCode(h[e]);const l=E(f),c=P(l);return new Ii({_isCrowdsaleAccount:!0,address:n,privateKey:c})}function Pi(e){let t=null;try{t=JSON.parse(e)}catch(e){return!1}return t.encseed&&t.ethaddr}function _i(e){let t=null;try{t=JSON.parse(e)}catch(e){return!1}return!(!t.version||parseInt(t.version)!==t.version||3!==parseInt(t.version))}var Bi={exports:{}};!function(e,t){!function(t){const r=2147483647;function n(e){const t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);let r=1779033703,n=3144134277,i=1013904242,s=2773480762,o=1359893119,a=2600822924,u=528734635,h=1541459225;const f=new Uint32Array(64);function l(e){let l=0,c=e.length;for(;c>=64;){let d,p,m,g,y,v=r,A=n,w=i,b=s,M=o,E=a,S=u,C=h;for(p=0;p<16;p++)m=l+4*p,f[p]=(255&e[m])<<24|(255&e[m+1])<<16|(255&e[m+2])<<8|255&e[m+3];for(p=16;p<64;p++)d=f[p-2],g=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,d=f[p-15],y=(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3,f[p]=(g+f[p-7]|0)+(y+f[p-16]|0)|0;for(p=0;p<64;p++)g=(((M>>>6|M<<26)^(M>>>11|M<<21)^(M>>>25|M<<7))+(M&E^~M&S)|0)+(C+(t[p]+f[p]|0)|0)|0,y=((v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10))+(v&A^v&w^A&w)|0,C=S,S=E,E=M,M=b+g|0,b=w,w=A,A=v,v=g+y|0;r=r+v|0,n=n+A|0,i=i+w|0,s=s+b|0,o=o+M|0,a=a+E|0,u=u+S|0,h=h+C|0,l+=64,c-=64}}l(e);let c,d=e.length%64,p=e.length/536870912|0,m=e.length<<3,g=d<56?56:120,y=e.slice(e.length-d,e.length);for(y.push(128),c=d+1;c<g;c++)y.push(0);return y.push(p>>>24&255),y.push(p>>>16&255),y.push(p>>>8&255),y.push(p>>>0&255),y.push(m>>>24&255),y.push(m>>>16&255),y.push(m>>>8&255),y.push(m>>>0&255),l(y),[r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255,h>>>24&255,h>>>16&255,h>>>8&255,h>>>0&255]}function i(e,t,r){e=e.length<=64?e:n(e);const i=64+t.length+4,s=new Array(i),o=new Array(64);let a,u=[];for(a=0;a<64;a++)s[a]=54;for(a=0;a<e.length;a++)s[a]^=e[a];for(a=0;a<t.length;a++)s[64+a]=t[a];for(a=i-4;a<i;a++)s[a]=0;for(a=0;a<64;a++)o[a]=92;for(a=0;a<e.length;a++)o[a]^=e[a];function h(){for(let e=i-1;e>=i-4;e--){if(s[e]++,s[e]<=255)return;s[e]=0}}for(;r>=32;)h(),u=u.concat(n(o.concat(n(s)))),r-=32;return r>0&&(h(),u=u.concat(n(o.concat(n(s))).slice(0,r))),u}function s(e,t,r,n,i){let s;for(h(e,16*(2*r-1),i,0,16),s=0;s<2*r;s++)u(e,16*s,i,16),a(i,n),h(i,0,e,t+16*s,16);for(s=0;s<r;s++)h(e,t+2*s*16,e,16*s,16);for(s=0;s<r;s++)h(e,t+16*(2*s+1),e,16*(s+r),16)}function o(e,t){return e<<t|e>>>32-t}function a(e,t){h(e,0,t,0,16);for(let e=8;e>0;e-=2)t[4]^=o(t[0]+t[12],7),t[8]^=o(t[4]+t[0],9),t[12]^=o(t[8]+t[4],13),t[0]^=o(t[12]+t[8],18),t[9]^=o(t[5]+t[1],7),t[13]^=o(t[9]+t[5],9),t[1]^=o(t[13]+t[9],13),t[5]^=o(t[1]+t[13],18),t[14]^=o(t[10]+t[6],7),t[2]^=o(t[14]+t[10],9),t[6]^=o(t[2]+t[14],13),t[10]^=o(t[6]+t[2],18),t[3]^=o(t[15]+t[11],7),t[7]^=o(t[3]+t[15],9),t[11]^=o(t[7]+t[3],13),t[15]^=o(t[11]+t[7],18),t[1]^=o(t[0]+t[3],7),t[2]^=o(t[1]+t[0],9),t[3]^=o(t[2]+t[1],13),t[0]^=o(t[3]+t[2],18),t[6]^=o(t[5]+t[4],7),t[7]^=o(t[6]+t[5],9),t[4]^=o(t[7]+t[6],13),t[5]^=o(t[4]+t[7],18),t[11]^=o(t[10]+t[9],7),t[8]^=o(t[11]+t[10],9),t[9]^=o(t[8]+t[11],13),t[10]^=o(t[9]+t[8],18),t[12]^=o(t[15]+t[14],7),t[13]^=o(t[12]+t[15],9),t[14]^=o(t[13]+t[12],13),t[15]^=o(t[14]+t[13],18);for(let r=0;r<16;++r)e[r]+=t[r]}function u(e,t,r,n){for(let i=0;i<n;i++)r[i]^=e[t+i]}function h(e,t,r,n,i){for(;i--;)r[n++]=e[t++]}function f(e){if(!e||"number"!=typeof e.length)return!1;for(let t=0;t<e.length;t++){const r=e[t];if("number"!=typeof r||r%1||r<0||r>=256)return!1}return!0}function l(e,t){if("number"!=typeof e||e%1)throw new Error("invalid "+t);return e}function c(e,t,n,o,a,c,d){if(n=l(n,"N"),o=l(o,"r"),a=l(a,"p"),c=l(c,"dkLen"),0===n||0!=(n&n-1))throw new Error("N must be power of 2");if(n>r/128/o)throw new Error("N too large");if(o>r/128/a)throw new Error("r too large");if(!f(e))throw new Error("password must be an array or buffer");if(e=Array.prototype.slice.call(e),!f(t))throw new Error("salt must be an array or buffer");t=Array.prototype.slice.call(t);let p=i(e,t,128*a*o);const m=new Uint32Array(32*a*o);for(let e=0;e<m.length;e++){const t=4*e;m[e]=(255&p[t+3])<<24|(255&p[t+2])<<16|(255&p[t+1])<<8|(255&p[t+0])<<0}const g=new Uint32Array(64*o),y=new Uint32Array(32*o*n),v=32*o,A=new Uint32Array(16),w=new Uint32Array(16),b=a*n*2;let M,E,S=0,C=null,I=!1,T=0,P=0;const _=d?parseInt(1e3/o):4294967295,B="undefined"!=typeof setImmediate?setImmediate:setTimeout,x=function(){if(I)return d(new Error("cancelled"),S/b);let t;switch(T){case 0:E=32*P*o,h(m,E,g,0,v),T=1,M=0;case 1:t=n-M,t>_&&(t=_);for(let e=0;e<t;e++)h(g,0,y,(M+e)*v,v),s(g,v,o,A,w);if(M+=t,S+=t,d){const e=parseInt(1e3*S/b);if(e!==C){if(I=d(null,S/b),I)break;C=e}}if(M<n)break;M=0,T=2;case 2:t=n-M,t>_&&(t=_);for(let e=0;e<t;e++){const e=g[16*(2*o-1)]&n-1;u(y,e*v,g,v),s(g,v,o,A,w)}if(M+=t,S+=t,d){const e=parseInt(1e3*S/b);if(e!==C){if(I=d(null,S/b),I)break;C=e}}if(M<n)break;if(h(g,0,m,E,v),P++,P<a){T=0;break}p=[];for(let e=0;e<m.length;e++)p.push(m[e]>>0&255),p.push(m[e]>>8&255),p.push(m[e]>>16&255),p.push(m[e]>>24&255);const r=i(e,p,c);return d&&d(null,1,r),r}d&&B(x)};if(!d)for(;;){const e=x();if(null!=e)return e}x()}const d={scrypt:function(e,t,r,n,i,s,o){return new Promise((function(a,u){let h=0;o&&o(0),c(e,t,r,n,i,s,(function(e,t,r){if(e)u(e);else if(r)o&&1!==h&&o(1),a(new Uint8Array(r));else if(o&&t!==h)return h=t,o(t)}))}))},syncScrypt:function(e,t,r,n,i,s){return new Uint8Array(c(e,t,r,n,i,s))}};e.exports=d}()}(Bi);var xi=Bi.exports,Ri=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))};const ki=new A(Ai);function Di(e){return null!=e&&e.mnemonic&&e.mnemonic.phrase}class Oi extends g{isKeystoreAccount(e){return!(!e||!e._isKeystoreAccount)}}function Ni(e,t){const r=wi(Ei(e,"crypto/ciphertext"));if(re(P(ne([t.slice(16,32),r]))).substring(2)!==Ei(e,"crypto/mac").toLowerCase())throw new Error("invalid password");const n=function(e,t,r){if("aes-128-ctr"===Ei(e,"crypto/cipher")){const n=wi(Ei(e,"crypto/cipherparams/iv")),i=new vi.Counter(n),s=new vi.ModeOfOperation.ctr(t,i);return ee(s.decrypt(r))}return null}(e,t.slice(0,16),r);n||ki.throwError("unsupported cipher",A.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const i=t.slice(32,64),s=ge(n);if(e.address){let t=e.address.toLowerCase();if("0x"!==t.substring(0,2)&&(t="0x"+t),J(t)!==s)throw new Error("address mismatch")}const o={_isKeystoreAccount:!0,address:s,privateKey:re(n)};if("0.1"===Ei(e,"x-ethers/version")){const t=wi(Ei(e,"x-ethers/mnemonicCiphertext")),r=wi(Ei(e,"x-ethers/mnemonicCounter")),n=new vi.Counter(r),s=new vi.ModeOfOperation.ctr(i,n),a=Ei(e,"x-ethers/path")||ai,u=Ei(e,"x-ethers/locale")||"en",h=ee(s.decrypt(t));try{const e=li(h,u),t=ui.fromMnemonic(e,null,u).derivePath(a);if(t.privateKey!=o.privateKey)throw new Error("mnemonic mismatch");o.mnemonic=t.mnemonic}catch(e){if(e.code!==A.errors.INVALID_ARGUMENT||"wordlist"!==e.argument)throw e}}return new Oi(o)}function Fi(e,t,r,n,i){return ee(en(e,t,r,n,i))}function Li(e,t,r,n,i){return Promise.resolve(Fi(e,t,r,n,i))}function Ui(e,t,r,n,i){const s=Mi(t),o=Ei(e,"crypto/kdf");if(o&&"string"==typeof o){const t=function(e,t){return ki.throwArgumentError("invalid key-derivation function parameters",e,t)};if("scrypt"===o.toLowerCase()){const r=wi(Ei(e,"crypto/kdfparams/salt")),a=parseInt(Ei(e,"crypto/kdfparams/n")),u=parseInt(Ei(e,"crypto/kdfparams/r")),h=parseInt(Ei(e,"crypto/kdfparams/p"));a&&u&&h||t("kdf",o),0!=(a&a-1)&&t("N",a);const f=parseInt(Ei(e,"crypto/kdfparams/dklen"));return 32!==f&&t("dklen",f),n(s,r,a,u,h,64,i)}if("pbkdf2"===o.toLowerCase()){const n=wi(Ei(e,"crypto/kdfparams/salt"));let i=null;const o=Ei(e,"crypto/kdfparams/prf");"hmac-sha256"===o?i="sha256":"hmac-sha512"===o?i="sha512":t("prf",o);const a=parseInt(Ei(e,"crypto/kdfparams/c")),u=parseInt(Ei(e,"crypto/kdfparams/dklen"));return 32!==u&&t("dklen",u),r(s,n,a,u,i)}}return ki.throwArgumentError("unsupported key-derivation function","kdf",o)}function Hi(e,t,r){if(Pi(e)){r&&r(0);const n=Ti(e,t);return r&&r(1),Promise.resolve(n)}return _i(e)?function(e,t,r){return Ri(this,void 0,void 0,(function*(){const n=JSON.parse(e);return Ni(n,yield Ui(n,t,Li,xi.scrypt,r))}))}(e,t,r):Promise.reject(new Error("invalid JSON wallet"))}function qi(e,t){if(Pi(e))return Ti(e,t);if(_i(e))return function(e,t){const r=JSON.parse(e);return Ni(r,Ui(r,t,Fi,xi.syncScrypt))}(e,t);throw new Error("invalid JSON wallet")}var Gi=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))};const Ki=new A("wallet/5.7.0");class ji extends Gr{constructor(e,t){if(super(),null!=(r=e)&&se(r.privateKey,32)&&null!=r.address){const t=new jn(e.privateKey);if(c(this,"_signingKey",(()=>t)),c(this,"address",ge(this.publicKey)),this.address!==J(e.address)&&Ki.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),function(e){const t=e.mnemonic;return t&&t.phrase}(e)){const t=e.mnemonic;c(this,"_mnemonic",(()=>({phrase:t.phrase,path:t.path||ai,locale:t.locale||"en"})));const r=this.mnemonic,n=ui.fromMnemonic(r.phrase,null,r.locale).derivePath(r.path);ge(n.privateKey)!==this.address&&Ki.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else c(this,"_mnemonic",(()=>null))}else{if(jn.isSigningKey(e))"secp256k1"!==e.curve&&Ki.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),c(this,"_signingKey",(()=>e));else{"string"==typeof e&&e.match(/^[0-9a-f]*$/i)&&64===e.length&&(e="0x"+e);const t=new jn(e);c(this,"_signingKey",(()=>t))}c(this,"_mnemonic",(()=>null)),c(this,"address",ge(this.publicKey))}var r;t&&!Qr.isProvider(t)&&Ki.throwArgumentError("invalid provider","provider",t),c(this,"provider",t||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(e){return new ji(this,e)}signTransaction(e){return m(e).then((t=>{null!=t.from&&(J(t.from)!==this.address&&Ki.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete t.from);const r=this._signingKey().signDigest(P(ye(t)));return ye(t,r)}))}signMessage(e){return Gi(this,void 0,void 0,(function*(){return he(this._signingKey().signDigest(Pt(e)))}))}_signTypedData(e,t,r){return Gi(this,void 0,void 0,(function*(){const n=yield jt.resolveNames(e,t,r,(e=>(null==this.provider&&Ki.throwError("cannot resolve ENS names without a provider",A.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:e}),this.provider.resolveName(e))));return he(this._signingKey().signDigest(jt.hash(n.domain,t,n.value)))}))}encrypt(e,t,r){if("function"!=typeof t||r||(r=t,t={}),r&&"function"!=typeof r)throw new Error("invalid callback");return t||(t={}),function(e,t,r,n){try{if(J(e.address)!==ge(e.privateKey))throw new Error("address/privateKey mismatch");if(Di(e)){const t=e.mnemonic;if(ui.fromMnemonic(t.phrase,null,t.locale).derivePath(t.path||ai).privateKey!=e.privateKey)throw new Error("mnemonic mismatch")}}catch(e){return Promise.reject(e)}"function"!=typeof r||n||(n=r,r={}),r||(r={});const i=ee(e.privateKey),s=Mi(t);let o=null,a=null,u=null;if(Di(e)){const t=e.mnemonic;o=ee(fi(t.phrase,t.locale||"en")),a=t.path||ai,u=t.locale||"en"}let h=r.client;h||(h="ethers.js");let f=null;f=r.salt?ee(r.salt):mi(32);let l=null;if(r.iv){if(l=ee(r.iv),16!==l.length)throw new Error("invalid iv")}else l=mi(16);let c=null;if(r.uuid){if(c=ee(r.uuid),16!==c.length)throw new Error("invalid uuid")}else c=mi(16);let d=1<<17,p=8,m=1;return r.scrypt&&(r.scrypt.N&&(d=r.scrypt.N),r.scrypt.r&&(p=r.scrypt.r),r.scrypt.p&&(m=r.scrypt.p)),xi.scrypt(s,f,d,p,m,64,n).then((t=>{const r=(t=ee(t)).slice(0,16),n=t.slice(16,32),s=t.slice(32,64),g=new vi.Counter(l),y=new vi.ModeOfOperation.ctr(r,g),v=ee(y.encrypt(i)),A=P(ne([n,v])),w={address:e.address.substring(2).toLowerCase(),id:Si(c),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:re(l).substring(2)},ciphertext:re(v).substring(2),kdf:"scrypt",kdfparams:{salt:re(f).substring(2),n:d,dklen:32,p:m,r:p},mac:A.substring(2)}};if(o){const e=mi(16),t=new vi.Counter(e),r=new vi.ModeOfOperation.ctr(s,t),n=ee(r.encrypt(o)),i=new Date,f=i.getUTCFullYear()+"-"+bi(i.getUTCMonth()+1,2)+"-"+bi(i.getUTCDate(),2)+"T"+bi(i.getUTCHours(),2)+"-"+bi(i.getUTCMinutes(),2)+"-"+bi(i.getUTCSeconds(),2)+".0Z";w["x-ethers"]={client:h,gethFilename:"UTC--"+f+"--"+w.address,mnemonicCounter:re(e).substring(2),mnemonicCiphertext:re(n).substring(2),path:a,locale:u,version:"0.1"}}return JSON.stringify(w)}))}(this,e,t,r)}static createRandom(e){let t=mi(16);e||(e={}),e.extraEntropy&&(t=ee(ue(P(ne([t,e.extraEntropy])),0,16)));const r=li(t,e.locale);return ji.fromMnemonic(r,e.path,e.locale)}static fromEncryptedJson(e,t,r){return Hi(e,t,r).then((e=>new ji(e)))}static fromEncryptedJsonSync(e,t){return new ji(qi(e,t))}static fromMnemonic(e,t,r){return t||(t=ai),new ji(ui.fromMnemonic(e,null,r).derivePath(t))}}const zi=new RegExp("^bytes([0-9]+)$"),Qi=new RegExp("^(u?int)([0-9]*)$"),Wi=new RegExp("^(.*)\\[([0-9]*)\\]$"),Ji="0000000000000000000000000000000000000000000000000000000000000000",Vi=new A("solidity/5.7.0");function Yi(e,t,r){switch(e){case"address":return r?fe(t,32):ee(t);case"string":return E(t);case"bytes":return ee(t);case"bool":return t=t?"0x01":"0x00",r?fe(t,32):ee(t)}let n=e.match(Qi);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!=0||0===i||i>256)&&Vi.throwArgumentError("invalid number type","type",e),r&&(i=256),t=b.from(t).toTwos(i),fe(t,i/8)}if(n=e.match(zi),n){const i=parseInt(n[1]);return(String(i)!==n[1]||0===i||i>32)&&Vi.throwArgumentError("invalid bytes type","type",e),ee(t).byteLength!==i&&Vi.throwArgumentError(`invalid value for ${e}`,"value",t),r?ee((t+Ji).substring(0,66)):t}if(n=e.match(Wi),n&&Array.isArray(t)){const r=n[1];parseInt(n[2]||String(t.length))!=t.length&&Vi.throwArgumentError(`invalid array length for ${e}`,"value",t);const i=[];return t.forEach((function(e){i.push(Yi(r,e,!0))})),ne(i)}return Vi.throwArgumentError("invalid type","type",e)}function Xi(e,t){e.length!=t.length&&Vi.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);const r=[];return e.forEach((function(e,n){r.push(Yi(e,t[n]))})),re(ne(r))}const Zi=new A("units/5.7.0"),$i=["wei","kwei","mwei","gwei","szabo","finney","ether"];function es(e,t){if("string"==typeof t){const e=$i.indexOf(t);-1!==e&&(t=3*e)}return Ne(e,null!=t?t:18)}function ts(e,t){if("string"!=typeof e&&Zi.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=$i.indexOf(t);-1!==e&&(t=3*e)}return Fe(e,null!=t?t:18)}var rs=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))};function ns(e,t){return rs(this,void 0,void 0,(function*(){null==t&&(t={});const r={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};if(!0!==t.skipFetchSetup&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),null!=t.fetchOptions){const e=t.fetchOptions;e.mode&&(r.mode=e.mode),e.cache&&(r.cache=e.cache),e.credentials&&(r.credentials=e.credentials),e.redirect&&(r.redirect=e.redirect),e.referrer&&(r.referrer=e.referrer)}const n=yield fetch(e,r),i=yield n.arrayBuffer(),s={};return n.headers.forEach?n.headers.forEach(((e,t)=>{s[t.toLowerCase()]=e})):n.headers.keys().forEach((e=>{s[e.toLowerCase()]=n.headers.get(e)})),{headers:s,statusCode:n.status,statusMessage:n.statusText,body:ee(new Uint8Array(i))}}))}var is=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))};const ss=new A("web/5.7.1");function os(e){return new Promise((t=>{setTimeout(t,e)}))}function as(e,t){if(null==e)return null;if("string"==typeof e)return e;if(le(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return S(e)}catch(e){}return re(e)}return e}function us(e,t,r){const n="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;ss.assertArgument(n>0&&n%1==0,"invalid connection throttle limit","connection.throttleLimit",n);const i="object"==typeof e?e.throttleCallback:null,s="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;ss.assertArgument(s>0&&s%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",s);const o="object"==typeof e&&!!e.errorPassThrough,a={};let u=null;const h={method:"GET"};let f=!1,l=12e4;if("string"==typeof e)u=e;else if("object"==typeof e){if(null!=e&&null!=e.url||ss.throwArgumentError("missing URL","connection.url",e),u=e.url,"number"==typeof e.timeout&&e.timeout>0&&(l=e.timeout),e.headers)for(const t in e.headers)a[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(f=!0);if(h.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==u.substring(0,6)&&!0!==e.allowInsecureAuthentication&&ss.throwError("basic authentication requires a secure https url",A.errors.INVALID_ARGUMENT,{argument:"url",url:u,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;a.authorization={key:"Authorization",value:"Basic "+et(E(t))}}null!=e.skipFetchSetup&&(h.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(h.fetchOptions=p(e.fetchOptions))}const c=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),d=u?u.match(c):null;if(d)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":d[1]||"text/plain"},body:d[2]?$e(d[3]):(m=d[3],E(m.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return r&&(t=r(e.body,e)),Promise.resolve(t)}catch(e){ss.throwError("processing response error",A.errors.SERVER_ERROR,{body:as(d[1],d[2]),error:e,requestBody:null,requestMethod:"GET",url:u})}var m;t&&(h.method="POST",h.body=t,null==a["content-type"]&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==a["content-length"]&&(a["content-length"]={key:"Content-Length",value:String(t.length)}));const g={};Object.keys(a).forEach((e=>{const t=a[e];g[t.key]=t.value})),h.headers=g;const y=function(){let e=null;return{promise:new Promise((function(t,r){l&&(e=setTimeout((()=>{null!=e&&(e=null,r(ss.makeError("timeout",A.errors.TIMEOUT,{requestBody:as(h.body,g["content-type"]),requestMethod:h.method,timeout:l,url:u})))}),l))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),v=function(){return is(this,void 0,void 0,(function*(){for(let e=0;e<n;e++){let t=null;try{if(t=yield ns(u,h),e<n)if(301===t.statusCode||302===t.statusCode){const e=t.headers.location||"";if("GET"===h.method&&e.match(/^https:/)){u=t.headers.location;continue}}else if(429===t.statusCode){let r=!0;if(i&&(r=yield i(e,u)),r){let r=0;const n=t.headers["retry-after"];r="string"==typeof n&&n.match(/^[1-9][0-9]*$/)?1e3*parseInt(n):s*parseInt(String(Math.random()*Math.pow(2,e))),yield os(r);continue}}}catch(e){t=e.response,null==t&&(y.cancel(),ss.throwError("missing response",A.errors.SERVER_ERROR,{requestBody:as(h.body,g["content-type"]),requestMethod:h.method,serverError:e,url:u}))}let a=t.body;if(f&&304===t.statusCode?a=null:!o&&(t.statusCode<200||t.statusCode>=300)&&(y.cancel(),ss.throwError("bad response",A.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:as(a,t.headers?t.headers["content-type"]:null),requestBody:as(h.body,g["content-type"]),requestMethod:h.method,url:u})),r)try{const e=yield r(a,t);return y.cancel(),e}catch(r){if(r.throttleRetry&&e<n){let t=!0;if(i&&(t=yield i(e,u)),t){const t=s*parseInt(String(Math.random()*Math.pow(2,e)));yield os(t);continue}}y.cancel(),ss.throwError("processing response error",A.errors.SERVER_ERROR,{body:as(a,t.headers?t.headers["content-type"]:null),error:r,requestBody:as(h.body,g["content-type"]),requestMethod:h.method,url:u})}return y.cancel(),a}return ss.throwError("failed response",A.errors.SERVER_ERROR,{requestBody:as(h.body,g["content-type"]),requestMethod:h.method,url:u})}))}();return Promise.race([y.promise,v])}var hs=Object.freeze({__proto__:null,AbiCoder:B,defaultAbiCoder:x,Fragment:R,ConstructorFragment:k,ErrorFragment:D,EventFragment:O,FunctionFragment:N,ParamType:F,FormatTypes:L,checkResultErrors:U,Logger:A,RLP:Ie,_fetchData:us,fetchJson:function(e,t,r){let n=null;if(null!=t){n=E(t);const r="string"==typeof e?{url:e}:p(e);if(r.headers){0!==Object.keys(r.headers).filter((e=>"content-type"===e.toLowerCase())).length||(r.headers=p(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};e=r}return us(e,n,((e,t)=>{let n=null;if(null!=e)try{n=JSON.parse(S(e))}catch(t){ss.throwError("invalid JSON",A.errors.SERVER_ERROR,{body:e,error:t})}return r&&(n=r(n,t)),n}))},poll:function(e,t){return t||(t={}),null==(t=p(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(r,n){let i=null,s=!1;const o=()=>!s&&(s=!0,i&&clearTimeout(i),!0);t.timeout&&(i=setTimeout((()=>{o()&&n(new Error("timeout"))}),t.timeout));const a=t.retryLimit;let u=0;!function i(){return e().then((function(e){if(void 0!==e)o()&&r(e);else if(t.oncePoll)t.oncePoll.once("poll",i);else if(t.onceBlock)t.onceBlock.once("block",i);else if(!s){if(u++,u>a)return void(o()&&n(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,u)));e<t.floor&&(e=t.floor),e>t.ceiling&&(e=t.ceiling),setTimeout(i,e)}return null}),(function(e){o()&&n(e)}))}()}))},checkProperties:y,deepCopy:d,defineReadOnly:c,getStatic:v,resolveProperties:m,shallowCopy:p,arrayify:ee,concat:ne,stripZeros:ce,zeroPad:fe,isBytes:te,isBytesLike:le,defaultPath:ai,HDNode:ui,SigningKey:jn,Interface:H,LogDescription:q,TransactionDescription:G,base58:Jr,base64:tt,hexlify:re,isHexString:se,hexConcat:ie,hexStripZeros:de,hexValue:pe,hexZeroPad:$,hexDataLength:oe,hexDataSlice:ue,nameprep:function(e){if(e.match(/^[a-z0-9-]*$/i)&&e.length<=59)return e.toLowerCase();let t=C(e);var r;r=t.map((e=>{if(Qe.indexOf(e)>=0)return[];if(e>=65024&&e<=65039)return[];let t=function(e){let t=je(e,We);if(t)return[e+t.s];let r=Je[e];if(r)return r;let n=Ve[e];return n?[e+n[0]]:Ye[e]||null}(e);return t||[e]})),t=r.reduce(((e,t)=>(t.forEach((t=>{e.push(t)})),e)),[]),t=C(T(t),I.NFKC),t.forEach((e=>{if(je(e,Xe))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),t.forEach((e=>{if(je(e,ze))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));let n=T(t);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");return n},_toEscapedUtf8String:K,toUtf8Bytes:E,toUtf8CodePoints:C,toUtf8String:S,Utf8ErrorFuncs:j,formatBytes32String:function(e){const t=E(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return re(ne([t,Ee]).slice(0,32))},parseBytes32String:function(e){const t=ee(e);if(32!==t.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==t[31])throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;0===t[r-1];)r--;return S(t.slice(0,r))},dnsEncode:function(e){return re(ne(It(e).map((e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t}))))+"00"},hashMessage:Pt,namehash:function(e){"string"!=typeof e&&Et.throwArgumentError("invalid ENS name; not a string","name",e);let t=St;const r=It(e);for(;r.length;)t=P(ne([t,P(r.pop())]));return re(t)},isValidName:function(e){try{return 0!==It(e).length}catch(e){}return!1},id:_,_TypedDataEncoder:jt,getAddress:J,getIcapAddress:V,getContractAddress:Y,getCreate2Address:X,isAddress:Z,formatEther:function(e){return es(e,18)},parseEther:function(e){return ts(e,18)},formatUnits:es,parseUnits:ts,commify:function(e){const t=String(e).split(".");(t.length>2||!t[0].match(/^-?[0-9]*$/)||t[1]&&!t[1].match(/^[0-9]*$/)||"."===e||"-."===e)&&Zi.throwArgumentError("invalid value","value",e);let r=t[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0");let i="";for(2===t.length&&(i="."+(t[1]||"0"));i.length>2&&"0"===i[i.length-1];)i=i.substring(0,i.length-1);const s=[];for(;r.length;){if(r.length<=3){s.unshift(r);break}{const e=r.length-3;s.unshift(r.substring(e)),r=r.substring(0,e)}}return n+s.join(",")+i},computeHmac:$r,keccak256:P,ripemd160:Xr,sha256:Zr,sha512:function(e){return"0x"+me.sha512().update(ee(e)).digest("hex")},randomBytes:mi,shuffled:function(e){for(let t=(e=e.slice()).length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e},solidityPack:Xi,solidityKeccak256:function(e,t){return P(Xi(e,t))},soliditySha256:function(e,t){return Zr(Xi(e,t))},splitSignature:ae,joinSignature:he,accessListify:Ae,parseTransaction:we,serializeTransaction:ye,TransactionTypes:be,getJsonWalletAddress:function(e){if(Pi(e))try{return J(JSON.parse(e).ethaddr)}catch(e){return null}if(_i(e))try{return J(JSON.parse(e).address)}catch(e){return null}return null},computeAddress:ge,recoverAddress:ve,computePublicKey:zn,recoverPublicKey:function(e,t){const r=ae(t),n={r:ee(r.r),s:ee(r.s)};return"0x"+Kn().recoverPubKey(ee(e),n,r.recoveryParam).encode("hex",!1)},verifyMessage:function(e,t){return ve(Pt(e),t)},verifyTypedData:function(e,t,r,n){return ve(jt.hash(e,t,r),n)},getAccountPath:function(e){return("number"!=typeof e||e<0||e>=ti||e%1)&&Zn.throwArgumentError("invalid account index","index",e),`m/44'/60'/${e}'/0/0`},mnemonicToEntropy:fi,entropyToMnemonic:li,isValidMnemonic:function(e,t){try{return fi(e,t),!0}catch(e){}return!1},mnemonicToSeed:hi,get SupportedAlgorithm(){return Vr},get UnicodeNormalizationForm(){return I},get Utf8ErrorReason(){return z},Indexed:Q});const fs="ethers/5.7.2",ls=new A(fs);var cs=Object.freeze({__proto__:null,Signer:Gr,Wallet:ji,VoidSigner:Kr,getDefaultProvider:Ce,providers:Se,BaseContract:h,Contract:f,ContractFactory:l,BigNumber:b,FixedNumber:Ue,constants:Me,get errors(){return W},logger:ls,utils:hs,wordlists:Xn,version:fs,Wordlist:Wn});try{const e=window;null==e._ethers&&(e._ethers=cs)}catch(e){}var ds=o(Object.freeze({__proto__:null,ethers:cs,Signer:Gr,Wallet:ji,VoidSigner:Kr,getDefaultProvider:Ce,providers:Se,BaseContract:h,Contract:f,ContractFactory:l,BigNumber:b,FixedNumber:Ue,constants:Me,get errors(){return W},logger:ls,utils:hs,wordlists:Xn,version:fs,Wordlist:Wn})),ps={};Object.defineProperty(ps,"__esModule",{value:!0}),ps.MAGIC_VALUE_BYTES=ps.MAGIC_VALUE=ps.EIP_1271_BYTES_INTERFACE=ps.EIP_1271_INTERFACE=void 0;const ms=ds;ps.MAGIC_VALUE="0x1626ba7e";ps.MAGIC_VALUE_BYTES="0x20c13b0b";const gs=new ms.ethers.utils.Interface(["function isValidSignature(bytes32 _dataHash, bytes calldata _signature) external view"]);ps.EIP_1271_INTERFACE=gs;const ys=new ms.ethers.utils.Interface(["function isValidSignature(bytes calldata _data, bytes calldata _signature) public view"]);ps.EIP_1271_BYTES_INTERFACE=ys;var vs={},As={},ws={};Object.defineProperty(ws,"__esModule",{value:!0}),ws.PermissionsError=ws.PERMISSIONS_REQUEST_REJECTED=void 0,ws.PERMISSIONS_REQUEST_REJECTED=4001;class bs extends Error{constructor(e,t,r){super(e),this.code=t,this.data=r,Object.setPrototypeOf(this,bs.prototype)}}ws.PermissionsError=bs,Object.defineProperty(As,"__esModule",{value:!0}),As.Wallet=void 0;const Ms=or,Es=ws;As.Wallet=class{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(Ms.Methods.wallet_getPermissions,void 0)).data}async requestPermissions(e){if(!this.isPermissionRequestValid(e))throw new Es.PermissionsError("Permissions request is invalid",Es.PERMISSIONS_REQUEST_REJECTED);try{return(await this.communicator.send(Ms.Methods.wallet_requestPermissions,e)).data}catch(e){throw new Es.PermissionsError("Permissions rejected",Es.PERMISSIONS_REQUEST_REJECTED)}}isPermissionRequestValid(e){return e.every((e=>"object"==typeof e&&Object.keys(e).every((e=>!!Object.values(Ms.RestrictedMethods).includes(e)))))}},Object.defineProperty(vs,"__esModule",{value:!0});const Ss=As,Cs=ws,Is=(e,t)=>t.some((t=>t.parentCapability===e));vs.default=()=>(e,t,r)=>{const n=r.value;return r.value=async function(){const e=new Ss.Wallet(this.communicator);let r=await e.getPermissions();if(Is(t,r)||(r=await e.requestPermissions([{[t]:{}}])),!Is(t,r))throw new Cs.PermissionsError("Permissions rejected",Cs.PERMISSIONS_REQUEST_REJECTED);return n.apply(this)},r};var Ts=s&&s.__decorate||function(e,t,r,n){var i,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,r,o):i(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},Ps=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Fr,"__esModule",{value:!0}),Fr.Safe=void 0;const _s=ds,Bs=ps,xs=or,Rs=kr,ks=ur,Ds=Ps(vs);class Os{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(xs.Methods.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(xs.Methods.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e="usd"}={}){return(await this.communicator.send(xs.Methods.getSafeBalances,{currency:e})).data}async check1271Signature(e,t="0x"){const r=await this.getInfo(),n=Bs.EIP_1271_INTERFACE.encodeFunctionData("isValidSignature",[e,t]),i={call:Rs.RPC_CALLS.eth_call,params:[{to:r.safeAddress,data:n},"latest"]};try{return(await this.communicator.send(xs.Methods.rpcCall,i)).data.slice(0,10).toLowerCase()===Bs.MAGIC_VALUE}catch(e){return!1}}async check1271SignatureBytes(e,t="0x"){const r=await this.getInfo(),n=_s.ethers.utils.arrayify(e),i=Bs.EIP_1271_BYTES_INTERFACE.encodeFunctionData("isValidSignature",[n,t]),s={call:Rs.RPC_CALLS.eth_call,params:[{to:r.safeAddress,data:i},"latest"]};try{return(await this.communicator.send(xs.Methods.rpcCall,s)).data.slice(0,10).toLowerCase()===Bs.MAGIC_VALUE_BYTES}catch(e){return!1}}calculateMessageHash(e){return _s.ethers.utils.hashMessage(e)}calculateTypedMessageHash(e){return _s.ethers.utils._TypedDataEncoder.hash(e.domain,e.types,e.message)}async getOffChainSignature(e){return(await this.communicator.send(xs.Methods.getOffChainSignature,e)).data}async isMessageSigned(e,t="0x"){let r;if("string"==typeof e&&(r=async()=>{const r=this.calculateMessageHash(e);return await this.isMessageHashSigned(r,t)}),(0,ks.isObjectEIP712TypedData)(e)&&(r=async()=>{const r=this.calculateTypedMessageHash(e);return await this.isMessageHashSigned(r,t)}),r){return await r()}throw new Error("Invalid message type")}async isMessageHashSigned(e,t="0x"){const r=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const n of r){if(await n(e,t))return!0}return!1}async getEnvironmentInfo(){return(await this.communicator.send(xs.Methods.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(xs.Methods.requestAddressBook,void 0)).data}}Ts([(0,Ds.default)()],Os.prototype,"requestAddressBook",null),Fr.Safe=Os;var Ns=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Qt,"__esModule",{value:!0});const Fs=Ns(Wt),Ls=ar,Us=Rr,Hs=Fr,qs=As;Qt.default=class{constructor(e={}){const{allowedDomains:t=null,debug:r=!1}=e;this.communicator=new Fs.default(t,r),this.eth=new Us.Eth(this.communicator),this.txs=new Ls.TXs(this.communicator),this.safe=new Hs.Safe(this.communicator),this.wallet=new qs.Wallet(this.communicator)}},function(e){var t=s&&s.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=s&&s.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)},n=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.getSDKVersion=void 0;const i=n(Qt);e.default=i.default,r(Qt,e),r(ur,e),r(or,e),r(Jt,e);var o=Vt;Object.defineProperty(e,"getSDKVersion",{enumerable:!0,get:function(){return o.getSDKVersion}})}(zt);var Gs=a(zt),Ks={},js={},zs={};Object.defineProperty(zs,"__esModule",{value:!0}),zs.getLowerCase=void 0,zs.getLowerCase=function(e){return e?e.toLowerCase():e},Object.defineProperty(js,"__esModule",{value:!0}),js.SafeAppProvider=void 0;const Qs=Pe,Ws=zs;class Js extends Qs.EventEmitter{constructor(e,t){super(),this.submittedTxs=new Map,this.safe=e,this.sdk=t}async connect(){this.emit("connect",{chainId:this.chainId})}async disconnect(){}get chainId(){return this.safe.chainId}async request(e){const{method:t,params:r=[]}=e;switch(t){case"eth_accounts":return[this.safe.safeAddress];case"net_version":case"eth_chainId":return`0x${this.chainId.toString(16)}`;case"personal_sign":{const[e,t]=r;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase())throw new Error("The address or message hash is invalid");return await this.sdk.txs.signMessage(e),"0x"}case"eth_sign":{const[e,t]=r;if(this.safe.safeAddress.toLowerCase()!==e.toLowerCase()||!t.startsWith("0x"))throw new Error("The address or message hash is invalid");return await this.sdk.txs.signMessage(t),"0x"}case"eth_signTypedData":case"eth_signTypedData_v4":{const[e,t]=r,n="string"==typeof t?JSON.parse(t):t;if(this.safe.safeAddress.toLowerCase()!==e.toLowerCase())throw new Error("The address is invalid");return await this.sdk.txs.signTypedMessage(n),"0x"}case"eth_sendTransaction":const t=Object.assign({value:"0",data:"0x"},r[0]);"string"==typeof t.gas&&t.gas.startsWith("0x")&&(t.gas=parseInt(t.gas,16));const n=await this.sdk.txs.send({txs:[t],params:{safeTxGas:t.gas}});return this.submittedTxs.set(n.safeTxHash,{from:this.safe.safeAddress,hash:n.safeTxHash,gas:0,gasPrice:"0x00",nonce:0,input:t.data,value:t.value,to:t.to,blockHash:null,blockNumber:null,transactionIndex:null}),n.safeTxHash;case"eth_blockNumber":return(await this.sdk.eth.getBlockByNumber(["latest"])).number;case"eth_getBalance":return this.sdk.eth.getBalance([(0,Ws.getLowerCase)(r[0]),r[1]]);case"eth_getCode":return this.sdk.eth.getCode([(0,Ws.getLowerCase)(r[0]),r[1]]);case"eth_getTransactionCount":return this.sdk.eth.getTransactionCount([(0,Ws.getLowerCase)(r[0]),r[1]]);case"eth_getStorageAt":return this.sdk.eth.getStorageAt([(0,Ws.getLowerCase)(r[0]),r[1],r[2]]);case"eth_getBlockByNumber":return this.sdk.eth.getBlockByNumber([r[0],r[1]]);case"eth_getBlockByHash":return this.sdk.eth.getBlockByHash([r[0],r[1]]);case"eth_getTransactionByHash":let i=r[0];try{i=(await this.sdk.txs.getBySafeTxHash(i)).txHash||i}catch(e){}return this.submittedTxs.has(i)?this.submittedTxs.get(i):this.sdk.eth.getTransactionByHash([i]).then((e=>(e&&(e.hash=r[0]),e)));case"eth_getTransactionReceipt":{let e=r[0];try{e=(await this.sdk.txs.getBySafeTxHash(e)).txHash||e}catch(e){}return this.sdk.eth.getTransactionReceipt([e]).then((e=>(e&&(e.transactionHash=r[0]),e)))}case"eth_estimateGas":return this.sdk.eth.getEstimateGas(r[0]);case"eth_call":return this.sdk.eth.call([r[0],r[1]]);case"eth_getLogs":return this.sdk.eth.getPastLogs([r[0]]);case"eth_gasPrice":return this.sdk.eth.getGasPrice();case"wallet_getPermissions":return this.sdk.wallet.getPermissions();case"wallet_requestPermissions":return this.sdk.wallet.requestPermissions(r[0]);case"safe_setSettings":return this.sdk.eth.setSafeSettings([r[0]]);default:throw Error(`"${e.method}" not implemented`)}}send(e,t){e||t("Undefined request"),this.request(e).then((r=>t(null,{jsonrpc:"2.0",id:e.id,result:r}))).catch((e=>t(e,null)))}}var Vs,Ys;function Xs(){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return Ys||(Ys=new Gs),void 0!==Vs?[3,2]:[4,Promise.race([Ys.safe.getInfo(),new Promise((function(e){return setTimeout(e,200)}))])];case 1:Vs=e.sent(),e.label=2;case 2:return[2,Vs]}}))}))}function Zs(){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,Xs()];case 1:return[2,!!e.sent()]}}))}))}function $s(n){return e(this,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return[4,Xs()];case 1:if(!(e=t.sent()))throw Error("Could not load Safe information");return(i=new Ks.SafeAppProvider(e,Ys)).on("connect",n.connect),i.on("disconnect",n.disconnect),i.on("accountsChanged",n.accountsChanged),i.on("chainChanged",n.chainChanged),i.on("message",n.message),[2,r(i)]}}))}))}js.SafeAppProvider=Js,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppProvider=void 0;var t=js;Object.defineProperty(e,"SafeAppProvider",{enumerable:!0,get:function(){return t.SafeAppProvider}})}(Ks);var eo={},to={},ro={};Object.defineProperty(ro,"__esModule",{value:!0}),ro.getTxServiceBaseUrl=void 0,ro.getTxServiceBaseUrl=function(e){return`${e}/api`};var no={};!function(e){var t=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.sendRequest=e.HttpMethod=void 0;const r=t(Te);var n;(n=e.HttpMethod||(e.HttpMethod={})).Get="get",n.Post="post",n.Delete="delete",e.sendRequest=async function({url:e,method:t,body:n}){const i=await(0,r.default)(e,{method:t,headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(n)});let s;try{s=await i.json()}catch(e){if(!i.ok)throw new Error(i.statusText)}if(i.ok)return s;if(s.data)throw new Error(s.data);if(s.detail)throw new Error(s.detail);if(s.message)throw new Error(s.message);if(s.nonFieldErrors)throw new Error(s.nonFieldErrors);if(s.delegate)throw new Error(s.delegate);if(s.safe)throw new Error(s.safe);if(s.delegator)throw new Error(s.delegator);throw new Error(i.statusText)}}(no);var io,so,oo=s&&s.__classPrivateFieldSet||function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r},ao=s&&s.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};Object.defineProperty(to,"__esModule",{value:!0});const uo=ro,ho=no;io=new WeakMap,so=new WeakMap,to.default=class{constructor({txServiceUrl:e,ethAdapter:t}){io.set(this,void 0),so.set(this,void 0),oo(this,io,(0,uo.getTxServiceBaseUrl)(e),"f"),oo(this,so,t,"f")}async getServiceInfo(){return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/about`,method:ho.HttpMethod.Get})}async getServiceMasterCopiesInfo(){return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/about/master-copies`,method:ho.HttpMethod.Get})}async decodeData(e){if(""===e)throw new Error("Invalid data");return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/data-decoder/`,method:ho.HttpMethod.Post,body:{data:e}})}async getSafesByOwner(e){if(""===e)throw new Error("Invalid owner address");const{address:t}=await ao(this,so,"f").getEip3770Address(e);return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/owners/${t}/safes/`,method:ho.HttpMethod.Get})}async getSafesByModule(e){if(""===e)throw new Error("Invalid module address");const{address:t}=await ao(this,so,"f").getEip3770Address(e);return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/modules/${t}/safes/`,method:ho.HttpMethod.Get})}async getTransaction(e){if(""===e)throw new Error("Invalid safeTxHash");return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/multisig-transactions/${e}/`,method:ho.HttpMethod.Get})}async getTransactionConfirmations(e){if(""===e)throw new Error("Invalid safeTxHash");return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/multisig-transactions/${e}/confirmations/`,method:ho.HttpMethod.Get})}async confirmTransaction(e,t){if(""===e)throw new Error("Invalid safeTxHash");if(""===t)throw new Error("Invalid signature");return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/multisig-transactions/${e}/confirmations/`,method:ho.HttpMethod.Post,body:{signature:t}})}async getSafeInfo(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await ao(this,so,"f").getEip3770Address(e);return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/safes/${t}/`,method:ho.HttpMethod.Get})}async getSafeDelegates({safeAddress:e,delegateAddress:t,delegatorAddress:r,label:n,limit:i,offset:s}){const o=new URL(`${ao(this,io,"f")}/v1/delegates`);if(e){const{address:t}=await ao(this,so,"f").getEip3770Address(e);o.searchParams.set("safe",t)}if(t){const{address:e}=await ao(this,so,"f").getEip3770Address(t);o.searchParams.set("delegate",e)}if(r){const{address:e}=await ao(this,so,"f").getEip3770Address(r);o.searchParams.set("delegator",e)}return n&&o.searchParams.set("label",n),i&&o.searchParams.set("limit",i),s&&o.searchParams.set("offset",s),(0,ho.sendRequest)({url:o.toString(),method:ho.HttpMethod.Get})}async addSafeDelegate({safeAddress:e,delegateAddress:t,delegatorAddress:r,label:n,signer:i}){if(""===t)throw new Error("Invalid Safe delegate address");if(""===r)throw new Error("Invalid Safe delegator address");if(""===n)throw new Error("Invalid label");const{address:s}=await ao(this,so,"f").getEip3770Address(t),{address:o}=await ao(this,so,"f").getEip3770Address(r),a=s+Math.floor(Date.now()/1e3/3600),u=await i.signMessage(a),h={safe:e?(await ao(this,so,"f").getEip3770Address(e)).address:null,delegate:s,delegator:o,label:n,signature:u};return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/delegates/`,method:ho.HttpMethod.Post,body:h})}async removeSafeDelegate({delegateAddress:e,delegatorAddress:t,signer:r}){if(""===e)throw new Error("Invalid Safe delegate address");if(""===t)throw new Error("Invalid Safe delegator address");const{address:n}=await ao(this,so,"f").getEip3770Address(e),{address:i}=await ao(this,so,"f").getEip3770Address(t),s=n+Math.floor(Date.now()/1e3/3600),o=await r.signMessage(s);return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/delegates/${n}`,method:ho.HttpMethod.Delete,body:{delegate:n,delegator:i,signature:o}})}async getSafeCreationInfo(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await ao(this,so,"f").getEip3770Address(e);return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/safes/${t}/creation/`,method:ho.HttpMethod.Get})}async estimateSafeTransaction(e,t){if(""===e)throw new Error("Invalid Safe address");const{address:r}=await ao(this,so,"f").getEip3770Address(e);return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/safes/${r}/multisig-transactions/estimations/`,method:ho.HttpMethod.Post,body:t})}async proposeTransaction({safeAddress:e,safeTransactionData:t,safeTxHash:r,senderAddress:n,senderSignature:i,origin:s}){if(""===e)throw new Error("Invalid Safe address");const{address:o}=await ao(this,so,"f").getEip3770Address(e),{address:a}=await ao(this,so,"f").getEip3770Address(n);if(""===r)throw new Error("Invalid safeTxHash");return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/safes/${o}/multisig-transactions/`,method:ho.HttpMethod.Post,body:{...t,contractTransactionHash:r,sender:a,signature:i,origin:s}})}async getIncomingTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await ao(this,so,"f").getEip3770Address(e);return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/safes/${t}/incoming-transfers?executed=true`,method:ho.HttpMethod.Get})}async getModuleTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await ao(this,so,"f").getEip3770Address(e);return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/safes/${t}/module-transactions/`,method:ho.HttpMethod.Get})}async getMultisigTransactions(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await ao(this,so,"f").getEip3770Address(e);return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/safes/${t}/multisig-transactions/`,method:ho.HttpMethod.Get})}async getPendingTransactions(e,t){if(""===e)throw new Error("Invalid Safe address");const{address:r}=await ao(this,so,"f").getEip3770Address(e),n=t||(await this.getSafeInfo(r)).nonce;return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/safes/${r}/multisig-transactions/?executed=false&nonce__gte=${n}`,method:ho.HttpMethod.Get})}async getAllTransactions(e,t){var r,n,i;if(""===e)throw new Error("Invalid Safe address");const{address:s}=await ao(this,so,"f").getEip3770Address(e),o=new URL(`${ao(this,io,"f")}/v1/safes/${s}/all-transactions/`),a=(null===(r=null==t?void 0:t.trusted)||void 0===r?void 0:r.toString())||"true";o.searchParams.set("trusted",a);const u=(null===(n=null==t?void 0:t.queued)||void 0===n?void 0:n.toString())||"true";o.searchParams.set("queued",u);const h=(null===(i=null==t?void 0:t.executed)||void 0===i?void 0:i.toString())||"false";return o.searchParams.set("executed",h),(0,ho.sendRequest)({url:o.toString(),method:ho.HttpMethod.Get})}async getNextNonce(e){if(""===e)throw new Error("Invalid Safe address");const{address:t}=await ao(this,so,"f").getEip3770Address(e),r=await this.getPendingTransactions(t);if(r.results.length>0){const e=r.results.map((e=>e.nonce));return Math.max(...e)+1}return(await this.getSafeInfo(t)).nonce}async getTokenList(){return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/tokens/`,method:ho.HttpMethod.Get})}async getToken(e){if(""===e)throw new Error("Invalid token address");const{address:t}=await ao(this,so,"f").getEip3770Address(e);return(0,ho.sendRequest)({url:`${ao(this,io,"f")}/v1/tokens/${t}/`,method:ho.HttpMethod.Get})}};var fo={};Object.defineProperty(fo,"__esModule",{value:!0}),function(e){var t=s&&s.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=s&&s.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)},n=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0});const i=n(to);r(fo,e),e.default=i.default}(eo);var lo=a(eo);var co,po={1:"https://safe-transaction-mainnet.safe.global/",5:"https://safe-transaction-goerli.safe.global/",42161:"https://safe-transaction-arbitrum.safe.global/",43114:"https://safe-transaction-avalanche.safe.global/",1313161554:"https://safe-transaction-aurora.safe.global/",56:"https://safe-transaction-bsc.safe.global/",10:"https://safe-transaction-optimism.safe.global/",137:"https://safe-transaction-polygon.safe.global/"};function mo(r){return e(this,void 0,void 0,(function(){var n,s,o;return t(this,(function(a){if((null==co?void 0:co.chainId)===r)return[2,co.safeService];if(!i.provider)throw new Error("provider is undefined");return n=function(){var r=this;return{getEip3770Address:function(n){return e(r,void 0,void 0,(function(){var e,r,i;return t(this,(function(t){return e=function(e){var t=e.split(":"),r=t.length>1?t[1]:t[0];return{prefix:t.length>1?t[0]:"",address:r}}(n),r=e.address,i=e.prefix,[2,{address:r,prefix:i}]}))}))}}}(),(s=po[r])?(o=new lo({txServiceUrl:s,ethAdapter:n}),[2,(co={safeService:o,chainId:r}).safeService]):[2,void 0]}))}))}function go(r,n){return e(this,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return n?[4,mo(r)]:[2,!1];case 1:if(!(e=t.sent()))return[2,!1];t.label=2;case 2:return t.trys.push([2,4,,5]),[4,e.getSafeInfo(n)];case 3:return[2,!!t.sent()];case 4:return i=t.sent(),console.error(i),[2,!1];case 5:return[2]}}))}))}function yo(r,i,s){return e(this,void 0,void 0,(function(){var e,o,a;return t(this,(function(t){switch(t.label){case 0:return[4,mo(r)];case 1:return(e=t.sent())?s!==i?[2,s]:[4,e.getMultisigTransactions(s)]:(console.error("chainId: ".concat(r," is not supported safe")),[2,s]);case 2:return o=t.sent(),a=n(o.results,1),[2,a[0].safeTxHash]}}))}))}function vo(r,n,i){return e(this,void 0,void 0,(function(){var e,s,o,a;return t(this,(function(t){switch(t.label){case 0:return[4,mo(r)];case 1:if(!(e=t.sent()))throw new Error("chainId: ".concat(r," is not supported safe"));t.label=2;case 2:return t.trys.push([2,4,,5]),[4,e.getMultisigTransactions(i)];case 3:return s=t.sent().results,(o=s.find((function(e){return e.safeTxHash.toLocaleLowerCase()===n.toLocaleLowerCase()})))?s.some((function(e){return!(e.nonce!==o.nonce||e.safeTxHash.toLocaleLowerCase()===n.toLocaleLowerCase()||!e.isExecuted||!e.isSuccessful)}))?[2,"rejected"]:null===o.isExecuted||null===o.isSuccessful?[2,null]:[2,{status:o.isExecuted&&o.isSuccessful||!1,transactionHash:o.transactionHash,blockNumber:o.blockNumber||null}]:[2,null];case 4:throw a=t.sent(),console.error(a),new Error("safeTxHash: ".concat(n," is not valid."));case 5:return[2]}}))}))}function Ao(e,t,r){var n={1:"eth",5:"gor",137:"matic",56:"bnb",42161:"arb1",10:"oeth",43114:"avax",1313161554:"aurora"}[t];if(!n)throw new Error("Not Supported network: ".concat(t));return"https://app.safe.global/transactions/tx?id=multisig_".concat(r,"_").concat(e,"&safe=").concat(n,"%3A").concat(r)}export{$s as default,go as getAccountIsSafe,Xs as getConnectedSafe,Zs as getIsSafe,Ao as getSafeHashDetailUrl,yo as getSafeTxHash,vo as getSafeTxStatus};