text: (self.webpackChunkborder=self.webpackChunkborder||[]).push([[4427],{48709:function(e){"use strict";!function(t){function r(e){return parseInt(e)===e}function n(e){if(!r(e.length))return!1;for(var t=0;t<e.length;t++)if(!r(e[t])||e[t]<0||e[t]>255)return!1;return!0}function o(e,t){if(e.buffer&&ArrayBuffer.isView(e)&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!n(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(r(e.length)&&n(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,o){null==n&&null==o||(e=e.slice?e.slice(n,o):Array.prototype.slice.call(e,n,o)),t.set(e,r)}var a,l={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r<e.length;){var n=e.charCodeAt(r++);37===n?(t.push(parseInt(e.substr(r,2),16)),r+=2):t.push(n)}return o(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("")}},c=(a="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(a[(240&n)>>4]+a[15&n])}return t.join("")}}),u={16:10,24:12,32:14},h=[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],d=[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],f=[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],p=[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],m=[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],g=[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],y=[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],v=[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],w=[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],b=[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],E=[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],k=[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],_=[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],P=[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],A=[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 S(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 N=function(e){if(!(this instanceof N))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:o(e,!0)}),this._prepare()};N.prototype._prepare=function(){var e=u[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),o=this.key.length/4,i=S(this.key);for(t=0;t<o;t++)r=t>>2,this._Ke[r][t%4]=i[t],this._Kd[e-r][t%4]=i[t];for(var s,a=0,l=o;l<n;){if(s=i[o-1],i[0]^=d[s>>16&255]<<24^d[s>>8&255]<<16^d[255&s]<<8^d[s>>24&255]^h[a]<<24,a+=1,8!=o)for(t=1;t<o;t++)i[t]^=i[t-1];else{for(t=1;t<o/2;t++)i[t]^=i[t-1];for(s=i[o/2-1],i[o/2]^=d[255&s]^d[s>>8&255]<<8^d[s>>16&255]<<16^d[s>>24&255]<<24,t=o/2+1;t<o;t++)i[t]^=i[t-1]}for(t=0;t<o&&l<n;)c=l>>2,f=l%4,this._Ke[c][f]=i[t],this._Kd[e-c][f]=i[t++],l++}for(var c=1;c<e;c++)for(var f=0;f<4;f++)s=this._Kd[c][f],this._Kd[c][f]=k[s>>24&255]^_[s>>16&255]^P[s>>8&255]^A[255&s]},N.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=S(e),o=0;o<4;o++)n[o]^=this._Ke[0][o];for(var s=1;s<t;s++){for(o=0;o<4;o++)r[o]=p[n[o]>>24&255]^m[n[(o+1)%4]>>16&255]^g[n[(o+2)%4]>>8&255]^y[255&n[(o+3)%4]]^this._Ke[s][o];n=r.slice()}var a,l=i(16);for(o=0;o<4;o++)a=this._Ke[t][o],l[4*o]=255&(d[n[o]>>24&255]^a>>24),l[4*o+1]=255&(d[n[(o+1)%4]>>16&255]^a>>16),l[4*o+2]=255&(d[n[(o+2)%4]>>8&255]^a>>8),l[4*o+3]=255&(d[255&n[(o+3)%4]]^a);return l},N.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=S(e),o=0;o<4;o++)n[o]^=this._Kd[0][o];for(var s=1;s<t;s++){for(o=0;o<4;o++)r[o]=v[n[o]>>24&255]^w[n[(o+3)%4]>>16&255]^b[n[(o+2)%4]>>8&255]^E[255&n[(o+1)%4]]^this._Kd[s][o];n=r.slice()}var a,l=i(16);for(o=0;o<4;o++)a=this._Kd[t][o],l[4*o]=255&(f[n[o]>>24&255]^a>>24),l[4*o+1]=255&(f[n[(o+3)%4]>>16&255]^a>>16),l[4*o+2]=255&(f[n[(o+2)%4]>>8&255]^a>>8),l[4*o+3]=255&(f[255&n[(o+1)%4]]^a);return l};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 N(e)};T.prototype.encrypt=function(e){if((e=o(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),n=0;n<e.length;n+=16)s(e,r,0,n,n+16),s(r=this._aes.encrypt(r),t,n);return t},T.prototype.decrypt=function(e){if((e=o(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),n=0;n<e.length;n+=16)s(e,r,0,n,n+16),s(r=this._aes.decrypt(r),t,n);return t};var C=function(e,t){if(!(this instanceof C))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=o(t,!0),this._aes=new N(e)};C.prototype.encrypt=function(e){if((e=o(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),n=0;n<e.length;n+=16){s(e,r,0,n,n+16);for(var a=0;a<16;a++)r[a]^=this._lastCipherblock[a];this._lastCipherblock=this._aes.encrypt(r),s(this._lastCipherblock,t,n)}return t},C.prototype.decrypt=function(e){if((e=o(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),n=0;n<e.length;n+=16){s(e,r,0,n,n+16),r=this._aes.decrypt(r);for(var a=0;a<16;a++)t[n+a]=r[a]^this._lastCipherblock[a];s(e,this._lastCipherblock,0,n,n+16)}return t};var R=function(e,t,r){if(!(this instanceof R))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=o(t,!0),this._aes=new N(e)};R.prototype.encrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t,r=o(e,!0),n=0;n<r.length;n+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var i=0;i<this.segmentSize;i++)r[n+i]^=t[i];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(r,this._shiftRegister,16-this.segmentSize,n,n+this.segmentSize)}return r},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=o(e,!0),n=0;n<r.length;n+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var i=0;i<this.segmentSize;i++)r[n+i]^=t[i];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(e,this._shiftRegister,16-this.segmentSize,n,n+this.segmentSize)}return r};var x=function(e,t){if(!(this instanceof x))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=o(t,!0),this._lastPrecipherIndex=16,this._aes=new N(e)};x.prototype.encrypt=function(e){for(var t=o(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},x.prototype.decrypt=x.prototype.encrypt;var B=function(e){if(!(this instanceof B))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)};B.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},B.prototype.setBytes=function(e){if(16!=(e=o(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},B.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var I=function(e,t){if(!(this instanceof I))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof B||(t=new B(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new N(e)};I.prototype.encrypt=function(e){for(var t=o(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},I.prototype.decrypt=I.prototype.encrypt;var O={AES:N,Counter:B,ModeOfOperation:{ecb:T,cbc:C,cfb:R,ofb:x,ctr:I},utils:{hex:c,utf8:l},padding:{pkcs7:{pad:function(e){var t=16-(e=o(e,!0)).length%16,r=i(e.length+t);s(e,r);for(var n=e.length;n<r.length;n++)r[n]=t;return r},strip:function(e){if((e=o(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,n=0;n<t;n++)if(e[r+n]!==t)throw new Error("PKCS#7 invalid padding byte");var a=i(r);return s(e,a,0,0,r),a}}},_arrayTest:{coerceArray:o,createArray:i,copyArray:s}};e.exports=O}()},23951:(e,t,r)=>{"use strict";r.d(t,{Gy:()=>d,bP:()=>c,JQ:()=>u,o:()=>h});var n=r(33715),o=r.n(n),i=r(93286),s=r(21261),a=r(80711);const l=new a.Yd("sha2/5.5.0");function c(e){return"0x"+o().ripemd160().update((0,i.lE)(e)).digest("hex")}function u(e){return"0x"+o().sha256().update((0,i.lE)(e)).digest("hex")}function h(e){return"0x"+o().sha512().update((0,i.lE)(e)).digest("hex")}function d(e,t,r){return s.p[e]||l.throwError("unsupported algorithm "+e,a.Yd.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:e}),"0x"+o().hmac(o()[e],(0,i.lE)(t)).update((0,i.lE)(r)).digest("hex")}},21261:(e,t,r)=>{"use strict";var n;r.d(t,{p:()=>n}),function(e){e.sha256="sha256",e.sha512="sha512"}(n||(n={}))},33777:(e,t,r)=>{"use strict";r.d(t,{wn:()=>m,P2:()=>p,JQ:()=>g});var n=r(2593),o=r(93286),i=r(38197),s=r(23951),a=r(44242),l=r(80711);const c=new RegExp("^bytes([0-9]+)$"),u=new RegExp("^(u?int)([0-9]*)$"),h=new RegExp("^(.*)\\[([0-9]*)\\]$"),d=new l.Yd("solidity/5.5.0");function f(e,t,r){switch(e){case"address":return r?(0,o.Bu)(t,32):(0,o.lE)(t);case"string":return(0,a.Y0)(t);case"bytes":return(0,o.lE)(t);case"bool":return t=t?"0x01":"0x00",r?(0,o.Bu)(t,32):(0,o.lE)(t)}let i=e.match(u);if(i){let s=parseInt(i[2]||"256");return(i[2]&&String(s)!==i[2]||s%8!=0||0===s||s>256)&&d.throwArgumentError("invalid number type","type",e),r&&(s=256),t=n.O$.from(t).toTwos(s),(0,o.Bu)(t,s/8)}if(i=e.match(c),i){const n=parseInt(i[1]);return(String(n)!==i[1]||0===n||n>32)&&d.throwArgumentError("invalid bytes type","type",e),(0,o.lE)(t).byteLength!==n&&d.throwArgumentError(`invalid value for ${e}`,"value",t),r?(0,o.lE)((t+"0000000000000000000000000000000000000000000000000000000000000000").substring(0,66)):t}if(i=e.match(h),i&&Array.isArray(t)){const r=i[1];parseInt(i[2]||String(t.length))!=t.length&&d.throwArgumentError(`invalid array length for ${e}`,"value",t);const n=[];return t.forEach((function(e){n.push(f(r,e,!0))})),(0,o.zo)(n)}return d.throwArgumentError("invalid type","type",e)}function p(e,t){e.length!=t.length&&d.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);const r=[];return e.forEach((function(e,n){r.push(f(e,t[n]))})),(0,o.Dv)((0,o.zo)(r))}function m(e,t){return(0,i.w)(p(e,t))}function g(e,t){return(0,s.JQ)(p(e,t))}},92882:e=>{"use strict";for(var t="qpzry9x8gf2tvdw0s3jn54khce6mua7l",r={},n=0;n<t.length;n++){var o=t.charAt(n);if(void 0!==r[o])throw new TypeError(o+" is ambiguous");r[o]=n}function i(e){var t=e>>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function s(e){for(var t=1,r=0;r<e.length;++r){var n=e.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+e+")";t=i(t)^n>>5}for(t=i(t),r=0;r<e.length;++r){var o=e.charCodeAt(r);t=i(t)^31&o}return t}function a(e,t){if(t=t||90,e.length<8)return e+" too short";if(e.length>t)return"Exceeds length limit";var n=e.toLowerCase(),o=e.toUpperCase();if(e!==n&&e!==o)return"Mixed-case string "+e;var a=(e=n).lastIndexOf("1");if(-1===a)return"No separator character for "+e;if(0===a)return"Missing prefix for "+e;var l=e.slice(0,a),c=e.slice(a+1);if(c.length<6)return"Data too short";var u=s(l);if("string"==typeof u)return u;for(var h=[],d=0;d<c.length;++d){var f=c.charAt(d),p=r[f];if(void 0===p)return"Unknown character "+f;u=i(u)^p,d+6>=c.length||h.push(p)}return 1!==u?"Invalid checksum for "+e:{prefix:l,words:h}}function l(e,t,r,n){for(var o=0,i=0,s=(1<<r)-1,a=[],l=0;l<e.length;++l)for(o=o<<t|e[l],i+=t;i>=r;)i-=r,a.push(o>>i&s);if(n)i>0&&a.push(o<<r-i&s);else{if(i>=t)return"Excess padding";if(o<<r-i&s)return"Non-zero padding"}return a}e.exports={decodeUnsafe:function(){var e=a.apply(null,arguments);if("object"==typeof e)return e},decode:function(e){var t=a.apply(null,arguments);if("object"==typeof t)return t;throw new Error(t)},encode:function(e,r,n){if(n=n||90,e.length+7+r.length>n)throw new TypeError("Exceeds length limit");var o=s(e=e.toLowerCase());if("string"==typeof o)throw new Error(o);for(var a=e+"1",l=0;l<r.length;++l){var c=r[l];if(c>>5!=0)throw new Error("Non 5-bit word");o=i(o)^c,a+=t.charAt(c)}for(l=0;l<6;++l)o=i(o);for(o^=1,l=0;l<6;++l)a+=t.charAt(o>>5*(5-l)&31);return a},toWordsUnsafe:function(e){var t=l(e,8,5,!0);if(Array.isArray(t))return t},toWords:function(e){var t=l(e,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)},fromWordsUnsafe:function(e){var t=l(e,5,8,!1);if(Array.isArray(t))return t},fromWords:function(e){var t=l(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}}},77191:(e,t,r)=>{var n=r(58162);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},20536:(e,t,r)=>{"use strict";r.r(t),r.d(t,{BaseContract:()=>U,BigNumber:()=>u.O$,Contract:()=>z,ContractFactory:()=>M,FixedNumber:()=>X,Signer:()=>b,VoidSigner:()=>E,Wallet:()=>St,Wordlist:()=>Ce,constants:()=>n,errors:()=>d.jK,ethers:()=>a,getDefaultProvider:()=>to,logger:()=>yo,providers:()=>o,utils:()=>s,version:()=>go,wordlists:()=>Ie});var n={};r.r(n),r.d(n,{AddressZero:()=>Ct,EtherSymbol:()=>Bt,HashZero:()=>xt,MaxInt256:()=>Rt.PS,MaxUint256:()=>Rt.Bz,MinInt256:()=>Rt.$B,NegativeOne:()=>Rt.tL,One:()=>Rt.fh,Two:()=>Rt.Py,WeiPerEther:()=>Rt.Ce,Zero:()=>Rt._Y});var o={};r.r(o),r.d(o,{AlchemyProvider:()=>dn,AlchemyWebSocketProvider:()=>hn,BaseProvider:()=>zr,CloudflareProvider:()=>pn,EtherscanProvider:()=>_n,FallbackProvider:()=>Ln,Formatter:()=>yr,InfuraProvider:()=>Yn,InfuraWebSocketProvider:()=>Kn,IpcProvider:()=>Un,JsonRpcBatchProvider:()=>$n,JsonRpcProvider:()=>Qr,JsonRpcSigner:()=>Vr,NodesmithProvider:()=>Hn,PocketProvider:()=>Vn,Provider:()=>m,Resolver:()=>Gr,StaticJsonRpcProvider:()=>an,UrlJsonRpcProvider:()=>ln,Web3Provider:()=>Xn,WebSocketProvider:()=>on,getDefaultProvider:()=>to,getNetwork:()=>zt,isCommunityResourcable:()=>vr,isCommunityResource:()=>wr,showThrottleMessage:()=>Er});var i={};r.r(i),r.d(i,{decode:()=>nr,encode:()=>or});var s={};r.r(s),r.d(s,{AbiCoder:()=>ro.R,ConstructorFragment:()=>no.Xg,ErrorFragment:()=>no.IC,EventFragment:()=>no.QV,FormatTypes:()=>no.pc,Fragment:()=>no.HY,FunctionFragment:()=>no.YW,HDNode:()=>$e,Indexed:()=>c.Hk,Interface:()=>c.vU,LogDescription:()=>c.CC,Logger:()=>d.Yd,ParamType:()=>no._R,RLP:()=>io,SigningKey:()=>Se.Et,SupportedAlgorithm:()=>Ne.p,TransactionDescription:()=>c.vk,TransactionTypes:()=>P.TransactionTypes,UnicodeNormalizationForm:()=>ne.Uj,Utf8ErrorFuncs:()=>ne.te,Utf8ErrorReason:()=>ne.Uw,_TypedDataEncoder:()=>Ee,_fetchData:()=>cr,_toEscapedUtf8String:()=>ne.U$,accessListify:()=>P.accessListify,arrayify:()=>_.lE,base58:()=>_e,base64:()=>i,checkProperties:()=>h.uj,checkResultErrors:()=>l.BR,commify:()=>uo,computeAddress:()=>P.computeAddress,computeHmac:()=>Pe.Gy,computePublicKey:()=>Se.VW,concat:()=>_.zo,deepCopy:()=>h.p$,defaultAbiCoder:()=>ro.$,defaultPath:()=>Ye,defineReadOnly:()=>h.zG,entropyToMnemonic:()=>We,fetchJson:()=>ur,formatBytes32String:()=>so,formatEther:()=>po,formatUnits:()=>ho,getAccountPath:()=>Ve,getAddress:()=>k.Kn,getContractAddress:()=>k.CR,getCreate2Address:()=>k.hB,getIcapAddress:()=>k.vU,getJsonWalletAddress:()=>ft,getStatic:()=>h.tu,hashMessage:()=>oe,hexConcat:()=>_.xs,hexDataLength:()=>_.E1,hexDataSlice:()=>_.p3,hexStripZeros:()=>_.Ou,hexValue:()=>_.$P,hexZeroPad:()=>_.$m,hexlify:()=>_.Dv,id:()=>se.id,isAddress:()=>k.UJ,isBytes:()=>_._t,isBytesLike:()=>_.Zq,isHexString:()=>_.A7,isValidMnemonic:()=>qe,isValidName:()=>tr,joinSignature:()=>_.gV,keccak256:()=>re.w,mnemonicToEntropy:()=>He,mnemonicToSeed:()=>je,namehash:()=>rr,nameprep:()=>Zt,parseBytes32String:()=>ao,parseEther:()=>mo,parseTransaction:()=>P.parse,parseUnits:()=>fo,poll:()=>hr,randomBytes:()=>Xe,recoverAddress:()=>P.recoverAddress,recoverPublicKey:()=>Se.LO,resolveProperties:()=>h.mE,ripemd160:()=>Pe.bP,serializeTransaction:()=>P.serialize,sha256:()=>Pe.JQ,sha512:()=>Pe.o,shallowCopy:()=>h.DC,shuffled:()=>Pn,solidityKeccak256:()=>oo.wn,solidityPack:()=>oo.P2,soliditySha256:()=>oo.JQ,splitSignature:()=>_.N,stripZeros:()=>_.G1,toUtf8Bytes:()=>ne.Y0,toUtf8CodePoints:()=>ne.XL,toUtf8String:()=>ne.ZN,verifyMessage:()=>Nt,verifyTypedData:()=>Tt,zeroPad:()=>_.Bu});var a={};r.r(a),r.d(a,{BaseContract:()=>U,BigNumber:()=>u.O$,Contract:()=>z,ContractFactory:()=>M,FixedNumber:()=>X,Signer:()=>b,VoidSigner:()=>E,Wallet:()=>St,Wordlist:()=>Ce,constants:()=>n,errors:()=>d.jK,getDefaultProvider:()=>to,logger:()=>yo,providers:()=>o,utils:()=>s,version:()=>go,wordlists:()=>Ie});var l=r(61184),c=r(8198),u=r(2593),h=r(53587),d=r(80711);const f=new d.Yd("abstract-provider/5.5.1");class p extends h.dk{static isForkEvent(e){return!(!e||!e._isForkEvent)}}class m{constructor(){f.checkAbstract(new.target,m),(0,h.zG)(this,"_isProvider",!0)}getFeeData(){return e=this,t=void 0,n=function*(){const{block:e,gasPrice:t}=yield(0,h.mE)({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((e=>null))});let r=null,n=null;return e&&e.baseFeePerGas&&(n=u.O$.from("2500000000"),r=e.baseFeePerGas.mul(2).add(n)),{maxFeePerGas:r,maxPriorityFeePerGas:n,gasPrice:t}},new((r=void 0)||(r=Promise))((function(o,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}));var e,t,r,n}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!(!e||!e._isProvider)}}var g=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const y=new d.Yd("abstract-signer/5.5.0"),v=["accessList","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],w=[d.Yd.errors.INSUFFICIENT_FUNDS,d.Yd.errors.NONCE_EXPIRED,d.Yd.errors.REPLACEMENT_UNDERPRICED];class b{constructor(){y.checkAbstract(new.target,b),(0,h.zG)(this,"_isSigner",!0)}getBalance(e){return g(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)}))}getTransactionCount(e){return g(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)}))}estimateGas(e){return g(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const t=yield(0,h.mE)(this.checkTransaction(e));return yield this.provider.estimateGas(t)}))}call(e,t){return g(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield(0,h.mE)(this.checkTransaction(e));return yield this.provider.call(r,t)}))}sendTransaction(e){return g(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 g(this,void 0,void 0,(function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return g(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return g(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(e){return g(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)}))}checkTransaction(e){for(const t in e)-1===v.indexOf(t)&&y.throwArgumentError("invalid transaction key: "+t,"transaction",e);const t=(0,h.DC)(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()&&y.throwArgumentError("from address mismatch","transaction",e),t[0]))),t}populateTransaction(e){return g(this,void 0,void 0,(function*(){const t=yield(0,h.mE)(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then((e=>g(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&y.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||y.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):y.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&&y.throwError("network does not support EIP-1559",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):y.throwError("failed to get consistent fee data",d.Yd.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(w.indexOf(e.code)>=0)throw e;return y.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",d.Yd.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]&&y.throwArgumentError("chainId address mismatch","transaction",e),t[0]))),yield(0,h.mE)(t)}))}_checkProvider(e){this.provider||y.throwError("missing provider",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}}class E extends b{constructor(e,t){y.checkNew(new.target,E),super(),(0,h.zG)(this,"address",e),(0,h.zG)(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then((()=>{y.throwError(e,d.Yd.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 E(this.address,e)}}var k=r(64594),_=r(93286),P=r(64377),A=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const S=new d.Yd("contracts/5.5.0"),N={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0,customData:!0};function T(e,t){return A(this,void 0,void 0,(function*(){const r=yield t;"string"!=typeof r&&S.throwArgumentError("invalid address or ENS name","name",r);try{return(0,k.Kn)(r)}catch(e){}e||S.throwError("a provider or signer is needed to resolve ENS names",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield e.resolveName(r);return null==n&&S.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n}))}function C(e,t,r){return A(this,void 0,void 0,(function*(){return Array.isArray(r)?yield Promise.all(r.map(((r,n)=>C(e,Array.isArray(t)?t[n]:t[r.name],r)))):"address"===r.type?yield T(e,t):"tuple"===r.type?yield C(e,t,r.components):"array"===r.baseType?Array.isArray(t)?yield Promise.all(t.map((t=>C(e,t,r.arrayChildren)))):Promise.reject(S.makeError("invalid value for array",d.Yd.errors.INVALID_ARGUMENT,{argument:"value",value:t})):t}))}function R(e,t,r){return A(this,void 0,void 0,(function*(){let n={};r.length===t.inputs.length+1&&"object"==typeof r[r.length-1]&&(n=(0,h.DC)(r.pop())),S.checkArgumentCount(r.length,t.inputs.length,"passed to contract"),e.signer?n.from?n.from=(0,h.mE)({override:T(e.signer,n.from),signer:e.signer.getAddress()}).then((e=>A(this,void 0,void 0,(function*(){return(0,k.Kn)(e.signer)!==e.override&&S.throwError("Contract with a Signer cannot override from",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),e.override})))):n.from=e.signer.getAddress():n.from&&(n.from=T(e.provider,n.from));const o=yield(0,h.mE)({args:C(e.signer||e.provider,r,t.inputs),address:e.resolvedAddress,overrides:(0,h.mE)(n)||{}}),i=e.interface.encodeFunctionData(t,o.args),s={data:i,to:o.address},a=o.overrides;if(null!=a.nonce&&(s.nonce=u.O$.from(a.nonce).toNumber()),null!=a.gasLimit&&(s.gasLimit=u.O$.from(a.gasLimit)),null!=a.gasPrice&&(s.gasPrice=u.O$.from(a.gasPrice)),null!=a.maxFeePerGas&&(s.maxFeePerGas=u.O$.from(a.maxFeePerGas)),null!=a.maxPriorityFeePerGas&&(s.maxPriorityFeePerGas=u.O$.from(a.maxPriorityFeePerGas)),null!=a.from&&(s.from=a.from),null!=a.type&&(s.type=a.type),null!=a.accessList&&(s.accessList=(0,P.accessListify)(a.accessList)),null==s.gasLimit&&null!=t.gas){let e=21e3;const r=(0,_.lE)(i);for(let t=0;t<r.length;t++)e+=4,r[t]&&(e+=64);s.gasLimit=u.O$.from(t.gas).add(e)}if(a.value){const e=u.O$.from(a.value);e.isZero()||t.payable||S.throwError("non-payable method cannot override value",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:n.value}),s.value=e}a.customData&&(s.customData=(0,h.DC)(a.customData)),delete n.nonce,delete n.gasLimit,delete n.gasPrice,delete n.from,delete n.value,delete n.type,delete n.accessList,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.customData;const l=Object.keys(n).filter((e=>null!=n[e]));return l.length&&S.throwError(`cannot override ${l.map((e=>JSON.stringify(e))).join(",")}`,d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),s}))}function x(e,t){const r=t.wait.bind(t);t.wait=t=>r(t).then((t=>(t.events=t.logs.map((r=>{let n=(0,h.p$)(r),o=null;try{o=e.interface.parseLog(r)}catch(e){}return o&&(n.args=o.args,n.decode=(t,r)=>e.interface.decodeEventLog(o.eventFragment,t,r),n.event=o.name,n.eventSignature=o.signature),n.removeListener=()=>e.provider,n.getBlock=()=>e.provider.getBlock(t.blockHash),n.getTransaction=()=>e.provider.getTransaction(t.transactionHash),n.getTransactionReceipt=()=>Promise.resolve(t),n})),t)))}function B(e,t,r){const n=e.signer||e.provider;return function(...o){return A(this,void 0,void 0,(function*(){let i;if(o.length===t.inputs.length+1&&"object"==typeof o[o.length-1]){const e=(0,h.DC)(o.pop());null!=e.blockTag&&(i=yield e.blockTag),delete e.blockTag,o.push(e)}null!=e.deployTransaction&&(yield e._deployed(i));const s=yield R(e,t,o),a=yield n.call(s,i);try{let n=e.interface.decodeFunctionResult(t,a);return r&&1===t.outputs.length&&(n=n[0]),n}catch(t){throw t.code===d.Yd.errors.CALL_EXCEPTION&&(t.address=e.address,t.args=o,t.transaction=s),t}}))}}function I(e,t,r){return t.constant?B(e,t,r):function(e,t){return function(...r){return A(this,void 0,void 0,(function*(){e.signer||S.throwError("sending a transaction requires a signer",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=e.deployTransaction&&(yield e._deployed());const n=yield R(e,t,r),o=yield e.signer.sendTransaction(n);return x(e,o),o}))}}(e,t)}function O(e){return!e.address||null!=e.topics&&0!==e.topics.length?(e.address||"*")+"@"+(e.topics?e.topics.map((e=>Array.isArray(e)?e.join("|"):e)).join(":"):""):"*"}class D{constructor(e,t){(0,h.zG)(this,"tag",e),(0,h.zG)(this,"filter",t),this._listeners=[]}addListener(e,t){this._listeners.push({listener:e,once:t})}removeListener(e){let t=!1;this._listeners=this._listeners.filter((r=>!(!t&&r.listener===e&&(t=!0,1))))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((e=>e.listener))}listenerCount(){return this._listeners.length}run(e){const t=this.listenerCount();return this._listeners=this._listeners.filter((t=>{const r=e.slice();return setTimeout((()=>{t.listener.apply(this,r)}),0),!t.once})),t}prepareEvent(e){}getEmit(e){return[e]}}class F extends D{constructor(){super("error",null)}}class G extends D{constructor(e,t,r,n){const o={address:e};let i=t.getEventTopic(r);n?(i!==n[0]&&S.throwArgumentError("topic mismatch","topics",n),o.topics=n.slice()):o.topics=[i],super(O(o),o),(0,h.zG)(this,"address",e),(0,h.zG)(this,"interface",t),(0,h.zG)(this,"fragment",r)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(e,t)=>this.interface.decodeEventLog(this.fragment,e,t);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(t){e.args=null,e.decodeError=t}}getEmit(e){const t=(0,l.BR)(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class L extends D{constructor(e,t){super("*",{address:e}),(0,h.zG)(this,"address",e),(0,h.zG)(this,"interface",t)}prepareEvent(e){super.prepareEvent(e);try{const t=this.interface.parseLog(e);e.event=t.name,e.eventSignature=t.signature,e.decode=(e,r)=>this.interface.decodeEventLog(t.eventFragment,e,r),e.args=t.args}catch(e){}}}class U{constructor(e,t,r){S.checkNew(new.target,z),(0,h.zG)(this,"interface",(0,h.tu)(new.target,"getInterface")(t)),null==r?((0,h.zG)(this,"provider",null),(0,h.zG)(this,"signer",null)):b.isSigner(r)?((0,h.zG)(this,"provider",r.provider||null),(0,h.zG)(this,"signer",r)):m.isProvider(r)?((0,h.zG)(this,"provider",r),(0,h.zG)(this,"signer",null)):S.throwArgumentError("invalid signer or provider","signerOrProvider",r),(0,h.zG)(this,"callStatic",{}),(0,h.zG)(this,"estimateGas",{}),(0,h.zG)(this,"functions",{}),(0,h.zG)(this,"populateTransaction",{}),(0,h.zG)(this,"filters",{});{const e={};Object.keys(this.interface.events).forEach((t=>{const r=this.interface.events[t];(0,h.zG)(this.filters,t,((...e)=>({address:this.address,topics:this.interface.encodeFilterTopics(r,e)}))),e[r.name]||(e[r.name]=[]),e[r.name].push(t)})),Object.keys(e).forEach((t=>{const r=e[t];1===r.length?(0,h.zG)(this.filters,t,this.filters[r[0]]):S.warn(`Duplicate definition of ${t} (${r.join(", ")})`)}))}if((0,h.zG)(this,"_runningEvents",{}),(0,h.zG)(this,"_wrappedEmits",{}),null==e&&S.throwArgumentError("invalid contract address or ENS name","addressOrName",e),(0,h.zG)(this,"address",e),this.provider)(0,h.zG)(this,"resolvedAddress",T(this.provider,e));else try{(0,h.zG)(this,"resolvedAddress",Promise.resolve((0,k.Kn)(e)))}catch(e){S.throwError("provider is required to use ENS name as contract address",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}const n={},o={};Object.keys(this.interface.functions).forEach((e=>{const t=this.interface.functions[e];if(o[e])S.warn(`Duplicate ABI entry for ${JSON.stringify(e)}`);else{o[e]=!0;{const r=t.name;n[`%${r}`]||(n[`%${r}`]=[]),n[`%${r}`].push(e)}null==this[e]&&(0,h.zG)(this,e,I(this,t,!0)),null==this.functions[e]&&(0,h.zG)(this.functions,e,I(this,t,!1)),null==this.callStatic[e]&&(0,h.zG)(this.callStatic,e,B(this,t,!0)),null==this.populateTransaction[e]&&(0,h.zG)(this.populateTransaction,e,function(e,t){return function(...r){return R(e,t,r)}}(this,t)),null==this.estimateGas[e]&&(0,h.zG)(this.estimateGas,e,function(e,t){const r=e.signer||e.provider;return function(...n){return A(this,void 0,void 0,(function*(){r||S.throwError("estimate require a provider or signer",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const o=yield R(e,t,n);return yield r.estimateGas(o)}))}}(this,t))}})),Object.keys(n).forEach((e=>{const t=n[e];if(t.length>1)return;e=e.substring(1);const r=t[0];try{null==this[e]&&(0,h.zG)(this,e,this[r])}catch(e){}null==this.functions[e]&&(0,h.zG)(this.functions,e,this.functions[r]),null==this.callStatic[e]&&(0,h.zG)(this.callStatic,e,this.callStatic[r]),null==this.populateTransaction[e]&&(0,h.zG)(this.populateTransaction,e,this.populateTransaction[r]),null==this.estimateGas[e]&&(0,h.zG)(this.estimateGas,e,this.estimateGas[r])}))}static getContractAddress(e){return(0,k.CR)(e)}static getInterface(e){return c.vU.isInterface(e)?e:new c.vU(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,e).then((e=>("0x"===e&&S.throwError("contract not deployed",d.Yd.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(e){this.signer||S.throwError("sending a transactions require a signer",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=(0,h.DC)(e||{});return["from","to"].forEach((function(e){null!=t[e]&&S.throwError("cannot override "+e,d.Yd.errors.UNSUPPORTED_OPERATION,{operation:e})})),t.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(t)))}connect(e){"string"==typeof e&&(e=new E(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&(0,h.zG)(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return c.Hk.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if("string"==typeof e){if("error"===e)return this._normalizeRunningEvent(new F);if("event"===e)return this._normalizeRunningEvent(new D("event",null));if("*"===e)return this._normalizeRunningEvent(new L(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new G(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{const t=e.topics[0];if("string"!=typeof t)throw new Error("invalid topic");const r=this.interface.getEvent(t);return this._normalizeRunningEvent(new G(this.address,this.interface,r,e.topics))}catch(e){}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new D(O(t),t))}return this._normalizeRunningEvent(new L(this.address,this.interface))}_checkRunningEvents(e){if(0===e.listenerCount()){delete this._runningEvents[e.tag];const t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,t,r){const n=(0,h.p$)(t);return n.removeListener=()=>{r&&(e.removeListener(r),this._checkRunningEvents(e))},n.getBlock=()=>this.provider.getBlock(t.blockHash),n.getTransaction=()=>this.provider.getTransaction(t.transactionHash),n.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(n),n}_addEventListener(e,t,r){if(this.provider||S.throwError("events require a provider or a signer with a provider",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,r),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const r=r=>{let n=this._wrapEvent(e,r,t);if(null==n.decodeError)try{const t=e.getEmit(n);this.emit(e.filter,...t)}catch(e){n.decodeError=e.error}null!=e.filter&&this.emit("event",n),null!=n.decodeError&&this.emit("error",n.decodeError,n)};this._wrappedEmits[e.tag]=r,null!=e.filter&&this.provider.on(e.filter,r)}}queryFilter(e,t,r){const n=this._getRunningEvent(e),o=(0,h.DC)(n.filter);return"string"==typeof t&&(0,_.A7)(t,32)?(null!=r&&S.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),o.blockHash=t):(o.fromBlock=null!=t?t:0,o.toBlock=null!=r?r:"latest"),this.provider.getLogs(o).then((e=>e.map((e=>this._wrapEvent(n,e,null)))))}on(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}once(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}emit(e,...t){if(!this.provider)return!1;const r=this._getRunningEvent(e),n=r.run(t)>0;return this._checkRunningEvents(r),n}listenerCount(e){return this.provider?null==e?Object.keys(this._runningEvents).reduce(((e,t)=>e+this._runningEvents[t].listenerCount()),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(null==e){const e=[];for(let t in this._runningEvents)this._runningEvents[t].listeners().forEach((t=>{e.push(t)}));return e}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(null==e){for(const e in this._runningEvents){const t=this._runningEvents[e];t.removeAllListeners(),this._checkRunningEvents(t)}return this}const t=this._getRunningEvent(e);return t.removeAllListeners(),this._checkRunningEvents(t),this}off(e,t){if(!this.provider)return this;const r=this._getRunningEvent(e);return r.removeListener(t),this._checkRunningEvents(r),this}removeListener(e,t){return this.off(e,t)}}class z extends U{}class M{constructor(e,t,r){let n=null;n="string"==typeof t?t:(0,_._t)(t)?(0,_.Dv)(t):t&&"string"==typeof t.object?t.object:"!","0x"!==n.substring(0,2)&&(n="0x"+n),(!(0,_.A7)(n)||n.length%2)&&S.throwArgumentError("invalid bytecode","bytecode",t),r&&!b.isSigner(r)&&S.throwArgumentError("invalid signer","signer",r),(0,h.zG)(this,"bytecode",n),(0,h.zG)(this,"interface",(0,h.tu)(new.target,"getInterface")(e)),(0,h.zG)(this,"signer",r||null)}getDeployTransaction(...e){let t={};if(e.length===this.interface.deploy.inputs.length+1&&"object"==typeof e[e.length-1]){t=(0,h.DC)(e.pop());for(const e in t)if(!N[e])throw new Error("unknown transaction override "+e)}return["data","from","to"].forEach((e=>{null!=t[e]&&S.throwError("cannot override "+e,d.Yd.errors.UNSUPPORTED_OPERATION,{operation:e})})),t.value&&(u.O$.from(t.value).isZero()||this.interface.deploy.payable||S.throwError("non-payable constructor cannot override value",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:t.value})),S.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor"),t.data=(0,_.Dv)((0,_.zo)([this.bytecode,this.interface.encodeDeploy(e)])),t}deploy(...e){return A(this,void 0,void 0,(function*(){let t={};e.length===this.interface.deploy.inputs.length+1&&(t=e.pop()),S.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor");const r=yield C(this.signer,e,this.interface.deploy.inputs);r.push(t);const n=this.getDeployTransaction(...r),o=yield this.signer.sendTransaction(n),i=(0,h.tu)(this.constructor,"getContractAddress")(o),s=(0,h.tu)(this.constructor,"getContract")(i,this.interface,this.signer);return x(s,o),(0,h.zG)(s,"deployTransaction",o),s}))}attach(e){return this.constructor.getContract(e,this.interface,this.signer)}connect(e){return new this.constructor(this.interface,this.bytecode,e)}static fromSolidity(e,t){null==e&&S.throwError("missing compiler output",d.Yd.errors.MISSING_ARGUMENT,{argument:"compilerOutput"}),"string"==typeof e&&(e=JSON.parse(e));const r=e.abi;let n=null;return e.bytecode?n=e.bytecode:e.evm&&e.evm.bytecode&&(n=e.evm.bytecode),new this(r,n,t)}static getInterface(e){return z.getInterface(e)}static getContractAddress(e){return(0,k.CR)(e)}static getContract(e,t,r){return new z(e,t,r)}}var K=r(48794);const Y=new d.Yd(K.i),$={},j=u.O$.from(0),H=u.O$.from(-1);function W(e,t,r,n){const o={fault:t,operation:r};return void 0!==n&&(o.value=n),Y.throwError(e,d.Yd.errors.NUMERIC_FAULT,o)}let q="0";for(;q.length<256;)q+=q;function V(e){if("number"!=typeof e)try{e=u.O$.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+q.substring(0,e):Y.throwArgumentError("invalid decimal size","decimals",e)}function J(e,t){null==t&&(t=0);const r=V(t),n=(e=u.O$.from(e)).lt(j);n&&(e=e.mul(H));let o=e.mod(r).toString();for(;o.length<r.length-1;)o="0"+o;o=o.match(/^([0-9]*[1-9]|0)(0*)/)[1];const i=e.div(r).toString();return e=1===r.length?i:i+"."+o,n&&(e="-"+e),e}function Z(e,t){null==t&&(t=0);const r=V(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||Y.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&Y.throwArgumentError("missing value","value",e);const o=e.split(".");o.length>2&&Y.throwArgumentError("too many decimal points","value",e);let i=o[0],s=o[1];for(i||(i="0"),s||(s="0");"0"===s[s.length-1];)s=s.substring(0,s.length-1);for(s.length>r.length-1&&W("fractional component exceeds decimals","underflow","parseFixed"),""===s&&(s="0");s.length<r.length-1;)s+="0";const a=u.O$.from(i),l=u.O$.from(s);let c=a.mul(r).add(l);return n&&(c=c.mul(H)),c}class Q{constructor(e,t,r,n){e!==$&&Y.throwError("cannot use FixedFormat constructor; use FixedFormat.from",d.Yd.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=V(n),Object.freeze(this)}static from(e){if(e instanceof Q)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 o=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);o||Y.throwArgumentError("invalid fixed format","format",e),t="u"!==o[1],r=parseInt(o[2]),n=parseInt(o[3])}else if(e){const o=(t,r,n)=>null==e[t]?n:(typeof e[t]!==r&&Y.throwArgumentError("invalid fixed format ("+t+" not "+r+")","format."+t,e[t]),e[t]);t=o("signed","boolean",t),r=o("width","number",r),n=o("decimals","number",n)}return r%8&&Y.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&Y.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new Q($,t,r,n)}}class X{constructor(e,t,r,n){Y.checkNew(new.target,X),e!==$&&Y.throwError("cannot use FixedNumber constructor; use FixedNumber.from",d.Yd.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&&Y.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=Z(this._value,this.format.decimals),r=Z(e._value,e.format.decimals);return X.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=Z(this._value,this.format.decimals),r=Z(e._value,e.format.decimals);return X.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=Z(this._value,this.format.decimals),r=Z(e._value,e.format.decimals);return X.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=Z(this._value,this.format.decimals),r=Z(e._value,e.format.decimals);return X.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=X.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(ee.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=X.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(ee.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)&&Y.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=X.from("1"+q.substring(0,e),this.format),n=te.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&&Y.throwArgumentError("invalid byte width","width",e);const t=u.O$.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return(0,_.$m)(t,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return X.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||(0,u.Zm)(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),X.fromString(J(e,t),Q.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=Q.from(t),n=Z(e,r.decimals);!r.signed&&n.lt(j)&&W("unsigned value cannot be negative","overflow","value",e);let o=null;r.signed?o=n.toTwos(r.width).toHexString():(o=n.toHexString(),o=(0,_.$m)(o,r.width/8));const i=J(n,r.decimals);return new X($,o,i,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=Q.from(t);if((0,_.lE)(e).length>r.width/8)throw new Error("overflow");let n=u.O$.from(e);r.signed&&(n=n.fromTwos(r.width));const o=n.toTwos((r.signed?0:1)+r.width).toHexString(),i=J(n,r.decimals);return new X($,o,i,r)}static from(e,t){if("string"==typeof e)return X.fromString(e,t);if((0,_._t)(e))return X.fromBytes(e,t);try{return X.fromValue(e,0,t)}catch(e){if(e.code!==d.Yd.errors.INVALID_ARGUMENT)throw e}return Y.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const ee=X.from(1),te=X.from("0.5");var re=r(38197),ne=r(44242);function oe(e){return"string"==typeof e&&(e=(0,ne.Y0)(e)),(0,re.w)((0,_.zo)([(0,ne.Y0)("Ethereum Signed Message:\n"),(0,ne.Y0)(String(e.length)),e]))}const ie="hash/5.5.0";var se=r(32046);const ae=new d.Yd(ie),le=new Uint8Array(32);le.fill(0);const ce=u.O$.from(-1),ue=u.O$.from(0),he=u.O$.from(1),de=u.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),fe=(0,_.$m)(he.toHexString(),32),pe=(0,_.$m)(ue.toHexString(),32),me={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},ge=["name","version","chainId","verifyingContract","salt"];function ye(e){return function(t){return"string"!=typeof t&&ae.throwArgumentError(`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const ve={name:ye("name"),version:ye("version"),chainId:function(e){try{return u.O$.from(e).toString()}catch(e){}return ae.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return(0,k.Kn)(e).toLowerCase()}catch(e){}return ae.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=(0,_.lE)(e);if(32!==t.length)throw new Error("bad length");return(0,_.Dv)(t)}catch(e){}return ae.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function we(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))&&ae.throwArgumentError("invalid numeric width","type",e);const o=de.mask(r?n-1:n),i=r?o.add(he).mul(ce):ue;return function(t){const r=u.O$.from(t);return(r.lt(i)||r.gt(o))&&ae.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),(0,_.$m)(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))&&ae.throwArgumentError("invalid bytes width","type",e),function(t){return(0,_.lE)(t).length!==r&&ae.throwArgumentError(`invalid length for ${e}`,"value",t),function(e){const t=(0,_.lE)(e),r=t.length%32;return r?(0,_.xs)([t,le.slice(r)]):(0,_.Dv)(t)}(t)}}}switch(e){case"address":return function(e){return(0,_.$m)((0,k.Kn)(e),32)};case"bool":return function(e){return e?fe:pe};case"bytes":return function(e){return(0,re.w)(e)};case"string":return function(e){return(0,se.id)(e)}}return null}function be(e,t){return`${e}(${t.map((({name:e,type:t})=>t+" "+e)).join(",")})`}class Ee{constructor(e){(0,h.zG)(this,"types",Object.freeze((0,h.p$)(e))),(0,h.zG)(this,"_encoderCache",{}),(0,h.zG)(this,"_types",{});const t={},r={},n={};Object.keys(e).forEach((e=>{t[e]={},r[e]=[],n[e]={}}));for(const n in e){const o={};e[n].forEach((i=>{o[i.name]&&ae.throwArgumentError(`duplicate variable name ${JSON.stringify(i.name)} in ${JSON.stringify(n)}`,"types",e),o[i.name]=!0;const s=i.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===n&&ae.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",e),we(s)||(r[s]||ae.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",e),r[s].push(n),t[n][s]=!0)}))}const o=Object.keys(r).filter((e=>0===r[e].length));0===o.length?ae.throwArgumentError("missing primary type","types",e):o.length>1&&ae.throwArgumentError(`ambiguous primary types or unused types: ${o.map((e=>JSON.stringify(e))).join(", ")}`,"types",e),(0,h.zG)(this,"primaryType",o[0]),function o(i,s){s[i]&&ae.throwArgumentError(`circular type reference to ${JSON.stringify(i)}`,"types",e),s[i]=!0,Object.keys(t[i]).forEach((e=>{r[e]&&(o(e,s),Object.keys(s).forEach((t=>{n[t][e]=!0})))})),delete s[i]}(this.primaryType,{});for(const t in n){const r=Object.keys(n[t]);r.sort(),this._types[t]=be(t,e[t])+r.map((t=>be(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=we(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&&ae.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t);let o=t.map(r);return this._types[e]&&(o=o.map(re.w)),(0,re.w)((0,_.xs)(o))}}const r=this.types[e];if(r){const t=(0,se.id)(this._types[e]);return e=>{const n=r.map((({name:t,type:r})=>{const n=this.getEncoder(r)(e[t]);return this._types[r]?(0,re.w)(n):n}));return n.unshift(t),(0,_.xs)(n)}}return ae.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||ae.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return(0,re.w)(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(we(e))return r(e,t);const n=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const e=n[1],o=parseInt(n[3]);return o>=0&&t.length!==o&&ae.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((t=>this._visit(e,t,r)))}const o=this.types[e];return o?o.reduce(((e,{name:n,type:o})=>(e[n]=this._visit(o,t[n],r),e)),{}):ae.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new Ee(e)}static getPrimaryType(e){return Ee.from(e).primaryType}static hashStruct(e,t,r){return Ee.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const n=me[r];n||ae.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:n})}return t.sort(((e,t)=>ge.indexOf(e.name)-ge.indexOf(t.name))),Ee.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return(0,_.xs)(["0x1901",Ee.hashDomain(e),Ee.from(t).hash(r)])}static hash(e,t,r){return(0,re.w)(Ee.encode(e,t,r))}static resolveNames(e,t,r,n){return o=this,i=void 0,a=function*(){e=(0,h.DC)(e);const o={};e.verifyingContract&&!(0,_.A7)(e.verifyingContract,20)&&(o[e.verifyingContract]="0x");const i=Ee.from(t);i.visit(r,((e,t)=>("address"!==e||(0,_.A7)(t,20)||(o[t]="0x"),t)));for(const e in o)o[e]=yield n(e);return e.verifyingContract&&o[e.verifyingContract]&&(e.verifyingContract=o[e.verifyingContract]),r=i.visit(r,((e,t)=>"address"===e&&o[t]?o[t]:t)),{domain:e,value:r}},new((s=void 0)||(s=Promise))((function(e,t){function r(e){try{l(a.next(e))}catch(e){t(e)}}function n(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var o;t.done?e(t.value):(o=t.value,o instanceof s?o:new s((function(e){e(o)}))).then(r,n)}l((a=a.apply(o,i||[])).next())}));var o,i,s,a}static getPayload(e,t,r){Ee.hashDomain(e);const n={},o=[];ge.forEach((t=>{const r=e[t];null!=r&&(n[t]=ve[t](r),o.push({name:t,type:me[t]}))}));const i=Ee.from(t),s=(0,h.DC)(t);return s.EIP712Domain?ae.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):s.EIP712Domain=o,i.encode(r),{types:s,domain:n,primaryType:i.primaryType,message:i.visit(r,((e,t)=>{if(e.match(/^bytes(\d*)/))return(0,_.Dv)((0,_.lE)(t));if(e.match(/^u?int/))return u.O$.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!=typeof t&&ae.throwArgumentError("invalid string","value",t),t}return ae.throwArgumentError("unsupported type","type",e)}))}}}class ke{constructor(e){(0,h.zG)(this,"alphabet",e),(0,h.zG)(this,"base",e.length),(0,h.zG)(this,"_alphabetMap",{}),(0,h.zG)(this,"_leader",e.charAt(0));for(let t=0;t<e.length;t++)this._alphabetMap[e.charAt(t)]=t}encode(e){let t=(0,_.lE)(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 o=n;for(let e=0;e<t.length;++e)o+=t[e]*this.base,t[e]=255&o,o>>=8;for(;o>0;)t.push(255&o),o>>=8}for(let r=0;e[r]===this._leader&&r<e.length-1;++r)t.push(0);return(0,_.lE)(new Uint8Array(t.reverse()))}}new ke("abcdefghijklmnopqrstuvwxyz234567");const _e=new ke("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var Pe=r(23951);function Ae(e,t,r,n,o){let i;e=(0,_.lE)(e),t=(0,_.lE)(t);let s=1;const a=new Uint8Array(n),l=new Uint8Array(t.length+4);let c,u;l.set(t);for(let h=1;h<=s;h++){l[t.length]=h>>24&255,l[t.length+1]=h>>16&255,l[t.length+2]=h>>8&255,l[t.length+3]=255&h;let d=(0,_.lE)((0,Pe.Gy)(o,e,l));i||(i=d.length,u=new Uint8Array(i),s=Math.ceil(n/i),c=n-(s-1)*i),u.set(d);for(let t=1;t<r;t++){d=(0,_.lE)((0,Pe.Gy)(o,e,d));for(let e=0;e<i;e++)u[e]^=d[e]}const f=(h-1)*i,p=h===s?c:i;a.set((0,_.lE)(u).slice(0,p),f)}return(0,_.Dv)(a)}var Se=r(62768),Ne=r(21261);const Te=new d.Yd("wordlists/5.5.0");class Ce{constructor(e){Te.checkAbstract(new.target,Ce),(0,h.zG)(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(0,se.id)(t.join("\n")+"\n")}static register(e,t){t||(t=e.locale)}}let Re=null;function xe(e){if(null==Re&&(Re="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==Ce.check(e)))throw Re=null,new Error("BIP39 Wordlist for en (English) FAILED")}const Be=new class extends Ce{constructor(){super("en")}getWord(e){return xe(this),Re[e]}getWordIndex(e){return xe(this),Re.indexOf(e)}};Ce.register(Be);const Ie={en:Be},Oe=new d.Yd("hdnode/5.5.0"),De=u.O$.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Fe=(0,ne.Y0)("Bitcoin seed"),Ge=2147483648;function Le(e){return(1<<e)-1<<8-e}function Ue(e){return(0,_.$m)((0,_.Dv)(e),32)}function ze(e){return _e.encode((0,_.zo)([e,(0,_.p3)((0,Pe.JQ)((0,Pe.JQ)(e)),0,4)]))}function Me(e){if(null==e)return Ie.en;if("string"==typeof e){const t=Ie[e];return null==t&&Oe.throwArgumentError("unknown locale","wordlist",e),t}return e}const Ke={},Ye="m/44'/60'/0'/0/0";class $e{constructor(e,t,r,n,o,i,s,a){if(Oe.checkNew(new.target,$e),e!==Ke)throw new Error("HDNode constructor cannot be called directly");if(t){const e=new Se.Et(t);(0,h.zG)(this,"privateKey",e.privateKey),(0,h.zG)(this,"publicKey",e.compressedPublicKey)}else(0,h.zG)(this,"privateKey",null),(0,h.zG)(this,"publicKey",(0,_.Dv)(r));(0,h.zG)(this,"parentFingerprint",n),(0,h.zG)(this,"fingerprint",(0,_.p3)((0,Pe.bP)((0,Pe.JQ)(this.publicKey)),0,4)),(0,h.zG)(this,"address",(0,P.computeAddress)(this.publicKey)),(0,h.zG)(this,"chainCode",o),(0,h.zG)(this,"index",i),(0,h.zG)(this,"depth",s),null==a?((0,h.zG)(this,"mnemonic",null),(0,h.zG)(this,"path",null)):"string"==typeof a?((0,h.zG)(this,"mnemonic",null),(0,h.zG)(this,"path",a)):((0,h.zG)(this,"mnemonic",a),(0,h.zG)(this,"path",a.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return ze((0,_.zo)([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",(0,_.Dv)(this.depth),this.parentFingerprint,(0,_.$m)((0,_.Dv)(this.index),4),this.chainCode,null!=this.privateKey?(0,_.zo)(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new $e(Ke,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&Ge){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set((0,_.lE)(this.privateKey),1),t&&(t+="'")}else r.set((0,_.lE)(this.publicKey));for(let t=24;t>=0;t-=8)r[33+(t>>3)]=e>>24-t&255;const n=(0,_.lE)((0,Pe.Gy)(Ne.p.sha512,this.chainCode,r)),o=n.slice(0,32),i=n.slice(32);let s=null,a=null;this.privateKey?s=Ue(u.O$.from(o).add(this.privateKey).mod(De)):a=new Se.Et((0,_.Dv)(o))._addPoint(this.publicKey);let l=t;const c=this.mnemonic;return c&&(l=Object.freeze({phrase:c.phrase,path:t,locale:c.locale||"en"})),new $e(Ke,s,a,this.fingerprint,Ue(i),e,this.depth+1,l)}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>=Ge)throw new Error("invalid path index - "+n);r=r._derive(Ge+e)}else{if(!n.match(/^[0-9]+$/))throw new Error("invalid path component - "+n);{const e=parseInt(n);if(e>=Ge)throw new Error("invalid path index - "+n);r=r._derive(e)}}}return r}static _fromSeed(e,t){const r=(0,_.lE)(e);if(r.length<16||r.length>64)throw new Error("invalid seed");const n=(0,_.lE)((0,Pe.Gy)(Ne.p.sha512,Fe,r));return new $e(Ke,Ue(n.slice(0,32)),null,"0x00000000",Ue(n.slice(32)),0,0,t)}static fromMnemonic(e,t,r){return e=We(He(e,r=Me(r)),r),$e._fromSeed(je(e,t),{phrase:e,path:"m",locale:r.locale})}static fromSeed(e){return $e._fromSeed(e,null)}static fromExtendedKey(e){const t=_e.decode(e);82===t.length&&ze(t.slice(0,78))===e||Oe.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const r=t[4],n=(0,_.Dv)(t.slice(5,9)),o=parseInt((0,_.Dv)(t.slice(9,13)).substring(2),16),i=(0,_.Dv)(t.slice(13,45)),s=t.slice(45,78);switch((0,_.Dv)(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new $e(Ke,null,(0,_.Dv)(s),n,i,o,r,null);case"0x0488ade4":case"0x04358394 ":if(0!==s[0])break;return new $e(Ke,(0,_.Dv)(s.slice(1)),null,n,i,o,r,null)}return Oe.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function je(e,t){t||(t="");const r=(0,ne.Y0)("mnemonic"+t,ne.Uj.NFKD);return Ae((0,ne.Y0)(e,ne.Uj.NFKD),r,2048,64,"sha512")}function He(e,t){t=Me(t),Oe.checkNormalize();const r=t.split(e);if(r.length%3!=0)throw new Error("invalid mnemonic");const n=(0,_.lE)(new Uint8Array(Math.ceil(11*r.length/8)));let o=0;for(let e=0;e<r.length;e++){let i=t.getWordIndex(r[e].normalize("NFKD"));if(-1===i)throw new Error("invalid mnemonic");for(let e=0;e<11;e++)i&1<<10-e&&(n[o>>3]|=1<<7-o%8),o++}const i=32*r.length/3,s=Le(r.length/3);if(((0,_.lE)((0,Pe.JQ)(n.slice(0,i/8)))[0]&s)!=(n[n.length-1]&s))throw new Error("invalid checksum");return(0,_.Dv)(n.slice(0,i/8))}function We(e,t){if(t=Me(t),(e=(0,_.lE)(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 o=e.length/4,i=(0,_.lE)((0,Pe.JQ)(e))[0]&Le(o);return r[r.length-1]<<=o,r[r.length-1]|=i>>8-o,t.join(r.map((e=>t.getWord(e))))}function qe(e,t){try{return He(e,t),!0}catch(e){}return!1}function Ve(e){return("number"!=typeof e||e<0||e>=Ge||e%1)&&Oe.throwArgumentError("invalid account index","index",e),`m/44'/60'/${e}'/0/0`}const Je=new d.Yd("random/5.5.0");let Ze=null;try{if(Ze=window,null==Ze)throw new Error("try next")}catch(e){try{if(Ze=r.g,null==Ze)throw new Error("try next")}catch(e){Ze={}}}let Qe=Ze.crypto||Ze.msCrypto;function Xe(e){(e<=0||e>1024||e%1||e!=e)&&Je.throwArgumentError("invalid length","length",e);const t=new Uint8Array(e);return Qe.getRandomValues(t),(0,_.lE)(t)}Qe&&Qe.getRandomValues||(Je.warn("WARNING: Missing strong random number source"),Qe={getRandomValues:function(e){return Je.throwError("no secure random source avaialble",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});var et=r(48709),tt=r.n(et);const rt="json-wallets/5.5.0";function nt(e){return"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),(0,_.lE)(e)}function ot(e,t){for(e=String(e);e.length<t;)e="0"+e;return e}function it(e){return"string"==typeof e?(0,ne.Y0)(e,ne.Uj.NFKC):(0,_.lE)(e)}function st(e,t){let r=e;const n=t.toLowerCase().split("/");for(let e=0;e<n.length;e++){let t=null;for(const o in r)if(o.toLowerCase()===n[e]){t=r[o];break}if(null===t)return null;r=t}return r}function at(e){const t=(0,_.lE)(e);t[6]=15&t[6]|64,t[8]=63&t[8]|128;const r=(0,_.Dv)(t);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}const lt=new d.Yd(rt);class ct extends h.dk{isCrowdsaleAccount(e){return!(!e||!e._isCrowdsaleAccount)}}function ut(e,t){const r=JSON.parse(e);t=it(t);const n=(0,k.Kn)(st(r,"ethaddr")),o=nt(st(r,"encseed"));o&&o.length%16==0||lt.throwArgumentError("invalid encseed","json",e);const i=(0,_.lE)(Ae(t,t,2e3,32,"sha256")).slice(0,16),s=o.slice(0,16),a=o.slice(16),l=new(tt().ModeOfOperation.cbc)(i,s),c=tt().padding.pkcs7.strip((0,_.lE)(l.decrypt(a)));let u="";for(let e=0;e<c.length;e++)u+=String.fromCharCode(c[e]);const h=(0,ne.Y0)(u),d=(0,re.w)(h);return new ct({_isCrowdsaleAccount:!0,address:n,privateKey:d})}function ht(e){let t=null;try{t=JSON.parse(e)}catch(e){return!1}return t.encseed&&t.ethaddr}function dt(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))}function ft(e){if(ht(e))try{return(0,k.Kn)(JSON.parse(e).ethaddr)}catch(e){return null}if(dt(e))try{return(0,k.Kn)(JSON.parse(e).address)}catch(e){return null}return null}var pt=r(17635),mt=r.n(pt);const gt=new d.Yd(rt);function yt(e){return null!=e&&e.mnemonic&&e.mnemonic.phrase}class vt extends h.dk{isKeystoreAccount(e){return!(!e||!e._isKeystoreAccount)}}function wt(e,t){const r=nt(st(e,"crypto/ciphertext"));if((0,_.Dv)((0,re.w)((0,_.zo)([t.slice(16,32),r]))).substring(2)!==st(e,"crypto/mac").toLowerCase())throw new Error("invalid password");const n=function(e,t,r){if("aes-128-ctr"===st(e,"crypto/cipher")){const n=nt(st(e,"crypto/cipherparams/iv")),o=new(tt().Counter)(n),i=new(tt().ModeOfOperation.ctr)(t,o);return(0,_.lE)(i.decrypt(r))}return null}(e,t.slice(0,16),r);n||gt.throwError("unsupported cipher",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const o=t.slice(32,64),i=(0,P.computeAddress)(n);if(e.address){let t=e.address.toLowerCase();if("0x"!==t.substring(0,2)&&(t="0x"+t),(0,k.Kn)(t)!==i)throw new Error("address mismatch")}const s={_isKeystoreAccount:!0,address:i,privateKey:(0,_.Dv)(n)};if("0.1"===st(e,"x-ethers/version")){const t=nt(st(e,"x-ethers/mnemonicCiphertext")),r=nt(st(e,"x-ethers/mnemonicCounter")),n=new(tt().Counter)(r),i=new(tt().ModeOfOperation.ctr)(o,n),a=st(e,"x-ethers/path")||Ye,l=st(e,"x-ethers/locale")||"en",c=(0,_.lE)(i.decrypt(t));try{const e=We(c,l),t=$e.fromMnemonic(e,null,l).derivePath(a);if(t.privateKey!=s.privateKey)throw new Error("mnemonic mismatch");s.mnemonic=t.mnemonic}catch(e){if(e.code!==d.Yd.errors.INVALID_ARGUMENT||"wordlist"!==e.argument)throw e}}return new vt(s)}function bt(e,t,r,n,o){return(0,_.lE)(Ae(e,t,r,n,o))}function Et(e,t,r,n,o){return Promise.resolve(bt(e,t,r,n,o))}function kt(e,t,r,n,o){const i=it(t),s=st(e,"crypto/kdf");if(s&&"string"==typeof s){const t=function(e,t){return gt.throwArgumentError("invalid key-derivation function parameters",e,t)};if("scrypt"===s.toLowerCase()){const r=nt(st(e,"crypto/kdfparams/salt")),a=parseInt(st(e,"crypto/kdfparams/n")),l=parseInt(st(e,"crypto/kdfparams/r")),c=parseInt(st(e,"crypto/kdfparams/p"));a&&l&&c||t("kdf",s),0!=(a&a-1)&&t("N",a);const u=parseInt(st(e,"crypto/kdfparams/dklen"));return 32!==u&&t("dklen",u),n(i,r,a,l,c,64,o)}if("pbkdf2"===s.toLowerCase()){const n=nt(st(e,"crypto/kdfparams/salt"));let o=null;const s=st(e,"crypto/kdfparams/prf");"hmac-sha256"===s?o="sha256":"hmac-sha512"===s?o="sha512":t("prf",s);const a=parseInt(st(e,"crypto/kdfparams/c")),l=parseInt(st(e,"crypto/kdfparams/dklen"));return 32!==l&&t("dklen",l),r(i,n,a,l,o)}}return gt.throwArgumentError("unsupported key-derivation function","kdf",s)}function _t(e,t,r){if(ht(e)){r&&r(0);const n=ut(e,t);return r&&r(1),Promise.resolve(n)}return dt(e)?function(e,t,r){return n=this,o=void 0,s=function*(){const n=JSON.parse(e);return wt(n,yield kt(n,t,Et,mt().scrypt,r))},new((i=void 0)||(i=Promise))((function(e,t){function r(e){try{l(s.next(e))}catch(e){t(e)}}function a(e){try{l(s.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(r,a)}l((s=s.apply(n,o||[])).next())}));var n,o,i,s}(e,t,r):Promise.reject(new Error("invalid JSON wallet"))}var Pt=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const At=new d.Yd("wallet/5.5.0");class St extends b{constructor(e,t){if(At.checkNew(new.target,St),super(),null!=(r=e)&&(0,_.A7)(r.privateKey,32)&&null!=r.address){const t=new Se.Et(e.privateKey);if((0,h.zG)(this,"_signingKey",(()=>t)),(0,h.zG)(this,"address",(0,P.computeAddress)(this.publicKey)),this.address!==(0,k.Kn)(e.address)&&At.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),function(e){const t=e.mnemonic;return t&&t.phrase}(e)){const t=e.mnemonic;(0,h.zG)(this,"_mnemonic",(()=>({phrase:t.phrase,path:t.path||Ye,locale:t.locale||"en"})));const r=this.mnemonic,n=$e.fromMnemonic(r.phrase,null,r.locale).derivePath(r.path);(0,P.computeAddress)(n.privateKey)!==this.address&&At.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else(0,h.zG)(this,"_mnemonic",(()=>null))}else{if(Se.Et.isSigningKey(e))"secp256k1"!==e.curve&&At.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),(0,h.zG)(this,"_signingKey",(()=>e));else{"string"==typeof e&&e.match(/^[0-9a-f]*$/i)&&64===e.length&&(e="0x"+e);const t=new Se.Et(e);(0,h.zG)(this,"_signingKey",(()=>t))}(0,h.zG)(this,"_mnemonic",(()=>null)),(0,h.zG)(this,"address",(0,P.computeAddress)(this.publicKey))}var r;t&&!m.isProvider(t)&&At.throwArgumentError("invalid provider","provider",t),(0,h.zG)(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 St(this,e)}signTransaction(e){return(0,h.mE)(e).then((t=>{null!=t.from&&((0,k.Kn)(t.from)!==this.address&&At.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete t.from);const r=this._signingKey().signDigest((0,re.w)((0,P.serialize)(t)));return(0,P.serialize)(t,r)}))}signMessage(e){return Pt(this,void 0,void 0,(function*(){return(0,_.gV)(this._signingKey().signDigest(oe(e)))}))}_signTypedData(e,t,r){return Pt(this,void 0,void 0,(function*(){const n=yield Ee.resolveNames(e,t,r,(e=>(null==this.provider&&At.throwError("cannot resolve ENS names without a provider",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:e}),this.provider.resolveName(e))));return(0,_.gV)(this._signingKey().signDigest(Ee.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((0,k.Kn)(e.address)!==(0,P.computeAddress)(e.privateKey))throw new Error("address/privateKey mismatch");if(yt(e)){const t=e.mnemonic;if($e.fromMnemonic(t.phrase,null,t.locale).derivePath(t.path||Ye).privateKey!=e.privateKey)throw new Error("mnemonic mismatch")}}catch(e){return Promise.reject(e)}"function"!=typeof r||n||(n=r,r={}),r||(r={});const o=(0,_.lE)(e.privateKey),i=it(t);let s=null,a=null,l=null;if(yt(e)){const t=e.mnemonic;s=(0,_.lE)(He(t.phrase,t.locale||"en")),a=t.path||Ye,l=t.locale||"en"}let c=r.client;c||(c="ethers.js");let u=null;u=r.salt?(0,_.lE)(r.salt):Xe(32);let h=null;if(r.iv){if(h=(0,_.lE)(r.iv),16!==h.length)throw new Error("invalid iv")}else h=Xe(16);let d=null;if(r.uuid){if(d=(0,_.lE)(r.uuid),16!==d.length)throw new Error("invalid uuid")}else d=Xe(16);let f=1<<17,p=8,m=1;return r.scrypt&&(r.scrypt.N&&(f=r.scrypt.N),r.scrypt.r&&(p=r.scrypt.r),r.scrypt.p&&(m=r.scrypt.p)),mt().scrypt(i,u,f,p,m,64,n).then((t=>{const r=(t=(0,_.lE)(t)).slice(0,16),n=t.slice(16,32),i=t.slice(32,64),g=new(tt().Counter)(h),y=new(tt().ModeOfOperation.ctr)(r,g),v=(0,_.lE)(y.encrypt(o)),w=(0,re.w)((0,_.zo)([n,v])),b={address:e.address.substring(2).toLowerCase(),id:at(d),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:(0,_.Dv)(h).substring(2)},ciphertext:(0,_.Dv)(v).substring(2),kdf:"scrypt",kdfparams:{salt:(0,_.Dv)(u).substring(2),n:f,dklen:32,p:m,r:p},mac:w.substring(2)}};if(s){const e=Xe(16),t=new(tt().Counter)(e),r=new(tt().ModeOfOperation.ctr)(i,t),n=(0,_.lE)(r.encrypt(s)),o=new Date,u=o.getUTCFullYear()+"-"+ot(o.getUTCMonth()+1,2)+"-"+ot(o.getUTCDate(),2)+"T"+ot(o.getUTCHours(),2)+"-"+ot(o.getUTCMinutes(),2)+"-"+ot(o.getUTCSeconds(),2)+".0Z";b["x-ethers"]={client:c,gethFilename:"UTC--"+u+"--"+b.address,mnemonicCounter:(0,_.Dv)(e).substring(2),mnemonicCiphertext:(0,_.Dv)(n).substring(2),path:a,locale:l,version:"0.1"}}return JSON.stringify(b)}))}(this,e,t,r)}static createRandom(e){let t=Xe(16);e||(e={}),e.extraEntropy&&(t=(0,_.lE)((0,_.p3)((0,re.w)((0,_.zo)([t,e.extraEntropy])),0,16)));const r=We(t,e.locale);return St.fromMnemonic(r,e.path,e.locale)}static fromEncryptedJson(e,t,r){return _t(e,t,r).then((e=>new St(e)))}static fromEncryptedJsonSync(e,t){return new St(function(e,t){if(ht(e))return ut(e,t);if(dt(e))return function(e,t){const r=JSON.parse(e);return wt(r,kt(r,t,bt,mt().syncScrypt))}(e,t);throw new Error("invalid JSON wallet")}(e,t))}static fromMnemonic(e,t,r){return t||(t=Ye),new St($e.fromMnemonic(e,null,r).derivePath(t))}}function Nt(e,t){return(0,P.recoverAddress)(oe(e),t)}function Tt(e,t,r,n){return(0,P.recoverAddress)(Ee.hash(e,t,r),n)}const Ct="0x0000000000000000000000000000000000000000";var Rt=r(21046);const xt="0x0000000000000000000000000000000000000000000000000000000000000000",Bt="Ξ",It=new d.Yd("networks/5.5.0");function Ot(e){const t=function(t,r){null==r&&(r={});const n=[];if(t.InfuraProvider)try{n.push(new t.InfuraProvider(e,r.infura))}catch(e){}if(t.EtherscanProvider)try{n.push(new t.EtherscanProvider(e,r.etherscan))}catch(e){}if(t.AlchemyProvider)try{n.push(new t.AlchemyProvider(e,r.alchemy))}catch(e){}if(t.PocketProvider){const r=["goerli","ropsten","rinkeby"];try{const o=new t.PocketProvider(e);o.network&&-1===r.indexOf(o.network.name)&&n.push(o)}catch(e){}}if(t.CloudflareProvider)try{n.push(new t.CloudflareProvider(e))}catch(e){}if(0===n.length)return null;if(t.FallbackProvider){let o=1;return null!=r.quorum?o=r.quorum:"homestead"===e&&(o=2),new t.FallbackProvider(n,o)}return n[0]};return t.renetwork=function(e){return Ot(e)},t}function Dt(e,t){const r=function(r,n){return r.JsonRpcProvider?new r.JsonRpcProvider(e,t):null};return r.renetwork=function(t){return Dt(e,t)},r}const Ft={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:Ot("homestead")},Gt={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:Ot("ropsten")},Lt={chainId:63,name:"classicMordor",_defaultProvider:Dt("https://www.ethercluster.com/mordor","classicMordor")},Ut={unspecified:{chainId:0,name:"unspecified"},homestead:Ft,mainnet:Ft,morden:{chainId:2,name:"morden"},ropsten:Gt,testnet:Gt,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:Ot("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:Ot("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:Ot("goerli")},classic:{chainId:61,name:"classic",_defaultProvider:Dt("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:Lt,classicTestnet:Lt,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:Dt("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic"},maticmum:{chainId:80001,name:"maticmum"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function zt(e){if(null==e)return null;if("number"==typeof e){for(const t in Ut){const r=Ut[t];if(r.chainId===e)return{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress||null,_defaultProvider:r._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"==typeof e){const t=Ut[e];return null==t?null:{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress,_defaultProvider:t._defaultProvider||null}}const t=Ut[e.name];if(!t)return"number"!=typeof e.chainId&&It.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==t.chainId&&It.throwArgumentError("network chainId mismatch","network",e);let r=e._defaultProvider||null;var n;return null==r&&t._defaultProvider&&(r=(n=t._defaultProvider)&&"function"==typeof n.renetwork?t._defaultProvider.renetwork(e):t._defaultProvider),{name:e.name,chainId:t.chainId,ensAddress:e.ensAddress||t.ensAddress||null,_defaultProvider:r}}function Mt(e,t){t||(t=function(e){return[parseInt(e,16)]});let r=0,n={};return e.split(",").forEach((e=>{let o=e.split(":");r+=parseInt(o[0],16),n[r]=t(o[1])})),n}function Kt(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 Yt(e,t){let r=0;for(let n=0;n<t.length;n++){let o=t[n];if(r+=o.l,e>=r&&e<=r+o.h&&(e-r)%(o.d||1)==0){if(o.e&&-1!==o.e.indexOf(e-r))continue;return o}}return null}const $t=Kt("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"),jt="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((e=>parseInt(e,16))),Ht=[{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}],Wt=Mt("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"),qt=Mt("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"),Vt=Mt("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})),Jt=Kt("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");function Zt(e){if(e.match(/^[a-z0-9-]*$/i)&&e.length<=59)return e.toLowerCase();let t=(0,ne.XL)(e);var r;r=t.map((e=>{if(jt.indexOf(e)>=0)return[];if(e>=65024&&e<=65039)return[];let t=function(e){let t=Yt(e,Ht);if(t)return[e+t.s];let r=Wt[e];if(r)return r;let n=qt[e];return n?[e+n[0]]:Vt[e]||null}(e);return t||[e]})),t=r.reduce(((e,t)=>(t.forEach((t=>{e.push(t)})),e)),[]),t=(0,ne.XL)((0,ne.uu)(t),ne.Uj.NFKC),t.forEach((e=>{if(Yt(e,Jt))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),t.forEach((e=>{if(Yt(e,$t))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));let n=(0,ne.uu)(t);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");if(n.length>63)throw new Error("too long");return n}const Qt=new d.Yd(ie),Xt=new Uint8Array(32);Xt.fill(0);const er=new RegExp("^((.*)\\.)?([^.]+)$");function tr(e){try{const t=e.split(".");for(let e=0;e<t.length;e++)if(0===Zt(t[e]).length)throw new Error("empty");return!0}catch(e){}return!1}function rr(e){"string"!=typeof e&&Qt.throwArgumentError("invalid ENS name; not a string","name",e);let t=e,r=Xt;for(;t.length;){const n=t.match(er);null!=n&&""!==n[2]||Qt.throwArgumentError("invalid ENS address; missing component","name",e);const o=(0,ne.Y0)(Zt(n[3]));r=(0,re.w)((0,_.zo)([r,(0,re.w)(o)])),t=n[2]||""}return(0,_.Dv)(r)}function nr(e){e=atob(e);const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return(0,_.lE)(t)}function or(e){e=(0,_.lE)(e);let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function ir(e,t){return r=this,n=void 0,i=function*(){null==t&&(t={});const r={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};!0!==t.skipFetchSetup&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client");const n=yield fetch(e,r),o=yield n.arrayBuffer(),i={};return n.headers.forEach?n.headers.forEach(((e,t)=>{i[t.toLowerCase()]=e})):n.headers.keys().forEach((e=>{i[e.toLowerCase()]=n.headers.get(e)})),{headers:i,statusCode:n.status,statusMessage:n.statusText,body:(0,_.lE)(new Uint8Array(o))}},new((o=void 0)||(o=Promise))((function(e,t){function s(e){try{l(i.next(e))}catch(e){t(e)}}function a(e){try{l(i.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(s,a)}l((i=i.apply(r,n||[])).next())}));var r,n,o,i}const sr=new d.Yd("web/5.5.0");function ar(e){return new Promise((t=>{setTimeout(t,e)}))}function lr(e,t){if(null==e)return null;if("string"==typeof e)return e;if((0,_.Zq)(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return(0,ne.ZN)(e)}catch(e){}return(0,_.Dv)(e)}return e}function cr(e,t,r){const n="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;sr.assertArgument(n>0&&n%1==0,"invalid connection throttle limit","connection.throttleLimit",n);const o="object"==typeof e?e.throttleCallback:null,i="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;sr.assertArgument(i>0&&i%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",i);const s={};let a=null;const l={method:"GET"};let c=!1,u=12e4;if("string"==typeof e)a=e;else if("object"==typeof e){if(null!=e&&null!=e.url||sr.throwArgumentError("missing URL","connection.url",e),a=e.url,"number"==typeof e.timeout&&e.timeout>0&&(u=e.timeout),e.headers)for(const t in e.headers)s[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(c=!0);if(l.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==a.substring(0,6)&&!0!==e.allowInsecureAuthentication&&sr.throwError("basic authentication requires a secure https url",d.Yd.errors.INVALID_ARGUMENT,{argument:"url",url:a,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;s.authorization={key:"Authorization",value:"Basic "+or((0,ne.Y0)(t))}}}t&&(l.method="POST",l.body=t,null==s["content-type"]&&(s["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==s["content-length"]&&(s["content-length"]={key:"Content-Length",value:String(t.length)}));const h={};Object.keys(s).forEach((e=>{const t=s[e];h[t.key]=t.value})),l.headers=h;const f=function(){let e=null;return{promise:new Promise((function(t,r){u&&(e=setTimeout((()=>{null!=e&&(e=null,r(sr.makeError("timeout",d.Yd.errors.TIMEOUT,{requestBody:lr(l.body,h["content-type"]),requestMethod:l.method,timeout:u,url:a})))}),u))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),p=function(){return e=this,t=void 0,u=function*(){for(let e=0;e<n;e++){let t=null;try{if(t=yield ir(a,l),429===t.statusCode&&e<n){let r=!0;if(o&&(r=yield o(e,a)),r){let r=0;const n=t.headers["retry-after"];r="string"==typeof n&&n.match(/^[1-9][0-9]*$/)?1e3*parseInt(n):i*parseInt(String(Math.random()*Math.pow(2,e))),yield ar(r);continue}}}catch(e){t=e.response,null==t&&(f.cancel(),sr.throwError("missing response",d.Yd.errors.SERVER_ERROR,{requestBody:lr(l.body,h["content-type"]),requestMethod:l.method,serverError:e,url:a}))}let s=t.body;if(c&&304===t.statusCode?s=null:(t.statusCode<200||t.statusCode>=300)&&(f.cancel(),sr.throwError("bad response",d.Yd.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:lr(s,t.headers?t.headers["content-type"]:null),requestBody:lr(l.body,h["content-type"]),requestMethod:l.method,url:a})),r)try{const e=yield r(s,t);return f.cancel(),e}catch(r){if(r.throttleRetry&&e<n){let t=!0;if(o&&(t=yield o(e,a)),t){const t=i*parseInt(String(Math.random()*Math.pow(2,e)));yield ar(t);continue}}f.cancel(),sr.throwError("processing response error",d.Yd.errors.SERVER_ERROR,{body:lr(s,t.headers?t.headers["content-type"]:null),error:r,requestBody:lr(l.body,h["content-type"]),requestMethod:l.method,url:a})}return f.cancel(),s}return sr.throwError("failed response",d.Yd.errors.SERVER_ERROR,{requestBody:lr(l.body,h["content-type"]),requestMethod:l.method,url:a})},new((s=void 0)||(s=Promise))((function(r,n){function o(e){try{a(u.next(e))}catch(e){n(e)}}function i(e){try{a(u.throw(e))}catch(e){n(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,i)}a((u=u.apply(e,t||[])).next())}));var e,t,s,u}();return Promise.race([f.promise,p])}function ur(e,t,r){let n=null;if(null!=t){n=(0,ne.Y0)(t);const r="string"==typeof e?{url:e}:(0,h.DC)(e);r.headers?0!==Object.keys(r.headers).filter((e=>"content-type"===e.toLowerCase())).length||(r.headers=(0,h.DC)(r.headers),r.headers["content-type"]="application/json"):r.headers={"content-type":"application/json"},e=r}return cr(e,n,((e,t)=>{let n=null;if(null!=e)try{n=JSON.parse((0,ne.ZN)(e))}catch(t){sr.throwError("invalid JSON",d.Yd.errors.SERVER_ERROR,{body:e,error:t})}return r&&(n=r(n,t)),n}))}function hr(e,t){return t||(t={}),null==(t=(0,h.DC)(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(r,n){let o=null,i=!1;const s=()=>!i&&(i=!0,o&&clearTimeout(o),!0);t.timeout&&(o=setTimeout((()=>{s()&&n(new Error("timeout"))}),t.timeout));const a=t.retryLimit;let l=0;!function o(){return e().then((function(e){if(void 0!==e)s()&&r(e);else if(t.oncePoll)t.oncePoll.once("poll",o);else if(t.onceBlock)t.onceBlock.once("block",o);else if(!i){if(l++,l>a)return void(s()&&n(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,l)));e<t.floor&&(e=t.floor),e>t.ceiling&&(e=t.ceiling),setTimeout(o,e)}return null}),(function(e){s()&&n(e)}))}()}))}var dr=r(92882),fr=r.n(dr);const pr="providers/5.5.0";var mr=r(25108);const gr=new d.Yd(pr);class yr{constructor(){gr.checkNew(new.target,yr),this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},t=this.address.bind(this),r=this.bigNumber.bind(this),n=this.blockTag.bind(this),o=this.data.bind(this),i=this.hash.bind(this),s=this.hex.bind(this),a=this.number.bind(this),l=this.type.bind(this);return e.transaction={hash:i,type:l,accessList:yr.allowNull(this.accessList.bind(this),null),blockHash:yr.allowNull(i,null),blockNumber:yr.allowNull(a,null),transactionIndex:yr.allowNull(a,null),confirmations:yr.allowNull(a,null),from:t,gasPrice:yr.allowNull(r),maxPriorityFeePerGas:yr.allowNull(r),maxFeePerGas:yr.allowNull(r),gasLimit:r,to:yr.allowNull(t,null),value:r,nonce:a,data:o,r:yr.allowNull(this.uint256),s:yr.allowNull(this.uint256),v:yr.allowNull(a),creates:yr.allowNull(t,null),raw:yr.allowNull(o)},e.transactionRequest={from:yr.allowNull(t),nonce:yr.allowNull(a),gasLimit:yr.allowNull(r),gasPrice:yr.allowNull(r),maxPriorityFeePerGas:yr.allowNull(r),maxFeePerGas:yr.allowNull(r),to:yr.allowNull(t),value:yr.allowNull(r),data:yr.allowNull((e=>this.data(e,!0))),type:yr.allowNull(a),accessList:yr.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:i,address:t,topics:yr.arrayOf(i),data:o,logIndex:a,blockHash:i},e.receipt={to:yr.allowNull(this.address,null),from:yr.allowNull(this.address,null),contractAddress:yr.allowNull(t,null),transactionIndex:a,root:yr.allowNull(s),gasUsed:r,logsBloom:yr.allowNull(o),blockHash:i,transactionHash:i,logs:yr.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:yr.allowNull(a,null),cumulativeGasUsed:r,effectiveGasPrice:yr.allowNull(r),status:yr.allowNull(a),type:l},e.block={hash:i,parentHash:i,number:a,timestamp:a,nonce:yr.allowNull(s),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:t,extraData:o,transactions:yr.allowNull(yr.arrayOf(i)),baseFeePerGas:yr.allowNull(r)},e.blockWithTransactions=(0,h.DC)(e.block),e.blockWithTransactions.transactions=yr.allowNull(yr.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:yr.allowNull(n,void 0),toBlock:yr.allowNull(n,void 0),blockHash:yr.allowNull(i,void 0),address:yr.allowNull(t,void 0),topics:yr.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:yr.allowNull(a),blockHash:yr.allowNull(i),transactionIndex:a,removed:yr.allowNull(this.boolean.bind(this)),address:t,data:yr.allowFalsish(o,"0x"),topics:yr.arrayOf(i),transactionHash:i,logIndex:a},e}accessList(e){return(0,P.accessListify)(e||[])}number(e){return"0x"===e?0:u.O$.from(e).toNumber()}type(e){return"0x"===e||null==e?0:u.O$.from(e).toNumber()}bigNumber(e){return u.O$.from(e)}boolean(e){if("boolean"==typeof e)return e;if("string"==typeof e){if("true"===(e=e.toLowerCase()))return!0;if("false"===e)return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return"string"==typeof e&&(t||"0x"===e.substring(0,2)||(e="0x"+e),(0,_.A7)(e))?e.toLowerCase():gr.throwArgumentError("invalid hash","value",e)}data(e,t){const r=this.hex(e,t);if(r.length%2!=0)throw new Error("invalid data; odd-length - "+e);return r}address(e){return(0,k.Kn)(e)}callAddress(e){if(!(0,_.A7)(e,32))return null;const t=(0,k.Kn)((0,_.p3)(e,12));return t===Ct?null:t}contractAddress(e){return(0,k.CR)(e)}blockTag(e){if(null==e)return"latest";if("earliest"===e)return"0x0";if("latest"===e||"pending"===e)return e;if("number"==typeof e||(0,_.A7)(e))return(0,_.$P)(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return 32!==(0,_.E1)(r)?gr.throwArgumentError("invalid hash","value",e):r}difficulty(e){if(null==e)return null;const t=u.O$.from(e);try{return t.toNumber()}catch(e){}return null}uint256(e){if(!(0,_.A7)(e))throw new Error("invalid uint256");return(0,_.$m)(e,32)}_block(e,t){null!=e.author&&null==e.miner&&(e.miner=e.author);const r=null!=e._difficulty?e._difficulty:e.difficulty,n=yr.check(t,e);return n._difficulty=null==r?null:u.O$.from(r),n}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return yr.check(this.formats.transactionRequest,e)}transactionResponse(e){null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&u.O$.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),null!=e.input&&null==e.data&&(e.data=e.input),null==e.to&&null==e.creates&&(e.creates=this.contractAddress(e)),1!==e.type&&2!==e.type||null!=e.accessList||(e.accessList=[]);const t=yr.check(this.formats.transaction,e);if(null!=e.chainId){let r=e.chainId;(0,_.A7)(r)&&(r=u.O$.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;null==r&&null==t.v&&(r=e.chainId),(0,_.A7)(r)&&(r=u.O$.from(r).toNumber()),"number"!=typeof r&&null!=t.v&&(r=(t.v-35)/2,r<0&&(r=0),r=parseInt(r)),"number"!=typeof r&&(r=0),t.chainId=r}return t.blockHash&&"x"===t.blockHash.replace(/0/g,"")&&(t.blockHash=null),t}transaction(e){return(0,P.parse)(e)}receiptLog(e){return yr.check(this.formats.receiptLog,e)}receipt(e){const t=yr.check(this.formats.receipt,e);if(null!=t.root)if(t.root.length<=4){const e=u.O$.from(t.root).toNumber();0===e||1===e?(null!=t.status&&t.status!==e&&gr.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=e,delete t.root):gr.throwArgumentError("invalid alt-root-status","value.root",t.root)}else 66!==t.root.length&&gr.throwArgumentError("invalid root hash","value.root",t.root);return null!=t.status&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map((e=>this.topics(e))):null!=e?this.hash(e,!0):null}filter(e){return yr.check(this.formats.filter,e)}filterLog(e){return yr.check(this.formats.filterLog,e)}static check(e,t){const r={};for(const n in e)try{const o=e[n](t[n]);void 0!==o&&(r[n]=o)}catch(e){throw e.checkKey=n,e.checkValue=t[n],e}return r}static allowNull(e,t){return function(r){return null==r?t:e(r)}}static allowFalsish(e,t){return function(r){return r?e(r):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const r=[];return t.forEach((function(t){r.push(e(t))})),r}}}function vr(e){return e&&"function"==typeof e.isCommunityResource}function wr(e){return vr(e)&&e.isCommunityResource()}let br=!1;function Er(){br||(br=!0,mr.log("========= NOTICE ========="),mr.log("Request-Rate Exceeded  (this message will not be repeated)"),mr.log(""),mr.log("The default API keys for each service are provided as a highly-throttled,"),mr.log("community resource for low-traffic projects and early prototyping."),mr.log(""),mr.log("While your application will continue to function, we highly recommended"),mr.log("signing up for your own API keys to improve performance, increase your"),mr.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),mr.log(""),mr.log("For more details: https://docs.ethers.io/api-keys/"),mr.log("=========================="))}var kr=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const _r=new d.Yd(pr);function Pr(e){return null==e?"null":(32!==(0,_.E1)(e)&&_r.throwArgumentError("invalid topic","topic",e),e.toLowerCase())}function Ar(e){for(e=e.slice();e.length>0&&null==e[e.length-1];)e.pop();return e.map((e=>{if(Array.isArray(e)){const t={};e.forEach((e=>{t[Pr(e)]=!0}));const r=Object.keys(t);return r.sort(),r.join("|")}return Pr(e)})).join("&")}function Sr(e){if("string"==typeof e){if(e=e.toLowerCase(),32===(0,_.E1)(e))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+Ar(e);if(p.isForkEvent(e))throw _r.warn("not implemented"),new Error("not implemented");if(e&&"object"==typeof e)return"filter:"+(e.address||"*")+":"+Ar(e.topics||[])}throw new Error("invalid event - "+e)}function Nr(){return(new Date).getTime()}function Tr(e){return new Promise((t=>{setTimeout(t,e)}))}const Cr=["block","network","pending","poll"];class Rr{constructor(e,t,r){(0,h.zG)(this,"tag",e),(0,h.zG)(this,"listener",t),(0,h.zG)(this,"once",r)}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return"tx"!==e[0]?null:e[1]}get filter(){const e=this.tag.split(":");if("filter"!==e[0])return null;const t=e[1],r=""===(n=e[2])?[]:n.split(/&/g).map((e=>{if(""===e)return[];const t=e.split("|").map((e=>"null"===e?null:e));return 1===t.length?t[0]:t}));var n;const o={};return r.length>0&&(o.topics=r),t&&"*"!==t&&(o.address=t),o}pollable(){return this.tag.indexOf(":")>=0||Cr.indexOf(this.tag)>=0}}const xr={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Br(e){return(0,_.$m)(u.O$.from(e).toHexString(),32)}function Ir(e){return _e.encode((0,_.zo)([e,(0,_.p3)((0,Pe.JQ)((0,Pe.JQ)(e)),0,4)]))}const Or=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),new RegExp("^(ipfs)://(.*)$","i"),new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function Dr(e){try{return(0,ne.ZN)(Fr(e))}catch(e){}return null}function Fr(e){if("0x"===e)return null;const t=u.O$.from((0,_.p3)(e,0,32)).toNumber(),r=u.O$.from((0,_.p3)(e,t,t+32)).toNumber();return(0,_.p3)(e,t+32,t+32+r)}class Gr{constructor(e,t,r,n){(0,h.zG)(this,"provider",e),(0,h.zG)(this,"name",r),(0,h.zG)(this,"address",e.formatter.address(t)),(0,h.zG)(this,"_resolvedAddress",n)}_fetchBytes(e,t){return kr(this,void 0,void 0,(function*(){const r={to:this.address,data:(0,_.xs)([e,rr(this.name),t||"0x"])};try{return Fr(yield this.provider.call(r))}catch(e){return e.code,d.Yd.errors.CALL_EXCEPTION,null}}))}_getAddress(e,t){const r=xr[String(e)];if(null==r&&_r.throwError(`unsupported coin type: ${e}`,d.Yd.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),"eth"===r.ilk)return this.provider.formatter.address(t);const n=(0,_.lE)(t);if(null!=r.p2pkh){const e=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return Ir((0,_.zo)([[r.p2pkh],"0x"+e[2]]))}}if(null!=r.p2sh){const e=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return Ir((0,_.zo)([[r.p2sh],"0x"+e[2]]))}}if(null!=r.prefix){const e=n[1];let t=n[0];if(0===t?20!==e&&32!==e&&(t=-1):t=-1,t>=0&&n.length===2+e&&e>=1&&e<=75){const e=fr().toWords(n.slice(2));return e.unshift(t),fr().encode(r.prefix,e)}}return null}getAddress(e){return kr(this,void 0,void 0,(function*(){if(null==e&&(e=60),60===e)try{const e={to:this.address,data:"0x3b3b57de"+rr(this.name).substring(2)},t=yield this.provider.call(e);return"0x"===t||t===xt?null:this.provider.formatter.callAddress(t)}catch(e){if(e.code===d.Yd.errors.CALL_EXCEPTION)return null;throw e}const t=yield this._fetchBytes("0xf1cb7e06",Br(e));if(null==t||"0x"===t)return null;const r=this._getAddress(e,t);return null==r&&_r.throwError("invalid or unsupported coin data",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r}))}getAvatar(){return kr(this,void 0,void 0,(function*(){const e=[];try{const t=yield this.getText("avatar");if(null==t)return null;for(let r=0;r<Or.length;r++){const n=t.match(Or[r]);if(null!=n)switch(n[1]){case"https":return e.push({type:"url",content:t}),{linkage:e,url:t};case"data":return e.push({type:"data",content:t}),{linkage:e,url:t};case"ipfs":return e.push({type:"ipfs",content:t}),{linkage:e,url:`https://gateway.ipfs.io/ipfs/${t.substring(7)}`};case"erc721":case"erc1155":{const r="erc721"===n[1]?"0xc87b56dd":"0x0e89341c";e.push({type:n[1],content:t});const o=this._resolvedAddress||(yield this.getAddress()),i=(n[2]||"").split("/");if(2!==i.length)return null;const s=yield this.provider.formatter.address(i[0]),a=(0,_.$m)(u.O$.from(i[1]).toHexString(),32);if("erc721"===n[1]){const t=this.provider.formatter.callAddress(yield this.provider.call({to:s,data:(0,_.xs)(["0x6352211e",a])}));if(o!==t)return null;e.push({type:"owner",content:t})}else if("erc1155"===n[1]){const t=u.O$.from(yield this.provider.call({to:s,data:(0,_.xs)(["0x00fdd58e",(0,_.$m)(o,32),a])}));if(t.isZero())return null;e.push({type:"balance",content:t.toString()})}const l={to:this.provider.formatter.address(i[0]),data:(0,_.xs)([r,a])};let c=Dr(yield this.provider.call(l));if(null==c)return null;e.push({type:"metadata-url",content:c}),"erc1155"===n[1]&&(c=c.replace("{id}",a.substring(2)));const h=yield ur(c);return h&&"string"==typeof h.image&&h.image.match(/^https:\/\//i)?(e.push({type:"metadata",content:JSON.stringify(h)}),e.push({type:"url",content:h.image}),{linkage:e,url:h.image}):null}}}}catch(e){}return null}))}getContentHash(){return kr(this,void 0,void 0,(function*(){const e=yield this._fetchBytes("0xbc1c58d1");if(null==e||"0x"===e)return null;const t=e.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const e=parseInt(t[3],16);if(t[4].length===2*e)return"ipfs://"+_e.encode("0x"+t[1])}const r=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);return r&&64===r[1].length?"bzz://"+r[1]:_r.throwError("invalid or unsupported content hash data",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})}))}getText(e){return kr(this,void 0,void 0,(function*(){let t=(0,ne.Y0)(e);t=(0,_.zo)([Br(64),Br(t.length),t]),t.length%32!=0&&(t=(0,_.zo)([t,(0,_.$m)("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",(0,_.Dv)(t));return null==r||"0x"===r?null:(0,ne.ZN)(r)}))}}let Lr=null,Ur=1;class zr extends m{constructor(e){if(_r.checkNew(new.target,m),super(),this._events=[],this._emitted={block:-2},this.formatter=new.target.getFormatter(),(0,h.zG)(this,"anyNetwork","any"===e),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch((e=>{})),this._ready().catch((e=>{}));else{const t=(0,h.tu)(new.target,"getNetwork")(e);t?((0,h.zG)(this,"_network",t),this.emit("network",t,null)):_r.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return kr(this,void 0,void 0,(function*(){if(null==this._network){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch(e){}null==e&&(e=yield this.detectNetwork()),e||_r.throwError("no network detected",d.Yd.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=e:(0,h.zG)(this,"_network",e),this.emit("network",e,null))}return this._network}))}get ready(){return hr((()=>this._ready().then((e=>e),(e=>{if(e.code!==d.Yd.errors.NETWORK_ERROR||"noNetwork"!==e.event)throw e}))))}static getFormatter(){return null==Lr&&(Lr=new yr),Lr}static getNetwork(e){return zt(null==e?"homestead":e)}_getInternalBlockNumber(e){return kr(this,void 0,void 0,(function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const t=this._internalBlockNumber;try{const r=yield t;if(Nr()-r.respTime<=e)return r.blockNumber;break}catch(e){if(this._internalBlockNumber===t)break}}const t=Nr(),r=(0,h.mE)({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((e=>null),(e=>e))}).then((({blockNumber:e,networkError:n})=>{if(n)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),n;const o=Nr();return(e=u.O$.from(e).toNumber())<this._maxInternalBlockNumber&&(e=this._maxInternalBlockNumber),this._maxInternalBlockNumber=e,this._setFastBlockNumber(e),{blockNumber:e,reqTime:t,respTime:o}}));return this._internalBlockNumber=r,r.catch((e=>{this._internalBlockNumber===r&&(this._internalBlockNumber=null)})),(yield r).blockNumber}))}poll(){return kr(this,void 0,void 0,(function*(){const e=Ur++,t=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(e){return void this.emit("error",e)}if(this._setFastBlockNumber(r),this.emit("poll",e,r),r!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)_r.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",_r.makeError("network block skew detected",d.Yd.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let e=this._emitted.block+1;e<=r;e++)this.emit("block",e);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach((e=>{if("block"===e)return;const t=this._emitted[e];"pending"!==t&&r-t>12&&delete this._emitted[e]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=r-1),this._events.forEach((e=>{switch(e.type){case"tx":{const r=e.hash;let n=this.getTransactionReceipt(r).then((e=>e&&null!=e.blockNumber?(this._emitted["t:"+r]=e.blockNumber,this.emit(r,e),null):null)).catch((e=>{this.emit("error",e)}));t.push(n);break}case"filter":{const n=e.filter;n.fromBlock=this._lastBlockNumber+1,n.toBlock=r;const o=this.getLogs(n).then((e=>{0!==e.length&&e.forEach((e=>{this._emitted["b:"+e.blockHash]=e.blockNumber,this._emitted["t:"+e.transactionHash]=e.blockNumber,this.emit(n,e)}))})).catch((e=>{this.emit("error",e)}));t.push(o);break}}})),this._lastBlockNumber=r,Promise.all(t).then((()=>{this.emit("didPoll",e)})).catch((e=>{this.emit("error",e)}))}else this.emit("didPoll",e)}))}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return kr(this,void 0,void 0,(function*(){return _r.throwError("provider does not support network detection",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return kr(this,void 0,void 0,(function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",t,e),yield Tr(0),this._network;const r=_r.makeError("underlying network changed",d.Yd.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",r),r}return e}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((e=>{this._setFastBlockNumber(e)}),(e=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(e){e&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if("number"!=typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const e=Nr();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then((e=>((null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(e){null!=this._fastBlockNumber&&e<this._fastBlockNumber||(this._fastQueryDate=Nr(),(null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,r){return kr(this,void 0,void 0,(function*(){return this._waitForTransaction(e,null==t?1:t,r||0,null)}))}_waitForTransaction(e,t,r,n){return kr(this,void 0,void 0,(function*(){const o=yield this.getTransactionReceipt(e);return(o?o.confirmations:0)>=t?o:new Promise(((o,i)=>{const s=[];let a=!1;const l=function(){return!!a||(a=!0,s.forEach((e=>{e()})),!1)},c=e=>{e.confirmations<t||l()||o(e)};if(this.on(e,c),s.push((()=>{this.removeListener(e,c)})),n){let r=n.startBlock,o=null;const c=s=>kr(this,void 0,void 0,(function*(){a||(yield Tr(1e3),this.getTransactionCount(n.from).then((u=>kr(this,void 0,void 0,(function*(){if(!a){if(u<=n.nonce)r=s;else{{const t=yield this.getTransaction(e);if(t&&null!=t.blockNumber)return}for(null==o&&(o=r-3,o<n.startBlock&&(o=n.startBlock));o<=s;){if(a)return;const r=yield this.getBlockWithTransactions(o);for(let o=0;o<r.transactions.length;o++){const s=r.transactions[o];if(s.hash===e)return;if(s.from===n.from&&s.nonce===n.nonce){if(a)return;const r=yield this.waitForTransaction(s.hash,t);if(l())return;let o="replaced";return s.data===n.data&&s.to===n.to&&s.value.eq(n.value)?o="repriced":"0x"===s.data&&s.from===s.to&&s.value.isZero()&&(o="cancelled"),void i(_r.makeError("transaction was replaced",d.Yd.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===o||"cancelled"===o,reason:o,replacement:this._wrapTransaction(s),hash:e,receipt:r}))}}o++}}a||this.once("block",c)}}))),(e=>{a||this.once("block",c)})))}));if(a)return;this.once("block",c),s.push((()=>{this.removeListener("block",c)}))}if("number"==typeof r&&r>0){const e=setTimeout((()=>{l()||i(_r.makeError("timeout exceeded",d.Yd.errors.TIMEOUT,{timeout:r}))}),r);e.unref&&e.unref(),s.push((()=>{clearTimeout(e)}))}}))}))}getBlockNumber(){return kr(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return kr(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return u.O$.from(e)}catch(t){return _r.throwError("bad result from backend",d.Yd.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}}))}getBalance(e,t){return kr(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,h.mE)({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getBalance",r);try{return u.O$.from(n)}catch(e){return _r.throwError("bad result from backend",d.Yd.errors.SERVER_ERROR,{method:"getBalance",params:r,result:n,error:e})}}))}getTransactionCount(e,t){return kr(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,h.mE)({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getTransactionCount",r);try{return u.O$.from(n).toNumber()}catch(e){return _r.throwError("bad result from backend",d.Yd.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:n,error:e})}}))}getCode(e,t){return kr(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,h.mE)({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getCode",r);try{return(0,_.Dv)(n)}catch(e){return _r.throwError("bad result from backend",d.Yd.errors.SERVER_ERROR,{method:"getCode",params:r,result:n,error:e})}}))}getStorageAt(e,t,r){return kr(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield(0,h.mE)({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then((e=>(0,_.$P)(e)))}),o=yield this.perform("getStorageAt",n);try{return(0,_.Dv)(o)}catch(e){return _r.throwError("bad result from backend",d.Yd.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:o,error:e})}}))}_wrapTransaction(e,t,r){if(null!=t&&32!==(0,_.E1)(t))throw new Error("invalid response - sendTransaction");const n=e;return null!=t&&e.hash!==t&&_r.throwError("Transaction hash mismatch from Provider.sendTransaction.",d.Yd.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),n.wait=(t,n)=>kr(this,void 0,void 0,(function*(){let o;null==t&&(t=1),null==n&&(n=0),0!==t&&null!=r&&(o={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:r});const i=yield this._waitForTransaction(e.hash,t,n,o);return null==i&&0===t?null:(this._emitted["t:"+e.hash]=i.blockNumber,0===i.status&&_r.throwError("transaction failed",d.Yd.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:i}),i)})),n}sendTransaction(e){return kr(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then((e=>(0,_.Dv)(e))),r=this.formatter.transaction(e);null==r.confirmations&&(r.confirmations=0);const n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const e=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(r,e,n)}catch(e){throw e.transaction=r,e.transactionHash=r.hash,e}}))}_getTransactionRequest(e){return kr(this,void 0,void 0,(function*(){const t=yield e,r={};return["from","to"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>e?this._getAddress(e):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>e?u.O$.from(e):null)))})),["type"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>null!=e?e:null)))})),t.accessList&&(r.accessList=this.formatter.accessList(t.accessList)),["data"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>e?(0,_.Dv)(e):null)))})),this.formatter.transactionRequest(yield(0,h.mE)(r))}))}_getFilter(e){return kr(this,void 0,void 0,(function*(){e=yield e;const t={};return null!=e.address&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach((r=>{null!=e[r]&&(t[r]=e[r])})),["fromBlock","toBlock"].forEach((r=>{null!=e[r]&&(t[r]=this._getBlockTag(e[r]))})),this.formatter.filter(yield(0,h.mE)(t))}))}call(e,t){return kr(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield(0,h.mE)({transaction:this._getTransactionRequest(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("call",r);try{return(0,_.Dv)(n)}catch(e){return _r.throwError("bad result from backend",d.Yd.errors.SERVER_ERROR,{method:"call",params:r,result:n,error:e})}}))}estimateGas(e){return kr(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield(0,h.mE)({transaction:this._getTransactionRequest(e)}),r=yield this.perform("estimateGas",t);try{return u.O$.from(r)}catch(e){return _r.throwError("bad result from backend",d.Yd.errors.SERVER_ERROR,{method:"estimateGas",params:t,result:r,error:e})}}))}_getAddress(e){return kr(this,void 0,void 0,(function*(){"string"!=typeof(e=yield e)&&_r.throwArgumentError("invalid address or ENS name","name",e);const t=yield this.resolveName(e);return null==t&&_r.throwError("ENS name not configured",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(e)})`}),t}))}_getBlock(e,t){return kr(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;let r=-128;const n={includeTransactions:!!t};if((0,_.A7)(e,32))n.blockHash=e;else try{n.blockTag=yield this._getBlockTag(e),(0,_.A7)(n.blockTag)&&(r=parseInt(n.blockTag.substring(2),16))}catch(t){_r.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",e)}return hr((()=>kr(this,void 0,void 0,(function*(){const e=yield this.perform("getBlock",n);if(null==e)return null!=n.blockHash&&null==this._emitted["b:"+n.blockHash]||null!=n.blockTag&&r>this._emitted.block?null:void 0;if(t){let t=null;for(let r=0;r<e.transactions.length;r++){const n=e.transactions[r];if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){null==t&&(t=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let e=t-n.blockNumber+1;e<=0&&(e=1),n.confirmations=e}}const r=this.formatter.blockWithTransactions(e);return r.transactions=r.transactions.map((e=>this._wrapTransaction(e))),r}return this.formatter.block(e)}))),{oncePoll:this})}))}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return kr(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return hr((()=>kr(this,void 0,void 0,(function*(){const r=yield this.perform("getTransaction",t);if(null==r)return null==this._emitted["t:"+e]?null:void 0;const n=this.formatter.transactionResponse(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;e<=0&&(e=1),n.confirmations=e}return this._wrapTransaction(n)}))),{oncePoll:this})}))}getTransactionReceipt(e){return kr(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return hr((()=>kr(this,void 0,void 0,(function*(){const r=yield this.perform("getTransactionReceipt",t);if(null==r)return null==this._emitted["t:"+e]?null:void 0;if(null==r.blockHash)return;const n=this.formatter.receipt(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;e<=0&&(e=1),n.confirmations=e}return n}))),{oncePoll:this})}))}getLogs(e){return kr(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield(0,h.mE)({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach((e=>{null==e.removed&&(e.removed=!1)})),yr.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)}))}getEtherPrice(){return kr(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(e){return kr(this,void 0,void 0,(function*(){if("number"==typeof(e=yield e)&&e<0){e%1&&_r.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)}))}getResolver(e){return kr(this,void 0,void 0,(function*(){try{const t=yield this._getResolver(e);return null==t?null:new Gr(this,t,e)}catch(e){return e.code,d.Yd.errors.CALL_EXCEPTION,null}}))}_getResolver(e){return kr(this,void 0,void 0,(function*(){const t=yield this.getNetwork();t.ensAddress||_r.throwError("network does not support ENS",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"ENS",network:t.name});const r={to:t.ensAddress,data:"0x0178b8bf"+rr(e).substring(2)};try{return this.formatter.callAddress(yield this.call(r))}catch(e){if(e.code===d.Yd.errors.CALL_EXCEPTION)return null;throw e}}))}resolveName(e){return kr(this,void 0,void 0,(function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(t){if((0,_.A7)(e))throw t}"string"!=typeof e&&_r.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null}))}lookupAddress(e){return kr(this,void 0,void 0,(function*(){e=yield e;const t=(e=this.formatter.address(e)).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(t);if(!r)return null;let n=(0,_.lE)(yield this.call({to:r,data:"0x691f3431"+rr(t).substring(2)}));if(n.length<32||!u.O$.from(n.slice(0,32)).eq(32))return null;if(n=n.slice(32),n.length<32)return null;const o=u.O$.from(n.slice(0,32)).toNumber();if(n=n.slice(32),o>n.length)return null;const i=(0,ne.ZN)(n.slice(0,o));return(yield this.resolveName(i))!=e?null:i}))}getAvatar(e){return kr(this,void 0,void 0,(function*(){let t=null;if((0,_.A7)(e)){const r=this.formatter.address(e),n=r.substring(2).toLowerCase()+".addr.reverse",o=yield this._getResolver(n);if(!o)return null;t=new Gr(this,o,"_",r)}else t=yield this.getResolver(e);const r=yield t.getAvatar();return null==r?null:r.url}))}perform(e,t){return _r.throwError(e+" not implemented",d.Yd.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_stopEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_addEventListener(e,t,r){const n=new Rr(Sr(e),t,r);return this._events.push(n),this._startEvent(n),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let r=!1,n=[],o=Sr(e);return this._events=this._events.filter((e=>e.tag!==o||(setTimeout((()=>{e.listener.apply(this,t)}),0),r=!0,!e.once||(n.push(e),!1)))),n.forEach((e=>{this._stopEvent(e)})),r}listenerCount(e){if(!e)return this._events.length;let t=Sr(e);return this._events.filter((e=>e.tag===t)).length}listeners(e){if(null==e)return this._events.map((e=>e.listener));let t=Sr(e);return this._events.filter((e=>e.tag===t)).map((e=>e.listener))}off(e,t){if(null==t)return this.removeAllListeners(e);const r=[];let n=!1,o=Sr(e);return this._events=this._events.filter((e=>e.tag!==o||e.listener!=t||!!n||(n=!0,r.push(e),!1))),r.forEach((e=>{this._stopEvent(e)})),this}removeAllListeners(e){let t=[];if(null==e)t=this._events,this._events=[];else{const r=Sr(e);this._events=this._events.filter((e=>e.tag!==r||(t.push(e),!1)))}return t.forEach((e=>{this._stopEvent(e)})),this}}var Mr=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const Kr=new d.Yd(pr),Yr=["call","estimateGas"];function $r(e,t,r){if("call"===e&&t.code===d.Yd.errors.SERVER_ERROR){const e=t.error;if(e&&e.message.match("reverted")&&(0,_.A7)(e.data))return e.data;Kr.throwError("missing revert data in call exception",d.Yd.errors.CALL_EXCEPTION,{error:t,data:"0x"})}let n=t.message;t.code===d.Yd.errors.SERVER_ERROR&&t.error&&"string"==typeof t.error.message?n=t.error.message:"string"==typeof t.body?n=t.body:"string"==typeof t.responseText&&(n=t.responseText),n=(n||"").toLowerCase();const o=r.transaction||r.signedTransaction;throw n.match(/insufficient funds|base fee exceeds gas limit/)&&Kr.throwError("insufficient funds for intrinsic transaction cost",d.Yd.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:o}),n.match(/nonce too low/)&&Kr.throwError("nonce has already been used",d.Yd.errors.NONCE_EXPIRED,{error:t,method:e,transaction:o}),n.match(/replacement transaction underpriced/)&&Kr.throwError("replacement fee too low",d.Yd.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:o}),n.match(/only replay-protected/)&&Kr.throwError("legacy pre-eip-155 transactions not supported",d.Yd.errors.UNSUPPORTED_OPERATION,{error:t,method:e,transaction:o}),Yr.indexOf(e)>=0&&n.match(/gas required exceeds allowance|always failing transaction|execution reverted/)&&Kr.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",d.Yd.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:o}),t}function jr(e){return new Promise((function(t){setTimeout(t,e)}))}function Hr(e){if(e.error){const t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function Wr(e){return e?e.toLowerCase():e}const qr={};class Vr extends b{constructor(e,t,r){if(Kr.checkNew(new.target,Vr),super(),e!==qr)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");(0,h.zG)(this,"provider",t),null==r&&(r=0),"string"==typeof r?((0,h.zG)(this,"_address",this.provider.formatter.address(r)),(0,h.zG)(this,"_index",null)):"number"==typeof r?((0,h.zG)(this,"_index",r),(0,h.zG)(this,"_address",null)):Kr.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return Kr.throwError("cannot alter JSON-RPC Signer connection",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new Jr(qr,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((e=>(e.length<=this._index&&Kr.throwError("unknown account #"+this._index,d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index]))))}sendUncheckedTransaction(e){e=(0,h.DC)(e);const t=this.getAddress().then((e=>(e&&(e=e.toLowerCase()),e)));if(null==e.gasLimit){const r=(0,h.DC)(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return null!=e.to&&(e.to=Promise.resolve(e.to).then((e=>Mr(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.provider.resolveName(e);return null==t&&Kr.throwArgumentError("provided ENS name resolves to null","tx.to",e),t}))))),(0,h.mE)({tx:(0,h.mE)(e),sender:t}).then((({tx:t,sender:r})=>{null!=t.from?t.from.toLowerCase()!==r&&Kr.throwArgumentError("from address mismatch","transaction",e):t.from=r;const n=this.provider.constructor.hexlifyTransaction(t,{from:!0});return this.provider.send("eth_sendTransaction",[n]).then((e=>e),(e=>$r("sendTransaction",e,n)))}))}signTransaction(e){return Kr.throwError("signing transactions is unsupported",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Mr(this,void 0,void 0,(function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(e);try{return yield hr((()=>Mr(this,void 0,void 0,(function*(){const e=yield this.provider.getTransaction(r);if(null!==e)return this.provider._wrapTransaction(e,r,t)}))),{oncePoll:this.provider})}catch(e){throw e.transactionHash=r,e}}))}signMessage(e){return Mr(this,void 0,void 0,(function*(){const t="string"==typeof e?(0,ne.Y0)(e):e,r=yield this.getAddress();return yield this.provider.send("personal_sign",[(0,_.Dv)(t),r.toLowerCase()])}))}_legacySignMessage(e){return Mr(this,void 0,void 0,(function*(){const t="string"==typeof e?(0,ne.Y0)(e):e,r=yield this.getAddress();return yield this.provider.send("eth_sign",[r.toLowerCase(),(0,_.Dv)(t)])}))}_signTypedData(e,t,r){return Mr(this,void 0,void 0,(function*(){const n=yield Ee.resolveNames(e,t,r,(e=>this.provider.resolveName(e))),o=yield this.getAddress();return yield this.provider.send("eth_signTypedData_v4",[o.toLowerCase(),JSON.stringify(Ee.getPayload(n.domain,t,n.value))])}))}unlock(e){return Mr(this,void 0,void 0,(function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])}))}}class Jr extends Vr{sendTransaction(e){return this.sendUncheckedTransaction(e).then((e=>({hash:e,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:t=>this.provider.waitForTransaction(e,t)})))}}const Zr={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class Qr extends zr{constructor(e,t){Kr.checkNew(new.target,Qr);let r=t;null==r&&(r=new Promise(((e,t)=>{setTimeout((()=>{this.detectNetwork().then((t=>{e(t)}),(e=>{t(e)}))}),0)}))),super(r),e||(e=(0,h.tu)(this.constructor,"defaultUrl")()),"string"==typeof e?(0,h.zG)(this,"connection",Object.freeze({url:e})):(0,h.zG)(this,"connection",Object.freeze((0,h.DC)(e))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return Mr(this,void 0,void 0,(function*(){yield jr(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch(t){try{e=yield this.send("net_version",[])}catch(e){}}if(null!=e){const t=(0,h.tu)(this.constructor,"getNetwork");try{return t(u.O$.from(e).toNumber())}catch(t){return Kr.throwError("could not detect network",d.Yd.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:t})}}return Kr.throwError("could not detect network",d.Yd.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(e){return new Vr(qr,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((e=>e.map((e=>this.formatter.address(e)))))}send(e,t){const r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:(0,h.p$)(r),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(n&&this._cache[e])return this._cache[e];const o=ur(this.connection,JSON.stringify(r),Hr).then((e=>(this.emit("debug",{action:"response",request:r,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:r,provider:this}),e}));return n&&(this._cache[e]=o,setTimeout((()=>{this._cache[e]=null}),0)),o}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[Wr(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[Wr(t.address),t.blockTag]];case"getCode":return["eth_getCode",[Wr(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[Wr(t.address),t.position,t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[(0,h.tu)(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[(0,h.tu)(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=Wr(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return Mr(this,void 0,void 0,(function*(){if("call"===e||"estimateGas"===e){const e=t.transaction;if(e&&null!=e.type&&u.O$.from(e.type).isZero()&&null==e.maxFeePerGas&&null==e.maxPriorityFeePerGas){const r=yield this.getFeeData();null==r.maxFeePerGas&&null==r.maxPriorityFeePerGas&&((t=(0,h.DC)(t)).transaction=(0,h.DC)(e),delete t.transaction.type)}}const r=this.prepareRequest(e,t);null==r&&Kr.throwError(e+" not implemented",d.Yd.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(r){return $r(e,r,t)}}))}_startEvent(e){"pending"===e.tag&&this._startPending(),super._startEvent(e)}_startPending(){if(null!=this._pendingFilter)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then((function(r){return function n(){e.send("eth_getFilterChanges",[r]).then((function(r){if(e._pendingFilter!=t)return null;let n=Promise.resolve();return r.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",n=n.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),n.then((function(){return jr(1e3)}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){n()}),0),null;e.send("eth_uninstallFilter",[r])})).catch((e=>{}))}(),r})).catch((e=>{}))}_stopEvent(e){"pending"===e.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const r=(0,h.DC)(Zr);if(t)for(const e in t)t[e]&&(r[e]=!0);(0,h.uj)(e,r);const n={};return["gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null==e[t])return;const r=(0,_.$P)(e[t]);"gasLimit"===t&&(t="gas"),n[t]=r})),["from","to","data"].forEach((function(t){null!=e[t]&&(n[t]=(0,_.Dv)(e[t]))})),e.accessList&&(n.accessList=(0,P.accessListify)(e.accessList)),n}}let Xr=null;try{if(Xr=WebSocket,null==Xr)throw new Error("inject please")}catch(e){const t=new d.Yd(pr);Xr=function(){t.throwError("WebSockets not supported in this environment",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var en=r(25108),tn=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const rn=new d.Yd(pr);let nn=1;class on extends Qr{constructor(e,t){"any"===t&&rn.throwError("WebSocketProvider does not support 'any' network yet",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),super(e,t),this._pollingInterval=-1,this._wsReady=!1,(0,h.zG)(this,"_websocket",new Xr(this.connection.url)),(0,h.zG)(this,"_requests",{}),(0,h.zG)(this,"_subs",{}),(0,h.zG)(this,"_subIds",{}),(0,h.zG)(this,"_detectNetwork",super.detectNetwork()),this._websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach((e=>{this._websocket.send(this._requests[e].payload)}))},this._websocket.onmessage=e=>{const t=e.data,r=JSON.parse(t);if(null!=r.id){const e=String(r.id),n=this._requests[e];if(delete this._requests[e],void 0!==r.result)n.callback(null,r.result),this.emit("debug",{action:"response",request:JSON.parse(n.payload),response:r.result,provider:this});else{let e=null;r.error?(e=new Error(r.error.message||"unknown error"),(0,h.zG)(e,"code",r.error.code||null),(0,h.zG)(e,"response",t)):e=new Error("unknown error"),n.callback(e,void 0),this.emit("debug",{action:"response",error:e,request:JSON.parse(n.payload),provider:this})}}else if("eth_subscription"===r.method){const e=this._subs[r.params.subscription];e&&e.processFunc(r.params.result)}else en.warn("this should not happen")};const r=setInterval((()=>{this.emit("poll")}),1e3);r.unref&&r.unref()}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){rn.throwError("cannot reset events block on WebSocketProvider",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){rn.throwError("cannot set polling interval on WebSocketProvider",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return tn(this,void 0,void 0,(function*(){return null}))}set polling(e){e&&rn.throwError("cannot set polling on WebSocketProvider",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,t){const r=nn++;return new Promise(((n,o)=>{const i=JSON.stringify({method:e,params:t,id:r,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(i),provider:this}),this._requests[String(r)]={callback:function(e,t){return e?o(e):n(t)},payload:i},this._wsReady&&this._websocket.send(i)}))}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,t,r){return tn(this,void 0,void 0,(function*(){let n=this._subIds[e];null==n&&(n=Promise.all(t).then((e=>this.send("eth_subscribe",e))),this._subIds[e]=n);const o=yield n;this._subs[o]={tag:e,processFunc:r}}))}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],(e=>{const t=u.O$.from(e.number).toNumber();this._emitted.block=t,this.emit("block",t)}));break;case"pending":this._subscribe("pending",["newPendingTransactions"],(e=>{this.emit("pending",e)}));break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],(t=>{null==t.removed&&(t.removed=!1),this.emit(e.filter,this.formatter.filterLog(t))}));break;case"tx":{const t=e=>{const t=e.hash;this.getTransactionReceipt(t).then((e=>{e&&this.emit(t,e)}))};t(e),this._subscribe("tx",["newHeads"],(e=>{this._events.filter((e=>"tx"===e.type)).forEach(t)}));break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:en.log("unhandled:",e)}}_stopEvent(e){let t=e.tag;if("tx"===e.type){if(this._events.filter((e=>"tx"===e.type)).length)return;t="tx"}else if(this.listenerCount(e.event))return;const r=this._subIds[t];r&&(delete this._subIds[t],r.then((e=>{this._subs[e]&&(delete this._subs[e],this.send("eth_unsubscribe",[e]))})))}destroy(){return tn(this,void 0,void 0,(function*(){this._websocket.readyState===Xr.CONNECTING&&(yield new Promise((e=>{this._websocket.onopen=function(){e(!0)},this._websocket.onerror=function(){e(!1)}}))),this._websocket.close(1e3)}))}}const sn=new d.Yd(pr);class an extends Qr{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return t=this,r=void 0,o=function*(){let t=this.network;return null==t&&(t=yield e.detectNetwork.call(this),t||sn.throwError("no network detected",d.Yd.errors.UNKNOWN_ERROR,{}),null==this._network&&((0,h.zG)(this,"_network",t),this.emit("network",t,null))),t},new((n=void 0)||(n=Promise))((function(e,i){function s(e){try{l(o.next(e))}catch(e){i(e)}}function a(e){try{l(o.throw(e))}catch(e){i(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(e){e(r)}))).then(s,a)}l((o=o.apply(t,r||[])).next())}));var t,r,n,o}}class ln extends an{constructor(e,t){sn.checkAbstract(new.target,ln),e=(0,h.tu)(new.target,"getNetwork")(e),t=(0,h.tu)(new.target,"getApiKey")(t),super((0,h.tu)(new.target,"getUrl")(e,t),e),"string"==typeof t?(0,h.zG)(this,"apiKey",t):null!=t&&Object.keys(t).forEach((e=>{(0,h.zG)(this,e,t[e])}))}_startPending(){sn.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return sn.throwError("API provider does not support signing",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,t){return sn.throwError("not implemented; sub-classes must override getUrl",d.Yd.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const cn=new d.Yd(pr),un="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class hn extends on{constructor(e,t){const r=new dn(e,t);super(r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi."),r.network),(0,h.zG)(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===un}}class dn extends ln{static getWebSocketProvider(e,t){return new hn(e,t)}static getApiKey(e){return null==e?un:(e&&"string"!=typeof e&&cn.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="eth-mainnet.alchemyapi.io/v2/";break;case"ropsten":r="eth-ropsten.alchemyapi.io/v2/";break;case"rinkeby":r="eth-rinkeby.alchemyapi.io/v2/";break;case"goerli":r="eth-goerli.alchemyapi.io/v2/";break;case"kovan":r="eth-kovan.alchemyapi.io/v2/";break;case"matic":r="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":r="polygon-mumbai.g.alchemy.com/v2/";break;default:cn.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+t,throttleCallback:(e,r)=>(t===un&&Er(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===un}}const fn=new d.Yd(pr);class pn extends ln{static getApiKey(e){return null!=e&&fn.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,t){let r=null;return"homestead"===e.name?r="https://cloudflare-eth.com/":fn.throwArgumentError("unsupported network","network",arguments[0]),r}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return n=this,o=void 0,s=function*(){return"getBlockNumber"===e?(yield r.perform.call(this,"getBlock",{blockTag:"latest"})).number:r.perform.call(this,e,t)},new((i=void 0)||(i=Promise))((function(e,t){function r(e){try{l(s.next(e))}catch(e){t(e)}}function a(e){try{l(s.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(r,a)}l((s=s.apply(n,o||[])).next())}));var n,o,i,s}}var mn=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const gn=new d.Yd(pr);function yn(e){const t={};for(let r in e){if(null==e[r])continue;let n=e[r];"type"===r&&0===n||(n={type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?(0,_.$P)((0,_.Dv)(n)):"accessList"===r?"["+(0,P.accessListify)(n).map((e=>`{address:"${e.address}",storageKeys:["${e.storageKeys.join('","')}"]}`)).join(",")+"]":(0,_.Dv)(n),t[r]=n)}return t}function vn(e){if(0==e.status&&("No records found"===e.message||"No transactions found"===e.message))return e.result;if(1!=e.status||"OK"!=e.message){const t=new Error("invalid response");throw t.result=JSON.stringify(e),(e.result||"").toLowerCase().indexOf("rate limit")>=0&&(t.throttleRetry=!0),t}return e.result}function wn(e){if(e&&0==e.status&&"NOTOK"==e.message&&(e.result||"").toLowerCase().indexOf("rate limit")>=0){const t=new Error("throttled response");throw t.result=JSON.stringify(e),t.throttleRetry=!0,t}if("2.0"!=e.jsonrpc){const t=new Error("invalid response");throw t.result=JSON.stringify(e),t}if(e.error){const t=new Error(e.error.message||"unknown error");throw e.error.code&&(t.code=e.error.code),e.error.data&&(t.data=e.error.data),t}return e.result}function bn(e){if("pending"===e)throw new Error("pending not supported");return"latest"===e?e:parseInt(e.substring(2),16)}const En="9D13ZE7XSBTJ94N9BNJ2MA33VMAY2YPIRB";function kn(e,t,r){if("call"===e&&t.code===d.Yd.errors.SERVER_ERROR){const e=t.error;if(e&&(e.message.match(/reverted/i)||e.message.match(/VM execution error/i))){let r=e.data;if(r&&(r="0x"+r.replace(/^.*0x/i,"")),(0,_.A7)(r))return r;gn.throwError("missing revert data in call exception",d.Yd.errors.CALL_EXCEPTION,{error:t,data:"0x"})}}let n=t.message;throw t.code===d.Yd.errors.SERVER_ERROR&&(t.error&&"string"==typeof t.error.message?n=t.error.message:"string"==typeof t.body?n=t.body:"string"==typeof t.responseText&&(n=t.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&gn.throwError("insufficient funds for intrinsic transaction cost",d.Yd.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&gn.throwError("nonce has already been used",d.Yd.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),n.match(/another transaction with same nonce/)&&gn.throwError("replacement fee too low",d.Yd.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&gn.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",d.Yd.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}class _n extends zr{constructor(e,t){gn.checkNew(new.target,_n),super(e),(0,h.zG)(this,"baseUrl",this.getBaseUrl()),(0,h.zG)(this,"apiKey",t||En)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"ropsten":return"https://api-ropsten.etherscan.io";case"rinkeby":return"https://api-rinkeby.etherscan.io";case"kovan":return"https://api-kovan.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io"}return gn.throwArgumentError("unsupported network","network",name)}getUrl(e,t){const r=Object.keys(t).reduce(((e,r)=>{const n=t[r];return null!=n&&(e+=`&${r}=${n}`),e}),""),n=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${r}${n}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,t){return t.module=e,t.apikey=this.apiKey,t}fetch(e,t,r){return mn(this,void 0,void 0,(function*(){const n=r?this.getPostUrl():this.getUrl(e,t),o=r?this.getPostData(e,t):null,i="proxy"===e?wn:vn;this.emit("debug",{action:"request",request:n,provider:this});const s={url:n,throttleSlotInterval:1e3,throttleCallback:(e,t)=>(this.isCommunityResource()&&Er(),Promise.resolve(!0))};let a=null;o&&(s.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},a=Object.keys(o).map((e=>`${e}=${o[e]}`)).join("&"));const l=yield ur(s,a,i||wn);return this.emit("debug",{action:"response",request:n,response:(0,h.p$)(l),provider:this}),l}))}detectNetwork(){return mn(this,void 0,void 0,(function*(){return this.network}))}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return mn(this,void 0,void 0,(function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:t.address,tag:t.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch((e=>kn("sendTransaction",e,t.signedTransaction)));case"getBlock":if(t.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:t.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.transactionHash});case"call":{if("latest"!==t.blockTag)throw new Error("EtherscanProvider does not support blockTag for call");const e=yn(t.transaction);e.module="proxy",e.action="eth_call";try{return yield this.fetch("proxy",e,!0)}catch(e){return kn("call",e,t.transaction)}}case"estimateGas":{const e=yn(t.transaction);e.module="proxy",e.action="eth_estimateGas";try{return yield this.fetch("proxy",e,!0)}catch(e){return kn("estimateGas",e,t.transaction)}}case"getLogs":{const e={action:"getLogs"};if(t.filter.fromBlock&&(e.fromBlock=bn(t.filter.fromBlock)),t.filter.toBlock&&(e.toBlock=bn(t.filter.toBlock)),t.filter.address&&(e.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&gn.throwError("unsupported topic count",d.Yd.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),1===t.filter.topics.length)){const r=t.filter.topics[0];"string"==typeof r&&66===r.length||gn.throwError("unsupported topic format",d.Yd.errors.UNSUPPORTED_OPERATION,{topic0:r}),e.topic0=r}const r=yield this.fetch("logs",e);let n={};for(let e=0;e<r.length;e++){const t=r[e];if(null==t.blockHash){if(null==n[t.blockNumber]){const e=yield this.getBlock(t.blockNumber);e&&(n[t.blockNumber]=e.hash)}t.blockHash=n[t.blockNumber]}}return r}case"getEtherPrice":return"homestead"!==this.network.name?0:parseFloat((yield this.fetch("stats",{action:"ethprice"})).ethusd)}return r.perform.call(this,e,t)}))}getHistory(e,t,r){return mn(this,void 0,void 0,(function*(){const n={action:"txlist",address:yield this.resolveName(e),startblock:null==t?0:t,endblock:null==r?99999999:r,sort:"asc"};return(yield this.fetch("account",n)).map((e=>{["contractAddress","to"].forEach((function(t){""==e[t]&&delete e[t]})),null==e.creates&&null!=e.contractAddress&&(e.creates=e.contractAddress);const t=this.formatter.transactionResponse(e);return e.timeStamp&&(t.timestamp=parseInt(e.timeStamp)),t}))}))}isCommunityResource(){return this.apiKey===En}}function Pn(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}var An=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const Sn=new d.Yd(pr);function Nn(){return(new Date).getTime()}function Tn(e){let t=null;for(let r=0;r<e.length;r++){const n=e[r];if(null==n)return null;t?t.name===n.name&&t.chainId===n.chainId&&(t.ensAddress===n.ensAddress||null==t.ensAddress&&null==n.ensAddress)||Sn.throwArgumentError("provider mismatch","networks",e):t=n}return t}function Cn(e,t){e=e.slice().sort();const r=Math.floor(e.length/2);if(e.length%2)return e[r];const n=e[r-1],o=e[r];return null!=t&&Math.abs(n-o)>t?null:(n+o)/2}function Rn(e){if(null===e)return"null";if("number"==typeof e||"boolean"==typeof e)return JSON.stringify(e);if("string"==typeof e)return e;if(u.O$.isBigNumber(e))return e.toString();if(Array.isArray(e))return JSON.stringify(e.map((e=>Rn(e))));if("object"==typeof e){const t=Object.keys(e);return t.sort(),"{"+t.map((t=>{let r=e[t];return r="function"==typeof r?"[function]":Rn(r),JSON.stringify(t)+":"+r})).join(",")+"}"}throw new Error("unknown value type: "+typeof e)}let xn=1;function Bn(e){let t=null,r=null,n=new Promise((n=>{t=function(){r&&(clearTimeout(r),r=null),n()},r=setTimeout(t,e)}));return{cancel:t,getPromise:function(){return n},wait:e=>(n=n.then(e),n)}}const In=[d.Yd.errors.CALL_EXCEPTION,d.Yd.errors.INSUFFICIENT_FUNDS,d.Yd.errors.NONCE_EXPIRED,d.Yd.errors.REPLACEMENT_UNDERPRICED,d.Yd.errors.UNPREDICTABLE_GAS_LIMIT],On=["address","args","errorArgs","errorSignature","method","transaction"];function Dn(e,t){const r={weight:e.weight};return Object.defineProperty(r,"provider",{get:()=>e.provider}),e.start&&(r.start=e.start),t&&(r.duration=t-e.start),e.done&&(e.error?r.error=e.error:r.result=e.result||null),r}function Fn(e,t){return An(this,void 0,void 0,(function*(){const r=e.provider;return null!=r.blockNumber&&r.blockNumber>=t||-1===t?r:hr((()=>new Promise(((n,o)=>{setTimeout((function(){return r.blockNumber>=t?n(r):e.cancelled?n(null):n(void 0)}),0)}))),{oncePoll:r})}))}function Gn(e,t,r,n){return An(this,void 0,void 0,(function*(){let o=e.provider;switch(r){case"getBlockNumber":case"getGasPrice":return o[r]();case"getEtherPrice":if(o.getEtherPrice)return o.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&(0,_.A7)(n.blockTag)&&(o=yield Fn(e,t)),o[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&(0,_.A7)(n.blockTag)&&(o=yield Fn(e,t)),o.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&(0,_.A7)(n.blockTag)&&(o=yield Fn(e,t)),o[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&(0,_.A7)(n.blockTag)&&(o=yield Fn(e,t)),o[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return o[r](n.transactionHash);case"getLogs":{let r=n.filter;return(r.fromBlock&&(0,_.A7)(r.fromBlock)||r.toBlock&&(0,_.A7)(r.toBlock))&&(o=yield Fn(e,t)),o.getLogs(r)}}return Sn.throwError("unknown method error",d.Yd.errors.UNKNOWN_ERROR,{method:r,params:n})}))}class Ln extends zr{constructor(e,t){Sn.checkNew(new.target,Ln),0===e.length&&Sn.throwArgumentError("missing providers","providers",e);const r=e.map(((e,t)=>{if(m.isProvider(e)){const t=wr(e)?2e3:750,r=1;return Object.freeze({provider:e,weight:1,stallTimeout:t,priority:r})}const r=(0,h.DC)(e);null==r.priority&&(r.priority=1),null==r.stallTimeout&&(r.stallTimeout=wr(e)?2e3:750),null==r.weight&&(r.weight=1);const n=r.weight;return(n%1||n>512||n<1)&&Sn.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${t}].weight`,n),Object.freeze(r)})),n=r.reduce(((e,t)=>e+t.weight),0);null==t?t=n/2:t>n&&Sn.throwArgumentError("quorum will always fail; larger than total weight","quorum",t);let o=Tn(r.map((e=>e.provider.network)));null==o&&(o=new Promise(((e,t)=>{setTimeout((()=>{this.detectNetwork().then(e,t)}),0)}))),super(o),(0,h.zG)(this,"providerConfigs",Object.freeze(r)),(0,h.zG)(this,"quorum",t),this._highestBlockNumber=-1}detectNetwork(){return An(this,void 0,void 0,(function*(){return Tn(yield Promise.all(this.providerConfigs.map((e=>e.provider.getNetwork()))))}))}perform(e,t){return An(this,void 0,void 0,(function*(){if("sendTransaction"===e){const e=yield Promise.all(this.providerConfigs.map((e=>e.provider.sendTransaction(t.signedTransaction).then((e=>e.hash),(e=>e)))));for(let t=0;t<e.length;t++){const r=e[t];if("string"==typeof r)return r}throw e[0]}-1===this._highestBlockNumber&&"getBlockNumber"!==e&&(yield this.getBlockNumber());const r=function(e,t,r){let n=Rn;switch(t){case"getBlockNumber":return function(t){const r=t.map((e=>e.result));let n=Cn(t.map((e=>e.result)),2);if(null!=n)return n=Math.ceil(n),r.indexOf(n+1)>=0&&n++,n>=e._highestBlockNumber&&(e._highestBlockNumber=n),e._highestBlockNumber};case"getGasPrice":return function(e){const t=e.map((e=>e.result));return t.sort(),t[Math.floor(t.length/2)]};case"getEtherPrice":return function(e){return Cn(e.map((e=>e.result)))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(e){return null==e?null:((e=(0,h.DC)(e)).confirmations=-1,Rn(e))};break;case"getBlock":n=r.includeTransactions?function(e){return null==e?null:((e=(0,h.DC)(e)).transactions=e.transactions.map((e=>((e=(0,h.DC)(e)).confirmations=-1,e))),Rn(e))}:function(e){return null==e?null:Rn(e)};break;default:throw new Error("unknown method: "+t)}return function(e,t){return function(r){const n={};r.forEach((t=>{const r=e(t.result);n[r]||(n[r]={count:0,result:t.result}),n[r].count++}));const o=Object.keys(n);for(let e=0;e<o.length;e++){const r=n[o[e]];if(r.count>=t)return r.result}}}(n,e.quorum)}(this,e,t),n=Pn(this.providerConfigs.map(h.DC));n.sort(((e,t)=>e.priority-t.priority));const o=this._highestBlockNumber;let i=0,s=!0;for(;;){const a=Nn();let l=n.filter((e=>e.runner&&a-e.start<e.stallTimeout)).reduce(((e,t)=>e+t.weight),0);for(;l<this.quorum&&i<n.length;){const r=n[i++],s=xn++;r.start=Nn(),r.staller=Bn(r.stallTimeout),r.staller.wait((()=>{r.staller=null})),r.runner=Gn(r,o,e,t).then((n=>{r.done=!0,r.result=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:Dn(r,Nn()),request:{method:e,params:(0,h.p$)(t)},provider:this})}),(n=>{r.done=!0,r.error=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:Dn(r,Nn()),request:{method:e,params:(0,h.p$)(t)},provider:this})})),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:Dn(r,null),request:{method:e,params:(0,h.p$)(t)},provider:this}),l+=r.weight}const c=[];n.forEach((e=>{!e.done&&e.runner&&(c.push(e.runner),e.staller&&c.push(e.staller.getPromise()))})),c.length&&(yield Promise.race(c));const u=n.filter((e=>e.done&&null==e.error));if(u.length>=this.quorum){const e=r(u);if(void 0!==e)return n.forEach((e=>{e.staller&&e.staller.cancel(),e.cancelled=!0})),e;s||(yield Bn(100).getPromise()),s=!1}const d=n.reduce(((e,t)=>{if(!t.done||null==t.error)return e;const r=t.error.code;return In.indexOf(r)>=0&&(e[r]||(e[r]={error:t.error,weight:0}),e[r].weight+=t.weight),e}),{});if(Object.keys(d).forEach((e=>{const t=d[e];if(t.weight<this.quorum)return;n.forEach((e=>{e.staller&&e.staller.cancel(),e.cancelled=!0}));const r=t.error,o={};On.forEach((e=>{null!=r[e]&&(o[e]=r[e])})),Sn.throwError(r.reason||r.message,e,o)})),0===n.filter((e=>!e.done)).length)break}return n.forEach((e=>{e.staller&&e.staller.cancel(),e.cancelled=!0})),Sn.throwError("failed to meet quorum",d.Yd.errors.SERVER_ERROR,{method:e,params:t,results:n.map((e=>Dn(e))),provider:this})}))}}const Un=null,zn=new d.Yd(pr),Mn="84842078b09946638c03157f83405213";class Kn extends on{constructor(e,t){const r=new Yn(e,t),n=r.connection;n.password&&zn.throwError("INFURA WebSocket project secrets unsupported",d.Yd.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"}),super(n.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/"),e),(0,h.zG)(this,"apiKey",r.projectId),(0,h.zG)(this,"projectId",r.projectId),(0,h.zG)(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===Mn}}class Yn extends ln{static getWebSocketProvider(e,t){return new Kn(e,t)}static getApiKey(e){const t={apiKey:Mn,projectId:Mn,projectSecret:null};return null==e||("string"==typeof e?t.projectId=e:null!=e.projectSecret?(zn.assertArgument("string"==typeof e.projectId,"projectSecret requires a projectId","projectId",e.projectId),zn.assertArgument("string"==typeof e.projectSecret,"invalid projectSecret","projectSecret","[REDACTED]"),t.projectId=e.projectId,t.projectSecret=e.projectSecret):e.projectId&&(t.projectId=e.projectId),t.apiKey=t.projectId),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"homestead":r="mainnet.infura.io";break;case"ropsten":r="ropsten.infura.io";break;case"rinkeby":r="rinkeby.infura.io";break;case"kovan":r="kovan.infura.io";break;case"goerli":r="goerli.infura.io";break;case"matic":r="polygon-mainnet.infura.io";break;case"maticmum":r="polygon-mumbai.infura.io";break;default:zn.throwError("unsupported network",d.Yd.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const n={allowGzip:!0,url:"https://"+r+"/v3/"+t.projectId,throttleCallback:(e,r)=>(t.projectId===Mn&&Er(),Promise.resolve(!0))};return null!=t.projectSecret&&(n.user="",n.password=t.projectSecret),n}isCommunityResource(){return this.projectId===Mn}}class $n extends Qr{send(e,t){const r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const n={request:r,resolve:null,reject:null},o=new Promise(((e,t)=>{n.resolve=e,n.reject=t}));return this._pendingBatch.push(n),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const e=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const t=e.map((e=>e.request));return this.emit("debug",{action:"requestBatch",request:(0,h.p$)(t),provider:this}),ur(this.connection,JSON.stringify(t)).then((r=>{this.emit("debug",{action:"response",request:t,response:r,provider:this}),e.forEach(((e,t)=>{const n=r[t];if(n.error){const t=new Error(n.error.message);t.code=n.error.code,t.data=n.error.data,e.reject(t)}else e.resolve(n.result)}))}),(r=>{this.emit("debug",{action:"response",error:r,request:t,provider:this}),e.forEach((e=>{e.reject(r)}))}))}),10)),o}}const jn=new d.Yd(pr);class Hn extends ln{static getApiKey(e){return e&&"string"!=typeof e&&jn.throwArgumentError("invalid apiKey","apiKey",e),e||"ETHERS_JS_SHARED"}static getUrl(e,t){jn.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let r=null;switch(e.name){case"homestead":r="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":r="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":r="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":r="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":r="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:jn.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+t}}const Wn=new d.Yd(pr),qn={homestead:"6004bcd10040261633ade990",ropsten:"6004bd4d0040261633ade991",rinkeby:"6004bda20040261633ade994",goerli:"6004bd860040261633ade992"};class Vn extends ln{constructor(e,t){if(null==t){const r=(0,h.tu)(new.target,"getNetwork")(e);if(r){const e=qn[r.name];e&&(t={applicationId:e,loadBalancer:!0})}null==t&&Wn.throwError("unsupported network",d.Yd.errors.INVALID_ARGUMENT,{argument:"network",value:e})}super(e,t)}static getApiKey(e){null==e&&Wn.throwArgumentError("PocketProvider.getApiKey does not support null apiKey","apiKey",e);const t={applicationId:null,loadBalancer:!1,applicationSecretKey:null};return"string"==typeof e?t.applicationId=e:null!=e.applicationSecretKey?(Wn.assertArgument("string"==typeof e.applicationId,"applicationSecretKey requires an applicationId","applicationId",e.applicationId),Wn.assertArgument("string"==typeof e.applicationSecretKey,"invalid applicationSecretKey","applicationSecretKey","[REDACTED]"),t.applicationId=e.applicationId,t.applicationSecretKey=e.applicationSecretKey,t.loadBalancer=!!e.loadBalancer):e.applicationId?(Wn.assertArgument("string"==typeof e.applicationId,"apiKey.applicationId must be a string","apiKey.applicationId",e.applicationId),t.applicationId=e.applicationId,t.loadBalancer=!!e.loadBalancer):Wn.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"homestead":r="eth-mainnet.gateway.pokt.network";break;case"ropsten":r="eth-ropsten.gateway.pokt.network";break;case"rinkeby":r="eth-rinkeby.gateway.pokt.network";break;case"goerli":r="eth-goerli.gateway.pokt.network";break;default:Wn.throwError("unsupported network",d.Yd.errors.INVALID_ARGUMENT,{argument:"network",value:e})}let n=null;n=t.loadBalancer?`https://${r}/v1/lb/${t.applicationId}`:`https://${r}/v1/${t.applicationId}`;const o={url:n,headers:{}};return null!=t.applicationSecretKey&&(o.user="",o.password=t.applicationSecretKey),o}isCommunityResource(){return this.applicationId===qn[this.network.name]}}const Jn=new d.Yd(pr);let Zn=1;function Qn(e,t){const r="Web3LegacyFetcher";return function(e,n){const o={method:e,params:n,id:Zn++,jsonrpc:"2.0"};return new Promise(((e,n)=>{this.emit("debug",{action:"request",fetcher:r,request:(0,h.p$)(o),provider:this}),t(o,((t,i)=>{if(t)return this.emit("debug",{action:"response",fetcher:r,error:t,request:o,provider:this}),n(t);if(this.emit("debug",{action:"response",fetcher:r,request:o,response:i,provider:this}),i.error){const e=new Error(i.error.message);return e.code=i.error.code,e.data=i.error.data,n(e)}e(i.result)}))}))}}class Xn extends Qr{constructor(e,t){Jn.checkNew(new.target,Xn),null==e&&Jn.throwArgumentError("missing provider","provider",e);let r=null,n=null,o=null;"function"==typeof e?(r="unknown:",n=e):(r=e.host||e.path||"",!r&&e.isMetaMask&&(r="metamask"),o=e,e.request?(""===r&&(r="eip-1193:"),n=function(e){return function(t,r){null==r&&(r=[]);const n={method:t,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:(0,h.p$)(n),provider:this}),e.request(n).then((e=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:e,provider:this}),e}))}}(e)):e.sendAsync?n=Qn(0,e.sendAsync.bind(e)):e.send?n=Qn(0,e.send.bind(e)):Jn.throwArgumentError("unsupported provider","provider",e),r||(r="unknown:")),super(r,t),(0,h.zG)(this,"jsonRpcFetchFunc",n),(0,h.zG)(this,"provider",o)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const eo=new d.Yd(pr);function to(e,t){if(null==e&&(e="homestead"),"string"==typeof e){const t=e.match(/^(ws|http)s?:/i);if(t)switch(t[1]){case"http":return new Qr(e);case"ws":return new on(e);default:eo.throwArgumentError("unsupported URL scheme","network",e)}}const r=zt(e);return r&&r._defaultProvider||eo.throwError("unsupported getDefaultProvider network",d.Yd.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:e}),r._defaultProvider({FallbackProvider:Ln,AlchemyProvider:dn,CloudflareProvider:pn,EtherscanProvider:_n,InfuraProvider:Yn,JsonRpcProvider:Qr,NodesmithProvider:Hn,PocketProvider:Vn,Web3Provider:Xn,IpcProvider:Un},t)}var ro=r(72734),no=r(11388),oo=r(33777),io=r(61843);function so(e){const t=(0,ne.Y0)(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return(0,_.Dv)((0,_.zo)([t,xt]).slice(0,32))}function ao(e){const t=(0,_.lE)(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(0,ne.ZN)(t.slice(0,r))}const lo=new d.Yd("units/5.5.0"),co=["wei","kwei","mwei","gwei","szabo","finney","ether"];function uo(e){const t=String(e).split(".");(t.length>2||!t[0].match(/^-?[0-9]*$/)||t[1]&&!t[1].match(/^[0-9]*$/)||"."===e||"-."===e)&&lo.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 o="";for(2===t.length&&(o="."+(t[1]||"0"));o.length>2&&"0"===o[o.length-1];)o=o.substring(0,o.length-1);const i=[];for(;r.length;){if(r.length<=3){i.unshift(r);break}{const e=r.length-3;i.unshift(r.substring(e)),r=r.substring(0,e)}}return n+i.join(",")+o}function ho(e,t){if("string"==typeof t){const e=co.indexOf(t);-1!==e&&(t=3*e)}return J(e,null!=t?t:18)}function fo(e,t){if("string"!=typeof e&&lo.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=co.indexOf(t);-1!==e&&(t=3*e)}return Z(e,null!=t?t:18)}function po(e){return ho(e,18)}function mo(e){return fo(e,18)}const go="ethers/5.5.1",yo=new d.Yd(go);try{const e=window;null==e._ethers&&(e._ethers=a)}catch(e){}}}]);