edge-core-js 2.26.0 → 2.26.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see edge-core.js.LICENSE.txt */
2
- !function(){var e={8826: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 a(e){return new Uint8Array(e)}function i(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 s,u={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=(s="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(s[(240&n)>>4]+s[15&n])}return t.join("")}}),f={16:10,24:12,32:14},l=[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],p=[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],h=[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],b=[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],v=[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],g=[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],m=[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],w=[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],x=[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],I=[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],O=[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],E=[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 A=function(e){if(!(this instanceof A))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:o(e,!0)}),this._prepare()};A.prototype._prepare=function(){var e=f[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,a=S(this.key);for(t=0;t<o;t++)r=t>>2,this._Ke[r][t%4]=a[t],this._Kd[e-r][t%4]=a[t];for(var i,s=0,u=o;u<n;){if(i=a[o-1],a[0]^=d[i>>16&255]<<24^d[i>>8&255]<<16^d[255&i]<<8^d[i>>24&255]^l[s]<<24,s+=1,8!=o)for(t=1;t<o;t++)a[t]^=a[t-1];else{for(t=1;t<o/2;t++)a[t]^=a[t-1];i=a[o/2-1],a[o/2]^=d[255&i]^d[i>>8&255]<<8^d[i>>16&255]<<16^d[i>>24&255]<<24;for(t=o/2+1;t<o;t++)a[t]^=a[t-1]}for(t=0;t<o&&u<n;)c=u>>2,p=u%4,this._Ke[c][p]=a[t],this._Kd[e-c][p]=a[t++],u++}for(var c=1;c<e;c++)for(var p=0;p<4;p++)i=this._Kd[c][p],this._Kd[c][p]=k[i>>24&255]^I[i>>16&255]^O[i>>8&255]^E[255&i]},A.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 i=1;i<t;i++){for(o=0;o<4;o++)r[o]=h[n[o]>>24&255]^b[n[(o+1)%4]>>16&255]^v[n[(o+2)%4]>>8&255]^y[255&n[(o+3)%4]]^this._Ke[i][o];n=r.slice()}var s,u=a(16);for(o=0;o<4;o++)s=this._Ke[t][o],u[4*o]=255&(d[n[o]>>24&255]^s>>24),u[4*o+1]=255&(d[n[(o+1)%4]>>16&255]^s>>16),u[4*o+2]=255&(d[n[(o+2)%4]>>8&255]^s>>8),u[4*o+3]=255&(d[255&n[(o+3)%4]]^s);return u},A.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 i=1;i<t;i++){for(o=0;o<4;o++)r[o]=g[n[o]>>24&255]^m[n[(o+3)%4]>>16&255]^w[n[(o+2)%4]>>8&255]^x[255&n[(o+1)%4]]^this._Kd[i][o];n=r.slice()}var s,u=a(16);for(o=0;o<4;o++)s=this._Kd[t][o],u[4*o]=255&(p[n[o]>>24&255]^s>>24),u[4*o+1]=255&(p[n[(o+3)%4]>>16&255]^s>>16),u[4*o+2]=255&(p[n[(o+2)%4]>>8&255]^s>>8),u[4*o+3]=255&(p[255&n[(o+1)%4]]^s);return u};var _=function(e){if(!(this instanceof _))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new A(e)};_.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=a(e.length),r=a(16),n=0;n<e.length;n+=16)i(e,r,0,n,n+16),i(r=this._aes.encrypt(r),t,n);return 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=a(e.length),r=a(16),n=0;n<e.length;n+=16)i(e,r,0,n,n+16),i(r=this._aes.decrypt(r),t,n);return t};var T=function(e,t){if(!(this instanceof T))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=a(16);this._lastCipherblock=o(t,!0),this._aes=new A(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=a(e.length),r=a(16),n=0;n<e.length;n+=16){i(e,r,0,n,n+16);for(var s=0;s<16;s++)r[s]^=this._lastCipherblock[s];this._lastCipherblock=this._aes.encrypt(r),i(this._lastCipherblock,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=a(e.length),r=a(16),n=0;n<e.length;n+=16){i(e,r,0,n,n+16),r=this._aes.decrypt(r);for(var s=0;s<16;s++)t[n+s]=r[s]^this._lastCipherblock[s];i(e,this._lastCipherblock,0,n,n+16)}return t};var P=function(e,t,r){if(!(this instanceof P))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=a(16);r||(r=1),this.segmentSize=r,this._shiftRegister=o(t,!0),this._aes=new A(e)};P.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 a=0;a<this.segmentSize;a++)r[n+a]^=t[a];i(this._shiftRegister,this._shiftRegister,0,this.segmentSize),i(r,this._shiftRegister,16-this.segmentSize,n,n+this.segmentSize)}return r},P.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 a=0;a<this.segmentSize;a++)r[n+a]^=t[a];i(this._shiftRegister,this._shiftRegister,0,this.segmentSize),i(e,this._shiftRegister,16-this.segmentSize,n,n+this.segmentSize)}return r};var M=function(e,t){if(!(this instanceof M))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=a(16);this._lastPrecipher=o(t,!0),this._lastPrecipherIndex=16,this._aes=new A(e)};M.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},M.prototype.decrypt=M.prototype.encrypt;var j=function(e){if(!(this instanceof j))throw Error("Counter must be instanitated with `new`");0===e||e||(e=1),"number"==typeof e?(this._counter=a(16),this.setValue(e)):this.setBytes(e)};j.prototype.setValue=function(e){if("number"!=typeof e||parseInt(e)!=e)throw new Error("invalid counter value (must be an integer)");if(e>Number.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},j.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},j.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var C=function(e,t){if(!(this instanceof C))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof j||(t=new j(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new A(e)};C.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},C.prototype.decrypt=C.prototype.encrypt;var N={AES:A,Counter:j,ModeOfOperation:{ecb:_,cbc:T,cfb:P,ofb:M,ctr:C},utils:{hex:c,utf8:u},padding:{pkcs7:{pad:function(e){var t=16-(e=o(e,!0)).length%16,r=a(e.length+t);i(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 s=a(r);return i(e,s,0,0,r),s}}},_arrayTest:{coerceArray:o,createArray:a,copyArray:i}};e.exports=N}()},5136:function(){function e(e,t,r){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:r})}e(Object,"assign",(function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");e=Object(e);for(var t=1;t<arguments.length;++t){var r=arguments[t];if(null!=r)for(var n=0,o=Object.keys(r);n<o.length;n++){var a=o[n];e[a]=r[a]}}return e})),e(Array.prototype,"fill",(function(e,t,r){var n=this.length;function o(e){return e<0?Math.max(n+e,0):Math.min(e,n)}for(var a=null!=t?o(t):0,i=null!=r?o(r):n,s=a;s<i;++s)this[s]=e;return this})),e(Array.prototype,"find",(function(e,t){for(var r=0;r<this.length;++r){var n=this[r];if(e.call(t,n,r,this))return n}})),e(Array.prototype,"includes",(function(e){return Array.prototype.indexOf.call(this,e)>=0})),e(Uint8Array.prototype,"fill",Array.prototype.fill)},8162:function(e){"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var o=e.charAt(n),a=o.charCodeAt(0);if(255!==t[a])throw new TypeError(o+" is ambiguous");t[a]=n}var i=e.length,s=e.charAt(0),u=Math.log(i)/Math.log(256),c=Math.log(256)/Math.log(i);function f(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var r=0,n=0,o=0;e[r]===s;)n++,r++;for(var a=(e.length-r)*u+1>>>0,c=new Uint8Array(a);e[r];){var f=t[e.charCodeAt(r)];if(255===f)return;for(var l=0,d=a-1;(0!==f||l<o)&&-1!==d;d--,l++)f+=i*c[d]>>>0,c[d]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");o=l,r++}for(var p=a-o;p!==a&&0===c[p];)p++;for(var h=new Uint8Array(n+(a-p)),b=n;p!==a;)h[b++]=c[p++];return h}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,a=t.length;o!==a&&0===t[o];)o++,r++;for(var u=(a-o)*c+1>>>0,f=new Uint8Array(u);o!==a;){for(var l=t[o],d=0,p=u-1;(0!==l||d<n)&&-1!==p;p--,d++)l+=256*f[p]>>>0,f[p]=l%i>>>0,l=l/i>>>0;if(0!==l)throw new Error("Non-zero carry");n=d,o++}for(var h=u-n;h!==u&&0===f[h];)h++;for(var b=s.repeat(r);h<u;++h)b+=e.charAt(f[h]);return b},decodeUnsafe:f,decode:function(e){var t=f(e);if(t)return t;throw new Error("Non-base"+i+" character")}}}},7591:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.log10=t.toFixed=t.toBns=t.round=t.ceil=t.floor=t.max=t.abs=t.min=t.eq=t.gte=t.gt=t.lte=t.lt=t.div=t.sub=t.mul=t.add=void 0;const o=n(r(3550)),a=/^(-?\d*\.?\d*)e((?:\+|-)?\d+)$/;function i(e,t,r=10){if(10!==r&&16!==r)throw new Error("Unsupported base");let{x:n,y:a,shift:i}=h(e,t);const s=b(n)?16:10,u=b(a)?16:10;n=p(n),a=p(a);const c=new o.default(n,s),f=new o.default(a,u);let d=c.add(f).toString(r);return d=l(d,i),10===r?d:d.replace(/^(-)?/,"$10x")}function s(e,t,r=10){if(10!==r&&16!==r)throw new Error("Unsupported base");let{x:n,y:a,shift:i}=h(e,t);const s=b(n)?16:10,u=b(a)?16:10;n=p(n),a=p(a);const c=new o.default(n,s),f=new o.default(a,u);let d=c.mul(f).toString(r);return d=l(d,2*i),10===r?d:d.replace(/^(-)?/,"$10x")}function u(e,t){let{x:r,y:n}=h(e,t);const a=b(r)?16:10,i=b(n)?16:10;r=p(r),n=p(n);const s=new o.default(r,a),u=new o.default(n,i);return s.gt(u)}function c(e,t){let{x:r,y:n}=h(e,t);const a=b(r)?16:10,i=b(n)?16:10;r=p(r),n=p(n);const s=new o.default(r,a),u=new o.default(n,i);return s.gte(u)}function f(e){let t="number"==typeof e?e.toString():e.replace(/^\s+|\s+$/g,"");""!==t&&"."!==t||(t="0");const r=t.match(a);if(null!=r){t=function(e,t){const r=t>=0?"1"+"0".repeat(Math.abs(t)):`0.${"0".repeat(Math.abs(t)-1)}1`;return s(e,r)}(r[1],parseInt(r[2]))}return function(...e){for(const t of e){if(t.split(".").length-1>1)throw new Error(`Invalid number: more than one decimal point '${t}'`);if(t.split("-").length-1>1)throw new Error(`Invalid number: more than one negative sign '${t}'`);if(!/^-?(?:0x[0-9A-Fa-f]+|(?:\d+(?:\.\d*)?|\.\d+))$/.test(t))throw new Error(`Invalid number: non-number characters '${t}'`)}}(t),t}function l(e,t){if(0===t)return e;let r,n=!1;return"-"===e.slice(0,1)&&(n=!0,e=e.slice(1)),r=t>e.length?"0."+d("",t-e.length)+e:e.substr(0,e.length-t)+"."+e.substr(e.length-t,e.length),r=y(r),n&&(r=`-${r}`),r}function d(e,t){let r=e;for(let n=0;n<t;n++)r+="0";return r}function p(e){return e.replace("0x","")}function h(e,t,r){let n=f(e),o=f(t),a=n.indexOf("."),i=o.indexOf(".");const s=b(n),u=b(o);if(-1!==a&&(n=y(n),a=n.indexOf(".")),-1!==i&&(o=y(o),i=o.indexOf(".")),-1!==a||-1!==i||"number"==typeof r){if(s||u)throw new Error("Cannot operate on base16 float values");let e=0,t=0;-1!==a&&(e=n.length-a-1),-1!==i&&(t=o.length-i-1);const c=e>t?e:t;let f=0;"number"==typeof r&&(f=r),n=d(n.replace(".",""),c+f-e),o=d(o.replace(".",""),c-t);return{x:n,y:o,shift:c}}return{x:n,y:o,shift:0}}function b(e){const t=f(e);return!!(t.startsWith("0x")||t.startsWith("-0x")||t.toLowerCase().includes("a")||t.toLowerCase().includes("b")||t.toLowerCase().includes("c")||t.toLowerCase().includes("d")||t.toLowerCase().includes("e")||t.toLowerCase().includes("f"))}function v(e,t,r=0){var n,o;let a=f(t),s=!1,l="";a.includes("-")&&(s=!0,a=a.replace(/^-+/,""));const[d,p=""]=a.split("."),h=a.indexOf("."),b=-1!==h?h-r:a.length-r,v=d+p;if("round"===e){e=c(null!==(n=v[b])&&void 0!==n?n:"0","5")?"ceil":"floor"}const g=Math.max(v.length-b+1,0),m=new Array(g).join("0");let w=v.substring(0,b)+m;const x=u(v.substring(b),"0");if("ceil"===e&&x){const e="1"+m,t=(null!==(o=w.match(/^0+/))&&void 0!==o?o:[""])[0].length;w=new Array(t).join("0")+i(w,e)}const k=h+(w.length-v.length);return l=-1!==h?w.substring(0,k)+"."+w.substring(k):w,l=y(l),s&&"0"!==l&&(l="-"+l),l}function y(e){let t=e.replace(/^0+/,"");return t=t.replace(/^\.+/,"0."),t.includes(".")&&(t=t.replace(/0+$/,""),t=t.replace(/\.+$/,""),""===t&&(t="0")),""===t&&(t="0"),t}t.add=i,t.mul=s,t.sub=function(e,t,r=10){if(10!==r&&16!==r)throw new Error("Unsupported base");let{x:n,y:a,shift:i}=h(e,t);const s=b(n)?16:10,u=b(a)?16:10;n=p(n),a=p(a);const c=new o.default(n,s),f=new o.default(a,u);let d=c.sub(f).toString(r);return d=l(d,i),10===r?d:d.replace(/^(-)?/,"$10x")},t.div=function(e,t,r=0,n=10){if(10!==n&&r>0)throw new Error("Cannot operate on floating point hex values");if(10!==n&&16!==n)throw new Error("Unsupported base");let{x:a,y:i}=h(e,t,r);const s=b(a)?16:10,u=b(i)?16:10;a=p(a),i=p(i);const c=new o.default(a,s),f=new o.default(i,u);let d=c.div(f).toString(n);return d=l(d,r),10===n?d:d.replace(/^(-)?/,"$10x")},t.lt=function(e,t){let{x:r,y:n}=h(e,t);const a=b(r)?16:10,i=b(n)?16:10;r=p(r),n=p(n);const s=new o.default(r,a),u=new o.default(n,i);return s.lt(u)},t.lte=function(e,t){let{x:r,y:n}=h(e,t);const a=b(r)?16:10,i=b(n)?16:10;r=p(r),n=p(n);const s=new o.default(r,a),u=new o.default(n,i);return s.lte(u)},t.gt=u,t.gte=c,t.eq=function(e,t){let{x:r,y:n}=h(e,t);const a=b(r)?16:10,i=b(n)?16:10;r=p(r),n=p(n);const s=new o.default(r,a),u=new o.default(n,i);return s.eq(u)},t.min=function(e,t,r=10){let{x:n,y:a,shift:i}=h(e,t);const s=b(n)?16:10,u=b(a)?16:10;n=p(n),a=p(a);const c=new o.default(n,s),f=new o.default(a,u);let d;return d=c.lte(f)?c.toString(r):f.toString(r),d=l(d,i),10===r?d:d.replace(/^(-)?/,"$10x")},t.abs=function(e,t=10){if(10!==t&&16!==t)throw new Error("Unsupported base");let{x:r,shift:n}=h(e,"0");const a=b(e)?16:10;r=p(r);let i=new o.default(r,a).abs().toString(t);return i=l(i,n),10===t?i:i.replace(/^(-)?/,"$10x")},t.max=function(e,t,r=10){let{x:n,y:a,shift:i}=h(e,t);const s=b(n)?16:10,u=b(a)?16:10;n=p(n),a=p(a);const c=new o.default(n,s),f=new o.default(a,u);let d;return d=c.gte(f)?c.toString(r):f.toString(r),d=l(d,i),10===r?d:d.replace(/^(-)?/,"$10x")},t.floor=(e,t)=>v("floor",e,t),t.ceil=(e,t)=>v("ceil",e,t),t.round=(e,t)=>v("round",e,t),t.toBns=f,t.toFixed=function(e,t=2,r=8){let n=f(e),o=!1,a="";n.includes("-")&&(o=!0,n=n.replace(/^-+/,"")),n=y(n);const i=n.indexOf(".");if(-1===i)a=n+"."+d("",t);else{const e=n.length-i-1;a=e>r?n.substr(0,n.length-(e-r)):e<t?n+d("",t-e):n}return a=a.replace(/\.+$/,""),o&&"0"!==a&&(a="-"+a),a},t.log10=function(e){if(null===e.match(/^[0-1]+$/g))throw new Error("InvalidLogInputValue: Must be a power of 10");if(!e.startsWith("1"))throw new Error("InvalidLogInputValue: Must not have leading zeros");if((e.match(/1/g)||[]).length>1)throw new Error("InvalidLogInputValue: Must be power of 10.");return(e.match(/0/g)||[]).length}},3550:function(e,t,r){!function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function o(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function a(e,t,r){if(a.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var i;"object"==typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(6601).Buffer}catch(E){}function s(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(e,t,r){var n=s(e,r);return r-1>=t&&(n|=s(e,r-1)<<4),n}function c(e,t,r,n){for(var o=0,a=Math.min(e.length,r),i=t;i<a;i++){var s=e.charCodeAt(i)-48;o*=n,o+=s>=49?s-49+10:s>=17?s-17+10:s}return o}a.isBN=function(e){return e instanceof a||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return e.cmp(t)>0?e:t},a.min=function(e,t){return e.cmp(t)<0?e:t},a.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var o=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(o++,this.negative=1),o<e.length&&(16===t?this._parseHex(e,o,r):(this._parseBase(e,t,o),"le"===r&&this._initArray(this.toArray(),t,r)))},a.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},a.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var a,i,s=0;if("be"===r)for(o=e.length-1,a=0;o>=0;o-=3)i=e[o]|e[o-1]<<8|e[o-2]<<16,this.words[a]|=i<<s&67108863,this.words[a+1]=i>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(o=0,a=0;o<e.length;o+=3)i=e[o]|e[o+1]<<8|e[o+2]<<16,this.words[a]|=i<<s&67108863,this.words[a+1]=i>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,a=0,i=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)o=u(e,t,n)<<a,this.words[i]|=67108863&o,a>=18?(a-=18,i+=1,this.words[i]|=o>>>26):a+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)o=u(e,t,n)<<a,this.words[i]|=67108863&o,a>=18?(a-=18,i+=1,this.words[i]|=o>>>26):a+=8;this.strip()},a.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,o=1;o<=67108863;o*=t)n++;n--,o=o/t|0;for(var a=e.length-r,i=a%n,s=Math.min(a,a-i)+r,u=0,f=r;f<s;f+=n)u=c(e,f,f+n,t),this.imuln(o),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==i){var l=1;for(u=c(e,f,e.length,t),f=0;f<i;f++)l*=t;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},a.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function p(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var o=0|e.words[0],a=0|t.words[0],i=o*a,s=67108863&i,u=i/67108864|0;r.words[0]=s;for(var c=1;c<n;c++){for(var f=u>>>26,l=67108863&u,d=Math.min(c,t.length-1),p=Math.max(0,c-e.length+1);p<=d;p++){var h=c-p|0;f+=(i=(o=0|e.words[h])*(a=0|t.words[p])+l)/67108864|0,l=67108863&i}r.words[c]=0|l,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}a.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var o=0,a=0,i=0;i<this.length;i++){var s=this.words[i],u=(16777215&(s<<o|a)).toString(16);r=0!==(a=s>>>24-o&16777215)||i!==this.length-1?f[6-u.length]+u+r:u+r,(o+=2)>=26&&(o-=26,i--)}for(0!==a&&(r=a.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=l[e],p=d[e];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var b=h.modn(p).toString(e);r=(h=h.idivn(p)).isZero()?b+r:f[c-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(e,t){return n(void 0!==i),this.toArrayLike(i,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,r){var o=this.byteLength(),a=r||Math.max(1,o);n(o<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0"),this.strip();var i,s,u="le"===t,c=new e(a),f=this.clone();if(u){for(s=0;!f.isZero();s++)i=f.andln(255),f.iushrn(8),c[s]=i;for(;s<a;s++)c[s]=0}else{for(s=0;s<a-o;s++)c[s]=0;for(s=0;!f.isZero();s++)i=f.andln(255),f.iushrn(8),c[a-s-1]=i}return c},Math.clz32?a.prototype._countBits=function(e){return 32-Math.clz32(e)}:a.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},a.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},a.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},a.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var o=0;o<t;o++)this.words[o]=67108863&~this.words[o];return r>0&&(this.words[o]=~this.words[o]&67108863>>26-r),this.strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,o=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<o:this.words[r]&~(1<<o),this.strip()},a.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a<n.length;a++)t=(0|r.words[a])+(0|n.words[a])+o,this.words[a]=67108863&t,o=t>>>26;for(;0!==o&&a<r.length;a++)t=(0|r.words[a])+o,this.words[a]=67108863&t,o=t>>>26;if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,o=this.cmp(e);if(0===o)return this.negative=0,this.length=1,this.words[0]=0,this;o>0?(r=this,n=e):(r=e,n=this);for(var a=0,i=0;i<n.length;i++)a=(t=(0|r.words[i])-(0|n.words[i])+a)>>26,this.words[i]=67108863&t;for(;0!==a&&i<r.length;i++)a=(t=(0|r.words[i])+a)>>26,this.words[i]=67108863&t;if(0===a&&i<r.length&&r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this.length=Math.max(this.length,i),r!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var n,o,a,i=e.words,s=t.words,u=r.words,c=0,f=0|i[0],l=8191&f,d=f>>>13,p=0|i[1],h=8191&p,b=p>>>13,v=0|i[2],y=8191&v,g=v>>>13,m=0|i[3],w=8191&m,x=m>>>13,k=0|i[4],I=8191&k,O=k>>>13,E=0|i[5],S=8191&E,A=E>>>13,_=0|i[6],T=8191&_,P=_>>>13,M=0|i[7],j=8191&M,C=M>>>13,N=0|i[8],D=8191&N,R=N>>>13,B=0|i[9],L=8191&B,K=B>>>13,U=0|s[0],F=8191&U,W=U>>>13,q=0|s[1],z=8191&q,G=q>>>13,H=0|s[2],Y=8191&H,J=H>>>13,V=0|s[3],X=8191&V,$=V>>>13,Z=0|s[4],Q=8191&Z,ee=Z>>>13,te=0|s[5],re=8191&te,ne=te>>>13,oe=0|s[6],ae=8191&oe,ie=oe>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,fe=0|s[8],le=8191&fe,de=fe>>>13,pe=0|s[9],he=8191&pe,be=pe>>>13;r.negative=e.negative^t.negative,r.length=19;var ve=(c+(n=Math.imul(l,F))|0)+((8191&(o=(o=Math.imul(l,W))+Math.imul(d,F)|0))<<13)|0;c=((a=Math.imul(d,W))+(o>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(h,F),o=(o=Math.imul(h,W))+Math.imul(b,F)|0,a=Math.imul(b,W);var ye=(c+(n=n+Math.imul(l,z)|0)|0)+((8191&(o=(o=o+Math.imul(l,G)|0)+Math.imul(d,z)|0))<<13)|0;c=((a=a+Math.imul(d,G)|0)+(o>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,F),o=(o=Math.imul(y,W))+Math.imul(g,F)|0,a=Math.imul(g,W),n=n+Math.imul(h,z)|0,o=(o=o+Math.imul(h,G)|0)+Math.imul(b,z)|0,a=a+Math.imul(b,G)|0;var ge=(c+(n=n+Math.imul(l,Y)|0)|0)+((8191&(o=(o=o+Math.imul(l,J)|0)+Math.imul(d,Y)|0))<<13)|0;c=((a=a+Math.imul(d,J)|0)+(o>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(w,F),o=(o=Math.imul(w,W))+Math.imul(x,F)|0,a=Math.imul(x,W),n=n+Math.imul(y,z)|0,o=(o=o+Math.imul(y,G)|0)+Math.imul(g,z)|0,a=a+Math.imul(g,G)|0,n=n+Math.imul(h,Y)|0,o=(o=o+Math.imul(h,J)|0)+Math.imul(b,Y)|0,a=a+Math.imul(b,J)|0;var me=(c+(n=n+Math.imul(l,X)|0)|0)+((8191&(o=(o=o+Math.imul(l,$)|0)+Math.imul(d,X)|0))<<13)|0;c=((a=a+Math.imul(d,$)|0)+(o>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(I,F),o=(o=Math.imul(I,W))+Math.imul(O,F)|0,a=Math.imul(O,W),n=n+Math.imul(w,z)|0,o=(o=o+Math.imul(w,G)|0)+Math.imul(x,z)|0,a=a+Math.imul(x,G)|0,n=n+Math.imul(y,Y)|0,o=(o=o+Math.imul(y,J)|0)+Math.imul(g,Y)|0,a=a+Math.imul(g,J)|0,n=n+Math.imul(h,X)|0,o=(o=o+Math.imul(h,$)|0)+Math.imul(b,X)|0,a=a+Math.imul(b,$)|0;var we=(c+(n=n+Math.imul(l,Q)|0)|0)+((8191&(o=(o=o+Math.imul(l,ee)|0)+Math.imul(d,Q)|0))<<13)|0;c=((a=a+Math.imul(d,ee)|0)+(o>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(S,F),o=(o=Math.imul(S,W))+Math.imul(A,F)|0,a=Math.imul(A,W),n=n+Math.imul(I,z)|0,o=(o=o+Math.imul(I,G)|0)+Math.imul(O,z)|0,a=a+Math.imul(O,G)|0,n=n+Math.imul(w,Y)|0,o=(o=o+Math.imul(w,J)|0)+Math.imul(x,Y)|0,a=a+Math.imul(x,J)|0,n=n+Math.imul(y,X)|0,o=(o=o+Math.imul(y,$)|0)+Math.imul(g,X)|0,a=a+Math.imul(g,$)|0,n=n+Math.imul(h,Q)|0,o=(o=o+Math.imul(h,ee)|0)+Math.imul(b,Q)|0,a=a+Math.imul(b,ee)|0;var xe=(c+(n=n+Math.imul(l,re)|0)|0)+((8191&(o=(o=o+Math.imul(l,ne)|0)+Math.imul(d,re)|0))<<13)|0;c=((a=a+Math.imul(d,ne)|0)+(o>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(T,F),o=(o=Math.imul(T,W))+Math.imul(P,F)|0,a=Math.imul(P,W),n=n+Math.imul(S,z)|0,o=(o=o+Math.imul(S,G)|0)+Math.imul(A,z)|0,a=a+Math.imul(A,G)|0,n=n+Math.imul(I,Y)|0,o=(o=o+Math.imul(I,J)|0)+Math.imul(O,Y)|0,a=a+Math.imul(O,J)|0,n=n+Math.imul(w,X)|0,o=(o=o+Math.imul(w,$)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,$)|0,n=n+Math.imul(y,Q)|0,o=(o=o+Math.imul(y,ee)|0)+Math.imul(g,Q)|0,a=a+Math.imul(g,ee)|0,n=n+Math.imul(h,re)|0,o=(o=o+Math.imul(h,ne)|0)+Math.imul(b,re)|0,a=a+Math.imul(b,ne)|0;var ke=(c+(n=n+Math.imul(l,ae)|0)|0)+((8191&(o=(o=o+Math.imul(l,ie)|0)+Math.imul(d,ae)|0))<<13)|0;c=((a=a+Math.imul(d,ie)|0)+(o>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(j,F),o=(o=Math.imul(j,W))+Math.imul(C,F)|0,a=Math.imul(C,W),n=n+Math.imul(T,z)|0,o=(o=o+Math.imul(T,G)|0)+Math.imul(P,z)|0,a=a+Math.imul(P,G)|0,n=n+Math.imul(S,Y)|0,o=(o=o+Math.imul(S,J)|0)+Math.imul(A,Y)|0,a=a+Math.imul(A,J)|0,n=n+Math.imul(I,X)|0,o=(o=o+Math.imul(I,$)|0)+Math.imul(O,X)|0,a=a+Math.imul(O,$)|0,n=n+Math.imul(w,Q)|0,o=(o=o+Math.imul(w,ee)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,ee)|0,n=n+Math.imul(y,re)|0,o=(o=o+Math.imul(y,ne)|0)+Math.imul(g,re)|0,a=a+Math.imul(g,ne)|0,n=n+Math.imul(h,ae)|0,o=(o=o+Math.imul(h,ie)|0)+Math.imul(b,ae)|0,a=a+Math.imul(b,ie)|0;var Ie=(c+(n=n+Math.imul(l,ue)|0)|0)+((8191&(o=(o=o+Math.imul(l,ce)|0)+Math.imul(d,ue)|0))<<13)|0;c=((a=a+Math.imul(d,ce)|0)+(o>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(D,F),o=(o=Math.imul(D,W))+Math.imul(R,F)|0,a=Math.imul(R,W),n=n+Math.imul(j,z)|0,o=(o=o+Math.imul(j,G)|0)+Math.imul(C,z)|0,a=a+Math.imul(C,G)|0,n=n+Math.imul(T,Y)|0,o=(o=o+Math.imul(T,J)|0)+Math.imul(P,Y)|0,a=a+Math.imul(P,J)|0,n=n+Math.imul(S,X)|0,o=(o=o+Math.imul(S,$)|0)+Math.imul(A,X)|0,a=a+Math.imul(A,$)|0,n=n+Math.imul(I,Q)|0,o=(o=o+Math.imul(I,ee)|0)+Math.imul(O,Q)|0,a=a+Math.imul(O,ee)|0,n=n+Math.imul(w,re)|0,o=(o=o+Math.imul(w,ne)|0)+Math.imul(x,re)|0,a=a+Math.imul(x,ne)|0,n=n+Math.imul(y,ae)|0,o=(o=o+Math.imul(y,ie)|0)+Math.imul(g,ae)|0,a=a+Math.imul(g,ie)|0,n=n+Math.imul(h,ue)|0,o=(o=o+Math.imul(h,ce)|0)+Math.imul(b,ue)|0,a=a+Math.imul(b,ce)|0;var Oe=(c+(n=n+Math.imul(l,le)|0)|0)+((8191&(o=(o=o+Math.imul(l,de)|0)+Math.imul(d,le)|0))<<13)|0;c=((a=a+Math.imul(d,de)|0)+(o>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(L,F),o=(o=Math.imul(L,W))+Math.imul(K,F)|0,a=Math.imul(K,W),n=n+Math.imul(D,z)|0,o=(o=o+Math.imul(D,G)|0)+Math.imul(R,z)|0,a=a+Math.imul(R,G)|0,n=n+Math.imul(j,Y)|0,o=(o=o+Math.imul(j,J)|0)+Math.imul(C,Y)|0,a=a+Math.imul(C,J)|0,n=n+Math.imul(T,X)|0,o=(o=o+Math.imul(T,$)|0)+Math.imul(P,X)|0,a=a+Math.imul(P,$)|0,n=n+Math.imul(S,Q)|0,o=(o=o+Math.imul(S,ee)|0)+Math.imul(A,Q)|0,a=a+Math.imul(A,ee)|0,n=n+Math.imul(I,re)|0,o=(o=o+Math.imul(I,ne)|0)+Math.imul(O,re)|0,a=a+Math.imul(O,ne)|0,n=n+Math.imul(w,ae)|0,o=(o=o+Math.imul(w,ie)|0)+Math.imul(x,ae)|0,a=a+Math.imul(x,ie)|0,n=n+Math.imul(y,ue)|0,o=(o=o+Math.imul(y,ce)|0)+Math.imul(g,ue)|0,a=a+Math.imul(g,ce)|0,n=n+Math.imul(h,le)|0,o=(o=o+Math.imul(h,de)|0)+Math.imul(b,le)|0,a=a+Math.imul(b,de)|0;var Ee=(c+(n=n+Math.imul(l,he)|0)|0)+((8191&(o=(o=o+Math.imul(l,be)|0)+Math.imul(d,he)|0))<<13)|0;c=((a=a+Math.imul(d,be)|0)+(o>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(L,z),o=(o=Math.imul(L,G))+Math.imul(K,z)|0,a=Math.imul(K,G),n=n+Math.imul(D,Y)|0,o=(o=o+Math.imul(D,J)|0)+Math.imul(R,Y)|0,a=a+Math.imul(R,J)|0,n=n+Math.imul(j,X)|0,o=(o=o+Math.imul(j,$)|0)+Math.imul(C,X)|0,a=a+Math.imul(C,$)|0,n=n+Math.imul(T,Q)|0,o=(o=o+Math.imul(T,ee)|0)+Math.imul(P,Q)|0,a=a+Math.imul(P,ee)|0,n=n+Math.imul(S,re)|0,o=(o=o+Math.imul(S,ne)|0)+Math.imul(A,re)|0,a=a+Math.imul(A,ne)|0,n=n+Math.imul(I,ae)|0,o=(o=o+Math.imul(I,ie)|0)+Math.imul(O,ae)|0,a=a+Math.imul(O,ie)|0,n=n+Math.imul(w,ue)|0,o=(o=o+Math.imul(w,ce)|0)+Math.imul(x,ue)|0,a=a+Math.imul(x,ce)|0,n=n+Math.imul(y,le)|0,o=(o=o+Math.imul(y,de)|0)+Math.imul(g,le)|0,a=a+Math.imul(g,de)|0;var Se=(c+(n=n+Math.imul(h,he)|0)|0)+((8191&(o=(o=o+Math.imul(h,be)|0)+Math.imul(b,he)|0))<<13)|0;c=((a=a+Math.imul(b,be)|0)+(o>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(L,Y),o=(o=Math.imul(L,J))+Math.imul(K,Y)|0,a=Math.imul(K,J),n=n+Math.imul(D,X)|0,o=(o=o+Math.imul(D,$)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,$)|0,n=n+Math.imul(j,Q)|0,o=(o=o+Math.imul(j,ee)|0)+Math.imul(C,Q)|0,a=a+Math.imul(C,ee)|0,n=n+Math.imul(T,re)|0,o=(o=o+Math.imul(T,ne)|0)+Math.imul(P,re)|0,a=a+Math.imul(P,ne)|0,n=n+Math.imul(S,ae)|0,o=(o=o+Math.imul(S,ie)|0)+Math.imul(A,ae)|0,a=a+Math.imul(A,ie)|0,n=n+Math.imul(I,ue)|0,o=(o=o+Math.imul(I,ce)|0)+Math.imul(O,ue)|0,a=a+Math.imul(O,ce)|0,n=n+Math.imul(w,le)|0,o=(o=o+Math.imul(w,de)|0)+Math.imul(x,le)|0,a=a+Math.imul(x,de)|0;var Ae=(c+(n=n+Math.imul(y,he)|0)|0)+((8191&(o=(o=o+Math.imul(y,be)|0)+Math.imul(g,he)|0))<<13)|0;c=((a=a+Math.imul(g,be)|0)+(o>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(L,X),o=(o=Math.imul(L,$))+Math.imul(K,X)|0,a=Math.imul(K,$),n=n+Math.imul(D,Q)|0,o=(o=o+Math.imul(D,ee)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,ee)|0,n=n+Math.imul(j,re)|0,o=(o=o+Math.imul(j,ne)|0)+Math.imul(C,re)|0,a=a+Math.imul(C,ne)|0,n=n+Math.imul(T,ae)|0,o=(o=o+Math.imul(T,ie)|0)+Math.imul(P,ae)|0,a=a+Math.imul(P,ie)|0,n=n+Math.imul(S,ue)|0,o=(o=o+Math.imul(S,ce)|0)+Math.imul(A,ue)|0,a=a+Math.imul(A,ce)|0,n=n+Math.imul(I,le)|0,o=(o=o+Math.imul(I,de)|0)+Math.imul(O,le)|0,a=a+Math.imul(O,de)|0;var _e=(c+(n=n+Math.imul(w,he)|0)|0)+((8191&(o=(o=o+Math.imul(w,be)|0)+Math.imul(x,he)|0))<<13)|0;c=((a=a+Math.imul(x,be)|0)+(o>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(L,Q),o=(o=Math.imul(L,ee))+Math.imul(K,Q)|0,a=Math.imul(K,ee),n=n+Math.imul(D,re)|0,o=(o=o+Math.imul(D,ne)|0)+Math.imul(R,re)|0,a=a+Math.imul(R,ne)|0,n=n+Math.imul(j,ae)|0,o=(o=o+Math.imul(j,ie)|0)+Math.imul(C,ae)|0,a=a+Math.imul(C,ie)|0,n=n+Math.imul(T,ue)|0,o=(o=o+Math.imul(T,ce)|0)+Math.imul(P,ue)|0,a=a+Math.imul(P,ce)|0,n=n+Math.imul(S,le)|0,o=(o=o+Math.imul(S,de)|0)+Math.imul(A,le)|0,a=a+Math.imul(A,de)|0;var Te=(c+(n=n+Math.imul(I,he)|0)|0)+((8191&(o=(o=o+Math.imul(I,be)|0)+Math.imul(O,he)|0))<<13)|0;c=((a=a+Math.imul(O,be)|0)+(o>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(L,re),o=(o=Math.imul(L,ne))+Math.imul(K,re)|0,a=Math.imul(K,ne),n=n+Math.imul(D,ae)|0,o=(o=o+Math.imul(D,ie)|0)+Math.imul(R,ae)|0,a=a+Math.imul(R,ie)|0,n=n+Math.imul(j,ue)|0,o=(o=o+Math.imul(j,ce)|0)+Math.imul(C,ue)|0,a=a+Math.imul(C,ce)|0,n=n+Math.imul(T,le)|0,o=(o=o+Math.imul(T,de)|0)+Math.imul(P,le)|0,a=a+Math.imul(P,de)|0;var Pe=(c+(n=n+Math.imul(S,he)|0)|0)+((8191&(o=(o=o+Math.imul(S,be)|0)+Math.imul(A,he)|0))<<13)|0;c=((a=a+Math.imul(A,be)|0)+(o>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(L,ae),o=(o=Math.imul(L,ie))+Math.imul(K,ae)|0,a=Math.imul(K,ie),n=n+Math.imul(D,ue)|0,o=(o=o+Math.imul(D,ce)|0)+Math.imul(R,ue)|0,a=a+Math.imul(R,ce)|0,n=n+Math.imul(j,le)|0,o=(o=o+Math.imul(j,de)|0)+Math.imul(C,le)|0,a=a+Math.imul(C,de)|0;var Me=(c+(n=n+Math.imul(T,he)|0)|0)+((8191&(o=(o=o+Math.imul(T,be)|0)+Math.imul(P,he)|0))<<13)|0;c=((a=a+Math.imul(P,be)|0)+(o>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(L,ue),o=(o=Math.imul(L,ce))+Math.imul(K,ue)|0,a=Math.imul(K,ce),n=n+Math.imul(D,le)|0,o=(o=o+Math.imul(D,de)|0)+Math.imul(R,le)|0,a=a+Math.imul(R,de)|0;var je=(c+(n=n+Math.imul(j,he)|0)|0)+((8191&(o=(o=o+Math.imul(j,be)|0)+Math.imul(C,he)|0))<<13)|0;c=((a=a+Math.imul(C,be)|0)+(o>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(L,le),o=(o=Math.imul(L,de))+Math.imul(K,le)|0,a=Math.imul(K,de);var Ce=(c+(n=n+Math.imul(D,he)|0)|0)+((8191&(o=(o=o+Math.imul(D,be)|0)+Math.imul(R,he)|0))<<13)|0;c=((a=a+Math.imul(R,be)|0)+(o>>>13)|0)+(Ce>>>26)|0,Ce&=67108863;var Ne=(c+(n=Math.imul(L,he))|0)+((8191&(o=(o=Math.imul(L,be))+Math.imul(K,he)|0))<<13)|0;return c=((a=Math.imul(K,be))+(o>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=ve,u[1]=ye,u[2]=ge,u[3]=me,u[4]=we,u[5]=xe,u[6]=ke,u[7]=Ie,u[8]=Oe,u[9]=Ee,u[10]=Se,u[11]=Ae,u[12]=_e,u[13]=Te,u[14]=Pe,u[15]=Me,u[16]=je,u[17]=Ce,u[18]=Ne,0!==c&&(u[19]=c,r.length++),r};function b(e,t,r){return(new v).mulp(e,t,r)}function v(e,t){this.x=e,this.y=t}Math.imul||(h=p),a.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):n<63?p(this,e,t):n<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,o=0,a=0;a<r.length-1;a++){var i=o;o=0;for(var s=67108863&n,u=Math.min(a,t.length-1),c=Math.max(0,a-e.length+1);c<=u;c++){var f=a-c,l=(0|e.words[f])*(0|t.words[c]),d=67108863&l;s=67108863&(d=d+s|0),o+=(i=(i=i+(l/67108864|0)|0)+(d>>>26)|0)>>>26,i&=67108863}r.words[a]=s,n=i,i=o}return 0!==n?r.words[a]=n:r.length--,r.strip()}(this,e,t):b(this,e,t),r},v.prototype.makeRBT=function(e){for(var t=new Array(e),r=a.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},v.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,o=0;o<t;o++)n|=(1&e)<<t-o-1,e>>=1;return n},v.prototype.permute=function(e,t,r,n,o,a){for(var i=0;i<a;i++)n[i]=t[e[i]],o[i]=r[e[i]]},v.prototype.transform=function(e,t,r,n,o,a){this.permute(a,e,t,r,n,o);for(var i=1;i<o;i<<=1)for(var s=i<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),f=0;f<o;f+=s)for(var l=u,d=c,p=0;p<i;p++){var h=r[f+p],b=n[f+p],v=r[f+p+i],y=n[f+p+i],g=l*v-d*y;y=l*y+d*v,v=g,r[f+p]=h+v,n[f+p]=b+y,r[f+p+i]=h-v,n[f+p+i]=b-y,p!==s&&(g=u*l-c*d,d=u*d+c*l,l=g)}},v.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,o=0;for(r=r/2|0;r;r>>>=1)o++;return 1<<o+1+n},v.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var o=e[n];e[n]=e[r-n-1],e[r-n-1]=o,o=t[n],t[n]=-t[r-n-1],t[r-n-1]=-o}},v.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var o=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&o,r=o<67108864?0:o/67108864|0}return e},v.prototype.convert13b=function(e,t,r,o){for(var a=0,i=0;i<t;i++)a+=0|e[i],r[2*i]=8191&a,a>>>=13,r[2*i+1]=8191&a,a>>>=13;for(i=2*t;i<o;++i)r[i]=0;n(0===a),n(0==(-8192&a))},v.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},v.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),o=this.makeRBT(n),a=this.stub(n),i=new Array(n),s=new Array(n),u=new Array(n),c=new Array(n),f=new Array(n),l=new Array(n),d=r.words;d.length=n,this.convert13b(e.words,e.length,i,n),this.convert13b(t.words,t.length,c,n),this.transform(i,a,s,u,n,o),this.transform(c,a,f,l,n,o);for(var p=0;p<n;p++){var h=s[p]*f[p]-u[p]*l[p];u[p]=s[p]*l[p]+u[p]*f[p],s[p]=h}return this.conjugate(s,u,n),this.transform(s,u,d,a,n,o),this.conjugate(d,a,n),this.normalize13b(d,n),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},a.prototype.mul=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},a.prototype.mulf=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),b(this,e,t)},a.prototype.imul=function(e){return this.clone().mulTo(e,this)},a.prototype.imuln=function(e){n("number"==typeof e),n(e<67108864);for(var t=0,r=0;r<this.length;r++){var o=(0|this.words[r])*e,a=(67108863&o)+(67108863&t);t>>=26,t+=o/67108864|0,t+=a>>>26,this.words[r]=67108863&a}return 0!==t&&(this.words[r]=t,this.length++),this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,o=r%26;t[r]=(e.words[n]&1<<o)>>>o}return t}(e);if(0===t.length)return new a(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var o=r.sqr();n<t.length;n++,o=o.sqr())0!==t[n]&&(r=r.mul(o));return r},a.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,o=(e-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var i=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,u=(0|this.words[t])-s<<r;this.words[t]=u|i,i=s>>>26-r}i&&(this.words[t]=i,this.length++)}if(0!==o){for(t=this.length-1;t>=0;t--)this.words[t+o]=this.words[t];for(t=0;t<o;t++)this.words[t]=0;this.length+=o}return this.strip()},a.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,r){var o;n("number"==typeof e&&e>=0),o=t?(t-t%26)/26:0;var a=e%26,i=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,u=r;if(o-=i,o=Math.max(0,o),u){for(var c=0;c<i;c++)u.words[c]=this.words[c];u.length=i}if(0===i);else if(this.length>i)for(this.length-=i,c=0;c<this.length;c++)this.words[c]=this.words[c+i];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=o);c--){var l=0|this.words[c];this.words[c]=f<<26-a|l>>>a,f=l&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,o=1<<t;return!(this.length<=r)&&!!(this.words[r]&o)},a.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var o=67108863^67108863>>>t<<t;this.words[this.length-1]&=o}return this.strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},a.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},a.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},a.prototype.addn=function(e){return this.clone().iaddn(e)},a.prototype.subn=function(e){return this.clone().isubn(e)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(e,t,r){var o,a,i=e.length+r;this._expand(i);var s=0;for(o=0;o<e.length;o++){a=(0|this.words[o+r])+s;var u=(0|e.words[o])*t;s=((a-=67108863&u)>>26)-(u/67108864|0),this.words[o+r]=67108863&a}for(;o<this.length-r;o++)s=(a=(0|this.words[o+r])+s)>>26,this.words[o+r]=67108863&a;if(0===s)return this.strip();for(n(-1===s),s=0,o=0;o<this.length;o++)s=(a=-(0|this.words[o])+s)>>26,this.words[o]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),o=e,i=0|o.words[o.length-1];0!==(r=26-this._countBits(i))&&(o=o.ushln(r),n.iushln(r),i=0|o.words[o.length-1]);var s,u=n.length-o.length;if("mod"!==t){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var f=n.clone()._ishlnsubmul(o,1,u);0===f.negative&&(n=f,s&&(s.words[u]=1));for(var l=u-1;l>=0;l--){var d=67108864*(0|n.words[o.length+l])+(0|n.words[o.length+l-1]);for(d=Math.min(d/i|0,67108863),n._ishlnsubmul(o,d,l);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(o,1,l),n.isZero()||(n.negative^=1);s&&(s.words[l]=d)}return s&&s.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(i=s.mod.neg(),r&&0!==i.negative&&i.iadd(e)),{div:o,mod:i}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(i=s.mod.neg(),r&&0!==i.negative&&i.isub(e)),{div:s.div,mod:i}):e.length>this.length||this.cmp(e)<0?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modn(e.words[0]))}:this._wordDiv(e,t);var o,i,s},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),o=e.andln(1),a=r.cmp(n);return a<0||1===o&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},a.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,o=this.length-1;o>=0;o--)r=(t*r+(0|this.words[o]))%e;return r},a.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var o=(0|this.words[r])+67108864*t;this.words[r]=o/e|0,t=o%e}return this.strip()},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new a(1),i=new a(0),s=new a(0),u=new a(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var f=r.clone(),l=t.clone();!t.isZero();){for(var d=0,p=1;0==(t.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||i.isOdd())&&(o.iadd(f),i.isub(l)),o.iushrn(1),i.iushrn(1);for(var h=0,b=1;0==(r.words[0]&b)&&h<26;++h,b<<=1);if(h>0)for(r.iushrn(h);h-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(l)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),i.isub(u)):(r.isub(t),s.isub(o),u.isub(i))}return{a:s,b:u,gcd:r.iushln(c)}},a.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,i=new a(1),s=new a(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,f=1;0==(t.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(t.iushrn(c);c-- >0;)i.isOdd()&&i.iadd(u),i.iushrn(1);for(var l=0,d=1;0==(r.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(s)):(r.isub(t),s.isub(i))}return(o=0===t.cmpn(1)?i:s).cmpn(0)<0&&o.iadd(e),o},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var o=t.cmp(r);if(o<0){var a=t;t=r,r=a}else if(0===o||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,o=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=o,this;for(var a=o,i=r;0!==a&&i<this.length;i++){var s=0|this.words[i];a=(s+=a)>>>26,s&=67108863,this.words[i]=s}return 0!==a&&(this.words[i]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var o=0|this.words[0];t=o===e?0:o<e?-1:1}return 0!==this.negative?0|-t:t},a.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},a.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],o=0|e.words[r];if(n!==o){n<o?t=-1:n>o&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return this.cmpn(e)>=0},a.prototype.gte=function(e){return this.cmp(e)>=0},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return this.cmpn(e)<=0},a.prototype.lte=function(e){return this.cmp(e)<=0},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new I(e)},a.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function m(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function O(e){I.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var e=new a(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},o(m,g),m.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),o=0;o<n;o++)t.words[o]=e.words[o];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&r,o=10;o<e.length;o++){var i=0|e.words[o];e.words[o-10]=(i&r)<<4|a>>>22,a=i}a>>>=22,e.words[o-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},m.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},o(w,g),o(x,g),o(k,g),k.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,o=67108863&n;n>>>=26,e.words[r]=o,t=n}return 0!==t&&(e.words[e.length++]=t),e},a._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new m;else if("p224"===e)t=new w;else if("p192"===e)t=new x;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new k}return y[e]=t,t},I.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},I.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},I.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},I.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},I.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},I.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},I.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},I.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},I.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},I.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},I.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},I.prototype.isqr=function(e){return this.imul(e,e.clone())},I.prototype.sqr=function(e){return this.mul(e,e)},I.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new a(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),i=0;!o.isZero()&&0===o.andln(1);)i++,o.iushrn(1);n(!o.isZero());var s=new a(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,o),d=this.pow(e,o.addn(1).iushrn(1)),p=this.pow(e,o),h=i;0!==p.cmp(s);){for(var b=p,v=0;0!==b.cmp(s);v++)b=b.redSqr();n(v<h);var y=this.pow(l,new a(1).iushln(h-v-1));d=d.redMul(y),l=y.redSqr(),p=p.redMul(l),h=v}return d},I.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},I.prototype.pow=function(e,t){if(t.isZero())return new a(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new a(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var o=r[0],i=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),n=t.length-1;n>=0;n--){for(var c=t.words[n],f=u-1;f>=0;f--){var l=c>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==l||0!==i?(i<<=1,i|=l,(4===++s||0===n&&0===f)&&(o=this.mul(o,r[i]),s=0,i=0)):s=0}u=26}return o},I.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},I.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new O(e)},o(O,I),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),i=o;return o.cmp(this.m)>=0?i=o.isub(this.m):o.cmpn(0)<0&&(i=o.iadd(this.m)),i._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},9931:function(e,t,r){var n;function o(e){this.rand=e}if(e.exports=function(e){return n||(n=new o(null)),n.generate(e)},e.exports.Rand=o,o.prototype.generate=function(e){return this._rand(e)},o.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?o.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?o.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(o.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var a=r(9214);if("function"!=typeof a.randomBytes)throw new Error("Not supported");o.prototype._rand=function(e){return a.randomBytes(e)}}catch(i){}},7445:function(e,t){"use strict";function r(e){switch(typeof e){case"function":case"object":return null==e?"null":Array.isArray(e)?"array":typeof e;case"string":return JSON.stringify(e);default:return String(e)}}function n(e,t){return function(r){return null!=r?e(r):"function"==typeof t?t():t}}function o(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=0;n<t.length;++n)if(e===t[n])return e;var o="Expected ";1!==t.length&&(o+="one of: ");for(var a=0;a<t.length;++a)a>0&&(o+=" | "),o+=JSON.stringify(t[a]);throw o+=", got "+r(e),new TypeError(o)}}function a(e){if("string"!=typeof e)throw new TypeError("Expected a string, got "+r(e));return e}Object.defineProperty(t,"__esModule",{value:!0});var i=o(null),s=o(void 0);var u=n(i);function c(e,t,r){return e instanceof Error&&(null==e.insertStepAt&&(e.message+=" at ",e.insertStepAt=e.message.length),e.message=e.message.slice(0,e.insertStepAt)+t+e.message.slice(e.insertStepAt),e.insertStepAt+=r),e}function f(e){if("function"==typeof e)return function(t){if("object"!=typeof t||null==t)throw new TypeError("Expected an object, got "+r(t));for(var n={},o=Object.keys(t),a=0;a<o.length;++a){var i=o[a];if("__proto__"!==i)try{n[i]=e(t[i])}catch(s){throw c(s,"["+JSON.stringify(i)+"]",0)}}return n};var t=Object.keys(e);function n(n){return function(o){if("object"!=typeof o||null==o)throw new TypeError("Expected an object, got "+r(o));var a,i={};if(n){var s=Object.keys(o);for(a=0;a<s.length;++a){var u=s[a];"__proto__"!==u&&(i[u]=o[u])}}for(a=0;a<t.length;++a){var f=t[a];try{i[f]=e[f](o[f])}catch(l){throw c(l,"."+f,0)}}return i}}var o=n(!1);return o.shape=e,o.withRest=n(!0),o}var l=f;function d(e,t){return function(r){return p[h]>0?t(r):e(r)}}var p="object"==typeof globalThis&&null!=globalThis?globalThis:JSON,h="function"==typeof Symbol?Symbol.for("uncleaning"):"uncleaning",b=d((function(e){if("string"!=typeof e&&!(e instanceof Date))throw new TypeError("Expected a date string, got "+r(e));var t=new Date(e);if(null==t.toJSON())throw new TypeError("Invalid date format, got "+r(e));return t}),(function(e){return e.toISOString()}));t.asArray=function(e){return function(t){if(!Array.isArray(t))throw new TypeError("Expected an array, got "+r(t));for(var n=[],o=0;o<t.length;++o)try{n[o]=e(t[o])}catch(a){throw c(a,"["+o+"]",0)}return n}},t.asBoolean=function(e){if("boolean"!=typeof e)throw new TypeError("Expected a boolean, got "+r(e));return e},t.asCodec=d,t.asDate=b,t.asEither=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){for(var r=0;r<t.length;r++)try{return t[r](e)}catch(n){if(r+1>=t.length)throw n}}},t.asJSON=function(e){return d((function(t){var r=JSON.parse(a(t));try{return e(r)}catch(n){throw c(n,"JSON.parse()",11)}}),(function(t){return JSON.stringify(e(t))}))},t.asMap=l,t.asMaybe=function(e,t){return function(r){try{return e(r)}catch(n){return"function"==typeof t?t():t}}},t.asNone=u,t.asNull=i,t.asNumber=function(e){if("number"!=typeof e)throw new TypeError("Expected a number, got "+r(e));return e},t.asObject=f,t.asOptional=n,t.asString=a,t.asTuple=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){if(!Array.isArray(e))throw new TypeError("Expected an array, got "+r(e));for(var n=[],o=0;o<t.length;++o)try{n[o]=t[o](e[o])}catch(a){throw c(a,"["+o+"]")}return n}},t.asUndefined=s,t.asUnknown=function(e){return e},t.asValue=o,t.uncleaner=function(e){return function(t){null==p[h]&&Object.defineProperty(p,h,{value:0,writable:!0});try{return++p[h],e(t)}finally{--p[h]}}}},4098:function(e,t){var r="undefined"!=typeof self?self:this,n=function(){function e(){this.fetch=!1,this.DOMException=r.DOMException}return e.prototype=r,new e}();!function(e){!function(t){var r="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,o="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),a="FormData"in e,i="ArrayBuffer"in e;if(i)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function f(e){return"string"!=typeof e&&(e=String(e)),e}function l(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function p(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function h(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function b(e){var t=new FileReader,r=h(t);return t.readAsArrayBuffer(e),r}function v(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:o&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:a&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():i&&o&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=v(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=v(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var e=p(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(b)}),this.text=function(){var e,t,r,n=p(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=h(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(e,t){e=c(e),t=f(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},d.prototype.delete=function(e){delete this.map[c(e)]},d.prototype.get=function(e){return e=c(e),this.has(e)?this.map[e]:null},d.prototype.has=function(e){return this.map.hasOwnProperty(c(e))},d.prototype.set=function(e,t){this.map[c(e)]=f(t)},d.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},d.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),l(e)},d.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),l(e)},d.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),l(e)},n&&(d.prototype[Symbol.iterator]=d.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function m(e,t){var r,n,o=(t=t||{}).body;if(e instanceof m){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new d(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new d(t.headers)),this.method=(r=t.method||this.method||"GET",n=r.toUpperCase(),g.indexOf(n)>-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(o))}})),t}function x(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new d(t.headers),this.url=t.url||"",this._initBody(e)}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},y.call(m.prototype),y.call(x.prototype),x.prototype.clone=function(){return new x(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},x.error=function(){var e=new x(null,{status:0,statusText:""});return e.type="error",e};var k=[301,302,303,307,308];x.redirect=function(e,t){if(-1===k.indexOf(t))throw new RangeError("Invalid status code");return new x(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(O){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function I(e,r){return new Promise((function(n,a){var i=new m(e,r);if(i.signal&&i.signal.aborted)return a(new t.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var e,t,r={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new d,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();t.append(n,o)}})),t)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var o="response"in s?s.response:s.responseText;n(new x(o,r))},s.onerror=function(){a(new TypeError("Network request failed"))},s.ontimeout=function(){a(new TypeError("Network request failed"))},s.onabort=function(){a(new t.DOMException("Aborted","AbortError"))},s.open(i.method,i.url,!0),"include"===i.credentials?s.withCredentials=!0:"omit"===i.credentials&&(s.withCredentials=!1),"responseType"in s&&o&&(s.responseType="blob"),i.headers.forEach((function(e,t){s.setRequestHeader(t,e)})),i.signal&&(i.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&i.signal.removeEventListener("abort",u)}),s.send(void 0===i._bodyInit?null:i._bodyInit)}))}I.polyfill=!0,e.fetch||(e.fetch=I,e.Headers=d,e.Request=m,e.Response=x),t.Headers=d,t.Request=m,t.Response=x,t.fetch=I,Object.defineProperty(t,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(t=o.fetch).default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t},4550:function(e){e.exports=[{code:"AED",number:"784",digits:2,currency:"UAE Dirham",countries:["United Arab Emirates (The)"]},{code:"AFN",number:"971",digits:2,currency:"Afghani",countries:["Afghanistan"]},{code:"ALL",number:"008",digits:2,currency:"Lek",countries:["Albania"]},{code:"AMD",number:"051",digits:2,currency:"Armenian Dram",countries:["Armenia"]},{code:"ANG",number:"532",digits:2,currency:"Netherlands Antillean Guilder",countries:["CuraçAo","Sint Maarten (Dutch Part)"]},{code:"AOA",number:"973",digits:2,currency:"Kwanza",countries:["Angola"]},{code:"ARS",number:"032",digits:2,currency:"Argentine Peso",countries:["Argentina"]},{code:"AUD",number:"036",digits:2,currency:"Australian Dollar",countries:["Australia","Christmas Island","Cocos (Keeling) Islands (The)","Heard Island And Mcdonald Islands","Kiribati","Nauru","Norfolk Island","Tuvalu"]},{code:"AWG",number:"533",digits:2,currency:"Aruban Florin",countries:["Aruba"]},{code:"AZN",number:"944",digits:2,currency:"Azerbaijan Manat",countries:["Azerbaijan"]},{code:"BAM",number:"977",digits:2,currency:"Convertible Mark",countries:["Bosnia And Herzegovina"]},{code:"BBD",number:"052",digits:2,currency:"Barbados Dollar",countries:["Barbados"]},{code:"BDT",number:"050",digits:2,currency:"Taka",countries:["Bangladesh"]},{code:"BGN",number:"975",digits:2,currency:"Bulgarian Lev",countries:["Bulgaria"]},{code:"BHD",number:"048",digits:3,currency:"Bahraini Dinar",countries:["Bahrain"]},{code:"BIF",number:"108",digits:0,currency:"Burundi Franc",countries:["Burundi"]},{code:"BMD",number:"060",digits:2,currency:"Bermudian Dollar",countries:["Bermuda"]},{code:"BND",number:"096",digits:2,currency:"Brunei Dollar",countries:["Brunei Darussalam"]},{code:"BOB",number:"068",digits:2,currency:"Boliviano",countries:["Bolivia (Plurinational State Of)"]},{code:"BOV",number:"984",digits:2,currency:"Mvdol",countries:["Bolivia (Plurinational State Of)"]},{code:"BRL",number:"986",digits:2,currency:"Brazilian Real",countries:["Brazil"]},{code:"BSD",number:"044",digits:2,currency:"Bahamian Dollar",countries:["Bahamas (The)"]},{code:"BTN",number:"064",digits:2,currency:"Ngultrum",countries:["Bhutan"]},{code:"BWP",number:"072",digits:2,currency:"Pula",countries:["Botswana"]},{code:"BYN",number:"933",digits:2,currency:"Belarusian Ruble",countries:["Belarus"]},{code:"BZD",number:"084",digits:2,currency:"Belize Dollar",countries:["Belize"]},{code:"CAD",number:"124",digits:2,currency:"Canadian Dollar",countries:["Canada"]},{code:"CDF",number:"976",digits:2,currency:"Congolese Franc",countries:["Congo (The Democratic Republic Of The)"]},{code:"CHE",number:"947",digits:2,currency:"WIR Euro",countries:["Switzerland"]},{code:"CHF",number:"756",digits:2,currency:"Swiss Franc",countries:["Liechtenstein","Switzerland"]},{code:"CHW",number:"948",digits:2,currency:"WIR Franc",countries:["Switzerland"]},{code:"CLF",number:"990",digits:4,currency:"Unidad de Fomento",countries:["Chile"]},{code:"CLP",number:"152",digits:0,currency:"Chilean Peso",countries:["Chile"]},{code:"CNY",number:"156",digits:2,currency:"Yuan Renminbi",countries:["China"]},{code:"COP",number:"170",digits:2,currency:"Colombian Peso",countries:["Colombia"]},{code:"COU",number:"970",digits:2,currency:"Unidad de Valor Real",countries:["Colombia"]},{code:"CRC",number:"188",digits:2,currency:"Costa Rican Colon",countries:["Costa Rica"]},{code:"CUC",number:"931",digits:2,currency:"Peso Convertible",countries:["Cuba"]},{code:"CUP",number:"192",digits:2,currency:"Cuban Peso",countries:["Cuba"]},{code:"CVE",number:"132",digits:2,currency:"Cabo Verde Escudo",countries:["Cabo Verde"]},{code:"CZK",number:"203",digits:2,currency:"Czech Koruna",countries:["Czechia"]},{code:"DJF",number:"262",digits:0,currency:"Djibouti Franc",countries:["Djibouti"]},{code:"DKK",number:"208",digits:2,currency:"Danish Krone",countries:["Denmark","Faroe Islands (The)","Greenland"]},{code:"DOP",number:"214",digits:2,currency:"Dominican Peso",countries:["Dominican Republic (The)"]},{code:"DZD",number:"012",digits:2,currency:"Algerian Dinar",countries:["Algeria"]},{code:"EGP",number:"818",digits:2,currency:"Egyptian Pound",countries:["Egypt"]},{code:"ERN",number:"232",digits:2,currency:"Nakfa",countries:["Eritrea"]},{code:"ETB",number:"230",digits:2,currency:"Ethiopian Birr",countries:["Ethiopia"]},{code:"EUR",number:"978",digits:2,currency:"Euro",countries:["Andorra","Austria","Belgium","Cyprus","Estonia","European Union","Finland","France","French Guiana","French Southern Territories (The)","Germany","Greece","Guadeloupe","Holy See (The)","Ireland","Italy","Latvia","Lithuania","Luxembourg","Malta","Martinique","Mayotte","Monaco","Montenegro","Netherlands (The)","Portugal","Réunion","Saint Barthélemy","Saint Martin (French Part)","Saint Pierre And Miquelon","San Marino","Slovakia","Slovenia","Spain","Åland Islands"]},{code:"FJD",number:"242",digits:2,currency:"Fiji Dollar",countries:["Fiji"]},{code:"FKP",number:"238",digits:2,currency:"Falkland Islands Pound",countries:["Falkland Islands (The) [Malvinas]"]},{code:"GBP",number:"826",digits:2,currency:"Pound Sterling",countries:["Guernsey","Isle Of Man","Jersey","United Kingdom Of Great Britain And Northern Ireland (The)"]},{code:"GEL",number:"981",digits:2,currency:"Lari",countries:["Georgia"]},{code:"GHS",number:"936",digits:2,currency:"Ghana Cedi",countries:["Ghana"]},{code:"GIP",number:"292",digits:2,currency:"Gibraltar Pound",countries:["Gibraltar"]},{code:"GMD",number:"270",digits:2,currency:"Dalasi",countries:["Gambia (The)"]},{code:"GNF",number:"324",digits:0,currency:"Guinean Franc",countries:["Guinea"]},{code:"GTQ",number:"320",digits:2,currency:"Quetzal",countries:["Guatemala"]},{code:"GYD",number:"328",digits:2,currency:"Guyana Dollar",countries:["Guyana"]},{code:"HKD",number:"344",digits:2,currency:"Hong Kong Dollar",countries:["Hong Kong"]},{code:"HNL",number:"340",digits:2,currency:"Lempira",countries:["Honduras"]},{code:"HRK",number:"191",digits:2,currency:"Kuna",countries:["Croatia"]},{code:"HTG",number:"332",digits:2,currency:"Gourde",countries:["Haiti"]},{code:"HUF",number:"348",digits:2,currency:"Forint",countries:["Hungary"]},{code:"IDR",number:"360",digits:2,currency:"Rupiah",countries:["Indonesia"]},{code:"ILS",number:"376",digits:2,currency:"New Israeli Sheqel",countries:["Israel"]},{code:"INR",number:"356",digits:2,currency:"Indian Rupee",countries:["Bhutan","India"]},{code:"IQD",number:"368",digits:3,currency:"Iraqi Dinar",countries:["Iraq"]},{code:"IRR",number:"364",digits:2,currency:"Iranian Rial",countries:["Iran (Islamic Republic Of)"]},{code:"ISK",number:"352",digits:0,currency:"Iceland Krona",countries:["Iceland"]},{code:"JMD",number:"388",digits:2,currency:"Jamaican Dollar",countries:["Jamaica"]},{code:"JOD",number:"400",digits:3,currency:"Jordanian Dinar",countries:["Jordan"]},{code:"JPY",number:"392",digits:0,currency:"Yen",countries:["Japan"]},{code:"KES",number:"404",digits:2,currency:"Kenyan Shilling",countries:["Kenya"]},{code:"KGS",number:"417",digits:2,currency:"Som",countries:["Kyrgyzstan"]},{code:"KHR",number:"116",digits:2,currency:"Riel",countries:["Cambodia"]},{code:"KMF",number:"174",digits:0,currency:"Comorian Franc ",countries:["Comoros (The)"]},{code:"KPW",number:"408",digits:2,currency:"North Korean Won",countries:["Korea (The Democratic People's Republic Of)"]},{code:"KRW",number:"410",digits:0,currency:"Won",countries:["Korea (The Republic Of)"]},{code:"KWD",number:"414",digits:3,currency:"Kuwaiti Dinar",countries:["Kuwait"]},{code:"KYD",number:"136",digits:2,currency:"Cayman Islands Dollar",countries:["Cayman Islands (The)"]},{code:"KZT",number:"398",digits:2,currency:"Tenge",countries:["Kazakhstan"]},{code:"LAK",number:"418",digits:2,currency:"Lao Kip",countries:["Lao People's Democratic Republic (The)"]},{code:"LBP",number:"422",digits:2,currency:"Lebanese Pound",countries:["Lebanon"]},{code:"LKR",number:"144",digits:2,currency:"Sri Lanka Rupee",countries:["Sri Lanka"]},{code:"LRD",number:"430",digits:2,currency:"Liberian Dollar",countries:["Liberia"]},{code:"LSL",number:"426",digits:2,currency:"Loti",countries:["Lesotho"]},{code:"LYD",number:"434",digits:3,currency:"Libyan Dinar",countries:["Libya"]},{code:"MAD",number:"504",digits:2,currency:"Moroccan Dirham",countries:["Morocco","Western Sahara"]},{code:"MDL",number:"498",digits:2,currency:"Moldovan Leu",countries:["Moldova (The Republic Of)"]},{code:"MGA",number:"969",digits:2,currency:"Malagasy Ariary",countries:["Madagascar"]},{code:"MKD",number:"807",digits:2,currency:"Denar",countries:["Macedonia (The Former Yugoslav Republic Of)"]},{code:"MMK",number:"104",digits:2,currency:"Kyat",countries:["Myanmar"]},{code:"MNT",number:"496",digits:2,currency:"Tugrik",countries:["Mongolia"]},{code:"MOP",number:"446",digits:2,currency:"Pataca",countries:["Macao"]},{code:"MRU",number:"929",digits:2,currency:"Ouguiya",countries:["Mauritania"]},{code:"MUR",number:"480",digits:2,currency:"Mauritius Rupee",countries:["Mauritius"]},{code:"MVR",number:"462",digits:2,currency:"Rufiyaa",countries:["Maldives"]},{code:"MWK",number:"454",digits:2,currency:"Malawi Kwacha",countries:["Malawi"]},{code:"MXN",number:"484",digits:2,currency:"Mexican Peso",countries:["Mexico"]},{code:"MXV",number:"979",digits:2,currency:"Mexican Unidad de Inversion (UDI)",countries:["Mexico"]},{code:"MYR",number:"458",digits:2,currency:"Malaysian Ringgit",countries:["Malaysia"]},{code:"MZN",number:"943",digits:2,currency:"Mozambique Metical",countries:["Mozambique"]},{code:"NAD",number:"516",digits:2,currency:"Namibia Dollar",countries:["Namibia"]},{code:"NGN",number:"566",digits:2,currency:"Naira",countries:["Nigeria"]},{code:"NIO",number:"558",digits:2,currency:"Cordoba Oro",countries:["Nicaragua"]},{code:"NOK",number:"578",digits:2,currency:"Norwegian Krone",countries:["Bouvet Island","Norway","Svalbard And Jan Mayen"]},{code:"NPR",number:"524",digits:2,currency:"Nepalese Rupee",countries:["Nepal"]},{code:"NZD",number:"554",digits:2,currency:"New Zealand Dollar",countries:["Cook Islands (The)","New Zealand","Niue","Pitcairn","Tokelau"]},{code:"OMR",number:"512",digits:3,currency:"Rial Omani",countries:["Oman"]},{code:"PAB",number:"590",digits:2,currency:"Balboa",countries:["Panama"]},{code:"PEN",number:"604",digits:2,currency:"Sol",countries:["Peru"]},{code:"PGK",number:"598",digits:2,currency:"Kina",countries:["Papua New Guinea"]},{code:"PHP",number:"608",digits:2,currency:"Philippine Piso",countries:["Philippines (The)"]},{code:"PKR",number:"586",digits:2,currency:"Pakistan Rupee",countries:["Pakistan"]},{code:"PLN",number:"985",digits:2,currency:"Zloty",countries:["Poland"]},{code:"PYG",number:"600",digits:0,currency:"Guarani",countries:["Paraguay"]},{code:"QAR",number:"634",digits:2,currency:"Qatari Rial",countries:["Qatar"]},{code:"RON",number:"946",digits:2,currency:"Romanian Leu",countries:["Romania"]},{code:"RSD",number:"941",digits:2,currency:"Serbian Dinar",countries:["Serbia"]},{code:"RUB",number:"643",digits:2,currency:"Russian Ruble",countries:["Russian Federation (The)"]},{code:"RWF",number:"646",digits:0,currency:"Rwanda Franc",countries:["Rwanda"]},{code:"SAR",number:"682",digits:2,currency:"Saudi Riyal",countries:["Saudi Arabia"]},{code:"SBD",number:"090",digits:2,currency:"Solomon Islands Dollar",countries:["Solomon Islands"]},{code:"SCR",number:"690",digits:2,currency:"Seychelles Rupee",countries:["Seychelles"]},{code:"SDG",number:"938",digits:2,currency:"Sudanese Pound",countries:["Sudan (The)"]},{code:"SEK",number:"752",digits:2,currency:"Swedish Krona",countries:["Sweden"]},{code:"SGD",number:"702",digits:2,currency:"Singapore Dollar",countries:["Singapore"]},{code:"SHP",number:"654",digits:2,currency:"Saint Helena Pound",countries:["Saint Helena, Ascension And Tristan Da Cunha"]},{code:"SLL",number:"694",digits:2,currency:"Leone",countries:["Sierra Leone"]},{code:"SOS",number:"706",digits:2,currency:"Somali Shilling",countries:["Somalia"]},{code:"SRD",number:"968",digits:2,currency:"Surinam Dollar",countries:["Suriname"]},{code:"SSP",number:"728",digits:2,currency:"South Sudanese Pound",countries:["South Sudan"]},{code:"STN",number:"930",digits:2,currency:"Dobra",countries:["Sao Tome And Principe"]},{code:"SVC",number:"222",digits:2,currency:"El Salvador Colon",countries:["El Salvador"]},{code:"SYP",number:"760",digits:2,currency:"Syrian Pound",countries:["Syrian Arab Republic"]},{code:"SZL",number:"748",digits:2,currency:"Lilangeni",countries:["Swaziland"]},{code:"THB",number:"764",digits:2,currency:"Baht",countries:["Thailand"]},{code:"TJS",number:"972",digits:2,currency:"Somoni",countries:["Tajikistan"]},{code:"TMT",number:"934",digits:2,currency:"Turkmenistan New Manat",countries:["Turkmenistan"]},{code:"TND",number:"788",digits:3,currency:"Tunisian Dinar",countries:["Tunisia"]},{code:"TOP",number:"776",digits:2,currency:"Pa'anga",countries:["Tonga"]},{code:"TRY",number:"949",digits:2,currency:"Turkish Lira",countries:["Turkey"]},{code:"TTD",number:"780",digits:2,currency:"Trinidad and Tobago Dollar",countries:["Trinidad And Tobago"]},{code:"TWD",number:"901",digits:2,currency:"New Taiwan Dollar",countries:["Taiwan (Province Of China)"]},{code:"TZS",number:"834",digits:2,currency:"Tanzanian Shilling",countries:["Tanzania, United Republic Of"]},{code:"UAH",number:"980",digits:2,currency:"Hryvnia",countries:["Ukraine"]},{code:"UGX",number:"800",digits:0,currency:"Uganda Shilling",countries:["Uganda"]},{code:"USD",number:"840",digits:2,currency:"US Dollar",countries:["American Samoa","Bonaire, Sint Eustatius And Saba","British Indian Ocean Territory (The)","Ecuador","El Salvador","Guam","Haiti","Marshall Islands (The)","Micronesia (Federated States Of)","Northern Mariana Islands (The)","Palau","Panama","Puerto Rico","Timor-Leste","Turks And Caicos Islands (The)","United States Minor Outlying Islands (The)","United States Of America (The)","Virgin Islands (British)","Virgin Islands (U.S.)"]},{code:"USN",number:"997",digits:2,currency:"US Dollar (Next day)",countries:["United States Of America (The)"]},{code:"UYI",number:"940",digits:0,currency:"Uruguay Peso en Unidades Indexadas (URUIURUI)",countries:["Uruguay"]},{code:"UYU",number:"858",digits:2,currency:"Peso Uruguayo",countries:["Uruguay"]},{code:"UZS",number:"860",digits:2,currency:"Uzbekistan Sum",countries:["Uzbekistan"]},{code:"VEF",number:"937",digits:2,currency:"Bolívar",countries:["Venezuela (Bolivarian Republic Of)"]},{code:"VND",number:"704",digits:0,currency:"Dong",countries:["Viet Nam"]},{code:"VUV",number:"548",digits:0,currency:"Vatu",countries:["Vanuatu"]},{code:"WST",number:"882",digits:2,currency:"Tala",countries:["Samoa"]},{code:"XAF",number:"950",digits:0,currency:"CFA Franc BEAC",countries:["Cameroon","Central African Republic (The)","Chad","Congo (The)","Equatorial Guinea","Gabon"]},{code:"XAG",number:"961",digits:0,currency:"Silver",countries:[]},{code:"XAU",number:"959",digits:0,currency:"Gold",countries:[]},{code:"XBA",number:"955",digits:0,currency:"Bond Markets Unit European Composite Unit (EURCO)",countries:[]},{code:"XBB",number:"956",digits:0,currency:"Bond Markets Unit European Monetary Unit (E.M.U.-6)",countries:[]},{code:"XBC",number:"957",digits:0,currency:"Bond Markets Unit European Unit of Account 9 (E.U.A.-9)",countries:[]},{code:"XBD",number:"958",digits:0,currency:"Bond Markets Unit European Unit of Account 17 (E.U.A.-17)",countries:[]},{code:"XCD",number:"951",digits:2,currency:"East Caribbean Dollar",countries:["Anguilla","Antigua And Barbuda","Dominica","Grenada","Montserrat","Saint Kitts And Nevis","Saint Lucia","Saint Vincent And The Grenadines"]},{code:"XDR",number:"960",digits:0,currency:"SDR (Special Drawing Right)",countries:["International Monetary Fund (Imf) "]},{code:"XOF",number:"952",digits:0,currency:"CFA Franc BCEAO",countries:["Benin","Burkina Faso","Côte d'Ivoire","Guinea-Bissau","Mali","Niger (The)","Senegal","Togo"]},{code:"XPD",number:"964",digits:0,currency:"Palladium",countries:[]},{code:"XPF",number:"953",digits:0,currency:"CFP Franc",countries:["French Polynesia","New Caledonia","Wallis And Futuna"]},{code:"XPT",number:"962",digits:0,currency:"Platinum",countries:[]},{code:"XSU",number:"994",digits:0,currency:"Sucre",countries:['Sistema Unitario De Compensacion Regional De Pagos "Sucre"']},{code:"XTS",number:"963",digits:0,currency:"Codes specifically reserved for testing purposes",countries:[]},{code:"XUA",number:"965",digits:0,currency:"ADB Unit of Account",countries:["Member Countries Of The African Development Bank Group"]},{code:"XXX",number:"999",digits:0,currency:"The codes assigned for transactions where no currency is involved",countries:[]},{code:"YER",number:"886",digits:2,currency:"Yemeni Rial",countries:["Yemen"]},{code:"ZAR",number:"710",digits:2,currency:"Rand",countries:["Lesotho","Namibia","South Africa"]},{code:"ZMW",number:"967",digits:2,currency:"Zambian Kwacha",countries:["Zambia"]},{code:"ZWL",number:"932",digits:2,currency:"Zimbabwe Dollar",countries:["Zimbabwe"]}]},3546:function(e,t,r){var n=r(7680),o=r(2719),a=r(4550);t.Rx=function(e){return n(a,(function(t){return t.number===String(e)}))}},4638:function(e,t,r){"use strict";var n=r(5352);function o(e){throw new Error("makeNodeDisklet is not available on this platform")}function a(){throw new Error("makeReactNativeDisklet is not available on this platform")}function i(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(c){return void r(c)}s.done?t(u):Promise.resolve(u).then(n,o)}function s(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function s(e){i(a,n,o,s,u,"next",e)}function u(e){i(a,n,o,s,u,"throw",e)}s(void 0)}))}}function u(){return u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u.apply(this,arguments)}function c(e){if(/^\//.test(e))throw new Error("Absolute paths are not supported");for(var t=e.split("/"),r=0,n=0;r<t.length;){var o=t[r++];if(".."===o?n--:"."!==o&&""!==o&&(t[n++]=o),n<0)throw new Error("Path would escape folder")}return t.slice(0,n).join("/")}function f(e){return""===e?e:e+"/"}function l(e){for(var t=[],r=0;r<e.length;++r){var n=e.key(r);null!=n&&t.push(n)}return t}function d(e,t){void 0===e&&(e=window.localStorage),void 0===t&&(t={});var r=null!=t.prefix?f(t.prefix):"/";return{delete:function(t){var n=c(t);null!=e.getItem(r+n)&&e.removeItem(r+n);for(var o=f(n),a=0,i=l(e);a<i.length;a++){var s=i[a];0===s.indexOf(r+o)&&e.removeItem(s)}return Promise.resolve()},getData:function(e){return this.getText(e).then((function(e){return n.base64.parse(e)}))},getText:function(t){var n=c(t),o=e.getItem(r+n);return null==o?Promise.reject(new Error('Cannot load "'+n+'"')):Promise.resolve(o)},list:function(t){return s((function*(){void 0===t&&(t="");var n=c(t),o={};null!=e.getItem(r+n)&&(o[n]="file");for(var a=f(n),i=0,s=l(e);i<s.length;i++){var u=s[i];if(0===u.indexOf(r+a)){var d=u.indexOf("/",r.length+a.length);d<0?o[u.slice(r.length)]="file":o[u.slice(r.length,d)]="folder"}}return o}))()},setData:function(e,t){return this.setText(e,n.base64.stringify(t))},setText:function(t,n){return"string"!=typeof n?Promise.reject(new TypeError("setText expects a string")):(e.setItem(r+c(t),n),Promise.resolve())}}}function p(e){return void 0===e&&(e={}),{delete:function(t){var r=c(t);null!=e["/"+r]&&delete e["/"+r];for(var n=f(r),o=0,a=Object.keys(e);o<a.length;o++){var i=a[o];0===i.indexOf("/"+n)&&delete e[i]}return Promise.resolve()},getData:function(t){var r=c(t),n=e["/"+r];return null==n?Promise.reject(new Error('Cannot load "'+r+'"')):"string"==typeof n?Promise.reject(new Error('"'+r+'" is a text file.')):Promise.resolve(n)},getText:function(t){var r=c(t),n=e["/"+r];return null==n?Promise.reject(new Error('Cannot load "'+r+'"')):"string"!=typeof n?Promise.reject(new Error('"'+r+'" is a binary file.')):Promise.resolve(n)},list:function(t){return s((function*(){void 0===t&&(t="");var r=c(t),n={};null!=e["/"+r]&&(n[r]="file");for(var o=f(r),a=0,i=Object.keys(e);a<i.length;a++){var s=i[a];if(0===s.indexOf("/"+o)){var u=s.indexOf("/",1+o.length);u<0?n[s.slice(1)]="file":n[s.slice(1,u)]="folder"}}return n}))()},setData:function(t,r){var n=r,o=Uint8Array.from(n);return e["/"+c(t)]=o,Promise.resolve()},setText:function(t,r){return"string"!=typeof r?Promise.reject(new TypeError("setText expects a string")):(e["/"+c(t)]=r,Promise.resolve())}}}var h=function(){function e(e,t){this._disklet=e,this._path=t}var t=e.prototype;return t.delete=function(){return this._disklet.delete(this._path)},t.getData=function(){return this._disklet.getData(this._path)},t.getText=function(){return this._disklet.getText(this._path)},t.setData=function(e){return this._disklet.setData(this._path,e)},t.setText=function(e){return this._disklet.setText(this._path,e)},e}(),b=function(){function e(e,t){this._disklet=e,this._path=t}var t=e.prototype;return t.delete=function(){return this._disklet.delete(this._path)},t.file=function(e){return new h(this._disklet,this._path+"/"+e)},t.folder=function(t){return new e(this._disklet,this._path+"/"+t)},t.listFiles=function(){return this._disklet.list(this._path).then((function(e){return Object.keys(e).filter((function(t){return"file"===e[t]})).map((function(e){return e.replace(/^.*\//,"")}))}))},t.listFolders=function(){return this._disklet.list(this._path).then((function(e){return Object.keys(e).filter((function(t){return"folder"===e[t]})).map((function(e){return e.replace(/^.*\//,"")}))}))},e}();function v(e){return new b(e,".")}function y(e,t){for(var r=0,n=0;r<t.length;){var o=t[r++];if(".."===o?n--:"."!==o&&""!==o&&(t[n++]=o),n<0)throw new Error("Path would escape folder")}for(r=0;r<n;++r)e=e.folder(t[r]);return e}function g(e,t){return e.listFiles().then((function(r){return Promise.all(r.map((function(r){return t(e.file(r),r,e)})))}))}function m(e,t){return e.listFolders().then((function(r){return Promise.all(r.map((function(r){return t(e.folder(r),r,e)})))}))}function w(e,t){console.log(t+' "'+e+'"')}function x(e,t,r){var n=r.callback,o=void 0===n?w:n,a=r.verbose;(void 0!==a&&a||/set|delete/.test(t))&&o(e,t)}var k=function(){function e(e,t,r){this._file=e,this._path=t,this._opts=r}var t=e.prototype;return t.delete=function(){return x(this._path,"delete file",this._opts),this._file.delete()},t.getData=function(){return x(this._path,"get data",this._opts),this._file.getData()},t.getText=function(){return x(this._path,"get text",this._opts),this._file.getText()},t.setData=function(e){return x(this._path,"set data",this._opts),this._file.setData(e)},t.setText=function(e){return x(this._path,"set text",this._opts),this._file.setText(e)},t.getPath=function(){return this._path},e}(),I=function(){function e(e,t,r){this._folder=e,this._path=t,this._opts=r}var t=e.prototype;return t.delete=function(){return x(this._path,"delete folder",this._opts),this._folder.delete()},t.file=function(e){return new k(this._folder.file(e),this._path+e,this._opts)},t.folder=function(t){return new e(this._folder.folder(t),this._path+t+"/",this._opts)},t.listFiles=function(){return x(this._path,"list files",this._opts),this._folder.listFiles()},t.listFolders=function(){return x(this._path,"list folders",this._opts),this._folder.listFolders()},e}();function O(e,t){var r={},n=[];return e.forEach((function(e){/\._x_$/.test(e)?r[e]=!0:(r[e+"._x_"]=!0,n.push(e))})),t.forEach((function(e){r[e+"._x_"]||n.push(e)})),n}var E=function(){function e(e,t,r){this._master=e,this._fallback=t,this._whiteout=r}var t=e.prototype;return t.delete=function(){return Promise.all([this._whiteout.setData([]),this._master.delete().catch((function(e){return null}))])},t.getData=function(){var e=this;return this._master.getData().catch((function(t){return e._whiteout.getData().then((function(e){throw new Error("File has been deleted")}),(function(t){return e._fallback.getData()}))}))},t.getText=function(){var e=this;return this._master.getText().catch((function(t){return e._whiteout.getData().then((function(e){throw new Error("File has been deleted")}),(function(t){return e._fallback.getText()}))}))},t.setData=function(e){return this._master.setData(e)},t.setText=function(e){return this._master.setText(e)},t.getPath=function(){throw new Error("Cannot call getPath on a Union Folder")},e}(),S=function(){function e(e,t){this._master=e,this._fallback=t}var t=e.prototype;return t.delete=function(){return Promise.all([g(this,(function(e){return e.delete()})),m(this,(function(e){return e.delete()}))]).then((function(){}))},t.file=function(e){return new E(this._master.file(e),this._fallback.file(e),this._master.file(e+"._x_"))},t.folder=function(t){return new e(this._master.folder(t),this._fallback.folder(t))},t.listFiles=function(){return Promise.all([this._master.listFiles(),this._fallback.listFiles()]).then((function(e){return O(e[0],e[1])}))},t.listFolders=function(){return Promise.all([this._master.listFolders(),this._fallback.listFolders()]).then((function(e){return O(e[0],e[1])}))},e}();function A(e,t){var r=f(c(t));return{delete:function(t){return e.delete(r+t)},getData:function(t){return e.getData(r+t)},getText:function(t){return e.getText(r+t)},list:function(t){return void 0===t&&(t="."),e.list(r+t).then((function(e){var t={};for(var n in e)t[n.replace(r,"")]=e[n];return t}))},setData:function(t,n){return e.setData(r+t,n)},setText:function(t,n){return e.setText(r+t,n)}}}t.gQ=function(e){return Object.keys(e).filter((function(t){return"file"===e[t]}))},t.ji=function(e){return Object.keys(e).filter((function(t){return"folder"===e[t]}))},t.Wh=p,t.Cl=function(e,t){return{delete:function(r){return Promise.all([e.delete(r),t.delete(r)])},getData:function(r){return e.getData(r).catch((function(e){return t.getData(r)}))},getText:function(r){return e.getText(r).catch((function(e){return t.getText(r)}))},list:function(r){return Promise.all([e.list(r),t.list(r)]).then((function(e){var t=e[0];return u(e[1],t)}))},setData:function(t,r){return e.setData(t,r)},setText:function(t,r){return e.setText(t,r)}}},t.HN=A},1649:function(e,t,r){"use strict";var n=r(7445),o=r(4098),a=r(1223),i=r(3715),s=r(5352);function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=u(o),f=u(a),l=u(i);const d=/^[a-z0-9-_.]+(\/+[a-z0-9-_.]+)*$/i,p=/^[a-f0-9]{40}$/,h=n.asObject({infoServers:n.asOptional(n.asArray(n.asString)),syncServers:n.asOptional(n.asArray(n.asString))}),b=e=>{const t=n.asString(e);if(""===t)throw new TypeError("Expected non empty string");return t},v=e=>{const t=n.asString(e);if(!p.test(t))throw new TypeError(`Invalid sync key '${t}'`);return t},y=n.asObject({iv_hex:n.asString,encryptionType:n.asNumber,data_base64:n.asString}),g=n.asObject({success:n.asValue(!1),message:n.asString,stack:n.asOptional(n.asString)}),m=n.asEither(y,n.asNull),w=n.asObject(m),x=n.asObject({syncKey:v,hash:n.asOptional(b)}),k=n.asObject({hash:n.asOptional(n.asString),changes:w}),I=n.asObject({syncKey:v,hash:n.asOptional(b)}),O=n.asObject({changes:w}),E=n.asObject({hash:n.asString,changes:w}),S=n.asObject({syncKey:v}),A=n.asUndefined,_=()=>{};async function T(e,t,r={}){const{log:o=_,fetch:a=c.default}=r,{method:i,url:s,body:u,numbUrl:f=s,headers:l={}}=e,d=Date.now(),p=await a(s,{method:i,headers:{"Content-Type":"application/json",...l},body:JSON.stringify(u)}),h=Date.now()-d;o(`${i} ${f} returned ${p.status} in ${h}ms`);const b=await p.text();if(!p.ok)throw new Error(`Failed request ${i} ${f} failed ${p.status}: ${b}`);const v=n.asMaybe(g)(b);if(null!=v)throw new Error(`Failed request ${i} ${f} failed ${p.status}: ${v.message}`);return t(""!==b.trim()?JSON.parse(b):void 0)}const P=f.default("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),M=e=>{const t=j(j(s.base16.parse(e)));return P.encode(t)};function j(e){const t=l.default.sha256();return Uint8Array.from(t.update(e).digest())}class C extends Error{constructor(e="Cannot reach the network"){super(e),this.name="NetworkError"}}const N={infoServers:["https://info-eu1.edge.app","https://info-us1.edge.app"],syncServers:["https://sync-us1.edge.app","https://sync-us2.edge.app","https://sync-us3.edge.app","https://sync-us4.edge.app","https://sync-us5.edge.app","https://sync-us6.edge.app","https://sync-eu.edge.app"]};function D(e={}){const{log:t=(()=>{})}=e,r={...N,...e.edgeServers},{edgeServersCacheTTL:n=6e5}=e,o=function(e,t){let r=Date.now()+t,n=e(void 0);return{get:()=>{if(Date.now()>r||null==n){r=Date.now()+t;const o=e(n);n=o}return n}}}(((n={current:r})=>(n.current.infoServers.length>0&&async function(e,t={}){const{log:r=_,fetch:n=c.default}=t;let o=new Error("No info servers");for(const i of e){const[e,t]=["GET","/v1/edgeServers"],s=Date.now(),u=`${i}${t}`;try{const t=await n(u,{method:e,headers:{"Content-Type":"application/json"}}).catch((t=>{const n=Date.now()-s,o=`${e} ${u} failed in ${n}ms, ${String(t)}`;throw r(o),new C(o)})),{ok:o,status:a}=t,i=Date.now()-s,c=`${e} ${u} returned ${a} in ${i}ms`;if(!o)throw r(c),new C(c);r(c);const f=await t.text(),l=JSON.parse(f);return h(l)}catch(a){o=a;continue}}throw o}(n.current.infoServers,e).then((e=>{return n.current={...n.current,...e,infoServers:(t=e.infoServers,r=()=>N.infoServers,null!=t?t:r())};var t,r})).catch((async e=>{t(String(e))})),n)),n);return{async getEdgeServers(){const{current:e}=await o.get();return e}}}function R(e,t){return null!=e?e:t()}t.bS=w,t.Ei=y,t.h8=h,t.wJ=m,t.PG=x,t.SR=k,t.Th=b,t.Qw=e=>{const t=n.asString(e);try{if(d.test(t))return function(e){if(/^\//.test(e))throw new Error("Absolute paths are not supported");const t=e.split("/");let r=0,n=0;for(;r<t.length;){const e=t[r++];if(".."===e?n--:"."!==e&&""!==e&&(t[n++]=e),n<0)throw new Error("Path would escape folder");if(0===n&&r===t.length)throw new Error("Path would evaluate to empty file name")}return t.slice(0,n).join("/")}(t)}catch(r){}throw new Error(`Invalid path '${t}'`)},t.YK=O,t.KI=I,t.Wn=E,t.tp=S,t.RQ=A,t.tE=g,t.Jj=v,t.LZ=function(e={}){const t=D(e);async function r(){const{syncServers:e}=await t.getEdgeServers();return function(e){for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}return e}(e)}return{async createRepo(t,n){const o=await r();let a=new Error(`Failed to create repo ${t}: empty sync server list`);for(const r of o){const o=`${r}/api/v2/store/${t}`,s=o.replace(t,`<${M(t)}>`);try{return await T({method:"PUT",url:o,numbUrl:s,headers:null!=n?{"X-API-Key":n}:{}},A,e)}catch(i){a=i}}throw a},async readRepo(t,n){const o=await r();let a=new Error(`Failed to read repo ${t}: empty sync server list`);for(const r of o){const o=`${r}/api/v2/store/${t}/${R(n,(()=>""))}`,s=o.replace(t,`<${M(t)}>`);try{return await T({method:"GET",url:o,numbUrl:s},k,e)}catch(i){a=i}}throw a},async updateRepo(t,n,o){const a=await r();let i=new Error(`Failed to update repo ${t}: empty sync server list`);for(const r of a){const a=`${r}/api/v2/store/${t}/${R(n,(()=>""))}`,u=a.replace(t,`<${M(t)}>`);try{return await T({method:"POST",url:a,numbUrl:u,body:o},E,e)}catch(s){i=s}}throw i}}},t.m8=M},1223:function(e){e.exports=function(e){for(var t={},r=e.length,n=e.charAt(0),o=0;o<e.length;o++)t[e.charAt(o)]=o;function a(e){if(0===e.length)return[];for(var o=[0],a=0;a<e.length;a++){var i=t[e[a]];if(void 0===i)return;for(var s=0,u=i;s<o.length;++s)u+=o[s]*r,o[s]=255&u,u>>=8;for(;u>0;)o.push(255&u),u>>=8}for(var c=0;e[c]===n&&c<e.length-1;++c)o.push(0);return o.reverse()}return{encode:function(t){if(0===t.length)return"";for(var n=[0],o=0;o<t.length;++o){for(var a=0,i=t[o];a<n.length;++a)i+=n[a]<<8,n[a]=i%r,i=i/r|0;for(;i>0;)n.push(i%r),i=i/r|0}for(var s="",u=0;0===t[u]&&u<t.length-1;++u)s+=e[0];for(var c=n.length-1;c>=0;--c)s+=e[n[c]];return s},decodeUnsafe:a,decode:function(e){var t=a(e);if(t)return t;throw new Error("Non-base"+r+" character")}}}},6266:function(e,t,r){"use strict";var n=t;n.version=r(8597).i8,n.utils=r(953),n.rand=r(9931),n.curve=r(8254),n.curves=r(5427),n.ec=r(7954),n.eddsa=r(5980)},4918:function(e,t,r){"use strict";var n=r(3550),o=r(953),a=o.getNAF,i=o.getJSF,s=o.assert;function u(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(e,t){s(e.precomputed);var r=e._getDoubles(),n=a(t,1,this._bitLength),o=(1<<r.step+1)-(r.step%2==0?2:1);o/=3;var i,u,c=[];for(i=0;i<n.length;i+=r.step){u=0;for(var f=i+r.step-1;f>=i;f--)u=(u<<1)+n[f];c.push(u)}for(var l=this.jpoint(null,null,null),d=this.jpoint(null,null,null),p=o;p>0;p--){for(i=0;i<c.length;i++)(u=c[i])===p?d=d.mixedAdd(r.points[i]):u===-p&&(d=d.mixedAdd(r.points[i].neg()));l=l.add(d)}return l.toP()},u.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var o=n.points,i=a(t,r,this._bitLength),u=this.jpoint(null,null,null),c=i.length-1;c>=0;c--){for(var f=0;c>=0&&0===i[c];c--)f++;if(c>=0&&f++,u=u.dblp(f),c<0)break;var l=i[c];s(0!==l),u="affine"===e.type?l>0?u.mixedAdd(o[l-1>>1]):u.mixedAdd(o[-l-1>>1].neg()):l>0?u.add(o[l-1>>1]):u.add(o[-l-1>>1].neg())}return"affine"===e.type?u.toP():u},u.prototype._wnafMulAdd=function(e,t,r,n,o){var s,u,c,f=this._wnafT1,l=this._wnafT2,d=this._wnafT3,p=0;for(s=0;s<n;s++){var h=(c=t[s])._getNAFPoints(e);f[s]=h.wnd,l[s]=h.points}for(s=n-1;s>=1;s-=2){var b=s-1,v=s;if(1===f[b]&&1===f[v]){var y=[t[b],null,null,t[v]];0===t[b].y.cmp(t[v].y)?(y[1]=t[b].add(t[v]),y[2]=t[b].toJ().mixedAdd(t[v].neg())):0===t[b].y.cmp(t[v].y.redNeg())?(y[1]=t[b].toJ().mixedAdd(t[v]),y[2]=t[b].add(t[v].neg())):(y[1]=t[b].toJ().mixedAdd(t[v]),y[2]=t[b].toJ().mixedAdd(t[v].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],m=i(r[b],r[v]);for(p=Math.max(m[0].length,p),d[b]=new Array(p),d[v]=new Array(p),u=0;u<p;u++){var w=0|m[0][u],x=0|m[1][u];d[b][u]=g[3*(w+1)+(x+1)],d[v][u]=0,l[b]=y}}else d[b]=a(r[b],f[b],this._bitLength),d[v]=a(r[v],f[v],this._bitLength),p=Math.max(d[b].length,p),p=Math.max(d[v].length,p)}var k=this.jpoint(null,null,null),I=this._wnafT4;for(s=p;s>=0;s--){for(var O=0;s>=0;){var E=!0;for(u=0;u<n;u++)I[u]=0|d[u][s],0!==I[u]&&(E=!1);if(!E)break;O++,s--}if(s>=0&&O++,k=k.dblp(O),s<0)break;for(u=0;u<n;u++){var S=I[u];0!==S&&(S>0?c=l[u][S-1>>1]:S<0&&(c=l[u][-S-1>>1].neg()),k="affine"===c.type?k.mixedAdd(c):k.add(c))}}for(s=0;s<n;s++)l[s]=null;return o?k:k.toP()},u.BasePoint=c,c.prototype.eq=function(){throw new Error("Not implemented")},c.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(e,t){e=o.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?s(e[e.length-1]%2==0):7===e[0]&&s(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},c.prototype.encodeCompressed=function(e){return this.encode(e,!0)},c.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},c.prototype.encode=function(e,t){return o.encode(this._encode(t),e)},c.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},c.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},c.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,o=0;o<t;o+=e){for(var a=0;a<e;a++)n=n.dbl();r.push(n)}return{step:e,points:r}},c.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),o=1;o<r;o++)t[o]=t[o-1].add(n);return{wnd:e,points:t}},c.prototype._getBeta=function(){return null},c.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}},1138:function(e,t,r){"use strict";var n=r(953),o=r(3550),a=r(5717),i=r(4918),s=n.assert;function u(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,i.call(this,"edwards",e),this.a=new o(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new o(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new o(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),s(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function c(e,t,r,n,a){i.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new o(t,16),this.y=new o(r,16),this.z=n?new o(n,16):this.curve.one,this.t=a&&new o(a,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}a(u,i),e.exports=u,u.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},u.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},u.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},u.prototype.pointFromX=function(e,t){(e=new o(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),a=this.one.redSub(this.c2.redMul(this.d).redMul(r)),i=n.redMul(a.redInvm()),s=i.redSqrt();if(0!==s.redSqr().redSub(i).cmp(this.zero))throw new Error("invalid point");var u=s.fromRed().isOdd();return(t&&!u||!t&&u)&&(s=s.redNeg()),this.point(e,s)},u.prototype.pointFromY=function(e,t){(e=new o(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),a=r.redMul(this.d).redMul(this.c2).redSub(this.a),i=n.redMul(a.redInvm());if(0===i.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var s=i.redSqrt();if(0!==s.redSqr().redSub(i).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==t&&(s=s.redNeg()),this.point(s,e)},u.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),o=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(o)},a(c,i.BasePoint),u.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},u.prototype.point=function(e,t,r,n){return new c(this,e,t,r,n)},c.fromJSON=function(e,t){return new c(e,t[0],t[1],t[2])},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},c.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),o=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=n.redAdd(t),i=a.redSub(r),s=n.redSub(t),u=o.redMul(i),c=a.redMul(s),f=o.redMul(s),l=i.redMul(a);return this.curve.point(u,c,l,f)},c.prototype._projDbl=function(){var e,t,r,n,o,a,i=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(n=this.curve._mulA(s)).redAdd(u);this.zOne?(e=i.redSub(s).redSub(u).redMul(c.redSub(this.curve.two)),t=c.redMul(n.redSub(u)),r=c.redSqr().redSub(c).redSub(c)):(o=this.z.redSqr(),a=c.redSub(o).redISub(o),e=i.redSub(s).redISub(u).redMul(a),t=c.redMul(n.redSub(u)),r=c.redMul(a))}else n=s.redAdd(u),o=this.curve._mulC(this.z).redSqr(),a=n.redSub(o).redSub(o),e=this.curve._mulC(i.redISub(n)).redMul(a),t=this.curve._mulC(n).redMul(s.redISub(u)),r=n.redMul(a);return this.curve.point(e,t,r)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),o=this.z.redMul(e.z.redAdd(e.z)),a=r.redSub(t),i=o.redSub(n),s=o.redAdd(n),u=r.redAdd(t),c=a.redMul(i),f=s.redMul(u),l=a.redMul(u),d=i.redMul(s);return this.curve.point(c,f,d,l)},c.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),o=n.redSqr(),a=this.x.redMul(e.x),i=this.y.redMul(e.y),s=this.curve.d.redMul(a).redMul(i),u=o.redSub(s),c=o.redAdd(s),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(a).redISub(i),l=n.redMul(u).redMul(f);return this.curve.twisted?(t=n.redMul(c).redMul(i.redSub(this.curve._mulA(a))),r=u.redMul(c)):(t=n.redMul(c).redMul(i.redSub(a)),r=this.curve._mulC(u).redMul(c)),this.curve.point(l,t,r)},c.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},c.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},c.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},c.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},8254:function(e,t,r){"use strict";var n=t;n.base=r(4918),n.short=r(6673),n.mont=r(2881),n.edwards=r(1138)},2881:function(e,t,r){"use strict";var n=r(3550),o=r(5717),a=r(4918),i=r(953);function s(e){a.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(e,t,r){a.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(s,a),e.exports=s,s.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},o(u,a.BasePoint),s.prototype.decodePoint=function(e,t){return this.point(i.toArray(e,t),1)},s.prototype.point=function(e,t){return new u(this,e,t)},s.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(e,t){return new u(e,t[0],t[1]||e.one)},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),o=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,o)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),o=e.x.redAdd(e.z),a=e.x.redSub(e.z).redMul(r),i=o.redMul(n),s=t.z.redMul(a.redAdd(i).redSqr()),u=t.x.redMul(a.redISub(i).redSqr());return this.curve.point(s,u)},u.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),o=[];0!==t.cmpn(0);t.iushrn(1))o.push(t.andln(1));for(var a=o.length-1;a>=0;a--)0===o[a]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},6673:function(e,t,r){"use strict";var n=r(953),o=r(3550),a=r(5717),i=r(4918),s=n.assert;function u(e){i.call(this,"short",e),this.a=new o(e.a,16).toRed(this.red),this.b=new o(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(e,t,r,n){i.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new o(t,16),this.y=new o(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function f(e,t,r,n){i.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new o(0)):(this.x=new o(t,16),this.y=new o(r,16),this.z=new o(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}a(u,i),e.exports=u,u.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new o(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new o(e.lambda,16);else{var a=this._getEndoRoots(this.n);0===this.g.mul(a[0]).x.cmp(this.g.x.redMul(t))?r=a[0]:(r=a[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new o(e.a,16),b:new o(e.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:o.mont(e),r=new o(2).toRed(t).redInvm(),n=r.redNeg(),a=new o(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(a).fromRed(),n.redSub(a).fromRed()]},u.prototype._getEndoBasis=function(e){for(var t,r,n,a,i,s,u,c,f,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,p=this.n.clone(),h=new o(1),b=new o(0),v=new o(0),y=new o(1),g=0;0!==d.cmpn(0);){var m=p.div(d);c=p.sub(m.mul(d)),f=v.sub(m.mul(h));var w=y.sub(m.mul(b));if(!n&&c.cmp(l)<0)t=u.neg(),r=h,n=c.neg(),a=f;else if(n&&2==++g)break;u=c,p=d,d=c,v=h,h=f,y=b,b=w}i=c.neg(),s=f;var x=n.sqr().add(a.sqr());return i.sqr().add(s.sqr()).cmp(x)>=0&&(i=t,s=r),n.negative&&(n=n.neg(),a=a.neg()),i.negative&&(i=i.neg(),s=s.neg()),[{a:n,b:a},{a:i,b:s}]},u.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],o=n.b.mul(e).divRound(this.n),a=r.b.neg().mul(e).divRound(this.n),i=o.mul(r.a),s=a.mul(n.a),u=o.mul(r.b),c=a.mul(n.b);return{k1:e.sub(i).sub(s),k2:u.add(c).neg()}},u.prototype.pointFromX=function(e,t){(e=new o(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var a=n.fromRed().isOdd();return(t&&!a||!t&&a)&&(n=n.redNeg()),this.point(e,n)},u.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(o).cmpn(0)},u.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,o=this._endoWnafT2,a=0;a<e.length;a++){var i=this._endoSplit(t[a]),s=e[a],u=s._getBeta();i.k1.negative&&(i.k1.ineg(),s=s.neg(!0)),i.k2.negative&&(i.k2.ineg(),u=u.neg(!0)),n[2*a]=s,n[2*a+1]=u,o[2*a]=i.k1,o[2*a+1]=i.k2}for(var c=this._wnafMulAdd(1,n,o,2*a,r),f=0;f<2*a;f++)n[f]=null,o[f]=null;return c},a(c,i.BasePoint),u.prototype.point=function(e,t,r){return new c(this,e,t,r)},u.prototype.pointFromJSON=function(e,t){return c.fromJSON(this,e,t)},c.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},c.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},c.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function o(t){return e.point(t[0],t[1],r)}var a=t[2];return n.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[n].concat(a.doubles.points.map(o))},naf:a.naf&&{wnd:a.naf.wnd,points:[n].concat(a.naf.points.map(o))}},n},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},c.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),o=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),a=o.redSqr().redISub(this.x.redAdd(this.x)),i=o.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,i)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(e){return e=new o(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o):this.curve._wnafMulAdd(1,n,o,2)},c.prototype.jmulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o,!0):this.curve._wnafMulAdd(1,n,o,2,!0)},c.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},c.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},a(f,i.BasePoint),u.prototype.jpoint=function(e,t,r){return new f(this,e,t,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),o=e.x.redMul(r),a=this.y.redMul(t.redMul(e.z)),i=e.y.redMul(r.redMul(this.z)),s=n.redSub(o),u=a.redSub(i);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),f=c.redMul(s),l=n.redMul(c),d=u.redSqr().redIAdd(f).redISub(l).redISub(l),p=u.redMul(l.redISub(d)).redISub(a.redMul(f)),h=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(d,p,h)},f.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),o=this.y,a=e.y.redMul(t).redMul(this.z),i=r.redSub(n),s=o.redSub(a);if(0===i.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=i.redSqr(),c=u.redMul(i),f=r.redMul(u),l=s.redSqr().redIAdd(c).redISub(f).redISub(f),d=s.redMul(f.redISub(l)).redISub(o.redMul(c)),p=this.z.redMul(i);return this.curve.jpoint(l,d,p)},f.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var n=this.curve.a,o=this.curve.tinv,a=this.x,i=this.y,s=this.z,u=s.redSqr().redSqr(),c=i.redAdd(i);for(t=0;t<e;t++){var f=a.redSqr(),l=c.redSqr(),d=l.redSqr(),p=f.redAdd(f).redIAdd(f).redIAdd(n.redMul(u)),h=a.redMul(l),b=p.redSqr().redISub(h.redAdd(h)),v=h.redISub(b),y=p.redMul(v);y=y.redIAdd(y).redISub(d);var g=c.redMul(s);t+1<e&&(u=u.redMul(d)),a=b,s=g,c=y}return this.curve.jpoint(a,c.redMul(o),s)},f.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},f.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),a=o.redSqr(),i=this.x.redAdd(o).redSqr().redISub(n).redISub(a);i=i.redIAdd(i);var s=n.redAdd(n).redIAdd(n),u=s.redSqr().redISub(i).redISub(i),c=a.redIAdd(a);c=(c=c.redIAdd(c)).redIAdd(c),e=u,t=s.redMul(i.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.x.redSqr(),l=this.y.redSqr(),d=l.redSqr(),p=this.x.redAdd(l).redSqr().redISub(f).redISub(d);p=p.redIAdd(p);var h=f.redAdd(f).redIAdd(f),b=h.redSqr(),v=d.redIAdd(d);v=(v=v.redIAdd(v)).redIAdd(v),e=b.redISub(p).redISub(p),t=h.redMul(p.redISub(e)).redISub(v),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},f.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),a=o.redSqr(),i=this.x.redAdd(o).redSqr().redISub(n).redISub(a);i=i.redIAdd(i);var s=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=s.redSqr().redISub(i).redISub(i);e=u;var c=a.redIAdd(a);c=(c=c.redIAdd(c)).redIAdd(c),t=s.redMul(i.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.z.redSqr(),l=this.y.redSqr(),d=this.x.redMul(l),p=this.x.redSub(f).redMul(this.x.redAdd(f));p=p.redAdd(p).redIAdd(p);var h=d.redIAdd(d),b=(h=h.redIAdd(h)).redAdd(h);e=p.redSqr().redISub(b),r=this.y.redAdd(this.z).redSqr().redISub(l).redISub(f);var v=l.redSqr();v=(v=(v=v.redIAdd(v)).redIAdd(v)).redIAdd(v),t=p.redMul(h.redISub(e)).redISub(v)}return this.curve.jpoint(e,t,r)},f.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,o=n.redSqr().redSqr(),a=t.redSqr(),i=r.redSqr(),s=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(o)),u=t.redAdd(t),c=(u=u.redIAdd(u)).redMul(i),f=s.redSqr().redISub(c.redAdd(c)),l=c.redISub(f),d=i.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var p=s.redMul(l).redISub(d),h=r.redAdd(r).redMul(n);return this.curve.jpoint(f,p,h)},f.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),o=e.redAdd(e).redIAdd(e),a=o.redSqr(),i=this.x.redAdd(t).redSqr().redISub(e).redISub(n),s=(i=(i=(i=i.redIAdd(i)).redAdd(i).redIAdd(i)).redISub(a)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=o.redIAdd(i).redSqr().redISub(a).redISub(s).redISub(u),f=t.redMul(c);f=(f=f.redIAdd(f)).redIAdd(f);var l=this.x.redMul(s).redISub(f);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.y.redMul(c.redMul(u.redISub(c)).redISub(i.redMul(s)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var p=this.z.redAdd(i).redSqr().redISub(r).redISub(s);return this.curve.jpoint(l,d,p)},f.prototype.mul=function(e,t){return e=new o(e,t),this.curve._wnafMul(this,e)},f.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),o=r.redMul(e.z);return 0===this.y.redMul(o).redISub(e.y.redMul(n)).cmpn(0)},f.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),o=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(o),0===this.x.cmp(r))return!0}},f.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},5427:function(e,t,r){"use strict";var n,o=t,a=r(3715),i=r(8254),s=r(953).assert;function u(e){"short"===e.type?this.curve=new i.short(e):"edwards"===e.type?this.curve=new i.edwards(e):this.curve=new i.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,t){Object.defineProperty(o,e,{configurable:!0,enumerable:!0,get:function(){var r=new u(t);return Object.defineProperty(o,e,{configurable:!0,enumerable:!0,value:r}),r}})}o.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:a.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:a.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:a.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:a.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:a.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(1037)}catch(f){n=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:a.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},7954:function(e,t,r){"use strict";var n=r(3550),o=r(2156),a=r(953),i=r(5427),s=r(9931),u=a.assert,c=r(1251),f=r(611);function l(e){if(!(this instanceof l))return new l(e);"string"==typeof e&&(u(Object.prototype.hasOwnProperty.call(i,e),"Unknown curve "+e),e=i[e]),e instanceof i.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=l,l.prototype.keyPair=function(e){return new c(this,e)},l.prototype.keyFromPrivate=function(e,t){return c.fromPrivate(this,e,t)},l.prototype.keyFromPublic=function(e,t){return c.fromPublic(this,e,t)},l.prototype.genKeyPair=function(e){e||(e={});for(var t=new o({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||s(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),a=this.n.sub(new n(2));;){var i=new n(t.generate(r));if(!(i.cmp(a)>0))return i.iaddn(1),this.keyFromPrivate(i)}},l.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},l.prototype.sign=function(e,t,r,a){"object"==typeof r&&(a=r,r=null),a||(a={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new n(e,16));for(var i=this.n.byteLength(),s=t.getPrivate().toArray("be",i),u=e.toArray("be",i),c=new o({hash:this.hash,entropy:s,nonce:u,pers:a.pers,persEnc:a.persEnc||"utf8"}),l=this.n.sub(new n(1)),d=0;;d++){var p=a.k?a.k(d):new n(c.generate(this.n.byteLength()));if(!((p=this._truncateToN(p,!0)).cmpn(1)<=0||p.cmp(l)>=0)){var h=this.g.mul(p);if(!h.isInfinity()){var b=h.getX(),v=b.umod(this.n);if(0!==v.cmpn(0)){var y=p.invm(this.n).mul(v.mul(t.getPrivate()).iadd(e));if(0!==(y=y.umod(this.n)).cmpn(0)){var g=(h.getY().isOdd()?1:0)|(0!==b.cmp(v)?2:0);return a.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),g^=1),new f({r:v,s:y,recoveryParam:g})}}}}}},l.prototype.verify=function(e,t,r,o){e=this._truncateToN(new n(e,16)),r=this.keyFromPublic(r,o);var a=(t=new f(t,"hex")).r,i=t.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;var s,u=i.invm(this.n),c=u.mul(e).umod(this.n),l=u.mul(a).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(c,r.getPublic(),l)).isInfinity()&&s.eqXToP(a):!(s=this.g.mulAdd(c,r.getPublic(),l)).isInfinity()&&0===s.getX().umod(this.n).cmp(a)},l.prototype.recoverPubKey=function(e,t,r,o){u((3&r)===r,"The recovery param is more than two bits"),t=new f(t,o);var a=this.n,i=new n(e),s=t.r,c=t.s,l=1&r,d=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");s=d?this.curve.pointFromX(s.add(this.curve.n),l):this.curve.pointFromX(s,l);var p=t.r.invm(a),h=a.sub(i).mul(p).umod(a),b=c.mul(p).umod(a);return this.g.mulAdd(h,s,b)},l.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new f(t,n)).recoveryParam)return t.recoveryParam;for(var o=0;o<4;o++){var a;try{a=this.recoverPubKey(e,t,o)}catch(e){continue}if(a.eq(r))return o}throw new Error("Unable to find valid recovery factor")}},1251:function(e,t,r){"use strict";var n=r(3550),o=r(953).assert;function a(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=a,a.fromPublic=function(e,t,r){return t instanceof a?t:new a(e,{pub:t,pubEnc:r})},a.fromPrivate=function(e,t,r){return t instanceof a?t:new a(e,{priv:t,privEnc:r})},a.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},a.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},a.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},a.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},a.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?o(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||o(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},a.prototype.derive=function(e){return e.validate()||o(e.validate(),"public point not validated"),e.mul(this.priv).getX()},a.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},a.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},a.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},611:function(e,t,r){"use strict";var n=r(3550),o=r(953),a=o.assert;function i(e,t){if(e instanceof i)return e;this._importDER(e,t)||(a(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function s(){this.place=0}function u(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var o=0,a=0,i=t.place;a<n;a++,i++)o<<=8,o|=e[i],o>>>=0;return!(o<=127)&&(t.place=i,o)}function c(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function f(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}e.exports=i,i.prototype._importDER=function(e,t){e=o.toArray(e,t);var r=new s;if(48!==e[r.place++])return!1;var a=u(e,r);if(!1===a)return!1;if(a+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=u(e,r);if(!1===i)return!1;var c=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var f=u(e,r);if(!1===f)return!1;if(e.length!==f+r.place)return!1;var l=e.slice(r.place,f+r.place);if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}return this.r=new n(c),this.s=new n(l),this.recoveryParam=null,!0},i.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=c(t),r=c(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];f(n,t.length),(n=n.concat(t)).push(2),f(n,r.length);var a=n.concat(r),i=[48];return f(i,a.length),i=i.concat(a),o.encode(i,e)}},5980:function(e,t,r){"use strict";var n=r(3715),o=r(5427),a=r(953),i=a.assert,s=a.parseBytes,u=r(9087),c=r(3622);function f(e){if(i("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof f))return new f(e);e=o[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}e.exports=f,f.prototype.sign=function(e,t){e=s(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),o=this.g.mul(n),a=this.encodePoint(o),i=this.hashInt(a,r.pubBytes(),e).mul(r.priv()),u=n.add(i).umod(this.curve.n);return this.makeSignature({R:o,S:u,Rencoded:a})},f.prototype.verify=function(e,t,r){e=s(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),o=this.hashInt(t.Rencoded(),n.pubBytes(),e),a=this.g.mul(t.S());return t.R().add(n.pub().mul(o)).eq(a)},f.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return a.intFromLE(e.digest()).umod(this.curve.n)},f.prototype.keyFromPublic=function(e){return u.fromPublic(this,e)},f.prototype.keyFromSecret=function(e){return u.fromSecret(this,e)},f.prototype.makeSignature=function(e){return e instanceof c?e:new c(this,e)},f.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},f.prototype.decodePoint=function(e){var t=(e=a.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),n=0!=(128&e[t]),o=a.intFromLE(r);return this.curve.pointFromY(o,n)},f.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},f.prototype.decodeInt=function(e){return a.intFromLE(e)},f.prototype.isPoint=function(e){return e instanceof this.pointClass}},9087:function(e,t,r){"use strict";var n=r(953),o=n.assert,a=n.parseBytes,i=n.cachedProperty;function s(e,t){this.eddsa=e,this._secret=a(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=a(t.pub)}s.fromPublic=function(e,t){return t instanceof s?t:new s(e,{pub:t})},s.fromSecret=function(e,t){return t instanceof s?t:new s(e,{secret:t})},s.prototype.secret=function(){return this._secret},i(s,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),i(s,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),i(s,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),i(s,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),i(s,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),i(s,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),s.prototype.sign=function(e){return o(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},s.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},s.prototype.getSecret=function(e){return o(this._secret,"KeyPair is public only"),n.encode(this.secret(),e)},s.prototype.getPublic=function(e){return n.encode(this.pubBytes(),e)},e.exports=s},3622:function(e,t,r){"use strict";var n=r(3550),o=r(953),a=o.assert,i=o.cachedProperty,s=o.parseBytes;function u(e,t){this.eddsa=e,"object"!=typeof t&&(t=s(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),a(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof n&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}i(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),i(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),i(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),i(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return o.encode(this.toBytes(),"hex").toUpperCase()},e.exports=u},1037:function(e){e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},953:function(e,t,r){"use strict";var n=t,o=r(3550),a=r(9746),i=r(4504);n.assert=a,n.toArray=i.toArray,n.zero2=i.zero2,n.toHex=i.toHex,n.encode=i.encode,n.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var o=1<<t+1,a=e.clone(),i=0;i<n.length;i++){var s,u=a.andln(o-1);a.isOdd()?(s=u>(o>>1)-1?(o>>1)-u:u,a.isubn(s)):s=0,n[i]=s,a.iushrn(1)}return n},n.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,o=0,a=0;e.cmpn(-o)>0||t.cmpn(-a)>0;){var i,s,u=e.andln(3)+o&3,c=t.andln(3)+a&3;3===u&&(u=-1),3===c&&(c=-1),i=0==(1&u)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==c?u:-u,r[0].push(i),s=0==(1&c)?0:3!==(n=t.andln(7)+a&7)&&5!==n||2!==u?c:-c,r[1].push(s),2*o===i+1&&(o=1-o),2*a===s+1&&(a=1-a),e.iushrn(1),t.iushrn(1)}return r},n.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new o(e,"hex","le")}},7680:function(e){function t(e){return e}e.exports=function(e,r,n){r=r||t,n=n||e;for(var o=0,a=e.length;o<a;o+=1)if(r.call(n,e[o],o))return e[o]}},3715:function(e,t,r){var n=t;n.utils=r(6436),n.common=r(5772),n.sha=r(9041),n.ripemd=r(2949),n.hmac=r(2344),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},5772:function(e,t,r){"use strict";var n=r(6436),o=r(9746);function a(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=a,a.prototype.update=function(e,t){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var o=0;o<e.length;o+=this._delta32)this._update(e,o,o+this._delta32)}return this},a.prototype.digest=function(e){return this.update(this._pad()),o(null===this.pending),this._digest(e)},a.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var o=1;o<r;o++)n[o]=0;if(e<<=3,"big"===this.endian){for(var a=8;a<this.padLength;a++)n[o++]=0;n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=e>>>24&255,n[o++]=e>>>16&255,n[o++]=e>>>8&255,n[o++]=255&e}else for(n[o++]=255&e,n[o++]=e>>>8&255,n[o++]=e>>>16&255,n[o++]=e>>>24&255,n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=0,a=8;a<this.padLength;a++)n[o++]=0;return n}},2344:function(e,t,r){"use strict";var n=r(6436),o=r(9746);function a(e,t,r){if(!(this instanceof a))return new a(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}e.exports=a,a.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),o(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},a.prototype.update=function(e,t){return this.inner.update(e,t),this},a.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},2949:function(e,t,r){"use strict";var n=r(6436),o=r(5772),a=n.rotl32,i=n.sum32,s=n.sum32_3,u=n.sum32_4,c=o.BlockHash;function f(){if(!(this instanceof f))return new f;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function l(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function d(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function p(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}n.inherits(f,c),t.ripemd160=f,f.blockSize=512,f.outSize=160,f.hmacStrength=192,f.padLength=64,f.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],o=this.h[2],c=this.h[3],f=this.h[4],g=r,m=n,w=o,x=c,k=f,I=0;I<80;I++){var O=i(a(u(r,l(I,n,o,c),e[h[I]+t],d(I)),v[I]),f);r=f,f=c,c=a(o,10),o=n,n=O,O=i(a(u(g,l(79-I,m,w,x),e[b[I]+t],p(I)),y[I]),k),g=k,k=x,x=a(w,10),w=m,m=O}O=s(this.h[1],o,x),this.h[1]=s(this.h[2],c,k),this.h[2]=s(this.h[3],f,g),this.h[3]=s(this.h[4],r,m),this.h[4]=s(this.h[0],n,w),this.h[0]=O},f.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var h=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],b=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],v=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],y=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},9041:function(e,t,r){"use strict";t.sha1=r(4761),t.sha224=r(799),t.sha256=r(9344),t.sha384=r(772),t.sha512=r(5900)},4761:function(e,t,r){"use strict";var n=r(6436),o=r(5772),a=r(7038),i=n.rotl32,s=n.sum32,u=n.sum32_5,c=a.ft_1,f=o.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(d,f),e.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=i(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var o=this.h[0],a=this.h[1],f=this.h[2],d=this.h[3],p=this.h[4];for(n=0;n<r.length;n++){var h=~~(n/20),b=u(i(o,5),c(h,a,f,d),p,r[n],l[h]);p=d,d=f,f=i(a,30),a=o,o=b}this.h[0]=s(this.h[0],o),this.h[1]=s(this.h[1],a),this.h[2]=s(this.h[2],f),this.h[3]=s(this.h[3],d),this.h[4]=s(this.h[4],p)},d.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},799:function(e,t,r){"use strict";var n=r(6436),o=r(9344);function a(){if(!(this instanceof a))return new a;o.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(a,o),e.exports=a,a.blockSize=512,a.outSize=224,a.hmacStrength=192,a.padLength=64,a.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},9344:function(e,t,r){"use strict";var n=r(6436),o=r(5772),a=r(7038),i=r(9746),s=n.sum32,u=n.sum32_4,c=n.sum32_5,f=a.ch32,l=a.maj32,d=a.s0_256,p=a.s1_256,h=a.g0_256,b=a.g1_256,v=o.BlockHash,y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function g(){if(!(this instanceof g))return new g;v.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}n.inherits(g,v),e.exports=g,g.blockSize=512,g.outSize=256,g.hmacStrength=192,g.padLength=64,g.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=u(b(r[n-2]),r[n-7],h(r[n-15]),r[n-16]);var o=this.h[0],a=this.h[1],v=this.h[2],y=this.h[3],g=this.h[4],m=this.h[5],w=this.h[6],x=this.h[7];for(i(this.k.length===r.length),n=0;n<r.length;n++){var k=c(x,p(g),f(g,m,w),this.k[n],r[n]),I=s(d(o),l(o,a,v));x=w,w=m,m=g,g=s(y,k),y=v,v=a,a=o,o=s(k,I)}this.h[0]=s(this.h[0],o),this.h[1]=s(this.h[1],a),this.h[2]=s(this.h[2],v),this.h[3]=s(this.h[3],y),this.h[4]=s(this.h[4],g),this.h[5]=s(this.h[5],m),this.h[6]=s(this.h[6],w),this.h[7]=s(this.h[7],x)},g.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},772:function(e,t,r){"use strict";var n=r(6436),o=r(5900);function a(){if(!(this instanceof a))return new a;o.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(a,o),e.exports=a,a.blockSize=1024,a.outSize=384,a.hmacStrength=192,a.padLength=128,a.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},5900:function(e,t,r){"use strict";var n=r(6436),o=r(5772),a=r(9746),i=n.rotr64_hi,s=n.rotr64_lo,u=n.shr64_hi,c=n.shr64_lo,f=n.sum64,l=n.sum64_hi,d=n.sum64_lo,p=n.sum64_4_hi,h=n.sum64_4_lo,b=n.sum64_5_hi,v=n.sum64_5_lo,y=o.BlockHash,g=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function m(){if(!(this instanceof m))return new m;y.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=g,this.W=new Array(160)}function w(e,t,r,n,o){var a=e&r^~e&o;return a<0&&(a+=4294967296),a}function x(e,t,r,n,o,a){var i=t&n^~t&a;return i<0&&(i+=4294967296),i}function k(e,t,r,n,o){var a=e&r^e&o^r&o;return a<0&&(a+=4294967296),a}function I(e,t,r,n,o,a){var i=t&n^t&a^n&a;return i<0&&(i+=4294967296),i}function O(e,t){var r=i(e,t,28)^i(t,e,2)^i(t,e,7);return r<0&&(r+=4294967296),r}function E(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function S(e,t){var r=i(e,t,14)^i(e,t,18)^i(t,e,9);return r<0&&(r+=4294967296),r}function A(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function _(e,t){var r=i(e,t,1)^i(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function T(e,t){var r=s(e,t,1)^s(e,t,8)^c(e,t,7);return r<0&&(r+=4294967296),r}function P(e,t){var r=i(e,t,19)^i(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}function M(e,t){var r=s(e,t,19)^s(t,e,29)^c(e,t,6);return r<0&&(r+=4294967296),r}n.inherits(m,y),e.exports=m,m.blockSize=1024,m.outSize=512,m.hmacStrength=192,m.padLength=128,m.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var o=P(r[n-4],r[n-3]),a=M(r[n-4],r[n-3]),i=r[n-14],s=r[n-13],u=_(r[n-30],r[n-29]),c=T(r[n-30],r[n-29]),f=r[n-32],l=r[n-31];r[n]=p(o,a,i,s,u,c,f,l),r[n+1]=h(o,a,i,s,u,c,f,l)}},m.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],o=this.h[1],i=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],p=this.h[6],h=this.h[7],y=this.h[8],g=this.h[9],m=this.h[10],_=this.h[11],T=this.h[12],P=this.h[13],M=this.h[14],j=this.h[15];a(this.k.length===r.length);for(var C=0;C<r.length;C+=2){var N=M,D=j,R=S(y,g),B=A(y,g),L=w(y,g,m,_,T),K=x(y,g,m,_,T,P),U=this.k[C],F=this.k[C+1],W=r[C],q=r[C+1],z=b(N,D,R,B,L,K,U,F,W,q),G=v(N,D,R,B,L,K,U,F,W,q);N=O(n,o),D=E(n,o),R=k(n,o,i,s,u),B=I(n,o,i,s,u,c);var H=l(N,D,R,B),Y=d(N,D,R,B);M=T,j=P,T=m,P=_,m=y,_=g,y=l(p,h,z,G),g=d(h,h,z,G),p=u,h=c,u=i,c=s,i=n,s=o,n=l(z,G,H,Y),o=d(z,G,H,Y)}f(this.h,0,n,o),f(this.h,2,i,s),f(this.h,4,u,c),f(this.h,6,p,h),f(this.h,8,y,g),f(this.h,10,m,_),f(this.h,12,T,P),f(this.h,14,M,j)},m.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},7038:function(e,t,r){"use strict";var n=r(6436).rotr32;function o(e,t,r){return e&t^~e&r}function a(e,t,r){return e&t^e&r^t&r}function i(e,t,r){return e^t^r}t.ft_1=function(e,t,r,n){return 0===e?o(t,r,n):1===e||3===e?i(t,r,n):2===e?a(t,r,n):void 0},t.ch32=o,t.maj32=a,t.p32=i,t.s0_256=function(e){return n(e,2)^n(e,13)^n(e,22)},t.s1_256=function(e){return n(e,6)^n(e,11)^n(e,25)},t.g0_256=function(e){return n(e,7)^n(e,18)^e>>>3},t.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},6436:function(e,t,r){"use strict";var n=r(9746),o=r(5717);function a(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function i(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function s(e){return 1===e.length?"0"+e:e}function u(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=o,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),o=0;o<e.length;o+=2)r.push(parseInt(e[o]+e[o+1],16))}else for(var n=0,o=0;o<e.length;o++){var i=e.charCodeAt(o);i<128?r[n++]=i:i<2048?(r[n++]=i>>6|192,r[n++]=63&i|128):a(e,o)?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++o)),r[n++]=i>>18|240,r[n++]=i>>12&63|128,r[n++]=i>>6&63|128,r[n++]=63&i|128):(r[n++]=i>>12|224,r[n++]=i>>6&63|128,r[n++]=63&i|128)}else for(o=0;o<e.length;o++)r[o]=0|e[o];return r},t.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=s(e[r].toString(16));return t},t.htonl=i,t.toHex32=function(e,t){for(var r="",n=0;n<e.length;n++){var o=e[n];"little"===t&&(o=i(o)),r+=u(o.toString(16))}return r},t.zero2=s,t.zero8=u,t.join32=function(e,t,r,o){var a=r-t;n(a%4==0);for(var i=new Array(a/4),s=0,u=t;s<i.length;s++,u+=4){var c;c="big"===o?e[u]<<24|e[u+1]<<16|e[u+2]<<8|e[u+3]:e[u+3]<<24|e[u+2]<<16|e[u+1]<<8|e[u],i[s]=c>>>0}return i},t.split32=function(e,t){for(var r=new Array(4*e.length),n=0,o=0;n<e.length;n++,o+=4){var a=e[n];"big"===t?(r[o]=a>>>24,r[o+1]=a>>>16&255,r[o+2]=a>>>8&255,r[o+3]=255&a):(r[o+3]=a>>>24,r[o+2]=a>>>16&255,r[o+1]=a>>>8&255,r[o]=255&a)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(e,t,r,n,o){return e+t+r+n+o>>>0},t.sum64=function(e,t,r,n){var o=e[t],a=n+e[t+1]>>>0,i=(a<n?1:0)+r+o;e[t]=i>>>0,e[t+1]=a},t.sum64_hi=function(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,o,a,i,s){var u=0,c=t;return u+=(c=c+n>>>0)<t?1:0,u+=(c=c+a>>>0)<a?1:0,e+r+o+i+(u+=(c=c+s>>>0)<s?1:0)>>>0},t.sum64_4_lo=function(e,t,r,n,o,a,i,s){return t+n+a+s>>>0},t.sum64_5_hi=function(e,t,r,n,o,a,i,s,u,c){var f=0,l=t;return f+=(l=l+n>>>0)<t?1:0,f+=(l=l+a>>>0)<a?1:0,f+=(l=l+s>>>0)<s?1:0,e+r+o+i+u+(f+=(l=l+c>>>0)<c?1:0)>>>0},t.sum64_5_lo=function(e,t,r,n,o,a,i,s,u,c){return t+n+a+s+c>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},2156:function(e,t,r){"use strict";var n=r(3715),o=r(4504),a=r(9746);function i(e){if(!(this instanceof i))return new i(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=o.toArray(e.entropy,e.entropyEnc||"hex"),r=o.toArray(e.nonce,e.nonceEnc||"hex"),n=o.toArray(e.pers,e.persEnc||"hex");a(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}e.exports=i,i.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o<this.V.length;o++)this.K[o]=0,this.V[o]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},i.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},i.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},i.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=o.toArray(e,t),r=o.toArray(r,n),a(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},i.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=o.toArray(r,n||"hex"),this._update(r));for(var a=[];a.length<e;)this.V=this._hmac().update(this.V).digest(),a=a.concat(this.V);var i=a.slice(0,e);return this._update(r),this._reseed++,o.encode(i,t)}},5717:function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},9746:function(e){function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},4504:function(e,t){"use strict";var r=t;function n(e){return 1===e.length?"0"+e:e}function o(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(n=0;n<e.length;n++){var o=e.charCodeAt(n),a=o>>8,i=255&o;a?r.push(a,i):r.push(i)}return r},r.zero2=n,r.toHex=o,r.encode=function(e,t){return"hex"===t?o(e):e}},2719:function(e){var t=e.exports=function(e,r){if("function"==typeof e||r)return t.by(e,r);for(var n={object:[],function:[],string:{},number:{},boolean:{},undefined:{}},o=[],a=0;a<e.length;a++){var i=e[a],s="__proto__"===i?n.objects:n[typeof i]||n.objects;Array.isArray(s)?s.indexOf(i)<0&&(s.push(i),o.push(i)):Object.hasOwnProperty.call(s,i)||(s[i]=!0,o.push(i))}return o};t.by=function(e,t){if("function"==typeof e){var r=t;t=e,e=r}for(var n=[],o=0;o<e.length;o++){for(var a=e[o],i=!1,s=0;s<n.length;s++){var u=n[s];if(t.call(n,a,u)){i=!0;break}}i||n.push(a)}return n}},7635:function(e){"use strict";!function(t){var r=2147483647;function n(e){var t=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],r=1779033703,n=3144134277,o=1013904242,a=2773480762,i=1359893119,s=2600822924,u=528734635,c=1541459225,f=new Array(64);function l(e){for(var l=0,d=e.length;d>=64;){var p,h,b,v,y,g=r,m=n,w=o,x=a,k=i,I=s,O=u,E=c;for(h=0;h<16;h++)b=l+4*h,f[h]=(255&e[b])<<24|(255&e[b+1])<<16|(255&e[b+2])<<8|255&e[b+3];for(h=16;h<64;h++)v=((p=f[h-2])>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,y=((p=f[h-15])>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,f[h]=(v+f[h-7]|0)+(y+f[h-16]|0)|0;for(h=0;h<64;h++)v=(((k>>>6|k<<26)^(k>>>11|k<<21)^(k>>>25|k<<7))+(k&I^~k&O)|0)+(E+(t[h]+f[h]|0)|0)|0,y=((g>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10))+(g&m^g&w^m&w)|0,E=O,O=I,I=k,k=x+v|0,x=w,w=m,m=g,g=v+y|0;r=r+g|0,n=n+m|0,o=o+w|0,a=a+x|0,i=i+k|0,s=s+I|0,u=u+O|0,c=c+E|0,l+=64,d-=64}}l(e);var d,p=e.length%64,h=e.length/536870912|0,b=e.length<<3,v=p<56?56:120,y=e.slice(e.length-p,e.length);for(y.push(128),d=p+1;d<v;d++)y.push(0);return y.push(h>>>24&255),y.push(h>>>16&255),y.push(h>>>8&255),y.push(h>>>0&255),y.push(b>>>24&255),y.push(b>>>16&255),y.push(b>>>8&255),y.push(b>>>0&255),l(y),[r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255,c>>>24&255,c>>>16&255,c>>>8&255,c>>>0&255]}function o(e,t,r){var o;e=e.length<=64?e:n(e);var a=64+t.length+4,i=new Array(a),s=new Array(64),u=[];for(o=0;o<64;o++)i[o]=54;for(o=0;o<e.length;o++)i[o]^=e[o];for(o=0;o<t.length;o++)i[64+o]=t[o];for(o=a-4;o<a;o++)i[o]=0;for(o=0;o<64;o++)s[o]=92;for(o=0;o<e.length;o++)s[o]^=e[o];function c(){for(var e=a-1;e>=a-4;e--){if(i[e]++,i[e]<=255)return;i[e]=0}}for(;r>=32;)c(),u=u.concat(n(s.concat(n(i)))),r-=32;return r>0&&(c(),u=u.concat(n(s.concat(n(i))).slice(0,r))),u}function a(e,t,r,n,o){var a;for(c(e,16*(2*r-1),o,0,16),a=0;a<2*r;a++)u(e,16*a,o,16),s(o,n),c(o,0,e,t+16*a,16);for(a=0;a<r;a++)c(e,t+2*a*16,e,16*a,16);for(a=0;a<r;a++)c(e,t+16*(2*a+1),e,16*(a+r),16)}function i(e,t){return e<<t|e>>>32-t}function s(e,t){c(e,0,t,0,16);for(var r=8;r>0;r-=2)t[4]^=i(t[0]+t[12],7),t[8]^=i(t[4]+t[0],9),t[12]^=i(t[8]+t[4],13),t[0]^=i(t[12]+t[8],18),t[9]^=i(t[5]+t[1],7),t[13]^=i(t[9]+t[5],9),t[1]^=i(t[13]+t[9],13),t[5]^=i(t[1]+t[13],18),t[14]^=i(t[10]+t[6],7),t[2]^=i(t[14]+t[10],9),t[6]^=i(t[2]+t[14],13),t[10]^=i(t[6]+t[2],18),t[3]^=i(t[15]+t[11],7),t[7]^=i(t[3]+t[15],9),t[11]^=i(t[7]+t[3],13),t[15]^=i(t[11]+t[7],18),t[1]^=i(t[0]+t[3],7),t[2]^=i(t[1]+t[0],9),t[3]^=i(t[2]+t[1],13),t[0]^=i(t[3]+t[2],18),t[6]^=i(t[5]+t[4],7),t[7]^=i(t[6]+t[5],9),t[4]^=i(t[7]+t[6],13),t[5]^=i(t[4]+t[7],18),t[11]^=i(t[10]+t[9],7),t[8]^=i(t[11]+t[10],9),t[9]^=i(t[8]+t[11],13),t[10]^=i(t[9]+t[8],18),t[12]^=i(t[15]+t[14],7),t[13]^=i(t[12]+t[15],9),t[14]^=i(t[13]+t[12],13),t[15]^=i(t[14]+t[13],18);for(r=0;r<16;++r)e[r]+=t[r]}function u(e,t,r,n){for(var o=0;o<n;o++)r[o]^=e[t+o]}function c(e,t,r,n,o){for(;o--;)r[n++]=e[t++]}function f(e){if(!e||"number"!=typeof e.length)return!1;for(var t=0;t<e.length;t++){if("number"!=typeof e[t])return!1;var r=parseInt(e[t]);if(r!=e[t]||r<0||r>=256)return!1}return!0}function l(e,t){var r=parseInt(e);if(e!=r)throw new Error("invalid "+t);return r}e.exports=function(e,t,n,i,s,d,p){if(!p)throw new Error("missing callback");if(n=l(n,"N"),i=l(i,"r"),s=l(s,"p"),d=l(d,"dkLen"),0===n||0!=(n&n-1))throw new Error("N must be power of 2");if(n>r/128/i)throw new Error("N too large");if(i>r/128/s)throw new Error("r too large");if(!f(e))throw new Error("password must be an array or buffer");if(!f(t))throw new Error("salt must be an array or buffer");for(var h=o(e,t,128*s*i),b=new Uint32Array(32*s*i),v=0;v<b.length;v++){var y=4*v;b[v]=(255&h[y+3])<<24|(255&h[y+2])<<16|(255&h[y+1])<<8|(255&h[y+0])<<0}var g,m,w=new Uint32Array(64*i),x=new Uint32Array(32*i*n),k=32*i,I=new Uint32Array(16),O=new Uint32Array(16),E=s*n*2,S=0,A=null,_=!1,T=0,P=0,M=parseInt(1e3/i),j="undefined"!=typeof setImmediate?setImmediate:setTimeout,C=function(){if(_)return p(new Error("cancelled"),S/E);switch(T){case 0:c(b,m=32*P*i,w,0,k),T=1,g=0;case 1:(r=n-g)>M&&(r=M);for(var t=0;t<r;t++)c(w,0,x,(g+t)*k,k),a(w,k,i,I,O);if(g+=r,S+=r,(f=parseInt(1e3*S/E))!==A){if(_=p(null,S/E))break;A=f}if(g<n)break;g=0,T=2;case 2:var r,f;for((r=n-g)>M&&(r=M),t=0;t<r;t++){var l=w[16*(2*i-1)]&n-1;u(x,l*k,w,k),a(w,k,i,I,O)}if(g+=r,S+=r,(f=parseInt(1e3*S/E))!==A){if(_=p(null,S/E))break;A=f}if(g<n)break;if(c(w,0,b,m,k),++P<s){T=0;break}for(h=[],t=0;t<b.length;t++)h.push(b[t]>>0&255),h.push(b[t]>>8&255),h.push(b[t]>>16&255),h.push(b[t]>>24&255);var v=o(e,h,d);return p(null,1,v)}j(C)};C()}}()},7716:function(e,t){"use strict";function r(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(c){return void r(c)}s.done?t(u):Promise.resolve(u).then(n,o)}function n(e){return function(){var t=this,n=arguments;return new Promise((function(o,a){var i=e.apply(t,n);function s(e){r(i,o,a,s,u,"next",e)}function u(e){r(i,o,a,s,u,"throw",e)}s(void 0)}))}}function o(){return o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o.apply(this,arguments)}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s={parse:function(e){for(var t=encodeURI(e),r=new Uint8Array(t.length),n=0,o=0;o<t.length;++o){var a=t.charCodeAt(o);37===a?(r[n++]=parseInt(t.slice(o+1,o+3),16),o+=2):r[n++]=a}return r.subarray(0,n)},stringify:function(e){for(var t="",r=0;r<e.length;++r){var n=e[r];t+="%"+(n>>4).toString(16)+(15&n).toString(16)}return decodeURIComponent(t)}};function u(e){var t=e.body,r=void 0===t?"":t,o=e.headers,a=void 0===o?{}:o,i=e.status,u=void 0===i?200:i,f=Promise.resolve(r),l={headers:c(a),ok:u>=200&&u<300,status:u,arrayBuffer:function(){return n((function*(){return yield f.then((function(e){return"string"==typeof e?s.parse(e).buffer:e}))}))()},json:function(){return n((function*(){return yield l.text().then((function(e){return JSON.parse(e)}))}))()},text:function(){return n((function*(){return yield f.then((function(e){return"string"==typeof e?e:s.stringify(new Uint8Array(e))}))}))()}};return l}function c(e){var t={forEach:function(t,r){for(var n=0,o=Object.keys(e);n<o.length;n++){var a=o[n];t.call(r,e[a],a)}},get:function(r){return t.has(r)?e[r]:null},has:function(t){return Object.prototype.hasOwnProperty.call(e,t)}};return t}t.hd=function(e){return function(){var t=n((function*(t,r){void 0===r&&(r={});var n=r,a=n.body,i=void 0===a?"":a,c=n.method,f=void 0===c?"GET":c,l=n.headers,d=void 0===l?{}:l,p=new URL(t),h=p.host,b={method:f,path:p.pathname+p.search,version:"HTTP/1.1",headers:o({},d,{host:h}),body:"string"==typeof i?s.parse(i):new Uint8Array(i)};return u(yield e(b))}));return function(e,r){return t.apply(this,arguments)}}()},t.O7=u,t.h6=function(e){for(var t={},r=0,n=Object.keys(e);r<n.length;r++){var o=n[r];t[o.toUpperCase()]=e[o]}null==t.OPTIONS&&(t.OPTIONS=function(){return{status:204,headers:a}});var a={"content-length":"0",allow:Object.keys(t).join(", ")};return function(e){var r=t[e.method];return null!=r?r(e):{status:405,headers:a}}},t.Fl=function(e,t){void 0===t&&(t=function(){return{status:404}});for(var r=[],n=0,o=Object.keys(e);n<o.length;n++){var a=o[n];r.push({regexp:new RegExp("^"+a+"$"),server:e[a]})}return function(e){for(var n,o=i(r);!(n=o()).done;){var a=n.value,s=a.regexp,u=a.server;if(s.test(e.path))return u(e)}return t(e)}},t.o3=function(e){return function(){var t=n((function*(t){var r=yield e(t),n=r.headers;return o({},r,{headers:o({},void 0===n?{}:n,{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"Accept, Authorization, Content-Type","Access-Control-Allow-Methods":"DELETE, GET, OPTIONS, POST, PUT"})})}));return function(e){return t.apply(this,arguments)}}()}},2956:function(e,t){"use strict";function r(){var e=[],t=!1;function r(){t&&(t=!1,e=e.slice())}return[function(t){r(),e.push(t);var n=!0;return function(){n&&(n=!1,r(),e.splice(e.indexOf(t),1))}},function(r){t=!0;for(var n=e,o=0;o<n.length;++o)n[o](r);t=!1}]}t.BU=r,t.j6=function(){var e={};return[function(t,n){var o=e[t];return null==o&&(o=e[t]=r()),o[0](n)},function(t,r){var n=e[t];null!=n&&n[1](r)}]}},6601:function(){},9214:function(){},7061:function(e,t,r){var n=r(8698).default;function o(){"use strict";e.exports=o=function(){return r},e.exports.__esModule=!0,e.exports.default=e.exports;var t,r={},a=Object.prototype,i=a.hasOwnProperty,s=Object.defineProperty||function(e,t,r){e[t]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",f=u.asyncIterator||"@@asyncIterator",l=u.toStringTag||"@@toStringTag";function d(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(t){d=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof w?t:w,a=Object.create(o.prototype),i=new C(n||[]);return s(a,"_invoke",{value:T(e,r,i)}),a}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=p;var b="suspendedStart",v="suspendedYield",y="executing",g="completed",m={};function w(){}function x(){}function k(){}var I={};d(I,c,(function(){return this}));var O=Object.getPrototypeOf,E=O&&O(O(N([])));E&&E!==a&&i.call(E,c)&&(I=E);var S=k.prototype=w.prototype=Object.create(I);function A(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function r(o,a,s,u){var c=h(e[o],e,a);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==n(l)&&i.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,s,u)}),(function(e){r("throw",e,s,u)})):t.resolve(l).then((function(e){f.value=e,s(f)}),(function(e){return r("throw",e,s,u)}))}u(c.arg)}var o;s(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(a,a):a()}})}function T(e,r,n){var o=b;return function(a,i){if(o===y)throw new Error("Generator is already running");if(o===g){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var s=n.delegate;if(s){var u=P(s,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===b)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var c=h(e,r,n);if("normal"===c.type){if(o=n.done?g:v,c.arg===m)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=g,n.method="throw",n.arg=c.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var a=h(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,m;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function M(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(M,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return x.prototype=k,s(S,"constructor",{value:k,configurable:!0}),s(k,"constructor",{value:x,configurable:!0}),x.displayName=d(k,l,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,k):(e.__proto__=k,d(e,l,"GeneratorFunction")),e.prototype=Object.create(S),e},r.awrap=function(e){return{__await:e}},A(_.prototype),d(_.prototype,f,(function(){return this})),r.AsyncIterator=_,r.async=function(e,t,n,o,a){void 0===a&&(a=Promise);var i=new _(p(e,t,n,o),a);return r.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},A(S),d(S,l,"Generator"),d(S,c,(function(){return this})),d(S,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=N,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),j(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},r}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},8698:function(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4687:function(e,t,r){var n=r(7061)();e.exports=n;try{regeneratorRuntime=n}catch(o){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},5352:function(e,t){"use strict";function r(e,t,r){var n;if(void 0===r&&(r={}),!t.codes){t.codes={};for(var o=0;o<t.chars.length;++o)t.codes[t.chars[o]]=o}if(!r.loose&&e.length*t.bits&7)throw new SyntaxError("Invalid padding");for(var a=e.length;"="===e[a-1];)if(--a,!(r.loose||(e.length-a)*t.bits&7))throw new SyntaxError("Invalid padding");for(var i=new(null!=(n=r.out)?n:Uint8Array)(a*t.bits/8|0),s=0,u=0,c=0,f=0;f<a;++f){var l=t.codes[e[f]];if(void 0===l)throw new SyntaxError("Invalid character "+e[f]);u=u<<t.bits|l,(s+=t.bits)>=8&&(s-=8,i[c++]=255&u>>s)}if(s>=t.bits||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return i}function n(e,t,r){void 0===r&&(r={});for(var n=r.pad,o=void 0===n||n,a=(1<<t.bits)-1,i="",s=0,u=0,c=0;c<e.length;++c)for(u=u<<8|255&e[c],s+=8;s>t.bits;)s-=t.bits,i+=t.chars[a&u>>s];if(s&&(i+=t.chars[a&u<<t.bits-s]),o)for(;i.length*t.bits&7;)i+="=";return i}Object.defineProperty(t,"__esModule",{value:!0});var o={chars:"0123456789ABCDEF",bits:4},a={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bits:5},i={chars:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bits:5},s={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bits:6},u={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bits:6},c={parse:function(e,t){return r(e.toUpperCase(),o,t)},stringify:function(e,t){return n(e,o,t)}},f={parse:function(e,t){return void 0===t&&(t={}),r(t.loose?e.toUpperCase().replace(/0/g,"O").replace(/1/g,"L").replace(/8/g,"B"):e,a,t)},stringify:function(e,t){return n(e,a,t)}},l={parse:function(e,t){return r(e,i,t)},stringify:function(e,t){return n(e,i,t)}},d={parse:function(e,t){return r(e,s,t)},stringify:function(e,t){return n(e,s,t)}},p={parse:function(e,t){return r(e,u,t)},stringify:function(e,t){return n(e,u,t)}},h={parse:r,stringify:n};t.base16=c,t.base32=f,t.base32hex=l,t.base64=d,t.base64url=p,t.codec=h},8597:function(e){"use strict";e.exports={i8:"6.5.4"}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},function(){"use strict";function e(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(c){return void r(c)}s.done?t(u):Promise.resolve(u).then(n,o)}function t(t){return function(){var r=this,n=arguments;return new Promise((function(o,a){var i=t.apply(r,n);function s(t){e(i,o,a,s,u,"next",t)}function u(t){e(i,o,a,s,u,"throw",t)}s(void 0)}))}}function n(e){if(Array.isArray(e))return e}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function a(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,t){return n(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return s}}(e,t)||a(e,t)||i()}var u=r(4687),c=r.n(u),f=(r(5136),r(3715)),l=r.n(f),d=r(2156),p=r.n(d);function h(e,t,r){var n;if(void 0===r&&(r={}),!t.codes){t.codes={};for(var o=0;o<t.chars.length;++o)t.codes[t.chars[o]]=o}if(!r.loose&&e.length*t.bits&7)throw new SyntaxError("Invalid padding");for(var a=e.length;"="===e[a-1];)if(--a,!(r.loose||(e.length-a)*t.bits&7))throw new SyntaxError("Invalid padding");for(var i=new(null!=(n=r.out)?n:Uint8Array)(a*t.bits/8|0),s=0,u=0,c=0,f=0;f<a;++f){var l=t.codes[e[f]];if(void 0===l)throw new SyntaxError("Invalid character "+e[f]);u=u<<t.bits|l,(s+=t.bits)>=8&&(s-=8,i[c++]=255&u>>s)}if(s>=t.bits||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return i}function b(e,t,r){void 0===r&&(r={});for(var n=r.pad,o=void 0===n||n,a=(1<<t.bits)-1,i="",s=0,u=0,c=0;c<e.length;++c)for(u=u<<8|255&e[c],s+=8;s>t.bits;)s-=t.bits,i+=t.chars[a&u>>s];if(s&&(i+=t.chars[a&u<<t.bits-s]),o)for(;i.length*t.bits&7;)i+="=";return i}var v={chars:"0123456789ABCDEF",bits:4},y={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bits:5},g={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bits:6},m={parse:function(e,t){return h(e.toUpperCase(),v,t)},stringify:function(e,t){return b(e,v,t)}},w={parse:function(e,t){return void 0===t&&(t={}),h(t.loose?e.toUpperCase().replace(/0/g,"O").replace(/1/g,"L").replace(/8/g,"B"):e,y,t)},stringify:function(e,t){return b(e,y,t)}},x={parse:function(e,t){return h(e,g,t)},stringify:function(e,t){return b(e,g,t)}},k=r(7716);const I=k.hd,O=k.O7,E=k.h6,S=k.Fl;k.o3;function A(){return A=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},A.apply(this,arguments)}var _="_yaob",T=1,P={};function M(e,t){Object.prototype.hasOwnProperty.call(e,_)?A(e[_],t):Object.defineProperty(e,_,{value:t})}function j(e){var t=e.prototype;if(!Object.prototype.hasOwnProperty.call(t,_)){M(t,{})}return e}function C(e){Object.prototype.hasOwnProperty.call(e,_)&&null!=e[_].localId||M(e,{localId:T++,bridges:[],listeners:{},watchers:{}});return e}function N(e){if(null==e[_])throw new TypeError("Not a bridgeable object");return C(e),e[_]}function D(e,t){null==t?t="":t+=".";for(var r=0,n=Object.getOwnPropertyNames(e);r<n.length;r++){var o=n[r],a=t+o;if(null!=P[a])throw new Error("A shared value named "+a+" already exists");P[a]=e[o],M(e[o],{shareId:a})}}function R(e,t){try{var r=K(e,t),n=U(e,r,t);return""!==r?{map:r,raw:n}:{raw:n}}catch(t){return B(e,t)}}function B(e,t){var r=K(e,t);return{map:r,raw:U(e,r,t),throw:!0}}function L(e,t,r,n){void 0===n&&(n=!1);var o=t.map,a=t.raw,i=null!=o?F(e,o,a,r,n):a;if(t.throw)throw i;return i}function K(e,t){switch(typeof t){case"boolean":case"number":case"string":return"";case"object":if(null===t)return"";if(t instanceof Date)return"d";if(t instanceof Error)return"e";if(t instanceof ArrayBuffer)return"ab";if(t instanceof Uint8Array)return"u8";if(t instanceof Map)return"M";if(t instanceof Set)return"S";if(null!=t[_])return null!=t[_].shareId?"s":"o";if(Array.isArray(t)){for(var r="",n=0;n<t.length;++n){var o=K(e,t[n]);if(""!==o&&""===r){r=[];for(var a=0;a<n;++a)r[a]=""}""!==r&&(r[n]=o)}return r}var i="";for(var s in t){var u=K(e,t[s]);""!==u&&(""===i&&(i={}),i[s]=u)}return i;case"undefined":return"u";case"function":return null!=t[_]&&null!=t[_].shareId?"s":"?";default:return"?"}}function U(e,t,r){switch(t){case"":return r;case"?":return typeof r;case"d":return r.toISOString();case"e":return function(e,t){var r=A({message:t.message,stack:t.stack},t),n=null;return t instanceof EvalError?n="EvalError":t instanceof RangeError?n="RangeError":t instanceof ReferenceError?n="ReferenceError":t instanceof SyntaxError?n="SyntaxError":t instanceof TypeError?n="TypeError":t instanceof URIError&&(n="URIError"),A({base:n},R(e,r))}(e,r);case"o":return e.getPackedId(r);case"s":return r[_].shareId;case"u":return null;case"ab":return x.stringify(new Uint8Array(r));case"u8":return x.stringify(r);case"M":return R(e,Array.from(r.entries()));case"S":return R(e,Array.from(r.values()));default:if(Array.isArray(t)){for(var n=[],o=0;o<t.length;++o)n[o]=U(e,t[o],r[o]);return n}var a={};for(var i in r)a[i]=i in t?U(e,t[i],r[i]):r[i];return a}}function F(e,t,r,n,o){switch(t){case"":return r;case"?":throw new TypeError("Unsupported value of type "+("string"==typeof r?r:"?")+" at "+n);case"d":return new Date(r);case"e":if("object"!=typeof r||null===r)throw new TypeError("Expecting an error description at "+n);return function(e,t,r){var n={EvalError:EvalError,RangeError:RangeError,ReferenceError:ReferenceError,SyntaxError:SyntaxError,TypeError:TypeError,URIError:URIError},o=new(null!=t.base&&n[t.base]||Error),a=L(e,t,r,!0);for(var i in a)o[i]=a[i];return o}(e,r,n);case"o":if(null===r)throw new TypeError("Closed bridge object at "+n);if("number"!=typeof r)throw new TypeError("Expecting a packedId at "+n);var a=e.getObject(-r);if(null==a)throw new RangeError("Invalid packedId "+r+" at "+n);return a;case"s":if("string"!=typeof r)throw new TypeError("Expecting a shareId at "+n);var i=P[r];if(null==i)throw new RangeError("Invalid shareId '"+r+"' at "+n);return i;case"u":return;case"ab":if("string"!=typeof r)throw new TypeError("Expecting a base64 string at "+n);return x.parse(r).buffer;case"u8":if("string"!=typeof r)throw new TypeError("Expecting a base64 string at "+n);return x.parse(r);case"M":if("object"!=typeof r||null===r)throw new TypeError("Expecting an Map description at "+n);return new Map(L(e,r,n));case"S":if("object"!=typeof r||null===r)throw new TypeError("Expecting an Set description at "+n);return new Set(L(e,r,n));default:if("object"!=typeof t||null===t)throw new TypeError("Invalid type information "+t+" at "+n);if("object"!=typeof r||null===r)throw new TypeError("Expecting an array or object at "+n);if(Array.isArray(t)){if(!Array.isArray(r))throw new TypeError("Expecting an array at "+n);for(var s=[],u=0;u<t.length;++u)!0===o&&"?"===t[u]||(s[u]=F(e,t[u],r[u],n+"["+u+"]",o));return s}var c={};for(var f in r)!0===o&&"?"===t[f]||(c[f]=f in t?F(e,t[f],r[f],n+"."+f,o):r[f]);return c}}var W={};function q(e,t,r){var n=N(e),o=n.closed,a=n.listeners;return o?function(){}:(null==a[t]?a[t]=[r]:a[t].push(r),function(){a[t]=a[t].filter((function(e){return e!==r}))})}function z(e){var t=N(e),r=t.listeners.close;if(null!=r)for(var n=0;n<r.length;n++){Y(e,r[n],void 0,!0)}t.closed=!0;for(var o=0,a=t.bridges;o<a.length;o++){a[o].emitClose(t.localId)}t.bridges=[],t.listeners={},t.watchers={}}function G(e,t,r){var n=N(e);if(n.closed)throw new Error("Cannot emit event on closed object");for(var o=0,a=n.bridges;o<a.length;o++){a[o].emitEvent(n.localId,t,r)}var i=n.listeners[t];if(null!=i)for(var s=0;s<i.length;s++){Y(e,i[s],r,"error"!==t)}}function H(e,t){var r=N(e);if(r.closed)throw new Error("Cannot update closed object");for(var n=0,o=r.bridges;n<o.length;n++){o[n].markDirty(r.localId,t)}for(var a in null!=t&&null!=r.watchers[t]&&(r.watchers[t].data=W),r.watchers){var i=r.watchers[a];try{var s=e[a];if(s!==i.data){i.data=s;for(var u=0,c=i.fs;u<c.length;u++){Y(e,c[u],i.data,!0)}}}catch(f){}}}function Y(e,t,r,n){try{var o=t(r);n&&null!=o&&"function"==typeof o.then&&o.then(void 0,(function(t){return G(e,"error",t)}))}catch(a){n&&G(e,"error",a)}}var J={};function V(e,t,r){var n=!1,o={};for(var a in r)try{var i=t[a];i!==r[a]&&(n=!0,o[a]=R(e,i),r[a]=i)}catch(s){o[a]=B(e,s),r[a]=J}return{dirty:n,props:o}}function X(e,t){var r,n={},o=(r=t.localId,{localId:T++,bridges:[],listeners:{},watchers:{},remoteId:r,errors:{},props:{}});for(var a in n[_]={value:o},t.props)n[a]={enumerable:e.hideProperties.indexOf(a)<0,get:Z(o,a)};for(var i=0,s=t.methods;i<s.length;i++){var u=s[i];n[u]={value:Q(e,o,u)}}return Object.create(Object.prototype,n)}function $(e,t,r){var n=t[_];for(var o in r)try{n.props[o]=L(e,r[o],o),n.errors[o]=!1}catch(a){n.props[o]=a,n.errors[o]=!0}}function Z(e,t){return function(){if(e.errors[t])throw e.props[t];return e.props[t]}}function Q(e,t,r){return function(){if(t.closed)return Promise.reject(new TypeError("Cannot call method '"+r+"' of closed proxy"));for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return e.emitCall(t.remoteId,r,o)}}var ee=function(){function e(e){var t=e.hideProperties,r=void 0===t?[]:t,n=e.sendMessage,o=e.throttleMs,a=void 0===o?0:o;this.hideProperties=r,this.sendMessage=n,this.throttleMs=a,this.proxies={},this.objects={},this.caches={},this.nextCallId=0,this.pendingCalls={},this.dirty={},this.message={},this.lastUpdate=0,this.sendPending=!1}var t=e.prototype;return t.close=function(e){for(var t in this.pendingCalls){this.pendingCalls[Number(t)].reject(e)}for(var r in this.proxies)z(this.proxies[Number(r)]);this.closed=!0},t.getObject=function(e){return e<0?this.proxies[-e]:this.objects[e]},t.getPackedId=function(e){var t=N(e);if(t.closed)return null;if(null!=t.remoteId&&null!=this.proxies[t.remoteId])return-t.remoteId;if(null==this.objects[t.localId]){this.objects[t.localId]=e;var r=function(e,t){for(var r={},n=Object.prototype,o=t;o!==n&&null!=o;o=Object.getPrototypeOf(o))for(var a=0,i=Object.getOwnPropertyNames(o);a<i.length;a++){var s=i[a];s===_||/^_/.test(s)||"constructor"===s||(r[s]=!0)}var u={},c=[],f={};for(var l in r)try{var d=t[l];"function"!=typeof d||null!=d[_]&&null!=d[_].shareId?(u[l]=d,f[l]=R(e,d)):c.push(l)}catch(p){u[l]=J,f[l]=B(e,p)}return{cache:u,create:{localId:N(t).localId,methods:c,props:f}}}(this,e),n=r.cache,o=r.create;this.caches[t.localId]=n,t.bridges.push(this),this.emitCreate(o,e)}return t.localId},t.markDirty=function(e,t){var r=this.caches[e];null!=t&&t in r&&(r[t]=J),this.dirty[e]={cache:r,object:this.objects[e]},this.wakeup()},t.emitClose=function(e){delete this.objects[e],delete this.caches[e],null==this.message.closed&&(this.message.closed=[]),this.message.closed.push(e),this.wakeup()},t.emitCreate=function(e,t){null==this.message.created&&(this.message.created=[]),this.message.created.push(e)},t.emitCall=function(e,t,r){var n=this,o=this.nextCallId++,a=A({callId:o,remoteId:e,name:t},R(this,r));return null==this.message.calls&&(this.message.calls=[]),this.message.calls.push(a),this.wakeup(),new Promise((function(e,r){n.pendingCalls[o]={name:t,resolve:e,reject:r}}))},t.emitEvent=function(e,t,r){var n=A({localId:e,name:t},R(this,r));null==this.message.events&&(this.message.events=[]),this.message.events.push(n),this.wakeup()},t.emitReturn=function(e,t,r){var n=A({callId:e},t?B(this,r):R(this,r));null==this.message.returns&&(this.message.returns=[]),this.message.returns.push(n),this.wakeup()},t.handleMessage=function(e){var t=this;if(e.created){for(var r=0,n=e.created;r<n.length;r++){var o=n[r];this.proxies[o.localId]=X(this,o)}for(var a=0,i=e.created;a<i.length;a++){var s=i[a];$(this,this.proxies[s.localId],s.props)}}if(e.changed){for(var u=0,c=e.changed;u<c.length;u++){var f=c[u],l=f.localId,d=f.props,p=this.proxies[l];if(null==p)throw new RangeError("Invalid localId "+l);$(this,p,d)}for(var h=0,b=e.changed;h<b.length;h++){var v=b[h];H(this.proxies[v.localId])}}if(e.events)for(var y=0,g=e.events;y<g.length;y++){var m=g[y],w=m.localId,x=m.name,k=0===w?this:this.proxies[w];if(null!=k)try{G(k,x,L(this,m,x))}catch(D){G(k,"error",D)}}if(e.calls)for(var I=function(e,r){var n=r[e],o=n.callId,a=n.remoteId,i=n.name;try{var s=t.objects[a];if(null==s)throw new TypeError("Cannot call method '"+i+"' of closed proxy (remote)");if("function"!=typeof s[i])throw new TypeError("'"+i+"' is not a function");var u=L(t,n,i+".arguments");Promise.resolve(s[i].apply(s,u)).then((function(e){return t.emitReturn(o,!1,e)}),(function(e){return t.emitReturn(o,!0,e)}))}catch(D){t.emitReturn(o,!0,D)}},O=0,E=e.calls;O<E.length;O++)I(O,E);if(e.returns)for(var S=0,A=e.returns;S<A.length;S++){var _=A[S],T=_.callId,P=this.pendingCalls[T];if(null==P)throw new RangeError("Invalid callId "+T);try{P.resolve(L(this,_,P.name+".return"))}catch(D){P.reject(D)}finally{delete this.pendingCalls[T]}}if(e.closed)for(var M=0,j=e.closed;M<j.length;M++){var C=j[M],N=this.proxies[C];if(null==N)return;delete this.proxies[C],z(N)}},t.sendNow=function(){if(!this.closed){for(var e in this.dirty){var t=Number(e),r=this.dirty[t],n=V(this,r.object,r.cache),o=n.dirty,a=n.props;if(o){var i={localId:t,props:a};null==this.message.changed&&(this.message.changed=[]),this.message.changed.push(i)}}var s=this.message;this.dirty={},this.message={},null==s.calls&&null==s.changed&&null==s.closed&&null==s.created&&null==s.events&&null==s.returns||this.sendMessage(s)}},t.wakeup=function(){var e=this;if(!this.sendPending){this.sendPending=!0;var t=this.lastUpdate+this.throttleMs-Date.now();setTimeout((function(){e.sendPending=!1,e.lastUpdate=Date.now(),e.sendNow()}),t<0?0:t)}},e}();j(ee);var te=function(){function e(e){var t=this;this._state=new ee(e),this._rootPromise=new Promise((function(e){return q(t._state,"root",e)}))}var t=e.prototype;return t.handleMessage=function(e){this._state.handleMessage(e)},t.getRoot=function(){return this._rootPromise},t.sendRoot=function(e){this._state.emitEvent(0,"root",e)},t.close=function(e){this._state.close(e)},e}();var re=function(e,t){return q(this,e,t)},ne=function(e,t){return function(e,t,r){var n=N(e),o=n.closed,a=n.watchers,i=e[t];return o?function(){}:(null==a[t]?a[t]={data:i,fs:[r]}:a[t].fs.push(r),function(){a[t].fs=a[t].fs.filter((function(e){return e!==r}))})}(this,e,t)};D({onMethod:re,watchMethod:ne});var oe=function(){function e(){}var t=e.prototype;return t._close=function(){z(this)},t._emit=function(e,t){return G(this,e,t)},t._update=function(e){H(this,e)},e}(),ae=oe.prototype;ae.on=re,ae.watch=ne,j(oe);var ie=r(4638);r(7635);function se(e){return se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},se(e)}function ue(e){var t=function(e,t){if("object"!==se(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==se(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===se(t)?t:String(t)}function ce(e,t,r){return(t=ue(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function le(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ue(n.key),n)}}function de(e,t,r){return t&&le(e.prototype,t),r&&le(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var pe=function(){function e(){fe(this,e)}return de(e,[{key:"getFirstWalletInfo",value:function(e){return this.allKeys.find((function(t){return t.type===e}))}},{key:"getWalletInfo",value:function(e){return this.allKeys.find((function(t){return t.id===e}))}},{key:"listWalletIds",value:function(){return this.allKeys.map((function(e){return e.id}))}}]),e}();function he(e){var t=e.length<10,r=!/[0-9]/.test(e),n=!/[a-z]/.test(e),o=!/[A-Z]/.test(e),a=(/[0-9]/.test(e)?10:0)+(/[A-Z]/.test(e)?26:0)+(/[a-z]/.test(e)?26:0)+(/[^0-9A-Za-z]/.test(e)?30:0);return{secondsToCrack:Math.pow(a,e.length)/1e6,tooShort:t,noNumber:r,noLowerCase:n,noUpperCase:o,passed:e.length>=16||!(t||r||o||n)}}function be(e){for(var t=e.toLowerCase().replace(/[ \f\r\n\t\v]+/g," ").replace(/ $/,"").replace(/^ /,""),r=0;r<t.length;++r){var n=t.charCodeAt(r);if(n<32||n>126)throw new Error("Bad characters in username")}return t}function ve(e){var r,n,o,a=this,i=!1,s=ce({next:(o=t(c().mark((function t(){var n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=r){t.next=4;break}return t.next=3,a.$internalStreamTransactions(e);case 3:r=t.sent;case 4:if(i){t.next=12;break}return t.next=7,r.next();case 7:if((n=t.sent).done){t.next=10;break}return t.abrupt("return",n);case 10:z(r),i=!0;case 12:return t.abrupt("return",{done:!0,value:void 0});case 13:case"end":return t.stop()}}),t)}))),function(){return o.apply(this,arguments)}),return:(n=t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return null==r||i||(z(r),i=!0),e.abrupt("return",{done:!0,value:void 0});case 2:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})},Symbol.asyncIterator,(function(){return s}));return s}function ye(e){switch(typeof e){case"function":case"object":return null==e?"null":Array.isArray(e)?"array":typeof e;case"string":return JSON.stringify(e);default:return String(e)}}function ge(e,t){return function(r){return null!=r?e(r):"function"==typeof t?t():t}}function me(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){for(var r=0;r<t.length;++r)if(e===t[r])return e;var n="Expected ";1!==t.length&&(n+="one of: ");for(var o=0;o<t.length;++o)o>0&&(n+=" | "),n+=JSON.stringify(t[o]);throw n+=", got "+ye(e),new TypeError(n)}}function we(e){if("boolean"!=typeof e)throw new TypeError("Expected a boolean, got "+ye(e));return e}function xe(e){if("number"!=typeof e)throw new TypeError("Expected a number, got "+ye(e));return e}function ke(e){if("string"!=typeof e)throw new TypeError("Expected a string, got "+ye(e));return e}D(pe.prototype,"AccountSync"),D({checkPasswordRules:he}),D({fixUsername:be}),D({streamTransactions:ve},"CurrencyWalletSync");var Ie=me(null);me(void 0);function Oe(e){return e}ge(Ie);function Ee(e,t,r){return e instanceof Error&&(null==e.insertStepAt&&(e.message+=" at ",e.insertStepAt=e.message.length),e.message=e.message.slice(0,e.insertStepAt)+t+e.message.slice(e.insertStepAt),e.insertStepAt+=r),e}function Se(e){return function(t){if(!Array.isArray(t))throw new TypeError("Expected an array, got "+ye(t));for(var r=[],n=0;n<t.length;++n)try{r[n]=e(t[n])}catch(o){throw Ee(o,"["+n+"]",0)}return r}}function Ae(e){if("function"==typeof e)return function(t){if("object"!=typeof t||null==t)throw new TypeError("Expected an object, got "+ye(t));for(var r={},n=Object.keys(t),o=0;o<n.length;++o){var a=n[o];if("__proto__"!==a)try{r[a]=e(t[a])}catch(i){throw Ee(i,"["+JSON.stringify(a)+"]",0)}}return r};var t=Object.keys(e);function r(r){return function(n){if("object"!=typeof n||null==n)throw new TypeError("Expected an object, got "+ye(n));var o,a={};if(r){var i=Object.keys(n);for(o=0;o<i.length;++o){var s=i[o];"__proto__"!==s&&(a[s]=n[s])}}for(o=0;o<t.length;++o){var u=t[o];try{a[u]=e[u](n[u])}catch(c){throw Ee(c,"."+u,0)}}return a}}var n=r(!1);return n.shape=e,n.withRest=r(!0),n}function _e(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){for(var r=0;r<t.length;r++)try{return t[r](e)}catch(n){if(r+1>=t.length)throw n}}}function Te(e,t){return function(r){try{return e(r)}catch(n){return"function"==typeof t?t():t}}}function Pe(e,t){return function(r){return je[Ce]>0?t(r):e(r)}}function Me(e){return function(t){null==je[Ce]&&Object.defineProperty(je,Ce,{value:0,writable:!0});try{return++je[Ce],e(t)}finally{--je[Ce]}}}var je="object"==typeof globalThis&&null!=globalThis?globalThis:JSON,Ce="function"==typeof Symbol?Symbol.for("uncleaning"):"uncleaning",Ne=Pe((function(e){if("string"!=typeof e&&!(e instanceof Date))throw new TypeError("Expected a date string, got "+ye(e));var t=new Date(e);if(null==t.toJSON())throw new TypeError("Invalid date format, got "+ye(e));return t}),(function(e){return e.toISOString()}));var De=Pe((function(e){return m.parse(ke(e))}),(function(e){return m.stringify(e).toLowerCase()})),Re=Pe((function(e){return w.parse(ke(e),{loose:!0})}),(function(e){return w.stringify(e,{pad:!1})})),Be=Pe((function(e){return x.parse(ke(e))}),(function(e){return x.stringify(e)})),Le=Ae({voucherId:ke,activates:Ne,created:Ne,ip:ke,ipDescription:ke,deviceDescription:ge(ke)}),Ke=Ae({encryptionType:xe,data_base64:Be,iv_hex:De}),Ue=Ae({created:ge(Ne),data_base64:Be,encryptionType:xe,iv_hex:De}),Fe=Ae({salt_hex:De,n:xe,r:xe,p:xe}),We=Ae({loginRequest:ge(Ae({appId:ke}).withRest),publicKey:Be,timeout:ge(xe)}).withRest,qe=Ae({publicKey:Be,box:Ke}),ze=Se(Be),Ge=Ae({data:Oe,challengeId:ge(ke),deviceDescription:ge(ke),otp:ge(ke),syncToken:ge(ke),voucherId:ge(ke),voucherAuth:ge(Be),loginId:ge(Be),loginAuth:ge(Be),userId:ge(Be),passwordAuth:ge(Be),pin2Id:ge(Be),pin2Auth:ge(Be),recovery2Id:ge(Be),recovery2Auth:ge(ze),loginIds:ge(Se(Be)),otpResetAuth:ge(ke),did:ge(ke),l1:ge(Be),lp1:ge(Be),lpin1:ge(Be),lra1:ge(Be),recoveryAuth:ge(Be)}),He=Ae({results:ge(Oe),status_code:xe,message:ke}),Ye=Ae({otpTimeout:ge(xe,604800),otpKey:Re}),Je=Ae({passwordAuth:Be,passwordAuthBox:Ke,passwordAuthSnrp:Fe,passwordBox:Ke,passwordKeySnrp:Fe}),Ve=Ae({pin2Id:Be}),Xe=Ae({pin2Id:ge(Be),pin2Auth:ge(Be),pin2Box:ge(Ke),pin2KeyBox:ge(Ke),pin2TextBox:Ke}),$e=Ae({recovery2Id:Be}),Ze=Ae({recovery2Id:Be,recovery2Auth:ze,recovery2Box:Ke,recovery2KeyBox:Ke,question2Box:Ke}),Qe=Ae({loginAuthBox:Ke,loginAuth:Be}),et=Ae({userId:Be,userTextBox:Ke}),tt=Ae({approvedVouchers:ge(Se(ke)),rejectedVouchers:ge(Se(ke))}),rt=Ae({keyBoxes:Se(Ke),newSyncKeys:ge(Se(ke),(function(){return[]}))}),nt=Ae({appId:ke,loginId:Be,parentBox:ge(Ke)}),ot=Ae({challengeId:ke,challengeUri:ke}),at=Ae({challengeId:ke,challengeUri:ge(ke)}),it=Ae({request:We,replies:Se(qe)}),st=me(!0),ut=Ae({appId:ke,created:Ne,loginId:Be,syncToken:ge(ke),children:ge(Se((function(e){return ut(e)}))),parentBox:ge(Ke),otpKey:ge(_e(st,Re)),otpResetDate:ge(Ne),otpTimeout:ge(xe),passwordAuthBox:ge(Ke),passwordAuthSnrp:ge(Fe),passwordBox:ge(_e(st,Ke)),passwordKeySnrp:ge(Fe),pin2Box:ge(_e(st,Ke)),pin2KeyBox:ge(Ke),pin2TextBox:ge(Ke),question2Box:ge(Ke),recovery2Box:ge(_e(st,Ke)),recovery2KeyBox:ge(Ke),loginAuthBox:ge(Ke),userId:ge(Be),userTextBox:ge(Ke),pendingVouchers:ge(Se(Le),(function(){return[]})),keyBoxes:ge(Se(Ue)),mnemonicBox:ge(Ke),rootKeyBox:ge(Ke),syncKeyBox:ge(Ke)}),ct=Se(Ae({loginId:Be,otpResetPending:ge(we,!1),pendingVouchers:ge(Se(Le),(function(){return[]})),recovery2Corrupt:ge(we,!1)})),ft=Ae({login_id:ge(Be),otp_reset_auth:ge(ke),otp_timeout_date:ge(Ne),reason:ge(me("ip","otp"),"otp"),voucher_activates:ge(Ne),voucher_auth:ge(Be),voucher_id:ge(ke)}),lt=Ae({otpResetDate:Ne}),dt=Ae({wait_seconds:ge(xe)}),pt=Ae({question2Box:Ke}),ht=Ae({loginId:Be,passwordAuthSnrp:ge(Fe),questionBox:ge(Ke),questionKeySnrp:ge(Fe),recoveryAuthSnrp:ge(Fe)}),bt=Me(Ke),vt=Me(qe),yt=Me(We),gt=Me(Ge),mt=Me(He),wt=Me(Ye),xt=Me(Je),kt=Me(Ve),It=Me(Xe),Ot=Me($e),Et=Me(Ze),St=Me(Qe),At=Me(et),_t=Me(tt),Tt=Me(rt),Pt=Me(nt),Mt=(Me(ot),Me(at),Me(it)),jt=Me(ut),Ct=Me(ct),Nt=Me(ft),Dt=Me(lt),Rt=Me(dt),Bt=Me(pt),Lt=Me(ht),Kt=Ae(Ke),Ut=Ae({loginId:Be,voucherAuth:Be,voucherId:ke,created:Ne,activates:Ne,status:me("pending","approved","rejected"),ip:ke,ipDescription:ke,deviceDescription:ge(ke)}),Ft=Ae({appId:ke,created:ge(Ne,(function(){return new Date})),loginId:Be,children:ge(Se((function(e){return Ft(e)})),(function(){return[]})),parentBox:ge(Ke),parentId:function(){},otpKey:ge(Re),otpResetAuth:ge(ke),otpResetDate:ge(Ne),otpTimeout:ge(xe),passwordAuth:ge(Be),passwordAuthBox:ge(Ke),passwordAuthSnrp:ge(Fe),passwordBox:ge(Ke),passwordKeySnrp:ge(Fe),pin2Id:ge(Be),pin2Auth:ge(Be),pin2Box:ge(Ke),pin2KeyBox:ge(Ke),pin2TextBox:ge(Ke),recovery2Id:ge(Be),recovery2Auth:ge(ze),question2Box:ge(Ke),recovery2Box:ge(Ke),recovery2KeyBox:ge(Ke),loginAuth:ge(Be),loginAuthBox:ge(Ke),userId:ge(Be),userTextBox:ge(Ke),keyBoxes:ge(Se(Ue),(function(){return[]})),mnemonicBox:ge(Ke),rootKeyBox:ge(Ke),syncKeyBox:ge(Ke),vouchers:ge(Se(Ut),(function(){return[]})),pinBox:ge(Ke),pinId:ge(ke),pinKeyBox:ge(Ke)}),Wt=Me(Ft),qt=Me(Kt),zt=r(8162),Gt=r.n(zt)()("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),Ht={parse:function(e){return Gt.decode(e)},stringify:function(e){return Gt.encode(e)}},Yt={parse:function(e){for(var t=encodeURI(e),r=new Uint8Array(t.length),n=0,o=0;o<t.length;++o){var a=t.charCodeAt(o);37===a?(r[n++]=parseInt(t.slice(o+1,o+3),16),o+=2):r[n++]=a}return r.subarray(0,n)},stringify:function(e){for(var t="",r=0;r<e.length;++r){var n=e[r];t+="%"+(n>>4).toString(16)+(15&n).toString(16)}return decodeURIComponent(t)}};function Jt(e){var t=new URL(e);if("http:"!==t.protocol||"localhost"!==t.hostname){if("https:"===t.protocol){if("localhost"===t.hostname)return;if(/^([A-Za-z0-9_-]+\.)*edge(test)?\.app$/.test(t.hostname))return}throw new Error("Only *.edge.app or localhost are valid login domain names, not ".concat(t.hostname))}}function Vt(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Login requires a CAPTCHA";if(!(this instanceof Vt))throw new TypeError("Class constructor ChallengeError cannot be invoked without 'new'");return function(e){t=new Error(e),Object.defineProperty(t,"constructor",{value:Vt,configurable:!0,writable:!0})}(r),t.name="ChallengeError",t.challengeId=e.challengeId,t.challengeUri=e.challengeUri,t}function Xt(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Cannot reach the network";if(!(this instanceof Xt))throw new TypeError("Class constructor NetworkError cannot be invoked without 'new'");return function(t){e=new Error(t),Object.defineProperty(e,"constructor",{value:Xt,configurable:!0,writable:!0})}(t),e.name="NetworkError",e}function $t(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"The application is too old. Please upgrade.";if(!(this instanceof $t))throw new TypeError("Class constructor ObsoleteApiError cannot be invoked without 'new'");return function(t){e=new Error(t),Object.defineProperty(e,"constructor",{value:$t,configurable:!0,writable:!0})}(t),e.name="ObsoleteApiError",e}function Zt(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Invalid OTP token";if(!(this instanceof Zt))throw new TypeError("Class constructor OtpError cannot be invoked without 'new'");!function(e){t=new Error(e),Object.defineProperty(t,"constructor",{value:Zt,configurable:!0,writable:!0})}(r),t.name="OtpError",t.reason="otp";var n=Te(ft)(e);if(null!=n)return null!=n.login_id&&(t.loginId=x.stringify(n.login_id)),t.resetToken=n.otp_reset_auth,t.reason=n.reason,t.resetDate=n.otp_timeout_date,t.voucherActivates=n.voucher_activates,null!=n.voucher_auth&&(t.voucherAuth=x.stringify(n.voucher_auth)),t.voucherId=n.voucher_id,t}function Qt(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Invalid password";if(!(this instanceof Qt))throw new TypeError("Class constructor PasswordError cannot be invoked without 'new'");!function(e){t=new Error(e),Object.defineProperty(t,"constructor",{value:Qt,configurable:!0,writable:!0})}(r),t.name="PasswordError";var n=Te(dt)(e);if(null!=n)return t.wait=n.wait_seconds,t}function er(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Invalid username";if(!(this instanceof er))throw new TypeError("Class constructor UsernameError cannot be invoked without 'new'");return function(t){e=new Error(t),Object.defineProperty(e,"constructor",{value:er,configurable:!0,writable:!0})}(t),e.name="UsernameError",e}function tr(e){return function(t){if(t instanceof Error&&t.name===e)return t}}tr("ChallengeError"),tr("DustSpendError");var rr=tr("InsufficientFundsError"),nr=(tr("NetworkError"),tr("NoAmountSpecifiedError"),tr("ObsoleteApiError"),tr("OtpError")),or=(tr("PasswordError"),tr("PendingFundsError")),ar=(tr("SameCurrencyError"),tr("SpendToSelfError"),tr("SwapAboveLimitError")),ir=tr("SwapBelowLimitError"),sr=tr("SwapCurrencyError"),ur=tr("SwapPermissionError"),cr=tr("UsernameError"),fr=r(8826);function lr(e,t){var r=l().hmac(l().sha256,t);return Uint8Array.from(r.update(e).digest())}function dr(e){var t=l().sha256();return Uint8Array.from(t.update(e).digest())}function pr(e,t){var r=e.length;if(r!==t.length)return!1;for(var n=0,o=0;o<r;++o)n|=e[o]^t[o];return 0===n}var hr=r.n(fr)().ModeOfOperation.cbc;function br(e,t){var r=vr(e,t);return 0===r[r.length-1]?Yt.stringify(r.subarray(0,-1)):Yt.stringify(r)}function vr(e,t){if(0!==e.encryptionType)throw new Error("Unknown encryption type");var r=e.iv_hex,n=e.data_base64,o=new hr(t,r).decrypt(n),a=1+o[0]+4,i=o[a-4]<<24|o[a-3]<<16|o[a-2]<<8|o[a-1],s=a+i+1,u=s+o[s-1],c=u+32;if(!pr(dr(o.subarray(0,u)),o.subarray(u,c)))throw new Error("Invalid checksum");if(!pr(gr(c),o.subarray(c)))throw new Error("Invalid PKCS7 padding");return o.subarray(a,a+i)}function yr(e,t,r){var n=31&e.random(1)[0],o=1+n+4,a=t.length,i=o+a+1,s=31&e.random(1)[0],u=i+s,c=u+32,f=gr(c),l=new Uint8Array(c+f.length);l.set(f,c),l[0]=n,l.set(e.random(n),1),l[o-4]=a>>24&255,l[o-3]=a>>16&255,l[o-2]=a>>8&255,l[o-1]=255&a,l.set(t,o),l[i-1]=s,l.set(e.random(s),i),l.set(dr(l.subarray(0,u)),u);var d=e.random(16);return{encryptionType:0,iv_hex:d,data_base64:new hr(r,d).encrypt(l)}}function gr(e){for(var t=new Uint8Array(16-(15&e)),r=0;r<t.length;++r)t[r]=t.length;return t}function mr(e,t,r){var n,o,a=function(e,t){var r=l().hmac(l().sha1,t);return Uint8Array.from(r.update(e).digest())}((n=t,o=Math.floor(n/4294967296),new Uint8Array([o>>24&255,o>>16&255,o>>8&255,255&o,n>>24&255,n>>16&255,n>>8&255,255&n])),e),i=15&a[19],s=((127&a[i])<<24|a[i+1]<<16|a[i+2]<<8|a[i+3]).toString();return(Array(r).join("0")+s).slice(-r)}function wr(e){return mr(e,(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now()/1e3)/30,6)}function xr(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.now,o=void 0===n?Date.now()/1e3:n,a=r.spread,i=void 0===a?1:a,s=o/30;if(t===mr(e,s,6))return!0;for(var u=1;u<=i;++u){if(t===mr(e,s-u,6))return!0;if(t===mr(e,s+u,6))return!0}return!1}function kr(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Ir(e){return function(e){if(Array.isArray(e))return o(e)}(e)||kr(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Or(){for(var e=[],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.concat.apply(e,Ir(r.filter((function(e){return null!=e}))))}function Er(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];Object.defineProperty(e,o,{writable:!0,configurable:!0,value:t[o]})}return e}function Sr(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Error("Timeout of ".concat(t,"ms exceeded"));return new Promise((function(n,o){var a=setTimeout((function(){return o(r)}),t);e.then((function(e){clearTimeout(a),n(e)}),(function(e){clearTimeout(a),o(e)}))}))}function Ar(e,t){return new Promise((function(r,n){var o=!1,a=[],i=[],s=setTimeout((function(){s=void 0,a.length>0&&(o=!0,r({results:a,errors:i}))}),t);function u(){var t=a.length+i.length===e.length;t&&null!=s&&clearTimeout(s),(t||null==s)&&(o=!0,a.length>0?r({results:a,errors:i}):n(i))}u();for(var c=0;c<e.length;c++){e[c].then((function(e){o||(a.push(e),u())}),(function(e){o||(i.push(e),u())}))}}))}function _r(e){var t=He(e);switch(t.status_code){case 0:return t.results;case 2:throw new er("Account already exists on server");case 3:throw new er("Account does not exist on server");case 4:case 5:throw new Qt(t.results);case 6:throw new Error("Invalid API key");case 8:throw new Zt(t.results);case 1e3:throw new $t;default:var r=Te(ot)(t.results);if(null!=r)throw new Vt(r);throw new Error("Server error: ".concat(t.message))}}function Tr(e,t,r,n){return Pr.apply(this,arguments)}function Pr(){return(Pr=t(c().mark((function e(t,r,n,o){var a,i,s,u,f,l,d,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=t.props.state.login.loginServers,i=Math.floor(255*Math.random()),u=new Error("No login servers available"),f=0;case 4:if(!(f<a.length)){e.next=19;break}return e.prev=5,l=(i+f)%a.length,e.next=9,Mr(t,a[l],r,n,o);case 9:return s=e.sent,e.abrupt("break",19);case 13:e.prev=13,e.t0=e.catch(5),u=e.t0;case 16:++f,e.next=4;break;case 19:if(null!=s){e.next=21;break}throw u;case 21:return d=s.status,e.next=24,s.json().catch((function(){throw new Error("Invalid reply JSON, HTTP status ".concat(d))}));case 24:return p=e.sent,e.abrupt("return",_r(p));case 26:case"end":return e.stop()}}),e,null,[[5,13]])})))).apply(this,arguments)}function Mr(e,t,r,n,o){var a=e.props,i=a.state,s=a.io,u=a.log,c=i.login,f=c.apiKey,l=c.apiSecret,d="GET"===r||null==o?void 0:JSON.stringify(gt(o)),p="Token ".concat(f);if(null!=l){var h="".concat(r,"\n/api").concat(n,"\n").concat(null!=d?d:""),b=lr(Yt.parse(h),l);p="HMAC ".concat(f," ").concat(x.stringify(b))}var v={body:d,method:r,headers:{"content-type":"application/json",accept:"application/json",authorization:p},corsBypass:"never"},y=Date.now(),g="".concat(t,"/api").concat(n);return Sr(s.fetch(g,v),3e4).then((function(e){var t=Date.now()-y;return u("".concat(r," ").concat(g," returned ").concat(e.status," in ").concat(t,"ms")),409===e.status&&u.crash("Login API conflict error",{path:n}),e}),(function(e){var t=Date.now()-y;throw u.error("".concat(r," ").concat(g," failed in ").concat(t,"ms, ").concat(String(e))),new Xt("Could not reach the auth server: ".concat(n))}))}function jr(e,t){var r=e.props.io,n=t.loginId,o=t.loginKey,a=r.random(32),i=yr(r,a,o);return{loginId:n,server:St({loginAuth:a,loginAuthBox:i}),serverPath:"/v2/login/secret",stash:{loginAuthBox:i}}}function Cr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e3;return e.props.output.scrypt.makeSnrp(t)}function Nr(e,t,r){return Dr.apply(this,arguments)}function Dr(){return(Dr=t(c().mark((function e(t,r,n){var o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"string"==typeof r&&(r=Yt.parse(r)),e.next=3,t.props.output.scrypt.timeScrypt(r,n);case 3:return o=e.sent,e.abrupt("return",o.hash);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Rr={salt_hex:Uint8Array.from([181,134,95,251,159,167,179,191,228,178,56,77,71,206,131,30,226,42,74,157,92,52,199,239,125,33,70,124,199,88,248,27]),n:16384,r:1,p:1};function Br(e){return{username:e,appId:"",loginId:new Uint8Array(0),pendingVouchers:[]}}function Lr(e,t){for(var r=e.props.state.login.stashes,n=0;n<r.length;n++){var o=r[n];if(o.username===t)return o}}function Kr(e,t){for(var r=e.props.state.login.stashes,n=0;n<r.length;n++){var o=r[n],a=dn(o,(function(e){return pr(e.loginId,t)}));if(null!=a)return{stashTree:o,stash:a}}throw new Error("Cannot find stash '".concat(x.stringify(t),"'"))}function Ur(e,t){var r=dn(e,(function(e){return pr(e.loginId,t)}));if(null!=r)return r;throw new Error("Cannot find child stash '".concat(x.stringify(t),"'"))}var Fr={};function Wr(e,t){return null==Fr[t]&&(Fr[t]=Nr(e,t,Rr)),Fr[t]}function qr(e,t){return zr.apply(this,arguments)}function zr(){return(zr=t(c().mark((function e(t,r){var n,o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=[],e.next=3,t.list("logins").then(ie.gQ);case 3:o=e.sent,a=0;case 5:if(!(a<o.length)){e.next=25;break}return i=o[a],e.prev=7,e.t0=n,e.t1=Vr,e.t2=JSON,e.next=13,t.getText(i);case 13:e.t3=e.sent,e.t4=e.t2.parse.call(e.t2,e.t3),e.t5=(0,e.t1)(e.t4),e.t0.push.call(e.t0,e.t5),e.next=22;break;case 19:e.prev=19,e.t6=e.catch(7),r.error("Could not load ".concat(i,": ").concat(String(e.t6)));case 22:a++,e.next=5;break;case 25:return e.abrupt("return",n);case 26:case"end":return e.stop()}}),e,null,[[7,19]])})))).apply(this,arguments)}function Gr(e,t){return Hr.apply(this,arguments)}function Hr(){return(Hr=t(c().mark((function e(t,r){var n,o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props,o=n.dispatch,a=n.io,e.next=3,a.disklet.list("logins").then(ie.gQ);case 3:i=e.sent,s=0;case 5:if(!(s<i.length)){e.next=25;break}return u=i[s],e.prev=7,e.t0=Vr,e.t1=JSON,e.next=12,a.disklet.getText(u);case 12:if(e.t2=e.sent,e.t3=e.t1.parse.call(e.t1,e.t2),!pr((0,e.t0)(e.t3).loginId,r)){e.next=18;break}return e.next=18,a.disklet.delete(u);case 18:e.next=22;break;case 20:e.prev=20,e.t4=e.catch(7);case 22:s++,e.next=5;break;case 25:o({type:"LOGIN_STASH_DELETED",payload:r});case 26:case"end":return e.stop()}}),e,null,[[7,20]])})))).apply(this,arguments)}function Yr(e,t){return Jr.apply(this,arguments)}function Jr(){return(Jr=t(c().mark((function e(t,r){var n,o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.props,o=n.dispatch,a=n.io,i=r.appId,s=r.loginId,""===i){e.next=4;break}throw new Error("Cannot save a login without an appId.");case 4:if(null!=s&&32===s.length){e.next=6;break}throw new Error("Invalid loginId");case 6:return e.next=8,a.disklet.setText("logins/".concat(Ht.stringify(s),".json"),JSON.stringify(Xr(r)));case 8:o({type:"LOGIN_STASH_SAVED",payload:r});case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Vr=Ae({appId:ke,created:ge(Ne),lastLogin:ge(Ne),loginId:Be,otpKey:ge(Re),otpResetDate:ge(Ne),otpTimeout:ge(xe),pendingVouchers:ge(Se(Le),(function(){return[]})),voucherId:ge(ke),voucherAuth:ge(Be),loginAuthBox:ge(Ke),parentBox:ge(Ke),passwordAuthBox:ge(Ke),passwordAuthSnrp:ge(Fe),passwordBox:ge(Ke),passwordKeySnrp:ge(Fe),pin2Key:ge(Pe((function(e){var t=ke(e);return"="!==e.slice(-1)?Ht.parse(t):x.parse(t)}),(function(e){return x.stringify(e)}))),pin2TextBox:ge(Ke),recovery2Key:ge(Be),userId:ge(Be),username:ge((function(e){return be(ke(e))})),children:ge(Se((function(e){return Vr(e)}))),keyBoxes:ge(Se(Ue)),mnemonicBox:ge(Ke),rootKeyBox:ge(Ke),syncKeyBox:ge(Ke)}),Xr=Me(Vr);function $r(e){if(null!=e.otpKey)return wr(e.otpKey)}function Zr(e,t){var r=t.otp,n=t.otpKey;return null!=r?r:null!=n?wr(w.parse(n,{loose:!0})):null!=e.otpKey?wr(e.otpKey):void 0}function Qr(e,t,r){return en.apply(this,arguments)}function en(){return(en=t(c().mark((function e(t,r,n){var o,a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.props.state.accounts[r],a=o.loginTree,i=o.sessionKey,s=a.otpKey,u=void 0===s?t.props.io.random(10):s,f={loginId:a.loginId,server:wt({otpKey:u,otpTimeout:n}),serverPath:"/v2/login/otp",stash:{otpKey:u,otpResetDate:void 0,otpTimeout:n}},e.next=5,xn(t,i,f);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function tn(e,t){return rn.apply(this,arguments)}function rn(){return(rn=t(c().mark((function e(t,r){var n,o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props.state.accounts[r],o=n.loginTree,a=n.sessionKey,i={loginId:o.loginId,server:void 0,serverMethod:"DELETE",serverPath:"/v2/login/otp",stash:{otpKey:void 0,otpResetDate:void 0,otpTimeout:void 0}},e.next=4,xn(t,a,i);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function nn(e,t){return on.apply(this,arguments)}function on(){return(on=t(c().mark((function e(t,r){var n,o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.props.state.accounts[r],o=n.loginTree,a=n.sessionKey,i=o.otpTimeout,s=o.otpKey,null!=i&&null!=s){e.next=4;break}throw new Error("Cannot cancel 2FA reset: 2FA is not enabled.");case 4:return u={loginId:o.loginId,server:wt({otpTimeout:i,otpKey:s}),serverPath:"/v2/login/otp",stash:{otpResetDate:void 0}},e.next=7,xn(t,a,u);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function an(e,t,r){return sn.apply(this,arguments)}function sn(){return(sn=t(c().mark((function e(t,r,n){var o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wr(t,r);case 2:return e.t0=e.sent,e.t1=n,o={userId:e.t0,otpResetAuth:e.t1},e.next=7,Tr(t,"DELETE","/v2/login/otp",o);case 7:return a=e.sent,i=lt(a),s=i.otpResetDate,e.abrupt("return",s);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function un(e,t,r){return cn.apply(this,arguments)}function cn(){return cn=t(c().mark((function e(r,n,o){var a,i,s,u,f,l,d,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=r.props.state.accounts[n]){e.next=2;break}return e.abrupt("return");case 2:if(a=r.props.state.accounts[n].login,i=a.userId,s=a.passwordAuth,u=Kr(r,a.loginId),f=u.stashTree,l=u.stash,null!=s&&null!=i){e.next=7;break}throw new Error("Cannot repair OTP: There is no password on this account");case 7:return d={userId:i,passwordAuth:s,otp:wr(o)},p={now:f.lastLogin},e.next=11,mn(r,f,l,p,d,t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",a.loginKey);case 1:case"end":return e.stop()}}),e)}))));case 11:case"end":return e.stop()}}),e)}))),cn.apply(this,arguments)}function fn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ln(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fn(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function dn(e,t){if(t(e))return e;var r=e;if(null!=r.children)for(var n=0,o=r.children;n<o.length;n++){var a=dn(o[n],t);if(null!=a)return a}}function pn(e,t,r,n){if(t(e))return r(e);var o=null!=e.children?e.children.map((function(e){return pn(e,t,r,n)})):[];return n(e,o)}function hn(e,t,r){var n=e.children,o=void 0===n?[]:n,a=r.appId,i=r.created,s=r.loginId,u=r.loginAuthBox,c=r.userId,f=r.otpKey,l=r.otpResetDate,d=r.otpTimeout,p=r.pendingVouchers,h=r.parentBox,b=r.passwordAuthBox,v=r.passwordAuthSnrp,y=r.passwordBox,g=r.passwordKeySnrp,m=r.pin2TextBox,w=r.children,x=void 0===w?[]:w,k=r.keyBoxes,I=void 0===k?[]:k,O=r.mnemonicBox,E=r.rootKeyBox,S=r.syncKeyBox,A=r.syncToken,_={appId:a,created:i,loginId:s,loginAuthBox:u,userId:c,otpKey:!0===f?e.otpKey:f,otpResetDate:l,otpTimeout:d,pendingVouchers:p,parentBox:h,passwordAuthBox:b,passwordAuthSnrp:v,passwordBox:!0===y?e.passwordBox:y,passwordKeySnrp:g,pin2TextBox:m,keyBoxes:I,mnemonicBox:O,rootKeyBox:E,syncKeyBox:S,syncToken:A};null!=e.lastLogin&&(_.lastLogin=e.lastLogin),null!=e.username&&(_.username=e.username),null!=e.userId&&null==_.userId&&(_.userId=e.userId),null!=r.pin2KeyBox&&(_.pin2Key=vr(r.pin2KeyBox,t)),null!=r.recovery2KeyBox&&(_.recovery2Key=vr(r.recovery2KeyBox,t)),x.sort((function(e,t){return e.created.valueOf()-t.created.valueOf()})),_.children=x.map((function(e){var r=e.appId,n=e.loginId,a=e.parentBox;if(null==a)throw new Error("Key integrity violation: No parentBox on child login.");var i=vr(a,t),s=o.find((function(e){return pr(e.loginId,n)}));return hn(null!=s?s:{appId:r,loginId:n,pendingVouchers:[]},i,e)}));for(var T=function(){var e=o[P].loginId;if(null==x.find((function(t){return pr(t.loginId,e)})))throw new Error("The server has lost children!")},P=0;P<o.length;P++)T();return _}function bn(e,t,r){return pn(e,(function(e){return e.appId===r.appId}),(function(e){return hn(e,t,r)}),(function(e,t){return ln(ln({},e),{},{children:t})}))}function vn(e,t){var r=e.appId,n=e.created,o=e.lastLogin,a=void 0===o?new Date:o,i=e.loginId,s=e.otpKey,u=e.otpResetDate,c=e.otpTimeout,f=e.pendingVouchers,l=e.userId,d=e.username,p=e.children,h=void 0===p?[]:p,b={appId:r,created:n,isRoot:null==e.parentBox,lastLogin:a,loginId:i,loginKey:t,otpKey:s,otpResetDate:u,otpTimeout:c,pendingVouchers:f,userId:l,username:d,children:[]};if(null!=e.loginAuthBox&&(b.loginAuth=vr(e.loginAuthBox,t)),null!=e.passwordAuthBox&&(null==b.userId&&(b.userId=i),b.passwordAuth=vr(e.passwordAuthBox,t)),null==b.loginAuth&&null==b.passwordAuth)throw new Error("No server authentication methods on login");return b.pin2Key=e.pin2Key,null!=e.pin2TextBox&&(b.pin=br(e.pin2TextBox,t)),b.recovery2Key=e.recovery2Key,b.children=h.map((function(e){if(null==e.parentBox)throw new Error("Key integrity violation: No parentBox on child login.");return vn(e,vr(e.parentBox,t))})),b}function yn(e,t){return pn(e,(function(e){return pr(e.loginId,t.loginId)}),(function(e){return vn(e,t.loginKey)}),(function(e,t){var r=e.appId,n=e.lastLogin,o=void 0===n?new Date:n,a=e.loginId,i=e.pendingVouchers,s=e.username;return{appId:r,children:t,isRoot:null==e.parentBox,lastLogin:o,loginId:a,loginKey:undefined,pendingVouchers:i,username:s}}))}function gn(e,t){return pn(e,(function(e){return e.appId===t}),(function(e){return e}),(function(e,t){return{appId:e.appId,children:t,loginId:e.loginId,pendingVouchers:[],username:e.username}}))}function mn(e,t,r,n,o,a){return wn.apply(this,arguments)}function wn(){return wn=t(c().mark((function e(t,r,n,o,a,i){var s,u,f,l,d,p,h,b,v,y,g,m;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=o.now,u=void 0===s?new Date:s,f=t.props.state.login.deviceDescription,l=ln({challengeId:o.challengeId,otp:Zr(n,o),voucherId:n.voucherId,voucherAuth:n.voucherAuth},a),null!=f&&(l.deviceDescription=f),e.t0=ut,e.next=7,Tr(t,"POST","/v2/login",l).catch((function(e){var o=nr(e);throw null!=o&&(0===n.loginId.length&&null!=o.loginId||null!=o.voucherId&&null!=o.voucherAuth)&&(null!=o.loginId&&(n.loginId=x.parse(o.loginId)),null!=o.voucherAuth&&(n.voucherId=o.voucherId,n.voucherAuth=x.parse(o.voucherAuth)),r.lastLogin=u,Yr(t,r).catch((function(){}))),e}));case 7:return e.t1=e.sent,d=(0,e.t0)(e.t1),p=d.loginId,e.next=12,i(d);case 12:return h=e.sent,(r=bn(r,h,d)).lastLogin=u,e.next=17,Yr(t,r);case 17:if(null!=d.loginAuthBox){e.next=28;break}return b=Kr(t,p),v=b.stash,y=b.stashTree,g=jr(t,{loginId:p,loginKey:h}),m=ln(ln({},a),{},{otp:Zr(v,o),data:g.server}),e.t2=ut,e.next=24,Tr(t,"POST",g.serverPath,m);case 24:return e.t3=e.sent,d=(0,e.t2)(e.t3),e.next=28,Yr(t,bn(y,h,d));case 28:return e.abrupt("return",{loginId:p,loginKey:h});case 29:case"end":return e.stop()}}),e)}))),wn.apply(this,arguments)}function xn(e,t,r){return kn.apply(this,arguments)}function kn(){return(kn=t(c().mark((function e(t,r,n){var o,a,i,s,u,f,l,d;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=n.serverMethod,a=void 0===o?"POST":o,i=n.serverPath,s=Kr(t,n.loginId),u=s.stashTree,f=An(u,r,n.loginId),(l=_n(u,f)).data=n.server,e.next=7,Tr(t,a,i,l);case 7:return d=pn(u,(function(e){return pr(e.loginId,n.loginId)}),(function(e){return ln(ln(ln({},e),n.stash),{},{children:Or(e.children,n.stash.children),keyBoxes:Or(e.keyBoxes,n.stash.keyBoxes)})}),(function(e,t){return ln(ln({},e),{},{children:t})})),e.next=10,Yr(t,d);case 10:return e.abrupt("return",d);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function In(e,t,r){return On.apply(this,arguments)}function On(){return(On=t(c().mark((function e(t,r,n){var o,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=0;case 1:if(!(o<n.length)){e.next=10;break}if(null!=(a=n[o])){e.next=5;break}return e.abrupt("continue",7);case 5:return e.next=7,xn(t,r,a);case 7:o++,e.next=1;break;case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function En(e,t){return Sn.apply(this,arguments)}function Sn(){return(Sn=t(c().mark((function e(r,n){var o,a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=Kr(r,n.loginId),a=o.stashTree,i=o.stash,null==(s=i.syncToken)){e.next=13;break}return e.prev=3,e.next=6,Tr(r,"POST","/v2/sync",{loginId:i.loginId,syncToken:s});case 6:if(!we(e.sent)){e.next=9;break}return e.abrupt("return");case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(3);case 13:return u=_n(a,n),f={now:a.lastLogin},e.next=17,mn(r,a,i,f,u,t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.loginKey);case 1:case"end":return e.stop()}}),e)}))));case 17:case"end":return e.stop()}}),e,null,[[3,11]])})))).apply(this,arguments)}function An(e,t,r){var n;if(pr(r,t.loginId))return t;var o=Ur(e,t.loginId),a=function e(t,n){for(var o=0;o<t.length;o++){var a=t[o];if(null!=a.parentBox){if(pr(a.loginId,r))return{loginId:a.loginId,loginKey:vr(a.parentBox,n)};var i=a.children,s=void 0===i?[]:i;if(0!==s.length){var u=e(s,vr(a.parentBox,n));if(null!=u)return u}}}}(null!==(n=null==o?void 0:o.children)&&void 0!==n?n:[],t.loginKey);if(null==a)throw new Error("Cannot decrypt child login '".concat(x.stringify(t.loginId),"'"));return a}function _n(e,t){var r=Ur(e,t.loginId),n=r.loginAuthBox,o=r.otpKey,a=r.passwordAuthBox,i=r.syncToken,s=r.userId,u=r.voucherAuth,c=r.voucherId,f=null!=o?wr(o):void 0;if(null!=n)return{loginAuth:vr(n,t.loginKey),loginId:t.loginId,otp:f,syncToken:i,voucherAuth:u,voucherId:c};if(null!=a&&null!=s)return{passwordAuth:vr(a,t.loginKey),userId:s,otp:f,syncToken:i,voucherAuth:u,voucherId:c};throw new Error("No server authentication methods available")}var Tn=r(1649);Tn.bS,Tn.Ei,Tn.h8,Tn.wJ,Tn.PG,Tn.SR,Tn.Th,Tn.Qw,Tn.YK,Tn.KI,Tn.Wn,Tn.tp,Tn.RQ,Tn.tE,Tn.Jj;const Pn=Tn.LZ;Tn.m8;function Mn(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var jn="function"==typeof Symbol&&Symbol.observable||"@@observable",Cn=function(){return Math.random().toString(36).substring(7).split("").join(".")},Nn={INIT:"@@redux/INIT"+Cn(),REPLACE:"@@redux/REPLACE"+Cn(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Cn()}};function Dn(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Rn(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error(Mn(0));if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error(Mn(1));return r(Rn)(e,t)}if("function"!=typeof e)throw new Error(Mn(2));var o=e,a=t,i=[],s=i,u=!1;function c(){s===i&&(s=i.slice())}function f(){if(u)throw new Error(Mn(3));return a}function l(e){if("function"!=typeof e)throw new Error(Mn(4));if(u)throw new Error(Mn(5));var t=!0;return c(),s.push(e),function(){if(t){if(u)throw new Error(Mn(6));t=!1,c();var r=s.indexOf(e);s.splice(r,1),i=null}}}function d(e){if(!Dn(e))throw new Error(Mn(7));if(void 0===e.type)throw new Error(Mn(8));if(u)throw new Error(Mn(9));try{u=!0,a=o(a,e)}finally{u=!1}for(var t=i=s,r=0;r<t.length;r++){(0,t[r])()}return e}return d({type:Nn.INIT}),(n={dispatch:d,subscribe:l,getState:f,replaceReducer:function(e){if("function"!=typeof e)throw new Error(Mn(10));o=e,d({type:Nn.REPLACE})}})[jn]=function(){var e,t=l;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Mn(11));function r(){e.next&&e.next(f())}return r(),{unsubscribe:t(r)}}})[jn]=function(){return this},e},n}function Bn(e){function t(t){var r=void 0,n=void 0,o=!0,a=!1,i=!1,s=void 0,u=void 0,c=void 0;function f(){if(r){try{if(u){var e=u;s=void 0,u=void 0,c=void 0,e(((n=new Error("Pixie has been destroyed")).name="PixieShutdownError",n))}var t=r;r=void 0,t.destroy()}catch(n){l(n)}i=!0}var n}function l(e){i||t.onError(e),f()}function d(){a=!1,p()}function p(){for(;r&&o&&!a;){o=!1,a=!0;try{var e=r.update(n);e&&"function"==typeof e.then?e.then(d,l):a=!1}catch(t){l(t)}}}function h(){return s||(s=new Promise((function(e,t){c=e,u=t}))),s}var b={onError:l,onOutput:function(e){i||t.onOutput(e)},get props(){return n},nextProps:h,waitFor:function(e){return new Promise((function(t,r){return function o(){try{var a=e(n);null!=a?t(a):h().then(o,r)}catch(i){r(i)}}()}))}};try{r=function(e){return"function"==typeof e?{update:e,destroy:function(){}}:e}(e(b))}catch(v){l(v)}return{update:function(e){if(n=e,o=!0,c){var t=c;s=void 0,u=void 0,c=void 0,t(e)}p()},destroy:f}}return t.tame=!0,t.defaultOutput=e.defaultOutput,t}function Ln(e){return e.tame?e:Bn(e)}function Kn(e,t,r){r(e)}var Un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fn=(function(){function e(e){this.value=e}function t(t){var r,n;function o(r,n){try{var i=t[r](n),s=i.value;s instanceof e?Promise.resolve(s.value).then((function(e){o("next",e)}),(function(e){o("throw",e)})):a(i.done?"return":"normal",i.value)}catch(u){a("throw",u)}}function a(e,t){switch(e){case"return":r.resolve({value:t,done:!0});break;case"throw":r.reject(t);break;default:r.resolve({value:t,done:!1})}(r=r.next)?o(r.key,r.arg):n=null}this._invoke=function(e,t){return new Promise((function(a,i){var s={key:e,arg:t,resolve:a,reject:i,next:null};n?n=n.next=s:(r=n=s,o(e,t))}))},"function"!=typeof t.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(e){return this._invoke("next",e)},t.prototype.throw=function(e){return this._invoke("throw",e)},t.prototype.return=function(e){return this._invoke("return",e)}}(),function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}()),Wn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};function qn(e){}function zn(e){}function Gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qn,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:zn;return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Kn,r=Ln(e);function n(e){var n=e.onOutput,o=void 0,a=void 0,i=function(){var e=o;o=void 0,e&&e.destroy()},s={onError:function(r){i();try{t(r,a,e.onError)}catch(r){e.onError(r)}},onOutput:n};return{update:function(e){a=e,o||(o=r(s)),o.update(e)},destroy:i}}return n.tame=!0,n.defaultOutput=e.defaultOutput,n}(function(e){var t=Ln(e);function r(r){var n=r.onError,o=void 0,a=e.defaultOutput,i=void 0,s=!0,u=!1,c=function(){for(;o&&s&&!u;)s=!1,u=!0,o.update(Wn({},i,{output:a})),u=!1},f={onError:n,onOutput:function(e){e!==a&&(a=e,s=!0,r.onOutput(e),c())}};return{update:function(e){i=e,s=!0,o||(o=t(f)),c()},destroy:function(){var e=o;o=void 0,e&&e.destroy()}}}return r.tame=!0,r.defaultOutput=e.defaultOutput,r}(e))({onError:t,onOutput:r})}function Hn(e,t,r,n){var o=Gn(t,r,n);o.update({dispatch:e.dispatch,output:void 0,state:e.getState()});var a=e.subscribe((function(){o.update({dispatch:e.dispatch,output:void 0,state:e.getState()})}));return function(){a(),o.destroy()}}function Yn(e){var t={},r=Object.keys(e),n=Array.isArray(r),o=0;for(r=n?r:r[Symbol.iterator]();;){var a;if(n){if(o>=r.length)break;a=r[o++]}else{if((o=r.next()).done)break;a=o.value}var i=a;t[i]=e[i].defaultOutput}function s(r){var n=r.onError,o={},a={},i=Wn({},t),s=!1,u=function(){if(f){if(l>=c.length)return"break";d=c[l++]}else{if((l=c.next()).done)return"break";d=l.value}var t=d;if(o[t]={onError:n,onOutput:function(e){e!==i[t]&&((i=Wn({},i))[t]=e,r.onOutput(i))}},a[t]=Ln(e[t])(o[t]),s)return"break"},c=Object.keys(e),f=Array.isArray(c),l=0;for(c=f?c:c[Symbol.iterator]();;){var d;if("break"===u())break}return{update:function(e){var t=Object.keys(a),r=Array.isArray(t),n=0;for(t=r?t:t[Symbol.iterator]();;){var o;if(r){if(n>=t.length)break;o=t[n++]}else{if((n=t.next()).done)break;o=n.value}if(a[o].update(e),s)return}},destroy:function(){s=!0;var e=Object.keys(a),t=Array.isArray(e),r=0;for(e=t?e:e[Symbol.iterator]();;){var n;if(t){if(r>=e.length)break;n=e[r++]}else{if((r=e.next()).done)break;n=r.value}a[n].destroy()}}}}return s.tame=!0,s.defaultOutput=t,s}function Jn(e,t){return function(){try{return e.apply(void 0,arguments)}catch(r){t(r)}}}function Vn(e,t){if(e===t)return!0;if("object"!==(void 0===e?"undefined":Un(e)))return!1;if("object"!==(void 0===t?"undefined":Un(t)))return!1;if(!e||!t)return!1;var r=Object.getOwnPropertyNames(e);if(r.length!==Object.getOwnPropertyNames(t).length)return!1;var n=r,o=Array.isArray(n),a=0;for(n=o?n:n[Symbol.iterator]();;){var i;if(o){if(a>=n.length)break;i=n[a++]}else{if((a=n.next()).done)break;i=a.value}var s=i;if(!Object.prototype.hasOwnProperty.call(t,s)||e[s]!==t[s])return!1}return!0}function Xn(e,t){var r=Ln(e);function n(e){var n=e.onError,o=e.onOutput,a=void 0,i=void 0,s=!1,u=Jn(t,n),c={onError:n,onOutput:o};return{update:function(e){var t=u(e);if(!s){var n=!Vn(t,i);if(i=t,t){if(a||(a=r(c)),s)return;n&&a.update(t)}else a&&a.destroy(),a=void 0}},destroy:function(){s=!0,a&&a.destroy(),a=void 0}}}return n.tame=!0,n.defaultOutput=e.defaultOutput,n}function $n(e,t,r){var n=Ln(e);function o(e){var o=e.onError,a={},i={},s=!1,u={},c=!1,f=!1,l=Jn(t,o),d=Jn(r,o),p=function(){if(s&&!c){s=!1;var t={},r=Object.keys(a),n=Array.isArray(r),o=0;for(r=n?r:r[Symbol.iterator]();;){var u;if(n){if(o>=r.length)break;u=r[o++]}else{if((o=r.next()).done)break;u=o.value}var f=u;t[f]=i[f]}i=t,e.onOutput(i)}};return{update:function(e){var t=l(e);if(!f&&t){c=!0;var r={},h=function(){if(v){if(y>=b.length)return"break";g=b[y++]}else{if((y=b.next()).done)return"break";g=y.value}var t=g,c=d(e,t);if(f)return{v:void 0};var l=!Vn(c,u[t]);if(u[t]=c,c){if(!a[t]){if(a[t]=n({onError:o,onOutput:function(e){e!==i[t]&&(i[t]=e,s=!0,p())}}),f)return{v:void 0}}if(l&&a[t].update(c),f)return{v:void 0};r[t]=a[t]}};var b=t,v=Array.isArray(b),y=0;e:for(b=v?b:b[Symbol.iterator]();;){var g,m=h();if("break"===m)break e;if("object"===(void 0===m?"undefined":Un(m)))return m.v}var w=a;a=r;var x=Object.keys(w),k=Array.isArray(x),I=0;for(x=k?x:x[Symbol.iterator]();;){var O;if(k){if(I>=x.length)break;O=x[I++]}else{if((I=x.next()).done)break;O=I.value}var E=O;r[E]||(s=!0,w[E].destroy())}f||(c=!1,p())}},destroy:function(){f=!0;var e=Object.keys(a),t=Array.isArray(e),r=0;for(e=t?e:e[Symbol.iterator]();;){var n;if(t){if(r>=e.length)break;n=e[r++]}else{if((r=e.next()).done)break;n=r.value}var o=n;a[o]&&a[o].destroy()}}}}return o.tame=!0,o.defaultOutput={},o}!function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.props=t}Fn(e,[{key:"update",value:function(e,t){}},{key:"destroy",value:function(e,t){}}])}();var Zn={then:function(){}};function Qn(e){var r=Me(e);return{load:function(r,n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.t0=e,t.t1=JSON,t.next=5,r.getText(n);case 5:return t.t2=t.sent,t.t3=t.t1.parse.call(t.t1,t.t2),t.abrupt("return",(0,t.t0)(t.t3));case 10:t.prev=10,t.t4=t.catch(0);case 12:case"end":return t.stop()}}),t,null,[[0,10]])})))()},save:function(e,n,o){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.setText(n,JSON.stringify(r(o)));case 2:case"end":return t.stop()}}),t)})))()}}}var eo=function(e){if(null==e||"object"!==se(e))throw new TypeError("Expected a JSON object");return e},to="client.json",ro=Qn(Ae({clientId:Be})),no="infoCache.json",oo=Ae({corePlugins:Ae(eo),syncServers:Se(ke)}),ao=Qn(oo);function io(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function so(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?io(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):io(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function uo(e,t,r){return function(){for(var n="",o=0;o<arguments.length;++o){var a=arguments[o];o>0&&(n+=" "),"string"==typeof a?n+=a:a instanceof Error?n+=String(a):n+=JSON.stringify(a,null,2)}e({message:n,source:r,time:new Date,type:t})}}function co(e,t){return so(so({},e),{},{onLog:function(r){var n=t(),o=n.sources,a=n.defaultLogLevel,i=null!=o[r.source]?o[r.source]:a;switch(r.type){case"info":"info"===i&&e.onLog(r);break;case"warn":"info"!==i&&"warn"!==i||e.onLog(r);break;case"error":"silent"!==i&&e.onLog(r)}}})}function fo(e,t){var r=e.onLog,n=e.crashReporter;return Er(uo(r,"info",t),{breadcrumb:function(e,o){var a=new Date;null!=n?n.logBreadcrumb({message:e,metadata:o,source:t,time:a}):(e="".concat(e," ").concat(JSON.stringify(o,null,2)),r({message:e,source:t,time:a,type:"warn"}))},crash:function(e,o){var a=new Date;if(null!=n)n.logCrash({error:e,metadata:o,source:t,time:a});else{var i="".concat(String(e)," ").concat(JSON.stringify(o,null,2));r({message:i,source:t,time:a,type:"error"})}},warn:uo(r,"warn",t),error:uo(r,"error",t)})}function lo(e,t){return po.apply(this,arguments)}function po(){return(po=t(c().mark((function e(t,r){var n,o,a,i,u,f,l,d,p,h,b,v,y,g,m,w;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=[],e.next=3,t.disklet.list("Accounts").then(ie.ji);case 3:o=e.sent,a=0;case 5:if(!(a<o.length)){e.next=55;break}return i=o[a],u=(0,ie.HN)(t.disklet,i),e.t0=Promise,e.next=11,bo.load(u,"CarePackage.json");case 11:return e.t1=e.sent,e.next=14,vo.load(u,"LoginPackage.json");case 14:return e.t2=e.sent,e.next=17,yo.load(u,"OtpKey.json");case 17:return e.t3=e.sent,e.next=20,go.load(u,"Pin2Key.json");case 20:return e.t4=e.sent,e.next=23,mo.load(u,"Recovery2Key.json");case 23:return e.t5=e.sent,e.next=26,wo.load(u,"UserName.json");case 26:return e.t6=e.sent,e.t7=[e.t1,e.t2,e.t3,e.t4,e.t5,e.t6],e.next=30,e.t0.all.call(e.t0,e.t7);case 30:if(f=e.sent,l=s(f,6),d=l[0],p=l[1],h=l[2],b=l[3],v=l[4],null!=(y=l[5])){e.next=40;break}return e.abrupt("continue",52);case 40:if(g=be(y.userName),!r.has(g)){e.next=43;break}return e.abrupt("continue",52);case 43:return e.next=45,t.scrypt(Yt.parse(g),Rr.salt_hex,Rr.n,Rr.r,Rr.p,32);case 45:m=e.sent,w={appId:"",loginId:m,pendingVouchers:[],username:g},null!=d&&null!=p&&(w.passwordKeySnrp=d.SNRP2,w.passwordBox=p.EMK_LP2,w.syncKeyBox=p.ESyncKey,w.passwordAuthBox=p.ELP1),null!=h&&(w.otpKey=h.TOTP),null!=b&&(w.pin2Key=b.pin2Key),null!=v&&(w.recovery2Key=v.recovery2Key),n.push(w);case 52:a++,e.next=5;break;case 55:return e.abrupt("return",n);case 56:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ho=Pe((function(e){return Ht.parse(ke(e))}),(function(e){return Ht.stringify(e)})),bo=Qn(Ae({SNRP2:Fe,SNRP3:ge(Fe),SNRP4:ge(Fe),ERQ:ge(Ke)})),vo=Qn(Ae({EMK_LP2:Ke,EMK_LRA3:ge(Ke),ESyncKey:Ke,ELP1:Ke})),yo=Qn(Ae({TOTP:Re})),go=Qn(Ae({pin2Key:ho})),mo=Qn(Ae({recovery2Key:ho})),wo=Qn(Ae({userName:ke}));function xo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ko(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?xo(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xo(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Io={},Oo=!1,Eo=[],So=[];function Ao(){Oo=!0;for(var e=0;e<So.length;e++){(0,So[e])()}}function _o(e,t,r,n,o){var a=e.io,i=e.nativeIo,s=ko(ko({},a),{},{console:console});function u(e){for(var u={},c=0,f=Object.keys(e);c<f.length;c++){var l=f[c],d=e[l],p=fo(r,l),h=n[l];if(!1!==h&&null!=h)try{if("function"==typeof d){var b,v,y={infoPayload:null!==(b=null===(v=t.corePlugins)||void 0===v?void 0:v[l])&&void 0!==b?b:{},initOptions:"object"===se(h)?h:{},io:s,log:p,nativeIo:i,pluginDisklet:(0,ie.HN)(a.disklet,"plugins/"+l)};u[l]=d(y)}else{if("object"!==se(d)||null==d)throw new TypeError("Plugins must be functions or objects, got ".concat(se(d)));u[l]=d}}catch(g){p.error(g)}}o({type:"CORE_PLUGINS_ADDED",payload:u})}function c(){o({type:"CORE_PLUGINS_LOCKED",payload:n})}return u(Io),Oo&&c(),Eo.push(u),So.push(c),function(){Eo.filter((function(e){return e!==u})),So.filter((function(e){return e!==c}))}}function To(e,t){var r,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).onError,o=void 0===n?function(){}:n,a=!1;function i(){r=void 0,c.started&&(a=!0,new Promise((function(t){return t(e())})).catch(o).then(u,u))}function s(e){a=!1,c.started&&(r=setTimeout(i,e))}function u(){s(t)}var c={started:!1,setDelay:function(e){t=e},start:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).wait;c.started=!0,a||null!=r||("number"==typeof e?s(e):!0===e?s(t):i())},stop:function(){c.started=!1,null!=r&&(clearTimeout(r),r=void 0)}};return c}function Po(e){return new Promise((function(t){return setTimeout((function(){return t(e)}),e)}))}function Mo(e,t){var r=jo(e,t);if(null==r)throw new Error("Cannot find a currency plugin for wallet type ".concat(t));return r}function jo(e,t){return Object.keys(e).find((function(r){return e[r].currencyInfo.walletType===t}))}function Co(e,t){var r=e.props,n=r.dispatch,o=r.state,a=o.plugins.currencyTools[t];if(null!=a)return a;var i=o.plugins.currency[t].makeCurrencyTools();return n({type:"CURRENCY_TOOLS_LOADED",payload:{pluginId:t,tools:i}}),i}function No(e){return Do.apply(this,arguments)}function Do(){return Do=t(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.waitFor((function(e){var t=e.state.plugins,r=t.init;if(t.locked){for(var n=e.state.plugins,o=n.currency,a=n.swap,i=[],s=0,u=Object.keys(r);s<u.length;s++){var c=u[s];!1!==r[c]&&null!=r[c]&&null==o[c]&&null==a[c]&&i.push(c)}if(i.length>0)throw new Error("The following plugins are missing or failed to load: "+i.join(", "));return!0}}));case 2:case"end":return e.stop()}}),e)}))),Do.apply(this,arguments)}new Set,new Map;var Ro=Ae({dataKey:Be,syncKey:Be}),Bo=Me(Ro);function Lo(e){var t=e.props.io;return{dataKey:t.random(32),syncKey:t.random(20)}}function Ko(e,r,n){var o={delete:function(e){return n.delete(e)},getData:function(e){return t(c().mark((function t(){var o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getText(e);case 2:return o=t.sent,a=Ke(JSON.parse(o)),t.abrupt("return",vr(a,r));case 5:case"end":return t.stop()}}),t)})))()},getText:function(e){return t(c().mark((function t(){var o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getText(e);case 2:return o=t.sent,a=Ke(JSON.parse(o)),t.abrupt("return",br(a,r));case 5:case"end":return t.stop()}}),t)})))()},list:function(e){return n.list(e)},setData:function(t,o){return n.setText(t,JSON.stringify(bt(yr(e,Uint8Array.from(o),r))))},setText:function(e,t){return this.setData(e,Yt.parse(t))}};return C(o),o}function Uo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var Fo=100;function Wo(e,t){return(0,ie.HN)(e.disklet,"local/"+Ht.stringify(x.parse(t)))}function qo(e,t){var r=t.dataKey,n=t.syncKey,o=(0,ie.HN)(e.disklet,"repos/"+Ht.stringify(dr(dr(n)))),a=(0,ie.HN)(o,"changes"),i=(0,ie.HN)(o,"data");return{dataKey:r,syncKey:n,baseDisklet:o,changesDisklet:a,dataDisklet:i,disklet:Ko(e,r,(0,ie.Cl)(a,i))}}function zo(e){var t={lastSync:0,lastHash:void 0};return e.baseDisklet.getText("status.json").then((function(e){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Uo(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Uo(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({lastSync:0},JSON.parse(e))})).catch((function(){return t}))}function Go(e,t){return Ho.apply(this,arguments)}function Ho(){return(Ho=t(c().mark((function e(t,r){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(Object.keys(r).map((function(e){var n=r[e];return null!=n?t.setText(e,JSON.stringify(bt(n))):t.delete(e)})));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Yo(e,t,r){return Jo.apply(this,arguments)}function Jo(){return Jo=t(c().mark((function e(r,n,o){var a,i,s,u,f,l,d,p,h,b,v,y,g;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=n.changesDisklet,i=n.dataDisklet,s=n.syncKey,e.next=3,Vo(a).then((function(e){return Promise.all(e.map(function(){var e=t(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=t,e.t1=Ke,e.t2=JSON,e.next=5,a.getText(t);case 5:return e.t3=e.sent,e.t4=e.t2.parse.call(e.t2,e.t3),e.t5=(0,e.t1)(e.t4),e.abrupt("return",{path:e.t0,box:e.t5});case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()))}));case 3:return u=e.sent,f=m.stringify(s).toLowerCase(),e.next=7,function(){if(0===u.length)return r.readRepo(f,o.lastHash);for(var e={},t=0;t<u.length;t++){var n=u[t];e[n.path]=bt(n.box)}return r.updateRepo(f,o.lastHash,{changes:e})}();case 7:for(l=e.sent,d=l.hash,p={},h=0,b=Object.keys(null!==(v=l.changes)&&void 0!==v?v:{});h<b.length;h++)y=b[h],g=l.changes[y],p[y]=null==g?null:Ke(g);return e.next=13,Go(i,p);case 13:return e.next=15,Promise.all(u.map((function(e){return a.delete(e.path)})));case 15:return o.lastSync=Date.now()/1e3,null!=d&&(o.lastHash=d),e.next=19,n.baseDisklet.setText("status.json",JSON.stringify(o));case 19:return e.abrupt("return",{status:o,changes:p});case 20:case"end":return e.stop()}}),e)}))),Jo.apply(this,arguments)}function Vo(e){return Xo.apply(this,arguments)}function Xo(){return Xo=t(c().mark((function e(t){var r,n,o,a,i,s,u,f,l,d=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=d.length>1&&void 0!==d[1]?d[1]:"",n=d.length>2&&void 0!==d[2]?d[2]:Fo,e.next=4,t.list(r);case 4:o=e.sent,a=Object.keys(o).filter((function(e){return"file"===o[e]})),i=Object.keys(o).filter((function(e){return"folder"===o[e]})),s=0;case 8:if(!(s<i.length)){e.next=20;break}if(u=i[s],!(a.length>=n)){e.next=12;break}return e.abrupt("break",20);case 12:return f=n-a.length,e.next=15,Vo(t,u,f);case 15:l=e.sent,a.push.apply(a,Ir(l.slice(0,f)));case 17:s++,e.next=8;break;case 20:return e.abrupt("return",a);case 21:case"end":return e.stop()}}),e)}))),Xo.apply(this,arguments)}function $o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var Zo=3e4;function Qo(e,t){return ea.apply(this,arguments)}function ea(){return(ea=t(c().mark((function e(t,r){var n,o,a,i,s,u,f,l,d;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props,o=n.dispatch,a=n.io,i=n.onError,s=Ro(r.keys),u=qo(a,s),C(f=Wo(a,r.id)),e.next=7,zo(u);case 7:if(l=e.sent,o({type:"STORAGE_WALLET_ADDED",payload:{id:r.id,initialState:{localDisklet:f,paths:u,status:l,lastChanges:[]}}}),d=ta(t,r.id),!(l.lastSync>0)){e.next=14;break}d.catch((function(e){var n=r.keys.syncKey,o=l.lastHash;t.props.log.error("Could not sync ".concat(String(n)," with last hash ").concat(String(o),": ").concat(String(e))),i(e)})),e.next=16;break;case 14:return e.next=16,d;case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ta(e,t){var r=e.props,n=r.dispatch,o=r.syncClient,a=r.state.storageWallets[t];return Yo(o,a.paths,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$o(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},a.status)).then((function(e){var r=e.changes,o=e.status;return n({type:"STORAGE_WALLET_SYNCED",payload:{id:t,changes:Object.keys(r),status:o}}),Object.keys(r)}))}function ra(e,t){return e.storageWallets[t].lastChanges}function na(e,t){return e.storageWallets[t].paths.disklet}function oa(e,t){return e.storageWallets[t].localDisklet}function aa(e,t,r){return Ko(r,e.storageWallets[t].paths.dataKey,e.storageWallets[t].localDisklet)}function ia(e,t,r){var n=e.storageWallets[t].paths.dataKey;return Ht.stringify(lr(Yt.parse(r),n))}var sa=Ae({multiplier:ke,name:ke,symbol:ge(ke)}),ua=Ae({currencyCode:ke,denominations:Se(sa),displayName:ke,networkLocation:ge(eo)}),ca=Ae({enabled:ge(we,!0)}).withRest,fa=Ae({SortIndex:ge(xe,0),Archived:ge(we,!1),BitcoinSeed:De,MK:De,SyncKey:De}).withRest,la=Ae({id:ke,archived:ge(we),deleted:ge(we),hidden:ge(we),migratedFromWalletId:ge(ke),sortIndex:ge(xe)}),da=Ae({userSettings:ge(Ae(eo),(function(){return{}})),swapSettings:ge(Ae(ca),(function(){return{}}))}).withRest,pa=Ae({customTokens:Se(Ae({contractAddress:ke,currencyCode:ke,currencyName:ke,denomination:ke,denominations:Se(sa),isVisible:ge(we,!0),multiplier:ke,walletType:ge(ke,"wallet:ethereum")}))});function ha(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ba(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ha(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ha(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var va=Qn(Ae({customTokens:Ae(Ae(ua))})),ya=Qn(pa),ga="CustomTokens.json",ma="Settings.json",wa=Te(Ae({contractAddress:ke}));function xa(e,t,r){return ka.apply(this,arguments)}function ka(){return(ka=t(c().mark((function e(t,r,n){var o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Co(t,r);case 2:if(null==(o=e.sent).getTokenId){e.next=7;break}return e.next=6,o.getTokenId(n);case 6:return e.abrupt("return",e.sent);case 7:if(null!=(a=Ta(t,r))){e.next=10;break}throw new Error("A wallet must exist before adding tokens to a legacy currency plugin");case 10:if(null!=a.addCustomToken){e.next=12;break}throw new Error("".concat(r," doesn't support tokens"));case 12:if(null!=(i=Sa(n))){e.next=15;break}throw new Error("A token must have a contract address to be added to a legacy currency plugin");case 15:return e.next=17,a.addCustomToken(ba(ba({},i),n));case 17:return e.abrupt("return",Ia(i.contractAddress));case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ia(e){return e.toLowerCase().replace(/^0x/,"")}function Oa(e){for(var t={},r=0;r<e.length;r++){var n=e[r],o=n.contractAddress;null!=o&&(t[Ia(o)]={currencyCode:n.currencyCode,denominations:n.denominations,displayName:n.currencyName,networkLocation:{contractAddress:n.contractAddress}})}return t}function Ea(){for(var e,t,r,n,o,a,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=[],u=0,c=Object.keys(i);u<c.length;u++){var f=c[u];s.push((e=i[f],t=void 0,r=void 0,n=void 0,o=void 0,a=void 0,t=e.currencyCode,r=e.displayName,n=e.denominations,o=e.networkLocation,a=wa(o),{currencyCode:t,currencyName:r,denominations:n,contractAddress:null==a?void 0:a.contractAddress}))}return s}function Sa(e){var t=e.currencyCode,r=e.displayName,n=e.denominations,o=e.networkLocation,a=wa(o);if(null!=a)return{currencyCode:t,currencyName:r,multiplier:n[0].multiplier,contractAddress:a.contractAddress}}function Aa(e,t){return _a.apply(this,arguments)}function _a(){return _a=t(c().mark((function e(r,n){var o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=r.props,a=o.dispatch,i=o.state,e.next=3,Promise.all(Object.keys(i.plugins.currency).map(function(){var e=t(c().mark((function e(t){var r,o,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(o=i.plugins.currency[t]).getBuiltinTokens){e.next=5;break}e.t0=Oa(null!==(r=o.currencyInfo.metaTokens)&&void 0!==r?r:[]),e.next=8;break;case 5:return e.next=7,o.getBuiltinTokens();case 7:e.t0=e.sent;case 8:s=e.t0,a({type:"ACCOUNT_BUILTIN_TOKENS_LOADED",payload:{accountId:n,pluginId:t,tokens:s}});case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}}),e)}))),_a.apply(this,arguments)}function Ta(e,t){for(var r=0,n=Object.keys(e.props.state.currency.wallets);r<n.length;r++){var o=n[r],a=e.props.output.currency.wallets[o];if(null!=(null==a?void 0:a.engine)&&e.props.state.currency.wallets[o].pluginId===t)return a.engine}}function Pa(e,t){return Ma.apply(this,arguments)}function Ma(){return(Ma=t(c().mark((function e(t,r){var n,o,a,i,s,u,f,l,d,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props.state,o=n.accounts[r].accountWalletInfo,a=na(n,o.id),e.next=5,ya.load(a,ma);case 5:if(null!=(i=e.sent)){e.next=8;break}return e.abrupt("return",{});case 8:s={},u=0,f=i.customTokens;case 10:if(!(u<f.length)){e.next=23;break}if((l=f[u]).isVisible){e.next=14;break}return e.abrupt("continue",20);case 14:if(null!=(d=jo(n.plugins.currency,l.walletType))){e.next=17;break}return e.abrupt("continue",20);case 17:null==s[d]&&(s[d]={}),p=Ia(l.contractAddress),s[d][p]={currencyCode:l.currencyCode,denominations:l.denominations,displayName:l.currencyName,networkLocation:{contractAddress:l.contractAddress}};case 20:u++,e.next=10;break;case 23:return e.abrupt("return",s);case 24:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ja(e,t){return Ca.apply(this,arguments)}function Ca(){return(Ca=t(c().mark((function e(t,r){var n,o,a,i,s,u,f,l;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props,o=n.dispatch,a=n.state,i=a.accounts[r].accountWalletInfo,s=na(a,i.id),e.next=5,va.load(s,ga);case 5:if(null==(u=e.sent)){e.next=11;break}f=u.customTokens,o({type:"ACCOUNT_CUSTOM_TOKENS_LOADED",payload:{accountId:r,customTokens:f}}),e.next=15;break;case 11:return e.next=13,Pa(t,r);case 13:l=e.sent,o({type:"ACCOUNT_CUSTOM_TOKENS_LOADED",payload:{accountId:r,customTokens:l}});case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Na(e,t){return Da.apply(this,arguments)}function Da(){return(Da=t(c().mark((function e(t,r){var n,o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props.state,o=n.accounts[r].accountWalletInfo,a=na(n,o.id),i=t.props.state.accounts[r].customTokens,e.next=6,va.load(a,ga);case 6:return s=e.sent,e.next=9,va.save(a,ga,ba(ba({},s),{},{customTokens:i}));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ra=r(7591);function Ba(e){var t,r=e.currencyInfo,n=e.allTokens,o=e.tokenId;return void 0===o&&null!=e.currencyCode&&e.currencyCode!==r.currencyCode&&(o=Object.keys(n).find((function(t){return n[t].currencyCode===e.currencyCode}))),{currencyCode:(null==o?r:n[o]).currencyCode,tokenId:null!==(t=o)&&void 0!==t?t:null}}function La(e){return null!=e.networkFee&&null==e.networkFee.tokenId&&(e.networkFee.tokenId=e.request.fromTokenId),e}var Ka=function(e){null!=e.networkFees&&0!==e.networkFees.length||(e.networkFees=[{tokenId:e.tokenId,nativeAmount:e.networkFee}],null!=e.parentNetworkFee&&e.networkFees.push({tokenId:null,nativeAmount:e.parentNetworkFee}))};function Ua(e,r){var n=r.id,o=r.type,a=r.keys;return{id:n,type:o,keys:a,get disklet(){return na(e.props.state,n)},get localDisklet(){return oa(e.props.state,n)},sync:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ta(e,n);case 2:case"end":return t.stop()}}),t)})))()}}}function Fa(e,t,r){for(var n=0,o=e.denominations;n<o.length;n++){var a=o[n];if(a.name===r)return a.multiplier}for(var i=0,s=Object.keys(t);i<s.length;i++)for(var u=0,c=t[s[i]].denominations;u<c.length;u++){var f=c[u];if(f.name===r)return f.multiplier}return"1"}function Wa(e,t){return e.waitFor((function(e){if(null==e.state.currency.wallets[t])throw new Error("Wallet id ".concat(t," does not exist in this account"));var r=e.state.currency.wallets[t].engineFailure;if(null!=r)throw r;if(null!=e.output.currency.wallets[t])return e.output.currency.wallets[t].walletApi}))}var qa={"[object Float32Array]":!0,"[object Float64Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Int8Array]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0};function za(e,t,r){if("[object Object]"===r){if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var n=Object.getOwnPropertyNames(e);if(n.length!==Object.getOwnPropertyNames(t).length)return!1;for(var o=0;o<n.length;o++){var a=n[o];if(!Object.prototype.hasOwnProperty.call(t,a)||!Ga(e[a],t[a]))return!1}return!0}if("[object Array]"===r){if(e.length!==t.length)return!1;for(var i=0;i<e.length;++i)if(!Ga(e[i],t[i]))return!1;return!0}if("[object Date]"===r)return e.getTime()===t.getTime();if("[object Map]"===r)return function(e,t){if(e.size!==t.size)return!1;for(var r=0;r<e.length;r++){var n=s(e[r],2),o=n[0],a=n[1];if(!t.has(o)||t.get(o)!==a)return!1}return!0}(e,t);if(qa[r]){if(e.length!==t.length)return!1;for(var u=0;u<e.length;++u)if(e[u]!==t[u])return!1;return!0}return!1}function Ga(e,t){if(e===t)return!0;if("object"!==se(e))return!1;if("object"!==se(t))return!1;var r=Object.prototype.toString.call(e);return r===Object.prototype.toString.call(t)&&za(e,t,r)}var Ha=500,Ya=3,Ja=[];function Va(e){Ja.length<=0&&Xa();for(var t=!1,r=0;r<Ja.length;r++){var n=Ja[r];if(n.id===e.id&&n.action===e.action){n.updateFunc=e.updateFunc,t=!0;break}}t||Ja.push(e)}function Xa(){setTimeout((function(){for(var e=Math.min(Ya,Ja.length),t=0;t<e;t++){var r=Ja.shift();null!=r&&r.updateFunc()}Ja.length>0&&Xa()}),Ha)}function $a(e,t){for(var r,n,o,a,i,s,u={exchangeAmount:{}},c=u.exchangeAmount,f=void 0===c?{}:c,l=null!==(r=e.exchangeAmount)&&void 0!==r?r:{},d=null!==(n=t.exchangeAmount)&&void 0!==n?n:{},p=0,h=Object.keys(l);p<h.length;p++){var b=h[p];null!==d[b]&&(f[b]=l[b])}for(var v=0,y=Object.keys(d);v<y.length;v++){var g=y[v],m=d[g];null!=m&&(f[g]=m)}return null!==t.bizId&&(u.bizId=null!==(o=t.bizId)&&void 0!==o?o:e.bizId),null!==t.category&&(u.category=null!==(a=t.category)&&void 0!==a?a:e.category),null!==t.name&&(u.name=null!==(i=t.name)&&void 0!==i?i:e.name),null!==t.notes&&(u.notes=null!==(s=t.notes)&&void 0!==s?s:e.notes),u}var Za=Ae({bizId:ge(xe),category:ge(ke),exchangeAmount:ge(Ae(xe)),name:ge(ke),notes:ge(ke)}),Qa=me("high","standard","low"),ei=Ae({orderId:ge(ke),orderUri:ge(ke),isEstimate:we,plugin:Ae({pluginId:ke,displayName:ke,supportEmail:ge(ke)}),payoutAddress:ke,payoutCurrencyCode:ke,payoutNativeAmount:ke,payoutWalletId:ke,refundAddress:ge(ke)});function ti(e){var t=ke(e);if(!/^\d+$/.test(t))throw new Error("Expected an integer string");return t}var ri=Ae({pluginId:ke,tokenId:_e(ke,Ie),nativeAmount:ge(ti)}),ni=Ae({fiatCurrencyCode:ke,fiatAmount:ke}),oi=Ae({pluginId:ke,displayName:ke,isDex:ge(we),orderUri:ge(ke),supportEmail:ke}),ai=_e(Ae({actionType:me("swap"),swapInfo:oi,orderId:ge(ke),orderUri:ge(ke),isEstimate:ge(we),canBePartial:ge(we),fromAsset:ri,toAsset:ri,payoutWalletId:ke,payoutAddress:ke,refundAddress:ge(ke)}),Ae({actionType:me("stake"),pluginId:ke,stakeAssets:Se(ri)}),Ae({actionType:me("fiat"),orderId:ke,orderUri:ge(ke),isEstimate:we,fiatPlugin:Ae({providerId:ke,providerDisplayName:ke,supportEmail:ge(ke)}),payinAddress:ge(ke),payoutAddress:ge(ke),fiatAsset:ni,cryptoAsset:ri}),Ae({actionType:me("tokenApproval"),tokenApproved:ri,tokenContractAddress:ke,contractAddress:ke})),ii=Ae({assetActionType:me("claim","claimOrder","stake","stakeNetworkFee","stakeOrder","unstake","unstakeNetworkFee","unstakeOrder","swap","swapNetworkFee","swapOrderPost","swapOrderFill","swapOrderCancel","buy","sell","sellNetworkFee","tokenApproval","transfer","transferNetworkFee")}),si=Se(ke),ui=Ae({enabledTokenIds:Se(ke),detectedTokenIds:Se(ke)}),ci=Ae({assetAction:ge(ii),metadata:function(e){for(var t=Za(e),r=t.exchangeAmount,n=void 0===r?{}:r,o=0,a=Object.keys(n);o<a.length;o++){var i=a[o];String(n[i]).includes("e")&&delete n[i]}return t},nativeAmount:ge(ke),providerFeeSent:ge(ke)}),fi=Ae({txid:ke,internal:we,creationDate:xe,currencies:function(e){var t=Ae(e);return Pe((function(e){for(var r=t(e),n=new Map,o=0,a=Object.keys(r);o<a.length;o++){var i=a[o];n.set(i,r[i])}return n}),(function(e){var r={};return e.forEach((function(e,t){r[t]=e})),t(r)}))}(ci),tokens:ge(function(e){var t=Ae(e);return Pe((function(e){for(var r=t(e),n=new Map,o=0,a=Object.keys(r);o<a.length;o++){var i=a[o];n.set(""===i?null:i,r[i])}return n}),(function(e){var r={};return e.forEach((function(e,t){r[null==t?"":t]=e})),t(r)}))}(ci),(function(){return new Map})),deviceDescription:ge(ke),feeRateRequested:ge(_e(Qa,eo)),feeRateUsed:ge(eo),payees:ge(Se(Ae({address:ke,amount:ke,currency:ke,tag:ge(ke)}))),savedAction:ge(ai),secret:ge(ke),swap:ge(ei)}),li=Ae({airbitzFeeWanted:xe,meta:Ae({amountFeeAirBitzSatoshi:xe,balance:xe,fee:xe,amountCurrency:xe,bizId:xe,category:ke,name:ke,notes:ke,attributes:xe,amountSatoshi:xe,amountFeeMinersSatoshi:xe,airbitzFee:xe}),ntxid:ke,state:Ae({creationDate:xe,internal:we,malleableTxId:ke})}),di=Ae({seq:xe,address:ke,state:Ae({recycleable:ge(we,!0),creationDate:ge(xe,0)}),meta:Ae({amountSatoshi:ge(xe,0)}).withRest}),pi=Ae(Ae({timestamp:xe,txidHash:ke})),hi=Ae({walletInfo:Ae({id:ke,keys:eo,type:ke})}),bi=Ae({checkpoint:ke}),vi=Ae({fiat:ge(ke),num:ge(xe)}),yi=Ae({walletName:_e(ke,Ie)}),gi=r(3546);function mi(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=[e[r],e[t]];e[t]=n[0],e[r]=n[1]}return e}function wi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function xi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wi(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ki=Qn(fa),Ii=Qn(la),Oi=Qn(da),Ei=da({}),Si="PluginSettings.json";function Ai(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];if(e[o]!==t[o])return!0}return!1}function _i(e){return Ti.apply(this,arguments)}function Ti(){return Ti=t(c().mark((function e(r){var n,o,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=[],o={},e.t0=ie.gQ,e.next=5,r.list("Wallets");case 5:return e.t1=e.sent,a=(0,e.t0)(e.t1),e.next=9,Promise.all(a.map(function(){var e=t(c().mark((function e(t){var a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ki.load(r,t);case 2:if(null!=(a=e.sent)){e.next=5;break}return e.abrupt("return");case 5:i=xi(xi({},Bo({dataKey:a.MK,syncKey:a.SyncKey})),{},{bitcoinKey:x.stringify(a.BitcoinSeed),format:"bip32"}),s=Ji("wallet:bitcoin",i,a.MK),n.push(s),o[s.id]={archived:a.Archived,deleted:!1,hidden:!1,migratedFromWalletId:void 0,sortIndex:a.SortIndex};case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 9:return e.abrupt("return",{walletInfos:n,walletStates:o});case 10:case"end":return e.stop()}}),e)}))),Ti.apply(this,arguments)}function Pi(e){return Mi.apply(this,arguments)}function Mi(){return Mi=t(c().mark((function e(r){var n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={},e.t0=ie.gQ,e.next=4,r.list("Keys");case 4:return e.t1=e.sent,o=(0,e.t0)(e.t1),e.next=8,Promise.all(o.map(function(){var e=t(c().mark((function e(t){var o,a,i,s,u,f,l;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ii.load(r,t);case 2:if(null!=(o=e.sent)){e.next=5;break}return e.abrupt("return");case 5:a=o.id,i=o.archived,s=o.deleted,u=o.hidden,f=o.migratedFromWalletId,l=o.sortIndex,n[a]={archived:i,deleted:s,hidden:u,sortIndex:l,migratedFromWalletId:f};case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 8:return e.abrupt("return",n);case 9:case"end":return e.stop()}}),e)}))),Mi.apply(this,arguments)}function ji(e,t){return Ci.apply(this,arguments)}function Ci(){return(Ci=t(c().mark((function e(t,r){var n,o,a,i,s,u,f,l,d,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props.state.accounts[r],o=n.accountWalletInfo,a=n.accountWalletInfos,e.next=4,Promise.all(a.map((function(e){return _i(na(t.props.state,e.id))})));case 4:return i=e.sent,e.next=7,Pi(na(t.props.state,o.id));case 7:for(s=e.sent,u=[],f=0;f<i.length;f++)l=i[f],u.push.apply(u,Ir(l.walletInfos));d=i.map((function(e){return e.walletStates})),p=Object.assign.apply(Object,[{}].concat(Ir(d),[s])),t.props.dispatch({type:"ACCOUNT_KEYS_LOADED",payload:{accountId:r,legacyWalletInfos:u,walletStates:p}});case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ni(e,t,r){return Di.apply(this,arguments)}function Di(){return Di=t(c().mark((function e(r,n,o){var a,i,s,u,f,l,d,p,h;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(a=r.props.state.accounts[n],i=a.accountWalletInfo,s=a.walletStates,u=na(r.props.state,i.id),f={},l=0,d=Object.keys(o);l<d.length;l++)p=d[l],null==s[p]?f[p]=o[p]:Ai(s[p],o[p])&&(f[p]=xi(xi({},s[p]),o[p]));if(!((h=Object.keys(f)).length<1)){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,Promise.all(h.map(function(){var e=t(c().mark((function e(t){var n,o,a,s,l,d,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=f[t],o=n.archived,a=n.deleted,s=n.hidden,l=n.migratedFromWalletId,d=n.sortIndex,p=ia(r.props.state,i.id,t),e.next=4,Ii.save(u,"Keys/".concat(p,".json"),{archived:o,deleted:a,hidden:s,id:t,migratedFromWalletId:l,sortIndex:d});case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 9:r.props.dispatch({type:"ACCOUNT_CHANGED_WALLET_STATES",payload:{accountId:n,walletStates:xi(xi({},s),f)}});case 10:case"end":return e.stop()}}),e)}))),Di.apply(this,arguments)}function Ri(e,t,r,n){return Bi.apply(this,arguments)}function Bi(){return(Bi=t(c().mark((function e(t,r,n,o){var a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.props.state.accounts[r].accountWalletInfo,s=na(t.props.state,i.id),e.next=4,Oi.load(s,Si);case 4:if(e.t1=a=e.sent,e.t0=null!==e.t1,!e.t0){e.next=8;break}e.t0=void 0!==a;case 8:if(!e.t0){e.next=12;break}e.t2=a,e.next=13;break;case 12:e.t2=Ei;case 13:return u=e.t2,e.next=16,Oi.save(s,Si,xi(xi({},u),{},{userSettings:xi(xi({},t.props.state.accounts[r].userSettings),{},ce({},n,o))}));case 16:t.props.dispatch({type:"ACCOUNT_PLUGIN_SETTINGS_CHANGED",payload:{accountId:r,pluginId:n,userSettings:xi({},o)}});case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Li(e,t,r,n){return Ki.apply(this,arguments)}function Ki(){return(Ki=t(c().mark((function e(t,r,n,o){var a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.props.state.accounts[r].accountWalletInfo,s=na(t.props.state,i.id),e.next=4,Oi.load(s,Si);case 4:if(e.t1=a=e.sent,e.t0=null!==e.t1,!e.t0){e.next=8;break}e.t0=void 0!==a;case 8:if(!e.t0){e.next=12;break}e.t2=a,e.next=13;break;case 12:e.t2=Ei;case 13:return u=e.t2,e.next=16,Oi.save(s,Si,xi(xi({},u),{},{swapSettings:xi(xi({},t.props.state.accounts[r].swapSettings),{},ce({},n,o))}));case 16:t.props.dispatch({type:"ACCOUNT_SWAP_SETTINGS_CHANGED",payload:{accountId:r,pluginId:n,swapSettings:o}});case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ui(e,t){return Fi.apply(this,arguments)}function Fi(){return(Fi=t(c().mark((function e(t,r){var n,o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props.state.accounts[r].accountWalletInfo,o=na(t.props.state,n.id),e.next=4,Oi.load(o,Si);case 4:a=e.sent,s=(i=null!=a?a:{userSettings:{},swapSettings:{}}).userSettings,u=i.swapSettings,t.props.dispatch({type:"ACCOUNT_PLUGIN_SETTINGS_LOADED",payload:{accountId:r,userSettings:s,swapSettings:u}});case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Wi=Ae({id:ke,keys:eo,type:ke}),qi=Me(Wi);function zi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Gi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?zi(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Hi(e,t){return e.find((function(e){return e.type===t}))}function Yi(e){return""===e?"account-repo:co.airbitz.wallet":"account-repo:".concat(e)}function Ji(e,t,r){var n=lr(Yt.parse(e),null!=r?r:Ro(t).dataKey);return{id:x.stringify(n),type:e,keys:t}}function Vi(e,t,r){e.props.log.breadcrumb("makeKeysKit",{});for(var n=e.props.io,o=r.map((function(e){return Gi({created:new Date},yr(n,Yt.parse(JSON.stringify(qi(e))),t.loginKey))})),a=[],i=0;i<r.length;i++){var s=r[i],u=Te(Ro)(s.keys);null!=u&&a.push(m.stringify(u.syncKey).toLowerCase())}return{loginId:t.loginId,server:Tt({keyBoxes:o,newSyncKeys:a}),serverPath:"/v2/login/keys",stash:{keyBoxes:o}}}function Xi(e){for(var t=[],r=new Map,n=0;n<e.length;n++){var o=e[n],a=o.id,i=o.keys,s=o.type;if(null==a||32!==x.parse(a).length)throw new Error("Key integrity violation: invalid id ".concat(a));var u=r.get(a);if(null!=u){var c=t[u];if(c.type!==s)throw new Error("Key integrity violation for ".concat(a,": type ").concat(s," does not match ").concat(c.type));for(var f=0,l=Object.keys(i);f<l.length;f++){var d=l[f];if(null!=c.keys[d]&&c.keys[d]!==i[d])throw new Error("Key integrity violation for ".concat(a,": ").concat(d," keys do not match"))}t[u]={id:a,keys:Gi(Gi({},c.keys),i),type:s}}else r.set(a,t.length),t.push(o)}return t}function $i(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Map,n=e.appId,o=e.keyBoxes,a=void 0===o?[]:o,i=[],s=e.mnemonicBox,u=e.rootKeyBox;if(null!=s&&null!=u){var c=vr(u,t),f={mnemonic:br(s,lr(c,Yt.parse("infoKey"))),rootKey:x.stringify(c)};i.push(Ji("wallet:bitid",f,c))}if(null!=e.syncKeyBox){var l=vr(e.syncKeyBox,t),d=Yi(n),p=Bo({dataKey:t,syncKey:l});i.push(Ji(d,p,t))}var h=a.map((function(e){var n,o,a=Wi(JSON.parse(br(e,t))),i=(n=e.created,o=r.get(a.id),null==n?o:null==o?n:new Date(Math.min(n.valueOf(),o.valueOf())));return null!=i&&r.set(a.id,i),a}));return Xi([].concat(i,Ir(h))).map((function(e){return Zi(e)}))}function Zi(e){var t=e.id,r=e.keys,n=e.type,o={"wallet:bitcoin-bip44":{format:"bip44",coinType:0},"wallet:bitcoin-bip49":{format:"bip49",coinType:0},"wallet:bitcoincash-bip32":{format:"bip32"},"wallet:bitcoincash-bip44":{format:"bip44",coinType:145},"wallet:bitcoincash-bip44-testnet":{format:"bip44",coinType:1},"wallet:bitcoin-bip44-testnet":{format:"bip44",coinType:1},"wallet:bitcoin-bip49-testnet":{format:"bip49",coinType:1},"wallet:dash-bip44":{format:"bip44",coinType:5},"wallet:dogecoin-bip44":{format:"bip44",coinType:3},"wallet:litecoin-bip44":{format:"bip44",coinType:2},"wallet:litecoin-bip49":{format:"bip49",coinType:2},"wallet:feathercoin-bip49":{format:"bip49",coinType:8},"wallet:feathercoin-bip44":{format:"bip44",coinType:8},"wallet:qtum-bip44":{format:"bip44",coinType:2301},"wallet:ufo-bip49":{format:"bip49",coinType:202},"wallet:ufo-bip84":{format:"bip84",coinType:202},"wallet:zcoin-bip44":{format:"bip44",coinType:136},"wallet:bitcoin-testnet":{format:"bip32"},"wallet:bitcoin":{format:"bip32"},"wallet:bitcoincash-testnet":{format:"bip32"},"wallet:litecoin":{format:"bip32",coinType:2},"wallet:zcoin":{format:"bip32",coinType:136}};return null!=o[n]?{id:t,keys:Gi(Gi({},o[n]),r),type:n.replace(/-bip[0-9]+/,"")}:e}function Qi(e,t,r){return es.apply(this,arguments)}function es(){return(es=t(c().mark((function e(t,r,n){var o,a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=function(e,n){return null!=n&&(e=Gi(Gi({},e),{},{imported:n})),Zi(Ji(r,Gi(Gi({},Bo(Lo(t))),e)))},o=n.importText,a=n.keyOptions,null==(i=n.keys)){e.next=4;break}return e.abrupt("return",s(i));case 4:return u=Mo(t.props.state.plugins.currency,r),e.next=7,Co(t,u);case 7:if(f=e.sent,null==o){e.next=16;break}if(null!=f.importPrivateKey){e.next=11;break}throw new Error("This wallet does not support importing keys");case 11:return e.t0=s,e.next=14,f.importPrivateKey(o,a);case 14:return e.t1=e.sent,e.abrupt("return",(0,e.t0)(e.t1,!0));case 16:return e.t2=s,e.next=19,f.createPrivateKey(r,a);case 19:return e.t3=e.sent,e.abrupt("return",(0,e.t2)(e.t3,!1));case 21:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ts(e,t,r,n){return rs.apply(this,arguments)}function rs(){return(rs=t(c().mark((function e(t,r,n,o){var a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=o.enabledTokenIds,i=o.fiatCurrencyCode,s=o.migratedFromWalletId,u=o.name,e.next=3,Wa(t,n);case 3:if(f=e.sent,null==s){e.next=7;break}return e.next=7,Ni(t,r,ce({},n,{migratedFromWalletId:s}));case 7:if(null==u){e.next=10;break}return e.next=10,f.renameWallet(u);case 10:if(null==i){e.next=13;break}return e.next=13,f.setFiatCurrencyCode(i);case 13:if(!(null!=a&&a.length>0)){e.next=16;break}return e.next=16,f.changeEnabledTokenIds(a);case 16:return e.abrupt("return",f);case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ns=Rr;function os(e,t){return e+t}function as(e,t,r,n){return is.apply(this,arguments)}function is(){return(is=t(c().mark((function e(t,r,n,o){var a,i,s,u,f,l,d,p,h;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=o.now,i=void 0===a?new Date:a,s=r.passwordBox,u=r.passwordKeySnrp,f=r.username,null!=s&&null!=u&&null!=f){e.next=4;break}throw new Error("Missing data for offline password login");case 4:return l=os(f,n),e.next=7,Nr(t,l,u);case 7:return d=e.sent,p={loginId:r.loginId,loginKey:vr(s,d)},r.lastLogin=i,Yr(t,r).catch((function(){})),h=t.props.log,En(t,p).catch((function(e){return h.error(e)})),e.abrupt("return",p);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ss(e,t,r,n){return us.apply(this,arguments)}function us(){return us=t(c().mark((function e(r,n,o,a){var i,u,f,l,d,p,h;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(i=n.username)){e.next=3;break}throw new Error("Password login requires a username");case 3:return u=os(i,o),e.next=6,Promise.all([Wr(r,i),Nr(r,u,ns)]);case 6:return f=e.sent,l=s(f,2),d=l[0],p=l[1],h={userId:d,passwordAuth:p},e.next=13,mn(r,n,n,a,h,function(){var e=t(c().mark((function e(t){var n,o,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.passwordBox,o=t.passwordKeySnrp,null!=n&&!0!==n&&null!=o){e.next=3;break}throw new Error("Missing data for online password login");case 3:return e.next=5,Nr(r,u,o);case 5:return a=e.sent,e.abrupt("return",vr(n,a));case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 13:return e.abrupt("return",e.sent);case 14:case"end":return e.stop()}}),e)}))),us.apply(this,arguments)}function cs(e,t,r,n){return fs.apply(this,arguments)}function fs(){return(fs=t(c().mark((function e(t,r,n,o){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,as(t,r,n,o).catch((function(){return ss(t,r,n,o)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ls(e,t,r){return ds.apply(this,arguments)}function ds(){return(ds=t(c().mark((function e(t,r,n){var o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t.props.state.accounts[r],a=o.loginTree,i=o.sessionKey,null!=(s=o.stashTree.username)){e.next=5;break}throw new Error("Password login requires a username");case 5:return e.next=7,ys(t,a,s,n);case 7:return u=e.sent,e.next=10,xn(t,i,u);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ps(e,t,r){return hs.apply(this,arguments)}function hs(){return hs=t(c().mark((function e(t,r,n){var o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=r.username,a=r.passwordAuth,null!=o&&null!=a){e.next=3;break}return e.abrupt("return",!1);case 3:return i=os(o,n),e.next=6,Nr(t,i,ns);case 6:s=e.sent,u=0;case 8:if(!(u<a.length)){e.next=14;break}if(s[u]===a[u]){e.next=11;break}return e.abrupt("return",!1);case 11:++u,e.next=8;break;case 14:return e.abrupt("return",!0);case 15:case"end":return e.stop()}}),e)}))),hs.apply(this,arguments)}function bs(e,t){return vs.apply(this,arguments)}function vs(){return(vs=t(c().mark((function e(t,r){var n,o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props.state.accounts[r],o=n.loginTree,a=n.sessionKey,i={loginId:o.loginId,server:void 0,serverMethod:"DELETE",serverPath:"/v2/login/password",stash:{passwordAuthSnrp:void 0,passwordBox:void 0,passwordKeySnrp:void 0}},null!=o.loginAuth&&(i.stash.passwordAuthBox=void 0),e.next=5,xn(t,a,i);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ys(e,t,r,n){return gs.apply(this,arguments)}function gs(){return gs=t(c().mark((function e(r,n,o,a){var i,u,f,l,d,p,h,b,v,y;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=os(o,a),u=r.props.io,e.next=4,Promise.all([Cr(r).then(function(){var e=t(c().mark((function e(t){var o,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Nr(r,i,t);case 2:return o=e.sent,a=yr(u,n.loginKey,o),e.abrupt("return",{passwordKeySnrp:t,passwordBox:a});case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),Nr(r,i,ns).then((function(e){return{passwordAuth:e,passwordAuthBox:yr(u,e,n.loginKey)}}))]);case 4:return f=e.sent,l=s(f,2),d=l[0],p=d.passwordKeySnrp,h=d.passwordBox,b=l[1],v=b.passwordAuth,y=b.passwordAuthBox,e.abrupt("return",{loginId:n.loginId,server:xt({passwordAuth:v,passwordAuthSnrp:ns,passwordKeySnrp:p,passwordBox:h,passwordAuthBox:y}),serverPath:"/v2/login/password",stash:{passwordKeySnrp:p,passwordBox:h,passwordAuthBox:y}});case 13:case"end":return e.stop()}}),e)}))),gs.apply(this,arguments)}function ms(e,t){return lr(null==t?Uint8Array.from([0]):Yt.parse(t),e)}function ws(e,t){return lr(Yt.parse(t),e)}function xs(e,t){if(null!=e.pin2Key)return e;var r=dn(e,(function(e){return e.appId===t}));return null!=(null==r?void 0:r.pin2Key)?r:void 0}function ks(e,t,r,n,o){return Is.apply(this,arguments)}function Is(){return Is=t(c().mark((function e(r,n,o,a,i){var s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(s=xs(o,n))&&null!=s.pin2Key){e.next=3;break}throw new Error("PIN login is not enabled for this account on this device");case 3:return u=s.pin2Key,f={pin2Id:ms(u,o.username),pin2Auth:ws(u,a)},e.next=7,mn(r,o,s,i,f,function(){var e=t(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=t.pin2Box&&!0!==t.pin2Box){e.next=2;break}throw new Error("Missing data for PIN v2 login");case 2:return e.abrupt("return",vr(t.pin2Box,u));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 7:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}}),e)}))),Is.apply(this,arguments)}function Os(e,t,r){return Es.apply(this,arguments)}function Es(){return(Es=t(c().mark((function e(t,r,n){var o,a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t.props.state.accounts[r],a=o.loginTree,i=o.stashTree.username,s=n.pin,null==(u=n.enableLogin)&&(u=null!=a.pin2Key||null!=s&&null==a.pin),null==s&&(s=a.pin),null!=s){e.next=12;break}if(!u){e.next=9;break}throw new Error("Please change your PIN in the settings area above before enabling.");case 9:return e.next=11,In(t,a,Cs(a));case 11:return e.abrupt("return");case 12:return f=Ps(t,a,i,s,u),e.next=15,In(t,a,f);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ss(e,t,r){return As.apply(this,arguments)}function As(){return As=t(c().mark((function e(t,r,n){var o,a,i,s,u,f,l,d;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=r.appId,a=r.loginId,null!=(i=r.username)){e.next=3;break}return e.abrupt("return",!1);case 3:if(s=Kr(t,a),u=s.stashTree,null!=(f=xs(u,o))&&null!=f.pin2Key){e.next=7;break}throw new Error("No PIN set locally for this account");case 7:return l=f.pin2Key,d={pin2Id:ms(l,i),pin2Auth:ws(l,n),otp:$r(r)},e.next=11,Tr(t,"POST","/v2/login",d).then((function(e){return!0}),(function(e){return!1}));case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}}),e)}))),As.apply(this,arguments)}function _s(e,t){return Ts.apply(this,arguments)}function Ts(){return(Ts=t(c().mark((function e(t,r){var n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props.state.accounts[r].loginTree,o=Cs(n),e.next=4,In(t,n,o);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ps(e,t,r,n,o){for(var a=[js(e,t,r,n,o)],i=0,s=t.children;i<s.length;i++){var u=s[i];a.push.apply(a,Ir(Ps(e,u,r,n,o)))}return a}function Ms(e,t){var r=e.loginId,n=e.pin2Key;if(null!=n)return{loginId:r,server:kt({pin2Id:ms(n,t)}),serverPath:"",stash:{}}}function js(e,t,r,n,o){var a=e.props.io,i=yr(a,Yt.parse(n),t.loginKey);if(o){var s=t.loginId,u=t.loginKey,c=t.pin2Key,f=void 0===c?a.random(32):c,l=yr(a,u,f),d=yr(a,f,u);return{loginId:s,server:It({pin2Id:ms(f,r),pin2Auth:ws(f,n),pin2Box:l,pin2KeyBox:d,pin2TextBox:i}),serverPath:"/v2/login/pin2",stash:{pin2Key:f,pin2TextBox:i}}}return{loginId:t.loginId,server:It({pin2Id:void 0,pin2Auth:void 0,pin2Box:void 0,pin2KeyBox:void 0,pin2TextBox:i}),serverPath:"/v2/login/pin2",stash:{pin2Key:void 0,pin2TextBox:i}}}function Cs(e){for(var t=[Ns(e)],r=0,n=e.children;r<n.length;r++){var o=n[r];t.push.apply(t,Ir(Cs(o)))}return t}function Ns(e){return{loginId:e.loginId,server:void 0,serverMethod:"DELETE",serverPath:"/v2/login/pin2",stash:{pin2Key:void 0}}}function Ds(e,t){return lr(Yt.parse(t),e)}function Rs(e,t){return t.map((function(t){return lr(Yt.parse(t),e)}))}function Bs(e,t,r,n,o){return Ls.apply(this,arguments)}function Ls(){return Ls=t(c().mark((function e(r,n,o,a,i){var s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(s=n.username)){e.next=3;break}throw new Error("Recovery login requires a username");case 3:return u={recovery2Id:Ds(o,s),recovery2Auth:Rs(o,a)},e.next=6,mn(r,n,n,i,u,function(){var e=t(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=t.recovery2Box&&!0!==t.recovery2Box){e.next=2;break}throw new Error("Missing data for recovery v2 login");case 2:return e.abrupt("return",vr(t.recovery2Box,o));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)}))),Ls.apply(this,arguments)}function Ks(e,t,r){return Us.apply(this,arguments)}function Us(){return(Us=t(c().mark((function e(t,r,n){var o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o={recovery2Id:Ds(r,n)},e.next=3,Tr(t,"POST","/v2/login",o);case 3:if(a=e.sent,i=pt(a),null!=(s=i.question2Box)){e.next=7;break}throw new Error("Login has no recovery questions");case 7:return e.abrupt("return",Ys(JSON.parse(br(s,r))));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fs(e,t,r,n){return Ws.apply(this,arguments)}function Ws(){return(Ws=t(c().mark((function e(t,r,n,o){var a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.props.state.accounts[r],i=a.loginTree,s=a.sessionKey,null!=(u=a.stashTree.username)){e.next=5;break}throw new Error("Recovery login requires a username");case 5:return f=Hs(t,i,u,n,o),e.next=8,xn(t,s,f);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qs(e,t){return zs.apply(this,arguments)}function zs(){return(zs=t(c().mark((function e(t,r){var n,o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props.state.accounts[r],o=n.loginTree,a=n.sessionKey,i={login:{recovery2Key:void 0},loginId:o.loginId,server:void 0,serverMethod:"DELETE",serverPath:"/v2/login/recovery2",stash:{recovery2Key:void 0}},e.next=4,xn(t,a,i);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Gs(e,t){var r=e.loginId,n=e.recovery2Key;if(null!=n)return{loginId:r,server:Ot({recovery2Id:Ds(n,t)}),serverPath:"",stash:{}}}function Hs(e,t,r,n,o){var a=e.props.io;if(!Array.isArray(n))throw new TypeError("Questions must be an array of strings");if(!Array.isArray(o))throw new TypeError("Answers must be an array of strings");var i=t.loginId,s=t.loginKey,u=t.recovery2Key,c=void 0===u?a.random(32):u,f=yr(a,Yt.parse(JSON.stringify(Js(n))),c),l=yr(a,s,c),d=yr(a,c,s);return{loginId:i,server:Et({recovery2Id:Ds(c,r),recovery2Auth:Rs(c,o),recovery2Box:l,recovery2KeyBox:d,question2Box:f}),serverPath:"/v2/login/recovery2",stash:{recovery2Key:c}}}var Ys=Se(ke),Js=Me(Ys);function Vs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Xs(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Vs(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vs(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function $s(e,t,r){return Zs.apply(this,arguments)}function Zs(){return Zs=t(c().mark((function e(t,r,n){var o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=function(e){for(var r=[Qs(t,e,n)],o=0,i=e.children;o<i.length;o++){var s=i[o];r.push.apply(r,Ir(a(s)))}return r},o=t.props.state.accounts[r].loginTree,e.next=4,Promise.all(a(o));case 4:return i=e.sent,e.next=7,In(t,o,i);case 7:case"end":return e.stop()}}),e)}))),Zs.apply(this,arguments)}function Qs(e,t,r){return eu.apply(this,arguments)}function eu(){return eu=t(c().mark((function e(t,r,n){var o,a,i,s,u,f,l,d,p,h,b,v;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=n.password,f=n.username,l=r.isRoot,d=r.loginId,null==r.passwordAuth||null!=u){e.next=4;break}throw new Error("A password is required to change the username");case 4:if(p=Ms(r,f),h=Gs(r,f),null==u){e.next=10;break}return e.next=9,ys(t,r,f,u);case 9:b=e.sent;case 10:if(!l){e.next=14;break}return e.next=13,tu(t,r,f);case 13:v=e.sent;case 14:if(null!=b||null!=p||null!=h||null!=v){e.next=16;break}return e.abrupt("return");case 16:return e.abrupt("return",{loginId:d,server:Xs(Xs(Xs(Xs({},null===(o=b)||void 0===o?void 0:o.server),null==p?void 0:p.server),null==h?void 0:h.server),null===(a=v)||void 0===a?void 0:a.server),serverPath:"/v2/login/username",stash:Xs(Xs(Xs(Xs({},null===(i=b)||void 0===i?void 0:i.stash),null==p?void 0:p.stash),null==h?void 0:h.stash),null===(s=v)||void 0===s?void 0:s.stash)});case 17:case"end":return e.stop()}}),e)}))),eu.apply(this,arguments)}function tu(e,t,r){return ru.apply(this,arguments)}function ru(){return ru=t(c().mark((function e(t,r,n){var o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.props.io,a=r.loginId,i=r.loginKey,e.next=4,Wr(t,n);case 4:return s=e.sent,e.abrupt("return",{loginId:a,server:At({userId:s,userTextBox:yr(o,Yt.parse(n),i)}),serverPath:"",stash:{userId:s,username:n}});case 6:case"end":return e.stop()}}),e)}))),ru.apply(this,arguments)}function nu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ou(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?nu(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nu(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function au(e,t,r){return iu.apply(this,arguments)}function iu(){return(iu=t(c().mark((function e(t,r,n){var o,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wr(t,r);case 2:return o=e.sent,a={challengeId:n,userId:o},e.next=6,Tr(t,"POST","/v2/login",a).then((function(e){return!1})).catch((function(e){if(null!=cr(e))return!0;throw e}));case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function su(e,t,r,n){return uu.apply(this,arguments)}function uu(){return uu=t(c().mark((function e(t,r,n,o){var a,i,s,u,f,l,d,p,h,b,v,y,g,m,w,x,k,I,O,E,S,A,_,T,P;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(h=o.keyInfo,b=o.password,v=o.pin,y=o.username,g=t.props.io,t.props.log.breadcrumb("makeCreateKit",{}),m=null==r,w=g.random(32),x=g.random(32),k={loginId:w,loginKey:x},I={appId:n,lastLogin:new Date,loginId:w,loginKey:x,isRoot:m,pendingVouchers:[],children:[]},O=jr(t,I),null!=h&&(E=Vi(t,k,[h])),null!=r&&(S=yr(g,x,r.loginKey)),null==b||null==y){e.next=15;break}return e.next=14,ys(t,I,y,b);case 14:A=e.sent;case 15:if(null!=v&&(_=js(t,I,y,v,!0)),!m||null==y){e.next=20;break}return e.next=19,tu(t,I,y);case 19:T=e.sent;case 20:return P={loginId:w,server:ou(ou(ou(ou(ou(ou({},Pt({appId:n,loginId:w,parentBox:S})),null===(a=E)||void 0===a?void 0:a.server),null===(i=A)||void 0===i?void 0:i.server),null===(s=_)||void 0===s?void 0:s.server),O.server),null===(u=T)||void 0===u?void 0:u.server),serverPath:"/v2/login/create",stash:ou(ou(ou(ou(ou({appId:n,loginId:w,parentBox:S},null===(f=E)||void 0===f?void 0:f.stash),null===(l=A)||void 0===l?void 0:l.stash),null===(d=_)||void 0===d?void 0:d.stash),O.stash),null===(p=T)||void 0===p?void 0:p.stash)},e.abrupt("return",{kit:P,sessionKey:k});case 22:case"end":return e.stop()}}),e)}))),uu.apply(this,arguments)}function cu(e,t,r){return fu.apply(this,arguments)}function fu(){return(fu=t(c().mark((function e(t,r,n){var o,a,i,s,u,f,l;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=r.challengeId,a=r.now,i=void 0===a?new Date:a,t.props.log.breadcrumb("createLogin",{}),e.next=4,su(t,void 0,"",n);case 4:return s=e.sent,u=s.kit,f=s.sessionKey,l={challengeId:o,data:u.server},e.next=10,Tr(t,"POST",u.serverPath,l);case 10:return u.stash.lastLogin=i,e.next=13,Yr(t,u.stash);case 13:return e.abrupt("return",f);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function lu(e,t,r,n){return du.apply(this,arguments)}function du(){return(du=t(c().mark((function e(t,r,n,o){var a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return null!=r.pin2TextBox&&(a=br(r.pin2TextBox,n.loginKey)),e.next=3,su(t,n,o,{keyInfo:Ji(Yi(o),Bo(Lo(t))),pin:a,username:r.username});case 3:return i=e.sent,s=i.kit,u={loginId:n.loginId,server:s.server,serverPath:s.serverPath,stash:{children:[s.stash]}},e.next=8,xn(t,n,u);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pu(e,t,r,n){return hu.apply(this,arguments)}function hu(){return(hu=t(c().mark((function e(t,r,n,o){var a,i,s,u,f,l,d;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.props.log,null!=(i=dn(r,(function(e){return e.appId===o})))){e.next=7;break}return t.props.log.breadcrumb("createChildLogin",{}),e.next=6,lu(t,r,n,o);case 6:case 17:return e.abrupt("return",e.sent);case 7:if(s=An(r,n,i.loginId),u=$i(i,s.loginKey),a.warn("Login: decrypted keys for user ".concat(x.stringify(r.loginId))),f=Yi(o),null!=Hi(u,f)){e.next=18;break}return t.props.log.breadcrumb("createAccountRepo",{}),l=Ji(f,Bo(Lo(t))),d=Vi(t,s,[l]),e.next=17,xn(t,n,d);case 18:return e.abrupt("return",r);case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bu(e,t,r,n){return vu.apply(this,arguments)}function vu(){return(vu=t(c().mark((function e(t,r,n,o){var a,i,s,u,f,l;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=o.pauseWallets,i=void 0!==a&&a,s=t.props.state.login.appId,u=t.props.log,t.props.log.breadcrumb("makeAccount",{}),f=Kr(t,r.loginId),l=f.stashTree,e.next=7,pu(t,l,r,s);case 7:return u.warn("Login: account exists for appId"),t.props.dispatch({type:"LOGIN",payload:{loginType:n,pauseWallets:i,rootLoginId:l.loginId,sessionKey:r}}),e.next=11,yu(t,t.props.state.lastAccountId);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function yu(e,t){return e.waitFor((function(e){var r=e.state.accounts[t];if(null!=r.loadFailure)throw r.loadFailure;var n=e.output.accounts[t];if(null!=(null==n?void 0:n.accountApi))return n.accountApi}))}var gu=r(6266),mu=r.n(gu),wu=r(2956);wu.BU;const xu=wu.j6;function ku(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Iu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ku(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ku(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Ou=new(0,mu().ec)("secp256k1");function Eu(e,t){var r=e.derive(Ou.keyFromPublic(t).getPublic()).toArray("be");return lr(Uint8Array.from([0,0,0,1].concat(Ir(r))),Yt.parse("dataKey"))}function Su(e,t){var r=Eu(e,t.publicKey);return JSON.parse(br(t.box,r))}function Au(e,t,r){var n=Ou.genKeyPair({entropy:e.random(32)}),o=Eu(n,t);return{publicKey:Uint8Array.from(n.getPublic().encodeCompressed()),box:yr(e,Yt.parse(JSON.stringify(r)),o)}}function _u(e,t){return Tu.apply(this,arguments)}function Tu(){return Tu=t(c().mark((function e(r,n){var o,a,i,u,f,l,d,p,h,b,v,y,g,m,w,x=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=x.length>2&&void 0!==x[2]?x[2]:1e3,a=r.props.io,i=n.timeout,u=void 0===i?600:i,f=Ou.genKeyPair({entropy:a.random(32)}),l=Uint8Array.from(f.getPublic().encodeCompressed()),d=Ht.stringify(dr(dr(l)).slice(0,10)),p={data:yt(Iu(Iu({},n),{},{publicKey:l,timeout:u}))},e.next=9,Tr(r,"PUT","/v2/lobby/".concat(d),p);case 9:return h=xu(),b=s(h,2),v=b[0],y=b[1],g=[],m=function(){var e=t(c().mark((function e(){var t,n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=it,e.next=3,Tr(r,"GET","/v2/lobby/"+d);case 3:for(e.t1=e.sent,t=(0,e.t0)(e.t1);g.length<t.replies.length;)n=t.replies[g.length],o=Su(f,n),y("reply",o),g.push(o);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),(w=To(m,o,{onError:function(e){y("error",e)}})).start({wait:!1}),e.abrupt("return",{close:function(){return w.stop()},lobbyId:d,on:v,replies:g});case 15:case"end":return e.stop()}}),e)}))),Tu.apply(this,arguments)}function Pu(e,t){return Mu.apply(this,arguments)}function Mu(){return(Mu=t(c().mark((function e(t,r){var n,o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=it,e.next=3,Tr(t,"GET","/v2/lobby/"+r);case 3:if(e.t1=e.sent,n=(0,e.t0)(e.t1),o=n.request.publicKey,a=dr(dr(o)),pr(i=Ht.parse(r),a.subarray(0,i.length))){e.next=10;break}throw new Error("Lobby ECDH integrity error");case 10:return e.abrupt("return",n.request);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ju(e,t,r,n){return Cu.apply(this,arguments)}function Cu(){return(Cu=t(c().mark((function e(t,r,n,o){var a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.props.io,i=n.publicKey,s={data:vt(Au(a,i,o))},e.next=5,Tr(t,"POST","/v2/lobby/"+r,s);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Nu=Ae({appId:ke,loginKey:Be,loginStash:Vr});function Du(e,t,r,n){return Ru.apply(this,arguments)}function Ru(){return(Ru=t(c().mark((function e(t,r,n,o){var a,i,s,u,f,l,d;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=o.now,i=void 0===a?new Date:a,s=r.loginKey,u=r.loginStash,t.props.log.breadcrumb("unpackAccount",{}),null!=(f=dn(u,(function(e){return e.appId===n})))){e.next=6;break}throw new Error('Cannot find requested appId: "'.concat(n,'"'));case 6:try{l=Kr(t,f.loginId),f.voucherId=l.stash.voucherId,f.voucherAuth=l.stash.voucherAuth}catch(c){}return u.lastLogin=i,e.next=10,Yr(t,u);case 10:return d={loginId:f.loginId,loginKey:s},e.next=13,En(t,d);case 13:return e.next=15,bu(t,d,"edgeLogin",o);case 15:return e.abrupt("return",e.sent);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Bu(e,t){return Lu.apply(this,arguments)}function Lu(){return Lu=t(c().mark((function e(r,n){var o,a,i,s,u,f,l,d,p,h,b=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=function(){return(l=t(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=0;t<p.length;t++)(0,p[t])();h.state="closed",H(h),z(h);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)},f=function(){return l.apply(this,arguments)},u=function(){return(u=t(c().mark((function e(t){var a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(a=0;a<p.length;a++)(0,p[a])();return i=Nu(t),s=i.loginStash.username,h.state="started",h.username=s,H(h),e.next=8,Du(r,i,n,o);case 8:u=e.sent,h.state="done",h.account=u,H(h),z(h);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)},s=function(e){return u.apply(this,arguments)},i=function(e){for(var t=0;t<p.length;t++){(0,p[t])()}h.state="error",h.error=e,H(h),z(h)},a=function(e){h.error=e,H(h)},o=b.length>2&&void 0!==b[2]?b[2]:{},e.next=9,_u(r,{loginRequest:{appId:n}});case 9:return d=e.sent,p=[d.close,d.on("error",a),d.on("reply",(function(e){s(e).catch(i)}))],h={id:d.lobbyId,cancelRequest:f,watch:ne,state:"pending",account:void 0,error:void 0,username:void 0},e.abrupt("return",C(h));case 13:case"end":return e.stop()}}),e)}))),Lu.apply(this,arguments)}var Ku=Me(Nu),Uu=Ae({appName:ke,darkImageUrl:ge(ke),lightImageUrl:ge(ke),imageUrl:ge(ke)});function Fu(e,t){return Wu.apply(this,arguments)}function Wu(){return(Wu=t(c().mark((function e(t,r){var n,o,a,i,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=mi(t.props.state.infoServers),o=s(n,1),a=o[0],i="".concat(a,"/v1/appIdInfo/").concat(r),e.next=5,t.props.io.fetch(i,{corsBypass:"never"});case 5:if(404!==(u=e.sent).status){e.next=8;break}return e.abrupt("return",{appName:r});case 8:if(u.ok){e.next=10;break}throw new Error("Fetching ".concat(i," returned ").concat(u.status));case 10:return e.t0=Uu,e.next=13,u.json();case 13:return e.t1=e.sent,null==(f=(0,e.t0)(e.t1)).lightImageUrl&&(f.lightImageUrl=f.imageUrl),null==f.darkImageUrl&&(f.darkImageUrl=f.imageUrl),e.abrupt("return",f);case 20:return e.prev=20,e.t2=e.catch(0),t.props.onError(e.t2),e.abrupt("return",{appName:r});case 24:case"end":return e.stop()}}),e,null,[[0,20]])})))).apply(this,arguments)}function qu(e,t,r,n,o){return zu.apply(this,arguments)}function zu(){return zu=t(c().mark((function e(t,r,n,o,a){var i,s,u,f,l,d,p,h,b;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.props.state.accounts[r].sessionKey,t.props.log.breadcrumb("approveLoginRequest",{}),e.next=4,En(t,i);case 4:return s=Kr(t,i.loginId),u=s.stashTree,e.next=7,pu(t,u,i,n);case 7:if(f=e.sent,null!=(l=dn(f,(function(e){return e.appId===n})))){e.next=11;break}throw new Error("Failed to create the requested login object");case 11:return d=An(f,i,l.loginId),p=Ku({appId:n,loginKey:d.loginKey,loginStash:gn(f,n)}),e.next=15,ju(t,o,a,p);case 15:null!=(b=t.props.output.accounts[r].accountApi)&&b.on("close",(function(){null!=h&&clearTimeout(h)})),h=setTimeout((function(){h=void 0,En(t,i).then((function(){h=setTimeout((function(){h=void 0,En(t,i).catch((function(e){return t.props.onError(e)}))}),2e4)})).catch((function(e){return t.props.onError(e)}))}),1e4);case 18:case"end":return e.stop()}}),e)}))),zu.apply(this,arguments)}function Gu(e,t,r){return Hu.apply(this,arguments)}function Hu(){return(Hu=t(c().mark((function e(t,r,n){var o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Pu(t,n);case 2:if(null==(o=e.sent).loginRequest){e.next=7;break}return e.next=6,Yu(t,r,n,o,o.loginRequest.appId);case 6:a=e.sent;case 7:return C(i={loginRequest:a}),e.abrupt("return",i);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Yu(e,t,r,n,o){return Ju.apply(this,arguments)}function Ju(){return(Ju=t(c().mark((function e(r,n,o,a,i){var s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.props.log.breadcrumb("unpackLoginRequest",{}),e.next=3,Fu(r,i);case 3:return s=e.sent,C(u={appId:i,displayName:s.appName,displayImageDarkUrl:s.darkImageUrl,displayImageLightUrl:s.lightImageUrl,approve:function(){return qu(r,n,i,o,a)},close:function(){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:z(u);case 1:case"end":return e.stop()}}),e)})))()}}),e.abrupt("return",u);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Vu(e){for(var t={},r=0,n=Object.keys(e);r<n.length;r++){var o=n[r];t[e[o].currencyCode]=o}return t}function Xu(){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments.length>3?arguments[3]:void 0,r=Vu(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),n=Vu(e),o=[],a=0;a<t.length;a++){var i,s=t[a],u=null!==(i=n[s])&&void 0!==i?i:r[s];null!=u&&o.push(u)}return o}function $u(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>3?arguments[3]:void 0,n=[],o=0;o<r.length;o++){var a,i=r[o],s=null!==(a=t[i])&&void 0!==a?a:e[i];null!=s&&n.push(s.currencyCode)}return n}function Zu(e){for(var t=new Set(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]),r=[],n=0;n<e.length;n++){var o=e[n];t.has(o)||(t.add(o),r.push(o))}return r}function Qu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ec(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qu(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qu(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var tc="Currency.json",rc="fixedLegacyFileNames.json",nc="EnabledTokens.json",oc="seenTxCheckpoint.json",ac="Tokens.json",ic="WalletName.json",sc=Qn(di),uc=Qn(pi),cc=Qn(si),fc=Qn(li),lc=Qn(bi),dc=Qn(ui),pc=Qn(fi),hc=Qn(vi),bc=Qn(yi);function vc(e,t,r){return yc.apply(this,arguments)}function yc(){return(yc=t(c().mark((function e(t,r,n){var o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.props,a=o.state,i=o.walletId,s=na(a,i),e.next=4,dc.save(s,ac,{detectedTokenIds:r,enabledTokenIds:n});case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gc(e,t,r){var n={creationDate:e.state.creationDate,currencies:new Map,tokens:new Map,internal:e.state.internal,txid:e.state.malleableTxId},o={};return o[r]=e.meta.amountCurrency,n.currencies.set(t,{metadata:{bizId:e.meta.bizId,category:e.meta.category,exchangeAmount:o,name:e.meta.name,notes:e.meta.notes},providerFeeSent:e.meta.amountFeeAirBitzSatoshi.toFixed()}),n}function mc(e,t,r,n){var o,a=e.currency.wallets[t].fileNames,i=ia(e,t,r),s=(null!==(o=a[i])&&void 0!==o?o:{}).creationDate,u=void 0===s?Math.min(n,Date.now()/1e3):s,c="".concat(u.toFixed(0),"-").concat(i,".json");return{creationDate:u,fileName:c,txidHash:i}}function wc(e,t){return xc.apply(this,arguments)}function xc(){return(xc=t(c().mark((function e(t,r){var n,o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props,o=n.dispatch,a=n.state,i=n.walletId,s=na(a,i),e.next=4,bc.save(s,ic,{walletName:r});case 4:o({type:"CURRENCY_WALLET_NAME_CHANGED",payload:{name:r,walletId:i}});case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kc(e,t){return Ic.apply(this,arguments)}function Ic(){return(Ic=t(c().mark((function e(t,r){var n,o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.props,o=n.dispatch,a=n.state,i=n.walletId,s=na(a,i),/^iso:/.test(r)){e.next=4;break}throw new TypeError("Fiat currency codes must start with `iso:`");case 4:return e.next=6,hc.save(s,tc,{fiat:r,num:void 0});case 6:o({type:"CURRENCY_WALLET_FIAT_CHANGED",payload:{fiatCurrencyCode:r,walletId:i}});case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Oc(e){return Ec.apply(this,arguments)}function Ec(){return(Ec=t(c().mark((function e(t){var r,n,o,a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.props,n=r.dispatch,o=r.state,a=r.walletId,i=na(o,a),e.next=4,hc.load(i,tc);case 4:s=e.sent,u="iso:USD",null!=s&&(null!=s.fiat?u=s.fiat:null!=s.num&&null!=(f=(0,gi.Rx)("000".concat(s.num).slice(-3)))&&(u="iso:".concat(f.code))),n({type:"CURRENCY_WALLET_FIAT_CHANGED",payload:{fiatCurrencyCode:u,walletId:a}});case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Sc(e){return Ac.apply(this,arguments)}function Ac(){return(Ac=t(c().mark((function e(t){var r,n,o,a,i,s,u,f,l,d,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.props,n=r.dispatch,o=r.state,a=r.walletId,i=na(o,a),e.next=4,bc.load(i,ic);case 4:if(s=e.sent,u=null,null!=s&&null!=s.walletName){e.next=17;break}if(f=t.props.walletState.walletInfo.appIds,null==(l=(void 0===f?[]:f).find((function(e){return""!==e})))){e.next=15;break}return e.next=12,Fu(fd(t),l);case 12:d=e.sent,p=d.appName,u=p;case 15:e.next=18;break;case 17:u=s.walletName;case 18:n({type:"CURRENCY_WALLET_NAME_CHANGED",payload:{name:"string"==typeof u?u:null,walletId:a}});case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _c(e){return Tc.apply(this,arguments)}function Tc(){return(Tc=t(c().mark((function e(t){var r,n,o,a,i,s,u,f,l,d,p,h,b;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.props,n=r.dispatch,o=r.state,a=r.walletId,i=na(o,a),e.next=4,dc.load(i,ac);case 4:if(null==(s=e.sent)){e.next=8;break}return n({type:"CURRENCY_WALLET_LOADED_TOKEN_FILE",payload:ec({walletId:t.props.walletId},s)}),e.abrupt("return");case 8:return e.next=10,cc.load(i,nc);case 10:null!=(u=e.sent)&&(f=t.props.walletState,l=f.accountId,d=f.currencyInfo,p=f.pluginId,h=t.props.state.accounts[l],b=Xu(h.builtinTokens[p],h.customTokens[p],d,u),n({type:"CURRENCY_WALLET_LOADED_TOKEN_FILE",payload:{walletId:t.props.walletId,detectedTokenIds:[],enabledTokenIds:b}}));case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pc(e,t){return Mc.apply(this,arguments)}function Mc(){return Mc=t(c().mark((function e(r,n){var o,a,i,s,u,f,l,d;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=r.props,a=o.dispatch,i=o.walletId,s=na(r.props.state,i),u=r.props.walletState.currencyInfo.currencyCode,f=r.props.walletState.fileNames,l=r.props.walletState.fiat,d={},e.next=8,Promise.all(n.map(function(){var e=t(c().mark((function e(t){var r,n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=f[t]){e.next=2;break}return e.abrupt("return");case 2:return r="Transactions/".concat(f[t].fileName),e.next=5,fc.load(s,r);case 5:if(null!=(n=e.sent)){e.next=8;break}return e.abrupt("return");case 8:d[t]=gc(n,u,l);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 8:return e.next=10,Promise.all(n.map(function(){var e=t(c().mark((function e(t){var r,n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=f[t]){e.next=2;break}return e.abrupt("return");case 2:return r="transaction/".concat(f[t].fileName),e.next=5,pc.load(s,r);case 5:if(null!=(n=e.sent)){e.next=8;break}return e.abrupt("return");case 8:d[t]=n;case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 10:return a({type:"CURRENCY_WALLET_FILES_LOADED",payload:{files:d,walletId:i}}),e.abrupt("return",d);case 12:case"end":return e.stop()}}),e)}))),Mc.apply(this,arguments)}function jc(e,t,r){return Cc.apply(this,arguments)}function Cc(){return Cc=t(c().mark((function e(r,n,o){var a,i,s,u,f,l,d,p,h,b,v,y;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=oa(r,n),e.next=3,uc.load(i,rc);case 3:if(e.t1=a=e.sent,e.t0=null!==e.t1,!e.t0){e.next=7;break}e.t0=void 0!==a;case 7:if(!e.t0){e.next=11;break}e.t2=a,e.next=12;break;case 11:e.t2={};case 12:return s=e.t2,e.t3=ie.gQ,e.next=16,o.list();case 16:for(e.t4=e.sent,u=(0,e.t3)(e.t4),f={},l=[],d=0;d<u.length;d++)p=u[d],null!=(h=s[p])?(b=h.timestamp,v=h.txidHash,f[v]={creationDate:b,fileName:p}):l.push(p);if(y=l.map(function(){var e=t(c().mark((function e(t){var a,i,u,l,d,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fc.load(o,t);case 2:if(null!=(a=e.sent)){e.next=5;break}return e.abrupt("return");case 5:i=a.state,u=i.creationDate,l=i.malleableTxId,d=t,p=ia(r,n,l),f[p]={creationDate:u,fileName:d},s[d]={timestamp:u,txidHash:p};case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),!(y.length>0)){e.next=27;break}return e.next=25,Promise.all(y);case 25:return e.next=27,uc.save(i,rc,s).catch((function(){}));case 27:return e.abrupt("return",f);case 28:case"end":return e.stop()}}),e)}))),Cc.apply(this,arguments)}function Nc(e){return Dc.apply(this,arguments)}function Dc(){return(Dc=t(c().mark((function e(t){var r,n,o,a,i,u,f,l,d,p,h,b,v,y,g,m;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.props,n=r.dispatch,o=r.state,a=r.walletId,i=na(o,a),e.next=4,jc(o,a,(0,ie.HN)(i,"Transactions"));case 4:return u=e.sent,e.next=7,(0,ie.HN)(i,"transaction").list();case 7:for(f=e.sent,l=0,d=(0,ie.gQ)(f);l<d.length;l++)p=d[l],h=p.split(".json")[0],b=h.split("-"),v=s(b,2),y=v[0],g=v[1],m=parseInt(y),(null==u[g]||m<u[g].creationDate)&&(u[g]={creationDate:m,fileName:p});n({type:"CURRENCY_WALLET_FILE_NAMES_LOADED",payload:{txFileNames:u,walletId:a}});case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Rc(e){return Bc.apply(this,arguments)}function Bc(){return Bc=t(c().mark((function e(r){var n,o,a,i,s,u,f,l;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=r.props,a=o.state,i=o.walletId,s=na(a,i),u=[],e.t0=ie.gQ,e.next=6,s.list("Addresses");case 6:return e.t1=e.sent,f=(0,e.t0)(e.t1),e.next=10,Promise.all(f.map(function(){var e=t(c().mark((function e(t){var r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,sc.load(s,t);case 2:if(null!=(r=e.sent)){e.next=5;break}return e.abrupt("return");case 5:if(""!==r.address&&!r.state.recycleable){e.next=7;break}return e.abrupt("return");case 7:u.push(r.address);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 10:if(null==(l=null===(n=r.props.walletOutput)||void 0===n?void 0:n.engine)){e.next=14;break}return e.next=14,l.addGapLimitAddresses(u);case 14:case"end":return e.stop()}}),e)}))),Bc.apply(this,arguments)}function Lc(e,t,r,n,o,a,i){return Kc.apply(this,arguments)}function Kc(){return(Kc=t(c().mark((function e(t,r,n,o,a,i,s){var u,f,l,d,p,h,b,v,y,g,m,w,x,k,I,O,E,S,A,_,T,P,M,j;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(l=t.props,d=l.dispatch,p=l.state,h=l.walletId,b=na(p,h),v=t.props.walletState,y=v.accountId,g=v.currencyInfo,m=v.pluginId,w=t.props.state.accounts[y].allTokens[m],x=null==n?g:w[n],k=x.currencyCode,null!=(I=t.props.walletState.txs[r])){e.next=8;break}throw new Error("Setting metatdata for missing tx ".concat(r));case 8:return O=mc(p,h,I.txid,I.date),E=O.creationDate,S=O.fileName,A=O.txidHash,e.next=11,pc.load(b,"transaction/".concat(S));case 11:return _=e.sent,T=ec(ec({},_),{},{creationDate:E,currencies:new Map(null!==(u=null==_?void 0:_.currencies)&&void 0!==u?u:[]),internal:!0,tokens:new Map(null!==(f=null==_?void 0:_.tokens)&&void 0!==f?f:[]),txid:r}),P=ec(ec({metadata:{}},T.currencies.get(k)),T.tokens.get(n)),T.tokens.set(n,P),T.currencies.delete(k),null!=a&&(P.metadata=$a(null!==(M=P.metadata)&&void 0!==M?M:{},a)),null!=i&&(P.assetAction=i),null!=s&&(T.savedAction=s),d({type:"CURRENCY_WALLET_FILE_CHANGED",payload:{creationDate:E,fileName:S,json:T,txid:r,txidHash:A,walletId:h}}),e.next=22,pc.save(b,"transaction/"+S,T);case 22:j=Cf(t,I,T,n),o.onTransactions([{isNew:null==_,transaction:j}]);case 24:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Uc(e,t){return Fc.apply(this,arguments)}function Fc(){return(Fc=t(c().mark((function e(t,r){var n,o,a,i,s,u,f,l,d,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.props,a=o.dispatch,i=o.state,s=o.walletId,u=mc(i,s,r.txid,r.date),f=u.creationDate,l=u.fileName,d=u.txidHash,(p={txid:r.txid,internal:!0,creationDate:f,currencies:new Map,feeRateUsed:r.feeRateUsed,tokens:new Map,savedAction:r.savedAction,swap:r.swapData}).tokens.set(r.tokenId,{assetAction:r.assetAction,metadata:null!==(n=r.metadata)&&void 0!==n?n:{},nativeAmount:r.nativeAmount}),null!=r.networkFeeOption&&(p.feeRateRequested="custom"===r.networkFeeOption?r.requestedCustomFee:r.networkFeeOption),null!=r.spendTargets&&(p.payees=r.spendTargets.map((function(e){return{currency:e.currencyCode,address:e.publicAddress,amount:e.nativeAmount,tag:e.memo}})),null!=r.deviceDescription&&(p.deviceDescription=r.deviceDescription)),"string"==typeof r.txSecret&&(p.secret=r.txSecret),a({type:"CURRENCY_WALLET_FILE_CHANGED",payload:{creationDate:f,fileName:l,json:p,txid:r.txid,txidHash:d,walletId:s}}),e.abrupt("return",{fileName:l,txFile:p});case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Wc(e,t,r){return qc.apply(this,arguments)}function qc(){return(qc=t(c().mark((function e(t,r,n){var o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.props,a=o.state,i=o.walletId,s=na(a,i),e.next=4,pc.save(s,"transaction/"+r,n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function zc(e){return Gc.apply(this,arguments)}function Gc(){return(Gc=t(c().mark((function e(t){var r,n,o,a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props,o=n.dispatch,a=n.state,i=n.walletId,s=na(a,i),e.next=4,lc.load(s,oc);case 4:if(e.t1=r=e.sent,e.t0=null!==e.t1,!e.t0){e.next=8;break}e.t0=void 0!==r;case 8:if(!e.t0){e.next=12;break}e.t2=r,e.next=13;break;case 12:e.t2={};case 13:return u=e.t2,null!=(f=u.checkpoint)&&o({type:"CURRENCY_ENGINE_SEEN_TX_CHECKPOINT_CHANGED",payload:{checkpoint:f,walletId:i}}),e.abrupt("return",f);case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Hc(){return(Hc=t(c().mark((function e(t,r){var n,o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props,o=n.dispatch,a=n.state,i=n.walletId,s=na(a,i),u={checkpoint:r},o({type:"CURRENCY_ENGINE_SEEN_TX_CHECKPOINT_CHANGED",payload:{checkpoint:r,walletId:i}}),e.next=6,lc.save(s,oc,u);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Yc="redux-keto wrapper";function Jc(e,t,r){for(var n=Object.create(null),o=function(){var e=i[a],o=t(e);Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var t=this,n=t[Yc];if(n.running[e]){var a=new ReferenceError("Reducer '"+e+"' depends on its own result");throw a.name="ReduxKetoCircularReferenceError",a}n.running[e]=!0;try{var i=o(n.state[e],n.action,r(n.next,t,e),r(n.prev,n.state,e));if(void 0===i)throw new TypeError("Reducer '"+e+"' returned undefined");return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!1,value:i}),i}finally{n.running[e]=!1}}})},a=0,i=e;a<i.length;a+=1)o();return n}function Vc(e,t,r,n,o){var a=Object.create(e);return Object.defineProperty(a,Yc,{configurable:!0,enumerable:!1,writable:!1,value:{state:t,action:r,next:n,prev:o,running:{}}}),a}function Xc(e,t){if(void 0===e&&(e={}),null===t||null==t[Yc])return t;for(var r=Object.keys(Object.getPrototypeOf(t)),n=Object.keys(e).length===r.length,o=0,a=r;o<a.length;o+=1){var i=a[o];Object.defineProperty(t,i,{configurable:!1,enumerable:!0,writable:!1,value:Xc(e[i],t[i])}),t[i]!==e[i]&&(n=!1)}return n?e:(delete t[Yc],t)}function $c(e,t,r){return void 0!==e?e:t}function Zc(e,t){if(void 0===t&&(t=$c),"object"!=typeof e||null===e)throw new TypeError("The reducer map must be an object.");for(var r=Object.keys(e),n=0,o=r;n<o.length;n+=1){var a=o[n];if("function"!=typeof e[a])throw new TypeError("Reducers must be functions.")}for(var i=Jc(r,(function(t){return e[t]}),t),s={},u=0,c=r;u<c.length;u+=1){var f=c[u];s[f]=e[f].defaultState}function l(e,t,r,n){void 0===e&&(e=s);var o=Vc(i,e,t,r,n);return void 0===r?Xc(e,o):o}return l.defaultState=s,l}function Qc(e,t){return e}function ef(e){return e}function tf(e,t,r){void 0===t&&(t=Qc),void 0===r&&(r=ef);var n=e.defaultState;function o(o,a,i,s){void 0===o&&(o=n);var u=t(a,i),c=r(i),f=r(s);if(!u)return o;var l=e(o,u,c,f);return void 0===i?Xc(o,l):l}return o.defaultState=n,o}function rf(e,t,r){return{id:r,root:void 0!==e?e:t,get self(){return t[r]}}}var nf={};function of(e,t,r){function n(n,o,a,i){void 0===n&&(n=nf);var s=t(a),u=Vc(n===nf||s!==t(i)?Jc(s,(function(t){return e}),r):Object.getPrototypeOf(n),n,o,a,i);return void 0===a?Xc(n,u):u}return void 0===r&&(r=rf),n.defaultState=nf,n}function af(){for(var e=arguments,t=arguments.length-1,r=arguments[t],n=[];t-- >0;)n[t]=e[t];if("function"!=typeof r)throw new TypeError("The reducer must be a function");for(var o=0,a=n;o<a.length;o+=1){if("function"!=typeof a[o])throw new TypeError("Each argument filter must be a function")}return function(e,t,o,a){void 0===e&&(e=r.defaultState);for(var i=void 0!==e,s=[],u=0;u<n.length;++u)s[u]=n[u](o),i&&s[u]!==n[u](a)&&(i=!1);return i?e:r.apply(void 0,s)}}function sf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function uf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sf(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sf(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var cf=[],ff=Zc({accountId:function(e,t,r){if(null!=e)return e;for(var n=0,o=Object.keys(r.root.accounts);n<o.length;n++)for(var a=o[n],i=r.root.accounts[a],s=0,u=Object.keys(i.walletInfos);s<u.length;s++){if(u[s]===r.id)return a}throw new Error("Cannot find account for walletId ".concat(r.id))},allEnabledTokenIds:af((function(e){return e.root.accounts[e.self.accountId].alwaysEnabledTokenIds[e.self.pluginId]}),(function(e){return e.self.enabledTokenIds}),(function(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Zu([].concat(Ir(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),Ir(e)))})),pluginId:af((function(e){return e.root.login.walletInfos[e.id].type}),(function(e){return e.root.plugins.currency}),(function(e,t){return Mo(t,e)})),paused:function(e,t,r){return null==e?r.root.accounts[r.self.accountId].pauseWallets:"CURRENCY_WALLET_CHANGED_PAUSED"===t.type?t.payload.paused:e},currencyInfo:function(e,t,r){if(null!=e)return e;var n=r.self.pluginId;return r.root.plugins.currency[n].currencyInfo},detectedTokenIds:hf((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:cf,t=arguments.length>1?arguments[1]:void 0;if("CURRENCY_WALLET_LOADED_TOKEN_FILE"===t.type)return t.payload.detectedTokenIds;if("CURRENCY_ENGINE_DETECTED_TOKENS"===t.type){var r=t.payload.detectedTokenIds;return Zu([].concat(Ir(e),Ir(r)))}return"CURRENCY_ENGINE_CLEARED"===t.type?[]:e})),enabledTokenIds:hf((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:cf,t=arguments.length>1?arguments[1]:void 0;if("CURRENCY_WALLET_LOADED_TOKEN_FILE"===t.type)return t.payload.enabledTokenIds;if("CURRENCY_WALLET_ENABLED_TOKENS_CHANGED"===t.type)return t.payload.enabledTokenIds;if("CURRENCY_ENGINE_DETECTED_TOKENS"===t.type){var r=t.payload.enablingTokenIds;return Zu([].concat(Ir(e),Ir(r)))}return e})),tokenFileDirty:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;switch((arguments.length>1?arguments[1]:void 0).type){case"CURRENCY_WALLET_LOADED_TOKEN_FILE":case"CURRENCY_WALLET_SAVED_TOKEN_FILE":return!1;case"CURRENCY_ENGINE_CLEARED":case"CURRENCY_ENGINE_DETECTED_TOKENS":case"CURRENCY_WALLET_ENABLED_TOKENS_CHANGED":return t.self.detectedTokenIds!==r.self.detectedTokenIds||t.self.enabledTokenIds!==r.self.enabledTokenIds;default:return e}},engineFailure:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;if("CURRENCY_ENGINE_FAILED"===t.type){var r=t.payload.error;return r instanceof Error?r:new Error(String(r))}return e},engineStarted:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;return"CURRENCY_ENGINE_STARTED"===t.type||"CURRENCY_ENGINE_STOPPED"!==t.type&&e},fiat:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return"CURRENCY_WALLET_FIAT_CHANGED"===t.type?t.payload.fiatCurrencyCode:e},fiatLoaded:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"CURRENCY_WALLET_FIAT_CHANGED"===(arguments.length>1?arguments[1]:void 0).type||e},files:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"CURRENCY_WALLET_FILE_CHANGED":var r=t.payload,n=r.json,o=r.txidHash,a=uf({},e);return a[o]=n,a;case"CURRENCY_WALLET_FILES_LOADED":var i=t.payload.files;return uf(uf({},e),i)}return e},fileNames:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"CURRENCY_WALLET_FILE_NAMES_LOADED":var r=t.payload.txFileNames;return uf(uf({},e),r);case"CURRENCY_WALLET_FILE_CHANGED":var n=t.payload,o=n.fileName,a=n.creationDate,i=n.txidHash;return(null==e[i]||a<e[i].creationDate)&&(e[i]={creationDate:a,fileName:o}),e}return e},syncRatio:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"CURRENCY_ENGINE_CHANGED_SYNC_RATIO":return t.payload.ratio;case"CURRENCY_ENGINE_CLEARED":return 0}return e},balanceMap:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map,t=arguments.length>1?arguments[1]:void 0;if("CURRENCY_ENGINE_CHANGED_BALANCE"===t.type){var r=t.payload,n=r.balance,o=r.tokenId,a=new Map(e);return a.set(o,n),a}return e},balances:af((function(e){return e.self.balanceMap}),(function(e){return e.self.currencyInfo}),(function(e){return e.root.accounts[e.self.accountId].allTokens[e.self.pluginId]}),(function(e,t,r){for(var n={},o=0,a=e.keys();o<a.length;o++){var i=a[o],s=e.get(i),u=(null==i?t:r[i]).currencyCode;null!=s&&(n[u]=s)}return n})),height:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;return"CURRENCY_ENGINE_CHANGED_HEIGHT"===t.type?t.payload.height:e},name:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;return"CURRENCY_WALLET_NAME_CHANGED"===t.type?t.payload.name:e},nameLoaded:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"CURRENCY_WALLET_NAME_CHANGED"===(arguments.length>1?arguments[1]:void 0).type||e},seenTxCheckpoint:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;return"CURRENCY_ENGINE_SEEN_TX_CHECKPOINT_CHANGED"===t.type?t.payload.checkpoint:e},sortedTxidHashes:af((function(e){return e.self.txidHashes}),(function(e){return Object.keys(e).sort((function(t,r){return e[t].date>e[r].date?-1:e[t].date<e[r].date?1:0}))})),stakingStatus:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{stakedAmounts:[]},t=arguments.length>1?arguments[1]:void 0;return"CURRENCY_ENGINE_CHANGED_STAKING"===t.type?t.payload.stakingStatus:e},txidHashes:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"CURRENCY_ENGINE_CHANGED_TXS":return lf(e,t.payload.txidHashes);case"CURRENCY_WALLET_FILE_NAMES_LOADED":for(var r=t.payload.txFileNames,n={},o=0,a=Object.keys(r);o<a.length;o++){var i=a[o];n[i]={date:r[i].creationDate}}return lf(e,n)}return e},txs:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"CHANGE_MERGE_TX":var r=t.payload.tx,n=uf({},e);return n[r.txid]=r,n;case"CURRENCY_ENGINE_CHANGED_TXS":for(var o=t.payload.txs,a=uf({},e),i=0;i<o.length;i++){var s=o[i];a[s.txid]=pf(s,a[s.txid])}return a;case"CURRENCY_ENGINE_CLEARED":return{}}return e},unactivatedTokenIds:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"CURRENCY_ENGINE_CHANGED_UNACTIVATED_TOKEN_IDS":return t.payload.unactivatedTokenIds;case"CURRENCY_ENGINE_CLEARED":return[]}return e},gotTxs:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"CURRENCY_ENGINE_GOT_TXS":var r=t.payload.tokenId,n=new Set(e);return n.add(r),n;case"CURRENCY_ENGINE_CLEARED":return new Set;default:return e}},walletInfo:function(e,t,r){return r.root.login.walletInfos[r.id]},publicWalletInfo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;return"CURRENCY_WALLET_PUBLIC_INFO"===t.type?t.payload.walletInfo:e}});function lf(e,t){for(var r=uf({},e),n=0,o=Object.keys(t);n<o.length;n++){var a,i=o[n],s=r[i],u=t[i];r[i]=null==s?u:{date:Math.min(u.date,s.date),txid:null!==(a=u.txid)&&void 0!==a?a:s.txid}}return r}var df=tf(ff,(function(e,t){return/^CURRENCY_/.test(e.type)&&"payload"in e&&"object"===se(e.payload)&&"walletId"in e.payload&&e.payload.walletId===t.id?e:{type:"UPDATE_NEXT"}}));function pf(e,t){var r,n,o,a,i=e.confirmations,s=void 0===i?"unconfirmed":i,u=e.isSend,c=void 0===u?(0,Ra.lt)(e.nativeAmount,"0"):u,f=e.tokenId,l=void 0===f?null:f,d={blockHeight:e.blockHeight,chainAction:e.chainAction,chainAssetAction:new Map(null!==(r=null==t?void 0:t.chainAssetAction)&&void 0!==r?r:[]),confirmations:s,date:e.date,isSend:c,memos:e.memos,nativeAmount:new Map(null!==(n=null==t?void 0:t.nativeAmount)&&void 0!==n?n:[]),networkFee:new Map(null!==(o=null==t?void 0:t.networkFee)&&void 0!==o?o:[]),otherParams:e.otherParams,ourReceiveAddresses:e.ourReceiveAddresses,signedTx:e.signedTx,txid:e.txid};return d.nativeAmount.set(l,e.nativeAmount),d.networkFee.set(l,null!==(a=e.networkFee)&&void 0!==a?a:"0"),null!=e.feeRateUsed&&(d.feeRateUsed=e.feeRateUsed),null!=e.parentNetworkFee&&d.networkFee.set(null,String(e.parentNetworkFee)),null!=e.chainAssetAction&&d.chainAssetAction.set(l,e.chainAssetAction),d}function hf(e){return function(t,r){var n=e(t,r);return n===t?t:(n.sort((function(e,t){return e===t?0:e>t?1:-1})),null!=t&&Ga(n,t)?t:n)}}var bf=5e3;function vf(e,t){var r=e.props,n=r.log,o=r.walletId,a=!1,i=0,s=[];return function(e){if(a){var r;n("throttledTxCallback delay, walletId: ".concat(o)),(r=s).push.apply(r,Ir(e))}else{var u=Date.now();u-i>bf?(i=u,t(e)):(n("throttledTxCallback delay, walletId: ".concat(o)),a=!0,s=e,setTimeout((function(){i=Date.now(),t(s),a=!1,s=[]}),bf))}}}function yf(e){var t=e.props.walletId;"narfavJN4rp9ZzYigcRj1i0vrU2OAGGp4+KksAksj54="===t&&(bf=25,Ya=99,Ha=1);var r=vf(e,(function(t){var r;null!=(null===(r=e.props.walletOutput)||void 0===r?void 0:r.walletApi)&&G(e.props.walletOutput.walletApi,"transactionsChanged",t)})),n=vf(e,(function(t){var r;null!=(null===(r=e.props.walletOutput)||void 0===r?void 0:r.walletApi)&&G(e.props.walletOutput.walletApi,"newTransactions",t)})),o={onAddressesChecked:function(r){Va({id:t,action:"onAddressesChecked",updateFunc:function(){e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_SYNC_RATIO",payload:{ratio:r,walletId:t}})}})},onNewTokens:function(r){Va({id:t,action:"onNewTokens",updateFunc:function(){var n=e.props.walletState,o=n.detectedTokenIds,a=n.enabledTokenIds,i=Zu(r,[].concat(Ir(o),Ir(a)));if(e.props.dispatch({type:"CURRENCY_ENGINE_DETECTED_TOKENS",payload:{detectedTokenIds:r,enablingTokenIds:i,walletId:t}}),i.length>0){var s,u=null===(s=e.props)||void 0===s||null===(s=s.walletOutput)||void 0===s?void 0:s.walletApi;null!=u&&G(u,"enabledDetectedTokens",i)}}})},onUnactivatedTokenIdsChanged:function(r){Va({id:t,action:"onUnactivatedTokenIdsChanged",updateFunc:function(){e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_UNACTIVATED_TOKEN_IDS",payload:{unactivatedTokenIds:r,walletId:t}})}})},onBalanceChanged:function(t,r){var n=e.props.walletState,a=n.accountId,i=n.currencyInfo,s=n.pluginId,u=e.props.state.accounts[a].allTokens[s];if(t===i.currencyCode)o.onTokenBalanceChanged(null,r);else{var c=Ba({allTokens:u,currencyInfo:i,currencyCode:t}).tokenId;null!=c&&o.onTokenBalanceChanged(c,r)}},onTokenBalanceChanged:function(r,n){var o=Te(ti)(n);null!=o?Va({id:"".concat(t,"==").concat(String(r)),action:"onTokenBalanceChanged",updateFunc:function(){e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_BALANCE",payload:{balance:o,tokenId:r,walletId:t}})}}):e.props.onError(new Error("Plugin sent bogus balance for ".concat(String(r),': "').concat(n,'"')))},onBlockHeightChanged:function(n){Va({id:t,action:"onBlockHeightChanged",updateFunc:function(){for(var o=e.props.walletState.txs,a=0,i=Object.keys(o);a<i.length;a++){var s=o[i[a]];if(mf(s.confirmations)){var u=e.props.walletState.currencyInfo.requiredConfirmations,c=e.props.walletState.height;s.confirmations=wf(s,c,u);var f=ia(e.props.state,t,s.txid),l=e.props.walletState.files,d=Cf(e,s,l[f],null);e.props.dispatch({type:"CHANGE_MERGE_TX",payload:{tx:s}}),r([d])}}e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_HEIGHT",payload:{height:n,walletId:t}})}})},onSeenTxCheckpoint:function(t){(function(e,t){return Hc.apply(this,arguments)})(e,t).catch((function(t){return e.props.onError(t)}))},onStakingStatusChanged:function(r){Va({id:t,action:"onStakingStatusChanged",updateFunc:function(){e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_STAKING",payload:{stakingStatus:r,walletId:t}})}})},onTransactions:function(o){var a=e.props.walletState,i=a.accountId,s=a.currencyInfo,u=a.pluginId,c=e.props.state.accounts[i].allTokens[u];if(null!=o&&0!==o.length){for(var f=[],l=0;l<o.length;l++){var d=o[l].transaction;if(Ka(d),"string"!=typeof d.txid||"number"!=typeof d.date||"string"!=typeof d.networkFee||"number"!=typeof d.blockHeight||"string"!=typeof d.nativeAmount||"object"!==se(d.ourReceiveAddresses))return void e.props.onError(new Error("Plugin sent bogus tx: ".concat(JSON.stringify(d,null,2))));if(null==d.isSend&&(d.isSend=(0,Ra.lt)(d.nativeAmount,"0")),null==d.memos&&(d.memos=[]),void 0===d.tokenId){var p=Ba({allTokens:c,currencyInfo:s,currencyCode:d.currencyCode}).tokenId;d.tokenId=null!=p?p:null}f.push(d)}for(var h=e.props.state,b=e.props.walletState.txs,v={},y=[],g=[],m=0;m<o.length;m++){var w=o[m],x=w.isNew,k=w.transaction,I=k.txid;if(mf(k.confirmations)){var O=e.props.walletState.currencyInfo.requiredConfirmations,E=e.props.walletState.height;k.confirmations=wf(k,E,O)}var S=pf(k,b[I]);if(!Ga(S,b[I])||null!=k.metadata){var A=ia(h,t,I);null==e.props.walletState.fileNames[A]&&Uc(e,k).catch((function(t){return e.props.onError(t)}));var _=e.props.walletState.files,T=Cf(e,S,_[A],k.tokenId);x?g.push(T):y.push(T),v[A]={date:T.date,txid:I}}}e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_TXS",payload:{txs:f,walletId:t,txidHashes:v}}),y.length>0&&r(y),g.length>0&&n(g)}},onTransactionsChanged:function(e){o.onTransactions(e.map((function(e){return{isNew:!1,transaction:e}})))},onAddressChanged:function(){null!=e.props.walletOutput.walletApi&&G(e.props.walletOutput.walletApi,"addressChanged",void 0)},onWcNewContractCall:function(t){null!=e.props.walletOutput.walletApi&&G(e.props.walletOutput.walletApi,"wcNewContractCall",t)},onTxidsChanged:function(){}};return o}function gf(e){var r,n=e.props.walletId;function o(e){return a.apply(this,arguments)}function a(){return(a=t(c().mark((function t(o){var a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((a=ra(o.state,n))===r){t.next=13;break}return r=a,t.next=5,_c(e);case 5:return t.next=7,Oc(e);case 7:return t.next=9,Sc(e);case 9:return t.next=11,Nc(e);case 11:return t.next=13,Rc(e);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}!function t(){e.nextProps().then(o).then(t,(function(r){var n;(n=r)instanceof Error&&"PixieShutdownError"===n.name||(e.props.onError(r),t())}))}()}var mf=function(e){return"confirmed"!==e&&"dropped"!==e&&"failed"!==e},wf=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e.blockHeight>0){var n=1+t-e.blockHeight;return n<=0?"syncing":n>=r?"confirmed":n}return e.blockHeight<0?"dropped":"unconfirmed"};function xf(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date(0),r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Date;return 1e3*e.date>=t.valueOf()&&1e3*e.date<r.valueOf()}function kf(e,t,r){var n,o=e.props.state.currency;if(null==r||""===r)return!0;for(var a=r.toLowerCase().replace(".","").replace(",",""),i=0;i<a.length;i++)if("0"!==a[i]){a=a.substring(i);break}function s(e){return null!=e&&("string"==typeof e||"number"==typeof e)&&!!e.toString().toLowerCase().replace(".","").replace(",","").includes(a)}if(s(t.nativeAmount))return!0;if(null!=t.metadata){var u=t.metadata,c=u.category,f=void 0===c?"":c,l=u.name,d=void 0===l?"":l,p=u.notes,h=void 0===p?"":p,b=u.exchangeAmount,v=void 0===b?{}:b,y=null!=t.walletId?o.wallets[t.walletId]:void 0;if(s(f)||s(d)||s(h)||null!=y&&s(v[y.fiat]))return!0}if(null!=t.swapData){var g=t.swapData.plugin,m=g.displayName,w=void 0===m?"":m,x=g.pluginId,k=void 0===x?"":x;if(s(w)||s(k))return!0}var I=null!==(n=t.savedAction)&&void 0!==n?n:t.chainAction;if(null!=I&&"swap"===I.actionType){var O=I.toAsset.pluginId,E=I.fromAsset.pluginId,S=I.swapInfo,A=S.displayName,_=S.supportEmail;if(s(E)||s(O)||s(A)||s(_))return!0}if(null!=t.spendTargets)for(var T=0,P=t.spendTargets;T<P.length;T++){var M=P[T],j=M.publicAddress,C=void 0===j?"":j,N=M.memo,D=void 0===N?"":N;if(s(C)||s(D))return!0}if(t.ourReceiveAddresses.length>0)for(var R=0,B=t.ourReceiveAddresses;R<B.length;R++){if(s(B[R]))return!0}return!!s(t.txid)}function If(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Of(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?If(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):If(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ef(e,t){var r,n,o=[],a=t.memoType;if("hex"===a||"number"===a||"text"===a)for(var i=0,u=e.spendTargets;i<u.length;i++){var c,f=u[i];null!=f.memo?o.push({type:a,value:f.memo}):null!=f.uniqueIdentifier?o.push({type:a,value:f.uniqueIdentifier}):"string"==typeof(null===(c=f.otherParams)||void 0===c?void 0:c.uniqueIdentifier)&&o.push({type:a,value:f.otherParams.uniqueIdentifier})}for(var l=0;l<o.length;l++){var d=o[l];"hex"===d.type&&(d.value=d.value.replace(/^0x/i,""))}var p=Of(Of({},e),{},{spendTargets:e.spendTargets.map((function(e){return Of(Of({},e),{},{memo:void 0,uniqueIdentifier:void 0})})),memos:null!==(r=e.memos)&&void 0!==r?r:o});if(1===(null===(n=p.memos)||void 0===n?void 0:n.length)&&p.spendTargets.length>=1){var h=s(p.memos,1)[0];if(h.type===t.memoType){var b=s(p.spendTargets,1)[0];b.memo=h.value,b.uniqueIdentifier=h.value,b.otherParams=Of(Of({},b.otherParams),{},{uniqueIdenfitifer:h.value})}}return p}function Sf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Af(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Sf(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sf(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var _f=function(){var e=t(c().mark((function e(t,r,n,o,a){var i,s,u,f,l,d,p,h,b,v;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(v=function(e,t){var r=(0,Ra.sub)(t,e);if((0,Ra.lte)(r,"1"))return Promise.resolve(e);var o=(0,Ra.add)(e,(0,Ra.div)(r,"2"));b[0].nativeAmount=o;var i=u?a.keys:void 0;return n.makeSpend(Af(Af({},s),{},{spendTargets:b,networkFeeOption:d,customNetworkFee:p}),{privateKeys:i}).then((function(){return v(o,t)})).catch((function(){return v(e,o)}))},t=Ef(t,r.currencyInfo),s=Ba({allTokens:o,currencyInfo:r.currencyInfo,tokenId:t.tokenId}),u=null!==(i=r.currencyInfo.unsafeMakeSpend)&&void 0!==i&&i,"function"!=typeof n.getMaxSpendable){e.next=9;break}return f=u?a.keys:void 0,e.next=8,n.getMaxSpendable(Af(Af({},t),s),{privateKeys:f});case 8:case 14:return e.abrupt("return",e.sent);case 9:return d=(l=t).networkFeeOption,p=l.customNetworkFee,h=n.getBalance(s),b=t.spendTargets.map((function(e){return Af(Af({},e),{},{nativeAmount:"0"})})),e.next=14,v("0",(0,Ra.add)(h,"1"));case 15:case"end":return e.stop()}}),e)})));return function(t,r,n,o,a){return e.apply(this,arguments)}}();function Tf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Pf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Tf(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tf(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Mf={bizId:0,category:"",exchangeAmount:{},name:"",notes:""};function jf(e,r,n,o){var a=fd(e),i=e.props.walletState,s=i.accountId,u=i.pluginId,f=i.walletInfo,l=e.props.state.plugins.currency[u],d=l.currencyInfo,p=d.unsafeBroadcastTx,h=void 0!==p&&p,b=d.unsafeMakeSpend,v=void 0!==b&&b,y=Ua(a,f),g=yf(e),m={};if(null!=r.otherMethods)for(var w=0,k=Object.keys(r.otherMethods);w<k.length;w++){var I=k[w],O=r.otherMethods[I];"function"==typeof O&&(m[I]=O)}if(null!=r.otherMethodsWithKeys)for(var E=function(){var e=A[S],t=r.otherMethodsWithKeys[e];if("function"!=typeof t)return 1;m[e]=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.apply(void 0,[f.keys].concat(r))}},S=0,A=Object.keys(r.otherMethodsWithKeys);S<A.length;S++)E();C(m);var _={on:re,watch:ne,get created(){return f.created},get disklet(){return y.disklet},get id(){return y.id},get localDisklet(){return y.localDisklet},publicWalletInfo:o,sync:function(){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y.sync();case 2:case"end":return e.stop()}}),e)})))()},get type(){return y.type},get name(){return e.props.walletState.name},renameWallet:function(r){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,wc(e,r);case 2:case"end":return t.stop()}}),t)})))()},get fiatCurrencyCode(){return e.props.walletState.fiat},setFiatCurrencyCode:function(r){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,kc(e,r);case 2:case"end":return t.stop()}}),t)})))()},get currencyConfig(){return e.props.output.accounts[s].accountApi.currencyConfig[u]},get currencyInfo(){return l.currencyInfo},denominationToNative:function(r,n){return t(c().mark((function t(){var o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=Fa(l.currencyInfo,e.props.state.accounts[s].allTokens[u],n),t.abrupt("return",(0,Ra.mul)(r,o));case 2:case"end":return t.stop()}}),t)})))()},nativeToDenomination:function(r,n){return t(c().mark((function t(){var o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=Fa(l.currencyInfo,e.props.state.accounts[s].allTokens[u],n),t.abrupt("return",(0,Ra.div)(r,o,o.length));case 2:case"end":return t.stop()}}),t)})))()},get balances(){return e.props.walletState.balances},get balanceMap(){return e.props.walletState.balanceMap},get blockHeight(){return e.props.state.skipBlockHeight?0:e.props.walletState.height},get syncRatio(){return e.props.walletState.syncRatio},get unactivatedTokenIds(){return e.props.walletState.unactivatedTokenIds},changePaused:function(r){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.props.dispatch({type:"CURRENCY_WALLET_CHANGED_PAUSED",payload:{walletId:e.props.walletId,paused:r}});case 1:case"end":return t.stop()}}),t)})))()},get paused(){return e.props.walletState.paused},changeEnabledTokenIds:function(r){return t(c().mark((function t(){var n,o,a,i,s,u,f,l,d,p;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=e.props,a=o.dispatch,i=o.walletId,s=o.walletState,u=s.accountId,f=s.pluginId,l=e.props.state.accounts[u],d=null!==(n=l.allTokens[f])&&void 0!==n?n:{},p=Zu(r).filter((function(e){return null!=d[e]})),a({type:"CURRENCY_WALLET_ENABLED_TOKENS_CHANGED",payload:{walletId:i,enabledTokenIds:p}});case 6:case"end":return t.stop()}}),t)})))()},get detectedTokenIds(){return e.props.walletState.detectedTokenIds},get enabledTokenIds(){return e.props.walletState.enabledTokenIds},getNumTransactions:function(n){return t(c().mark((function t(){var o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=Ba({allTokens:e.props.state.accounts[s].allTokens[u],currencyInfo:l.currencyInfo,tokenId:n.tokenId}),t.abrupt("return",r.getNumTransactions(o));case 2:case"end":return t.stop()}}),t)})))()},$internalStreamTransactions:function(n){var o=this;return t(c().mark((function i(){var s,u,f,l,d,p,h,b,v,y,m,w,x,k,I,O,E,S,A,_,T,P,M,j;return c().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(s=n.afterDate,u=n.batchSize,f=void 0===u?10:u,l=n.beforeDate,d=n.firstBatchSize,p=void 0===d?f:d,h=n.searchString,b=n.spamThreshold,v=void 0===b?"0":b,y=n.tokenId,w=null==(m=void 0===y?null:y)?o.currencyInfo:o.currencyConfig.allTokens[m],x=w.currencyCode,k={currencyCode:x,tokenId:m},(I=e.props.walletState).gotTxs.has(m)){i.next=11;break}return i.next=7,r.getTransactions(k);case 7:O=i.sent,g.onTransactionsChanged(O),e.props.dispatch({type:"CURRENCY_ENGINE_GOT_TXS",payload:{walletId:e.props.walletId,tokenId:m}}),I=e.props.walletState;case 11:return S=(E=I).files,A=E.sortedTxidHashes,_=E.txidHashes,T=E.txs,P=0,M=!0,j=0,i.abrupt("return",C({next:function(){return t(c().mark((function t(){var r,n,o,i,u,d,b,y,g,w,x,k,I;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=M?p:f,n=[];case 2:if(!(P<A.length&&n.length<r)){t.next=32;break}if(!(P>=j)){t.next=10;break}return u=A.slice(j,j+r).filter((function(e){return null==S[e]})),t.next=7,Pc(e,u);case 7:d=t.sent,Object.assign(S,d),j+=r;case 10:if(b=A[P++],y=S[b],null!=(g=null!==(o=null==y?void 0:y.txid)&&void 0!==o?o:null===(i=_[b])||void 0===i?void 0:i.txid)){t.next=15;break}return t.abrupt("continue",2);case 15:if(w=T[g],x=null==w?void 0:w.nativeAmount.get(m),k=null==w?void 0:w.networkFee.get(m),null!=w&&null!=x&&null!=k){t.next=20;break}return t.abrupt("continue",2);case 20:if(I=Cf(e,w,y,m),Ka(I),kf(a,I,h)){t.next=24;break}return t.abrupt("continue",2);case 24:if(xf(I,s,l)){t.next=26;break}return t.abrupt("continue",2);case 26:if(w.isSend||null!=I.assetAction||null!=I.chainAction||null!=I.chainAssetAction||null!=I.savedAction||!(0,Ra.lt)((0,Ra.abs)(x),v)){t.next=29;break}return t.abrupt("continue",2);case 29:n.push(I),t.next=2;break;case 32:return M=!1,t.abrupt("return",{done:0===n.length,value:n});case 34:case"end":return t.stop()}}),t)})))()}}));case 16:case"end":return i.stop()}}),i)})))()},getTransactions:function(r){return t(c().mark((function t(){var n,o,a,i,f,d,p,h;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.endDate,o=r.startDate,a=r.searchString,i=r.spamThreshold,f=Ba({allTokens:e.props.state.accounts[s].allTokens[u],currencyInfo:l.currencyInfo,tokenId:r.tokenId}),t.next=4,_.$internalStreamTransactions(Pf(Pf({},f),{},{afterDate:o,beforeDate:n,searchString:a,spamThreshold:i}));case 4:d=t.sent,p=[];case 6:return t.next=9,d.next();case 9:if(!(h=t.sent).done){t.next=12;break}return t.abrupt("return",p);case 12:p.push.apply(p,Ir(h.value)),t.next=6;break;case 15:case"end":return t.stop()}}),t)})))()},streamTransactions:ve,getAddresses:function(n){return t(c().mark((function t(){var o,a,i,f,d,p,h,b,v;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null==r.getAddresses){t.next=6;break}return t.next=3,r.getAddresses(n);case 3:return t.abrupt("return",t.sent);case 6:return o=Ba({allTokens:e.props.state.accounts[s].allTokens[u],currencyInfo:l.currencyInfo,tokenId:n.tokenId}),t.next=9,r.getFreshAddress(Pf(Pf({},o),{},{forceIndex:n.forceIndex}));case 9:return a=t.sent,i=a.publicAddress,f=a.legacyAddress,d=a.segwitAddress,p=a.nativeBalance,h=a.legacyNativeBalance,b=a.segwitNativeBalance,v=[{addressType:"publicAddress",publicAddress:i,nativeBalance:p}],null!=d&&v.unshift({addressType:"segwitAddress",publicAddress:d,nativeBalance:b}),null!=f&&v.push({addressType:"legacyAddress",publicAddress:f,nativeBalance:h}),t.abrupt("return",v);case 15:case"end":return t.stop()}}),t)})))()},getReceiveAddress:function(e){var r=this;return t(c().mark((function t(){var n,o,a,i,s,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.getAddresses(e);case 2:if(!((o=t.sent).length<1)){t.next=5;break}throw new Error("No addresses available");case 5:return a=null!==(n=o.find((function(e){return"publicAddress"===e.addressType})))&&void 0!==n?n:o[0],i={publicAddress:a.publicAddress,nativeBalance:a.nativeBalance,metadata:Mf,nativeAmount:"0"},null!=(s=o.find((function(e){return"segwitAddress"===e.addressType})))&&(i.segwitAddress=s.publicAddress,i.segwitNativeBalance=s.nativeBalance),null!=(u=o.find((function(e){return"legacyAddress"===e.addressType})))&&(i.legacyAddress=u.publicAddress,i.legacyNativeBalance=u.nativeBalance),t.abrupt("return",i);case 12:case"end":return t.stop()}}),t)})))()},lockReceiveAddress:function(e){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))()},saveReceiveAddress:function(e){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))()},broadcastTx:function(e){return t(c().mark((function t(){var n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=h?f.keys:void 0,t.next=3,r.broadcastTx(e,{privateKeys:n});case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))()},getMaxSpendable:function(n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,_f(n,l,r,e.props.state.accounts[s].allTokens[u],f);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},getPaymentProtocolInfo:function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=r.getPaymentProtocolInfo){t.next=2;break}throw new Error("'getPaymentProtocolInfo' is not implemented on wallets of this type");case 2:return t.next=4,r.getPaymentProtocolInfo(e);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})))()},makeSpend:function(n){return t(c().mark((function t(){var o,a,i,d,p,h,b,y,g,m,w,x,k,I,O,E,S,A,_,T,P,M,j,C,N,D,R,B,L,K,U;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=Ef(n,l.currencyInfo),a=(o=n).assetAction,i=o.customNetworkFee,d=o.enableRbf,p=o.memos,h=o.metadata,b=o.networkFeeOption,y=void 0===b?"standard":b,g=o.noUnconfirmed,m=void 0!==g&&g,w=o.otherParams,x=o.pendingTxs,k=o.rbfTxid,I=o.savedAction,O=o.skipChecks,E=o.spendTargets,S=void 0===E?[]:E,A=o.swapData,_=Ba({allTokens:e.props.state.accounts[s].allTokens[u],currencyInfo:l.currencyInfo,tokenId:n.tokenId}),T=[],P=[],M=0;case 6:if(!(M<S.length)){t.next=16;break}if(j=S[M],C=j.memo,N=j.publicAddress,D=j.nativeAmount,R=void 0===D?"0":D,B=j.otherParams,L=void 0===B?{}:B,null!=N){t.next=11;break}return t.abrupt("continue",13);case 11:T.push({memo:C,nativeAmount:R,otherParams:L,publicAddress:N,uniqueIdentifier:C}),P.push({currencyCode:_.currencyCode,memo:C,nativeAmount:R,publicAddress:N,uniqueIdentifier:C});case 13:M++,t.next=6;break;case 16:if(null==n.privateKeys){t.next=18;break}throw new TypeError("Only sweepPrivateKeys takes private keys");case 18:return K=v?f.keys:void 0,t.next=21,r.makeSpend(Pf(Pf({},_),{},{customNetworkFee:i,enableRbf:d,memos:p,metadata:h,networkFeeOption:y,noUnconfirmed:m,otherParams:w,pendingTxs:x,rbfTxid:k,skipChecks:O,spendTargets:T}),{privateKeys:K});case 21:return U=t.sent,Ka(U),U.networkFeeOption=y,U.requestedCustomFee=i,U.spendTargets=P,U.currencyCode=_.currencyCode,U.tokenId=_.tokenId,null!=h&&(U.metadata=h),null!=A&&(U.swapData=ei(A)),null!=I&&(U.savedAction=ai(I)),null!=a&&(U.assetAction=ii(a)),null!=e.props.state.login.deviceDescription&&(U.deviceDescription=e.props.state.login.deviceDescription),t.abrupt("return",U);case 34:case"end":return t.stop()}}),t)})))()},saveTx:function(n){return t(c().mark((function t(){var o,a,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=e.props.walletState.txs[n.txid]){t.next=11;break}return t.next=3,Uc(e,n);case 3:return o=t.sent,a=o.fileName,i=o.txFile,t.next=8,Wc(e,a,i);case 8:g.onTransactions([{isNew:!0,transaction:n}]),t.next=13;break;case 11:return t.next=13,Lc(e,n.txid,n.tokenId,g);case 13:return t.next=15,r.saveTx(n);case 15:case"end":return t.stop()}}),t)})))()},saveTxAction:function(r){return t(c().mark((function t(){var n,o,a,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.txid,o=r.tokenId,a=r.assetAction,i=r.savedAction,t.next=3,Lc(e,n,o,g,void 0,a,i);case 3:case"end":return t.stop()}}),t)})))()},saveTxMetadata:function(r){return t(c().mark((function t(){var n,o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.txid,o=r.tokenId,a=r.metadata,t.next=3,Lc(e,n,o,g,a);case 3:case"end":return t.stop()}}),t)})))()},signBytes:function(e){var n=arguments;return t(c().mark((function t(){var o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=n.length>1&&void 0!==n[1]?n[1]:{},a=f.keys,null==r.signBytes){t.next=8;break}return t.next=5,r.signBytes(e,a,o);case 5:case 11:return t.abrupt("return",t.sent);case 8:if("bitcoin"!==u||null==r.signMessage){t.next=12;break}return t.next=11,r.signMessage(x.stringify(e),a,o);case 12:throw new Error("".concat(u," doesn't support signBytes"));case 13:case"end":return t.stop()}}),t)})))()},signMessage:function(e){var n=arguments;return t(c().mark((function t(){var o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=n.length>1&&void 0!==n[1]?n[1]:{},null!=r.signMessage){t.next=3;break}throw new Error("".concat(u," doesn't support signing messages"));case 3:return a=f.keys,t.next=6,r.signMessage(e,a,o);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)})))()},signTx:function(e){return t(c().mark((function t(){var n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.keys,t.next=3,r.signTx(e,n);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))()},sweepPrivateKeys:function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=r.sweepPrivateKeys){t.next=2;break}throw new Error("Sweeping this currency is not supported.");case 2:return t.next=4,r.sweepPrivateKeys(e);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})))()},accelerate:function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=r.accelerate){t.next=2;break}return t.abrupt("return",null);case 2:return t.next=4,r.accelerate(e);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})))()},get stakingStatus(){return e.props.walletState.stakingStatus},dumpData:function(){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.dumpData();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))()},resyncBlockchain:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a.props.dispatch({type:"CURRENCY_ENGINE_CLEARED",payload:{walletId:e.props.walletId}}),t.next=3,r.resyncBlockchain();case 3:case"end":return t.stop()}}),t)})))()},encodeUri:function(r){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.encodeUri(r,Ea(e.props.state.accounts[s].customTokens[u]));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},parseUri:function(r,o){return t(c().mark((function t(){var a,i,f,d,p;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.parseUri(r,o,Ea(e.props.state.accounts[s].customTokens[u]));case 2:return void 0===(a=t.sent).tokenId&&(f=Ba({allTokens:e.props.state.accounts[s].allTokens[u],currencyInfo:l.currencyInfo,currencyCode:null!==(i=a.currencyCode)&&void 0!==i?i:o}),d=f.tokenId,p=void 0===d?null:d,a.tokenId=p),t.abrupt("return",a);case 5:case"end":return t.stop()}}),t)})))()},otherMethods:m};return C(_)}function Cf(e,t,r,n){var o,a,i,s=e.props.walletId,u=e.props.walletState,c=u.accountId,f=u.currencyInfo,l=u.pluginId,d=e.props.state.accounts[c].allTokens[l],p=(null==n?f:d[n]).currencyCode,h=f.currencyCode,b={chainAction:t.chainAction,chainAssetAction:t.chainAssetAction.get(n),blockHeight:t.blockHeight,confirmations:t.confirmations,currencyCode:p,feeRateUsed:t.feeRateUsed,date:t.date,isSend:t.isSend,memos:t.memos,metadata:{},nativeAmount:null!==(o=t.nativeAmount.get(n))&&void 0!==o?o:"0",networkFee:null!==(a=t.networkFee.get(n))&&void 0!==a?a:"0",networkFees:[],otherParams:Pf({},t.otherParams),ourReceiveAddresses:t.ourReceiveAddresses,parentNetworkFee:h===p?void 0:null!==(i=t.networkFee.get(null))&&void 0!==i?i:"0",signedTx:t.signedTx,tokenId:n,txid:t.txid,walletId:s};if(null!=r){var v,y,g,m,w,x,k,I,O;r.creationDate<b.date&&(b.date=r.creationDate),b.metadata=$a(null!==(v=null!==(y=null===(g=r.tokens.get(null))||void 0===g?void 0:g.metadata)&&void 0!==y?y:null===(m=r.currencies.get(h))||void 0===m?void 0:m.metadata)&&void 0!==v?v:{},null!==(w=null!==(x=null===(k=r.tokens.get(n))||void 0===k?void 0:k.metadata)&&void 0!==x?x:null===(I=r.currencies.get(p))||void 0===I?void 0:I.metadata)&&void 0!==w?w:{}),null!=r.feeRateRequested&&("string"==typeof r.feeRateRequested?b.networkFeeOption=r.feeRateRequested:(b.networkFeeOption="custom",b.requestedCustomFee=r.feeRateRequested)),null==b.feeRateUsed&&(b.feeRateUsed=r.feeRateUsed),null!=r.payees&&(b.spendTargets=r.payees.map((function(e){return{currencyCode:e.currency,memo:e.tag,nativeAmount:e.amount,publicAddress:e.address,uniqueIdentifier:e.tag}})));var E=null===(O=r.tokens.get(n))||void 0===O?void 0:O.assetAction;null!=E&&(b.assetAction=E),null!=r.savedAction&&(b.savedAction=r.savedAction),null!=r.swap&&(b.swapData=r.swap),null!=r.secret&&(b.txSecret=r.secret),null!=r.deviceDescription&&(b.deviceDescription=r.deviceDescription)}return b}function Nf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Df(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Nf(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nf(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Rf="publicKey.json",Bf=Qn(hi),Lf=Yn({engine:function(e){return t(c().mark((function t(){var r,n,o,a,i,s,u,f,l,d,p,h,b,v,y,g,m,w,x,k,I,O,E;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.props,n=r.state,o=r.walletId,a=r.walletState,i=a.accountId,s=a.pluginId,u=a.walletInfo,f=n.plugins.currency[s],l=f.currencyInfo.currencyCode,t.prev=4,h=fd(e),t.next=8,Qo(h,u);case 8:return b=e.props.state,v=oa(b,u.id),y=aa(b,u.id,e.props.io),t.next=13,Nc(e);case 13:return t.next=15,Co(h,s);case 15:return g=t.sent,t.next=18,Kf(u,v,g);case 18:return m=t.sent,e.props.dispatch({type:"CURRENCY_WALLET_PUBLIC_INFO",payload:{walletInfo:m,walletId:o}}),t.next=22,zc(e);case 22:return w=t.sent,t.next=25,_c(e);case 25:return x=b.accounts[i],t.next=28,f.makeCurrencyEngine(m,{callbacks:yf(e),seenTxCheckpoint:w,log:fo(e.props.logBackend,"".concat(s,"-").concat(u.id.slice(0,2))),walletLocalDisklet:v,walletLocalEncryptedDisklet:y,customTokens:null!==(d=x.customTokens[s])&&void 0!==d?d:{},enabledTokenIds:e.props.walletState.allEnabledTokenIds,userSettings:null!==(p=x.userSettings[s])&&void 0!==p?p:{}});case 28:if(k=t.sent,e.onOutput(k),I={currencyCode:l,tokenId:null},null!=(O=Te(ti)(k.getBalance(I)))&&e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_BALANCE",payload:{balance:O,tokenId:null,walletId:o}}),E=k.getBlockHeight(),e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_HEIGHT",payload:{height:E,walletId:o}}),null==k.getStakingStatus){t.next=38;break}return t.next=38,k.getStakingStatus().then((function(t){e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_STAKING",payload:{stakingStatus:t,walletId:o}})}),(function(t){return e.props.onError(t)}));case 38:return t.next=40,Oc(e);case 40:return t.next=42,Sc(e);case 42:return t.next=44,Rc(e);case 44:t.next=50;break;case 46:t.prev=46,t.t0=t.catch(4),e.props.onError(t.t0),e.props.dispatch({type:"CURRENCY_ENGINE_FAILED",payload:{error:t.t0,walletId:o}});case 50:return gf(e),t.next=53,Zn;case 53:return t.abrupt("return",t.sent);case 54:case"end":return t.stop()}}),t,null,[[4,46]])})))},walletApi:function(e){return t(c().mark((function t(){var r,n,o,a,i,s,u,f,l;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.props,n=r.walletOutput,o=r.walletState,null!=n){t.next=3;break}return t.abrupt("return");case 3:if(a=n.engine,i=o.nameLoaded,s=o.pluginId,u=o.publicWalletInfo,null!=a&&null!=u&&i){t.next=7;break}return t.abrupt("return");case 7:return t.next=9,Co(fd(e),s);case 9:return f=t.sent,l=jf(e,a,f,u),e.onOutput(l),t.next=14,Zn;case 14:return t.abrupt("return",t.sent);case 15:case"end":return t.stop()}}),t)})))},engineStarted:Xn((function(e){var r,n;return{update:function(){var o=e.props,a=o.log,i=o.walletId,s=o.walletOutput,u=o.walletState,f=u.currencyInfo,l=u.walletInfo,d=u.publicWalletInfo;if(null!=s){var p=s.engine;if(null!=s.walletApi&&u.fiatLoaded&&!u.engineStarted&&null!=p&&null==r&&(a("".concat(i," startEngine")),e.props.dispatch({type:"CURRENCY_ENGINE_STARTED",payload:{walletId:i}}),r=Promise.resolve().then((function(){return p.startEngine()})).catch((function(t){return e.props.onError(t)})),null!=p.syncNetwork)){var h=!0===f.unsafeSyncNetwork&&null!=d?l.keys:void 0,b=function(){var e=t(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==p.syncNetwork){e.next=7;break}return e.next=3,p.syncNetwork({privateKeys:h});case 3:t=e.sent,n.setDelay(t),e.next=8;break;case 7:n.stop();case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(n=To(b,1e4,{onError:function(e){a.error(e)}})).start({wait:!1})}}},destroy:function(){var t=e.props,o=t.log,a=t.walletId,i=t.walletOutput;if(null!=i){var s=i.engine;null!=s&&null!=r&&(o("".concat(a," killEngine")),r.then((function(){return s.killEngine()})).catch((function(t){return e.props.onError(t)})).then((function(){return e.props.dispatch({type:"CURRENCY_ENGINE_STOPPED",payload:{walletId:a}})})).catch((function(){}))),null!=n&&n.stop()}}}}),(function(e){return e.state.paused||e.walletState.paused?void 0:e})),syncTimer:Xn((function(e){function r(){return(r=t(c().mark((function t(){var r;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.props.walletId,t.next=3,ta(fd(e),r);case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var n=To((function(){return r.apply(this,arguments)}),Zo);return{update:function(){var t=e.props,r=t.state,o=t.walletId;null!=t.walletOutput&&null!=r.storageWallets[o]&&r.storageWallets[o].status.lastSync>0&&n.start({wait:Zo*(1+Math.random())})},destroy:function(){n.stop()}}}),(function(e){return e.state.paused||e.walletState.paused?void 0:e})),tokenSaver:function(e){return function(){var r=t(c().mark((function t(){var r,n,o,a,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.props.walletState,n=r.detectedTokenIds,o=r.enabledTokenIds,a=r.tokenFileDirty,i=null!=n&&null!=o,!a||!i){t.next=8;break}return t.next=5,vc(e,n,o).catch((function(t){return e.props.onError(t)}));case 5:return e.props.dispatch({type:"CURRENCY_WALLET_SAVED_TOKEN_FILE",payload:{walletId:e.props.walletId}}),t.next=8,Po(100);case 8:case"end":return t.stop()}}),t)})));return function(){return r.apply(this,arguments)}}()},watcher:function(e){var r,n={},o={},a=cf;return t(c().mark((function t(){var i,s,u,f,l,d,p,h,b,v,y,g,m,w,x,k,I,O,E,S,A;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(u=e.props,f=u.state,l=u.walletState,d=u.walletOutput,null!=l&&null!=d){t.next=3;break}return t.abrupt("return");case 3:if(p=d.engine,h=d.walletApi,b=l.accountId,v=l.pluginId,y=f.accounts[b],r!==l&&null!=h&&H(h),r=l,g=null!==(i=y.userSettings[v])&&void 0!==i?i:n,n===g||null==p){t.next=12;break}return t.next=12,p.changeUserSettings(g);case 12:if(n=g,m=null!==(s=y.customTokens[v])&&void 0!==s?s:o,o===m||null==p){t.next=35;break}if(null==p.changeCustomTokens){t.next=20;break}return t.next=18,p.changeCustomTokens(m);case 18:t.next=35;break;case 20:if(null==p.addCustomToken){t.next=35;break}w=0,x=Object.keys(m);case 22:if(!(w<x.length)){t.next=35;break}if(k=x[w],(I=m[k])!==o[k]){t.next=27;break}return t.abrupt("continue",32);case 27:if(null!=(O=Sa(I))){t.next=30;break}return t.abrupt("continue",32);case 30:return t.next=32,p.addCustomToken(Df(Df({},O),I)).catch((function(t){return e.props.onError(t)}));case 32:w++,t.next=22;break;case 35:if(o=m,E=l.allEnabledTokenIds,a===E||null==p){t.next=50;break}if(null==p.changeEnabledTokenIds){t.next=43;break}return t.next=41,p.changeEnabledTokenIds(E).catch((function(t){return e.props.onError(t)}));case 41:t.next=50;break;case 43:if(null==p.disableTokens||null==p.enableTokens){t.next=50;break}return S=$u(y.builtinTokens[v],y.customTokens[v],l.currencyInfo,Zu(a,E)),A=$u(y.builtinTokens[v],y.customTokens[v],l.currencyInfo,Zu(E,a)),t.next=48,p.disableTokens(S).catch((function(t){return e.props.onError(t)}));case 48:return t.next=50,p.enableTokens(A).catch((function(t){return e.props.onError(t)}));case 50:a=E;case 51:case"end":return t.stop()}}),t)})))}});function Kf(e,t,r){return Uf.apply(this,arguments)}function Uf(){return(Uf=t(c().mark((function e(t,r,n){var o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Bf.load(r,Rf);case 2:if(null==(o=e.sent)){e.next=11;break}if(e.t0=null==n.checkPublicKey,e.t0){e.next=9;break}return e.next=8,n.checkPublicKey(o.walletInfo.keys);case 8:e.t0=e.sent;case 9:if(!e.t0){e.next=11;break}return e.abrupt("return",o.walletInfo);case 11:return a={},e.prev=12,e.next=15,n.derivePublicKey(t);case 15:a=e.sent,e.next=20;break;case 18:e.prev=18,e.t1=e.catch(12);case 20:if(i={id:t.id,type:t.type,keys:a},!(Object.keys(a).length>0)){e.next=24;break}return e.next=24,Bf.save(r,Rf,{walletInfo:i});case 24:return e.abrupt("return",i);case 25:case"end":return e.stop()}}),e,null,[[12,18]])})))).apply(this,arguments)}function Ff(e,t){return Wf.apply(this,arguments)}function Wf(){return Wf=t(c().mark((function e(t,r){var n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Kr(t,r.loginId),o=n.stashTree,e.next=3,Tr(t,"POST","/v2/login/delete",_n(o,r));case 3:case"end":return e.stop()}}),e)}))),Wf.apply(this,arguments)}function qf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function zf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?qf(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qf(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Gf(e,t,r){return Hf.apply(this,arguments)}function Hf(){return(Hf=t(c().mark((function e(t,r,n){var o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t.props.state.accounts[r].allWalletInfosFull,null!=(a=o.find((function(e){return e.id===n})))){e.next=4;break}throw new Error("Invalid wallet id ".concat(n));case 4:if(null!=(i=jo(t.props.state.plugins.currency,a.type))){e.next=7;break}return e.abrupt("return",[]);case 7:return e.next=9,Co(t,i);case 9:if(null!=(s=e.sent).getSplittableTypes){e.next=12;break}return e.abrupt("return",[]);case 12:return e.next=14,s.getSplittableTypes(a);case 14:return u=e.sent,e.abrupt("return",u.filter((function(e){var t=Yf(a,e),r=o.find((function(e){return e.id===t.id}));return null==r||r.archived||r.deleted})));case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Yf(e,t){var r=e.id,n=e.type,o=e.keys,a=Te(Ro)(o);if(null==a)throw new Error("Wallet ".concat(r," is not a splittable type"));for(var i=a.dataKey,s=a.syncKey,u=Zf(lr(Yt.parse(n),i),lr(Yt.parse(t),i)),c=Zf(x.parse(r),u),f=Zf(s,u.subarray(0,s.length)),l=n.replace(/wallet:/,"").replace("-",""),d=t.replace(/wallet:/,"").replace("-",""),p=Bo({dataKey:i,syncKey:f}),h=0,b=Object.keys(o);h<b.length;h++){var v=b[h],y=v===l+"Key"?d+"Key":v;null==p[y]&&(p[y]=o[v])}return{id:x.stringify(c),keys:p,type:t}}function Jf(e,t,r,n){return Vf.apply(this,arguments)}function Vf(){return(Vf=t(c().mark((function e(t,r,n,o){var a,i,s,u,f,l,d,p,h,b,v,y;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.props.state.accounts[r],i=a.allWalletInfosFull,s=a.sessionKey,null!=(u=i.find((function(e){return e.id===n})))){e.next=5;break}throw new Error("Invalid wallet id ".concat(n));case 5:if("wallet:bitcoincash"!==o||"wallet:bitcoin"!==u.type||"bip49"!==u.keys.format){e.next=7;break}throw new Error("Cannot split segwit-format Bitcoin wallets to Bitcoin Cash");case 7:if(!(f="wallet:bitcoinsv"===o&&"wallet:bitcoincash"===u.type)){e.next=14;break}if(null!=(l=t.props.output.currency.wallets[n].walletApi)){e.next=12;break}throw new Error("Missing Wallet");case 12:return e.next=14,Xf(l);case 14:if(d=Yf(u,o),p=i.find((function(e){return e.id===d.id})),null==p){e.next=26;break}if(!p.archived&&!p.deleted){e.next=23;break}return(h={})[d.id]={archived:!1,deleted:!1,migratedFromWalletId:void 0},e.next=22,Ni(t,r,h);case 22:return e.abrupt("return",u.id);case 23:if(!f){e.next=25;break}return e.abrupt("return",d.id);case 25:throw new Error("This wallet has already been split");case 26:return b=Vi(t,s,[d]),e.next=29,xn(t,s,b);case 29:return e.prev=29,e.next=32,Wa(t,d.id);case 32:if(v=e.sent,null==(y=t.props.output.currency.wallets[n].walletApi)){e.next=41;break}if(null==y.name){e.next=38;break}return e.next=38,v.renameWallet(y.name);case 38:if(null==y.fiatCurrencyCode){e.next=41;break}return e.next=41,v.setFiatCurrencyCode(y.fiatCurrencyCode);case 41:e.next=46;break;case 43:e.prev=43,e.t0=e.catch(29),t.props.onError(e.t0);case 46:return e.abrupt("return",d.id);case 47:case"end":return e.stop()}}),e,null,[[29,43]])})))).apply(this,arguments)}function Xf(e){return $f.apply(this,arguments)}function $f(){return($f=t(c().mark((function e(t){var r,n,o,a,i,s,u,f,l,d,p,h;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=zf(zf({},r={currencyCode:"BCH",tokenId:null}),{},{spendTargets:[{nativeAmount:"10000",otherParams:{script:{type:"replayProtection"}},publicAddress:""}],metadata:{},networkFeeOption:"high"}),e.next=4,t.makeSpend(n);case 4:return o=e.sent,e.next=7,t.signTx(o);case 7:return a=e.sent,e.next=10,t.broadcastTx(a);case 10:return i=e.sent,e.next=13,t.saveTx(i);case 13:return e.next=15,t.getReceiveAddress(r);case 15:return s=e.sent,u=s.publicAddress,f=zf(zf({},r),{},{metadata:{name:"Replay Protection Tx",notes:"This transaction is to protect your BCH wallet from unintentionally spending BSV funds. Please wait for the transaction to confirm before making additional transactions using this BCH wallet."},networkFeeOption:"high",spendTargets:[{publicAddress:u,nativeAmount:"0"}]}),e.next=20,t.getMaxSpendable(f);case 20:return l=e.sent,f.spendTargets[0].nativeAmount=l,e.next=24,t.makeSpend(f);case 24:return d=e.sent,e.next=27,t.signTx(d);case 27:return p=e.sent,e.next=30,t.broadcastTx(p);case 30:return h=e.sent,e.next=33,t.saveTx(h);case 33:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Zf(e,t){if(e.length!==t.length)throw new Error("Array lengths do not match: ".concat(e.length,", ").concat(t.length));for(var r=new Uint8Array(e.length),n=0;n<e.length;++n)r[n]=e[n]^t[n];return r}function Qf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function el(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qf(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qf(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function tl(e,t,r){return rl.apply(this,arguments)}function rl(){return rl=t(c().mark((function e(t,r,n){var o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=Kr(t,r.loginId),a=o.stashTree,e.next=3,Tr(t,"POST","/v2/login/vouchers",el(el({},_n(a,r)),{},{data:_t(n)}));case 3:return i=e.sent,s=bn(a,r.loginKey,ut(i)),e.next=7,Yr(t,s);case 7:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}}),e)}))),rl.apply(this,arguments)}function nl(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var ol=["fromWallet","toWallet"];function al(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function il(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?al(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):al(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function sl(e,t,r){return ul.apply(this,arguments)}function ul(){return ul=t(c().mark((function e(t,r,n){var o,a,i,s,u,f,l,d,p,h,b,v,y,g,m,w,x,k,I,O,E,S,A=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=(o=A.length>3&&void 0!==A[3]?A[3]:{}).disabled,i=void 0===a?{}:a,s=o.noResponseMs,u=o.preferPluginId,f=o.promoCodes,l=void 0===f?{}:f,d=o.slowResponseMs,p=void 0===d?2e4:d,h=t.props,b=h.log,v=h.state,y=v.accounts[r],g=y.swapSettings,m=y.userSettings,w=v.plugins.swap,b.warn("Requesting swap quotes for: ",il(il({},n),{},{fromWallet:n.fromWallet.id,toWallet:n.toWallet.id}),{preferPluginId:u,promoCodes:l}),x=new Set,k=[],I=c().mark((function e(){var t,r,o,a,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=E[O],a=null!=g[o]?g[o]:{},s=a.enabled,(void 0===s||s)&&!i[o]){e.next=4;break}return e.abrupt("return",1);case 4:x.add(o),k.push(w[o].fetchSwapQuote(n,m[o],{infoPayload:null!==(t=null===(r=v.infoCache.corePlugins)||void 0===r?void 0:r[o])&&void 0!==t?t:{},promoCode:l[o]}).then((function(e){var t;La(e);var r=null!==(t=e.request)&&void 0!==t?t:{},n=(r.fromWallet,r.toWallet,nl(r,ol)),a=il(il({},e),{},{request:n});return x.delete(o),b.warn("".concat(o," gave swap quote:"),a),e}),(function(e){throw x.delete(o),b.warn("".concat(o," gave swap error: ").concat(String(e))),pl(e)&&b.crash("Unknown swap error: ".concat(String(e)),{error:e,swapPluginId:o,request:{fromToken:String(n.fromTokenId),fromWalletType:n.fromWallet.type,toToken:String(n.toTokenId),toWalletType:n.toWallet.type,quoteFor:n.quoteFor}}),e})));case 6:case"end":return e.stop()}}),e)})),O=0,E=Object.keys(w);case 11:if(!(O<E.length)){e.next=18;break}return e.delegateYield(I(),"t0",13);case 13:if(!e.t0){e.next=15;break}return e.abrupt("continue",15);case 15:O++,e.next=11;break;case 18:if(S=Ar(k,p).then((function(e){for(var t=e.results,r=e.errors,a=0;a<x.length;a++){var i=x[a];b.warn("".concat(i," gave swap timeout"))}var s=fl(t,o);return b.warn("".concat(k.length," swap quotes requested, ").concat(t.length," resolved, ").concat(r.length," failed, sorted ").concat(s.map((function(e){return e.pluginId})).join(", "),".")),t.map((function(e){return cl(w,n,e)}))}),(function(e){throw b.warn("All ".concat(k.length," swap quotes rejected.")),ll(e)})),null!=s){e.next=23;break}return e.next=22,S;case 22:return e.abrupt("return",e.sent);case 23:return e.next=25,Sr(S,s);case 25:return e.abrupt("return",e.sent);case 26:case"end":return e.stop()}}),e)}))),ul.apply(this,arguments)}function cl(e,r,n){var o,a,i=C({canBePartial:n.canBePartial,expirationDate:n.expirationDate,fromNativeAmount:n.fromNativeAmount,isEstimate:n.isEstimate,maxFulfillmentSeconds:n.maxFulfillmentSeconds,networkFee:n.networkFee,pluginId:n.pluginId,request:null!==(o=n.request)&&void 0!==o?o:r,swapInfo:null!==(a=n.swapInfo)&&void 0!==a?a:e[n.pluginId].swapInfo,toNativeAmount:n.toNativeAmount,minReceiveAmount:n.minReceiveAmount,approve:function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.approve(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},close:function(){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.close();case 2:z(i);case 3:case"end":return e.stop()}}),e)})))()}});return i}function fl(e,t){var r=t.preferPluginId,n=t.preferType,o=t.promoCodes;return e.sort((function(e,t){if("transfer"===e.pluginId)return-1;if("transfer"===t.pluginId)return 1;if(e.pluginId===r)return-1;if(t.pluginId===r)return 1;if(null!=n){var a=!0===e.swapInfo.isDex&&"DEX"===n||!0!==e.swapInfo.isDex&&"CEX"===n,i=!0===t.swapInfo.isDex&&"DEX"===n||!0!==t.swapInfo.isDex&&"CEX"===n;if(a&&!i)return-1;if(!a&&i)return 1}if(null!=o){var s=null!=o[e.pluginId],u=null!=o[t.pluginId];if(s&&!u)return-1;if(!s&&u)return 1}var c=e.isEstimate,f=void 0===c||c,l=t.isEstimate,d=void 0===l||l;if(!f&&d)return-1;if(f&&!d)return 1;var p=Number(e.toNativeAmount)/Number(e.fromNativeAmount),h=Number(t.toNativeAmount)/Number(t.fromNativeAmount);return p>h?-1:h>p?1:0}))}function ll(e){return e.reduce((function(e,t){var r=dl(e)-dl(t);if(r>0)return e;if(r<0)return t;var n=ir(e),o=ir(t);if(null!=n&&null!=o)return(0,Ra.lt)(n.nativeMin,o.nativeMin)?n:o;var a=ar(e),i=ar(t);return null!=a&&null!=i?(0,Ra.gt)(a.nativeMax,i.nativeMax)?a:i:e}))}function dl(e){return null==e?0:null!=rr(e)||null!=or(e)?6:null!=ir(e)?5:null!=ar(e)?4:null!=ur(e)?3:null!=sr(e)?2:1}function pl(e){return!(dl(e)>1)}var hl=Qn(Ae({name:ke})),bl=Qn(Ae({key:ke,data:ke}));function vl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function yl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vl(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var gl=0,ml=function(){var e=t(c().mark((function e(r,n,o){var a,i,s,u,f,l,d,p,h,b,v,y,g,m,w,x,k,I,O,E,S,A,_,T,P,M,j=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(i=(j.length>3&&void 0!==j[3]?j[3]:{}).keys)){e.next=4;break}throw new Error("No keys provided");case 4:return s="memorywallet-".concat(gl++),u={id:s,type:o,keys:i},e.next=8,Co(r,n.currencyInfo.pluginId);case 8:return f=e.sent,e.next=11,f.derivePublicKey(u);case 11:return l=e.sent,u.keys=yl(yl({},l),u.keys),d=fo(r.props.logBackend,"".concat(s,"-").concat(o)),p=new Map,h=[],b=0,v=!1,y=function(){v&&(H(M),v=!1)},g=To(t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Po(1e3);case 2:y();case 3:case"end":return e.stop()}}),e)}))),0),m=r.props.state.plugins.currency[n.currencyInfo.pluginId],e.next=23,m.makeCurrencyEngine(u,{callbacks:{onAddressChanged:function(){},onAddressesChecked:function(e){1!==M.syncRatio&&1===e&&(b=e,v=!0)},onNewTokens:function(e){var t=e.sort((function(e,t){return e.localeCompare(t)}));if(h.length!==t.length)return h=t,void(v=!0);for(var r=0;r<t.length;r++)if(h[r]!==t[r])return h=t,void(v=!0)},onSeenTxCheckpoint:function(){},onStakingStatusChanged:function(){},onTokenBalanceChanged:function(e,t){p.get(e)!==t&&((p=new Map(p)).set(e,t),v=!0)},onTransactions:function(){},onTransactionsChanged:function(){},onTxidsChanged:function(){},onUnactivatedTokenIdsChanged:function(){},onWcNewContractCall:function(){},onBlockHeightChanged:function(){},onBalanceChanged:function(){}},customTokens:yl({},n.customTokens),enabledTokenIds:Ir(Object.keys(n.allTokens)),lightMode:!0,log:d,userSettings:yl({},null!==(a=n.userSettings)&&void 0!==a?a:{}),walletLocalDisklet:(0,ie.Wh)(),walletLocalEncryptedDisklet:(0,ie.Wh)()});case 23:return w=e.sent,x=m.currencyInfo,k=x.unsafeBroadcastTx,I=void 0!==k&&k,O=x.unsafeMakeSpend,E=void 0!==O&&O,S=x.unsafeSyncNetwork,A=void 0!==S&&S,_=yl({},i),null!=w.syncNetwork&&(P=function(){var e=t(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==w.syncNetwork){e.next=7;break}return e.next=3,w.syncNetwork({privateKeys:A?{privateKeys:i}:void 0});case 3:t=e.sent,T.setDelay(t),e.next=8;break;case 7:T.stop();case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),(T=To(P,1e4,{onError:function(e){r.props.log.error(e)}})).start({wait:!1})),e.t0=C,e.t1=ne,e.t2=function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null==w.changeEnabledTokenIds){t.next=3;break}return t.next=3,w.changeEnabledTokenIds(e);case 3:case"end":return t.stop()}}),t)})))()},e.t3=function(){return t(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,w.startEngine();case 2:null===(t=T)||void 0===t||t.start({wait:!1});case 3:case"end":return e.stop()}}),e)})))()},e.t4=function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,_f(e,m,w,n.allTokens,u);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},e.t5=function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,w.makeSpend(e,E?_:void 0);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},e.t6=function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,w.signTx(e,_);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},e.t7=function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,w.broadcastTx(e,I?_:void 0);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},e.t8=function(){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))()},e.t9=function(){return t(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d.warn("killing memory wallet"),null===(t=T)||void 0===t||t.stop(),z(M),e.next=5,w.killEngine();case 5:case"end":return e.stop()}}),e)})))()},e.t10={watch:e.t1,get balanceMap(){return p},get detectedTokenIds(){return h},get syncRatio(){return b},changeEnabledTokenIds:e.t2,startEngine:e.t3,getMaxSpendable:e.t4,makeSpend:e.t5,signTx:e.t6,broadcastTx:e.t7,saveTx:e.t8,close:e.t9},M=(0,e.t0)(e.t10),g.start({wait:!1}),e.abrupt("return",M);case 41:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}();function wl(e,t){return wl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},wl(e,t)}function xl(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&wl(e,t)}function kl(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Il(e,t){if(t&&("object"===se(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return kl(e)}function Ol(e){return Ol=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ol(e)}function El(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Sl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?El(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):El(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Al(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ol(e);if(t){var o=Ol(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Il(this,r)}}var _l={},Tl=[],Pl=function(e){xl(l,e);var r,n,o,a,i,s,u,f=Al(l);function l(e,t,r){var n;fe(this,l),(n=f.call(this))._ai=e,n._accountId=t,n._pluginId=r;var o=e.props.state.plugins.currency[r].otherMethods;return null!=o?(C(o),n.otherMethods=o):n.otherMethods={},n}return de(l,[{key:"currencyInfo",get:function(){return this._ai.props.state.plugins.currency[this._pluginId].currencyInfo}},{key:"allTokens",get:function(){var e=this._ai.props.state,t=this._accountId,r=this._pluginId;return e.accounts[t].allTokens[r]}},{key:"builtinTokens",get:function(){var e=this._ai.props.state,t=this._accountId,r=this._pluginId;return e.accounts[t].builtinTokens[r]}},{key:"customTokens",get:function(){var e,t=this._ai.props.state,r=this._accountId,n=this._pluginId;return null!==(e=t.accounts[r].customTokens[n])&&void 0!==e?e:_l}},{key:"getTokenId",value:(u=t(c().mark((function e(t){var r,n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._ai,n=this._pluginId,e.next=3,xa(r,n,t);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"addCustomToken",value:(s=t(c().mark((function e(t){var r,n,o,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._accountId,n=this._ai,o=this._pluginId,e.next=3,xa(n,o,t);case 3:return a=e.sent,n.props.dispatch({type:"ACCOUNT_CUSTOM_TOKEN_ADDED",payload:{accountId:r,pluginId:o,tokenId:a,token:t}}),e.abrupt("return",a);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"changeCustomToken",value:(i=t(c().mark((function e(t,r){var n,o,a,i,s,u,f,l,d;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._accountId,o=this._ai,a=this._pluginId,null!=o.props.state.accounts[n].customTokens[a][t]){e.next=4;break}throw new Error('There is no token with id "'.concat(t,'"'));case 4:return e.next=6,xa(o,a,r);case 6:if(i=e.sent,o.props.dispatch({type:"ACCOUNT_CUSTOM_TOKEN_ADDED",payload:{accountId:n,pluginId:a,tokenId:i,token:r}}),i===t){e.next=21;break}s=o.props.state.currency.wallets,u=0,f=Object.keys(s);case 11:if(!(u<f.length)){e.next=20;break}if(l=f[u],(d=s[l]).accountId===n&&d.pluginId===a&&d.enabledTokenIds.includes(t)){e.next=16;break}return e.abrupt("continue",17);case 16:o.props.dispatch({type:"CURRENCY_WALLET_ENABLED_TOKENS_CHANGED",payload:{walletId:l,enabledTokenIds:Zu([].concat(Ir(d.enabledTokenIds),[i]),[t])}});case 17:u++,e.next=11;break;case 20:o.props.dispatch({type:"ACCOUNT_CUSTOM_TOKEN_REMOVED",payload:{accountId:n,pluginId:a,tokenId:t}});case 21:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"removeCustomToken",value:(a=t(c().mark((function e(t){var r,n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=this._accountId,n=this._ai,o=this._pluginId,n.props.dispatch({type:"ACCOUNT_CUSTOM_TOKEN_REMOVED",payload:{accountId:r,pluginId:o,tokenId:t}});case 2:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"alwaysEnabledTokenIds",get:function(){var e,t=this._ai.props.state,r=this._accountId,n=this._pluginId;return null!==(e=t.accounts[r].alwaysEnabledTokenIds[n])&&void 0!==e?e:Tl}},{key:"changeAlwaysEnabledTokenIds",value:(o=t(c().mark((function e(t){var r,n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=this._accountId,n=this._ai,o=this._pluginId,n.props.dispatch({type:"ACCOUNT_ALWAYS_ENABLED_TOKENS_CHANGED",payload:{accountId:r,pluginId:o,tokenIds:t}});case 2:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"userSettings",get:function(){return this._ai.props.state.accounts[this._accountId].userSettings[this._pluginId]}},{key:"changeUserSettings",value:(n=t(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ri(this._ai,this._accountId,this._pluginId,t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"importKey",value:(r=t(c().mark((function e(t){var r,n,o,a=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:{},e.next=3,Co(this._ai,this._pluginId);case 3:if(null!=(n=e.sent).importPrivateKey){e.next=6;break}throw new Error("This wallet does not support importing keys");case 6:return e.next=8,n.importPrivateKey(t,r.keyOptions);case 8:return o=e.sent,e.abrupt("return",Sl(Sl({},o),{},{imported:!0}));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})}]),l}(oe),Ml=function(e){xl(a,e);var r,n,o=Al(a);function a(e,t,r){var n;return fe(this,a),(n=o.call(this))._ai=e,n._accountId=t,n._pluginId=r,n}return de(a,[{key:"enabled",get:function(){var e=this._ai.props.state.accounts[this._accountId].swapSettings,t=(null!=e[this._pluginId]?e[this._pluginId]:{}).enabled;return void 0===t||t}},{key:"needsActivation",get:function(){var e,t,r=this._ai.props.state.plugins.swap[this._pluginId];if(null==r.checkSettings)return!1;var n=null!==(e=this._ai.props.state.accounts[this._accountId].userSettings[this._pluginId])&&void 0!==e?e:{};return null!==(t=r.checkSettings(n).needsActivation)&&void 0!==t&&t}},{key:"swapInfo",get:function(){return this._ai.props.state.plugins.swap[this._pluginId].swapInfo}},{key:"userSettings",get:function(){return this._ai.props.state.accounts[this._accountId].userSettings[this._pluginId]}},{key:"changeEnabled",value:(n=t(c().mark((function e(t){var r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._ai.props.state.accounts[this._accountId],e.next=3,Li(this._ai,this._accountId,this._pluginId,Sl(Sl({},r.swapSettings[this._pluginId]),{},{enabled:t}));case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"changeUserSettings",value:(r=t(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ri(this._ai,this._accountId,this._pluginId,t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})}]),a}(oe);function jl(e,r){for(var o=e.props.state.accounts[r],s=function(){var t=e.props.state.accounts[r];return null!=t&&(o=t),o},u=s(),f=u.accountWalletInfo,l=u.loginType,d={},p=0,h=Object.keys(e.props.state.plugins.currency);p<h.length;p++){var b=h[p],v=new Pl(e,r,b);d[b]=v}for(var y={},g=0,m=Object.keys(e.props.state.plugins.swap);g<m.length;g++){var x=m[g],k=new Ml(e,r,x);y[x]=k}var I=function(e,r){var n=e.props.state.accounts[r].accountWalletInfo,o=na(e.props.state,n.id),a=function(t){return ia(e.props.state,n.id,t)},i=function(e){return"Plugins/".concat(a(e))},s=function(e,t){return"".concat(i(e),"/").concat(a(t),".json")},u={deleteItem:function(e,r){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o.delete(s(e,r));case 2:case"end":return t.stop()}}),t)})))()},deleteStore:function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o.delete(i(e));case 2:case"end":return t.stop()}}),t)})))()},listItemIds:function(e){return t(c().mark((function r(){var n,a;return c().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=[],r.t0=ie.gQ,r.next=4,o.list(i(e));case 4:return r.t1=r.sent,a=(0,r.t0)(r.t1),r.next=8,Promise.all(a.map(function(){var e=t(c().mark((function e(t){var r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,bl.load(o,t);case 2:null!=(r=e.sent)&&n.push(r.key);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 8:return r.abrupt("return",n);case 9:case"end":return r.stop()}}),r)})))()},listStoreIds:function(){return t(c().mark((function e(){var r,n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[],e.t0=ie.ji,e.next=4,o.list("Plugins");case 4:return e.t1=e.sent,n=(0,e.t0)(e.t1),e.next=8,Promise.all(n.map(function(){var e=t(c().mark((function e(t){var n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,hl.load(o,"".concat(t,"/Name.json"));case 2:null!=(n=e.sent)&&r.push(n.name);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}}),e)})))()},getItem:function(e,r){return t(c().mark((function t(){var n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,bl.load(o,s(e,r));case 2:if(null!=(n=t.sent)){t.next=5;break}throw new Error('No item named "'.concat(r,'"'));case 5:return t.abrupt("return",n.data);case 6:case"end":return t.stop()}}),t)})))()},setItem:function(e,r,n){return t(c().mark((function t(){var a,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a="".concat(i(e),"/Name.json"),t.next=3,hl.load(o,a);case 3:if(null!=(u=t.sent)){t.next=9;break}return t.next=7,hl.save(o,a,{name:e});case 7:t.next=11;break;case 9:if(u.name===e){t.next=11;break}throw new Error("Warning: folder name doesn't match for ".concat(e));case 11:return t.next=13,bl.save(o,s(e,r),{key:r,data:n});case 13:case"end":return t.stop()}}),t)})))()}};return C(u),u}(e,r),O=Ua(e,f);function E(){if(e.props.state.hideKeys)throw new Error("Not available when `hideKeys` is enabled")}var S={on:re,watch:ne,get id(){return O.id},get type(){return O.type},get disklet(){return E(),O.disklet},get localDisklet(){return E(),O.localDisklet},sync:function(){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O.sync();case 2:case"end":return e.stop()}}),e)})))()},get appId(){return s().login.appId},get created(){return s().login.created},getLoginKey:function(){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return E(),e.abrupt("return",Ht.stringify(s().login.loginKey));case 2:case"end":return e.stop()}}),e)})))()},get lastLogin(){return s().login.lastLogin},get loggedIn(){return null!=e.props.state.accounts[r]},get recoveryKey(){E();var e=s().login;return null!=e.recovery2Key?Ht.stringify(e.recovery2Key):void 0},get rootLoginId(){E();var e=s().loginTree;return Ht.stringify(e.loginId)},get username(){return s().loginTree.username},get currencyConfig(){return d},get swapConfig(){return y},get dataStore(){return I},get edgeLogin(){return null==s().loginTree.loginKey},keyLogin:"keyLogin"===l,newAccount:"newAccount"===l,passwordLogin:"passwordLogin"===l,pinLogin:"pinLogin"===l,recoveryLogin:"recoveryLogin"===l,changePassword:function(n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,ls(e,r,n);case 3:case"end":return t.stop()}}),t)})))()},changePin:function(n){return t(c().mark((function t(){var o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,Os(e,r,n);case 3:return o=s(),a=o.login,t.abrupt("return",null!=a.pin2Key?Ht.stringify(a.pin2Key):"");case 5:case"end":return t.stop()}}),t)})))()},changeRecovery:function(n,o){return t(c().mark((function t(){var a,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,Fs(e,r,n,o);case 3:if(a=s(),null!=(i=a.loginTree).recovery2Key){t.next=6;break}throw new Error("Missing recoveryKey");case 6:return t.abrupt("return",Ht.stringify(i.recovery2Key));case 7:case"end":return t.stop()}}),t)})))()},changeUsername:function(n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),n.username=be(n.username),t.next=4,$s(e,r,n);case 4:case"end":return t.stop()}}),t)})))()},checkPassword:function(r){return t(c().mark((function t(){var n,o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),n=s(),o=n.loginTree,t.next=4,ps(e,o,r);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})))()},checkPin:function(r){return t(c().mark((function t(){var n,o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(E(),n=s(),o=n.login,a=n.loginTree,null==o.pin){t.next=6;break}t.t0=r===o.pin,t.next=9;break;case 6:return t.next=8,Ss(e,a,r);case 8:t.t0=t.sent;case 9:return t.abrupt("return",t.t0);case 10:case"end":return t.stop()}}),t)})))()},getPin:function(){return t(c().mark((function e(){var t,r,n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=s(),n=r.login,o=r.loginTree,e.abrupt("return",null!==(t=n.pin)&&void 0!==t?t:o.pin);case 2:case"end":return e.stop()}}),e)})))()},deletePassword:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,bs(e,r);case 3:case"end":return t.stop()}}),t)})))()},deletePin:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,_s(e,r);case 3:case"end":return t.stop()}}),t)})))()},deleteRecovery:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,qs(e,r);case 3:case"end":return t.stop()}}),t)})))()},get otpKey(){E();var e=s().loginTree;return null!=e.otpKey?w.stringify(e.otpKey,{pad:!1}):void 0},get otpResetDate(){return E(),s().loginTree.otpResetDate},cancelOtpReset:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,nn(e,r);case 3:case"end":return t.stop()}}),t)})))()},enableOtp:function(){var n=arguments;return t(c().mark((function t(){var o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=n.length>0&&void 0!==n[0]?n[0]:604800,E(),t.next=4,Qr(e,r,o);case 4:case"end":return t.stop()}}),t)})))()},disableOtp:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,tn(e,r);case 3:case"end":return t.stop()}}),t)})))()},repairOtp:function(n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,un(e,r,w.parse(n,{loose:!0}));case 3:case"end":return t.stop()}}),t)})))()},get pendingVouchers(){return s().login.pendingVouchers},approveVoucher:function(r){return t(c().mark((function t(){var n,o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s(),o=n.loginTree,t.next=3,tl(e,o,{approvedVouchers:[r]});case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))()},rejectVoucher:function(r){return t(c().mark((function t(){var n,o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s(),o=n.loginTree,t.next=3,tl(e,o,{rejectedVouchers:[r]});case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))()},fetchLobby:function(n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.props.log.breadcrumb("EdgeAccount.fetchLobby",{}),E(),t.next=4,Gu(e,r,n);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})))()},deleteRemoteAccount:function(){return t(c().mark((function t(){var r,n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=s(),n=r.loginTree,t.next=3,Ff(e,n);case 3:case"end":return t.stop()}}),t)})))()},logout:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.props.dispatch({type:"LOGOUT",payload:{accountId:r}});case 1:case"end":return t.stop()}}),t)})))()},get allKeys(){return e.props.state.accounts[r].allWalletInfosClean},changeWalletStates:function(n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Ni(e,r,n);case 2:case"end":return t.stop()}}),t)})))()},createWallet:function(r,n){return t(c().mark((function t(){var o,a,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=s(),a=o.sessionKey,e.props.log.breadcrumb("EdgeAccount.createWallet",{}),t.next=4,Qi(e,r,{keys:n});case 4:return i=t.sent,t.next=7,xn(e,a,Vi(e,a,[i]));case 7:return t.abrupt("return",i.id);case 8:case"end":return t.stop()}}),t)})))()},getFirstWalletInfo:pe.prototype.getFirstWalletInfo,getWalletInfo:pe.prototype.getWalletInfo,listWalletIds:pe.prototype.listWalletIds,splitWalletInfo:function(n,o){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Jf(e,r,n,o);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},listSplittableWalletTypes:function(n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Gf(e,r,n);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},getDisplayPrivateKey:function(n){return t(c().mark((function t(){var o,a,i,s,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=Cl(e,r,n),a=Mo(e.props.state.plugins.currency,o.type),t.next=4,Co(e,a);case 4:if(null==(i=t.sent).getDisplayPrivateKey){t.next=9;break}return t.next=8,i.getDisplayPrivateKey(o);case 8:return t.abrupt("return",t.sent);case 9:if(null!=(s=e.props.output.currency.wallets[n].engine)&&null!=s.getDisplayPrivateSeed){t.next=12;break}throw new Error("Wallet has not yet loaded");case 12:return t.next=14,s.getDisplayPrivateSeed(o.keys);case 14:if(null!=(u=t.sent)){t.next=17;break}throw new Error("The engine failed to return a key");case 17:return t.abrupt("return",u);case 18:case"end":return t.stop()}}),t)})))()},getDisplayPublicKey:function(n){return t(c().mark((function t(){var o,a,i,s,u,f,l;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=Cl(e,r,n),a=Mo(e.props.state.plugins.currency,o.type),t.next=4,Co(e,a);case 4:if(null==(i=t.sent).getDisplayPublicKey){t.next=13;break}return s=Wo(e.props.io,n),t.next=9,Kf(o,s,i);case 9:return u=t.sent,t.next=12,i.getDisplayPublicKey(u);case 12:return t.abrupt("return",t.sent);case 13:if(null!=(f=e.props.output.currency.wallets[n].engine)&&null!=f.getDisplayPublicSeed){t.next=16;break}throw new Error("Wallet has not yet loaded");case 16:return t.next=18,f.getDisplayPublicSeed();case 18:if(null!=(l=t.sent)){t.next=21;break}throw new Error("The engine failed to return a key");case 21:return t.abrupt("return",l);case 22:case"end":return t.stop()}}),t)})))()},getRawPrivateKey:function(n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Cl(e,r,n).keys);case 1:case"end":return t.stop()}}),t)})))()},getRawPublicKey:function(n){return t(c().mark((function t(){var o,a,i,s,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=Cl(e,r,n),a=Mo(e.props.state.plugins.currency,o.type),t.next=4,Co(e,a);case 4:return i=t.sent,s=Wo(e.props.io,n),t.next=8,Kf(o,s,i);case 8:return u=t.sent,t.abrupt("return",u.keys);case 10:case"end":return t.stop()}}),t)})))()},get activeWalletIds(){return e.props.state.accounts[r].activeWalletIds},get archivedWalletIds(){return e.props.state.accounts[r].archivedWalletIds},get hiddenWalletIds(){return e.props.state.accounts[r].hiddenWalletIds},get currencyWallets(){return e.props.output.accounts[r].currencyWallets},get currencyWalletErrors(){return e.props.state.accounts[r].currencyWalletErrors},createCurrencyWallet:function(n){var o=arguments;return t(c().mark((function t(){var a,i,u,f;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=o.length>1&&void 0!==o[1]?o[1]:{},i=s(),u=i.sessionKey,e.props.log.breadcrumb("EdgeAccount.createCurrencyWallet",{}),t.next=5,Qi(e,n,a);case 5:return f=t.sent,t.next=8,xn(e,u,Vi(e,u,[f]));case 8:return t.next=10,ts(e,r,f.id,a);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}}),t)})))()},makeMemoryWallet:function(r){var n=arguments;return t(c().mark((function t(){var o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=n.length>1&&void 0!==n[1]?n[1]:{},null!=(a=Object.values(d).find((function(e){return e.currencyInfo.walletType===r})))){t.next=4;break}throw new Error("Invalid walletType");case 4:return t.next=6,ml(e,a,r,o);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)})))()},createCurrencyWallets:function(n){return t(c().mark((function o(){var a,i,u;return c().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return a=s(),i=a.sessionKey,e.props.log.breadcrumb("EdgeAccount.makeMemoryWallet",{}),o.next=4,Promise.all(n.map(function(){var r=t(c().mark((function t(r){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Qi(e,r.walletType,r);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return r.apply(this,arguments)}}()));case 4:return u=o.sent,o.next=7,xn(e,i,Vi(e,i,u));case 7:return o.next=9,Promise.all(u.map(function(){var o=t(c().mark((function t(o,a){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Nl(ts(e,r,o.id,n[a]));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e,t){return o.apply(this,arguments)}}()));case 9:return o.abrupt("return",o.sent);case 10:case"end":return o.stop()}}),o)})))()},waitForCurrencyWallet:function(e){var r=this;return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,n){var o=function(){var o=r.currencyWallets[e];null!=o&&(t(o),a());var i=r.currencyWalletErrors[e];null!=i&&(n(i),a())},a=function(){for(var e=0;e<i.length;e++){(0,i[e])()}},i=[r.watch("currencyWallets",o),r.watch("currencyWalletErrors",o)];o()}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},waitForAllWallets:function(){var e=this;return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,r){var n=function(){if(null==e.activeWalletIds.find((function(t){return null==e.currencyWallets[t]&&null==e.currencyWalletErrors[t]}))){for(var r=0;r<o.length;r++){(0,o[r])()}t()}},o=[e.watch("activeWalletIds",n),e.watch("currencyWallets",n),e.watch("currencyWalletErrors",n)];n()}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},getActivationAssets:function(n){return t(c().mark((function t(){var o,a,i,s,u,f;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=n.activateWalletId,a=n.activateTokenIds,i=e.props.output.accounts[r].currencyWallets,s=e.props.output.currency.wallets[o],null!=(u=s.engine)){t.next=6;break}throw new Error("Invalid wallet: ".concat(o," not found"));case 6:if(null!=u.engineGetActivationAssets){t.next=8;break}throw new Error("getActivationAssets unsupported by walletId ".concat(o));case 8:return t.next=10,u.engineGetActivationAssets({currencyWallets:i,activateTokenIds:a});case 10:return(f=t.sent).assetOptions.forEach((function(e){var t;return e.tokenId=null!==(t=e.tokenId)&&void 0!==t?t:null})),t.abrupt("return",f);case 13:case"end":return t.stop()}}),t)})))()},activateWallet:function(n){return t(c().mark((function t(){var o,a,i,s,u,f,l,d,p,h;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=n.activateWalletId,i=n.activateTokenIds,s=n.paymentInfo,u=e.props.output.accounts[r].currencyWallets,f=e.props.output.currency.wallets[a],null!=(l=f.engine)){t.next=6;break}throw new Error("Invalid wallet: ".concat(a," not found"));case 6:if(null!=l.engineActivateWallet){t.next=8;break}throw new Error("activateWallet unsupported by walletId ".concat(a));case 8:if(d=null!==(o=null==s?void 0:s.walletId)&&void 0!==o?o:"",null!=(p=u[d])){t.next=12;break}throw new Error("No wallet for walletId ".concat(d));case 12:return t.next=14,l.engineActivateWallet({activateTokenIds:i,paymentInfo:null!=s?{wallet:p,tokenId:s.tokenId}:void 0,paymentTokenId:null==s?void 0:s.tokenId,paymentWallet:p});case 14:return void 0===(h=t.sent).networkFee.tokenId&&(h.networkFee.tokenId=null),t.abrupt("return",C(h));case 17:case"end":return t.stop()}}),t)})))()},fetchSwapQuote:function(o,s){return t(c().mark((function t(){var u,f,l,d,p;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,sl(e,r,o,s);case 2:for(u=t.sent,f=n(c=u)||kr(c)||a(c)||i(),l=f[0],d=f.slice(1),p=0;p<d.length;p++)d[p].close().catch((function(){}));if(null!=l){t.next=9;break}throw new Error("No swap providers enabled");case 9:return t.abrupt("return",l);case 10:case"end":return t.stop()}var c}),t)})))()},fetchSwapQuotes:function(n,o){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,sl(e,r,n,o);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()}};return C(S),S}function Cl(e,t,r){var n=e.props.state.accounts[t].allWalletInfosFull.find((function(e){return e.id===r}));if(null==n)throw new Error("Invalid wallet: ".concat(r," not found"));return n}function Nl(e){return Dl.apply(this,arguments)}function Dl(){return(Dl=t(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t;case 3:return e.t0=e.sent,e.abrupt("return",{ok:!0,result:e.t0});case 7:return e.prev=7,e.t1=e.catch(0),e.abrupt("return",{ok:!1,error:e.t1});case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function Rl(e){var t=function(e,t){if("object"!==se(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==se(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===se(t)?t:String(t)}function Bl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ll(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Bl(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Kl={},Ul={loginId:new Uint8Array,loginKey:new Uint8Array},Fl=Zc({accountWalletInfo:af((function(e){return e.root.login.appId}),(function(e){return e.self.allWalletInfosFull}),(function(e,t){var r=Yi(e),n=Hi(t,r);if(null==n)throw new Error('Cannot find a "'.concat(r,'" repo'));return n})),accountWalletInfos:af((function(e){return e.root.login.appId}),(function(e){return e.self.allWalletInfosFull}),(function(e,t){var r=[Yi(e)];return""===e&&r.push("account:repo:co.airbitz.wallet",""),t.filter((function(e){return r.includes(e.type)}))})),allWalletInfosFull:af((function(e){return e.self.stashTree}),(function(e){return e.self.login}),(function(e){return e.self.legacyWalletInfos}),(function(e){return e.self.walletStates}),(function(e,t,r,n){return function(e,t,r,n){for(var o=new Map,a=new Map,i=Ir(r),s=Ur(e,t.loginId),u=0;u<r.length;u++){var c=r[u];i.push(c);var f=a.get(c.id);null!=f?f.push(s.appId):a.set(c.id,[s.appId])}return function e(t,r){for(var n=$i(t,r,o),s=0;s<n.length;s++){var u=n[s];i.push(u);var c=a.get(u.id);null!=c?c.push(t.appId):a.set(u.id,[t.appId])}for(var f=0,l=null!==(d=t.children)&&void 0!==d?d:[];f<l.length;f++){var d,p=l[f];null!=p.parentBox&&e(p,vr(p.parentBox,r))}}(s,t.loginKey),Xi(i).map((function(e){var t,r,s;return Gi(Gi({appId:(s=null!==(t=a.get(e.id))&&void 0!==t?t:[],s[s.length-1]),appIds:null!==(r=a.get(e.id))&&void 0!==r?r:[],archived:!1,created:o.get(e.id),deleted:!1,hidden:!1,sortIndex:i.length},n[e.id]),e)}))}(e,t,r,n)})),allWalletInfosClean:af((function(e){return e.self.allWalletInfosFull}),(function(e){return e.map((function(e){return Ll(Ll({},e),{},{keys:{}})}))})),currencyWalletErrors:function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,o=r.self.activeWalletIds,a=r.root.currency.wallets,i=o!==(null===(e=n.self)||void 0===e?void 0:e.activeWalletIds),s={},u=0;u<o.length;u++){var c=o[u],f=a[c].engineFailure;null!=f&&(s[c]=f),s[c]!==t[c]&&(i=!0)}return i?s:t},currencyWalletIds:af((function(e){return e.self.walletInfos}),(function(e){return e.root.plugins.currency}),(function(e,t){return Object.keys(e).filter((function(r){var n=e[r],o=jo(t,n.type);return!n.deleted&&null!=o})).sort((function(t,r){var n=e[t],o=e[r];return n.sortIndex-o.sortIndex}))})),activeWalletIds:af((function(e){return e.self.walletInfos}),(function(e){return e.self.currencyWalletIds}),(function(e){return e.self.keysLoaded}),(function(e,t,r){return r?t.filter((function(t){return!e[t].archived})):[]})),archivedWalletIds:af((function(e){return e.self.walletInfos}),(function(e){return e.self.currencyWalletIds}),(function(e){return e.self.keysLoaded}),(function(e,t,r){return r?t.filter((function(t){return e[t].archived})):[]})),hiddenWalletIds:af((function(e){return e.self.walletInfos}),(function(e){return e.self.currencyWalletIds}),(function(e){return e.self.keysLoaded}),(function(e,t,r){return r?t.filter((function(t){return e[t].hidden})):[]})),keysLoaded:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"ACCOUNT_KEYS_LOADED"===(arguments.length>1?arguments[1]:void 0).type||e},legacyWalletInfos:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return"ACCOUNT_KEYS_LOADED"===t.type?t.payload.legacyWalletInfos:e},walletInfos:af((function(e){return e.self.allWalletInfosFull}),(function(e){for(var t={},r=0;r<e.length;r++){var n=e[r];t[n.id]=n}return t})),walletStates:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return"ACCOUNT_CHANGED_WALLET_STATES"===t.type||"ACCOUNT_KEYS_LOADED"===t.type?t.payload.walletStates:e},pauseWallets:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;return"LOGIN"===t.type?t.payload.pauseWallets:e},loadFailure:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;if("ACCOUNT_LOAD_FAILED"===t.type){var r=t.payload.error;return r instanceof Error?r:new Error(String(r))}return e},login:af((function(e){return e.root.login.appId}),(function(e){return e.self.loginTree}),(function(e,t){var r=dn(t,(function(t){return t.appId===e}));if(null==r)throw new Error("Internal error: cannot find login for ".concat(e));return r})),loginTree:af((function(e){return e.self.stashTree}),(function(e){return e.self.sessionKey}),(function(e,t){return yn(e,t)})),loginType:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"newAccount",t=arguments.length>1?arguments[1]:void 0;return"LOGIN"===t.type?t.payload.loginType:e},rootLoginId:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array(0),t=arguments.length>1?arguments[1]:void 0;return"LOGIN"===t.type?t.payload.rootLoginId:e},sessionKey:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ul,t=arguments.length>1?arguments[1]:void 0;return"LOGIN"===t.type?t.payload.sessionKey:e},stashTree:af((function(e){return e.self.rootLoginId}),(function(e){return e.root.login.stashes}),(function(e,t){for(var r=0;r<t.length;r++){var n=t[r];if(pr(n.loginId,e))return n}throw new Error("There is no stash")})),allTokens:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,n=t.self,o=n.builtinTokens,a=n.customTokens;if(null==r.self||o!==r.self.builtinTokens||a!==r.self.customTokens){for(var i=Ll({},e),s=0,u=Object.keys(t.root.plugins.currency);s<u.length;s++){var c=u[s];null!=r.self&&o[c]===r.self.builtinTokens[c]&&a[c]===r.self.customTokens[c]||(i[c]=Ll(Ll({},a[c]),o[c]))}return i}return e},builtinTokens:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if("ACCOUNT_BUILTIN_TOKENS_LOADED"===t.type){var r=t.payload,n=r.pluginId,o=r.tokens;return Ll(Ll({},e),{},ce({},n,o))}return e},customTokens:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Kl,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ACCOUNT_CUSTOM_TOKENS_LOADED":var r=t.payload.customTokens;return r;case"ACCOUNT_CUSTOM_TOKEN_ADDED":var n,o=t.payload,a=o.pluginId,i=o.tokenId,s=o.token,u=null!==(n=e[a])&&void 0!==n?n:{};if(Ga(u[i],s))return e;var c=Ll(Ll({},u),{},ce({},i,s));return Ll(Ll({},e),{},ce({},a,c));case"ACCOUNT_CUSTOM_TOKEN_REMOVED":var f,l=t.payload,d=l.pluginId,p=l.tokenId,h=null!==(f=e[d])&&void 0!==f?f:{};if(null==h[p])return e;h[p];var b=nl(h,[p].map(Rl));return Ll(Ll({},e),{},ce({},d,b))}return e},alwaysEnabledTokenIds:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if("ACCOUNT_ALWAYS_ENABLED_TOKENS_CHANGED"===t.type){var r=t.payload,n=r.pluginId,o=r.tokenIds;return Ll(Ll({},e),{},ce({},n,o))}return e},swapSettings:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ACCOUNT_PLUGIN_SETTINGS_LOADED":return t.payload.swapSettings;case"ACCOUNT_SWAP_SETTINGS_CHANGED":var r=t.payload,n=r.pluginId,o=r.swapSettings,a=Ll({},e);return a[n]=o,a}return e},userSettings:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ACCOUNT_PLUGIN_SETTINGS_CHANGED":var r=t.payload,n=r.pluginId,o=r.userSettings,a=Ll({},e);return a[n]=o,a;case"ACCOUNT_PLUGIN_SETTINGS_LOADED":return t.payload.userSettings}return e}}),Wl=tf(Fl,(function(e,t){return/^ACCOUNT_/.test(e.type)&&"payload"in e&&"object"===se(e.payload)&&"accountId"in e.payload&&e.payload.accountId===t.id||"LOGIN"===e.type&&t.root.lastAccountId===t.id?e:{type:"UPDATE_NEXT"}}));function ql(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function zl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ql(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ql(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Gl=Yn({accountApi:function(e){return{destroy:function(){e.props.state={accounts:{}};var t=e.props.accountOutput;if(null!=t){var r=t.accountApi;if(null!=r){H(r),z(r),z(r.dataStore);for(var n=r.currencyConfig,o=r.swapConfig,a=0,i=Object.keys(n);a<i.length;a++){z(n[i[a]])}for(var s=0,u=Object.keys(o);s<u.length;s++){z(o[u[s]])}}}},update:function(){return t(c().mark((function r(){var n,o,a,i,s,u,f,l;return c().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return l=function(){return(l=t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([ji(n,a),ja(n,a),Ui(n,a)]);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)},f=function(){return l.apply(this,arguments)},n=fd(e),o=e.props,a=o.accountId,i=o.accountState,s=o.log,u=i.accountWalletInfos,r.prev=5,r.next=8,No(n);case 8:return r.next=10,Aa(n,a);case 10:return s.warn("Login: currency plugins exist"),r.next=13,Promise.all(u.map((function(e){return Qo(n,e)})));case 13:return s.warn("Login: synced account repos"),r.next=16,f();case 16:s.warn("Login: loaded files"),e.onOutput(jl(n,a)),s.warn("Login: complete"),r.next=24;break;case 21:r.prev=21,r.t0=r.catch(5),e.props.dispatch({type:"ACCOUNT_LOAD_FAILED",payload:{accountId:a,error:r.t0}});case 24:return r.next=26,Zn;case 26:return r.abrupt("return",r.sent);case 27:case"end":return r.stop()}}),r,null,[[5,21]])})))()}}},syncTimer:Xn((function(e){function r(){return(r=t(c().mark((function t(){var r,n,o,a,i,s,u,f,l;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=fd(e),n=e.props,o=n.accountId,a=n.accountState,i=a.accountWalletInfos,null!=e.props.state.accounts[o]){t.next=5;break}return t.abrupt("return");case 5:return t.next=7,Promise.all(i.map((function(e){return ta(r,e.id)})));case 7:for(s=t.sent,u=[],f=0;f<s.length;f++)l=s[f],u.push.apply(u,Ir(l));if(!(u.length>0)){t.next=13;break}return t.next=13,Promise.all([Ui(r,o),ji(r,o)]);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function n(){return(n=t(c().mark((function t(){var r,n,o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=fd(e),n=e.props.accountId,null!=e.props.state.accounts[n]){t.next=4;break}return t.abrupt("return");case 4:return o=e.props.state.accounts[n].sessionKey,t.next=7,En(r,o);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var o=To((function(){return r.apply(this,arguments)}),Zo),a=To((function(){return n.apply(this,arguments)}),Zo,{onError:function(t){var r=nr(t);null!=r&&e.props.onError(r)}});return{update:function(){var t;null!=(null===(t=e.props.accountOutput)||void 0===t?void 0:t.accountApi)&&(o.start({wait:Zo*(1+Math.random())}),a.start({wait:Zo*(1+Math.random())}))},destroy:function(){o.stop(),a.stop()}}}),(function(e){return e.state.paused?void 0:e})),tokenSaver:function(e){var r=Kl;return function(){var n=t(c().mark((function t(){var n,o,a,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.props,o=n.accountId,a=n.accountState,(i=a.customTokens)===r||r===Kl){t.next=7;break}return t.next=5,Na(fd(e),o).catch((function(t){return e.props.onError(t)}));case 5:return t.next=7,Po(100);case 7:r=i;case 8:case"end":return t.stop()}}),t)})));return function(){return n.apply(this,arguments)}}()},watcher:function(e){var t;return function(){var r=e.props,n=r.accountState,o=r.accountOutput;if(null!=n&&null!=o){var a=o.accountApi;if(null!=a&&H(a),t!==n&&(t=n,null!=a)){for(var i=a.currencyConfig,s=a.swapConfig,u=0,c=Object.keys(i);u<c.length;u++){H(i[c[u]])}for(var f=0,l=Object.keys(s);f<l.length;f++){H(s[l[f]])}}}}},currencyWallets:function(e){var t;return function(){var r=e.props,n=r.accountOutput,o=r.accountState.activeWalletIds,a=t!==o;t=o;var i={};null!=(null==n?void 0:n.currencyWallets)&&(i=n.currencyWallets);for(var s={},u=e.props.output.currency.wallets,c=0;c<o.length;c++){var f,l=o[c],d=null===(f=u[l])||void 0===f?void 0:f.walletApi;d!==i[l]&&(a=!0),null!=d&&(s[l]=d)}a&&e.onOutput(s)}}}),Hl=$n(Gl,(function(e){return e.state.accountIds}),(function(e,t){return zl(zl({},e),{},{accountId:t,accountState:e.state.accounts[t],accountOutput:e.output.accounts[t]})})),Yl=["loginId"];function Jl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Vl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Jl(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Xl(e){return $l.apply(this,arguments)}function $l(){return($l=t(c().mark((function e(t){var r,n,o,a,i,s,u,f,l,d,p,h,b,v,y,g,m;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.props.state.login.stashes,n={},o=[],a=0;case 4:if(!(a<r.length)){e.next=14;break}if(i=r[a],s=i.loginId,null!=(u=i.username)){e.next=9;break}return e.abrupt("continue",11);case 9:n[x.stringify(s)]=u,o.push(s);case 11:a++,e.next=4;break;case 14:return f={loginIds:o},e.next=17,Tr(t,"POST","/v2/messages",f);case 17:l=e.sent,d=[],p=0,h=ct(l);case 20:if(!(p<h.length)){e.next=31;break}if(b=h[p],v=b.loginId,y=nl(b,Yl),g=x.stringify(v),null!=(m=n[g])){e.next=27;break}return e.abrupt("continue",28);case 27:d.push(Vl(Vl({},y),{},{loginId:g,username:m}));case 28:p++,e.next=20;break;case 31:return e.abrupt("return",d);case 32:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Zl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ol(e);if(t){var o=Ol(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Il(this,r)}}var Ql=function(e){xl(r,e);var t=Zl(r);function r(e){var n;return fe(this,r),(n=t.call(this))._lobby=e,n._cleanups=[e.close,e.on("reply",(function(e){return H(kl(n),"replies")})),e.on("error",(function(e){return G(kl(n),"error",e)}))],n}return de(r,[{key:"lobbyId",get:function(){return this._lobby.lobbyId}},{key:"replies",get:function(){return this._lobby.replies}},{key:"close",value:function(){this._cleanups.forEach((function(e){return e()})),z(this)}}]),r}(oe),ed=function(e){xl(s,e);var r,n,o,a,i=Zl(s);function s(e){var t;return fe(this,s),(t=i.call(this))._ai=e,t}return de(s,[{key:"authRequest",value:function(e,t,r){return Tr(this._ai,e,t,r)}},{key:"hashUsername",value:function(e){return Wr(this._ai,e)}},{key:"makeLobby",value:(a=t(c().mark((function e(t){var r,n,o=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.length>1&&void 0!==o[1]?o[1]:1e3,e.next=3,_u(this._ai,t,r);case 3:return n=e.sent,e.abrupt("return",new Ql(n));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"fetchLobbyRequest",value:function(e){return Pu(this._ai,e)}},{key:"sendLobbyReply",value:(o=t(c().mark((function e(t,r,n){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ju(this._ai,t,r,n);case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return o.apply(this,arguments)})},{key:"syncRepo",value:(n=t(c().mark((function e(t){var r,n,o,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._ai.props,n=r.io,o=r.syncClient,a=qo(n,{dataKey:new Uint8Array(0),syncKey:t}),e.next=4,Yo(o,a,{lastSync:0,lastHash:void 0});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"getRepoDisklet",value:(r=t(c().mark((function e(t,r){var n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._ai.props.io,C((o=qo(n,{dataKey:r,syncKey:t})).disklet),e.abrupt("return",o.disklet);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})}]),s}(oe);function td(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function rd(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?td(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):td(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var nd=Yn({api:function(e){return{destroy:function(){z(e.props.output.context.api)},update:function(){return e.onOutput(function(e){var r,n=e.props.state.login.appId,o=Ht.stringify(e.props.state.login.clientId),a=new ed(e),i={on:re,watch:ne,appId:n,clientId:o,close:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.props.close();case 1:case"end":return t.stop()}}),t)})))()},$internalStuff:a,fixUsername:be,get localUsers(){return e.props.state.login.localUsers},forgetAccount:function(r){return t(c().mark((function t(){var n,o,a,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=Ht.parse(r),o=0,a=e.props.state.accountIds;case 2:if(!(o<a.length)){t.next=10;break}if(i=a[o],!pr(e.props.state.accounts[i].stashTree.loginId,n)){t.next=7;break}throw new Error("Cannot remove logged-in user");case 7:o++,t.next=2;break;case 10:return t.next=12,Gr(e,n);case 12:case"end":return t.stop()}}),t)})))()},fetchChallenge:function(){return t(c().mark((function t(){var r,n,o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Tr(e,"POST","/v2/captcha/create",{});case 2:return r=t.sent,n=ot(r),o=n.challengeId,a=n.challengeUri,t.abrupt("return",{challengeId:o,challengeUri:a});case 5:case"end":return t.stop()}}),t)})))()},usernameAvailable:function(r){var n=arguments;return t(c().mark((function t(){var o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=(n.length>1&&void 0!==n[1]?n[1]:{}).challengeId,r=be(r),t.next=5,au(e,r,o);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t)})))()},createAccount:function(r){return t(c().mark((function t(){var n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.props.log.breadcrumb("EdgeContext.createAccount",{}),null!=r.username&&(r.username=be(r.username)),t.next=4,cu(e,r,r);case 4:return n=t.sent,t.next=7,bu(e,n,"newAccount",r);case 7:return t.abrupt("return",t.sent);case 8:case"end":return t.stop()}}),t)})))()},loginWithKey:function(r,o){var a=arguments;return t(c().mark((function t(){var i,s,u,f,l,d,p;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(s=(i=a.length>2&&void 0!==a[2]?a[2]:{}).now,u=void 0===s?new Date:s,f=i.useLoginId,null!=(l=void 0!==f&&f?Kr(e,Ht.parse(r)).stashTree:Lr(e,be(r)))){t.next=5;break}throw new Error("User does not exist on this device");case 5:if(null!=(d=dn(l,(function(e){return e.appId===n})))){t.next=8;break}throw new Error('Cannot find requested appId: "'.concat(n,'"'));case 8:return p={loginId:d.loginId,loginKey:Ht.parse(o)},_n(l,p),l.lastLogin=u,Yr(e,l).catch((function(){})),En(e,p).catch((function(t){return e.props.onError(t)})),t.next=15,bu(e,p,"keyLogin",i);case 15:return t.abrupt("return",t.sent);case 16:case"end":return t.stop()}}),t)})))()},loginWithPassword:function(r,n){var o=arguments;return t(c().mark((function t(){var a,i,s;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=o.length>2&&void 0!==o[2]?o[2]:{},e.props.log.breadcrumb("EdgeContext.loginWithPassword",{}),r=be(r),i=Lr(e,r),t.next=6,cs(e,null!=i?i:Br(r),n,a);case 6:return s=t.sent,t.next=9,bu(e,s,"passwordLogin",a);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t)})))()},checkPasswordRules:he,loginWithPIN:function(r,o){var a=arguments;return t(c().mark((function t(){var i,s,u,f;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=a.length>2&&void 0!==a[2]?a[2]:{},e.props.log.breadcrumb("EdgeContext.loginWithPIN",{}),s=i.useLoginId,null!=(u=void 0!==s&&s?Kr(e,Ht.parse(r)).stashTree:Lr(e,be(r)))){t.next=6;break}throw new Error("User does not exist on this device");case 6:return t.next=8,ks(e,n,u,o,i);case 8:return f=t.sent,t.next=11,bu(e,f,"pinLogin",i);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t)})))()},loginWithRecovery2:function(r,n,o){var a=arguments;return t(c().mark((function t(){var i,s,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=a.length>3&&void 0!==a[3]?a[3]:{},e.props.log.breadcrumb("EdgeContext.loginWithRecovery2",{}),n=be(n),s=Lr(e,n),t.next=6,Bs(e,null!=s?s:Br(n),Ht.parse(r),o,i);case 6:return u=t.sent,t.next=9,bu(e,u,"recoveryLogin",i);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t)})))()},fetchRecovery2Questions:function(r,n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=be(n),t.next=3,Ks(e,Ht.parse(r),n);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))()},requestEdgeLogin:function(r){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.props.log.breadcrumb("EdgeContext.requestEdgeLogin",{}),t.next=3,Bu(e,n,r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))()},requestOtpReset:function(r,n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=be(r),t.next=3,an(e,r,n);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))()},fetchLoginMessages:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Xl(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},get paused(){return e.props.state.paused},changePaused:function(n){var o=arguments;return t(c().mark((function t(){var a,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=(o.length>1&&void 0!==o[1]?o[1]:{}).secondsDelay,i=void 0===a?0:a,null!=r&&(clearTimeout(r),r=void 0),e.props.state.paused!==n){t.next=5;break}return t.abrupt("return");case 5:0===i?e.props.dispatch({type:"PAUSE",payload:n}):r=setTimeout((function(){r=void 0,e.props.dispatch({type:"PAUSE",payload:n})}),1e3*i);case 6:case"end":return t.stop()}}),t)})))()},get logSettings(){return e.props.state.logSettings},changeLogSettings:function(r){return t(c().mark((function t(){var n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=rd(rd({},e.props.state.logSettings),r),e.props.dispatch({type:"CHANGE_LOG_SETTINGS",payload:n});case 2:case"end":return t.stop()}}),t)})))()}};return C(i),i}(e)),Zn}}},watcher:function(e){var t,r,n;return function(){t===e.props.state.login.localUsers&&r===e.props.state.paused&&n===e.props.state.logSettings||(t=e.props.state.login.localUsers,r=e.props.state.paused,n=e.props.state.logSettings,null!=e.props.output.context.api&&H(e.props.output.context.api))}},infoFetcher:Xn((function(e){function r(){return(r=t(c().mark((function t(){var r,n,o,a,i,u,f,l,d;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.props,n=r.dispatch,o=r.io,a=mi(e.props.state.infoServers),i=s(a,1),u=i[0],t.next=4,fetch("".concat(u,"/v1/coreRollup"),{headers:{accept:"application/json"}});case 4:if((f=t.sent).ok){t.next=7;break}return t.abrupt("return");case 7:return t.next=9,f.json();case 9:return l=t.sent,d=oo(l),n({type:"INFO_CACHE_FETCHED",payload:d}),t.next=14,ao.save(o.disklet,no,d);case 14:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var n=To((function(){return r.apply(this,arguments)}),6e5,{onError:function(t){e.props.onError(t)}});return{update:function(){n.started||n.start()},destroy:function(){n.stop()}}}),(function(e){return e.state.paused?void 0:e}))});function od(e,t){if("object"!==se(e)||"object"!==se(t)||null==e||null==t)return e===t;var r=Array.isArray(e);if(r!==Array.isArray(t))return!1;if(r){if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!od(e[n],t[n]))return!1;return!0}var o=Object.getOwnPropertyNames(e).filter((function(t){return void 0!==e[t]})),a=Object.getOwnPropertyNames(t).filter((function(e){return void 0!==t[e]}));if(o.length!==a.length)return!1;for(var i=0;i<o.length;i++){var s=o[i];if(!Object.prototype.hasOwnProperty.call(t,s))return!1;if(!od(e[s],t[s]))return!1}return!0}function ad(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function id(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ad(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ad(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var sd=Yn({wallets:$n(Lf,(function(e){return e.state.currency.currencyWalletIds}),(function(e,t){return id(id({},e),{},{walletId:t,walletState:e.state.currency.wallets[t],walletOutput:e.output.currency.wallets[t]})})),pluginUpdater:function(e){var r;return t(c().mark((function t(){var n,o,a,i,s,u,f,l,d,p,h,b,v;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.props.state,o=n.infoCache,a=n.plugins,r!==o){t.next=3;break}return t.abrupt("return");case 3:if(null==r){t.next=16;break}i=0,s=Object.keys(a.currency);case 5:if(!(i<s.length)){t.next=16;break}if(p=s[i],h=a.currency[p],b=null!==(u=null===(f=o.corePlugins)||void 0===f?void 0:f[p])&&void 0!==u?u:{},v=null!==(l=null===(d=r.corePlugins)||void 0===d?void 0:d[p])&&void 0!==l?l:{},null==h.updateInfoPayload||od(v,b)){t.next=13;break}return t.next=13,h.updateInfoPayload(b);case 13:i++,t.next=5;break;case 16:r=o;case 17:case"end":return t.stop()}}),t)})))}});function ud(e,t,r){var n={salt_hex:e,n:16384,r:8,p:1};if(0===t)return n.n=131072,n.r=8,n.p=64,n;var o=t,a=t/8,i=(r-o)/a;(i=i>0?i:0)>0&&(i=0),i=Math.floor(i),n.r=8+i;var s=14,u=(r-(o+=i*a))/o;(u=u>0?u:0)>3&&(u=3),s+=(u=Math.floor(u))>=0?u:0,o+=u*o,n.n=Math.pow(2,s);var c=(r-o)/o;return(c=c>0?c:0)>64&&(c=64),c=Math.floor(c),n.p=c>=1?c:1,o+=c*o,n}var cd=Yn({makeSnrp:function(e){return function(){var r,n=e.props,o=n.io,a=n.log;function i(){return(i=t(c().mark((function t(n){var i,s;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return null==r&&(r=e.props.output.scrypt.timeScrypt(Yt.parse("1reallyJunkiePasswordToCheck"),{salt_hex:m.parse("b5865ffb9fa7b3bfe4b2384d47ce831ee22a4a9d5c34c7ef7d21467cc758f81b"),n:16384,r:8,p:1}).then((function(e){return e.time}))),t.next=3,r;case 3:return i=t.sent,s=ud(o.random(32),i,n),a("snrp for ".concat(n,"ms target: ").concat(s.n," ").concat(s.r," ").concat(s.p," based on ").concat(i,"ms benchmark")),t.abrupt("return",s);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return e.onOutput((function(e){return i.apply(this,arguments)})),Zn}},timeScrypt:function(e){return function(){var t,r,n=e.props,o=n.io,a=n.log,i="undefined"!=typeof window&&null!=window.performance&&"function"==typeof window.performance.now?function(){return window.performance.now()}:function(){return Date.now()};return e.onOutput((t=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,n=t.salt_hex,s=i();return a("starting scrypt n=".concat(t.n," r=").concat(t.r," p=").concat(t.p)),o.scrypt(e,n,t.n,t.r,t.p,r).then((function(e){var r=i()-s;return a("finished scrypt n=".concat(t.n," r=").concat(t.r," p=").concat(t.p," in ").concat(r,"ms")),{hash:e,time:r}}))},r=Promise.resolve(),function(){for(var e=this,n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];var i=function(){return t.apply(e,o)},s=r.then(i,i);return r=s,s})),Zn}}}),fd=function(e){return e},ld=Yn({accounts:Hl,context:nd,currency:sd,scrypt:cd}),dd=Zc({currencyWalletIds:function(e,t,r){if(1===r.accountIds.length){var n=r.accountIds[0];return r.accounts[n].activeWalletIds}for(var o=[],a=0,i=r.accountIds;a<i.length;a++){var s=i[a];o.push.apply(o,Ir(r.accounts[s].activeWalletIds))}return o},wallets:of(df,(function(e){return e.currency.currencyWalletIds}))}),pd=new Uint8Array(0),hd=Zc({apiKey:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.apiKey:e},apiSecret:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1?arguments[1]:void 0;return"INIT"===r.type?null!==(e=r.payload.apiSecret)&&void 0!==e?e:null:t},appId:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.appId:e},clientId:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pd,t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.clientId:e},deviceDescription:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.deviceDescription:e},localUsers:af((function(e){return e.login.appId}),(function(e){return e.login.stashes}),(function(e,t){for(var r=[],n=0;n<t.length;n++){var o=t[n],a=o.lastLogin,i=o.loginId,s=o.recovery2Key,u=o.username,c=dn(o,(function(t){return t.appId===e})),f=null!=c&&(null!=c.passwordAuthBox||null!=c.loginAuthBox),l=xs(o,e);r.push({keyLoginEnabled:f,lastLogin:a,loginId:Ht.stringify(i),pinLoginEnabled:null!=l,recovery2Key:null!=s?Ht.stringify(s):void 0,username:u,voucherId:null!=c?c.voucherId:void 0})}return r})),loginServers:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.loginServers:e},stashes:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"INIT":return t.payload.stashes;case"LOGIN_STASH_DELETED":var r=t.payload;return e.filter((function(e){return!pr(e.loginId,r)}));case"LOGIN_STASH_SAVED":var n=t.payload,o=e.filter((function(e){return!pr(e.loginId,n.loginId)}));return o.unshift(n),o}return e},walletInfos:function(e,t,r){if(1===r.accountIds.length){var n=r.accountIds[0];return r.accounts[n].walletInfos}for(var o={},a=0,i=r.accountIds;a<i.length;a++)for(var s=i[a],u=r.accounts[s],c=0,f=Object.keys(u.walletInfos);c<f.length;c++){var l=f[c],d=u.walletInfos[l];o[l]=d}return o}});function bd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function vd(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?bd(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bd(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var yd={init:{},locked:!1,currency:{},swap:{},currencyTools:{}};function gd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function md(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?gd(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gd(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var wd=function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++){var o=t[n];0,"function"==typeof e[o]&&(r[o]=e[o])}var a,i=Object.keys(r);try{!function(e){Object.keys(e).forEach((function(t){var r=e[t];if(void 0===r(void 0,{type:Nn.INIT}))throw new Error(Mn(12));if(void 0===r(void 0,{type:Nn.PROBE_UNKNOWN_ACTION()}))throw new Error(Mn(13))}))}(r)}catch(s){a=s}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var n=!1,o={},s=0;s<i.length;s++){var u=i[s],c=r[u],f=e[u],l=c(f,t);if(void 0===l){t&&t.type;throw new Error(Mn(14))}o[u]=l,n=n||l!==f}return(n=n||i.length!==Object.keys(e).length)?o:e}}({lastChanges:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;if("STORAGE_WALLET_SYNCED"===t.type){var r=t.payload.changes;return r.length>0?r:e}return e},localDisklet:function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:null},paths:function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:null},status:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{lastSync:0,lastHash:void 0},t=arguments.length>1?arguments[1]:void 0;return"STORAGE_WALLET_SYNCED"===t.type?t.payload.status:e}}),xd={sources:{},defaultLogLevel:"warn"},kd=Zc({accountCount:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return"LOGIN"===(arguments.length>1?arguments[1]:void 0).type?e+1:e},accountIds:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;switch(t.type){case"LOGIN":return[].concat(Ir(e),[r.lastAccountId]);case"LOGOUT":var n=t.payload.accountId,o=e.filter((function(e){return e!==n}));if(o.length===e.length)throw new Error("Login ".concat(n," does not exist"));return o;case"CLOSE":return[]}return e},accounts:of(Wl,(function(e){return e.accountIds})),hideKeys:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.hideKeys:e},infoCache:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"INIT":return t.payload.infoCache;case"INFO_CACHE_FETCHED":return t.payload}return e},infoServers:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.infoServers:e},lastAccountId:function(e,t,r){return"login".concat(r.accountCount)},logSettings:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xd,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"INIT":return t.payload.logSettings;case"CHANGE_LOG_SETTINGS":return t.payload}return e},paused:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;return"PAUSE"===t.type?t.payload:e},ready:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"INIT"===(arguments.length>1?arguments[1]:void 0).type||e},skipBlockHeight:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.skipBlockHeight:e},syncServers:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.syncServers:e},currency:dd,login:hd,plugins:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yd,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"CORE_PLUGINS_ADDED":for(var r=vd(vd({},e),{},{currency:vd({},e.currency),swap:vd({},e.swap)}),n=0,o=Object.keys(t.payload);n<o.length;n++){var a=o[n],i=t.payload[a];null!=i?("currencyInfo"in i&&(null==i.currencyInfo.chainDisplayName&&(i.currencyInfo.chainDisplayName=i.currencyInfo.displayName),null==i.currencyInfo.assetDisplayName&&(i.currencyInfo.assetDisplayName=i.currencyInfo.displayName),r.currency[a]=i),"swapInfo"in i&&(r.swap[a]=i)):r.init=vd(vd({},r.init),{},ce({},a,!1))}return r;case"CORE_PLUGINS_LOCKED":return vd(vd({},e),{},{locked:!0});case"CURRENCY_TOOLS_LOADED":var s=vd({},e.currencyTools);return s[t.payload.pluginId]=t.payload.tools,vd(vd({},e),{},{currencyTools:s});case"INIT":return vd(vd({},e),{},{init:t.payload.pluginsInit})}return e},storageWallets:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"STORAGE_WALLET_ADDED":var r=t.payload,n=r.id,o=r.initialState,a=md({},e);return a[n]=wd(o,{type:"UPDATE_NEXT"}),a;case"STORAGE_WALLET_SYNCED":var i=t.payload.id;if(null!=e[i]){var s=md({},e);return s[i]=wd(e[i],t),s}return e}return e}});function Id(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Od(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Id(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Id(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Ed=[],Sd="object"===("undefined"==typeof window?"undefined":se(window))&&null!=window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__({name:"core"}):void 0;function Ad(e,t,r){return _d.apply(this,arguments)}function _d(){return(_d=t(c().mark((function e(t,r,n){var o,a,i,u,f,l,d,p,h,b,v,y,g,m,w,x,k,I,O,E,S,A,_,T,P,M,j,C,N,D,R,B,L,K,U,F,W,q,z,H,Y;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.io,a=n.airbitzSupport,i=void 0!==a&&a,u=n.apiSecret,f=n.appId,l=void 0===f?"":f,d=n.authServer,p=n.deviceDescription,h=void 0===p?null:p,b=n.hideKeys,v=void 0!==b&&b,y=n.infoServer,g=n.loginServer,m=n.plugins,w=void 0===m?{}:m,x=n.skipBlockHeight,k=void 0!==x&&x,I=n.syncServer,null!=(O=n.apiKey)&&""!==O||(O="4248c1bf41e53b840a5fdb2c872dd3ade525e66d"),E=Td(d,["https://login1.edge.app","https://login2.edge.app"]),S=Td(y,["https://info1.edge.app","https://info2.edge.app"]),A=Td(g,E.map((function(e){return e.replace(/\/api$/,"")}))),_=Td(I,["https://sync-us1.edge.app","https://sync-us2.edge.app","https://sync-us3.edge.app","https://sync-us4.edge.app","https://sync-us5.edge.app","https://sync-us6.edge.app","https://sync-eu.edge.app"]),T=Od(Od({},xd),n.logSettings),S.map((function(e){return Jt(e)})),A.map((function(e){return Jt(e)})),_.map((function(e){return Jt(e)})),P=Rn(kd,Sd),r=co(r,(function(){var e=P.getState();return e.ready?e.logSettings:T})),M=fo(r,"edge-core"),e.next=17,Promise.all([ro.load(o.disklet,to),ao.load(o.disklet,no),qr(o.disklet,M)]);case 17:if(j=e.sent,C=s(j,3),N=C[0],D=C[1],R=void 0===D?{}:D,B=C[2],!i){e.next=30;break}for(L=new Set,K=0;K<B.length;K++)null!=(U=B[K].username)&&L.add(U);return e.next=28,lo(o,L);case 28:F=e.sent,B.push.apply(B,Ir(F));case 30:if(null!=N){e.next=34;break}return N={clientId:o.random(16)},e.next=34,ro.save(o.disklet,to,N);case 34:return P.dispatch({type:"INIT",payload:{apiKey:O,apiSecret:u,appId:l,loginServers:A,infoCache:R,infoServers:S,syncServers:_,clientId:N.clientId,deviceDescription:h,hideKeys:v,logSettings:T,pluginsInit:w,skipBlockHeight:k,stashes:B}}),W=_o(t,R,r,w,P.dispatch),q=Pn({log:M,fetch:function(e,t){return o.fetch(e,Od(Od({},t),{},{corsBypass:"never"}))},edgeServers:{infoServers:S,syncServers:_}}),z={output:{}},H=Hn(P,Xn(ld,(function(e){return Od(Od({},e),{},{close:function(){H(),W(),P.dispatch({type:"CLOSE"})},io:o,log:M,logBackend:r,onError:function(e){var t;null!=(null===(t=z.output.context)||void 0===t?void 0:t.api)&&G(z.output.context.api,"error",e)},syncClient:q})})),(function(e){return M.error(e)}),(function(e){return z.output=e})),Y=z.output.context.api,Ed.push(Y),e.abrupt("return",Y);case 42:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Td(e,t){return"string"==typeof e?[e]:null!=e&&e.length>0?e:t}var Pd=["children"];function Md(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function jd(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Md(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Md(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Cd=function(){function e(){fe(this,e),this.lobbies=new Map,this.logins=[],this.repos=new Map}return de(e,[{key:"getLoginById",value:function(e){return this.logins.find((function(t){return pr(t.loginId,e)}))}},{key:"getLoginByUserId",value:function(e){return this.logins.find((function(t){return null==t.userId?pr(t.loginId,e):pr(t.userId,e)}))}},{key:"getLoginByPin2Id",value:function(e){return this.logins.find((function(t){return null!=t.pin2Id&&pr(t.pin2Id,e)}))}},{key:"getLoginByRecovery2Id",value:function(e){return this.logins.find((function(t){return null!=t.recovery2Id&&pr(t.recovery2Id,e)}))}},{key:"getLoginsByParent",value:function(e){return this.logins.filter((function(t){return t.parentId===e.loginId}))}},{key:"insertLogin",value:function(e){this.logins.push(e)}},{key:"setupLogin",value:function(e){var t=e.children,r=nl(e,Pd);this.insertLogin(r);for(var n=0;n<t.length;n++){var o=t[n];o.parentId=e.loginId,this.setupLogin(o)}}},{key:"setupRepo",value:function(e,t){this.repos.set(e,t)}},{key:"dumpLogin",value:function(e){var t=this;return function e(r){return jd(jd({},r),{},{children:t.getLoginsByParent(r).map((function(t){return e(t)}))})}(e)}}]),e}();function Nd(e,t){var r=e.getLoginsByParent(t).map((function(t){return Nd(e,t)}));return{appId:t.appId,created:t.created,loginId:t.loginId,children:r,parentBox:t.parentBox,passwordAuthBox:t.passwordAuthBox,passwordAuthSnrp:t.passwordAuthSnrp,passwordBox:t.passwordBox,passwordKeySnrp:t.passwordKeySnrp,pin2Box:t.pin2Box,pin2KeyBox:t.pin2KeyBox,pin2TextBox:t.pin2TextBox,question2Box:t.question2Box,recovery2Box:t.recovery2Box,recovery2KeyBox:t.recovery2KeyBox,otpKey:t.otpKey,otpResetDate:t.otpResetDate,otpTimeout:t.otpTimeout,pendingVouchers:Dd(t),loginAuthBox:t.loginAuthBox,userId:t.userId,userTextBox:t.userTextBox,keyBoxes:t.keyBoxes,mnemonicBox:t.mnemonicBox,rootKeyBox:t.rootKeyBox,syncKeyBox:t.syncKeyBox}}function Dd(e){return e.vouchers.filter((function(e){return"pending"===e.status})).map((function(e){return{activates:e.activates,created:e.created,deviceDescription:e.deviceDescription,ip:e.ip,ipDescription:e.ipDescription,voucherId:e.voucherId}}))}function Rd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Bd(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Rd(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rd(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Ld={success:{code:0,httpStatus:200,message:"Success"},error:{code:1,httpStatus:503,message:"Error"},accountExists:{code:2,httpStatus:401,message:"Account already exists"},noAccount:{code:3,httpStatus:401,message:"No account"},invalidPassword:{code:4,httpStatus:401,message:"Invalid Password"},invalidAnswers:{code:5,httpStatus:401,message:"Invalid Answers"},invalidApiKey:{code:6,httpStatus:401,message:"Invalid API Key"},invalidOtp:{code:8,httpStatus:401,message:"Invalid OTP"},conflict:{code:10,httpStatus:409,message:"Conflicting change"},obsolete:{code:1e3,httpStatus:410,message:"Obsolete API"},created:{code:0,httpStatus:201,message:"Account created"},invalidRequest:{code:1,httpStatus:401,message:"Invalid request"},notFound:{code:1,httpStatus:404,message:"Not found"},noLobby:{code:3,httpStatus:404,message:"Not found"},invalidAppId:{code:10,httpStatus:401,message:"A login with the same appId already exists"}};function Kd(e,t){try{return[e(t),{status:200}]}catch(r){return[void 0,Fd(Ld.invalidRequest,"Invalid request: ".concat(String(r)))]}}function Ud(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.status,n=void 0===r?200:r,o=t.headers;return{status:n,headers:Bd({"content-type":"application/json"},void 0===o?{}:o),body:JSON.stringify(e)}}function Fd(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ld.success,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.message,r=e.code,n=e.httpStatus;return Ud(mt({status_code:r,message:t}),{status:n})}function Wd(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ld.success,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.message,n=t.code,o=t.httpStatus;return Ud(mt({status_code:n,message:r,results:e}),{status:o})}function qd(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.reason,n=void 0===r?"otp":r,o=t.voucher;return Wd(Nt({login_id:e.loginId,otp_reset_auth:e.otpResetAuth,otp_timeout_date:e.otpResetDate,reason:n,voucher_auth:null==o?void 0:o.voucherAuth,voucher_activates:null==o?void 0:o.activates,voucher_id:null==o?void 0:o.voucherId}),Ld.invalidOtp)}function zd(e){return Wd(Rt({wait_seconds:e}),Ld.invalidPassword)}function Gd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Hd(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Gd(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Gd(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Yd=function(e){return function(){var r=t(c().mark((function t(r){var n,o,a,i,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=r.json,o=Kd(Ge,n),a=s(o,2),i=a[0],u=a[1],null!=i){t.next=4;break}return t.abrupt("return",u);case 4:return t.next=6,e(Hd(Hd({},r),{},{body:i,payload:i.data}));case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)})));return function(e){return r.apply(this,arguments)}}()},Jd=function(e){return function(){var r=t(c().mark((function t(r){var n,o,a,i,s,u,f,l;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=r.body,o=r.login,a=n.otp,i=n.voucherAuth,s=n.voucherId,null!=(u=o.otpKey)){t.next=7;break}return t.next=6,e(r);case 6:case 10:case 16:return t.abrupt("return",t.sent);case 7:if(null==a||!xr(u,a,{spread:2})){t.next=11;break}return t.next=10,e(r);case 11:if(null==i||null==s){t.next=17;break}if(f=o.vouchers.find((function(e){return e.voucherId===s})),null==f||"approved"!==f.status||!pr(i,f.voucherAuth)){t.next=17;break}return t.next=16,e(r);case 17:return o.otpResetAuth="Super secret reset token",l={activates:new Date("2020-01-01T00:00:00Z"),created:new Date("2020-01-08T00:00:00Z"),deviceDescription:"A phone",ip:"localhost",ipDescription:"here",loginId:o.loginId,status:"pending",voucherAuth:Uint8Array.from([170,187]),voucherId:"voucher-".concat(o.vouchers.length)},o.vouchers.push(l),t.abrupt("return",qd(o,{voucher:l}));case 21:case"end":return t.stop()}}),t)})));return function(e){return r.apply(this,arguments)}}()},Vd=function(e){return Fd(Ld.invalidRequest)},Xd=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Vd;return function(r){var n=r.db,o=r.body,a=o.loginAuth,i=o.loginId,s=o.passwordAuth,u=o.pin2Auth,c=o.pin2Id,f=o.recovery2Auth,l=o.recovery2Id,d=o.userId;if(null!=i&&null!=a){var p=n.getLoginById(i);return null==p?Fd(Ld.noAccount):null!=p.loginAuth&&pr(a,p.loginAuth)?Jd(e)(Hd(Hd({},r),{},{login:p})):zd(0)}if(null!=d&&null!=s){var h=n.getLoginByUserId(d);return null==h?Fd(Ld.noAccount):null!=h.passwordAuth&&pr(s,h.passwordAuth)?Jd(e)(Hd(Hd({},r),{},{login:h})):zd(0)}if(null!=c&&null!=u){var b=n.getLoginByPin2Id(c);return null==b?Fd(Ld.noAccount):null!=b.pin2Auth&&pr(u,b.pin2Auth)?Jd(e)(Hd(Hd({},r),{},{login:b})):zd(0)}if(null!=l&&null!=f){var v=n.getLoginByRecovery2Id(l);if(null==v)return Fd(Ld.noAccount);var y=v.recovery2Auth,g=f;if(null==y||g.length!==y.length)return zd(0);for(var m=0;m<g.length;++m)if(!pr(g[m],y[m]))return zd(0);return Jd(e)(Hd(Hd({},r),{},{login:v}))}return t(r)}},$d=Xd((function(e){var t=e.db,r=e.login;return Wd(jt(Nd(t,r)))}),(function(e){var t=e.db,r=e.json,n=Ge(r),o=n.userId,a=n.passwordAuth,i=n.recovery2Id,s=n.recovery2Auth;if(null!=o&&null==a){var u=t.getLoginByUserId(o);if(null==u)return Fd(Ld.noAccount);var c=u.loginId,f=u.passwordAuthSnrp;return Wd(Lt({loginId:c,passwordAuthSnrp:void 0===f?Rr:f}))}if(null!=i&&null==s){var l=t.getLoginByRecovery2Id(i);if(null==l)return Fd(Ld.noAccount);var d=l.question2Box;return null==d?Fd(Ld.noAccount):Wd(Bt({question2Box:d}))}return Fd(Ld.invalidRequest)}));function Zd(e,t){var r=e.db,n=e.json,o=new Date,a=s(Kd(Ge,n),2),i=a[0],u=a[1];if(null==i)return u;var c=s(Kd(nt,i.data),2),f=c[0],l=c[1];if(null==f)return l;var d=s(Kd(Qe,i.data),2),p=d[0],h=d[1];if(null==p)return h;if(null!=r.getLoginById(f.loginId))return Fd(Ld.accountExists);for(var b=Te(rt,(function(){return{newSyncKeys:[],keyBoxes:[]}}))(i.data),v=0,y=b.newSyncKeys;v<y.length;v++){var g=y[v];r.repos.set(g,{})}var m=Hd(Hd(Hd(Hd(Hd(Hd(Hd({},f),p),{},{created:o,keyBoxes:b.keyBoxes.map((function(e){return Hd(Hd({},e),{},{created:o})})),vouchers:[]},Te(Ye)(i.data)),Te(Je)(i.data)),Te(Xe)(i.data)),Te(Ze)(i.data)),Te(et)(i.data));if(null!=t){if(null!=r.getLoginsByParent(t).find((function(e){return e.appId===f.appId})))return Fd(Ld.invalidAppId);m.parentId=t.loginId}return r.insertLogin(m),Fd(Ld.created,"Account created")}var Qd=Xd((function(e){return Zd(e,e.login)}),(function(e){return Zd(e)})),ep=Xd((function(e){var t=e.db,r=e.login,n=e.payload,o=new Date,a=s(Kd(rt,n),2),i=a[0],u=a[1];if(null==i)return u;for(var c=0,f=i.newSyncKeys;c<f.length;c++){var l=f[c];t.repos.set(l,{})}return r.keyBoxes=Or(r.keyBoxes,i.keyBoxes.map((function(e){return Hd(Hd({},e),{},{created:o})}))),Fd()})),tp=Xd((function(e){var t=e.login,r=e.payload,n=s(Kd(Ye,r),2),o=n[0],a=n[1];return null==o?a:(t.otpKey=o.otpKey,t.otpTimeout=o.otpTimeout,t.otpResetDate=void 0,Fd())})),rp=Xd((function(e){var t=e.login;return t.otpKey=void 0,t.otpResetAuth=void 0,t.otpResetDate=void 0,t.otpTimeout=void 0,Fd()}),(function(e){var t=e.db,r=e.json,n=Ge(r);if(null==n.userId||null==n.otpResetAuth)return Fd(Ld.invalidRequest);var o=t.getLoginByUserId(n.userId);if(null==o)return Fd(Ld.noAccount);if(n.otpResetAuth!==o.otpResetAuth)return zd(0);var a=o.otpKey,i=o.otpTimeout;return null==a||null==i?Fd(Ld.invalidRequest,"OTP not setup for this account."):(null==o.otpResetDate&&(o.otpResetDate=new Date(Date.now()+1e3*i)),Wd(Dt({otpResetDate:o.otpResetDate})))})),np=Xd((function(e){var t=e.login;return t.passwordAuth=void 0,t.passwordAuthBox=void 0,t.passwordAuthSnrp=void 0,t.passwordBox=void 0,t.passwordKeySnrp=void 0,Fd()})),op=Xd((function(e){var t=e.login,r=e.payload,n=s(Kd(Je,r),2),o=n[0],a=n[1];return null==o?a:(t.passwordAuth=o.passwordAuth,t.passwordAuthBox=o.passwordAuthBox,t.passwordAuthSnrp=o.passwordAuthSnrp,t.passwordBox=o.passwordBox,t.passwordKeySnrp=o.passwordKeySnrp,Fd())})),ap=Xd((function(e){var t=e.login;return t.pin2Auth=void 0,t.pin2Box=void 0,t.pin2Id=void 0,t.pin2KeyBox=void 0,t.pin2TextBox=void 0,Fd()})),ip=Xd((function(e){var t=e.login,r=e.payload,n=s(Kd(Xe,r),2),o=n[0],a=n[1];return null==o?a:(t.pin2Auth=o.pin2Auth,t.pin2Box=o.pin2Box,t.pin2Id=o.pin2Id,t.pin2KeyBox=o.pin2KeyBox,t.pin2TextBox=o.pin2TextBox,Fd())})),sp=Xd((function(e){var t=e.login;return t.question2Box=void 0,t.recovery2Auth=void 0,t.recovery2Box=void 0,t.recovery2Id=void 0,t.recovery2KeyBox=void 0,Fd()})),up=Xd((function(e){var t=e.login,r=e.payload,n=s(Kd(Ze,r),2),o=n[0],a=n[1];return null==o?a:(t.question2Box=o.question2Box,t.recovery2Auth=o.recovery2Auth,t.recovery2Box=o.recovery2Box,t.recovery2Id=o.recovery2Id,t.recovery2KeyBox=o.recovery2KeyBox,Fd())})),cp=Xd((function(e){var t=e.db,r=e.login,n=e.payload,o=s(Kd(Qe,n),2),a=o[0],i=o[1];return null==a?i:null!=r.loginAuth?Fd(Ld.conflict,"The secret-key login is already configured"):(r.loginAuth=a.loginAuth,r.loginAuthBox=a.loginAuthBox,Wd(jt(Nd(t,r))))})),fp=Xd(function(){var e=t(c().mark((function e(t){var r,n,o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.db,n=t.login,o=t.payload,a=Te(Je)(o),i=Te(Ve)(o),s=Te($e)(o),u=Te(et)(o),null==n.passwordAuth||null!=a){e.next=7;break}return e.abrupt("return",Fd(Ld.invalidRequest,"Missing password payload"));case 7:if(null==n.pin2Auth||null!=i){e.next=9;break}return e.abrupt("return",Fd(Ld.invalidRequest,"Missing pin2Id payload"));case 9:if(null==n.recovery2Auth||null!=s){e.next=11;break}return e.abrupt("return",Fd(Ld.invalidRequest,"Missing recovery2Id payload"));case 11:if(null!=n.parentBox||null!=u){e.next=13;break}return e.abrupt("return",Fd(Ld.invalidRequest,"Missing username payload"));case 13:if(null!=a&&(n.passwordAuth=a.passwordAuth,n.passwordAuthBox=a.passwordAuthBox,n.passwordAuthSnrp=a.passwordAuthSnrp,n.passwordBox=a.passwordBox,n.passwordKeySnrp=a.passwordKeySnrp),null==i){e.next=21;break}if(null!=n.pin2Auth){e.next=17;break}return e.abrupt("return",Fd(Ld.invalidRequest,"Login lacks pin2"));case 17:if(null==r.getLoginByPin2Id(i.pin2Id)){e.next=20;break}return e.abrupt("return",Fd(Ld.conflict));case 20:n.pin2Id=i.pin2Id;case 21:if(null==s){e.next=28;break}if(null!=n.recovery2Auth){e.next=24;break}return e.abrupt("return",Fd(Ld.invalidRequest,"Login lacks recovery2"));case 24:if(null==r.getLoginByRecovery2Id(s.recovery2Id)){e.next=27;break}return e.abrupt("return",Fd(Ld.conflict));case 27:n.recovery2Id=s.recovery2Id;case 28:if(null==u){e.next=36;break}if(null==n.parentBox){e.next=31;break}return e.abrupt("return",Fd(Ld.invalidRequest,"Only top-level logins can have usernames"));case 31:if(null==r.getLoginByUserId(u.userId)){e.next=34;break}return e.abrupt("return",Fd(Ld.conflict));case 34:n.userId=u.userId,n.userTextBox=u.userTextBox;case 36:return e.abrupt("return",Wd(jt(Nd(r,n))));case 37:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),lp=Xd(function(){var e=t(c().mark((function e(t){var r,n,o,a,i,u,f,l,d,p,h,b,v,y,g,m,w,x,k;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.db,n=t.login,o=t.payload,a=Kd(tt,o),i=s(a,2),u=i[0],f=i[1],null!=u){e.next=4;break}return e.abrupt("return",f);case 4:for(l=u.approvedVouchers,d=void 0===l?[]:l,p=u.rejectedVouchers,h=void 0===p?[]:p,b={},v=0;v<d.length;v++)y=d[v],b[y]="approved";for(g=0;g<h.length;g++)m=h[g],b[m]="rejected";w=0,x=n.vouchers;case 9:if(!(w<x.length)){e.next=17;break}if(k=x[w],null!=b[k.voucherId]){e.next=13;break}return e.abrupt("continue",14);case 13:k.status=b[k.voucherId];case 14:w++,e.next=9;break;case 17:return e.abrupt("return",Wd(jt(Nd(r,n))));case 18:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),dp=function(e){return Fd(Ld.noLobby,"Cannot find lobby ".concat(e.lobbyId))},pp=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dp;return function(r){var n=r.db,o=r.path.split("/")[4],a=n.lobbies.get(o);return null!=a?e(Hd(Hd({},r),{},{lobby:a,lobbyId:o})):t(Hd(Hd({},r),{},{lobbyId:o}))}},hp=pp((function(e){return Fd(Ld.accountExists,"Lobby ".concat(e.lobbyId," already exists."))}),(function(e){var t=e.db,r=e.json,n=e.lobbyId,o=s(Kd(Ge,r),2),a=o[0],i=o[1];if(null==a)return i;var u=s(Kd(We,a.data),2),c=u[0],f=u[1];if(null==c)return f;var l=c.timeout,d=void 0===l?600:l,p=new Date(Date.now()+1e3*d).toISOString();return t.lobbies.set(n,{request:c,replies:[],expires:p}),Fd()})),bp=pp((function(e){var t=e.json,r=e.lobby,n=s(Kd(Ge,t),2),o=n[0],a=n[1];if(null==o)return a;var i=s(Kd(qe,o.data),2),u=i[0],c=i[1];return null==u?c:(r.replies.push(u),Fd())})),vp=pp((function(e){var t=e.lobby;return Wd(Mt(t))})),yp=pp((function(e){var t=e.db,r=e.lobbyId;return t.lobbies.delete(r),Fd()})),gp=function(e){return function(t){var r=t.db,n=t.path.split("/")[4],o=r.repos.get(n);return null==o?Ud({msg:"Hash not found"},{status:404}):e(Hd(Hd({},t),{},{repo:o}))}},mp=gp((function(e){var t=e.repo;return Ud({changes:qt(t)})})),wp=gp((function(e){for(var t=e.json,r=e.repo,n=xp(t).changes,o=0,a=Object.keys(n);o<a.length;o++){var i=a[o];r[i]=n[i]}return Ud({changes:qt(r),hash:"1111111111111111111111111111111111111111"})})),xp=Ae({changes:Ae(Ke)}),kp=S({"/api/v2/login/?":E({GET:Yd($d),POST:Yd($d)}),"/api/v2/login/create/?":E({POST:Yd(Qd),PUT:Yd(Qd)}),"/api/v2/login/keys/?":E({POST:Yd(ep)}),"/api/v2/login/otp/?":E({DELETE:Yd(rp),POST:Yd(tp),PUT:Yd(tp)}),"/api/v2/login/password/?":E({DELETE:Yd(np),POST:Yd(op),PUT:Yd(op)}),"/api/v2/login/pin2/?":E({DELETE:Yd(ap),POST:Yd(ip),PUT:Yd(ip)}),"/api/v2/login/recovery2/?":E({DELETE:Yd(sp),POST:Yd(up),PUT:Yd(up)}),"/api/v2/login/secret/?":E({POST:Yd(cp)}),"/api/v2/login/username/?":E({POST:Yd(fp)}),"/api/v2/login/vouchers/?":E({POST:Yd(lp)}),"/api/v2/messages/?":E({POST:Yd((function(e){var t=e.db,r=e.json,n=s(Kd(Ge,r),2),o=n[0],a=n[1];if(null==o)return a;var i=o.loginIds;if(null==i)return Fd(Ld.invalidRequest);for(var u=[],c=0;c<i.length;c++){var f=i[c],l=t.getLoginById(f);null!=l&&u.push({loginId:f,otpResetPending:null!=l.otpResetDate,pendingVouchers:Dd(l),recovery2Corrupt:!1})}return Wd(Ct(u))}))}),"/api/v2/lobby/[^/]+/?":E({DELETE:Yd(yp),GET:Yd(vp),POST:Yd(bp),PUT:Yd(hp)}),"/api/v2/store/[^/]+/?":E({GET:mp,POST:wp}),"/v1/edgeServers":E({GET:function(e){return Ud({infoServers:["https://info-fake1.edge.app"],syncServers:["https://sync-fake1.edge.app","https://sync-fake2.edge.app","https://sync-fake3.edge.app"]})}})},(function(e){return Fd(Ld.notFound,"Unknown API endpoint ".concat(e.path))}));function Ip(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Op(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ip(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ip(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ep(e,t){return Sp.apply(this,arguments)}function Sp(){return(Sp=t(c().mark((function e(t,r){var n,o,a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.lastLogin,o=r.server,a=x.parse(r.loginId),i=x.parse(r.loginKey),s=null==r.username?void 0:be(r.username),u=bn({appId:"",lastLogin:n,loginId:a,pendingVouchers:[],username:s},i,ut(o)),f="logins/".concat(Ht.stringify(a),".json"),e.next=8,t.disklet.setText(f,JSON.stringify(Xr(u))).catch((function(){}));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ap(e,t,r){return _p.apply(this,arguments)}function _p(){return(_p=t(c().mark((function e(t,r,n){var o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=qo(t,{dataKey:new Uint8Array(0),syncKey:r}),e.next=3,Go(o.dataDisklet,n);case 3:return e.next=5,o.baseDisklet.setText("status.json",JSON.stringify({lastSync:1,lastHash:null}));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Tp(e,r,n){for(var o=e.io,a=e.nativeIo,i=new Cd,s=function(e){var t=Er((function(r){if(t.offline)throw new Error("Fake network error");var n=r.body.byteLength>0?JSON.parse(Yt.stringify(new Uint8Array(r.body))):{};return kp(Hd(Hd({},r),{},{db:e,json:n}))}),{offline:!1});return t}(i),u=0;u<n.length;u++){var f=n[u];i.setupLogin(Ft(f.server));for(var l=0,d=Object.keys(f.repos);l<d.length;l++){var p=d[l];i.setupRepo(p,Kt(f.repos[p]))}}var h=[],b={close:function(){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(h.map((function(e){return e.close()})));case 2:z(b);case 3:case"end":return e.stop()}}),e)})))()},makeEdgeContext:function(e){return t(c().mark((function t(){var i,u,f,l,d,p,b,v,y,g,w,x,k,O,E,S,A,_;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=e.allowNetworkAccess,u=void 0!==i&&i,f=e.cleanDevice,l=void 0!==f&&f,d=e.extraFiles,p=void 0===d?{}:d,b=I(s),v=u?function(e,t){try{Jt(e)}catch(r){return o.fetch(e,t)}return b(e,t)}:b,y=Op(Op({},o),{},{disklet:(0,ie.Wh)(),fetch:v}),l){t.next=21;break}g=0;case 6:if(!(g<n.length)){t.next=21;break}return w=n[g],t.next=10,Ep(y,w);case 10:x=0,k=Object.keys(w.repos);case 11:if(!(x<k.length)){t.next=18;break}return O=k[x],t.next=15,Ap(y,m.parse(O),Kt(w.repos[O]));case 15:x++,t.next=11;break;case 18:g++,t.next=6;break;case 21:if(null==p){t.next=30;break}E=0,S=Object.keys(p);case 23:if(!(E<S.length)){t.next=30;break}return A=S[E],t.next=27,y.disklet.setText(A,p[A]);case 27:E++,t.next=23;break;case 30:return t.next=32,Ad({io:y,nativeIo:a},r,Op({},e));case 32:return _=t.sent,h.push(_),t.abrupt("return",_);case 35:case"end":return t.stop()}}),t)})))()},goOffline:function(){var e=arguments;return t(c().mark((function t(){var r;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=!(e.length>0&&void 0!==e[0])||e[0],s.offline=r;case 2:case"end":return t.stop()}}),t)})))()},dumpFakeUser:function(e){return t(c().mark((function t(){var r,n,o,a,s,u,f,l,d,p,h,b;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(""===e.appId){t.next=2;break}throw new Error("Only root logins are dumpable.");case 2:return r=Ht.parse(e.rootLoginId),t.t0=Ht,t.next=6,e.getLoginKey();case 6:if(t.t1=t.sent,n=t.t0.parse.call(t.t0,t.t1),null!=(o=i.getLoginById(r))){t.next=11;break}throw new Error("Cannot find user ".concat(e.rootLoginId));case 11:a=[],s=0,u=e.allKeys;case 13:if(!(s<u.length)){t.next=24;break}return f=u[s],t.next=17,e.getRawPrivateKey(f.id);case 17:if(null!=(l=t.sent).syncKey){t.next=20;break}return t.abrupt("continue",21);case 20:a.push(m.stringify(x.parse(l.syncKey)).toLowerCase());case 21:s++,t.next=13;break;case 24:for(d={},p=0;p<a.length;p++)h=a[p],null!=(b=i.repos.get(h))&&(d[h]=qt(b));return t.abrupt("return",{lastLogin:e.lastLogin,loginId:x.stringify(r),loginKey:x.stringify(n),repos:d,server:Wt(i.dumpLogin(o)),username:e.username});case 27:case"end":return t.stop()}}),t)})))()}};return C(b),b}var Pp=["allKeys","displayPrivateSeed","displayPublicSeed","keys","otpKey","loginKey","publicWalletInfo","recoveryKey"];function Mp(e){var t=function(){var e={resolve:function(){},reject:function(){}},t=0;if("undefined"!=typeof Map){var r=new Map;return{add:function(e){var n=++t;return r.set(n,e),n},grab:function(t){var n=r.get(t);return null==n?e:(r.delete(t),n)}}}var n={};return{add:function(e){var r=++t;return n[String(r)]=e,r},grab:function(t){var r=n[String(t)];return null==r?e:(delete n[String(t)],r)}}}();return{call:function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return new Promise((function(n,a){e(t.add({resolve:n,reject:a}),r,o)}))},resolve:function(e,r){t.grab(e).resolve(r)},reject:function(e,r){t.grab(e).reject(new Error(r))}}}var jp=new Map,Cp=s(null!=window.edgeCore?[Mp((function(e,t,r){window.edgeCore.call(e,t,JSON.stringify(r))})),new te({hideProperties:Pp,sendMessage:function(e){window.edgeCore.postMessage(JSON.stringify(e))},throttleMs:50})]:[Mp((function(e,t,r){window.webkit.messageHandlers.edgeCore.postMessage([e,t,r])})),new te({hideProperties:Pp,sendMessage:function(e){window.webkit.messageHandlers.edgeCore.postMessage([0,"postMessage",[JSON.stringify(e)]])},throttleMs:50})],2),Np=Cp[0],Dp=Cp[1];function Rp(e){var t=window.document.head;if(null!=t&&0!==e.length)for(var r=0,n=function(){++r>=e.length&&Ao()},o=0;o<e.length;o++){var a=e[o],i=document.createElement("script");i.addEventListener("error",n),i.addEventListener("load",n),i.charset="utf-8",i.defer=!0,i.src=a,t.appendChild(i)}else Ao()}function Bp(){return Lp.apply(this,arguments)}function Lp(){return Lp=t(c().mark((function e(){var r,n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=p(),e.t1=l().sha256,e.t2=x,e.next=5,Np.call("randomBytes",32);case 5:return e.t3=e.sent,e.t4=e.t2.parse.call(e.t2,e.t3),e.t5={hash:e.t1,entropy:e.t4},r=new e.t0(e.t5),n=function(){var e=t(c().mark((function e(t){var r,n,o,a,i,s,u,f=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(r=f.length>1&&void 0!==f[1]?f[1]:{}).method,o=void 0===n?"GET":n,a=r.headers,i=void 0===a?{}:a,s=r.body,e.next=4,Np.call("fetch",t,o,i,s instanceof ArrayBuffer?x.stringify(new Uint8Array(s)):s,s instanceof ArrayBuffer);case 4:return u=e.sent,e.abrupt("return",O({status:u.status,headers:u.headers,body:u.bodyIsBase64?x.parse(u.body):u.body}));case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),o={disklet:{delete:function(e){return Np.call("diskletDelete",Kp(e))},getData:function(e){return t(c().mark((function t(){var r;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Np.call("diskletGetData",Kp(e));case 2:return r=t.sent,t.abrupt("return",x.parse(r));case 4:case"end":return t.stop()}}),t)})))()},getText:function(e){return Np.call("diskletGetText",Kp(e))},list:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Np.call("diskletList",Kp(e))},setData:function(e,t){return Np.call("diskletSetData",Kp(e),x.stringify(t))},setText:function(e,t){return Np.call("diskletSetText",Kp(e),t)}},random:function(e){return r.generate(e)},scrypt:function(e,r,n,o,a,i){return t(c().mark((function t(){var s;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Np.call("scrypt",x.stringify(e),x.stringify(r),n,o,a,i);case 2:return s=t.sent,t.abrupt("return",x.parse(s));case 4:case"end":return t.stop()}}),t)})))()},fetch:function(e,r){return t(c().mark((function t(){var o,a,i,s,u,f,l,d,p,h,b;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=(null!=r?r:{}).corsBypass,"always"!==(i=void 0===a?"auto":a)){t.next=5;break}return t.next=4,n(e,r);case 4:case 8:return t.abrupt("return",t.sent);case 5:if("never"!==i){t.next=9;break}return t.next=8,window.fetch(e,r);case 9:if(s=new URL(e),u=s.protocol,f=s.host,l=s.pathname,d="".concat(u,"//").concat(f).concat(l),p=null!==(o=jp.get(d))&&void 0!==o?o:{windowSuccess:!1,nativeSuccess:!1},jp.has(d)||jp.set(d,p),p.nativeSuccess){t.next=26;break}return t.prev=14,t.next=17,window.fetch(e,r);case 17:return h=t.sent,p.windowSuccess=!0,t.abrupt("return",h);case 22:if(t.prev=22,t.t0=t.catch(14),!p.windowSuccess){t.next=26;break}throw t.t0;case 26:return t.next=28,n(e,r);case 28:return b=t.sent,p.nativeSuccess=!0,t.abrupt("return",b);case 31:case"end":return t.stop()}}),t,null,[[14,22]])})))()},fetchCors:function(e){var r=arguments;return t(c().mark((function t(){var n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},t.next=3,o.fetch(e,n);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))()}},e.abrupt("return",o);case 12:case"end":return e.stop()}}),e)}))),Lp.apply(this,arguments)}function Kp(e){if(/^\//.test(e))throw new Error("Absolute paths are not supported");for(var t=e.split("/"),r=0,n=0;r<t.length;){var o=t[r++];if(".."===o?n--:"."!==o&&""!==o&&(t[n++]=o),n<0)throw new Error("Path would escape folder")}return t.slice(0,n).join("/")}window.addEdgeCorePlugins=function(e){if(Oo)throw new Error("The Edge core plugin list has already been locked");for(var t=0,r=Object.keys(e);t<r.length;t++){var n=r[t];Io[n]=e[n]}for(var o=0;o<Eo.length;o++){(0,Eo[o])(e)}},window.nativeBridge=Np,window.reactBridge=Dp;var Up=C({makeEdgeContext:function(e,r,n,o){return t(c().mark((function t(){var a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return Rp(n),t.next=3,Bp();case 3:return a=t.sent,t.next=6,Ad({io:a,nativeIo:e},r,o);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)})))()},makeFakeEdgeWorld:function(e,r,n){var o=arguments;return t(c().mark((function t(){var a,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=o.length>3&&void 0!==o[3]?o[3]:[],Rp(n),t.next=4,Bp();case 4:return i=t.sent,t.abrupt("return",Tp({io:i,nativeIo:e},r,a));case 6:case"end":return t.stop()}}),t)})))()}});Dp.sendRoot(Up)}()}();
2
+ !function(){var e={8826: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 a(e){return new Uint8Array(e)}function i(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 s,u={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=(s="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(s[(240&n)>>4]+s[15&n])}return t.join("")}}),f={16:10,24:12,32:14},l=[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],p=[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],h=[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],b=[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],v=[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],g=[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],m=[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],w=[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],x=[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],I=[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],O=[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],E=[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 A=function(e){if(!(this instanceof A))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:o(e,!0)}),this._prepare()};A.prototype._prepare=function(){var e=f[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,a=S(this.key);for(t=0;t<o;t++)r=t>>2,this._Ke[r][t%4]=a[t],this._Kd[e-r][t%4]=a[t];for(var i,s=0,u=o;u<n;){if(i=a[o-1],a[0]^=d[i>>16&255]<<24^d[i>>8&255]<<16^d[255&i]<<8^d[i>>24&255]^l[s]<<24,s+=1,8!=o)for(t=1;t<o;t++)a[t]^=a[t-1];else{for(t=1;t<o/2;t++)a[t]^=a[t-1];i=a[o/2-1],a[o/2]^=d[255&i]^d[i>>8&255]<<8^d[i>>16&255]<<16^d[i>>24&255]<<24;for(t=o/2+1;t<o;t++)a[t]^=a[t-1]}for(t=0;t<o&&u<n;)c=u>>2,p=u%4,this._Ke[c][p]=a[t],this._Kd[e-c][p]=a[t++],u++}for(var c=1;c<e;c++)for(var p=0;p<4;p++)i=this._Kd[c][p],this._Kd[c][p]=k[i>>24&255]^I[i>>16&255]^O[i>>8&255]^E[255&i]},A.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 i=1;i<t;i++){for(o=0;o<4;o++)r[o]=h[n[o]>>24&255]^b[n[(o+1)%4]>>16&255]^v[n[(o+2)%4]>>8&255]^y[255&n[(o+3)%4]]^this._Ke[i][o];n=r.slice()}var s,u=a(16);for(o=0;o<4;o++)s=this._Ke[t][o],u[4*o]=255&(d[n[o]>>24&255]^s>>24),u[4*o+1]=255&(d[n[(o+1)%4]>>16&255]^s>>16),u[4*o+2]=255&(d[n[(o+2)%4]>>8&255]^s>>8),u[4*o+3]=255&(d[255&n[(o+3)%4]]^s);return u},A.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 i=1;i<t;i++){for(o=0;o<4;o++)r[o]=g[n[o]>>24&255]^m[n[(o+3)%4]>>16&255]^w[n[(o+2)%4]>>8&255]^x[255&n[(o+1)%4]]^this._Kd[i][o];n=r.slice()}var s,u=a(16);for(o=0;o<4;o++)s=this._Kd[t][o],u[4*o]=255&(p[n[o]>>24&255]^s>>24),u[4*o+1]=255&(p[n[(o+3)%4]>>16&255]^s>>16),u[4*o+2]=255&(p[n[(o+2)%4]>>8&255]^s>>8),u[4*o+3]=255&(p[255&n[(o+1)%4]]^s);return u};var T=function(e){if(!(this instanceof T))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new A(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=a(e.length),r=a(16),n=0;n<e.length;n+=16)i(e,r,0,n,n+16),i(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=a(e.length),r=a(16),n=0;n<e.length;n+=16)i(e,r,0,n,n+16),i(r=this._aes.decrypt(r),t,n);return t};var _=function(e,t){if(!(this instanceof _))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=a(16);this._lastCipherblock=o(t,!0),this._aes=new A(e)};_.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=a(e.length),r=a(16),n=0;n<e.length;n+=16){i(e,r,0,n,n+16);for(var s=0;s<16;s++)r[s]^=this._lastCipherblock[s];this._lastCipherblock=this._aes.encrypt(r),i(this._lastCipherblock,t,n)}return 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=a(e.length),r=a(16),n=0;n<e.length;n+=16){i(e,r,0,n,n+16),r=this._aes.decrypt(r);for(var s=0;s<16;s++)t[n+s]=r[s]^this._lastCipherblock[s];i(e,this._lastCipherblock,0,n,n+16)}return t};var P=function(e,t,r){if(!(this instanceof P))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=a(16);r||(r=1),this.segmentSize=r,this._shiftRegister=o(t,!0),this._aes=new A(e)};P.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 a=0;a<this.segmentSize;a++)r[n+a]^=t[a];i(this._shiftRegister,this._shiftRegister,0,this.segmentSize),i(r,this._shiftRegister,16-this.segmentSize,n,n+this.segmentSize)}return r},P.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 a=0;a<this.segmentSize;a++)r[n+a]^=t[a];i(this._shiftRegister,this._shiftRegister,0,this.segmentSize),i(e,this._shiftRegister,16-this.segmentSize,n,n+this.segmentSize)}return r};var M=function(e,t){if(!(this instanceof M))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=a(16);this._lastPrecipher=o(t,!0),this._lastPrecipherIndex=16,this._aes=new A(e)};M.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},M.prototype.decrypt=M.prototype.encrypt;var j=function(e){if(!(this instanceof j))throw Error("Counter must be instanitated with `new`");0===e||e||(e=1),"number"==typeof e?(this._counter=a(16),this.setValue(e)):this.setBytes(e)};j.prototype.setValue=function(e){if("number"!=typeof e||parseInt(e)!=e)throw new Error("invalid counter value (must be an integer)");if(e>Number.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},j.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},j.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var C=function(e,t){if(!(this instanceof C))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof j||(t=new j(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new A(e)};C.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},C.prototype.decrypt=C.prototype.encrypt;var N={AES:A,Counter:j,ModeOfOperation:{ecb:T,cbc:_,cfb:P,ofb:M,ctr:C},utils:{hex:c,utf8:u},padding:{pkcs7:{pad:function(e){var t=16-(e=o(e,!0)).length%16,r=a(e.length+t);i(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 s=a(r);return i(e,s,0,0,r),s}}},_arrayTest:{coerceArray:o,createArray:a,copyArray:i}};e.exports=N}()},5136:function(){function e(e,t,r){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:r})}e(Object,"assign",(function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");e=Object(e);for(var t=1;t<arguments.length;++t){var r=arguments[t];if(null!=r)for(var n=0,o=Object.keys(r);n<o.length;n++){var a=o[n];e[a]=r[a]}}return e})),e(Array.prototype,"fill",(function(e,t,r){var n=this.length;function o(e){return e<0?Math.max(n+e,0):Math.min(e,n)}for(var a=null!=t?o(t):0,i=null!=r?o(r):n,s=a;s<i;++s)this[s]=e;return this})),e(Array.prototype,"find",(function(e,t){for(var r=0;r<this.length;++r){var n=this[r];if(e.call(t,n,r,this))return n}})),e(Array.prototype,"includes",(function(e){return Array.prototype.indexOf.call(this,e)>=0})),e(Uint8Array.prototype,"fill",Array.prototype.fill)},8162:function(e){"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var o=e.charAt(n),a=o.charCodeAt(0);if(255!==t[a])throw new TypeError(o+" is ambiguous");t[a]=n}var i=e.length,s=e.charAt(0),u=Math.log(i)/Math.log(256),c=Math.log(256)/Math.log(i);function f(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var r=0,n=0,o=0;e[r]===s;)n++,r++;for(var a=(e.length-r)*u+1>>>0,c=new Uint8Array(a);e[r];){var f=t[e.charCodeAt(r)];if(255===f)return;for(var l=0,d=a-1;(0!==f||l<o)&&-1!==d;d--,l++)f+=i*c[d]>>>0,c[d]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");o=l,r++}for(var p=a-o;p!==a&&0===c[p];)p++;for(var h=new Uint8Array(n+(a-p)),b=n;p!==a;)h[b++]=c[p++];return h}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,a=t.length;o!==a&&0===t[o];)o++,r++;for(var u=(a-o)*c+1>>>0,f=new Uint8Array(u);o!==a;){for(var l=t[o],d=0,p=u-1;(0!==l||d<n)&&-1!==p;p--,d++)l+=256*f[p]>>>0,f[p]=l%i>>>0,l=l/i>>>0;if(0!==l)throw new Error("Non-zero carry");n=d,o++}for(var h=u-n;h!==u&&0===f[h];)h++;for(var b=s.repeat(r);h<u;++h)b+=e.charAt(f[h]);return b},decodeUnsafe:f,decode:function(e){var t=f(e);if(t)return t;throw new Error("Non-base"+i+" character")}}}},7591:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.log10=t.toFixed=t.toBns=t.round=t.ceil=t.floor=t.max=t.abs=t.min=t.eq=t.gte=t.gt=t.lte=t.lt=t.div=t.sub=t.mul=t.add=void 0;const o=n(r(3550)),a=/^(-?\d*\.?\d*)e((?:\+|-)?\d+)$/;function i(e,t,r=10){if(10!==r&&16!==r)throw new Error("Unsupported base");let{x:n,y:a,shift:i}=h(e,t);const s=b(n)?16:10,u=b(a)?16:10;n=p(n),a=p(a);const c=new o.default(n,s),f=new o.default(a,u);let d=c.add(f).toString(r);return d=l(d,i),10===r?d:d.replace(/^(-)?/,"$10x")}function s(e,t,r=10){if(10!==r&&16!==r)throw new Error("Unsupported base");let{x:n,y:a,shift:i}=h(e,t);const s=b(n)?16:10,u=b(a)?16:10;n=p(n),a=p(a);const c=new o.default(n,s),f=new o.default(a,u);let d=c.mul(f).toString(r);return d=l(d,2*i),10===r?d:d.replace(/^(-)?/,"$10x")}function u(e,t){let{x:r,y:n}=h(e,t);const a=b(r)?16:10,i=b(n)?16:10;r=p(r),n=p(n);const s=new o.default(r,a),u=new o.default(n,i);return s.gt(u)}function c(e,t){let{x:r,y:n}=h(e,t);const a=b(r)?16:10,i=b(n)?16:10;r=p(r),n=p(n);const s=new o.default(r,a),u=new o.default(n,i);return s.gte(u)}function f(e){let t="number"==typeof e?e.toString():e.replace(/^\s+|\s+$/g,"");""!==t&&"."!==t||(t="0");const r=t.match(a);if(null!=r){t=function(e,t){const r=t>=0?"1"+"0".repeat(Math.abs(t)):`0.${"0".repeat(Math.abs(t)-1)}1`;return s(e,r)}(r[1],parseInt(r[2]))}return function(...e){for(const t of e){if(t.split(".").length-1>1)throw new Error(`Invalid number: more than one decimal point '${t}'`);if(t.split("-").length-1>1)throw new Error(`Invalid number: more than one negative sign '${t}'`);if(!/^-?(?:0x[0-9A-Fa-f]+|(?:\d+(?:\.\d*)?|\.\d+))$/.test(t))throw new Error(`Invalid number: non-number characters '${t}'`)}}(t),t}function l(e,t){if(0===t)return e;let r,n=!1;return"-"===e.slice(0,1)&&(n=!0,e=e.slice(1)),r=t>e.length?"0."+d("",t-e.length)+e:e.substr(0,e.length-t)+"."+e.substr(e.length-t,e.length),r=y(r),n&&(r=`-${r}`),r}function d(e,t){let r=e;for(let n=0;n<t;n++)r+="0";return r}function p(e){return e.replace("0x","")}function h(e,t,r){let n=f(e),o=f(t),a=n.indexOf("."),i=o.indexOf(".");const s=b(n),u=b(o);if(-1!==a&&(n=y(n),a=n.indexOf(".")),-1!==i&&(o=y(o),i=o.indexOf(".")),-1!==a||-1!==i||"number"==typeof r){if(s||u)throw new Error("Cannot operate on base16 float values");let e=0,t=0;-1!==a&&(e=n.length-a-1),-1!==i&&(t=o.length-i-1);const c=e>t?e:t;let f=0;"number"==typeof r&&(f=r),n=d(n.replace(".",""),c+f-e),o=d(o.replace(".",""),c-t);return{x:n,y:o,shift:c}}return{x:n,y:o,shift:0}}function b(e){const t=f(e);return!!(t.startsWith("0x")||t.startsWith("-0x")||t.toLowerCase().includes("a")||t.toLowerCase().includes("b")||t.toLowerCase().includes("c")||t.toLowerCase().includes("d")||t.toLowerCase().includes("e")||t.toLowerCase().includes("f"))}function v(e,t,r=0){var n,o;let a=f(t),s=!1,l="";a.includes("-")&&(s=!0,a=a.replace(/^-+/,""));const[d,p=""]=a.split("."),h=a.indexOf("."),b=-1!==h?h-r:a.length-r,v=d+p;if("round"===e){e=c(null!==(n=v[b])&&void 0!==n?n:"0","5")?"ceil":"floor"}const g=Math.max(v.length-b+1,0),m=new Array(g).join("0");let w=v.substring(0,b)+m;const x=u(v.substring(b),"0");if("ceil"===e&&x){const e="1"+m,t=(null!==(o=w.match(/^0+/))&&void 0!==o?o:[""])[0].length;w=new Array(t).join("0")+i(w,e)}const k=h+(w.length-v.length);return l=-1!==h?w.substring(0,k)+"."+w.substring(k):w,l=y(l),s&&"0"!==l&&(l="-"+l),l}function y(e){let t=e.replace(/^0+/,"");return t=t.replace(/^\.+/,"0."),t.includes(".")&&(t=t.replace(/0+$/,""),t=t.replace(/\.+$/,""),""===t&&(t="0")),""===t&&(t="0"),t}t.add=i,t.mul=s,t.sub=function(e,t,r=10){if(10!==r&&16!==r)throw new Error("Unsupported base");let{x:n,y:a,shift:i}=h(e,t);const s=b(n)?16:10,u=b(a)?16:10;n=p(n),a=p(a);const c=new o.default(n,s),f=new o.default(a,u);let d=c.sub(f).toString(r);return d=l(d,i),10===r?d:d.replace(/^(-)?/,"$10x")},t.div=function(e,t,r=0,n=10){if(10!==n&&r>0)throw new Error("Cannot operate on floating point hex values");if(10!==n&&16!==n)throw new Error("Unsupported base");let{x:a,y:i}=h(e,t,r);const s=b(a)?16:10,u=b(i)?16:10;a=p(a),i=p(i);const c=new o.default(a,s),f=new o.default(i,u);let d=c.div(f).toString(n);return d=l(d,r),10===n?d:d.replace(/^(-)?/,"$10x")},t.lt=function(e,t){let{x:r,y:n}=h(e,t);const a=b(r)?16:10,i=b(n)?16:10;r=p(r),n=p(n);const s=new o.default(r,a),u=new o.default(n,i);return s.lt(u)},t.lte=function(e,t){let{x:r,y:n}=h(e,t);const a=b(r)?16:10,i=b(n)?16:10;r=p(r),n=p(n);const s=new o.default(r,a),u=new o.default(n,i);return s.lte(u)},t.gt=u,t.gte=c,t.eq=function(e,t){let{x:r,y:n}=h(e,t);const a=b(r)?16:10,i=b(n)?16:10;r=p(r),n=p(n);const s=new o.default(r,a),u=new o.default(n,i);return s.eq(u)},t.min=function(e,t,r=10){let{x:n,y:a,shift:i}=h(e,t);const s=b(n)?16:10,u=b(a)?16:10;n=p(n),a=p(a);const c=new o.default(n,s),f=new o.default(a,u);let d;return d=c.lte(f)?c.toString(r):f.toString(r),d=l(d,i),10===r?d:d.replace(/^(-)?/,"$10x")},t.abs=function(e,t=10){if(10!==t&&16!==t)throw new Error("Unsupported base");let{x:r,shift:n}=h(e,"0");const a=b(e)?16:10;r=p(r);let i=new o.default(r,a).abs().toString(t);return i=l(i,n),10===t?i:i.replace(/^(-)?/,"$10x")},t.max=function(e,t,r=10){let{x:n,y:a,shift:i}=h(e,t);const s=b(n)?16:10,u=b(a)?16:10;n=p(n),a=p(a);const c=new o.default(n,s),f=new o.default(a,u);let d;return d=c.gte(f)?c.toString(r):f.toString(r),d=l(d,i),10===r?d:d.replace(/^(-)?/,"$10x")},t.floor=(e,t)=>v("floor",e,t),t.ceil=(e,t)=>v("ceil",e,t),t.round=(e,t)=>v("round",e,t),t.toBns=f,t.toFixed=function(e,t=2,r=8){let n=f(e),o=!1,a="";n.includes("-")&&(o=!0,n=n.replace(/^-+/,"")),n=y(n);const i=n.indexOf(".");if(-1===i)a=n+"."+d("",t);else{const e=n.length-i-1;a=e>r?n.substr(0,n.length-(e-r)):e<t?n+d("",t-e):n}return a=a.replace(/\.+$/,""),o&&"0"!==a&&(a="-"+a),a},t.log10=function(e){if(null===e.match(/^[0-1]+$/g))throw new Error("InvalidLogInputValue: Must be a power of 10");if(!e.startsWith("1"))throw new Error("InvalidLogInputValue: Must not have leading zeros");if((e.match(/1/g)||[]).length>1)throw new Error("InvalidLogInputValue: Must be power of 10.");return(e.match(/0/g)||[]).length}},3550:function(e,t,r){!function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function o(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function a(e,t,r){if(a.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var i;"object"==typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(6601).Buffer}catch(E){}function s(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(e,t,r){var n=s(e,r);return r-1>=t&&(n|=s(e,r-1)<<4),n}function c(e,t,r,n){for(var o=0,a=Math.min(e.length,r),i=t;i<a;i++){var s=e.charCodeAt(i)-48;o*=n,o+=s>=49?s-49+10:s>=17?s-17+10:s}return o}a.isBN=function(e){return e instanceof a||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return e.cmp(t)>0?e:t},a.min=function(e,t){return e.cmp(t)<0?e:t},a.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var o=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(o++,this.negative=1),o<e.length&&(16===t?this._parseHex(e,o,r):(this._parseBase(e,t,o),"le"===r&&this._initArray(this.toArray(),t,r)))},a.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},a.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var a,i,s=0;if("be"===r)for(o=e.length-1,a=0;o>=0;o-=3)i=e[o]|e[o-1]<<8|e[o-2]<<16,this.words[a]|=i<<s&67108863,this.words[a+1]=i>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(o=0,a=0;o<e.length;o+=3)i=e[o]|e[o+1]<<8|e[o+2]<<16,this.words[a]|=i<<s&67108863,this.words[a+1]=i>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,a=0,i=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)o=u(e,t,n)<<a,this.words[i]|=67108863&o,a>=18?(a-=18,i+=1,this.words[i]|=o>>>26):a+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)o=u(e,t,n)<<a,this.words[i]|=67108863&o,a>=18?(a-=18,i+=1,this.words[i]|=o>>>26):a+=8;this.strip()},a.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,o=1;o<=67108863;o*=t)n++;n--,o=o/t|0;for(var a=e.length-r,i=a%n,s=Math.min(a,a-i)+r,u=0,f=r;f<s;f+=n)u=c(e,f,f+n,t),this.imuln(o),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==i){var l=1;for(u=c(e,f,e.length,t),f=0;f<i;f++)l*=t;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},a.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function p(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var o=0|e.words[0],a=0|t.words[0],i=o*a,s=67108863&i,u=i/67108864|0;r.words[0]=s;for(var c=1;c<n;c++){for(var f=u>>>26,l=67108863&u,d=Math.min(c,t.length-1),p=Math.max(0,c-e.length+1);p<=d;p++){var h=c-p|0;f+=(i=(o=0|e.words[h])*(a=0|t.words[p])+l)/67108864|0,l=67108863&i}r.words[c]=0|l,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}a.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var o=0,a=0,i=0;i<this.length;i++){var s=this.words[i],u=(16777215&(s<<o|a)).toString(16);r=0!==(a=s>>>24-o&16777215)||i!==this.length-1?f[6-u.length]+u+r:u+r,(o+=2)>=26&&(o-=26,i--)}for(0!==a&&(r=a.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=l[e],p=d[e];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var b=h.modn(p).toString(e);r=(h=h.idivn(p)).isZero()?b+r:f[c-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(e,t){return n(void 0!==i),this.toArrayLike(i,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,r){var o=this.byteLength(),a=r||Math.max(1,o);n(o<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0"),this.strip();var i,s,u="le"===t,c=new e(a),f=this.clone();if(u){for(s=0;!f.isZero();s++)i=f.andln(255),f.iushrn(8),c[s]=i;for(;s<a;s++)c[s]=0}else{for(s=0;s<a-o;s++)c[s]=0;for(s=0;!f.isZero();s++)i=f.andln(255),f.iushrn(8),c[a-s-1]=i}return c},Math.clz32?a.prototype._countBits=function(e){return 32-Math.clz32(e)}:a.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},a.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},a.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},a.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var o=0;o<t;o++)this.words[o]=67108863&~this.words[o];return r>0&&(this.words[o]=~this.words[o]&67108863>>26-r),this.strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,o=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<o:this.words[r]&~(1<<o),this.strip()},a.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a<n.length;a++)t=(0|r.words[a])+(0|n.words[a])+o,this.words[a]=67108863&t,o=t>>>26;for(;0!==o&&a<r.length;a++)t=(0|r.words[a])+o,this.words[a]=67108863&t,o=t>>>26;if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,o=this.cmp(e);if(0===o)return this.negative=0,this.length=1,this.words[0]=0,this;o>0?(r=this,n=e):(r=e,n=this);for(var a=0,i=0;i<n.length;i++)a=(t=(0|r.words[i])-(0|n.words[i])+a)>>26,this.words[i]=67108863&t;for(;0!==a&&i<r.length;i++)a=(t=(0|r.words[i])+a)>>26,this.words[i]=67108863&t;if(0===a&&i<r.length&&r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this.length=Math.max(this.length,i),r!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var n,o,a,i=e.words,s=t.words,u=r.words,c=0,f=0|i[0],l=8191&f,d=f>>>13,p=0|i[1],h=8191&p,b=p>>>13,v=0|i[2],y=8191&v,g=v>>>13,m=0|i[3],w=8191&m,x=m>>>13,k=0|i[4],I=8191&k,O=k>>>13,E=0|i[5],S=8191&E,A=E>>>13,T=0|i[6],_=8191&T,P=T>>>13,M=0|i[7],j=8191&M,C=M>>>13,N=0|i[8],D=8191&N,R=N>>>13,B=0|i[9],L=8191&B,K=B>>>13,U=0|s[0],F=8191&U,W=U>>>13,q=0|s[1],z=8191&q,G=q>>>13,H=0|s[2],Y=8191&H,J=H>>>13,V=0|s[3],X=8191&V,$=V>>>13,Z=0|s[4],Q=8191&Z,ee=Z>>>13,te=0|s[5],re=8191&te,ne=te>>>13,oe=0|s[6],ae=8191&oe,ie=oe>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,fe=0|s[8],le=8191&fe,de=fe>>>13,pe=0|s[9],he=8191&pe,be=pe>>>13;r.negative=e.negative^t.negative,r.length=19;var ve=(c+(n=Math.imul(l,F))|0)+((8191&(o=(o=Math.imul(l,W))+Math.imul(d,F)|0))<<13)|0;c=((a=Math.imul(d,W))+(o>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(h,F),o=(o=Math.imul(h,W))+Math.imul(b,F)|0,a=Math.imul(b,W);var ye=(c+(n=n+Math.imul(l,z)|0)|0)+((8191&(o=(o=o+Math.imul(l,G)|0)+Math.imul(d,z)|0))<<13)|0;c=((a=a+Math.imul(d,G)|0)+(o>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,F),o=(o=Math.imul(y,W))+Math.imul(g,F)|0,a=Math.imul(g,W),n=n+Math.imul(h,z)|0,o=(o=o+Math.imul(h,G)|0)+Math.imul(b,z)|0,a=a+Math.imul(b,G)|0;var ge=(c+(n=n+Math.imul(l,Y)|0)|0)+((8191&(o=(o=o+Math.imul(l,J)|0)+Math.imul(d,Y)|0))<<13)|0;c=((a=a+Math.imul(d,J)|0)+(o>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(w,F),o=(o=Math.imul(w,W))+Math.imul(x,F)|0,a=Math.imul(x,W),n=n+Math.imul(y,z)|0,o=(o=o+Math.imul(y,G)|0)+Math.imul(g,z)|0,a=a+Math.imul(g,G)|0,n=n+Math.imul(h,Y)|0,o=(o=o+Math.imul(h,J)|0)+Math.imul(b,Y)|0,a=a+Math.imul(b,J)|0;var me=(c+(n=n+Math.imul(l,X)|0)|0)+((8191&(o=(o=o+Math.imul(l,$)|0)+Math.imul(d,X)|0))<<13)|0;c=((a=a+Math.imul(d,$)|0)+(o>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(I,F),o=(o=Math.imul(I,W))+Math.imul(O,F)|0,a=Math.imul(O,W),n=n+Math.imul(w,z)|0,o=(o=o+Math.imul(w,G)|0)+Math.imul(x,z)|0,a=a+Math.imul(x,G)|0,n=n+Math.imul(y,Y)|0,o=(o=o+Math.imul(y,J)|0)+Math.imul(g,Y)|0,a=a+Math.imul(g,J)|0,n=n+Math.imul(h,X)|0,o=(o=o+Math.imul(h,$)|0)+Math.imul(b,X)|0,a=a+Math.imul(b,$)|0;var we=(c+(n=n+Math.imul(l,Q)|0)|0)+((8191&(o=(o=o+Math.imul(l,ee)|0)+Math.imul(d,Q)|0))<<13)|0;c=((a=a+Math.imul(d,ee)|0)+(o>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(S,F),o=(o=Math.imul(S,W))+Math.imul(A,F)|0,a=Math.imul(A,W),n=n+Math.imul(I,z)|0,o=(o=o+Math.imul(I,G)|0)+Math.imul(O,z)|0,a=a+Math.imul(O,G)|0,n=n+Math.imul(w,Y)|0,o=(o=o+Math.imul(w,J)|0)+Math.imul(x,Y)|0,a=a+Math.imul(x,J)|0,n=n+Math.imul(y,X)|0,o=(o=o+Math.imul(y,$)|0)+Math.imul(g,X)|0,a=a+Math.imul(g,$)|0,n=n+Math.imul(h,Q)|0,o=(o=o+Math.imul(h,ee)|0)+Math.imul(b,Q)|0,a=a+Math.imul(b,ee)|0;var xe=(c+(n=n+Math.imul(l,re)|0)|0)+((8191&(o=(o=o+Math.imul(l,ne)|0)+Math.imul(d,re)|0))<<13)|0;c=((a=a+Math.imul(d,ne)|0)+(o>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(_,F),o=(o=Math.imul(_,W))+Math.imul(P,F)|0,a=Math.imul(P,W),n=n+Math.imul(S,z)|0,o=(o=o+Math.imul(S,G)|0)+Math.imul(A,z)|0,a=a+Math.imul(A,G)|0,n=n+Math.imul(I,Y)|0,o=(o=o+Math.imul(I,J)|0)+Math.imul(O,Y)|0,a=a+Math.imul(O,J)|0,n=n+Math.imul(w,X)|0,o=(o=o+Math.imul(w,$)|0)+Math.imul(x,X)|0,a=a+Math.imul(x,$)|0,n=n+Math.imul(y,Q)|0,o=(o=o+Math.imul(y,ee)|0)+Math.imul(g,Q)|0,a=a+Math.imul(g,ee)|0,n=n+Math.imul(h,re)|0,o=(o=o+Math.imul(h,ne)|0)+Math.imul(b,re)|0,a=a+Math.imul(b,ne)|0;var ke=(c+(n=n+Math.imul(l,ae)|0)|0)+((8191&(o=(o=o+Math.imul(l,ie)|0)+Math.imul(d,ae)|0))<<13)|0;c=((a=a+Math.imul(d,ie)|0)+(o>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(j,F),o=(o=Math.imul(j,W))+Math.imul(C,F)|0,a=Math.imul(C,W),n=n+Math.imul(_,z)|0,o=(o=o+Math.imul(_,G)|0)+Math.imul(P,z)|0,a=a+Math.imul(P,G)|0,n=n+Math.imul(S,Y)|0,o=(o=o+Math.imul(S,J)|0)+Math.imul(A,Y)|0,a=a+Math.imul(A,J)|0,n=n+Math.imul(I,X)|0,o=(o=o+Math.imul(I,$)|0)+Math.imul(O,X)|0,a=a+Math.imul(O,$)|0,n=n+Math.imul(w,Q)|0,o=(o=o+Math.imul(w,ee)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,ee)|0,n=n+Math.imul(y,re)|0,o=(o=o+Math.imul(y,ne)|0)+Math.imul(g,re)|0,a=a+Math.imul(g,ne)|0,n=n+Math.imul(h,ae)|0,o=(o=o+Math.imul(h,ie)|0)+Math.imul(b,ae)|0,a=a+Math.imul(b,ie)|0;var Ie=(c+(n=n+Math.imul(l,ue)|0)|0)+((8191&(o=(o=o+Math.imul(l,ce)|0)+Math.imul(d,ue)|0))<<13)|0;c=((a=a+Math.imul(d,ce)|0)+(o>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(D,F),o=(o=Math.imul(D,W))+Math.imul(R,F)|0,a=Math.imul(R,W),n=n+Math.imul(j,z)|0,o=(o=o+Math.imul(j,G)|0)+Math.imul(C,z)|0,a=a+Math.imul(C,G)|0,n=n+Math.imul(_,Y)|0,o=(o=o+Math.imul(_,J)|0)+Math.imul(P,Y)|0,a=a+Math.imul(P,J)|0,n=n+Math.imul(S,X)|0,o=(o=o+Math.imul(S,$)|0)+Math.imul(A,X)|0,a=a+Math.imul(A,$)|0,n=n+Math.imul(I,Q)|0,o=(o=o+Math.imul(I,ee)|0)+Math.imul(O,Q)|0,a=a+Math.imul(O,ee)|0,n=n+Math.imul(w,re)|0,o=(o=o+Math.imul(w,ne)|0)+Math.imul(x,re)|0,a=a+Math.imul(x,ne)|0,n=n+Math.imul(y,ae)|0,o=(o=o+Math.imul(y,ie)|0)+Math.imul(g,ae)|0,a=a+Math.imul(g,ie)|0,n=n+Math.imul(h,ue)|0,o=(o=o+Math.imul(h,ce)|0)+Math.imul(b,ue)|0,a=a+Math.imul(b,ce)|0;var Oe=(c+(n=n+Math.imul(l,le)|0)|0)+((8191&(o=(o=o+Math.imul(l,de)|0)+Math.imul(d,le)|0))<<13)|0;c=((a=a+Math.imul(d,de)|0)+(o>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(L,F),o=(o=Math.imul(L,W))+Math.imul(K,F)|0,a=Math.imul(K,W),n=n+Math.imul(D,z)|0,o=(o=o+Math.imul(D,G)|0)+Math.imul(R,z)|0,a=a+Math.imul(R,G)|0,n=n+Math.imul(j,Y)|0,o=(o=o+Math.imul(j,J)|0)+Math.imul(C,Y)|0,a=a+Math.imul(C,J)|0,n=n+Math.imul(_,X)|0,o=(o=o+Math.imul(_,$)|0)+Math.imul(P,X)|0,a=a+Math.imul(P,$)|0,n=n+Math.imul(S,Q)|0,o=(o=o+Math.imul(S,ee)|0)+Math.imul(A,Q)|0,a=a+Math.imul(A,ee)|0,n=n+Math.imul(I,re)|0,o=(o=o+Math.imul(I,ne)|0)+Math.imul(O,re)|0,a=a+Math.imul(O,ne)|0,n=n+Math.imul(w,ae)|0,o=(o=o+Math.imul(w,ie)|0)+Math.imul(x,ae)|0,a=a+Math.imul(x,ie)|0,n=n+Math.imul(y,ue)|0,o=(o=o+Math.imul(y,ce)|0)+Math.imul(g,ue)|0,a=a+Math.imul(g,ce)|0,n=n+Math.imul(h,le)|0,o=(o=o+Math.imul(h,de)|0)+Math.imul(b,le)|0,a=a+Math.imul(b,de)|0;var Ee=(c+(n=n+Math.imul(l,he)|0)|0)+((8191&(o=(o=o+Math.imul(l,be)|0)+Math.imul(d,he)|0))<<13)|0;c=((a=a+Math.imul(d,be)|0)+(o>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(L,z),o=(o=Math.imul(L,G))+Math.imul(K,z)|0,a=Math.imul(K,G),n=n+Math.imul(D,Y)|0,o=(o=o+Math.imul(D,J)|0)+Math.imul(R,Y)|0,a=a+Math.imul(R,J)|0,n=n+Math.imul(j,X)|0,o=(o=o+Math.imul(j,$)|0)+Math.imul(C,X)|0,a=a+Math.imul(C,$)|0,n=n+Math.imul(_,Q)|0,o=(o=o+Math.imul(_,ee)|0)+Math.imul(P,Q)|0,a=a+Math.imul(P,ee)|0,n=n+Math.imul(S,re)|0,o=(o=o+Math.imul(S,ne)|0)+Math.imul(A,re)|0,a=a+Math.imul(A,ne)|0,n=n+Math.imul(I,ae)|0,o=(o=o+Math.imul(I,ie)|0)+Math.imul(O,ae)|0,a=a+Math.imul(O,ie)|0,n=n+Math.imul(w,ue)|0,o=(o=o+Math.imul(w,ce)|0)+Math.imul(x,ue)|0,a=a+Math.imul(x,ce)|0,n=n+Math.imul(y,le)|0,o=(o=o+Math.imul(y,de)|0)+Math.imul(g,le)|0,a=a+Math.imul(g,de)|0;var Se=(c+(n=n+Math.imul(h,he)|0)|0)+((8191&(o=(o=o+Math.imul(h,be)|0)+Math.imul(b,he)|0))<<13)|0;c=((a=a+Math.imul(b,be)|0)+(o>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(L,Y),o=(o=Math.imul(L,J))+Math.imul(K,Y)|0,a=Math.imul(K,J),n=n+Math.imul(D,X)|0,o=(o=o+Math.imul(D,$)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,$)|0,n=n+Math.imul(j,Q)|0,o=(o=o+Math.imul(j,ee)|0)+Math.imul(C,Q)|0,a=a+Math.imul(C,ee)|0,n=n+Math.imul(_,re)|0,o=(o=o+Math.imul(_,ne)|0)+Math.imul(P,re)|0,a=a+Math.imul(P,ne)|0,n=n+Math.imul(S,ae)|0,o=(o=o+Math.imul(S,ie)|0)+Math.imul(A,ae)|0,a=a+Math.imul(A,ie)|0,n=n+Math.imul(I,ue)|0,o=(o=o+Math.imul(I,ce)|0)+Math.imul(O,ue)|0,a=a+Math.imul(O,ce)|0,n=n+Math.imul(w,le)|0,o=(o=o+Math.imul(w,de)|0)+Math.imul(x,le)|0,a=a+Math.imul(x,de)|0;var Ae=(c+(n=n+Math.imul(y,he)|0)|0)+((8191&(o=(o=o+Math.imul(y,be)|0)+Math.imul(g,he)|0))<<13)|0;c=((a=a+Math.imul(g,be)|0)+(o>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(L,X),o=(o=Math.imul(L,$))+Math.imul(K,X)|0,a=Math.imul(K,$),n=n+Math.imul(D,Q)|0,o=(o=o+Math.imul(D,ee)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,ee)|0,n=n+Math.imul(j,re)|0,o=(o=o+Math.imul(j,ne)|0)+Math.imul(C,re)|0,a=a+Math.imul(C,ne)|0,n=n+Math.imul(_,ae)|0,o=(o=o+Math.imul(_,ie)|0)+Math.imul(P,ae)|0,a=a+Math.imul(P,ie)|0,n=n+Math.imul(S,ue)|0,o=(o=o+Math.imul(S,ce)|0)+Math.imul(A,ue)|0,a=a+Math.imul(A,ce)|0,n=n+Math.imul(I,le)|0,o=(o=o+Math.imul(I,de)|0)+Math.imul(O,le)|0,a=a+Math.imul(O,de)|0;var Te=(c+(n=n+Math.imul(w,he)|0)|0)+((8191&(o=(o=o+Math.imul(w,be)|0)+Math.imul(x,he)|0))<<13)|0;c=((a=a+Math.imul(x,be)|0)+(o>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(L,Q),o=(o=Math.imul(L,ee))+Math.imul(K,Q)|0,a=Math.imul(K,ee),n=n+Math.imul(D,re)|0,o=(o=o+Math.imul(D,ne)|0)+Math.imul(R,re)|0,a=a+Math.imul(R,ne)|0,n=n+Math.imul(j,ae)|0,o=(o=o+Math.imul(j,ie)|0)+Math.imul(C,ae)|0,a=a+Math.imul(C,ie)|0,n=n+Math.imul(_,ue)|0,o=(o=o+Math.imul(_,ce)|0)+Math.imul(P,ue)|0,a=a+Math.imul(P,ce)|0,n=n+Math.imul(S,le)|0,o=(o=o+Math.imul(S,de)|0)+Math.imul(A,le)|0,a=a+Math.imul(A,de)|0;var _e=(c+(n=n+Math.imul(I,he)|0)|0)+((8191&(o=(o=o+Math.imul(I,be)|0)+Math.imul(O,he)|0))<<13)|0;c=((a=a+Math.imul(O,be)|0)+(o>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(L,re),o=(o=Math.imul(L,ne))+Math.imul(K,re)|0,a=Math.imul(K,ne),n=n+Math.imul(D,ae)|0,o=(o=o+Math.imul(D,ie)|0)+Math.imul(R,ae)|0,a=a+Math.imul(R,ie)|0,n=n+Math.imul(j,ue)|0,o=(o=o+Math.imul(j,ce)|0)+Math.imul(C,ue)|0,a=a+Math.imul(C,ce)|0,n=n+Math.imul(_,le)|0,o=(o=o+Math.imul(_,de)|0)+Math.imul(P,le)|0,a=a+Math.imul(P,de)|0;var Pe=(c+(n=n+Math.imul(S,he)|0)|0)+((8191&(o=(o=o+Math.imul(S,be)|0)+Math.imul(A,he)|0))<<13)|0;c=((a=a+Math.imul(A,be)|0)+(o>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(L,ae),o=(o=Math.imul(L,ie))+Math.imul(K,ae)|0,a=Math.imul(K,ie),n=n+Math.imul(D,ue)|0,o=(o=o+Math.imul(D,ce)|0)+Math.imul(R,ue)|0,a=a+Math.imul(R,ce)|0,n=n+Math.imul(j,le)|0,o=(o=o+Math.imul(j,de)|0)+Math.imul(C,le)|0,a=a+Math.imul(C,de)|0;var Me=(c+(n=n+Math.imul(_,he)|0)|0)+((8191&(o=(o=o+Math.imul(_,be)|0)+Math.imul(P,he)|0))<<13)|0;c=((a=a+Math.imul(P,be)|0)+(o>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(L,ue),o=(o=Math.imul(L,ce))+Math.imul(K,ue)|0,a=Math.imul(K,ce),n=n+Math.imul(D,le)|0,o=(o=o+Math.imul(D,de)|0)+Math.imul(R,le)|0,a=a+Math.imul(R,de)|0;var je=(c+(n=n+Math.imul(j,he)|0)|0)+((8191&(o=(o=o+Math.imul(j,be)|0)+Math.imul(C,he)|0))<<13)|0;c=((a=a+Math.imul(C,be)|0)+(o>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(L,le),o=(o=Math.imul(L,de))+Math.imul(K,le)|0,a=Math.imul(K,de);var Ce=(c+(n=n+Math.imul(D,he)|0)|0)+((8191&(o=(o=o+Math.imul(D,be)|0)+Math.imul(R,he)|0))<<13)|0;c=((a=a+Math.imul(R,be)|0)+(o>>>13)|0)+(Ce>>>26)|0,Ce&=67108863;var Ne=(c+(n=Math.imul(L,he))|0)+((8191&(o=(o=Math.imul(L,be))+Math.imul(K,he)|0))<<13)|0;return c=((a=Math.imul(K,be))+(o>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=ve,u[1]=ye,u[2]=ge,u[3]=me,u[4]=we,u[5]=xe,u[6]=ke,u[7]=Ie,u[8]=Oe,u[9]=Ee,u[10]=Se,u[11]=Ae,u[12]=Te,u[13]=_e,u[14]=Pe,u[15]=Me,u[16]=je,u[17]=Ce,u[18]=Ne,0!==c&&(u[19]=c,r.length++),r};function b(e,t,r){return(new v).mulp(e,t,r)}function v(e,t){this.x=e,this.y=t}Math.imul||(h=p),a.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):n<63?p(this,e,t):n<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,o=0,a=0;a<r.length-1;a++){var i=o;o=0;for(var s=67108863&n,u=Math.min(a,t.length-1),c=Math.max(0,a-e.length+1);c<=u;c++){var f=a-c,l=(0|e.words[f])*(0|t.words[c]),d=67108863&l;s=67108863&(d=d+s|0),o+=(i=(i=i+(l/67108864|0)|0)+(d>>>26)|0)>>>26,i&=67108863}r.words[a]=s,n=i,i=o}return 0!==n?r.words[a]=n:r.length--,r.strip()}(this,e,t):b(this,e,t),r},v.prototype.makeRBT=function(e){for(var t=new Array(e),r=a.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},v.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,o=0;o<t;o++)n|=(1&e)<<t-o-1,e>>=1;return n},v.prototype.permute=function(e,t,r,n,o,a){for(var i=0;i<a;i++)n[i]=t[e[i]],o[i]=r[e[i]]},v.prototype.transform=function(e,t,r,n,o,a){this.permute(a,e,t,r,n,o);for(var i=1;i<o;i<<=1)for(var s=i<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),f=0;f<o;f+=s)for(var l=u,d=c,p=0;p<i;p++){var h=r[f+p],b=n[f+p],v=r[f+p+i],y=n[f+p+i],g=l*v-d*y;y=l*y+d*v,v=g,r[f+p]=h+v,n[f+p]=b+y,r[f+p+i]=h-v,n[f+p+i]=b-y,p!==s&&(g=u*l-c*d,d=u*d+c*l,l=g)}},v.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,o=0;for(r=r/2|0;r;r>>>=1)o++;return 1<<o+1+n},v.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var o=e[n];e[n]=e[r-n-1],e[r-n-1]=o,o=t[n],t[n]=-t[r-n-1],t[r-n-1]=-o}},v.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var o=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&o,r=o<67108864?0:o/67108864|0}return e},v.prototype.convert13b=function(e,t,r,o){for(var a=0,i=0;i<t;i++)a+=0|e[i],r[2*i]=8191&a,a>>>=13,r[2*i+1]=8191&a,a>>>=13;for(i=2*t;i<o;++i)r[i]=0;n(0===a),n(0==(-8192&a))},v.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},v.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),o=this.makeRBT(n),a=this.stub(n),i=new Array(n),s=new Array(n),u=new Array(n),c=new Array(n),f=new Array(n),l=new Array(n),d=r.words;d.length=n,this.convert13b(e.words,e.length,i,n),this.convert13b(t.words,t.length,c,n),this.transform(i,a,s,u,n,o),this.transform(c,a,f,l,n,o);for(var p=0;p<n;p++){var h=s[p]*f[p]-u[p]*l[p];u[p]=s[p]*l[p]+u[p]*f[p],s[p]=h}return this.conjugate(s,u,n),this.transform(s,u,d,a,n,o),this.conjugate(d,a,n),this.normalize13b(d,n),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},a.prototype.mul=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},a.prototype.mulf=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),b(this,e,t)},a.prototype.imul=function(e){return this.clone().mulTo(e,this)},a.prototype.imuln=function(e){n("number"==typeof e),n(e<67108864);for(var t=0,r=0;r<this.length;r++){var o=(0|this.words[r])*e,a=(67108863&o)+(67108863&t);t>>=26,t+=o/67108864|0,t+=a>>>26,this.words[r]=67108863&a}return 0!==t&&(this.words[r]=t,this.length++),this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,o=r%26;t[r]=(e.words[n]&1<<o)>>>o}return t}(e);if(0===t.length)return new a(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var o=r.sqr();n<t.length;n++,o=o.sqr())0!==t[n]&&(r=r.mul(o));return r},a.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,o=(e-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var i=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,u=(0|this.words[t])-s<<r;this.words[t]=u|i,i=s>>>26-r}i&&(this.words[t]=i,this.length++)}if(0!==o){for(t=this.length-1;t>=0;t--)this.words[t+o]=this.words[t];for(t=0;t<o;t++)this.words[t]=0;this.length+=o}return this.strip()},a.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,r){var o;n("number"==typeof e&&e>=0),o=t?(t-t%26)/26:0;var a=e%26,i=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,u=r;if(o-=i,o=Math.max(0,o),u){for(var c=0;c<i;c++)u.words[c]=this.words[c];u.length=i}if(0===i);else if(this.length>i)for(this.length-=i,c=0;c<this.length;c++)this.words[c]=this.words[c+i];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=o);c--){var l=0|this.words[c];this.words[c]=f<<26-a|l>>>a,f=l&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,o=1<<t;return!(this.length<=r)&&!!(this.words[r]&o)},a.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var o=67108863^67108863>>>t<<t;this.words[this.length-1]&=o}return this.strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},a.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},a.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},a.prototype.addn=function(e){return this.clone().iaddn(e)},a.prototype.subn=function(e){return this.clone().isubn(e)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(e,t,r){var o,a,i=e.length+r;this._expand(i);var s=0;for(o=0;o<e.length;o++){a=(0|this.words[o+r])+s;var u=(0|e.words[o])*t;s=((a-=67108863&u)>>26)-(u/67108864|0),this.words[o+r]=67108863&a}for(;o<this.length-r;o++)s=(a=(0|this.words[o+r])+s)>>26,this.words[o+r]=67108863&a;if(0===s)return this.strip();for(n(-1===s),s=0,o=0;o<this.length;o++)s=(a=-(0|this.words[o])+s)>>26,this.words[o]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),o=e,i=0|o.words[o.length-1];0!==(r=26-this._countBits(i))&&(o=o.ushln(r),n.iushln(r),i=0|o.words[o.length-1]);var s,u=n.length-o.length;if("mod"!==t){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var f=n.clone()._ishlnsubmul(o,1,u);0===f.negative&&(n=f,s&&(s.words[u]=1));for(var l=u-1;l>=0;l--){var d=67108864*(0|n.words[o.length+l])+(0|n.words[o.length+l-1]);for(d=Math.min(d/i|0,67108863),n._ishlnsubmul(o,d,l);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(o,1,l),n.isZero()||(n.negative^=1);s&&(s.words[l]=d)}return s&&s.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(i=s.mod.neg(),r&&0!==i.negative&&i.iadd(e)),{div:o,mod:i}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(i=s.mod.neg(),r&&0!==i.negative&&i.isub(e)),{div:s.div,mod:i}):e.length>this.length||this.cmp(e)<0?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modn(e.words[0]))}:this._wordDiv(e,t);var o,i,s},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),o=e.andln(1),a=r.cmp(n);return a<0||1===o&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},a.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,o=this.length-1;o>=0;o--)r=(t*r+(0|this.words[o]))%e;return r},a.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var o=(0|this.words[r])+67108864*t;this.words[r]=o/e|0,t=o%e}return this.strip()},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new a(1),i=new a(0),s=new a(0),u=new a(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var f=r.clone(),l=t.clone();!t.isZero();){for(var d=0,p=1;0==(t.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||i.isOdd())&&(o.iadd(f),i.isub(l)),o.iushrn(1),i.iushrn(1);for(var h=0,b=1;0==(r.words[0]&b)&&h<26;++h,b<<=1);if(h>0)for(r.iushrn(h);h-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(l)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),i.isub(u)):(r.isub(t),s.isub(o),u.isub(i))}return{a:s,b:u,gcd:r.iushln(c)}},a.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,i=new a(1),s=new a(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,f=1;0==(t.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(t.iushrn(c);c-- >0;)i.isOdd()&&i.iadd(u),i.iushrn(1);for(var l=0,d=1;0==(r.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(s)):(r.isub(t),s.isub(i))}return(o=0===t.cmpn(1)?i:s).cmpn(0)<0&&o.iadd(e),o},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var o=t.cmp(r);if(o<0){var a=t;t=r,r=a}else if(0===o||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,o=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=o,this;for(var a=o,i=r;0!==a&&i<this.length;i++){var s=0|this.words[i];a=(s+=a)>>>26,s&=67108863,this.words[i]=s}return 0!==a&&(this.words[i]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var o=0|this.words[0];t=o===e?0:o<e?-1:1}return 0!==this.negative?0|-t:t},a.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},a.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],o=0|e.words[r];if(n!==o){n<o?t=-1:n>o&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return this.cmpn(e)>=0},a.prototype.gte=function(e){return this.cmp(e)>=0},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return this.cmpn(e)<=0},a.prototype.lte=function(e){return this.cmp(e)<=0},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new I(e)},a.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function m(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function O(e){I.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var e=new a(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},o(m,g),m.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),o=0;o<n;o++)t.words[o]=e.words[o];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&r,o=10;o<e.length;o++){var i=0|e.words[o];e.words[o-10]=(i&r)<<4|a>>>22,a=i}a>>>=22,e.words[o-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},m.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},o(w,g),o(x,g),o(k,g),k.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,o=67108863&n;n>>>=26,e.words[r]=o,t=n}return 0!==t&&(e.words[e.length++]=t),e},a._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new m;else if("p224"===e)t=new w;else if("p192"===e)t=new x;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new k}return y[e]=t,t},I.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},I.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},I.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},I.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},I.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},I.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},I.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},I.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},I.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},I.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},I.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},I.prototype.isqr=function(e){return this.imul(e,e.clone())},I.prototype.sqr=function(e){return this.mul(e,e)},I.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new a(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),i=0;!o.isZero()&&0===o.andln(1);)i++,o.iushrn(1);n(!o.isZero());var s=new a(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var l=this.pow(f,o),d=this.pow(e,o.addn(1).iushrn(1)),p=this.pow(e,o),h=i;0!==p.cmp(s);){for(var b=p,v=0;0!==b.cmp(s);v++)b=b.redSqr();n(v<h);var y=this.pow(l,new a(1).iushln(h-v-1));d=d.redMul(y),l=y.redSqr(),p=p.redMul(l),h=v}return d},I.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},I.prototype.pow=function(e,t){if(t.isZero())return new a(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new a(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var o=r[0],i=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),n=t.length-1;n>=0;n--){for(var c=t.words[n],f=u-1;f>=0;f--){var l=c>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==l||0!==i?(i<<=1,i|=l,(4===++s||0===n&&0===f)&&(o=this.mul(o,r[i]),s=0,i=0)):s=0}u=26}return o},I.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},I.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new O(e)},o(O,I),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),i=o;return o.cmp(this.m)>=0?i=o.isub(this.m):o.cmpn(0)<0&&(i=o.iadd(this.m)),i._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},9931:function(e,t,r){var n;function o(e){this.rand=e}if(e.exports=function(e){return n||(n=new o(null)),n.generate(e)},e.exports.Rand=o,o.prototype.generate=function(e){return this._rand(e)},o.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?o.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?o.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(o.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var a=r(9214);if("function"!=typeof a.randomBytes)throw new Error("Not supported");o.prototype._rand=function(e){return a.randomBytes(e)}}catch(i){}},7445:function(e,t){"use strict";function r(e){switch(typeof e){case"function":case"object":return null==e?"null":Array.isArray(e)?"array":typeof e;case"string":return JSON.stringify(e);default:return String(e)}}function n(e,t){return function(r){return null!=r?e(r):"function"==typeof t?t():t}}function o(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=0;n<t.length;++n)if(e===t[n])return e;var o="Expected ";1!==t.length&&(o+="one of: ");for(var a=0;a<t.length;++a)a>0&&(o+=" | "),o+=JSON.stringify(t[a]);throw o+=", got "+r(e),new TypeError(o)}}function a(e){if("string"!=typeof e)throw new TypeError("Expected a string, got "+r(e));return e}Object.defineProperty(t,"__esModule",{value:!0});var i=o(null),s=o(void 0);var u=n(i);function c(e,t,r){return e instanceof Error&&(null==e.insertStepAt&&(e.message+=" at ",e.insertStepAt=e.message.length),e.message=e.message.slice(0,e.insertStepAt)+t+e.message.slice(e.insertStepAt),e.insertStepAt+=r),e}function f(e){if("function"==typeof e)return function(t){if("object"!=typeof t||null==t)throw new TypeError("Expected an object, got "+r(t));for(var n={},o=Object.keys(t),a=0;a<o.length;++a){var i=o[a];if("__proto__"!==i)try{n[i]=e(t[i])}catch(s){throw c(s,"["+JSON.stringify(i)+"]",0)}}return n};var t=Object.keys(e);function n(n){return function(o){if("object"!=typeof o||null==o)throw new TypeError("Expected an object, got "+r(o));var a,i={};if(n){var s=Object.keys(o);for(a=0;a<s.length;++a){var u=s[a];"__proto__"!==u&&(i[u]=o[u])}}for(a=0;a<t.length;++a){var f=t[a];try{i[f]=e[f](o[f])}catch(l){throw c(l,"."+f,0)}}return i}}var o=n(!1);return o.shape=e,o.withRest=n(!0),o}var l=f;function d(e,t){return function(r){return p[h]>0?t(r):e(r)}}var p="object"==typeof globalThis&&null!=globalThis?globalThis:JSON,h="function"==typeof Symbol?Symbol.for("uncleaning"):"uncleaning",b=d((function(e){if("string"!=typeof e&&!(e instanceof Date))throw new TypeError("Expected a date string, got "+r(e));var t=new Date(e);if(null==t.toJSON())throw new TypeError("Invalid date format, got "+r(e));return t}),(function(e){return e.toISOString()}));t.asArray=function(e){return function(t){if(!Array.isArray(t))throw new TypeError("Expected an array, got "+r(t));for(var n=[],o=0;o<t.length;++o)try{n[o]=e(t[o])}catch(a){throw c(a,"["+o+"]",0)}return n}},t.asBoolean=function(e){if("boolean"!=typeof e)throw new TypeError("Expected a boolean, got "+r(e));return e},t.asCodec=d,t.asDate=b,t.asEither=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){for(var r=0;r<t.length;r++)try{return t[r](e)}catch(n){if(r+1>=t.length)throw n}}},t.asJSON=function(e){return d((function(t){var r=JSON.parse(a(t));try{return e(r)}catch(n){throw c(n,"JSON.parse()",11)}}),(function(t){return JSON.stringify(e(t))}))},t.asMap=l,t.asMaybe=function(e,t){return function(r){try{return e(r)}catch(n){return"function"==typeof t?t():t}}},t.asNone=u,t.asNull=i,t.asNumber=function(e){if("number"!=typeof e)throw new TypeError("Expected a number, got "+r(e));return e},t.asObject=f,t.asOptional=n,t.asString=a,t.asTuple=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){if(!Array.isArray(e))throw new TypeError("Expected an array, got "+r(e));for(var n=[],o=0;o<t.length;++o)try{n[o]=t[o](e[o])}catch(a){throw c(a,"["+o+"]")}return n}},t.asUndefined=s,t.asUnknown=function(e){return e},t.asValue=o,t.uncleaner=function(e){return function(t){null==p[h]&&Object.defineProperty(p,h,{value:0,writable:!0});try{return++p[h],e(t)}finally{--p[h]}}}},4098:function(e,t){var r="undefined"!=typeof self?self:this,n=function(){function e(){this.fetch=!1,this.DOMException=r.DOMException}return e.prototype=r,new e}();!function(e){!function(t){var r="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,o="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),a="FormData"in e,i="ArrayBuffer"in e;if(i)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function f(e){return"string"!=typeof e&&(e=String(e)),e}function l(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function p(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function h(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function b(e){var t=new FileReader,r=h(t);return t.readAsArrayBuffer(e),r}function v(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:o&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:a&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():i&&o&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=v(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=v(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var e=p(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(b)}),this.text=function(){var e,t,r,n=p(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=h(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(e,t){e=c(e),t=f(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},d.prototype.delete=function(e){delete this.map[c(e)]},d.prototype.get=function(e){return e=c(e),this.has(e)?this.map[e]:null},d.prototype.has=function(e){return this.map.hasOwnProperty(c(e))},d.prototype.set=function(e,t){this.map[c(e)]=f(t)},d.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},d.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),l(e)},d.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),l(e)},d.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),l(e)},n&&(d.prototype[Symbol.iterator]=d.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function m(e,t){var r,n,o=(t=t||{}).body;if(e instanceof m){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new d(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new d(t.headers)),this.method=(r=t.method||this.method||"GET",n=r.toUpperCase(),g.indexOf(n)>-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(o))}})),t}function x(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new d(t.headers),this.url=t.url||"",this._initBody(e)}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},y.call(m.prototype),y.call(x.prototype),x.prototype.clone=function(){return new x(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},x.error=function(){var e=new x(null,{status:0,statusText:""});return e.type="error",e};var k=[301,302,303,307,308];x.redirect=function(e,t){if(-1===k.indexOf(t))throw new RangeError("Invalid status code");return new x(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(O){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function I(e,r){return new Promise((function(n,a){var i=new m(e,r);if(i.signal&&i.signal.aborted)return a(new t.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var e,t,r={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new d,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();t.append(n,o)}})),t)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var o="response"in s?s.response:s.responseText;n(new x(o,r))},s.onerror=function(){a(new TypeError("Network request failed"))},s.ontimeout=function(){a(new TypeError("Network request failed"))},s.onabort=function(){a(new t.DOMException("Aborted","AbortError"))},s.open(i.method,i.url,!0),"include"===i.credentials?s.withCredentials=!0:"omit"===i.credentials&&(s.withCredentials=!1),"responseType"in s&&o&&(s.responseType="blob"),i.headers.forEach((function(e,t){s.setRequestHeader(t,e)})),i.signal&&(i.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&i.signal.removeEventListener("abort",u)}),s.send(void 0===i._bodyInit?null:i._bodyInit)}))}I.polyfill=!0,e.fetch||(e.fetch=I,e.Headers=d,e.Request=m,e.Response=x),t.Headers=d,t.Request=m,t.Response=x,t.fetch=I,Object.defineProperty(t,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(t=o.fetch).default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t},4550:function(e){e.exports=[{code:"AED",number:"784",digits:2,currency:"UAE Dirham",countries:["United Arab Emirates (The)"]},{code:"AFN",number:"971",digits:2,currency:"Afghani",countries:["Afghanistan"]},{code:"ALL",number:"008",digits:2,currency:"Lek",countries:["Albania"]},{code:"AMD",number:"051",digits:2,currency:"Armenian Dram",countries:["Armenia"]},{code:"ANG",number:"532",digits:2,currency:"Netherlands Antillean Guilder",countries:["CuraçAo","Sint Maarten (Dutch Part)"]},{code:"AOA",number:"973",digits:2,currency:"Kwanza",countries:["Angola"]},{code:"ARS",number:"032",digits:2,currency:"Argentine Peso",countries:["Argentina"]},{code:"AUD",number:"036",digits:2,currency:"Australian Dollar",countries:["Australia","Christmas Island","Cocos (Keeling) Islands (The)","Heard Island And Mcdonald Islands","Kiribati","Nauru","Norfolk Island","Tuvalu"]},{code:"AWG",number:"533",digits:2,currency:"Aruban Florin",countries:["Aruba"]},{code:"AZN",number:"944",digits:2,currency:"Azerbaijan Manat",countries:["Azerbaijan"]},{code:"BAM",number:"977",digits:2,currency:"Convertible Mark",countries:["Bosnia And Herzegovina"]},{code:"BBD",number:"052",digits:2,currency:"Barbados Dollar",countries:["Barbados"]},{code:"BDT",number:"050",digits:2,currency:"Taka",countries:["Bangladesh"]},{code:"BGN",number:"975",digits:2,currency:"Bulgarian Lev",countries:["Bulgaria"]},{code:"BHD",number:"048",digits:3,currency:"Bahraini Dinar",countries:["Bahrain"]},{code:"BIF",number:"108",digits:0,currency:"Burundi Franc",countries:["Burundi"]},{code:"BMD",number:"060",digits:2,currency:"Bermudian Dollar",countries:["Bermuda"]},{code:"BND",number:"096",digits:2,currency:"Brunei Dollar",countries:["Brunei Darussalam"]},{code:"BOB",number:"068",digits:2,currency:"Boliviano",countries:["Bolivia (Plurinational State Of)"]},{code:"BOV",number:"984",digits:2,currency:"Mvdol",countries:["Bolivia (Plurinational State Of)"]},{code:"BRL",number:"986",digits:2,currency:"Brazilian Real",countries:["Brazil"]},{code:"BSD",number:"044",digits:2,currency:"Bahamian Dollar",countries:["Bahamas (The)"]},{code:"BTN",number:"064",digits:2,currency:"Ngultrum",countries:["Bhutan"]},{code:"BWP",number:"072",digits:2,currency:"Pula",countries:["Botswana"]},{code:"BYN",number:"933",digits:2,currency:"Belarusian Ruble",countries:["Belarus"]},{code:"BZD",number:"084",digits:2,currency:"Belize Dollar",countries:["Belize"]},{code:"CAD",number:"124",digits:2,currency:"Canadian Dollar",countries:["Canada"]},{code:"CDF",number:"976",digits:2,currency:"Congolese Franc",countries:["Congo (The Democratic Republic Of The)"]},{code:"CHE",number:"947",digits:2,currency:"WIR Euro",countries:["Switzerland"]},{code:"CHF",number:"756",digits:2,currency:"Swiss Franc",countries:["Liechtenstein","Switzerland"]},{code:"CHW",number:"948",digits:2,currency:"WIR Franc",countries:["Switzerland"]},{code:"CLF",number:"990",digits:4,currency:"Unidad de Fomento",countries:["Chile"]},{code:"CLP",number:"152",digits:0,currency:"Chilean Peso",countries:["Chile"]},{code:"CNY",number:"156",digits:2,currency:"Yuan Renminbi",countries:["China"]},{code:"COP",number:"170",digits:2,currency:"Colombian Peso",countries:["Colombia"]},{code:"COU",number:"970",digits:2,currency:"Unidad de Valor Real",countries:["Colombia"]},{code:"CRC",number:"188",digits:2,currency:"Costa Rican Colon",countries:["Costa Rica"]},{code:"CUC",number:"931",digits:2,currency:"Peso Convertible",countries:["Cuba"]},{code:"CUP",number:"192",digits:2,currency:"Cuban Peso",countries:["Cuba"]},{code:"CVE",number:"132",digits:2,currency:"Cabo Verde Escudo",countries:["Cabo Verde"]},{code:"CZK",number:"203",digits:2,currency:"Czech Koruna",countries:["Czechia"]},{code:"DJF",number:"262",digits:0,currency:"Djibouti Franc",countries:["Djibouti"]},{code:"DKK",number:"208",digits:2,currency:"Danish Krone",countries:["Denmark","Faroe Islands (The)","Greenland"]},{code:"DOP",number:"214",digits:2,currency:"Dominican Peso",countries:["Dominican Republic (The)"]},{code:"DZD",number:"012",digits:2,currency:"Algerian Dinar",countries:["Algeria"]},{code:"EGP",number:"818",digits:2,currency:"Egyptian Pound",countries:["Egypt"]},{code:"ERN",number:"232",digits:2,currency:"Nakfa",countries:["Eritrea"]},{code:"ETB",number:"230",digits:2,currency:"Ethiopian Birr",countries:["Ethiopia"]},{code:"EUR",number:"978",digits:2,currency:"Euro",countries:["Andorra","Austria","Belgium","Cyprus","Estonia","European Union","Finland","France","French Guiana","French Southern Territories (The)","Germany","Greece","Guadeloupe","Holy See (The)","Ireland","Italy","Latvia","Lithuania","Luxembourg","Malta","Martinique","Mayotte","Monaco","Montenegro","Netherlands (The)","Portugal","Réunion","Saint Barthélemy","Saint Martin (French Part)","Saint Pierre And Miquelon","San Marino","Slovakia","Slovenia","Spain","Åland Islands"]},{code:"FJD",number:"242",digits:2,currency:"Fiji Dollar",countries:["Fiji"]},{code:"FKP",number:"238",digits:2,currency:"Falkland Islands Pound",countries:["Falkland Islands (The) [Malvinas]"]},{code:"GBP",number:"826",digits:2,currency:"Pound Sterling",countries:["Guernsey","Isle Of Man","Jersey","United Kingdom Of Great Britain And Northern Ireland (The)"]},{code:"GEL",number:"981",digits:2,currency:"Lari",countries:["Georgia"]},{code:"GHS",number:"936",digits:2,currency:"Ghana Cedi",countries:["Ghana"]},{code:"GIP",number:"292",digits:2,currency:"Gibraltar Pound",countries:["Gibraltar"]},{code:"GMD",number:"270",digits:2,currency:"Dalasi",countries:["Gambia (The)"]},{code:"GNF",number:"324",digits:0,currency:"Guinean Franc",countries:["Guinea"]},{code:"GTQ",number:"320",digits:2,currency:"Quetzal",countries:["Guatemala"]},{code:"GYD",number:"328",digits:2,currency:"Guyana Dollar",countries:["Guyana"]},{code:"HKD",number:"344",digits:2,currency:"Hong Kong Dollar",countries:["Hong Kong"]},{code:"HNL",number:"340",digits:2,currency:"Lempira",countries:["Honduras"]},{code:"HRK",number:"191",digits:2,currency:"Kuna",countries:["Croatia"]},{code:"HTG",number:"332",digits:2,currency:"Gourde",countries:["Haiti"]},{code:"HUF",number:"348",digits:2,currency:"Forint",countries:["Hungary"]},{code:"IDR",number:"360",digits:2,currency:"Rupiah",countries:["Indonesia"]},{code:"ILS",number:"376",digits:2,currency:"New Israeli Sheqel",countries:["Israel"]},{code:"INR",number:"356",digits:2,currency:"Indian Rupee",countries:["Bhutan","India"]},{code:"IQD",number:"368",digits:3,currency:"Iraqi Dinar",countries:["Iraq"]},{code:"IRR",number:"364",digits:2,currency:"Iranian Rial",countries:["Iran (Islamic Republic Of)"]},{code:"ISK",number:"352",digits:0,currency:"Iceland Krona",countries:["Iceland"]},{code:"JMD",number:"388",digits:2,currency:"Jamaican Dollar",countries:["Jamaica"]},{code:"JOD",number:"400",digits:3,currency:"Jordanian Dinar",countries:["Jordan"]},{code:"JPY",number:"392",digits:0,currency:"Yen",countries:["Japan"]},{code:"KES",number:"404",digits:2,currency:"Kenyan Shilling",countries:["Kenya"]},{code:"KGS",number:"417",digits:2,currency:"Som",countries:["Kyrgyzstan"]},{code:"KHR",number:"116",digits:2,currency:"Riel",countries:["Cambodia"]},{code:"KMF",number:"174",digits:0,currency:"Comorian Franc ",countries:["Comoros (The)"]},{code:"KPW",number:"408",digits:2,currency:"North Korean Won",countries:["Korea (The Democratic People's Republic Of)"]},{code:"KRW",number:"410",digits:0,currency:"Won",countries:["Korea (The Republic Of)"]},{code:"KWD",number:"414",digits:3,currency:"Kuwaiti Dinar",countries:["Kuwait"]},{code:"KYD",number:"136",digits:2,currency:"Cayman Islands Dollar",countries:["Cayman Islands (The)"]},{code:"KZT",number:"398",digits:2,currency:"Tenge",countries:["Kazakhstan"]},{code:"LAK",number:"418",digits:2,currency:"Lao Kip",countries:["Lao People's Democratic Republic (The)"]},{code:"LBP",number:"422",digits:2,currency:"Lebanese Pound",countries:["Lebanon"]},{code:"LKR",number:"144",digits:2,currency:"Sri Lanka Rupee",countries:["Sri Lanka"]},{code:"LRD",number:"430",digits:2,currency:"Liberian Dollar",countries:["Liberia"]},{code:"LSL",number:"426",digits:2,currency:"Loti",countries:["Lesotho"]},{code:"LYD",number:"434",digits:3,currency:"Libyan Dinar",countries:["Libya"]},{code:"MAD",number:"504",digits:2,currency:"Moroccan Dirham",countries:["Morocco","Western Sahara"]},{code:"MDL",number:"498",digits:2,currency:"Moldovan Leu",countries:["Moldova (The Republic Of)"]},{code:"MGA",number:"969",digits:2,currency:"Malagasy Ariary",countries:["Madagascar"]},{code:"MKD",number:"807",digits:2,currency:"Denar",countries:["Macedonia (The Former Yugoslav Republic Of)"]},{code:"MMK",number:"104",digits:2,currency:"Kyat",countries:["Myanmar"]},{code:"MNT",number:"496",digits:2,currency:"Tugrik",countries:["Mongolia"]},{code:"MOP",number:"446",digits:2,currency:"Pataca",countries:["Macao"]},{code:"MRU",number:"929",digits:2,currency:"Ouguiya",countries:["Mauritania"]},{code:"MUR",number:"480",digits:2,currency:"Mauritius Rupee",countries:["Mauritius"]},{code:"MVR",number:"462",digits:2,currency:"Rufiyaa",countries:["Maldives"]},{code:"MWK",number:"454",digits:2,currency:"Malawi Kwacha",countries:["Malawi"]},{code:"MXN",number:"484",digits:2,currency:"Mexican Peso",countries:["Mexico"]},{code:"MXV",number:"979",digits:2,currency:"Mexican Unidad de Inversion (UDI)",countries:["Mexico"]},{code:"MYR",number:"458",digits:2,currency:"Malaysian Ringgit",countries:["Malaysia"]},{code:"MZN",number:"943",digits:2,currency:"Mozambique Metical",countries:["Mozambique"]},{code:"NAD",number:"516",digits:2,currency:"Namibia Dollar",countries:["Namibia"]},{code:"NGN",number:"566",digits:2,currency:"Naira",countries:["Nigeria"]},{code:"NIO",number:"558",digits:2,currency:"Cordoba Oro",countries:["Nicaragua"]},{code:"NOK",number:"578",digits:2,currency:"Norwegian Krone",countries:["Bouvet Island","Norway","Svalbard And Jan Mayen"]},{code:"NPR",number:"524",digits:2,currency:"Nepalese Rupee",countries:["Nepal"]},{code:"NZD",number:"554",digits:2,currency:"New Zealand Dollar",countries:["Cook Islands (The)","New Zealand","Niue","Pitcairn","Tokelau"]},{code:"OMR",number:"512",digits:3,currency:"Rial Omani",countries:["Oman"]},{code:"PAB",number:"590",digits:2,currency:"Balboa",countries:["Panama"]},{code:"PEN",number:"604",digits:2,currency:"Sol",countries:["Peru"]},{code:"PGK",number:"598",digits:2,currency:"Kina",countries:["Papua New Guinea"]},{code:"PHP",number:"608",digits:2,currency:"Philippine Piso",countries:["Philippines (The)"]},{code:"PKR",number:"586",digits:2,currency:"Pakistan Rupee",countries:["Pakistan"]},{code:"PLN",number:"985",digits:2,currency:"Zloty",countries:["Poland"]},{code:"PYG",number:"600",digits:0,currency:"Guarani",countries:["Paraguay"]},{code:"QAR",number:"634",digits:2,currency:"Qatari Rial",countries:["Qatar"]},{code:"RON",number:"946",digits:2,currency:"Romanian Leu",countries:["Romania"]},{code:"RSD",number:"941",digits:2,currency:"Serbian Dinar",countries:["Serbia"]},{code:"RUB",number:"643",digits:2,currency:"Russian Ruble",countries:["Russian Federation (The)"]},{code:"RWF",number:"646",digits:0,currency:"Rwanda Franc",countries:["Rwanda"]},{code:"SAR",number:"682",digits:2,currency:"Saudi Riyal",countries:["Saudi Arabia"]},{code:"SBD",number:"090",digits:2,currency:"Solomon Islands Dollar",countries:["Solomon Islands"]},{code:"SCR",number:"690",digits:2,currency:"Seychelles Rupee",countries:["Seychelles"]},{code:"SDG",number:"938",digits:2,currency:"Sudanese Pound",countries:["Sudan (The)"]},{code:"SEK",number:"752",digits:2,currency:"Swedish Krona",countries:["Sweden"]},{code:"SGD",number:"702",digits:2,currency:"Singapore Dollar",countries:["Singapore"]},{code:"SHP",number:"654",digits:2,currency:"Saint Helena Pound",countries:["Saint Helena, Ascension And Tristan Da Cunha"]},{code:"SLL",number:"694",digits:2,currency:"Leone",countries:["Sierra Leone"]},{code:"SOS",number:"706",digits:2,currency:"Somali Shilling",countries:["Somalia"]},{code:"SRD",number:"968",digits:2,currency:"Surinam Dollar",countries:["Suriname"]},{code:"SSP",number:"728",digits:2,currency:"South Sudanese Pound",countries:["South Sudan"]},{code:"STN",number:"930",digits:2,currency:"Dobra",countries:["Sao Tome And Principe"]},{code:"SVC",number:"222",digits:2,currency:"El Salvador Colon",countries:["El Salvador"]},{code:"SYP",number:"760",digits:2,currency:"Syrian Pound",countries:["Syrian Arab Republic"]},{code:"SZL",number:"748",digits:2,currency:"Lilangeni",countries:["Swaziland"]},{code:"THB",number:"764",digits:2,currency:"Baht",countries:["Thailand"]},{code:"TJS",number:"972",digits:2,currency:"Somoni",countries:["Tajikistan"]},{code:"TMT",number:"934",digits:2,currency:"Turkmenistan New Manat",countries:["Turkmenistan"]},{code:"TND",number:"788",digits:3,currency:"Tunisian Dinar",countries:["Tunisia"]},{code:"TOP",number:"776",digits:2,currency:"Pa'anga",countries:["Tonga"]},{code:"TRY",number:"949",digits:2,currency:"Turkish Lira",countries:["Turkey"]},{code:"TTD",number:"780",digits:2,currency:"Trinidad and Tobago Dollar",countries:["Trinidad And Tobago"]},{code:"TWD",number:"901",digits:2,currency:"New Taiwan Dollar",countries:["Taiwan (Province Of China)"]},{code:"TZS",number:"834",digits:2,currency:"Tanzanian Shilling",countries:["Tanzania, United Republic Of"]},{code:"UAH",number:"980",digits:2,currency:"Hryvnia",countries:["Ukraine"]},{code:"UGX",number:"800",digits:0,currency:"Uganda Shilling",countries:["Uganda"]},{code:"USD",number:"840",digits:2,currency:"US Dollar",countries:["American Samoa","Bonaire, Sint Eustatius And Saba","British Indian Ocean Territory (The)","Ecuador","El Salvador","Guam","Haiti","Marshall Islands (The)","Micronesia (Federated States Of)","Northern Mariana Islands (The)","Palau","Panama","Puerto Rico","Timor-Leste","Turks And Caicos Islands (The)","United States Minor Outlying Islands (The)","United States Of America (The)","Virgin Islands (British)","Virgin Islands (U.S.)"]},{code:"USN",number:"997",digits:2,currency:"US Dollar (Next day)",countries:["United States Of America (The)"]},{code:"UYI",number:"940",digits:0,currency:"Uruguay Peso en Unidades Indexadas (URUIURUI)",countries:["Uruguay"]},{code:"UYU",number:"858",digits:2,currency:"Peso Uruguayo",countries:["Uruguay"]},{code:"UZS",number:"860",digits:2,currency:"Uzbekistan Sum",countries:["Uzbekistan"]},{code:"VEF",number:"937",digits:2,currency:"Bolívar",countries:["Venezuela (Bolivarian Republic Of)"]},{code:"VND",number:"704",digits:0,currency:"Dong",countries:["Viet Nam"]},{code:"VUV",number:"548",digits:0,currency:"Vatu",countries:["Vanuatu"]},{code:"WST",number:"882",digits:2,currency:"Tala",countries:["Samoa"]},{code:"XAF",number:"950",digits:0,currency:"CFA Franc BEAC",countries:["Cameroon","Central African Republic (The)","Chad","Congo (The)","Equatorial Guinea","Gabon"]},{code:"XAG",number:"961",digits:0,currency:"Silver",countries:[]},{code:"XAU",number:"959",digits:0,currency:"Gold",countries:[]},{code:"XBA",number:"955",digits:0,currency:"Bond Markets Unit European Composite Unit (EURCO)",countries:[]},{code:"XBB",number:"956",digits:0,currency:"Bond Markets Unit European Monetary Unit (E.M.U.-6)",countries:[]},{code:"XBC",number:"957",digits:0,currency:"Bond Markets Unit European Unit of Account 9 (E.U.A.-9)",countries:[]},{code:"XBD",number:"958",digits:0,currency:"Bond Markets Unit European Unit of Account 17 (E.U.A.-17)",countries:[]},{code:"XCD",number:"951",digits:2,currency:"East Caribbean Dollar",countries:["Anguilla","Antigua And Barbuda","Dominica","Grenada","Montserrat","Saint Kitts And Nevis","Saint Lucia","Saint Vincent And The Grenadines"]},{code:"XDR",number:"960",digits:0,currency:"SDR (Special Drawing Right)",countries:["International Monetary Fund (Imf) "]},{code:"XOF",number:"952",digits:0,currency:"CFA Franc BCEAO",countries:["Benin","Burkina Faso","Côte d'Ivoire","Guinea-Bissau","Mali","Niger (The)","Senegal","Togo"]},{code:"XPD",number:"964",digits:0,currency:"Palladium",countries:[]},{code:"XPF",number:"953",digits:0,currency:"CFP Franc",countries:["French Polynesia","New Caledonia","Wallis And Futuna"]},{code:"XPT",number:"962",digits:0,currency:"Platinum",countries:[]},{code:"XSU",number:"994",digits:0,currency:"Sucre",countries:['Sistema Unitario De Compensacion Regional De Pagos "Sucre"']},{code:"XTS",number:"963",digits:0,currency:"Codes specifically reserved for testing purposes",countries:[]},{code:"XUA",number:"965",digits:0,currency:"ADB Unit of Account",countries:["Member Countries Of The African Development Bank Group"]},{code:"XXX",number:"999",digits:0,currency:"The codes assigned for transactions where no currency is involved",countries:[]},{code:"YER",number:"886",digits:2,currency:"Yemeni Rial",countries:["Yemen"]},{code:"ZAR",number:"710",digits:2,currency:"Rand",countries:["Lesotho","Namibia","South Africa"]},{code:"ZMW",number:"967",digits:2,currency:"Zambian Kwacha",countries:["Zambia"]},{code:"ZWL",number:"932",digits:2,currency:"Zimbabwe Dollar",countries:["Zimbabwe"]}]},3546:function(e,t,r){var n=r(7680),o=r(2719),a=r(4550);t.Rx=function(e){return n(a,(function(t){return t.number===String(e)}))}},4638:function(e,t,r){"use strict";var n=r(5352);function o(e){throw new Error("makeNodeDisklet is not available on this platform")}function a(){throw new Error("makeReactNativeDisklet is not available on this platform")}function i(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(c){return void r(c)}s.done?t(u):Promise.resolve(u).then(n,o)}function s(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function s(e){i(a,n,o,s,u,"next",e)}function u(e){i(a,n,o,s,u,"throw",e)}s(void 0)}))}}function u(){return u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u.apply(this,arguments)}function c(e){if(/^\//.test(e))throw new Error("Absolute paths are not supported");for(var t=e.split("/"),r=0,n=0;r<t.length;){var o=t[r++];if(".."===o?n--:"."!==o&&""!==o&&(t[n++]=o),n<0)throw new Error("Path would escape folder")}return t.slice(0,n).join("/")}function f(e){return""===e?e:e+"/"}function l(e){for(var t=[],r=0;r<e.length;++r){var n=e.key(r);null!=n&&t.push(n)}return t}function d(e,t){void 0===e&&(e=window.localStorage),void 0===t&&(t={});var r=null!=t.prefix?f(t.prefix):"/";return{delete:function(t){var n=c(t);null!=e.getItem(r+n)&&e.removeItem(r+n);for(var o=f(n),a=0,i=l(e);a<i.length;a++){var s=i[a];0===s.indexOf(r+o)&&e.removeItem(s)}return Promise.resolve()},getData:function(e){return this.getText(e).then((function(e){return n.base64.parse(e)}))},getText:function(t){var n=c(t),o=e.getItem(r+n);return null==o?Promise.reject(new Error('Cannot load "'+n+'"')):Promise.resolve(o)},list:function(t){return s((function*(){void 0===t&&(t="");var n=c(t),o={};null!=e.getItem(r+n)&&(o[n]="file");for(var a=f(n),i=0,s=l(e);i<s.length;i++){var u=s[i];if(0===u.indexOf(r+a)){var d=u.indexOf("/",r.length+a.length);d<0?o[u.slice(r.length)]="file":o[u.slice(r.length,d)]="folder"}}return o}))()},setData:function(e,t){return this.setText(e,n.base64.stringify(t))},setText:function(t,n){return"string"!=typeof n?Promise.reject(new TypeError("setText expects a string")):(e.setItem(r+c(t),n),Promise.resolve())}}}function p(e){return void 0===e&&(e={}),{delete:function(t){var r=c(t);null!=e["/"+r]&&delete e["/"+r];for(var n=f(r),o=0,a=Object.keys(e);o<a.length;o++){var i=a[o];0===i.indexOf("/"+n)&&delete e[i]}return Promise.resolve()},getData:function(t){var r=c(t),n=e["/"+r];return null==n?Promise.reject(new Error('Cannot load "'+r+'"')):"string"==typeof n?Promise.reject(new Error('"'+r+'" is a text file.')):Promise.resolve(n)},getText:function(t){var r=c(t),n=e["/"+r];return null==n?Promise.reject(new Error('Cannot load "'+r+'"')):"string"!=typeof n?Promise.reject(new Error('"'+r+'" is a binary file.')):Promise.resolve(n)},list:function(t){return s((function*(){void 0===t&&(t="");var r=c(t),n={};null!=e["/"+r]&&(n[r]="file");for(var o=f(r),a=0,i=Object.keys(e);a<i.length;a++){var s=i[a];if(0===s.indexOf("/"+o)){var u=s.indexOf("/",1+o.length);u<0?n[s.slice(1)]="file":n[s.slice(1,u)]="folder"}}return n}))()},setData:function(t,r){var n=r,o=Uint8Array.from(n);return e["/"+c(t)]=o,Promise.resolve()},setText:function(t,r){return"string"!=typeof r?Promise.reject(new TypeError("setText expects a string")):(e["/"+c(t)]=r,Promise.resolve())}}}var h=function(){function e(e,t){this._disklet=e,this._path=t}var t=e.prototype;return t.delete=function(){return this._disklet.delete(this._path)},t.getData=function(){return this._disklet.getData(this._path)},t.getText=function(){return this._disklet.getText(this._path)},t.setData=function(e){return this._disklet.setData(this._path,e)},t.setText=function(e){return this._disklet.setText(this._path,e)},e}(),b=function(){function e(e,t){this._disklet=e,this._path=t}var t=e.prototype;return t.delete=function(){return this._disklet.delete(this._path)},t.file=function(e){return new h(this._disklet,this._path+"/"+e)},t.folder=function(t){return new e(this._disklet,this._path+"/"+t)},t.listFiles=function(){return this._disklet.list(this._path).then((function(e){return Object.keys(e).filter((function(t){return"file"===e[t]})).map((function(e){return e.replace(/^.*\//,"")}))}))},t.listFolders=function(){return this._disklet.list(this._path).then((function(e){return Object.keys(e).filter((function(t){return"folder"===e[t]})).map((function(e){return e.replace(/^.*\//,"")}))}))},e}();function v(e){return new b(e,".")}function y(e,t){for(var r=0,n=0;r<t.length;){var o=t[r++];if(".."===o?n--:"."!==o&&""!==o&&(t[n++]=o),n<0)throw new Error("Path would escape folder")}for(r=0;r<n;++r)e=e.folder(t[r]);return e}function g(e,t){return e.listFiles().then((function(r){return Promise.all(r.map((function(r){return t(e.file(r),r,e)})))}))}function m(e,t){return e.listFolders().then((function(r){return Promise.all(r.map((function(r){return t(e.folder(r),r,e)})))}))}function w(e,t){console.log(t+' "'+e+'"')}function x(e,t,r){var n=r.callback,o=void 0===n?w:n,a=r.verbose;(void 0!==a&&a||/set|delete/.test(t))&&o(e,t)}var k=function(){function e(e,t,r){this._file=e,this._path=t,this._opts=r}var t=e.prototype;return t.delete=function(){return x(this._path,"delete file",this._opts),this._file.delete()},t.getData=function(){return x(this._path,"get data",this._opts),this._file.getData()},t.getText=function(){return x(this._path,"get text",this._opts),this._file.getText()},t.setData=function(e){return x(this._path,"set data",this._opts),this._file.setData(e)},t.setText=function(e){return x(this._path,"set text",this._opts),this._file.setText(e)},t.getPath=function(){return this._path},e}(),I=function(){function e(e,t,r){this._folder=e,this._path=t,this._opts=r}var t=e.prototype;return t.delete=function(){return x(this._path,"delete folder",this._opts),this._folder.delete()},t.file=function(e){return new k(this._folder.file(e),this._path+e,this._opts)},t.folder=function(t){return new e(this._folder.folder(t),this._path+t+"/",this._opts)},t.listFiles=function(){return x(this._path,"list files",this._opts),this._folder.listFiles()},t.listFolders=function(){return x(this._path,"list folders",this._opts),this._folder.listFolders()},e}();function O(e,t){var r={},n=[];return e.forEach((function(e){/\._x_$/.test(e)?r[e]=!0:(r[e+"._x_"]=!0,n.push(e))})),t.forEach((function(e){r[e+"._x_"]||n.push(e)})),n}var E=function(){function e(e,t,r){this._master=e,this._fallback=t,this._whiteout=r}var t=e.prototype;return t.delete=function(){return Promise.all([this._whiteout.setData([]),this._master.delete().catch((function(e){return null}))])},t.getData=function(){var e=this;return this._master.getData().catch((function(t){return e._whiteout.getData().then((function(e){throw new Error("File has been deleted")}),(function(t){return e._fallback.getData()}))}))},t.getText=function(){var e=this;return this._master.getText().catch((function(t){return e._whiteout.getData().then((function(e){throw new Error("File has been deleted")}),(function(t){return e._fallback.getText()}))}))},t.setData=function(e){return this._master.setData(e)},t.setText=function(e){return this._master.setText(e)},t.getPath=function(){throw new Error("Cannot call getPath on a Union Folder")},e}(),S=function(){function e(e,t){this._master=e,this._fallback=t}var t=e.prototype;return t.delete=function(){return Promise.all([g(this,(function(e){return e.delete()})),m(this,(function(e){return e.delete()}))]).then((function(){}))},t.file=function(e){return new E(this._master.file(e),this._fallback.file(e),this._master.file(e+"._x_"))},t.folder=function(t){return new e(this._master.folder(t),this._fallback.folder(t))},t.listFiles=function(){return Promise.all([this._master.listFiles(),this._fallback.listFiles()]).then((function(e){return O(e[0],e[1])}))},t.listFolders=function(){return Promise.all([this._master.listFolders(),this._fallback.listFolders()]).then((function(e){return O(e[0],e[1])}))},e}();function A(e,t){var r=f(c(t));return{delete:function(t){return e.delete(r+t)},getData:function(t){return e.getData(r+t)},getText:function(t){return e.getText(r+t)},list:function(t){return void 0===t&&(t="."),e.list(r+t).then((function(e){var t={};for(var n in e)t[n.replace(r,"")]=e[n];return t}))},setData:function(t,n){return e.setData(r+t,n)},setText:function(t,n){return e.setText(r+t,n)}}}t.gQ=function(e){return Object.keys(e).filter((function(t){return"file"===e[t]}))},t.ji=function(e){return Object.keys(e).filter((function(t){return"folder"===e[t]}))},t.Wh=p,t.Cl=function(e,t){return{delete:function(r){return Promise.all([e.delete(r),t.delete(r)])},getData:function(r){return e.getData(r).catch((function(e){return t.getData(r)}))},getText:function(r){return e.getText(r).catch((function(e){return t.getText(r)}))},list:function(r){return Promise.all([e.list(r),t.list(r)]).then((function(e){var t=e[0];return u(e[1],t)}))},setData:function(t,r){return e.setData(t,r)},setText:function(t,r){return e.setText(t,r)}}},t.HN=A},1649:function(e,t,r){"use strict";var n=r(7445),o=r(4098),a=r(1223),i=r(3715),s=r(5352);function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=u(o),f=u(a),l=u(i);const d=/^[a-z0-9-_.]+(\/+[a-z0-9-_.]+)*$/i,p=/^[a-f0-9]{40}$/,h=n.asObject({infoServers:n.asOptional(n.asArray(n.asString)),syncServers:n.asOptional(n.asArray(n.asString))}),b=e=>{const t=n.asString(e);if(""===t)throw new TypeError("Expected non empty string");return t},v=e=>{const t=n.asString(e);if(!p.test(t))throw new TypeError(`Invalid sync key '${t}'`);return t},y=n.asObject({iv_hex:n.asString,encryptionType:n.asNumber,data_base64:n.asString}),g=n.asObject({success:n.asValue(!1),message:n.asString,stack:n.asOptional(n.asString)}),m=n.asEither(y,n.asNull),w=n.asObject(m),x=n.asObject({syncKey:v,hash:n.asOptional(b)}),k=n.asObject({hash:n.asOptional(n.asString),changes:w}),I=n.asObject({syncKey:v,hash:n.asOptional(b)}),O=n.asObject({changes:w}),E=n.asObject({hash:n.asString,changes:w}),S=n.asObject({syncKey:v}),A=n.asUndefined,T=()=>{};async function _(e,t,r={}){const{log:o=T,fetch:a=c.default}=r,{method:i,url:s,body:u,numbUrl:f=s,headers:l={}}=e,d=Date.now(),p=await a(s,{method:i,headers:{"Content-Type":"application/json",...l},body:JSON.stringify(u)}),h=Date.now()-d;o(`${i} ${f} returned ${p.status} in ${h}ms`);const b=await p.text();if(!p.ok)throw new Error(`Failed request ${i} ${f} failed ${p.status}: ${b}`);const v=n.asMaybe(g)(b);if(null!=v)throw new Error(`Failed request ${i} ${f} failed ${p.status}: ${v.message}`);return t(""!==b.trim()?JSON.parse(b):void 0)}const P=f.default("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),M=e=>{const t=j(j(s.base16.parse(e)));return P.encode(t)};function j(e){const t=l.default.sha256();return Uint8Array.from(t.update(e).digest())}class C extends Error{constructor(e="Cannot reach the network"){super(e),this.name="NetworkError"}}const N={infoServers:["https://info-eu1.edge.app","https://info-us1.edge.app"],syncServers:["https://sync-us1.edge.app","https://sync-us2.edge.app","https://sync-us3.edge.app","https://sync-us4.edge.app","https://sync-us5.edge.app","https://sync-us6.edge.app","https://sync-eu.edge.app"]};function D(e={}){const{log:t=(()=>{})}=e,r={...N,...e.edgeServers},{edgeServersCacheTTL:n=6e5}=e,o=function(e,t){let r=Date.now()+t,n=e(void 0);return{get:()=>{if(Date.now()>r||null==n){r=Date.now()+t;const o=e(n);n=o}return n}}}(((n={current:r})=>(n.current.infoServers.length>0&&async function(e,t={}){const{log:r=T,fetch:n=c.default}=t;let o=new Error("No info servers");for(const i of e){const[e,t]=["GET","/v1/edgeServers"],s=Date.now(),u=`${i}${t}`;try{const t=await n(u,{method:e,headers:{"Content-Type":"application/json"}}).catch((t=>{const n=Date.now()-s,o=`${e} ${u} failed in ${n}ms, ${String(t)}`;throw r(o),new C(o)})),{ok:o,status:a}=t,i=Date.now()-s,c=`${e} ${u} returned ${a} in ${i}ms`;if(!o)throw r(c),new C(c);r(c);const f=await t.text(),l=JSON.parse(f);return h(l)}catch(a){o=a;continue}}throw o}(n.current.infoServers,e).then((e=>{return n.current={...n.current,...e,infoServers:(t=e.infoServers,r=()=>N.infoServers,null!=t?t:r())};var t,r})).catch((async e=>{t(String(e))})),n)),n);return{async getEdgeServers(){const{current:e}=await o.get();return e}}}function R(e,t){return null!=e?e:t()}t.bS=w,t.Ei=y,t.h8=h,t.wJ=m,t.PG=x,t.SR=k,t.Th=b,t.Qw=e=>{const t=n.asString(e);try{if(d.test(t))return function(e){if(/^\//.test(e))throw new Error("Absolute paths are not supported");const t=e.split("/");let r=0,n=0;for(;r<t.length;){const e=t[r++];if(".."===e?n--:"."!==e&&""!==e&&(t[n++]=e),n<0)throw new Error("Path would escape folder");if(0===n&&r===t.length)throw new Error("Path would evaluate to empty file name")}return t.slice(0,n).join("/")}(t)}catch(r){}throw new Error(`Invalid path '${t}'`)},t.YK=O,t.KI=I,t.Wn=E,t.tp=S,t.RQ=A,t.tE=g,t.Jj=v,t.LZ=function(e={}){const t=D(e);async function r(){const{syncServers:e}=await t.getEdgeServers();return function(e){for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}return e}(e)}return{async createRepo(t,n){const o=await r();let a=new Error(`Failed to create repo ${t}: empty sync server list`);for(const r of o){const o=`${r}/api/v2/store/${t}`,s=o.replace(t,`<${M(t)}>`);try{return await _({method:"PUT",url:o,numbUrl:s,headers:null!=n?{"X-API-Key":n}:{}},A,e)}catch(i){a=i}}throw a},async readRepo(t,n){const o=await r();let a=new Error(`Failed to read repo ${t}: empty sync server list`);for(const r of o){const o=`${r}/api/v2/store/${t}/${R(n,(()=>""))}`,s=o.replace(t,`<${M(t)}>`);try{return await _({method:"GET",url:o,numbUrl:s},k,e)}catch(i){a=i}}throw a},async updateRepo(t,n,o){const a=await r();let i=new Error(`Failed to update repo ${t}: empty sync server list`);for(const r of a){const a=`${r}/api/v2/store/${t}/${R(n,(()=>""))}`,u=a.replace(t,`<${M(t)}>`);try{return await _({method:"POST",url:a,numbUrl:u,body:o},E,e)}catch(s){i=s}}throw i}}},t.m8=M},1223:function(e){e.exports=function(e){for(var t={},r=e.length,n=e.charAt(0),o=0;o<e.length;o++)t[e.charAt(o)]=o;function a(e){if(0===e.length)return[];for(var o=[0],a=0;a<e.length;a++){var i=t[e[a]];if(void 0===i)return;for(var s=0,u=i;s<o.length;++s)u+=o[s]*r,o[s]=255&u,u>>=8;for(;u>0;)o.push(255&u),u>>=8}for(var c=0;e[c]===n&&c<e.length-1;++c)o.push(0);return o.reverse()}return{encode:function(t){if(0===t.length)return"";for(var n=[0],o=0;o<t.length;++o){for(var a=0,i=t[o];a<n.length;++a)i+=n[a]<<8,n[a]=i%r,i=i/r|0;for(;i>0;)n.push(i%r),i=i/r|0}for(var s="",u=0;0===t[u]&&u<t.length-1;++u)s+=e[0];for(var c=n.length-1;c>=0;--c)s+=e[n[c]];return s},decodeUnsafe:a,decode:function(e){var t=a(e);if(t)return t;throw new Error("Non-base"+r+" character")}}}},6266:function(e,t,r){"use strict";var n=t;n.version=r(8597).i8,n.utils=r(953),n.rand=r(9931),n.curve=r(8254),n.curves=r(5427),n.ec=r(7954),n.eddsa=r(5980)},4918:function(e,t,r){"use strict";var n=r(3550),o=r(953),a=o.getNAF,i=o.getJSF,s=o.assert;function u(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(e,t){s(e.precomputed);var r=e._getDoubles(),n=a(t,1,this._bitLength),o=(1<<r.step+1)-(r.step%2==0?2:1);o/=3;var i,u,c=[];for(i=0;i<n.length;i+=r.step){u=0;for(var f=i+r.step-1;f>=i;f--)u=(u<<1)+n[f];c.push(u)}for(var l=this.jpoint(null,null,null),d=this.jpoint(null,null,null),p=o;p>0;p--){for(i=0;i<c.length;i++)(u=c[i])===p?d=d.mixedAdd(r.points[i]):u===-p&&(d=d.mixedAdd(r.points[i].neg()));l=l.add(d)}return l.toP()},u.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var o=n.points,i=a(t,r,this._bitLength),u=this.jpoint(null,null,null),c=i.length-1;c>=0;c--){for(var f=0;c>=0&&0===i[c];c--)f++;if(c>=0&&f++,u=u.dblp(f),c<0)break;var l=i[c];s(0!==l),u="affine"===e.type?l>0?u.mixedAdd(o[l-1>>1]):u.mixedAdd(o[-l-1>>1].neg()):l>0?u.add(o[l-1>>1]):u.add(o[-l-1>>1].neg())}return"affine"===e.type?u.toP():u},u.prototype._wnafMulAdd=function(e,t,r,n,o){var s,u,c,f=this._wnafT1,l=this._wnafT2,d=this._wnafT3,p=0;for(s=0;s<n;s++){var h=(c=t[s])._getNAFPoints(e);f[s]=h.wnd,l[s]=h.points}for(s=n-1;s>=1;s-=2){var b=s-1,v=s;if(1===f[b]&&1===f[v]){var y=[t[b],null,null,t[v]];0===t[b].y.cmp(t[v].y)?(y[1]=t[b].add(t[v]),y[2]=t[b].toJ().mixedAdd(t[v].neg())):0===t[b].y.cmp(t[v].y.redNeg())?(y[1]=t[b].toJ().mixedAdd(t[v]),y[2]=t[b].add(t[v].neg())):(y[1]=t[b].toJ().mixedAdd(t[v]),y[2]=t[b].toJ().mixedAdd(t[v].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],m=i(r[b],r[v]);for(p=Math.max(m[0].length,p),d[b]=new Array(p),d[v]=new Array(p),u=0;u<p;u++){var w=0|m[0][u],x=0|m[1][u];d[b][u]=g[3*(w+1)+(x+1)],d[v][u]=0,l[b]=y}}else d[b]=a(r[b],f[b],this._bitLength),d[v]=a(r[v],f[v],this._bitLength),p=Math.max(d[b].length,p),p=Math.max(d[v].length,p)}var k=this.jpoint(null,null,null),I=this._wnafT4;for(s=p;s>=0;s--){for(var O=0;s>=0;){var E=!0;for(u=0;u<n;u++)I[u]=0|d[u][s],0!==I[u]&&(E=!1);if(!E)break;O++,s--}if(s>=0&&O++,k=k.dblp(O),s<0)break;for(u=0;u<n;u++){var S=I[u];0!==S&&(S>0?c=l[u][S-1>>1]:S<0&&(c=l[u][-S-1>>1].neg()),k="affine"===c.type?k.mixedAdd(c):k.add(c))}}for(s=0;s<n;s++)l[s]=null;return o?k:k.toP()},u.BasePoint=c,c.prototype.eq=function(){throw new Error("Not implemented")},c.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(e,t){e=o.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?s(e[e.length-1]%2==0):7===e[0]&&s(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},c.prototype.encodeCompressed=function(e){return this.encode(e,!0)},c.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},c.prototype.encode=function(e,t){return o.encode(this._encode(t),e)},c.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},c.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},c.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,o=0;o<t;o+=e){for(var a=0;a<e;a++)n=n.dbl();r.push(n)}return{step:e,points:r}},c.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),o=1;o<r;o++)t[o]=t[o-1].add(n);return{wnd:e,points:t}},c.prototype._getBeta=function(){return null},c.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}},1138:function(e,t,r){"use strict";var n=r(953),o=r(3550),a=r(5717),i=r(4918),s=n.assert;function u(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,i.call(this,"edwards",e),this.a=new o(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new o(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new o(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),s(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function c(e,t,r,n,a){i.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new o(t,16),this.y=new o(r,16),this.z=n?new o(n,16):this.curve.one,this.t=a&&new o(a,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}a(u,i),e.exports=u,u.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},u.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},u.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},u.prototype.pointFromX=function(e,t){(e=new o(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),a=this.one.redSub(this.c2.redMul(this.d).redMul(r)),i=n.redMul(a.redInvm()),s=i.redSqrt();if(0!==s.redSqr().redSub(i).cmp(this.zero))throw new Error("invalid point");var u=s.fromRed().isOdd();return(t&&!u||!t&&u)&&(s=s.redNeg()),this.point(e,s)},u.prototype.pointFromY=function(e,t){(e=new o(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),a=r.redMul(this.d).redMul(this.c2).redSub(this.a),i=n.redMul(a.redInvm());if(0===i.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var s=i.redSqrt();if(0!==s.redSqr().redSub(i).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==t&&(s=s.redNeg()),this.point(s,e)},u.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),o=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(o)},a(c,i.BasePoint),u.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},u.prototype.point=function(e,t,r,n){return new c(this,e,t,r,n)},c.fromJSON=function(e,t){return new c(e,t[0],t[1],t[2])},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},c.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),o=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=n.redAdd(t),i=a.redSub(r),s=n.redSub(t),u=o.redMul(i),c=a.redMul(s),f=o.redMul(s),l=i.redMul(a);return this.curve.point(u,c,l,f)},c.prototype._projDbl=function(){var e,t,r,n,o,a,i=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(n=this.curve._mulA(s)).redAdd(u);this.zOne?(e=i.redSub(s).redSub(u).redMul(c.redSub(this.curve.two)),t=c.redMul(n.redSub(u)),r=c.redSqr().redSub(c).redSub(c)):(o=this.z.redSqr(),a=c.redSub(o).redISub(o),e=i.redSub(s).redISub(u).redMul(a),t=c.redMul(n.redSub(u)),r=c.redMul(a))}else n=s.redAdd(u),o=this.curve._mulC(this.z).redSqr(),a=n.redSub(o).redSub(o),e=this.curve._mulC(i.redISub(n)).redMul(a),t=this.curve._mulC(n).redMul(s.redISub(u)),r=n.redMul(a);return this.curve.point(e,t,r)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),o=this.z.redMul(e.z.redAdd(e.z)),a=r.redSub(t),i=o.redSub(n),s=o.redAdd(n),u=r.redAdd(t),c=a.redMul(i),f=s.redMul(u),l=a.redMul(u),d=i.redMul(s);return this.curve.point(c,f,d,l)},c.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),o=n.redSqr(),a=this.x.redMul(e.x),i=this.y.redMul(e.y),s=this.curve.d.redMul(a).redMul(i),u=o.redSub(s),c=o.redAdd(s),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(a).redISub(i),l=n.redMul(u).redMul(f);return this.curve.twisted?(t=n.redMul(c).redMul(i.redSub(this.curve._mulA(a))),r=u.redMul(c)):(t=n.redMul(c).redMul(i.redSub(a)),r=this.curve._mulC(u).redMul(c)),this.curve.point(l,t,r)},c.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},c.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},c.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},c.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},8254:function(e,t,r){"use strict";var n=t;n.base=r(4918),n.short=r(6673),n.mont=r(2881),n.edwards=r(1138)},2881:function(e,t,r){"use strict";var n=r(3550),o=r(5717),a=r(4918),i=r(953);function s(e){a.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(e,t,r){a.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(s,a),e.exports=s,s.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},o(u,a.BasePoint),s.prototype.decodePoint=function(e,t){return this.point(i.toArray(e,t),1)},s.prototype.point=function(e,t){return new u(this,e,t)},s.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(e,t){return new u(e,t[0],t[1]||e.one)},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),o=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,o)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),o=e.x.redAdd(e.z),a=e.x.redSub(e.z).redMul(r),i=o.redMul(n),s=t.z.redMul(a.redAdd(i).redSqr()),u=t.x.redMul(a.redISub(i).redSqr());return this.curve.point(s,u)},u.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),o=[];0!==t.cmpn(0);t.iushrn(1))o.push(t.andln(1));for(var a=o.length-1;a>=0;a--)0===o[a]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},6673:function(e,t,r){"use strict";var n=r(953),o=r(3550),a=r(5717),i=r(4918),s=n.assert;function u(e){i.call(this,"short",e),this.a=new o(e.a,16).toRed(this.red),this.b=new o(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(e,t,r,n){i.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new o(t,16),this.y=new o(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function f(e,t,r,n){i.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new o(0)):(this.x=new o(t,16),this.y=new o(r,16),this.z=new o(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}a(u,i),e.exports=u,u.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new o(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new o(e.lambda,16);else{var a=this._getEndoRoots(this.n);0===this.g.mul(a[0]).x.cmp(this.g.x.redMul(t))?r=a[0]:(r=a[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new o(e.a,16),b:new o(e.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:o.mont(e),r=new o(2).toRed(t).redInvm(),n=r.redNeg(),a=new o(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(a).fromRed(),n.redSub(a).fromRed()]},u.prototype._getEndoBasis=function(e){for(var t,r,n,a,i,s,u,c,f,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,p=this.n.clone(),h=new o(1),b=new o(0),v=new o(0),y=new o(1),g=0;0!==d.cmpn(0);){var m=p.div(d);c=p.sub(m.mul(d)),f=v.sub(m.mul(h));var w=y.sub(m.mul(b));if(!n&&c.cmp(l)<0)t=u.neg(),r=h,n=c.neg(),a=f;else if(n&&2==++g)break;u=c,p=d,d=c,v=h,h=f,y=b,b=w}i=c.neg(),s=f;var x=n.sqr().add(a.sqr());return i.sqr().add(s.sqr()).cmp(x)>=0&&(i=t,s=r),n.negative&&(n=n.neg(),a=a.neg()),i.negative&&(i=i.neg(),s=s.neg()),[{a:n,b:a},{a:i,b:s}]},u.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],o=n.b.mul(e).divRound(this.n),a=r.b.neg().mul(e).divRound(this.n),i=o.mul(r.a),s=a.mul(n.a),u=o.mul(r.b),c=a.mul(n.b);return{k1:e.sub(i).sub(s),k2:u.add(c).neg()}},u.prototype.pointFromX=function(e,t){(e=new o(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var a=n.fromRed().isOdd();return(t&&!a||!t&&a)&&(n=n.redNeg()),this.point(e,n)},u.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(o).cmpn(0)},u.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,o=this._endoWnafT2,a=0;a<e.length;a++){var i=this._endoSplit(t[a]),s=e[a],u=s._getBeta();i.k1.negative&&(i.k1.ineg(),s=s.neg(!0)),i.k2.negative&&(i.k2.ineg(),u=u.neg(!0)),n[2*a]=s,n[2*a+1]=u,o[2*a]=i.k1,o[2*a+1]=i.k2}for(var c=this._wnafMulAdd(1,n,o,2*a,r),f=0;f<2*a;f++)n[f]=null,o[f]=null;return c},a(c,i.BasePoint),u.prototype.point=function(e,t,r){return new c(this,e,t,r)},u.prototype.pointFromJSON=function(e,t){return c.fromJSON(this,e,t)},c.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},c.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},c.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function o(t){return e.point(t[0],t[1],r)}var a=t[2];return n.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[n].concat(a.doubles.points.map(o))},naf:a.naf&&{wnd:a.naf.wnd,points:[n].concat(a.naf.points.map(o))}},n},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},c.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),o=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),a=o.redSqr().redISub(this.x.redAdd(this.x)),i=o.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,i)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(e){return e=new o(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o):this.curve._wnafMulAdd(1,n,o,2)},c.prototype.jmulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o,!0):this.curve._wnafMulAdd(1,n,o,2,!0)},c.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},c.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},a(f,i.BasePoint),u.prototype.jpoint=function(e,t,r){return new f(this,e,t,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),o=e.x.redMul(r),a=this.y.redMul(t.redMul(e.z)),i=e.y.redMul(r.redMul(this.z)),s=n.redSub(o),u=a.redSub(i);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),f=c.redMul(s),l=n.redMul(c),d=u.redSqr().redIAdd(f).redISub(l).redISub(l),p=u.redMul(l.redISub(d)).redISub(a.redMul(f)),h=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(d,p,h)},f.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),o=this.y,a=e.y.redMul(t).redMul(this.z),i=r.redSub(n),s=o.redSub(a);if(0===i.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=i.redSqr(),c=u.redMul(i),f=r.redMul(u),l=s.redSqr().redIAdd(c).redISub(f).redISub(f),d=s.redMul(f.redISub(l)).redISub(o.redMul(c)),p=this.z.redMul(i);return this.curve.jpoint(l,d,p)},f.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var n=this.curve.a,o=this.curve.tinv,a=this.x,i=this.y,s=this.z,u=s.redSqr().redSqr(),c=i.redAdd(i);for(t=0;t<e;t++){var f=a.redSqr(),l=c.redSqr(),d=l.redSqr(),p=f.redAdd(f).redIAdd(f).redIAdd(n.redMul(u)),h=a.redMul(l),b=p.redSqr().redISub(h.redAdd(h)),v=h.redISub(b),y=p.redMul(v);y=y.redIAdd(y).redISub(d);var g=c.redMul(s);t+1<e&&(u=u.redMul(d)),a=b,s=g,c=y}return this.curve.jpoint(a,c.redMul(o),s)},f.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},f.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),a=o.redSqr(),i=this.x.redAdd(o).redSqr().redISub(n).redISub(a);i=i.redIAdd(i);var s=n.redAdd(n).redIAdd(n),u=s.redSqr().redISub(i).redISub(i),c=a.redIAdd(a);c=(c=c.redIAdd(c)).redIAdd(c),e=u,t=s.redMul(i.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.x.redSqr(),l=this.y.redSqr(),d=l.redSqr(),p=this.x.redAdd(l).redSqr().redISub(f).redISub(d);p=p.redIAdd(p);var h=f.redAdd(f).redIAdd(f),b=h.redSqr(),v=d.redIAdd(d);v=(v=v.redIAdd(v)).redIAdd(v),e=b.redISub(p).redISub(p),t=h.redMul(p.redISub(e)).redISub(v),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},f.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),a=o.redSqr(),i=this.x.redAdd(o).redSqr().redISub(n).redISub(a);i=i.redIAdd(i);var s=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=s.redSqr().redISub(i).redISub(i);e=u;var c=a.redIAdd(a);c=(c=c.redIAdd(c)).redIAdd(c),t=s.redMul(i.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.z.redSqr(),l=this.y.redSqr(),d=this.x.redMul(l),p=this.x.redSub(f).redMul(this.x.redAdd(f));p=p.redAdd(p).redIAdd(p);var h=d.redIAdd(d),b=(h=h.redIAdd(h)).redAdd(h);e=p.redSqr().redISub(b),r=this.y.redAdd(this.z).redSqr().redISub(l).redISub(f);var v=l.redSqr();v=(v=(v=v.redIAdd(v)).redIAdd(v)).redIAdd(v),t=p.redMul(h.redISub(e)).redISub(v)}return this.curve.jpoint(e,t,r)},f.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,o=n.redSqr().redSqr(),a=t.redSqr(),i=r.redSqr(),s=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(o)),u=t.redAdd(t),c=(u=u.redIAdd(u)).redMul(i),f=s.redSqr().redISub(c.redAdd(c)),l=c.redISub(f),d=i.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var p=s.redMul(l).redISub(d),h=r.redAdd(r).redMul(n);return this.curve.jpoint(f,p,h)},f.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),o=e.redAdd(e).redIAdd(e),a=o.redSqr(),i=this.x.redAdd(t).redSqr().redISub(e).redISub(n),s=(i=(i=(i=i.redIAdd(i)).redAdd(i).redIAdd(i)).redISub(a)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=o.redIAdd(i).redSqr().redISub(a).redISub(s).redISub(u),f=t.redMul(c);f=(f=f.redIAdd(f)).redIAdd(f);var l=this.x.redMul(s).redISub(f);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.y.redMul(c.redMul(u.redISub(c)).redISub(i.redMul(s)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var p=this.z.redAdd(i).redSqr().redISub(r).redISub(s);return this.curve.jpoint(l,d,p)},f.prototype.mul=function(e,t){return e=new o(e,t),this.curve._wnafMul(this,e)},f.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),o=r.redMul(e.z);return 0===this.y.redMul(o).redISub(e.y.redMul(n)).cmpn(0)},f.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),o=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(o),0===this.x.cmp(r))return!0}},f.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},5427:function(e,t,r){"use strict";var n,o=t,a=r(3715),i=r(8254),s=r(953).assert;function u(e){"short"===e.type?this.curve=new i.short(e):"edwards"===e.type?this.curve=new i.edwards(e):this.curve=new i.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,t){Object.defineProperty(o,e,{configurable:!0,enumerable:!0,get:function(){var r=new u(t);return Object.defineProperty(o,e,{configurable:!0,enumerable:!0,value:r}),r}})}o.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:a.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:a.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:a.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:a.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:a.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(1037)}catch(f){n=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:a.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},7954:function(e,t,r){"use strict";var n=r(3550),o=r(2156),a=r(953),i=r(5427),s=r(9931),u=a.assert,c=r(1251),f=r(611);function l(e){if(!(this instanceof l))return new l(e);"string"==typeof e&&(u(Object.prototype.hasOwnProperty.call(i,e),"Unknown curve "+e),e=i[e]),e instanceof i.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=l,l.prototype.keyPair=function(e){return new c(this,e)},l.prototype.keyFromPrivate=function(e,t){return c.fromPrivate(this,e,t)},l.prototype.keyFromPublic=function(e,t){return c.fromPublic(this,e,t)},l.prototype.genKeyPair=function(e){e||(e={});for(var t=new o({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||s(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),a=this.n.sub(new n(2));;){var i=new n(t.generate(r));if(!(i.cmp(a)>0))return i.iaddn(1),this.keyFromPrivate(i)}},l.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},l.prototype.sign=function(e,t,r,a){"object"==typeof r&&(a=r,r=null),a||(a={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new n(e,16));for(var i=this.n.byteLength(),s=t.getPrivate().toArray("be",i),u=e.toArray("be",i),c=new o({hash:this.hash,entropy:s,nonce:u,pers:a.pers,persEnc:a.persEnc||"utf8"}),l=this.n.sub(new n(1)),d=0;;d++){var p=a.k?a.k(d):new n(c.generate(this.n.byteLength()));if(!((p=this._truncateToN(p,!0)).cmpn(1)<=0||p.cmp(l)>=0)){var h=this.g.mul(p);if(!h.isInfinity()){var b=h.getX(),v=b.umod(this.n);if(0!==v.cmpn(0)){var y=p.invm(this.n).mul(v.mul(t.getPrivate()).iadd(e));if(0!==(y=y.umod(this.n)).cmpn(0)){var g=(h.getY().isOdd()?1:0)|(0!==b.cmp(v)?2:0);return a.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),g^=1),new f({r:v,s:y,recoveryParam:g})}}}}}},l.prototype.verify=function(e,t,r,o){e=this._truncateToN(new n(e,16)),r=this.keyFromPublic(r,o);var a=(t=new f(t,"hex")).r,i=t.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;var s,u=i.invm(this.n),c=u.mul(e).umod(this.n),l=u.mul(a).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(c,r.getPublic(),l)).isInfinity()&&s.eqXToP(a):!(s=this.g.mulAdd(c,r.getPublic(),l)).isInfinity()&&0===s.getX().umod(this.n).cmp(a)},l.prototype.recoverPubKey=function(e,t,r,o){u((3&r)===r,"The recovery param is more than two bits"),t=new f(t,o);var a=this.n,i=new n(e),s=t.r,c=t.s,l=1&r,d=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");s=d?this.curve.pointFromX(s.add(this.curve.n),l):this.curve.pointFromX(s,l);var p=t.r.invm(a),h=a.sub(i).mul(p).umod(a),b=c.mul(p).umod(a);return this.g.mulAdd(h,s,b)},l.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new f(t,n)).recoveryParam)return t.recoveryParam;for(var o=0;o<4;o++){var a;try{a=this.recoverPubKey(e,t,o)}catch(e){continue}if(a.eq(r))return o}throw new Error("Unable to find valid recovery factor")}},1251:function(e,t,r){"use strict";var n=r(3550),o=r(953).assert;function a(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=a,a.fromPublic=function(e,t,r){return t instanceof a?t:new a(e,{pub:t,pubEnc:r})},a.fromPrivate=function(e,t,r){return t instanceof a?t:new a(e,{priv:t,privEnc:r})},a.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},a.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},a.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},a.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},a.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?o(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||o(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},a.prototype.derive=function(e){return e.validate()||o(e.validate(),"public point not validated"),e.mul(this.priv).getX()},a.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},a.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},a.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},611:function(e,t,r){"use strict";var n=r(3550),o=r(953),a=o.assert;function i(e,t){if(e instanceof i)return e;this._importDER(e,t)||(a(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function s(){this.place=0}function u(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var o=0,a=0,i=t.place;a<n;a++,i++)o<<=8,o|=e[i],o>>>=0;return!(o<=127)&&(t.place=i,o)}function c(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function f(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}e.exports=i,i.prototype._importDER=function(e,t){e=o.toArray(e,t);var r=new s;if(48!==e[r.place++])return!1;var a=u(e,r);if(!1===a)return!1;if(a+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=u(e,r);if(!1===i)return!1;var c=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var f=u(e,r);if(!1===f)return!1;if(e.length!==f+r.place)return!1;var l=e.slice(r.place,f+r.place);if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}return this.r=new n(c),this.s=new n(l),this.recoveryParam=null,!0},i.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=c(t),r=c(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];f(n,t.length),(n=n.concat(t)).push(2),f(n,r.length);var a=n.concat(r),i=[48];return f(i,a.length),i=i.concat(a),o.encode(i,e)}},5980:function(e,t,r){"use strict";var n=r(3715),o=r(5427),a=r(953),i=a.assert,s=a.parseBytes,u=r(9087),c=r(3622);function f(e){if(i("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof f))return new f(e);e=o[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}e.exports=f,f.prototype.sign=function(e,t){e=s(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),o=this.g.mul(n),a=this.encodePoint(o),i=this.hashInt(a,r.pubBytes(),e).mul(r.priv()),u=n.add(i).umod(this.curve.n);return this.makeSignature({R:o,S:u,Rencoded:a})},f.prototype.verify=function(e,t,r){e=s(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),o=this.hashInt(t.Rencoded(),n.pubBytes(),e),a=this.g.mul(t.S());return t.R().add(n.pub().mul(o)).eq(a)},f.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return a.intFromLE(e.digest()).umod(this.curve.n)},f.prototype.keyFromPublic=function(e){return u.fromPublic(this,e)},f.prototype.keyFromSecret=function(e){return u.fromSecret(this,e)},f.prototype.makeSignature=function(e){return e instanceof c?e:new c(this,e)},f.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},f.prototype.decodePoint=function(e){var t=(e=a.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),n=0!=(128&e[t]),o=a.intFromLE(r);return this.curve.pointFromY(o,n)},f.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},f.prototype.decodeInt=function(e){return a.intFromLE(e)},f.prototype.isPoint=function(e){return e instanceof this.pointClass}},9087:function(e,t,r){"use strict";var n=r(953),o=n.assert,a=n.parseBytes,i=n.cachedProperty;function s(e,t){this.eddsa=e,this._secret=a(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=a(t.pub)}s.fromPublic=function(e,t){return t instanceof s?t:new s(e,{pub:t})},s.fromSecret=function(e,t){return t instanceof s?t:new s(e,{secret:t})},s.prototype.secret=function(){return this._secret},i(s,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),i(s,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),i(s,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),i(s,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),i(s,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),i(s,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),s.prototype.sign=function(e){return o(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},s.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},s.prototype.getSecret=function(e){return o(this._secret,"KeyPair is public only"),n.encode(this.secret(),e)},s.prototype.getPublic=function(e){return n.encode(this.pubBytes(),e)},e.exports=s},3622:function(e,t,r){"use strict";var n=r(3550),o=r(953),a=o.assert,i=o.cachedProperty,s=o.parseBytes;function u(e,t){this.eddsa=e,"object"!=typeof t&&(t=s(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),a(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof n&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}i(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),i(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),i(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),i(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return o.encode(this.toBytes(),"hex").toUpperCase()},e.exports=u},1037:function(e){e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},953:function(e,t,r){"use strict";var n=t,o=r(3550),a=r(9746),i=r(4504);n.assert=a,n.toArray=i.toArray,n.zero2=i.zero2,n.toHex=i.toHex,n.encode=i.encode,n.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var o=1<<t+1,a=e.clone(),i=0;i<n.length;i++){var s,u=a.andln(o-1);a.isOdd()?(s=u>(o>>1)-1?(o>>1)-u:u,a.isubn(s)):s=0,n[i]=s,a.iushrn(1)}return n},n.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,o=0,a=0;e.cmpn(-o)>0||t.cmpn(-a)>0;){var i,s,u=e.andln(3)+o&3,c=t.andln(3)+a&3;3===u&&(u=-1),3===c&&(c=-1),i=0==(1&u)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==c?u:-u,r[0].push(i),s=0==(1&c)?0:3!==(n=t.andln(7)+a&7)&&5!==n||2!==u?c:-c,r[1].push(s),2*o===i+1&&(o=1-o),2*a===s+1&&(a=1-a),e.iushrn(1),t.iushrn(1)}return r},n.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new o(e,"hex","le")}},7680:function(e){function t(e){return e}e.exports=function(e,r,n){r=r||t,n=n||e;for(var o=0,a=e.length;o<a;o+=1)if(r.call(n,e[o],o))return e[o]}},3715:function(e,t,r){var n=t;n.utils=r(6436),n.common=r(5772),n.sha=r(9041),n.ripemd=r(2949),n.hmac=r(2344),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},5772:function(e,t,r){"use strict";var n=r(6436),o=r(9746);function a(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=a,a.prototype.update=function(e,t){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var o=0;o<e.length;o+=this._delta32)this._update(e,o,o+this._delta32)}return this},a.prototype.digest=function(e){return this.update(this._pad()),o(null===this.pending),this._digest(e)},a.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var o=1;o<r;o++)n[o]=0;if(e<<=3,"big"===this.endian){for(var a=8;a<this.padLength;a++)n[o++]=0;n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=e>>>24&255,n[o++]=e>>>16&255,n[o++]=e>>>8&255,n[o++]=255&e}else for(n[o++]=255&e,n[o++]=e>>>8&255,n[o++]=e>>>16&255,n[o++]=e>>>24&255,n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=0,a=8;a<this.padLength;a++)n[o++]=0;return n}},2344:function(e,t,r){"use strict";var n=r(6436),o=r(9746);function a(e,t,r){if(!(this instanceof a))return new a(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}e.exports=a,a.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),o(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},a.prototype.update=function(e,t){return this.inner.update(e,t),this},a.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},2949:function(e,t,r){"use strict";var n=r(6436),o=r(5772),a=n.rotl32,i=n.sum32,s=n.sum32_3,u=n.sum32_4,c=o.BlockHash;function f(){if(!(this instanceof f))return new f;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function l(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function d(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function p(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}n.inherits(f,c),t.ripemd160=f,f.blockSize=512,f.outSize=160,f.hmacStrength=192,f.padLength=64,f.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],o=this.h[2],c=this.h[3],f=this.h[4],g=r,m=n,w=o,x=c,k=f,I=0;I<80;I++){var O=i(a(u(r,l(I,n,o,c),e[h[I]+t],d(I)),v[I]),f);r=f,f=c,c=a(o,10),o=n,n=O,O=i(a(u(g,l(79-I,m,w,x),e[b[I]+t],p(I)),y[I]),k),g=k,k=x,x=a(w,10),w=m,m=O}O=s(this.h[1],o,x),this.h[1]=s(this.h[2],c,k),this.h[2]=s(this.h[3],f,g),this.h[3]=s(this.h[4],r,m),this.h[4]=s(this.h[0],n,w),this.h[0]=O},f.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var h=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],b=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],v=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],y=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},9041:function(e,t,r){"use strict";t.sha1=r(4761),t.sha224=r(799),t.sha256=r(9344),t.sha384=r(772),t.sha512=r(5900)},4761:function(e,t,r){"use strict";var n=r(6436),o=r(5772),a=r(7038),i=n.rotl32,s=n.sum32,u=n.sum32_5,c=a.ft_1,f=o.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(d,f),e.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=i(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var o=this.h[0],a=this.h[1],f=this.h[2],d=this.h[3],p=this.h[4];for(n=0;n<r.length;n++){var h=~~(n/20),b=u(i(o,5),c(h,a,f,d),p,r[n],l[h]);p=d,d=f,f=i(a,30),a=o,o=b}this.h[0]=s(this.h[0],o),this.h[1]=s(this.h[1],a),this.h[2]=s(this.h[2],f),this.h[3]=s(this.h[3],d),this.h[4]=s(this.h[4],p)},d.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},799:function(e,t,r){"use strict";var n=r(6436),o=r(9344);function a(){if(!(this instanceof a))return new a;o.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(a,o),e.exports=a,a.blockSize=512,a.outSize=224,a.hmacStrength=192,a.padLength=64,a.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},9344:function(e,t,r){"use strict";var n=r(6436),o=r(5772),a=r(7038),i=r(9746),s=n.sum32,u=n.sum32_4,c=n.sum32_5,f=a.ch32,l=a.maj32,d=a.s0_256,p=a.s1_256,h=a.g0_256,b=a.g1_256,v=o.BlockHash,y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function g(){if(!(this instanceof g))return new g;v.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}n.inherits(g,v),e.exports=g,g.blockSize=512,g.outSize=256,g.hmacStrength=192,g.padLength=64,g.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=u(b(r[n-2]),r[n-7],h(r[n-15]),r[n-16]);var o=this.h[0],a=this.h[1],v=this.h[2],y=this.h[3],g=this.h[4],m=this.h[5],w=this.h[6],x=this.h[7];for(i(this.k.length===r.length),n=0;n<r.length;n++){var k=c(x,p(g),f(g,m,w),this.k[n],r[n]),I=s(d(o),l(o,a,v));x=w,w=m,m=g,g=s(y,k),y=v,v=a,a=o,o=s(k,I)}this.h[0]=s(this.h[0],o),this.h[1]=s(this.h[1],a),this.h[2]=s(this.h[2],v),this.h[3]=s(this.h[3],y),this.h[4]=s(this.h[4],g),this.h[5]=s(this.h[5],m),this.h[6]=s(this.h[6],w),this.h[7]=s(this.h[7],x)},g.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},772:function(e,t,r){"use strict";var n=r(6436),o=r(5900);function a(){if(!(this instanceof a))return new a;o.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(a,o),e.exports=a,a.blockSize=1024,a.outSize=384,a.hmacStrength=192,a.padLength=128,a.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},5900:function(e,t,r){"use strict";var n=r(6436),o=r(5772),a=r(9746),i=n.rotr64_hi,s=n.rotr64_lo,u=n.shr64_hi,c=n.shr64_lo,f=n.sum64,l=n.sum64_hi,d=n.sum64_lo,p=n.sum64_4_hi,h=n.sum64_4_lo,b=n.sum64_5_hi,v=n.sum64_5_lo,y=o.BlockHash,g=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function m(){if(!(this instanceof m))return new m;y.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=g,this.W=new Array(160)}function w(e,t,r,n,o){var a=e&r^~e&o;return a<0&&(a+=4294967296),a}function x(e,t,r,n,o,a){var i=t&n^~t&a;return i<0&&(i+=4294967296),i}function k(e,t,r,n,o){var a=e&r^e&o^r&o;return a<0&&(a+=4294967296),a}function I(e,t,r,n,o,a){var i=t&n^t&a^n&a;return i<0&&(i+=4294967296),i}function O(e,t){var r=i(e,t,28)^i(t,e,2)^i(t,e,7);return r<0&&(r+=4294967296),r}function E(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function S(e,t){var r=i(e,t,14)^i(e,t,18)^i(t,e,9);return r<0&&(r+=4294967296),r}function A(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function T(e,t){var r=i(e,t,1)^i(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function _(e,t){var r=s(e,t,1)^s(e,t,8)^c(e,t,7);return r<0&&(r+=4294967296),r}function P(e,t){var r=i(e,t,19)^i(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}function M(e,t){var r=s(e,t,19)^s(t,e,29)^c(e,t,6);return r<0&&(r+=4294967296),r}n.inherits(m,y),e.exports=m,m.blockSize=1024,m.outSize=512,m.hmacStrength=192,m.padLength=128,m.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var o=P(r[n-4],r[n-3]),a=M(r[n-4],r[n-3]),i=r[n-14],s=r[n-13],u=T(r[n-30],r[n-29]),c=_(r[n-30],r[n-29]),f=r[n-32],l=r[n-31];r[n]=p(o,a,i,s,u,c,f,l),r[n+1]=h(o,a,i,s,u,c,f,l)}},m.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],o=this.h[1],i=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],p=this.h[6],h=this.h[7],y=this.h[8],g=this.h[9],m=this.h[10],T=this.h[11],_=this.h[12],P=this.h[13],M=this.h[14],j=this.h[15];a(this.k.length===r.length);for(var C=0;C<r.length;C+=2){var N=M,D=j,R=S(y,g),B=A(y,g),L=w(y,g,m,T,_),K=x(y,g,m,T,_,P),U=this.k[C],F=this.k[C+1],W=r[C],q=r[C+1],z=b(N,D,R,B,L,K,U,F,W,q),G=v(N,D,R,B,L,K,U,F,W,q);N=O(n,o),D=E(n,o),R=k(n,o,i,s,u),B=I(n,o,i,s,u,c);var H=l(N,D,R,B),Y=d(N,D,R,B);M=_,j=P,_=m,P=T,m=y,T=g,y=l(p,h,z,G),g=d(h,h,z,G),p=u,h=c,u=i,c=s,i=n,s=o,n=l(z,G,H,Y),o=d(z,G,H,Y)}f(this.h,0,n,o),f(this.h,2,i,s),f(this.h,4,u,c),f(this.h,6,p,h),f(this.h,8,y,g),f(this.h,10,m,T),f(this.h,12,_,P),f(this.h,14,M,j)},m.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},7038:function(e,t,r){"use strict";var n=r(6436).rotr32;function o(e,t,r){return e&t^~e&r}function a(e,t,r){return e&t^e&r^t&r}function i(e,t,r){return e^t^r}t.ft_1=function(e,t,r,n){return 0===e?o(t,r,n):1===e||3===e?i(t,r,n):2===e?a(t,r,n):void 0},t.ch32=o,t.maj32=a,t.p32=i,t.s0_256=function(e){return n(e,2)^n(e,13)^n(e,22)},t.s1_256=function(e){return n(e,6)^n(e,11)^n(e,25)},t.g0_256=function(e){return n(e,7)^n(e,18)^e>>>3},t.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},6436:function(e,t,r){"use strict";var n=r(9746),o=r(5717);function a(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function i(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function s(e){return 1===e.length?"0"+e:e}function u(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=o,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),o=0;o<e.length;o+=2)r.push(parseInt(e[o]+e[o+1],16))}else for(var n=0,o=0;o<e.length;o++){var i=e.charCodeAt(o);i<128?r[n++]=i:i<2048?(r[n++]=i>>6|192,r[n++]=63&i|128):a(e,o)?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++o)),r[n++]=i>>18|240,r[n++]=i>>12&63|128,r[n++]=i>>6&63|128,r[n++]=63&i|128):(r[n++]=i>>12|224,r[n++]=i>>6&63|128,r[n++]=63&i|128)}else for(o=0;o<e.length;o++)r[o]=0|e[o];return r},t.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=s(e[r].toString(16));return t},t.htonl=i,t.toHex32=function(e,t){for(var r="",n=0;n<e.length;n++){var o=e[n];"little"===t&&(o=i(o)),r+=u(o.toString(16))}return r},t.zero2=s,t.zero8=u,t.join32=function(e,t,r,o){var a=r-t;n(a%4==0);for(var i=new Array(a/4),s=0,u=t;s<i.length;s++,u+=4){var c;c="big"===o?e[u]<<24|e[u+1]<<16|e[u+2]<<8|e[u+3]:e[u+3]<<24|e[u+2]<<16|e[u+1]<<8|e[u],i[s]=c>>>0}return i},t.split32=function(e,t){for(var r=new Array(4*e.length),n=0,o=0;n<e.length;n++,o+=4){var a=e[n];"big"===t?(r[o]=a>>>24,r[o+1]=a>>>16&255,r[o+2]=a>>>8&255,r[o+3]=255&a):(r[o+3]=a>>>24,r[o+2]=a>>>16&255,r[o+1]=a>>>8&255,r[o]=255&a)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(e,t,r,n,o){return e+t+r+n+o>>>0},t.sum64=function(e,t,r,n){var o=e[t],a=n+e[t+1]>>>0,i=(a<n?1:0)+r+o;e[t]=i>>>0,e[t+1]=a},t.sum64_hi=function(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,o,a,i,s){var u=0,c=t;return u+=(c=c+n>>>0)<t?1:0,u+=(c=c+a>>>0)<a?1:0,e+r+o+i+(u+=(c=c+s>>>0)<s?1:0)>>>0},t.sum64_4_lo=function(e,t,r,n,o,a,i,s){return t+n+a+s>>>0},t.sum64_5_hi=function(e,t,r,n,o,a,i,s,u,c){var f=0,l=t;return f+=(l=l+n>>>0)<t?1:0,f+=(l=l+a>>>0)<a?1:0,f+=(l=l+s>>>0)<s?1:0,e+r+o+i+u+(f+=(l=l+c>>>0)<c?1:0)>>>0},t.sum64_5_lo=function(e,t,r,n,o,a,i,s,u,c){return t+n+a+s+c>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},2156:function(e,t,r){"use strict";var n=r(3715),o=r(4504),a=r(9746);function i(e){if(!(this instanceof i))return new i(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=o.toArray(e.entropy,e.entropyEnc||"hex"),r=o.toArray(e.nonce,e.nonceEnc||"hex"),n=o.toArray(e.pers,e.persEnc||"hex");a(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}e.exports=i,i.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o<this.V.length;o++)this.K[o]=0,this.V[o]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},i.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},i.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},i.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=o.toArray(e,t),r=o.toArray(r,n),a(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},i.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=o.toArray(r,n||"hex"),this._update(r));for(var a=[];a.length<e;)this.V=this._hmac().update(this.V).digest(),a=a.concat(this.V);var i=a.slice(0,e);return this._update(r),this._reseed++,o.encode(i,t)}},5717:function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},9746:function(e){function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},4504:function(e,t){"use strict";var r=t;function n(e){return 1===e.length?"0"+e:e}function o(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(n=0;n<e.length;n++){var o=e.charCodeAt(n),a=o>>8,i=255&o;a?r.push(a,i):r.push(i)}return r},r.zero2=n,r.toHex=o,r.encode=function(e,t){return"hex"===t?o(e):e}},2719:function(e){var t=e.exports=function(e,r){if("function"==typeof e||r)return t.by(e,r);for(var n={object:[],function:[],string:{},number:{},boolean:{},undefined:{}},o=[],a=0;a<e.length;a++){var i=e[a],s="__proto__"===i?n.objects:n[typeof i]||n.objects;Array.isArray(s)?s.indexOf(i)<0&&(s.push(i),o.push(i)):Object.hasOwnProperty.call(s,i)||(s[i]=!0,o.push(i))}return o};t.by=function(e,t){if("function"==typeof e){var r=t;t=e,e=r}for(var n=[],o=0;o<e.length;o++){for(var a=e[o],i=!1,s=0;s<n.length;s++){var u=n[s];if(t.call(n,a,u)){i=!0;break}}i||n.push(a)}return n}},7635:function(e){"use strict";!function(t){var r=2147483647;function n(e){var t=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],r=1779033703,n=3144134277,o=1013904242,a=2773480762,i=1359893119,s=2600822924,u=528734635,c=1541459225,f=new Array(64);function l(e){for(var l=0,d=e.length;d>=64;){var p,h,b,v,y,g=r,m=n,w=o,x=a,k=i,I=s,O=u,E=c;for(h=0;h<16;h++)b=l+4*h,f[h]=(255&e[b])<<24|(255&e[b+1])<<16|(255&e[b+2])<<8|255&e[b+3];for(h=16;h<64;h++)v=((p=f[h-2])>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,y=((p=f[h-15])>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,f[h]=(v+f[h-7]|0)+(y+f[h-16]|0)|0;for(h=0;h<64;h++)v=(((k>>>6|k<<26)^(k>>>11|k<<21)^(k>>>25|k<<7))+(k&I^~k&O)|0)+(E+(t[h]+f[h]|0)|0)|0,y=((g>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10))+(g&m^g&w^m&w)|0,E=O,O=I,I=k,k=x+v|0,x=w,w=m,m=g,g=v+y|0;r=r+g|0,n=n+m|0,o=o+w|0,a=a+x|0,i=i+k|0,s=s+I|0,u=u+O|0,c=c+E|0,l+=64,d-=64}}l(e);var d,p=e.length%64,h=e.length/536870912|0,b=e.length<<3,v=p<56?56:120,y=e.slice(e.length-p,e.length);for(y.push(128),d=p+1;d<v;d++)y.push(0);return y.push(h>>>24&255),y.push(h>>>16&255),y.push(h>>>8&255),y.push(h>>>0&255),y.push(b>>>24&255),y.push(b>>>16&255),y.push(b>>>8&255),y.push(b>>>0&255),l(y),[r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255,c>>>24&255,c>>>16&255,c>>>8&255,c>>>0&255]}function o(e,t,r){var o;e=e.length<=64?e:n(e);var a=64+t.length+4,i=new Array(a),s=new Array(64),u=[];for(o=0;o<64;o++)i[o]=54;for(o=0;o<e.length;o++)i[o]^=e[o];for(o=0;o<t.length;o++)i[64+o]=t[o];for(o=a-4;o<a;o++)i[o]=0;for(o=0;o<64;o++)s[o]=92;for(o=0;o<e.length;o++)s[o]^=e[o];function c(){for(var e=a-1;e>=a-4;e--){if(i[e]++,i[e]<=255)return;i[e]=0}}for(;r>=32;)c(),u=u.concat(n(s.concat(n(i)))),r-=32;return r>0&&(c(),u=u.concat(n(s.concat(n(i))).slice(0,r))),u}function a(e,t,r,n,o){var a;for(c(e,16*(2*r-1),o,0,16),a=0;a<2*r;a++)u(e,16*a,o,16),s(o,n),c(o,0,e,t+16*a,16);for(a=0;a<r;a++)c(e,t+2*a*16,e,16*a,16);for(a=0;a<r;a++)c(e,t+16*(2*a+1),e,16*(a+r),16)}function i(e,t){return e<<t|e>>>32-t}function s(e,t){c(e,0,t,0,16);for(var r=8;r>0;r-=2)t[4]^=i(t[0]+t[12],7),t[8]^=i(t[4]+t[0],9),t[12]^=i(t[8]+t[4],13),t[0]^=i(t[12]+t[8],18),t[9]^=i(t[5]+t[1],7),t[13]^=i(t[9]+t[5],9),t[1]^=i(t[13]+t[9],13),t[5]^=i(t[1]+t[13],18),t[14]^=i(t[10]+t[6],7),t[2]^=i(t[14]+t[10],9),t[6]^=i(t[2]+t[14],13),t[10]^=i(t[6]+t[2],18),t[3]^=i(t[15]+t[11],7),t[7]^=i(t[3]+t[15],9),t[11]^=i(t[7]+t[3],13),t[15]^=i(t[11]+t[7],18),t[1]^=i(t[0]+t[3],7),t[2]^=i(t[1]+t[0],9),t[3]^=i(t[2]+t[1],13),t[0]^=i(t[3]+t[2],18),t[6]^=i(t[5]+t[4],7),t[7]^=i(t[6]+t[5],9),t[4]^=i(t[7]+t[6],13),t[5]^=i(t[4]+t[7],18),t[11]^=i(t[10]+t[9],7),t[8]^=i(t[11]+t[10],9),t[9]^=i(t[8]+t[11],13),t[10]^=i(t[9]+t[8],18),t[12]^=i(t[15]+t[14],7),t[13]^=i(t[12]+t[15],9),t[14]^=i(t[13]+t[12],13),t[15]^=i(t[14]+t[13],18);for(r=0;r<16;++r)e[r]+=t[r]}function u(e,t,r,n){for(var o=0;o<n;o++)r[o]^=e[t+o]}function c(e,t,r,n,o){for(;o--;)r[n++]=e[t++]}function f(e){if(!e||"number"!=typeof e.length)return!1;for(var t=0;t<e.length;t++){if("number"!=typeof e[t])return!1;var r=parseInt(e[t]);if(r!=e[t]||r<0||r>=256)return!1}return!0}function l(e,t){var r=parseInt(e);if(e!=r)throw new Error("invalid "+t);return r}e.exports=function(e,t,n,i,s,d,p){if(!p)throw new Error("missing callback");if(n=l(n,"N"),i=l(i,"r"),s=l(s,"p"),d=l(d,"dkLen"),0===n||0!=(n&n-1))throw new Error("N must be power of 2");if(n>r/128/i)throw new Error("N too large");if(i>r/128/s)throw new Error("r too large");if(!f(e))throw new Error("password must be an array or buffer");if(!f(t))throw new Error("salt must be an array or buffer");for(var h=o(e,t,128*s*i),b=new Uint32Array(32*s*i),v=0;v<b.length;v++){var y=4*v;b[v]=(255&h[y+3])<<24|(255&h[y+2])<<16|(255&h[y+1])<<8|(255&h[y+0])<<0}var g,m,w=new Uint32Array(64*i),x=new Uint32Array(32*i*n),k=32*i,I=new Uint32Array(16),O=new Uint32Array(16),E=s*n*2,S=0,A=null,T=!1,_=0,P=0,M=parseInt(1e3/i),j="undefined"!=typeof setImmediate?setImmediate:setTimeout,C=function(){if(T)return p(new Error("cancelled"),S/E);switch(_){case 0:c(b,m=32*P*i,w,0,k),_=1,g=0;case 1:(r=n-g)>M&&(r=M);for(var t=0;t<r;t++)c(w,0,x,(g+t)*k,k),a(w,k,i,I,O);if(g+=r,S+=r,(f=parseInt(1e3*S/E))!==A){if(T=p(null,S/E))break;A=f}if(g<n)break;g=0,_=2;case 2:var r,f;for((r=n-g)>M&&(r=M),t=0;t<r;t++){var l=w[16*(2*i-1)]&n-1;u(x,l*k,w,k),a(w,k,i,I,O)}if(g+=r,S+=r,(f=parseInt(1e3*S/E))!==A){if(T=p(null,S/E))break;A=f}if(g<n)break;if(c(w,0,b,m,k),++P<s){_=0;break}for(h=[],t=0;t<b.length;t++)h.push(b[t]>>0&255),h.push(b[t]>>8&255),h.push(b[t]>>16&255),h.push(b[t]>>24&255);var v=o(e,h,d);return p(null,1,v)}j(C)};C()}}()},7716:function(e,t){"use strict";function r(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(c){return void r(c)}s.done?t(u):Promise.resolve(u).then(n,o)}function n(e){return function(){var t=this,n=arguments;return new Promise((function(o,a){var i=e.apply(t,n);function s(e){r(i,o,a,s,u,"next",e)}function u(e){r(i,o,a,s,u,"throw",e)}s(void 0)}))}}function o(){return o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o.apply(this,arguments)}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s={parse:function(e){for(var t=encodeURI(e),r=new Uint8Array(t.length),n=0,o=0;o<t.length;++o){var a=t.charCodeAt(o);37===a?(r[n++]=parseInt(t.slice(o+1,o+3),16),o+=2):r[n++]=a}return r.subarray(0,n)},stringify:function(e){for(var t="",r=0;r<e.length;++r){var n=e[r];t+="%"+(n>>4).toString(16)+(15&n).toString(16)}return decodeURIComponent(t)}};function u(e){var t=e.body,r=void 0===t?"":t,o=e.headers,a=void 0===o?{}:o,i=e.status,u=void 0===i?200:i,f=Promise.resolve(r),l={headers:c(a),ok:u>=200&&u<300,status:u,arrayBuffer:function(){return n((function*(){return yield f.then((function(e){return"string"==typeof e?s.parse(e).buffer:e}))}))()},json:function(){return n((function*(){return yield l.text().then((function(e){return JSON.parse(e)}))}))()},text:function(){return n((function*(){return yield f.then((function(e){return"string"==typeof e?e:s.stringify(new Uint8Array(e))}))}))()}};return l}function c(e){var t={forEach:function(t,r){for(var n=0,o=Object.keys(e);n<o.length;n++){var a=o[n];t.call(r,e[a],a)}},get:function(r){return t.has(r)?e[r]:null},has:function(t){return Object.prototype.hasOwnProperty.call(e,t)}};return t}t.hd=function(e){return function(){var t=n((function*(t,r){void 0===r&&(r={});var n=r,a=n.body,i=void 0===a?"":a,c=n.method,f=void 0===c?"GET":c,l=n.headers,d=void 0===l?{}:l,p=new URL(t),h=p.host,b={method:f,path:p.pathname+p.search,version:"HTTP/1.1",headers:o({},d,{host:h}),body:"string"==typeof i?s.parse(i):new Uint8Array(i)};return u(yield e(b))}));return function(e,r){return t.apply(this,arguments)}}()},t.O7=u,t.h6=function(e){for(var t={},r=0,n=Object.keys(e);r<n.length;r++){var o=n[r];t[o.toUpperCase()]=e[o]}null==t.OPTIONS&&(t.OPTIONS=function(){return{status:204,headers:a}});var a={"content-length":"0",allow:Object.keys(t).join(", ")};return function(e){var r=t[e.method];return null!=r?r(e):{status:405,headers:a}}},t.Fl=function(e,t){void 0===t&&(t=function(){return{status:404}});for(var r=[],n=0,o=Object.keys(e);n<o.length;n++){var a=o[n];r.push({regexp:new RegExp("^"+a+"$"),server:e[a]})}return function(e){for(var n,o=i(r);!(n=o()).done;){var a=n.value,s=a.regexp,u=a.server;if(s.test(e.path))return u(e)}return t(e)}},t.o3=function(e){return function(){var t=n((function*(t){var r=yield e(t),n=r.headers;return o({},r,{headers:o({},void 0===n?{}:n,{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"Accept, Authorization, Content-Type","Access-Control-Allow-Methods":"DELETE, GET, OPTIONS, POST, PUT"})})}));return function(e){return t.apply(this,arguments)}}()}},2956:function(e,t){"use strict";function r(){var e=[],t=!1;function r(){t&&(t=!1,e=e.slice())}return[function(t){r(),e.push(t);var n=!0;return function(){n&&(n=!1,r(),e.splice(e.indexOf(t),1))}},function(r){t=!0;for(var n=e,o=0;o<n.length;++o)n[o](r);t=!1}]}t.BU=r,t.j6=function(){var e={};return[function(t,n){var o=e[t];return null==o&&(o=e[t]=r()),o[0](n)},function(t,r){var n=e[t];null!=n&&n[1](r)}]}},6601:function(){},9214:function(){},7061:function(e,t,r){var n=r(8698).default;function o(){"use strict";e.exports=o=function(){return r},e.exports.__esModule=!0,e.exports.default=e.exports;var t,r={},a=Object.prototype,i=a.hasOwnProperty,s=Object.defineProperty||function(e,t,r){e[t]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",f=u.asyncIterator||"@@asyncIterator",l=u.toStringTag||"@@toStringTag";function d(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(t){d=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof w?t:w,a=Object.create(o.prototype),i=new C(n||[]);return s(a,"_invoke",{value:_(e,r,i)}),a}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=p;var b="suspendedStart",v="suspendedYield",y="executing",g="completed",m={};function w(){}function x(){}function k(){}var I={};d(I,c,(function(){return this}));var O=Object.getPrototypeOf,E=O&&O(O(N([])));E&&E!==a&&i.call(E,c)&&(I=E);var S=k.prototype=w.prototype=Object.create(I);function A(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function r(o,a,s,u){var c=h(e[o],e,a);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==n(l)&&i.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,s,u)}),(function(e){r("throw",e,s,u)})):t.resolve(l).then((function(e){f.value=e,s(f)}),(function(e){return r("throw",e,s,u)}))}u(c.arg)}var o;s(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(a,a):a()}})}function _(e,r,n){var o=b;return function(a,i){if(o===y)throw new Error("Generator is already running");if(o===g){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var s=n.delegate;if(s){var u=P(s,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===b)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var c=h(e,r,n);if("normal"===c.type){if(o=n.done?g:v,c.arg===m)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=g,n.method="throw",n.arg=c.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var a=h(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,m;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function M(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(M,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return x.prototype=k,s(S,"constructor",{value:k,configurable:!0}),s(k,"constructor",{value:x,configurable:!0}),x.displayName=d(k,l,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,k):(e.__proto__=k,d(e,l,"GeneratorFunction")),e.prototype=Object.create(S),e},r.awrap=function(e){return{__await:e}},A(T.prototype),d(T.prototype,f,(function(){return this})),r.AsyncIterator=T,r.async=function(e,t,n,o,a){void 0===a&&(a=Promise);var i=new T(p(e,t,n,o),a);return r.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},A(S),d(S,l,"Generator"),d(S,c,(function(){return this})),d(S,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=N,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),j(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},r}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},8698:function(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4687:function(e,t,r){var n=r(7061)();e.exports=n;try{regeneratorRuntime=n}catch(o){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},5352:function(e,t){"use strict";function r(e,t,r){var n;if(void 0===r&&(r={}),!t.codes){t.codes={};for(var o=0;o<t.chars.length;++o)t.codes[t.chars[o]]=o}if(!r.loose&&e.length*t.bits&7)throw new SyntaxError("Invalid padding");for(var a=e.length;"="===e[a-1];)if(--a,!(r.loose||(e.length-a)*t.bits&7))throw new SyntaxError("Invalid padding");for(var i=new(null!=(n=r.out)?n:Uint8Array)(a*t.bits/8|0),s=0,u=0,c=0,f=0;f<a;++f){var l=t.codes[e[f]];if(void 0===l)throw new SyntaxError("Invalid character "+e[f]);u=u<<t.bits|l,(s+=t.bits)>=8&&(s-=8,i[c++]=255&u>>s)}if(s>=t.bits||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return i}function n(e,t,r){void 0===r&&(r={});for(var n=r.pad,o=void 0===n||n,a=(1<<t.bits)-1,i="",s=0,u=0,c=0;c<e.length;++c)for(u=u<<8|255&e[c],s+=8;s>t.bits;)s-=t.bits,i+=t.chars[a&u>>s];if(s&&(i+=t.chars[a&u<<t.bits-s]),o)for(;i.length*t.bits&7;)i+="=";return i}Object.defineProperty(t,"__esModule",{value:!0});var o={chars:"0123456789ABCDEF",bits:4},a={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bits:5},i={chars:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bits:5},s={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bits:6},u={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bits:6},c={parse:function(e,t){return r(e.toUpperCase(),o,t)},stringify:function(e,t){return n(e,o,t)}},f={parse:function(e,t){return void 0===t&&(t={}),r(t.loose?e.toUpperCase().replace(/0/g,"O").replace(/1/g,"L").replace(/8/g,"B"):e,a,t)},stringify:function(e,t){return n(e,a,t)}},l={parse:function(e,t){return r(e,i,t)},stringify:function(e,t){return n(e,i,t)}},d={parse:function(e,t){return r(e,s,t)},stringify:function(e,t){return n(e,s,t)}},p={parse:function(e,t){return r(e,u,t)},stringify:function(e,t){return n(e,u,t)}},h={parse:r,stringify:n};t.base16=c,t.base32=f,t.base32hex=l,t.base64=d,t.base64url=p,t.codec=h},8597:function(e){"use strict";e.exports={i8:"6.5.4"}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},function(){"use strict";function e(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(c){return void r(c)}s.done?t(u):Promise.resolve(u).then(n,o)}function t(t){return function(){var r=this,n=arguments;return new Promise((function(o,a){var i=t.apply(r,n);function s(t){e(i,o,a,s,u,"next",t)}function u(t){e(i,o,a,s,u,"throw",t)}s(void 0)}))}}function n(e){if(Array.isArray(e))return e}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function a(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,t){return n(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return s}}(e,t)||a(e,t)||i()}var u=r(4687),c=r.n(u),f=(r(5136),r(3715)),l=r.n(f),d=r(2156),p=r.n(d);function h(e,t,r){var n;if(void 0===r&&(r={}),!t.codes){t.codes={};for(var o=0;o<t.chars.length;++o)t.codes[t.chars[o]]=o}if(!r.loose&&e.length*t.bits&7)throw new SyntaxError("Invalid padding");for(var a=e.length;"="===e[a-1];)if(--a,!(r.loose||(e.length-a)*t.bits&7))throw new SyntaxError("Invalid padding");for(var i=new(null!=(n=r.out)?n:Uint8Array)(a*t.bits/8|0),s=0,u=0,c=0,f=0;f<a;++f){var l=t.codes[e[f]];if(void 0===l)throw new SyntaxError("Invalid character "+e[f]);u=u<<t.bits|l,(s+=t.bits)>=8&&(s-=8,i[c++]=255&u>>s)}if(s>=t.bits||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return i}function b(e,t,r){void 0===r&&(r={});for(var n=r.pad,o=void 0===n||n,a=(1<<t.bits)-1,i="",s=0,u=0,c=0;c<e.length;++c)for(u=u<<8|255&e[c],s+=8;s>t.bits;)s-=t.bits,i+=t.chars[a&u>>s];if(s&&(i+=t.chars[a&u<<t.bits-s]),o)for(;i.length*t.bits&7;)i+="=";return i}var v={chars:"0123456789ABCDEF",bits:4},y={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bits:5},g={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bits:6},m={parse:function(e,t){return h(e.toUpperCase(),v,t)},stringify:function(e,t){return b(e,v,t)}},w={parse:function(e,t){return void 0===t&&(t={}),h(t.loose?e.toUpperCase().replace(/0/g,"O").replace(/1/g,"L").replace(/8/g,"B"):e,y,t)},stringify:function(e,t){return b(e,y,t)}},x={parse:function(e,t){return h(e,g,t)},stringify:function(e,t){return b(e,g,t)}},k=r(7716);const I=k.hd,O=k.O7,E=k.h6,S=k.Fl;k.o3;function A(){return A=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},A.apply(this,arguments)}var T="_yaob",_=1,P={};function M(e,t){Object.prototype.hasOwnProperty.call(e,T)?A(e[T],t):Object.defineProperty(e,T,{value:t})}function j(e){var t=e.prototype;if(!Object.prototype.hasOwnProperty.call(t,T)){M(t,{})}return e}function C(e){Object.prototype.hasOwnProperty.call(e,T)&&null!=e[T].localId||M(e,{localId:_++,bridges:[],listeners:{},watchers:{}});return e}function N(e){if(null==e[T])throw new TypeError("Not a bridgeable object");return C(e),e[T]}function D(e,t){null==t?t="":t+=".";for(var r=0,n=Object.getOwnPropertyNames(e);r<n.length;r++){var o=n[r],a=t+o;if(null!=P[a])throw new Error("A shared value named "+a+" already exists");P[a]=e[o],M(e[o],{shareId:a})}}function R(e,t){try{var r=K(e,t),n=U(e,r,t);return""!==r?{map:r,raw:n}:{raw:n}}catch(t){return B(e,t)}}function B(e,t){var r=K(e,t);return{map:r,raw:U(e,r,t),throw:!0}}function L(e,t,r,n){void 0===n&&(n=!1);var o=t.map,a=t.raw,i=null!=o?F(e,o,a,r,n):a;if(t.throw)throw i;return i}function K(e,t){switch(typeof t){case"boolean":case"number":case"string":return"";case"object":if(null===t)return"";if(t instanceof Date)return"d";if(t instanceof Error)return"e";if(t instanceof ArrayBuffer)return"ab";if(t instanceof Uint8Array)return"u8";if(t instanceof Map)return"M";if(t instanceof Set)return"S";if(null!=t[T])return null!=t[T].shareId?"s":"o";if(Array.isArray(t)){for(var r="",n=0;n<t.length;++n){var o=K(e,t[n]);if(""!==o&&""===r){r=[];for(var a=0;a<n;++a)r[a]=""}""!==r&&(r[n]=o)}return r}var i="";for(var s in t){var u=K(e,t[s]);""!==u&&(""===i&&(i={}),i[s]=u)}return i;case"undefined":return"u";case"function":return null!=t[T]&&null!=t[T].shareId?"s":"?";default:return"?"}}function U(e,t,r){switch(t){case"":return r;case"?":return typeof r;case"d":return r.toISOString();case"e":return function(e,t){var r=A({message:t.message,stack:t.stack},t),n=null;return t instanceof EvalError?n="EvalError":t instanceof RangeError?n="RangeError":t instanceof ReferenceError?n="ReferenceError":t instanceof SyntaxError?n="SyntaxError":t instanceof TypeError?n="TypeError":t instanceof URIError&&(n="URIError"),A({base:n},R(e,r))}(e,r);case"o":return e.getPackedId(r);case"s":return r[T].shareId;case"u":return null;case"ab":return x.stringify(new Uint8Array(r));case"u8":return x.stringify(r);case"M":return R(e,Array.from(r.entries()));case"S":return R(e,Array.from(r.values()));default:if(Array.isArray(t)){for(var n=[],o=0;o<t.length;++o)n[o]=U(e,t[o],r[o]);return n}var a={};for(var i in r)a[i]=i in t?U(e,t[i],r[i]):r[i];return a}}function F(e,t,r,n,o){switch(t){case"":return r;case"?":throw new TypeError("Unsupported value of type "+("string"==typeof r?r:"?")+" at "+n);case"d":return new Date(r);case"e":if("object"!=typeof r||null===r)throw new TypeError("Expecting an error description at "+n);return function(e,t,r){var n={EvalError:EvalError,RangeError:RangeError,ReferenceError:ReferenceError,SyntaxError:SyntaxError,TypeError:TypeError,URIError:URIError},o=new(null!=t.base&&n[t.base]||Error),a=L(e,t,r,!0);for(var i in a)o[i]=a[i];return o}(e,r,n);case"o":if(null===r)throw new TypeError("Closed bridge object at "+n);if("number"!=typeof r)throw new TypeError("Expecting a packedId at "+n);var a=e.getObject(-r);if(null==a)throw new RangeError("Invalid packedId "+r+" at "+n);return a;case"s":if("string"!=typeof r)throw new TypeError("Expecting a shareId at "+n);var i=P[r];if(null==i)throw new RangeError("Invalid shareId '"+r+"' at "+n);return i;case"u":return;case"ab":if("string"!=typeof r)throw new TypeError("Expecting a base64 string at "+n);return x.parse(r).buffer;case"u8":if("string"!=typeof r)throw new TypeError("Expecting a base64 string at "+n);return x.parse(r);case"M":if("object"!=typeof r||null===r)throw new TypeError("Expecting an Map description at "+n);return new Map(L(e,r,n));case"S":if("object"!=typeof r||null===r)throw new TypeError("Expecting an Set description at "+n);return new Set(L(e,r,n));default:if("object"!=typeof t||null===t)throw new TypeError("Invalid type information "+t+" at "+n);if("object"!=typeof r||null===r)throw new TypeError("Expecting an array or object at "+n);if(Array.isArray(t)){if(!Array.isArray(r))throw new TypeError("Expecting an array at "+n);for(var s=[],u=0;u<t.length;++u)!0===o&&"?"===t[u]||(s[u]=F(e,t[u],r[u],n+"["+u+"]",o));return s}var c={};for(var f in r)!0===o&&"?"===t[f]||(c[f]=f in t?F(e,t[f],r[f],n+"."+f,o):r[f]);return c}}var W={};function q(e,t,r){var n=N(e),o=n.closed,a=n.listeners;return o?function(){}:(null==a[t]?a[t]=[r]:a[t].push(r),function(){a[t]=a[t].filter((function(e){return e!==r}))})}function z(e){var t=N(e),r=t.listeners.close;if(null!=r)for(var n=0;n<r.length;n++){Y(e,r[n],void 0,!0)}t.closed=!0;for(var o=0,a=t.bridges;o<a.length;o++){a[o].emitClose(t.localId)}t.bridges=[],t.listeners={},t.watchers={}}function G(e,t,r){var n=N(e);if(n.closed)throw new Error("Cannot emit event on closed object");for(var o=0,a=n.bridges;o<a.length;o++){a[o].emitEvent(n.localId,t,r)}var i=n.listeners[t];if(null!=i)for(var s=0;s<i.length;s++){Y(e,i[s],r,"error"!==t)}}function H(e,t){var r=N(e);if(r.closed)throw new Error("Cannot update closed object");for(var n=0,o=r.bridges;n<o.length;n++){o[n].markDirty(r.localId,t)}for(var a in null!=t&&null!=r.watchers[t]&&(r.watchers[t].data=W),r.watchers){var i=r.watchers[a];try{var s=e[a];if(s!==i.data){i.data=s;for(var u=0,c=i.fs;u<c.length;u++){Y(e,c[u],i.data,!0)}}}catch(f){}}}function Y(e,t,r,n){try{var o=t(r);n&&null!=o&&"function"==typeof o.then&&o.then(void 0,(function(t){return G(e,"error",t)}))}catch(a){n&&G(e,"error",a)}}var J={};function V(e,t,r){var n=!1,o={};for(var a in r)try{var i=t[a];i!==r[a]&&(n=!0,o[a]=R(e,i),r[a]=i)}catch(s){o[a]=B(e,s),r[a]=J}return{dirty:n,props:o}}function X(e,t){var r,n={},o=(r=t.localId,{localId:_++,bridges:[],listeners:{},watchers:{},remoteId:r,errors:{},props:{}});for(var a in n[T]={value:o},t.props)n[a]={enumerable:e.hideProperties.indexOf(a)<0,get:Z(o,a)};for(var i=0,s=t.methods;i<s.length;i++){var u=s[i];n[u]={value:Q(e,o,u)}}return Object.create(Object.prototype,n)}function $(e,t,r){var n=t[T];for(var o in r)try{n.props[o]=L(e,r[o],o),n.errors[o]=!1}catch(a){n.props[o]=a,n.errors[o]=!0}}function Z(e,t){return function(){if(e.errors[t])throw e.props[t];return e.props[t]}}function Q(e,t,r){return function(){if(t.closed)return Promise.reject(new TypeError("Cannot call method '"+r+"' of closed proxy"));for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return e.emitCall(t.remoteId,r,o)}}var ee=function(){function e(e){var t=e.hideProperties,r=void 0===t?[]:t,n=e.sendMessage,o=e.throttleMs,a=void 0===o?0:o;this.hideProperties=r,this.sendMessage=n,this.throttleMs=a,this.proxies={},this.objects={},this.caches={},this.nextCallId=0,this.pendingCalls={},this.dirty={},this.message={},this.lastUpdate=0,this.sendPending=!1}var t=e.prototype;return t.close=function(e){for(var t in this.pendingCalls){this.pendingCalls[Number(t)].reject(e)}for(var r in this.proxies)z(this.proxies[Number(r)]);this.closed=!0},t.getObject=function(e){return e<0?this.proxies[-e]:this.objects[e]},t.getPackedId=function(e){var t=N(e);if(t.closed)return null;if(null!=t.remoteId&&null!=this.proxies[t.remoteId])return-t.remoteId;if(null==this.objects[t.localId]){this.objects[t.localId]=e;var r=function(e,t){for(var r={},n=Object.prototype,o=t;o!==n&&null!=o;o=Object.getPrototypeOf(o))for(var a=0,i=Object.getOwnPropertyNames(o);a<i.length;a++){var s=i[a];s===T||/^_/.test(s)||"constructor"===s||(r[s]=!0)}var u={},c=[],f={};for(var l in r)try{var d=t[l];"function"!=typeof d||null!=d[T]&&null!=d[T].shareId?(u[l]=d,f[l]=R(e,d)):c.push(l)}catch(p){u[l]=J,f[l]=B(e,p)}return{cache:u,create:{localId:N(t).localId,methods:c,props:f}}}(this,e),n=r.cache,o=r.create;this.caches[t.localId]=n,t.bridges.push(this),this.emitCreate(o,e)}return t.localId},t.markDirty=function(e,t){var r=this.caches[e];null!=t&&t in r&&(r[t]=J),this.dirty[e]={cache:r,object:this.objects[e]},this.wakeup()},t.emitClose=function(e){delete this.objects[e],delete this.caches[e],null==this.message.closed&&(this.message.closed=[]),this.message.closed.push(e),this.wakeup()},t.emitCreate=function(e,t){null==this.message.created&&(this.message.created=[]),this.message.created.push(e)},t.emitCall=function(e,t,r){var n=this,o=this.nextCallId++,a=A({callId:o,remoteId:e,name:t},R(this,r));return null==this.message.calls&&(this.message.calls=[]),this.message.calls.push(a),this.wakeup(),new Promise((function(e,r){n.pendingCalls[o]={name:t,resolve:e,reject:r}}))},t.emitEvent=function(e,t,r){var n=A({localId:e,name:t},R(this,r));null==this.message.events&&(this.message.events=[]),this.message.events.push(n),this.wakeup()},t.emitReturn=function(e,t,r){var n=A({callId:e},t?B(this,r):R(this,r));null==this.message.returns&&(this.message.returns=[]),this.message.returns.push(n),this.wakeup()},t.handleMessage=function(e){var t=this;if(e.created){for(var r=0,n=e.created;r<n.length;r++){var o=n[r];this.proxies[o.localId]=X(this,o)}for(var a=0,i=e.created;a<i.length;a++){var s=i[a];$(this,this.proxies[s.localId],s.props)}}if(e.changed){for(var u=0,c=e.changed;u<c.length;u++){var f=c[u],l=f.localId,d=f.props,p=this.proxies[l];if(null==p)throw new RangeError("Invalid localId "+l);$(this,p,d)}for(var h=0,b=e.changed;h<b.length;h++){var v=b[h];H(this.proxies[v.localId])}}if(e.events)for(var y=0,g=e.events;y<g.length;y++){var m=g[y],w=m.localId,x=m.name,k=0===w?this:this.proxies[w];if(null!=k)try{G(k,x,L(this,m,x))}catch(D){G(k,"error",D)}}if(e.calls)for(var I=function(e,r){var n=r[e],o=n.callId,a=n.remoteId,i=n.name;try{var s=t.objects[a];if(null==s)throw new TypeError("Cannot call method '"+i+"' of closed proxy (remote)");if("function"!=typeof s[i])throw new TypeError("'"+i+"' is not a function");var u=L(t,n,i+".arguments");Promise.resolve(s[i].apply(s,u)).then((function(e){return t.emitReturn(o,!1,e)}),(function(e){return t.emitReturn(o,!0,e)}))}catch(D){t.emitReturn(o,!0,D)}},O=0,E=e.calls;O<E.length;O++)I(O,E);if(e.returns)for(var S=0,A=e.returns;S<A.length;S++){var T=A[S],_=T.callId,P=this.pendingCalls[_];if(null==P)throw new RangeError("Invalid callId "+_);try{P.resolve(L(this,T,P.name+".return"))}catch(D){P.reject(D)}finally{delete this.pendingCalls[_]}}if(e.closed)for(var M=0,j=e.closed;M<j.length;M++){var C=j[M],N=this.proxies[C];if(null==N)return;delete this.proxies[C],z(N)}},t.sendNow=function(){if(!this.closed){for(var e in this.dirty){var t=Number(e),r=this.dirty[t],n=V(this,r.object,r.cache),o=n.dirty,a=n.props;if(o){var i={localId:t,props:a};null==this.message.changed&&(this.message.changed=[]),this.message.changed.push(i)}}var s=this.message;this.dirty={},this.message={},null==s.calls&&null==s.changed&&null==s.closed&&null==s.created&&null==s.events&&null==s.returns||this.sendMessage(s)}},t.wakeup=function(){var e=this;if(!this.sendPending){this.sendPending=!0;var t=this.lastUpdate+this.throttleMs-Date.now();setTimeout((function(){e.sendPending=!1,e.lastUpdate=Date.now(),e.sendNow()}),t<0?0:t)}},e}();j(ee);var te=function(){function e(e){var t=this;this._state=new ee(e),this._rootPromise=new Promise((function(e){return q(t._state,"root",e)}))}var t=e.prototype;return t.handleMessage=function(e){this._state.handleMessage(e)},t.getRoot=function(){return this._rootPromise},t.sendRoot=function(e){this._state.emitEvent(0,"root",e)},t.close=function(e){this._state.close(e)},e}();var re=function(e,t){return q(this,e,t)},ne=function(e,t){return function(e,t,r){var n=N(e),o=n.closed,a=n.watchers,i=e[t];return o?function(){}:(null==a[t]?a[t]={data:i,fs:[r]}:a[t].fs.push(r),function(){a[t].fs=a[t].fs.filter((function(e){return e!==r}))})}(this,e,t)};D({onMethod:re,watchMethod:ne});var oe=function(){function e(){}var t=e.prototype;return t._close=function(){z(this)},t._emit=function(e,t){return G(this,e,t)},t._update=function(e){H(this,e)},e}(),ae=oe.prototype;ae.on=re,ae.watch=ne,j(oe);var ie=r(4638);r(7635);function se(e){return se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},se(e)}function ue(e){var t=function(e,t){if("object"!==se(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==se(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===se(t)?t:String(t)}function ce(e,t,r){return(t=ue(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function le(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ue(n.key),n)}}function de(e,t,r){return t&&le(e.prototype,t),r&&le(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var pe=function(){function e(){fe(this,e)}return de(e,[{key:"getFirstWalletInfo",value:function(e){return this.allKeys.find((function(t){return t.type===e}))}},{key:"getWalletInfo",value:function(e){return this.allKeys.find((function(t){return t.id===e}))}},{key:"listWalletIds",value:function(){return this.allKeys.map((function(e){return e.id}))}}]),e}();function he(e){var t=e.length<10,r=!/[0-9]/.test(e),n=!/[a-z]/.test(e),o=!/[A-Z]/.test(e),a=(/[0-9]/.test(e)?10:0)+(/[A-Z]/.test(e)?26:0)+(/[a-z]/.test(e)?26:0)+(/[^0-9A-Za-z]/.test(e)?30:0);return{secondsToCrack:Math.pow(a,e.length)/1e6,tooShort:t,noNumber:r,noLowerCase:n,noUpperCase:o,passed:e.length>=16||!(t||r||o||n)}}function be(e){for(var t=e.toLowerCase().replace(/[ \f\r\n\t\v]+/g," ").replace(/ $/,"").replace(/^ /,""),r=0;r<t.length;++r){var n=t.charCodeAt(r);if(n<32||n>126)throw new Error("Bad characters in username")}return t}function ve(e){var r,n,o,a=this,i=!1,s=ce({next:(o=t(c().mark((function t(){var n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=r){t.next=4;break}return t.next=3,a.$internalStreamTransactions(e);case 3:r=t.sent;case 4:if(i){t.next=12;break}return t.next=7,r.next();case 7:if((n=t.sent).done){t.next=10;break}return t.abrupt("return",n);case 10:z(r),i=!0;case 12:return t.abrupt("return",{done:!0,value:void 0});case 13:case"end":return t.stop()}}),t)}))),function(){return o.apply(this,arguments)}),return:(n=t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return null==r||i||(z(r),i=!0),e.abrupt("return",{done:!0,value:void 0});case 2:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})},Symbol.asyncIterator,(function(){return s}));return s}function ye(e){switch(typeof e){case"function":case"object":return null==e?"null":Array.isArray(e)?"array":typeof e;case"string":return JSON.stringify(e);default:return String(e)}}function ge(e,t){return function(r){return null!=r?e(r):"function"==typeof t?t():t}}function me(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){for(var r=0;r<t.length;++r)if(e===t[r])return e;var n="Expected ";1!==t.length&&(n+="one of: ");for(var o=0;o<t.length;++o)o>0&&(n+=" | "),n+=JSON.stringify(t[o]);throw n+=", got "+ye(e),new TypeError(n)}}function we(e){if("boolean"!=typeof e)throw new TypeError("Expected a boolean, got "+ye(e));return e}function xe(e){if("number"!=typeof e)throw new TypeError("Expected a number, got "+ye(e));return e}function ke(e){if("string"!=typeof e)throw new TypeError("Expected a string, got "+ye(e));return e}D(pe.prototype,"AccountSync"),D({checkPasswordRules:he}),D({fixUsername:be}),D({streamTransactions:ve},"CurrencyWalletSync");var Ie=me(null);me(void 0);function Oe(e){return e}ge(Ie);function Ee(e,t,r){return e instanceof Error&&(null==e.insertStepAt&&(e.message+=" at ",e.insertStepAt=e.message.length),e.message=e.message.slice(0,e.insertStepAt)+t+e.message.slice(e.insertStepAt),e.insertStepAt+=r),e}function Se(e){return function(t){if(!Array.isArray(t))throw new TypeError("Expected an array, got "+ye(t));for(var r=[],n=0;n<t.length;++n)try{r[n]=e(t[n])}catch(o){throw Ee(o,"["+n+"]",0)}return r}}function Ae(e){if("function"==typeof e)return function(t){if("object"!=typeof t||null==t)throw new TypeError("Expected an object, got "+ye(t));for(var r={},n=Object.keys(t),o=0;o<n.length;++o){var a=n[o];if("__proto__"!==a)try{r[a]=e(t[a])}catch(i){throw Ee(i,"["+JSON.stringify(a)+"]",0)}}return r};var t=Object.keys(e);function r(r){return function(n){if("object"!=typeof n||null==n)throw new TypeError("Expected an object, got "+ye(n));var o,a={};if(r){var i=Object.keys(n);for(o=0;o<i.length;++o){var s=i[o];"__proto__"!==s&&(a[s]=n[s])}}for(o=0;o<t.length;++o){var u=t[o];try{a[u]=e[u](n[u])}catch(c){throw Ee(c,"."+u,0)}}return a}}var n=r(!1);return n.shape=e,n.withRest=r(!0),n}function Te(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){for(var r=0;r<t.length;r++)try{return t[r](e)}catch(n){if(r+1>=t.length)throw n}}}function _e(e,t){return function(r){try{return e(r)}catch(n){return"function"==typeof t?t():t}}}function Pe(e,t){return function(r){return je[Ce]>0?t(r):e(r)}}function Me(e){return function(t){null==je[Ce]&&Object.defineProperty(je,Ce,{value:0,writable:!0});try{return++je[Ce],e(t)}finally{--je[Ce]}}}var je="object"==typeof globalThis&&null!=globalThis?globalThis:JSON,Ce="function"==typeof Symbol?Symbol.for("uncleaning"):"uncleaning",Ne=Pe((function(e){if("string"!=typeof e&&!(e instanceof Date))throw new TypeError("Expected a date string, got "+ye(e));var t=new Date(e);if(null==t.toJSON())throw new TypeError("Invalid date format, got "+ye(e));return t}),(function(e){return e.toISOString()}));var De=Pe((function(e){return m.parse(ke(e))}),(function(e){return m.stringify(e).toLowerCase()})),Re=Pe((function(e){return w.parse(ke(e),{loose:!0})}),(function(e){return w.stringify(e,{pad:!1})})),Be=Pe((function(e){return x.parse(ke(e))}),(function(e){return x.stringify(e)})),Le=Ae({voucherId:ke,activates:Ne,created:Ne,ip:ke,ipDescription:ke,deviceDescription:ge(ke)}),Ke=Ae({encryptionType:xe,data_base64:Be,iv_hex:De}),Ue=Ae({created:ge(Ne),data_base64:Be,encryptionType:xe,iv_hex:De}),Fe=Ae({salt_hex:De,n:xe,r:xe,p:xe}),We=Ae({loginRequest:ge(Ae({appId:ke}).withRest),publicKey:Be,timeout:ge(xe)}).withRest,qe=Ae({publicKey:Be,box:Ke}),ze=Se(Be),Ge=Ae({data:Oe,challengeId:ge(ke),deviceDescription:ge(ke),otp:ge(ke),syncToken:ge(ke),voucherId:ge(ke),voucherAuth:ge(Be),loginId:ge(Be),loginAuth:ge(Be),userId:ge(Be),passwordAuth:ge(Be),pin2Id:ge(Be),pin2Auth:ge(Be),recovery2Id:ge(Be),recovery2Auth:ge(ze),loginIds:ge(Se(Be)),otpResetAuth:ge(ke),did:ge(ke),l1:ge(Be),lp1:ge(Be),lpin1:ge(Be),lra1:ge(Be),recoveryAuth:ge(Be)}),He=Ae({results:ge(Oe),status_code:xe,message:ke}),Ye=Ae({otpTimeout:ge(xe,604800),otpKey:Re}),Je=Ae({passwordAuth:Be,passwordAuthBox:Ke,passwordAuthSnrp:Fe,passwordBox:Ke,passwordKeySnrp:Fe}),Ve=Ae({pin2Id:Be}),Xe=Ae({pin2Id:ge(Be),pin2Auth:ge(Be),pin2Box:ge(Ke),pin2KeyBox:ge(Ke),pin2TextBox:Ke}),$e=Ae({recovery2Id:Be}),Ze=Ae({recovery2Id:Be,recovery2Auth:ze,recovery2Box:Ke,recovery2KeyBox:Ke,question2Box:Ke}),Qe=Ae({loginAuthBox:Ke,loginAuth:Be}),et=Ae({userId:Be,userTextBox:Ke}),tt=Ae({approvedVouchers:ge(Se(ke)),rejectedVouchers:ge(Se(ke))}),rt=Ae({keyBoxes:Se(Ke),newSyncKeys:ge(Se(ke),(function(){return[]}))}),nt=Ae({appId:ke,loginId:Be,parentBox:ge(Ke)}),ot=Ae({challengeId:ke,challengeUri:ke}),at=Ae({challengeId:ke,challengeUri:ge(ke)}),it=Ae({request:We,replies:Se(qe)}),st=me(!0),ut=Ae({appId:ke,created:Ne,loginId:Be,syncToken:ge(ke),children:ge(Se((function(e){return ut(e)}))),parentBox:ge(Ke),otpKey:ge(Te(st,Re)),otpResetDate:ge(Ne),otpTimeout:ge(xe),passwordAuthBox:ge(Ke),passwordAuthSnrp:ge(Fe),passwordBox:ge(Te(st,Ke)),passwordKeySnrp:ge(Fe),pin2Box:ge(Te(st,Ke)),pin2KeyBox:ge(Ke),pin2TextBox:ge(Ke),question2Box:ge(Ke),recovery2Box:ge(Te(st,Ke)),recovery2KeyBox:ge(Ke),loginAuthBox:ge(Ke),userId:ge(Be),userTextBox:ge(Ke),pendingVouchers:ge(Se(Le),(function(){return[]})),keyBoxes:ge(Se(Ue)),mnemonicBox:ge(Ke),rootKeyBox:ge(Ke),syncKeyBox:ge(Ke)}),ct=Se(Ae({loginId:Be,otpResetPending:ge(we,!1),pendingVouchers:ge(Se(Le),(function(){return[]})),recovery2Corrupt:ge(we,!1)})),ft=Ae({login_id:ge(Be),otp_reset_auth:ge(ke),otp_timeout_date:ge(Ne),reason:ge(me("ip","otp"),"otp"),voucher_activates:ge(Ne),voucher_auth:ge(Be),voucher_id:ge(ke)}),lt=Ae({otpResetDate:Ne}),dt=Ae({wait_seconds:ge(xe)}),pt=Ae({question2Box:Ke}),ht=Ae({loginId:Be,passwordAuthSnrp:ge(Fe),questionBox:ge(Ke),questionKeySnrp:ge(Fe),recoveryAuthSnrp:ge(Fe)}),bt=Me(Ke),vt=Me(qe),yt=Me(We),gt=Me(Ge),mt=Me(He),wt=Me(Ye),xt=Me(Je),kt=Me(Ve),It=Me(Xe),Ot=Me($e),Et=Me(Ze),St=Me(Qe),At=Me(et),Tt=Me(tt),_t=Me(rt),Pt=Me(nt),Mt=(Me(ot),Me(at),Me(it)),jt=Me(ut),Ct=Me(ct),Nt=Me(ft),Dt=Me(lt),Rt=Me(dt),Bt=Me(pt),Lt=Me(ht),Kt=Ae(Ke),Ut=Ae({loginId:Be,voucherAuth:Be,voucherId:ke,created:Ne,activates:Ne,status:me("pending","approved","rejected"),ip:ke,ipDescription:ke,deviceDescription:ge(ke)}),Ft=Ae({appId:ke,created:ge(Ne,(function(){return new Date})),loginId:Be,children:ge(Se((function(e){return Ft(e)})),(function(){return[]})),parentBox:ge(Ke),parentId:function(){},otpKey:ge(Re),otpResetAuth:ge(ke),otpResetDate:ge(Ne),otpTimeout:ge(xe),passwordAuth:ge(Be),passwordAuthBox:ge(Ke),passwordAuthSnrp:ge(Fe),passwordBox:ge(Ke),passwordKeySnrp:ge(Fe),pin2Id:ge(Be),pin2Auth:ge(Be),pin2Box:ge(Ke),pin2KeyBox:ge(Ke),pin2TextBox:ge(Ke),recovery2Id:ge(Be),recovery2Auth:ge(ze),question2Box:ge(Ke),recovery2Box:ge(Ke),recovery2KeyBox:ge(Ke),loginAuth:ge(Be),loginAuthBox:ge(Ke),userId:ge(Be),userTextBox:ge(Ke),keyBoxes:ge(Se(Ue),(function(){return[]})),mnemonicBox:ge(Ke),rootKeyBox:ge(Ke),syncKeyBox:ge(Ke),vouchers:ge(Se(Ut),(function(){return[]})),pinBox:ge(Ke),pinId:ge(ke),pinKeyBox:ge(Ke)}),Wt=Me(Ft),qt=Me(Kt),zt=r(8162),Gt=r.n(zt)()("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),Ht={parse:function(e){return Gt.decode(e)},stringify:function(e){return Gt.encode(e)}},Yt={parse:function(e){for(var t=encodeURI(e),r=new Uint8Array(t.length),n=0,o=0;o<t.length;++o){var a=t.charCodeAt(o);37===a?(r[n++]=parseInt(t.slice(o+1,o+3),16),o+=2):r[n++]=a}return r.subarray(0,n)},stringify:function(e){for(var t="",r=0;r<e.length;++r){var n=e[r];t+="%"+(n>>4).toString(16)+(15&n).toString(16)}return decodeURIComponent(t)}};function Jt(e){var t=new URL(e);if("http:"!==t.protocol||"localhost"!==t.hostname){if("https:"===t.protocol){if("localhost"===t.hostname)return;if(/^([A-Za-z0-9_-]+\.)*edge(test)?\.app$/.test(t.hostname))return}throw new Error("Only *.edge.app or localhost are valid login domain names, not ".concat(t.hostname))}}function Vt(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Login requires a CAPTCHA";if(!(this instanceof Vt))throw new TypeError("Class constructor ChallengeError cannot be invoked without 'new'");return function(e){t=new Error(e),Object.defineProperty(t,"constructor",{value:Vt,configurable:!0,writable:!0})}(r),t.name="ChallengeError",t.challengeId=e.challengeId,t.challengeUri=e.challengeUri,t}function Xt(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Cannot reach the network";if(!(this instanceof Xt))throw new TypeError("Class constructor NetworkError cannot be invoked without 'new'");return function(t){e=new Error(t),Object.defineProperty(e,"constructor",{value:Xt,configurable:!0,writable:!0})}(t),e.name="NetworkError",e}function $t(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"The application is too old. Please upgrade.";if(!(this instanceof $t))throw new TypeError("Class constructor ObsoleteApiError cannot be invoked without 'new'");return function(t){e=new Error(t),Object.defineProperty(e,"constructor",{value:$t,configurable:!0,writable:!0})}(t),e.name="ObsoleteApiError",e}function Zt(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Invalid OTP token";if(!(this instanceof Zt))throw new TypeError("Class constructor OtpError cannot be invoked without 'new'");!function(e){t=new Error(e),Object.defineProperty(t,"constructor",{value:Zt,configurable:!0,writable:!0})}(r),t.name="OtpError",t.reason="otp";var n=_e(ft)(e);if(null!=n)return null!=n.login_id&&(t.loginId=x.stringify(n.login_id)),t.resetToken=n.otp_reset_auth,t.reason=n.reason,t.resetDate=n.otp_timeout_date,t.voucherActivates=n.voucher_activates,null!=n.voucher_auth&&(t.voucherAuth=x.stringify(n.voucher_auth)),t.voucherId=n.voucher_id,t}function Qt(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Invalid password";if(!(this instanceof Qt))throw new TypeError("Class constructor PasswordError cannot be invoked without 'new'");!function(e){t=new Error(e),Object.defineProperty(t,"constructor",{value:Qt,configurable:!0,writable:!0})}(r),t.name="PasswordError";var n=_e(dt)(e);if(null!=n)return t.wait=n.wait_seconds,t}function er(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Invalid username";if(!(this instanceof er))throw new TypeError("Class constructor UsernameError cannot be invoked without 'new'");return function(t){e=new Error(t),Object.defineProperty(e,"constructor",{value:er,configurable:!0,writable:!0})}(t),e.name="UsernameError",e}function tr(e){return function(t){if(t instanceof Error&&t.name===e)return t}}tr("ChallengeError"),tr("DustSpendError");var rr=tr("InsufficientFundsError"),nr=(tr("NetworkError"),tr("NoAmountSpecifiedError"),tr("ObsoleteApiError"),tr("OtpError")),or=(tr("PasswordError"),tr("PendingFundsError")),ar=(tr("SameCurrencyError"),tr("SpendToSelfError"),tr("SwapAboveLimitError")),ir=tr("SwapBelowLimitError"),sr=tr("SwapCurrencyError"),ur=tr("SwapPermissionError"),cr=tr("UsernameError"),fr=r(8826);function lr(e,t){var r=l().hmac(l().sha256,t);return Uint8Array.from(r.update(e).digest())}function dr(e){var t=l().sha256();return Uint8Array.from(t.update(e).digest())}function pr(e,t){var r=e.length;if(r!==t.length)return!1;for(var n=0,o=0;o<r;++o)n|=e[o]^t[o];return 0===n}var hr=r.n(fr)().ModeOfOperation.cbc;function br(e,t){var r=vr(e,t);return 0===r[r.length-1]?Yt.stringify(r.subarray(0,-1)):Yt.stringify(r)}function vr(e,t){if(0!==e.encryptionType)throw new Error("Unknown encryption type");var r=e.iv_hex,n=e.data_base64,o=new hr(t,r).decrypt(n),a=1+o[0]+4,i=o[a-4]<<24|o[a-3]<<16|o[a-2]<<8|o[a-1],s=a+i+1,u=s+o[s-1],c=u+32;if(!pr(dr(o.subarray(0,u)),o.subarray(u,c)))throw new Error("Invalid checksum");if(!pr(gr(c),o.subarray(c)))throw new Error("Invalid PKCS7 padding");return o.subarray(a,a+i)}function yr(e,t,r){var n=31&e.random(1)[0],o=1+n+4,a=t.length,i=o+a+1,s=31&e.random(1)[0],u=i+s,c=u+32,f=gr(c),l=new Uint8Array(c+f.length);l.set(f,c),l[0]=n,l.set(e.random(n),1),l[o-4]=a>>24&255,l[o-3]=a>>16&255,l[o-2]=a>>8&255,l[o-1]=255&a,l.set(t,o),l[i-1]=s,l.set(e.random(s),i),l.set(dr(l.subarray(0,u)),u);var d=e.random(16);return{encryptionType:0,iv_hex:d,data_base64:new hr(r,d).encrypt(l)}}function gr(e){for(var t=new Uint8Array(16-(15&e)),r=0;r<t.length;++r)t[r]=t.length;return t}function mr(e,t,r){var n,o,a=function(e,t){var r=l().hmac(l().sha1,t);return Uint8Array.from(r.update(e).digest())}((n=t,o=Math.floor(n/4294967296),new Uint8Array([o>>24&255,o>>16&255,o>>8&255,255&o,n>>24&255,n>>16&255,n>>8&255,255&n])),e),i=15&a[19],s=((127&a[i])<<24|a[i+1]<<16|a[i+2]<<8|a[i+3]).toString();return(Array(r).join("0")+s).slice(-r)}function wr(e){return mr(e,(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now()/1e3)/30,6)}function xr(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.now,o=void 0===n?Date.now()/1e3:n,a=r.spread,i=void 0===a?1:a,s=o/30;if(t===mr(e,s,6))return!0;for(var u=1;u<=i;++u){if(t===mr(e,s-u,6))return!0;if(t===mr(e,s+u,6))return!0}return!1}function kr(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Ir(e){return function(e){if(Array.isArray(e))return o(e)}(e)||kr(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Or(){for(var e=[],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.concat.apply(e,Ir(r.filter((function(e){return null!=e}))))}function Er(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];Object.defineProperty(e,o,{writable:!0,configurable:!0,value:t[o]})}return e}function Sr(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Error("Timeout of ".concat(t,"ms exceeded"));return new Promise((function(n,o){var a=setTimeout((function(){return o(r)}),t);e.then((function(e){clearTimeout(a),n(e)}),(function(e){clearTimeout(a),o(e)}))}))}function Ar(e,t){return new Promise((function(r,n){var o=!1,a=[],i=[],s=setTimeout((function(){s=void 0,a.length>0&&(o=!0,r({results:a,errors:i}))}),t);function u(){var t=a.length+i.length===e.length;t&&null!=s&&clearTimeout(s),(t||null==s)&&(o=!0,a.length>0?r({results:a,errors:i}):n(i))}u();for(var c=0;c<e.length;c++){e[c].then((function(e){o||(a.push(e),u())}),(function(e){o||(i.push(e),u())}))}}))}function Tr(e){var t=He(e);switch(t.status_code){case 0:return t.results;case 2:throw new er("Account already exists on server");case 3:throw new er("Account does not exist on server");case 4:case 5:throw new Qt(t.results);case 6:throw new Error("Invalid API key");case 8:throw new Zt(t.results);case 1e3:throw new $t;default:var r=_e(ot)(t.results);if(null!=r)throw new Vt(r);throw new Error("Server error: ".concat(t.message))}}function _r(e,t,r,n){return Pr.apply(this,arguments)}function Pr(){return(Pr=t(c().mark((function e(t,r,n,o){var a,i,s,u,f,l,d,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=t.props.state.login.loginServers,i=Math.floor(255*Math.random()),u=new Error("No login servers available"),f=0;case 4:if(!(f<a.length)){e.next=19;break}return e.prev=5,l=(i+f)%a.length,e.next=9,Mr(t,a[l],r,n,o);case 9:return s=e.sent,e.abrupt("break",19);case 13:e.prev=13,e.t0=e.catch(5),u=e.t0;case 16:++f,e.next=4;break;case 19:if(null!=s){e.next=21;break}throw u;case 21:return d=s.status,e.next=24,s.json().catch((function(){throw new Error("Invalid reply JSON, HTTP status ".concat(d))}));case 24:return p=e.sent,e.abrupt("return",Tr(p));case 26:case"end":return e.stop()}}),e,null,[[5,13]])})))).apply(this,arguments)}function Mr(e,t,r,n,o){var a=e.props,i=a.state,s=a.io,u=a.log,c=i.login,f=c.apiKey,l=c.apiSecret,d="GET"===r||null==o?void 0:JSON.stringify(gt(o)),p="Token ".concat(f);if(null!=l){var h="".concat(r,"\n/api").concat(n,"\n").concat(null!=d?d:""),b=lr(Yt.parse(h),l);p="HMAC ".concat(f," ").concat(x.stringify(b))}var v={body:d,method:r,headers:{"content-type":"application/json",accept:"application/json",authorization:p},corsBypass:"never"},y=Date.now(),g="".concat(t,"/api").concat(n);return Sr(s.fetch(g,v),3e4).then((function(e){var t=Date.now()-y;return u("".concat(r," ").concat(g," returned ").concat(e.status," in ").concat(t,"ms")),409===e.status&&u.crash("Login API conflict error",{path:n}),e}),(function(e){var t=Date.now()-y;throw u.error("".concat(r," ").concat(g," failed in ").concat(t,"ms, ").concat(String(e))),new Xt("Could not reach the auth server: ".concat(n))}))}function jr(e,t){var r=e.props.io,n=t.loginId,o=t.loginKey,a=r.random(32),i=yr(r,a,o);return{loginId:n,server:St({loginAuth:a,loginAuthBox:i}),serverPath:"/v2/login/secret",stash:{loginAuthBox:i}}}function Cr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e3;return e.props.output.scrypt.makeSnrp(t)}function Nr(e,t,r){return Dr.apply(this,arguments)}function Dr(){return(Dr=t(c().mark((function e(t,r,n){var o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"string"==typeof r&&(r=Yt.parse(r)),e.next=3,t.props.output.scrypt.timeScrypt(r,n);case 3:return o=e.sent,e.abrupt("return",o.hash);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Rr={salt_hex:Uint8Array.from([181,134,95,251,159,167,179,191,228,178,56,77,71,206,131,30,226,42,74,157,92,52,199,239,125,33,70,124,199,88,248,27]),n:16384,r:1,p:1};function Br(e){return{username:e,appId:"",loginId:new Uint8Array(0),pendingVouchers:[]}}function Lr(e,t){for(var r=e.props.state.login.stashes,n=0;n<r.length;n++){var o=r[n];if(o.username===t)return o}}function Kr(e,t){for(var r=e.props.state.login.stashes,n=0;n<r.length;n++){var o=r[n],a=dn(o,(function(e){return pr(e.loginId,t)}));if(null!=a)return{stashTree:o,stash:a}}throw new Error("Cannot find stash '".concat(x.stringify(t),"'"))}function Ur(e,t){var r=dn(e,(function(e){return pr(e.loginId,t)}));if(null!=r)return r;throw new Error("Cannot find child stash '".concat(x.stringify(t),"'"))}var Fr={};function Wr(e,t){return null==Fr[t]&&(Fr[t]=Nr(e,t,Rr)),Fr[t]}function qr(e,t){return zr.apply(this,arguments)}function zr(){return(zr=t(c().mark((function e(t,r){var n,o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=[],e.next=3,t.list("logins").then(ie.gQ);case 3:o=e.sent,a=0;case 5:if(!(a<o.length)){e.next=25;break}return i=o[a],e.prev=7,e.t0=n,e.t1=Vr,e.t2=JSON,e.next=13,t.getText(i);case 13:e.t3=e.sent,e.t4=e.t2.parse.call(e.t2,e.t3),e.t5=(0,e.t1)(e.t4),e.t0.push.call(e.t0,e.t5),e.next=22;break;case 19:e.prev=19,e.t6=e.catch(7),r.error("Could not load ".concat(i,": ").concat(String(e.t6)));case 22:a++,e.next=5;break;case 25:return e.abrupt("return",n);case 26:case"end":return e.stop()}}),e,null,[[7,19]])})))).apply(this,arguments)}function Gr(e,t){return Hr.apply(this,arguments)}function Hr(){return(Hr=t(c().mark((function e(t,r){var n,o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props,o=n.dispatch,a=n.io,e.next=3,a.disklet.list("logins").then(ie.gQ);case 3:i=e.sent,s=0;case 5:if(!(s<i.length)){e.next=25;break}return u=i[s],e.prev=7,e.t0=Vr,e.t1=JSON,e.next=12,a.disklet.getText(u);case 12:if(e.t2=e.sent,e.t3=e.t1.parse.call(e.t1,e.t2),!pr((0,e.t0)(e.t3).loginId,r)){e.next=18;break}return e.next=18,a.disklet.delete(u);case 18:e.next=22;break;case 20:e.prev=20,e.t4=e.catch(7);case 22:s++,e.next=5;break;case 25:o({type:"LOGIN_STASH_DELETED",payload:r});case 26:case"end":return e.stop()}}),e,null,[[7,20]])})))).apply(this,arguments)}function Yr(e,t){return Jr.apply(this,arguments)}function Jr(){return(Jr=t(c().mark((function e(t,r){var n,o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.props,o=n.dispatch,a=n.io,i=r.appId,s=r.loginId,""===i){e.next=4;break}throw new Error("Cannot save a login without an appId.");case 4:if(null!=s&&32===s.length){e.next=6;break}throw new Error("Invalid loginId");case 6:return e.next=8,a.disklet.setText("logins/".concat(Ht.stringify(s),".json"),JSON.stringify(Xr(r)));case 8:o({type:"LOGIN_STASH_SAVED",payload:r});case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Vr=Ae({appId:ke,created:ge(Ne),lastLogin:ge(Ne),loginId:Be,otpKey:ge(Re),otpResetDate:ge(Ne),otpTimeout:ge(xe),pendingVouchers:ge(Se(Le),(function(){return[]})),voucherId:ge(ke),voucherAuth:ge(Be),loginAuthBox:ge(Ke),parentBox:ge(Ke),passwordAuthBox:ge(Ke),passwordAuthSnrp:ge(Fe),passwordBox:ge(Ke),passwordKeySnrp:ge(Fe),pin2Key:ge(Pe((function(e){var t=ke(e);return"="!==e.slice(-1)?Ht.parse(t):x.parse(t)}),(function(e){return x.stringify(e)}))),pin2TextBox:ge(Ke),recovery2Key:ge(Be),userId:ge(Be),username:ge((function(e){return be(ke(e))})),children:ge(Se((function(e){return Vr(e)}))),keyBoxes:ge(Se(Ue)),mnemonicBox:ge(Ke),rootKeyBox:ge(Ke),syncKeyBox:ge(Ke)}),Xr=Me(Vr);function $r(e){if(null!=e.otpKey)return wr(e.otpKey)}function Zr(e,t){var r=t.otp,n=t.otpKey;return null!=r?r:null!=n?wr(w.parse(n,{loose:!0})):null!=e.otpKey?wr(e.otpKey):void 0}function Qr(e,t,r){return en.apply(this,arguments)}function en(){return(en=t(c().mark((function e(t,r,n){var o,a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.props.state.accounts[r],a=o.loginTree,i=o.sessionKey,s=a.otpKey,u=void 0===s?t.props.io.random(10):s,f={loginId:a.loginId,server:wt({otpKey:u,otpTimeout:n}),serverPath:"/v2/login/otp",stash:{otpKey:u,otpResetDate:void 0,otpTimeout:n}},e.next=5,xn(t,i,f);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function tn(e,t){return rn.apply(this,arguments)}function rn(){return(rn=t(c().mark((function e(t,r){var n,o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props.state.accounts[r],o=n.loginTree,a=n.sessionKey,i={loginId:o.loginId,server:void 0,serverMethod:"DELETE",serverPath:"/v2/login/otp",stash:{otpKey:void 0,otpResetDate:void 0,otpTimeout:void 0}},e.next=4,xn(t,a,i);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function nn(e,t){return on.apply(this,arguments)}function on(){return(on=t(c().mark((function e(t,r){var n,o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.props.state.accounts[r],o=n.loginTree,a=n.sessionKey,i=o.otpTimeout,s=o.otpKey,null!=i&&null!=s){e.next=4;break}throw new Error("Cannot cancel 2FA reset: 2FA is not enabled.");case 4:return u={loginId:o.loginId,server:wt({otpTimeout:i,otpKey:s}),serverPath:"/v2/login/otp",stash:{otpResetDate:void 0}},e.next=7,xn(t,a,u);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function an(e,t,r){return sn.apply(this,arguments)}function sn(){return(sn=t(c().mark((function e(t,r,n){var o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wr(t,r);case 2:return e.t0=e.sent,e.t1=n,o={userId:e.t0,otpResetAuth:e.t1},e.next=7,_r(t,"DELETE","/v2/login/otp",o);case 7:return a=e.sent,i=lt(a),s=i.otpResetDate,e.abrupt("return",s);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function un(e,t,r){return cn.apply(this,arguments)}function cn(){return cn=t(c().mark((function e(r,n,o){var a,i,s,u,f,l,d,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=r.props.state.accounts[n]){e.next=2;break}return e.abrupt("return");case 2:if(a=r.props.state.accounts[n].login,i=a.userId,s=a.passwordAuth,u=Kr(r,a.loginId),f=u.stashTree,l=u.stash,null!=s&&null!=i){e.next=7;break}throw new Error("Cannot repair OTP: There is no password on this account");case 7:return d={userId:i,passwordAuth:s,otp:wr(o)},p={now:f.lastLogin},e.next=11,mn(r,f,l,p,d,t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",a.loginKey);case 1:case"end":return e.stop()}}),e)}))));case 11:case"end":return e.stop()}}),e)}))),cn.apply(this,arguments)}function fn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ln(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fn(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function dn(e,t){if(t(e))return e;var r=e;if(null!=r.children)for(var n=0,o=r.children;n<o.length;n++){var a=dn(o[n],t);if(null!=a)return a}}function pn(e,t,r,n){if(t(e))return r(e);var o=null!=e.children?e.children.map((function(e){return pn(e,t,r,n)})):[];return n(e,o)}function hn(e,t,r){var n=e.children,o=void 0===n?[]:n,a=r.appId,i=r.created,s=r.loginId,u=r.loginAuthBox,c=r.userId,f=r.otpKey,l=r.otpResetDate,d=r.otpTimeout,p=r.pendingVouchers,h=r.parentBox,b=r.passwordAuthBox,v=r.passwordAuthSnrp,y=r.passwordBox,g=r.passwordKeySnrp,m=r.pin2TextBox,w=r.children,x=void 0===w?[]:w,k=r.keyBoxes,I=void 0===k?[]:k,O=r.mnemonicBox,E=r.rootKeyBox,S=r.syncKeyBox,A=r.syncToken,T={appId:a,created:i,loginId:s,loginAuthBox:u,userId:c,otpKey:!0===f?e.otpKey:f,otpResetDate:l,otpTimeout:d,pendingVouchers:p,parentBox:h,passwordAuthBox:b,passwordAuthSnrp:v,passwordBox:!0===y?e.passwordBox:y,passwordKeySnrp:g,pin2TextBox:m,keyBoxes:I,mnemonicBox:O,rootKeyBox:E,syncKeyBox:S,syncToken:A};null!=e.lastLogin&&(T.lastLogin=e.lastLogin),null!=e.username&&(T.username=e.username),null!=e.userId&&null==T.userId&&(T.userId=e.userId),null!=r.pin2KeyBox&&(T.pin2Key=vr(r.pin2KeyBox,t)),null!=r.recovery2KeyBox&&(T.recovery2Key=vr(r.recovery2KeyBox,t)),x.sort((function(e,t){return e.created.valueOf()-t.created.valueOf()})),T.children=x.map((function(e){var r=e.appId,n=e.loginId,a=e.parentBox;if(null==a)throw new Error("Key integrity violation: No parentBox on child login.");var i=vr(a,t),s=o.find((function(e){return pr(e.loginId,n)}));return hn(null!=s?s:{appId:r,loginId:n,pendingVouchers:[]},i,e)}));for(var _=function(){var e=o[P].loginId;if(null==x.find((function(t){return pr(t.loginId,e)})))throw new Error("The server has lost children!")},P=0;P<o.length;P++)_();return T}function bn(e,t,r){return pn(e,(function(e){return e.appId===r.appId}),(function(e){return hn(e,t,r)}),(function(e,t){return ln(ln({},e),{},{children:t})}))}function vn(e,t){var r=e.appId,n=e.created,o=e.lastLogin,a=void 0===o?new Date:o,i=e.loginId,s=e.otpKey,u=e.otpResetDate,c=e.otpTimeout,f=e.pendingVouchers,l=e.userId,d=e.username,p=e.children,h=void 0===p?[]:p,b={appId:r,created:n,isRoot:null==e.parentBox,lastLogin:a,loginId:i,loginKey:t,otpKey:s,otpResetDate:u,otpTimeout:c,pendingVouchers:f,userId:l,username:d,children:[]};if(null!=e.loginAuthBox&&(b.loginAuth=vr(e.loginAuthBox,t)),null!=e.passwordAuthBox&&(null==b.userId&&(b.userId=i),b.passwordAuth=vr(e.passwordAuthBox,t)),null==b.loginAuth&&null==b.passwordAuth)throw new Error("No server authentication methods on login");return b.pin2Key=e.pin2Key,null!=e.pin2TextBox&&(b.pin=br(e.pin2TextBox,t)),b.recovery2Key=e.recovery2Key,b.children=h.map((function(e){if(null==e.parentBox)throw new Error("Key integrity violation: No parentBox on child login.");return vn(e,vr(e.parentBox,t))})),b}function yn(e,t){return pn(e,(function(e){return pr(e.loginId,t.loginId)}),(function(e){return vn(e,t.loginKey)}),(function(e,t){var r=e.appId,n=e.lastLogin,o=void 0===n?new Date:n,a=e.loginId,i=e.pendingVouchers,s=e.username;return{appId:r,children:t,isRoot:null==e.parentBox,lastLogin:o,loginId:a,loginKey:undefined,pendingVouchers:i,username:s}}))}function gn(e,t){return pn(e,(function(e){return e.appId===t}),(function(e){return e}),(function(e,t){return{appId:e.appId,children:t,loginId:e.loginId,pendingVouchers:[],username:e.username}}))}function mn(e,t,r,n,o,a){return wn.apply(this,arguments)}function wn(){return wn=t(c().mark((function e(t,r,n,o,a,i){var s,u,f,l,d,p,h,b,v,y,g,m;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=o.now,u=void 0===s?new Date:s,f=t.props.state.login.deviceDescription,l=ln({challengeId:o.challengeId,otp:Zr(n,o),voucherId:n.voucherId,voucherAuth:n.voucherAuth},a),null!=f&&(l.deviceDescription=f),e.t0=ut,e.next=7,_r(t,"POST","/v2/login",l).catch((function(e){var o=nr(e);throw null!=o&&(0===n.loginId.length&&null!=o.loginId||null!=o.voucherId&&null!=o.voucherAuth)&&(null!=o.loginId&&(n.loginId=x.parse(o.loginId)),null!=o.voucherAuth&&(n.voucherId=o.voucherId,n.voucherAuth=x.parse(o.voucherAuth)),r.lastLogin=u,Yr(t,r).catch((function(){}))),e}));case 7:return e.t1=e.sent,d=(0,e.t0)(e.t1),p=d.loginId,e.next=12,i(d);case 12:return h=e.sent,(r=bn(r,h,d)).lastLogin=u,e.next=17,Yr(t,r);case 17:if(null!=d.loginAuthBox){e.next=28;break}return b=Kr(t,p),v=b.stash,y=b.stashTree,g=jr(t,{loginId:p,loginKey:h}),m=ln(ln({},a),{},{otp:Zr(v,o),data:g.server}),e.t2=ut,e.next=24,_r(t,"POST",g.serverPath,m);case 24:return e.t3=e.sent,d=(0,e.t2)(e.t3),e.next=28,Yr(t,bn(y,h,d));case 28:return e.abrupt("return",{loginId:p,loginKey:h});case 29:case"end":return e.stop()}}),e)}))),wn.apply(this,arguments)}function xn(e,t,r){return kn.apply(this,arguments)}function kn(){return(kn=t(c().mark((function e(t,r,n){var o,a,i,s,u,f,l,d;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=n.serverMethod,a=void 0===o?"POST":o,i=n.serverPath,s=Kr(t,n.loginId),u=s.stashTree,f=An(u,r,n.loginId),(l=Tn(u,f)).data=n.server,e.next=7,_r(t,a,i,l);case 7:return d=pn(u,(function(e){return pr(e.loginId,n.loginId)}),(function(e){return ln(ln(ln({},e),n.stash),{},{children:Or(e.children,n.stash.children),keyBoxes:Or(e.keyBoxes,n.stash.keyBoxes)})}),(function(e,t){return ln(ln({},e),{},{children:t})})),e.next=10,Yr(t,d);case 10:return e.abrupt("return",d);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function In(e,t,r){return On.apply(this,arguments)}function On(){return(On=t(c().mark((function e(t,r,n){var o,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=0;case 1:if(!(o<n.length)){e.next=10;break}if(null!=(a=n[o])){e.next=5;break}return e.abrupt("continue",7);case 5:return e.next=7,xn(t,r,a);case 7:o++,e.next=1;break;case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function En(e,t){return Sn.apply(this,arguments)}function Sn(){return(Sn=t(c().mark((function e(r,n){var o,a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=Kr(r,n.loginId),a=o.stashTree,i=o.stash,null==(s=i.syncToken)){e.next=13;break}return e.prev=3,e.next=6,_r(r,"POST","/v2/sync",{loginId:i.loginId,syncToken:s});case 6:if(!we(e.sent)){e.next=9;break}return e.abrupt("return");case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(3);case 13:return u=Tn(a,n),f={now:a.lastLogin},e.next=17,mn(r,a,i,f,u,t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.loginKey);case 1:case"end":return e.stop()}}),e)}))));case 17:case"end":return e.stop()}}),e,null,[[3,11]])})))).apply(this,arguments)}function An(e,t,r){var n;if(pr(r,t.loginId))return t;var o=Ur(e,t.loginId),a=function e(t,n){for(var o=0;o<t.length;o++){var a=t[o];if(null!=a.parentBox){if(pr(a.loginId,r))return{loginId:a.loginId,loginKey:vr(a.parentBox,n)};var i=a.children,s=void 0===i?[]:i;if(0!==s.length){var u=e(s,vr(a.parentBox,n));if(null!=u)return u}}}}(null!==(n=null==o?void 0:o.children)&&void 0!==n?n:[],t.loginKey);if(null==a)throw new Error("Cannot decrypt child login '".concat(x.stringify(t.loginId),"'"));return a}function Tn(e,t){var r=Ur(e,t.loginId),n=r.loginAuthBox,o=r.otpKey,a=r.passwordAuthBox,i=r.syncToken,s=r.userId,u=r.voucherAuth,c=r.voucherId,f=null!=o?wr(o):void 0;if(null!=n)return{loginAuth:vr(n,t.loginKey),loginId:t.loginId,otp:f,syncToken:i,voucherAuth:u,voucherId:c};if(null!=a&&null!=s)return{passwordAuth:vr(a,t.loginKey),userId:s,otp:f,syncToken:i,voucherAuth:u,voucherId:c};throw new Error("No server authentication methods available")}var _n=r(1649);_n.bS,_n.Ei,_n.h8,_n.wJ,_n.PG,_n.SR,_n.Th,_n.Qw,_n.YK,_n.KI,_n.Wn,_n.tp,_n.RQ,_n.tE,_n.Jj;const Pn=_n.LZ;_n.m8;function Mn(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var jn="function"==typeof Symbol&&Symbol.observable||"@@observable",Cn=function(){return Math.random().toString(36).substring(7).split("").join(".")},Nn={INIT:"@@redux/INIT"+Cn(),REPLACE:"@@redux/REPLACE"+Cn(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Cn()}};function Dn(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Rn(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error(Mn(0));if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error(Mn(1));return r(Rn)(e,t)}if("function"!=typeof e)throw new Error(Mn(2));var o=e,a=t,i=[],s=i,u=!1;function c(){s===i&&(s=i.slice())}function f(){if(u)throw new Error(Mn(3));return a}function l(e){if("function"!=typeof e)throw new Error(Mn(4));if(u)throw new Error(Mn(5));var t=!0;return c(),s.push(e),function(){if(t){if(u)throw new Error(Mn(6));t=!1,c();var r=s.indexOf(e);s.splice(r,1),i=null}}}function d(e){if(!Dn(e))throw new Error(Mn(7));if(void 0===e.type)throw new Error(Mn(8));if(u)throw new Error(Mn(9));try{u=!0,a=o(a,e)}finally{u=!1}for(var t=i=s,r=0;r<t.length;r++){(0,t[r])()}return e}return d({type:Nn.INIT}),(n={dispatch:d,subscribe:l,getState:f,replaceReducer:function(e){if("function"!=typeof e)throw new Error(Mn(10));o=e,d({type:Nn.REPLACE})}})[jn]=function(){var e,t=l;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Mn(11));function r(){e.next&&e.next(f())}return r(),{unsubscribe:t(r)}}})[jn]=function(){return this},e},n}function Bn(e){function t(t){var r=void 0,n=void 0,o=!0,a=!1,i=!1,s=void 0,u=void 0,c=void 0;function f(){if(r){try{if(u){var e=u;s=void 0,u=void 0,c=void 0,e(((n=new Error("Pixie has been destroyed")).name="PixieShutdownError",n))}var t=r;r=void 0,t.destroy()}catch(n){l(n)}i=!0}var n}function l(e){i||t.onError(e),f()}function d(){a=!1,p()}function p(){for(;r&&o&&!a;){o=!1,a=!0;try{var e=r.update(n);e&&"function"==typeof e.then?e.then(d,l):a=!1}catch(t){l(t)}}}function h(){return s||(s=new Promise((function(e,t){c=e,u=t}))),s}var b={onError:l,onOutput:function(e){i||t.onOutput(e)},get props(){return n},nextProps:h,waitFor:function(e){return new Promise((function(t,r){return function o(){try{var a=e(n);null!=a?t(a):h().then(o,r)}catch(i){r(i)}}()}))}};try{r=function(e){return"function"==typeof e?{update:e,destroy:function(){}}:e}(e(b))}catch(v){l(v)}return{update:function(e){if(n=e,o=!0,c){var t=c;s=void 0,u=void 0,c=void 0,t(e)}p()},destroy:f}}return t.tame=!0,t.defaultOutput=e.defaultOutput,t}function Ln(e){return e.tame?e:Bn(e)}function Kn(e,t,r){r(e)}var Un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fn=(function(){function e(e){this.value=e}function t(t){var r,n;function o(r,n){try{var i=t[r](n),s=i.value;s instanceof e?Promise.resolve(s.value).then((function(e){o("next",e)}),(function(e){o("throw",e)})):a(i.done?"return":"normal",i.value)}catch(u){a("throw",u)}}function a(e,t){switch(e){case"return":r.resolve({value:t,done:!0});break;case"throw":r.reject(t);break;default:r.resolve({value:t,done:!1})}(r=r.next)?o(r.key,r.arg):n=null}this._invoke=function(e,t){return new Promise((function(a,i){var s={key:e,arg:t,resolve:a,reject:i,next:null};n?n=n.next=s:(r=n=s,o(e,t))}))},"function"!=typeof t.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(e){return this._invoke("next",e)},t.prototype.throw=function(e){return this._invoke("throw",e)},t.prototype.return=function(e){return this._invoke("return",e)}}(),function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}()),Wn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};function qn(e){}function zn(e){}function Gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qn,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:zn;return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Kn,r=Ln(e);function n(e){var n=e.onOutput,o=void 0,a=void 0,i=function(){var e=o;o=void 0,e&&e.destroy()},s={onError:function(r){i();try{t(r,a,e.onError)}catch(r){e.onError(r)}},onOutput:n};return{update:function(e){a=e,o||(o=r(s)),o.update(e)},destroy:i}}return n.tame=!0,n.defaultOutput=e.defaultOutput,n}(function(e){var t=Ln(e);function r(r){var n=r.onError,o=void 0,a=e.defaultOutput,i=void 0,s=!0,u=!1,c=function(){for(;o&&s&&!u;)s=!1,u=!0,o.update(Wn({},i,{output:a})),u=!1},f={onError:n,onOutput:function(e){e!==a&&(a=e,s=!0,r.onOutput(e),c())}};return{update:function(e){i=e,s=!0,o||(o=t(f)),c()},destroy:function(){var e=o;o=void 0,e&&e.destroy()}}}return r.tame=!0,r.defaultOutput=e.defaultOutput,r}(e))({onError:t,onOutput:r})}function Hn(e,t,r,n){var o=Gn(t,r,n);o.update({dispatch:e.dispatch,output:void 0,state:e.getState()});var a=e.subscribe((function(){o.update({dispatch:e.dispatch,output:void 0,state:e.getState()})}));return function(){a(),o.destroy()}}function Yn(e){var t={},r=Object.keys(e),n=Array.isArray(r),o=0;for(r=n?r:r[Symbol.iterator]();;){var a;if(n){if(o>=r.length)break;a=r[o++]}else{if((o=r.next()).done)break;a=o.value}var i=a;t[i]=e[i].defaultOutput}function s(r){var n=r.onError,o={},a={},i=Wn({},t),s=!1,u=function(){if(f){if(l>=c.length)return"break";d=c[l++]}else{if((l=c.next()).done)return"break";d=l.value}var t=d;if(o[t]={onError:n,onOutput:function(e){e!==i[t]&&((i=Wn({},i))[t]=e,r.onOutput(i))}},a[t]=Ln(e[t])(o[t]),s)return"break"},c=Object.keys(e),f=Array.isArray(c),l=0;for(c=f?c:c[Symbol.iterator]();;){var d;if("break"===u())break}return{update:function(e){var t=Object.keys(a),r=Array.isArray(t),n=0;for(t=r?t:t[Symbol.iterator]();;){var o;if(r){if(n>=t.length)break;o=t[n++]}else{if((n=t.next()).done)break;o=n.value}if(a[o].update(e),s)return}},destroy:function(){s=!0;var e=Object.keys(a),t=Array.isArray(e),r=0;for(e=t?e:e[Symbol.iterator]();;){var n;if(t){if(r>=e.length)break;n=e[r++]}else{if((r=e.next()).done)break;n=r.value}a[n].destroy()}}}}return s.tame=!0,s.defaultOutput=t,s}function Jn(e,t){return function(){try{return e.apply(void 0,arguments)}catch(r){t(r)}}}function Vn(e,t){if(e===t)return!0;if("object"!==(void 0===e?"undefined":Un(e)))return!1;if("object"!==(void 0===t?"undefined":Un(t)))return!1;if(!e||!t)return!1;var r=Object.getOwnPropertyNames(e);if(r.length!==Object.getOwnPropertyNames(t).length)return!1;var n=r,o=Array.isArray(n),a=0;for(n=o?n:n[Symbol.iterator]();;){var i;if(o){if(a>=n.length)break;i=n[a++]}else{if((a=n.next()).done)break;i=a.value}var s=i;if(!Object.prototype.hasOwnProperty.call(t,s)||e[s]!==t[s])return!1}return!0}function Xn(e,t){var r=Ln(e);function n(e){var n=e.onError,o=e.onOutput,a=void 0,i=void 0,s=!1,u=Jn(t,n),c={onError:n,onOutput:o};return{update:function(e){var t=u(e);if(!s){var n=!Vn(t,i);if(i=t,t){if(a||(a=r(c)),s)return;n&&a.update(t)}else a&&a.destroy(),a=void 0}},destroy:function(){s=!0,a&&a.destroy(),a=void 0}}}return n.tame=!0,n.defaultOutput=e.defaultOutput,n}function $n(e,t,r){var n=Ln(e);function o(e){var o=e.onError,a={},i={},s=!1,u={},c=!1,f=!1,l=Jn(t,o),d=Jn(r,o),p=function(){if(s&&!c){s=!1;var t={},r=Object.keys(a),n=Array.isArray(r),o=0;for(r=n?r:r[Symbol.iterator]();;){var u;if(n){if(o>=r.length)break;u=r[o++]}else{if((o=r.next()).done)break;u=o.value}var f=u;t[f]=i[f]}i=t,e.onOutput(i)}};return{update:function(e){var t=l(e);if(!f&&t){c=!0;var r={},h=function(){if(v){if(y>=b.length)return"break";g=b[y++]}else{if((y=b.next()).done)return"break";g=y.value}var t=g,c=d(e,t);if(f)return{v:void 0};var l=!Vn(c,u[t]);if(u[t]=c,c){if(!a[t]){if(a[t]=n({onError:o,onOutput:function(e){e!==i[t]&&(i[t]=e,s=!0,p())}}),f)return{v:void 0}}if(l&&a[t].update(c),f)return{v:void 0};r[t]=a[t]}};var b=t,v=Array.isArray(b),y=0;e:for(b=v?b:b[Symbol.iterator]();;){var g,m=h();if("break"===m)break e;if("object"===(void 0===m?"undefined":Un(m)))return m.v}var w=a;a=r;var x=Object.keys(w),k=Array.isArray(x),I=0;for(x=k?x:x[Symbol.iterator]();;){var O;if(k){if(I>=x.length)break;O=x[I++]}else{if((I=x.next()).done)break;O=I.value}var E=O;r[E]||(s=!0,w[E].destroy())}f||(c=!1,p())}},destroy:function(){f=!0;var e=Object.keys(a),t=Array.isArray(e),r=0;for(e=t?e:e[Symbol.iterator]();;){var n;if(t){if(r>=e.length)break;n=e[r++]}else{if((r=e.next()).done)break;n=r.value}var o=n;a[o]&&a[o].destroy()}}}}return o.tame=!0,o.defaultOutput={},o}!function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.props=t}Fn(e,[{key:"update",value:function(e,t){}},{key:"destroy",value:function(e,t){}}])}();var Zn={then:function(){}};function Qn(e){var r=Me(e);return{load:function(r,n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.t0=e,t.t1=JSON,t.next=5,r.getText(n);case 5:return t.t2=t.sent,t.t3=t.t1.parse.call(t.t1,t.t2),t.abrupt("return",(0,t.t0)(t.t3));case 10:t.prev=10,t.t4=t.catch(0);case 12:case"end":return t.stop()}}),t,null,[[0,10]])})))()},save:function(e,n,o){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.setText(n,JSON.stringify(r(o)));case 2:case"end":return t.stop()}}),t)})))()}}}var eo=function(e){if(null==e||"object"!==se(e))throw new TypeError("Expected a JSON object");return e},to="client.json",ro=Qn(Ae({clientId:Be})),no="infoCache.json",oo=Ae({corePlugins:Ae(eo),syncServers:Se(ke)}),ao=Qn(oo);function io(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function so(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?io(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):io(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function uo(e,t,r){return function(){for(var n="",o=0;o<arguments.length;++o){var a=arguments[o];o>0&&(n+=" "),"string"==typeof a?n+=a:a instanceof Error?n+=String(a):n+=JSON.stringify(a,null,2)}e({message:n,source:r,time:new Date,type:t})}}function co(e,t){return so(so({},e),{},{onLog:function(r){var n=t(),o=n.sources,a=n.defaultLogLevel,i=null!=o[r.source]?o[r.source]:a;switch(r.type){case"info":"info"===i&&e.onLog(r);break;case"warn":"info"!==i&&"warn"!==i||e.onLog(r);break;case"error":"silent"!==i&&e.onLog(r)}}})}function fo(e,t){var r=e.onLog,n=e.crashReporter;return Er(uo(r,"info",t),{breadcrumb:function(e,o){var a=new Date;null!=n?n.logBreadcrumb({message:e,metadata:o,source:t,time:a}):(e="".concat(e," ").concat(JSON.stringify(o,null,2)),r({message:e,source:t,time:a,type:"warn"}))},crash:function(e,o){var a=new Date;if(null!=n)n.logCrash({error:e,metadata:o,source:t,time:a});else{var i="".concat(String(e)," ").concat(JSON.stringify(o,null,2));r({message:i,source:t,time:a,type:"error"})}},warn:uo(r,"warn",t),error:uo(r,"error",t)})}function lo(e,t){return po.apply(this,arguments)}function po(){return(po=t(c().mark((function e(t,r){var n,o,a,i,u,f,l,d,p,h,b,v,y,g,m,w;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=[],e.next=3,t.disklet.list("Accounts").then(ie.ji);case 3:o=e.sent,a=0;case 5:if(!(a<o.length)){e.next=55;break}return i=o[a],u=(0,ie.HN)(t.disklet,i),e.t0=Promise,e.next=11,bo.load(u,"CarePackage.json");case 11:return e.t1=e.sent,e.next=14,vo.load(u,"LoginPackage.json");case 14:return e.t2=e.sent,e.next=17,yo.load(u,"OtpKey.json");case 17:return e.t3=e.sent,e.next=20,go.load(u,"Pin2Key.json");case 20:return e.t4=e.sent,e.next=23,mo.load(u,"Recovery2Key.json");case 23:return e.t5=e.sent,e.next=26,wo.load(u,"UserName.json");case 26:return e.t6=e.sent,e.t7=[e.t1,e.t2,e.t3,e.t4,e.t5,e.t6],e.next=30,e.t0.all.call(e.t0,e.t7);case 30:if(f=e.sent,l=s(f,6),d=l[0],p=l[1],h=l[2],b=l[3],v=l[4],null!=(y=l[5])){e.next=40;break}return e.abrupt("continue",52);case 40:if(g=be(y.userName),!r.has(g)){e.next=43;break}return e.abrupt("continue",52);case 43:return e.next=45,t.scrypt(Yt.parse(g),Rr.salt_hex,Rr.n,Rr.r,Rr.p,32);case 45:m=e.sent,w={appId:"",loginId:m,pendingVouchers:[],username:g},null!=d&&null!=p&&(w.passwordKeySnrp=d.SNRP2,w.passwordBox=p.EMK_LP2,w.syncKeyBox=p.ESyncKey,w.passwordAuthBox=p.ELP1),null!=h&&(w.otpKey=h.TOTP),null!=b&&(w.pin2Key=b.pin2Key),null!=v&&(w.recovery2Key=v.recovery2Key),n.push(w);case 52:a++,e.next=5;break;case 55:return e.abrupt("return",n);case 56:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ho=Pe((function(e){return Ht.parse(ke(e))}),(function(e){return Ht.stringify(e)})),bo=Qn(Ae({SNRP2:Fe,SNRP3:ge(Fe),SNRP4:ge(Fe),ERQ:ge(Ke)})),vo=Qn(Ae({EMK_LP2:Ke,EMK_LRA3:ge(Ke),ESyncKey:Ke,ELP1:Ke})),yo=Qn(Ae({TOTP:Re})),go=Qn(Ae({pin2Key:ho})),mo=Qn(Ae({recovery2Key:ho})),wo=Qn(Ae({userName:ke}));function xo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ko(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?xo(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xo(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Io={},Oo=!1,Eo=[],So=[];function Ao(){Oo=!0;for(var e=0;e<So.length;e++){(0,So[e])()}}function To(e,t,r,n,o){var a=e.io,i=e.nativeIo,s=ko(ko({},a),{},{console:console});function u(e){for(var u={},c=0,f=Object.keys(e);c<f.length;c++){var l=f[c],d=e[l],p=fo(r,l),h=n[l];if(!1!==h&&null!=h)try{if("function"==typeof d){var b,v,y={infoPayload:null!==(b=null===(v=t.corePlugins)||void 0===v?void 0:v[l])&&void 0!==b?b:{},initOptions:"object"===se(h)?h:{},io:s,log:p,nativeIo:i,pluginDisklet:(0,ie.HN)(a.disklet,"plugins/"+l)};u[l]=d(y)}else{if("object"!==se(d)||null==d)throw new TypeError("Plugins must be functions or objects, got ".concat(se(d)));u[l]=d}}catch(g){p.error(g)}}o({type:"CORE_PLUGINS_ADDED",payload:u})}function c(){o({type:"CORE_PLUGINS_LOCKED",payload:n})}return u(Io),Oo&&c(),Eo.push(u),So.push(c),function(){Eo.filter((function(e){return e!==u})),So.filter((function(e){return e!==c}))}}function _o(e,t){var r,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).onError,o=void 0===n?function(){}:n,a=!1;function i(){r=void 0,c.started&&(a=!0,new Promise((function(t){return t(e())})).catch(o).then(u,u))}function s(e){a=!1,c.started&&(r=setTimeout(i,e))}function u(){s(t)}var c={started:!1,setDelay:function(e){t=e},start:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).wait;c.started=!0,a||null!=r||("number"==typeof e?s(e):!0===e?s(t):i())},stop:function(){c.started=!1,null!=r&&(clearTimeout(r),r=void 0)}};return c}function Po(e){return new Promise((function(t){return setTimeout((function(){return t(e)}),e)}))}function Mo(e,t){var r=jo(e,t);if(null==r)throw new Error("Cannot find a currency plugin for wallet type ".concat(t));return r}function jo(e,t){return Object.keys(e).find((function(r){return e[r].currencyInfo.walletType===t}))}function Co(e,t){var r=e.props,n=r.dispatch,o=r.state,a=o.plugins.currencyTools[t];if(null!=a)return a;var i=o.plugins.currency[t].makeCurrencyTools();return n({type:"CURRENCY_TOOLS_LOADED",payload:{pluginId:t,tools:i}}),i}function No(e){return Do.apply(this,arguments)}function Do(){return Do=t(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.waitFor((function(e){var t=e.state.plugins,r=t.init;if(t.locked){for(var n=e.state.plugins,o=n.currency,a=n.swap,i=[],s=0,u=Object.keys(r);s<u.length;s++){var c=u[s];!1!==r[c]&&null!=r[c]&&null==o[c]&&null==a[c]&&i.push(c)}if(i.length>0)throw new Error("The following plugins are missing or failed to load: "+i.join(", "));return!0}}));case 2:case"end":return e.stop()}}),e)}))),Do.apply(this,arguments)}new Set,new Map;var Ro=Ae({dataKey:Be,syncKey:Be}),Bo=Me(Ro);function Lo(e){var t=e.props.io;return{dataKey:t.random(32),syncKey:t.random(20)}}function Ko(e,r,n){var o={delete:function(e){return n.delete(e)},getData:function(e){return t(c().mark((function t(){var o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getText(e);case 2:return o=t.sent,a=Ke(JSON.parse(o)),t.abrupt("return",vr(a,r));case 5:case"end":return t.stop()}}),t)})))()},getText:function(e){return t(c().mark((function t(){var o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getText(e);case 2:return o=t.sent,a=Ke(JSON.parse(o)),t.abrupt("return",br(a,r));case 5:case"end":return t.stop()}}),t)})))()},list:function(e){return n.list(e)},setData:function(t,o){return n.setText(t,JSON.stringify(bt(yr(e,Uint8Array.from(o),r))))},setText:function(e,t){return this.setData(e,Yt.parse(t))}};return C(o),o}function Uo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var Fo=100;function Wo(e,t){return(0,ie.HN)(e.disklet,"local/"+Ht.stringify(x.parse(t)))}function qo(e,t){var r=t.dataKey,n=t.syncKey,o=(0,ie.HN)(e.disklet,"repos/"+Ht.stringify(dr(dr(n)))),a=(0,ie.HN)(o,"changes"),i=(0,ie.HN)(o,"data");return{dataKey:r,syncKey:n,baseDisklet:o,changesDisklet:a,dataDisklet:i,disklet:Ko(e,r,(0,ie.Cl)(a,i))}}function zo(e){var t={lastSync:0,lastHash:void 0};return e.baseDisklet.getText("status.json").then((function(e){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Uo(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Uo(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({lastSync:0},JSON.parse(e))})).catch((function(){return t}))}function Go(e,t){return Ho.apply(this,arguments)}function Ho(){return(Ho=t(c().mark((function e(t,r){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(Object.keys(r).map((function(e){var n=r[e];return null!=n?t.setText(e,JSON.stringify(bt(n))):t.delete(e)})));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Yo(e,t,r){return Jo.apply(this,arguments)}function Jo(){return Jo=t(c().mark((function e(r,n,o){var a,i,s,u,f,l,d,p,h,b,v,y,g;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=n.changesDisklet,i=n.dataDisklet,s=n.syncKey,e.next=3,Vo(a).then((function(e){return Promise.all(e.map(function(){var e=t(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=t,e.t1=Ke,e.t2=JSON,e.next=5,a.getText(t);case 5:return e.t3=e.sent,e.t4=e.t2.parse.call(e.t2,e.t3),e.t5=(0,e.t1)(e.t4),e.abrupt("return",{path:e.t0,box:e.t5});case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()))}));case 3:return u=e.sent,f=m.stringify(s).toLowerCase(),e.next=7,function(){if(0===u.length)return r.readRepo(f,o.lastHash);for(var e={},t=0;t<u.length;t++){var n=u[t];e[n.path]=bt(n.box)}return r.updateRepo(f,o.lastHash,{changes:e})}();case 7:for(l=e.sent,d=l.hash,p={},h=0,b=Object.keys(null!==(v=l.changes)&&void 0!==v?v:{});h<b.length;h++)y=b[h],g=l.changes[y],p[y]=null==g?null:Ke(g);return e.next=13,Go(i,p);case 13:return e.next=15,Promise.all(u.map((function(e){return a.delete(e.path)})));case 15:return o.lastSync=Date.now()/1e3,null!=d&&(o.lastHash=d),e.next=19,n.baseDisklet.setText("status.json",JSON.stringify(o));case 19:return e.abrupt("return",{status:o,changes:p});case 20:case"end":return e.stop()}}),e)}))),Jo.apply(this,arguments)}function Vo(e){return Xo.apply(this,arguments)}function Xo(){return Xo=t(c().mark((function e(t){var r,n,o,a,i,s,u,f,l,d=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=d.length>1&&void 0!==d[1]?d[1]:"",n=d.length>2&&void 0!==d[2]?d[2]:Fo,e.next=4,t.list(r);case 4:o=e.sent,a=Object.keys(o).filter((function(e){return"file"===o[e]})),i=Object.keys(o).filter((function(e){return"folder"===o[e]})),s=0;case 8:if(!(s<i.length)){e.next=20;break}if(u=i[s],!(a.length>=n)){e.next=12;break}return e.abrupt("break",20);case 12:return f=n-a.length,e.next=15,Vo(t,u,f);case 15:l=e.sent,a.push.apply(a,Ir(l.slice(0,f)));case 17:s++,e.next=8;break;case 20:return e.abrupt("return",a);case 21:case"end":return e.stop()}}),e)}))),Xo.apply(this,arguments)}function $o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var Zo=3e4;function Qo(e,t){return ea.apply(this,arguments)}function ea(){return(ea=t(c().mark((function e(t,r){var n,o,a,i,s,u,f,l,d;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props,o=n.dispatch,a=n.io,i=n.onError,s=Ro(r.keys),u=qo(a,s),C(f=Wo(a,r.id)),e.next=7,zo(u);case 7:if(l=e.sent,o({type:"STORAGE_WALLET_ADDED",payload:{id:r.id,initialState:{localDisklet:f,paths:u,status:l,lastChanges:[]}}}),d=ta(t,r.id),!(l.lastSync>0)){e.next=14;break}d.catch((function(e){var n=r.keys.syncKey,o=l.lastHash;t.props.log.error("Could not sync ".concat(String(n)," with last hash ").concat(String(o),": ").concat(String(e))),i(e)})),e.next=16;break;case 14:return e.next=16,d;case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ta(e,t){var r=e.props,n=r.dispatch,o=r.syncClient,a=r.state.storageWallets[t];return Yo(o,a.paths,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$o(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},a.status)).then((function(e){var r=e.changes,o=e.status;return n({type:"STORAGE_WALLET_SYNCED",payload:{id:t,changes:Object.keys(r),status:o}}),Object.keys(r)}))}function ra(e,t){return e.storageWallets[t].lastChanges}function na(e,t){return e.storageWallets[t].paths.disklet}function oa(e,t){return e.storageWallets[t].localDisklet}function aa(e,t,r){return Ko(r,e.storageWallets[t].paths.dataKey,e.storageWallets[t].localDisklet)}function ia(e,t,r){var n=e.storageWallets[t].paths.dataKey;return Ht.stringify(lr(Yt.parse(r),n))}var sa=Ae({multiplier:ke,name:ke,symbol:ge(ke)}),ua=Ae({currencyCode:ke,denominations:Se(sa),displayName:ke,networkLocation:ge(eo)}),ca=Ae({enabled:ge(we,!0)}).withRest,fa=Ae({SortIndex:ge(xe,0),Archived:ge(we,!1),BitcoinSeed:De,MK:De,SyncKey:De}).withRest,la=Ae({id:ke,archived:ge(we),deleted:ge(we),hidden:ge(we),migratedFromWalletId:ge(ke),sortIndex:ge(xe)}),da=Ae({userSettings:ge(Ae(eo),(function(){return{}})),swapSettings:ge(Ae(ca),(function(){return{}}))}).withRest,pa=Ae({customTokens:Se(Ae({contractAddress:ke,currencyCode:ke,currencyName:ke,denomination:ke,denominations:Se(sa),isVisible:ge(we,!0),multiplier:ke,walletType:ge(ke,"wallet:ethereum")}))});function ha(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ba(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ha(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ha(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var va=Qn(Ae({customTokens:Ae(Ae(ua))})),ya=Qn(pa),ga="CustomTokens.json",ma="Settings.json",wa=_e(Ae({contractAddress:ke}));function xa(e,t,r){return ka.apply(this,arguments)}function ka(){return(ka=t(c().mark((function e(t,r,n){var o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Co(t,r);case 2:if(null==(o=e.sent).getTokenId){e.next=7;break}return e.next=6,o.getTokenId(n);case 6:return e.abrupt("return",e.sent);case 7:if(null!=(a=_a(t,r))){e.next=10;break}throw new Error("A wallet must exist before adding tokens to a legacy currency plugin");case 10:if(null!=a.addCustomToken){e.next=12;break}throw new Error("".concat(r," doesn't support tokens"));case 12:if(null!=(i=Sa(n))){e.next=15;break}throw new Error("A token must have a contract address to be added to a legacy currency plugin");case 15:return e.next=17,a.addCustomToken(ba(ba({},i),n));case 17:return e.abrupt("return",Ia(i.contractAddress));case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ia(e){return e.toLowerCase().replace(/^0x/,"")}function Oa(e){for(var t={},r=0;r<e.length;r++){var n=e[r],o=n.contractAddress;null!=o&&(t[Ia(o)]={currencyCode:n.currencyCode,denominations:n.denominations,displayName:n.currencyName,networkLocation:{contractAddress:n.contractAddress}})}return t}function Ea(){for(var e,t,r,n,o,a,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=[],u=0,c=Object.keys(i);u<c.length;u++){var f=c[u];s.push((e=i[f],t=void 0,r=void 0,n=void 0,o=void 0,a=void 0,t=e.currencyCode,r=e.displayName,n=e.denominations,o=e.networkLocation,a=wa(o),{currencyCode:t,currencyName:r,denominations:n,contractAddress:null==a?void 0:a.contractAddress}))}return s}function Sa(e){var t=e.currencyCode,r=e.displayName,n=e.denominations,o=e.networkLocation,a=wa(o);if(null!=a)return{currencyCode:t,currencyName:r,multiplier:n[0].multiplier,contractAddress:a.contractAddress}}function Aa(e,t){return Ta.apply(this,arguments)}function Ta(){return Ta=t(c().mark((function e(r,n){var o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=r.props,a=o.dispatch,i=o.state,e.next=3,Promise.all(Object.keys(i.plugins.currency).map(function(){var e=t(c().mark((function e(t){var r,o,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(o=i.plugins.currency[t]).getBuiltinTokens){e.next=5;break}e.t0=Oa(null!==(r=o.currencyInfo.metaTokens)&&void 0!==r?r:[]),e.next=8;break;case 5:return e.next=7,o.getBuiltinTokens();case 7:e.t0=e.sent;case 8:s=e.t0,a({type:"ACCOUNT_BUILTIN_TOKENS_LOADED",payload:{accountId:n,pluginId:t,tokens:s}});case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}}),e)}))),Ta.apply(this,arguments)}function _a(e,t){for(var r=0,n=Object.keys(e.props.state.currency.wallets);r<n.length;r++){var o=n[r],a=e.props.output.currency.wallets[o];if(null!=(null==a?void 0:a.engine)&&e.props.state.currency.wallets[o].pluginId===t)return a.engine}}function Pa(e,t){return Ma.apply(this,arguments)}function Ma(){return(Ma=t(c().mark((function e(t,r){var n,o,a,i,s,u,f,l,d,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props.state,o=n.accounts[r].accountWalletInfo,a=na(n,o.id),e.next=5,ya.load(a,ma);case 5:if(null!=(i=e.sent)){e.next=8;break}return e.abrupt("return",{});case 8:s={},u=0,f=i.customTokens;case 10:if(!(u<f.length)){e.next=23;break}if((l=f[u]).isVisible){e.next=14;break}return e.abrupt("continue",20);case 14:if(null!=(d=jo(n.plugins.currency,l.walletType))){e.next=17;break}return e.abrupt("continue",20);case 17:null==s[d]&&(s[d]={}),p=Ia(l.contractAddress),s[d][p]={currencyCode:l.currencyCode,denominations:l.denominations,displayName:l.currencyName,networkLocation:{contractAddress:l.contractAddress}};case 20:u++,e.next=10;break;case 23:return e.abrupt("return",s);case 24:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ja(e,t){return Ca.apply(this,arguments)}function Ca(){return(Ca=t(c().mark((function e(t,r){var n,o,a,i,s,u,f,l;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props,o=n.dispatch,a=n.state,i=a.accounts[r].accountWalletInfo,s=na(a,i.id),e.next=5,va.load(s,ga);case 5:if(null==(u=e.sent)){e.next=11;break}f=u.customTokens,o({type:"ACCOUNT_CUSTOM_TOKENS_LOADED",payload:{accountId:r,customTokens:f}}),e.next=15;break;case 11:return e.next=13,Pa(t,r);case 13:l=e.sent,o({type:"ACCOUNT_CUSTOM_TOKENS_LOADED",payload:{accountId:r,customTokens:l}});case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Na(e,t){return Da.apply(this,arguments)}function Da(){return(Da=t(c().mark((function e(t,r){var n,o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props.state,o=n.accounts[r].accountWalletInfo,a=na(n,o.id),i=t.props.state.accounts[r].customTokens,e.next=6,va.load(a,ga);case 6:return s=e.sent,e.next=9,va.save(a,ga,ba(ba({},s),{},{customTokens:i}));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ra=r(7591);function Ba(e){var t,r=e.currencyInfo,n=e.allTokens,o=e.tokenId;return void 0===o&&null!=e.currencyCode&&e.currencyCode!==r.currencyCode&&(o=Object.keys(n).find((function(t){return n[t].currencyCode===e.currencyCode}))),{currencyCode:(null==o?r:n[o]).currencyCode,tokenId:null!==(t=o)&&void 0!==t?t:null}}function La(e){return null!=e.networkFee&&null==e.networkFee.tokenId&&(e.networkFee.tokenId=e.request.fromTokenId),e}var Ka=function(e){null!=e.networkFees&&0!==e.networkFees.length||(e.networkFees=[{tokenId:e.tokenId,nativeAmount:e.networkFee}],null!=e.parentNetworkFee&&e.networkFees.push({tokenId:null,nativeAmount:e.parentNetworkFee}))};function Ua(e,r){var n=r.id,o=r.type,a=r.keys;return{id:n,type:o,keys:a,get disklet(){return na(e.props.state,n)},get localDisklet(){return oa(e.props.state,n)},sync:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ta(e,n);case 2:case"end":return t.stop()}}),t)})))()}}}function Fa(e,t,r){for(var n=0,o=e.denominations;n<o.length;n++){var a=o[n];if(a.name===r)return a.multiplier}for(var i=0,s=Object.keys(t);i<s.length;i++)for(var u=0,c=t[s[i]].denominations;u<c.length;u++){var f=c[u];if(f.name===r)return f.multiplier}return"1"}function Wa(e,t){return e.waitFor((function(e){if(null==e.state.currency.wallets[t])throw new Error("Wallet id ".concat(t," does not exist in this account"));var r=e.state.currency.wallets[t].engineFailure;if(null!=r)throw r;if(null!=e.output.currency.wallets[t])return e.output.currency.wallets[t].walletApi}))}var qa={"[object Float32Array]":!0,"[object Float64Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Int8Array]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0};function za(e,t,r){if("[object Object]"===r){if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var n=Object.getOwnPropertyNames(e);if(n.length!==Object.getOwnPropertyNames(t).length)return!1;for(var o=0;o<n.length;o++){var a=n[o];if(!Object.prototype.hasOwnProperty.call(t,a)||!Ga(e[a],t[a]))return!1}return!0}if("[object Array]"===r){if(e.length!==t.length)return!1;for(var i=0;i<e.length;++i)if(!Ga(e[i],t[i]))return!1;return!0}if("[object Date]"===r)return e.getTime()===t.getTime();if("[object Map]"===r)return function(e,t){if(e.size!==t.size)return!1;for(var r=0;r<e.length;r++){var n=s(e[r],2),o=n[0],a=n[1];if(!t.has(o)||t.get(o)!==a)return!1}return!0}(e,t);if(qa[r]){if(e.length!==t.length)return!1;for(var u=0;u<e.length;++u)if(e[u]!==t[u])return!1;return!0}return!1}function Ga(e,t){if(e===t)return!0;if("object"!==se(e))return!1;if("object"!==se(t))return!1;var r=Object.prototype.toString.call(e);return r===Object.prototype.toString.call(t)&&za(e,t,r)}var Ha=500,Ya=3,Ja=[];function Va(e){Ja.length<=0&&Xa();for(var t=!1,r=0;r<Ja.length;r++){var n=Ja[r];if(n.id===e.id&&n.action===e.action){n.updateFunc=e.updateFunc,t=!0;break}}t||Ja.push(e)}function Xa(){setTimeout((function(){for(var e=Math.min(Ya,Ja.length),t=0;t<e;t++){var r=Ja.shift();null!=r&&r.updateFunc()}Ja.length>0&&Xa()}),Ha)}function $a(e,t){for(var r,n,o,a,i,s,u={exchangeAmount:{}},c=u.exchangeAmount,f=void 0===c?{}:c,l=null!==(r=e.exchangeAmount)&&void 0!==r?r:{},d=null!==(n=t.exchangeAmount)&&void 0!==n?n:{},p=0,h=Object.keys(l);p<h.length;p++){var b=h[p];null!==d[b]&&(f[b]=l[b])}for(var v=0,y=Object.keys(d);v<y.length;v++){var g=y[v],m=d[g];null!=m&&(f[g]=m)}return null!==t.bizId&&(u.bizId=null!==(o=t.bizId)&&void 0!==o?o:e.bizId),null!==t.category&&(u.category=null!==(a=t.category)&&void 0!==a?a:e.category),null!==t.name&&(u.name=null!==(i=t.name)&&void 0!==i?i:e.name),null!==t.notes&&(u.notes=null!==(s=t.notes)&&void 0!==s?s:e.notes),u}var Za=Ae({bizId:ge(xe),category:ge(ke),exchangeAmount:ge(Ae(xe)),name:ge(ke),notes:ge(ke)}),Qa=me("high","standard","low"),ei=Ae({orderId:ge(ke),orderUri:ge(ke),isEstimate:we,plugin:Ae({pluginId:ke,displayName:ke,supportEmail:ge(ke)}),payoutAddress:ke,payoutCurrencyCode:ke,payoutNativeAmount:ke,payoutWalletId:ke,refundAddress:ge(ke)});function ti(e){var t=ke(e);if(!/^\d+$/.test(t))throw new Error("Expected an integer string");return t}var ri=Ae({pluginId:ke,tokenId:Te(ke,Ie),nativeAmount:ge(ti)}),ni=Ae({fiatCurrencyCode:ke,fiatAmount:ke}),oi=Ae({pluginId:ke,displayName:ke,isDex:ge(we),orderUri:ge(ke),supportEmail:ke}),ai=Te(Ae({actionType:me("swap"),swapInfo:oi,orderId:ge(ke),orderUri:ge(ke),isEstimate:ge(we),canBePartial:ge(we),fromAsset:ri,toAsset:ri,payoutWalletId:ke,payoutAddress:ke,refundAddress:ge(ke)}),Ae({actionType:me("stake"),pluginId:ke,stakeAssets:Se(ri)}),Ae({actionType:me("fiat"),orderId:ke,orderUri:ge(ke),isEstimate:we,fiatPlugin:Ae({providerId:ke,providerDisplayName:ke,supportEmail:ge(ke)}),payinAddress:ge(ke),payoutAddress:ge(ke),fiatAsset:ni,cryptoAsset:ri}),Ae({actionType:me("tokenApproval"),tokenApproved:ri,tokenContractAddress:ke,contractAddress:ke})),ii=Ae({assetActionType:me("claim","claimOrder","stake","stakeNetworkFee","stakeOrder","unstake","unstakeNetworkFee","unstakeOrder","swap","swapNetworkFee","swapOrderPost","swapOrderFill","swapOrderCancel","buy","sell","sellNetworkFee","tokenApproval","transfer","transferNetworkFee")}),si=Se(ke),ui=Ae({enabledTokenIds:Se(ke),detectedTokenIds:Se(ke)}),ci=Ae({assetAction:ge(ii),metadata:function(e){for(var t=Za(e),r=t.exchangeAmount,n=void 0===r?{}:r,o=0,a=Object.keys(n);o<a.length;o++){var i=a[o];String(n[i]).includes("e")&&delete n[i]}return t},nativeAmount:ge(ke),providerFeeSent:ge(ke)}),fi=Ae({txid:ke,internal:we,creationDate:xe,currencies:function(e){var t=Ae(e);return Pe((function(e){for(var r=t(e),n=new Map,o=0,a=Object.keys(r);o<a.length;o++){var i=a[o];n.set(i,r[i])}return n}),(function(e){var r={};return e.forEach((function(e,t){r[t]=e})),t(r)}))}(ci),tokens:ge(function(e){var t=Ae(e);return Pe((function(e){for(var r=t(e),n=new Map,o=0,a=Object.keys(r);o<a.length;o++){var i=a[o];n.set(""===i?null:i,r[i])}return n}),(function(e){var r={};return e.forEach((function(e,t){r[null==t?"":t]=e})),t(r)}))}(ci),(function(){return new Map})),deviceDescription:ge(ke),feeRateRequested:ge(Te(Qa,eo)),feeRateUsed:ge(eo),payees:ge(Se(Ae({address:ke,amount:ke,currency:ke,tag:ge(ke)}))),savedAction:ge(ai),secret:ge(ke),swap:ge(ei)}),li=Ae({airbitzFeeWanted:xe,meta:Ae({amountFeeAirBitzSatoshi:xe,balance:xe,fee:xe,amountCurrency:xe,bizId:xe,category:ke,name:ke,notes:ke,attributes:xe,amountSatoshi:xe,amountFeeMinersSatoshi:xe,airbitzFee:xe}),ntxid:ke,state:Ae({creationDate:xe,internal:we,malleableTxId:ke})}),di=Ae({seq:xe,address:ke,state:Ae({recycleable:ge(we,!0),creationDate:ge(xe,0)}),meta:Ae({amountSatoshi:ge(xe,0)}).withRest}),pi=Ae(Ae({timestamp:xe,txidHash:ke})),hi=Ae({walletInfo:Ae({id:ke,keys:eo,type:ke})}),bi=Ae({checkpoint:ke}),vi=Ae({fiat:ge(ke),num:ge(xe)}),yi=Ae({walletName:Te(ke,Ie)}),gi=r(3546);function mi(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=[e[r],e[t]];e[t]=n[0],e[r]=n[1]}return e}function wi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function xi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wi(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ki=Qn(fa),Ii=Qn(la),Oi=Qn(da),Ei=da({}),Si="PluginSettings.json";function Ai(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];if(e[o]!==t[o])return!0}return!1}function Ti(e){return _i.apply(this,arguments)}function _i(){return _i=t(c().mark((function e(r){var n,o,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=[],o={},e.t0=ie.gQ,e.next=5,r.list("Wallets");case 5:return e.t1=e.sent,a=(0,e.t0)(e.t1),e.next=9,Promise.all(a.map(function(){var e=t(c().mark((function e(t){var a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ki.load(r,t);case 2:if(null!=(a=e.sent)){e.next=5;break}return e.abrupt("return");case 5:i=xi(xi({},Bo({dataKey:a.MK,syncKey:a.SyncKey})),{},{bitcoinKey:x.stringify(a.BitcoinSeed),format:"bip32"}),s=Ji("wallet:bitcoin",i,a.MK),n.push(s),o[s.id]={archived:a.Archived,deleted:!1,hidden:!1,migratedFromWalletId:void 0,sortIndex:a.SortIndex};case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 9:return e.abrupt("return",{walletInfos:n,walletStates:o});case 10:case"end":return e.stop()}}),e)}))),_i.apply(this,arguments)}function Pi(e){return Mi.apply(this,arguments)}function Mi(){return Mi=t(c().mark((function e(r){var n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={},e.t0=ie.gQ,e.next=4,r.list("Keys");case 4:return e.t1=e.sent,o=(0,e.t0)(e.t1),e.next=8,Promise.all(o.map(function(){var e=t(c().mark((function e(t){var o,a,i,s,u,f,l;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ii.load(r,t);case 2:if(null!=(o=e.sent)){e.next=5;break}return e.abrupt("return");case 5:a=o.id,i=o.archived,s=o.deleted,u=o.hidden,f=o.migratedFromWalletId,l=o.sortIndex,n[a]={archived:i,deleted:s,hidden:u,sortIndex:l,migratedFromWalletId:f};case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 8:return e.abrupt("return",n);case 9:case"end":return e.stop()}}),e)}))),Mi.apply(this,arguments)}function ji(e,t){return Ci.apply(this,arguments)}function Ci(){return(Ci=t(c().mark((function e(t,r){var n,o,a,i,s,u,f,l,d,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props.state.accounts[r],o=n.accountWalletInfo,a=n.accountWalletInfos,e.next=4,Promise.all(a.map((function(e){return Ti(na(t.props.state,e.id))})));case 4:return i=e.sent,e.next=7,Pi(na(t.props.state,o.id));case 7:for(s=e.sent,u=[],f=0;f<i.length;f++)l=i[f],u.push.apply(u,Ir(l.walletInfos));d=i.map((function(e){return e.walletStates})),p=Object.assign.apply(Object,[{}].concat(Ir(d),[s])),t.props.dispatch({type:"ACCOUNT_KEYS_LOADED",payload:{accountId:r,legacyWalletInfos:u,walletStates:p}});case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ni(e,t,r){return Di.apply(this,arguments)}function Di(){return Di=t(c().mark((function e(r,n,o){var a,i,s,u,f,l,d,p,h;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(a=r.props.state.accounts[n],i=a.accountWalletInfo,s=a.walletStates,u=na(r.props.state,i.id),f={},l=0,d=Object.keys(o);l<d.length;l++)p=d[l],null==s[p]?f[p]=o[p]:Ai(s[p],o[p])&&(f[p]=xi(xi({},s[p]),o[p]));if(!((h=Object.keys(f)).length<1)){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,Promise.all(h.map(function(){var e=t(c().mark((function e(t){var n,o,a,s,l,d,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=f[t],o=n.archived,a=n.deleted,s=n.hidden,l=n.migratedFromWalletId,d=n.sortIndex,p=ia(r.props.state,i.id,t),e.next=4,Ii.save(u,"Keys/".concat(p,".json"),{archived:o,deleted:a,hidden:s,id:t,migratedFromWalletId:l,sortIndex:d});case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 9:r.props.dispatch({type:"ACCOUNT_CHANGED_WALLET_STATES",payload:{accountId:n,walletStates:xi(xi({},s),f)}});case 10:case"end":return e.stop()}}),e)}))),Di.apply(this,arguments)}function Ri(e,t,r,n){return Bi.apply(this,arguments)}function Bi(){return(Bi=t(c().mark((function e(t,r,n,o){var a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.props.state.accounts[r].accountWalletInfo,s=na(t.props.state,i.id),e.next=4,Oi.load(s,Si);case 4:if(e.t1=a=e.sent,e.t0=null!==e.t1,!e.t0){e.next=8;break}e.t0=void 0!==a;case 8:if(!e.t0){e.next=12;break}e.t2=a,e.next=13;break;case 12:e.t2=Ei;case 13:return u=e.t2,e.next=16,Oi.save(s,Si,xi(xi({},u),{},{userSettings:xi(xi({},t.props.state.accounts[r].userSettings),{},ce({},n,o))}));case 16:t.props.dispatch({type:"ACCOUNT_PLUGIN_SETTINGS_CHANGED",payload:{accountId:r,pluginId:n,userSettings:xi({},o)}});case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Li(e,t,r,n){return Ki.apply(this,arguments)}function Ki(){return(Ki=t(c().mark((function e(t,r,n,o){var a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.props.state.accounts[r].accountWalletInfo,s=na(t.props.state,i.id),e.next=4,Oi.load(s,Si);case 4:if(e.t1=a=e.sent,e.t0=null!==e.t1,!e.t0){e.next=8;break}e.t0=void 0!==a;case 8:if(!e.t0){e.next=12;break}e.t2=a,e.next=13;break;case 12:e.t2=Ei;case 13:return u=e.t2,e.next=16,Oi.save(s,Si,xi(xi({},u),{},{swapSettings:xi(xi({},t.props.state.accounts[r].swapSettings),{},ce({},n,o))}));case 16:t.props.dispatch({type:"ACCOUNT_SWAP_SETTINGS_CHANGED",payload:{accountId:r,pluginId:n,swapSettings:o}});case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ui(e,t){return Fi.apply(this,arguments)}function Fi(){return(Fi=t(c().mark((function e(t,r){var n,o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props.state.accounts[r].accountWalletInfo,o=na(t.props.state,n.id),e.next=4,Oi.load(o,Si);case 4:a=e.sent,s=(i=null!=a?a:{userSettings:{},swapSettings:{}}).userSettings,u=i.swapSettings,t.props.dispatch({type:"ACCOUNT_PLUGIN_SETTINGS_LOADED",payload:{accountId:r,userSettings:s,swapSettings:u}});case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Wi=Ae({id:ke,keys:eo,type:ke}),qi=Me(Wi);function zi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Gi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?zi(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Hi(e,t){return e.find((function(e){return e.type===t}))}function Yi(e){return""===e?"account-repo:co.airbitz.wallet":"account-repo:".concat(e)}function Ji(e,t,r){var n=lr(Yt.parse(e),null!=r?r:Ro(t).dataKey);return{id:x.stringify(n),type:e,keys:t}}function Vi(e,t,r){e.props.log.breadcrumb("makeKeysKit",{});for(var n=e.props.io,o=r.map((function(e){return Gi({created:new Date},yr(n,Yt.parse(JSON.stringify(qi(e))),t.loginKey))})),a=[],i=0;i<r.length;i++){var s=r[i],u=_e(Ro)(s.keys);null!=u&&a.push(m.stringify(u.syncKey).toLowerCase())}return{loginId:t.loginId,server:_t({keyBoxes:o,newSyncKeys:a}),serverPath:"/v2/login/keys",stash:{keyBoxes:o}}}function Xi(e){for(var t=[],r=new Map,n=0;n<e.length;n++){var o=e[n],a=o.id,i=o.keys,s=o.type;if(null==a||32!==x.parse(a).length)throw new Error("Key integrity violation: invalid id ".concat(a));var u=r.get(a);if(null!=u){var c=t[u];if(c.type!==s)throw new Error("Key integrity violation for ".concat(a,": type ").concat(s," does not match ").concat(c.type));for(var f=0,l=Object.keys(i);f<l.length;f++){var d=l[f];if(null!=c.keys[d]&&c.keys[d]!==i[d])throw new Error("Key integrity violation for ".concat(a,": ").concat(d," keys do not match"))}t[u]={id:a,keys:Gi(Gi({},c.keys),i),type:s}}else r.set(a,t.length),t.push(o)}return t}function $i(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Map,n=e.appId,o=e.keyBoxes,a=void 0===o?[]:o,i=[],s=e.mnemonicBox,u=e.rootKeyBox;if(null!=s&&null!=u){var c=vr(u,t),f={mnemonic:br(s,lr(c,Yt.parse("infoKey"))),rootKey:x.stringify(c)};i.push(Ji("wallet:bitid",f,c))}if(null!=e.syncKeyBox){var l=vr(e.syncKeyBox,t),d=Yi(n),p=Bo({dataKey:t,syncKey:l});i.push(Ji(d,p,t))}var h=a.map((function(e){var n,o,a=Wi(JSON.parse(br(e,t))),i=(n=e.created,o=r.get(a.id),null==n?o:null==o?n:new Date(Math.min(n.valueOf(),o.valueOf())));return null!=i&&r.set(a.id,i),a}));return Xi([].concat(i,Ir(h))).map((function(e){return Zi(e)}))}function Zi(e){var t=e.id,r=e.keys,n=e.type,o={"wallet:bitcoin-bip44":{format:"bip44",coinType:0},"wallet:bitcoin-bip49":{format:"bip49",coinType:0},"wallet:bitcoincash-bip32":{format:"bip32"},"wallet:bitcoincash-bip44":{format:"bip44",coinType:145},"wallet:bitcoincash-bip44-testnet":{format:"bip44",coinType:1},"wallet:bitcoin-bip44-testnet":{format:"bip44",coinType:1},"wallet:bitcoin-bip49-testnet":{format:"bip49",coinType:1},"wallet:dash-bip44":{format:"bip44",coinType:5},"wallet:dogecoin-bip44":{format:"bip44",coinType:3},"wallet:litecoin-bip44":{format:"bip44",coinType:2},"wallet:litecoin-bip49":{format:"bip49",coinType:2},"wallet:feathercoin-bip49":{format:"bip49",coinType:8},"wallet:feathercoin-bip44":{format:"bip44",coinType:8},"wallet:qtum-bip44":{format:"bip44",coinType:2301},"wallet:ufo-bip49":{format:"bip49",coinType:202},"wallet:ufo-bip84":{format:"bip84",coinType:202},"wallet:zcoin-bip44":{format:"bip44",coinType:136},"wallet:bitcoin-testnet":{format:"bip32"},"wallet:bitcoin":{format:"bip32"},"wallet:bitcoincash-testnet":{format:"bip32"},"wallet:litecoin":{format:"bip32",coinType:2},"wallet:zcoin":{format:"bip32",coinType:136}};return null!=o[n]?{id:t,keys:Gi(Gi({},o[n]),r),type:n.replace(/-bip[0-9]+/,"")}:e}function Qi(e,t,r){return es.apply(this,arguments)}function es(){return(es=t(c().mark((function e(t,r,n){var o,a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=function(e,n){return null!=n&&(e=Gi(Gi({},e),{},{imported:n})),Zi(Ji(r,Gi(Gi({},Bo(Lo(t))),e)))},o=n.importText,a=n.keyOptions,null==(i=n.keys)){e.next=4;break}return e.abrupt("return",s(i));case 4:return u=Mo(t.props.state.plugins.currency,r),e.next=7,Co(t,u);case 7:if(f=e.sent,null==o){e.next=16;break}if(null!=f.importPrivateKey){e.next=11;break}throw new Error("This wallet does not support importing keys");case 11:return e.t0=s,e.next=14,f.importPrivateKey(o,a);case 14:return e.t1=e.sent,e.abrupt("return",(0,e.t0)(e.t1,!0));case 16:return e.t2=s,e.next=19,f.createPrivateKey(r,a);case 19:return e.t3=e.sent,e.abrupt("return",(0,e.t2)(e.t3,!1));case 21:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ts(e,t,r,n){return rs.apply(this,arguments)}function rs(){return(rs=t(c().mark((function e(t,r,n,o){var a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=o.enabledTokenIds,i=o.fiatCurrencyCode,s=o.migratedFromWalletId,u=o.name,e.next=3,Wa(t,n);case 3:if(f=e.sent,null==s){e.next=7;break}return e.next=7,Ni(t,r,ce({},n,{migratedFromWalletId:s}));case 7:if(null==u){e.next=10;break}return e.next=10,f.renameWallet(u);case 10:if(null==i){e.next=13;break}return e.next=13,f.setFiatCurrencyCode(i);case 13:if(!(null!=a&&a.length>0)){e.next=16;break}return e.next=16,f.changeEnabledTokenIds(a);case 16:return e.abrupt("return",f);case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ns=Rr;function os(e,t){return e+t}function as(e,t,r,n){return is.apply(this,arguments)}function is(){return(is=t(c().mark((function e(t,r,n,o){var a,i,s,u,f,l,d,p,h;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=o.now,i=void 0===a?new Date:a,s=r.passwordBox,u=r.passwordKeySnrp,f=r.username,null!=s&&null!=u&&null!=f){e.next=4;break}throw new Error("Missing data for offline password login");case 4:return l=os(f,n),e.next=7,Nr(t,l,u);case 7:return d=e.sent,p={loginId:r.loginId,loginKey:vr(s,d)},r.lastLogin=i,Yr(t,r).catch((function(){})),h=t.props.log,En(t,p).catch((function(e){return h.error(e)})),e.abrupt("return",p);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ss(e,t,r,n){return us.apply(this,arguments)}function us(){return us=t(c().mark((function e(r,n,o,a){var i,u,f,l,d,p,h;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(i=n.username)){e.next=3;break}throw new Error("Password login requires a username");case 3:return u=os(i,o),e.next=6,Promise.all([Wr(r,i),Nr(r,u,ns)]);case 6:return f=e.sent,l=s(f,2),d=l[0],p=l[1],h={userId:d,passwordAuth:p},e.next=13,mn(r,n,n,a,h,function(){var e=t(c().mark((function e(t){var n,o,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.passwordBox,o=t.passwordKeySnrp,null!=n&&!0!==n&&null!=o){e.next=3;break}throw new Error("Missing data for online password login");case 3:return e.next=5,Nr(r,u,o);case 5:return a=e.sent,e.abrupt("return",vr(n,a));case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 13:return e.abrupt("return",e.sent);case 14:case"end":return e.stop()}}),e)}))),us.apply(this,arguments)}function cs(e,t,r,n){return fs.apply(this,arguments)}function fs(){return(fs=t(c().mark((function e(t,r,n,o){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,as(t,r,n,o).catch((function(){return ss(t,r,n,o)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ls(e,t,r){return ds.apply(this,arguments)}function ds(){return(ds=t(c().mark((function e(t,r,n){var o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t.props.state.accounts[r],a=o.loginTree,i=o.sessionKey,null!=(s=o.stashTree.username)){e.next=5;break}throw new Error("Password login requires a username");case 5:return e.next=7,ys(t,a,s,n);case 7:return u=e.sent,e.next=10,xn(t,i,u);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ps(e,t,r){return hs.apply(this,arguments)}function hs(){return hs=t(c().mark((function e(t,r,n){var o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=r.username,a=r.passwordAuth,null!=o&&null!=a){e.next=3;break}return e.abrupt("return",!1);case 3:return i=os(o,n),e.next=6,Nr(t,i,ns);case 6:s=e.sent,u=0;case 8:if(!(u<a.length)){e.next=14;break}if(s[u]===a[u]){e.next=11;break}return e.abrupt("return",!1);case 11:++u,e.next=8;break;case 14:return e.abrupt("return",!0);case 15:case"end":return e.stop()}}),e)}))),hs.apply(this,arguments)}function bs(e,t){return vs.apply(this,arguments)}function vs(){return(vs=t(c().mark((function e(t,r){var n,o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props.state.accounts[r],o=n.loginTree,a=n.sessionKey,i={loginId:o.loginId,server:void 0,serverMethod:"DELETE",serverPath:"/v2/login/password",stash:{passwordAuthSnrp:void 0,passwordBox:void 0,passwordKeySnrp:void 0}},null!=o.loginAuth&&(i.stash.passwordAuthBox=void 0),e.next=5,xn(t,a,i);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ys(e,t,r,n){return gs.apply(this,arguments)}function gs(){return gs=t(c().mark((function e(r,n,o,a){var i,u,f,l,d,p,h,b,v,y;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=os(o,a),u=r.props.io,e.next=4,Promise.all([Cr(r).then(function(){var e=t(c().mark((function e(t){var o,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Nr(r,i,t);case 2:return o=e.sent,a=yr(u,n.loginKey,o),e.abrupt("return",{passwordKeySnrp:t,passwordBox:a});case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),Nr(r,i,ns).then((function(e){return{passwordAuth:e,passwordAuthBox:yr(u,e,n.loginKey)}}))]);case 4:return f=e.sent,l=s(f,2),d=l[0],p=d.passwordKeySnrp,h=d.passwordBox,b=l[1],v=b.passwordAuth,y=b.passwordAuthBox,e.abrupt("return",{loginId:n.loginId,server:xt({passwordAuth:v,passwordAuthSnrp:ns,passwordKeySnrp:p,passwordBox:h,passwordAuthBox:y}),serverPath:"/v2/login/password",stash:{passwordKeySnrp:p,passwordBox:h,passwordAuthBox:y}});case 13:case"end":return e.stop()}}),e)}))),gs.apply(this,arguments)}function ms(e,t){return lr(null==t?Uint8Array.from([0]):Yt.parse(t),e)}function ws(e,t){return lr(Yt.parse(t),e)}function xs(e,t){if(null!=e.pin2Key)return e;var r=dn(e,(function(e){return e.appId===t}));return null!=(null==r?void 0:r.pin2Key)?r:void 0}function ks(e,t,r,n,o){return Is.apply(this,arguments)}function Is(){return Is=t(c().mark((function e(r,n,o,a,i){var s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(s=xs(o,n))&&null!=s.pin2Key){e.next=3;break}throw new Error("PIN login is not enabled for this account on this device");case 3:return u=s.pin2Key,f={pin2Id:ms(u,o.username),pin2Auth:ws(u,a)},e.next=7,mn(r,o,s,i,f,function(){var e=t(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=t.pin2Box&&!0!==t.pin2Box){e.next=2;break}throw new Error("Missing data for PIN v2 login");case 2:return e.abrupt("return",vr(t.pin2Box,u));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 7:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}}),e)}))),Is.apply(this,arguments)}function Os(e,t,r){return Es.apply(this,arguments)}function Es(){return(Es=t(c().mark((function e(t,r,n){var o,a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t.props.state.accounts[r],a=o.loginTree,i=o.stashTree.username,s=n.pin,null==(u=n.enableLogin)&&(u=null!=a.pin2Key||null!=s&&null==a.pin),null==s&&(s=a.pin),null!=s){e.next=12;break}if(!u){e.next=9;break}throw new Error("Please change your PIN in the settings area above before enabling.");case 9:return e.next=11,In(t,a,Cs(a));case 11:return e.abrupt("return");case 12:return f=Ps(t,a,i,s,u),e.next=15,In(t,a,f);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ss(e,t,r){return As.apply(this,arguments)}function As(){return As=t(c().mark((function e(t,r,n){var o,a,i,s,u,f,l,d;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=r.appId,a=r.loginId,null!=(i=r.username)){e.next=3;break}return e.abrupt("return",!1);case 3:if(s=Kr(t,a),u=s.stashTree,null!=(f=xs(u,o))&&null!=f.pin2Key){e.next=7;break}throw new Error("No PIN set locally for this account");case 7:return l=f.pin2Key,d={pin2Id:ms(l,i),pin2Auth:ws(l,n),otp:$r(r)},e.next=11,_r(t,"POST","/v2/login",d).then((function(e){return!0}),(function(e){return!1}));case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}}),e)}))),As.apply(this,arguments)}function Ts(e,t){return _s.apply(this,arguments)}function _s(){return(_s=t(c().mark((function e(t,r){var n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props.state.accounts[r].loginTree,o=Cs(n),e.next=4,In(t,n,o);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ps(e,t,r,n,o){for(var a=[js(e,t,r,n,o)],i=0,s=t.children;i<s.length;i++){var u=s[i];a.push.apply(a,Ir(Ps(e,u,r,n,o)))}return a}function Ms(e,t){var r=e.loginId,n=e.pin2Key;if(null!=n)return{loginId:r,server:kt({pin2Id:ms(n,t)}),serverPath:"",stash:{}}}function js(e,t,r,n,o){var a=e.props.io,i=yr(a,Yt.parse(n),t.loginKey);if(o){var s=t.loginId,u=t.loginKey,c=t.pin2Key,f=void 0===c?a.random(32):c,l=yr(a,u,f),d=yr(a,f,u);return{loginId:s,server:It({pin2Id:ms(f,r),pin2Auth:ws(f,n),pin2Box:l,pin2KeyBox:d,pin2TextBox:i}),serverPath:"/v2/login/pin2",stash:{pin2Key:f,pin2TextBox:i}}}return{loginId:t.loginId,server:It({pin2Id:void 0,pin2Auth:void 0,pin2Box:void 0,pin2KeyBox:void 0,pin2TextBox:i}),serverPath:"/v2/login/pin2",stash:{pin2Key:void 0,pin2TextBox:i}}}function Cs(e){for(var t=[Ns(e)],r=0,n=e.children;r<n.length;r++){var o=n[r];t.push.apply(t,Ir(Cs(o)))}return t}function Ns(e){return{loginId:e.loginId,server:void 0,serverMethod:"DELETE",serverPath:"/v2/login/pin2",stash:{pin2Key:void 0}}}function Ds(e,t){return lr(Yt.parse(t),e)}function Rs(e,t){return t.map((function(t){return lr(Yt.parse(t),e)}))}function Bs(e,t,r,n,o){return Ls.apply(this,arguments)}function Ls(){return Ls=t(c().mark((function e(r,n,o,a,i){var s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(s=n.username)){e.next=3;break}throw new Error("Recovery login requires a username");case 3:return u={recovery2Id:Ds(o,s),recovery2Auth:Rs(o,a)},e.next=6,mn(r,n,n,i,u,function(){var e=t(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=t.recovery2Box&&!0!==t.recovery2Box){e.next=2;break}throw new Error("Missing data for recovery v2 login");case 2:return e.abrupt("return",vr(t.recovery2Box,o));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)}))),Ls.apply(this,arguments)}function Ks(e,t,r){return Us.apply(this,arguments)}function Us(){return(Us=t(c().mark((function e(t,r,n){var o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o={recovery2Id:Ds(r,n)},e.next=3,_r(t,"POST","/v2/login",o);case 3:if(a=e.sent,i=pt(a),null!=(s=i.question2Box)){e.next=7;break}throw new Error("Login has no recovery questions");case 7:return e.abrupt("return",Ys(JSON.parse(br(s,r))));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fs(e,t,r,n){return Ws.apply(this,arguments)}function Ws(){return(Ws=t(c().mark((function e(t,r,n,o){var a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.props.state.accounts[r],i=a.loginTree,s=a.sessionKey,null!=(u=a.stashTree.username)){e.next=5;break}throw new Error("Recovery login requires a username");case 5:return f=Hs(t,i,u,n,o),e.next=8,xn(t,s,f);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qs(e,t){return zs.apply(this,arguments)}function zs(){return(zs=t(c().mark((function e(t,r){var n,o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props.state.accounts[r],o=n.loginTree,a=n.sessionKey,i={login:{recovery2Key:void 0},loginId:o.loginId,server:void 0,serverMethod:"DELETE",serverPath:"/v2/login/recovery2",stash:{recovery2Key:void 0}},e.next=4,xn(t,a,i);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Gs(e,t){var r=e.loginId,n=e.recovery2Key;if(null!=n)return{loginId:r,server:Ot({recovery2Id:Ds(n,t)}),serverPath:"",stash:{}}}function Hs(e,t,r,n,o){var a=e.props.io;if(!Array.isArray(n))throw new TypeError("Questions must be an array of strings");if(!Array.isArray(o))throw new TypeError("Answers must be an array of strings");var i=t.loginId,s=t.loginKey,u=t.recovery2Key,c=void 0===u?a.random(32):u,f=yr(a,Yt.parse(JSON.stringify(Js(n))),c),l=yr(a,s,c),d=yr(a,c,s);return{loginId:i,server:Et({recovery2Id:Ds(c,r),recovery2Auth:Rs(c,o),recovery2Box:l,recovery2KeyBox:d,question2Box:f}),serverPath:"/v2/login/recovery2",stash:{recovery2Key:c}}}var Ys=Se(ke),Js=Me(Ys);function Vs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Xs(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Vs(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vs(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function $s(e,t,r){return Zs.apply(this,arguments)}function Zs(){return Zs=t(c().mark((function e(t,r,n){var o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=function(e){for(var r=[Qs(t,e,n)],o=0,i=e.children;o<i.length;o++){var s=i[o];r.push.apply(r,Ir(a(s)))}return r},o=t.props.state.accounts[r].loginTree,e.next=4,Promise.all(a(o));case 4:return i=e.sent,e.next=7,In(t,o,i);case 7:case"end":return e.stop()}}),e)}))),Zs.apply(this,arguments)}function Qs(e,t,r){return eu.apply(this,arguments)}function eu(){return eu=t(c().mark((function e(t,r,n){var o,a,i,s,u,f,l,d,p,h,b,v;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=n.password,f=n.username,l=r.isRoot,d=r.loginId,null==r.passwordAuth||null!=u){e.next=4;break}throw new Error("A password is required to change the username");case 4:if(p=Ms(r,f),h=Gs(r,f),null==u){e.next=10;break}return e.next=9,ys(t,r,f,u);case 9:b=e.sent;case 10:if(!l){e.next=14;break}return e.next=13,tu(t,r,f);case 13:v=e.sent;case 14:if(null!=b||null!=p||null!=h||null!=v){e.next=16;break}return e.abrupt("return");case 16:return e.abrupt("return",{loginId:d,server:Xs(Xs(Xs(Xs({},null===(o=b)||void 0===o?void 0:o.server),null==p?void 0:p.server),null==h?void 0:h.server),null===(a=v)||void 0===a?void 0:a.server),serverPath:"/v2/login/username",stash:Xs(Xs(Xs(Xs({},null===(i=b)||void 0===i?void 0:i.stash),null==p?void 0:p.stash),null==h?void 0:h.stash),null===(s=v)||void 0===s?void 0:s.stash)});case 17:case"end":return e.stop()}}),e)}))),eu.apply(this,arguments)}function tu(e,t,r){return ru.apply(this,arguments)}function ru(){return ru=t(c().mark((function e(t,r,n){var o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.props.io,a=r.loginId,i=r.loginKey,e.next=4,Wr(t,n);case 4:return s=e.sent,e.abrupt("return",{loginId:a,server:At({userId:s,userTextBox:yr(o,Yt.parse(n),i)}),serverPath:"",stash:{userId:s,username:n}});case 6:case"end":return e.stop()}}),e)}))),ru.apply(this,arguments)}function nu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ou(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?nu(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nu(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function au(e,t,r){return iu.apply(this,arguments)}function iu(){return(iu=t(c().mark((function e(t,r,n){var o,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wr(t,r);case 2:return o=e.sent,a={challengeId:n,userId:o},e.next=6,_r(t,"POST","/v2/login",a).then((function(e){return!1})).catch((function(e){if(null!=cr(e))return!0;throw e}));case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function su(e,t,r,n){return uu.apply(this,arguments)}function uu(){return uu=t(c().mark((function e(t,r,n,o){var a,i,s,u,f,l,d,p,h,b,v,y,g,m,w,x,k,I,O,E,S,A,T,_,P;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(h=o.keyInfo,b=o.password,v=o.pin,y=o.username,g=t.props.io,t.props.log.breadcrumb("makeCreateKit",{}),m=null==r,w=g.random(32),x=g.random(32),k={loginId:w,loginKey:x},I={appId:n,lastLogin:new Date,loginId:w,loginKey:x,isRoot:m,pendingVouchers:[],children:[]},O=jr(t,I),null!=h&&(E=Vi(t,k,[h])),null!=r&&(S=yr(g,x,r.loginKey)),null==b||null==y){e.next=15;break}return e.next=14,ys(t,I,y,b);case 14:A=e.sent;case 15:if(null!=v&&(T=js(t,I,y,v,!0)),!m||null==y){e.next=20;break}return e.next=19,tu(t,I,y);case 19:_=e.sent;case 20:return P={loginId:w,server:ou(ou(ou(ou(ou(ou({},Pt({appId:n,loginId:w,parentBox:S})),null===(a=E)||void 0===a?void 0:a.server),null===(i=A)||void 0===i?void 0:i.server),null===(s=T)||void 0===s?void 0:s.server),O.server),null===(u=_)||void 0===u?void 0:u.server),serverPath:"/v2/login/create",stash:ou(ou(ou(ou(ou({appId:n,loginId:w,parentBox:S},null===(f=E)||void 0===f?void 0:f.stash),null===(l=A)||void 0===l?void 0:l.stash),null===(d=T)||void 0===d?void 0:d.stash),O.stash),null===(p=_)||void 0===p?void 0:p.stash)},e.abrupt("return",{kit:P,sessionKey:k});case 22:case"end":return e.stop()}}),e)}))),uu.apply(this,arguments)}function cu(e,t,r){return fu.apply(this,arguments)}function fu(){return(fu=t(c().mark((function e(t,r,n){var o,a,i,s,u,f,l;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=r.challengeId,a=r.now,i=void 0===a?new Date:a,t.props.log.breadcrumb("createLogin",{}),e.next=4,su(t,void 0,"",n);case 4:return s=e.sent,u=s.kit,f=s.sessionKey,l={challengeId:o,data:u.server},e.next=10,_r(t,"POST",u.serverPath,l);case 10:return u.stash.lastLogin=i,e.next=13,Yr(t,u.stash);case 13:return e.abrupt("return",f);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function lu(e,t,r,n){return du.apply(this,arguments)}function du(){return(du=t(c().mark((function e(t,r,n,o){var a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return null!=r.pin2TextBox&&(a=br(r.pin2TextBox,n.loginKey)),e.next=3,su(t,n,o,{keyInfo:Ji(Yi(o),Bo(Lo(t))),pin:a,username:r.username});case 3:return i=e.sent,s=i.kit,u={loginId:n.loginId,server:s.server,serverPath:s.serverPath,stash:{children:[s.stash]}},e.next=8,xn(t,n,u);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pu(e,t,r,n){return hu.apply(this,arguments)}function hu(){return(hu=t(c().mark((function e(t,r,n,o){var a,i,s,u,f,l,d;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.props.log,null!=(i=dn(r,(function(e){return e.appId===o})))){e.next=7;break}return t.props.log.breadcrumb("createChildLogin",{}),e.next=6,lu(t,r,n,o);case 6:case 17:return e.abrupt("return",e.sent);case 7:if(s=An(r,n,i.loginId),u=$i(i,s.loginKey),a.warn("Login: decrypted keys for user ".concat(x.stringify(r.loginId))),f=Yi(o),null!=Hi(u,f)){e.next=18;break}return t.props.log.breadcrumb("createAccountRepo",{}),l=Ji(f,Bo(Lo(t))),d=Vi(t,s,[l]),e.next=17,xn(t,n,d);case 18:return e.abrupt("return",r);case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bu(e,t,r,n){return vu.apply(this,arguments)}function vu(){return(vu=t(c().mark((function e(t,r,n,o){var a,i,s,u,f,l;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=o.pauseWallets,i=void 0!==a&&a,s=t.props.state.login.appId,u=t.props.log,t.props.log.breadcrumb("makeAccount",{}),f=Kr(t,r.loginId),l=f.stashTree,e.next=7,pu(t,l,r,s);case 7:return u.warn("Login: account exists for appId"),t.props.dispatch({type:"LOGIN",payload:{loginType:n,pauseWallets:i,rootLoginId:l.loginId,sessionKey:r}}),e.next=11,yu(t,t.props.state.lastAccountId);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function yu(e,t){return e.waitFor((function(e){var r=e.state.accounts[t];if(null!=r.loadFailure)throw r.loadFailure;var n=e.output.accounts[t];if(null!=(null==n?void 0:n.accountApi))return n.accountApi}))}var gu=r(6266),mu=r.n(gu),wu=r(2956);wu.BU;const xu=wu.j6;function ku(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Iu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ku(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ku(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Ou=new(0,mu().ec)("secp256k1");function Eu(e,t){var r=e.derive(Ou.keyFromPublic(t).getPublic()).toArray("be");return lr(Uint8Array.from([0,0,0,1].concat(Ir(r))),Yt.parse("dataKey"))}function Su(e,t){var r=Eu(e,t.publicKey);return JSON.parse(br(t.box,r))}function Au(e,t,r){var n=Ou.genKeyPair({entropy:e.random(32)}),o=Eu(n,t);return{publicKey:Uint8Array.from(n.getPublic().encodeCompressed()),box:yr(e,Yt.parse(JSON.stringify(r)),o)}}function Tu(e,t){return _u.apply(this,arguments)}function _u(){return _u=t(c().mark((function e(r,n){var o,a,i,u,f,l,d,p,h,b,v,y,g,m,w,x=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=x.length>2&&void 0!==x[2]?x[2]:1e3,a=r.props.io,i=n.timeout,u=void 0===i?600:i,f=Ou.genKeyPair({entropy:a.random(32)}),l=Uint8Array.from(f.getPublic().encodeCompressed()),d=Ht.stringify(dr(dr(l)).slice(0,10)),p={data:yt(Iu(Iu({},n),{},{publicKey:l,timeout:u}))},e.next=9,_r(r,"PUT","/v2/lobby/".concat(d),p);case 9:return h=xu(),b=s(h,2),v=b[0],y=b[1],g=[],m=function(){var e=t(c().mark((function e(){var t,n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=it,e.next=3,_r(r,"GET","/v2/lobby/"+d);case 3:for(e.t1=e.sent,t=(0,e.t0)(e.t1);g.length<t.replies.length;)n=t.replies[g.length],o=Su(f,n),y("reply",o),g.push(o);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),(w=_o(m,o,{onError:function(e){y("error",e)}})).start({wait:!1}),e.abrupt("return",{close:function(){return w.stop()},lobbyId:d,on:v,replies:g});case 15:case"end":return e.stop()}}),e)}))),_u.apply(this,arguments)}function Pu(e,t){return Mu.apply(this,arguments)}function Mu(){return(Mu=t(c().mark((function e(t,r){var n,o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=it,e.next=3,_r(t,"GET","/v2/lobby/"+r);case 3:if(e.t1=e.sent,n=(0,e.t0)(e.t1),o=n.request.publicKey,a=dr(dr(o)),pr(i=Ht.parse(r),a.subarray(0,i.length))){e.next=10;break}throw new Error("Lobby ECDH integrity error");case 10:return e.abrupt("return",n.request);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ju(e,t,r,n){return Cu.apply(this,arguments)}function Cu(){return(Cu=t(c().mark((function e(t,r,n,o){var a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.props.io,i=n.publicKey,s={data:vt(Au(a,i,o))},e.next=5,_r(t,"POST","/v2/lobby/"+r,s);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Nu=Ae({appId:ke,loginKey:Be,loginStash:Vr});function Du(e,t,r,n){return Ru.apply(this,arguments)}function Ru(){return(Ru=t(c().mark((function e(t,r,n,o){var a,i,s,u,f,l,d;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=o.now,i=void 0===a?new Date:a,s=r.loginKey,u=r.loginStash,t.props.log.breadcrumb("unpackAccount",{}),null!=(f=dn(u,(function(e){return e.appId===n})))){e.next=6;break}throw new Error('Cannot find requested appId: "'.concat(n,'"'));case 6:try{l=Kr(t,f.loginId),f.voucherId=l.stash.voucherId,f.voucherAuth=l.stash.voucherAuth}catch(c){}return u.lastLogin=i,e.next=10,Yr(t,u);case 10:return d={loginId:f.loginId,loginKey:s},e.next=13,En(t,d);case 13:return e.next=15,bu(t,d,"edgeLogin",o);case 15:return e.abrupt("return",e.sent);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Bu(e,t){return Lu.apply(this,arguments)}function Lu(){return Lu=t(c().mark((function e(r,n){var o,a,i,s,u,f,l,d,p,h,b=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=function(){return(l=t(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=0;t<p.length;t++)(0,p[t])();h.state="closed",H(h),z(h);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)},f=function(){return l.apply(this,arguments)},u=function(){return(u=t(c().mark((function e(t){var a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(a=0;a<p.length;a++)(0,p[a])();return i=Nu(t),s=i.loginStash.username,h.state="started",h.username=s,H(h),e.next=8,Du(r,i,n,o);case 8:u=e.sent,h.state="done",h.account=u,H(h),z(h);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)},s=function(e){return u.apply(this,arguments)},i=function(e){for(var t=0;t<p.length;t++){(0,p[t])()}h.state="error",h.error=e,H(h),z(h)},a=function(e){h.error=e,H(h)},o=b.length>2&&void 0!==b[2]?b[2]:{},e.next=9,Tu(r,{loginRequest:{appId:n}});case 9:return d=e.sent,p=[d.close,d.on("error",a),d.on("reply",(function(e){s(e).catch(i)}))],h={id:d.lobbyId,cancelRequest:f,watch:ne,state:"pending",account:void 0,error:void 0,username:void 0},e.abrupt("return",C(h));case 13:case"end":return e.stop()}}),e)}))),Lu.apply(this,arguments)}var Ku=Me(Nu),Uu=Ae({appName:ke,darkImageUrl:ge(ke),lightImageUrl:ge(ke),imageUrl:ge(ke)});function Fu(e,t){return Wu.apply(this,arguments)}function Wu(){return(Wu=t(c().mark((function e(t,r){var n,o,a,i,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=mi(t.props.state.infoServers),o=s(n,1),a=o[0],i="".concat(a,"/v1/appIdInfo/").concat(r),e.next=5,t.props.io.fetch(i,{corsBypass:"never"});case 5:if(404!==(u=e.sent).status){e.next=8;break}return e.abrupt("return",{appName:r});case 8:if(u.ok){e.next=10;break}throw new Error("Fetching ".concat(i," returned ").concat(u.status));case 10:return e.t0=Uu,e.next=13,u.json();case 13:return e.t1=e.sent,null==(f=(0,e.t0)(e.t1)).lightImageUrl&&(f.lightImageUrl=f.imageUrl),null==f.darkImageUrl&&(f.darkImageUrl=f.imageUrl),e.abrupt("return",f);case 20:return e.prev=20,e.t2=e.catch(0),t.props.onError(e.t2),e.abrupt("return",{appName:r});case 24:case"end":return e.stop()}}),e,null,[[0,20]])})))).apply(this,arguments)}function qu(e,t,r,n,o){return zu.apply(this,arguments)}function zu(){return zu=t(c().mark((function e(t,r,n,o,a){var i,s,u,f,l,d,p,h,b;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.props.state.accounts[r].sessionKey,t.props.log.breadcrumb("approveLoginRequest",{}),e.next=4,En(t,i);case 4:return s=Kr(t,i.loginId),u=s.stashTree,e.next=7,pu(t,u,i,n);case 7:if(f=e.sent,null!=(l=dn(f,(function(e){return e.appId===n})))){e.next=11;break}throw new Error("Failed to create the requested login object");case 11:return d=An(f,i,l.loginId),p=Ku({appId:n,loginKey:d.loginKey,loginStash:gn(f,n)}),e.next=15,ju(t,o,a,p);case 15:null!=(b=t.props.output.accounts[r].accountApi)&&b.on("close",(function(){null!=h&&clearTimeout(h)})),h=setTimeout((function(){h=void 0,En(t,i).then((function(){h=setTimeout((function(){h=void 0,En(t,i).catch((function(e){return t.props.onError(e)}))}),2e4)})).catch((function(e){return t.props.onError(e)}))}),1e4);case 18:case"end":return e.stop()}}),e)}))),zu.apply(this,arguments)}function Gu(e,t,r){return Hu.apply(this,arguments)}function Hu(){return(Hu=t(c().mark((function e(t,r,n){var o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Pu(t,n);case 2:if(null==(o=e.sent).loginRequest){e.next=7;break}return e.next=6,Yu(t,r,n,o,o.loginRequest.appId);case 6:a=e.sent;case 7:return C(i={loginRequest:a}),e.abrupt("return",i);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Yu(e,t,r,n,o){return Ju.apply(this,arguments)}function Ju(){return(Ju=t(c().mark((function e(r,n,o,a,i){var s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.props.log.breadcrumb("unpackLoginRequest",{}),e.next=3,Fu(r,i);case 3:return s=e.sent,C(u={appId:i,displayName:s.appName,displayImageDarkUrl:s.darkImageUrl,displayImageLightUrl:s.lightImageUrl,approve:function(){return qu(r,n,i,o,a)},close:function(){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:z(u);case 1:case"end":return e.stop()}}),e)})))()}}),e.abrupt("return",u);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Vu(e){for(var t={},r=0,n=Object.keys(e);r<n.length;r++){var o=n[r];t[e[o].currencyCode]=o}return t}function Xu(){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments.length>3?arguments[3]:void 0,r=Vu(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),n=Vu(e),o=[],a=0;a<t.length;a++){var i,s=t[a],u=null!==(i=n[s])&&void 0!==i?i:r[s];null!=u&&o.push(u)}return o}function $u(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>3?arguments[3]:void 0,n=[],o=0;o<r.length;o++){var a,i=r[o],s=null!==(a=t[i])&&void 0!==a?a:e[i];null!=s&&n.push(s.currencyCode)}return n}function Zu(e){for(var t=new Set(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]),r=[],n=0;n<e.length;n++){var o=e[n];t.has(o)||(t.add(o),r.push(o))}return r}function Qu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ec(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qu(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qu(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var tc="Currency.json",rc="fixedLegacyFileNames.json",nc="EnabledTokens.json",oc="seenTxCheckpoint.json",ac="Tokens.json",ic="WalletName.json",sc=Qn(di),uc=Qn(pi),cc=Qn(si),fc=Qn(li),lc=Qn(bi),dc=Qn(ui),pc=Qn(fi),hc=Qn(vi),bc=Qn(yi);function vc(e,t,r){return yc.apply(this,arguments)}function yc(){return(yc=t(c().mark((function e(t,r,n){var o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.props,a=o.state,i=o.walletId,s=na(a,i),e.next=4,dc.save(s,ac,{detectedTokenIds:r,enabledTokenIds:n});case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gc(e,t,r){var n={creationDate:e.state.creationDate,currencies:new Map,tokens:new Map,internal:e.state.internal,txid:e.state.malleableTxId},o={};return o[r]=e.meta.amountCurrency,n.currencies.set(t,{metadata:{bizId:e.meta.bizId,category:e.meta.category,exchangeAmount:o,name:e.meta.name,notes:e.meta.notes},providerFeeSent:e.meta.amountFeeAirBitzSatoshi.toFixed()}),n}function mc(e,t,r,n){var o,a=e.currency.wallets[t].fileNames,i=ia(e,t,r),s=(null!==(o=a[i])&&void 0!==o?o:{}).creationDate,u=void 0===s?Math.min(n,Date.now()/1e3):s,c="".concat(u.toFixed(0),"-").concat(i,".json");return{creationDate:u,fileName:c,txidHash:i}}function wc(e,t){return xc.apply(this,arguments)}function xc(){return(xc=t(c().mark((function e(t,r){var n,o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props,o=n.dispatch,a=n.state,i=n.walletId,s=na(a,i),e.next=4,bc.save(s,ic,{walletName:r});case 4:o({type:"CURRENCY_WALLET_NAME_CHANGED",payload:{name:r,walletId:i}});case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kc(e,t){return Ic.apply(this,arguments)}function Ic(){return(Ic=t(c().mark((function e(t,r){var n,o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.props,o=n.dispatch,a=n.state,i=n.walletId,s=na(a,i),/^iso:/.test(r)){e.next=4;break}throw new TypeError("Fiat currency codes must start with `iso:`");case 4:return e.next=6,hc.save(s,tc,{fiat:r,num:void 0});case 6:o({type:"CURRENCY_WALLET_FIAT_CHANGED",payload:{fiatCurrencyCode:r,walletId:i}});case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Oc(e){return Ec.apply(this,arguments)}function Ec(){return(Ec=t(c().mark((function e(t){var r,n,o,a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.props,n=r.dispatch,o=r.state,a=r.walletId,i=na(o,a),e.next=4,hc.load(i,tc);case 4:s=e.sent,u="iso:USD",null!=s&&(null!=s.fiat?u=s.fiat:null!=s.num&&null!=(f=(0,gi.Rx)("000".concat(s.num).slice(-3)))&&(u="iso:".concat(f.code))),n({type:"CURRENCY_WALLET_FIAT_CHANGED",payload:{fiatCurrencyCode:u,walletId:a}});case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Sc(e){return Ac.apply(this,arguments)}function Ac(){return(Ac=t(c().mark((function e(t){var r,n,o,a,i,s,u,f,l,d,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.props,n=r.dispatch,o=r.state,a=r.walletId,i=na(o,a),e.next=4,bc.load(i,ic);case 4:if(s=e.sent,u=null,null!=s&&null!=s.walletName){e.next=17;break}if(f=t.props.walletState.walletInfo.appIds,null==(l=(void 0===f?[]:f).find((function(e){return""!==e})))){e.next=15;break}return e.next=12,Fu(ld(t),l);case 12:d=e.sent,p=d.appName,u=p;case 15:e.next=18;break;case 17:u=s.walletName;case 18:n({type:"CURRENCY_WALLET_NAME_CHANGED",payload:{name:"string"==typeof u?u:null,walletId:a}});case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Tc(e){return _c.apply(this,arguments)}function _c(){return(_c=t(c().mark((function e(t){var r,n,o,a,i,s,u,f,l,d,p,h,b,v,y;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.props,n=r.dispatch,o=r.state,a=r.walletId,i=na(o,a),e.next=4,dc.load(i,ac);case 4:if(null==(s=e.sent)){e.next=10;break}return u=a.slice(0,2),t.props.log.warn("enabledTokenIds: ".concat(u," loaded modern file")),n({type:"CURRENCY_WALLET_LOADED_TOKEN_FILE",payload:ec({walletId:t.props.walletId},s)}),e.abrupt("return");case 10:return e.next=12,cc.load(i,nc);case 12:null!=(f=e.sent)&&(l=t.props.walletState,d=l.accountId,p=l.currencyInfo,h=l.pluginId,b=t.props.state.accounts[d],v=Xu(b.builtinTokens[h],b.customTokens[h],p,f),y=a.slice(0,2),t.props.log.warn("enabledTokenIds: ".concat(y," loaded legacy file")),n({type:"CURRENCY_WALLET_LOADED_TOKEN_FILE",payload:{walletId:t.props.walletId,detectedTokenIds:[],enabledTokenIds:v}}));case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pc(e,t){return Mc.apply(this,arguments)}function Mc(){return Mc=t(c().mark((function e(r,n){var o,a,i,s,u,f,l,d;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=r.props,a=o.dispatch,i=o.walletId,s=na(r.props.state,i),u=r.props.walletState.currencyInfo.currencyCode,f=r.props.walletState.fileNames,l=r.props.walletState.fiat,d={},e.next=8,Promise.all(n.map(function(){var e=t(c().mark((function e(t){var r,n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=f[t]){e.next=2;break}return e.abrupt("return");case 2:return r="Transactions/".concat(f[t].fileName),e.next=5,fc.load(s,r);case 5:if(null!=(n=e.sent)){e.next=8;break}return e.abrupt("return");case 8:d[t]=gc(n,u,l);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 8:return e.next=10,Promise.all(n.map(function(){var e=t(c().mark((function e(t){var r,n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=f[t]){e.next=2;break}return e.abrupt("return");case 2:return r="transaction/".concat(f[t].fileName),e.next=5,pc.load(s,r);case 5:if(null!=(n=e.sent)){e.next=8;break}return e.abrupt("return");case 8:d[t]=n;case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 10:return a({type:"CURRENCY_WALLET_FILES_LOADED",payload:{files:d,walletId:i}}),e.abrupt("return",d);case 12:case"end":return e.stop()}}),e)}))),Mc.apply(this,arguments)}function jc(e,t,r){return Cc.apply(this,arguments)}function Cc(){return Cc=t(c().mark((function e(r,n,o){var a,i,s,u,f,l,d,p,h,b,v,y;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=oa(r,n),e.next=3,uc.load(i,rc);case 3:if(e.t1=a=e.sent,e.t0=null!==e.t1,!e.t0){e.next=7;break}e.t0=void 0!==a;case 7:if(!e.t0){e.next=11;break}e.t2=a,e.next=12;break;case 11:e.t2={};case 12:return s=e.t2,e.t3=ie.gQ,e.next=16,o.list();case 16:for(e.t4=e.sent,u=(0,e.t3)(e.t4),f={},l=[],d=0;d<u.length;d++)p=u[d],null!=(h=s[p])?(b=h.timestamp,v=h.txidHash,f[v]={creationDate:b,fileName:p}):l.push(p);if(y=l.map(function(){var e=t(c().mark((function e(t){var a,i,u,l,d,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fc.load(o,t);case 2:if(null!=(a=e.sent)){e.next=5;break}return e.abrupt("return");case 5:i=a.state,u=i.creationDate,l=i.malleableTxId,d=t,p=ia(r,n,l),f[p]={creationDate:u,fileName:d},s[d]={timestamp:u,txidHash:p};case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),!(y.length>0)){e.next=27;break}return e.next=25,Promise.all(y);case 25:return e.next=27,uc.save(i,rc,s).catch((function(){}));case 27:return e.abrupt("return",f);case 28:case"end":return e.stop()}}),e)}))),Cc.apply(this,arguments)}function Nc(e){return Dc.apply(this,arguments)}function Dc(){return(Dc=t(c().mark((function e(t){var r,n,o,a,i,u,f,l,d,p,h,b,v,y,g,m;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.props,n=r.dispatch,o=r.state,a=r.walletId,i=na(o,a),e.next=4,jc(o,a,(0,ie.HN)(i,"Transactions"));case 4:return u=e.sent,e.next=7,(0,ie.HN)(i,"transaction").list();case 7:for(f=e.sent,l=0,d=(0,ie.gQ)(f);l<d.length;l++)p=d[l],h=p.split(".json")[0],b=h.split("-"),v=s(b,2),y=v[0],g=v[1],m=parseInt(y),(null==u[g]||m<u[g].creationDate)&&(u[g]={creationDate:m,fileName:p});n({type:"CURRENCY_WALLET_FILE_NAMES_LOADED",payload:{txFileNames:u,walletId:a}});case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Rc(e){return Bc.apply(this,arguments)}function Bc(){return Bc=t(c().mark((function e(r){var n,o,a,i,s,u,f,l;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=r.props,a=o.state,i=o.walletId,s=na(a,i),u=[],e.t0=ie.gQ,e.next=6,s.list("Addresses");case 6:return e.t1=e.sent,f=(0,e.t0)(e.t1),e.next=10,Promise.all(f.map(function(){var e=t(c().mark((function e(t){var r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,sc.load(s,t);case 2:if(null!=(r=e.sent)){e.next=5;break}return e.abrupt("return");case 5:if(""!==r.address&&!r.state.recycleable){e.next=7;break}return e.abrupt("return");case 7:u.push(r.address);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 10:if(null==(l=null===(n=r.props.walletOutput)||void 0===n?void 0:n.engine)){e.next=14;break}return e.next=14,l.addGapLimitAddresses(u);case 14:case"end":return e.stop()}}),e)}))),Bc.apply(this,arguments)}function Lc(e,t,r,n,o,a,i){return Kc.apply(this,arguments)}function Kc(){return(Kc=t(c().mark((function e(t,r,n,o,a,i,s){var u,f,l,d,p,h,b,v,y,g,m,w,x,k,I,O,E,S,A,T,_,P,M,j;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(l=t.props,d=l.dispatch,p=l.state,h=l.walletId,b=na(p,h),v=t.props.walletState,y=v.accountId,g=v.currencyInfo,m=v.pluginId,w=t.props.state.accounts[y].allTokens[m],x=null==n?g:w[n],k=x.currencyCode,null!=(I=t.props.walletState.txs[r])){e.next=8;break}throw new Error("Setting metatdata for missing tx ".concat(r));case 8:return O=mc(p,h,I.txid,I.date),E=O.creationDate,S=O.fileName,A=O.txidHash,e.next=11,pc.load(b,"transaction/".concat(S));case 11:return T=e.sent,_=ec(ec({},T),{},{creationDate:E,currencies:new Map(null!==(u=null==T?void 0:T.currencies)&&void 0!==u?u:[]),internal:!0,tokens:new Map(null!==(f=null==T?void 0:T.tokens)&&void 0!==f?f:[]),txid:r}),P=ec(ec({metadata:{}},_.currencies.get(k)),_.tokens.get(n)),_.tokens.set(n,P),_.currencies.delete(k),null!=a&&(P.metadata=$a(null!==(M=P.metadata)&&void 0!==M?M:{},a)),null!=i&&(P.assetAction=i),null!=s&&(_.savedAction=s),d({type:"CURRENCY_WALLET_FILE_CHANGED",payload:{creationDate:E,fileName:S,json:_,txid:r,txidHash:A,walletId:h}}),e.next=22,pc.save(b,"transaction/"+S,_);case 22:j=Cf(t,I,_,n),o.onTransactions([{isNew:!1,transaction:j}]);case 24:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Uc(e,t){return Fc.apply(this,arguments)}function Fc(){return(Fc=t(c().mark((function e(t,r){var n,o,a,i,s,u,f,l,d,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.props,a=o.dispatch,i=o.state,s=o.walletId,u=mc(i,s,r.txid,r.date),f=u.creationDate,l=u.fileName,d=u.txidHash,(p={txid:r.txid,internal:!0,creationDate:f,currencies:new Map,feeRateUsed:r.feeRateUsed,tokens:new Map,savedAction:r.savedAction,swap:r.swapData}).tokens.set(r.tokenId,{assetAction:r.assetAction,metadata:null!==(n=r.metadata)&&void 0!==n?n:{},nativeAmount:r.nativeAmount}),null!=r.networkFeeOption&&(p.feeRateRequested="custom"===r.networkFeeOption?r.requestedCustomFee:r.networkFeeOption),null!=r.spendTargets&&(p.payees=r.spendTargets.map((function(e){return{currency:e.currencyCode,address:e.publicAddress,amount:e.nativeAmount,tag:e.memo}})),null!=r.deviceDescription&&(p.deviceDescription=r.deviceDescription)),"string"==typeof r.txSecret&&(p.secret=r.txSecret),a({type:"CURRENCY_WALLET_FILE_CHANGED",payload:{creationDate:f,fileName:l,json:p,txid:r.txid,txidHash:d,walletId:s}}),e.abrupt("return",{fileName:l,txFile:p});case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Wc(e,t,r){return qc.apply(this,arguments)}function qc(){return(qc=t(c().mark((function e(t,r,n){var o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.props,a=o.state,i=o.walletId,s=na(a,i),e.next=4,pc.save(s,"transaction/"+r,n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function zc(e){return Gc.apply(this,arguments)}function Gc(){return(Gc=t(c().mark((function e(t){var r,n,o,a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props,o=n.dispatch,a=n.state,i=n.walletId,s=na(a,i),e.next=4,lc.load(s,oc);case 4:if(e.t1=r=e.sent,e.t0=null!==e.t1,!e.t0){e.next=8;break}e.t0=void 0!==r;case 8:if(!e.t0){e.next=12;break}e.t2=r,e.next=13;break;case 12:e.t2={};case 13:return u=e.t2,null!=(f=u.checkpoint)&&o({type:"CURRENCY_ENGINE_SEEN_TX_CHECKPOINT_CHANGED",payload:{checkpoint:f,walletId:i}}),e.abrupt("return",f);case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Hc(){return(Hc=t(c().mark((function e(t,r){var n,o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.props,o=n.dispatch,a=n.state,i=n.walletId,s=na(a,i),u={checkpoint:r},o({type:"CURRENCY_ENGINE_SEEN_TX_CHECKPOINT_CHANGED",payload:{checkpoint:r,walletId:i}}),e.next=6,lc.save(s,oc,u);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Yc="redux-keto wrapper";function Jc(e,t,r){for(var n=Object.create(null),o=function(){var e=i[a],o=t(e);Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var t=this,n=t[Yc];if(n.running[e]){var a=new ReferenceError("Reducer '"+e+"' depends on its own result");throw a.name="ReduxKetoCircularReferenceError",a}n.running[e]=!0;try{var i=o(n.state[e],n.action,r(n.next,t,e),r(n.prev,n.state,e));if(void 0===i)throw new TypeError("Reducer '"+e+"' returned undefined");return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!1,value:i}),i}finally{n.running[e]=!1}}})},a=0,i=e;a<i.length;a+=1)o();return n}function Vc(e,t,r,n,o){var a=Object.create(e);return Object.defineProperty(a,Yc,{configurable:!0,enumerable:!1,writable:!1,value:{state:t,action:r,next:n,prev:o,running:{}}}),a}function Xc(e,t){if(void 0===e&&(e={}),null===t||null==t[Yc])return t;for(var r=Object.keys(Object.getPrototypeOf(t)),n=Object.keys(e).length===r.length,o=0,a=r;o<a.length;o+=1){var i=a[o];Object.defineProperty(t,i,{configurable:!1,enumerable:!0,writable:!1,value:Xc(e[i],t[i])}),t[i]!==e[i]&&(n=!1)}return n?e:(delete t[Yc],t)}function $c(e,t,r){return void 0!==e?e:t}function Zc(e,t){if(void 0===t&&(t=$c),"object"!=typeof e||null===e)throw new TypeError("The reducer map must be an object.");for(var r=Object.keys(e),n=0,o=r;n<o.length;n+=1){var a=o[n];if("function"!=typeof e[a])throw new TypeError("Reducers must be functions.")}for(var i=Jc(r,(function(t){return e[t]}),t),s={},u=0,c=r;u<c.length;u+=1){var f=c[u];s[f]=e[f].defaultState}function l(e,t,r,n){void 0===e&&(e=s);var o=Vc(i,e,t,r,n);return void 0===r?Xc(e,o):o}return l.defaultState=s,l}function Qc(e,t){return e}function ef(e){return e}function tf(e,t,r){void 0===t&&(t=Qc),void 0===r&&(r=ef);var n=e.defaultState;function o(o,a,i,s){void 0===o&&(o=n);var u=t(a,i),c=r(i),f=r(s);if(!u)return o;var l=e(o,u,c,f);return void 0===i?Xc(o,l):l}return o.defaultState=n,o}function rf(e,t,r){return{id:r,root:void 0!==e?e:t,get self(){return t[r]}}}var nf={};function of(e,t,r){function n(n,o,a,i){void 0===n&&(n=nf);var s=t(a),u=Vc(n===nf||s!==t(i)?Jc(s,(function(t){return e}),r):Object.getPrototypeOf(n),n,o,a,i);return void 0===a?Xc(n,u):u}return void 0===r&&(r=rf),n.defaultState=nf,n}function af(){for(var e=arguments,t=arguments.length-1,r=arguments[t],n=[];t-- >0;)n[t]=e[t];if("function"!=typeof r)throw new TypeError("The reducer must be a function");for(var o=0,a=n;o<a.length;o+=1){if("function"!=typeof a[o])throw new TypeError("Each argument filter must be a function")}return function(e,t,o,a){void 0===e&&(e=r.defaultState);for(var i=void 0!==e,s=[],u=0;u<n.length;++u)s[u]=n[u](o),i&&s[u]!==n[u](a)&&(i=!1);return i?e:r.apply(void 0,s)}}function sf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function uf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sf(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sf(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var cf=[],ff=Zc({accountId:function(e,t,r){if(null!=e)return e;for(var n=0,o=Object.keys(r.root.accounts);n<o.length;n++)for(var a=o[n],i=r.root.accounts[a],s=0,u=Object.keys(i.walletInfos);s<u.length;s++){if(u[s]===r.id)return a}throw new Error("Cannot find account for walletId ".concat(r.id))},allEnabledTokenIds:af((function(e){return e.root.accounts[e.self.accountId].alwaysEnabledTokenIds[e.self.pluginId]}),(function(e){return e.self.enabledTokenIds}),(function(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Zu([].concat(Ir(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),Ir(e)))})),pluginId:af((function(e){return e.root.login.walletInfos[e.id].type}),(function(e){return e.root.plugins.currency}),(function(e,t){return Mo(t,e)})),paused:function(e,t,r){return null==e?r.root.accounts[r.self.accountId].pauseWallets:"CURRENCY_WALLET_CHANGED_PAUSED"===t.type?t.payload.paused:e},currencyInfo:function(e,t,r){if(null!=e)return e;var n=r.self.pluginId;return r.root.plugins.currency[n].currencyInfo},detectedTokenIds:hf((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:cf,t=arguments.length>1?arguments[1]:void 0;if("CURRENCY_WALLET_LOADED_TOKEN_FILE"===t.type)return t.payload.detectedTokenIds;if("CURRENCY_ENGINE_DETECTED_TOKENS"===t.type){var r=t.payload.detectedTokenIds;return Zu([].concat(Ir(e),Ir(r)))}return"CURRENCY_ENGINE_CLEARED"===t.type?[]:e})),enabledTokenIds:hf((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:cf,t=arguments.length>1?arguments[1]:void 0;if("CURRENCY_WALLET_LOADED_TOKEN_FILE"===t.type)return t.payload.enabledTokenIds;if("CURRENCY_WALLET_ENABLED_TOKENS_CHANGED"===t.type)return t.payload.enabledTokenIds;if("CURRENCY_ENGINE_DETECTED_TOKENS"===t.type){var r=t.payload.enablingTokenIds;return Zu([].concat(Ir(e),Ir(r)))}return e})),tokenFileDirty:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;switch((arguments.length>1?arguments[1]:void 0).type){case"CURRENCY_WALLET_LOADED_TOKEN_FILE":case"CURRENCY_WALLET_SAVED_TOKEN_FILE":return!1;case"CURRENCY_ENGINE_CLEARED":case"CURRENCY_ENGINE_DETECTED_TOKENS":case"CURRENCY_WALLET_ENABLED_TOKENS_CHANGED":return t.self.detectedTokenIds!==r.self.detectedTokenIds||t.self.enabledTokenIds!==r.self.enabledTokenIds;default:return e}},engineFailure:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;if("CURRENCY_ENGINE_FAILED"===t.type){var r=t.payload.error;return r instanceof Error?r:new Error(String(r))}return e},engineStarted:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;return"CURRENCY_ENGINE_STARTED"===t.type||"CURRENCY_ENGINE_STOPPED"!==t.type&&e},fiat:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return"CURRENCY_WALLET_FIAT_CHANGED"===t.type?t.payload.fiatCurrencyCode:e},fiatLoaded:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"CURRENCY_WALLET_FIAT_CHANGED"===(arguments.length>1?arguments[1]:void 0).type||e},files:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"CURRENCY_WALLET_FILE_CHANGED":var r=t.payload,n=r.json,o=r.txidHash,a=uf({},e);return a[o]=n,a;case"CURRENCY_WALLET_FILES_LOADED":var i=t.payload.files;return uf(uf({},e),i)}return e},fileNames:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"CURRENCY_WALLET_FILE_NAMES_LOADED":var r=t.payload.txFileNames;return uf(uf({},e),r);case"CURRENCY_WALLET_FILE_CHANGED":var n=t.payload,o=n.fileName,a=n.creationDate,i=n.txidHash;return(null==e[i]||a<e[i].creationDate)&&(e[i]={creationDate:a,fileName:o}),e}return e},syncRatio:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"CURRENCY_ENGINE_CHANGED_SYNC_RATIO":return t.payload.ratio;case"CURRENCY_ENGINE_CLEARED":return 0}return e},balanceMap:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map,t=arguments.length>1?arguments[1]:void 0;if("CURRENCY_ENGINE_CHANGED_BALANCE"===t.type){var r=t.payload,n=r.balance,o=r.tokenId,a=new Map(e);return a.set(o,n),a}return e},balances:af((function(e){return e.self.balanceMap}),(function(e){return e.self.currencyInfo}),(function(e){return e.root.accounts[e.self.accountId].allTokens[e.self.pluginId]}),(function(e,t,r){for(var n={},o=0,a=e.keys();o<a.length;o++){var i=a[o],s=e.get(i),u=(null==i?t:r[i]).currencyCode;null!=s&&(n[u]=s)}return n})),height:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;return"CURRENCY_ENGINE_CHANGED_HEIGHT"===t.type?t.payload.height:e},name:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;return"CURRENCY_WALLET_NAME_CHANGED"===t.type?t.payload.name:e},nameLoaded:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"CURRENCY_WALLET_NAME_CHANGED"===(arguments.length>1?arguments[1]:void 0).type||e},seenTxCheckpoint:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;return"CURRENCY_ENGINE_SEEN_TX_CHECKPOINT_CHANGED"===t.type?t.payload.checkpoint:e},sortedTxidHashes:af((function(e){return e.self.txidHashes}),(function(e){return Object.keys(e).sort((function(t,r){return e[t].date>e[r].date?-1:e[t].date<e[r].date?1:0}))})),stakingStatus:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{stakedAmounts:[]},t=arguments.length>1?arguments[1]:void 0;return"CURRENCY_ENGINE_CHANGED_STAKING"===t.type?t.payload.stakingStatus:e},txidHashes:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"CURRENCY_ENGINE_CHANGED_TXS":return lf(e,t.payload.txidHashes);case"CURRENCY_WALLET_FILE_NAMES_LOADED":for(var r=t.payload.txFileNames,n={},o=0,a=Object.keys(r);o<a.length;o++){var i=a[o];n[i]={date:r[i].creationDate}}return lf(e,n)}return e},txs:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"CHANGE_MERGE_TX":var r=t.payload.tx,n=uf({},e);return n[r.txid]=r,n;case"CURRENCY_ENGINE_CHANGED_TXS":for(var o=t.payload.txs,a=uf({},e),i=0;i<o.length;i++){var s=o[i];a[s.txid]=pf(s,a[s.txid])}return a;case"CURRENCY_ENGINE_CLEARED":return{}}return e},unactivatedTokenIds:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"CURRENCY_ENGINE_CHANGED_UNACTIVATED_TOKEN_IDS":return t.payload.unactivatedTokenIds;case"CURRENCY_ENGINE_CLEARED":return[]}return e},gotTxs:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"CURRENCY_ENGINE_GOT_TXS":var r=t.payload.tokenId,n=new Set(e);return n.add(r),n;case"CURRENCY_ENGINE_CLEARED":return new Set;default:return e}},walletInfo:function(e,t,r){return r.root.login.walletInfos[r.id]},publicWalletInfo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;return"CURRENCY_WALLET_PUBLIC_INFO"===t.type?t.payload.walletInfo:e}});function lf(e,t){for(var r=uf({},e),n=0,o=Object.keys(t);n<o.length;n++){var a,i=o[n],s=r[i],u=t[i];r[i]=null==s?u:{date:Math.min(u.date,s.date),txid:null!==(a=u.txid)&&void 0!==a?a:s.txid}}return r}var df=tf(ff,(function(e,t){return/^CURRENCY_/.test(e.type)&&"payload"in e&&"object"===se(e.payload)&&"walletId"in e.payload&&e.payload.walletId===t.id?e:{type:"UPDATE_NEXT"}}));function pf(e,t){var r,n,o,a,i=e.confirmations,s=void 0===i?"unconfirmed":i,u=e.isSend,c=void 0===u?(0,Ra.lt)(e.nativeAmount,"0"):u,f=e.tokenId,l=void 0===f?null:f,d={blockHeight:e.blockHeight,chainAction:e.chainAction,chainAssetAction:new Map(null!==(r=null==t?void 0:t.chainAssetAction)&&void 0!==r?r:[]),confirmations:s,date:e.date,isSend:c,memos:e.memos,nativeAmount:new Map(null!==(n=null==t?void 0:t.nativeAmount)&&void 0!==n?n:[]),networkFee:new Map(null!==(o=null==t?void 0:t.networkFee)&&void 0!==o?o:[]),otherParams:e.otherParams,ourReceiveAddresses:e.ourReceiveAddresses,signedTx:e.signedTx,txid:e.txid};return d.nativeAmount.set(l,e.nativeAmount),d.networkFee.set(l,null!==(a=e.networkFee)&&void 0!==a?a:"0"),null!=e.feeRateUsed&&(d.feeRateUsed=e.feeRateUsed),null!=e.parentNetworkFee&&d.networkFee.set(null,String(e.parentNetworkFee)),null!=e.chainAssetAction&&d.chainAssetAction.set(l,e.chainAssetAction),d}function hf(e){return function(t,r){var n=e(t,r);return n===t?t:(n.sort((function(e,t){return e===t?0:e>t?1:-1})),null!=t&&Ga(n,t)?t:n)}}var bf=5e3;function vf(e,t){var r=e.props,n=r.log,o=r.walletId,a=!1,i=0,s=[];return function(e){if(a){var r;n("throttledTxCallback delay, walletId: ".concat(o)),(r=s).push.apply(r,Ir(e))}else{var u=Date.now();u-i>bf?(i=u,t(e)):(n("throttledTxCallback delay, walletId: ".concat(o)),a=!0,s=e,setTimeout((function(){i=Date.now(),t(s),a=!1,s=[]}),bf))}}}function yf(e){var t=e.props.walletId;"narfavJN4rp9ZzYigcRj1i0vrU2OAGGp4+KksAksj54="===t&&(bf=25,Ya=99,Ha=1);var r=vf(e,(function(t){var r;null!=(null===(r=e.props.walletOutput)||void 0===r?void 0:r.walletApi)&&G(e.props.walletOutput.walletApi,"transactionsChanged",t)})),n=vf(e,(function(t){var r;null!=(null===(r=e.props.walletOutput)||void 0===r?void 0:r.walletApi)&&G(e.props.walletOutput.walletApi,"newTransactions",t)})),o={onAddressesChecked:function(r){Va({id:t,action:"onAddressesChecked",updateFunc:function(){e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_SYNC_RATIO",payload:{ratio:r,walletId:t}})}})},onNewTokens:function(r){Va({id:t,action:"onNewTokens",updateFunc:function(){var n=e.props.walletState,o=n.detectedTokenIds,a=n.enabledTokenIds,i=Zu(r,[].concat(Ir(o),Ir(a))),s=t.slice(0,2);if(e.props.log.warn("enabledTokenIds: ".concat(s," engine detected tokens")),e.props.dispatch({type:"CURRENCY_ENGINE_DETECTED_TOKENS",payload:{detectedTokenIds:r,enablingTokenIds:i,walletId:t}}),i.length>0){var u,c=null===(u=e.props)||void 0===u||null===(u=u.walletOutput)||void 0===u?void 0:u.walletApi;null!=c&&G(c,"enabledDetectedTokens",i)}}})},onUnactivatedTokenIdsChanged:function(r){Va({id:t,action:"onUnactivatedTokenIdsChanged",updateFunc:function(){e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_UNACTIVATED_TOKEN_IDS",payload:{unactivatedTokenIds:r,walletId:t}})}})},onBalanceChanged:function(t,r){var n=e.props.walletState,a=n.accountId,i=n.currencyInfo,s=n.pluginId,u=e.props.state.accounts[a].allTokens[s];if(t===i.currencyCode)o.onTokenBalanceChanged(null,r);else{var c=Ba({allTokens:u,currencyInfo:i,currencyCode:t}).tokenId;null!=c&&o.onTokenBalanceChanged(c,r)}},onTokenBalanceChanged:function(r,n){var o=_e(ti)(n);null!=o?Va({id:"".concat(t,"==").concat(String(r)),action:"onTokenBalanceChanged",updateFunc:function(){e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_BALANCE",payload:{balance:o,tokenId:r,walletId:t}})}}):e.props.onError(new Error("Plugin sent bogus balance for ".concat(String(r),': "').concat(n,'"')))},onBlockHeightChanged:function(n){Va({id:t,action:"onBlockHeightChanged",updateFunc:function(){for(var o=e.props.walletState.txs,a=0,i=Object.keys(o);a<i.length;a++){var s=o[i[a]];if(mf(s.confirmations)){var u=e.props.walletState.currencyInfo.requiredConfirmations,c=e.props.walletState.height;s.confirmations=wf(s,c,u);var f=ia(e.props.state,t,s.txid),l=e.props.walletState.files,d=Cf(e,s,l[f],null);e.props.dispatch({type:"CHANGE_MERGE_TX",payload:{tx:s}}),r([d])}}e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_HEIGHT",payload:{height:n,walletId:t}})}})},onSeenTxCheckpoint:function(t){(function(e,t){return Hc.apply(this,arguments)})(e,t).catch((function(t){return e.props.onError(t)}))},onStakingStatusChanged:function(r){Va({id:t,action:"onStakingStatusChanged",updateFunc:function(){e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_STAKING",payload:{stakingStatus:r,walletId:t}})}})},onTransactions:function(o){var a=e.props.walletState,i=a.accountId,s=a.currencyInfo,u=a.pluginId,c=e.props.state.accounts[i].allTokens[u];if(null!=o&&0!==o.length){for(var f=[],l=0;l<o.length;l++){var d=o[l].transaction;if(Ka(d),"string"!=typeof d.txid||"number"!=typeof d.date||"string"!=typeof d.networkFee||"number"!=typeof d.blockHeight||"string"!=typeof d.nativeAmount||"object"!==se(d.ourReceiveAddresses))return void e.props.onError(new Error("Plugin sent bogus tx: ".concat(JSON.stringify(d,null,2))));if(null==d.isSend&&(d.isSend=(0,Ra.lt)(d.nativeAmount,"0")),null==d.memos&&(d.memos=[]),void 0===d.tokenId){var p=Ba({allTokens:c,currencyInfo:s,currencyCode:d.currencyCode}).tokenId;d.tokenId=null!=p?p:null}f.push(d)}for(var h=e.props.state,b=e.props.walletState.txs,v={},y=[],g=[],m=0;m<o.length;m++){var w=o[m],x=w.isNew,k=w.transaction,I=k.txid;if(mf(k.confirmations)){var O=e.props.walletState.currencyInfo.requiredConfirmations,E=e.props.walletState.height;k.confirmations=wf(k,E,O)}var S=pf(k,b[I]);if(!Ga(S,b[I])||null!=k.metadata){var A=ia(h,t,I);null==e.props.walletState.fileNames[A]&&Uc(e,k).catch((function(t){return e.props.onError(t)}));var T=e.props.walletState.files,_=Cf(e,S,T[A],k.tokenId);x?g.push(_):y.push(_),v[A]={date:_.date,txid:I}}}e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_TXS",payload:{txs:f,walletId:t,txidHashes:v}}),y.length>0&&r(y),g.length>0&&n(g)}},onTransactionsChanged:function(e){o.onTransactions(e.map((function(e){return{isNew:!1,transaction:e}})))},onAddressChanged:function(){null!=e.props.walletOutput.walletApi&&G(e.props.walletOutput.walletApi,"addressChanged",void 0)},onWcNewContractCall:function(t){null!=e.props.walletOutput.walletApi&&G(e.props.walletOutput.walletApi,"wcNewContractCall",t)},onTxidsChanged:function(){}};return o}function gf(e){var r,n=e.props.walletId;function o(e){return a.apply(this,arguments)}function a(){return(a=t(c().mark((function t(o){var a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((a=ra(o.state,n))===r){t.next=13;break}return r=a,t.next=5,Tc(e);case 5:return t.next=7,Oc(e);case 7:return t.next=9,Sc(e);case 9:return t.next=11,Nc(e);case 11:return t.next=13,Rc(e);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}!function t(){e.nextProps().then(o).then(t,(function(r){var n;(n=r)instanceof Error&&"PixieShutdownError"===n.name||(e.props.onError(r),t())}))}()}var mf=function(e){return"confirmed"!==e&&"dropped"!==e&&"failed"!==e},wf=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e.blockHeight>0){var n=1+t-e.blockHeight;return n<=0?"syncing":n>=r?"confirmed":n}return e.blockHeight<0?"dropped":"unconfirmed"};function xf(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date(0),r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Date;return 1e3*e.date>=t.valueOf()&&1e3*e.date<r.valueOf()}function kf(e,t,r){var n,o=e.props.state.currency;if(null==r||""===r)return!0;for(var a=r.toLowerCase().replace(".","").replace(",",""),i=0;i<a.length;i++)if("0"!==a[i]){a=a.substring(i);break}function s(e){return null!=e&&("string"==typeof e||"number"==typeof e)&&!!e.toString().toLowerCase().replace(".","").replace(",","").includes(a)}if(s(t.nativeAmount))return!0;if(null!=t.metadata){var u=t.metadata,c=u.category,f=void 0===c?"":c,l=u.name,d=void 0===l?"":l,p=u.notes,h=void 0===p?"":p,b=u.exchangeAmount,v=void 0===b?{}:b,y=null!=t.walletId?o.wallets[t.walletId]:void 0;if(s(f)||s(d)||s(h)||null!=y&&s(v[y.fiat]))return!0}if(null!=t.swapData){var g=t.swapData.plugin,m=g.displayName,w=void 0===m?"":m,x=g.pluginId,k=void 0===x?"":x;if(s(w)||s(k))return!0}var I=null!==(n=t.savedAction)&&void 0!==n?n:t.chainAction;if(null!=I&&"swap"===I.actionType){var O=I.toAsset.pluginId,E=I.fromAsset.pluginId,S=I.swapInfo,A=S.displayName,T=S.supportEmail;if(s(E)||s(O)||s(A)||s(T))return!0}if(null!=t.spendTargets)for(var _=0,P=t.spendTargets;_<P.length;_++){var M=P[_],j=M.publicAddress,C=void 0===j?"":j,N=M.memo,D=void 0===N?"":N;if(s(C)||s(D))return!0}if(t.ourReceiveAddresses.length>0)for(var R=0,B=t.ourReceiveAddresses;R<B.length;R++){if(s(B[R]))return!0}return!!s(t.txid)}function If(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Of(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?If(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):If(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ef(e,t){var r,n,o=[],a=t.memoType;if("hex"===a||"number"===a||"text"===a)for(var i=0,u=e.spendTargets;i<u.length;i++){var c,f=u[i];null!=f.memo?o.push({type:a,value:f.memo}):null!=f.uniqueIdentifier?o.push({type:a,value:f.uniqueIdentifier}):"string"==typeof(null===(c=f.otherParams)||void 0===c?void 0:c.uniqueIdentifier)&&o.push({type:a,value:f.otherParams.uniqueIdentifier})}for(var l=0;l<o.length;l++){var d=o[l];"hex"===d.type&&(d.value=d.value.replace(/^0x/i,""))}var p=Of(Of({},e),{},{spendTargets:e.spendTargets.map((function(e){return Of(Of({},e),{},{memo:void 0,uniqueIdentifier:void 0})})),memos:null!==(r=e.memos)&&void 0!==r?r:o});if(1===(null===(n=p.memos)||void 0===n?void 0:n.length)&&p.spendTargets.length>=1){var h=s(p.memos,1)[0];if(h.type===t.memoType){var b=s(p.spendTargets,1)[0];b.memo=h.value,b.uniqueIdentifier=h.value,b.otherParams=Of(Of({},b.otherParams),{},{uniqueIdenfitifer:h.value})}}return p}function Sf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Af(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Sf(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sf(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Tf=function(){var e=t(c().mark((function e(t,r,n,o,a){var i,s,u,f,l,d,p,h,b,v;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(v=function(e,t){var r=(0,Ra.sub)(t,e);if((0,Ra.lte)(r,"1"))return Promise.resolve(e);var o=(0,Ra.add)(e,(0,Ra.div)(r,"2"));b[0].nativeAmount=o;var i=u?a.keys:void 0;return n.makeSpend(Af(Af({},s),{},{spendTargets:b,networkFeeOption:d,customNetworkFee:p}),{privateKeys:i}).then((function(){return v(o,t)})).catch((function(){return v(e,o)}))},t=Ef(t,r.currencyInfo),s=Ba({allTokens:o,currencyInfo:r.currencyInfo,tokenId:t.tokenId}),u=null!==(i=r.currencyInfo.unsafeMakeSpend)&&void 0!==i&&i,"function"!=typeof n.getMaxSpendable){e.next=9;break}return f=u?a.keys:void 0,e.next=8,n.getMaxSpendable(Af(Af({},t),s),{privateKeys:f});case 8:case 14:return e.abrupt("return",e.sent);case 9:return d=(l=t).networkFeeOption,p=l.customNetworkFee,h=n.getBalance(s),b=t.spendTargets.map((function(e){return Af(Af({},e),{},{nativeAmount:"0"})})),e.next=14,v("0",(0,Ra.add)(h,"1"));case 15:case"end":return e.stop()}}),e)})));return function(t,r,n,o,a){return e.apply(this,arguments)}}();function _f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Pf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_f(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Mf={bizId:0,category:"",exchangeAmount:{},name:"",notes:""};function jf(e,r,n,o){var a=ld(e),i=e.props.walletState,s=i.accountId,u=i.pluginId,f=i.walletInfo,l=e.props.state.plugins.currency[u],d=l.currencyInfo,p=d.unsafeBroadcastTx,h=void 0!==p&&p,b=d.unsafeMakeSpend,v=void 0!==b&&b,y=Ua(a,f),g=yf(e),m={};if(null!=r.otherMethods)for(var w=0,k=Object.keys(r.otherMethods);w<k.length;w++){var I=k[w],O=r.otherMethods[I];"function"==typeof O&&(m[I]=O)}if(null!=r.otherMethodsWithKeys)for(var E=function(){var e=A[S],t=r.otherMethodsWithKeys[e];if("function"!=typeof t)return 1;m[e]=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.apply(void 0,[f.keys].concat(r))}},S=0,A=Object.keys(r.otherMethodsWithKeys);S<A.length;S++)E();C(m);var T={on:re,watch:ne,get created(){return f.created},get disklet(){return y.disklet},get id(){return y.id},get localDisklet(){return y.localDisklet},publicWalletInfo:o,sync:function(){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y.sync();case 2:case"end":return e.stop()}}),e)})))()},get type(){return y.type},get name(){return e.props.walletState.name},renameWallet:function(r){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,wc(e,r);case 2:case"end":return t.stop()}}),t)})))()},get fiatCurrencyCode(){return e.props.walletState.fiat},setFiatCurrencyCode:function(r){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,kc(e,r);case 2:case"end":return t.stop()}}),t)})))()},get currencyConfig(){return e.props.output.accounts[s].accountApi.currencyConfig[u]},get currencyInfo(){return l.currencyInfo},denominationToNative:function(r,n){return t(c().mark((function t(){var o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=Fa(l.currencyInfo,e.props.state.accounts[s].allTokens[u],n),t.abrupt("return",(0,Ra.mul)(r,o));case 2:case"end":return t.stop()}}),t)})))()},nativeToDenomination:function(r,n){return t(c().mark((function t(){var o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=Fa(l.currencyInfo,e.props.state.accounts[s].allTokens[u],n),t.abrupt("return",(0,Ra.div)(r,o,o.length));case 2:case"end":return t.stop()}}),t)})))()},get balances(){return e.props.walletState.balances},get balanceMap(){return e.props.walletState.balanceMap},get blockHeight(){return e.props.state.skipBlockHeight?0:e.props.walletState.height},get syncRatio(){return e.props.walletState.syncRatio},get unactivatedTokenIds(){return e.props.walletState.unactivatedTokenIds},changePaused:function(r){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.props.dispatch({type:"CURRENCY_WALLET_CHANGED_PAUSED",payload:{walletId:e.props.walletId,paused:r}});case 1:case"end":return t.stop()}}),t)})))()},get paused(){return e.props.walletState.paused},changeEnabledTokenIds:function(r){return t(c().mark((function t(){var n,o,a,i,s,u,f,l,d,p,h;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=e.props,a=o.dispatch,i=o.walletId,s=o.walletState,u=s.accountId,f=s.pluginId,l=e.props.state.accounts[u],d=null!==(n=l.allTokens[f])&&void 0!==n?n:{},p=Zu(r).filter((function(e){return null!=d[e]})),h=i.slice(0,2),e.props.log.warn("enabledTokenIds: ".concat(h," changeEnabledTokenIds")),a({type:"CURRENCY_WALLET_ENABLED_TOKENS_CHANGED",payload:{walletId:i,enabledTokenIds:p}});case 8:case"end":return t.stop()}}),t)})))()},get detectedTokenIds(){return e.props.walletState.detectedTokenIds},get enabledTokenIds(){return e.props.walletState.enabledTokenIds},getNumTransactions:function(n){return t(c().mark((function t(){var o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=Ba({allTokens:e.props.state.accounts[s].allTokens[u],currencyInfo:l.currencyInfo,tokenId:n.tokenId}),t.abrupt("return",r.getNumTransactions(o));case 2:case"end":return t.stop()}}),t)})))()},$internalStreamTransactions:function(n){var o=this;return t(c().mark((function i(){var s,u,f,l,d,p,h,b,v,y,m,w,x,k,I,O,E,S,A,T,_,P,M,j;return c().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(s=n.afterDate,u=n.batchSize,f=void 0===u?10:u,l=n.beforeDate,d=n.firstBatchSize,p=void 0===d?f:d,h=n.searchString,b=n.spamThreshold,v=void 0===b?"0":b,y=n.tokenId,w=null==(m=void 0===y?null:y)?o.currencyInfo:o.currencyConfig.allTokens[m],x=w.currencyCode,k={currencyCode:x,tokenId:m},(I=e.props.walletState).gotTxs.has(m)){i.next=11;break}return i.next=7,r.getTransactions(k);case 7:O=i.sent,g.onTransactionsChanged(O),e.props.dispatch({type:"CURRENCY_ENGINE_GOT_TXS",payload:{walletId:e.props.walletId,tokenId:m}}),I=e.props.walletState;case 11:return S=(E=I).files,A=E.sortedTxidHashes,T=E.txidHashes,_=E.txs,P=0,M=!0,j=0,i.abrupt("return",C({next:function(){return t(c().mark((function t(){var r,n,o,i,u,d,b,y,g,w,x,k,I;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=M?p:f,n=[];case 2:if(!(P<A.length&&n.length<r)){t.next=32;break}if(!(P>=j)){t.next=10;break}return u=A.slice(j,j+r).filter((function(e){return null==S[e]})),t.next=7,Pc(e,u);case 7:d=t.sent,Object.assign(S,d),j+=r;case 10:if(b=A[P++],y=S[b],null!=(g=null!==(o=null==y?void 0:y.txid)&&void 0!==o?o:null===(i=T[b])||void 0===i?void 0:i.txid)){t.next=15;break}return t.abrupt("continue",2);case 15:if(w=_[g],x=null==w?void 0:w.nativeAmount.get(m),k=null==w?void 0:w.networkFee.get(m),null!=w&&null!=x&&null!=k){t.next=20;break}return t.abrupt("continue",2);case 20:if(I=Cf(e,w,y,m),Ka(I),kf(a,I,h)){t.next=24;break}return t.abrupt("continue",2);case 24:if(xf(I,s,l)){t.next=26;break}return t.abrupt("continue",2);case 26:if(w.isSend||null!=I.assetAction||null!=I.chainAction||null!=I.chainAssetAction||null!=I.savedAction||!(0,Ra.lt)((0,Ra.abs)(x),v)){t.next=29;break}return t.abrupt("continue",2);case 29:n.push(I),t.next=2;break;case 32:return M=!1,t.abrupt("return",{done:0===n.length,value:n});case 34:case"end":return t.stop()}}),t)})))()}}));case 16:case"end":return i.stop()}}),i)})))()},getTransactions:function(r){return t(c().mark((function t(){var n,o,a,i,f,d,p,h;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.endDate,o=r.startDate,a=r.searchString,i=r.spamThreshold,f=Ba({allTokens:e.props.state.accounts[s].allTokens[u],currencyInfo:l.currencyInfo,tokenId:r.tokenId}),t.next=4,T.$internalStreamTransactions(Pf(Pf({},f),{},{afterDate:o,beforeDate:n,searchString:a,spamThreshold:i}));case 4:d=t.sent,p=[];case 6:return t.next=9,d.next();case 9:if(!(h=t.sent).done){t.next=12;break}return t.abrupt("return",p);case 12:p.push.apply(p,Ir(h.value)),t.next=6;break;case 15:case"end":return t.stop()}}),t)})))()},streamTransactions:ve,getAddresses:function(n){return t(c().mark((function t(){var o,a,i,f,d,p,h,b,v;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null==r.getAddresses){t.next=6;break}return t.next=3,r.getAddresses(n);case 3:return t.abrupt("return",t.sent);case 6:return o=Ba({allTokens:e.props.state.accounts[s].allTokens[u],currencyInfo:l.currencyInfo,tokenId:n.tokenId}),t.next=9,r.getFreshAddress(Pf(Pf({},o),{},{forceIndex:n.forceIndex}));case 9:return a=t.sent,i=a.publicAddress,f=a.legacyAddress,d=a.segwitAddress,p=a.nativeBalance,h=a.legacyNativeBalance,b=a.segwitNativeBalance,v=[{addressType:"publicAddress",publicAddress:i,nativeBalance:p}],null!=d&&v.unshift({addressType:"segwitAddress",publicAddress:d,nativeBalance:b}),null!=f&&v.push({addressType:"legacyAddress",publicAddress:f,nativeBalance:h}),t.abrupt("return",v);case 15:case"end":return t.stop()}}),t)})))()},getReceiveAddress:function(e){var r=this;return t(c().mark((function t(){var n,o,a,i,s,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.getAddresses(e);case 2:if(!((o=t.sent).length<1)){t.next=5;break}throw new Error("No addresses available");case 5:return a=null!==(n=o.find((function(e){return"publicAddress"===e.addressType})))&&void 0!==n?n:o[0],i={publicAddress:a.publicAddress,nativeBalance:a.nativeBalance,metadata:Mf,nativeAmount:"0"},null!=(s=o.find((function(e){return"segwitAddress"===e.addressType})))&&(i.segwitAddress=s.publicAddress,i.segwitNativeBalance=s.nativeBalance),null!=(u=o.find((function(e){return"legacyAddress"===e.addressType})))&&(i.legacyAddress=u.publicAddress,i.legacyNativeBalance=u.nativeBalance),t.abrupt("return",i);case 12:case"end":return t.stop()}}),t)})))()},lockReceiveAddress:function(e){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))()},saveReceiveAddress:function(e){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))()},broadcastTx:function(e){return t(c().mark((function t(){var n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=h?f.keys:void 0,t.next=3,r.broadcastTx(e,{privateKeys:n});case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))()},getMaxSpendable:function(n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Tf(n,l,r,e.props.state.accounts[s].allTokens[u],f);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},getPaymentProtocolInfo:function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=r.getPaymentProtocolInfo){t.next=2;break}throw new Error("'getPaymentProtocolInfo' is not implemented on wallets of this type");case 2:return t.next=4,r.getPaymentProtocolInfo(e);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})))()},makeSpend:function(n){return t(c().mark((function t(){var o,a,i,d,p,h,b,y,g,m,w,x,k,I,O,E,S,A,T,_,P,M,j,C,N,D,R,B,L,K,U;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=Ef(n,l.currencyInfo),a=(o=n).assetAction,i=o.customNetworkFee,d=o.enableRbf,p=o.memos,h=o.metadata,b=o.networkFeeOption,y=void 0===b?"standard":b,g=o.noUnconfirmed,m=void 0!==g&&g,w=o.otherParams,x=o.pendingTxs,k=o.rbfTxid,I=o.savedAction,O=o.skipChecks,E=o.spendTargets,S=void 0===E?[]:E,A=o.swapData,T=Ba({allTokens:e.props.state.accounts[s].allTokens[u],currencyInfo:l.currencyInfo,tokenId:n.tokenId}),_=[],P=[],M=0;case 6:if(!(M<S.length)){t.next=16;break}if(j=S[M],C=j.memo,N=j.publicAddress,D=j.nativeAmount,R=void 0===D?"0":D,B=j.otherParams,L=void 0===B?{}:B,null!=N){t.next=11;break}return t.abrupt("continue",13);case 11:_.push({memo:C,nativeAmount:R,otherParams:L,publicAddress:N,uniqueIdentifier:C}),P.push({currencyCode:T.currencyCode,memo:C,nativeAmount:R,publicAddress:N,uniqueIdentifier:C});case 13:M++,t.next=6;break;case 16:if(null==n.privateKeys){t.next=18;break}throw new TypeError("Only sweepPrivateKeys takes private keys");case 18:return K=v?f.keys:void 0,t.next=21,r.makeSpend(Pf(Pf({},T),{},{customNetworkFee:i,enableRbf:d,memos:p,metadata:h,networkFeeOption:y,noUnconfirmed:m,otherParams:w,pendingTxs:x,rbfTxid:k,skipChecks:O,spendTargets:_}),{privateKeys:K});case 21:return U=t.sent,Ka(U),U.networkFeeOption=y,U.requestedCustomFee=i,U.spendTargets=P,U.currencyCode=T.currencyCode,U.tokenId=T.tokenId,null!=h&&(U.metadata=h),null!=A&&(U.swapData=ei(A)),null!=I&&(U.savedAction=ai(I)),null!=a&&(U.assetAction=ii(a)),null!=e.props.state.login.deviceDescription&&(U.deviceDescription=e.props.state.login.deviceDescription),t.abrupt("return",U);case 34:case"end":return t.stop()}}),t)})))()},saveTx:function(n){return t(c().mark((function t(){var o,a,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=e.props.walletState.txs[n.txid]){t.next=11;break}return t.next=3,Uc(e,n);case 3:return o=t.sent,a=o.fileName,i=o.txFile,t.next=8,Wc(e,a,i);case 8:g.onTransactions([{isNew:!0,transaction:n}]),t.next=13;break;case 11:return t.next=13,Lc(e,n.txid,n.tokenId,g);case 13:return t.next=15,r.saveTx(n);case 15:case"end":return t.stop()}}),t)})))()},saveTxAction:function(r){return t(c().mark((function t(){var n,o,a,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.txid,o=r.tokenId,a=r.assetAction,i=r.savedAction,t.next=3,Lc(e,n,o,g,void 0,a,i);case 3:case"end":return t.stop()}}),t)})))()},saveTxMetadata:function(r){return t(c().mark((function t(){var n,o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.txid,o=r.tokenId,a=r.metadata,t.next=3,Lc(e,n,o,g,a);case 3:case"end":return t.stop()}}),t)})))()},signBytes:function(e){var n=arguments;return t(c().mark((function t(){var o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=n.length>1&&void 0!==n[1]?n[1]:{},a=f.keys,null==r.signBytes){t.next=8;break}return t.next=5,r.signBytes(e,a,o);case 5:case 11:return t.abrupt("return",t.sent);case 8:if("bitcoin"!==u||null==r.signMessage){t.next=12;break}return t.next=11,r.signMessage(x.stringify(e),a,o);case 12:throw new Error("".concat(u," doesn't support signBytes"));case 13:case"end":return t.stop()}}),t)})))()},signMessage:function(e){var n=arguments;return t(c().mark((function t(){var o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=n.length>1&&void 0!==n[1]?n[1]:{},null!=r.signMessage){t.next=3;break}throw new Error("".concat(u," doesn't support signing messages"));case 3:return a=f.keys,t.next=6,r.signMessage(e,a,o);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)})))()},signTx:function(e){return t(c().mark((function t(){var n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.keys,t.next=3,r.signTx(e,n);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))()},sweepPrivateKeys:function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=r.sweepPrivateKeys){t.next=2;break}throw new Error("Sweeping this currency is not supported.");case 2:return t.next=4,r.sweepPrivateKeys(e);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})))()},accelerate:function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=r.accelerate){t.next=2;break}return t.abrupt("return",null);case 2:return t.next=4,r.accelerate(e);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})))()},get stakingStatus(){return e.props.walletState.stakingStatus},dumpData:function(){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.dumpData();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))()},resyncBlockchain:function(){return t(c().mark((function t(){var n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.props.walletId.slice(0,2),e.props.log.warn("enabledTokenIds: ".concat(n," resyncBlockchain")),a.props.dispatch({type:"CURRENCY_ENGINE_CLEARED",payload:{walletId:e.props.walletId}}),t.next=5,r.resyncBlockchain();case 5:case"end":return t.stop()}}),t)})))()},encodeUri:function(r){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.encodeUri(r,Ea(e.props.state.accounts[s].customTokens[u]));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},parseUri:function(r,o){return t(c().mark((function t(){var a,i,f,d,p;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.parseUri(r,o,Ea(e.props.state.accounts[s].customTokens[u]));case 2:return void 0===(a=t.sent).tokenId&&(f=Ba({allTokens:e.props.state.accounts[s].allTokens[u],currencyInfo:l.currencyInfo,currencyCode:null!==(i=a.currencyCode)&&void 0!==i?i:o}),d=f.tokenId,p=void 0===d?null:d,a.tokenId=p),t.abrupt("return",a);case 5:case"end":return t.stop()}}),t)})))()},otherMethods:m};return C(T)}function Cf(e,t,r,n){var o,a,i,s=e.props.walletId,u=e.props.walletState,c=u.accountId,f=u.currencyInfo,l=u.pluginId,d=e.props.state.accounts[c].allTokens[l],p=(null==n?f:d[n]).currencyCode,h=f.currencyCode,b={chainAction:t.chainAction,chainAssetAction:t.chainAssetAction.get(n),blockHeight:t.blockHeight,confirmations:t.confirmations,currencyCode:p,feeRateUsed:t.feeRateUsed,date:t.date,isSend:t.isSend,memos:t.memos,metadata:{},nativeAmount:null!==(o=t.nativeAmount.get(n))&&void 0!==o?o:"0",networkFee:null!==(a=t.networkFee.get(n))&&void 0!==a?a:"0",networkFees:[],otherParams:Pf({},t.otherParams),ourReceiveAddresses:t.ourReceiveAddresses,parentNetworkFee:h===p?void 0:null!==(i=t.networkFee.get(null))&&void 0!==i?i:"0",signedTx:t.signedTx,tokenId:n,txid:t.txid,walletId:s};if(null!=r){var v,y,g,m,w,x,k,I,O;r.creationDate<b.date&&(b.date=r.creationDate),b.metadata=$a(null!==(v=null!==(y=null===(g=r.tokens.get(null))||void 0===g?void 0:g.metadata)&&void 0!==y?y:null===(m=r.currencies.get(h))||void 0===m?void 0:m.metadata)&&void 0!==v?v:{},null!==(w=null!==(x=null===(k=r.tokens.get(n))||void 0===k?void 0:k.metadata)&&void 0!==x?x:null===(I=r.currencies.get(p))||void 0===I?void 0:I.metadata)&&void 0!==w?w:{}),null!=r.feeRateRequested&&("string"==typeof r.feeRateRequested?b.networkFeeOption=r.feeRateRequested:(b.networkFeeOption="custom",b.requestedCustomFee=r.feeRateRequested)),null==b.feeRateUsed&&(b.feeRateUsed=r.feeRateUsed),null!=r.payees&&(b.spendTargets=r.payees.map((function(e){return{currencyCode:e.currency,memo:e.tag,nativeAmount:e.amount,publicAddress:e.address,uniqueIdentifier:e.tag}})));var E=null===(O=r.tokens.get(n))||void 0===O?void 0:O.assetAction;null!=E&&(b.assetAction=E),null!=r.savedAction&&(b.savedAction=r.savedAction),null!=r.swap&&(b.swapData=r.swap),null!=r.secret&&(b.txSecret=r.secret),null!=r.deviceDescription&&(b.deviceDescription=r.deviceDescription)}return b}function Nf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Df(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Nf(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nf(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Rf="publicKey.json",Bf=Qn(hi),Lf=Yn({engine:function(e){return t(c().mark((function t(){var r,n,o,a,i,s,u,f,l,d,p,h,b,v,y,g,m,w,x,k,I,O,E;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.props,n=r.state,o=r.walletId,a=r.walletState,i=a.accountId,s=a.pluginId,u=a.walletInfo,f=n.plugins.currency[s],l=f.currencyInfo.currencyCode,t.prev=4,h=ld(e),t.next=8,Qo(h,u);case 8:return b=e.props.state,v=oa(b,u.id),y=aa(b,u.id,e.props.io),t.next=13,Nc(e);case 13:return t.next=15,Co(h,s);case 15:return g=t.sent,t.next=18,Kf(u,v,g);case 18:return m=t.sent,e.props.dispatch({type:"CURRENCY_WALLET_PUBLIC_INFO",payload:{walletInfo:m,walletId:o}}),t.next=22,zc(e);case 22:return w=t.sent,t.next=25,Tc(e);case 25:return x=b.accounts[i],t.next=28,f.makeCurrencyEngine(m,{callbacks:yf(e),seenTxCheckpoint:w,log:fo(e.props.logBackend,"".concat(s,"-").concat(u.id.slice(0,2))),walletLocalDisklet:v,walletLocalEncryptedDisklet:y,customTokens:null!==(d=x.customTokens[s])&&void 0!==d?d:{},enabledTokenIds:e.props.walletState.allEnabledTokenIds,userSettings:null!==(p=x.userSettings[s])&&void 0!==p?p:{}});case 28:if(k=t.sent,e.onOutput(k),I={currencyCode:l,tokenId:null},null!=(O=_e(ti)(k.getBalance(I)))&&e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_BALANCE",payload:{balance:O,tokenId:null,walletId:o}}),E=k.getBlockHeight(),e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_HEIGHT",payload:{height:E,walletId:o}}),null==k.getStakingStatus){t.next=38;break}return t.next=38,k.getStakingStatus().then((function(t){e.props.dispatch({type:"CURRENCY_ENGINE_CHANGED_STAKING",payload:{stakingStatus:t,walletId:o}})}),(function(t){return e.props.onError(t)}));case 38:return t.next=40,Oc(e);case 40:return t.next=42,Sc(e);case 42:return t.next=44,Rc(e);case 44:t.next=50;break;case 46:t.prev=46,t.t0=t.catch(4),e.props.onError(t.t0),e.props.dispatch({type:"CURRENCY_ENGINE_FAILED",payload:{error:t.t0,walletId:o}});case 50:return gf(e),t.next=53,Zn;case 53:return t.abrupt("return",t.sent);case 54:case"end":return t.stop()}}),t,null,[[4,46]])})))},walletApi:function(e){return t(c().mark((function t(){var r,n,o,a,i,s,u,f,l;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.props,n=r.walletOutput,o=r.walletState,null!=n){t.next=3;break}return t.abrupt("return");case 3:if(a=n.engine,i=o.nameLoaded,s=o.pluginId,u=o.publicWalletInfo,null!=a&&null!=u&&i){t.next=7;break}return t.abrupt("return");case 7:return t.next=9,Co(ld(e),s);case 9:return f=t.sent,l=jf(e,a,f,u),e.onOutput(l),t.next=14,Zn;case 14:return t.abrupt("return",t.sent);case 15:case"end":return t.stop()}}),t)})))},engineStarted:Xn((function(e){var r,n;return{update:function(){var o=e.props,a=o.log,i=o.walletId,s=o.walletOutput,u=o.walletState,f=u.currencyInfo,l=u.walletInfo,d=u.publicWalletInfo;if(null!=s){var p=s.engine;if(null!=s.walletApi&&u.fiatLoaded&&!u.engineStarted&&null!=p&&null==r&&(a("".concat(i," startEngine")),e.props.dispatch({type:"CURRENCY_ENGINE_STARTED",payload:{walletId:i}}),r=Promise.resolve().then((function(){return p.startEngine()})).catch((function(t){return e.props.onError(t)})),null!=p.syncNetwork)){var h=!0===f.unsafeSyncNetwork&&null!=d?l.keys:void 0,b=function(){var e=t(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==p.syncNetwork){e.next=7;break}return e.next=3,p.syncNetwork({privateKeys:h});case 3:t=e.sent,n.setDelay(t),e.next=8;break;case 7:n.stop();case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(n=_o(b,1e4,{onError:function(e){a.error(e)}})).start({wait:!1})}}},destroy:function(){var t=e.props,o=t.log,a=t.walletId,i=t.walletOutput;if(null!=i){var s=i.engine;null!=s&&null!=r&&(o("".concat(a," killEngine")),r.then((function(){return s.killEngine()})).catch((function(t){return e.props.onError(t)})).then((function(){return e.props.dispatch({type:"CURRENCY_ENGINE_STOPPED",payload:{walletId:a}})})).catch((function(){}))),null!=n&&n.stop()}}}}),(function(e){return e.state.paused||e.walletState.paused?void 0:e})),syncTimer:Xn((function(e){function r(){return(r=t(c().mark((function t(){var r;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.props.walletId,t.next=3,ta(ld(e),r);case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var n=_o((function(){return r.apply(this,arguments)}),Zo);return{update:function(){var t=e.props,r=t.state,o=t.walletId;null!=t.walletOutput&&null!=r.storageWallets[o]&&r.storageWallets[o].status.lastSync>0&&n.start({wait:Zo*(1+Math.random())})},destroy:function(){n.stop()}}}),(function(e){return e.state.paused||e.walletState.paused?void 0:e})),tokenSaver:function(e){var r=cf;return function(){var n=t(c().mark((function t(){var n,o,a,i,s,u,f,l;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.props.walletState,o=n.detectedTokenIds,a=n.enabledTokenIds,i=n.tokenFileDirty,s=null!=o&&null!=a,!i||!s){t.next=12;break}return u=Ff(a,r),f=Ff(r,a),l=e.props.walletId.slice(0,2),e.props.log.warn("enabledTokenIds: ".concat(l," write to disk, add [").concat(u,"], remove [").concat(f,"]")),t.next=9,vc(e,o,a).catch((function(t){return e.props.onError(t)}));case 9:return e.props.dispatch({type:"CURRENCY_WALLET_SAVED_TOKEN_FILE",payload:{walletId:e.props.walletId}}),t.next=12,Po(100);case 12:r=a;case 13:case"end":return t.stop()}}),t)})));return function(){return n.apply(this,arguments)}}()},watcher:function(e){var r,n={},o={},a=cf;return t(c().mark((function t(){var i,s,u,f,l,d,p,h,b,v,y,g,m,w,x,k,I,O,E,S,A;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(u=e.props,f=u.state,l=u.walletState,d=u.walletOutput,null!=l&&null!=d){t.next=3;break}return t.abrupt("return");case 3:if(p=d.engine,h=d.walletApi,b=l.accountId,v=l.pluginId,y=f.accounts[b],r!==l&&null!=h&&H(h),r=l,g=null!==(i=y.userSettings[v])&&void 0!==i?i:n,n===g||null==p){t.next=12;break}return t.next=12,p.changeUserSettings(g);case 12:if(n=g,m=null!==(s=y.customTokens[v])&&void 0!==s?s:o,o===m||null==p){t.next=35;break}if(null==p.changeCustomTokens){t.next=20;break}return t.next=18,p.changeCustomTokens(m);case 18:t.next=35;break;case 20:if(null==p.addCustomToken){t.next=35;break}w=0,x=Object.keys(m);case 22:if(!(w<x.length)){t.next=35;break}if(k=x[w],(I=m[k])!==o[k]){t.next=27;break}return t.abrupt("continue",32);case 27:if(null!=(O=Sa(I))){t.next=30;break}return t.abrupt("continue",32);case 30:return t.next=32,p.addCustomToken(Df(Df({},O),I)).catch((function(t){return e.props.onError(t)}));case 32:w++,t.next=22;break;case 35:if(o=m,E=l.allEnabledTokenIds,a===E||null==p){t.next=50;break}if(null==p.changeEnabledTokenIds){t.next=43;break}return t.next=41,p.changeEnabledTokenIds(E).catch((function(t){return e.props.onError(t)}));case 41:t.next=50;break;case 43:if(null==p.disableTokens||null==p.enableTokens){t.next=50;break}return S=$u(y.builtinTokens[v],y.customTokens[v],l.currencyInfo,Zu(a,E)),A=$u(y.builtinTokens[v],y.customTokens[v],l.currencyInfo,Zu(E,a)),t.next=48,p.disableTokens(S).catch((function(t){return e.props.onError(t)}));case 48:return t.next=50,p.enableTokens(A).catch((function(t){return e.props.onError(t)}));case 50:a=E;case 51:case"end":return t.stop()}}),t)})))}});function Kf(e,t,r){return Uf.apply(this,arguments)}function Uf(){return(Uf=t(c().mark((function e(t,r,n){var o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Bf.load(r,Rf);case 2:if(null==(o=e.sent)){e.next=11;break}if(e.t0=null==n.checkPublicKey,e.t0){e.next=9;break}return e.next=8,n.checkPublicKey(o.walletInfo.keys);case 8:e.t0=e.sent;case 9:if(!e.t0){e.next=11;break}return e.abrupt("return",o.walletInfo);case 11:return a={},e.prev=12,e.next=15,n.derivePublicKey(t);case 15:a=e.sent,e.next=20;break;case 18:e.prev=18,e.t1=e.catch(12);case 20:if(i={id:t.id,type:t.type,keys:a},!(Object.keys(a).length>0)){e.next=24;break}return e.next=24,Bf.save(r,Rf,{walletInfo:i});case 24:return e.abrupt("return",i);case 25:case"end":return e.stop()}}),e,null,[[12,18]])})))).apply(this,arguments)}function Ff(e,t){var r=new Set(t);return e.filter((function(e){return!r.has(e)})).join(", ")}function Wf(e,t){return qf.apply(this,arguments)}function qf(){return qf=t(c().mark((function e(t,r){var n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Kr(t,r.loginId),o=n.stashTree,e.next=3,_r(t,"POST","/v2/login/delete",Tn(o,r));case 3:case"end":return e.stop()}}),e)}))),qf.apply(this,arguments)}function zf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Gf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?zf(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zf(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Hf(e,t,r){return Yf.apply(this,arguments)}function Yf(){return(Yf=t(c().mark((function e(t,r,n){var o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t.props.state.accounts[r].allWalletInfosFull,null!=(a=o.find((function(e){return e.id===n})))){e.next=4;break}throw new Error("Invalid wallet id ".concat(n));case 4:if(null!=(i=jo(t.props.state.plugins.currency,a.type))){e.next=7;break}return e.abrupt("return",[]);case 7:return e.next=9,Co(t,i);case 9:if(null!=(s=e.sent).getSplittableTypes){e.next=12;break}return e.abrupt("return",[]);case 12:return e.next=14,s.getSplittableTypes(a);case 14:return u=e.sent,e.abrupt("return",u.filter((function(e){var t=Jf(a,e),r=o.find((function(e){return e.id===t.id}));return null==r||r.archived||r.deleted})));case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Jf(e,t){var r=e.id,n=e.type,o=e.keys,a=_e(Ro)(o);if(null==a)throw new Error("Wallet ".concat(r," is not a splittable type"));for(var i=a.dataKey,s=a.syncKey,u=Qf(lr(Yt.parse(n),i),lr(Yt.parse(t),i)),c=Qf(x.parse(r),u),f=Qf(s,u.subarray(0,s.length)),l=n.replace(/wallet:/,"").replace("-",""),d=t.replace(/wallet:/,"").replace("-",""),p=Bo({dataKey:i,syncKey:f}),h=0,b=Object.keys(o);h<b.length;h++){var v=b[h],y=v===l+"Key"?d+"Key":v;null==p[y]&&(p[y]=o[v])}return{id:x.stringify(c),keys:p,type:t}}function Vf(e,t,r,n){return Xf.apply(this,arguments)}function Xf(){return(Xf=t(c().mark((function e(t,r,n,o){var a,i,s,u,f,l,d,p,h,b,v,y;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.props.state.accounts[r],i=a.allWalletInfosFull,s=a.sessionKey,null!=(u=i.find((function(e){return e.id===n})))){e.next=5;break}throw new Error("Invalid wallet id ".concat(n));case 5:if("wallet:bitcoincash"!==o||"wallet:bitcoin"!==u.type||"bip49"!==u.keys.format){e.next=7;break}throw new Error("Cannot split segwit-format Bitcoin wallets to Bitcoin Cash");case 7:if(!(f="wallet:bitcoinsv"===o&&"wallet:bitcoincash"===u.type)){e.next=14;break}if(null!=(l=t.props.output.currency.wallets[n].walletApi)){e.next=12;break}throw new Error("Missing Wallet");case 12:return e.next=14,$f(l);case 14:if(d=Jf(u,o),p=i.find((function(e){return e.id===d.id})),null==p){e.next=26;break}if(!p.archived&&!p.deleted){e.next=23;break}return(h={})[d.id]={archived:!1,deleted:!1,migratedFromWalletId:void 0},e.next=22,Ni(t,r,h);case 22:return e.abrupt("return",u.id);case 23:if(!f){e.next=25;break}return e.abrupt("return",d.id);case 25:throw new Error("This wallet has already been split");case 26:return b=Vi(t,s,[d]),e.next=29,xn(t,s,b);case 29:return e.prev=29,e.next=32,Wa(t,d.id);case 32:if(v=e.sent,null==(y=t.props.output.currency.wallets[n].walletApi)){e.next=41;break}if(null==y.name){e.next=38;break}return e.next=38,v.renameWallet(y.name);case 38:if(null==y.fiatCurrencyCode){e.next=41;break}return e.next=41,v.setFiatCurrencyCode(y.fiatCurrencyCode);case 41:e.next=46;break;case 43:e.prev=43,e.t0=e.catch(29),t.props.onError(e.t0);case 46:return e.abrupt("return",d.id);case 47:case"end":return e.stop()}}),e,null,[[29,43]])})))).apply(this,arguments)}function $f(e){return Zf.apply(this,arguments)}function Zf(){return(Zf=t(c().mark((function e(t){var r,n,o,a,i,s,u,f,l,d,p,h;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Gf(Gf({},r={currencyCode:"BCH",tokenId:null}),{},{spendTargets:[{nativeAmount:"10000",otherParams:{script:{type:"replayProtection"}},publicAddress:""}],metadata:{},networkFeeOption:"high"}),e.next=4,t.makeSpend(n);case 4:return o=e.sent,e.next=7,t.signTx(o);case 7:return a=e.sent,e.next=10,t.broadcastTx(a);case 10:return i=e.sent,e.next=13,t.saveTx(i);case 13:return e.next=15,t.getReceiveAddress(r);case 15:return s=e.sent,u=s.publicAddress,f=Gf(Gf({},r),{},{metadata:{name:"Replay Protection Tx",notes:"This transaction is to protect your BCH wallet from unintentionally spending BSV funds. Please wait for the transaction to confirm before making additional transactions using this BCH wallet."},networkFeeOption:"high",spendTargets:[{publicAddress:u,nativeAmount:"0"}]}),e.next=20,t.getMaxSpendable(f);case 20:return l=e.sent,f.spendTargets[0].nativeAmount=l,e.next=24,t.makeSpend(f);case 24:return d=e.sent,e.next=27,t.signTx(d);case 27:return p=e.sent,e.next=30,t.broadcastTx(p);case 30:return h=e.sent,e.next=33,t.saveTx(h);case 33:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Qf(e,t){if(e.length!==t.length)throw new Error("Array lengths do not match: ".concat(e.length,", ").concat(t.length));for(var r=new Uint8Array(e.length),n=0;n<e.length;++n)r[n]=e[n]^t[n];return r}function el(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function tl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?el(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):el(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function rl(e,t,r){return nl.apply(this,arguments)}function nl(){return nl=t(c().mark((function e(t,r,n){var o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=Kr(t,r.loginId),a=o.stashTree,e.next=3,_r(t,"POST","/v2/login/vouchers",tl(tl({},Tn(a,r)),{},{data:Tt(n)}));case 3:return i=e.sent,s=bn(a,r.loginKey,ut(i)),e.next=7,Yr(t,s);case 7:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}}),e)}))),nl.apply(this,arguments)}function ol(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var al=["fromWallet","toWallet"];function il(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function sl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?il(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):il(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ul(e,t,r){return cl.apply(this,arguments)}function cl(){return cl=t(c().mark((function e(t,r,n){var o,a,i,s,u,f,l,d,p,h,b,v,y,g,m,w,x,k,I,O,E,S,A=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=(o=A.length>3&&void 0!==A[3]?A[3]:{}).disabled,i=void 0===a?{}:a,s=o.noResponseMs,u=o.preferPluginId,f=o.promoCodes,l=void 0===f?{}:f,d=o.slowResponseMs,p=void 0===d?2e4:d,h=t.props,b=h.log,v=h.state,y=v.accounts[r],g=y.swapSettings,m=y.userSettings,w=v.plugins.swap,b.warn("Requesting swap quotes for: ",sl(sl({},n),{},{fromWallet:n.fromWallet.id,toWallet:n.toWallet.id}),{preferPluginId:u,promoCodes:l}),x=new Set,k=[],I=c().mark((function e(){var t,r,o,a,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=E[O],a=null!=g[o]?g[o]:{},s=a.enabled,(void 0===s||s)&&!i[o]){e.next=4;break}return e.abrupt("return",1);case 4:x.add(o),k.push(w[o].fetchSwapQuote(n,m[o],{infoPayload:null!==(t=null===(r=v.infoCache.corePlugins)||void 0===r?void 0:r[o])&&void 0!==t?t:{},promoCode:l[o]}).then((function(e){var t;La(e);var r=null!==(t=e.request)&&void 0!==t?t:{},n=(r.fromWallet,r.toWallet,ol(r,al)),a=sl(sl({},e),{},{request:n});return x.delete(o),b.warn("".concat(o," gave swap quote:"),a),e}),(function(e){throw x.delete(o),b.warn("".concat(o," gave swap error: ").concat(String(e))),hl(e)&&b.crash("Unknown swap error: ".concat(String(e)),{error:e,swapPluginId:o,request:{fromToken:String(n.fromTokenId),fromWalletType:n.fromWallet.type,toToken:String(n.toTokenId),toWalletType:n.toWallet.type,quoteFor:n.quoteFor}}),e})));case 6:case"end":return e.stop()}}),e)})),O=0,E=Object.keys(w);case 11:if(!(O<E.length)){e.next=18;break}return e.delegateYield(I(),"t0",13);case 13:if(!e.t0){e.next=15;break}return e.abrupt("continue",15);case 15:O++,e.next=11;break;case 18:if(S=Ar(k,p).then((function(e){for(var t=e.results,r=e.errors,a=0;a<x.length;a++){var i=x[a];b.warn("".concat(i," gave swap timeout"))}var s=ll(t,o);return b.warn("".concat(k.length," swap quotes requested, ").concat(t.length," resolved, ").concat(r.length," failed, sorted ").concat(s.map((function(e){return e.pluginId})).join(", "),".")),t.map((function(e){return fl(w,n,e)}))}),(function(e){throw b.warn("All ".concat(k.length," swap quotes rejected.")),dl(e)})),null!=s){e.next=23;break}return e.next=22,S;case 22:return e.abrupt("return",e.sent);case 23:return e.next=25,Sr(S,s);case 25:return e.abrupt("return",e.sent);case 26:case"end":return e.stop()}}),e)}))),cl.apply(this,arguments)}function fl(e,r,n){var o,a,i=C({canBePartial:n.canBePartial,expirationDate:n.expirationDate,fromNativeAmount:n.fromNativeAmount,isEstimate:n.isEstimate,maxFulfillmentSeconds:n.maxFulfillmentSeconds,networkFee:n.networkFee,pluginId:n.pluginId,request:null!==(o=n.request)&&void 0!==o?o:r,swapInfo:null!==(a=n.swapInfo)&&void 0!==a?a:e[n.pluginId].swapInfo,toNativeAmount:n.toNativeAmount,minReceiveAmount:n.minReceiveAmount,approve:function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.approve(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},close:function(){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.close();case 2:z(i);case 3:case"end":return e.stop()}}),e)})))()}});return i}function ll(e,t){var r=t.preferPluginId,n=t.preferType,o=t.promoCodes;return e.sort((function(e,t){if("transfer"===e.pluginId)return-1;if("transfer"===t.pluginId)return 1;if(e.pluginId===r)return-1;if(t.pluginId===r)return 1;if(null!=n){var a=!0===e.swapInfo.isDex&&"DEX"===n||!0!==e.swapInfo.isDex&&"CEX"===n,i=!0===t.swapInfo.isDex&&"DEX"===n||!0!==t.swapInfo.isDex&&"CEX"===n;if(a&&!i)return-1;if(!a&&i)return 1}if(null!=o){var s=null!=o[e.pluginId],u=null!=o[t.pluginId];if(s&&!u)return-1;if(!s&&u)return 1}var c=e.isEstimate,f=void 0===c||c,l=t.isEstimate,d=void 0===l||l;if(!f&&d)return-1;if(f&&!d)return 1;var p=Number(e.toNativeAmount)/Number(e.fromNativeAmount),h=Number(t.toNativeAmount)/Number(t.fromNativeAmount);return p>h?-1:h>p?1:0}))}function dl(e){return e.reduce((function(e,t){var r=pl(e)-pl(t);if(r>0)return e;if(r<0)return t;var n=ir(e),o=ir(t);if(null!=n&&null!=o)return(0,Ra.lt)(n.nativeMin,o.nativeMin)?n:o;var a=ar(e),i=ar(t);return null!=a&&null!=i?(0,Ra.gt)(a.nativeMax,i.nativeMax)?a:i:e}))}function pl(e){return null==e?0:null!=rr(e)||null!=or(e)?6:null!=ir(e)?5:null!=ar(e)?4:null!=ur(e)?3:null!=sr(e)?2:1}function hl(e){return!(pl(e)>1)}var bl=Qn(Ae({name:ke})),vl=Qn(Ae({key:ke,data:ke}));function yl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function gl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?yl(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ml=0,wl=function(){var e=t(c().mark((function e(r,n,o){var a,i,s,u,f,l,d,p,h,b,v,y,g,m,w,x,k,I,O,E,S,A,T,_,P,M,j=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(i=(j.length>3&&void 0!==j[3]?j[3]:{}).keys)){e.next=4;break}throw new Error("No keys provided");case 4:return s="memorywallet-".concat(ml++),u={id:s,type:o,keys:i},e.next=8,Co(r,n.currencyInfo.pluginId);case 8:return f=e.sent,e.next=11,f.derivePublicKey(u);case 11:return l=e.sent,u.keys=gl(gl({},l),u.keys),d=fo(r.props.logBackend,"".concat(s,"-").concat(o)),p=new Map,h=[],b=0,v=!1,y=function(){v&&(H(M),v=!1)},g=_o(t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Po(1e3);case 2:y();case 3:case"end":return e.stop()}}),e)}))),0),m=r.props.state.plugins.currency[n.currencyInfo.pluginId],e.next=23,m.makeCurrencyEngine(u,{callbacks:{onAddressChanged:function(){},onAddressesChecked:function(e){1!==M.syncRatio&&1===e&&(b=e,v=!0)},onNewTokens:function(e){var t=e.sort((function(e,t){return e.localeCompare(t)}));if(h.length!==t.length)return h=t,void(v=!0);for(var r=0;r<t.length;r++)if(h[r]!==t[r])return h=t,void(v=!0)},onSeenTxCheckpoint:function(){},onStakingStatusChanged:function(){},onTokenBalanceChanged:function(e,t){p.get(e)!==t&&((p=new Map(p)).set(e,t),v=!0)},onTransactions:function(){},onTransactionsChanged:function(){},onTxidsChanged:function(){},onUnactivatedTokenIdsChanged:function(){},onWcNewContractCall:function(){},onBlockHeightChanged:function(){},onBalanceChanged:function(){}},customTokens:gl({},n.customTokens),enabledTokenIds:Ir(Object.keys(n.allTokens)),lightMode:!0,log:d,userSettings:gl({},null!==(a=n.userSettings)&&void 0!==a?a:{}),walletLocalDisklet:(0,ie.Wh)(),walletLocalEncryptedDisklet:(0,ie.Wh)()});case 23:return w=e.sent,x=m.currencyInfo,k=x.unsafeBroadcastTx,I=void 0!==k&&k,O=x.unsafeMakeSpend,E=void 0!==O&&O,S=x.unsafeSyncNetwork,A=void 0!==S&&S,T=gl({},i),null!=w.syncNetwork&&(P=function(){var e=t(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==w.syncNetwork){e.next=7;break}return e.next=3,w.syncNetwork({privateKeys:A?{privateKeys:i}:void 0});case 3:t=e.sent,_.setDelay(t),e.next=8;break;case 7:_.stop();case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),(_=_o(P,1e4,{onError:function(e){r.props.log.error(e)}})).start({wait:!1})),e.t0=C,e.t1=ne,e.t2=function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null==w.changeEnabledTokenIds){t.next=3;break}return t.next=3,w.changeEnabledTokenIds(e);case 3:case"end":return t.stop()}}),t)})))()},e.t3=function(){return t(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,w.startEngine();case 2:null===(t=_)||void 0===t||t.start({wait:!1});case 3:case"end":return e.stop()}}),e)})))()},e.t4=function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Tf(e,m,w,n.allTokens,u);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},e.t5=function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,w.makeSpend(e,E?T:void 0);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},e.t6=function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,w.signTx(e,T);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},e.t7=function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,w.broadcastTx(e,I?T:void 0);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},e.t8=function(){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))()},e.t9=function(){return t(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d.warn("killing memory wallet"),null===(t=_)||void 0===t||t.stop(),z(M),e.next=5,w.killEngine();case 5:case"end":return e.stop()}}),e)})))()},e.t10={watch:e.t1,get balanceMap(){return p},get detectedTokenIds(){return h},get syncRatio(){return b},changeEnabledTokenIds:e.t2,startEngine:e.t3,getMaxSpendable:e.t4,makeSpend:e.t5,signTx:e.t6,broadcastTx:e.t7,saveTx:e.t8,close:e.t9},M=(0,e.t0)(e.t10),g.start({wait:!1}),e.abrupt("return",M);case 41:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}();function xl(e,t){return xl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},xl(e,t)}function kl(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xl(e,t)}function Il(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ol(e,t){if(t&&("object"===se(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Il(e)}function El(e){return El=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},El(e)}function Sl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Al(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Sl(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Tl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=El(e);if(t){var o=El(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Ol(this,r)}}var _l={},Pl=[],Ml=function(e){kl(l,e);var r,n,o,a,i,s,u,f=Tl(l);function l(e,t,r){var n;fe(this,l),(n=f.call(this))._ai=e,n._accountId=t,n._pluginId=r;var o=e.props.state.plugins.currency[r].otherMethods;return null!=o?(C(o),n.otherMethods=o):n.otherMethods={},n}return de(l,[{key:"currencyInfo",get:function(){return this._ai.props.state.plugins.currency[this._pluginId].currencyInfo}},{key:"allTokens",get:function(){var e=this._ai.props.state,t=this._accountId,r=this._pluginId;return e.accounts[t].allTokens[r]}},{key:"builtinTokens",get:function(){var e=this._ai.props.state,t=this._accountId,r=this._pluginId;return e.accounts[t].builtinTokens[r]}},{key:"customTokens",get:function(){var e,t=this._ai.props.state,r=this._accountId,n=this._pluginId;return null!==(e=t.accounts[r].customTokens[n])&&void 0!==e?e:_l}},{key:"getTokenId",value:(u=t(c().mark((function e(t){var r,n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._ai,n=this._pluginId,e.next=3,xa(r,n,t);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"addCustomToken",value:(s=t(c().mark((function e(t){var r,n,o,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._accountId,n=this._ai,o=this._pluginId,e.next=3,xa(n,o,t);case 3:return a=e.sent,n.props.dispatch({type:"ACCOUNT_CUSTOM_TOKEN_ADDED",payload:{accountId:r,pluginId:o,tokenId:a,token:t}}),e.abrupt("return",a);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"changeCustomToken",value:(i=t(c().mark((function e(t,r){var n,o,a,i,s,u,f,l,d,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._accountId,o=this._ai,a=this._pluginId,null!=o.props.state.accounts[n].customTokens[a][t]){e.next=4;break}throw new Error('There is no token with id "'.concat(t,'"'));case 4:return e.next=6,xa(o,a,r);case 6:if(i=e.sent,o.props.dispatch({type:"ACCOUNT_CUSTOM_TOKEN_ADDED",payload:{accountId:n,pluginId:a,tokenId:i,token:r}}),i===t){e.next=23;break}s=o.props.state.currency.wallets,u=0,f=Object.keys(s);case 11:if(!(u<f.length)){e.next=22;break}if(l=f[u],(d=s[l]).accountId===n&&d.pluginId===a&&d.enabledTokenIds.includes(t)){e.next=16;break}return e.abrupt("continue",19);case 16:p=l.slice(0,2),o.props.log.warn("enabledTokenIds: ".concat(p," changeCustomToken edited id")),o.props.dispatch({type:"CURRENCY_WALLET_ENABLED_TOKENS_CHANGED",payload:{walletId:l,enabledTokenIds:Zu([].concat(Ir(d.enabledTokenIds),[i]),[t])}});case 19:u++,e.next=11;break;case 22:o.props.dispatch({type:"ACCOUNT_CUSTOM_TOKEN_REMOVED",payload:{accountId:n,pluginId:a,tokenId:t}});case 23:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"removeCustomToken",value:(a=t(c().mark((function e(t){var r,n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=this._accountId,n=this._ai,o=this._pluginId,n.props.dispatch({type:"ACCOUNT_CUSTOM_TOKEN_REMOVED",payload:{accountId:r,pluginId:o,tokenId:t}});case 2:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"alwaysEnabledTokenIds",get:function(){var e,t=this._ai.props.state,r=this._accountId,n=this._pluginId;return null!==(e=t.accounts[r].alwaysEnabledTokenIds[n])&&void 0!==e?e:Pl}},{key:"changeAlwaysEnabledTokenIds",value:(o=t(c().mark((function e(t){var r,n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=this._accountId,n=this._ai,o=this._pluginId,n.props.dispatch({type:"ACCOUNT_ALWAYS_ENABLED_TOKENS_CHANGED",payload:{accountId:r,pluginId:o,tokenIds:t}});case 2:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"userSettings",get:function(){return this._ai.props.state.accounts[this._accountId].userSettings[this._pluginId]}},{key:"changeUserSettings",value:(n=t(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ri(this._ai,this._accountId,this._pluginId,t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"importKey",value:(r=t(c().mark((function e(t){var r,n,o,a=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:{},e.next=3,Co(this._ai,this._pluginId);case 3:if(null!=(n=e.sent).importPrivateKey){e.next=6;break}throw new Error("This wallet does not support importing keys");case 6:return e.next=8,n.importPrivateKey(t,r.keyOptions);case 8:return o=e.sent,e.abrupt("return",Al(Al({},o),{},{imported:!0}));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})}]),l}(oe),jl=function(e){kl(a,e);var r,n,o=Tl(a);function a(e,t,r){var n;return fe(this,a),(n=o.call(this))._ai=e,n._accountId=t,n._pluginId=r,n}return de(a,[{key:"enabled",get:function(){var e=this._ai.props.state.accounts[this._accountId].swapSettings,t=(null!=e[this._pluginId]?e[this._pluginId]:{}).enabled;return void 0===t||t}},{key:"needsActivation",get:function(){var e,t,r=this._ai.props.state.plugins.swap[this._pluginId];if(null==r.checkSettings)return!1;var n=null!==(e=this._ai.props.state.accounts[this._accountId].userSettings[this._pluginId])&&void 0!==e?e:{};return null!==(t=r.checkSettings(n).needsActivation)&&void 0!==t&&t}},{key:"swapInfo",get:function(){return this._ai.props.state.plugins.swap[this._pluginId].swapInfo}},{key:"userSettings",get:function(){return this._ai.props.state.accounts[this._accountId].userSettings[this._pluginId]}},{key:"changeEnabled",value:(n=t(c().mark((function e(t){var r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._ai.props.state.accounts[this._accountId],e.next=3,Li(this._ai,this._accountId,this._pluginId,Al(Al({},r.swapSettings[this._pluginId]),{},{enabled:t}));case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"changeUserSettings",value:(r=t(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ri(this._ai,this._accountId,this._pluginId,t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})}]),a}(oe);function Cl(e,r){for(var o=e.props.state.accounts[r],s=function(){var t=e.props.state.accounts[r];return null!=t&&(o=t),o},u=s(),f=u.accountWalletInfo,l=u.loginType,d={},p=0,h=Object.keys(e.props.state.plugins.currency);p<h.length;p++){var b=h[p],v=new Ml(e,r,b);d[b]=v}for(var y={},g=0,m=Object.keys(e.props.state.plugins.swap);g<m.length;g++){var x=m[g],k=new jl(e,r,x);y[x]=k}var I=function(e,r){var n=e.props.state.accounts[r].accountWalletInfo,o=na(e.props.state,n.id),a=function(t){return ia(e.props.state,n.id,t)},i=function(e){return"Plugins/".concat(a(e))},s=function(e,t){return"".concat(i(e),"/").concat(a(t),".json")},u={deleteItem:function(e,r){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o.delete(s(e,r));case 2:case"end":return t.stop()}}),t)})))()},deleteStore:function(e){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o.delete(i(e));case 2:case"end":return t.stop()}}),t)})))()},listItemIds:function(e){return t(c().mark((function r(){var n,a;return c().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=[],r.t0=ie.gQ,r.next=4,o.list(i(e));case 4:return r.t1=r.sent,a=(0,r.t0)(r.t1),r.next=8,Promise.all(a.map(function(){var e=t(c().mark((function e(t){var r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vl.load(o,t);case 2:null!=(r=e.sent)&&n.push(r.key);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 8:return r.abrupt("return",n);case 9:case"end":return r.stop()}}),r)})))()},listStoreIds:function(){return t(c().mark((function e(){var r,n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[],e.t0=ie.ji,e.next=4,o.list("Plugins");case 4:return e.t1=e.sent,n=(0,e.t0)(e.t1),e.next=8,Promise.all(n.map(function(){var e=t(c().mark((function e(t){var n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,bl.load(o,"".concat(t,"/Name.json"));case 2:null!=(n=e.sent)&&r.push(n.name);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}}),e)})))()},getItem:function(e,r){return t(c().mark((function t(){var n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,vl.load(o,s(e,r));case 2:if(null!=(n=t.sent)){t.next=5;break}throw new Error('No item named "'.concat(r,'"'));case 5:return t.abrupt("return",n.data);case 6:case"end":return t.stop()}}),t)})))()},setItem:function(e,r,n){return t(c().mark((function t(){var a,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a="".concat(i(e),"/Name.json"),t.next=3,bl.load(o,a);case 3:if(null!=(u=t.sent)){t.next=9;break}return t.next=7,bl.save(o,a,{name:e});case 7:t.next=11;break;case 9:if(u.name===e){t.next=11;break}throw new Error("Warning: folder name doesn't match for ".concat(e));case 11:return t.next=13,vl.save(o,s(e,r),{key:r,data:n});case 13:case"end":return t.stop()}}),t)})))()}};return C(u),u}(e,r),O=Ua(e,f);function E(){if(e.props.state.hideKeys)throw new Error("Not available when `hideKeys` is enabled")}var S={on:re,watch:ne,get id(){return O.id},get type(){return O.type},get disklet(){return E(),O.disklet},get localDisklet(){return E(),O.localDisklet},sync:function(){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O.sync();case 2:case"end":return e.stop()}}),e)})))()},get appId(){return s().login.appId},get created(){return s().login.created},getLoginKey:function(){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return E(),e.abrupt("return",Ht.stringify(s().login.loginKey));case 2:case"end":return e.stop()}}),e)})))()},get lastLogin(){return s().login.lastLogin},get loggedIn(){return null!=e.props.state.accounts[r]},get recoveryKey(){E();var e=s().login;return null!=e.recovery2Key?Ht.stringify(e.recovery2Key):void 0},get rootLoginId(){E();var e=s().loginTree;return Ht.stringify(e.loginId)},get username(){return s().loginTree.username},get currencyConfig(){return d},get swapConfig(){return y},get dataStore(){return I},get edgeLogin(){return null==s().loginTree.loginKey},keyLogin:"keyLogin"===l,newAccount:"newAccount"===l,passwordLogin:"passwordLogin"===l,pinLogin:"pinLogin"===l,recoveryLogin:"recoveryLogin"===l,changePassword:function(n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,ls(e,r,n);case 3:case"end":return t.stop()}}),t)})))()},changePin:function(n){return t(c().mark((function t(){var o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,Os(e,r,n);case 3:return o=s(),a=o.login,t.abrupt("return",null!=a.pin2Key?Ht.stringify(a.pin2Key):"");case 5:case"end":return t.stop()}}),t)})))()},changeRecovery:function(n,o){return t(c().mark((function t(){var a,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,Fs(e,r,n,o);case 3:if(a=s(),null!=(i=a.loginTree).recovery2Key){t.next=6;break}throw new Error("Missing recoveryKey");case 6:return t.abrupt("return",Ht.stringify(i.recovery2Key));case 7:case"end":return t.stop()}}),t)})))()},changeUsername:function(n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),n.username=be(n.username),t.next=4,$s(e,r,n);case 4:case"end":return t.stop()}}),t)})))()},checkPassword:function(r){return t(c().mark((function t(){var n,o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),n=s(),o=n.loginTree,t.next=4,ps(e,o,r);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})))()},checkPin:function(r){return t(c().mark((function t(){var n,o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(E(),n=s(),o=n.login,a=n.loginTree,null==o.pin){t.next=6;break}t.t0=r===o.pin,t.next=9;break;case 6:return t.next=8,Ss(e,a,r);case 8:t.t0=t.sent;case 9:return t.abrupt("return",t.t0);case 10:case"end":return t.stop()}}),t)})))()},getPin:function(){return t(c().mark((function e(){var t,r,n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=s(),n=r.login,o=r.loginTree,e.abrupt("return",null!==(t=n.pin)&&void 0!==t?t:o.pin);case 2:case"end":return e.stop()}}),e)})))()},deletePassword:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,bs(e,r);case 3:case"end":return t.stop()}}),t)})))()},deletePin:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,Ts(e,r);case 3:case"end":return t.stop()}}),t)})))()},deleteRecovery:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,qs(e,r);case 3:case"end":return t.stop()}}),t)})))()},get otpKey(){E();var e=s().loginTree;return null!=e.otpKey?w.stringify(e.otpKey,{pad:!1}):void 0},get otpResetDate(){return E(),s().loginTree.otpResetDate},cancelOtpReset:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,nn(e,r);case 3:case"end":return t.stop()}}),t)})))()},enableOtp:function(){var n=arguments;return t(c().mark((function t(){var o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=n.length>0&&void 0!==n[0]?n[0]:604800,E(),t.next=4,Qr(e,r,o);case 4:case"end":return t.stop()}}),t)})))()},disableOtp:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,tn(e,r);case 3:case"end":return t.stop()}}),t)})))()},repairOtp:function(n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return E(),t.next=3,un(e,r,w.parse(n,{loose:!0}));case 3:case"end":return t.stop()}}),t)})))()},get pendingVouchers(){return s().login.pendingVouchers},approveVoucher:function(r){return t(c().mark((function t(){var n,o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s(),o=n.loginTree,t.next=3,rl(e,o,{approvedVouchers:[r]});case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))()},rejectVoucher:function(r){return t(c().mark((function t(){var n,o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s(),o=n.loginTree,t.next=3,rl(e,o,{rejectedVouchers:[r]});case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))()},fetchLobby:function(n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.props.log.breadcrumb("EdgeAccount.fetchLobby",{}),E(),t.next=4,Gu(e,r,n);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})))()},deleteRemoteAccount:function(){return t(c().mark((function t(){var r,n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=s(),n=r.loginTree,t.next=3,Wf(e,n);case 3:case"end":return t.stop()}}),t)})))()},logout:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.props.dispatch({type:"LOGOUT",payload:{accountId:r}});case 1:case"end":return t.stop()}}),t)})))()},get allKeys(){return e.props.state.accounts[r].allWalletInfosClean},changeWalletStates:function(n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Ni(e,r,n);case 2:case"end":return t.stop()}}),t)})))()},createWallet:function(r,n){return t(c().mark((function t(){var o,a,i,u,f,l;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=s(),a=o.login,i=o.sessionKey,u=o.stashTree,e.props.log.breadcrumb("EdgeAccount.createWallet",{}),t.next=4,Qi(e,r,{keys:n});case 4:return f=t.sent,l=An(u,i,a.loginId),t.next=8,xn(e,i,Vi(e,l,[f]));case 8:return t.abrupt("return",f.id);case 9:case"end":return t.stop()}}),t)})))()},getFirstWalletInfo:pe.prototype.getFirstWalletInfo,getWalletInfo:pe.prototype.getWalletInfo,listWalletIds:pe.prototype.listWalletIds,splitWalletInfo:function(n,o){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Vf(e,r,n,o);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},listSplittableWalletTypes:function(n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Hf(e,r,n);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},getDisplayPrivateKey:function(n){return t(c().mark((function t(){var o,a,i,s,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=Nl(e,r,n),a=Mo(e.props.state.plugins.currency,o.type),t.next=4,Co(e,a);case 4:if(null==(i=t.sent).getDisplayPrivateKey){t.next=9;break}return t.next=8,i.getDisplayPrivateKey(o);case 8:return t.abrupt("return",t.sent);case 9:if(null!=(s=e.props.output.currency.wallets[n].engine)&&null!=s.getDisplayPrivateSeed){t.next=12;break}throw new Error("Wallet has not yet loaded");case 12:return t.next=14,s.getDisplayPrivateSeed(o.keys);case 14:if(null!=(u=t.sent)){t.next=17;break}throw new Error("The engine failed to return a key");case 17:return t.abrupt("return",u);case 18:case"end":return t.stop()}}),t)})))()},getDisplayPublicKey:function(n){return t(c().mark((function t(){var o,a,i,s,u,f,l;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=Nl(e,r,n),a=Mo(e.props.state.plugins.currency,o.type),t.next=4,Co(e,a);case 4:if(null==(i=t.sent).getDisplayPublicKey){t.next=13;break}return s=Wo(e.props.io,n),t.next=9,Kf(o,s,i);case 9:return u=t.sent,t.next=12,i.getDisplayPublicKey(u);case 12:return t.abrupt("return",t.sent);case 13:if(null!=(f=e.props.output.currency.wallets[n].engine)&&null!=f.getDisplayPublicSeed){t.next=16;break}throw new Error("Wallet has not yet loaded");case 16:return t.next=18,f.getDisplayPublicSeed();case 18:if(null!=(l=t.sent)){t.next=21;break}throw new Error("The engine failed to return a key");case 21:return t.abrupt("return",l);case 22:case"end":return t.stop()}}),t)})))()},getRawPrivateKey:function(n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Nl(e,r,n).keys);case 1:case"end":return t.stop()}}),t)})))()},getRawPublicKey:function(n){return t(c().mark((function t(){var o,a,i,s,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=Nl(e,r,n),a=Mo(e.props.state.plugins.currency,o.type),t.next=4,Co(e,a);case 4:return i=t.sent,s=Wo(e.props.io,n),t.next=8,Kf(o,s,i);case 8:return u=t.sent,t.abrupt("return",u.keys);case 10:case"end":return t.stop()}}),t)})))()},get activeWalletIds(){return e.props.state.accounts[r].activeWalletIds},get archivedWalletIds(){return e.props.state.accounts[r].archivedWalletIds},get hiddenWalletIds(){return e.props.state.accounts[r].hiddenWalletIds},get currencyWallets(){return e.props.output.accounts[r].currencyWallets},get currencyWalletErrors(){return e.props.state.accounts[r].currencyWalletErrors},createCurrencyWallet:function(n){var o=arguments;return t(c().mark((function t(){var a,i,u,f,l,d,p;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=o.length>1&&void 0!==o[1]?o[1]:{},i=s(),u=i.login,f=i.sessionKey,l=i.stashTree,e.props.log.breadcrumb("EdgeAccount.createCurrencyWallet",{}),t.next=5,Qi(e,n,a);case 5:return d=t.sent,p=An(l,f,u.loginId),t.next=9,xn(e,f,Vi(e,p,[d]));case 9:return t.next=11,ts(e,r,d.id,a);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t)})))()},makeMemoryWallet:function(r){var n=arguments;return t(c().mark((function t(){var o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=n.length>1&&void 0!==n[1]?n[1]:{},null!=(a=Object.values(d).find((function(e){return e.currencyInfo.walletType===r})))){t.next=4;break}throw new Error("Invalid walletType");case 4:return t.next=6,wl(e,a,r,o);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)})))()},createCurrencyWallets:function(n){return t(c().mark((function o(){var a,i,u,f,l,d;return c().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return a=s(),i=a.login,u=a.sessionKey,f=a.stashTree,e.props.log.breadcrumb("EdgeAccount.makeMemoryWallet",{}),o.next=4,Promise.all(n.map(function(){var r=t(c().mark((function t(r){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Qi(e,r.walletType,r);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return r.apply(this,arguments)}}()));case 4:return l=o.sent,d=An(f,u,i.loginId),o.next=8,xn(e,u,Vi(e,d,l));case 8:return o.next=10,Promise.all(l.map(function(){var o=t(c().mark((function t(o,a){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Dl(ts(e,r,o.id,n[a]));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e,t){return o.apply(this,arguments)}}()));case 10:return o.abrupt("return",o.sent);case 11:case"end":return o.stop()}}),o)})))()},waitForCurrencyWallet:function(e){var r=this;return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,n){var o=function(){var o=r.currencyWallets[e];null!=o&&(t(o),a());var i=r.currencyWalletErrors[e];null!=i&&(n(i),a())},a=function(){for(var e=0;e<i.length;e++){(0,i[e])()}},i=[r.watch("currencyWallets",o),r.watch("currencyWalletErrors",o)];o()}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},waitForAllWallets:function(){var e=this;return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,r){var n=function(){if(null==e.activeWalletIds.find((function(t){return null==e.currencyWallets[t]&&null==e.currencyWalletErrors[t]}))){for(var r=0;r<o.length;r++){(0,o[r])()}t()}},o=[e.watch("activeWalletIds",n),e.watch("currencyWallets",n),e.watch("currencyWalletErrors",n)];n()}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},getActivationAssets:function(n){return t(c().mark((function t(){var o,a,i,s,u,f;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=n.activateWalletId,a=n.activateTokenIds,i=e.props.output.accounts[r].currencyWallets,s=e.props.output.currency.wallets[o],null!=(u=s.engine)){t.next=6;break}throw new Error("Invalid wallet: ".concat(o," not found"));case 6:if(null!=u.engineGetActivationAssets){t.next=8;break}throw new Error("getActivationAssets unsupported by walletId ".concat(o));case 8:return t.next=10,u.engineGetActivationAssets({currencyWallets:i,activateTokenIds:a});case 10:return(f=t.sent).assetOptions.forEach((function(e){var t;return e.tokenId=null!==(t=e.tokenId)&&void 0!==t?t:null})),t.abrupt("return",f);case 13:case"end":return t.stop()}}),t)})))()},activateWallet:function(n){return t(c().mark((function t(){var o,a,i,s,u,f,l,d,p,h;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=n.activateWalletId,i=n.activateTokenIds,s=n.paymentInfo,u=e.props.output.accounts[r].currencyWallets,f=e.props.output.currency.wallets[a],null!=(l=f.engine)){t.next=6;break}throw new Error("Invalid wallet: ".concat(a," not found"));case 6:if(null!=l.engineActivateWallet){t.next=8;break}throw new Error("activateWallet unsupported by walletId ".concat(a));case 8:if(d=null!==(o=null==s?void 0:s.walletId)&&void 0!==o?o:"",null!=(p=u[d])){t.next=12;break}throw new Error("No wallet for walletId ".concat(d));case 12:return t.next=14,l.engineActivateWallet({activateTokenIds:i,paymentInfo:null!=s?{wallet:p,tokenId:s.tokenId}:void 0,paymentTokenId:null==s?void 0:s.tokenId,paymentWallet:p});case 14:return void 0===(h=t.sent).networkFee.tokenId&&(h.networkFee.tokenId=null),t.abrupt("return",C(h));case 17:case"end":return t.stop()}}),t)})))()},fetchSwapQuote:function(o,s){return t(c().mark((function t(){var u,f,l,d,p;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ul(e,r,o,s);case 2:for(u=t.sent,f=n(c=u)||kr(c)||a(c)||i(),l=f[0],d=f.slice(1),p=0;p<d.length;p++)d[p].close().catch((function(){}));if(null!=l){t.next=9;break}throw new Error("No swap providers enabled");case 9:return t.abrupt("return",l);case 10:case"end":return t.stop()}var c}),t)})))()},fetchSwapQuotes:function(n,o){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ul(e,r,n,o);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()}};return C(S),S}function Nl(e,t,r){var n=e.props.state.accounts[t].allWalletInfosFull.find((function(e){return e.id===r}));if(null==n)throw new Error("Invalid wallet: ".concat(r," not found"));return n}function Dl(e){return Rl.apply(this,arguments)}function Rl(){return(Rl=t(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t;case 3:return e.t0=e.sent,e.abrupt("return",{ok:!0,result:e.t0});case 7:return e.prev=7,e.t1=e.catch(0),e.abrupt("return",{ok:!1,error:e.t1});case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function Bl(e){var t=function(e,t){if("object"!==se(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==se(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===se(t)?t:String(t)}function Ll(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Kl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ll(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ll(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Ul={},Fl={loginId:new Uint8Array,loginKey:new Uint8Array},Wl=Zc({accountWalletInfo:af((function(e){return e.root.login.appId}),(function(e){return e.self.allWalletInfosFull}),(function(e,t){var r=Yi(e),n=Hi(t,r);if(null==n)throw new Error('Cannot find a "'.concat(r,'" repo'));return n})),accountWalletInfos:af((function(e){return e.root.login.appId}),(function(e){return e.self.allWalletInfosFull}),(function(e,t){var r=[Yi(e)];return""===e&&r.push("account:repo:co.airbitz.wallet",""),t.filter((function(e){return r.includes(e.type)}))})),allWalletInfosFull:af((function(e){return e.self.stashTree}),(function(e){return e.self.login}),(function(e){return e.self.legacyWalletInfos}),(function(e){return e.self.walletStates}),(function(e,t,r,n){return function(e,t,r,n){for(var o=new Map,a=new Map,i=Ir(r),s=Ur(e,t.loginId),u=0;u<r.length;u++){var c=r[u];i.push(c);var f=a.get(c.id);null!=f?f.push(s.appId):a.set(c.id,[s.appId])}return function e(t,r){for(var n=$i(t,r,o),s=0;s<n.length;s++){var u=n[s];i.push(u);var c=a.get(u.id);null!=c?c.push(t.appId):a.set(u.id,[t.appId])}for(var f=0,l=null!==(d=t.children)&&void 0!==d?d:[];f<l.length;f++){var d,p=l[f];null!=p.parentBox&&e(p,vr(p.parentBox,r))}}(s,t.loginKey),Xi(i).map((function(e){var t,r,s;return Gi(Gi({appId:(s=null!==(t=a.get(e.id))&&void 0!==t?t:[],s[s.length-1]),appIds:null!==(r=a.get(e.id))&&void 0!==r?r:[],archived:!1,created:o.get(e.id),deleted:!1,hidden:!1,sortIndex:i.length},n[e.id]),e)}))}(e,t,r,n)})),allWalletInfosClean:af((function(e){return e.self.allWalletInfosFull}),(function(e){return e.map((function(e){return Kl(Kl({},e),{},{keys:{}})}))})),currencyWalletErrors:function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,o=r.self.activeWalletIds,a=r.root.currency.wallets,i=o!==(null===(e=n.self)||void 0===e?void 0:e.activeWalletIds),s={},u=0;u<o.length;u++){var c=o[u],f=a[c].engineFailure;null!=f&&(s[c]=f),s[c]!==t[c]&&(i=!0)}return i?s:t},currencyWalletIds:af((function(e){return e.self.walletInfos}),(function(e){return e.root.plugins.currency}),(function(e,t){return Object.keys(e).filter((function(r){var n=e[r],o=jo(t,n.type);return!n.deleted&&null!=o})).sort((function(t,r){var n=e[t],o=e[r];return n.sortIndex-o.sortIndex}))})),activeWalletIds:af((function(e){return e.self.walletInfos}),(function(e){return e.self.currencyWalletIds}),(function(e){return e.self.keysLoaded}),(function(e,t,r){return r?t.filter((function(t){return!e[t].archived})):[]})),archivedWalletIds:af((function(e){return e.self.walletInfos}),(function(e){return e.self.currencyWalletIds}),(function(e){return e.self.keysLoaded}),(function(e,t,r){return r?t.filter((function(t){return e[t].archived})):[]})),hiddenWalletIds:af((function(e){return e.self.walletInfos}),(function(e){return e.self.currencyWalletIds}),(function(e){return e.self.keysLoaded}),(function(e,t,r){return r?t.filter((function(t){return e[t].hidden})):[]})),keysLoaded:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"ACCOUNT_KEYS_LOADED"===(arguments.length>1?arguments[1]:void 0).type||e},legacyWalletInfos:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return"ACCOUNT_KEYS_LOADED"===t.type?t.payload.legacyWalletInfos:e},walletInfos:af((function(e){return e.self.allWalletInfosFull}),(function(e){for(var t={},r=0;r<e.length;r++){var n=e[r];t[n.id]=n}return t})),walletStates:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return"ACCOUNT_CHANGED_WALLET_STATES"===t.type||"ACCOUNT_KEYS_LOADED"===t.type?t.payload.walletStates:e},pauseWallets:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;return"LOGIN"===t.type?t.payload.pauseWallets:e},loadFailure:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;if("ACCOUNT_LOAD_FAILED"===t.type){var r=t.payload.error;return r instanceof Error?r:new Error(String(r))}return e},login:af((function(e){return e.root.login.appId}),(function(e){return e.self.loginTree}),(function(e,t){var r=dn(t,(function(t){return t.appId===e}));if(null==r)throw new Error("Internal error: cannot find login for ".concat(e));return r})),loginTree:af((function(e){return e.self.stashTree}),(function(e){return e.self.sessionKey}),(function(e,t){return yn(e,t)})),loginType:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"newAccount",t=arguments.length>1?arguments[1]:void 0;return"LOGIN"===t.type?t.payload.loginType:e},rootLoginId:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array(0),t=arguments.length>1?arguments[1]:void 0;return"LOGIN"===t.type?t.payload.rootLoginId:e},sessionKey:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Fl,t=arguments.length>1?arguments[1]:void 0;return"LOGIN"===t.type?t.payload.sessionKey:e},stashTree:af((function(e){return e.self.rootLoginId}),(function(e){return e.root.login.stashes}),(function(e,t){for(var r=0;r<t.length;r++){var n=t[r];if(pr(n.loginId,e))return n}throw new Error("There is no stash")})),allTokens:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,n=t.self,o=n.builtinTokens,a=n.customTokens;if(null==r.self||o!==r.self.builtinTokens||a!==r.self.customTokens){for(var i=Kl({},e),s=0,u=Object.keys(t.root.plugins.currency);s<u.length;s++){var c=u[s];null!=r.self&&o[c]===r.self.builtinTokens[c]&&a[c]===r.self.customTokens[c]||(i[c]=Kl(Kl({},a[c]),o[c]))}return i}return e},builtinTokens:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if("ACCOUNT_BUILTIN_TOKENS_LOADED"===t.type){var r=t.payload,n=r.pluginId,o=r.tokens;return Kl(Kl({},e),{},ce({},n,o))}return e},customTokens:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ul,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ACCOUNT_CUSTOM_TOKENS_LOADED":var r=t.payload.customTokens;return r;case"ACCOUNT_CUSTOM_TOKEN_ADDED":var n,o=t.payload,a=o.pluginId,i=o.tokenId,s=o.token,u=null!==(n=e[a])&&void 0!==n?n:{};if(Ga(u[i],s))return e;var c=Kl(Kl({},u),{},ce({},i,s));return Kl(Kl({},e),{},ce({},a,c));case"ACCOUNT_CUSTOM_TOKEN_REMOVED":var f,l=t.payload,d=l.pluginId,p=l.tokenId,h=null!==(f=e[d])&&void 0!==f?f:{};if(null==h[p])return e;h[p];var b=ol(h,[p].map(Bl));return Kl(Kl({},e),{},ce({},d,b))}return e},alwaysEnabledTokenIds:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if("ACCOUNT_ALWAYS_ENABLED_TOKENS_CHANGED"===t.type){var r=t.payload,n=r.pluginId,o=r.tokenIds;return Kl(Kl({},e),{},ce({},n,o))}return e},swapSettings:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ACCOUNT_PLUGIN_SETTINGS_LOADED":return t.payload.swapSettings;case"ACCOUNT_SWAP_SETTINGS_CHANGED":var r=t.payload,n=r.pluginId,o=r.swapSettings,a=Kl({},e);return a[n]=o,a}return e},userSettings:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ACCOUNT_PLUGIN_SETTINGS_CHANGED":var r=t.payload,n=r.pluginId,o=r.userSettings,a=Kl({},e);return a[n]=o,a;case"ACCOUNT_PLUGIN_SETTINGS_LOADED":return t.payload.userSettings}return e}}),ql=tf(Wl,(function(e,t){return/^ACCOUNT_/.test(e.type)&&"payload"in e&&"object"===se(e.payload)&&"accountId"in e.payload&&e.payload.accountId===t.id||"LOGIN"===e.type&&t.root.lastAccountId===t.id?e:{type:"UPDATE_NEXT"}}));function zl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Gl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?zl(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Hl=Yn({accountApi:function(e){return{destroy:function(){e.props.state={accounts:{}};var t=e.props.accountOutput;if(null!=t){var r=t.accountApi;if(null!=r){H(r),z(r),z(r.dataStore);for(var n=r.currencyConfig,o=r.swapConfig,a=0,i=Object.keys(n);a<i.length;a++){z(n[i[a]])}for(var s=0,u=Object.keys(o);s<u.length;s++){z(o[u[s]])}}}},update:function(){return t(c().mark((function r(){var n,o,a,i,s,u,f,l;return c().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return l=function(){return(l=t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([ji(n,a),ja(n,a),Ui(n,a)]);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)},f=function(){return l.apply(this,arguments)},n=ld(e),o=e.props,a=o.accountId,i=o.accountState,s=o.log,u=i.accountWalletInfos,r.prev=5,r.next=8,No(n);case 8:return r.next=10,Aa(n,a);case 10:return s.warn("Login: currency plugins exist"),r.next=13,Promise.all(u.map((function(e){return Qo(n,e)})));case 13:return s.warn("Login: synced account repos"),r.next=16,f();case 16:s.warn("Login: loaded files"),e.onOutput(Cl(n,a)),s.warn("Login: complete"),r.next=24;break;case 21:r.prev=21,r.t0=r.catch(5),e.props.dispatch({type:"ACCOUNT_LOAD_FAILED",payload:{accountId:a,error:r.t0}});case 24:return r.next=26,Zn;case 26:return r.abrupt("return",r.sent);case 27:case"end":return r.stop()}}),r,null,[[5,21]])})))()}}},syncTimer:Xn((function(e){function r(){return(r=t(c().mark((function t(){var r,n,o,a,i,s,u,f,l;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=ld(e),n=e.props,o=n.accountId,a=n.accountState,i=a.accountWalletInfos,null!=e.props.state.accounts[o]){t.next=5;break}return t.abrupt("return");case 5:return t.next=7,Promise.all(i.map((function(e){return ta(r,e.id)})));case 7:for(s=t.sent,u=[],f=0;f<s.length;f++)l=s[f],u.push.apply(u,Ir(l));if(!(u.length>0)){t.next=13;break}return t.next=13,Promise.all([Ui(r,o),ji(r,o)]);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function n(){return(n=t(c().mark((function t(){var r,n,o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=ld(e),n=e.props.accountId,null!=e.props.state.accounts[n]){t.next=4;break}return t.abrupt("return");case 4:return o=e.props.state.accounts[n].sessionKey,t.next=7,En(r,o);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var o=_o((function(){return r.apply(this,arguments)}),Zo),a=_o((function(){return n.apply(this,arguments)}),Zo,{onError:function(t){var r=nr(t);null!=r&&e.props.onError(r)}});return{update:function(){var t;null!=(null===(t=e.props.accountOutput)||void 0===t?void 0:t.accountApi)&&(o.start({wait:Zo*(1+Math.random())}),a.start({wait:Zo*(1+Math.random())}))},destroy:function(){o.stop(),a.stop()}}}),(function(e){return e.state.paused?void 0:e})),tokenSaver:function(e){var r=Ul;return function(){var n=t(c().mark((function t(){var n,o,a,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.props,o=n.accountId,a=n.accountState,(i=a.customTokens)===r||r===Ul){t.next=7;break}return t.next=5,Na(ld(e),o).catch((function(t){return e.props.onError(t)}));case 5:return t.next=7,Po(100);case 7:r=i;case 8:case"end":return t.stop()}}),t)})));return function(){return n.apply(this,arguments)}}()},watcher:function(e){var t;return function(){var r=e.props,n=r.accountState,o=r.accountOutput;if(null!=n&&null!=o){var a=o.accountApi;if(null!=a&&H(a),t!==n&&(t=n,null!=a)){for(var i=a.currencyConfig,s=a.swapConfig,u=0,c=Object.keys(i);u<c.length;u++){H(i[c[u]])}for(var f=0,l=Object.keys(s);f<l.length;f++){H(s[l[f]])}}}}},currencyWallets:function(e){var t;return function(){var r=e.props,n=r.accountOutput,o=r.accountState.activeWalletIds,a=t!==o;t=o;var i={};null!=(null==n?void 0:n.currencyWallets)&&(i=n.currencyWallets);for(var s={},u=e.props.output.currency.wallets,c=0;c<o.length;c++){var f,l=o[c],d=null===(f=u[l])||void 0===f?void 0:f.walletApi;d!==i[l]&&(a=!0),null!=d&&(s[l]=d)}a&&e.onOutput(s)}}}),Yl=$n(Hl,(function(e){return e.state.accountIds}),(function(e,t){return Gl(Gl({},e),{},{accountId:t,accountState:e.state.accounts[t],accountOutput:e.output.accounts[t]})})),Jl=["loginId"];function Vl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Xl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Vl(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function $l(e){return Zl.apply(this,arguments)}function Zl(){return(Zl=t(c().mark((function e(t){var r,n,o,a,i,s,u,f,l,d,p,h,b,v,y,g,m;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.props.state.login.stashes,n={},o=[],a=0;case 4:if(!(a<r.length)){e.next=14;break}if(i=r[a],s=i.loginId,null!=(u=i.username)){e.next=9;break}return e.abrupt("continue",11);case 9:n[x.stringify(s)]=u,o.push(s);case 11:a++,e.next=4;break;case 14:return f={loginIds:o},e.next=17,_r(t,"POST","/v2/messages",f);case 17:l=e.sent,d=[],p=0,h=ct(l);case 20:if(!(p<h.length)){e.next=31;break}if(b=h[p],v=b.loginId,y=ol(b,Jl),g=x.stringify(v),null!=(m=n[g])){e.next=27;break}return e.abrupt("continue",28);case 27:d.push(Xl(Xl({},y),{},{loginId:g,username:m}));case 28:p++,e.next=20;break;case 31:return e.abrupt("return",d);case 32:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ql(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=El(e);if(t){var o=El(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Ol(this,r)}}var ed=function(e){kl(r,e);var t=Ql(r);function r(e){var n;return fe(this,r),(n=t.call(this))._lobby=e,n._cleanups=[e.close,e.on("reply",(function(e){return H(Il(n),"replies")})),e.on("error",(function(e){return G(Il(n),"error",e)}))],n}return de(r,[{key:"lobbyId",get:function(){return this._lobby.lobbyId}},{key:"replies",get:function(){return this._lobby.replies}},{key:"close",value:function(){this._cleanups.forEach((function(e){return e()})),z(this)}}]),r}(oe),td=function(e){kl(s,e);var r,n,o,a,i=Ql(s);function s(e){var t;return fe(this,s),(t=i.call(this))._ai=e,t}return de(s,[{key:"authRequest",value:function(e,t,r){return _r(this._ai,e,t,r)}},{key:"hashUsername",value:function(e){return Wr(this._ai,e)}},{key:"makeLobby",value:(a=t(c().mark((function e(t){var r,n,o=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.length>1&&void 0!==o[1]?o[1]:1e3,e.next=3,Tu(this._ai,t,r);case 3:return n=e.sent,e.abrupt("return",new ed(n));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"fetchLobbyRequest",value:function(e){return Pu(this._ai,e)}},{key:"sendLobbyReply",value:(o=t(c().mark((function e(t,r,n){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ju(this._ai,t,r,n);case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return o.apply(this,arguments)})},{key:"syncRepo",value:(n=t(c().mark((function e(t){var r,n,o,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._ai.props,n=r.io,o=r.syncClient,a=qo(n,{dataKey:new Uint8Array(0),syncKey:t}),e.next=4,Yo(o,a,{lastSync:0,lastHash:void 0});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"getRepoDisklet",value:(r=t(c().mark((function e(t,r){var n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._ai.props.io,C((o=qo(n,{dataKey:r,syncKey:t})).disklet),e.abrupt("return",o.disklet);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})}]),s}(oe);function rd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function nd(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?rd(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rd(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var od=Yn({api:function(e){return{destroy:function(){z(e.props.output.context.api)},update:function(){return e.onOutput(function(e){var r,n=e.props.state.login.appId,o=Ht.stringify(e.props.state.login.clientId),a=new td(e),i={on:re,watch:ne,appId:n,clientId:o,close:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.props.close();case 1:case"end":return t.stop()}}),t)})))()},$internalStuff:a,fixUsername:be,get localUsers(){return e.props.state.login.localUsers},forgetAccount:function(r){return t(c().mark((function t(){var n,o,a,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=Ht.parse(r),o=0,a=e.props.state.accountIds;case 2:if(!(o<a.length)){t.next=10;break}if(i=a[o],!pr(e.props.state.accounts[i].stashTree.loginId,n)){t.next=7;break}throw new Error("Cannot remove logged-in user");case 7:o++,t.next=2;break;case 10:return t.next=12,Gr(e,n);case 12:case"end":return t.stop()}}),t)})))()},fetchChallenge:function(){return t(c().mark((function t(){var r,n,o,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,_r(e,"POST","/v2/captcha/create",{});case 2:return r=t.sent,n=ot(r),o=n.challengeId,a=n.challengeUri,t.abrupt("return",{challengeId:o,challengeUri:a});case 5:case"end":return t.stop()}}),t)})))()},usernameAvailable:function(r){var n=arguments;return t(c().mark((function t(){var o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=(n.length>1&&void 0!==n[1]?n[1]:{}).challengeId,r=be(r),t.next=5,au(e,r,o);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t)})))()},createAccount:function(r){return t(c().mark((function t(){var n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.props.log.breadcrumb("EdgeContext.createAccount",{}),null!=r.username&&(r.username=be(r.username)),t.next=4,cu(e,r,r);case 4:return n=t.sent,t.next=7,bu(e,n,"newAccount",r);case 7:return t.abrupt("return",t.sent);case 8:case"end":return t.stop()}}),t)})))()},loginWithKey:function(r,o){var a=arguments;return t(c().mark((function t(){var i,s,u,f,l,d,p;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(s=(i=a.length>2&&void 0!==a[2]?a[2]:{}).now,u=void 0===s?new Date:s,f=i.useLoginId,null!=(l=void 0!==f&&f?Kr(e,Ht.parse(r)).stashTree:Lr(e,be(r)))){t.next=5;break}throw new Error("User does not exist on this device");case 5:if(null!=(d=dn(l,(function(e){return e.appId===n})))){t.next=8;break}throw new Error('Cannot find requested appId: "'.concat(n,'"'));case 8:return p={loginId:d.loginId,loginKey:Ht.parse(o)},Tn(l,p),l.lastLogin=u,Yr(e,l).catch((function(){})),En(e,p).catch((function(t){return e.props.onError(t)})),t.next=15,bu(e,p,"keyLogin",i);case 15:return t.abrupt("return",t.sent);case 16:case"end":return t.stop()}}),t)})))()},loginWithPassword:function(r,n){var o=arguments;return t(c().mark((function t(){var a,i,s;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=o.length>2&&void 0!==o[2]?o[2]:{},e.props.log.breadcrumb("EdgeContext.loginWithPassword",{}),r=be(r),i=Lr(e,r),t.next=6,cs(e,null!=i?i:Br(r),n,a);case 6:return s=t.sent,t.next=9,bu(e,s,"passwordLogin",a);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t)})))()},checkPasswordRules:he,loginWithPIN:function(r,o){var a=arguments;return t(c().mark((function t(){var i,s,u,f;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=a.length>2&&void 0!==a[2]?a[2]:{},e.props.log.breadcrumb("EdgeContext.loginWithPIN",{}),s=i.useLoginId,null!=(u=void 0!==s&&s?Kr(e,Ht.parse(r)).stashTree:Lr(e,be(r)))){t.next=6;break}throw new Error("User does not exist on this device");case 6:return t.next=8,ks(e,n,u,o,i);case 8:return f=t.sent,t.next=11,bu(e,f,"pinLogin",i);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t)})))()},loginWithRecovery2:function(r,n,o){var a=arguments;return t(c().mark((function t(){var i,s,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=a.length>3&&void 0!==a[3]?a[3]:{},e.props.log.breadcrumb("EdgeContext.loginWithRecovery2",{}),n=be(n),s=Lr(e,n),t.next=6,Bs(e,null!=s?s:Br(n),Ht.parse(r),o,i);case 6:return u=t.sent,t.next=9,bu(e,u,"recoveryLogin",i);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t)})))()},fetchRecovery2Questions:function(r,n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=be(n),t.next=3,Ks(e,Ht.parse(r),n);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))()},requestEdgeLogin:function(r){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.props.log.breadcrumb("EdgeContext.requestEdgeLogin",{}),t.next=3,Bu(e,n,r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))()},requestOtpReset:function(r,n){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=be(r),t.next=3,an(e,r,n);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))()},fetchLoginMessages:function(){return t(c().mark((function t(){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,$l(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))()},get paused(){return e.props.state.paused},changePaused:function(n){var o=arguments;return t(c().mark((function t(){var a,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=(o.length>1&&void 0!==o[1]?o[1]:{}).secondsDelay,i=void 0===a?0:a,null!=r&&(clearTimeout(r),r=void 0),e.props.state.paused!==n){t.next=5;break}return t.abrupt("return");case 5:0===i?e.props.dispatch({type:"PAUSE",payload:n}):r=setTimeout((function(){r=void 0,e.props.dispatch({type:"PAUSE",payload:n})}),1e3*i);case 6:case"end":return t.stop()}}),t)})))()},get logSettings(){return e.props.state.logSettings},changeLogSettings:function(r){return t(c().mark((function t(){var n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=nd(nd({},e.props.state.logSettings),r),e.props.dispatch({type:"CHANGE_LOG_SETTINGS",payload:n});case 2:case"end":return t.stop()}}),t)})))()}};return C(i),i}(e)),Zn}}},watcher:function(e){var t,r,n;return function(){t===e.props.state.login.localUsers&&r===e.props.state.paused&&n===e.props.state.logSettings||(t=e.props.state.login.localUsers,r=e.props.state.paused,n=e.props.state.logSettings,null!=e.props.output.context.api&&H(e.props.output.context.api))}},infoFetcher:Xn((function(e){function r(){return(r=t(c().mark((function t(){var r,n,o,a,i,u,f,l,d;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.props,n=r.dispatch,o=r.io,a=mi(e.props.state.infoServers),i=s(a,1),u=i[0],t.next=4,fetch("".concat(u,"/v1/coreRollup"),{headers:{accept:"application/json"}});case 4:if((f=t.sent).ok){t.next=7;break}return t.abrupt("return");case 7:return t.next=9,f.json();case 9:return l=t.sent,d=oo(l),n({type:"INFO_CACHE_FETCHED",payload:d}),t.next=14,ao.save(o.disklet,no,d);case 14:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var n=_o((function(){return r.apply(this,arguments)}),6e5,{onError:function(t){e.props.onError(t)}});return{update:function(){n.started||n.start()},destroy:function(){n.stop()}}}),(function(e){return e.state.paused?void 0:e}))});function ad(e,t){if("object"!==se(e)||"object"!==se(t)||null==e||null==t)return e===t;var r=Array.isArray(e);if(r!==Array.isArray(t))return!1;if(r){if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!ad(e[n],t[n]))return!1;return!0}var o=Object.getOwnPropertyNames(e).filter((function(t){return void 0!==e[t]})),a=Object.getOwnPropertyNames(t).filter((function(e){return void 0!==t[e]}));if(o.length!==a.length)return!1;for(var i=0;i<o.length;i++){var s=o[i];if(!Object.prototype.hasOwnProperty.call(t,s))return!1;if(!ad(e[s],t[s]))return!1}return!0}function id(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function sd(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?id(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):id(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ud=Yn({wallets:$n(Lf,(function(e){return e.state.currency.currencyWalletIds}),(function(e,t){return sd(sd({},e),{},{walletId:t,walletState:e.state.currency.wallets[t],walletOutput:e.output.currency.wallets[t]})})),pluginUpdater:function(e){var r;return t(c().mark((function t(){var n,o,a,i,s,u,f,l,d,p,h,b,v;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.props.state,o=n.infoCache,a=n.plugins,r!==o){t.next=3;break}return t.abrupt("return");case 3:if(null==r){t.next=16;break}i=0,s=Object.keys(a.currency);case 5:if(!(i<s.length)){t.next=16;break}if(p=s[i],h=a.currency[p],b=null!==(u=null===(f=o.corePlugins)||void 0===f?void 0:f[p])&&void 0!==u?u:{},v=null!==(l=null===(d=r.corePlugins)||void 0===d?void 0:d[p])&&void 0!==l?l:{},null==h.updateInfoPayload||ad(v,b)){t.next=13;break}return t.next=13,h.updateInfoPayload(b);case 13:i++,t.next=5;break;case 16:r=o;case 17:case"end":return t.stop()}}),t)})))}});function cd(e,t,r){var n={salt_hex:e,n:16384,r:8,p:1};if(0===t)return n.n=131072,n.r=8,n.p=64,n;var o=t,a=t/8,i=(r-o)/a;(i=i>0?i:0)>0&&(i=0),i=Math.floor(i),n.r=8+i;var s=14,u=(r-(o+=i*a))/o;(u=u>0?u:0)>3&&(u=3),s+=(u=Math.floor(u))>=0?u:0,o+=u*o,n.n=Math.pow(2,s);var c=(r-o)/o;return(c=c>0?c:0)>64&&(c=64),c=Math.floor(c),n.p=c>=1?c:1,o+=c*o,n}var fd=Yn({makeSnrp:function(e){return function(){var r,n=e.props,o=n.io,a=n.log;function i(){return(i=t(c().mark((function t(n){var i,s;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return null==r&&(r=e.props.output.scrypt.timeScrypt(Yt.parse("1reallyJunkiePasswordToCheck"),{salt_hex:m.parse("b5865ffb9fa7b3bfe4b2384d47ce831ee22a4a9d5c34c7ef7d21467cc758f81b"),n:16384,r:8,p:1}).then((function(e){return e.time}))),t.next=3,r;case 3:return i=t.sent,s=cd(o.random(32),i,n),a("snrp for ".concat(n,"ms target: ").concat(s.n," ").concat(s.r," ").concat(s.p," based on ").concat(i,"ms benchmark")),t.abrupt("return",s);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return e.onOutput((function(e){return i.apply(this,arguments)})),Zn}},timeScrypt:function(e){return function(){var t,r,n=e.props,o=n.io,a=n.log,i="undefined"!=typeof window&&null!=window.performance&&"function"==typeof window.performance.now?function(){return window.performance.now()}:function(){return Date.now()};return e.onOutput((t=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,n=t.salt_hex,s=i();return a("starting scrypt n=".concat(t.n," r=").concat(t.r," p=").concat(t.p)),o.scrypt(e,n,t.n,t.r,t.p,r).then((function(e){var r=i()-s;return a("finished scrypt n=".concat(t.n," r=").concat(t.r," p=").concat(t.p," in ").concat(r,"ms")),{hash:e,time:r}}))},r=Promise.resolve(),function(){for(var e=this,n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];var i=function(){return t.apply(e,o)},s=r.then(i,i);return r=s,s})),Zn}}}),ld=function(e){return e},dd=Yn({accounts:Yl,context:od,currency:ud,scrypt:fd}),pd=Zc({currencyWalletIds:function(e,t,r){if(1===r.accountIds.length){var n=r.accountIds[0];return r.accounts[n].activeWalletIds}for(var o=[],a=0,i=r.accountIds;a<i.length;a++){var s=i[a];o.push.apply(o,Ir(r.accounts[s].activeWalletIds))}return o},wallets:of(df,(function(e){return e.currency.currencyWalletIds}))}),hd=new Uint8Array(0),bd=Zc({apiKey:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.apiKey:e},apiSecret:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1?arguments[1]:void 0;return"INIT"===r.type?null!==(e=r.payload.apiSecret)&&void 0!==e?e:null:t},appId:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.appId:e},clientId:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:hd,t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.clientId:e},deviceDescription:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.deviceDescription:e},localUsers:af((function(e){return e.login.appId}),(function(e){return e.login.stashes}),(function(e,t){for(var r=[],n=0;n<t.length;n++){var o=t[n],a=o.lastLogin,i=o.loginId,s=o.recovery2Key,u=o.username,c=dn(o,(function(t){return t.appId===e})),f=null!=c&&(null!=c.passwordAuthBox||null!=c.loginAuthBox),l=xs(o,e);r.push({keyLoginEnabled:f,lastLogin:a,loginId:Ht.stringify(i),pinLoginEnabled:null!=l,recovery2Key:null!=s?Ht.stringify(s):void 0,username:u,voucherId:null!=c?c.voucherId:void 0})}return r})),loginServers:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.loginServers:e},stashes:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"INIT":return t.payload.stashes;case"LOGIN_STASH_DELETED":var r=t.payload;return e.filter((function(e){return!pr(e.loginId,r)}));case"LOGIN_STASH_SAVED":var n=t.payload,o=e.filter((function(e){return!pr(e.loginId,n.loginId)}));return o.unshift(n),o}return e},walletInfos:function(e,t,r){if(1===r.accountIds.length){var n=r.accountIds[0];return r.accounts[n].walletInfos}for(var o={},a=0,i=r.accountIds;a<i.length;a++)for(var s=i[a],u=r.accounts[s],c=0,f=Object.keys(u.walletInfos);c<f.length;c++){var l=f[c],d=u.walletInfos[l];o[l]=d}return o}});function vd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function yd(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vd(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vd(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var gd={init:{},locked:!1,currency:{},swap:{},currencyTools:{}};function md(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function wd(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?md(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):md(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var xd=function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++){var o=t[n];0,"function"==typeof e[o]&&(r[o]=e[o])}var a,i=Object.keys(r);try{!function(e){Object.keys(e).forEach((function(t){var r=e[t];if(void 0===r(void 0,{type:Nn.INIT}))throw new Error(Mn(12));if(void 0===r(void 0,{type:Nn.PROBE_UNKNOWN_ACTION()}))throw new Error(Mn(13))}))}(r)}catch(s){a=s}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var n=!1,o={},s=0;s<i.length;s++){var u=i[s],c=r[u],f=e[u],l=c(f,t);if(void 0===l){t&&t.type;throw new Error(Mn(14))}o[u]=l,n=n||l!==f}return(n=n||i.length!==Object.keys(e).length)?o:e}}({lastChanges:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;if("STORAGE_WALLET_SYNCED"===t.type){var r=t.payload.changes;return r.length>0?r:e}return e},localDisklet:function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:null},paths:function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:null},status:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{lastSync:0,lastHash:void 0},t=arguments.length>1?arguments[1]:void 0;return"STORAGE_WALLET_SYNCED"===t.type?t.payload.status:e}}),kd={sources:{},defaultLogLevel:"warn"},Id=Zc({accountCount:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return"LOGIN"===(arguments.length>1?arguments[1]:void 0).type?e+1:e},accountIds:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;switch(t.type){case"LOGIN":return[].concat(Ir(e),[r.lastAccountId]);case"LOGOUT":var n=t.payload.accountId,o=e.filter((function(e){return e!==n}));if(o.length===e.length)throw new Error("Login ".concat(n," does not exist"));return o;case"CLOSE":return[]}return e},accounts:of(ql,(function(e){return e.accountIds})),hideKeys:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.hideKeys:e},infoCache:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"INIT":return t.payload.infoCache;case"INFO_CACHE_FETCHED":return t.payload}return e},infoServers:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.infoServers:e},lastAccountId:function(e,t,r){return"login".concat(r.accountCount)},logSettings:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:kd,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"INIT":return t.payload.logSettings;case"CHANGE_LOG_SETTINGS":return t.payload}return e},paused:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;return"PAUSE"===t.type?t.payload:e},ready:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"INIT"===(arguments.length>1?arguments[1]:void 0).type||e},skipBlockHeight:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.skipBlockHeight:e},syncServers:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return"INIT"===t.type?t.payload.syncServers:e},currency:pd,login:bd,plugins:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:gd,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"CORE_PLUGINS_ADDED":for(var r=yd(yd({},e),{},{currency:yd({},e.currency),swap:yd({},e.swap)}),n=0,o=Object.keys(t.payload);n<o.length;n++){var a=o[n],i=t.payload[a];null!=i?("currencyInfo"in i&&(null==i.currencyInfo.chainDisplayName&&(i.currencyInfo.chainDisplayName=i.currencyInfo.displayName),null==i.currencyInfo.assetDisplayName&&(i.currencyInfo.assetDisplayName=i.currencyInfo.displayName),r.currency[a]=i),"swapInfo"in i&&(r.swap[a]=i)):r.init=yd(yd({},r.init),{},ce({},a,!1))}return r;case"CORE_PLUGINS_LOCKED":return yd(yd({},e),{},{locked:!0});case"CURRENCY_TOOLS_LOADED":var s=yd({},e.currencyTools);return s[t.payload.pluginId]=t.payload.tools,yd(yd({},e),{},{currencyTools:s});case"INIT":return yd(yd({},e),{},{init:t.payload.pluginsInit})}return e},storageWallets:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"STORAGE_WALLET_ADDED":var r=t.payload,n=r.id,o=r.initialState,a=wd({},e);return a[n]=xd(o,{type:"UPDATE_NEXT"}),a;case"STORAGE_WALLET_SYNCED":var i=t.payload.id;if(null!=e[i]){var s=wd({},e);return s[i]=xd(e[i],t),s}return e}return e}});function Od(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ed(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Od(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Od(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Sd=[],Ad="object"===("undefined"==typeof window?"undefined":se(window))&&null!=window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__({name:"core"}):void 0;function Td(e,t,r){return _d.apply(this,arguments)}function _d(){return(_d=t(c().mark((function e(t,r,n){var o,a,i,u,f,l,d,p,h,b,v,y,g,m,w,x,k,I,O,E,S,A,T,_,P,M,j,C,N,D,R,B,L,K,U,F,W,q,z,H,Y;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.io,a=n.airbitzSupport,i=void 0!==a&&a,u=n.apiSecret,f=n.appId,l=void 0===f?"":f,d=n.authServer,p=n.deviceDescription,h=void 0===p?null:p,b=n.hideKeys,v=void 0!==b&&b,y=n.infoServer,g=n.loginServer,m=n.plugins,w=void 0===m?{}:m,x=n.skipBlockHeight,k=void 0!==x&&x,I=n.syncServer,null!=(O=n.apiKey)&&""!==O||(O="4248c1bf41e53b840a5fdb2c872dd3ade525e66d"),E=Pd(d,["https://login1.edge.app","https://login2.edge.app"]),S=Pd(y,["https://info1.edge.app","https://info2.edge.app"]),A=Pd(g,E.map((function(e){return e.replace(/\/api$/,"")}))),T=Pd(I,["https://sync-us1.edge.app","https://sync-us2.edge.app","https://sync-us3.edge.app","https://sync-us4.edge.app","https://sync-us5.edge.app","https://sync-us6.edge.app","https://sync-eu.edge.app"]),_=Ed(Ed({},kd),n.logSettings),S.map((function(e){return Jt(e)})),A.map((function(e){return Jt(e)})),T.map((function(e){return Jt(e)})),P=Rn(Id,Ad),r=co(r,(function(){var e=P.getState();return e.ready?e.logSettings:_})),M=fo(r,"edge-core"),e.next=17,Promise.all([ro.load(o.disklet,to),ao.load(o.disklet,no),qr(o.disklet,M)]);case 17:if(j=e.sent,C=s(j,3),N=C[0],D=C[1],R=void 0===D?{}:D,B=C[2],!i){e.next=30;break}for(L=new Set,K=0;K<B.length;K++)null!=(U=B[K].username)&&L.add(U);return e.next=28,lo(o,L);case 28:F=e.sent,B.push.apply(B,Ir(F));case 30:if(null!=N){e.next=34;break}return N={clientId:o.random(16)},e.next=34,ro.save(o.disklet,to,N);case 34:return P.dispatch({type:"INIT",payload:{apiKey:O,apiSecret:u,appId:l,loginServers:A,infoCache:R,infoServers:S,syncServers:T,clientId:N.clientId,deviceDescription:h,hideKeys:v,logSettings:_,pluginsInit:w,skipBlockHeight:k,stashes:B}}),W=To(t,R,r,w,P.dispatch),q=Pn({log:M,fetch:function(e,t){return o.fetch(e,Ed(Ed({},t),{},{corsBypass:"never"}))},edgeServers:{infoServers:S,syncServers:T}}),z={output:{}},H=Hn(P,Xn(dd,(function(e){return Ed(Ed({},e),{},{close:function(){H(),W(),P.dispatch({type:"CLOSE"})},io:o,log:M,logBackend:r,onError:function(e){var t;null!=(null===(t=z.output.context)||void 0===t?void 0:t.api)&&G(z.output.context.api,"error",e)},syncClient:q})})),(function(e){return M.error(e)}),(function(e){return z.output=e})),Y=z.output.context.api,Sd.push(Y),e.abrupt("return",Y);case 42:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pd(e,t){return"string"==typeof e?[e]:null!=e&&e.length>0?e:t}var Md=["children"];function jd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Cd(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?jd(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jd(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Nd=function(){function e(){fe(this,e),this.lobbies=new Map,this.logins=[],this.repos=new Map}return de(e,[{key:"getLoginById",value:function(e){return this.logins.find((function(t){return pr(t.loginId,e)}))}},{key:"getLoginByUserId",value:function(e){return this.logins.find((function(t){return null==t.userId?pr(t.loginId,e):pr(t.userId,e)}))}},{key:"getLoginByPin2Id",value:function(e){return this.logins.find((function(t){return null!=t.pin2Id&&pr(t.pin2Id,e)}))}},{key:"getLoginByRecovery2Id",value:function(e){return this.logins.find((function(t){return null!=t.recovery2Id&&pr(t.recovery2Id,e)}))}},{key:"getLoginsByParent",value:function(e){return this.logins.filter((function(t){return t.parentId===e.loginId}))}},{key:"insertLogin",value:function(e){this.logins.push(e)}},{key:"setupLogin",value:function(e){var t=e.children,r=ol(e,Md);this.insertLogin(r);for(var n=0;n<t.length;n++){var o=t[n];o.parentId=e.loginId,this.setupLogin(o)}}},{key:"setupRepo",value:function(e,t){this.repos.set(e,t)}},{key:"dumpLogin",value:function(e){var t=this;return function e(r){return Cd(Cd({},r),{},{children:t.getLoginsByParent(r).map((function(t){return e(t)}))})}(e)}}]),e}();function Dd(e,t){var r=e.getLoginsByParent(t).map((function(t){return Dd(e,t)}));return{appId:t.appId,created:t.created,loginId:t.loginId,children:r,parentBox:t.parentBox,passwordAuthBox:t.passwordAuthBox,passwordAuthSnrp:t.passwordAuthSnrp,passwordBox:t.passwordBox,passwordKeySnrp:t.passwordKeySnrp,pin2Box:t.pin2Box,pin2KeyBox:t.pin2KeyBox,pin2TextBox:t.pin2TextBox,question2Box:t.question2Box,recovery2Box:t.recovery2Box,recovery2KeyBox:t.recovery2KeyBox,otpKey:t.otpKey,otpResetDate:t.otpResetDate,otpTimeout:t.otpTimeout,pendingVouchers:Rd(t),loginAuthBox:t.loginAuthBox,userId:t.userId,userTextBox:t.userTextBox,keyBoxes:t.keyBoxes,mnemonicBox:t.mnemonicBox,rootKeyBox:t.rootKeyBox,syncKeyBox:t.syncKeyBox}}function Rd(e){return e.vouchers.filter((function(e){return"pending"===e.status})).map((function(e){return{activates:e.activates,created:e.created,deviceDescription:e.deviceDescription,ip:e.ip,ipDescription:e.ipDescription,voucherId:e.voucherId}}))}function Bd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ld(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Bd(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bd(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Kd={success:{code:0,httpStatus:200,message:"Success"},error:{code:1,httpStatus:503,message:"Error"},accountExists:{code:2,httpStatus:401,message:"Account already exists"},noAccount:{code:3,httpStatus:401,message:"No account"},invalidPassword:{code:4,httpStatus:401,message:"Invalid Password"},invalidAnswers:{code:5,httpStatus:401,message:"Invalid Answers"},invalidApiKey:{code:6,httpStatus:401,message:"Invalid API Key"},invalidOtp:{code:8,httpStatus:401,message:"Invalid OTP"},conflict:{code:10,httpStatus:409,message:"Conflicting change"},obsolete:{code:1e3,httpStatus:410,message:"Obsolete API"},created:{code:0,httpStatus:201,message:"Account created"},invalidRequest:{code:1,httpStatus:401,message:"Invalid request"},notFound:{code:1,httpStatus:404,message:"Not found"},noLobby:{code:3,httpStatus:404,message:"Not found"},invalidAppId:{code:10,httpStatus:401,message:"A login with the same appId already exists"}};function Ud(e,t){try{return[e(t),{status:200}]}catch(r){return[void 0,Wd(Kd.invalidRequest,"Invalid request: ".concat(String(r)))]}}function Fd(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.status,n=void 0===r?200:r,o=t.headers;return{status:n,headers:Ld({"content-type":"application/json"},void 0===o?{}:o),body:JSON.stringify(e)}}function Wd(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Kd.success,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.message,r=e.code,n=e.httpStatus;return Fd(mt({status_code:r,message:t}),{status:n})}function qd(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Kd.success,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.message,n=t.code,o=t.httpStatus;return Fd(mt({status_code:n,message:r,results:e}),{status:o})}function zd(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.reason,n=void 0===r?"otp":r,o=t.voucher;return qd(Nt({login_id:e.loginId,otp_reset_auth:e.otpResetAuth,otp_timeout_date:e.otpResetDate,reason:n,voucher_auth:null==o?void 0:o.voucherAuth,voucher_activates:null==o?void 0:o.activates,voucher_id:null==o?void 0:o.voucherId}),Kd.invalidOtp)}function Gd(e){return qd(Rt({wait_seconds:e}),Kd.invalidPassword)}function Hd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Yd(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Hd(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hd(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Jd=function(e){return function(){var r=t(c().mark((function t(r){var n,o,a,i,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=r.json,o=Ud(Ge,n),a=s(o,2),i=a[0],u=a[1],null!=i){t.next=4;break}return t.abrupt("return",u);case 4:return t.next=6,e(Yd(Yd({},r),{},{body:i,payload:i.data}));case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)})));return function(e){return r.apply(this,arguments)}}()},Vd=function(e){return function(){var r=t(c().mark((function t(r){var n,o,a,i,s,u,f,l;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=r.body,o=r.login,a=n.otp,i=n.voucherAuth,s=n.voucherId,null!=(u=o.otpKey)){t.next=7;break}return t.next=6,e(r);case 6:case 10:case 16:return t.abrupt("return",t.sent);case 7:if(null==a||!xr(u,a,{spread:2})){t.next=11;break}return t.next=10,e(r);case 11:if(null==i||null==s){t.next=17;break}if(f=o.vouchers.find((function(e){return e.voucherId===s})),null==f||"approved"!==f.status||!pr(i,f.voucherAuth)){t.next=17;break}return t.next=16,e(r);case 17:return o.otpResetAuth="Super secret reset token",l={activates:new Date("2020-01-01T00:00:00Z"),created:new Date("2020-01-08T00:00:00Z"),deviceDescription:"A phone",ip:"localhost",ipDescription:"here",loginId:o.loginId,status:"pending",voucherAuth:Uint8Array.from([170,187]),voucherId:"voucher-".concat(o.vouchers.length)},o.vouchers.push(l),t.abrupt("return",zd(o,{voucher:l}));case 21:case"end":return t.stop()}}),t)})));return function(e){return r.apply(this,arguments)}}()},Xd=function(e){return Wd(Kd.invalidRequest)},$d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Xd;return function(r){var n=r.db,o=r.body,a=o.loginAuth,i=o.loginId,s=o.passwordAuth,u=o.pin2Auth,c=o.pin2Id,f=o.recovery2Auth,l=o.recovery2Id,d=o.userId;if(null!=i&&null!=a){var p=n.getLoginById(i);return null==p?Wd(Kd.noAccount):null!=p.loginAuth&&pr(a,p.loginAuth)?Vd(e)(Yd(Yd({},r),{},{login:p})):Gd(0)}if(null!=d&&null!=s){var h=n.getLoginByUserId(d);return null==h?Wd(Kd.noAccount):null!=h.passwordAuth&&pr(s,h.passwordAuth)?Vd(e)(Yd(Yd({},r),{},{login:h})):Gd(0)}if(null!=c&&null!=u){var b=n.getLoginByPin2Id(c);return null==b?Wd(Kd.noAccount):null!=b.pin2Auth&&pr(u,b.pin2Auth)?Vd(e)(Yd(Yd({},r),{},{login:b})):Gd(0)}if(null!=l&&null!=f){var v=n.getLoginByRecovery2Id(l);if(null==v)return Wd(Kd.noAccount);var y=v.recovery2Auth,g=f;if(null==y||g.length!==y.length)return Gd(0);for(var m=0;m<g.length;++m)if(!pr(g[m],y[m]))return Gd(0);return Vd(e)(Yd(Yd({},r),{},{login:v}))}return t(r)}},Zd=$d((function(e){var t=e.db,r=e.login;return qd(jt(Dd(t,r)))}),(function(e){var t=e.db,r=e.json,n=Ge(r),o=n.userId,a=n.passwordAuth,i=n.recovery2Id,s=n.recovery2Auth;if(null!=o&&null==a){var u=t.getLoginByUserId(o);if(null==u)return Wd(Kd.noAccount);var c=u.loginId,f=u.passwordAuthSnrp;return qd(Lt({loginId:c,passwordAuthSnrp:void 0===f?Rr:f}))}if(null!=i&&null==s){var l=t.getLoginByRecovery2Id(i);if(null==l)return Wd(Kd.noAccount);var d=l.question2Box;return null==d?Wd(Kd.noAccount):qd(Bt({question2Box:d}))}return Wd(Kd.invalidRequest)}));function Qd(e,t){var r=e.db,n=e.json,o=new Date,a=s(Ud(Ge,n),2),i=a[0],u=a[1];if(null==i)return u;var c=s(Ud(nt,i.data),2),f=c[0],l=c[1];if(null==f)return l;var d=s(Ud(Qe,i.data),2),p=d[0],h=d[1];if(null==p)return h;if(null!=r.getLoginById(f.loginId))return Wd(Kd.accountExists);for(var b=_e(rt,(function(){return{newSyncKeys:[],keyBoxes:[]}}))(i.data),v=0,y=b.newSyncKeys;v<y.length;v++){var g=y[v];r.repos.set(g,{})}var m=Yd(Yd(Yd(Yd(Yd(Yd(Yd({},f),p),{},{created:o,keyBoxes:b.keyBoxes.map((function(e){return Yd(Yd({},e),{},{created:o})})),vouchers:[]},_e(Ye)(i.data)),_e(Je)(i.data)),_e(Xe)(i.data)),_e(Ze)(i.data)),_e(et)(i.data));if(null!=t){if(null!=r.getLoginsByParent(t).find((function(e){return e.appId===f.appId})))return Wd(Kd.invalidAppId);m.parentId=t.loginId}return r.insertLogin(m),Wd(Kd.created,"Account created")}var ep=$d((function(e){return Qd(e,e.login)}),(function(e){return Qd(e)})),tp=$d((function(e){var t=e.db,r=e.login,n=e.payload,o=new Date,a=s(Ud(rt,n),2),i=a[0],u=a[1];if(null==i)return u;for(var c=0,f=i.newSyncKeys;c<f.length;c++){var l=f[c];t.repos.set(l,{})}return r.keyBoxes=Or(r.keyBoxes,i.keyBoxes.map((function(e){return Yd(Yd({},e),{},{created:o})}))),Wd()})),rp=$d((function(e){var t=e.login,r=e.payload,n=s(Ud(Ye,r),2),o=n[0],a=n[1];return null==o?a:(t.otpKey=o.otpKey,t.otpTimeout=o.otpTimeout,t.otpResetDate=void 0,Wd())})),np=$d((function(e){var t=e.login;return t.otpKey=void 0,t.otpResetAuth=void 0,t.otpResetDate=void 0,t.otpTimeout=void 0,Wd()}),(function(e){var t=e.db,r=e.json,n=Ge(r);if(null==n.userId||null==n.otpResetAuth)return Wd(Kd.invalidRequest);var o=t.getLoginByUserId(n.userId);if(null==o)return Wd(Kd.noAccount);if(n.otpResetAuth!==o.otpResetAuth)return Gd(0);var a=o.otpKey,i=o.otpTimeout;return null==a||null==i?Wd(Kd.invalidRequest,"OTP not setup for this account."):(null==o.otpResetDate&&(o.otpResetDate=new Date(Date.now()+1e3*i)),qd(Dt({otpResetDate:o.otpResetDate})))})),op=$d((function(e){var t=e.login;return t.passwordAuth=void 0,t.passwordAuthBox=void 0,t.passwordAuthSnrp=void 0,t.passwordBox=void 0,t.passwordKeySnrp=void 0,Wd()})),ap=$d((function(e){var t=e.login,r=e.payload,n=s(Ud(Je,r),2),o=n[0],a=n[1];return null==o?a:(t.passwordAuth=o.passwordAuth,t.passwordAuthBox=o.passwordAuthBox,t.passwordAuthSnrp=o.passwordAuthSnrp,t.passwordBox=o.passwordBox,t.passwordKeySnrp=o.passwordKeySnrp,Wd())})),ip=$d((function(e){var t=e.login;return t.pin2Auth=void 0,t.pin2Box=void 0,t.pin2Id=void 0,t.pin2KeyBox=void 0,t.pin2TextBox=void 0,Wd()})),sp=$d((function(e){var t=e.login,r=e.payload,n=s(Ud(Xe,r),2),o=n[0],a=n[1];return null==o?a:(t.pin2Auth=o.pin2Auth,t.pin2Box=o.pin2Box,t.pin2Id=o.pin2Id,t.pin2KeyBox=o.pin2KeyBox,t.pin2TextBox=o.pin2TextBox,Wd())})),up=$d((function(e){var t=e.login;return t.question2Box=void 0,t.recovery2Auth=void 0,t.recovery2Box=void 0,t.recovery2Id=void 0,t.recovery2KeyBox=void 0,Wd()})),cp=$d((function(e){var t=e.login,r=e.payload,n=s(Ud(Ze,r),2),o=n[0],a=n[1];return null==o?a:(t.question2Box=o.question2Box,t.recovery2Auth=o.recovery2Auth,t.recovery2Box=o.recovery2Box,t.recovery2Id=o.recovery2Id,t.recovery2KeyBox=o.recovery2KeyBox,Wd())})),fp=$d((function(e){var t=e.db,r=e.login,n=e.payload,o=s(Ud(Qe,n),2),a=o[0],i=o[1];return null==a?i:null!=r.loginAuth?Wd(Kd.conflict,"The secret-key login is already configured"):(r.loginAuth=a.loginAuth,r.loginAuthBox=a.loginAuthBox,qd(jt(Dd(t,r))))})),lp=$d(function(){var e=t(c().mark((function e(t){var r,n,o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.db,n=t.login,o=t.payload,a=_e(Je)(o),i=_e(Ve)(o),s=_e($e)(o),u=_e(et)(o),null==n.passwordAuth||null!=a){e.next=7;break}return e.abrupt("return",Wd(Kd.invalidRequest,"Missing password payload"));case 7:if(null==n.pin2Auth||null!=i){e.next=9;break}return e.abrupt("return",Wd(Kd.invalidRequest,"Missing pin2Id payload"));case 9:if(null==n.recovery2Auth||null!=s){e.next=11;break}return e.abrupt("return",Wd(Kd.invalidRequest,"Missing recovery2Id payload"));case 11:if(null!=n.parentBox||null!=u){e.next=13;break}return e.abrupt("return",Wd(Kd.invalidRequest,"Missing username payload"));case 13:if(null!=a&&(n.passwordAuth=a.passwordAuth,n.passwordAuthBox=a.passwordAuthBox,n.passwordAuthSnrp=a.passwordAuthSnrp,n.passwordBox=a.passwordBox,n.passwordKeySnrp=a.passwordKeySnrp),null==i){e.next=21;break}if(null!=n.pin2Auth){e.next=17;break}return e.abrupt("return",Wd(Kd.invalidRequest,"Login lacks pin2"));case 17:if(null==r.getLoginByPin2Id(i.pin2Id)){e.next=20;break}return e.abrupt("return",Wd(Kd.conflict));case 20:n.pin2Id=i.pin2Id;case 21:if(null==s){e.next=28;break}if(null!=n.recovery2Auth){e.next=24;break}return e.abrupt("return",Wd(Kd.invalidRequest,"Login lacks recovery2"));case 24:if(null==r.getLoginByRecovery2Id(s.recovery2Id)){e.next=27;break}return e.abrupt("return",Wd(Kd.conflict));case 27:n.recovery2Id=s.recovery2Id;case 28:if(null==u){e.next=36;break}if(null==n.parentBox){e.next=31;break}return e.abrupt("return",Wd(Kd.invalidRequest,"Only top-level logins can have usernames"));case 31:if(null==r.getLoginByUserId(u.userId)){e.next=34;break}return e.abrupt("return",Wd(Kd.conflict));case 34:n.userId=u.userId,n.userTextBox=u.userTextBox;case 36:return e.abrupt("return",qd(jt(Dd(r,n))));case 37:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),dp=$d(function(){var e=t(c().mark((function e(t){var r,n,o,a,i,u,f,l,d,p,h,b,v,y,g,m,w,x,k;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.db,n=t.login,o=t.payload,a=Ud(tt,o),i=s(a,2),u=i[0],f=i[1],null!=u){e.next=4;break}return e.abrupt("return",f);case 4:for(l=u.approvedVouchers,d=void 0===l?[]:l,p=u.rejectedVouchers,h=void 0===p?[]:p,b={},v=0;v<d.length;v++)y=d[v],b[y]="approved";for(g=0;g<h.length;g++)m=h[g],b[m]="rejected";w=0,x=n.vouchers;case 9:if(!(w<x.length)){e.next=17;break}if(k=x[w],null!=b[k.voucherId]){e.next=13;break}return e.abrupt("continue",14);case 13:k.status=b[k.voucherId];case 14:w++,e.next=9;break;case 17:return e.abrupt("return",qd(jt(Dd(r,n))));case 18:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),pp=function(e){return Wd(Kd.noLobby,"Cannot find lobby ".concat(e.lobbyId))},hp=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pp;return function(r){var n=r.db,o=r.path.split("/")[4],a=n.lobbies.get(o);return null!=a?e(Yd(Yd({},r),{},{lobby:a,lobbyId:o})):t(Yd(Yd({},r),{},{lobbyId:o}))}},bp=hp((function(e){return Wd(Kd.accountExists,"Lobby ".concat(e.lobbyId," already exists."))}),(function(e){var t=e.db,r=e.json,n=e.lobbyId,o=s(Ud(Ge,r),2),a=o[0],i=o[1];if(null==a)return i;var u=s(Ud(We,a.data),2),c=u[0],f=u[1];if(null==c)return f;var l=c.timeout,d=void 0===l?600:l,p=new Date(Date.now()+1e3*d).toISOString();return t.lobbies.set(n,{request:c,replies:[],expires:p}),Wd()})),vp=hp((function(e){var t=e.json,r=e.lobby,n=s(Ud(Ge,t),2),o=n[0],a=n[1];if(null==o)return a;var i=s(Ud(qe,o.data),2),u=i[0],c=i[1];return null==u?c:(r.replies.push(u),Wd())})),yp=hp((function(e){var t=e.lobby;return qd(Mt(t))})),gp=hp((function(e){var t=e.db,r=e.lobbyId;return t.lobbies.delete(r),Wd()})),mp=function(e){return function(t){var r=t.db,n=t.path.split("/")[4],o=r.repos.get(n);return null==o?Fd({msg:"Hash not found"},{status:404}):e(Yd(Yd({},t),{},{repo:o}))}},wp=mp((function(e){var t=e.repo;return Fd({changes:qt(t)})})),xp=mp((function(e){for(var t=e.json,r=e.repo,n=kp(t).changes,o=0,a=Object.keys(n);o<a.length;o++){var i=a[o];r[i]=n[i]}return Fd({changes:qt(r),hash:"1111111111111111111111111111111111111111"})})),kp=Ae({changes:Ae(Ke)}),Ip=S({"/api/v2/login/?":E({GET:Jd(Zd),POST:Jd(Zd)}),"/api/v2/login/create/?":E({POST:Jd(ep),PUT:Jd(ep)}),"/api/v2/login/keys/?":E({POST:Jd(tp)}),"/api/v2/login/otp/?":E({DELETE:Jd(np),POST:Jd(rp),PUT:Jd(rp)}),"/api/v2/login/password/?":E({DELETE:Jd(op),POST:Jd(ap),PUT:Jd(ap)}),"/api/v2/login/pin2/?":E({DELETE:Jd(ip),POST:Jd(sp),PUT:Jd(sp)}),"/api/v2/login/recovery2/?":E({DELETE:Jd(up),POST:Jd(cp),PUT:Jd(cp)}),"/api/v2/login/secret/?":E({POST:Jd(fp)}),"/api/v2/login/username/?":E({POST:Jd(lp)}),"/api/v2/login/vouchers/?":E({POST:Jd(dp)}),"/api/v2/messages/?":E({POST:Jd((function(e){var t=e.db,r=e.json,n=s(Ud(Ge,r),2),o=n[0],a=n[1];if(null==o)return a;var i=o.loginIds;if(null==i)return Wd(Kd.invalidRequest);for(var u=[],c=0;c<i.length;c++){var f=i[c],l=t.getLoginById(f);null!=l&&u.push({loginId:f,otpResetPending:null!=l.otpResetDate,pendingVouchers:Rd(l),recovery2Corrupt:!1})}return qd(Ct(u))}))}),"/api/v2/lobby/[^/]+/?":E({DELETE:Jd(gp),GET:Jd(yp),POST:Jd(vp),PUT:Jd(bp)}),"/api/v2/store/[^/]+/?":E({GET:wp,POST:xp}),"/v1/edgeServers":E({GET:function(e){return Fd({infoServers:["https://info-fake1.edge.app"],syncServers:["https://sync-fake1.edge.app","https://sync-fake2.edge.app","https://sync-fake3.edge.app"]})}})},(function(e){return Wd(Kd.notFound,"Unknown API endpoint ".concat(e.path))}));function Op(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ep(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Op(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Op(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Sp(e,t){return Ap.apply(this,arguments)}function Ap(){return(Ap=t(c().mark((function e(t,r){var n,o,a,i,s,u,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.lastLogin,o=r.server,a=x.parse(r.loginId),i=x.parse(r.loginKey),s=null==r.username?void 0:be(r.username),u=bn({appId:"",lastLogin:n,loginId:a,pendingVouchers:[],username:s},i,ut(o)),f="logins/".concat(Ht.stringify(a),".json"),e.next=8,t.disklet.setText(f,JSON.stringify(Xr(u))).catch((function(){}));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Tp(e,t,r){return _p.apply(this,arguments)}function _p(){return(_p=t(c().mark((function e(t,r,n){var o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=qo(t,{dataKey:new Uint8Array(0),syncKey:r}),e.next=3,Go(o.dataDisklet,n);case 3:return e.next=5,o.baseDisklet.setText("status.json",JSON.stringify({lastSync:1,lastHash:null}));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pp(e,r,n){for(var o=e.io,a=e.nativeIo,i=new Nd,s=function(e){var t=Er((function(r){if(t.offline)throw new Error("Fake network error");var n=r.body.byteLength>0?JSON.parse(Yt.stringify(new Uint8Array(r.body))):{};return Ip(Yd(Yd({},r),{},{db:e,json:n}))}),{offline:!1});return t}(i),u=0;u<n.length;u++){var f=n[u];i.setupLogin(Ft(f.server));for(var l=0,d=Object.keys(f.repos);l<d.length;l++){var p=d[l];i.setupRepo(p,Kt(f.repos[p]))}}var h=[],b={close:function(){return t(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(h.map((function(e){return e.close()})));case 2:z(b);case 3:case"end":return e.stop()}}),e)})))()},makeEdgeContext:function(e){return t(c().mark((function t(){var i,u,f,l,d,p,b,v,y,g,w,x,k,O,E,S,A,T;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=e.allowNetworkAccess,u=void 0!==i&&i,f=e.cleanDevice,l=void 0!==f&&f,d=e.extraFiles,p=void 0===d?{}:d,b=I(s),v=u?function(e,t){try{Jt(e)}catch(r){return o.fetch(e,t)}return b(e,t)}:b,y=Ep(Ep({},o),{},{disklet:(0,ie.Wh)(),fetch:v}),l){t.next=21;break}g=0;case 6:if(!(g<n.length)){t.next=21;break}return w=n[g],t.next=10,Sp(y,w);case 10:x=0,k=Object.keys(w.repos);case 11:if(!(x<k.length)){t.next=18;break}return O=k[x],t.next=15,Tp(y,m.parse(O),Kt(w.repos[O]));case 15:x++,t.next=11;break;case 18:g++,t.next=6;break;case 21:if(null==p){t.next=30;break}E=0,S=Object.keys(p);case 23:if(!(E<S.length)){t.next=30;break}return A=S[E],t.next=27,y.disklet.setText(A,p[A]);case 27:E++,t.next=23;break;case 30:return t.next=32,Td({io:y,nativeIo:a},r,Ep({},e));case 32:return T=t.sent,h.push(T),t.abrupt("return",T);case 35:case"end":return t.stop()}}),t)})))()},goOffline:function(){var e=arguments;return t(c().mark((function t(){var r;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=!(e.length>0&&void 0!==e[0])||e[0],s.offline=r;case 2:case"end":return t.stop()}}),t)})))()},dumpFakeUser:function(e){return t(c().mark((function t(){var r,n,o,a,s,u,f,l,d,p,h,b;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(""===e.appId){t.next=2;break}throw new Error("Only root logins are dumpable.");case 2:return r=Ht.parse(e.rootLoginId),t.t0=Ht,t.next=6,e.getLoginKey();case 6:if(t.t1=t.sent,n=t.t0.parse.call(t.t0,t.t1),null!=(o=i.getLoginById(r))){t.next=11;break}throw new Error("Cannot find user ".concat(e.rootLoginId));case 11:a=[],s=0,u=e.allKeys;case 13:if(!(s<u.length)){t.next=24;break}return f=u[s],t.next=17,e.getRawPrivateKey(f.id);case 17:if(null!=(l=t.sent).syncKey){t.next=20;break}return t.abrupt("continue",21);case 20:a.push(m.stringify(x.parse(l.syncKey)).toLowerCase());case 21:s++,t.next=13;break;case 24:for(d={},p=0;p<a.length;p++)h=a[p],null!=(b=i.repos.get(h))&&(d[h]=qt(b));return t.abrupt("return",{lastLogin:e.lastLogin,loginId:x.stringify(r),loginKey:x.stringify(n),repos:d,server:Wt(i.dumpLogin(o)),username:e.username});case 27:case"end":return t.stop()}}),t)})))()}};return C(b),b}var Mp=["allKeys","displayPrivateSeed","displayPublicSeed","keys","otpKey","loginKey","publicWalletInfo","recoveryKey"];function jp(e){var t=function(){var e={resolve:function(){},reject:function(){}},t=0;if("undefined"!=typeof Map){var r=new Map;return{add:function(e){var n=++t;return r.set(n,e),n},grab:function(t){var n=r.get(t);return null==n?e:(r.delete(t),n)}}}var n={};return{add:function(e){var r=++t;return n[String(r)]=e,r},grab:function(t){var r=n[String(t)];return null==r?e:(delete n[String(t)],r)}}}();return{call:function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return new Promise((function(n,a){e(t.add({resolve:n,reject:a}),r,o)}))},resolve:function(e,r){t.grab(e).resolve(r)},reject:function(e,r){t.grab(e).reject(new Error(r))}}}var Cp=new Map,Np=s(null!=window.edgeCore?[jp((function(e,t,r){window.edgeCore.call(e,t,JSON.stringify(r))})),new te({hideProperties:Mp,sendMessage:function(e){window.edgeCore.postMessage(JSON.stringify(e))},throttleMs:50})]:[jp((function(e,t,r){window.webkit.messageHandlers.edgeCore.postMessage([e,t,r])})),new te({hideProperties:Mp,sendMessage:function(e){window.webkit.messageHandlers.edgeCore.postMessage([0,"postMessage",[JSON.stringify(e)]])},throttleMs:50})],2),Dp=Np[0],Rp=Np[1];function Bp(e){var t=window.document.head;if(null!=t&&0!==e.length)for(var r=0,n=function(){++r>=e.length&&Ao()},o=0;o<e.length;o++){var a=e[o],i=document.createElement("script");i.addEventListener("error",n),i.addEventListener("load",n),i.charset="utf-8",i.defer=!0,i.src=a,t.appendChild(i)}else Ao()}function Lp(){return Kp.apply(this,arguments)}function Kp(){return Kp=t(c().mark((function e(){var r,n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=p(),e.t1=l().sha256,e.t2=x,e.next=5,Dp.call("randomBytes",32);case 5:return e.t3=e.sent,e.t4=e.t2.parse.call(e.t2,e.t3),e.t5={hash:e.t1,entropy:e.t4},r=new e.t0(e.t5),n=function(){var e=t(c().mark((function e(t){var r,n,o,a,i,s,u,f=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(r=f.length>1&&void 0!==f[1]?f[1]:{}).method,o=void 0===n?"GET":n,a=r.headers,i=void 0===a?{}:a,s=r.body,e.next=4,Dp.call("fetch",t,o,i,s instanceof ArrayBuffer?x.stringify(new Uint8Array(s)):s,s instanceof ArrayBuffer);case 4:return u=e.sent,e.abrupt("return",O({status:u.status,headers:u.headers,body:u.bodyIsBase64?x.parse(u.body):u.body}));case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),o={disklet:{delete:function(e){return Dp.call("diskletDelete",Up(e))},getData:function(e){return t(c().mark((function t(){var r;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Dp.call("diskletGetData",Up(e));case 2:return r=t.sent,t.abrupt("return",x.parse(r));case 4:case"end":return t.stop()}}),t)})))()},getText:function(e){return Dp.call("diskletGetText",Up(e))},list:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Dp.call("diskletList",Up(e))},setData:function(e,t){return Dp.call("diskletSetData",Up(e),x.stringify(t))},setText:function(e,t){return Dp.call("diskletSetText",Up(e),t)}},random:function(e){return r.generate(e)},scrypt:function(e,r,n,o,a,i){return t(c().mark((function t(){var s;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Dp.call("scrypt",x.stringify(e),x.stringify(r),n,o,a,i);case 2:return s=t.sent,t.abrupt("return",x.parse(s));case 4:case"end":return t.stop()}}),t)})))()},fetch:function(e,r){return t(c().mark((function t(){var o,a,i,s,u,f,l,d,p,h,b;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=(null!=r?r:{}).corsBypass,"always"!==(i=void 0===a?"auto":a)){t.next=5;break}return t.next=4,n(e,r);case 4:case 8:return t.abrupt("return",t.sent);case 5:if("never"!==i){t.next=9;break}return t.next=8,window.fetch(e,r);case 9:if(s=new URL(e),u=s.protocol,f=s.host,l=s.pathname,d="".concat(u,"//").concat(f).concat(l),p=null!==(o=Cp.get(d))&&void 0!==o?o:{windowSuccess:!1,nativeSuccess:!1},Cp.has(d)||Cp.set(d,p),p.nativeSuccess){t.next=26;break}return t.prev=14,t.next=17,window.fetch(e,r);case 17:return h=t.sent,p.windowSuccess=!0,t.abrupt("return",h);case 22:if(t.prev=22,t.t0=t.catch(14),!p.windowSuccess){t.next=26;break}throw t.t0;case 26:return t.next=28,n(e,r);case 28:return b=t.sent,p.nativeSuccess=!0,t.abrupt("return",b);case 31:case"end":return t.stop()}}),t,null,[[14,22]])})))()},fetchCors:function(e){var r=arguments;return t(c().mark((function t(){var n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},t.next=3,o.fetch(e,n);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))()}},e.abrupt("return",o);case 12:case"end":return e.stop()}}),e)}))),Kp.apply(this,arguments)}function Up(e){if(/^\//.test(e))throw new Error("Absolute paths are not supported");for(var t=e.split("/"),r=0,n=0;r<t.length;){var o=t[r++];if(".."===o?n--:"."!==o&&""!==o&&(t[n++]=o),n<0)throw new Error("Path would escape folder")}return t.slice(0,n).join("/")}window.addEdgeCorePlugins=function(e){if(Oo)throw new Error("The Edge core plugin list has already been locked");for(var t=0,r=Object.keys(e);t<r.length;t++){var n=r[t];Io[n]=e[n]}for(var o=0;o<Eo.length;o++){(0,Eo[o])(e)}},window.nativeBridge=Dp,window.reactBridge=Rp;var Fp=C({makeEdgeContext:function(e,r,n,o){return t(c().mark((function t(){var a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return Bp(n),t.next=3,Lp();case 3:return a=t.sent,t.next=6,Td({io:a,nativeIo:e},r,o);case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)})))()},makeFakeEdgeWorld:function(e,r,n){var o=arguments;return t(c().mark((function t(){var a,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=o.length>3&&void 0!==o[3]?o[3]:[],Bp(n),t.next=4,Lp();case 4:return i=t.sent,t.abrupt("return",Pp({io:i,nativeIo:e},r,a));case 6:case"end":return t.stop()}}),t)})))()}});Rp.sendRoot(Fp)}()}();