genosdb 0.22.3 → 0.22.5

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.
@@ -144,7 +144,7 @@ PERFORMANCE OF THIS SOFTWARE.
144
144
  this.index += bytes;
145
145
  return value;
146
146
  }
147
- `),VN.prototype[W]=G.toFunction({assertSize:Pj})});YE.exports=VN;function Pj(W,G){if(W>G)throw new yp(W,G)}});var H8=Z1((pq0,AE)=>{var Rj=IQ(),vp=gB(),gp=mB(),up=cB(),hp=lB(),bp=nB(),VE=rB(),mp=sB(),fp=WE(),{encode:UE}=jQ(),{decode:qE}=zY(),{encodingLength:cp}=OQ(),pp=ZE(),NE=HY(),HE={array:vp,bool:up,buffer:gp,reserved:hp,string:bp,when:mp,select:fp};for(let W of Object.keys(VE))HE[W]=VE[W];var QN=Symbol("schema");function QE(W){let G=new Rj({readableObjectMode:!1,writableObjectMode:!0,transform:lp});return G[QN]=W,G}function JE(W){let G=null,X=Buffer.isBuffer(W);if(!X)G=W;let Y=new Rj({transform:dp,readableObjectMode:!0,writableObjectMode:!1});if(Y[QN]=G,X)Y.append(W);return Y}function lp(W,G,X){try{UE(W,this[QN],this);let Y=this.slice();this.consume(Y.length),X(null,Y)}catch(Y){X(Y)}}function dp(W,G,X){this.append(W);try{while(this.length>0){let Y=new pp(this),Z=qE(Y,this[QN]);Y.commit(),this.push(Z)}X()}catch(Y){if(Y instanceof NE)X();else X(Y)}}AE.exports={createEncodeStream:QE,createDecodeStream:JE,encode:UE,decode:qE,encodingLength:cp,createEncode:QE,createDecode:JE,types:HE,BinaryStream:Rj,NotEnoughDataError:NE}});var H$=Z1((q$)=>{Object.defineProperty(q$,"__esModule",{value:!0});q$.LEB128=q$.SignedLEB128=q$.UnsignedLEB128=void 0;var DY;(function(W){W[W.LOWER_7=127]="LOWER_7",W[W.UPPER_1=128]="UPPER_1"})(DY||(DY={}));var U$=(W)=>Number.isSafeInteger(W);class MY{static decode(W,G=0){let X=this.$scanForNullBytes(W,G),Y=0,Z=0;for(let V=0;V<=X-G;V++){let Q=W[G+V]&DY.LOWER_7;Y|=Q<<Z,Z+=7}return Y}static encode(W){if(this.check(W),W<0)throw Error(`An unsigned number must NOT be negative, ${W} is!`);let G=[],X=W;do{let Y=X&DY.LOWER_7;if(X>>=7,X)Y=Y|DY.UPPER_1;G.push(Y)}while(X);return Uint8Array.from(G)}static check(W){if(!U$(W))throw Error(`${W} is not a safe integer!`)}static $scanForNullBytes(W,G=0){let X=G,Y=0;do{if(X>=W.byteLength)throw Error("This is not a LEB128-encoded Uint8Array, no ending found!");Y=W.slice(X,X+1)[0],X++}while(Y&DY.UPPER_1);return X-1}static getLength(W,G=0){return this.$scanForNullBytes(W,G)-G}}q$.UnsignedLEB128=MY;class DN{static $ceil7mul(W){let G=W;while(G%7)G++;return G}static check(W){if(!U$(W))throw Error(`${W} is not a safe integer!`)}static encode(W){if(this.check(W),W>=0)throw Error(`A signed number must be negative, ${W} isn't!`);let G=Math.ceil(Math.log2(-W));return MY.encode((1<<this.$ceil7mul(G))+W)}static decode(W,G=0){let X=MY.decode(W,G);return-((1<<Math.ceil(Math.log2(X)))-X)}}q$.SignedLEB128=DN;class MN{}q$.LEB128=MN;MN.encode=(W)=>(W>=0?MY:DN).encode(W);MN.decode=(W,G=0,X=!1)=>(X?DN:MY).decode(W,G)});var z$=Z1((dj,A$)=>{/*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */(function(W){function G(P){return parseInt(P)===P}function X(P){if(!G(P.length))return!1;for(var E=0;E<P.length;E++)if(!G(P[E])||P[E]<0||P[E]>255)return!1;return!0}function Y(P,E){if(P.buffer&&P.name==="Uint8Array"){if(E)if(P.slice)P=P.slice();else P=Array.prototype.slice.call(P);return P}if(Array.isArray(P)){if(!X(P))throw Error("Array contains invalid value: "+P);return new Uint8Array(P)}if(G(P.length)&&X(P))return new Uint8Array(P);throw Error("unsupported array-like object")}function Z(P){return new Uint8Array(P)}function V(P,E,b,k,f){if(k!=null||f!=null)if(P.slice)P=P.slice(k,f);else P=Array.prototype.slice.call(P,k,f);E.set(P,b)}var Q=function(){function P(b){var k=[],f=0;b=encodeURI(b);while(f<b.length){var e=b.charCodeAt(f++);if(e===37)k.push(parseInt(b.substr(f,2),16)),f+=2;else k.push(e)}return Y(k)}function E(b){var k=[],f=0;while(f<b.length){var e=b[f];if(e<128)k.push(String.fromCharCode(e)),f++;else if(e>191&&e<224)k.push(String.fromCharCode((e&31)<<6|b[f+1]&63)),f+=2;else k.push(String.fromCharCode((e&15)<<12|(b[f+1]&63)<<6|b[f+2]&63)),f+=3}return k.join("")}return{toBytes:P,fromBytes:E}}(),J=function(){function P(k){var f=[];for(var e=0;e<k.length;e+=2)f.push(parseInt(k.substr(e,2),16));return f}var E="0123456789abcdef";function b(k){var f=[];for(var e=0;e<k.length;e++){var q0=k[e];f.push(E[(q0&240)>>4]+E[q0&15])}return f.join("")}return{toBytes:P,fromBytes:b}}(),U={16:10,24:12,32:14},q=[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],N=[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],A=[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],I=[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],w=[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],C=[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],D=[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],x=[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],h=[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,1047239000,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],p=[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,679998000,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],u=[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],n=[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],c=[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,1047239000,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],l=[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,679998000,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 G0(P){var E=[];for(var b=0;b<P.length;b+=4)E.push(P[b]<<24|P[b+1]<<16|P[b+2]<<8|P[b+3]);return E}var m=function(P){if(!(this instanceof m))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:Y(P,!0)}),this._prepare()};m.prototype._prepare=function(){var P=U[this.key.length];if(P==null)throw Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var E=0;E<=P;E++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var b=(P+1)*4,k=this.key.length/4,f=G0(this.key),e;for(var E=0;E<k;E++)e=E>>2,this._Ke[e][E%4]=f[E],this._Kd[P-e][E%4]=f[E];var q0=0,Q0=k,$0;while(Q0<b){if($0=f[k-1],f[0]^=N[$0>>16&255]<<24^N[$0>>8&255]<<16^N[$0&255]<<8^N[$0>>24&255]^q[q0]<<24,q0+=1,k!=8)for(var E=1;E<k;E++)f[E]^=f[E-1];else{for(var E=1;E<k/2;E++)f[E]^=f[E-1];$0=f[k/2-1],f[k/2]^=N[$0&255]^N[$0>>8&255]<<8^N[$0>>16&255]<<16^N[$0>>24&255]<<24;for(var E=k/2+1;E<k;E++)f[E]^=f[E-1]}var E=0,D0,k0;while(E<k&&Q0<b)D0=Q0>>2,k0=Q0%4,this._Ke[D0][k0]=f[E],this._Kd[P-D0][k0]=f[E++],Q0++}for(var D0=1;D0<P;D0++)for(var k0=0;k0<4;k0++)$0=this._Kd[D0][k0],this._Kd[D0][k0]=u[$0>>24&255]^n[$0>>16&255]^c[$0>>8&255]^l[$0&255]},m.prototype.encrypt=function(P){if(P.length!=16)throw Error("invalid plaintext size (must be 16 bytes)");var E=this._Ke.length-1,b=[0,0,0,0],k=G0(P);for(var f=0;f<4;f++)k[f]^=this._Ke[0][f];for(var e=1;e<E;e++){for(var f=0;f<4;f++)b[f]=H[k[f]>>24&255]^I[k[(f+1)%4]>>16&255]^w[k[(f+2)%4]>>8&255]^C[k[(f+3)%4]&255]^this._Ke[e][f];k=b.slice()}var q0=Z(16),Q0;for(var f=0;f<4;f++)Q0=this._Ke[E][f],q0[4*f]=(N[k[f]>>24&255]^Q0>>24)&255,q0[4*f+1]=(N[k[(f+1)%4]>>16&255]^Q0>>16)&255,q0[4*f+2]=(N[k[(f+2)%4]>>8&255]^Q0>>8)&255,q0[4*f+3]=(N[k[(f+3)%4]&255]^Q0)&255;return q0},m.prototype.decrypt=function(P){if(P.length!=16)throw Error("invalid ciphertext size (must be 16 bytes)");var E=this._Kd.length-1,b=[0,0,0,0],k=G0(P);for(var f=0;f<4;f++)k[f]^=this._Kd[0][f];for(var e=1;e<E;e++){for(var f=0;f<4;f++)b[f]=D[k[f]>>24&255]^x[k[(f+3)%4]>>16&255]^h[k[(f+2)%4]>>8&255]^p[k[(f+1)%4]&255]^this._Kd[e][f];k=b.slice()}var q0=Z(16),Q0;for(var f=0;f<4;f++)Q0=this._Kd[E][f],q0[4*f]=(A[k[f]>>24&255]^Q0>>24)&255,q0[4*f+1]=(A[k[(f+3)%4]>>16&255]^Q0>>16)&255,q0[4*f+2]=(A[k[(f+2)%4]>>8&255]^Q0>>8)&255,q0[4*f+3]=(A[k[(f+1)%4]&255]^Q0)&255;return q0};var Y0=function(P){if(!(this instanceof Y0))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new m(P)};Y0.prototype.encrypt=function(P){if(P=Y(P),P.length%16!==0)throw Error("invalid plaintext size (must be multiple of 16 bytes)");var E=Z(P.length),b=Z(16);for(var k=0;k<P.length;k+=16)V(P,b,0,k,k+16),b=this._aes.encrypt(b),V(b,E,k);return E},Y0.prototype.decrypt=function(P){if(P=Y(P),P.length%16!==0)throw Error("invalid ciphertext size (must be multiple of 16 bytes)");var E=Z(P.length),b=Z(16);for(var k=0;k<P.length;k+=16)V(P,b,0,k,k+16),b=this._aes.decrypt(b),V(b,E,k);return E};var U0=function(P,E){if(!(this instanceof U0))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",!E)E=Z(16);else if(E.length!=16)throw Error("invalid initialation vector size (must be 16 bytes)");this._lastCipherblock=Y(E,!0),this._aes=new m(P)};U0.prototype.encrypt=function(P){if(P=Y(P),P.length%16!==0)throw Error("invalid plaintext size (must be multiple of 16 bytes)");var E=Z(P.length),b=Z(16);for(var k=0;k<P.length;k+=16){V(P,b,0,k,k+16);for(var f=0;f<16;f++)b[f]^=this._lastCipherblock[f];this._lastCipherblock=this._aes.encrypt(b),V(this._lastCipherblock,E,k)}return E},U0.prototype.decrypt=function(P){if(P=Y(P),P.length%16!==0)throw Error("invalid ciphertext size (must be multiple of 16 bytes)");var E=Z(P.length),b=Z(16);for(var k=0;k<P.length;k+=16){V(P,b,0,k,k+16),b=this._aes.decrypt(b);for(var f=0;f<16;f++)E[k+f]=b[f]^this._lastCipherblock[f];V(P,this._lastCipherblock,0,k,k+16)}return E};var y=function(P,E,b){if(!(this instanceof y))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",!E)E=Z(16);else if(E.length!=16)throw Error("invalid initialation vector size (must be 16 size)");if(!b)b=1;this.segmentSize=b,this._shiftRegister=Y(E,!0),this._aes=new m(P)};y.prototype.encrypt=function(P){if(P.length%this.segmentSize!=0)throw Error("invalid plaintext size (must be segmentSize bytes)");var E=Y(P,!0),b;for(var k=0;k<E.length;k+=this.segmentSize){b=this._aes.encrypt(this._shiftRegister);for(var f=0;f<this.segmentSize;f++)E[k+f]^=b[f];V(this._shiftRegister,this._shiftRegister,0,this.segmentSize),V(E,this._shiftRegister,16-this.segmentSize,k,k+this.segmentSize)}return E},y.prototype.decrypt=function(P){if(P.length%this.segmentSize!=0)throw Error("invalid ciphertext size (must be segmentSize bytes)");var E=Y(P,!0),b;for(var k=0;k<E.length;k+=this.segmentSize){b=this._aes.encrypt(this._shiftRegister);for(var f=0;f<this.segmentSize;f++)E[k+f]^=b[f];V(this._shiftRegister,this._shiftRegister,0,this.segmentSize),V(P,this._shiftRegister,16-this.segmentSize,k,k+this.segmentSize)}return E};var o=function(P,E){if(!(this instanceof o))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",!E)E=Z(16);else if(E.length!=16)throw Error("invalid initialation vector size (must be 16 bytes)");this._lastPrecipher=Y(E,!0),this._lastPrecipherIndex=16,this._aes=new m(P)};o.prototype.encrypt=function(P){var E=Y(P,!0);for(var b=0;b<E.length;b++){if(this._lastPrecipherIndex===16)this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0;E[b]^=this._lastPrecipher[this._lastPrecipherIndex++]}return E},o.prototype.decrypt=o.prototype.encrypt;var B=function(P){if(!(this instanceof B))throw Error("Counter must be instanitated with `new`");if(P!==0&&!P)P=1;if(typeof P==="number")this._counter=Z(16),this.setValue(P);else this.setBytes(P)};B.prototype.setValue=function(P){if(typeof P!=="number"||parseInt(P)!=P)throw Error("invalid counter value (must be an integer)");if(P>Number.MAX_SAFE_INTEGER)throw Error("integer value out of safe range");for(var E=15;E>=0;--E)this._counter[E]=P%256,P=parseInt(P/256)},B.prototype.setBytes=function(P){if(P=Y(P,!0),P.length!=16)throw Error("invalid counter bytes size (must be 16 bytes)");this._counter=P},B.prototype.increment=function(){for(var P=15;P>=0;P--)if(this._counter[P]===255)this._counter[P]=0;else{this._counter[P]++;break}};var R=function(P,E){if(!(this instanceof R))throw Error("AES must be instanitated with `new`");if(this.description="Counter",this.name="ctr",!(E instanceof B))E=new B(E);this._counter=E,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new m(P)};R.prototype.encrypt=function(P){var E=Y(P,!0);for(var b=0;b<E.length;b++){if(this._remainingCounterIndex===16)this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment();E[b]^=this._remainingCounter[this._remainingCounterIndex++]}return E},R.prototype.decrypt=R.prototype.encrypt;function _(P){P=Y(P,!0);var E=16-P.length%16,b=Z(P.length+E);V(P,b);for(var k=P.length;k<b.length;k++)b[k]=E;return b}function S(P){if(P=Y(P,!0),P.length<16)throw Error("PKCS#7 invalid length");var E=P[P.length-1];if(E>16)throw Error("PKCS#7 padding byte out of range");var b=P.length-E;for(var k=0;k<E;k++)if(P[b+k]!==E)throw Error("PKCS#7 invalid padding byte");var f=Z(b);return V(P,f,0,0,b),f}var v={AES:m,Counter:B,ModeOfOperation:{ecb:Y0,cbc:U0,cfb:y,ofb:o,ctr:R},utils:{hex:J,utf8:Q},padding:{pkcs7:{pad:_,strip:S}},_arrayTest:{coerceArray:Y,createArray:Z,copyArray:V}};if(typeof dj<"u")A$.exports=v;else if(typeof define==="function"&&define.amd)define([],function(){return v});else{if(W.aesjs)v._aesjs=W.aesjs;W.aesjs=v}})(dj)});var rj=Z1((C$)=>{var s0=C$,{Buffer:LN}=$8("buffer"),Sl=$8("os");s0.toBuffer=function(W,G,X){X=~~X;let Y;if(this.isV4Format(W))Y=G||LN.alloc(X+4),W.split(/\./g).map((Z)=>{Y[X++]=parseInt(Z,10)&255});else if(this.isV6Format(W)){let Z=W.split(":",8),V;for(V=0;V<Z.length;V++){let Q=this.isV4Format(Z[V]),J;if(Q)J=this.toBuffer(Z[V]),Z[V]=J.slice(0,2).toString("hex");if(J&&++V<8)Z.splice(V,0,J.slice(2,4).toString("hex"))}if(Z[0]==="")while(Z.length<8)Z.unshift("0");else if(Z[Z.length-1]==="")while(Z.length<8)Z.push("0");else if(Z.length<8){for(V=0;V<Z.length&&Z[V]!=="";V++);let Q=[V,1];for(V=9-Z.length;V>0;V--)Q.push("0");Z.splice(...Q)}Y=G||LN.alloc(X+16);for(V=0;V<Z.length;V++){let Q=parseInt(Z[V],16);Y[X++]=Q>>8&255,Y[X++]=Q&255}}if(!Y)throw Error(`Invalid ip address: ${W}`);return Y};s0.toString=function(W,G,X){G=~~G,X=X||W.length-G;let Y=[];if(X===4){for(let Z=0;Z<X;Z++)Y.push(W[G+Z]);Y=Y.join(".")}else if(X===16){for(let Z=0;Z<X;Z+=2)Y.push(W.readUInt16BE(G+Z).toString(16));Y=Y.join(":"),Y=Y.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3"),Y=Y.replace(/:{3,4}/,"::")}return Y};var xl=/^(\d{1,3}\.){3,3}\d{1,3}$/,kl=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i;s0.isV4Format=function(W){return xl.test(W)};s0.isV6Format=function(W){return kl.test(W)};function $Q(W){if(W===4)return"ipv4";if(W===6)return"ipv6";return W?W.toLowerCase():"ipv4"}s0.fromPrefixLen=function(W,G){if(W>32)G="ipv6";else G=$Q(G);let X=4;if(G==="ipv6")X=16;let Y=LN.alloc(X);for(let Z=0,V=Y.length;Z<V;++Z){let Q=8;if(W<8)Q=W;W-=Q,Y[Z]=~(255>>Q)&255}return s0.toString(Y)};s0.mask=function(W,G){W=s0.toBuffer(W),G=s0.toBuffer(G);let X=LN.alloc(Math.max(W.length,G.length)),Y;if(W.length===G.length)for(Y=0;Y<W.length;Y++)X[Y]=W[Y]&G[Y];else if(G.length===4)for(Y=0;Y<G.length;Y++)X[Y]=W[W.length-4+Y]&G[Y];else{for(Y=0;Y<X.length-6;Y++)X[Y]=0;X[10]=255,X[11]=255;for(Y=0;Y<W.length;Y++)X[Y+12]=W[Y]&G[Y+12];Y+=12}for(;Y<X.length;Y++)X[Y]=0;return s0.toString(X)};s0.cidr=function(W){let G=W.split("/"),X=G[0];if(G.length!==2)throw Error(`invalid CIDR subnet: ${X}`);let Y=s0.fromPrefixLen(parseInt(G[1],10));return s0.mask(X,Y)};s0.subnet=function(W,G){let X=s0.toLong(s0.mask(W,G)),Y=s0.toBuffer(G),Z=0;for(let Q=0;Q<Y.length;Q++)if(Y[Q]===255)Z+=8;else{let J=Y[Q]&255;while(J)J=J<<1&255,Z++}let V=2**(32-Z);return{networkAddress:s0.fromLong(X),firstAddress:V<=2?s0.fromLong(X):s0.fromLong(X+1),lastAddress:V<=2?s0.fromLong(X+V-1):s0.fromLong(X+V-2),broadcastAddress:s0.fromLong(X+V-1),subnetMask:G,subnetMaskLength:Z,numHosts:V<=2?V:V-2,length:V,contains(Q){return X===s0.toLong(s0.mask(Q,G))}}};s0.cidrSubnet=function(W){let G=W.split("/"),X=G[0];if(G.length!==2)throw Error(`invalid CIDR subnet: ${X}`);let Y=s0.fromPrefixLen(parseInt(G[1],10));return s0.subnet(X,Y)};s0.not=function(W){let G=s0.toBuffer(W);for(let X=0;X<G.length;X++)G[X]=255^G[X];return s0.toString(G)};s0.or=function(W,G){if(W=s0.toBuffer(W),G=s0.toBuffer(G),W.length===G.length){for(let V=0;V<W.length;++V)W[V]|=G[V];return s0.toString(W)}let X=W,Y=G;if(G.length>W.length)X=G,Y=W;let Z=X.length-Y.length;for(let V=Z;V<X.length;++V)X[V]|=Y[V-Z];return s0.toString(X)};s0.isEqual=function(W,G){if(W=s0.toBuffer(W),G=s0.toBuffer(G),W.length===G.length){for(let Y=0;Y<W.length;Y++)if(W[Y]!==G[Y])return!1;return!0}if(G.length===4){let Y=G;G=W,W=Y}for(let Y=0;Y<10;Y++)if(G[Y]!==0)return!1;let X=G.readUInt16BE(10);if(X!==0&&X!==65535)return!1;for(let Y=0;Y<4;Y++)if(W[Y]!==G[Y+12])return!1;return!0};s0.isPrivate=function(W){if(s0.isLoopback(W))return!0;if(!s0.isV6Format(W)){let G=s0.normalizeToLong(W);if(G<0)throw Error("invalid ipv4 address");W=s0.fromLong(G)}return/^(::f{4}:)?10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(W)||/^(::f{4}:)?192\.168\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(W)||/^(::f{4}:)?172\.(1[6-9]|2\d|30|31)\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(W)||/^(::f{4}:)?169\.254\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(W)||/^f[cd][0-9a-f]{2}:/i.test(W)||/^fe80:/i.test(W)||/^::1$/.test(W)||/^::$/.test(W)};s0.isPublic=function(W){return!s0.isPrivate(W)};s0.isLoopback=function(W){if(!/\./.test(W)&&!/:/.test(W))W=s0.fromLong(Number(W));return/^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/.test(W)||/^0177\./.test(W)||/^0x7f\./i.test(W)||/^fe80::1$/i.test(W)||/^::1$/.test(W)||/^::$/.test(W)};s0.loopback=function(W){if(W=$Q(W),W!=="ipv4"&&W!=="ipv6")throw Error("family must be ipv4 or ipv6");return W==="ipv4"?"127.0.0.1":"fe80::1"};s0.address=function(W,G){let X=Sl.networkInterfaces();if(G=$Q(G),W&&W!=="private"&&W!=="public"){let Z=X[W].filter((V)=>{return $Q(V.family)===G});if(Z.length===0)return;return Z[0].address}let Y=Object.keys(X).map((Z)=>{let V=X[Z].filter((Q)=>{if(Q.family=$Q(Q.family),Q.family!==G||s0.isLoopback(Q.address))return!1;if(!W)return!0;return W==="public"?s0.isPrivate(Q.address):s0.isPublic(Q.address)});return V.length?V[0].address:void 0}).filter(Boolean);return!Y.length?s0.loopback(G):Y[0]};s0.toLong=function(W){let G=0;return W.split(".").forEach((X)=>{G<<=8,G+=parseInt(X)}),G>>>0};s0.fromLong=function(W){return`${W>>>24}.${W>>16&255}.${W>>8&255}.${W&255}`};s0.normalizeToLong=function(W){let G=W.split(".").map((Z)=>{if(Z.startsWith("0x")||Z.startsWith("0X"))return parseInt(Z,16);else if(Z.startsWith("0")&&Z!=="0"&&/^[0-7]+$/.test(Z))return parseInt(Z,8);else if(/^[1-9]\d*$/.test(Z)||Z==="0")return parseInt(Z,10);else return NaN});if(G.some(isNaN))return-1;let X=0;switch(G.length){case 1:X=G[0];break;case 2:if(G[0]>255||G[1]>16777215)return-1;X=G[0]<<24|G[1]&16777215;break;case 3:if(G[0]>255||G[1]>255||G[2]>65535)return-1;X=G[0]<<24|G[1]<<16|G[2]&65535;break;case 4:if(G.some((Z)=>Z>255))return-1;X=G[0]<<24|G[1]<<16|G[2]<<8|G[3];break;default:return-1}return X>>>0}});var M$=Z1((SN0,D$)=>{D$.exports=function W(G,X){if(G===X)return!0;if(G&&X&&typeof G=="object"&&typeof X=="object"){if(G.constructor!==X.constructor)return!1;var Y,Z,V;if(Array.isArray(G)){if(Y=G.length,Y!=X.length)return!1;for(Z=Y;Z--!==0;)if(!W(G[Z],X[Z]))return!1;return!0}if(G.constructor===RegExp)return G.source===X.source&&G.flags===X.flags;if(G.valueOf!==Object.prototype.valueOf)return G.valueOf()===X.valueOf();if(G.toString!==Object.prototype.toString)return G.toString()===X.toString();if(V=Object.keys(G),Y=V.length,Y!==Object.keys(X).length)return!1;for(Z=Y;Z--!==0;)if(!Object.prototype.hasOwnProperty.call(X,V[Z]))return!1;for(Z=Y;Z--!==0;){var Q=V[Z];if(!W(G[Q],X[Q]))return!1}return!0}return G!==G&&X!==X}});var T$=Z1((_l)=>{_l.toString=function(W){switch(W){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+W};_l.toType=function(W){switch(W.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":return 255;case"*":return 255}if(W.toUpperCase().startsWith("UNKNOWN_"))return parseInt(W.slice(8));return 0}});var P$=Z1((gl)=>{gl.toString=function(W){switch(W){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+W};gl.toRcode=function(W){switch(W.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}});var R$=Z1((bl)=>{bl.toString=function(W){switch(W){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+W};bl.toOpcode=function(W){switch(W.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}});var L$=Z1((cl)=>{cl.toString=function(W){switch(W){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+W};cl.toClass=function(W){switch(W.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}});var B$=Z1((dl)=>{dl.toString=function(W){switch(W){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}if(W<0)return null;return`OPTION_${W}`};dl.toCode=function(W){if(typeof W==="number")return W;if(!W)return-1;switch(W.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}let G=W.match(/_(\d+)$/);if(G)return parseInt(G[1],10);return-1}});var F$=Z1(($$,aj)=>{var E$=function(W){Object.defineProperty(W,"__esModule",{value:!0}),W.decode=A,W.encode=N,W.familyOf=q,W.name=void 0,W.sizeOf=U,W.v6=W.v4=void 0;let G=/^(\d{1,3}\.){3,3}\d{1,3}$/,X=4,Y=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,Z=16,V={name:"v4",size:X,isFormat:(H)=>G.test(H),encode(H,I,w){w=~~w,I=I||new Uint8Array(w+X);let C=H.length,D=0;for(let x=0;x<C;){let h=H.charCodeAt(x++);if(h===46)I[w++]=D,D=0;else D=D*10+(h-48)}return I[w]=D,I},decode(H,I){return I=~~I,`${H[I++]}.${H[I++]}.${H[I++]}.${H[I]}`}};W.v4=V;let Q={name:"v6",size:Z,isFormat:(H)=>H.length>0&&Y.test(H),encode(H,I,w){w=~~w;let C=w+Z,D=-1,x=0,h=0,p=!0,u=!1;I=I||new Uint8Array(w+Z);for(let n=0;n<H.length;n++){let c=H.charCodeAt(n);if(c===58){if(p){if(D!==-1){if(w<C)I[w]=0;if(w<C-1)I[w+1]=0;w+=2}else if(w<C)D=w}else{if(u===!0){if(w<C)I[w]=h;w++}else{if(w<C)I[w]=x>>8;if(w<C-1)I[w+1]=x&255;w+=2}x=0,h=0}p=!0,u=!1}else if(c===46){if(w<C)I[w]=h;w++,h=0,x=0,p=!1,u=!0}else{if(p=!1,c>=97)c-=87;else if(c>=65)c-=55;else c-=48,h=h*10+c;x=(x<<4)+c}}if(p===!1)if(u===!0){if(w<C)I[w]=h;w++}else{if(w<C)I[w]=x>>8;if(w<C-1)I[w+1]=x&255;w+=2}else if(D===0){if(w<C)I[w]=0;if(w<C-1)I[w+1]=0;w+=2}else if(D!==-1){w+=2;for(let n=Math.min(w-1,C-1);n>=D+2;n--)I[n]=I[n-2];I[D]=0,I[D+1]=0,D=w}if(D!==w&&D!==-1){if(w>C-2)w=C-2;while(C>D)I[--C]=w<C&&w>D?I[--w]:0}else while(w<C)I[w++]=0;return I},decode(H,I){I=~~I;let w="";for(let C=0;C<Z;C+=2){if(C!==0)w+=":";w+=(H[I+C]<<8|H[I+C+1]).toString(16)}return w.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};W.v6=Q;let J="ip";W.name=J;function U(H){if(V.isFormat(H))return V.size;if(Q.isFormat(H))return Q.size;throw Error(`Invalid ip address: ${H}`)}function q(H){return U(H)===V.size?1:2}function N(H,I,w){w=~~w;let C=U(H);if(typeof I==="function")I=I(w+C);if(C===V.size)return V.encode(H,I,w);return Q.encode(H,I,w)}function A(H,I,w){if(I=~~I,w=w||H.length-I,w===V.size)return V.decode(H,I,w);if(w===Q.size)return Q.decode(H,I,w);throw Error(`Invalid buffer size needs to be ${V.size} for v4 or ${Q.size} for v6.`)}return"default"in W?W.default:W}({});if(typeof define==="function"&&define.amd)define([],function(){return E$});else if(typeof aj==="object"&&typeof $$==="object")aj.exports=E$});var S$=Z1((tl)=>{var G1=$8("buffer").Buffer,u4=T$(),il=P$(),rl=R$(),EN=L$(),ej=B$(),jG=F$(),y0=tl.name={};y0.encode=function(W,G,X,{mail:Y=!1}={}){if(!G)G=G1.alloc(y0.encodingLength(W));if(!X)X=0;let Z=X,V=W.replace(/^\.|\.$/gm,"");if(V.length){let Q=[];if(Y){let J="";V.split(".").forEach((U)=>{if(U.endsWith("\\"))J+=(J.length?".":"")+U.slice(0,-1);else if(Q.length===0&&J.length)Q.push(J+"."+U);else Q.push(U)})}else Q=V.split(".");for(let J=0;J<Q.length;J++){let U=G.write(Q[J],X+1);G[X]=U,X+=U+1}}return G[X++]=0,y0.encode.bytes=X-Z,G};y0.encode.bytes=0;y0.decode=function(W,G,{mail:X=!1}={}){if(!G)G=0;let Y=[],Z=G,V=0,Q=0,J=!1;while(!0){if(G>=W.length)throw Error("Cannot decode name (buffer overflow)");let U=W[G++];if(Q+=J?0:1,U===0)break;else if((U&192)===0){if(G+U>W.length)throw Error("Cannot decode name (buffer overflow)");if(V+=U+1,V>254)throw Error("Cannot decode name (name too long)");let q=W.toString("utf-8",G,G+U);if(X)q=q.replace(/\./g,"\\.");Y.push(q),G+=U,Q+=J?0:U}else if((U&192)===192){if(G+1>W.length)throw Error("Cannot decode name (buffer overflow)");let q=W.readUInt16BE(G-1)-49152;if(q>=Z)throw Error("Cannot decode name (bad pointer)");G=q,Z=q,Q+=J?0:1,J=!0}else throw Error("Cannot decode name (bad label)")}return y0.decode.bytes=Q,Y.length===0?".":Y.join(".")};y0.decode.bytes=0;y0.encodingLength=function(W){if(W==="."||W==="..")return 1;return G1.byteLength(W.replace(/^\.|\.$/gm,""))+2};var $1={};$1.encode=function(W,G,X){if(!G)G=G1.alloc($1.encodingLength(W));if(!X)X=0;let Y=G.write(W,X+1);return G[X]=Y,$1.encode.bytes=Y+1,G};$1.encode.bytes=0;$1.decode=function(W,G){if(!G)G=0;let X=W[G],Y=W.toString("utf-8",G+1,G+1+X);return $1.decode.bytes=X+1,Y};$1.decode.bytes=0;$1.encodingLength=function(W){return G1.byteLength(W)+1};var i5={};i5.encode=function(W,G,X){if(!G)G=i5.encodingLength(W);if(!X)X=0;let Y=(W.flags||0)&32767,Z=W.type==="response"?32768:0;return G.writeUInt16BE(W.id||0,X),G.writeUInt16BE(Y|Z,X+2),G.writeUInt16BE(W.questions.length,X+4),G.writeUInt16BE(W.answers.length,X+6),G.writeUInt16BE(W.authorities.length,X+8),G.writeUInt16BE(W.additionals.length,X+10),G};i5.encode.bytes=12;i5.decode=function(W,G){if(!G)G=0;if(W.length<12)throw Error("Header must be 12 bytes");let X=W.readUInt16BE(G+2);return{id:W.readUInt16BE(G),type:X&32768?"response":"query",flags:X&32767,flag_qr:(X>>15&1)===1,opcode:rl.toString(X>>11&15),flag_aa:(X>>10&1)===1,flag_tc:(X>>9&1)===1,flag_rd:(X>>8&1)===1,flag_ra:(X>>7&1)===1,flag_z:(X>>6&1)===1,flag_ad:(X>>5&1)===1,flag_cd:(X>>4&1)===1,rcode:il.toString(X&15),questions:Array(W.readUInt16BE(G+4)),answers:Array(W.readUInt16BE(G+6)),authorities:Array(W.readUInt16BE(G+8)),additionals:Array(W.readUInt16BE(G+10))}};i5.decode.bytes=12;i5.encodingLength=function(){return 12};var $4=tl.unknown={};$4.encode=function(W,G,X){if(!G)G=G1.alloc($4.encodingLength(W));if(!X)X=0;return G.writeUInt16BE(W.length,X),W.copy(G,X+2),$4.encode.bytes=W.length+2,G};$4.encode.bytes=0;$4.decode=function(W,G){if(!G)G=0;let X=W.readUInt16BE(G),Y=W.slice(G+2,G+2+X);return $4.decode.bytes=X+2,Y};$4.decode.bytes=0;$4.encodingLength=function(W){return W.length+2};var F4=tl.ns={};F4.encode=function(W,G,X){if(!G)G=G1.alloc(F4.encodingLength(W));if(!X)X=0;return y0.encode(W,G,X+2),G.writeUInt16BE(y0.encode.bytes,X),F4.encode.bytes=y0.encode.bytes+2,G};F4.encode.bytes=0;F4.decode=function(W,G){if(!G)G=0;let X=W.readUInt16BE(G),Y=y0.decode(W,G+2);return F4.decode.bytes=X+2,Y};F4.decode.bytes=0;F4.encodingLength=function(W){return y0.encodingLength(W)+2};var S4=tl.soa={};S4.encode=function(W,G,X){if(!G)G=G1.alloc(S4.encodingLength(W));if(!X)X=0;let Y=X;return X+=2,y0.encode(W.mname,G,X),X+=y0.encode.bytes,y0.encode(W.rname,G,X,{mail:!0}),X+=y0.encode.bytes,G.writeUInt32BE(W.serial||0,X),X+=4,G.writeUInt32BE(W.refresh||0,X),X+=4,G.writeUInt32BE(W.retry||0,X),X+=4,G.writeUInt32BE(W.expire||0,X),X+=4,G.writeUInt32BE(W.minimum||0,X),X+=4,G.writeUInt16BE(X-Y-2,Y),S4.encode.bytes=X-Y,G};S4.encode.bytes=0;S4.decode=function(W,G){if(!G)G=0;let X=G,Y={};return G+=2,Y.mname=y0.decode(W,G),G+=y0.decode.bytes,Y.rname=y0.decode(W,G,{mail:!0}),G+=y0.decode.bytes,Y.serial=W.readUInt32BE(G),G+=4,Y.refresh=W.readUInt32BE(G),G+=4,Y.retry=W.readUInt32BE(G),G+=4,Y.expire=W.readUInt32BE(G),G+=4,Y.minimum=W.readUInt32BE(G),G+=4,S4.decode.bytes=G-X,Y};S4.decode.bytes=0;S4.encodingLength=function(W){return 22+y0.encodingLength(W.mname)+y0.encodingLength(W.rname)};var x4=tl.txt={};x4.encode=function(W,G,X){if(!Array.isArray(W))W=[W];for(let Z=0;Z<W.length;Z++){if(typeof W[Z]==="string")W[Z]=G1.from(W[Z]);if(!G1.isBuffer(W[Z]))throw Error("Must be a Buffer")}if(!G)G=G1.alloc(x4.encodingLength(W));if(!X)X=0;let Y=X;return X+=2,W.forEach(function(Z){G[X++]=Z.length,Z.copy(G,X,0,Z.length),X+=Z.length}),G.writeUInt16BE(X-Y-2,Y),x4.encode.bytes=X-Y,G};x4.encode.bytes=0;x4.decode=function(W,G){if(!G)G=0;let X=G,Y=W.readUInt16BE(G);G+=2;let Z=[];while(Y>0){let V=W[G++];if(--Y,Y<V)throw Error("Buffer overflow");Z.push(W.slice(G,G+V)),G+=V,Y-=V}return x4.decode.bytes=G-X,Z};x4.decode.bytes=0;x4.encodingLength=function(W){if(!Array.isArray(W))W=[W];let G=2;return W.forEach(function(X){if(typeof X==="string")G+=G1.byteLength(X)+1;else G+=X.length+1}),G};var k4=tl.null={};k4.encode=function(W,G,X){if(!G)G=G1.alloc(k4.encodingLength(W));if(!X)X=0;if(typeof W==="string")W=G1.from(W);if(!W)W=G1.alloc(0);let Y=X;X+=2;let Z=W.length;return W.copy(G,X,0,Z),X+=Z,G.writeUInt16BE(X-Y-2,Y),k4.encode.bytes=X-Y,G};k4.encode.bytes=0;k4.decode=function(W,G){if(!G)G=0;let X=G,Y=W.readUInt16BE(G);G+=2;let Z=W.slice(G,G+Y);return G+=Y,k4.decode.bytes=G-X,Z};k4.decode.bytes=0;k4.encodingLength=function(W){if(!W)return 2;return(G1.isBuffer(W)?W.length:G1.byteLength(W))+2};var _4=tl.hinfo={};_4.encode=function(W,G,X){if(!G)G=G1.alloc(_4.encodingLength(W));if(!X)X=0;let Y=X;return X+=2,$1.encode(W.cpu,G,X),X+=$1.encode.bytes,$1.encode(W.os,G,X),X+=$1.encode.bytes,G.writeUInt16BE(X-Y-2,Y),_4.encode.bytes=X-Y,G};_4.encode.bytes=0;_4.decode=function(W,G){if(!G)G=0;let X=G,Y={};return G+=2,Y.cpu=$1.decode(W,G),G+=$1.decode.bytes,Y.os=$1.decode(W,G),G+=$1.decode.bytes,_4.decode.bytes=G-X,Y};_4.decode.bytes=0;_4.encodingLength=function(W){return $1.encodingLength(W.cpu)+$1.encodingLength(W.os)+2};var o5=tl.ptr={},al=tl.cname=o5,sl=tl.dname=o5;o5.encode=function(W,G,X){if(!G)G=G1.alloc(o5.encodingLength(W));if(!X)X=0;return y0.encode(W,G,X+2),G.writeUInt16BE(y0.encode.bytes,X),o5.encode.bytes=y0.encode.bytes+2,G};o5.encode.bytes=0;o5.decode=function(W,G){if(!G)G=0;let X=y0.decode(W,G+2);return o5.decode.bytes=y0.decode.bytes+2,X};o5.decode.bytes=0;o5.encodingLength=function(W){return y0.encodingLength(W)+2};var y4=tl.srv={};y4.encode=function(W,G,X){if(!G)G=G1.alloc(y4.encodingLength(W));if(!X)X=0;G.writeUInt16BE(W.priority||0,X+2),G.writeUInt16BE(W.weight||0,X+4),G.writeUInt16BE(W.port||0,X+6),y0.encode(W.target,G,X+8);let Y=y0.encode.bytes+6;return G.writeUInt16BE(Y,X),y4.encode.bytes=Y+2,G};y4.encode.bytes=0;y4.decode=function(W,G){if(!G)G=0;let X=W.readUInt16BE(G),Y={};return Y.priority=W.readUInt16BE(G+2),Y.weight=W.readUInt16BE(G+4),Y.port=W.readUInt16BE(G+6),Y.target=y0.decode(W,G+8),y4.decode.bytes=X+2,Y};y4.decode.bytes=0;y4.encodingLength=function(W){return 8+y0.encodingLength(W.target)};var Q5=tl.caa={};Q5.ISSUER_CRITICAL=128;Q5.encode=function(W,G,X){let Y=Q5.encodingLength(W);if(!G)G=G1.alloc(Q5.encodingLength(W));if(!X)X=0;if(W.issuerCritical)W.flags=Q5.ISSUER_CRITICAL;return G.writeUInt16BE(Y-2,X),X+=2,G.writeUInt8(W.flags||0,X),X+=1,$1.encode(W.tag,G,X),X+=$1.encode.bytes,G.write(W.value,X),X+=G1.byteLength(W.value),Q5.encode.bytes=Y,G};Q5.encode.bytes=0;Q5.decode=function(W,G){if(!G)G=0;let X=W.readUInt16BE(G);G+=2;let Y=G,Z={};return Z.flags=W.readUInt8(G),G+=1,Z.tag=$1.decode(W,G),G+=$1.decode.bytes,Z.value=W.toString("utf-8",G,Y+X),Z.issuerCritical=!!(Z.flags&Q5.ISSUER_CRITICAL),Q5.decode.bytes=X+2,Z};Q5.decode.bytes=0;Q5.encodingLength=function(W){return $1.encodingLength(W.tag)+$1.encodingLength(W.value)+2};var l6=tl.mx={};l6.encode=function(W,G,X){if(!G)G=G1.alloc(l6.encodingLength(W));if(!X)X=0;let Y=X;return X+=2,G.writeUInt16BE(W.preference||0,X),X+=2,y0.encode(W.exchange,G,X),X+=y0.encode.bytes,G.writeUInt16BE(X-Y-2,Y),l6.encode.bytes=X-Y,G};l6.encode.bytes=0;l6.decode=function(W,G){if(!G)G=0;let X=G,Y={};return G+=2,Y.preference=W.readUInt16BE(G),G+=2,Y.exchange=y0.decode(W,G),G+=y0.decode.bytes,l6.decode.bytes=G-X,Y};l6.encodingLength=function(W){return 4+y0.encodingLength(W.exchange)};var v4=tl.a={};v4.encode=function(W,G,X){if(!G)G=G1.alloc(v4.encodingLength(W));if(!X)X=0;return G.writeUInt16BE(4,X),X+=2,jG.v4.encode(W,G,X),v4.encode.bytes=6,G};v4.encode.bytes=0;v4.decode=function(W,G){if(!G)G=0;G+=2;let X=jG.v4.decode(W,G);return v4.decode.bytes=6,X};v4.decode.bytes=0;v4.encodingLength=function(){return 6};var g4=tl.aaaa={};g4.encode=function(W,G,X){if(!G)G=G1.alloc(g4.encodingLength(W));if(!X)X=0;return G.writeUInt16BE(16,X),X+=2,jG.v6.encode(W,G,X),g4.encode.bytes=18,G};g4.encode.bytes=0;g4.decode=function(W,G){if(!G)G=0;G+=2;let X=jG.v6.decode(W,G);return g4.decode.bytes=18,X};g4.decode.bytes=0;g4.encodingLength=function(){return 18};var n9=tl.option={};n9.encode=function(W,G,X){if(!G)G=G1.alloc(n9.encodingLength(W));if(!X)X=0;let Y=X,Z=ej.toCode(W.code);if(G.writeUInt16BE(Z,X),X+=2,W.data)G.writeUInt16BE(W.data.length,X),X+=2,W.data.copy(G,X),X+=W.data.length;else switch(Z){case 8:let V=W.sourcePrefixLength||0,Q=W.family||jG.familyOf(W.ip),J=jG.encode(W.ip,G1.alloc),U=Math.ceil(V/8);G.writeUInt16BE(U+4,X),X+=2,G.writeUInt16BE(Q,X),X+=2,G.writeUInt8(V,X++),G.writeUInt8(W.scopePrefixLength||0,X++),J.copy(G,X,0,U),X+=U;break;case 11:if(W.timeout)G.writeUInt16BE(2,X),X+=2,G.writeUInt16BE(W.timeout,X),X+=2;else G.writeUInt16BE(0,X),X+=2;break;case 12:let q=W.length||0;G.writeUInt16BE(q,X),X+=2,G.fill(0,X,X+q),X+=q;break;case 14:let N=W.tags.length*2;G.writeUInt16BE(N,X),X+=2;for(let A of W.tags)G.writeUInt16BE(A,X),X+=2;break;default:throw Error(`Unknown roption code: ${W.code}`)}return n9.encode.bytes=X-Y,G};n9.encode.bytes=0;n9.decode=function(W,G){if(!G)G=0;let X={};X.code=W.readUInt16BE(G),X.type=ej.toString(X.code),G+=2;let Y=W.readUInt16BE(G);switch(G+=2,X.data=W.slice(G,G+Y),X.code){case 8:X.family=W.readUInt16BE(G),G+=2,X.sourcePrefixLength=W.readUInt8(G++),X.scopePrefixLength=W.readUInt8(G++);let Z=G1.alloc(X.family===1?4:16);W.copy(Z,0,G,G+Y-4),X.ip=jG.decode(Z);break;case 11:if(Y>0)X.timeout=W.readUInt16BE(G),G+=2;break;case 14:X.tags=[];for(let V=0;V<Y;V+=2)X.tags.push(W.readUInt16BE(G)),G+=2}return n9.decode.bytes=Y+4,X};n9.decode.bytes=0;n9.encodingLength=function(W){if(W.data)return W.data.length+4;switch(ej.toCode(W.code)){case 8:let X=W.sourcePrefixLength||0;return Math.ceil(X/8)+8;case 11:return typeof W.timeout==="number"?6:4;case 12:return W.length+4;case 14:return 4+W.tags.length*2}throw Error(`Unknown roption code: ${W.code}`)};var U5=tl.opt={};U5.encode=function(W,G,X){if(!G)G=G1.alloc(U5.encodingLength(W));if(!X)X=0;let Y=X,Z=BY(W,n9);return G.writeUInt16BE(Z,X),X=FQ(W,n9,G,X+2),U5.encode.bytes=X-Y,G};U5.encode.bytes=0;U5.decode=function(W,G){if(!G)G=0;let X=G,Y=[],Z=W.readUInt16BE(G);G+=2;let V=0;while(Z>0)Y[V++]=n9.decode(W,G),G+=n9.decode.bytes,Z-=n9.decode.bytes;return U5.decode.bytes=G-X,Y};U5.decode.bytes=0;U5.encodingLength=function(W){return 2+BY(W||[],n9)};var y9=tl.dnskey={};y9.PROTOCOL_DNSSEC=3;y9.ZONE_KEY=128;y9.SECURE_ENTRYPOINT=32768;y9.encode=function(W,G,X){if(!G)G=G1.alloc(y9.encodingLength(W));if(!X)X=0;let Y=X,Z=W.key;if(!G1.isBuffer(Z))throw Error("Key must be a Buffer");return X+=2,G.writeUInt16BE(W.flags,X),X+=2,G.writeUInt8(y9.PROTOCOL_DNSSEC,X),X+=1,G.writeUInt8(W.algorithm,X),X+=1,Z.copy(G,X,0,Z.length),X+=Z.length,y9.encode.bytes=X-Y,G.writeUInt16BE(y9.encode.bytes-2,Y),G};y9.encode.bytes=0;y9.decode=function(W,G){if(!G)G=0;let X=G;var Y={},Z=W.readUInt16BE(G);if(G+=2,Y.flags=W.readUInt16BE(G),G+=2,W.readUInt8(G)!==y9.PROTOCOL_DNSSEC)throw Error("Protocol must be 3");return G+=1,Y.algorithm=W.readUInt8(G),G+=1,Y.key=W.slice(G,X+Z+2),G+=Y.key.length,y9.decode.bytes=G-X,Y};y9.decode.bytes=0;y9.encodingLength=function(W){return 6+G1.byteLength(W.key)};var F7=tl.rrsig={};F7.encode=function(W,G,X){if(!G)G=G1.alloc(F7.encodingLength(W));if(!X)X=0;let Y=X,Z=W.signature;if(!G1.isBuffer(Z))throw Error("Signature must be a Buffer");return X+=2,G.writeUInt16BE(u4.toType(W.typeCovered),X),X+=2,G.writeUInt8(W.algorithm,X),X+=1,G.writeUInt8(W.labels,X),X+=1,G.writeUInt32BE(W.originalTTL,X),X+=4,G.writeUInt32BE(W.expiration,X),X+=4,G.writeUInt32BE(W.inception,X),X+=4,G.writeUInt16BE(W.keyTag,X),X+=2,y0.encode(W.signersName,G,X),X+=y0.encode.bytes,Z.copy(G,X,0,Z.length),X+=Z.length,F7.encode.bytes=X-Y,G.writeUInt16BE(F7.encode.bytes-2,Y),G};F7.encode.bytes=0;F7.decode=function(W,G){if(!G)G=0;let X=G;var Y={},Z=W.readUInt16BE(G);return G+=2,Y.typeCovered=u4.toString(W.readUInt16BE(G)),G+=2,Y.algorithm=W.readUInt8(G),G+=1,Y.labels=W.readUInt8(G),G+=1,Y.originalTTL=W.readUInt32BE(G),G+=4,Y.expiration=W.readUInt32BE(G),G+=4,Y.inception=W.readUInt32BE(G),G+=4,Y.keyTag=W.readUInt16BE(G),G+=2,Y.signersName=y0.decode(W,G),G+=y0.decode.bytes,Y.signature=W.slice(G,X+Z+2),G+=Y.signature.length,F7.decode.bytes=G-X,Y};F7.decode.bytes=0;F7.encodingLength=function(W){return 20+y0.encodingLength(W.signersName)+G1.byteLength(W.signature)};var S7=tl.rp={};S7.encode=function(W,G,X){if(!G)G=G1.alloc(S7.encodingLength(W));if(!X)X=0;let Y=X;return X+=2,y0.encode(W.mbox||".",G,X,{mail:!0}),X+=y0.encode.bytes,y0.encode(W.txt||".",G,X),X+=y0.encode.bytes,S7.encode.bytes=X-Y,G.writeUInt16BE(S7.encode.bytes-2,Y),G};S7.encode.bytes=0;S7.decode=function(W,G){if(!G)G=0;let X=G,Y={};return G+=2,Y.mbox=y0.decode(W,G,{mail:!0})||".",G+=y0.decode.bytes,Y.txt=y0.decode(W,G)||".",G+=y0.decode.bytes,S7.decode.bytes=G-X,Y};S7.decode.bytes=0;S7.encodingLength=function(W){return 2+y0.encodingLength(W.mbox||".")+y0.encodingLength(W.txt||".")};var o8={};o8.encode=function(W,G,X){if(!G)G=G1.alloc(o8.encodingLength(W));if(!X)X=0;let Y=X;var Z=[];for(var V=0;V<W.length;V++){var Q=u4.toType(W[V]);if(Z[Q>>8]===void 0)Z[Q>>8]=[];Z[Q>>8][Q>>3&31]|=1<<7-(Q&7)}for(V=0;V<Z.length;V++)if(Z[V]!==void 0){var J=G1.from(Z[V]);G.writeUInt8(V,X),X+=1,G.writeUInt8(J.length,X),X+=1,J.copy(G,X),X+=J.length}return o8.encode.bytes=X-Y,G};o8.encode.bytes=0;o8.decode=function(W,G,X){if(!G)G=0;let Y=G;var Z=[];while(G-Y<X){var V=W.readUInt8(G);G+=1;var Q=W.readUInt8(G);G+=1;for(var J=0;J<Q;J++){var U=W.readUInt8(G+J);for(var q=0;q<8;q++)if(U&1<<7-q){var N=u4.toString(V<<8|J<<3|q);Z.push(N)}}G+=Q}return o8.decode.bytes=G-Y,Z};o8.decode.bytes=0;o8.encodingLength=function(W){var G=[];for(var X=0;X<W.length;X++){var Y=u4.toType(W[X]);G[Y>>8]=Math.max(G[Y>>8]||0,Y&255)}var Z=0;for(X=0;X<G.length;X++)if(G[X]!==void 0)Z+=2+Math.ceil((G[X]+1)/8);return Z};var x7=tl.nsec={};x7.encode=function(W,G,X){if(!G)G=G1.alloc(x7.encodingLength(W));if(!X)X=0;let Y=X;return X+=2,y0.encode(W.nextDomain,G,X),X+=y0.encode.bytes,o8.encode(W.rrtypes,G,X),X+=o8.encode.bytes,x7.encode.bytes=X-Y,G.writeUInt16BE(x7.encode.bytes-2,Y),G};x7.encode.bytes=0;x7.decode=function(W,G){if(!G)G=0;let X=G;var Y={},Z=W.readUInt16BE(G);return G+=2,Y.nextDomain=y0.decode(W,G),G+=y0.decode.bytes,Y.rrtypes=o8.decode(W,G,Z-(G-X)),G+=o8.decode.bytes,x7.decode.bytes=G-X,Y};x7.decode.bytes=0;x7.encodingLength=function(W){return 2+y0.encodingLength(W.nextDomain)+o8.encodingLength(W.rrtypes)};var k7=tl.nsec3={};k7.encode=function(W,G,X){if(!G)G=G1.alloc(k7.encodingLength(W));if(!X)X=0;let Y=X,Z=W.salt;if(!G1.isBuffer(Z))throw Error("salt must be a Buffer");let V=W.nextDomain;if(!G1.isBuffer(V))throw Error("nextDomain must be a Buffer");return X+=2,G.writeUInt8(W.algorithm,X),X+=1,G.writeUInt8(W.flags,X),X+=1,G.writeUInt16BE(W.iterations,X),X+=2,G.writeUInt8(Z.length,X),X+=1,Z.copy(G,X,0,Z.length),X+=Z.length,G.writeUInt8(V.length,X),X+=1,V.copy(G,X,0,V.length),X+=V.length,o8.encode(W.rrtypes,G,X),X+=o8.encode.bytes,k7.encode.bytes=X-Y,G.writeUInt16BE(k7.encode.bytes-2,Y),G};k7.encode.bytes=0;k7.decode=function(W,G){if(!G)G=0;let X=G;var Y={},Z=W.readUInt16BE(G);G+=2,Y.algorithm=W.readUInt8(G),G+=1,Y.flags=W.readUInt8(G),G+=1,Y.iterations=W.readUInt16BE(G),G+=2;let V=W.readUInt8(G);G+=1,Y.salt=W.slice(G,G+V),G+=V;let Q=W.readUInt8(G);return G+=1,Y.nextDomain=W.slice(G,G+Q),G+=Q,Y.rrtypes=o8.decode(W,G,Z-(G-X)),G+=o8.decode.bytes,k7.decode.bytes=G-X,Y};k7.decode.bytes=0;k7.encodingLength=function(W){return 8+W.salt.length+W.nextDomain.length+o8.encodingLength(W.rrtypes)};var _7=tl.ds={};_7.encode=function(W,G,X){if(!G)G=G1.alloc(_7.encodingLength(W));if(!X)X=0;let Y=X,Z=W.digest;if(!G1.isBuffer(Z))throw Error("Digest must be a Buffer");return X+=2,G.writeUInt16BE(W.keyTag,X),X+=2,G.writeUInt8(W.algorithm,X),X+=1,G.writeUInt8(W.digestType,X),X+=1,Z.copy(G,X,0,Z.length),X+=Z.length,_7.encode.bytes=X-Y,G.writeUInt16BE(_7.encode.bytes-2,Y),G};_7.encode.bytes=0;_7.decode=function(W,G){if(!G)G=0;let X=G;var Y={},Z=W.readUInt16BE(G);return G+=2,Y.keyTag=W.readUInt16BE(G),G+=2,Y.algorithm=W.readUInt8(G),G+=1,Y.digestType=W.readUInt8(G),G+=1,Y.digest=W.slice(G,X+Z+2),G+=Y.digest.length,_7.decode.bytes=G-X,Y};_7.decode.bytes=0;_7.encodingLength=function(W){return 6+G1.byteLength(W.digest)};var J5=tl.sshfp={};J5.getFingerprintLengthForHashType=function(G){switch(G){case 1:return 20;case 2:return 32}};J5.encode=function(G,X,Y){if(!X)X=G1.alloc(J5.encodingLength(G));if(!Y)Y=0;let Z=Y;Y+=2,X[Y]=G.algorithm,Y+=1,X[Y]=G.hash,Y+=1;let V=G1.from(G.fingerprint.toUpperCase(),"hex");if(V.length!==J5.getFingerprintLengthForHashType(G.hash))throw Error("Invalid fingerprint length");return V.copy(X,Y),Y+=V.byteLength,J5.encode.bytes=Y-Z,X.writeUInt16BE(J5.encode.bytes-2,Z),X};J5.encode.bytes=0;J5.decode=function(G,X){if(!X)X=0;let Y=X,Z={};X+=2,Z.algorithm=G[X],X+=1,Z.hash=G[X],X+=1;let V=J5.getFingerprintLengthForHashType(Z.hash);return Z.fingerprint=G.slice(X,X+V).toString("hex").toUpperCase(),X+=V,J5.decode.bytes=X-Y,Z};J5.decode.bytes=0;J5.encodingLength=function(W){return 4+G1.from(W.fingerprint,"hex").byteLength};var y7=tl.naptr={};y7.encode=function(W,G,X){if(!G)G=G1.alloc(y7.encodingLength(W));if(!X)X=0;let Y=X;return X+=2,G.writeUInt16BE(W.order||0,X),X+=2,G.writeUInt16BE(W.preference||0,X),X+=2,$1.encode(W.flags,G,X),X+=$1.encode.bytes,$1.encode(W.services,G,X),X+=$1.encode.bytes,$1.encode(W.regexp,G,X),X+=$1.encode.bytes,y0.encode(W.replacement,G,X),X+=y0.encode.bytes,y7.encode.bytes=X-Y,G.writeUInt16BE(y7.encode.bytes-2,Y),G};y7.encode.bytes=0;y7.decode=function(W,G){if(!G)G=0;let X=G,Y={};return G+=2,Y.order=W.readUInt16BE(G),G+=2,Y.preference=W.readUInt16BE(G),G+=2,Y.flags=$1.decode(W,G),G+=$1.decode.bytes,Y.services=$1.decode(W,G),G+=$1.decode.bytes,Y.regexp=$1.decode(W,G),G+=$1.decode.bytes,Y.replacement=y0.decode(W,G),G+=y0.decode.bytes,y7.decode.bytes=G-X,Y};y7.decode.bytes=0;y7.encodingLength=function(W){return $1.encodingLength(W.flags)+$1.encodingLength(W.services)+$1.encodingLength(W.regexp)+y0.encodingLength(W.replacement)+6};var v7=tl.tlsa={};v7.encode=function(W,G,X){if(!G)G=G1.alloc(v7.encodingLength(W));if(!X)X=0;let Y=X,Z=W.certificate;if(!G1.isBuffer(Z))throw Error("Certificate must be a Buffer");return X+=2,G.writeUInt8(W.usage,X),X+=1,G.writeUInt8(W.selector,X),X+=1,G.writeUInt8(W.matchingType,X),X+=1,Z.copy(G,X,0,Z.length),X+=Z.length,v7.encode.bytes=X-Y,G.writeUInt16BE(v7.encode.bytes-2,Y),G};v7.encode.bytes=0;v7.decode=function(W,G){if(!G)G=0;let X=G,Y={},Z=W.readUInt16BE(G);return G+=2,Y.usage=W.readUInt8(G),G+=1,Y.selector=W.readUInt8(G),G+=1,Y.matchingType=W.readUInt8(G),G+=1,Y.certificate=W.slice(G,X+Z+2),G+=Y.certificate.length,v7.decode.bytes=G-X,Y};v7.decode.bytes=0;v7.encodingLength=function(W){return 5+G1.byteLength(W.certificate)};var WO=tl.record=function(W){switch(W.toUpperCase()){case"A":return v4;case"PTR":return o5;case"CNAME":return al;case"DNAME":return sl;case"TXT":return x4;case"NULL":return k4;case"AAAA":return g4;case"SRV":return y4;case"HINFO":return _4;case"CAA":return Q5;case"NS":return F4;case"SOA":return S4;case"MX":return l6;case"OPT":return U5;case"DNSKEY":return y9;case"RRSIG":return F7;case"RP":return S7;case"NSEC":return x7;case"NSEC3":return k7;case"SSHFP":return J5;case"DS":return _7;case"NAPTR":return y7;case"TLSA":return v7}return $4},X9=tl.answer={};X9.encode=function(W,G,X){if(!G)G=G1.alloc(X9.encodingLength(W));if(!X)X=0;let Y=X;if(y0.encode(W.name,G,X),X+=y0.encode.bytes,G.writeUInt16BE(u4.toType(W.type),X),W.type.toUpperCase()==="OPT"){if(W.name!==".")throw Error("OPT name must be root.");G.writeUInt16BE(W.udpPayloadSize||4096,X+2),G.writeUInt8(W.extendedRcode||0,X+4),G.writeUInt8(W.ednsVersion||0,X+5),G.writeUInt16BE(W.flags||0,X+6),X+=8,U5.encode(W.options||[],G,X),X+=U5.encode.bytes}else{let Z=EN.toClass(W.class===void 0?"IN":W.class);if(W.flush)Z|=32768;G.writeUInt16BE(Z,X+2),G.writeUInt32BE(W.ttl||0,X+4),X+=8;let V=WO(W.type);V.encode(W.data,G,X),X+=V.encode.bytes}return X9.encode.bytes=X-Y,G};X9.encode.bytes=0;X9.decode=function(W,G){if(!G)G=0;let X={},Y=G;if(X.name=y0.decode(W,G),G+=y0.decode.bytes,X.type=u4.toString(W.readUInt16BE(G)),X.type==="OPT")X.udpPayloadSize=W.readUInt16BE(G+2),X.extendedRcode=W.readUInt8(G+4),X.ednsVersion=W.readUInt8(G+5),X.flags=W.readUInt16BE(G+6),X.flag_do=(X.flags>>15&1)===1,X.options=U5.decode(W,G+8),G+=8+U5.decode.bytes;else{let Z=W.readUInt16BE(G+2);X.ttl=W.readUInt32BE(G+4),X.class=EN.toString(Z&-32769),X.flush=!!(Z&32768);let V=WO(X.type);X.data=V.decode(W,G+8),G+=8+V.decode.bytes}return X9.decode.bytes=G-Y,X};X9.decode.bytes=0;X9.encodingLength=function(W){let G=W.data!==null&&W.data!==void 0?W.data:W.options;return y0.encodingLength(W.name)+8+WO(W.type).encodingLength(G)};var n5=tl.question={};n5.encode=function(W,G,X){if(!G)G=G1.alloc(n5.encodingLength(W));if(!X)X=0;let Y=X;return y0.encode(W.name,G,X),X+=y0.encode.bytes,G.writeUInt16BE(u4.toType(W.type),X),X+=2,G.writeUInt16BE(EN.toClass(W.class===void 0?"IN":W.class),X),X+=2,n5.encode.bytes=X-Y,W};n5.encode.bytes=0;n5.decode=function(W,G){if(!G)G=0;let X=G,Y={};if(Y.name=y0.decode(W,G),G+=y0.decode.bytes,Y.type=u4.toString(W.readUInt16BE(G)),G+=2,Y.class=EN.toString(W.readUInt16BE(G)),G+=2,!!(Y.class&32768))Y.class&=-32769;return n5.decode.bytes=G-X,Y};n5.decode.bytes=0;n5.encodingLength=function(W){return y0.encodingLength(W.name)+4};tl.AUTHORITATIVE_ANSWER=1024;tl.TRUNCATED_RESPONSE=512;tl.RECURSION_DESIRED=256;tl.RECURSION_AVAILABLE=128;tl.AUTHENTIC_DATA=32;tl.CHECKING_DISABLED=16;tl.DNSSEC_OK=32768;tl.encode=function(W,G,X){let Y=!G;if(Y)G=G1.alloc(tl.encodingLength(W));if(!X)X=0;let Z=X;if(!W.questions)W.questions=[];if(!W.answers)W.answers=[];if(!W.authorities)W.authorities=[];if(!W.additionals)W.additionals=[];if(i5.encode(W,G,X),X+=i5.encode.bytes,X=FQ(W.questions,n5,G,X),X=FQ(W.answers,X9,G,X),X=FQ(W.authorities,X9,G,X),X=FQ(W.additionals,X9,G,X),tl.encode.bytes=X-Z,Y&&tl.encode.bytes!==G.length)return G.slice(0,tl.encode.bytes);return G};tl.encode.bytes=0;tl.decode=function(W,G){if(!G)G=0;let X=G,Y=i5.decode(W,G);return G+=i5.decode.bytes,G=BN(Y.questions,n5,W,G),G=BN(Y.answers,X9,W,G),G=BN(Y.authorities,X9,W,G),G=BN(Y.additionals,X9,W,G),tl.decode.bytes=G-X,Y};tl.decode.bytes=0;tl.encodingLength=function(W){return i5.encodingLength(W)+BY(W.questions||[],n5)+BY(W.answers||[],X9)+BY(W.authorities||[],X9)+BY(W.additionals||[],X9)};tl.streamEncode=function(W){let G=tl.encode(W),X=G1.alloc(2);X.writeUInt16BE(G.byteLength);let Y=G1.concat([X,G]);return tl.streamEncode.bytes=Y.byteLength,Y};tl.streamEncode.bytes=0;tl.streamDecode=function(W){let G=W.readUInt16BE(0);if(W.byteLength<G+2)return null;let X=tl.decode(W.slice(2));return tl.streamDecode.bytes=tl.decode.bytes,X};tl.streamDecode.bytes=0;function BY(W,G){let X=0;for(let Y=0;Y<W.length;Y++)X+=G.encodingLength(W[Y]);return X}function FQ(W,G,X,Y){for(let Z=0;Z<W.length;Z++)G.encode(W[Z],X,Y),Y+=G.encode.bytes;return Y}function BN(W,G,X,Y){for(let Z=0;Z<W.length;Z++)W[Z]=G.decode(X,Y),Y+=G.decode.bytes;return Y}});var _$=Z1((AH0,k$)=>{var x$=Ad;process.nextTick(Hd,42);k$.exports=Jd;function Jd(W){var G=Y;return X;function X(Z){G(Z||qd)}function Y(Z){var V=[Z];G=Q,W(J);function Q(U){V.push(U)}function J(U){var q=arguments;G=Ud(U)?Y:N;while(V.length)N(V.shift());function N(A){x$(Nd,A,q)}}}}function Ud(W){return Object.prototype.toString.call(W)==="[object Error]"}function qd(){}function Nd(W,G){W.apply(null,G)}function Hd(W){if(W===42)x$=process.nextTick}function Ad(W,G,X){process.nextTick(function(){W(G,X)})}});var g$=Z1((zH0,v$)=>{var GO=S$(),zd=$8("dgram"),Id=_$(),wd=$8("events"),YO=$8("os"),XO=function(){};v$.exports=function(W){if(!W)W={};var G=new wd.EventEmitter,X=typeof W.port==="number"?W.port:5353,Y=W.type||"udp4",Z=W.ip||W.host||(Y==="udp4"?"224.0.0.251":null),V={address:Z,port:X},Q={},J=!1,U=null;if(Y==="udp6"&&(!Z||!W.interface))throw Error("For IPv6 multicast you must specify `ip` and `interface`");var q=W.socket||zd.createSocket({type:Y,reuseAddr:W.reuseAddr!==!1,toString:function(){return Y}});q.on("error",function(A){if(A.code==="EACCES"||A.code==="EADDRINUSE")G.emit("error",A);else G.emit("warning",A)}),q.on("message",function(A,H){try{A=GO.decode(A)}catch(I){G.emit("warning",I);return}if(G.emit("packet",A,H),A.type==="query")G.emit("query",A,H);if(A.type==="response")G.emit("response",A,H)}),q.on("listening",function(){if(!X)X=V.port=q.address().port;if(W.multicast!==!1)G.update(),U=setInterval(G.update,5000),q.setMulticastTTL(W.ttl||255),q.setMulticastLoopback(W.loopback!==!1)});var N=Id(function(A){if(!X||W.bind===!1)return A(null);q.once("error",A),q.bind(X,W.bind||W.interface,function(){q.removeListener("error",A),A(null)})});return N(function(A){if(A)return G.emit("error",A);G.emit("ready")}),G.send=function(A,H,I){if(typeof H==="function")return G.send(A,null,H);if(!I)I=XO;if(!H)H=V;else if(!H.host&&!H.address)H.address=V.address;N(w);function w(C){if(J)return I();if(C)return I(C);var D=GO.encode(A);q.send(D,0,D.length,H.port,H.address||H.host,I)}},G.response=G.respond=function(A,H,I){if(Array.isArray(A))A={answers:A};A.type="response",A.flags=(A.flags||0)|GO.AUTHORITATIVE_ANSWER,G.send(A,H,I)},G.query=function(A,H,I,w){if(typeof H==="function")return G.query(A,null,null,H);if(typeof H==="object"&&H&&H.port)return G.query(A,null,H,I);if(typeof I==="function")return G.query(A,H,null,I);if(!w)w=XO;if(typeof A==="string")A=[{name:A,type:H||"ANY"}];if(Array.isArray(A))A={type:"query",questions:A};A.type="query",G.send(A,I,w)},G.destroy=function(A){if(!A)A=XO;if(J)return process.nextTick(A);J=!0,clearInterval(U);for(var H in Q)try{q.dropMembership(Z,H)}catch(I){}Q={},q.close(A)},G.update=function(){var A=W.interface?[].concat(W.interface):Od(),H=!1;for(var I=0;I<A.length;I++){var w=A[I];if(Q[w])continue;try{q.addMembership(Z,w),Q[w]=!0,H=!0}catch(C){G.emit("warning",C)}}if(H){if(q.setMulticastInterface)try{q.setMulticastInterface(W.interface||jd())}catch(C){G.emit("warning",C)}G.emit("networkInterface")}},G};function jd(){var W=YO.networkInterfaces(),G=Object.keys(W);for(var X=0;X<G.length;X++){var Y=W[G[X]];for(var Z=0;Z<Y.length;Z++){var V=Y[Z];if(y$(V.family)&&!V.internal){if(YO.platform()==="darwin"&&G[X]==="en0")return V.address;return"0.0.0.0"}}}return"127.0.0.1"}function Od(){var W=YO.networkInterfaces(),G=Object.keys(W),X=[];for(var Y=0;Y<G.length;Y++){var Z=W[G[Y]];for(var V=0;V<Z.length;V++){var Q=Z[V];if(y$(Q.family)){X.push(Q.address);break}}}return X}function y$(W){return W===4||W==="IPv4"}});import{Database as qt}from"bun:sqlite";import{mkdirSync as Nt}from"fs";import{dirname as Ht}from"path";function JC(W){let G=W.length,X=0,Y=0;while(Y<G){let Z=W.charCodeAt(Y++);if((Z&4294967168)===0){X++;continue}else if((Z&4294965248)===0)X+=2;else{if(Z>=55296&&Z<=56319){if(Y<G){let V=W.charCodeAt(Y);if((V&64512)===56320)++Y,Z=((Z&1023)<<10)+(V&1023)+65536}}if((Z&4294901760)===0)X+=3;else X+=4}}return X}function g_(W,G,X){let Y=W.length,Z=X,V=0;while(V<Y){let Q=W.charCodeAt(V++);if((Q&4294967168)===0){G[Z++]=Q;continue}else if((Q&4294965248)===0)G[Z++]=Q>>6&31|192;else{if(Q>=55296&&Q<=56319){if(V<Y){let J=W.charCodeAt(V);if((J&64512)===56320)++V,Q=((Q&1023)<<10)+(J&1023)+65536}}if((Q&4294901760)===0)G[Z++]=Q>>12&15|224,G[Z++]=Q>>6&63|128;else G[Z++]=Q>>18&7|240,G[Z++]=Q>>12&63|128,G[Z++]=Q>>6&63|128}G[Z++]=Q&63|128}}var u_=new TextEncoder,h_=50;function b_(W,G,X){u_.encodeInto(W,G.subarray(X))}function UC(W,G,X){if(W.length>h_)b_(W,G,X);else g_(W,G,X)}var m_=4096;function NA(W,G,X){let Y=G,Z=Y+X,V=[],Q="";while(Y<Z){let J=W[Y++];if((J&128)===0)V.push(J);else if((J&224)===192){let U=W[Y++]&63;V.push((J&31)<<6|U)}else if((J&240)===224){let U=W[Y++]&63,q=W[Y++]&63;V.push((J&31)<<12|U<<6|q)}else if((J&248)===240){let U=W[Y++]&63,q=W[Y++]&63,N=W[Y++]&63,A=(J&7)<<18|U<<12|q<<6|N;if(A>65535)A-=65536,V.push(A>>>10&1023|55296),A=56320|A&1023;V.push(A)}else V.push(J);if(V.length>=m_)Q+=String.fromCharCode(...V),V.length=0}if(V.length>0)Q+=String.fromCharCode(...V);return Q}var f_=new TextDecoder,c_=200;function p_(W,G,X){let Y=W.subarray(G,G+X);return f_.decode(Y)}function qC(W,G,X){if(X>c_)return p_(W,G,X);else return NA(W,G,X)}class pG{type;data;constructor(W,G){this.type=W,this.data=G}}class $9 extends Error{constructor(W){super(W);let G=Object.create($9.prototype);Object.setPrototypeOf(this,G),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:$9.name})}}var lG=4294967295;function NC(W,G,X){let Y=X/4294967296,Z=X;W.setUint32(G,Y),W.setUint32(G+4,Z)}function _J(W,G,X){let Y=Math.floor(X/4294967296),Z=X;W.setUint32(G,Y),W.setUint32(G+4,Z)}function yJ(W,G){let X=W.getInt32(G),Y=W.getUint32(G+4);return X*4294967296+Y}function HC(W,G){let X=W.getUint32(G),Y=W.getUint32(G+4);return X*4294967296+Y}var l_=-1,d_=4294967295,o_=17179869183;function n_({sec:W,nsec:G}){if(W>=0&&G>=0&&W<=o_)if(G===0&&W<=d_){let X=new Uint8Array(4);return new DataView(X.buffer).setUint32(0,W),X}else{let X=W/4294967296,Y=W&4294967295,Z=new Uint8Array(8),V=new DataView(Z.buffer);return V.setUint32(0,G<<2|X&3),V.setUint32(4,Y),Z}else{let X=new Uint8Array(12),Y=new DataView(X.buffer);return Y.setUint32(0,G),_J(Y,4,W),X}}function i_(W){let G=W.getTime(),X=Math.floor(G/1000),Y=(G-X*1000)*1e6,Z=Math.floor(Y/1e9);return{sec:X+Z,nsec:Y-Z*1e9}}function r_(W){if(W instanceof Date){let G=i_(W);return n_(G)}else return null}function a_(W){let G=new DataView(W.buffer,W.byteOffset,W.byteLength);switch(W.byteLength){case 4:{let X=G.getUint32(0),Y=0;return{sec:X,nsec:0}}case 8:{let X=G.getUint32(0),Y=G.getUint32(4),Z=(X&3)*4294967296+Y,V=X>>>2;return{sec:Z,nsec:V}}case 12:{let X=yJ(G,4),Y=G.getUint32(0);return{sec:X,nsec:Y}}default:throw new $9(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${W.length}`)}}function s_(W){let G=a_(W);return new Date(G.sec*1000+G.nsec/1e6)}var AC={type:l_,encode:r_,decode:s_};class dG{static defaultCodec=new dG;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(AC)}register({type:W,encode:G,decode:X}){if(W>=0)this.encoders[W]=G,this.decoders[W]=X;else{let Y=-1-W;this.builtInEncoders[Y]=G,this.builtInDecoders[Y]=X}}tryToEncode(W,G){for(let X=0;X<this.builtInEncoders.length;X++){let Y=this.builtInEncoders[X];if(Y!=null){let Z=Y(W,G);if(Z!=null){let V=-1-X;return new pG(V,Z)}}}for(let X=0;X<this.encoders.length;X++){let Y=this.encoders[X];if(Y!=null){let Z=Y(W,G);if(Z!=null)return new pG(X,Z)}}if(W instanceof pG)return W;return null}decode(W,G,X){let Y=G<0?this.builtInDecoders[-1-G]:this.decoders[G];if(Y)return Y(W,G,X);else return new pG(G,W)}}function t_(W){return W instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&W instanceof SharedArrayBuffer}function UZ(W){if(W instanceof Uint8Array)return W;else if(ArrayBuffer.isView(W))return new Uint8Array(W.buffer,W.byteOffset,W.byteLength);else if(t_(W))return new Uint8Array(W);else return Uint8Array.from(W)}var e_=100,Wy=2048;class vJ{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(W){this.extensionCodec=W?.extensionCodec??dG.defaultCodec,this.context=W?.context,this.useBigInt64=W?.useBigInt64??!1,this.maxDepth=W?.maxDepth??e_,this.initialBufferSize=W?.initialBufferSize??Wy,this.sortKeys=W?.sortKeys??!1,this.forceFloat32=W?.forceFloat32??!1,this.ignoreUndefined=W?.ignoreUndefined??!1,this.forceIntegerToFloat=W?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new vJ({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(W){if(this.entered)return this.clone().encodeSharedRef(W);try{return this.entered=!0,this.reinitializeState(),this.doEncode(W,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(W){if(this.entered)return this.clone().encode(W);try{return this.entered=!0,this.reinitializeState(),this.doEncode(W,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(W,G){if(G>this.maxDepth)throw Error(`Too deep objects in depth ${G}`);if(W==null)this.encodeNil();else if(typeof W==="boolean")this.encodeBoolean(W);else if(typeof W==="number")if(!this.forceIntegerToFloat)this.encodeNumber(W);else this.encodeNumberAsFloat(W);else if(typeof W==="string")this.encodeString(W);else if(this.useBigInt64&&typeof W==="bigint")this.encodeBigInt64(W);else this.encodeObject(W,G)}ensureBufferSizeToWrite(W){let G=this.pos+W;if(this.view.byteLength<G)this.resizeBuffer(G*2)}resizeBuffer(W){let G=new ArrayBuffer(W),X=new Uint8Array(G),Y=new DataView(G);X.set(this.bytes),this.view=Y,this.bytes=X}encodeNil(){this.writeU8(192)}encodeBoolean(W){if(W===!1)this.writeU8(194);else this.writeU8(195)}encodeNumber(W){if(!this.forceIntegerToFloat&&Number.isSafeInteger(W))if(W>=0)if(W<128)this.writeU8(W);else if(W<256)this.writeU8(204),this.writeU8(W);else if(W<65536)this.writeU8(205),this.writeU16(W);else if(W<4294967296)this.writeU8(206),this.writeU32(W);else if(!this.useBigInt64)this.writeU8(207),this.writeU64(W);else this.encodeNumberAsFloat(W);else if(W>=-32)this.writeU8(224|W+32);else if(W>=-128)this.writeU8(208),this.writeI8(W);else if(W>=-32768)this.writeU8(209),this.writeI16(W);else if(W>=-2147483648)this.writeU8(210),this.writeI32(W);else if(!this.useBigInt64)this.writeU8(211),this.writeI64(W);else this.encodeNumberAsFloat(W);else this.encodeNumberAsFloat(W)}encodeNumberAsFloat(W){if(this.forceFloat32)this.writeU8(202),this.writeF32(W);else this.writeU8(203),this.writeF64(W)}encodeBigInt64(W){if(W>=BigInt(0))this.writeU8(207),this.writeBigUint64(W);else this.writeU8(211),this.writeBigInt64(W)}writeStringHeader(W){if(W<32)this.writeU8(160+W);else if(W<256)this.writeU8(217),this.writeU8(W);else if(W<65536)this.writeU8(218),this.writeU16(W);else if(W<4294967296)this.writeU8(219),this.writeU32(W);else throw Error(`Too long string: ${W} bytes in UTF-8`)}encodeString(W){let X=JC(W);this.ensureBufferSizeToWrite(5+X),this.writeStringHeader(X),UC(W,this.bytes,this.pos),this.pos+=X}encodeObject(W,G){let X=this.extensionCodec.tryToEncode(W,this.context);if(X!=null)this.encodeExtension(X);else if(Array.isArray(W))this.encodeArray(W,G);else if(ArrayBuffer.isView(W))this.encodeBinary(W);else if(typeof W==="object")this.encodeMap(W,G);else throw Error(`Unrecognized object: ${Object.prototype.toString.apply(W)}`)}encodeBinary(W){let G=W.byteLength;if(G<256)this.writeU8(196),this.writeU8(G);else if(G<65536)this.writeU8(197),this.writeU16(G);else if(G<4294967296)this.writeU8(198),this.writeU32(G);else throw Error(`Too large binary: ${G}`);let X=UZ(W);this.writeU8a(X)}encodeArray(W,G){let X=W.length;if(X<16)this.writeU8(144+X);else if(X<65536)this.writeU8(220),this.writeU16(X);else if(X<4294967296)this.writeU8(221),this.writeU32(X);else throw Error(`Too large array: ${X}`);for(let Y of W)this.doEncode(Y,G+1)}countWithoutUndefined(W,G){let X=0;for(let Y of G)if(W[Y]!==void 0)X++;return X}encodeMap(W,G){let X=Object.keys(W);if(this.sortKeys)X.sort();let Y=this.ignoreUndefined?this.countWithoutUndefined(W,X):X.length;if(Y<16)this.writeU8(128+Y);else if(Y<65536)this.writeU8(222),this.writeU16(Y);else if(Y<4294967296)this.writeU8(223),this.writeU32(Y);else throw Error(`Too large map object: ${Y}`);for(let Z of X){let V=W[Z];if(!(this.ignoreUndefined&&V===void 0))this.encodeString(Z),this.doEncode(V,G+1)}}encodeExtension(W){if(typeof W.data==="function"){let X=W.data(this.pos+6),Y=X.length;if(Y>=4294967296)throw Error(`Too large extension object: ${Y}`);this.writeU8(201),this.writeU32(Y),this.writeI8(W.type),this.writeU8a(X);return}let G=W.data.length;if(G===1)this.writeU8(212);else if(G===2)this.writeU8(213);else if(G===4)this.writeU8(214);else if(G===8)this.writeU8(215);else if(G===16)this.writeU8(216);else if(G<256)this.writeU8(199),this.writeU8(G);else if(G<65536)this.writeU8(200),this.writeU16(G);else if(G<4294967296)this.writeU8(201),this.writeU32(G);else throw Error(`Too large extension object: ${G}`);this.writeI8(W.type),this.writeU8a(W.data)}writeU8(W){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,W),this.pos++}writeU8a(W){let G=W.length;this.ensureBufferSizeToWrite(G),this.bytes.set(W,this.pos),this.pos+=G}writeI8(W){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,W),this.pos++}writeU16(W){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,W),this.pos+=2}writeI16(W){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,W),this.pos+=2}writeU32(W){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,W),this.pos+=4}writeI32(W){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,W),this.pos+=4}writeF32(W){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,W),this.pos+=4}writeF64(W){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,W),this.pos+=8}writeU64(W){this.ensureBufferSizeToWrite(8),NC(this.view,this.pos,W),this.pos+=8}writeI64(W){this.ensureBufferSizeToWrite(8),_J(this.view,this.pos,W),this.pos+=8}writeBigUint64(W){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,W),this.pos+=8}writeBigInt64(W){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,W),this.pos+=8}}function qZ(W,G){return new vJ(G).encodeSharedRef(W)}function gJ(W){return`${W<0?"-":""}0x${Math.abs(W).toString(16).padStart(2,"0")}`}var Gy=16,Xy=16;class HA{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(W=Gy,G=Xy){this.maxKeyLength=W,this.maxLengthPerKey=G,this.caches=[];for(let X=0;X<this.maxKeyLength;X++)this.caches.push([])}canBeCached(W){return W>0&&W<=this.maxKeyLength}find(W,G,X){let Y=this.caches[X-1];W:for(let Z of Y){let V=Z.bytes;for(let Q=0;Q<X;Q++)if(V[Q]!==W[G+Q])continue W;return Z.str}return null}store(W,G){let X=this.caches[W.length-1],Y={bytes:W,str:G};if(X.length>=this.maxLengthPerKey)X[Math.random()*X.length|0]=Y;else X.push(Y)}decode(W,G,X){let Y=this.find(W,G,X);if(Y!=null)return this.hit++,Y;this.miss++;let Z=NA(W,G,X),V=Uint8Array.prototype.slice.call(W,G,G+X);return this.store(V,Z),Z}}var AA="array",HZ="map_key",IC="map_value",Yy=(W)=>{if(typeof W==="string"||typeof W==="number")return W;throw new $9("The type of key must be string or number but "+typeof W)};class wC{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(W){let G=this.getUninitializedStateFromPool();G.type=AA,G.position=0,G.size=W,G.array=Array(W)}pushMapState(W){let G=this.getUninitializedStateFromPool();G.type=HZ,G.readCount=0,G.size=W,G.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){let W={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(W)}return this.stack[this.stackHeadPosition]}release(W){if(this.stack[this.stackHeadPosition]!==W)throw Error("Invalid stack state. Released state is not on top of the stack.");if(W.type===AA){let X=W;X.size=0,X.array=void 0,X.position=0,X.type=void 0}if(W.type===HZ||W.type===IC){let X=W;X.size=0,X.map=void 0,X.readCount=0,X.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}var NZ=-1,zA=new DataView(new ArrayBuffer(0)),Zy=new Uint8Array(zA.buffer);try{zA.getInt8(0)}catch(W){if(!(W instanceof RangeError))throw Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var zC=RangeError("Insufficient data"),Vy=new HA;class uJ{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=zA;bytes=Zy;headByte=NZ;stack=new wC;entered=!1;constructor(W){this.extensionCodec=W?.extensionCodec??dG.defaultCodec,this.context=W?.context,this.useBigInt64=W?.useBigInt64??!1,this.rawStrings=W?.rawStrings??!1,this.maxStrLength=W?.maxStrLength??lG,this.maxBinLength=W?.maxBinLength??lG,this.maxArrayLength=W?.maxArrayLength??lG,this.maxMapLength=W?.maxMapLength??lG,this.maxExtLength=W?.maxExtLength??lG,this.keyDecoder=W?.keyDecoder!==void 0?W.keyDecoder:Vy,this.mapKeyConverter=W?.mapKeyConverter??Yy}clone(){return new uJ({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=NZ,this.stack.reset()}setBuffer(W){let G=UZ(W);this.bytes=G,this.view=new DataView(G.buffer,G.byteOffset,G.byteLength),this.pos=0}appendBuffer(W){if(this.headByte===NZ&&!this.hasRemaining(1))this.setBuffer(W);else{let G=this.bytes.subarray(this.pos),X=UZ(W),Y=new Uint8Array(G.length+X.length);Y.set(G),Y.set(X,G.length),this.setBuffer(Y)}}hasRemaining(W){return this.view.byteLength-this.pos>=W}createExtraByteError(W){let{view:G,pos:X}=this;return RangeError(`Extra ${G.byteLength-X} of ${G.byteLength} byte(s) found at buffer[${W}]`)}decode(W){if(this.entered)return this.clone().decode(W);try{this.entered=!0,this.reinitializeState(),this.setBuffer(W);let G=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return G}finally{this.entered=!1}}*decodeMulti(W){if(this.entered){yield*this.clone().decodeMulti(W);return}try{this.entered=!0,this.reinitializeState(),this.setBuffer(W);while(this.hasRemaining(1))yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(W){if(this.entered)return this.clone().decodeAsync(W);try{this.entered=!0;let G=!1,X;for await(let Q of W){if(G)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(Q);try{X=this.doDecodeSync(),G=!0}catch(J){if(!(J instanceof RangeError))throw J}this.totalPos+=this.pos}if(G){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return X}let{headByte:Y,pos:Z,totalPos:V}=this;throw RangeError(`Insufficient data in parsing ${gJ(Y)} at ${V} (${Z} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(W){return this.decodeMultiAsync(W,!0)}decodeStream(W){return this.decodeMultiAsync(W,!1)}async*decodeMultiAsync(W,G){if(this.entered){yield*this.clone().decodeMultiAsync(W,G);return}try{this.entered=!0;let X=G,Y=-1;for await(let Z of W){if(G&&Y===0)throw this.createExtraByteError(this.totalPos);if(this.appendBuffer(Z),X)Y=this.readArraySize(),X=!1,this.complete();try{while(!0)if(yield this.doDecodeSync(),--Y===0)break}catch(V){if(!(V instanceof RangeError))throw V}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){W:while(!0){let W=this.readHeadByte(),G;if(W>=224)G=W-256;else if(W<192)if(W<128)G=W;else if(W<144){let Y=W-128;if(Y!==0){this.pushMapState(Y),this.complete();continue W}else G={}}else if(W<160){let Y=W-144;if(Y!==0){this.pushArrayState(Y),this.complete();continue W}else G=[]}else{let Y=W-160;G=this.decodeString(Y,0)}else if(W===192)G=null;else if(W===194)G=!1;else if(W===195)G=!0;else if(W===202)G=this.readF32();else if(W===203)G=this.readF64();else if(W===204)G=this.readU8();else if(W===205)G=this.readU16();else if(W===206)G=this.readU32();else if(W===207)if(this.useBigInt64)G=this.readU64AsBigInt();else G=this.readU64();else if(W===208)G=this.readI8();else if(W===209)G=this.readI16();else if(W===210)G=this.readI32();else if(W===211)if(this.useBigInt64)G=this.readI64AsBigInt();else G=this.readI64();else if(W===217){let Y=this.lookU8();G=this.decodeString(Y,1)}else if(W===218){let Y=this.lookU16();G=this.decodeString(Y,2)}else if(W===219){let Y=this.lookU32();G=this.decodeString(Y,4)}else if(W===220){let Y=this.readU16();if(Y!==0){this.pushArrayState(Y),this.complete();continue W}else G=[]}else if(W===221){let Y=this.readU32();if(Y!==0){this.pushArrayState(Y),this.complete();continue W}else G=[]}else if(W===222){let Y=this.readU16();if(Y!==0){this.pushMapState(Y),this.complete();continue W}else G={}}else if(W===223){let Y=this.readU32();if(Y!==0){this.pushMapState(Y),this.complete();continue W}else G={}}else if(W===196){let Y=this.lookU8();G=this.decodeBinary(Y,1)}else if(W===197){let Y=this.lookU16();G=this.decodeBinary(Y,2)}else if(W===198){let Y=this.lookU32();G=this.decodeBinary(Y,4)}else if(W===212)G=this.decodeExtension(1,0);else if(W===213)G=this.decodeExtension(2,0);else if(W===214)G=this.decodeExtension(4,0);else if(W===215)G=this.decodeExtension(8,0);else if(W===216)G=this.decodeExtension(16,0);else if(W===199){let Y=this.lookU8();G=this.decodeExtension(Y,1)}else if(W===200){let Y=this.lookU16();G=this.decodeExtension(Y,2)}else if(W===201){let Y=this.lookU32();G=this.decodeExtension(Y,4)}else throw new $9(`Unrecognized type byte: ${gJ(W)}`);this.complete();let X=this.stack;while(X.length>0){let Y=X.top();if(Y.type===AA)if(Y.array[Y.position]=G,Y.position++,Y.position===Y.size)G=Y.array,X.release(Y);else continue W;else if(Y.type===HZ){if(G==="__proto__")throw new $9("The key __proto__ is not allowed");Y.key=this.mapKeyConverter(G),Y.type=IC;continue W}else if(Y.map[Y.key]=G,Y.readCount++,Y.readCount===Y.size)G=Y.map,X.release(Y);else{Y.key=null,Y.type=HZ;continue W}}return G}}readHeadByte(){if(this.headByte===NZ)this.headByte=this.readU8();return this.headByte}complete(){this.headByte=NZ}readArraySize(){let W=this.readHeadByte();switch(W){case 220:return this.readU16();case 221:return this.readU32();default:if(W<160)return W-144;else throw new $9(`Unrecognized array type byte: ${gJ(W)}`)}}pushMapState(W){if(W>this.maxMapLength)throw new $9(`Max length exceeded: map length (${W}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(W)}pushArrayState(W){if(W>this.maxArrayLength)throw new $9(`Max length exceeded: array length (${W}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(W)}decodeString(W,G){if(!this.rawStrings||this.stateIsMapKey())return this.decodeUtf8String(W,G);return this.decodeBinary(W,G)}decodeUtf8String(W,G){if(W>this.maxStrLength)throw new $9(`Max length exceeded: UTF-8 byte length (${W}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+G+W)throw zC;let X=this.pos+G,Y;if(this.stateIsMapKey()&&this.keyDecoder?.canBeCached(W))Y=this.keyDecoder.decode(this.bytes,X,W);else Y=qC(this.bytes,X,W);return this.pos+=G+W,Y}stateIsMapKey(){if(this.stack.length>0)return this.stack.top().type===HZ;return!1}decodeBinary(W,G){if(W>this.maxBinLength)throw new $9(`Max length exceeded: bin length (${W}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(W+G))throw zC;let X=this.pos+G,Y=this.bytes.subarray(X,X+W);return this.pos+=G+W,Y}decodeExtension(W,G){if(W>this.maxExtLength)throw new $9(`Max length exceeded: ext length (${W}) > maxExtLength (${this.maxExtLength})`);let X=this.view.getInt8(this.pos+G),Y=this.decodeBinary(W,G+1);return this.extensionCodec.decode(Y,X,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let W=this.view.getUint8(this.pos);return this.pos++,W}readI8(){let W=this.view.getInt8(this.pos);return this.pos++,W}readU16(){let W=this.view.getUint16(this.pos);return this.pos+=2,W}readI16(){let W=this.view.getInt16(this.pos);return this.pos+=2,W}readU32(){let W=this.view.getUint32(this.pos);return this.pos+=4,W}readI32(){let W=this.view.getInt32(this.pos);return this.pos+=4,W}readU64(){let W=HC(this.view,this.pos);return this.pos+=8,W}readI64(){let W=yJ(this.view,this.pos);return this.pos+=8,W}readU64AsBigInt(){let W=this.view.getBigUint64(this.pos);return this.pos+=8,W}readI64AsBigInt(){let W=this.view.getBigInt64(this.pos);return this.pos+=8,W}readF32(){let W=this.view.getFloat32(this.pos);return this.pos+=4,W}readF64(){let W=this.view.getFloat64(this.pos);return this.pos+=8,W}}function HW(W,G){return new uJ(G).decode(W)}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function sG(W){let G=W.length;while(--G>=0)W[G]=0}var Qy=0,WD=1,Jy=2,Uy=3,qy=258,uA=29,BZ=256,KZ=BZ+1+uA,iG=30,hA=19,GD=2*KZ+1,AW=15,IA=16,Ny=7,bA=256,XD=16,YD=17,ZD=18,$A=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),pJ=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Hy=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),VD=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ay=512,r7=Array((KZ+2)*2);sG(r7);var wZ=Array(iG*2);sG(wZ);var CZ=Array(Ay);sG(CZ);var DZ=Array(qy-Uy+1);sG(DZ);var mA=Array(uA);sG(mA);var lJ=Array(iG);sG(lJ);function wA(W,G,X,Y,Z){this.static_tree=W,this.extra_bits=G,this.extra_base=X,this.elems=Y,this.max_length=Z,this.has_stree=W&&W.length}var QD,JD,UD;function jA(W,G){this.dyn_tree=W,this.max_code=0,this.stat_desc=G}var qD=(W)=>{return W<256?CZ[W]:CZ[256+(W>>>7)]},MZ=(W,G)=>{W.pending_buf[W.pending++]=G&255,W.pending_buf[W.pending++]=G>>>8&255},g9=(W,G,X)=>{if(W.bi_valid>IA-X)W.bi_buf|=G<<W.bi_valid&65535,MZ(W,W.bi_buf),W.bi_buf=G>>IA-W.bi_valid,W.bi_valid+=X-IA;else W.bi_buf|=G<<W.bi_valid&65535,W.bi_valid+=X},J7=(W,G,X)=>{g9(W,X[G*2],X[G*2+1])},ND=(W,G)=>{let X=0;do X|=W&1,W>>>=1,X<<=1;while(--G>0);return X>>>1},zy=(W)=>{if(W.bi_valid===16)MZ(W,W.bi_buf),W.bi_buf=0,W.bi_valid=0;else if(W.bi_valid>=8)W.pending_buf[W.pending++]=W.bi_buf&255,W.bi_buf>>=8,W.bi_valid-=8},Iy=(W,G)=>{let{dyn_tree:X,max_code:Y}=G,Z=G.stat_desc.static_tree,V=G.stat_desc.has_stree,Q=G.stat_desc.extra_bits,J=G.stat_desc.extra_base,U=G.stat_desc.max_length,q,N,A,H,I,w,C=0;for(H=0;H<=AW;H++)W.bl_count[H]=0;X[W.heap[W.heap_max]*2+1]=0;for(q=W.heap_max+1;q<GD;q++){if(N=W.heap[q],H=X[X[N*2+1]*2+1]+1,H>U)H=U,C++;if(X[N*2+1]=H,N>Y)continue;if(W.bl_count[H]++,I=0,N>=J)I=Q[N-J];if(w=X[N*2],W.opt_len+=w*(H+I),V)W.static_len+=w*(Z[N*2+1]+I)}if(C===0)return;do{H=U-1;while(W.bl_count[H]===0)H--;W.bl_count[H]--,W.bl_count[H+1]+=2,W.bl_count[U]--,C-=2}while(C>0);for(H=U;H!==0;H--){N=W.bl_count[H];while(N!==0){if(A=W.heap[--q],A>Y)continue;if(X[A*2+1]!==H)W.opt_len+=(H-X[A*2+1])*X[A*2],X[A*2+1]=H;N--}}},HD=(W,G,X)=>{let Y=Array(AW+1),Z=0,V,Q;for(V=1;V<=AW;V++)Z=Z+X[V-1]<<1,Y[V]=Z;for(Q=0;Q<=G;Q++){let J=W[Q*2+1];if(J===0)continue;W[Q*2]=ND(Y[J]++,J)}},wy=()=>{let W,G,X,Y,Z,V=Array(AW+1);X=0;for(Y=0;Y<uA-1;Y++){mA[Y]=X;for(W=0;W<1<<$A[Y];W++)DZ[X++]=Y}DZ[X-1]=Y,Z=0;for(Y=0;Y<16;Y++){lJ[Y]=Z;for(W=0;W<1<<pJ[Y];W++)CZ[Z++]=Y}Z>>=7;for(;Y<iG;Y++){lJ[Y]=Z<<7;for(W=0;W<1<<pJ[Y]-7;W++)CZ[256+Z++]=Y}for(G=0;G<=AW;G++)V[G]=0;W=0;while(W<=143)r7[W*2+1]=8,W++,V[8]++;while(W<=255)r7[W*2+1]=9,W++,V[9]++;while(W<=279)r7[W*2+1]=7,W++,V[7]++;while(W<=287)r7[W*2+1]=8,W++,V[8]++;HD(r7,KZ+1,V);for(W=0;W<iG;W++)wZ[W*2+1]=5,wZ[W*2]=ND(W,5);QD=new wA(r7,$A,BZ+1,KZ,AW),JD=new wA(wZ,pJ,0,iG,AW),UD=new wA([],Hy,0,hA,Ny)},AD=(W)=>{let G;for(G=0;G<KZ;G++)W.dyn_ltree[G*2]=0;for(G=0;G<iG;G++)W.dyn_dtree[G*2]=0;for(G=0;G<hA;G++)W.bl_tree[G*2]=0;W.dyn_ltree[bA*2]=1,W.opt_len=W.static_len=0,W.sym_next=W.matches=0},zD=(W)=>{if(W.bi_valid>8)MZ(W,W.bi_buf);else if(W.bi_valid>0)W.pending_buf[W.pending++]=W.bi_buf;W.bi_buf=0,W.bi_valid=0},jC=(W,G,X,Y)=>{let Z=G*2,V=X*2;return W[Z]<W[V]||W[Z]===W[V]&&Y[G]<=Y[X]},OA=(W,G,X)=>{let Y=W.heap[X],Z=X<<1;while(Z<=W.heap_len){if(Z<W.heap_len&&jC(G,W.heap[Z+1],W.heap[Z],W.depth))Z++;if(jC(G,Y,W.heap[Z],W.depth))break;W.heap[X]=W.heap[Z],X=Z,Z<<=1}W.heap[X]=Y},OC=(W,G,X)=>{let Y,Z,V=0,Q,J;if(W.sym_next!==0)do if(Y=W.pending_buf[W.sym_buf+V++]&255,Y+=(W.pending_buf[W.sym_buf+V++]&255)<<8,Z=W.pending_buf[W.sym_buf+V++],Y===0)J7(W,Z,G);else{if(Q=DZ[Z],J7(W,Q+BZ+1,G),J=$A[Q],J!==0)Z-=mA[Q],g9(W,Z,J);if(Y--,Q=qD(Y),J7(W,Q,X),J=pJ[Q],J!==0)Y-=lJ[Q],g9(W,Y,J)}while(V<W.sym_next);J7(W,bA,G)},FA=(W,G)=>{let X=G.dyn_tree,Y=G.stat_desc.static_tree,Z=G.stat_desc.has_stree,V=G.stat_desc.elems,Q,J,U=-1,q;W.heap_len=0,W.heap_max=GD;for(Q=0;Q<V;Q++)if(X[Q*2]!==0)W.heap[++W.heap_len]=U=Q,W.depth[Q]=0;else X[Q*2+1]=0;while(W.heap_len<2)if(q=W.heap[++W.heap_len]=U<2?++U:0,X[q*2]=1,W.depth[q]=0,W.opt_len--,Z)W.static_len-=Y[q*2+1];G.max_code=U;for(Q=W.heap_len>>1;Q>=1;Q--)OA(W,X,Q);q=V;do Q=W.heap[1],W.heap[1]=W.heap[W.heap_len--],OA(W,X,1),J=W.heap[1],W.heap[--W.heap_max]=Q,W.heap[--W.heap_max]=J,X[q*2]=X[Q*2]+X[J*2],W.depth[q]=(W.depth[Q]>=W.depth[J]?W.depth[Q]:W.depth[J])+1,X[Q*2+1]=X[J*2+1]=q,W.heap[1]=q++,OA(W,X,1);while(W.heap_len>=2);W.heap[--W.heap_max]=W.heap[1],Iy(W,G),HD(X,U,W.bl_count)},KC=(W,G,X)=>{let Y,Z=-1,V,Q=G[1],J=0,U=7,q=4;if(Q===0)U=138,q=3;G[(X+1)*2+1]=65535;for(Y=0;Y<=X;Y++){if(V=Q,Q=G[(Y+1)*2+1],++J<U&&V===Q)continue;else if(J<q)W.bl_tree[V*2]+=J;else if(V!==0){if(V!==Z)W.bl_tree[V*2]++;W.bl_tree[XD*2]++}else if(J<=10)W.bl_tree[YD*2]++;else W.bl_tree[ZD*2]++;if(J=0,Z=V,Q===0)U=138,q=3;else if(V===Q)U=6,q=3;else U=7,q=4}},CC=(W,G,X)=>{let Y,Z=-1,V,Q=G[1],J=0,U=7,q=4;if(Q===0)U=138,q=3;for(Y=0;Y<=X;Y++){if(V=Q,Q=G[(Y+1)*2+1],++J<U&&V===Q)continue;else if(J<q)do J7(W,V,W.bl_tree);while(--J!==0);else if(V!==0){if(V!==Z)J7(W,V,W.bl_tree),J--;J7(W,XD,W.bl_tree),g9(W,J-3,2)}else if(J<=10)J7(W,YD,W.bl_tree),g9(W,J-3,3);else J7(W,ZD,W.bl_tree),g9(W,J-11,7);if(J=0,Z=V,Q===0)U=138,q=3;else if(V===Q)U=6,q=3;else U=7,q=4}},jy=(W)=>{let G;KC(W,W.dyn_ltree,W.l_desc.max_code),KC(W,W.dyn_dtree,W.d_desc.max_code),FA(W,W.bl_desc);for(G=hA-1;G>=3;G--)if(W.bl_tree[VD[G]*2+1]!==0)break;return W.opt_len+=3*(G+1)+5+5+4,G},Oy=(W,G,X,Y)=>{let Z;g9(W,G-257,5),g9(W,X-1,5),g9(W,Y-4,4);for(Z=0;Z<Y;Z++)g9(W,W.bl_tree[VD[Z]*2+1],3);CC(W,W.dyn_ltree,G-1),CC(W,W.dyn_dtree,X-1)},Ky=(W)=>{let G=4093624447,X;for(X=0;X<=31;X++,G>>>=1)if(G&1&&W.dyn_ltree[X*2]!==0)return 0;if(W.dyn_ltree[18]!==0||W.dyn_ltree[20]!==0||W.dyn_ltree[26]!==0)return 1;for(X=32;X<BZ;X++)if(W.dyn_ltree[X*2]!==0)return 1;return 0},DC=!1,Cy=(W)=>{if(!DC)wy(),DC=!0;W.l_desc=new jA(W.dyn_ltree,QD),W.d_desc=new jA(W.dyn_dtree,JD),W.bl_desc=new jA(W.bl_tree,UD),W.bi_buf=0,W.bi_valid=0,AD(W)},ID=(W,G,X,Y)=>{if(g9(W,(Qy<<1)+(Y?1:0),3),zD(W),MZ(W,X),MZ(W,~X),X)W.pending_buf.set(W.window.subarray(G,G+X),W.pending);W.pending+=X},Dy=(W)=>{g9(W,WD<<1,3),J7(W,bA,r7),zy(W)},My=(W,G,X,Y)=>{let Z,V,Q=0;if(W.level>0){if(W.strm.data_type===2)W.strm.data_type=Ky(W);if(FA(W,W.l_desc),FA(W,W.d_desc),Q=jy(W),Z=W.opt_len+3+7>>>3,V=W.static_len+3+7>>>3,V<=Z)Z=V}else Z=V=X+5;if(X+4<=Z&&G!==-1)ID(W,G,X,Y);else if(W.strategy===4||V===Z)g9(W,(WD<<1)+(Y?1:0),3),OC(W,r7,wZ);else g9(W,(Jy<<1)+(Y?1:0),3),Oy(W,W.l_desc.max_code+1,W.d_desc.max_code+1,Q+1),OC(W,W.dyn_ltree,W.dyn_dtree);if(AD(W),Y)zD(W)},Ty=(W,G,X)=>{if(W.pending_buf[W.sym_buf+W.sym_next++]=G,W.pending_buf[W.sym_buf+W.sym_next++]=G>>8,W.pending_buf[W.sym_buf+W.sym_next++]=X,G===0)W.dyn_ltree[X*2]++;else W.matches++,G--,W.dyn_ltree[(DZ[X]+BZ+1)*2]++,W.dyn_dtree[qD(G)*2]++;return W.sym_next===W.sym_end},Py=Cy,Ry=ID,Ly=My,By=Ty,Ey=Dy,$y={_tr_init:Py,_tr_stored_block:Ry,_tr_flush_block:Ly,_tr_tally:By,_tr_align:Ey},Fy=(W,G,X,Y)=>{let Z=W&65535|0,V=W>>>16&65535|0,Q=0;while(X!==0){Q=X>2000?2000:X,X-=Q;do Z=Z+G[Y++]|0,V=V+Z|0;while(--Q);Z%=65521,V%=65521}return Z|V<<16|0},TZ=Fy,Sy=()=>{let W,G=[];for(var X=0;X<256;X++){W=X;for(var Y=0;Y<8;Y++)W=W&1?3988292384^W>>>1:W>>>1;G[X]=W}return G},xy=new Uint32Array(Sy()),ky=(W,G,X,Y)=>{let Z=xy,V=Y+X;W^=-1;for(let Q=Y;Q<V;Q++)W=W>>>8^Z[(W^G[Q])&255];return W^-1},d8=ky,wW={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},KW={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:_y,_tr_stored_block:SA,_tr_flush_block:yy,_tr_tally:V6,_tr_align:vy}=$y,{Z_NO_FLUSH:Q6,Z_PARTIAL_FLUSH:gy,Z_FULL_FLUSH:uy,Z_FINISH:A5,Z_BLOCK:MC,Z_OK:a8,Z_STREAM_END:TC,Z_STREAM_ERROR:U7,Z_DATA_ERROR:hy,Z_BUF_ERROR:KA,Z_DEFAULT_COMPRESSION:by,Z_FILTERED:my,Z_HUFFMAN_ONLY:hJ,Z_RLE:fy,Z_FIXED:cy,Z_DEFAULT_STRATEGY:py,Z_UNKNOWN:ly,Z_DEFLATED:nJ}=KW,dy=9,oy=15,ny=8,iy=29,ry=256,xA=ry+1+iy,ay=30,sy=19,ty=2*xA+1,ey=15,y1=3,Z6=258,q7=Z6+y1+1,Wv=32,rG=42,fA=57,kA=69,_A=73,yA=91,vA=103,zW=113,zZ=666,F9=1,tG=2,jW=3,eG=4,Gv=3,IW=(W,G)=>{return W.msg=wW[G],G},PC=(W)=>{return W*2-(W>4?9:0)},Y6=(W)=>{let G=W.length;while(--G>=0)W[G]=0},Xv=(W)=>{let G,X,Y,Z=W.w_size;G=W.hash_size,Y=G;do X=W.head[--Y],W.head[Y]=X>=Z?X-Z:0;while(--G);G=Z,Y=G;do X=W.prev[--Y],W.prev[Y]=X>=Z?X-Z:0;while(--G)},Yv=(W,G,X)=>(G<<W.hash_shift^X)&W.hash_mask,J6=Yv,s9=(W)=>{let G=W.state,X=G.pending;if(X>W.avail_out)X=W.avail_out;if(X===0)return;if(W.output.set(G.pending_buf.subarray(G.pending_out,G.pending_out+X),W.next_out),W.next_out+=X,G.pending_out+=X,W.total_out+=X,W.avail_out-=X,G.pending-=X,G.pending===0)G.pending_out=0},t9=(W,G)=>{yy(W,W.block_start>=0?W.block_start:-1,W.strstart-W.block_start,G),W.block_start=W.strstart,s9(W.strm)},n1=(W,G)=>{W.pending_buf[W.pending++]=G},AZ=(W,G)=>{W.pending_buf[W.pending++]=G>>>8&255,W.pending_buf[W.pending++]=G&255},gA=(W,G,X,Y)=>{let Z=W.avail_in;if(Z>Y)Z=Y;if(Z===0)return 0;if(W.avail_in-=Z,G.set(W.input.subarray(W.next_in,W.next_in+Z),X),W.state.wrap===1)W.adler=TZ(W.adler,G,Z,X);else if(W.state.wrap===2)W.adler=d8(W.adler,G,Z,X);return W.next_in+=Z,W.total_in+=Z,Z},wD=(W,G)=>{let{max_chain_length:X,strstart:Y}=W,Z,V,Q=W.prev_length,J=W.nice_match,U=W.strstart>W.w_size-q7?W.strstart-(W.w_size-q7):0,q=W.window,N=W.w_mask,A=W.prev,H=W.strstart+Z6,I=q[Y+Q-1],w=q[Y+Q];if(W.prev_length>=W.good_match)X>>=2;if(J>W.lookahead)J=W.lookahead;do{if(Z=G,q[Z+Q]!==w||q[Z+Q-1]!==I||q[Z]!==q[Y]||q[++Z]!==q[Y+1])continue;Y+=2,Z++;do;while(q[++Y]===q[++Z]&&q[++Y]===q[++Z]&&q[++Y]===q[++Z]&&q[++Y]===q[++Z]&&q[++Y]===q[++Z]&&q[++Y]===q[++Z]&&q[++Y]===q[++Z]&&q[++Y]===q[++Z]&&Y<H);if(V=Z6-(H-Y),Y=H-Z6,V>Q){if(W.match_start=G,Q=V,V>=J)break;I=q[Y+Q-1],w=q[Y+Q]}}while((G=A[G&N])>U&&--X!==0);if(Q<=W.lookahead)return Q;return W.lookahead},aG=(W)=>{let G=W.w_size,X,Y,Z;do{if(Y=W.window_size-W.lookahead-W.strstart,W.strstart>=G+(G-q7)){if(W.window.set(W.window.subarray(G,G+G-Y),0),W.match_start-=G,W.strstart-=G,W.block_start-=G,W.insert>W.strstart)W.insert=W.strstart;Xv(W),Y+=G}if(W.strm.avail_in===0)break;if(X=gA(W.strm,W.window,W.strstart+W.lookahead,Y),W.lookahead+=X,W.lookahead+W.insert>=y1){Z=W.strstart-W.insert,W.ins_h=W.window[Z],W.ins_h=J6(W,W.ins_h,W.window[Z+1]);while(W.insert)if(W.ins_h=J6(W,W.ins_h,W.window[Z+y1-1]),W.prev[Z&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=Z,Z++,W.insert--,W.lookahead+W.insert<y1)break}}while(W.lookahead<q7&&W.strm.avail_in!==0)},jD=(W,G)=>{let X=W.pending_buf_size-5>W.w_size?W.w_size:W.pending_buf_size-5,Y,Z,V,Q=0,J=W.strm.avail_in;do{if(Y=65535,V=W.bi_valid+42>>3,W.strm.avail_out<V)break;if(V=W.strm.avail_out-V,Z=W.strstart-W.block_start,Y>Z+W.strm.avail_in)Y=Z+W.strm.avail_in;if(Y>V)Y=V;if(Y<X&&(Y===0&&G!==A5||G===Q6||Y!==Z+W.strm.avail_in))break;if(Q=G===A5&&Y===Z+W.strm.avail_in?1:0,SA(W,0,0,Q),W.pending_buf[W.pending-4]=Y,W.pending_buf[W.pending-3]=Y>>8,W.pending_buf[W.pending-2]=~Y,W.pending_buf[W.pending-1]=~Y>>8,s9(W.strm),Z){if(Z>Y)Z=Y;W.strm.output.set(W.window.subarray(W.block_start,W.block_start+Z),W.strm.next_out),W.strm.next_out+=Z,W.strm.avail_out-=Z,W.strm.total_out+=Z,W.block_start+=Z,Y-=Z}if(Y)gA(W.strm,W.strm.output,W.strm.next_out,Y),W.strm.next_out+=Y,W.strm.avail_out-=Y,W.strm.total_out+=Y}while(Q===0);if(J-=W.strm.avail_in,J){if(J>=W.w_size)W.matches=2,W.window.set(W.strm.input.subarray(W.strm.next_in-W.w_size,W.strm.next_in),0),W.strstart=W.w_size,W.insert=W.strstart;else{if(W.window_size-W.strstart<=J){if(W.strstart-=W.w_size,W.window.set(W.window.subarray(W.w_size,W.w_size+W.strstart),0),W.matches<2)W.matches++;if(W.insert>W.strstart)W.insert=W.strstart}W.window.set(W.strm.input.subarray(W.strm.next_in-J,W.strm.next_in),W.strstart),W.strstart+=J,W.insert+=J>W.w_size-W.insert?W.w_size-W.insert:J}W.block_start=W.strstart}if(W.high_water<W.strstart)W.high_water=W.strstart;if(Q)return eG;if(G!==Q6&&G!==A5&&W.strm.avail_in===0&&W.strstart===W.block_start)return tG;if(V=W.window_size-W.strstart,W.strm.avail_in>V&&W.block_start>=W.w_size){if(W.block_start-=W.w_size,W.strstart-=W.w_size,W.window.set(W.window.subarray(W.w_size,W.w_size+W.strstart),0),W.matches<2)W.matches++;if(V+=W.w_size,W.insert>W.strstart)W.insert=W.strstart}if(V>W.strm.avail_in)V=W.strm.avail_in;if(V)gA(W.strm,W.window,W.strstart,V),W.strstart+=V,W.insert+=V>W.w_size-W.insert?W.w_size-W.insert:V;if(W.high_water<W.strstart)W.high_water=W.strstart;if(V=W.bi_valid+42>>3,V=W.pending_buf_size-V>65535?65535:W.pending_buf_size-V,X=V>W.w_size?W.w_size:V,Z=W.strstart-W.block_start,Z>=X||(Z||G===A5)&&G!==Q6&&W.strm.avail_in===0&&Z<=V)Y=Z>V?V:Z,Q=G===A5&&W.strm.avail_in===0&&Y===Z?1:0,SA(W,W.block_start,Y,Q),W.block_start+=Y,s9(W.strm);return Q?jW:F9},CA=(W,G)=>{let X,Y;for(;;){if(W.lookahead<q7){if(aG(W),W.lookahead<q7&&G===Q6)return F9;if(W.lookahead===0)break}if(X=0,W.lookahead>=y1)W.ins_h=J6(W,W.ins_h,W.window[W.strstart+y1-1]),X=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart;if(X!==0&&W.strstart-X<=W.w_size-q7)W.match_length=wD(W,X);if(W.match_length>=y1)if(Y=V6(W,W.strstart-W.match_start,W.match_length-y1),W.lookahead-=W.match_length,W.match_length<=W.max_lazy_match&&W.lookahead>=y1){W.match_length--;do W.strstart++,W.ins_h=J6(W,W.ins_h,W.window[W.strstart+y1-1]),X=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart;while(--W.match_length!==0);W.strstart++}else W.strstart+=W.match_length,W.match_length=0,W.ins_h=W.window[W.strstart],W.ins_h=J6(W,W.ins_h,W.window[W.strstart+1]);else Y=V6(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++;if(Y){if(t9(W,!1),W.strm.avail_out===0)return F9}}if(W.insert=W.strstart<y1-1?W.strstart:y1-1,G===A5){if(t9(W,!0),W.strm.avail_out===0)return jW;return eG}if(W.sym_next){if(t9(W,!1),W.strm.avail_out===0)return F9}return tG},oG=(W,G)=>{let X,Y,Z;for(;;){if(W.lookahead<q7){if(aG(W),W.lookahead<q7&&G===Q6)return F9;if(W.lookahead===0)break}if(X=0,W.lookahead>=y1)W.ins_h=J6(W,W.ins_h,W.window[W.strstart+y1-1]),X=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart;if(W.prev_length=W.match_length,W.prev_match=W.match_start,W.match_length=y1-1,X!==0&&W.prev_length<W.max_lazy_match&&W.strstart-X<=W.w_size-q7){if(W.match_length=wD(W,X),W.match_length<=5&&(W.strategy===my||W.match_length===y1&&W.strstart-W.match_start>4096))W.match_length=y1-1}if(W.prev_length>=y1&&W.match_length<=W.prev_length){Z=W.strstart+W.lookahead-y1,Y=V6(W,W.strstart-1-W.prev_match,W.prev_length-y1),W.lookahead-=W.prev_length-1,W.prev_length-=2;do if(++W.strstart<=Z)W.ins_h=J6(W,W.ins_h,W.window[W.strstart+y1-1]),X=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart;while(--W.prev_length!==0);if(W.match_available=0,W.match_length=y1-1,W.strstart++,Y){if(t9(W,!1),W.strm.avail_out===0)return F9}}else if(W.match_available){if(Y=V6(W,0,W.window[W.strstart-1]),Y)t9(W,!1);if(W.strstart++,W.lookahead--,W.strm.avail_out===0)return F9}else W.match_available=1,W.strstart++,W.lookahead--}if(W.match_available)Y=V6(W,0,W.window[W.strstart-1]),W.match_available=0;if(W.insert=W.strstart<y1-1?W.strstart:y1-1,G===A5){if(t9(W,!0),W.strm.avail_out===0)return jW;return eG}if(W.sym_next){if(t9(W,!1),W.strm.avail_out===0)return F9}return tG},Zv=(W,G)=>{let X,Y,Z,V,Q=W.window;for(;;){if(W.lookahead<=Z6){if(aG(W),W.lookahead<=Z6&&G===Q6)return F9;if(W.lookahead===0)break}if(W.match_length=0,W.lookahead>=y1&&W.strstart>0){if(Z=W.strstart-1,Y=Q[Z],Y===Q[++Z]&&Y===Q[++Z]&&Y===Q[++Z]){V=W.strstart+Z6;do;while(Y===Q[++Z]&&Y===Q[++Z]&&Y===Q[++Z]&&Y===Q[++Z]&&Y===Q[++Z]&&Y===Q[++Z]&&Y===Q[++Z]&&Y===Q[++Z]&&Z<V);if(W.match_length=Z6-(V-Z),W.match_length>W.lookahead)W.match_length=W.lookahead}}if(W.match_length>=y1)X=V6(W,1,W.match_length-y1),W.lookahead-=W.match_length,W.strstart+=W.match_length,W.match_length=0;else X=V6(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++;if(X){if(t9(W,!1),W.strm.avail_out===0)return F9}}if(W.insert=0,G===A5){if(t9(W,!0),W.strm.avail_out===0)return jW;return eG}if(W.sym_next){if(t9(W,!1),W.strm.avail_out===0)return F9}return tG},Vv=(W,G)=>{let X;for(;;){if(W.lookahead===0){if(aG(W),W.lookahead===0){if(G===Q6)return F9;break}}if(W.match_length=0,X=V6(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++,X){if(t9(W,!1),W.strm.avail_out===0)return F9}}if(W.insert=0,G===A5){if(t9(W,!0),W.strm.avail_out===0)return jW;return eG}if(W.sym_next){if(t9(W,!1),W.strm.avail_out===0)return F9}return tG};function Q7(W,G,X,Y,Z){this.good_length=W,this.max_lazy=G,this.nice_length=X,this.max_chain=Y,this.func=Z}var IZ=[new Q7(0,0,0,0,jD),new Q7(4,4,8,4,CA),new Q7(4,5,16,8,CA),new Q7(4,6,32,32,CA),new Q7(4,4,16,16,oG),new Q7(8,16,32,32,oG),new Q7(8,16,128,128,oG),new Q7(8,32,128,256,oG),new Q7(32,128,258,1024,oG),new Q7(32,258,258,4096,oG)],Qv=(W)=>{W.window_size=2*W.w_size,Y6(W.head),W.max_lazy_match=IZ[W.level].max_lazy,W.good_match=IZ[W.level].good_length,W.nice_match=IZ[W.level].nice_length,W.max_chain_length=IZ[W.level].max_chain,W.strstart=0,W.block_start=0,W.lookahead=0,W.insert=0,W.match_length=W.prev_length=y1-1,W.match_available=0,W.ins_h=0};function Jv(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=nJ,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(ty*2),this.dyn_dtree=new Uint16Array((2*ay+1)*2),this.bl_tree=new Uint16Array((2*sy+1)*2),Y6(this.dyn_ltree),Y6(this.dyn_dtree),Y6(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(ey+1),this.heap=new Uint16Array(2*xA+1),Y6(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*xA+1),Y6(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var EZ=(W)=>{if(!W)return 1;let G=W.state;if(!G||G.strm!==W||G.status!==rG&&G.status!==fA&&G.status!==kA&&G.status!==_A&&G.status!==yA&&G.status!==vA&&G.status!==zW&&G.status!==zZ)return 1;return 0},OD=(W)=>{if(EZ(W))return IW(W,U7);W.total_in=W.total_out=0,W.data_type=ly;let G=W.state;if(G.pending=0,G.pending_out=0,G.wrap<0)G.wrap=-G.wrap;return G.status=G.wrap===2?fA:G.wrap?rG:zW,W.adler=G.wrap===2?0:1,G.last_flush=-2,_y(G),a8},KD=(W)=>{let G=OD(W);if(G===a8)Qv(W.state);return G},Uv=(W,G)=>{if(EZ(W)||W.state.wrap!==2)return U7;return W.state.gzhead=G,a8},CD=(W,G,X,Y,Z,V)=>{if(!W)return U7;let Q=1;if(G===by)G=6;if(Y<0)Q=0,Y=-Y;else if(Y>15)Q=2,Y-=16;if(Z<1||Z>dy||X!==nJ||Y<8||Y>15||G<0||G>9||V<0||V>cy||Y===8&&Q!==1)return IW(W,U7);if(Y===8)Y=9;let J=new Jv;return W.state=J,J.strm=W,J.status=rG,J.wrap=Q,J.gzhead=null,J.w_bits=Y,J.w_size=1<<J.w_bits,J.w_mask=J.w_size-1,J.hash_bits=Z+7,J.hash_size=1<<J.hash_bits,J.hash_mask=J.hash_size-1,J.hash_shift=~~((J.hash_bits+y1-1)/y1),J.window=new Uint8Array(J.w_size*2),J.head=new Uint16Array(J.hash_size),J.prev=new Uint16Array(J.w_size),J.lit_bufsize=1<<Z+6,J.pending_buf_size=J.lit_bufsize*4,J.pending_buf=new Uint8Array(J.pending_buf_size),J.sym_buf=J.lit_bufsize,J.sym_end=(J.lit_bufsize-1)*3,J.level=G,J.strategy=V,J.method=X,KD(W)},qv=(W,G)=>{return CD(W,G,nJ,oy,ny,py)},Nv=(W,G)=>{if(EZ(W)||G>MC||G<0)return W?IW(W,U7):U7;let X=W.state;if(!W.output||W.avail_in!==0&&!W.input||X.status===zZ&&G!==A5)return IW(W,W.avail_out===0?KA:U7);let Y=X.last_flush;if(X.last_flush=G,X.pending!==0){if(s9(W),W.avail_out===0)return X.last_flush=-1,a8}else if(W.avail_in===0&&PC(G)<=PC(Y)&&G!==A5)return IW(W,KA);if(X.status===zZ&&W.avail_in!==0)return IW(W,KA);if(X.status===rG&&X.wrap===0)X.status=zW;if(X.status===rG){let Z=nJ+(X.w_bits-8<<4)<<8,V=-1;if(X.strategy>=hJ||X.level<2)V=0;else if(X.level<6)V=1;else if(X.level===6)V=2;else V=3;if(Z|=V<<6,X.strstart!==0)Z|=Wv;if(Z+=31-Z%31,AZ(X,Z),X.strstart!==0)AZ(X,W.adler>>>16),AZ(X,W.adler&65535);if(W.adler=1,X.status=zW,s9(W),X.pending!==0)return X.last_flush=-1,a8}if(X.status===fA)if(W.adler=0,n1(X,31),n1(X,139),n1(X,8),!X.gzhead){if(n1(X,0),n1(X,0),n1(X,0),n1(X,0),n1(X,0),n1(X,X.level===9?2:X.strategy>=hJ||X.level<2?4:0),n1(X,Gv),X.status=zW,s9(W),X.pending!==0)return X.last_flush=-1,a8}else{if(n1(X,(X.gzhead.text?1:0)+(X.gzhead.hcrc?2:0)+(!X.gzhead.extra?0:4)+(!X.gzhead.name?0:8)+(!X.gzhead.comment?0:16)),n1(X,X.gzhead.time&255),n1(X,X.gzhead.time>>8&255),n1(X,X.gzhead.time>>16&255),n1(X,X.gzhead.time>>24&255),n1(X,X.level===9?2:X.strategy>=hJ||X.level<2?4:0),n1(X,X.gzhead.os&255),X.gzhead.extra&&X.gzhead.extra.length)n1(X,X.gzhead.extra.length&255),n1(X,X.gzhead.extra.length>>8&255);if(X.gzhead.hcrc)W.adler=d8(W.adler,X.pending_buf,X.pending,0);X.gzindex=0,X.status=kA}if(X.status===kA){if(X.gzhead.extra){let Z=X.pending,V=(X.gzhead.extra.length&65535)-X.gzindex;while(X.pending+V>X.pending_buf_size){let J=X.pending_buf_size-X.pending;if(X.pending_buf.set(X.gzhead.extra.subarray(X.gzindex,X.gzindex+J),X.pending),X.pending=X.pending_buf_size,X.gzhead.hcrc&&X.pending>Z)W.adler=d8(W.adler,X.pending_buf,X.pending-Z,Z);if(X.gzindex+=J,s9(W),X.pending!==0)return X.last_flush=-1,a8;Z=0,V-=J}let Q=new Uint8Array(X.gzhead.extra);if(X.pending_buf.set(Q.subarray(X.gzindex,X.gzindex+V),X.pending),X.pending+=V,X.gzhead.hcrc&&X.pending>Z)W.adler=d8(W.adler,X.pending_buf,X.pending-Z,Z);X.gzindex=0}X.status=_A}if(X.status===_A){if(X.gzhead.name){let Z=X.pending,V;do{if(X.pending===X.pending_buf_size){if(X.gzhead.hcrc&&X.pending>Z)W.adler=d8(W.adler,X.pending_buf,X.pending-Z,Z);if(s9(W),X.pending!==0)return X.last_flush=-1,a8;Z=0}if(X.gzindex<X.gzhead.name.length)V=X.gzhead.name.charCodeAt(X.gzindex++)&255;else V=0;n1(X,V)}while(V!==0);if(X.gzhead.hcrc&&X.pending>Z)W.adler=d8(W.adler,X.pending_buf,X.pending-Z,Z);X.gzindex=0}X.status=yA}if(X.status===yA){if(X.gzhead.comment){let Z=X.pending,V;do{if(X.pending===X.pending_buf_size){if(X.gzhead.hcrc&&X.pending>Z)W.adler=d8(W.adler,X.pending_buf,X.pending-Z,Z);if(s9(W),X.pending!==0)return X.last_flush=-1,a8;Z=0}if(X.gzindex<X.gzhead.comment.length)V=X.gzhead.comment.charCodeAt(X.gzindex++)&255;else V=0;n1(X,V)}while(V!==0);if(X.gzhead.hcrc&&X.pending>Z)W.adler=d8(W.adler,X.pending_buf,X.pending-Z,Z)}X.status=vA}if(X.status===vA){if(X.gzhead.hcrc){if(X.pending+2>X.pending_buf_size){if(s9(W),X.pending!==0)return X.last_flush=-1,a8}n1(X,W.adler&255),n1(X,W.adler>>8&255),W.adler=0}if(X.status=zW,s9(W),X.pending!==0)return X.last_flush=-1,a8}if(W.avail_in!==0||X.lookahead!==0||G!==Q6&&X.status!==zZ){let Z=X.level===0?jD(X,G):X.strategy===hJ?Vv(X,G):X.strategy===fy?Zv(X,G):IZ[X.level].func(X,G);if(Z===jW||Z===eG)X.status=zZ;if(Z===F9||Z===jW){if(W.avail_out===0)X.last_flush=-1;return a8}if(Z===tG){if(G===gy)vy(X);else if(G!==MC){if(SA(X,0,0,!1),G===uy){if(Y6(X.head),X.lookahead===0)X.strstart=0,X.block_start=0,X.insert=0}}if(s9(W),W.avail_out===0)return X.last_flush=-1,a8}}if(G!==A5)return a8;if(X.wrap<=0)return TC;if(X.wrap===2)n1(X,W.adler&255),n1(X,W.adler>>8&255),n1(X,W.adler>>16&255),n1(X,W.adler>>24&255),n1(X,W.total_in&255),n1(X,W.total_in>>8&255),n1(X,W.total_in>>16&255),n1(X,W.total_in>>24&255);else AZ(X,W.adler>>>16),AZ(X,W.adler&65535);if(s9(W),X.wrap>0)X.wrap=-X.wrap;return X.pending!==0?a8:TC},Hv=(W)=>{if(EZ(W))return U7;let G=W.state.status;return W.state=null,G===zW?IW(W,hy):a8},Av=(W,G)=>{let X=G.length;if(EZ(W))return U7;let Y=W.state,Z=Y.wrap;if(Z===2||Z===1&&Y.status!==rG||Y.lookahead)return U7;if(Z===1)W.adler=TZ(W.adler,G,X,0);if(Y.wrap=0,X>=Y.w_size){if(Z===0)Y6(Y.head),Y.strstart=0,Y.block_start=0,Y.insert=0;let U=new Uint8Array(Y.w_size);U.set(G.subarray(X-Y.w_size,X),0),G=U,X=Y.w_size}let{avail_in:V,next_in:Q,input:J}=W;W.avail_in=X,W.next_in=0,W.input=G,aG(Y);while(Y.lookahead>=y1){let U=Y.strstart,q=Y.lookahead-(y1-1);do Y.ins_h=J6(Y,Y.ins_h,Y.window[U+y1-1]),Y.prev[U&Y.w_mask]=Y.head[Y.ins_h],Y.head[Y.ins_h]=U,U++;while(--q);Y.strstart=U,Y.lookahead=y1-1,aG(Y)}return Y.strstart+=Y.lookahead,Y.block_start=Y.strstart,Y.insert=Y.lookahead,Y.lookahead=0,Y.match_length=Y.prev_length=y1-1,Y.match_available=0,W.next_in=Q,W.input=J,W.avail_in=V,Y.wrap=Z,a8},zv=qv,Iv=CD,wv=KD,jv=OD,Ov=Uv,Kv=Nv,Cv=Hv,Dv=Av,Mv="pako deflate (from Nodeca project)",jZ={deflateInit:zv,deflateInit2:Iv,deflateReset:wv,deflateResetKeep:jv,deflateSetHeader:Ov,deflate:Kv,deflateEnd:Cv,deflateSetDictionary:Dv,deflateInfo:Mv},Tv=(W,G)=>{return Object.prototype.hasOwnProperty.call(W,G)},Pv=function(W){let G=Array.prototype.slice.call(arguments,1);while(G.length){let X=G.shift();if(!X)continue;if(typeof X!=="object")throw TypeError(X+"must be non-object");for(let Y in X)if(Tv(X,Y))W[Y]=X[Y]}return W},Rv=(W)=>{let G=0;for(let Y=0,Z=W.length;Y<Z;Y++)G+=W[Y].length;let X=new Uint8Array(G);for(let Y=0,Z=0,V=W.length;Y<V;Y++){let Q=W[Y];X.set(Q,Z),Z+=Q.length}return X},iJ={assign:Pv,flattenChunks:Rv},DD=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(W){DD=!1}var PZ=new Uint8Array(256);for(let W=0;W<256;W++)PZ[W]=W>=252?6:W>=248?5:W>=240?4:W>=224?3:W>=192?2:1;PZ[254]=PZ[254]=1;var Lv=(W)=>{if(typeof TextEncoder==="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(W);let G,X,Y,Z,V,Q=W.length,J=0;for(Z=0;Z<Q;Z++){if(X=W.charCodeAt(Z),(X&64512)===55296&&Z+1<Q){if(Y=W.charCodeAt(Z+1),(Y&64512)===56320)X=65536+(X-55296<<10)+(Y-56320),Z++}J+=X<128?1:X<2048?2:X<65536?3:4}G=new Uint8Array(J);for(V=0,Z=0;V<J;Z++){if(X=W.charCodeAt(Z),(X&64512)===55296&&Z+1<Q){if(Y=W.charCodeAt(Z+1),(Y&64512)===56320)X=65536+(X-55296<<10)+(Y-56320),Z++}if(X<128)G[V++]=X;else if(X<2048)G[V++]=192|X>>>6,G[V++]=128|X&63;else if(X<65536)G[V++]=224|X>>>12,G[V++]=128|X>>>6&63,G[V++]=128|X&63;else G[V++]=240|X>>>18,G[V++]=128|X>>>12&63,G[V++]=128|X>>>6&63,G[V++]=128|X&63}return G},Bv=(W,G)=>{if(G<65534){if(W.subarray&&DD)return String.fromCharCode.apply(null,W.length===G?W:W.subarray(0,G))}let X="";for(let Y=0;Y<G;Y++)X+=String.fromCharCode(W[Y]);return X},Ev=(W,G)=>{let X=G||W.length;if(typeof TextDecoder==="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(W.subarray(0,G));let Y,Z,V=Array(X*2);for(Z=0,Y=0;Y<X;){let Q=W[Y++];if(Q<128){V[Z++]=Q;continue}let J=PZ[Q];if(J>4){V[Z++]=65533,Y+=J-1;continue}Q&=J===2?31:J===3?15:7;while(J>1&&Y<X)Q=Q<<6|W[Y++]&63,J--;if(J>1){V[Z++]=65533;continue}if(Q<65536)V[Z++]=Q;else Q-=65536,V[Z++]=55296|Q>>10&1023,V[Z++]=56320|Q&1023}return Bv(V,Z)},$v=(W,G)=>{if(G=G||W.length,G>W.length)G=W.length;let X=G-1;while(X>=0&&(W[X]&192)===128)X--;if(X<0)return G;if(X===0)return G;return X+PZ[W[X]]>G?X:G},RZ={string2buf:Lv,buf2string:Ev,utf8border:$v};function Fv(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var MD=Fv,TD=Object.prototype.toString,{Z_NO_FLUSH:Sv,Z_SYNC_FLUSH:xv,Z_FULL_FLUSH:kv,Z_FINISH:_v,Z_OK:dJ,Z_STREAM_END:yv,Z_DEFAULT_COMPRESSION:vv,Z_DEFAULT_STRATEGY:gv,Z_DEFLATED:uv}=KW;function $Z(W){this.options=iJ.assign({level:vv,method:uv,chunkSize:16384,windowBits:15,memLevel:8,strategy:gv},W||{});let G=this.options;if(G.raw&&G.windowBits>0)G.windowBits=-G.windowBits;else if(G.gzip&&G.windowBits>0&&G.windowBits<16)G.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new MD,this.strm.avail_out=0;let X=jZ.deflateInit2(this.strm,G.level,G.method,G.windowBits,G.memLevel,G.strategy);if(X!==dJ)throw Error(wW[X]);if(G.header)jZ.deflateSetHeader(this.strm,G.header);if(G.dictionary){let Y;if(typeof G.dictionary==="string")Y=RZ.string2buf(G.dictionary);else if(TD.call(G.dictionary)==="[object ArrayBuffer]")Y=new Uint8Array(G.dictionary);else Y=G.dictionary;if(X=jZ.deflateSetDictionary(this.strm,Y),X!==dJ)throw Error(wW[X]);this._dict_set=!0}}$Z.prototype.push=function(W,G){let X=this.strm,Y=this.options.chunkSize,Z,V;if(this.ended)return!1;if(G===~~G)V=G;else V=G===!0?_v:Sv;if(typeof W==="string")X.input=RZ.string2buf(W);else if(TD.call(W)==="[object ArrayBuffer]")X.input=new Uint8Array(W);else X.input=W;X.next_in=0,X.avail_in=X.input.length;for(;;){if(X.avail_out===0)X.output=new Uint8Array(Y),X.next_out=0,X.avail_out=Y;if((V===xv||V===kv)&&X.avail_out<=6){this.onData(X.output.subarray(0,X.next_out)),X.avail_out=0;continue}if(Z=jZ.deflate(X,V),Z===yv){if(X.next_out>0)this.onData(X.output.subarray(0,X.next_out));return Z=jZ.deflateEnd(this.strm),this.onEnd(Z),this.ended=!0,Z===dJ}if(X.avail_out===0){this.onData(X.output);continue}if(V>0&&X.next_out>0){this.onData(X.output.subarray(0,X.next_out)),X.avail_out=0;continue}if(X.avail_in===0)break}return!0};$Z.prototype.onData=function(W){this.chunks.push(W)};$Z.prototype.onEnd=function(W){if(W===dJ)this.result=iJ.flattenChunks(this.chunks);this.chunks=[],this.err=W,this.msg=this.strm.msg};function cA(W,G){let X=new $Z(G);if(X.push(W,!0),X.err)throw X.msg||wW[X.err];return X.result}function hv(W,G){return G=G||{},G.raw=!0,cA(W,G)}function bv(W,G){return G=G||{},G.gzip=!0,cA(W,G)}var mv=$Z,fv=cA,cv=hv,pv=bv,lv=KW,dv={Deflate:mv,deflate:fv,deflateRaw:cv,gzip:pv,constants:lv},bJ=16209,ov=16191,nv=function(G,X){let Y,Z,V,Q,J,U,q,N,A,H,I,w,C,D,x,h,p,u,n,c,l,G0,m,Y0,U0=G.state;Y=G.next_in,m=G.input,Z=Y+(G.avail_in-5),V=G.next_out,Y0=G.output,Q=V-(X-G.avail_out),J=V+(G.avail_out-257),U=U0.dmax,q=U0.wsize,N=U0.whave,A=U0.wnext,H=U0.window,I=U0.hold,w=U0.bits,C=U0.lencode,D=U0.distcode,x=(1<<U0.lenbits)-1,h=(1<<U0.distbits)-1;W:do{if(w<15)I+=m[Y++]<<w,w+=8,I+=m[Y++]<<w,w+=8;p=C[I&x];G:for(;;){if(u=p>>>24,I>>>=u,w-=u,u=p>>>16&255,u===0)Y0[V++]=p&65535;else if(u&16){if(n=p&65535,u&=15,u){if(w<u)I+=m[Y++]<<w,w+=8;n+=I&(1<<u)-1,I>>>=u,w-=u}if(w<15)I+=m[Y++]<<w,w+=8,I+=m[Y++]<<w,w+=8;p=D[I&h];X:for(;;){if(u=p>>>24,I>>>=u,w-=u,u=p>>>16&255,u&16){if(c=p&65535,u&=15,w<u){if(I+=m[Y++]<<w,w+=8,w<u)I+=m[Y++]<<w,w+=8}if(c+=I&(1<<u)-1,c>U){G.msg="invalid distance too far back",U0.mode=bJ;break W}if(I>>>=u,w-=u,u=V-Q,c>u){if(u=c-u,u>N){if(U0.sane){G.msg="invalid distance too far back",U0.mode=bJ;break W}}if(l=0,G0=H,A===0){if(l+=q-u,u<n){n-=u;do Y0[V++]=H[l++];while(--u);l=V-c,G0=Y0}}else if(A<u){if(l+=q+A-u,u-=A,u<n){n-=u;do Y0[V++]=H[l++];while(--u);if(l=0,A<n){u=A,n-=u;do Y0[V++]=H[l++];while(--u);l=V-c,G0=Y0}}}else if(l+=A-u,u<n){n-=u;do Y0[V++]=H[l++];while(--u);l=V-c,G0=Y0}while(n>2)Y0[V++]=G0[l++],Y0[V++]=G0[l++],Y0[V++]=G0[l++],n-=3;if(n){if(Y0[V++]=G0[l++],n>1)Y0[V++]=G0[l++]}}else{l=V-c;do Y0[V++]=Y0[l++],Y0[V++]=Y0[l++],Y0[V++]=Y0[l++],n-=3;while(n>2);if(n){if(Y0[V++]=Y0[l++],n>1)Y0[V++]=Y0[l++]}}}else if((u&64)===0){p=D[(p&65535)+(I&(1<<u)-1)];continue X}else{G.msg="invalid distance code",U0.mode=bJ;break W}break}}else if((u&64)===0){p=C[(p&65535)+(I&(1<<u)-1)];continue G}else if(u&32){U0.mode=ov;break W}else{G.msg="invalid literal/length code",U0.mode=bJ;break W}break}}while(Y<Z&&V<J);n=w>>3,Y-=n,w-=n<<3,I&=(1<<w)-1,G.next_in=Y,G.next_out=V,G.avail_in=Y<Z?5+(Z-Y):5-(Y-Z),G.avail_out=V<J?257+(J-V):257-(V-J),U0.hold=I,U0.bits=w;return},nG=15,RC=852,LC=592,BC=0,DA=1,EC=2,iv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),av=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),sv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),tv=(W,G,X,Y,Z,V,Q,J)=>{let U=J.bits,q=0,N=0,A=0,H=0,I=0,w=0,C=0,D=0,x=0,h=0,p,u,n,c,l,G0=null,m,Y0=new Uint16Array(nG+1),U0=new Uint16Array(nG+1),y=null,o,B,R;for(q=0;q<=nG;q++)Y0[q]=0;for(N=0;N<Y;N++)Y0[G[X+N]]++;I=U;for(H=nG;H>=1;H--)if(Y0[H]!==0)break;if(I>H)I=H;if(H===0)return Z[V++]=20971520,Z[V++]=20971520,J.bits=1,0;for(A=1;A<H;A++)if(Y0[A]!==0)break;if(I<A)I=A;D=1;for(q=1;q<=nG;q++)if(D<<=1,D-=Y0[q],D<0)return-1;if(D>0&&(W===BC||H!==1))return-1;U0[1]=0;for(q=1;q<nG;q++)U0[q+1]=U0[q]+Y0[q];for(N=0;N<Y;N++)if(G[X+N]!==0)Q[U0[G[X+N]]++]=N;if(W===BC)G0=y=Q,m=20;else if(W===DA)G0=iv,y=rv,m=257;else G0=av,y=sv,m=0;if(h=0,N=0,q=A,l=V,w=I,C=0,n=-1,x=1<<I,c=x-1,W===DA&&x>RC||W===EC&&x>LC)return 1;for(;;){if(o=q-C,Q[N]+1<m)B=0,R=Q[N];else if(Q[N]>=m)B=y[Q[N]-m],R=G0[Q[N]-m];else B=96,R=0;p=1<<q-C,u=1<<w,A=u;do u-=p,Z[l+(h>>C)+u]=o<<24|B<<16|R|0;while(u!==0);p=1<<q-1;while(h&p)p>>=1;if(p!==0)h&=p-1,h+=p;else h=0;if(N++,--Y0[q]===0){if(q===H)break;q=G[X+Q[N]]}if(q>I&&(h&c)!==n){if(C===0)C=I;l+=A,w=q-C,D=1<<w;while(w+C<H){if(D-=Y0[w+C],D<=0)break;w++,D<<=1}if(x+=1<<w,W===DA&&x>RC||W===EC&&x>LC)return 1;n=h&c,Z[n]=I<<24|w<<16|l-V|0}}if(h!==0)Z[l+h]=q-C<<24|4194304|0;return J.bits=I,0},OZ=tv,ev=0,PD=1,RD=2,{Z_FINISH:$C,Z_BLOCK:Wg,Z_TREES:mJ,Z_OK:OW,Z_STREAM_END:Gg,Z_NEED_DICT:Xg,Z_STREAM_ERROR:z5,Z_DATA_ERROR:LD,Z_MEM_ERROR:BD,Z_BUF_ERROR:Yg,Z_DEFLATED:FC}=KW,rJ=16180,SC=16181,xC=16182,kC=16183,_C=16184,yC=16185,vC=16186,gC=16187,uC=16188,hC=16189,oJ=16190,i7=16191,MA=16192,bC=16193,TA=16194,mC=16195,fC=16196,cC=16197,pC=16198,fJ=16199,cJ=16200,lC=16201,dC=16202,oC=16203,nC=16204,iC=16205,PA=16206,rC=16207,aC=16208,N8=16209,ED=16210,$D=16211,Zg=852,Vg=592,Qg=15,Jg=Qg,sC=(W)=>{return(W>>>24&255)+(W>>>8&65280)+((W&65280)<<8)+((W&255)<<24)};function Ug(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var CW=(W)=>{if(!W)return 1;let G=W.state;if(!G||G.strm!==W||G.mode<rJ||G.mode>$D)return 1;return 0},FD=(W)=>{if(CW(W))return z5;let G=W.state;if(W.total_in=W.total_out=G.total=0,W.msg="",G.wrap)W.adler=G.wrap&1;return G.mode=rJ,G.last=0,G.havedict=0,G.flags=-1,G.dmax=32768,G.head=null,G.hold=0,G.bits=0,G.lencode=G.lendyn=new Int32Array(Zg),G.distcode=G.distdyn=new Int32Array(Vg),G.sane=1,G.back=-1,OW},SD=(W)=>{if(CW(W))return z5;let G=W.state;return G.wsize=0,G.whave=0,G.wnext=0,FD(W)},xD=(W,G)=>{let X;if(CW(W))return z5;let Y=W.state;if(G<0)X=0,G=-G;else if(X=(G>>4)+5,G<48)G&=15;if(G&&(G<8||G>15))return z5;if(Y.window!==null&&Y.wbits!==G)Y.window=null;return Y.wrap=X,Y.wbits=G,SD(W)},kD=(W,G)=>{if(!W)return z5;let X=new Ug;W.state=X,X.strm=W,X.window=null,X.mode=rJ;let Y=xD(W,G);if(Y!==OW)W.state=null;return Y},qg=(W)=>{return kD(W,Jg)},tC=!0,RA,LA,Ng=(W)=>{if(tC){RA=new Int32Array(512),LA=new Int32Array(32);let G=0;while(G<144)W.lens[G++]=8;while(G<256)W.lens[G++]=9;while(G<280)W.lens[G++]=7;while(G<288)W.lens[G++]=8;OZ(PD,W.lens,0,288,RA,0,W.work,{bits:9}),G=0;while(G<32)W.lens[G++]=5;OZ(RD,W.lens,0,32,LA,0,W.work,{bits:5}),tC=!1}W.lencode=RA,W.lenbits=9,W.distcode=LA,W.distbits=5},_D=(W,G,X,Y)=>{let Z,V=W.state;if(V.window===null)V.wsize=1<<V.wbits,V.wnext=0,V.whave=0,V.window=new Uint8Array(V.wsize);if(Y>=V.wsize)V.window.set(G.subarray(X-V.wsize,X),0),V.wnext=0,V.whave=V.wsize;else{if(Z=V.wsize-V.wnext,Z>Y)Z=Y;if(V.window.set(G.subarray(X-Y,X-Y+Z),V.wnext),Y-=Z,Y)V.window.set(G.subarray(X-Y,X),0),V.wnext=Y,V.whave=V.wsize;else{if(V.wnext+=Z,V.wnext===V.wsize)V.wnext=0;if(V.whave<V.wsize)V.whave+=Z}}return 0},Hg=(W,G)=>{let X,Y,Z,V,Q,J,U,q,N,A,H,I,w,C,D=0,x,h,p,u,n,c,l,G0,m=new Uint8Array(4),Y0,U0,y=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(CW(W)||!W.output||!W.input&&W.avail_in!==0)return z5;if(X=W.state,X.mode===i7)X.mode=MA;Q=W.next_out,Z=W.output,U=W.avail_out,V=W.next_in,Y=W.input,J=W.avail_in,q=X.hold,N=X.bits,A=J,H=U,G0=OW;W:for(;;)switch(X.mode){case rJ:if(X.wrap===0){X.mode=MA;break}while(N<16){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(X.wrap&2&&q===35615){if(X.wbits===0)X.wbits=15;X.check=0,m[0]=q&255,m[1]=q>>>8&255,X.check=d8(X.check,m,2,0),q=0,N=0,X.mode=SC;break}if(X.head)X.head.done=!1;if(!(X.wrap&1)||(((q&255)<<8)+(q>>8))%31){W.msg="incorrect header check",X.mode=N8;break}if((q&15)!==FC){W.msg="unknown compression method",X.mode=N8;break}if(q>>>=4,N-=4,l=(q&15)+8,X.wbits===0)X.wbits=l;if(l>15||l>X.wbits){W.msg="invalid window size",X.mode=N8;break}X.dmax=1<<X.wbits,X.flags=0,W.adler=X.check=1,X.mode=q&512?hC:i7,q=0,N=0;break;case SC:while(N<16){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(X.flags=q,(X.flags&255)!==FC){W.msg="unknown compression method",X.mode=N8;break}if(X.flags&57344){W.msg="unknown header flags set",X.mode=N8;break}if(X.head)X.head.text=q>>8&1;if(X.flags&512&&X.wrap&4)m[0]=q&255,m[1]=q>>>8&255,X.check=d8(X.check,m,2,0);q=0,N=0,X.mode=xC;case xC:while(N<32){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(X.head)X.head.time=q;if(X.flags&512&&X.wrap&4)m[0]=q&255,m[1]=q>>>8&255,m[2]=q>>>16&255,m[3]=q>>>24&255,X.check=d8(X.check,m,4,0);q=0,N=0,X.mode=kC;case kC:while(N<16){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(X.head)X.head.xflags=q&255,X.head.os=q>>8;if(X.flags&512&&X.wrap&4)m[0]=q&255,m[1]=q>>>8&255,X.check=d8(X.check,m,2,0);q=0,N=0,X.mode=_C;case _C:if(X.flags&1024){while(N<16){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(X.length=q,X.head)X.head.extra_len=q;if(X.flags&512&&X.wrap&4)m[0]=q&255,m[1]=q>>>8&255,X.check=d8(X.check,m,2,0);q=0,N=0}else if(X.head)X.head.extra=null;X.mode=yC;case yC:if(X.flags&1024){if(I=X.length,I>J)I=J;if(I){if(X.head){if(l=X.head.extra_len-X.length,!X.head.extra)X.head.extra=new Uint8Array(X.head.extra_len);X.head.extra.set(Y.subarray(V,V+I),l)}if(X.flags&512&&X.wrap&4)X.check=d8(X.check,Y,I,V);J-=I,V+=I,X.length-=I}if(X.length)break W}X.length=0,X.mode=vC;case vC:if(X.flags&2048){if(J===0)break W;I=0;do if(l=Y[V+I++],X.head&&l&&X.length<65536)X.head.name+=String.fromCharCode(l);while(l&&I<J);if(X.flags&512&&X.wrap&4)X.check=d8(X.check,Y,I,V);if(J-=I,V+=I,l)break W}else if(X.head)X.head.name=null;X.length=0,X.mode=gC;case gC:if(X.flags&4096){if(J===0)break W;I=0;do if(l=Y[V+I++],X.head&&l&&X.length<65536)X.head.comment+=String.fromCharCode(l);while(l&&I<J);if(X.flags&512&&X.wrap&4)X.check=d8(X.check,Y,I,V);if(J-=I,V+=I,l)break W}else if(X.head)X.head.comment=null;X.mode=uC;case uC:if(X.flags&512){while(N<16){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(X.wrap&4&&q!==(X.check&65535)){W.msg="header crc mismatch",X.mode=N8;break}q=0,N=0}if(X.head)X.head.hcrc=X.flags>>9&1,X.head.done=!0;W.adler=X.check=0,X.mode=i7;break;case hC:while(N<32){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}W.adler=X.check=sC(q),q=0,N=0,X.mode=oJ;case oJ:if(X.havedict===0)return W.next_out=Q,W.avail_out=U,W.next_in=V,W.avail_in=J,X.hold=q,X.bits=N,Xg;W.adler=X.check=1,X.mode=i7;case i7:if(G===Wg||G===mJ)break W;case MA:if(X.last){q>>>=N&7,N-=N&7,X.mode=PA;break}while(N<3){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}switch(X.last=q&1,q>>>=1,N-=1,q&3){case 0:X.mode=bC;break;case 1:if(Ng(X),X.mode=fJ,G===mJ){q>>>=2,N-=2;break W}break;case 2:X.mode=fC;break;case 3:W.msg="invalid block type",X.mode=N8}q>>>=2,N-=2;break;case bC:q>>>=N&7,N-=N&7;while(N<32){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if((q&65535)!==(q>>>16^65535)){W.msg="invalid stored block lengths",X.mode=N8;break}if(X.length=q&65535,q=0,N=0,X.mode=TA,G===mJ)break W;case TA:X.mode=mC;case mC:if(I=X.length,I){if(I>J)I=J;if(I>U)I=U;if(I===0)break W;Z.set(Y.subarray(V,V+I),Q),J-=I,V+=I,U-=I,Q+=I,X.length-=I;break}X.mode=i7;break;case fC:while(N<14){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(X.nlen=(q&31)+257,q>>>=5,N-=5,X.ndist=(q&31)+1,q>>>=5,N-=5,X.ncode=(q&15)+4,q>>>=4,N-=4,X.nlen>286||X.ndist>30){W.msg="too many length or distance symbols",X.mode=N8;break}X.have=0,X.mode=cC;case cC:while(X.have<X.ncode){while(N<3){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}X.lens[y[X.have++]]=q&7,q>>>=3,N-=3}while(X.have<19)X.lens[y[X.have++]]=0;if(X.lencode=X.lendyn,X.lenbits=7,Y0={bits:X.lenbits},G0=OZ(ev,X.lens,0,19,X.lencode,0,X.work,Y0),X.lenbits=Y0.bits,G0){W.msg="invalid code lengths set",X.mode=N8;break}X.have=0,X.mode=pC;case pC:while(X.have<X.nlen+X.ndist){for(;;){if(D=X.lencode[q&(1<<X.lenbits)-1],x=D>>>24,h=D>>>16&255,p=D&65535,x<=N)break;if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(p<16)q>>>=x,N-=x,X.lens[X.have++]=p;else{if(p===16){U0=x+2;while(N<U0){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(q>>>=x,N-=x,X.have===0){W.msg="invalid bit length repeat",X.mode=N8;break}l=X.lens[X.have-1],I=3+(q&3),q>>>=2,N-=2}else if(p===17){U0=x+3;while(N<U0){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}q>>>=x,N-=x,l=0,I=3+(q&7),q>>>=3,N-=3}else{U0=x+7;while(N<U0){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}q>>>=x,N-=x,l=0,I=11+(q&127),q>>>=7,N-=7}if(X.have+I>X.nlen+X.ndist){W.msg="invalid bit length repeat",X.mode=N8;break}while(I--)X.lens[X.have++]=l}}if(X.mode===N8)break;if(X.lens[256]===0){W.msg="invalid code -- missing end-of-block",X.mode=N8;break}if(X.lenbits=9,Y0={bits:X.lenbits},G0=OZ(PD,X.lens,0,X.nlen,X.lencode,0,X.work,Y0),X.lenbits=Y0.bits,G0){W.msg="invalid literal/lengths set",X.mode=N8;break}if(X.distbits=6,X.distcode=X.distdyn,Y0={bits:X.distbits},G0=OZ(RD,X.lens,X.nlen,X.ndist,X.distcode,0,X.work,Y0),X.distbits=Y0.bits,G0){W.msg="invalid distances set",X.mode=N8;break}if(X.mode=fJ,G===mJ)break W;case fJ:X.mode=cJ;case cJ:if(J>=6&&U>=258){if(W.next_out=Q,W.avail_out=U,W.next_in=V,W.avail_in=J,X.hold=q,X.bits=N,nv(W,H),Q=W.next_out,Z=W.output,U=W.avail_out,V=W.next_in,Y=W.input,J=W.avail_in,q=X.hold,N=X.bits,X.mode===i7)X.back=-1;break}X.back=0;for(;;){if(D=X.lencode[q&(1<<X.lenbits)-1],x=D>>>24,h=D>>>16&255,p=D&65535,x<=N)break;if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(h&&(h&240)===0){u=x,n=h,c=p;for(;;){if(D=X.lencode[c+((q&(1<<u+n)-1)>>u)],x=D>>>24,h=D>>>16&255,p=D&65535,u+x<=N)break;if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}q>>>=u,N-=u,X.back+=u}if(q>>>=x,N-=x,X.back+=x,X.length=p,h===0){X.mode=iC;break}if(h&32){X.back=-1,X.mode=i7;break}if(h&64){W.msg="invalid literal/length code",X.mode=N8;break}X.extra=h&15,X.mode=lC;case lC:if(X.extra){U0=X.extra;while(N<U0){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}X.length+=q&(1<<X.extra)-1,q>>>=X.extra,N-=X.extra,X.back+=X.extra}X.was=X.length,X.mode=dC;case dC:for(;;){if(D=X.distcode[q&(1<<X.distbits)-1],x=D>>>24,h=D>>>16&255,p=D&65535,x<=N)break;if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if((h&240)===0){u=x,n=h,c=p;for(;;){if(D=X.distcode[c+((q&(1<<u+n)-1)>>u)],x=D>>>24,h=D>>>16&255,p=D&65535,u+x<=N)break;if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}q>>>=u,N-=u,X.back+=u}if(q>>>=x,N-=x,X.back+=x,h&64){W.msg="invalid distance code",X.mode=N8;break}X.offset=p,X.extra=h&15,X.mode=oC;case oC:if(X.extra){U0=X.extra;while(N<U0){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}X.offset+=q&(1<<X.extra)-1,q>>>=X.extra,N-=X.extra,X.back+=X.extra}if(X.offset>X.dmax){W.msg="invalid distance too far back",X.mode=N8;break}X.mode=nC;case nC:if(U===0)break W;if(I=H-U,X.offset>I){if(I=X.offset-I,I>X.whave){if(X.sane){W.msg="invalid distance too far back",X.mode=N8;break}}if(I>X.wnext)I-=X.wnext,w=X.wsize-I;else w=X.wnext-I;if(I>X.length)I=X.length;C=X.window}else C=Z,w=Q-X.offset,I=X.length;if(I>U)I=U;U-=I,X.length-=I;do Z[Q++]=C[w++];while(--I);if(X.length===0)X.mode=cJ;break;case iC:if(U===0)break W;Z[Q++]=X.length,U--,X.mode=cJ;break;case PA:if(X.wrap){while(N<32){if(J===0)break W;J--,q|=Y[V++]<<N,N+=8}if(H-=U,W.total_out+=H,X.total+=H,X.wrap&4&&H)W.adler=X.check=X.flags?d8(X.check,Z,H,Q-H):TZ(X.check,Z,H,Q-H);if(H=U,X.wrap&4&&(X.flags?q:sC(q))!==X.check){W.msg="incorrect data check",X.mode=N8;break}q=0,N=0}X.mode=rC;case rC:if(X.wrap&&X.flags){while(N<32){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(X.wrap&4&&q!==(X.total&4294967295)){W.msg="incorrect length check",X.mode=N8;break}q=0,N=0}X.mode=aC;case aC:G0=Gg;break W;case N8:G0=LD;break W;case ED:return BD;case $D:default:return z5}if(W.next_out=Q,W.avail_out=U,W.next_in=V,W.avail_in=J,X.hold=q,X.bits=N,X.wsize||H!==W.avail_out&&X.mode<N8&&(X.mode<PA||G!==$C)){if(_D(W,W.output,W.next_out,H-W.avail_out));}if(A-=W.avail_in,H-=W.avail_out,W.total_in+=A,W.total_out+=H,X.total+=H,X.wrap&4&&H)W.adler=X.check=X.flags?d8(X.check,Z,H,W.next_out-H):TZ(X.check,Z,H,W.next_out-H);if(W.data_type=X.bits+(X.last?64:0)+(X.mode===i7?128:0)+(X.mode===fJ||X.mode===TA?256:0),(A===0&&H===0||G===$C)&&G0===OW)G0=Yg;return G0},Ag=(W)=>{if(CW(W))return z5;let G=W.state;if(G.window)G.window=null;return W.state=null,OW},zg=(W,G)=>{if(CW(W))return z5;let X=W.state;if((X.wrap&2)===0)return z5;return X.head=G,G.done=!1,OW},Ig=(W,G)=>{let X=G.length,Y,Z,V;if(CW(W))return z5;if(Y=W.state,Y.wrap!==0&&Y.mode!==oJ)return z5;if(Y.mode===oJ){if(Z=1,Z=TZ(Z,G,X,0),Z!==Y.check)return LD}if(V=_D(W,G,X,X),V)return Y.mode=ED,BD;return Y.havedict=1,OW},wg=SD,jg=xD,Og=FD,Kg=qg,Cg=kD,Dg=Hg,Mg=Ag,Tg=zg,Pg=Ig,Rg="pako inflate (from Nodeca project)",a7={inflateReset:wg,inflateReset2:jg,inflateResetKeep:Og,inflateInit:Kg,inflateInit2:Cg,inflate:Dg,inflateEnd:Mg,inflateGetHeader:Tg,inflateSetDictionary:Pg,inflateInfo:Rg};function Lg(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Bg=Lg,yD=Object.prototype.toString,{Z_NO_FLUSH:Eg,Z_FINISH:$g,Z_OK:LZ,Z_STREAM_END:BA,Z_NEED_DICT:EA,Z_STREAM_ERROR:Fg,Z_DATA_ERROR:eC,Z_MEM_ERROR:Sg}=KW;function FZ(W){this.options=iJ.assign({chunkSize:65536,windowBits:15,to:""},W||{});let G=this.options;if(G.raw&&G.windowBits>=0&&G.windowBits<16){if(G.windowBits=-G.windowBits,G.windowBits===0)G.windowBits=-15}if(G.windowBits>=0&&G.windowBits<16&&!(W&&W.windowBits))G.windowBits+=32;if(G.windowBits>15&&G.windowBits<48){if((G.windowBits&15)===0)G.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new MD,this.strm.avail_out=0;let X=a7.inflateInit2(this.strm,G.windowBits);if(X!==LZ)throw Error(wW[X]);if(this.header=new Bg,a7.inflateGetHeader(this.strm,this.header),G.dictionary){if(typeof G.dictionary==="string")G.dictionary=RZ.string2buf(G.dictionary);else if(yD.call(G.dictionary)==="[object ArrayBuffer]")G.dictionary=new Uint8Array(G.dictionary);if(G.raw){if(X=a7.inflateSetDictionary(this.strm,G.dictionary),X!==LZ)throw Error(wW[X])}}}FZ.prototype.push=function(W,G){let X=this.strm,Y=this.options.chunkSize,Z=this.options.dictionary,V,Q,J;if(this.ended)return!1;if(G===~~G)Q=G;else Q=G===!0?$g:Eg;if(yD.call(W)==="[object ArrayBuffer]")X.input=new Uint8Array(W);else X.input=W;X.next_in=0,X.avail_in=X.input.length;for(;;){if(X.avail_out===0)X.output=new Uint8Array(Y),X.next_out=0,X.avail_out=Y;if(V=a7.inflate(X,Q),V===EA&&Z){if(V=a7.inflateSetDictionary(X,Z),V===LZ)V=a7.inflate(X,Q);else if(V===eC)V=EA}while(X.avail_in>0&&V===BA&&X.state.wrap>0&&W[X.next_in]!==0)a7.inflateReset(X),V=a7.inflate(X,Q);switch(V){case Fg:case eC:case EA:case Sg:return this.onEnd(V),this.ended=!0,!1}if(J=X.avail_out,X.next_out){if(X.avail_out===0||V===BA)if(this.options.to==="string"){let U=RZ.utf8border(X.output,X.next_out),q=X.next_out-U,N=RZ.buf2string(X.output,U);if(X.next_out=q,X.avail_out=Y-q,q)X.output.set(X.output.subarray(U,U+q),0);this.onData(N)}else this.onData(X.output.length===X.next_out?X.output:X.output.subarray(0,X.next_out))}if(V===LZ&&J===0)continue;if(V===BA)return V=a7.inflateEnd(this.strm),this.onEnd(V),this.ended=!0,!0;if(X.avail_in===0)break}return!0};FZ.prototype.onData=function(W){this.chunks.push(W)};FZ.prototype.onEnd=function(W){if(W===LZ)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=iJ.flattenChunks(this.chunks);this.chunks=[],this.err=W,this.msg=this.strm.msg};function pA(W,G){let X=new FZ(G);if(X.push(W),X.err)throw X.msg||wW[X.err];return X.result}function xg(W,G){return G=G||{},G.raw=!0,pA(W,G)}var kg=FZ,_g=pA,yg=xg,vg=pA,gg=KW,ug={Inflate:kg,inflate:_g,inflateRaw:yg,ungzip:vg,constants:gg},{Deflate:hg,deflate:bg,deflateRaw:mg,gzip:fg}=dv,{Inflate:cg,inflate:pg,inflateRaw:lg,ungzip:dg}=ug,og=hg,ng=bg,ig=mg,rg=fg,ag=cg,sg=pg,tg=lg,eg=dg,Wu=KW,DW={Deflate:og,deflate:ng,deflateRaw:ig,gzip:rg,Inflate:ag,inflate:sg,inflateRaw:tg,ungzip:eg,constants:Wu};function vD(){let W=Date.now(),G=0;return{now(){return W=Math.max(W,Date.now()),G++,{physical:W,logical:G}},update(X){if(!X||typeof X.physical!=="number"||typeof X.logical!=="number")return;W=Math.max(W,X.physical),G=Math.max(G,X.logical)+1},compare(X,Y){if(!X&&!Y)return 0;if(!X)return-1;if(!Y)return 1;if(X.physical!==Y.physical)return X.physical>Y.physical?1:-1;if(X.logical!==Y.logical)return X.logical>Y.logical?1:-1;return 0}}}function gD(W,G,X){let Y=G.timestamp;if(Y?.physical>Date.now()+7200000)Y={physical:Date.now()+7200000,logical:Y.logical};if(G?.value?.priority===!0&&typeof G.id==="string"&&G.id.startsWith("user:")&&"role"in G.value){let{priority:Z,...V}=G.value;return{resolved:!0,value:V,timestamp:Y}}if(G?.value?.priority!==void 0){let{priority:Z,...V}=G.value;G={...G,value:V}}if(!W?.timestamp)return{resolved:!0,value:G.value,timestamp:Y};if(X.compare(Y,W.timestamp)<=0)return{resolved:!1};return{resolved:!0,value:G.value,timestamp:Y}}var SZ={$eq:(W,G)=>W===G,$ne:(W,G)=>W!==G,$gt:(W,G)=>W>G,$gte:(W,G)=>W>=G,$lt:(W,G)=>W<G,$lte:(W,G)=>W<=G,$in:(W,G)=>Array.isArray(G)&&(Array.isArray(W)?W.some((X)=>G.includes(X)):G.includes(W)),$between:(W,[G,X])=>W>=G&&W<=X,$exists:(W,G)=>G?W!==void 0:W===void 0,$startsWith:(W,G)=>typeof W==="string"&&W.startsWith(G),$endsWith:(W,G)=>typeof W==="string"&&W.endsWith(G),$contains:(W,G)=>typeof W==="string"&&W.includes(G),$text:{global:(W,G)=>{let X=(Z)=>String(Z).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^\w\s]/g,""),Y=X(G);return Object.values(W).some((Z)=>typeof Z==="object"?null.fieldSearch(Z,Y):X(Z).includes(Y))},field:(W,G)=>{let X=(Z)=>String(Z).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^\w\s]/g,""),Y=X(G);return Array.isArray(W)?W.some((Z)=>X(Z).includes(Y)):X(W).includes(Y)}},$like:(W,G)=>typeof W==="string"&&typeof G==="string"&&new RegExp(`^${G.replace(/%/g,".*").replace(/_/g,".")}$`,"i").test(W),$regex:(W,G)=>typeof W==="string"&&new RegExp(G.$regex||G,"i").test(W),$and:(W,G,X)=>G.every((Y)=>X.createFilter(Y,X.allNodes)(W)),$or:(W,G,X)=>G.some((Y)=>X.createFilter(Y,X.allNodes)(W)),$not:(W,G,X)=>!X.createFilter(G,X.allNodes)(W),$edge:(W,G,X)=>{if(!W.edges?.length||typeof G!=="object"||G===null)return!1;let Y=X.createFilter(G,X.allNodes),Z=[...W.edges],V=new Set(Z).add(W.id),Q=[];while(Z.length){let J=Z.shift(),U=X.allNodes[J];if(!U)continue;if(Y(U))Q.push(U);U.edges?.forEach((q)=>!V.has(q)&&V.add(q)&&Z.push(q))}if(Q.length)W._edgeResult=Q;return Q.length>0}},aJ=(W,G)=>G.split(".").reduce((X,Y)=>X&&typeof X==="object"&&(Y in X)?X[Y]:void 0,W),sJ=(W,G)=>{if(Object.keys(W).length===0)return()=>!0;return(X)=>Object.entries(W).every(([Y,Z])=>{if(Y.startsWith("$"))return SZ[Y](X,Z,{createFilter:sJ,allNodes:G});let V=aJ(X.value,Y);if(V===void 0)V=aJ(X,Y);if(typeof Z!=="object"||Z===null)return SZ.$eq(V,Z);return Object.entries(Z).every(([Q,J])=>{if(Q==="$text")return SZ.$text.field(V,J);if(Q==="$between"&&J.every((U)=>U instanceof Date))return SZ.$between(new Date(V),J);return SZ[Q]?.(V,J,{createFilter:sJ,allNodes:G})??!1})})},lA=(W,G)=>{let{$edge:X,...Y}=G.query||{},Z=sJ(Y,W),V=Object.values(W).filter(Z),J=[...X?(()=>{let U=sJ({$edge:X},W);V.forEach((N)=>U(N));let q=new Map;return V.forEach((N)=>{if(N._edgeResult)N._edgeResult.forEach((A)=>q.set(A.id,A)),delete N._edgeResult}),Array.from(q.values())})():V];if(G.field){let U=G.order==="asc"?1:-1;J.sort((q,N)=>{let A=aJ(q.value,G.field),H=aJ(N.value,G.field);if(typeof A==="string"&&typeof H==="string")return A.localeCompare(H)*U;return((A??0)-(H??0))*U})}if(G.$after){let U=J.findIndex((q)=>q.id===G.$after);J=U>=0?J.slice(U+1):[]}if(G.$before){let U=J.findIndex((q)=>q.id===G.$before);J=U>=0?J.slice(0,U):[]}if(G.$limit)J=J.slice(0,G.$limit);return J};var dA=(()=>{let W=()=>{};return new Proxy(console,{get:(G,X)=>globalThis.__gdbDebug?G[X].bind(G):W})})(),WX=typeof globalThis==="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function MU(W){return W instanceof Uint8Array||ArrayBuffer.isView(W)&&W.constructor.name==="Uint8Array"}function Xz(W){if(!Number.isSafeInteger(W)||W<0)throw Error("positive integer expected, got "+W)}function BW(W,...G){if(!MU(W))throw Error("Uint8Array expected");if(G.length>0&&!G.includes(W.length))throw Error("Uint8Array expected of length "+G+", got length="+W.length)}function XM(W){if(typeof W!=="function"||typeof W.create!=="function")throw Error("Hash should be wrapped by utils.createHasher");Xz(W.outputLen),Xz(W.blockLen)}function NU(W,G=!0){if(W.destroyed)throw Error("Hash instance has been destroyed");if(G&&W.finished)throw Error("Hash#digest() has already been called")}function Gu(W,G){BW(W);let X=G.outputLen;if(W.length<X)throw Error("digestInto() expects output buffer of length at least "+X)}function HU(...W){for(let G=0;G<W.length;G++)W[G].fill(0)}function oA(W){return new DataView(W.buffer,W.byteOffset,W.byteLength)}function N7(W,G){return W<<32-G|W>>>G}var YM=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),Xu=Array.from({length:256},(W,G)=>G.toString(16).padStart(2,"0"));function YX(W){if(BW(W),YM)return W.toHex();let G="";for(let X=0;X<W.length;X++)G+=Xu[W[X]];return G}var s7={_0:48,_9:57,A:65,F:70,a:97,f:102};function uD(W){if(W>=s7._0&&W<=s7._9)return W-s7._0;if(W>=s7.A&&W<=s7.F)return W-(s7.A-10);if(W>=s7.a&&W<=s7.f)return W-(s7.a-10);return}function AU(W){if(typeof W!=="string")throw Error("hex string expected, got "+typeof W);if(YM)return Uint8Array.fromHex(W);let G=W.length,X=G/2;if(G%2)throw Error("hex string expected, got unpadded hex of length "+G);let Y=new Uint8Array(X);for(let Z=0,V=0;Z<X;Z++,V+=2){let Q=uD(W.charCodeAt(V)),J=uD(W.charCodeAt(V+1));if(Q===void 0||J===void 0){let U=W[V]+W[V+1];throw Error('hex string expected, got non-hex character "'+U+'" at index '+V)}Y[Z]=Q*16+J}return Y}function ZM(W){if(typeof W!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(W))}function Hz(W){if(typeof W==="string")W=ZM(W);return BW(W),W}function H7(...W){let G=0;for(let Y=0;Y<W.length;Y++){let Z=W[Y];BW(Z),G+=Z.length}let X=new Uint8Array(G);for(let Y=0,Z=0;Y<W.length;Y++){let V=W[Y];X.set(V,Z),Z+=V.length}return X}class Az{}function Yu(W){let G=(Y)=>W().update(Hz(Y)).digest(),X=W();return G.outputLen=X.outputLen,G.blockLen=X.blockLen,G.create=()=>W(),G}function TU(W=32){if(WX&&typeof WX.getRandomValues==="function")return WX.getRandomValues(new Uint8Array(W));if(WX&&typeof WX.randomBytes==="function")return Uint8Array.from(WX.randomBytes(W));throw Error("crypto.getRandomValues must be defined")}function Zu(W,G,X,Y){if(typeof W.setBigUint64==="function")return W.setBigUint64(G,X,Y);let Z=BigInt(32),V=BigInt(4294967295),Q=Number(X>>Z&V),J=Number(X&V),U=Y?4:0,q=Y?0:4;W.setUint32(G+U,Q,Y),W.setUint32(G+q,J,Y)}function Vu(W,G,X){return W&G^~W&X}function Qu(W,G,X){return W&G^W&X^G&X}class VM extends Az{constructor(W,G,X,Y){super();this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=W,this.outputLen=G,this.padOffset=X,this.isLE=Y,this.buffer=new Uint8Array(W),this.view=oA(this.buffer)}update(W){NU(this),W=Hz(W),BW(W);let{view:G,buffer:X,blockLen:Y}=this,Z=W.length;for(let V=0;V<Z;){let Q=Math.min(Y-this.pos,Z-V);if(Q===Y){let J=oA(W);for(;Y<=Z-V;V+=Y)this.process(J,V);continue}if(X.set(W.subarray(V,V+Q),this.pos),this.pos+=Q,V+=Q,this.pos===Y)this.process(G,0),this.pos=0}return this.length+=W.length,this.roundClean(),this}digestInto(W){NU(this),Gu(W,this),this.finished=!0;let{buffer:G,view:X,blockLen:Y,isLE:Z}=this,{pos:V}=this;if(G[V++]=128,HU(this.buffer.subarray(V)),this.padOffset>Y-V)this.process(X,0),V=0;for(let N=V;N<Y;N++)G[N]=0;Zu(X,Y-8,BigInt(this.length*8),Z),this.process(X,0);let Q=oA(W),J=this.outputLen;if(J%4)throw Error("_sha2: outputLen should be aligned to 32bit");let U=J/4,q=this.get();if(U>q.length)throw Error("_sha2: outputLen bigger than state");for(let N=0;N<U;N++)Q.setUint32(4*N,q[N],Z)}digest(){let{buffer:W,outputLen:G}=this;this.digestInto(W);let X=W.slice(0,G);return this.destroy(),X}_cloneInto(W){W||(W=new this.constructor),W.set(...this.get());let{blockLen:G,buffer:X,length:Y,finished:Z,destroyed:V,pos:Q}=this;if(W.destroyed=V,W.finished=Z,W.length=Y,W.pos=Q,Y%G)W.buffer.set(X);return W}clone(){return this._cloneInto()}}var U6=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ju=Uint32Array.from([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]),q6=new Uint32Array(64);class QM extends VM{constructor(W=32){super(64,W,8,!1);this.A=U6[0]|0,this.B=U6[1]|0,this.C=U6[2]|0,this.D=U6[3]|0,this.E=U6[4]|0,this.F=U6[5]|0,this.G=U6[6]|0,this.H=U6[7]|0}get(){let{A:W,B:G,C:X,D:Y,E:Z,F:V,G:Q,H:J}=this;return[W,G,X,Y,Z,V,Q,J]}set(W,G,X,Y,Z,V,Q,J){this.A=W|0,this.B=G|0,this.C=X|0,this.D=Y|0,this.E=Z|0,this.F=V|0,this.G=Q|0,this.H=J|0}process(W,G){for(let N=0;N<16;N++,G+=4)q6[N]=W.getUint32(G,!1);for(let N=16;N<64;N++){let A=q6[N-15],H=q6[N-2],I=N7(A,7)^N7(A,18)^A>>>3,w=N7(H,17)^N7(H,19)^H>>>10;q6[N]=w+q6[N-7]+I+q6[N-16]|0}let{A:X,B:Y,C:Z,D:V,E:Q,F:J,G:U,H:q}=this;for(let N=0;N<64;N++){let A=N7(Q,6)^N7(Q,11)^N7(Q,25),H=q+A+Vu(Q,J,U)+Ju[N]+q6[N]|0,I=(N7(X,2)^N7(X,13)^N7(X,22))+Qu(X,Y,Z)|0;q=U,U=J,J=Q,Q=V+H|0,V=Z,Z=Y,Y=X,X=H+I|0}X=X+this.A|0,Y=Y+this.B|0,Z=Z+this.C|0,V=V+this.D|0,Q=Q+this.E|0,J=J+this.F|0,U=U+this.G|0,q=q+this.H|0,this.set(X,Y,Z,V,Q,J,U,q)}roundClean(){HU(q6)}destroy(){this.set(0,0,0,0,0,0,0,0),HU(this.buffer)}}var Yz=Yu(()=>new QM);class zz extends Az{constructor(W,G){super();this.finished=!1,this.destroyed=!1,XM(W);let X=Hz(G);if(this.iHash=W.create(),typeof this.iHash.update!=="function")throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let Y=this.blockLen,Z=new Uint8Array(Y);Z.set(X.length>Y?W.create().update(X).digest():X);for(let V=0;V<Z.length;V++)Z[V]^=54;this.iHash.update(Z),this.oHash=W.create();for(let V=0;V<Z.length;V++)Z[V]^=106;this.oHash.update(Z),HU(Z)}update(W){return NU(this),this.iHash.update(W),this}digestInto(W){NU(this),BW(W,this.outputLen),this.finished=!0,this.iHash.digestInto(W),this.oHash.update(W),this.oHash.digestInto(W),this.destroy()}digest(){let W=new Uint8Array(this.oHash.outputLen);return this.digestInto(W),W}_cloneInto(W){W||(W=Object.create(Object.getPrototypeOf(this),{}));let{oHash:G,iHash:X,finished:Y,destroyed:Z,blockLen:V,outputLen:Q}=this;return W=W,W.finished=Y,W.destroyed=Z,W.blockLen=V,W.outputLen=Q,W.oHash=G._cloneInto(W.oHash),W.iHash=X._cloneInto(W.iHash),W}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var JM=(W,G,X)=>new zz(W,G).update(X).digest();JM.create=(W,G)=>new zz(W,G);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var Iz=BigInt(0),Zz=BigInt(1);function zU(W,G=""){if(typeof W!=="boolean"){let X=G&&`"${G}"`;throw Error(X+"expected boolean, got type="+typeof W)}return W}function MW(W,G,X=""){let Y=MU(W),Z=W?.length,V=G!==void 0;if(!Y||V&&Z!==G){let Q=X&&`"${X}" `,J=V?` of length ${G}`:"",U=Y?`length=${Z}`:`type=${typeof W}`;throw Error(Q+"expected Uint8Array"+J+", got "+U)}return W}function tJ(W){let G=W.toString(16);return G.length&1?"0"+G:G}function UM(W){if(typeof W!=="string")throw Error("hex string expected, got "+typeof W);return W===""?Iz:BigInt("0x"+W)}function UX(W){return UM(YX(W))}function qM(W){return BW(W),UM(YX(Uint8Array.from(W).reverse()))}function PU(W,G){return AU(W.toString(16).padStart(G*2,"0"))}function NM(W,G){return PU(W,G).reverse()}function u8(W,G,X){let Y;if(typeof G==="string")try{Y=AU(G)}catch(V){throw Error(W+" must be hex string or Uint8Array, cause: "+V)}else if(MU(G))Y=Uint8Array.from(G);else throw Error(W+" must be hex string or Uint8Array");let Z=Y.length;if(typeof X==="number"&&Z!==X)throw Error(W+" of length "+X+" expected, got "+Z);return Y}var nA=(W)=>typeof W==="bigint"&&Iz<=W;function Vz(W,G,X){return nA(W)&&nA(G)&&nA(X)&&G<=W&&W<X}function Uu(W,G,X,Y){if(!Vz(G,X,Y))throw Error("expected valid "+W+": "+X+" <= n < "+Y+", got "+G)}function HM(W){let G;for(G=0;W>Iz;W>>=Zz,G+=1);return G}var uZ=(W)=>(Zz<<BigInt(W))-Zz;function qu(W,G,X){if(typeof W!=="number"||W<2)throw Error("hashLen must be a number");if(typeof G!=="number"||G<2)throw Error("qByteLen must be a number");if(typeof X!=="function")throw Error("hmacFn must be a function");let Y=(H)=>new Uint8Array(H),Z=(H)=>Uint8Array.of(H),V=Y(W),Q=Y(W),J=0,U=()=>{V.fill(1),Q.fill(0),J=0},q=(...H)=>X(Q,V,...H),N=(H=Y(0))=>{if(Q=q(Z(0),H),V=q(),H.length===0)return;Q=q(Z(1),H),V=q()},A=()=>{if(J++>=1000)throw Error("drbg: tried 1000 values");let H=0,I=[];while(H<G){V=q();let w=V.slice();I.push(w),H+=V.length}return H7(...I)};return(H,I)=>{U(),N(H);let w=void 0;while(!(w=I(A())))N();return U(),w}}function wz(W,G,X={}){if(!W||typeof W!=="object")throw Error("expected valid options object");function Y(Z,V,Q){let J=W[Z];if(Q&&J===void 0)return;let U=typeof J;if(U!==V||J===null)throw Error(`param "${Z}" is invalid: expected ${V}, got ${U}`)}Object.entries(G).forEach(([Z,V])=>Y(Z,V,!1)),Object.entries(X).forEach(([Z,V])=>Y(Z,V,!0))}function hD(W){let G=new WeakMap;return(X,...Y)=>{let Z=G.get(X);if(Z!==void 0)return Z;let V=W(X,...Y);return G.set(X,V),V}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var S9=BigInt(0),H9=BigInt(1),TW=BigInt(2),AM=BigInt(3),zM=BigInt(4),IM=BigInt(5),Nu=BigInt(7),wM=BigInt(8),Hu=BigInt(9),jM=BigInt(16);function w5(W,G){let X=W%G;return X>=S9?X:G+X}function I5(W,G,X){let Y=W;while(G-- >S9)Y*=Y,Y%=X;return Y}function bD(W,G){if(W===S9)throw Error("invert: expected non-zero number");if(G<=S9)throw Error("invert: expected positive modulus, got "+G);let X=w5(W,G),Y=G,Z=S9,V=H9,Q=H9,J=S9;while(X!==S9){let U=Y/X,q=Y%X,N=Z-Q*U,A=V-J*U;Y=X,X=q,Z=Q,V=J,Q=N,J=A}if(Y!==H9)throw Error("invert: does not exist");return w5(Z,G)}function jz(W,G,X){if(!W.eql(W.sqr(G),X))throw Error("Cannot find square root")}function OM(W,G){let X=(W.ORDER+H9)/zM,Y=W.pow(G,X);return jz(W,Y,G),Y}function Au(W,G){let X=(W.ORDER-IM)/wM,Y=W.mul(G,TW),Z=W.pow(Y,X),V=W.mul(G,Z),Q=W.mul(W.mul(V,TW),Z),J=W.mul(V,W.sub(Q,W.ONE));return jz(W,J,G),J}function zu(W){let G=hZ(W),X=KM(W),Y=X(G,G.neg(G.ONE)),Z=X(G,Y),V=X(G,G.neg(Y)),Q=(W+Nu)/jM;return(J,U)=>{let q=J.pow(U,Q),N=J.mul(q,Y),A=J.mul(q,Z),H=J.mul(q,V),I=J.eql(J.sqr(N),U),w=J.eql(J.sqr(A),U);q=J.cmov(q,N,I),N=J.cmov(H,A,w);let C=J.eql(J.sqr(N),U),D=J.cmov(q,N,C);return jz(J,D,U),D}}function KM(W){if(W<AM)throw Error("sqrt is not defined for small field");let G=W-H9,X=0;while(G%TW===S9)G/=TW,X++;let Y=TW,Z=hZ(W);while(mD(Z,Y)===1)if(Y++>1000)throw Error("Cannot find square root: probably non-prime P");if(X===1)return OM;let V=Z.pow(Y,G),Q=(G+H9)/TW;return function(J,U){if(J.is0(U))return U;if(mD(J,U)!==1)throw Error("Cannot find square root");let q=X,N=J.mul(J.ONE,V),A=J.pow(U,G),H=J.pow(U,Q);while(!J.eql(A,J.ONE)){if(J.is0(A))return J.ZERO;let I=1,w=J.sqr(A);while(!J.eql(w,J.ONE))if(I++,w=J.sqr(w),I===q)throw Error("Cannot find square root");let C=H9<<BigInt(q-I-1),D=J.pow(N,C);q=I,N=J.sqr(D),A=J.mul(A,N),H=J.mul(H,D)}return H}}function Iu(W){if(W%zM===AM)return OM;if(W%wM===IM)return Au;if(W%jM===Hu)return zu(W);return KM(W)}var wu=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function ju(W){let G={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},X=wu.reduce((Y,Z)=>{return Y[Z]="function",Y},G);return wz(W,X),W}function Ou(W,G,X){if(X<S9)throw Error("invalid exponent, negatives unsupported");if(X===S9)return W.ONE;if(X===H9)return G;let Y=W.ONE,Z=G;while(X>S9){if(X&H9)Y=W.mul(Y,Z);Z=W.sqr(Z),X>>=H9}return Y}function CM(W,G,X=!1){let Y=Array(G.length).fill(X?W.ZERO:void 0),Z=G.reduce((Q,J,U)=>{if(W.is0(J))return Q;return Y[U]=Q,W.mul(Q,J)},W.ONE),V=W.inv(Z);return G.reduceRight((Q,J,U)=>{if(W.is0(J))return Q;return Y[U]=W.mul(Q,Y[U]),W.mul(Q,J)},V),Y}function mD(W,G){let X=(W.ORDER-H9)/TW,Y=W.pow(G,X),Z=W.eql(Y,W.ONE),V=W.eql(Y,W.ZERO),Q=W.eql(Y,W.neg(W.ONE));if(!Z&&!V&&!Q)throw Error("invalid Legendre symbol result");return Z?1:V?0:-1}function DM(W,G){if(G!==void 0)Xz(G);let X=G!==void 0?G:W.toString(2).length,Y=Math.ceil(X/8);return{nBitLength:X,nByteLength:Y}}function hZ(W,G,X=!1,Y={}){if(W<=S9)throw Error("invalid field: expected ORDER > 0, got "+W);let Z=void 0,V=void 0,Q=!1,J=void 0;if(typeof G==="object"&&G!=null){if(Y.sqrt||X)throw Error("cannot specify opts in two arguments");let H=G;if(H.BITS)Z=H.BITS;if(H.sqrt)V=H.sqrt;if(typeof H.isLE==="boolean")X=H.isLE;if(typeof H.modFromBytes==="boolean")Q=H.modFromBytes;J=H.allowedLengths}else{if(typeof G==="number")Z=G;if(Y.sqrt)V=Y.sqrt}let{nBitLength:U,nByteLength:q}=DM(W,Z);if(q>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let N,A=Object.freeze({ORDER:W,isLE:X,BITS:U,BYTES:q,MASK:uZ(U),ZERO:S9,ONE:H9,allowedLengths:J,create:(H)=>w5(H,W),isValid:(H)=>{if(typeof H!=="bigint")throw Error("invalid field element: expected bigint, got "+typeof H);return S9<=H&&H<W},is0:(H)=>H===S9,isValidNot0:(H)=>!A.is0(H)&&A.isValid(H),isOdd:(H)=>(H&H9)===H9,neg:(H)=>w5(-H,W),eql:(H,I)=>H===I,sqr:(H)=>w5(H*H,W),add:(H,I)=>w5(H+I,W),sub:(H,I)=>w5(H-I,W),mul:(H,I)=>w5(H*I,W),pow:(H,I)=>Ou(A,H,I),div:(H,I)=>w5(H*bD(I,W),W),sqrN:(H)=>H*H,addN:(H,I)=>H+I,subN:(H,I)=>H-I,mulN:(H,I)=>H*I,inv:(H)=>bD(H,W),sqrt:V||((H)=>{if(!N)N=Iu(W);return N(A,H)}),toBytes:(H)=>X?NM(H,q):PU(H,q),fromBytes:(H,I=!0)=>{if(J){if(!J.includes(H.length)||H.length>q)throw Error("Field.fromBytes: expected "+J+" bytes, got "+H.length);let C=new Uint8Array(q);C.set(H,X?0:C.length-H.length),H=C}if(H.length!==q)throw Error("Field.fromBytes: expected "+q+" bytes, got "+H.length);let w=X?qM(H):UX(H);if(Q)w=w5(w,W);if(!I){if(!A.isValid(w))throw Error("invalid field element: outside of range 0..ORDER")}return w},invertBatch:(H)=>CM(A,H),cmov:(H,I,w)=>w?I:H});return Object.freeze(A)}function MM(W){if(typeof W!=="bigint")throw Error("field order must be bigint");let G=W.toString(2).length;return Math.ceil(G/8)}function TM(W){let G=MM(W);return G+Math.ceil(G/2)}function PM(W,G,X=!1){let Y=W.length,Z=MM(G),V=TM(G);if(Y<16||Y<V||Y>1024)throw Error("expected "+V+"-1024 bytes of input, got "+Y);let Q=X?qM(W):UX(W),J=w5(Q,G-H9)+H9;return X?NM(J,Z):PU(J,Z)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var QX=BigInt(0),PW=BigInt(1);function IU(W,G){let X=G.negate();return W?X:G}function iA(W,G){let X=CM(W.Fp,G.map((Y)=>Y.Z));return G.map((Y,Z)=>W.fromAffine(Y.toAffine(X[Z])))}function RM(W,G){if(!Number.isSafeInteger(W)||W<=0||W>G)throw Error("invalid window size, expected [1.."+G+"], got W="+W)}function rA(W,G){RM(W,G);let X=Math.ceil(G/W)+1,Y=2**(W-1),Z=2**W,V=uZ(W),Q=BigInt(W);return{windows:X,windowSize:Y,mask:V,maxNumber:Z,shiftBy:Q}}function fD(W,G,X){let{windowSize:Y,mask:Z,maxNumber:V,shiftBy:Q}=X,J=Number(W&Z),U=W>>Q;if(J>Y)J-=V,U+=PW;let q=G*Y,N=q+Math.abs(J)-1,A=J===0,H=J<0,I=G%2!==0;return{nextN:U,offset:N,isZero:A,isNeg:H,isNegF:I,offsetF:q}}function Ku(W,G){if(!Array.isArray(W))throw Error("array expected");W.forEach((X,Y)=>{if(!(X instanceof G))throw Error("invalid point at index "+Y)})}function Cu(W,G){if(!Array.isArray(W))throw Error("array of scalars expected");W.forEach((X,Y)=>{if(!G.isValid(X))throw Error("invalid scalar at index "+Y)})}var aA=new WeakMap,LM=new WeakMap;function sA(W){return LM.get(W)||1}function cD(W){if(W!==QX)throw Error("invalid wNAF")}class BM{constructor(W,G){this.BASE=W.BASE,this.ZERO=W.ZERO,this.Fn=W.Fn,this.bits=G}_unsafeLadder(W,G,X=this.ZERO){let Y=W;while(G>QX){if(G&PW)X=X.add(Y);Y=Y.double(),G>>=PW}return X}precomputeWindow(W,G){let{windows:X,windowSize:Y}=rA(G,this.bits),Z=[],V=W,Q=V;for(let J=0;J<X;J++){Q=V,Z.push(Q);for(let U=1;U<Y;U++)Q=Q.add(V),Z.push(Q);V=Q.double()}return Z}wNAF(W,G,X){if(!this.Fn.isValid(X))throw Error("invalid scalar");let Y=this.ZERO,Z=this.BASE,V=rA(W,this.bits);for(let Q=0;Q<V.windows;Q++){let{nextN:J,offset:U,isZero:q,isNeg:N,isNegF:A,offsetF:H}=fD(X,Q,V);if(X=J,q)Z=Z.add(IU(A,G[H]));else Y=Y.add(IU(N,G[U]))}return cD(X),{p:Y,f:Z}}wNAFUnsafe(W,G,X,Y=this.ZERO){let Z=rA(W,this.bits);for(let V=0;V<Z.windows;V++){if(X===QX)break;let{nextN:Q,offset:J,isZero:U,isNeg:q}=fD(X,V,Z);if(X=Q,U)continue;else{let N=G[J];Y=Y.add(q?N.negate():N)}}return cD(X),Y}getPrecomputes(W,G,X){let Y=aA.get(G);if(!Y){if(Y=this.precomputeWindow(G,W),W!==1){if(typeof X==="function")Y=X(Y);aA.set(G,Y)}}return Y}cached(W,G,X){let Y=sA(W);return this.wNAF(Y,this.getPrecomputes(Y,W,X),G)}unsafe(W,G,X,Y){let Z=sA(W);if(Z===1)return this._unsafeLadder(W,G,Y);return this.wNAFUnsafe(Z,this.getPrecomputes(Z,W,X),G,Y)}createCache(W,G){RM(G,this.bits),LM.set(W,G),aA.delete(W)}hasCache(W){return sA(W)!==1}}function Du(W,G,X,Y){let Z=G,V=W.ZERO,Q=W.ZERO;while(X>QX||Y>QX){if(X&PW)V=V.add(Z);if(Y&PW)Q=Q.add(Z);Z=Z.double(),X>>=PW,Y>>=PW}return{p1:V,p2:Q}}function Mu(W,G,X,Y){Ku(X,W),Cu(Y,G);let Z=X.length,V=Y.length;if(Z!==V)throw Error("arrays of points and scalars must have equal length");let Q=W.ZERO,J=HM(BigInt(Z)),U=1;if(J>12)U=J-3;else if(J>4)U=J-2;else if(J>0)U=2;let q=uZ(U),N=Array(Number(q)+1).fill(Q),A=Math.floor((G.BITS-1)/U)*U,H=Q;for(let I=A;I>=0;I-=U){N.fill(Q);for(let C=0;C<V;C++){let D=Y[C],x=Number(D>>BigInt(I)&q);N[x]=N[x].add(X[C])}let w=Q;for(let C=N.length-1,D=Q;C>0;C--)D=D.add(N[C]),w=w.add(D);if(H=H.add(w),I!==0)for(let C=0;C<U;C++)H=H.double()}return H}function pD(W,G,X){if(G){if(G.ORDER!==W)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return ju(G),G}else return hZ(W,{isLE:X})}function Tu(W,G,X={},Y){if(Y===void 0)Y=W==="edwards";if(!G||typeof G!=="object")throw Error(`expected valid ${W} CURVE object`);for(let J of["p","n","h"]){let U=G[J];if(!(typeof U==="bigint"&&U>QX))throw Error(`CURVE.${J} must be positive bigint`)}let Z=pD(G.p,X.Fp,Y),V=pD(G.n,X.Fn,Y),Q=["Gx","Gy","a",W==="weierstrass"?"b":"d"];for(let J of Q)if(!Z.isValid(G[J]))throw Error(`CURVE.${J} must be valid field element of CURVE.Fp`);return G=Object.freeze(Object.assign({},G)),{CURVE:G,Fp:Z,Fn:V}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var lD=(W,G)=>(W+(W>=0?G:-G)/$M)/G;function Pu(W,G,X){let[[Y,Z],[V,Q]]=G,J=lD(Q*W,X),U=lD(-Z*W,X),q=W-J*Y-U*V,N=-J*Z-U*Q,A=q<W4,H=N<W4;if(A)q=-q;if(H)N=-N;let I=uZ(Math.ceil(HM(X)/2))+ZX;if(q<W4||q>=I||N<W4||N>=I)throw Error("splitScalar (endomorphism): failed, k="+W);return{k1neg:A,k1:q,k2neg:H,k2:N}}function Qz(W){if(!["compact","recovered","der"].includes(W))throw Error('Signature format must be "compact", "recovered", or "der"');return W}function tA(W,G){let X={};for(let Y of Object.keys(G))X[Y]=W[Y]===void 0?G[Y]:W[Y];if(zU(X.lowS,"lowS"),zU(X.prehash,"prehash"),X.format!==void 0)Qz(X.format);return X}class EM extends Error{constructor(W=""){super(W)}}var e7={Err:EM,_tlv:{encode:(W,G)=>{let{Err:X}=e7;if(W<0||W>256)throw new X("tlv.encode: wrong tag");if(G.length&1)throw new X("tlv.encode: unpadded data");let Y=G.length/2,Z=tJ(Y);if(Z.length/2&128)throw new X("tlv.encode: long form length too big");let V=Y>127?tJ(Z.length/2|128):"";return tJ(W)+V+Z+G},decode(W,G){let{Err:X}=e7,Y=0;if(W<0||W>256)throw new X("tlv.encode: wrong tag");if(G.length<2||G[Y++]!==W)throw new X("tlv.decode: wrong tlv");let Z=G[Y++],V=!!(Z&128),Q=0;if(!V)Q=Z;else{let U=Z&127;if(!U)throw new X("tlv.decode(long): indefinite length not supported");if(U>4)throw new X("tlv.decode(long): byte length is too big");let q=G.subarray(Y,Y+U);if(q.length!==U)throw new X("tlv.decode: length bytes not complete");if(q[0]===0)throw new X("tlv.decode(long): zero leftmost byte");for(let N of q)Q=Q<<8|N;if(Y+=U,Q<128)throw new X("tlv.decode(long): not minimal encoding")}let J=G.subarray(Y,Y+Q);if(J.length!==Q)throw new X("tlv.decode: wrong value length");return{v:J,l:G.subarray(Y+Q)}}},_int:{encode(W){let{Err:G}=e7;if(W<W4)throw new G("integer: negative integers are not allowed");let X=tJ(W);if(Number.parseInt(X[0],16)&8)X="00"+X;if(X.length&1)throw new G("unexpected DER parsing assertion: unpadded hex");return X},decode(W){let{Err:G}=e7;if(W[0]&128)throw new G("invalid signature integer: negative");if(W[0]===0&&!(W[1]&128))throw new G("invalid signature integer: unnecessary leading zero");return UX(W)}},toSig(W){let{Err:G,_int:X,_tlv:Y}=e7,Z=u8("signature",W),{v:V,l:Q}=Y.decode(48,Z);if(Q.length)throw new G("invalid signature: left bytes after parsing");let{v:J,l:U}=Y.decode(2,V),{v:q,l:N}=Y.decode(2,U);if(N.length)throw new G("invalid signature: left bytes after parsing");return{r:X.decode(J),s:X.decode(q)}},hexFromSig(W){let{_tlv:G,_int:X}=e7,Y=G.encode(2,X.encode(W.r)),Z=G.encode(2,X.encode(W.s)),V=Y+Z;return G.encode(48,V)}},W4=BigInt(0),ZX=BigInt(1),$M=BigInt(2),eJ=BigInt(3),Ru=BigInt(4);function RW(W,G){let{BYTES:X}=W,Y;if(typeof G==="bigint")Y=G;else{let Z=u8("private key",G);try{Y=W.fromBytes(Z)}catch(V){throw Error(`invalid private key: expected ui8a of size ${X}, got ${typeof G}`)}}if(!W.isValidNot0(Y))throw Error("invalid private key: out of range [1..N-1]");return Y}function Lu(W,G={}){let X=Tu("weierstrass",W,G),{Fp:Y,Fn:Z}=X,V=X.CURVE,{h:Q,n:J}=V;wz(G,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});let{endo:U}=G;if(U){if(!Y.is0(V.a)||typeof U.beta!=="bigint"||!Array.isArray(U.basises))throw Error('invalid endo: expected "beta": bigint and "basises": array')}let q=SM(Y,Z);function N(){if(!Y.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}function A(y,o,B){let{x:R,y:_}=o.toAffine(),S=Y.toBytes(R);if(zU(B,"isCompressed"),B){N();let v=!Y.isOdd(_);return H7(FM(v),S)}else return H7(Uint8Array.of(4),S,Y.toBytes(_))}function H(y){MW(y,void 0,"Point");let{publicKey:o,publicKeyUncompressed:B}=q,R=y.length,_=y[0],S=y.subarray(1);if(R===o&&(_===2||_===3)){let v=Y.fromBytes(S);if(!Y.isValid(v))throw Error("bad point: is not on curve, wrong x");let P=C(v),E;try{E=Y.sqrt(P)}catch(k){let f=k instanceof Error?": "+k.message:"";throw Error("bad point: is not on curve, sqrt error"+f)}N();let b=Y.isOdd(E);if((_&1)===1!==b)E=Y.neg(E);return{x:v,y:E}}else if(R===B&&_===4){let v=Y.BYTES,P=Y.fromBytes(S.subarray(0,v)),E=Y.fromBytes(S.subarray(v,v*2));if(!D(P,E))throw Error("bad point: is not on curve");return{x:P,y:E}}else throw Error(`bad point: got length ${R}, expected compressed=${o} or uncompressed=${B}`)}let I=G.toBytes||A,w=G.fromBytes||H;function C(y){let o=Y.sqr(y),B=Y.mul(o,y);return Y.add(Y.add(B,Y.mul(y,V.a)),V.b)}function D(y,o){let B=Y.sqr(o),R=C(y);return Y.eql(B,R)}if(!D(V.Gx,V.Gy))throw Error("bad curve params: generator point");let x=Y.mul(Y.pow(V.a,eJ),Ru),h=Y.mul(Y.sqr(V.b),BigInt(27));if(Y.is0(Y.add(x,h)))throw Error("bad curve params: a or b");function p(y,o,B=!1){if(!Y.isValid(o)||B&&Y.is0(o))throw Error(`bad point coordinate ${y}`);return o}function u(y){if(!(y instanceof m))throw Error("ProjectivePoint expected")}function n(y){if(!U||!U.basises)throw Error("no endo");return Pu(y,U.basises,Z.ORDER)}let c=hD((y,o)=>{let{X:B,Y:R,Z:_}=y;if(Y.eql(_,Y.ONE))return{x:B,y:R};let S=y.is0();if(o==null)o=S?Y.ONE:Y.inv(_);let v=Y.mul(B,o),P=Y.mul(R,o),E=Y.mul(_,o);if(S)return{x:Y.ZERO,y:Y.ZERO};if(!Y.eql(E,Y.ONE))throw Error("invZ was invalid");return{x:v,y:P}}),l=hD((y)=>{if(y.is0()){if(G.allowInfinityPoint&&!Y.is0(y.Y))return;throw Error("bad point: ZERO")}let{x:o,y:B}=y.toAffine();if(!Y.isValid(o)||!Y.isValid(B))throw Error("bad point: x or y not field elements");if(!D(o,B))throw Error("bad point: equation left != right");if(!y.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});function G0(y,o,B,R,_){return B=new m(Y.mul(B.X,y),B.Y,B.Z),o=IU(R,o),B=IU(_,B),o.add(B)}class m{constructor(y,o,B){this.X=p("x",y),this.Y=p("y",o,!0),this.Z=p("z",B),Object.freeze(this)}static CURVE(){return V}static fromAffine(y){let{x:o,y:B}=y||{};if(!y||!Y.isValid(o)||!Y.isValid(B))throw Error("invalid affine point");if(y instanceof m)throw Error("projective point not allowed");if(Y.is0(o)&&Y.is0(B))return m.ZERO;return new m(o,B,Y.ONE)}static fromBytes(y){let o=m.fromAffine(w(MW(y,void 0,"point")));return o.assertValidity(),o}static fromHex(y){return m.fromBytes(u8("pointHex",y))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(y=8,o=!0){if(U0.createCache(this,y),!o)this.multiply(eJ);return this}assertValidity(){l(this)}hasEvenY(){let{y}=this.toAffine();if(!Y.isOdd)throw Error("Field doesn't support isOdd");return!Y.isOdd(y)}equals(y){u(y);let{X:o,Y:B,Z:R}=this,{X:_,Y:S,Z:v}=y,P=Y.eql(Y.mul(o,v),Y.mul(_,R)),E=Y.eql(Y.mul(B,v),Y.mul(S,R));return P&&E}negate(){return new m(this.X,Y.neg(this.Y),this.Z)}double(){let{a:y,b:o}=V,B=Y.mul(o,eJ),{X:R,Y:_,Z:S}=this,v=Y.ZERO,P=Y.ZERO,E=Y.ZERO,b=Y.mul(R,R),k=Y.mul(_,_),f=Y.mul(S,S),e=Y.mul(R,_);return e=Y.add(e,e),E=Y.mul(R,S),E=Y.add(E,E),v=Y.mul(y,E),P=Y.mul(B,f),P=Y.add(v,P),v=Y.sub(k,P),P=Y.add(k,P),P=Y.mul(v,P),v=Y.mul(e,v),E=Y.mul(B,E),f=Y.mul(y,f),e=Y.sub(b,f),e=Y.mul(y,e),e=Y.add(e,E),E=Y.add(b,b),b=Y.add(E,b),b=Y.add(b,f),b=Y.mul(b,e),P=Y.add(P,b),f=Y.mul(_,S),f=Y.add(f,f),b=Y.mul(f,e),v=Y.sub(v,b),E=Y.mul(f,k),E=Y.add(E,E),E=Y.add(E,E),new m(v,P,E)}add(y){u(y);let{X:o,Y:B,Z:R}=this,{X:_,Y:S,Z:v}=y,P=Y.ZERO,E=Y.ZERO,b=Y.ZERO,k=V.a,f=Y.mul(V.b,eJ),e=Y.mul(o,_),q0=Y.mul(B,S),Q0=Y.mul(R,v),$0=Y.add(o,B),D0=Y.add(_,S);$0=Y.mul($0,D0),D0=Y.add(e,q0),$0=Y.sub($0,D0),D0=Y.add(o,R);let k0=Y.add(_,v);return D0=Y.mul(D0,k0),k0=Y.add(e,Q0),D0=Y.sub(D0,k0),k0=Y.add(B,R),P=Y.add(S,v),k0=Y.mul(k0,P),P=Y.add(q0,Q0),k0=Y.sub(k0,P),b=Y.mul(k,D0),P=Y.mul(f,Q0),b=Y.add(P,b),P=Y.sub(q0,b),b=Y.add(q0,b),E=Y.mul(P,b),q0=Y.add(e,e),q0=Y.add(q0,e),Q0=Y.mul(k,Q0),D0=Y.mul(f,D0),q0=Y.add(q0,Q0),Q0=Y.sub(e,Q0),Q0=Y.mul(k,Q0),D0=Y.add(D0,Q0),e=Y.mul(q0,D0),E=Y.add(E,e),e=Y.mul(k0,D0),P=Y.mul($0,P),P=Y.sub(P,e),e=Y.mul($0,q0),b=Y.mul(k0,b),b=Y.add(b,e),new m(P,E,b)}subtract(y){return this.add(y.negate())}is0(){return this.equals(m.ZERO)}multiply(y){let{endo:o}=G;if(!Z.isValidNot0(y))throw Error("invalid scalar: out of range");let B,R,_=(S)=>U0.cached(this,S,(v)=>iA(m,v));if(o){let{k1neg:S,k1:v,k2neg:P,k2:E}=n(y),{p:b,f:k}=_(v),{p:f,f:e}=_(E);R=k.add(e),B=G0(o.beta,b,f,S,P)}else{let{p:S,f:v}=_(y);B=S,R=v}return iA(m,[B,R])[0]}multiplyUnsafe(y){let{endo:o}=G,B=this;if(!Z.isValid(y))throw Error("invalid scalar: out of range");if(y===W4||B.is0())return m.ZERO;if(y===ZX)return B;if(U0.hasCache(this))return this.multiply(y);if(o){let{k1neg:R,k1:_,k2neg:S,k2:v}=n(y),{p1:P,p2:E}=Du(m,B,_,v);return G0(o.beta,P,E,R,S)}else return U0.unsafe(B,y)}multiplyAndAddUnsafe(y,o,B){let R=this.multiplyUnsafe(o).add(y.multiplyUnsafe(B));return R.is0()?void 0:R}toAffine(y){return c(this,y)}isTorsionFree(){let{isTorsionFree:y}=G;if(Q===ZX)return!0;if(y)return y(m,this);return U0.unsafe(this,J).is0()}clearCofactor(){let{clearCofactor:y}=G;if(Q===ZX)return this;if(y)return y(m,this);return this.multiplyUnsafe(Q)}isSmallOrder(){return this.multiplyUnsafe(Q).is0()}toBytes(y=!0){return zU(y,"isCompressed"),this.assertValidity(),I(m,this,y)}toHex(y=!0){return YX(this.toBytes(y))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(y=!0){return this.toBytes(y)}_setWindowSize(y){this.precompute(y)}static normalizeZ(y){return iA(m,y)}static msm(y,o){return Mu(m,Z,y,o)}static fromPrivateKey(y){return m.BASE.multiply(RW(Z,y))}}m.BASE=new m(V.Gx,V.Gy,Y.ONE),m.ZERO=new m(Y.ZERO,Y.ONE,Y.ZERO),m.Fp=Y,m.Fn=Z;let Y0=Z.BITS,U0=new BM(m,G.endo?Math.ceil(Y0/2):Y0);return m.BASE.precompute(8),m}function FM(W){return Uint8Array.of(W?2:3)}function SM(W,G){return{secretKey:G.BYTES,publicKey:1+W.BYTES,publicKeyUncompressed:1+2*W.BYTES,publicKeyHasPrefix:!0,signature:2*G.BYTES}}function Bu(W,G={}){let{Fn:X}=W,Y=G.randomBytes||TU,Z=Object.assign(SM(W.Fp,X),{seed:TM(X.ORDER)});function V(H){try{return!!RW(X,H)}catch(I){return!1}}function Q(H,I){let{publicKey:w,publicKeyUncompressed:C}=Z;try{let D=H.length;if(I===!0&&D!==w)return!1;if(I===!1&&D!==C)return!1;return!!W.fromBytes(H)}catch(D){return!1}}function J(H=Y(Z.seed)){return PM(MW(H,Z.seed,"seed"),X.ORDER)}function U(H,I=!0){return W.BASE.multiply(RW(X,H)).toBytes(I)}function q(H){let I=J(H);return{secretKey:I,publicKey:U(I)}}function N(H){if(typeof H==="bigint")return!1;if(H instanceof W)return!0;let{secretKey:I,publicKey:w,publicKeyUncompressed:C}=Z;if(X.allowedLengths||I===w)return;let D=u8("key",H).length;return D===w||D===C}function A(H,I,w=!0){if(N(H)===!0)throw Error("first arg must be private key");if(N(I)===!1)throw Error("second arg must be public key");let C=RW(X,H);return W.fromHex(I).multiply(C).toBytes(w)}return Object.freeze({getPublicKey:U,getSharedSecret:A,keygen:q,Point:W,utils:{isValidSecretKey:V,isValidPublicKey:Q,randomSecretKey:J,isValidPrivateKey:V,randomPrivateKey:J,normPrivateKeyToScalar:(H)=>RW(X,H),precompute(H=8,I=W.BASE){return I.precompute(H,!1)}},lengths:Z})}function Eu(W,G,X={}){XM(G),wz(X,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let Y=X.randomBytes||TU,Z=X.hmac||((B,...R)=>JM(G,B,H7(...R))),{Fp:V,Fn:Q}=W,{ORDER:J,BITS:U}=Q,{keygen:q,getPublicKey:N,getSharedSecret:A,utils:H,lengths:I}=Bu(W,X),w={prehash:!1,lowS:typeof X.lowS==="boolean"?X.lowS:!1,format:void 0,extraEntropy:!1},C="compact";function D(B){let R=J>>ZX;return B>R}function x(B,R){if(!Q.isValidNot0(R))throw Error(`invalid signature ${B}: out of range 1..Point.Fn.ORDER`);return R}function h(B,R){Qz(R);let _=I.signature,S=R==="compact"?_:R==="recovered"?_+1:void 0;return MW(B,S,`${R} signature`)}class p{constructor(B,R,_){if(this.r=x("r",B),this.s=x("s",R),_!=null)this.recovery=_;Object.freeze(this)}static fromBytes(B,R=C){h(B,R);let _;if(R==="der"){let{r:E,s:b}=e7.toSig(MW(B));return new p(E,b)}if(R==="recovered")_=B[0],R="compact",B=B.subarray(1);let S=Q.BYTES,v=B.subarray(0,S),P=B.subarray(S,S*2);return new p(Q.fromBytes(v),Q.fromBytes(P),_)}static fromHex(B,R){return this.fromBytes(AU(B),R)}addRecoveryBit(B){return new p(this.r,this.s,B)}recoverPublicKey(B){let R=V.ORDER,{r:_,s:S,recovery:v}=this;if(v==null||![0,1,2,3].includes(v))throw Error("recovery id invalid");if(J*$M<R&&v>1)throw Error("recovery id is ambiguous for h>1 curve");let P=v===2||v===3?_+J:_;if(!V.isValid(P))throw Error("recovery id 2 or 3 invalid");let E=V.toBytes(P),b=W.fromBytes(H7(FM((v&1)===0),E)),k=Q.inv(P),f=n(u8("msgHash",B)),e=Q.create(-f*k),q0=Q.create(S*k),Q0=W.BASE.multiplyUnsafe(e).add(b.multiplyUnsafe(q0));if(Q0.is0())throw Error("point at infinify");return Q0.assertValidity(),Q0}hasHighS(){return D(this.s)}toBytes(B=C){if(Qz(B),B==="der")return AU(e7.hexFromSig(this));let R=Q.toBytes(this.r),_=Q.toBytes(this.s);if(B==="recovered"){if(this.recovery==null)throw Error("recovery bit must be present");return H7(Uint8Array.of(this.recovery),R,_)}return H7(R,_)}toHex(B){return YX(this.toBytes(B))}assertValidity(){}static fromCompact(B){return p.fromBytes(u8("sig",B),"compact")}static fromDER(B){return p.fromBytes(u8("sig",B),"der")}normalizeS(){return this.hasHighS()?new p(this.r,Q.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return YX(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return YX(this.toBytes("compact"))}}let u=X.bits2int||function(B){if(B.length>8192)throw Error("input is too large");let R=UX(B),_=B.length*8-U;return _>0?R>>BigInt(_):R},n=X.bits2int_modN||function(B){return Q.create(u(B))},c=uZ(U);function l(B){return Uu("num < 2^"+U,B,W4,c),Q.toBytes(B)}function G0(B,R){return MW(B,void 0,"message"),R?MW(G(B),void 0,"prehashed message"):B}function m(B,R,_){if(["recovered","canonical"].some((Q0)=>(Q0 in _)))throw Error("sign() legacy options not supported");let{lowS:S,prehash:v,extraEntropy:P}=tA(_,w);B=G0(B,v);let E=n(B),b=RW(Q,R),k=[l(b),l(E)];if(P!=null&&P!==!1){let Q0=P===!0?Y(I.secretKey):P;k.push(u8("extraEntropy",Q0))}let f=H7(...k),e=E;function q0(Q0){let $0=u(Q0);if(!Q.isValidNot0($0))return;let D0=Q.inv($0),k0=W.BASE.multiply($0).toAffine(),H1=Q.create(k0.x);if(H1===W4)return;let U1=Q.create(D0*Q.create(e+H1*b));if(U1===W4)return;let J0=(k0.x===H1?0:2)|Number(k0.y&ZX),B0=U1;if(S&&D(U1))B0=Q.neg(U1),J0^=1;return new p(H1,B0,J0)}return{seed:f,k2sig:q0}}function Y0(B,R,_={}){B=u8("message",B);let{seed:S,k2sig:v}=m(B,R,_);return qu(G.outputLen,Q.BYTES,Z)(S,v)}function U0(B){let R=void 0,_=typeof B==="string"||MU(B),S=!_&&B!==null&&typeof B==="object"&&typeof B.r==="bigint"&&typeof B.s==="bigint";if(!_&&!S)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(S)R=new p(B.r,B.s);else if(_){try{R=p.fromBytes(u8("sig",B),"der")}catch(v){if(!(v instanceof e7.Err))throw v}if(!R)try{R=p.fromBytes(u8("sig",B),"compact")}catch(v){return!1}}if(!R)return!1;return R}function y(B,R,_,S={}){let{lowS:v,prehash:P,format:E}=tA(S,w);if(_=u8("publicKey",_),R=G0(u8("message",R),P),"strict"in S)throw Error("options.strict was renamed to lowS");let b=E===void 0?U0(B):p.fromBytes(u8("sig",B),E);if(b===!1)return!1;try{let k=W.fromBytes(_);if(v&&b.hasHighS())return!1;let{r:f,s:e}=b,q0=n(R),Q0=Q.inv(e),$0=Q.create(q0*Q0),D0=Q.create(f*Q0),k0=W.BASE.multiplyUnsafe($0).add(k.multiplyUnsafe(D0));if(k0.is0())return!1;return Q.create(k0.x)===f}catch(k){return!1}}function o(B,R,_={}){let{prehash:S}=tA(_,w);return R=G0(R,S),p.fromBytes(B,"recovered").recoverPublicKey(R).toBytes()}return Object.freeze({keygen:q,getPublicKey:N,getSharedSecret:A,utils:H,lengths:I,Point:W,sign:Y0,verify:y,recoverPublicKey:o,Signature:p,hash:G})}function $u(W){let G={a:W.a,b:W.b,p:W.Fp.ORDER,n:W.n,h:W.h,Gx:W.Gx,Gy:W.Gy},X=W.Fp,Y=W.allowedPrivateKeyLengths?Array.from(new Set(W.allowedPrivateKeyLengths.map((Q)=>Math.ceil(Q/2)))):void 0,Z=hZ(G.n,{BITS:W.nBitLength,allowedLengths:Y,modFromBytes:W.wrapPrivateKey}),V={Fp:X,Fn:Z,allowInfinityPoint:W.allowInfinityPoint,endo:W.endo,isTorsionFree:W.isTorsionFree,clearCofactor:W.clearCofactor,fromBytes:W.fromBytes,toBytes:W.toBytes};return{CURVE:G,curveOpts:V}}function Fu(W){let{CURVE:G,curveOpts:X}=$u(W),Y={hmac:W.hmac,randomBytes:W.randomBytes,lowS:W.lowS,bits2int:W.bits2int,bits2int_modN:W.bits2int_modN};return{CURVE:G,curveOpts:X,hash:W.hash,ecdsaOpts:Y}}function Su(W,G){let X=G.Point;return Object.assign({},G,{ProjectivePoint:X,CURVE:Object.assign({},W,DM(X.Fn.ORDER,X.Fn.BITS))})}function xu(W){let{CURVE:G,curveOpts:X,hash:Y,ecdsaOpts:Z}=Fu(W),V=Lu(G,X),Q=Eu(V,Y,Z);return Su(W,Q)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ku(W,G){let X=(Y)=>xu({...W,hash:Y});return{...X(G),create:X}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var JX={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},_u={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},yu=BigInt(0),dD=BigInt(1),Jz=BigInt(2);function vu(W){let G=JX.p,X=BigInt(3),Y=BigInt(6),Z=BigInt(11),V=BigInt(22),Q=BigInt(23),J=BigInt(44),U=BigInt(88),q=W*W*W%G,N=q*q*W%G,A=I5(N,X,G)*N%G,H=I5(A,X,G)*N%G,I=I5(H,Jz,G)*q%G,w=I5(I,Z,G)*I%G,C=I5(w,V,G)*w%G,D=I5(C,J,G)*C%G,x=I5(D,U,G)*D%G,h=I5(x,J,G)*C%G,p=I5(h,X,G)*N%G,u=I5(p,Q,G)*w%G,n=I5(u,Y,G)*q%G,c=I5(n,Jz,G);if(!wU.eql(wU.sqr(c),W))throw Error("Cannot find square root");return c}var wU=hZ(JX.p,{sqrt:vu}),xM=ku({...JX,Fp:wU,lowS:!0,endo:_u},Yz),oD={};function jU(W,...G){let X=oD[W];if(X===void 0){let Y=Yz(ZM(W));X=H7(Y,Y),oD[W]=X}return Yz(H7(X,...G))}var Oz=(W)=>W.toBytes(!0).slice(1),qX=(()=>xM.Point)(),Kz=(W)=>W%Jz===yu;function Uz(W){let{Fn:G,BASE:X}=qX,Y=RW(G,W),Z=X.multiply(Y);return{scalar:Kz(Z.y)?Y:G.neg(Y),bytes:Oz(Z)}}function kM(W){let G=wU;if(!G.isValidNot0(W))throw Error("invalid x: Fail if x \u2265 p");let X=G.create(W*W),Y=G.create(X*W+BigInt(7)),Z=G.sqrt(Y);if(!Kz(Z))Z=G.neg(Z);let V=qX.fromAffine({x:W,y:Z});return V.assertValidity(),V}var gZ=UX;function _M(...W){return qX.Fn.create(gZ(jU("BIP0340/challenge",...W)))}function nD(W){return Uz(W).bytes}function gu(W,G,X=TU(32)){let{Fn:Y}=qX,Z=u8("message",W),{bytes:V,scalar:Q}=Uz(G),J=u8("auxRand",X,32),U=Y.toBytes(Q^gZ(jU("BIP0340/aux",J))),q=jU("BIP0340/nonce",U,V,Z),{bytes:N,scalar:A}=Uz(q),H=_M(N,V,Z),I=new Uint8Array(64);if(I.set(N,0),I.set(Y.toBytes(Y.create(A+H*Q)),32),!yM(I,Z,V))throw Error("sign: Invalid signature produced");return I}function yM(W,G,X){let{Fn:Y,BASE:Z}=qX,V=u8("signature",W,64),Q=u8("message",G),J=u8("publicKey",X,32);try{let U=kM(gZ(J)),q=gZ(V.subarray(0,32));if(!Vz(q,dD,JX.p))return!1;let N=gZ(V.subarray(32,64));if(!Vz(N,dD,JX.n))return!1;let A=_M(Y.toBytes(q),Oz(U),Q),H=Z.multiplyUnsafe(N).add(U.multiplyUnsafe(Y.neg(A))),{x:I,y:w}=H.toAffine();if(H.is0()||!Kz(w)||I!==q)return!1;return!0}catch(U){return!1}}var Cz=(()=>{let W=(X=TU(48))=>{return PM(X,JX.n)};xM.utils.randomSecretKey;function G(X){let Y=W(X);return{secretKey:Y,publicKey:nD(Y)}}return{keygen:G,getPublicKey:nD,sign:gu,verify:yM,Point:qX,utils:{randomSecretKey:W,randomPrivateKey:W,taggedHash:jU,lift_x:kM,pointToBytes:Oz,numberToBytesBE:PU,bytesToNumberBE:UX,mod:w5},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:64,seed:48}}})(),uu=new TextEncoder,hu=new TextDecoder,LW=(W)=>uu.encode(W),kZ=(W)=>hu.decode(W),qz=(W)=>Array.from(W,(G)=>G.toString(16).padStart(2,"0")).join(""),G4=JSON.stringify,OU=JSON.parse,vM=(W,G=Number.MAX_SAFE_INTEGER)=>W.split("").reduce((X,Y)=>X+Y.charCodeAt(0),0)%G,Dz="AES-GCM",bu={},gM="$",uM=",",mu=(W)=>{let G=new Uint8Array(W),X=32768,Y="";for(let Z=0;Z<G.length;Z+=32768)Y+=String.fromCharCode(...G.subarray(Z,Z+32768));return btoa(Y)},fu=(W)=>Uint8Array.from(atob(W),(G)=>G.charCodeAt(0)).buffer,WU=(W)=>bu[W]??=crypto.subtle.digest("SHA-1",LW(W)).then((G)=>{let X=new Uint8Array(G),Y="";for(let Z of X)Y+=Z.toString(36);return Y}),cu=async(W,G,X)=>{let Y=await crypto.subtle.digest("SHA-256",LW(`${W}:${G}:${X}`));return crypto.subtle.importKey("raw",Y,{name:Dz},!1,["encrypt","decrypt"])},pu=async(W,G)=>{let X=crypto.getRandomValues(new Uint8Array(12)),Y=await W,Z=await crypto.subtle.encrypt({name:Dz,iv:X},Y,LW(G));return`${X.join(uM)}${gM}${mu(Z)}`},lu=async(W,G)=>{let[X,Y]=G.split(gM);if(!X||!Y)throw Error("Invalid encrypted payload format");let Z=Uint8Array.from(X.split(uM),Number),V=await W,Q=await crypto.subtle.decrypt({name:Dz,iv:Z},V,fu(Y));return kZ(Q)},k5="GenosRTC",Mz=(W,G)=>Array.from({length:W},G),KU=(W)=>Array.from(crypto.getRandomValues(new Uint8Array(W)),(G)=>"0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"[G%62]).join(""),e1=typeof sessionStorage<"u"?sessionStorage.__genosrtcId??=KU(20):KU(20),XX=Promise.all.bind(Promise),du=typeof window<"u",{entries:ou,fromEntries:hM,keys:Re}=Object,nu=()=>{},t7=(W)=>Error(`GenosRTC: ${W}`),GU=(...W)=>W.join("@"),iu=(W,G)=>{let X=[...W],Y=X.length,Z=()=>{let V=Math.sin(G++)*1e4;return V-Math.floor(V)};while(Y){let V=Math.floor(Z()*Y--);[X[Y],X[V]]=[X[V],X[Y]]}return X},ru=5000,iD="icegatheringstatechange",rD="offer",au="answer",su=[...Mz(3,(W,G)=>`stun:stun${G||""}.l.google.com:19302`),"stun:stun.cloudflare.com:3478"].map((W)=>({urls:W})),aD=(W,{rtcConfig:G,rtcPolyfill:X,turnConfig:Y})=>{let Z=new(X||RTCPeerConnection)({iceServers:[...su,...Y||[]],...G}),V={},Q=!1,J=!1,U,q=(H)=>Object.assign(H,{binaryType:"arraybuffer",bufferedAmountLowThreshold:65535,onmessage:(I)=>V.data?.(I.data),onopen:()=>V.connect?.(),onclose:()=>V.close?.(),onerror:(I)=>!I?.error?.message?.includes("User-Initiated Abort")&&V.error?.(I)}),N=()=>Promise.race([new Promise((H)=>{let I=()=>{if(Z.iceGatheringState==="complete")Z.removeEventListener(iD,I),H()};Z.addEventListener(iD,I),I()}),new Promise((H)=>setTimeout(H,ru))]).then(()=>({type:Z.localDescription.type,sdp:Z.localDescription.sdp.replace(/a=ice-options:trickle\s\n/g,"")}));if(W?q(U=Z.createDataChannel("data")):Z.ondatachannel=({channel:H})=>q(U=H),Z.onnegotiationneeded=async()=>{try{Q=!0,await Z.setLocalDescription(),V.signal?.(await N())}catch(H){V.error?.(H)}finally{Q=!1}},Z.onconnectionstatechange=()=>{if(["disconnected","failed","closed"].includes(Z.connectionState))V.close?.()},Z.ontrack=(H)=>{V.track?.(H.track,H.streams[0]),V.stream?.(H.streams[0])},Z.onremovestream=(H)=>V.stream?.(H.stream),W&&!Z.canTrickleIceCandidates)Z.onnegotiationneeded();let A=()=>Z.getSenders();return{created:Date.now(),connection:Z,get channel(){return U},get isDead(){return Z.connectionState==="closed"},async signal(H){if(U?.readyState==="open"&&!H.sdp?.includes("a=rtpmap"))return;try{if(H.type===rD){if(Q||Z.signalingState!=="stable"&&!J){if(W)return;await XX([Z.setLocalDescription({type:"rollback"}),Z.setRemoteDescription(H)])}else await Z.setRemoteDescription(H);await Z.setLocalDescription();let I=await N();return V.signal?.(I),I}if(H.type===au){J=!0;try{await Z.setRemoteDescription(H)}finally{J=!1}}}catch(I){V.error?.(I)}},sendData:(H)=>{if(U?.readyState==="open")U.send(H)},destroy:()=>{U?.close(),Z.close(),Q=J=!1},setHandlers:(H)=>Object.assign(V,H),offerPromise:W?new Promise((H)=>V.signal=(I)=>I.type===rD&&H(I)):Promise.resolve(),addStream:(H)=>H.getTracks().forEach((I)=>Z.addTrack(I,H)),removeStream:(H)=>A().filter((I)=>H.getTracks().includes(I.track)).forEach((I)=>Z.removeTrack(I)),addTrack:(H,I)=>Z.addTrack(H,I),removeTrack:(H)=>{let I=A().find((w)=>w.track===H);if(I)Z.removeTrack(I)},replaceTrack:(H,I)=>A().find((w)=>w.track===H)?.replaceTrack(I)}},tu=Object.getPrototypeOf(Uint8Array),QU=12,bM=0,JU=bM+QU,UU=JU+1,_Z=UU+1,yZ=_Z+1,xZ=16384-yZ,XU=255,eA="bufferedamountlow",GX=(W)=>`@_${W}`,Wz=100,eu=3,Wh=200,Gh=(W,G,X,Y)=>{let Z=new Map,V=new Map,Q=new Map,J={},U={},q={},N={},A=new Map,H=(S,v)=>{if(!A.has(S))A.set(S,new Set);A.get(S).add(v)},I=(S,v)=>A.get(S)?.delete(v),w=(S,...v)=>A.get(S)?.forEach((P)=>P(...v)),C=(S,v)=>{let P=S?Array.isArray(S)?S:[S]:Z.keys();return Array.from(P,(E)=>{let b=Z.get(E);if(!b)return console.warn(`${k5}: no peer with id ${E}`),null;return v(E,b)}).filter(Boolean)},D=(S)=>{if(!Z.has(S))return;Z.delete(S),delete J[S],delete U[S],delete q[S],delete N[S],w("peer:leave",S),G(S)},x=(S)=>new Promise((v,P)=>{let E=setTimeout(()=>{S.removeEventListener(eA,b),P(Error(`${k5}: bufferLow timeout`))},5000);function b(){clearTimeout(E),S.removeEventListener(eA,b),v()}S.addEventListener(eA,b)}),h=(S)=>{if(Q.has(S))return Q.get(S);if(!S)throw t7("action type is required");let v=LW(S);if(v.byteLength>QU)throw t7(`\u274C "${S}" exceeds ${QU} bytes. Use a shorter name.`);let P=new Uint8Array(QU).map((Q0,$0)=>v[$0]||0),E=0,b=new Map([["message",new Set],["progress",new Set]]),k=(Q0,$0)=>b.get(Q0)?.add($0),f=(Q0,$0)=>b.get(Q0)?.delete($0),e=async(Q0,$0,D0,k0)=>{if(D0&&typeof D0!=="object")throw t7("meta must be object");if(Q0===void 0)throw t7("data cannot be undefined");let H1=Q0 instanceof Blob,U1=H1||Q0 instanceof ArrayBuffer||Q0 instanceof tu,J0=typeof Q0!=="string";if(D0&&!U1)throw t7("meta only allowed with binary");let B0=U1?new Uint8Array(H1?await Q0.arrayBuffer():Q0):LW(J0?G4(Q0):Q0),h0=D0?LW(G4(D0)):null,Y1=Math.ceil(B0.byteLength/xZ)+(D0?1:0)||1;if(Y1>Wz)throw t7(`Message too large, exceeds max chunks ${Wz}`);let A8=Mz(Y1,(F1,E0)=>{let l0=E0===Y1-1,q1=D0&&E0===0,d1=q1?h0:B0.subarray(D0?(E0-1)*xZ:E0*xZ,D0?E0*xZ:(E0+1)*xZ),j8=new Uint8Array(yZ+d1.byteLength);return j8.set(P),j8.set([E],JU),j8.set([l0|q1<<1|U1<<2|J0<<3],UU),j8.set([Math.round((E0+1)/Y1*XU)],_Z),j8.set(d1,yZ),j8});return E=E+1&XU,XX(C($0,async(F1,E0)=>{let{channel:l0}=E0;for(let q1=0;q1<Y1;q1++){let d1=0;while(l0.bufferedAmount>l0.bufferedAmountLowThreshold){if(d1++>eu)throw t7(`${k5}: send buffer full, max retries reached for peer ${F1}`);try{await x(l0)}catch(j8){console.warn(j8.message),await new Promise((v8)=>setTimeout(v8,Wh))}}if(!Z.has(F1))break;E0.sendData(A8[q1]),k0?.(A8[q1][_Z]/XU,F1,D0)}}))};V.set(S,{listeners:b,send:e});let q0={send:e,on:k,off:f};return Q.set(S,q0),q0},p=(S,v)=>{try{let P=new Uint8Array(v),E=kZ(P.subarray(bM,JU)).replace(/\x00/g,"");if(!V.has(E))return console.warn(`${k5}: unregistered type (${E})`);let[b]=P.subarray(JU,UU),[k]=P.subarray(UU,_Z),[f]=P.subarray(_Z,yZ),e=P.subarray(yZ),q0=Boolean(k&1),Q0=Boolean(k&2),$0=Boolean(k&4),D0=Boolean(k&8),k0=V.get(E),H1=(J[S]||={})[E]||={};if(H1[b]?.chunks?.length>Wz){console.warn(`${k5}: peer ${S} sent too many chunks for nonce ${b}, ignoring.`);return}let U1=H1[b]||={chunks:[]};if(Q0)try{U1.meta=OU(kZ(e))}catch{console.warn(`${k5}: failed to parse meta from peer ${S} for type ${E}`);return}else U1.chunks.push(e);if(k0.listeners.get("progress").forEach((h0)=>{try{h0(f/XU,S,U1.meta)}catch(Y1){console.error(Y1)}}),!q0)return;let J0=new Uint8Array(U1.chunks.reduce((h0,Y1)=>h0+Y1.byteLength,0));U1.chunks.reduce((h0,Y1)=>(J0.set(Y1,h0),h0+Y1.byteLength),0),delete H1[b];let B0;if($0)B0=J0;else if(D0)try{B0=OU(kZ(J0))}catch{console.warn(`${k5}: failed to parse JSON message data from peer ${S} for type ${E}`);return}else B0=kZ(J0);k0.listeners.get("message").forEach((h0)=>{try{h0(B0,S,U1.meta)}catch(Y1){console.error(Y1)}})}catch(P){console.error(`${k5}: error handling data from peer ${S}:`,P)}},u=async()=>{try{await R(""),await new Promise((S)=>setTimeout(S,99))}catch(S){console.warn(`${k5}: error sending leave`,S)}for(let[S,v]of Z){try{v.destroy()}catch{}Z.delete(S)}X()},{send:n,on:c}=h(GX("ping")),{send:l,on:G0}=h(GX("pong")),{send:m,on:Y0}=h(GX("signal")),{send:U0,on:y}=h(GX("stream")),{send:o,on:B}=h(GX("track")),{send:R,on:_}=h(GX("leave"));if(W((S,v)=>{let P=Z.get(v);if(P===S)return;if(P){let E=()=>{};P.setHandlers({data:E,stream:E,track:E,signal:E,close:E,error:E})}Z.set(v,S),S.setHandlers({data:(E)=>p(v,E),stream:(E)=>{w("stream:add",E,v,q[v]),delete q[v]},track:(E,b)=>{w("track:add",E,b,v,N[v]),delete N[v]},signal:(E)=>m(E,v),close:()=>D(v),error:(E)=>{console.error(`${k5}: peer error for ${v}`,E),D(v)}}),w("peer:join",v,Y?.(v))}),c("message",(S,v)=>l("",v)),G0("message",(S,v)=>{U[v]?.(),delete U[v]}),Y0("message",(S,v)=>Z.get(v)?.signal(S)),y("message",(S,v)=>q[v]=S),B("message",(S,v)=>N[v]=S),_("message",(S,v)=>D(v)),du)addEventListener("beforeunload",u);return{on:H,off:I,channel:h,leave:u,ping:async(S)=>{if(!S)throw t7("ping() requires target peer ID");let v=Date.now();return n("",S),await new Promise((P)=>U[S]=P),Date.now()-v},getPeers:()=>hM(Array.from(Z,([S,v])=>[S,v.connection])),addStream:(S,v,P)=>C(v,async(E,b)=>{if(P)await U0(P,E);b.addStream(S)}),removeStream:(S,v)=>C(v,(P,E)=>E.removeStream(S)),addTrack:(S,v,P,E)=>C(P,async(b,k)=>{if(E)await o(E,b);k.addTrack(S,v)}),removeTrack:(S,v)=>C(v,(P,E)=>E.removeTrack(S)),replaceTrack:(S,v,P,E)=>C(P,async(b,k)=>{if(E)await o(E,b);k.replaceTrack(S,v)})}},Xh=5,Yh=10,Zh=2500,YU=57333,Vh=({init:W,subscribe:G,announce:X})=>{let Y={},Z=!1,V,Q;return(J,U,q)=>{let{appId:N}=J;if(Y[N]?.[U])return Y[N][U];if(!J||!U||!N&&!J.firebaseApp)throw t7(!J?"config required":!U?"roomId required":"appId missing");let A=nu;if(!Z){let _=W(J);Q=Mz(Xh,()=>{try{return aD(!0,J)}catch{return null}}).filter(Boolean),V=Array.isArray(_)?_:[_];let S=setInterval(()=>{Q=Q.filter((v)=>{let P=Date.now()-v.created<YU;if(!P)v.destroy();return P})},YU);Y.offerCleanupTimer||=S,Z=!0}let H={},I={},w=new Map,C=new Map,D={},x=GU(k5,N,U),h=WU(x),p=WU(GU(x,e1)),u=cu(J.password||"",N,U),n=(_)=>async(S)=>({type:S.type,sdp:await _(u,S.sdp)}),c=n(lu),l=n(pu),G0=(_)=>{return setTimeout(()=>{if(!_.isDead&&!Object.values(I).includes(_))_.destroy()},YU),_},m=(_)=>{try{return G0(aD(_,J))}catch{return null}},Y0=(_,S)=>{if(I[S]===_)return;I[S]?.destroy(),I[S]=_,A(_,S),H[S]?.forEach((v)=>v!==_&&v.destroy()),delete H[S]},U0=(_,S)=>{if(I[S]===_)delete I[S]},y=(_)=>async(S,v,P)=>{let[E,b]=await XX([h,p]);if(S!==E&&S!==b)return;let{peerId:k,offer:f,answer:e,type:q0}=typeof v==="string"?OU(v):v;if(k&&k!==e1)C.set(k,Date.now());if(q0&&k)D[k]=q0;if(k===e1||I[k])return;if(J.admit&&!J.admit(k))return;if(f){if(H[k]?.[_]&&e1>k)return;let Q0=m(!1);if(!Q0)return;Q0.setHandlers({connect:()=>Y0(Q0,k),close:()=>U0(Q0,k)});try{let $0=await c(f);if(Q0.isDead)return;let[D0,k0]=await XX([WU(GU(x,k)),Q0.signal($0).then(l)]);P(D0,G4({peerId:e1,answer:k0,...J.type&&{type:J.type}}))}catch{q?.({error:"decryption failed (offer)",appId:N,peerId:k,roomId:U})}}else if(e){let Q0=H[k]?.[_];if(!Q0||Q0.isDead)return;Q0.setHandlers({connect:()=>Y0(Q0,k),close:()=>U0(Q0,k)});try{Q0.signal(await c(e))}catch{q?.({error:"decryption failed (answer)",appId:N,peerId:k,roomId:U})}}else{let Q0=H[k]||=[];if(Q0.forEach((U1,J0)=>{if(U1&&(U1.isDead||Date.now()-(U1.dialedAt??U1.created)>YU)){if(U1.isDead)w.set(k,Date.now()+30000);U1.destroy(),delete Q0[J0]}}),Q0[_]||Q0.filter(Boolean).length>=2||w.get(k)>Date.now())return;if(Object.values(H).reduce((U1,J0)=>U1+J0.filter((B0)=>B0&&!B0.isDead).length,0)>=Yh)return;let $0=Q.pop(),D0=$0?G0($0):m(!0);if(!D0){w.set(k,Date.now()+30000);return}D0.dialedAt=Date.now();let[k0,{offer:H1}]=await XX([WU(GU(x,k)),D0.offerPromise.then(l).then((U1)=>({offer:U1}))]);Q0[_]=D0,D0.setHandlers({connect:()=>Y0(D0,k),close:()=>U0(D0,k)}),P(k0,G4({peerId:e1,offer:H1,peer:D0,...J.type&&{type:J.type}}))}},o=[],B=[];V.forEach(async(_,S)=>{let v=await _;if(!v)return;let[P,E]=await XX([h,p]);B[S]=G(v,P,E,y(S));let b=async()=>{let k=await X(v,P,E);o[S]=setTimeout(b,typeof k==="number"?k:Zh)};b()}),Y[N]||={};let R=Gh((_)=>A=_,(_)=>delete I[_],()=>R.onCleanup?.(),(_)=>D[_]);return R.onCleanup=()=>{if(delete Y[N][U],o.forEach(clearTimeout),B.forEach((_)=>_?.()),Object.keys(Y).length===0)clearInterval(Y.offerCleanupTimer),delete Y.offerCleanupTimer},R._census=()=>{for(let S of Object.keys(I))C.set(S,Date.now());let _=Date.now()-120000;for(let[S,v]of C)if(v<_)C.delete(S);return[...C.keys()]},Y[N][U]=R}},sD=3333,ZU={},mM={},Qh=(W,G)=>{let X={},Y=null,Z=()=>{if(Y)clearTimeout(Y),Y=null;let V=new WebSocket(W);V.onclose=()=>{ZU[W]??=sD,Y=setTimeout(Z,ZU[W]),ZU[W]*=2},V.onmessage=(Q)=>G(Q.data),X.socket=V,X.url=V.url,X.ready=new Promise((Q)=>{V.onopen=()=>{ZU[W]=sD,Q(X)}}),X.send=(Q)=>{if(V.readyState===1)V.send(Q)}};return X.forceReconnect=Z,Z(),mM[W]=X,X};if(typeof window<"u"){let W=()=>{dA.info("\u26A1 [GenosRTC] Network event detected. Forcing reconnection\u2026"),Object.values(mM).forEach((G)=>{if(G.socket&&G.socket.readyState!==WebSocket.OPEN&&G.socket.readyState!==WebSocket.CONNECTING)G.forceReconnect()})};window.addEventListener("online",()=>{dA.info("\u2705 Reconnected to the network."),W()}),window.addEventListener("offline",async()=>{dA.info("\u274C Disconnected from the network.")}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible")W()})}var Jh=(W)=>()=>hM(ou(W).map(([G,X])=>[G,X.socket])),Uh=(W,G,X,Y)=>(W.relayUrls??(Y?iu(G,vM(W.appId)):G)).slice(0,W.relayUrls?.length??W.relayRedundancy??X),qh=["wss://relay.primal.net","wss://ftp.halifax.rwth-aachen.de/nostr","wss://nostr.oxtr.dev","wss://nostr.sathoarder.com","wss://nostr.mom","wss://nos.lol","wss://nostr.vulpem.com","wss://nostr.data.haus","wss://relay.mostro.network","wss://relay.nostrdice.com"],VX={},Nh=10,fM="x",cM="EVENT",Hh=/pow:\s*(\d+)\s*bits needed\.?/i,Nz=new Set,pM=Cz.utils.randomSecretKey(),Ah=qz(Cz.getPublicKey(pM)),Tz={},vZ={},zh={},lM=()=>Math.floor(Date.now()/1000),dM=(W)=>zh[W]??=vM(W,1e4)+20000,CU=(W)=>W.replace(/\/$/,""),Ih=(W,G)=>{let[X,Y,Z,V]=OU(G);if(X===cM)return vZ[Y]?.(Tz[Y],Z.content);if(X==="NOTICE"||X==="OK"&&!Z){if(+((X==="NOTICE"?Y:V).match(Hh)?.[1]??0)>0){let Q=CU(W);Nz.add(Q),VX[Q]?.close?.(),delete VX[Q]}}},wh=(W)=>{let G=CU(W);if(VX[G])return VX[G];let X=Qh(G,(Y)=>Ih(G,Y));return VX[G]=X},tD=async(W,G)=>{let X={kind:dM(W),content:G,pubkey:Ah,created_at:lM(),tags:[[fM,W]]},Y=LW(G4([0,X.pubkey,X.created_at,X.kind,X.tags,X.content])),Z=new Uint8Array(await crypto.subtle.digest("SHA-256",Y)),V=Cz.sign(Z,pM);return G4([cM,{...X,id:qz(Z),sig:qz(V)}])},eD=(W,G)=>{return Tz[W]=G,G4(["REQ",W,{kinds:[dM(G)],since:lM(),["#"+fM]:[G]}])},WM=(W)=>{return delete Tz[W],G4(["CLOSE",W])},oM=Vh({init:(W)=>{let G=(W?.relayUrls?.length?W.relayUrls:null)??qh;return Uh(W,G,Nh,!1).map(wh).map((X)=>X.ready.then(()=>X).catch(()=>null))},subscribe:(W,G,X,Y)=>{let Z=KU(64),V=KU(64);return vZ[Z]=vZ[V]=(Q,J)=>Y(Q,J,async(U,q)=>{if(Nz.has(CU(W.url)))return;W.send(await tD(U,q))}),W.send(eD(Z,G)),W.send(eD(V,X)),()=>{W.send(WM(Z)),W.send(WM(V)),delete vZ[Z],delete vZ[V]}},announce:async(W,G)=>{if(Nz.has(CU(W.url)))return;W.send(await tD(G,G4({peerId:e1})))}}),Le=Jh(VX),jh={cellSize:"auto",bridgesPerEdge:2,maxCellSize:50,targetCells:100,debug:!1},GM=5000,Oh=3000,Kh=30000,Ch=2000,DU=(W)=>{let G=String(W||"").match(/cell-(\d+)/);return G?Number(G[1]):null},Dh=(W,G)=>{let X=DU(W);if(X==null)return[];let Y=[];for(let Z=1;Z<G;Z*=2){if(X-Z>=0)Y.push(`cell-${X-Z}`);if(X+Z<G)Y.push(`cell-${X+Z}`)}return Y},VU=(W)=>`c${(DU(W)||0).toString(36)}`,Mh=(W,G,X)=>{if(W<=10)return Math.max(2,W);let Y=10,Z=Math.ceil(W/G);return Math.max(Y,Math.min(X,Z))},Th=(W,G)=>{return Math.max(1,Math.ceil(W/G))},nM=(W)=>{let G=0;for(let X=0;X<W.length;X++)G=Math.imul(G^W.charCodeAt(X),2654435761);return G>>>0},Gz=(W,G)=>{let X=0,Y=-1;for(let Z=0;Z<G;Z++){let V=nM(`${W}:${Z}`);if(V>Y)Y=V,X=Z}return X};class qU{constructor(W){this.peerId=W,this.joinedAt=Date.now(),this.lastSeen=Date.now(),this.rttSamples=[],this.stability=1,this.reconnects=0,this.isResponsive=!0,this.connectedCells=new Set}get uptime(){return Date.now()-this.joinedAt}get avgRtt(){if(this.rttSamples.length===0)return 1/0;return Math.round(this.rttSamples.reduce((W,G)=>W+G,0)/this.rttSamples.length)}get healthScore(){let W=this.avgRtt===1/0?0.5:Math.max(0,100-this.avgRtt)/100,G=Math.min(1,this.uptime/60000),X=this.stability,Y=this.isResponsive?1:0.3;return W*0.25+G*0.25+X*0.3+Y*0.2}get isStale(){return Date.now()-this.lastSeen>Kh}addRttSample(W){if(this.rttSamples.push(W),this.rttSamples.length>10)this.rttSamples.shift();this.lastSeen=Date.now(),this.isResponsive=!0}markReconnect(){this.reconnects++,this.stability=Math.max(0,1-this.reconnects*0.1)}markUnresponsive(){this.isResponsive=!1}markSeen(){this.lastSeen=Date.now()}addConnectedCell(W){if(W)this.connectedCells.add(W)}}function Ph(W,G={},X={}){let Y={...jh,...G},Z=!!Y.debug,V=(...$)=>Z&&console.debug("[cells]",...$),Q=Math.max(0,Y.bridgesPerEdge|0),J=Math.max(5,Y.maxCellSize|0),U=Math.max(10,Y.targetCells|0),q=Y.cellSize==="auto",N=q?2:Math.max(1,Y.cellSize|0),A={cellId:null,bridges:[],isBridge:!1},H=null,I=null,w=null,C=new Map,D=new Map,x=new Set,h=new Map,p=new Set,u=new Set,n=0,c=[],l=new Map,G0=new Set,m=new Map,Y0=new Map,U0=1,y=0,o=1,B=0,R=()=>{B0();let $=Th(J0().length,N);if($!==o)o=$,B=Date.now();let d=Date.now()-B;if($>U0&&d>4000)U0=$;else if($<U0&&d>30000)U0=$;return U0},_=()=>Math.min(150,Math.ceil(Math.log2(R()+1))*2+3),S=($)=>Dh($,R()),v=W.on?.bind(W),P=W.off?.bind(W);if(v)W.on=($,d)=>String($).startsWith("mesh:")?k($,d):v($,d);if(P)W.off=($,d)=>String($).startsWith("mesh:")?h.get($)?.delete(d):P($,d);let E=($)=>(x.add($),()=>x.delete($)),b=($,d,X0)=>{if(u.has(X0))return;if(u.add(X0),u.size>GM){let w0=u.values().next().value;u.delete(w0)}for(let w0 of x)try{w0($,d)}catch(e0){V("Error in deliver handler:",e0)}},k=($,d)=>{if(!h.has($))h.set($,new Set);return h.get($).add(d),()=>h.get($)?.delete(d)},f=($,...d)=>{let X0=h.get($);if(X0)for(let w0 of X0)try{w0(...d)}catch{}},e=($)=>{try{return typeof $==="string"?JSON.parse($):$}catch{return null}},q0=()=>`${e1}:${Date.now().toString(36)}:${(n++&65535).toString(36)}`,Q0=()=>{if(p.size>GM)p.delete(p.values().next().value)},$0=($,d,X0=[])=>{if(!$||!d)return;if(C.set($,{cell:d,isBridge:X0.length>0,bridges:[...X0]}),!D.has($))D.set($,new qU($));let w0=D.get($);if(w0.markSeen(),w0.addConnectedCell(d),Y0.set(d,{lastSeen:Date.now(),peerId:$}),X0.length>0)for(let e0 of S(d))w0.addConnectedCell(e0)},D0=($)=>D.get($),k0=($,d)=>{let X0=D.get($);if(X0)X0.addRttSample(d)},H1=($)=>{let d=E0($);if(d.length===0)return null;let X0=0,w0=0;for(let K1 of d){let r0=D.get(K1);if(r0&&!r0.isStale){if(X0+=r0.healthScore,r0.isResponsive)w0++}}let e0=d.filter((K1)=>{let r0=D.get(K1);return r0&&!r0.isStale});return{cellId:$,memberCount:e0.length,avgHealth:e0.length>0?X0/e0.length:0,responsiveRatio:e0.length>0?w0/e0.length:0}},U1=()=>{let $=H1(A.cellId);f("mesh:health",{...A,health:$})},J0=()=>[...new Set([...W._census(),e1])].sort(),B0=()=>{if(!q)return;let $=J0().length,d=Mh($,U,J);if(d!==N)V("cellSize changed:",N,"->",d),N=d},h0=($,d)=>d.filter((X0)=>Gz(X0,R())===$),Y1=($,d)=>{if(Q===0)return[];let X0=DU($),w0=DU(d);if(X0==null||w0==null)return[];let e0=J0(),K1=h0(X0,e0),r0=h0(w0,e0),K0=Math.min(X0,w0),F0=Math.max(X0,w0),g0=(o1)=>nM(`${o1}@${K0}~${F0}`),x0=[...new Set([...K1,...r0])].sort((o1,V7)=>g0(V7)-g0(o1));if(!x0.length)return[];let Q1=new Set(K1),X1=[],S1=(o1)=>o1&&!X1.includes(o1)&&X1.push(o1);S1(x0.find((o1)=>Q1.has(o1))),S1(x0.find((o1)=>!Q1.has(o1)));for(let o1 of x0){if(X1.length>=Math.max(Q,2))break;S1(o1)}return X1},A8=($,d)=>{if(Q===0)return[];let X0=S(d),w0=[];for(let e0 of X0)if(Y1(d,e0).includes($))w0.push(e0);return w0},F1=()=>{B0();let $=J0(),d=Gz(e1,R()),X0=R(),w0=`cell-${d}`,e0=A8(e1,w0),K1=e0.length>0;return V("computeState",{self:e1,myCell:w0,isBridge:K1,bridgeEdges:e0,cellSize:N,rosterSize:$.length,totalCells:X0,dynamicTTL:_()}),{cellId:w0,isBridge:K1,bridges:e0,cellSize:N,dynamicTTL:_(),totalCells:X0}},E0=($)=>{let d=[],X0=new Set(Object.keys(W.getPeers?.()||{}));for(let[w0,e0]of C)if(e0.cell===$){let K1=D.get(w0);if(X0.has(w0)&&(!K1||!K1.isStale))d.push(w0)}return d.sort(),d},l0=()=>{if(!H)return;Q9=qW(),X6=Date.now();let $={t:"state",id:q0(),ttl:_(),data:{id:e1,cell:A.cellId,bridges:A.bridges,health:D.get(e1)?.healthScore||0.5,timestamp:Date.now()},origin:e1,originCell:A.cellId},d=JSON.stringify($);H.send(d),q1(I,d)},q1=($,d)=>{let X0=e(d);if(!X0?.id||!X0?.t)return;let w0=p.has(X0.id);if(!w0)p.add(X0.id),Q0();let{t:e0,id:K1,ttl:r0,data:K0,origin:F0,originCell:g0}=X0,x0=A.cellId;if(e0==="state"&&K0)$0(K0.id,K0.cell,K0.bridges),f("mesh:peer-state",K0);if(e0==="ping"&&K0?.pingId&&F0!==e1){let X1={t:"pong",id:q0(),ttl:_(),data:{pingId:K0.pingId,receivedAt:Date.now()},origin:e1,originCell:x0};H?.send(JSON.stringify(X1))}if(e0==="pong"&&K0?.pingId){let X1=m.get(K0.pingId);if(X1){clearTimeout(X1.timeout);let S1=Date.now()-X1.start;k0(X1.peerId,S1),X1.resolve(S1),m.delete(K0.pingId)}}if(e0==="msg"&&F0!==e1){if(g0===x0||Q>0)b(K0,F0,K1)}if(w0)return;if(!A.isBridge)return;if((r0??0)<=0)return;let Q1=(X1,S1,o1=null)=>{if(!X1)return;let V7={t:e0,id:K1,ttl:o1??(r0??_())-1,data:K0,origin:F0||e1,originCell:g0||x0},NW=JSON.stringify(V7);if(S1?.length){let JZ=new Set(Object.keys(W.getPeers?.()||{})),J9=S1.filter((kJ)=>JZ.has(kJ));if(J9.length>0)X1.send(NW,J9)}else X1.send(NW)};if($===I){for(let X1 of S(x0))Q1(d1(X1),null);return}if(!S(x0).map(VU).includes($))return;Q1(H,null);for(let X1 of S(x0))if(VU(X1)!==$)Q1(d1(X1),null)},d1=($)=>{let d=VU($);if(l.has($))return l.get($);let X0=W.channel(d);if(l.set($,X0),!G0.has(d))G0.add(d),X0.on("message",(w0)=>q1(d,w0));return X0},j8=()=>{if(!A.cellId)return;if(I=VU(A.cellId),H=W.channel(I),!G0.has(I))G0.add(I),H.on("message",($)=>q1(I,$));if(A.isBridge)for(let $ of S(A.cellId))d1($);if(c.length)for(let $ of c.splice(0)){let d={t:"msg",id:q0(),ttl:_(),data:$,origin:e1,originCell:A.cellId},X0=JSON.stringify(d);H.send(X0),q1(I,X0)}l0()},v8=($)=>{if(!A.cellId)return!0;if(!J0().includes($))return!0;let d=`cell-${Gz($,R())}`;if(d===A.cellId)return!0;if(A.bridges.includes(d))return!0;return S(A.cellId).includes(d)&&Y1(d,A.cellId).includes($)},O8=()=>{let $=W.getPeers?.()||{};for(let d of Object.keys($))if(!v8(d))$[d].close?.()};X.admit=v8;let q8=()=>{let $=F1(),d=!A.cellId||A.cellId!==$.cellId||A.isBridge!==$.isBridge||JSON.stringify(A.bridges)!==JSON.stringify($.bridges);if(A=$,$0(e1,$.cellId,$.bridges),d)j8();else l0();O8(),f("mesh:state",$),U1()},Q9="",X6=0,qW=()=>{return`${A.cellId}:${A.isBridge}:${A.bridges.join(",")}`},QZ=()=>{if(w)return;w=setInterval(()=>{let $=R();if($!==y){y=$,q8();return}let d=qW();if(d!==Q9||Date.now()-X6>1e4)l0(),Q9=d;for(let[X0,w0]of D)if(X0!==e1&&w0.isStale)C.delete(X0),D.delete(X0),V("Removed stale peer:",X0)},Ch)},n7=()=>{if(w)clearInterval(w),w=null},i=($)=>{return new Promise((d,X0)=>{let w0=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,e0=Date.now(),K1=setTimeout(()=>{m.delete(w0);let K0=D.get($);if(K0)K0.markUnresponsive();X0(Error("Ping timeout"))},Oh);m.set(w0,{start:e0,resolve:d,reject:X0,timeout:K1,peerId:$});let r0={t:"ping",id:q0(),ttl:_(),data:{pingId:w0,target:$},origin:e1,originCell:A.cellId};H?.send(JSON.stringify(r0))})};if(W.on?.("peer:join",($)=>{if(!D.has($))D.set($,new qU($));else D.get($).markReconnect();q8()}),W.on?.("peer:leave",($)=>{C.delete($),q8()}),!D.has(e1))D.set(e1,new qU(e1));return D.get(e1).addConnectedCell(A.cellId||"cell-0"),q8(),QZ(),{send:($)=>{if(!A.cellId||!H)return c.push($);let d={t:"msg",id:q0(),ttl:_(),data:$,origin:e1,originCell:A.cellId},X0=JSON.stringify(d);H.send(X0),q1(I,X0)},on:($,d)=>$==="message"?E(d):void 0,ping:i,getState:()=>({...A,cellSize:N,health:H1(A.cellId),dynamicTTL:_(),totalCells:R(),knownCells:Y0.size}),getMetrics:D0,getCellHealth:H1,getPeerInfo:()=>new Map(C),getStableRoster:()=>J0(),getKnownCells:()=>new Map(Y0),getCellSize:()=>N,destroy:()=>{n7(),m.forEach(($)=>clearTimeout($.timeout)),m.clear(),u.clear(),Y0.clear()}}}function Rh(W,G,X){let Y={},Z=oM({...W,admit:(U)=>Y.admit?.(U)??!0},G,X),V=W.overlay||{},Q=Ph(Z,V,Y),J=new Map;return{on:(U,q)=>Z.on(U,q),off:(U,q)=>Z.off?.(U,q),channel:(U)=>{if(J.has(U))return J.get(U);let q=Z.channel(U),N={send:(A,H)=>{Q.send({_ch:U,_d:A,_t:H})},on:(A,H)=>{if(A==="message")Q.on("message",(I,w)=>{if(I?._ch===U)H(I._d,w)}),q.on(A,H);else q.on(A,H)},off:(A,H)=>q.off?.(A,H),_original:q};return J.set(U,N),N},get id(){return Z.id},get peers(){return Z.peers},getPeers:()=>Z.getPeers?.()||{},mesh:Q,_room:Z,getState:()=>Q.getState(),getMetrics:(U)=>Q.getMetrics(U),getCellHealth:(U)=>Q.getCellHealth(U),getPeerInfo:()=>Q.getPeerInfo(),ping:(U)=>Q.ping(U),leave:()=>{Q.destroy(),J.clear(),Z.leave()},destroy:()=>{Q.destroy(),J.clear()}}}var Pz=(W,G,X)=>W?.cells||W?.overlay?Rh(W,G,X):oM(W,G,X);import{randomBytes as A2}from"crypto";function Lh(){var W,G=!1,X=this;X._DeArray=function(Y,Z,V){return[Y.slice(Z,Z+V)]},X._EnArray=function(Y,Z,V,Q){for(var J=0;J<V;Y[Z+J]=Q[J]?Q[J]:0,J++);},X._DeChar=function(Y,Z){return String.fromCharCode(Y[Z])},X._EnChar=function(Y,Z,V){Y[Z]=V.charCodeAt(0)},X._DeInt=function(Y,Z){var V=G?W.len-1:0,Q=G?-1:1,J=V+Q*W.len,U,q,N;for(U=0,q=V,N=1;q!=J;U+=Y[Z+q]*N,q+=Q,N*=256);if(W.bSigned&&U&Math.pow(2,W.len*8-1))U-=Math.pow(2,W.len*8);return U},X._EnInt=function(Y,Z,V){var Q=G?W.len-1:0,J=G?-1:1,U=Q+J*W.len,q;V=V<W.min?W.min:V>W.max?W.max:V;for(q=Q;q!=U;Y[Z+q]=V&255,q+=J,V>>=8);},X._DeString=function(Y,Z,V){for(var Q=Array(V),J=0;J<V;Q[J]=String.fromCharCode(Y[Z+J]),J++);return Q.join("")},X._EnString=function(Y,Z,V,Q){for(var J,U=0;U<V;Y[Z+U]=(J=Q.charCodeAt(U))?J:0,U++);},X._De754=function(Y,Z){var V,Q,J,U,q,N,A,H,I,w;A=W.mLen,H=W.len*8-W.mLen-1,w=(1<<H)-1,I=w>>1,U=G?0:W.len-1,q=G?1:-1,V=Y[Z+U],U+=q,N=-7;for(Q=V&(1<<-N)-1,V>>=-N,N+=H;N>0;Q=Q*256+Y[Z+U],U+=q,N-=8);for(J=Q&(1<<-N)-1,Q>>=-N,N+=A;N>0;J=J*256+Y[Z+U],U+=q,N-=8);switch(Q){case 0:Q=1-I;break;case w:return J?NaN:(V?-1:1)*(1/0);default:J=J+Math.pow(2,A),Q=Q-I;break}return(V?-1:1)*J*Math.pow(2,Q-A)},X._En754=function(Y,Z,V){var Q,J,U,q,N,A,H,I,w,C;if(H=W.mLen,I=W.len*8-W.mLen-1,C=(1<<I)-1,w=C>>1,Q=V<0?1:0,V=Math.abs(V),isNaN(V)||V==1/0)U=isNaN(V)?1:0,J=C;else{if(J=Math.floor(Math.log(V)/Math.LN2),V*(A=Math.pow(2,-J))<1)J--,A*=2;if(J+w>=1)V+=W.rt/A;else V+=W.rt*Math.pow(2,1-w);if(V*A>=2)J++,A/=2;if(J+w>=C)U=0,J=C;else if(J+w>=1)U=(V*A-1)*Math.pow(2,H),J=J+w;else U=V*Math.pow(2,w-1)*Math.pow(2,H),J=0}for(q=G?W.len-1:0,N=G?-1:1;H>=8;Y[Z+q]=U&255,q+=N,U/=256,H-=8);for(J=J<<H|U,I+=H;I>0;Y[Z+q]=J&255,q+=N,J/=256,I-=8);Y[Z+q-N]|=Q*128},X._DeInt64=function(Y,Z){var V=G?0:7,Q=G?1:-1,J=V+Q*8,U=[0,0,!W.bSigned],q,N,A;for(q=V,A=1,N=0;q!=J;U[A]=(U[A]<<8>>>0)+Y[Z+q],q+=Q,N++,A=N<4?1:0);return U},X._EnInt64=function(Y,Z,V){var Q=G?0:7,J=G?1:-1,U=Q+J*8,q,N,A,H;for(q=Q,A=1,N=0,H=24;q!=U;Y[Z+q]=V[A]>>H&255,q+=J,N++,A=N<4?1:0,H=24-8*(N%4));},X._sPattern="(\\d + )?([AxcbBhHsfdiIlLqQ])",X._lenLut={A:1,x:1,c:1,b:1,B:1,h:2,H:2,s:1,f:4,d:8,i:4,I:4,l:4,L:4,q:8,Q:8},X._elLut={A:{en:X._EnArray,de:X._DeArray},s:{en:X._EnString,de:X._DeString},c:{en:X._EnChar,de:X._DeChar},b:{en:X._EnInt,de:X._DeInt,len:1,bSigned:!0,min:-Math.pow(2,7),max:Math.pow(2,7)-1},B:{en:X._EnInt,de:X._DeInt,len:1,bSigned:!1,min:0,max:Math.pow(2,8)-1},h:{en:X._EnInt,de:X._DeInt,len:2,bSigned:!0,min:-Math.pow(2,15),max:Math.pow(2,15)-1},H:{en:X._EnInt,de:X._DeInt,len:2,bSigned:!1,min:0,max:Math.pow(2,16)-1},i:{en:X._EnInt,de:X._DeInt,len:4,bSigned:!0,min:-Math.pow(2,31),max:Math.pow(2,31)-1},I:{en:X._EnInt,de:X._DeInt,len:4,bSigned:!1,min:0,max:Math.pow(2,32)-1},l:{en:X._EnInt,de:X._DeInt,len:4,bSigned:!0,min:-Math.pow(2,31),max:Math.pow(2,31)-1},L:{en:X._EnInt,de:X._DeInt,len:4,bSigned:!1,min:0,max:Math.pow(2,32)-1},f:{en:X._En754,de:X._De754,len:4,mLen:23,rt:Math.pow(2,-24)-Math.pow(2,-77)},d:{en:X._En754,de:X._De754,len:8,mLen:52,rt:0},q:{en:X._EnInt64,de:X._DeInt64,bSigned:!0},Q:{en:X._EnInt64,de:X._DeInt64,bSigned:!1}},X._UnpackSeries=function(Y,Z,V,Q){for(var J=W.de,U=[],q=0;q<Y;U.push(J(V,Q+q*Z)),q++);return U},X._PackSeries=function(Y,Z,V,Q,J,U){for(var q=W.en,N=0;N<Y;q(V,Q+N*Z,J[U+N]),N++);},X.Unpack=function(Y,Z,V){G=Y.charAt(0)!="<",V=V?V:0;var Q=new RegExp(this._sPattern,"g"),J,U,q,N=[];while(J=Q.exec(Y)){if(U=J[1]==null||J[1]==""?1:parseInt(J[1]),q=this._lenLut[J[2]],V+U*q>Z.length)return;switch(J[2]){case"A":case"s":N.push(this._elLut[J[2]].de(Z,V,U));break;case"c":case"b":case"B":case"h":case"H":case"i":case"I":case"l":case"L":case"f":case"d":case"q":case"Q":W=this._elLut[J[2]],N.push(this._UnpackSeries(U,q,Z,V));break}V+=U*q}return Array.prototype.concat.apply([],N)},X.PackTo=function(Y,Z,V,Q){G=Y.charAt(0)!="<";var J=new RegExp(this._sPattern,"g"),U,q,N,A,H=0;while(U=J.exec(Y)){if(q=U[1]==null||U[1]==""?1:parseInt(U[1]),N=this._lenLut[U[2]],V+q*N>Z.length)return!1;switch(U[2]){case"A":case"s":if(H+1>Q.length)return!1;this._elLut[U[2]].en(Z,V,q,Q[H]),H+=1;break;case"c":case"b":case"B":case"h":case"H":case"i":case"I":case"l":case"L":case"f":case"d":case"q":case"Q":if(W=this._elLut[U[2]],H+q>Q.length)return!1;this._PackSeries(q,N,Z,V,Q,H),H+=q;break;case"x":for(A=0;A<q;A++)Z[V+A]=0;break}V+=q*N}return Z},X.Pack=function(Y,Z){return this.PackTo(Y,Array(this.CalcLength(Y)),0,Z)},X.CalcLength=function(Y){var Z=new RegExp(this._sPattern,"g"),V=0,Q;while(Q=Z.exec(Y))V+=(Q[1]==null||Q[1]==""?1:parseInt(Q[1]))*this._lenLut[Q[2]];return V}}var r1=new Lh;var P2=_1(YT(),1),qH=_1(gz(),1);import{createSocket as Ld}from"dgram";import{createSocket as $d}from"dgram";import*as R2 from"net";import{connect as Fd}from"net";import{createSign as xd,randomBytes as kd,webcrypto as _d}from"crypto";var Nq0=_1(xT(),1);var C7={};qA(C7,{verifySchema:()=>um,fromBER:()=>Q4,compareSchema:()=>X4,VisibleString:()=>SW,ViewWriter:()=>lZ,VideotexString:()=>TX,ValueBlock:()=>s8,Utf8String:()=>y5,UniversalString:()=>KX,UTCTime:()=>xW,TimeOfDay:()=>aU,TeletexString:()=>MX,TIME:()=>eU,Set:()=>b9,Sequence:()=>x9,Repeated:()=>zX,RelativeObjectIdentifier:()=>iU,RawData:()=>TP,PrintableString:()=>DX,Primitive:()=>w6,OctetString:()=>O7,ObjectIdentifier:()=>jX,NumericString:()=>CX,Null:()=>j7,Integer:()=>j6,IA5String:()=>PX,HexBlock:()=>w7,GraphicString:()=>RX,GeneralizedTime:()=>EX,GeneralString:()=>LX,Enumerated:()=>wX,EndOfContent:()=>oU,Duration:()=>tU,DateTime:()=>sU,DEFAULT_MAX_NODES:()=>lT,DEFAULT_MAX_DEPTH:()=>pT,DEFAULT_MAX_CONTENT_LENGTH:()=>dT,DATE:()=>rU,Constructed:()=>m8,Choice:()=>oZ,CharacterString:()=>BX,Boolean:()=>IX,BmpString:()=>OX,BitString:()=>K7,BaseStringBlock:()=>lU,BaseBlock:()=>F8,Any:()=>Z4});/*!
147
+ `),VN.prototype[W]=G.toFunction({assertSize:Pj})});YE.exports=VN;function Pj(W,G){if(W>G)throw new yp(W,G)}});var H8=Z1((pq0,AE)=>{var Rj=IQ(),vp=gB(),gp=mB(),up=cB(),hp=lB(),bp=nB(),VE=rB(),mp=sB(),fp=WE(),{encode:UE}=jQ(),{decode:qE}=zY(),{encodingLength:cp}=OQ(),pp=ZE(),NE=HY(),HE={array:vp,bool:up,buffer:gp,reserved:hp,string:bp,when:mp,select:fp};for(let W of Object.keys(VE))HE[W]=VE[W];var QN=Symbol("schema");function QE(W){let G=new Rj({readableObjectMode:!1,writableObjectMode:!0,transform:lp});return G[QN]=W,G}function JE(W){let G=null,X=Buffer.isBuffer(W);if(!X)G=W;let Y=new Rj({transform:dp,readableObjectMode:!0,writableObjectMode:!1});if(Y[QN]=G,X)Y.append(W);return Y}function lp(W,G,X){try{UE(W,this[QN],this);let Y=this.slice();this.consume(Y.length),X(null,Y)}catch(Y){X(Y)}}function dp(W,G,X){this.append(W);try{while(this.length>0){let Y=new pp(this),Z=qE(Y,this[QN]);Y.commit(),this.push(Z)}X()}catch(Y){if(Y instanceof NE)X();else X(Y)}}AE.exports={createEncodeStream:QE,createDecodeStream:JE,encode:UE,decode:qE,encodingLength:cp,createEncode:QE,createDecode:JE,types:HE,BinaryStream:Rj,NotEnoughDataError:NE}});var H$=Z1((q$)=>{Object.defineProperty(q$,"__esModule",{value:!0});q$.LEB128=q$.SignedLEB128=q$.UnsignedLEB128=void 0;var DY;(function(W){W[W.LOWER_7=127]="LOWER_7",W[W.UPPER_1=128]="UPPER_1"})(DY||(DY={}));var U$=(W)=>Number.isSafeInteger(W);class MY{static decode(W,G=0){let X=this.$scanForNullBytes(W,G),Y=0,Z=0;for(let V=0;V<=X-G;V++){let Q=W[G+V]&DY.LOWER_7;Y|=Q<<Z,Z+=7}return Y}static encode(W){if(this.check(W),W<0)throw Error(`An unsigned number must NOT be negative, ${W} is!`);let G=[],X=W;do{let Y=X&DY.LOWER_7;if(X>>=7,X)Y=Y|DY.UPPER_1;G.push(Y)}while(X);return Uint8Array.from(G)}static check(W){if(!U$(W))throw Error(`${W} is not a safe integer!`)}static $scanForNullBytes(W,G=0){let X=G,Y=0;do{if(X>=W.byteLength)throw Error("This is not a LEB128-encoded Uint8Array, no ending found!");Y=W.slice(X,X+1)[0],X++}while(Y&DY.UPPER_1);return X-1}static getLength(W,G=0){return this.$scanForNullBytes(W,G)-G}}q$.UnsignedLEB128=MY;class DN{static $ceil7mul(W){let G=W;while(G%7)G++;return G}static check(W){if(!U$(W))throw Error(`${W} is not a safe integer!`)}static encode(W){if(this.check(W),W>=0)throw Error(`A signed number must be negative, ${W} isn't!`);let G=Math.ceil(Math.log2(-W));return MY.encode((1<<this.$ceil7mul(G))+W)}static decode(W,G=0){let X=MY.decode(W,G);return-((1<<Math.ceil(Math.log2(X)))-X)}}q$.SignedLEB128=DN;class MN{}q$.LEB128=MN;MN.encode=(W)=>(W>=0?MY:DN).encode(W);MN.decode=(W,G=0,X=!1)=>(X?DN:MY).decode(W,G)});var z$=Z1((dj,A$)=>{/*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */(function(W){function G(P){return parseInt(P)===P}function X(P){if(!G(P.length))return!1;for(var E=0;E<P.length;E++)if(!G(P[E])||P[E]<0||P[E]>255)return!1;return!0}function Y(P,E){if(P.buffer&&P.name==="Uint8Array"){if(E)if(P.slice)P=P.slice();else P=Array.prototype.slice.call(P);return P}if(Array.isArray(P)){if(!X(P))throw Error("Array contains invalid value: "+P);return new Uint8Array(P)}if(G(P.length)&&X(P))return new Uint8Array(P);throw Error("unsupported array-like object")}function Z(P){return new Uint8Array(P)}function V(P,E,b,k,f){if(k!=null||f!=null)if(P.slice)P=P.slice(k,f);else P=Array.prototype.slice.call(P,k,f);E.set(P,b)}var Q=function(){function P(b){var k=[],f=0;b=encodeURI(b);while(f<b.length){var e=b.charCodeAt(f++);if(e===37)k.push(parseInt(b.substr(f,2),16)),f+=2;else k.push(e)}return Y(k)}function E(b){var k=[],f=0;while(f<b.length){var e=b[f];if(e<128)k.push(String.fromCharCode(e)),f++;else if(e>191&&e<224)k.push(String.fromCharCode((e&31)<<6|b[f+1]&63)),f+=2;else k.push(String.fromCharCode((e&15)<<12|(b[f+1]&63)<<6|b[f+2]&63)),f+=3}return k.join("")}return{toBytes:P,fromBytes:E}}(),J=function(){function P(k){var f=[];for(var e=0;e<k.length;e+=2)f.push(parseInt(k.substr(e,2),16));return f}var E="0123456789abcdef";function b(k){var f=[];for(var e=0;e<k.length;e++){var q0=k[e];f.push(E[(q0&240)>>4]+E[q0&15])}return f.join("")}return{toBytes:P,fromBytes:b}}(),U={16:10,24:12,32:14},q=[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],N=[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],A=[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],I=[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],w=[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],C=[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],D=[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],x=[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],h=[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,1047239000,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],p=[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,679998000,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],u=[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],n=[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],c=[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,1047239000,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],l=[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,679998000,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 G0(P){var E=[];for(var b=0;b<P.length;b+=4)E.push(P[b]<<24|P[b+1]<<16|P[b+2]<<8|P[b+3]);return E}var m=function(P){if(!(this instanceof m))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:Y(P,!0)}),this._prepare()};m.prototype._prepare=function(){var P=U[this.key.length];if(P==null)throw Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var E=0;E<=P;E++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var b=(P+1)*4,k=this.key.length/4,f=G0(this.key),e;for(var E=0;E<k;E++)e=E>>2,this._Ke[e][E%4]=f[E],this._Kd[P-e][E%4]=f[E];var q0=0,Q0=k,$0;while(Q0<b){if($0=f[k-1],f[0]^=N[$0>>16&255]<<24^N[$0>>8&255]<<16^N[$0&255]<<8^N[$0>>24&255]^q[q0]<<24,q0+=1,k!=8)for(var E=1;E<k;E++)f[E]^=f[E-1];else{for(var E=1;E<k/2;E++)f[E]^=f[E-1];$0=f[k/2-1],f[k/2]^=N[$0&255]^N[$0>>8&255]<<8^N[$0>>16&255]<<16^N[$0>>24&255]<<24;for(var E=k/2+1;E<k;E++)f[E]^=f[E-1]}var E=0,D0,k0;while(E<k&&Q0<b)D0=Q0>>2,k0=Q0%4,this._Ke[D0][k0]=f[E],this._Kd[P-D0][k0]=f[E++],Q0++}for(var D0=1;D0<P;D0++)for(var k0=0;k0<4;k0++)$0=this._Kd[D0][k0],this._Kd[D0][k0]=u[$0>>24&255]^n[$0>>16&255]^c[$0>>8&255]^l[$0&255]},m.prototype.encrypt=function(P){if(P.length!=16)throw Error("invalid plaintext size (must be 16 bytes)");var E=this._Ke.length-1,b=[0,0,0,0],k=G0(P);for(var f=0;f<4;f++)k[f]^=this._Ke[0][f];for(var e=1;e<E;e++){for(var f=0;f<4;f++)b[f]=H[k[f]>>24&255]^I[k[(f+1)%4]>>16&255]^w[k[(f+2)%4]>>8&255]^C[k[(f+3)%4]&255]^this._Ke[e][f];k=b.slice()}var q0=Z(16),Q0;for(var f=0;f<4;f++)Q0=this._Ke[E][f],q0[4*f]=(N[k[f]>>24&255]^Q0>>24)&255,q0[4*f+1]=(N[k[(f+1)%4]>>16&255]^Q0>>16)&255,q0[4*f+2]=(N[k[(f+2)%4]>>8&255]^Q0>>8)&255,q0[4*f+3]=(N[k[(f+3)%4]&255]^Q0)&255;return q0},m.prototype.decrypt=function(P){if(P.length!=16)throw Error("invalid ciphertext size (must be 16 bytes)");var E=this._Kd.length-1,b=[0,0,0,0],k=G0(P);for(var f=0;f<4;f++)k[f]^=this._Kd[0][f];for(var e=1;e<E;e++){for(var f=0;f<4;f++)b[f]=D[k[f]>>24&255]^x[k[(f+3)%4]>>16&255]^h[k[(f+2)%4]>>8&255]^p[k[(f+1)%4]&255]^this._Kd[e][f];k=b.slice()}var q0=Z(16),Q0;for(var f=0;f<4;f++)Q0=this._Kd[E][f],q0[4*f]=(A[k[f]>>24&255]^Q0>>24)&255,q0[4*f+1]=(A[k[(f+3)%4]>>16&255]^Q0>>16)&255,q0[4*f+2]=(A[k[(f+2)%4]>>8&255]^Q0>>8)&255,q0[4*f+3]=(A[k[(f+1)%4]&255]^Q0)&255;return q0};var Y0=function(P){if(!(this instanceof Y0))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new m(P)};Y0.prototype.encrypt=function(P){if(P=Y(P),P.length%16!==0)throw Error("invalid plaintext size (must be multiple of 16 bytes)");var E=Z(P.length),b=Z(16);for(var k=0;k<P.length;k+=16)V(P,b,0,k,k+16),b=this._aes.encrypt(b),V(b,E,k);return E},Y0.prototype.decrypt=function(P){if(P=Y(P),P.length%16!==0)throw Error("invalid ciphertext size (must be multiple of 16 bytes)");var E=Z(P.length),b=Z(16);for(var k=0;k<P.length;k+=16)V(P,b,0,k,k+16),b=this._aes.decrypt(b),V(b,E,k);return E};var U0=function(P,E){if(!(this instanceof U0))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",!E)E=Z(16);else if(E.length!=16)throw Error("invalid initialation vector size (must be 16 bytes)");this._lastCipherblock=Y(E,!0),this._aes=new m(P)};U0.prototype.encrypt=function(P){if(P=Y(P),P.length%16!==0)throw Error("invalid plaintext size (must be multiple of 16 bytes)");var E=Z(P.length),b=Z(16);for(var k=0;k<P.length;k+=16){V(P,b,0,k,k+16);for(var f=0;f<16;f++)b[f]^=this._lastCipherblock[f];this._lastCipherblock=this._aes.encrypt(b),V(this._lastCipherblock,E,k)}return E},U0.prototype.decrypt=function(P){if(P=Y(P),P.length%16!==0)throw Error("invalid ciphertext size (must be multiple of 16 bytes)");var E=Z(P.length),b=Z(16);for(var k=0;k<P.length;k+=16){V(P,b,0,k,k+16),b=this._aes.decrypt(b);for(var f=0;f<16;f++)E[k+f]=b[f]^this._lastCipherblock[f];V(P,this._lastCipherblock,0,k,k+16)}return E};var y=function(P,E,b){if(!(this instanceof y))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",!E)E=Z(16);else if(E.length!=16)throw Error("invalid initialation vector size (must be 16 size)");if(!b)b=1;this.segmentSize=b,this._shiftRegister=Y(E,!0),this._aes=new m(P)};y.prototype.encrypt=function(P){if(P.length%this.segmentSize!=0)throw Error("invalid plaintext size (must be segmentSize bytes)");var E=Y(P,!0),b;for(var k=0;k<E.length;k+=this.segmentSize){b=this._aes.encrypt(this._shiftRegister);for(var f=0;f<this.segmentSize;f++)E[k+f]^=b[f];V(this._shiftRegister,this._shiftRegister,0,this.segmentSize),V(E,this._shiftRegister,16-this.segmentSize,k,k+this.segmentSize)}return E},y.prototype.decrypt=function(P){if(P.length%this.segmentSize!=0)throw Error("invalid ciphertext size (must be segmentSize bytes)");var E=Y(P,!0),b;for(var k=0;k<E.length;k+=this.segmentSize){b=this._aes.encrypt(this._shiftRegister);for(var f=0;f<this.segmentSize;f++)E[k+f]^=b[f];V(this._shiftRegister,this._shiftRegister,0,this.segmentSize),V(P,this._shiftRegister,16-this.segmentSize,k,k+this.segmentSize)}return E};var o=function(P,E){if(!(this instanceof o))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",!E)E=Z(16);else if(E.length!=16)throw Error("invalid initialation vector size (must be 16 bytes)");this._lastPrecipher=Y(E,!0),this._lastPrecipherIndex=16,this._aes=new m(P)};o.prototype.encrypt=function(P){var E=Y(P,!0);for(var b=0;b<E.length;b++){if(this._lastPrecipherIndex===16)this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0;E[b]^=this._lastPrecipher[this._lastPrecipherIndex++]}return E},o.prototype.decrypt=o.prototype.encrypt;var B=function(P){if(!(this instanceof B))throw Error("Counter must be instanitated with `new`");if(P!==0&&!P)P=1;if(typeof P==="number")this._counter=Z(16),this.setValue(P);else this.setBytes(P)};B.prototype.setValue=function(P){if(typeof P!=="number"||parseInt(P)!=P)throw Error("invalid counter value (must be an integer)");if(P>Number.MAX_SAFE_INTEGER)throw Error("integer value out of safe range");for(var E=15;E>=0;--E)this._counter[E]=P%256,P=parseInt(P/256)},B.prototype.setBytes=function(P){if(P=Y(P,!0),P.length!=16)throw Error("invalid counter bytes size (must be 16 bytes)");this._counter=P},B.prototype.increment=function(){for(var P=15;P>=0;P--)if(this._counter[P]===255)this._counter[P]=0;else{this._counter[P]++;break}};var R=function(P,E){if(!(this instanceof R))throw Error("AES must be instanitated with `new`");if(this.description="Counter",this.name="ctr",!(E instanceof B))E=new B(E);this._counter=E,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new m(P)};R.prototype.encrypt=function(P){var E=Y(P,!0);for(var b=0;b<E.length;b++){if(this._remainingCounterIndex===16)this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment();E[b]^=this._remainingCounter[this._remainingCounterIndex++]}return E},R.prototype.decrypt=R.prototype.encrypt;function _(P){P=Y(P,!0);var E=16-P.length%16,b=Z(P.length+E);V(P,b);for(var k=P.length;k<b.length;k++)b[k]=E;return b}function S(P){if(P=Y(P,!0),P.length<16)throw Error("PKCS#7 invalid length");var E=P[P.length-1];if(E>16)throw Error("PKCS#7 padding byte out of range");var b=P.length-E;for(var k=0;k<E;k++)if(P[b+k]!==E)throw Error("PKCS#7 invalid padding byte");var f=Z(b);return V(P,f,0,0,b),f}var v={AES:m,Counter:B,ModeOfOperation:{ecb:Y0,cbc:U0,cfb:y,ofb:o,ctr:R},utils:{hex:J,utf8:Q},padding:{pkcs7:{pad:_,strip:S}},_arrayTest:{coerceArray:Y,createArray:Z,copyArray:V}};if(typeof dj<"u")A$.exports=v;else if(typeof define==="function"&&define.amd)define([],function(){return v});else{if(W.aesjs)v._aesjs=W.aesjs;W.aesjs=v}})(dj)});var rj=Z1((C$)=>{var s0=C$,{Buffer:LN}=$8("buffer"),Sl=$8("os");s0.toBuffer=function(W,G,X){X=~~X;let Y;if(this.isV4Format(W))Y=G||LN.alloc(X+4),W.split(/\./g).map((Z)=>{Y[X++]=parseInt(Z,10)&255});else if(this.isV6Format(W)){let Z=W.split(":",8),V;for(V=0;V<Z.length;V++){let Q=this.isV4Format(Z[V]),J;if(Q)J=this.toBuffer(Z[V]),Z[V]=J.slice(0,2).toString("hex");if(J&&++V<8)Z.splice(V,0,J.slice(2,4).toString("hex"))}if(Z[0]==="")while(Z.length<8)Z.unshift("0");else if(Z[Z.length-1]==="")while(Z.length<8)Z.push("0");else if(Z.length<8){for(V=0;V<Z.length&&Z[V]!=="";V++);let Q=[V,1];for(V=9-Z.length;V>0;V--)Q.push("0");Z.splice(...Q)}Y=G||LN.alloc(X+16);for(V=0;V<Z.length;V++){let Q=parseInt(Z[V],16);Y[X++]=Q>>8&255,Y[X++]=Q&255}}if(!Y)throw Error(`Invalid ip address: ${W}`);return Y};s0.toString=function(W,G,X){G=~~G,X=X||W.length-G;let Y=[];if(X===4){for(let Z=0;Z<X;Z++)Y.push(W[G+Z]);Y=Y.join(".")}else if(X===16){for(let Z=0;Z<X;Z+=2)Y.push(W.readUInt16BE(G+Z).toString(16));Y=Y.join(":"),Y=Y.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3"),Y=Y.replace(/:{3,4}/,"::")}return Y};var xl=/^(\d{1,3}\.){3,3}\d{1,3}$/,kl=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i;s0.isV4Format=function(W){return xl.test(W)};s0.isV6Format=function(W){return kl.test(W)};function $Q(W){if(W===4)return"ipv4";if(W===6)return"ipv6";return W?W.toLowerCase():"ipv4"}s0.fromPrefixLen=function(W,G){if(W>32)G="ipv6";else G=$Q(G);let X=4;if(G==="ipv6")X=16;let Y=LN.alloc(X);for(let Z=0,V=Y.length;Z<V;++Z){let Q=8;if(W<8)Q=W;W-=Q,Y[Z]=~(255>>Q)&255}return s0.toString(Y)};s0.mask=function(W,G){W=s0.toBuffer(W),G=s0.toBuffer(G);let X=LN.alloc(Math.max(W.length,G.length)),Y;if(W.length===G.length)for(Y=0;Y<W.length;Y++)X[Y]=W[Y]&G[Y];else if(G.length===4)for(Y=0;Y<G.length;Y++)X[Y]=W[W.length-4+Y]&G[Y];else{for(Y=0;Y<X.length-6;Y++)X[Y]=0;X[10]=255,X[11]=255;for(Y=0;Y<W.length;Y++)X[Y+12]=W[Y]&G[Y+12];Y+=12}for(;Y<X.length;Y++)X[Y]=0;return s0.toString(X)};s0.cidr=function(W){let G=W.split("/"),X=G[0];if(G.length!==2)throw Error(`invalid CIDR subnet: ${X}`);let Y=s0.fromPrefixLen(parseInt(G[1],10));return s0.mask(X,Y)};s0.subnet=function(W,G){let X=s0.toLong(s0.mask(W,G)),Y=s0.toBuffer(G),Z=0;for(let Q=0;Q<Y.length;Q++)if(Y[Q]===255)Z+=8;else{let J=Y[Q]&255;while(J)J=J<<1&255,Z++}let V=2**(32-Z);return{networkAddress:s0.fromLong(X),firstAddress:V<=2?s0.fromLong(X):s0.fromLong(X+1),lastAddress:V<=2?s0.fromLong(X+V-1):s0.fromLong(X+V-2),broadcastAddress:s0.fromLong(X+V-1),subnetMask:G,subnetMaskLength:Z,numHosts:V<=2?V:V-2,length:V,contains(Q){return X===s0.toLong(s0.mask(Q,G))}}};s0.cidrSubnet=function(W){let G=W.split("/"),X=G[0];if(G.length!==2)throw Error(`invalid CIDR subnet: ${X}`);let Y=s0.fromPrefixLen(parseInt(G[1],10));return s0.subnet(X,Y)};s0.not=function(W){let G=s0.toBuffer(W);for(let X=0;X<G.length;X++)G[X]=255^G[X];return s0.toString(G)};s0.or=function(W,G){if(W=s0.toBuffer(W),G=s0.toBuffer(G),W.length===G.length){for(let V=0;V<W.length;++V)W[V]|=G[V];return s0.toString(W)}let X=W,Y=G;if(G.length>W.length)X=G,Y=W;let Z=X.length-Y.length;for(let V=Z;V<X.length;++V)X[V]|=Y[V-Z];return s0.toString(X)};s0.isEqual=function(W,G){if(W=s0.toBuffer(W),G=s0.toBuffer(G),W.length===G.length){for(let Y=0;Y<W.length;Y++)if(W[Y]!==G[Y])return!1;return!0}if(G.length===4){let Y=G;G=W,W=Y}for(let Y=0;Y<10;Y++)if(G[Y]!==0)return!1;let X=G.readUInt16BE(10);if(X!==0&&X!==65535)return!1;for(let Y=0;Y<4;Y++)if(W[Y]!==G[Y+12])return!1;return!0};s0.isPrivate=function(W){if(s0.isLoopback(W))return!0;if(!s0.isV6Format(W)){let G=s0.normalizeToLong(W);if(G<0)throw Error("invalid ipv4 address");W=s0.fromLong(G)}return/^(::f{4}:)?10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(W)||/^(::f{4}:)?192\.168\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(W)||/^(::f{4}:)?172\.(1[6-9]|2\d|30|31)\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(W)||/^(::f{4}:)?169\.254\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(W)||/^f[cd][0-9a-f]{2}:/i.test(W)||/^fe80:/i.test(W)||/^::1$/.test(W)||/^::$/.test(W)};s0.isPublic=function(W){return!s0.isPrivate(W)};s0.isLoopback=function(W){if(!/\./.test(W)&&!/:/.test(W))W=s0.fromLong(Number(W));return/^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/.test(W)||/^0177\./.test(W)||/^0x7f\./i.test(W)||/^fe80::1$/i.test(W)||/^::1$/.test(W)||/^::$/.test(W)};s0.loopback=function(W){if(W=$Q(W),W!=="ipv4"&&W!=="ipv6")throw Error("family must be ipv4 or ipv6");return W==="ipv4"?"127.0.0.1":"fe80::1"};s0.address=function(W,G){let X=Sl.networkInterfaces();if(G=$Q(G),W&&W!=="private"&&W!=="public"){let Z=X[W].filter((V)=>{return $Q(V.family)===G});if(Z.length===0)return;return Z[0].address}let Y=Object.keys(X).map((Z)=>{let V=X[Z].filter((Q)=>{if(Q.family=$Q(Q.family),Q.family!==G||s0.isLoopback(Q.address))return!1;if(!W)return!0;return W==="public"?s0.isPrivate(Q.address):s0.isPublic(Q.address)});return V.length?V[0].address:void 0}).filter(Boolean);return!Y.length?s0.loopback(G):Y[0]};s0.toLong=function(W){let G=0;return W.split(".").forEach((X)=>{G<<=8,G+=parseInt(X)}),G>>>0};s0.fromLong=function(W){return`${W>>>24}.${W>>16&255}.${W>>8&255}.${W&255}`};s0.normalizeToLong=function(W){let G=W.split(".").map((Z)=>{if(Z.startsWith("0x")||Z.startsWith("0X"))return parseInt(Z,16);else if(Z.startsWith("0")&&Z!=="0"&&/^[0-7]+$/.test(Z))return parseInt(Z,8);else if(/^[1-9]\d*$/.test(Z)||Z==="0")return parseInt(Z,10);else return NaN});if(G.some(isNaN))return-1;let X=0;switch(G.length){case 1:X=G[0];break;case 2:if(G[0]>255||G[1]>16777215)return-1;X=G[0]<<24|G[1]&16777215;break;case 3:if(G[0]>255||G[1]>255||G[2]>65535)return-1;X=G[0]<<24|G[1]<<16|G[2]&65535;break;case 4:if(G.some((Z)=>Z>255))return-1;X=G[0]<<24|G[1]<<16|G[2]<<8|G[3];break;default:return-1}return X>>>0}});var M$=Z1((SN0,D$)=>{D$.exports=function W(G,X){if(G===X)return!0;if(G&&X&&typeof G=="object"&&typeof X=="object"){if(G.constructor!==X.constructor)return!1;var Y,Z,V;if(Array.isArray(G)){if(Y=G.length,Y!=X.length)return!1;for(Z=Y;Z--!==0;)if(!W(G[Z],X[Z]))return!1;return!0}if(G.constructor===RegExp)return G.source===X.source&&G.flags===X.flags;if(G.valueOf!==Object.prototype.valueOf)return G.valueOf()===X.valueOf();if(G.toString!==Object.prototype.toString)return G.toString()===X.toString();if(V=Object.keys(G),Y=V.length,Y!==Object.keys(X).length)return!1;for(Z=Y;Z--!==0;)if(!Object.prototype.hasOwnProperty.call(X,V[Z]))return!1;for(Z=Y;Z--!==0;){var Q=V[Z];if(!W(G[Q],X[Q]))return!1}return!0}return G!==G&&X!==X}});var T$=Z1((_l)=>{_l.toString=function(W){switch(W){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+W};_l.toType=function(W){switch(W.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":return 255;case"*":return 255}if(W.toUpperCase().startsWith("UNKNOWN_"))return parseInt(W.slice(8));return 0}});var P$=Z1((gl)=>{gl.toString=function(W){switch(W){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+W};gl.toRcode=function(W){switch(W.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}});var R$=Z1((bl)=>{bl.toString=function(W){switch(W){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+W};bl.toOpcode=function(W){switch(W.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}});var L$=Z1((cl)=>{cl.toString=function(W){switch(W){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+W};cl.toClass=function(W){switch(W.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}});var B$=Z1((dl)=>{dl.toString=function(W){switch(W){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}if(W<0)return null;return`OPTION_${W}`};dl.toCode=function(W){if(typeof W==="number")return W;if(!W)return-1;switch(W.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}let G=W.match(/_(\d+)$/);if(G)return parseInt(G[1],10);return-1}});var F$=Z1(($$,aj)=>{var E$=function(W){Object.defineProperty(W,"__esModule",{value:!0}),W.decode=A,W.encode=N,W.familyOf=q,W.name=void 0,W.sizeOf=U,W.v6=W.v4=void 0;let G=/^(\d{1,3}\.){3,3}\d{1,3}$/,X=4,Y=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,Z=16,V={name:"v4",size:X,isFormat:(H)=>G.test(H),encode(H,I,w){w=~~w,I=I||new Uint8Array(w+X);let C=H.length,D=0;for(let x=0;x<C;){let h=H.charCodeAt(x++);if(h===46)I[w++]=D,D=0;else D=D*10+(h-48)}return I[w]=D,I},decode(H,I){return I=~~I,`${H[I++]}.${H[I++]}.${H[I++]}.${H[I]}`}};W.v4=V;let Q={name:"v6",size:Z,isFormat:(H)=>H.length>0&&Y.test(H),encode(H,I,w){w=~~w;let C=w+Z,D=-1,x=0,h=0,p=!0,u=!1;I=I||new Uint8Array(w+Z);for(let n=0;n<H.length;n++){let c=H.charCodeAt(n);if(c===58){if(p){if(D!==-1){if(w<C)I[w]=0;if(w<C-1)I[w+1]=0;w+=2}else if(w<C)D=w}else{if(u===!0){if(w<C)I[w]=h;w++}else{if(w<C)I[w]=x>>8;if(w<C-1)I[w+1]=x&255;w+=2}x=0,h=0}p=!0,u=!1}else if(c===46){if(w<C)I[w]=h;w++,h=0,x=0,p=!1,u=!0}else{if(p=!1,c>=97)c-=87;else if(c>=65)c-=55;else c-=48,h=h*10+c;x=(x<<4)+c}}if(p===!1)if(u===!0){if(w<C)I[w]=h;w++}else{if(w<C)I[w]=x>>8;if(w<C-1)I[w+1]=x&255;w+=2}else if(D===0){if(w<C)I[w]=0;if(w<C-1)I[w+1]=0;w+=2}else if(D!==-1){w+=2;for(let n=Math.min(w-1,C-1);n>=D+2;n--)I[n]=I[n-2];I[D]=0,I[D+1]=0,D=w}if(D!==w&&D!==-1){if(w>C-2)w=C-2;while(C>D)I[--C]=w<C&&w>D?I[--w]:0}else while(w<C)I[w++]=0;return I},decode(H,I){I=~~I;let w="";for(let C=0;C<Z;C+=2){if(C!==0)w+=":";w+=(H[I+C]<<8|H[I+C+1]).toString(16)}return w.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};W.v6=Q;let J="ip";W.name=J;function U(H){if(V.isFormat(H))return V.size;if(Q.isFormat(H))return Q.size;throw Error(`Invalid ip address: ${H}`)}function q(H){return U(H)===V.size?1:2}function N(H,I,w){w=~~w;let C=U(H);if(typeof I==="function")I=I(w+C);if(C===V.size)return V.encode(H,I,w);return Q.encode(H,I,w)}function A(H,I,w){if(I=~~I,w=w||H.length-I,w===V.size)return V.decode(H,I,w);if(w===Q.size)return Q.decode(H,I,w);throw Error(`Invalid buffer size needs to be ${V.size} for v4 or ${Q.size} for v6.`)}return"default"in W?W.default:W}({});if(typeof define==="function"&&define.amd)define([],function(){return E$});else if(typeof aj==="object"&&typeof $$==="object")aj.exports=E$});var S$=Z1((tl)=>{var G1=$8("buffer").Buffer,u4=T$(),il=P$(),rl=R$(),EN=L$(),ej=B$(),jG=F$(),y0=tl.name={};y0.encode=function(W,G,X,{mail:Y=!1}={}){if(!G)G=G1.alloc(y0.encodingLength(W));if(!X)X=0;let Z=X,V=W.replace(/^\.|\.$/gm,"");if(V.length){let Q=[];if(Y){let J="";V.split(".").forEach((U)=>{if(U.endsWith("\\"))J+=(J.length?".":"")+U.slice(0,-1);else if(Q.length===0&&J.length)Q.push(J+"."+U);else Q.push(U)})}else Q=V.split(".");for(let J=0;J<Q.length;J++){let U=G.write(Q[J],X+1);G[X]=U,X+=U+1}}return G[X++]=0,y0.encode.bytes=X-Z,G};y0.encode.bytes=0;y0.decode=function(W,G,{mail:X=!1}={}){if(!G)G=0;let Y=[],Z=G,V=0,Q=0,J=!1;while(!0){if(G>=W.length)throw Error("Cannot decode name (buffer overflow)");let U=W[G++];if(Q+=J?0:1,U===0)break;else if((U&192)===0){if(G+U>W.length)throw Error("Cannot decode name (buffer overflow)");if(V+=U+1,V>254)throw Error("Cannot decode name (name too long)");let q=W.toString("utf-8",G,G+U);if(X)q=q.replace(/\./g,"\\.");Y.push(q),G+=U,Q+=J?0:U}else if((U&192)===192){if(G+1>W.length)throw Error("Cannot decode name (buffer overflow)");let q=W.readUInt16BE(G-1)-49152;if(q>=Z)throw Error("Cannot decode name (bad pointer)");G=q,Z=q,Q+=J?0:1,J=!0}else throw Error("Cannot decode name (bad label)")}return y0.decode.bytes=Q,Y.length===0?".":Y.join(".")};y0.decode.bytes=0;y0.encodingLength=function(W){if(W==="."||W==="..")return 1;return G1.byteLength(W.replace(/^\.|\.$/gm,""))+2};var $1={};$1.encode=function(W,G,X){if(!G)G=G1.alloc($1.encodingLength(W));if(!X)X=0;let Y=G.write(W,X+1);return G[X]=Y,$1.encode.bytes=Y+1,G};$1.encode.bytes=0;$1.decode=function(W,G){if(!G)G=0;let X=W[G],Y=W.toString("utf-8",G+1,G+1+X);return $1.decode.bytes=X+1,Y};$1.decode.bytes=0;$1.encodingLength=function(W){return G1.byteLength(W)+1};var i5={};i5.encode=function(W,G,X){if(!G)G=i5.encodingLength(W);if(!X)X=0;let Y=(W.flags||0)&32767,Z=W.type==="response"?32768:0;return G.writeUInt16BE(W.id||0,X),G.writeUInt16BE(Y|Z,X+2),G.writeUInt16BE(W.questions.length,X+4),G.writeUInt16BE(W.answers.length,X+6),G.writeUInt16BE(W.authorities.length,X+8),G.writeUInt16BE(W.additionals.length,X+10),G};i5.encode.bytes=12;i5.decode=function(W,G){if(!G)G=0;if(W.length<12)throw Error("Header must be 12 bytes");let X=W.readUInt16BE(G+2);return{id:W.readUInt16BE(G),type:X&32768?"response":"query",flags:X&32767,flag_qr:(X>>15&1)===1,opcode:rl.toString(X>>11&15),flag_aa:(X>>10&1)===1,flag_tc:(X>>9&1)===1,flag_rd:(X>>8&1)===1,flag_ra:(X>>7&1)===1,flag_z:(X>>6&1)===1,flag_ad:(X>>5&1)===1,flag_cd:(X>>4&1)===1,rcode:il.toString(X&15),questions:Array(W.readUInt16BE(G+4)),answers:Array(W.readUInt16BE(G+6)),authorities:Array(W.readUInt16BE(G+8)),additionals:Array(W.readUInt16BE(G+10))}};i5.decode.bytes=12;i5.encodingLength=function(){return 12};var $4=tl.unknown={};$4.encode=function(W,G,X){if(!G)G=G1.alloc($4.encodingLength(W));if(!X)X=0;return G.writeUInt16BE(W.length,X),W.copy(G,X+2),$4.encode.bytes=W.length+2,G};$4.encode.bytes=0;$4.decode=function(W,G){if(!G)G=0;let X=W.readUInt16BE(G),Y=W.slice(G+2,G+2+X);return $4.decode.bytes=X+2,Y};$4.decode.bytes=0;$4.encodingLength=function(W){return W.length+2};var F4=tl.ns={};F4.encode=function(W,G,X){if(!G)G=G1.alloc(F4.encodingLength(W));if(!X)X=0;return y0.encode(W,G,X+2),G.writeUInt16BE(y0.encode.bytes,X),F4.encode.bytes=y0.encode.bytes+2,G};F4.encode.bytes=0;F4.decode=function(W,G){if(!G)G=0;let X=W.readUInt16BE(G),Y=y0.decode(W,G+2);return F4.decode.bytes=X+2,Y};F4.decode.bytes=0;F4.encodingLength=function(W){return y0.encodingLength(W)+2};var S4=tl.soa={};S4.encode=function(W,G,X){if(!G)G=G1.alloc(S4.encodingLength(W));if(!X)X=0;let Y=X;return X+=2,y0.encode(W.mname,G,X),X+=y0.encode.bytes,y0.encode(W.rname,G,X,{mail:!0}),X+=y0.encode.bytes,G.writeUInt32BE(W.serial||0,X),X+=4,G.writeUInt32BE(W.refresh||0,X),X+=4,G.writeUInt32BE(W.retry||0,X),X+=4,G.writeUInt32BE(W.expire||0,X),X+=4,G.writeUInt32BE(W.minimum||0,X),X+=4,G.writeUInt16BE(X-Y-2,Y),S4.encode.bytes=X-Y,G};S4.encode.bytes=0;S4.decode=function(W,G){if(!G)G=0;let X=G,Y={};return G+=2,Y.mname=y0.decode(W,G),G+=y0.decode.bytes,Y.rname=y0.decode(W,G,{mail:!0}),G+=y0.decode.bytes,Y.serial=W.readUInt32BE(G),G+=4,Y.refresh=W.readUInt32BE(G),G+=4,Y.retry=W.readUInt32BE(G),G+=4,Y.expire=W.readUInt32BE(G),G+=4,Y.minimum=W.readUInt32BE(G),G+=4,S4.decode.bytes=G-X,Y};S4.decode.bytes=0;S4.encodingLength=function(W){return 22+y0.encodingLength(W.mname)+y0.encodingLength(W.rname)};var x4=tl.txt={};x4.encode=function(W,G,X){if(!Array.isArray(W))W=[W];for(let Z=0;Z<W.length;Z++){if(typeof W[Z]==="string")W[Z]=G1.from(W[Z]);if(!G1.isBuffer(W[Z]))throw Error("Must be a Buffer")}if(!G)G=G1.alloc(x4.encodingLength(W));if(!X)X=0;let Y=X;return X+=2,W.forEach(function(Z){G[X++]=Z.length,Z.copy(G,X,0,Z.length),X+=Z.length}),G.writeUInt16BE(X-Y-2,Y),x4.encode.bytes=X-Y,G};x4.encode.bytes=0;x4.decode=function(W,G){if(!G)G=0;let X=G,Y=W.readUInt16BE(G);G+=2;let Z=[];while(Y>0){let V=W[G++];if(--Y,Y<V)throw Error("Buffer overflow");Z.push(W.slice(G,G+V)),G+=V,Y-=V}return x4.decode.bytes=G-X,Z};x4.decode.bytes=0;x4.encodingLength=function(W){if(!Array.isArray(W))W=[W];let G=2;return W.forEach(function(X){if(typeof X==="string")G+=G1.byteLength(X)+1;else G+=X.length+1}),G};var k4=tl.null={};k4.encode=function(W,G,X){if(!G)G=G1.alloc(k4.encodingLength(W));if(!X)X=0;if(typeof W==="string")W=G1.from(W);if(!W)W=G1.alloc(0);let Y=X;X+=2;let Z=W.length;return W.copy(G,X,0,Z),X+=Z,G.writeUInt16BE(X-Y-2,Y),k4.encode.bytes=X-Y,G};k4.encode.bytes=0;k4.decode=function(W,G){if(!G)G=0;let X=G,Y=W.readUInt16BE(G);G+=2;let Z=W.slice(G,G+Y);return G+=Y,k4.decode.bytes=G-X,Z};k4.decode.bytes=0;k4.encodingLength=function(W){if(!W)return 2;return(G1.isBuffer(W)?W.length:G1.byteLength(W))+2};var _4=tl.hinfo={};_4.encode=function(W,G,X){if(!G)G=G1.alloc(_4.encodingLength(W));if(!X)X=0;let Y=X;return X+=2,$1.encode(W.cpu,G,X),X+=$1.encode.bytes,$1.encode(W.os,G,X),X+=$1.encode.bytes,G.writeUInt16BE(X-Y-2,Y),_4.encode.bytes=X-Y,G};_4.encode.bytes=0;_4.decode=function(W,G){if(!G)G=0;let X=G,Y={};return G+=2,Y.cpu=$1.decode(W,G),G+=$1.decode.bytes,Y.os=$1.decode(W,G),G+=$1.decode.bytes,_4.decode.bytes=G-X,Y};_4.decode.bytes=0;_4.encodingLength=function(W){return $1.encodingLength(W.cpu)+$1.encodingLength(W.os)+2};var o5=tl.ptr={},al=tl.cname=o5,sl=tl.dname=o5;o5.encode=function(W,G,X){if(!G)G=G1.alloc(o5.encodingLength(W));if(!X)X=0;return y0.encode(W,G,X+2),G.writeUInt16BE(y0.encode.bytes,X),o5.encode.bytes=y0.encode.bytes+2,G};o5.encode.bytes=0;o5.decode=function(W,G){if(!G)G=0;let X=y0.decode(W,G+2);return o5.decode.bytes=y0.decode.bytes+2,X};o5.decode.bytes=0;o5.encodingLength=function(W){return y0.encodingLength(W)+2};var y4=tl.srv={};y4.encode=function(W,G,X){if(!G)G=G1.alloc(y4.encodingLength(W));if(!X)X=0;G.writeUInt16BE(W.priority||0,X+2),G.writeUInt16BE(W.weight||0,X+4),G.writeUInt16BE(W.port||0,X+6),y0.encode(W.target,G,X+8);let Y=y0.encode.bytes+6;return G.writeUInt16BE(Y,X),y4.encode.bytes=Y+2,G};y4.encode.bytes=0;y4.decode=function(W,G){if(!G)G=0;let X=W.readUInt16BE(G),Y={};return Y.priority=W.readUInt16BE(G+2),Y.weight=W.readUInt16BE(G+4),Y.port=W.readUInt16BE(G+6),Y.target=y0.decode(W,G+8),y4.decode.bytes=X+2,Y};y4.decode.bytes=0;y4.encodingLength=function(W){return 8+y0.encodingLength(W.target)};var Q5=tl.caa={};Q5.ISSUER_CRITICAL=128;Q5.encode=function(W,G,X){let Y=Q5.encodingLength(W);if(!G)G=G1.alloc(Q5.encodingLength(W));if(!X)X=0;if(W.issuerCritical)W.flags=Q5.ISSUER_CRITICAL;return G.writeUInt16BE(Y-2,X),X+=2,G.writeUInt8(W.flags||0,X),X+=1,$1.encode(W.tag,G,X),X+=$1.encode.bytes,G.write(W.value,X),X+=G1.byteLength(W.value),Q5.encode.bytes=Y,G};Q5.encode.bytes=0;Q5.decode=function(W,G){if(!G)G=0;let X=W.readUInt16BE(G);G+=2;let Y=G,Z={};return Z.flags=W.readUInt8(G),G+=1,Z.tag=$1.decode(W,G),G+=$1.decode.bytes,Z.value=W.toString("utf-8",G,Y+X),Z.issuerCritical=!!(Z.flags&Q5.ISSUER_CRITICAL),Q5.decode.bytes=X+2,Z};Q5.decode.bytes=0;Q5.encodingLength=function(W){return $1.encodingLength(W.tag)+$1.encodingLength(W.value)+2};var l6=tl.mx={};l6.encode=function(W,G,X){if(!G)G=G1.alloc(l6.encodingLength(W));if(!X)X=0;let Y=X;return X+=2,G.writeUInt16BE(W.preference||0,X),X+=2,y0.encode(W.exchange,G,X),X+=y0.encode.bytes,G.writeUInt16BE(X-Y-2,Y),l6.encode.bytes=X-Y,G};l6.encode.bytes=0;l6.decode=function(W,G){if(!G)G=0;let X=G,Y={};return G+=2,Y.preference=W.readUInt16BE(G),G+=2,Y.exchange=y0.decode(W,G),G+=y0.decode.bytes,l6.decode.bytes=G-X,Y};l6.encodingLength=function(W){return 4+y0.encodingLength(W.exchange)};var v4=tl.a={};v4.encode=function(W,G,X){if(!G)G=G1.alloc(v4.encodingLength(W));if(!X)X=0;return G.writeUInt16BE(4,X),X+=2,jG.v4.encode(W,G,X),v4.encode.bytes=6,G};v4.encode.bytes=0;v4.decode=function(W,G){if(!G)G=0;G+=2;let X=jG.v4.decode(W,G);return v4.decode.bytes=6,X};v4.decode.bytes=0;v4.encodingLength=function(){return 6};var g4=tl.aaaa={};g4.encode=function(W,G,X){if(!G)G=G1.alloc(g4.encodingLength(W));if(!X)X=0;return G.writeUInt16BE(16,X),X+=2,jG.v6.encode(W,G,X),g4.encode.bytes=18,G};g4.encode.bytes=0;g4.decode=function(W,G){if(!G)G=0;G+=2;let X=jG.v6.decode(W,G);return g4.decode.bytes=18,X};g4.decode.bytes=0;g4.encodingLength=function(){return 18};var n9=tl.option={};n9.encode=function(W,G,X){if(!G)G=G1.alloc(n9.encodingLength(W));if(!X)X=0;let Y=X,Z=ej.toCode(W.code);if(G.writeUInt16BE(Z,X),X+=2,W.data)G.writeUInt16BE(W.data.length,X),X+=2,W.data.copy(G,X),X+=W.data.length;else switch(Z){case 8:let V=W.sourcePrefixLength||0,Q=W.family||jG.familyOf(W.ip),J=jG.encode(W.ip,G1.alloc),U=Math.ceil(V/8);G.writeUInt16BE(U+4,X),X+=2,G.writeUInt16BE(Q,X),X+=2,G.writeUInt8(V,X++),G.writeUInt8(W.scopePrefixLength||0,X++),J.copy(G,X,0,U),X+=U;break;case 11:if(W.timeout)G.writeUInt16BE(2,X),X+=2,G.writeUInt16BE(W.timeout,X),X+=2;else G.writeUInt16BE(0,X),X+=2;break;case 12:let q=W.length||0;G.writeUInt16BE(q,X),X+=2,G.fill(0,X,X+q),X+=q;break;case 14:let N=W.tags.length*2;G.writeUInt16BE(N,X),X+=2;for(let A of W.tags)G.writeUInt16BE(A,X),X+=2;break;default:throw Error(`Unknown roption code: ${W.code}`)}return n9.encode.bytes=X-Y,G};n9.encode.bytes=0;n9.decode=function(W,G){if(!G)G=0;let X={};X.code=W.readUInt16BE(G),X.type=ej.toString(X.code),G+=2;let Y=W.readUInt16BE(G);switch(G+=2,X.data=W.slice(G,G+Y),X.code){case 8:X.family=W.readUInt16BE(G),G+=2,X.sourcePrefixLength=W.readUInt8(G++),X.scopePrefixLength=W.readUInt8(G++);let Z=G1.alloc(X.family===1?4:16);W.copy(Z,0,G,G+Y-4),X.ip=jG.decode(Z);break;case 11:if(Y>0)X.timeout=W.readUInt16BE(G),G+=2;break;case 14:X.tags=[];for(let V=0;V<Y;V+=2)X.tags.push(W.readUInt16BE(G)),G+=2}return n9.decode.bytes=Y+4,X};n9.decode.bytes=0;n9.encodingLength=function(W){if(W.data)return W.data.length+4;switch(ej.toCode(W.code)){case 8:let X=W.sourcePrefixLength||0;return Math.ceil(X/8)+8;case 11:return typeof W.timeout==="number"?6:4;case 12:return W.length+4;case 14:return 4+W.tags.length*2}throw Error(`Unknown roption code: ${W.code}`)};var U5=tl.opt={};U5.encode=function(W,G,X){if(!G)G=G1.alloc(U5.encodingLength(W));if(!X)X=0;let Y=X,Z=BY(W,n9);return G.writeUInt16BE(Z,X),X=FQ(W,n9,G,X+2),U5.encode.bytes=X-Y,G};U5.encode.bytes=0;U5.decode=function(W,G){if(!G)G=0;let X=G,Y=[],Z=W.readUInt16BE(G);G+=2;let V=0;while(Z>0)Y[V++]=n9.decode(W,G),G+=n9.decode.bytes,Z-=n9.decode.bytes;return U5.decode.bytes=G-X,Y};U5.decode.bytes=0;U5.encodingLength=function(W){return 2+BY(W||[],n9)};var y9=tl.dnskey={};y9.PROTOCOL_DNSSEC=3;y9.ZONE_KEY=128;y9.SECURE_ENTRYPOINT=32768;y9.encode=function(W,G,X){if(!G)G=G1.alloc(y9.encodingLength(W));if(!X)X=0;let Y=X,Z=W.key;if(!G1.isBuffer(Z))throw Error("Key must be a Buffer");return X+=2,G.writeUInt16BE(W.flags,X),X+=2,G.writeUInt8(y9.PROTOCOL_DNSSEC,X),X+=1,G.writeUInt8(W.algorithm,X),X+=1,Z.copy(G,X,0,Z.length),X+=Z.length,y9.encode.bytes=X-Y,G.writeUInt16BE(y9.encode.bytes-2,Y),G};y9.encode.bytes=0;y9.decode=function(W,G){if(!G)G=0;let X=G;var Y={},Z=W.readUInt16BE(G);if(G+=2,Y.flags=W.readUInt16BE(G),G+=2,W.readUInt8(G)!==y9.PROTOCOL_DNSSEC)throw Error("Protocol must be 3");return G+=1,Y.algorithm=W.readUInt8(G),G+=1,Y.key=W.slice(G,X+Z+2),G+=Y.key.length,y9.decode.bytes=G-X,Y};y9.decode.bytes=0;y9.encodingLength=function(W){return 6+G1.byteLength(W.key)};var F7=tl.rrsig={};F7.encode=function(W,G,X){if(!G)G=G1.alloc(F7.encodingLength(W));if(!X)X=0;let Y=X,Z=W.signature;if(!G1.isBuffer(Z))throw Error("Signature must be a Buffer");return X+=2,G.writeUInt16BE(u4.toType(W.typeCovered),X),X+=2,G.writeUInt8(W.algorithm,X),X+=1,G.writeUInt8(W.labels,X),X+=1,G.writeUInt32BE(W.originalTTL,X),X+=4,G.writeUInt32BE(W.expiration,X),X+=4,G.writeUInt32BE(W.inception,X),X+=4,G.writeUInt16BE(W.keyTag,X),X+=2,y0.encode(W.signersName,G,X),X+=y0.encode.bytes,Z.copy(G,X,0,Z.length),X+=Z.length,F7.encode.bytes=X-Y,G.writeUInt16BE(F7.encode.bytes-2,Y),G};F7.encode.bytes=0;F7.decode=function(W,G){if(!G)G=0;let X=G;var Y={},Z=W.readUInt16BE(G);return G+=2,Y.typeCovered=u4.toString(W.readUInt16BE(G)),G+=2,Y.algorithm=W.readUInt8(G),G+=1,Y.labels=W.readUInt8(G),G+=1,Y.originalTTL=W.readUInt32BE(G),G+=4,Y.expiration=W.readUInt32BE(G),G+=4,Y.inception=W.readUInt32BE(G),G+=4,Y.keyTag=W.readUInt16BE(G),G+=2,Y.signersName=y0.decode(W,G),G+=y0.decode.bytes,Y.signature=W.slice(G,X+Z+2),G+=Y.signature.length,F7.decode.bytes=G-X,Y};F7.decode.bytes=0;F7.encodingLength=function(W){return 20+y0.encodingLength(W.signersName)+G1.byteLength(W.signature)};var S7=tl.rp={};S7.encode=function(W,G,X){if(!G)G=G1.alloc(S7.encodingLength(W));if(!X)X=0;let Y=X;return X+=2,y0.encode(W.mbox||".",G,X,{mail:!0}),X+=y0.encode.bytes,y0.encode(W.txt||".",G,X),X+=y0.encode.bytes,S7.encode.bytes=X-Y,G.writeUInt16BE(S7.encode.bytes-2,Y),G};S7.encode.bytes=0;S7.decode=function(W,G){if(!G)G=0;let X=G,Y={};return G+=2,Y.mbox=y0.decode(W,G,{mail:!0})||".",G+=y0.decode.bytes,Y.txt=y0.decode(W,G)||".",G+=y0.decode.bytes,S7.decode.bytes=G-X,Y};S7.decode.bytes=0;S7.encodingLength=function(W){return 2+y0.encodingLength(W.mbox||".")+y0.encodingLength(W.txt||".")};var o8={};o8.encode=function(W,G,X){if(!G)G=G1.alloc(o8.encodingLength(W));if(!X)X=0;let Y=X;var Z=[];for(var V=0;V<W.length;V++){var Q=u4.toType(W[V]);if(Z[Q>>8]===void 0)Z[Q>>8]=[];Z[Q>>8][Q>>3&31]|=1<<7-(Q&7)}for(V=0;V<Z.length;V++)if(Z[V]!==void 0){var J=G1.from(Z[V]);G.writeUInt8(V,X),X+=1,G.writeUInt8(J.length,X),X+=1,J.copy(G,X),X+=J.length}return o8.encode.bytes=X-Y,G};o8.encode.bytes=0;o8.decode=function(W,G,X){if(!G)G=0;let Y=G;var Z=[];while(G-Y<X){var V=W.readUInt8(G);G+=1;var Q=W.readUInt8(G);G+=1;for(var J=0;J<Q;J++){var U=W.readUInt8(G+J);for(var q=0;q<8;q++)if(U&1<<7-q){var N=u4.toString(V<<8|J<<3|q);Z.push(N)}}G+=Q}return o8.decode.bytes=G-Y,Z};o8.decode.bytes=0;o8.encodingLength=function(W){var G=[];for(var X=0;X<W.length;X++){var Y=u4.toType(W[X]);G[Y>>8]=Math.max(G[Y>>8]||0,Y&255)}var Z=0;for(X=0;X<G.length;X++)if(G[X]!==void 0)Z+=2+Math.ceil((G[X]+1)/8);return Z};var x7=tl.nsec={};x7.encode=function(W,G,X){if(!G)G=G1.alloc(x7.encodingLength(W));if(!X)X=0;let Y=X;return X+=2,y0.encode(W.nextDomain,G,X),X+=y0.encode.bytes,o8.encode(W.rrtypes,G,X),X+=o8.encode.bytes,x7.encode.bytes=X-Y,G.writeUInt16BE(x7.encode.bytes-2,Y),G};x7.encode.bytes=0;x7.decode=function(W,G){if(!G)G=0;let X=G;var Y={},Z=W.readUInt16BE(G);return G+=2,Y.nextDomain=y0.decode(W,G),G+=y0.decode.bytes,Y.rrtypes=o8.decode(W,G,Z-(G-X)),G+=o8.decode.bytes,x7.decode.bytes=G-X,Y};x7.decode.bytes=0;x7.encodingLength=function(W){return 2+y0.encodingLength(W.nextDomain)+o8.encodingLength(W.rrtypes)};var k7=tl.nsec3={};k7.encode=function(W,G,X){if(!G)G=G1.alloc(k7.encodingLength(W));if(!X)X=0;let Y=X,Z=W.salt;if(!G1.isBuffer(Z))throw Error("salt must be a Buffer");let V=W.nextDomain;if(!G1.isBuffer(V))throw Error("nextDomain must be a Buffer");return X+=2,G.writeUInt8(W.algorithm,X),X+=1,G.writeUInt8(W.flags,X),X+=1,G.writeUInt16BE(W.iterations,X),X+=2,G.writeUInt8(Z.length,X),X+=1,Z.copy(G,X,0,Z.length),X+=Z.length,G.writeUInt8(V.length,X),X+=1,V.copy(G,X,0,V.length),X+=V.length,o8.encode(W.rrtypes,G,X),X+=o8.encode.bytes,k7.encode.bytes=X-Y,G.writeUInt16BE(k7.encode.bytes-2,Y),G};k7.encode.bytes=0;k7.decode=function(W,G){if(!G)G=0;let X=G;var Y={},Z=W.readUInt16BE(G);G+=2,Y.algorithm=W.readUInt8(G),G+=1,Y.flags=W.readUInt8(G),G+=1,Y.iterations=W.readUInt16BE(G),G+=2;let V=W.readUInt8(G);G+=1,Y.salt=W.slice(G,G+V),G+=V;let Q=W.readUInt8(G);return G+=1,Y.nextDomain=W.slice(G,G+Q),G+=Q,Y.rrtypes=o8.decode(W,G,Z-(G-X)),G+=o8.decode.bytes,k7.decode.bytes=G-X,Y};k7.decode.bytes=0;k7.encodingLength=function(W){return 8+W.salt.length+W.nextDomain.length+o8.encodingLength(W.rrtypes)};var _7=tl.ds={};_7.encode=function(W,G,X){if(!G)G=G1.alloc(_7.encodingLength(W));if(!X)X=0;let Y=X,Z=W.digest;if(!G1.isBuffer(Z))throw Error("Digest must be a Buffer");return X+=2,G.writeUInt16BE(W.keyTag,X),X+=2,G.writeUInt8(W.algorithm,X),X+=1,G.writeUInt8(W.digestType,X),X+=1,Z.copy(G,X,0,Z.length),X+=Z.length,_7.encode.bytes=X-Y,G.writeUInt16BE(_7.encode.bytes-2,Y),G};_7.encode.bytes=0;_7.decode=function(W,G){if(!G)G=0;let X=G;var Y={},Z=W.readUInt16BE(G);return G+=2,Y.keyTag=W.readUInt16BE(G),G+=2,Y.algorithm=W.readUInt8(G),G+=1,Y.digestType=W.readUInt8(G),G+=1,Y.digest=W.slice(G,X+Z+2),G+=Y.digest.length,_7.decode.bytes=G-X,Y};_7.decode.bytes=0;_7.encodingLength=function(W){return 6+G1.byteLength(W.digest)};var J5=tl.sshfp={};J5.getFingerprintLengthForHashType=function(G){switch(G){case 1:return 20;case 2:return 32}};J5.encode=function(G,X,Y){if(!X)X=G1.alloc(J5.encodingLength(G));if(!Y)Y=0;let Z=Y;Y+=2,X[Y]=G.algorithm,Y+=1,X[Y]=G.hash,Y+=1;let V=G1.from(G.fingerprint.toUpperCase(),"hex");if(V.length!==J5.getFingerprintLengthForHashType(G.hash))throw Error("Invalid fingerprint length");return V.copy(X,Y),Y+=V.byteLength,J5.encode.bytes=Y-Z,X.writeUInt16BE(J5.encode.bytes-2,Z),X};J5.encode.bytes=0;J5.decode=function(G,X){if(!X)X=0;let Y=X,Z={};X+=2,Z.algorithm=G[X],X+=1,Z.hash=G[X],X+=1;let V=J5.getFingerprintLengthForHashType(Z.hash);return Z.fingerprint=G.slice(X,X+V).toString("hex").toUpperCase(),X+=V,J5.decode.bytes=X-Y,Z};J5.decode.bytes=0;J5.encodingLength=function(W){return 4+G1.from(W.fingerprint,"hex").byteLength};var y7=tl.naptr={};y7.encode=function(W,G,X){if(!G)G=G1.alloc(y7.encodingLength(W));if(!X)X=0;let Y=X;return X+=2,G.writeUInt16BE(W.order||0,X),X+=2,G.writeUInt16BE(W.preference||0,X),X+=2,$1.encode(W.flags,G,X),X+=$1.encode.bytes,$1.encode(W.services,G,X),X+=$1.encode.bytes,$1.encode(W.regexp,G,X),X+=$1.encode.bytes,y0.encode(W.replacement,G,X),X+=y0.encode.bytes,y7.encode.bytes=X-Y,G.writeUInt16BE(y7.encode.bytes-2,Y),G};y7.encode.bytes=0;y7.decode=function(W,G){if(!G)G=0;let X=G,Y={};return G+=2,Y.order=W.readUInt16BE(G),G+=2,Y.preference=W.readUInt16BE(G),G+=2,Y.flags=$1.decode(W,G),G+=$1.decode.bytes,Y.services=$1.decode(W,G),G+=$1.decode.bytes,Y.regexp=$1.decode(W,G),G+=$1.decode.bytes,Y.replacement=y0.decode(W,G),G+=y0.decode.bytes,y7.decode.bytes=G-X,Y};y7.decode.bytes=0;y7.encodingLength=function(W){return $1.encodingLength(W.flags)+$1.encodingLength(W.services)+$1.encodingLength(W.regexp)+y0.encodingLength(W.replacement)+6};var v7=tl.tlsa={};v7.encode=function(W,G,X){if(!G)G=G1.alloc(v7.encodingLength(W));if(!X)X=0;let Y=X,Z=W.certificate;if(!G1.isBuffer(Z))throw Error("Certificate must be a Buffer");return X+=2,G.writeUInt8(W.usage,X),X+=1,G.writeUInt8(W.selector,X),X+=1,G.writeUInt8(W.matchingType,X),X+=1,Z.copy(G,X,0,Z.length),X+=Z.length,v7.encode.bytes=X-Y,G.writeUInt16BE(v7.encode.bytes-2,Y),G};v7.encode.bytes=0;v7.decode=function(W,G){if(!G)G=0;let X=G,Y={},Z=W.readUInt16BE(G);return G+=2,Y.usage=W.readUInt8(G),G+=1,Y.selector=W.readUInt8(G),G+=1,Y.matchingType=W.readUInt8(G),G+=1,Y.certificate=W.slice(G,X+Z+2),G+=Y.certificate.length,v7.decode.bytes=G-X,Y};v7.decode.bytes=0;v7.encodingLength=function(W){return 5+G1.byteLength(W.certificate)};var WO=tl.record=function(W){switch(W.toUpperCase()){case"A":return v4;case"PTR":return o5;case"CNAME":return al;case"DNAME":return sl;case"TXT":return x4;case"NULL":return k4;case"AAAA":return g4;case"SRV":return y4;case"HINFO":return _4;case"CAA":return Q5;case"NS":return F4;case"SOA":return S4;case"MX":return l6;case"OPT":return U5;case"DNSKEY":return y9;case"RRSIG":return F7;case"RP":return S7;case"NSEC":return x7;case"NSEC3":return k7;case"SSHFP":return J5;case"DS":return _7;case"NAPTR":return y7;case"TLSA":return v7}return $4},X9=tl.answer={};X9.encode=function(W,G,X){if(!G)G=G1.alloc(X9.encodingLength(W));if(!X)X=0;let Y=X;if(y0.encode(W.name,G,X),X+=y0.encode.bytes,G.writeUInt16BE(u4.toType(W.type),X),W.type.toUpperCase()==="OPT"){if(W.name!==".")throw Error("OPT name must be root.");G.writeUInt16BE(W.udpPayloadSize||4096,X+2),G.writeUInt8(W.extendedRcode||0,X+4),G.writeUInt8(W.ednsVersion||0,X+5),G.writeUInt16BE(W.flags||0,X+6),X+=8,U5.encode(W.options||[],G,X),X+=U5.encode.bytes}else{let Z=EN.toClass(W.class===void 0?"IN":W.class);if(W.flush)Z|=32768;G.writeUInt16BE(Z,X+2),G.writeUInt32BE(W.ttl||0,X+4),X+=8;let V=WO(W.type);V.encode(W.data,G,X),X+=V.encode.bytes}return X9.encode.bytes=X-Y,G};X9.encode.bytes=0;X9.decode=function(W,G){if(!G)G=0;let X={},Y=G;if(X.name=y0.decode(W,G),G+=y0.decode.bytes,X.type=u4.toString(W.readUInt16BE(G)),X.type==="OPT")X.udpPayloadSize=W.readUInt16BE(G+2),X.extendedRcode=W.readUInt8(G+4),X.ednsVersion=W.readUInt8(G+5),X.flags=W.readUInt16BE(G+6),X.flag_do=(X.flags>>15&1)===1,X.options=U5.decode(W,G+8),G+=8+U5.decode.bytes;else{let Z=W.readUInt16BE(G+2);X.ttl=W.readUInt32BE(G+4),X.class=EN.toString(Z&-32769),X.flush=!!(Z&32768);let V=WO(X.type);X.data=V.decode(W,G+8),G+=8+V.decode.bytes}return X9.decode.bytes=G-Y,X};X9.decode.bytes=0;X9.encodingLength=function(W){let G=W.data!==null&&W.data!==void 0?W.data:W.options;return y0.encodingLength(W.name)+8+WO(W.type).encodingLength(G)};var n5=tl.question={};n5.encode=function(W,G,X){if(!G)G=G1.alloc(n5.encodingLength(W));if(!X)X=0;let Y=X;return y0.encode(W.name,G,X),X+=y0.encode.bytes,G.writeUInt16BE(u4.toType(W.type),X),X+=2,G.writeUInt16BE(EN.toClass(W.class===void 0?"IN":W.class),X),X+=2,n5.encode.bytes=X-Y,W};n5.encode.bytes=0;n5.decode=function(W,G){if(!G)G=0;let X=G,Y={};if(Y.name=y0.decode(W,G),G+=y0.decode.bytes,Y.type=u4.toString(W.readUInt16BE(G)),G+=2,Y.class=EN.toString(W.readUInt16BE(G)),G+=2,!!(Y.class&32768))Y.class&=-32769;return n5.decode.bytes=G-X,Y};n5.decode.bytes=0;n5.encodingLength=function(W){return y0.encodingLength(W.name)+4};tl.AUTHORITATIVE_ANSWER=1024;tl.TRUNCATED_RESPONSE=512;tl.RECURSION_DESIRED=256;tl.RECURSION_AVAILABLE=128;tl.AUTHENTIC_DATA=32;tl.CHECKING_DISABLED=16;tl.DNSSEC_OK=32768;tl.encode=function(W,G,X){let Y=!G;if(Y)G=G1.alloc(tl.encodingLength(W));if(!X)X=0;let Z=X;if(!W.questions)W.questions=[];if(!W.answers)W.answers=[];if(!W.authorities)W.authorities=[];if(!W.additionals)W.additionals=[];if(i5.encode(W,G,X),X+=i5.encode.bytes,X=FQ(W.questions,n5,G,X),X=FQ(W.answers,X9,G,X),X=FQ(W.authorities,X9,G,X),X=FQ(W.additionals,X9,G,X),tl.encode.bytes=X-Z,Y&&tl.encode.bytes!==G.length)return G.slice(0,tl.encode.bytes);return G};tl.encode.bytes=0;tl.decode=function(W,G){if(!G)G=0;let X=G,Y=i5.decode(W,G);return G+=i5.decode.bytes,G=BN(Y.questions,n5,W,G),G=BN(Y.answers,X9,W,G),G=BN(Y.authorities,X9,W,G),G=BN(Y.additionals,X9,W,G),tl.decode.bytes=G-X,Y};tl.decode.bytes=0;tl.encodingLength=function(W){return i5.encodingLength(W)+BY(W.questions||[],n5)+BY(W.answers||[],X9)+BY(W.authorities||[],X9)+BY(W.additionals||[],X9)};tl.streamEncode=function(W){let G=tl.encode(W),X=G1.alloc(2);X.writeUInt16BE(G.byteLength);let Y=G1.concat([X,G]);return tl.streamEncode.bytes=Y.byteLength,Y};tl.streamEncode.bytes=0;tl.streamDecode=function(W){let G=W.readUInt16BE(0);if(W.byteLength<G+2)return null;let X=tl.decode(W.slice(2));return tl.streamDecode.bytes=tl.decode.bytes,X};tl.streamDecode.bytes=0;function BY(W,G){let X=0;for(let Y=0;Y<W.length;Y++)X+=G.encodingLength(W[Y]);return X}function FQ(W,G,X,Y){for(let Z=0;Z<W.length;Z++)G.encode(W[Z],X,Y),Y+=G.encode.bytes;return Y}function BN(W,G,X,Y){for(let Z=0;Z<W.length;Z++)W[Z]=G.decode(X,Y),Y+=G.decode.bytes;return Y}});var _$=Z1((AH0,k$)=>{var x$=Ad;process.nextTick(Hd,42);k$.exports=Jd;function Jd(W){var G=Y;return X;function X(Z){G(Z||qd)}function Y(Z){var V=[Z];G=Q,W(J);function Q(U){V.push(U)}function J(U){var q=arguments;G=Ud(U)?Y:N;while(V.length)N(V.shift());function N(A){x$(Nd,A,q)}}}}function Ud(W){return Object.prototype.toString.call(W)==="[object Error]"}function qd(){}function Nd(W,G){W.apply(null,G)}function Hd(W){if(W===42)x$=process.nextTick}function Ad(W,G,X){process.nextTick(function(){W(G,X)})}});var g$=Z1((zH0,v$)=>{var GO=S$(),zd=$8("dgram"),Id=_$(),wd=$8("events"),YO=$8("os"),XO=function(){};v$.exports=function(W){if(!W)W={};var G=new wd.EventEmitter,X=typeof W.port==="number"?W.port:5353,Y=W.type||"udp4",Z=W.ip||W.host||(Y==="udp4"?"224.0.0.251":null),V={address:Z,port:X},Q={},J=!1,U=null;if(Y==="udp6"&&(!Z||!W.interface))throw Error("For IPv6 multicast you must specify `ip` and `interface`");var q=W.socket||zd.createSocket({type:Y,reuseAddr:W.reuseAddr!==!1,toString:function(){return Y}});q.on("error",function(A){if(A.code==="EACCES"||A.code==="EADDRINUSE")G.emit("error",A);else G.emit("warning",A)}),q.on("message",function(A,H){try{A=GO.decode(A)}catch(I){G.emit("warning",I);return}if(G.emit("packet",A,H),A.type==="query")G.emit("query",A,H);if(A.type==="response")G.emit("response",A,H)}),q.on("listening",function(){if(!X)X=V.port=q.address().port;if(W.multicast!==!1)G.update(),U=setInterval(G.update,5000),q.setMulticastTTL(W.ttl||255),q.setMulticastLoopback(W.loopback!==!1)});var N=Id(function(A){if(!X||W.bind===!1)return A(null);q.once("error",A),q.bind(X,W.bind||W.interface,function(){q.removeListener("error",A),A(null)})});return N(function(A){if(A)return G.emit("error",A);G.emit("ready")}),G.send=function(A,H,I){if(typeof H==="function")return G.send(A,null,H);if(!I)I=XO;if(!H)H=V;else if(!H.host&&!H.address)H.address=V.address;N(w);function w(C){if(J)return I();if(C)return I(C);var D=GO.encode(A);q.send(D,0,D.length,H.port,H.address||H.host,I)}},G.response=G.respond=function(A,H,I){if(Array.isArray(A))A={answers:A};A.type="response",A.flags=(A.flags||0)|GO.AUTHORITATIVE_ANSWER,G.send(A,H,I)},G.query=function(A,H,I,w){if(typeof H==="function")return G.query(A,null,null,H);if(typeof H==="object"&&H&&H.port)return G.query(A,null,H,I);if(typeof I==="function")return G.query(A,H,null,I);if(!w)w=XO;if(typeof A==="string")A=[{name:A,type:H||"ANY"}];if(Array.isArray(A))A={type:"query",questions:A};A.type="query",G.send(A,I,w)},G.destroy=function(A){if(!A)A=XO;if(J)return process.nextTick(A);J=!0,clearInterval(U);for(var H in Q)try{q.dropMembership(Z,H)}catch(I){}Q={},q.close(A)},G.update=function(){var A=W.interface?[].concat(W.interface):Od(),H=!1;for(var I=0;I<A.length;I++){var w=A[I];if(Q[w])continue;try{q.addMembership(Z,w),Q[w]=!0,H=!0}catch(C){G.emit("warning",C)}}if(H){if(q.setMulticastInterface)try{q.setMulticastInterface(W.interface||jd())}catch(C){G.emit("warning",C)}G.emit("networkInterface")}},G};function jd(){var W=YO.networkInterfaces(),G=Object.keys(W);for(var X=0;X<G.length;X++){var Y=W[G[X]];for(var Z=0;Z<Y.length;Z++){var V=Y[Z];if(y$(V.family)&&!V.internal){if(YO.platform()==="darwin"&&G[X]==="en0")return V.address;return"0.0.0.0"}}}return"127.0.0.1"}function Od(){var W=YO.networkInterfaces(),G=Object.keys(W),X=[];for(var Y=0;Y<G.length;Y++){var Z=W[G[Y]];for(var V=0;V<Z.length;V++){var Q=Z[V];if(y$(Q.family)){X.push(Q.address);break}}}return X}function y$(W){return W===4||W==="IPv4"}});import{Database as qt}from"bun:sqlite";import{mkdirSync as Nt}from"fs";import{dirname as Ht}from"path";function JC(W){let G=W.length,X=0,Y=0;while(Y<G){let Z=W.charCodeAt(Y++);if((Z&4294967168)===0){X++;continue}else if((Z&4294965248)===0)X+=2;else{if(Z>=55296&&Z<=56319){if(Y<G){let V=W.charCodeAt(Y);if((V&64512)===56320)++Y,Z=((Z&1023)<<10)+(V&1023)+65536}}if((Z&4294901760)===0)X+=3;else X+=4}}return X}function g_(W,G,X){let Y=W.length,Z=X,V=0;while(V<Y){let Q=W.charCodeAt(V++);if((Q&4294967168)===0){G[Z++]=Q;continue}else if((Q&4294965248)===0)G[Z++]=Q>>6&31|192;else{if(Q>=55296&&Q<=56319){if(V<Y){let J=W.charCodeAt(V);if((J&64512)===56320)++V,Q=((Q&1023)<<10)+(J&1023)+65536}}if((Q&4294901760)===0)G[Z++]=Q>>12&15|224,G[Z++]=Q>>6&63|128;else G[Z++]=Q>>18&7|240,G[Z++]=Q>>12&63|128,G[Z++]=Q>>6&63|128}G[Z++]=Q&63|128}}var u_=new TextEncoder,h_=50;function b_(W,G,X){u_.encodeInto(W,G.subarray(X))}function UC(W,G,X){if(W.length>h_)b_(W,G,X);else g_(W,G,X)}var m_=4096;function NA(W,G,X){let Y=G,Z=Y+X,V=[],Q="";while(Y<Z){let J=W[Y++];if((J&128)===0)V.push(J);else if((J&224)===192){let U=W[Y++]&63;V.push((J&31)<<6|U)}else if((J&240)===224){let U=W[Y++]&63,q=W[Y++]&63;V.push((J&31)<<12|U<<6|q)}else if((J&248)===240){let U=W[Y++]&63,q=W[Y++]&63,N=W[Y++]&63,A=(J&7)<<18|U<<12|q<<6|N;if(A>65535)A-=65536,V.push(A>>>10&1023|55296),A=56320|A&1023;V.push(A)}else V.push(J);if(V.length>=m_)Q+=String.fromCharCode(...V),V.length=0}if(V.length>0)Q+=String.fromCharCode(...V);return Q}var f_=new TextDecoder,c_=200;function p_(W,G,X){let Y=W.subarray(G,G+X);return f_.decode(Y)}function qC(W,G,X){if(X>c_)return p_(W,G,X);else return NA(W,G,X)}class pG{type;data;constructor(W,G){this.type=W,this.data=G}}class $9 extends Error{constructor(W){super(W);let G=Object.create($9.prototype);Object.setPrototypeOf(this,G),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:$9.name})}}var lG=4294967295;function NC(W,G,X){let Y=X/4294967296,Z=X;W.setUint32(G,Y),W.setUint32(G+4,Z)}function _J(W,G,X){let Y=Math.floor(X/4294967296),Z=X;W.setUint32(G,Y),W.setUint32(G+4,Z)}function yJ(W,G){let X=W.getInt32(G),Y=W.getUint32(G+4);return X*4294967296+Y}function HC(W,G){let X=W.getUint32(G),Y=W.getUint32(G+4);return X*4294967296+Y}var l_=-1,d_=4294967295,o_=17179869183;function n_({sec:W,nsec:G}){if(W>=0&&G>=0&&W<=o_)if(G===0&&W<=d_){let X=new Uint8Array(4);return new DataView(X.buffer).setUint32(0,W),X}else{let X=W/4294967296,Y=W&4294967295,Z=new Uint8Array(8),V=new DataView(Z.buffer);return V.setUint32(0,G<<2|X&3),V.setUint32(4,Y),Z}else{let X=new Uint8Array(12),Y=new DataView(X.buffer);return Y.setUint32(0,G),_J(Y,4,W),X}}function i_(W){let G=W.getTime(),X=Math.floor(G/1000),Y=(G-X*1000)*1e6,Z=Math.floor(Y/1e9);return{sec:X+Z,nsec:Y-Z*1e9}}function r_(W){if(W instanceof Date){let G=i_(W);return n_(G)}else return null}function a_(W){let G=new DataView(W.buffer,W.byteOffset,W.byteLength);switch(W.byteLength){case 4:{let X=G.getUint32(0),Y=0;return{sec:X,nsec:0}}case 8:{let X=G.getUint32(0),Y=G.getUint32(4),Z=(X&3)*4294967296+Y,V=X>>>2;return{sec:Z,nsec:V}}case 12:{let X=yJ(G,4),Y=G.getUint32(0);return{sec:X,nsec:Y}}default:throw new $9(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${W.length}`)}}function s_(W){let G=a_(W);return new Date(G.sec*1000+G.nsec/1e6)}var AC={type:l_,encode:r_,decode:s_};class dG{static defaultCodec=new dG;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(AC)}register({type:W,encode:G,decode:X}){if(W>=0)this.encoders[W]=G,this.decoders[W]=X;else{let Y=-1-W;this.builtInEncoders[Y]=G,this.builtInDecoders[Y]=X}}tryToEncode(W,G){for(let X=0;X<this.builtInEncoders.length;X++){let Y=this.builtInEncoders[X];if(Y!=null){let Z=Y(W,G);if(Z!=null){let V=-1-X;return new pG(V,Z)}}}for(let X=0;X<this.encoders.length;X++){let Y=this.encoders[X];if(Y!=null){let Z=Y(W,G);if(Z!=null)return new pG(X,Z)}}if(W instanceof pG)return W;return null}decode(W,G,X){let Y=G<0?this.builtInDecoders[-1-G]:this.decoders[G];if(Y)return Y(W,G,X);else return new pG(G,W)}}function t_(W){return W instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&W instanceof SharedArrayBuffer}function UZ(W){if(W instanceof Uint8Array)return W;else if(ArrayBuffer.isView(W))return new Uint8Array(W.buffer,W.byteOffset,W.byteLength);else if(t_(W))return new Uint8Array(W);else return Uint8Array.from(W)}var e_=100,Wy=2048;class vJ{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(W){this.extensionCodec=W?.extensionCodec??dG.defaultCodec,this.context=W?.context,this.useBigInt64=W?.useBigInt64??!1,this.maxDepth=W?.maxDepth??e_,this.initialBufferSize=W?.initialBufferSize??Wy,this.sortKeys=W?.sortKeys??!1,this.forceFloat32=W?.forceFloat32??!1,this.ignoreUndefined=W?.ignoreUndefined??!1,this.forceIntegerToFloat=W?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new vJ({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(W){if(this.entered)return this.clone().encodeSharedRef(W);try{return this.entered=!0,this.reinitializeState(),this.doEncode(W,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(W){if(this.entered)return this.clone().encode(W);try{return this.entered=!0,this.reinitializeState(),this.doEncode(W,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(W,G){if(G>this.maxDepth)throw Error(`Too deep objects in depth ${G}`);if(W==null)this.encodeNil();else if(typeof W==="boolean")this.encodeBoolean(W);else if(typeof W==="number")if(!this.forceIntegerToFloat)this.encodeNumber(W);else this.encodeNumberAsFloat(W);else if(typeof W==="string")this.encodeString(W);else if(this.useBigInt64&&typeof W==="bigint")this.encodeBigInt64(W);else this.encodeObject(W,G)}ensureBufferSizeToWrite(W){let G=this.pos+W;if(this.view.byteLength<G)this.resizeBuffer(G*2)}resizeBuffer(W){let G=new ArrayBuffer(W),X=new Uint8Array(G),Y=new DataView(G);X.set(this.bytes),this.view=Y,this.bytes=X}encodeNil(){this.writeU8(192)}encodeBoolean(W){if(W===!1)this.writeU8(194);else this.writeU8(195)}encodeNumber(W){if(!this.forceIntegerToFloat&&Number.isSafeInteger(W))if(W>=0)if(W<128)this.writeU8(W);else if(W<256)this.writeU8(204),this.writeU8(W);else if(W<65536)this.writeU8(205),this.writeU16(W);else if(W<4294967296)this.writeU8(206),this.writeU32(W);else if(!this.useBigInt64)this.writeU8(207),this.writeU64(W);else this.encodeNumberAsFloat(W);else if(W>=-32)this.writeU8(224|W+32);else if(W>=-128)this.writeU8(208),this.writeI8(W);else if(W>=-32768)this.writeU8(209),this.writeI16(W);else if(W>=-2147483648)this.writeU8(210),this.writeI32(W);else if(!this.useBigInt64)this.writeU8(211),this.writeI64(W);else this.encodeNumberAsFloat(W);else this.encodeNumberAsFloat(W)}encodeNumberAsFloat(W){if(this.forceFloat32)this.writeU8(202),this.writeF32(W);else this.writeU8(203),this.writeF64(W)}encodeBigInt64(W){if(W>=BigInt(0))this.writeU8(207),this.writeBigUint64(W);else this.writeU8(211),this.writeBigInt64(W)}writeStringHeader(W){if(W<32)this.writeU8(160+W);else if(W<256)this.writeU8(217),this.writeU8(W);else if(W<65536)this.writeU8(218),this.writeU16(W);else if(W<4294967296)this.writeU8(219),this.writeU32(W);else throw Error(`Too long string: ${W} bytes in UTF-8`)}encodeString(W){let X=JC(W);this.ensureBufferSizeToWrite(5+X),this.writeStringHeader(X),UC(W,this.bytes,this.pos),this.pos+=X}encodeObject(W,G){let X=this.extensionCodec.tryToEncode(W,this.context);if(X!=null)this.encodeExtension(X);else if(Array.isArray(W))this.encodeArray(W,G);else if(ArrayBuffer.isView(W))this.encodeBinary(W);else if(typeof W==="object")this.encodeMap(W,G);else throw Error(`Unrecognized object: ${Object.prototype.toString.apply(W)}`)}encodeBinary(W){let G=W.byteLength;if(G<256)this.writeU8(196),this.writeU8(G);else if(G<65536)this.writeU8(197),this.writeU16(G);else if(G<4294967296)this.writeU8(198),this.writeU32(G);else throw Error(`Too large binary: ${G}`);let X=UZ(W);this.writeU8a(X)}encodeArray(W,G){let X=W.length;if(X<16)this.writeU8(144+X);else if(X<65536)this.writeU8(220),this.writeU16(X);else if(X<4294967296)this.writeU8(221),this.writeU32(X);else throw Error(`Too large array: ${X}`);for(let Y of W)this.doEncode(Y,G+1)}countWithoutUndefined(W,G){let X=0;for(let Y of G)if(W[Y]!==void 0)X++;return X}encodeMap(W,G){let X=Object.keys(W);if(this.sortKeys)X.sort();let Y=this.ignoreUndefined?this.countWithoutUndefined(W,X):X.length;if(Y<16)this.writeU8(128+Y);else if(Y<65536)this.writeU8(222),this.writeU16(Y);else if(Y<4294967296)this.writeU8(223),this.writeU32(Y);else throw Error(`Too large map object: ${Y}`);for(let Z of X){let V=W[Z];if(!(this.ignoreUndefined&&V===void 0))this.encodeString(Z),this.doEncode(V,G+1)}}encodeExtension(W){if(typeof W.data==="function"){let X=W.data(this.pos+6),Y=X.length;if(Y>=4294967296)throw Error(`Too large extension object: ${Y}`);this.writeU8(201),this.writeU32(Y),this.writeI8(W.type),this.writeU8a(X);return}let G=W.data.length;if(G===1)this.writeU8(212);else if(G===2)this.writeU8(213);else if(G===4)this.writeU8(214);else if(G===8)this.writeU8(215);else if(G===16)this.writeU8(216);else if(G<256)this.writeU8(199),this.writeU8(G);else if(G<65536)this.writeU8(200),this.writeU16(G);else if(G<4294967296)this.writeU8(201),this.writeU32(G);else throw Error(`Too large extension object: ${G}`);this.writeI8(W.type),this.writeU8a(W.data)}writeU8(W){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,W),this.pos++}writeU8a(W){let G=W.length;this.ensureBufferSizeToWrite(G),this.bytes.set(W,this.pos),this.pos+=G}writeI8(W){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,W),this.pos++}writeU16(W){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,W),this.pos+=2}writeI16(W){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,W),this.pos+=2}writeU32(W){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,W),this.pos+=4}writeI32(W){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,W),this.pos+=4}writeF32(W){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,W),this.pos+=4}writeF64(W){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,W),this.pos+=8}writeU64(W){this.ensureBufferSizeToWrite(8),NC(this.view,this.pos,W),this.pos+=8}writeI64(W){this.ensureBufferSizeToWrite(8),_J(this.view,this.pos,W),this.pos+=8}writeBigUint64(W){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,W),this.pos+=8}writeBigInt64(W){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,W),this.pos+=8}}function qZ(W,G){return new vJ(G).encodeSharedRef(W)}function gJ(W){return`${W<0?"-":""}0x${Math.abs(W).toString(16).padStart(2,"0")}`}var Gy=16,Xy=16;class HA{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(W=Gy,G=Xy){this.maxKeyLength=W,this.maxLengthPerKey=G,this.caches=[];for(let X=0;X<this.maxKeyLength;X++)this.caches.push([])}canBeCached(W){return W>0&&W<=this.maxKeyLength}find(W,G,X){let Y=this.caches[X-1];W:for(let Z of Y){let V=Z.bytes;for(let Q=0;Q<X;Q++)if(V[Q]!==W[G+Q])continue W;return Z.str}return null}store(W,G){let X=this.caches[W.length-1],Y={bytes:W,str:G};if(X.length>=this.maxLengthPerKey)X[Math.random()*X.length|0]=Y;else X.push(Y)}decode(W,G,X){let Y=this.find(W,G,X);if(Y!=null)return this.hit++,Y;this.miss++;let Z=NA(W,G,X),V=Uint8Array.prototype.slice.call(W,G,G+X);return this.store(V,Z),Z}}var AA="array",HZ="map_key",IC="map_value",Yy=(W)=>{if(typeof W==="string"||typeof W==="number")return W;throw new $9("The type of key must be string or number but "+typeof W)};class wC{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(W){let G=this.getUninitializedStateFromPool();G.type=AA,G.position=0,G.size=W,G.array=Array(W)}pushMapState(W){let G=this.getUninitializedStateFromPool();G.type=HZ,G.readCount=0,G.size=W,G.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){let W={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(W)}return this.stack[this.stackHeadPosition]}release(W){if(this.stack[this.stackHeadPosition]!==W)throw Error("Invalid stack state. Released state is not on top of the stack.");if(W.type===AA){let X=W;X.size=0,X.array=void 0,X.position=0,X.type=void 0}if(W.type===HZ||W.type===IC){let X=W;X.size=0,X.map=void 0,X.readCount=0,X.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}var NZ=-1,zA=new DataView(new ArrayBuffer(0)),Zy=new Uint8Array(zA.buffer);try{zA.getInt8(0)}catch(W){if(!(W instanceof RangeError))throw Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var zC=RangeError("Insufficient data"),Vy=new HA;class uJ{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=zA;bytes=Zy;headByte=NZ;stack=new wC;entered=!1;constructor(W){this.extensionCodec=W?.extensionCodec??dG.defaultCodec,this.context=W?.context,this.useBigInt64=W?.useBigInt64??!1,this.rawStrings=W?.rawStrings??!1,this.maxStrLength=W?.maxStrLength??lG,this.maxBinLength=W?.maxBinLength??lG,this.maxArrayLength=W?.maxArrayLength??lG,this.maxMapLength=W?.maxMapLength??lG,this.maxExtLength=W?.maxExtLength??lG,this.keyDecoder=W?.keyDecoder!==void 0?W.keyDecoder:Vy,this.mapKeyConverter=W?.mapKeyConverter??Yy}clone(){return new uJ({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=NZ,this.stack.reset()}setBuffer(W){let G=UZ(W);this.bytes=G,this.view=new DataView(G.buffer,G.byteOffset,G.byteLength),this.pos=0}appendBuffer(W){if(this.headByte===NZ&&!this.hasRemaining(1))this.setBuffer(W);else{let G=this.bytes.subarray(this.pos),X=UZ(W),Y=new Uint8Array(G.length+X.length);Y.set(G),Y.set(X,G.length),this.setBuffer(Y)}}hasRemaining(W){return this.view.byteLength-this.pos>=W}createExtraByteError(W){let{view:G,pos:X}=this;return RangeError(`Extra ${G.byteLength-X} of ${G.byteLength} byte(s) found at buffer[${W}]`)}decode(W){if(this.entered)return this.clone().decode(W);try{this.entered=!0,this.reinitializeState(),this.setBuffer(W);let G=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return G}finally{this.entered=!1}}*decodeMulti(W){if(this.entered){yield*this.clone().decodeMulti(W);return}try{this.entered=!0,this.reinitializeState(),this.setBuffer(W);while(this.hasRemaining(1))yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(W){if(this.entered)return this.clone().decodeAsync(W);try{this.entered=!0;let G=!1,X;for await(let Q of W){if(G)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(Q);try{X=this.doDecodeSync(),G=!0}catch(J){if(!(J instanceof RangeError))throw J}this.totalPos+=this.pos}if(G){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return X}let{headByte:Y,pos:Z,totalPos:V}=this;throw RangeError(`Insufficient data in parsing ${gJ(Y)} at ${V} (${Z} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(W){return this.decodeMultiAsync(W,!0)}decodeStream(W){return this.decodeMultiAsync(W,!1)}async*decodeMultiAsync(W,G){if(this.entered){yield*this.clone().decodeMultiAsync(W,G);return}try{this.entered=!0;let X=G,Y=-1;for await(let Z of W){if(G&&Y===0)throw this.createExtraByteError(this.totalPos);if(this.appendBuffer(Z),X)Y=this.readArraySize(),X=!1,this.complete();try{while(!0)if(yield this.doDecodeSync(),--Y===0)break}catch(V){if(!(V instanceof RangeError))throw V}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){W:while(!0){let W=this.readHeadByte(),G;if(W>=224)G=W-256;else if(W<192)if(W<128)G=W;else if(W<144){let Y=W-128;if(Y!==0){this.pushMapState(Y),this.complete();continue W}else G={}}else if(W<160){let Y=W-144;if(Y!==0){this.pushArrayState(Y),this.complete();continue W}else G=[]}else{let Y=W-160;G=this.decodeString(Y,0)}else if(W===192)G=null;else if(W===194)G=!1;else if(W===195)G=!0;else if(W===202)G=this.readF32();else if(W===203)G=this.readF64();else if(W===204)G=this.readU8();else if(W===205)G=this.readU16();else if(W===206)G=this.readU32();else if(W===207)if(this.useBigInt64)G=this.readU64AsBigInt();else G=this.readU64();else if(W===208)G=this.readI8();else if(W===209)G=this.readI16();else if(W===210)G=this.readI32();else if(W===211)if(this.useBigInt64)G=this.readI64AsBigInt();else G=this.readI64();else if(W===217){let Y=this.lookU8();G=this.decodeString(Y,1)}else if(W===218){let Y=this.lookU16();G=this.decodeString(Y,2)}else if(W===219){let Y=this.lookU32();G=this.decodeString(Y,4)}else if(W===220){let Y=this.readU16();if(Y!==0){this.pushArrayState(Y),this.complete();continue W}else G=[]}else if(W===221){let Y=this.readU32();if(Y!==0){this.pushArrayState(Y),this.complete();continue W}else G=[]}else if(W===222){let Y=this.readU16();if(Y!==0){this.pushMapState(Y),this.complete();continue W}else G={}}else if(W===223){let Y=this.readU32();if(Y!==0){this.pushMapState(Y),this.complete();continue W}else G={}}else if(W===196){let Y=this.lookU8();G=this.decodeBinary(Y,1)}else if(W===197){let Y=this.lookU16();G=this.decodeBinary(Y,2)}else if(W===198){let Y=this.lookU32();G=this.decodeBinary(Y,4)}else if(W===212)G=this.decodeExtension(1,0);else if(W===213)G=this.decodeExtension(2,0);else if(W===214)G=this.decodeExtension(4,0);else if(W===215)G=this.decodeExtension(8,0);else if(W===216)G=this.decodeExtension(16,0);else if(W===199){let Y=this.lookU8();G=this.decodeExtension(Y,1)}else if(W===200){let Y=this.lookU16();G=this.decodeExtension(Y,2)}else if(W===201){let Y=this.lookU32();G=this.decodeExtension(Y,4)}else throw new $9(`Unrecognized type byte: ${gJ(W)}`);this.complete();let X=this.stack;while(X.length>0){let Y=X.top();if(Y.type===AA)if(Y.array[Y.position]=G,Y.position++,Y.position===Y.size)G=Y.array,X.release(Y);else continue W;else if(Y.type===HZ){if(G==="__proto__")throw new $9("The key __proto__ is not allowed");Y.key=this.mapKeyConverter(G),Y.type=IC;continue W}else if(Y.map[Y.key]=G,Y.readCount++,Y.readCount===Y.size)G=Y.map,X.release(Y);else{Y.key=null,Y.type=HZ;continue W}}return G}}readHeadByte(){if(this.headByte===NZ)this.headByte=this.readU8();return this.headByte}complete(){this.headByte=NZ}readArraySize(){let W=this.readHeadByte();switch(W){case 220:return this.readU16();case 221:return this.readU32();default:if(W<160)return W-144;else throw new $9(`Unrecognized array type byte: ${gJ(W)}`)}}pushMapState(W){if(W>this.maxMapLength)throw new $9(`Max length exceeded: map length (${W}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(W)}pushArrayState(W){if(W>this.maxArrayLength)throw new $9(`Max length exceeded: array length (${W}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(W)}decodeString(W,G){if(!this.rawStrings||this.stateIsMapKey())return this.decodeUtf8String(W,G);return this.decodeBinary(W,G)}decodeUtf8String(W,G){if(W>this.maxStrLength)throw new $9(`Max length exceeded: UTF-8 byte length (${W}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+G+W)throw zC;let X=this.pos+G,Y;if(this.stateIsMapKey()&&this.keyDecoder?.canBeCached(W))Y=this.keyDecoder.decode(this.bytes,X,W);else Y=qC(this.bytes,X,W);return this.pos+=G+W,Y}stateIsMapKey(){if(this.stack.length>0)return this.stack.top().type===HZ;return!1}decodeBinary(W,G){if(W>this.maxBinLength)throw new $9(`Max length exceeded: bin length (${W}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(W+G))throw zC;let X=this.pos+G,Y=this.bytes.subarray(X,X+W);return this.pos+=G+W,Y}decodeExtension(W,G){if(W>this.maxExtLength)throw new $9(`Max length exceeded: ext length (${W}) > maxExtLength (${this.maxExtLength})`);let X=this.view.getInt8(this.pos+G),Y=this.decodeBinary(W,G+1);return this.extensionCodec.decode(Y,X,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let W=this.view.getUint8(this.pos);return this.pos++,W}readI8(){let W=this.view.getInt8(this.pos);return this.pos++,W}readU16(){let W=this.view.getUint16(this.pos);return this.pos+=2,W}readI16(){let W=this.view.getInt16(this.pos);return this.pos+=2,W}readU32(){let W=this.view.getUint32(this.pos);return this.pos+=4,W}readI32(){let W=this.view.getInt32(this.pos);return this.pos+=4,W}readU64(){let W=HC(this.view,this.pos);return this.pos+=8,W}readI64(){let W=yJ(this.view,this.pos);return this.pos+=8,W}readU64AsBigInt(){let W=this.view.getBigUint64(this.pos);return this.pos+=8,W}readI64AsBigInt(){let W=this.view.getBigInt64(this.pos);return this.pos+=8,W}readF32(){let W=this.view.getFloat32(this.pos);return this.pos+=4,W}readF64(){let W=this.view.getFloat64(this.pos);return this.pos+=8,W}}function HW(W,G){return new uJ(G).decode(W)}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function sG(W){let G=W.length;while(--G>=0)W[G]=0}var Qy=0,WD=1,Jy=2,Uy=3,qy=258,uA=29,BZ=256,KZ=BZ+1+uA,iG=30,hA=19,GD=2*KZ+1,AW=15,IA=16,Ny=7,bA=256,XD=16,YD=17,ZD=18,$A=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),pJ=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Hy=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),VD=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ay=512,r7=Array((KZ+2)*2);sG(r7);var wZ=Array(iG*2);sG(wZ);var CZ=Array(Ay);sG(CZ);var DZ=Array(qy-Uy+1);sG(DZ);var mA=Array(uA);sG(mA);var lJ=Array(iG);sG(lJ);function wA(W,G,X,Y,Z){this.static_tree=W,this.extra_bits=G,this.extra_base=X,this.elems=Y,this.max_length=Z,this.has_stree=W&&W.length}var QD,JD,UD;function jA(W,G){this.dyn_tree=W,this.max_code=0,this.stat_desc=G}var qD=(W)=>{return W<256?CZ[W]:CZ[256+(W>>>7)]},MZ=(W,G)=>{W.pending_buf[W.pending++]=G&255,W.pending_buf[W.pending++]=G>>>8&255},g9=(W,G,X)=>{if(W.bi_valid>IA-X)W.bi_buf|=G<<W.bi_valid&65535,MZ(W,W.bi_buf),W.bi_buf=G>>IA-W.bi_valid,W.bi_valid+=X-IA;else W.bi_buf|=G<<W.bi_valid&65535,W.bi_valid+=X},J7=(W,G,X)=>{g9(W,X[G*2],X[G*2+1])},ND=(W,G)=>{let X=0;do X|=W&1,W>>>=1,X<<=1;while(--G>0);return X>>>1},zy=(W)=>{if(W.bi_valid===16)MZ(W,W.bi_buf),W.bi_buf=0,W.bi_valid=0;else if(W.bi_valid>=8)W.pending_buf[W.pending++]=W.bi_buf&255,W.bi_buf>>=8,W.bi_valid-=8},Iy=(W,G)=>{let{dyn_tree:X,max_code:Y}=G,Z=G.stat_desc.static_tree,V=G.stat_desc.has_stree,Q=G.stat_desc.extra_bits,J=G.stat_desc.extra_base,U=G.stat_desc.max_length,q,N,A,H,I,w,C=0;for(H=0;H<=AW;H++)W.bl_count[H]=0;X[W.heap[W.heap_max]*2+1]=0;for(q=W.heap_max+1;q<GD;q++){if(N=W.heap[q],H=X[X[N*2+1]*2+1]+1,H>U)H=U,C++;if(X[N*2+1]=H,N>Y)continue;if(W.bl_count[H]++,I=0,N>=J)I=Q[N-J];if(w=X[N*2],W.opt_len+=w*(H+I),V)W.static_len+=w*(Z[N*2+1]+I)}if(C===0)return;do{H=U-1;while(W.bl_count[H]===0)H--;W.bl_count[H]--,W.bl_count[H+1]+=2,W.bl_count[U]--,C-=2}while(C>0);for(H=U;H!==0;H--){N=W.bl_count[H];while(N!==0){if(A=W.heap[--q],A>Y)continue;if(X[A*2+1]!==H)W.opt_len+=(H-X[A*2+1])*X[A*2],X[A*2+1]=H;N--}}},HD=(W,G,X)=>{let Y=Array(AW+1),Z=0,V,Q;for(V=1;V<=AW;V++)Z=Z+X[V-1]<<1,Y[V]=Z;for(Q=0;Q<=G;Q++){let J=W[Q*2+1];if(J===0)continue;W[Q*2]=ND(Y[J]++,J)}},wy=()=>{let W,G,X,Y,Z,V=Array(AW+1);X=0;for(Y=0;Y<uA-1;Y++){mA[Y]=X;for(W=0;W<1<<$A[Y];W++)DZ[X++]=Y}DZ[X-1]=Y,Z=0;for(Y=0;Y<16;Y++){lJ[Y]=Z;for(W=0;W<1<<pJ[Y];W++)CZ[Z++]=Y}Z>>=7;for(;Y<iG;Y++){lJ[Y]=Z<<7;for(W=0;W<1<<pJ[Y]-7;W++)CZ[256+Z++]=Y}for(G=0;G<=AW;G++)V[G]=0;W=0;while(W<=143)r7[W*2+1]=8,W++,V[8]++;while(W<=255)r7[W*2+1]=9,W++,V[9]++;while(W<=279)r7[W*2+1]=7,W++,V[7]++;while(W<=287)r7[W*2+1]=8,W++,V[8]++;HD(r7,KZ+1,V);for(W=0;W<iG;W++)wZ[W*2+1]=5,wZ[W*2]=ND(W,5);QD=new wA(r7,$A,BZ+1,KZ,AW),JD=new wA(wZ,pJ,0,iG,AW),UD=new wA([],Hy,0,hA,Ny)},AD=(W)=>{let G;for(G=0;G<KZ;G++)W.dyn_ltree[G*2]=0;for(G=0;G<iG;G++)W.dyn_dtree[G*2]=0;for(G=0;G<hA;G++)W.bl_tree[G*2]=0;W.dyn_ltree[bA*2]=1,W.opt_len=W.static_len=0,W.sym_next=W.matches=0},zD=(W)=>{if(W.bi_valid>8)MZ(W,W.bi_buf);else if(W.bi_valid>0)W.pending_buf[W.pending++]=W.bi_buf;W.bi_buf=0,W.bi_valid=0},jC=(W,G,X,Y)=>{let Z=G*2,V=X*2;return W[Z]<W[V]||W[Z]===W[V]&&Y[G]<=Y[X]},OA=(W,G,X)=>{let Y=W.heap[X],Z=X<<1;while(Z<=W.heap_len){if(Z<W.heap_len&&jC(G,W.heap[Z+1],W.heap[Z],W.depth))Z++;if(jC(G,Y,W.heap[Z],W.depth))break;W.heap[X]=W.heap[Z],X=Z,Z<<=1}W.heap[X]=Y},OC=(W,G,X)=>{let Y,Z,V=0,Q,J;if(W.sym_next!==0)do if(Y=W.pending_buf[W.sym_buf+V++]&255,Y+=(W.pending_buf[W.sym_buf+V++]&255)<<8,Z=W.pending_buf[W.sym_buf+V++],Y===0)J7(W,Z,G);else{if(Q=DZ[Z],J7(W,Q+BZ+1,G),J=$A[Q],J!==0)Z-=mA[Q],g9(W,Z,J);if(Y--,Q=qD(Y),J7(W,Q,X),J=pJ[Q],J!==0)Y-=lJ[Q],g9(W,Y,J)}while(V<W.sym_next);J7(W,bA,G)},FA=(W,G)=>{let X=G.dyn_tree,Y=G.stat_desc.static_tree,Z=G.stat_desc.has_stree,V=G.stat_desc.elems,Q,J,U=-1,q;W.heap_len=0,W.heap_max=GD;for(Q=0;Q<V;Q++)if(X[Q*2]!==0)W.heap[++W.heap_len]=U=Q,W.depth[Q]=0;else X[Q*2+1]=0;while(W.heap_len<2)if(q=W.heap[++W.heap_len]=U<2?++U:0,X[q*2]=1,W.depth[q]=0,W.opt_len--,Z)W.static_len-=Y[q*2+1];G.max_code=U;for(Q=W.heap_len>>1;Q>=1;Q--)OA(W,X,Q);q=V;do Q=W.heap[1],W.heap[1]=W.heap[W.heap_len--],OA(W,X,1),J=W.heap[1],W.heap[--W.heap_max]=Q,W.heap[--W.heap_max]=J,X[q*2]=X[Q*2]+X[J*2],W.depth[q]=(W.depth[Q]>=W.depth[J]?W.depth[Q]:W.depth[J])+1,X[Q*2+1]=X[J*2+1]=q,W.heap[1]=q++,OA(W,X,1);while(W.heap_len>=2);W.heap[--W.heap_max]=W.heap[1],Iy(W,G),HD(X,U,W.bl_count)},KC=(W,G,X)=>{let Y,Z=-1,V,Q=G[1],J=0,U=7,q=4;if(Q===0)U=138,q=3;G[(X+1)*2+1]=65535;for(Y=0;Y<=X;Y++){if(V=Q,Q=G[(Y+1)*2+1],++J<U&&V===Q)continue;else if(J<q)W.bl_tree[V*2]+=J;else if(V!==0){if(V!==Z)W.bl_tree[V*2]++;W.bl_tree[XD*2]++}else if(J<=10)W.bl_tree[YD*2]++;else W.bl_tree[ZD*2]++;if(J=0,Z=V,Q===0)U=138,q=3;else if(V===Q)U=6,q=3;else U=7,q=4}},CC=(W,G,X)=>{let Y,Z=-1,V,Q=G[1],J=0,U=7,q=4;if(Q===0)U=138,q=3;for(Y=0;Y<=X;Y++){if(V=Q,Q=G[(Y+1)*2+1],++J<U&&V===Q)continue;else if(J<q)do J7(W,V,W.bl_tree);while(--J!==0);else if(V!==0){if(V!==Z)J7(W,V,W.bl_tree),J--;J7(W,XD,W.bl_tree),g9(W,J-3,2)}else if(J<=10)J7(W,YD,W.bl_tree),g9(W,J-3,3);else J7(W,ZD,W.bl_tree),g9(W,J-11,7);if(J=0,Z=V,Q===0)U=138,q=3;else if(V===Q)U=6,q=3;else U=7,q=4}},jy=(W)=>{let G;KC(W,W.dyn_ltree,W.l_desc.max_code),KC(W,W.dyn_dtree,W.d_desc.max_code),FA(W,W.bl_desc);for(G=hA-1;G>=3;G--)if(W.bl_tree[VD[G]*2+1]!==0)break;return W.opt_len+=3*(G+1)+5+5+4,G},Oy=(W,G,X,Y)=>{let Z;g9(W,G-257,5),g9(W,X-1,5),g9(W,Y-4,4);for(Z=0;Z<Y;Z++)g9(W,W.bl_tree[VD[Z]*2+1],3);CC(W,W.dyn_ltree,G-1),CC(W,W.dyn_dtree,X-1)},Ky=(W)=>{let G=4093624447,X;for(X=0;X<=31;X++,G>>>=1)if(G&1&&W.dyn_ltree[X*2]!==0)return 0;if(W.dyn_ltree[18]!==0||W.dyn_ltree[20]!==0||W.dyn_ltree[26]!==0)return 1;for(X=32;X<BZ;X++)if(W.dyn_ltree[X*2]!==0)return 1;return 0},DC=!1,Cy=(W)=>{if(!DC)wy(),DC=!0;W.l_desc=new jA(W.dyn_ltree,QD),W.d_desc=new jA(W.dyn_dtree,JD),W.bl_desc=new jA(W.bl_tree,UD),W.bi_buf=0,W.bi_valid=0,AD(W)},ID=(W,G,X,Y)=>{if(g9(W,(Qy<<1)+(Y?1:0),3),zD(W),MZ(W,X),MZ(W,~X),X)W.pending_buf.set(W.window.subarray(G,G+X),W.pending);W.pending+=X},Dy=(W)=>{g9(W,WD<<1,3),J7(W,bA,r7),zy(W)},My=(W,G,X,Y)=>{let Z,V,Q=0;if(W.level>0){if(W.strm.data_type===2)W.strm.data_type=Ky(W);if(FA(W,W.l_desc),FA(W,W.d_desc),Q=jy(W),Z=W.opt_len+3+7>>>3,V=W.static_len+3+7>>>3,V<=Z)Z=V}else Z=V=X+5;if(X+4<=Z&&G!==-1)ID(W,G,X,Y);else if(W.strategy===4||V===Z)g9(W,(WD<<1)+(Y?1:0),3),OC(W,r7,wZ);else g9(W,(Jy<<1)+(Y?1:0),3),Oy(W,W.l_desc.max_code+1,W.d_desc.max_code+1,Q+1),OC(W,W.dyn_ltree,W.dyn_dtree);if(AD(W),Y)zD(W)},Ty=(W,G,X)=>{if(W.pending_buf[W.sym_buf+W.sym_next++]=G,W.pending_buf[W.sym_buf+W.sym_next++]=G>>8,W.pending_buf[W.sym_buf+W.sym_next++]=X,G===0)W.dyn_ltree[X*2]++;else W.matches++,G--,W.dyn_ltree[(DZ[X]+BZ+1)*2]++,W.dyn_dtree[qD(G)*2]++;return W.sym_next===W.sym_end},Py=Cy,Ry=ID,Ly=My,By=Ty,Ey=Dy,$y={_tr_init:Py,_tr_stored_block:Ry,_tr_flush_block:Ly,_tr_tally:By,_tr_align:Ey},Fy=(W,G,X,Y)=>{let Z=W&65535|0,V=W>>>16&65535|0,Q=0;while(X!==0){Q=X>2000?2000:X,X-=Q;do Z=Z+G[Y++]|0,V=V+Z|0;while(--Q);Z%=65521,V%=65521}return Z|V<<16|0},TZ=Fy,Sy=()=>{let W,G=[];for(var X=0;X<256;X++){W=X;for(var Y=0;Y<8;Y++)W=W&1?3988292384^W>>>1:W>>>1;G[X]=W}return G},xy=new Uint32Array(Sy()),ky=(W,G,X,Y)=>{let Z=xy,V=Y+X;W^=-1;for(let Q=Y;Q<V;Q++)W=W>>>8^Z[(W^G[Q])&255];return W^-1},d8=ky,wW={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},KW={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:_y,_tr_stored_block:SA,_tr_flush_block:yy,_tr_tally:V6,_tr_align:vy}=$y,{Z_NO_FLUSH:Q6,Z_PARTIAL_FLUSH:gy,Z_FULL_FLUSH:uy,Z_FINISH:A5,Z_BLOCK:MC,Z_OK:a8,Z_STREAM_END:TC,Z_STREAM_ERROR:U7,Z_DATA_ERROR:hy,Z_BUF_ERROR:KA,Z_DEFAULT_COMPRESSION:by,Z_FILTERED:my,Z_HUFFMAN_ONLY:hJ,Z_RLE:fy,Z_FIXED:cy,Z_DEFAULT_STRATEGY:py,Z_UNKNOWN:ly,Z_DEFLATED:nJ}=KW,dy=9,oy=15,ny=8,iy=29,ry=256,xA=ry+1+iy,ay=30,sy=19,ty=2*xA+1,ey=15,y1=3,Z6=258,q7=Z6+y1+1,Wv=32,rG=42,fA=57,kA=69,_A=73,yA=91,vA=103,zW=113,zZ=666,F9=1,tG=2,jW=3,eG=4,Gv=3,IW=(W,G)=>{return W.msg=wW[G],G},PC=(W)=>{return W*2-(W>4?9:0)},Y6=(W)=>{let G=W.length;while(--G>=0)W[G]=0},Xv=(W)=>{let G,X,Y,Z=W.w_size;G=W.hash_size,Y=G;do X=W.head[--Y],W.head[Y]=X>=Z?X-Z:0;while(--G);G=Z,Y=G;do X=W.prev[--Y],W.prev[Y]=X>=Z?X-Z:0;while(--G)},Yv=(W,G,X)=>(G<<W.hash_shift^X)&W.hash_mask,J6=Yv,s9=(W)=>{let G=W.state,X=G.pending;if(X>W.avail_out)X=W.avail_out;if(X===0)return;if(W.output.set(G.pending_buf.subarray(G.pending_out,G.pending_out+X),W.next_out),W.next_out+=X,G.pending_out+=X,W.total_out+=X,W.avail_out-=X,G.pending-=X,G.pending===0)G.pending_out=0},t9=(W,G)=>{yy(W,W.block_start>=0?W.block_start:-1,W.strstart-W.block_start,G),W.block_start=W.strstart,s9(W.strm)},n1=(W,G)=>{W.pending_buf[W.pending++]=G},AZ=(W,G)=>{W.pending_buf[W.pending++]=G>>>8&255,W.pending_buf[W.pending++]=G&255},gA=(W,G,X,Y)=>{let Z=W.avail_in;if(Z>Y)Z=Y;if(Z===0)return 0;if(W.avail_in-=Z,G.set(W.input.subarray(W.next_in,W.next_in+Z),X),W.state.wrap===1)W.adler=TZ(W.adler,G,Z,X);else if(W.state.wrap===2)W.adler=d8(W.adler,G,Z,X);return W.next_in+=Z,W.total_in+=Z,Z},wD=(W,G)=>{let{max_chain_length:X,strstart:Y}=W,Z,V,Q=W.prev_length,J=W.nice_match,U=W.strstart>W.w_size-q7?W.strstart-(W.w_size-q7):0,q=W.window,N=W.w_mask,A=W.prev,H=W.strstart+Z6,I=q[Y+Q-1],w=q[Y+Q];if(W.prev_length>=W.good_match)X>>=2;if(J>W.lookahead)J=W.lookahead;do{if(Z=G,q[Z+Q]!==w||q[Z+Q-1]!==I||q[Z]!==q[Y]||q[++Z]!==q[Y+1])continue;Y+=2,Z++;do;while(q[++Y]===q[++Z]&&q[++Y]===q[++Z]&&q[++Y]===q[++Z]&&q[++Y]===q[++Z]&&q[++Y]===q[++Z]&&q[++Y]===q[++Z]&&q[++Y]===q[++Z]&&q[++Y]===q[++Z]&&Y<H);if(V=Z6-(H-Y),Y=H-Z6,V>Q){if(W.match_start=G,Q=V,V>=J)break;I=q[Y+Q-1],w=q[Y+Q]}}while((G=A[G&N])>U&&--X!==0);if(Q<=W.lookahead)return Q;return W.lookahead},aG=(W)=>{let G=W.w_size,X,Y,Z;do{if(Y=W.window_size-W.lookahead-W.strstart,W.strstart>=G+(G-q7)){if(W.window.set(W.window.subarray(G,G+G-Y),0),W.match_start-=G,W.strstart-=G,W.block_start-=G,W.insert>W.strstart)W.insert=W.strstart;Xv(W),Y+=G}if(W.strm.avail_in===0)break;if(X=gA(W.strm,W.window,W.strstart+W.lookahead,Y),W.lookahead+=X,W.lookahead+W.insert>=y1){Z=W.strstart-W.insert,W.ins_h=W.window[Z],W.ins_h=J6(W,W.ins_h,W.window[Z+1]);while(W.insert)if(W.ins_h=J6(W,W.ins_h,W.window[Z+y1-1]),W.prev[Z&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=Z,Z++,W.insert--,W.lookahead+W.insert<y1)break}}while(W.lookahead<q7&&W.strm.avail_in!==0)},jD=(W,G)=>{let X=W.pending_buf_size-5>W.w_size?W.w_size:W.pending_buf_size-5,Y,Z,V,Q=0,J=W.strm.avail_in;do{if(Y=65535,V=W.bi_valid+42>>3,W.strm.avail_out<V)break;if(V=W.strm.avail_out-V,Z=W.strstart-W.block_start,Y>Z+W.strm.avail_in)Y=Z+W.strm.avail_in;if(Y>V)Y=V;if(Y<X&&(Y===0&&G!==A5||G===Q6||Y!==Z+W.strm.avail_in))break;if(Q=G===A5&&Y===Z+W.strm.avail_in?1:0,SA(W,0,0,Q),W.pending_buf[W.pending-4]=Y,W.pending_buf[W.pending-3]=Y>>8,W.pending_buf[W.pending-2]=~Y,W.pending_buf[W.pending-1]=~Y>>8,s9(W.strm),Z){if(Z>Y)Z=Y;W.strm.output.set(W.window.subarray(W.block_start,W.block_start+Z),W.strm.next_out),W.strm.next_out+=Z,W.strm.avail_out-=Z,W.strm.total_out+=Z,W.block_start+=Z,Y-=Z}if(Y)gA(W.strm,W.strm.output,W.strm.next_out,Y),W.strm.next_out+=Y,W.strm.avail_out-=Y,W.strm.total_out+=Y}while(Q===0);if(J-=W.strm.avail_in,J){if(J>=W.w_size)W.matches=2,W.window.set(W.strm.input.subarray(W.strm.next_in-W.w_size,W.strm.next_in),0),W.strstart=W.w_size,W.insert=W.strstart;else{if(W.window_size-W.strstart<=J){if(W.strstart-=W.w_size,W.window.set(W.window.subarray(W.w_size,W.w_size+W.strstart),0),W.matches<2)W.matches++;if(W.insert>W.strstart)W.insert=W.strstart}W.window.set(W.strm.input.subarray(W.strm.next_in-J,W.strm.next_in),W.strstart),W.strstart+=J,W.insert+=J>W.w_size-W.insert?W.w_size-W.insert:J}W.block_start=W.strstart}if(W.high_water<W.strstart)W.high_water=W.strstart;if(Q)return eG;if(G!==Q6&&G!==A5&&W.strm.avail_in===0&&W.strstart===W.block_start)return tG;if(V=W.window_size-W.strstart,W.strm.avail_in>V&&W.block_start>=W.w_size){if(W.block_start-=W.w_size,W.strstart-=W.w_size,W.window.set(W.window.subarray(W.w_size,W.w_size+W.strstart),0),W.matches<2)W.matches++;if(V+=W.w_size,W.insert>W.strstart)W.insert=W.strstart}if(V>W.strm.avail_in)V=W.strm.avail_in;if(V)gA(W.strm,W.window,W.strstart,V),W.strstart+=V,W.insert+=V>W.w_size-W.insert?W.w_size-W.insert:V;if(W.high_water<W.strstart)W.high_water=W.strstart;if(V=W.bi_valid+42>>3,V=W.pending_buf_size-V>65535?65535:W.pending_buf_size-V,X=V>W.w_size?W.w_size:V,Z=W.strstart-W.block_start,Z>=X||(Z||G===A5)&&G!==Q6&&W.strm.avail_in===0&&Z<=V)Y=Z>V?V:Z,Q=G===A5&&W.strm.avail_in===0&&Y===Z?1:0,SA(W,W.block_start,Y,Q),W.block_start+=Y,s9(W.strm);return Q?jW:F9},CA=(W,G)=>{let X,Y;for(;;){if(W.lookahead<q7){if(aG(W),W.lookahead<q7&&G===Q6)return F9;if(W.lookahead===0)break}if(X=0,W.lookahead>=y1)W.ins_h=J6(W,W.ins_h,W.window[W.strstart+y1-1]),X=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart;if(X!==0&&W.strstart-X<=W.w_size-q7)W.match_length=wD(W,X);if(W.match_length>=y1)if(Y=V6(W,W.strstart-W.match_start,W.match_length-y1),W.lookahead-=W.match_length,W.match_length<=W.max_lazy_match&&W.lookahead>=y1){W.match_length--;do W.strstart++,W.ins_h=J6(W,W.ins_h,W.window[W.strstart+y1-1]),X=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart;while(--W.match_length!==0);W.strstart++}else W.strstart+=W.match_length,W.match_length=0,W.ins_h=W.window[W.strstart],W.ins_h=J6(W,W.ins_h,W.window[W.strstart+1]);else Y=V6(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++;if(Y){if(t9(W,!1),W.strm.avail_out===0)return F9}}if(W.insert=W.strstart<y1-1?W.strstart:y1-1,G===A5){if(t9(W,!0),W.strm.avail_out===0)return jW;return eG}if(W.sym_next){if(t9(W,!1),W.strm.avail_out===0)return F9}return tG},oG=(W,G)=>{let X,Y,Z;for(;;){if(W.lookahead<q7){if(aG(W),W.lookahead<q7&&G===Q6)return F9;if(W.lookahead===0)break}if(X=0,W.lookahead>=y1)W.ins_h=J6(W,W.ins_h,W.window[W.strstart+y1-1]),X=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart;if(W.prev_length=W.match_length,W.prev_match=W.match_start,W.match_length=y1-1,X!==0&&W.prev_length<W.max_lazy_match&&W.strstart-X<=W.w_size-q7){if(W.match_length=wD(W,X),W.match_length<=5&&(W.strategy===my||W.match_length===y1&&W.strstart-W.match_start>4096))W.match_length=y1-1}if(W.prev_length>=y1&&W.match_length<=W.prev_length){Z=W.strstart+W.lookahead-y1,Y=V6(W,W.strstart-1-W.prev_match,W.prev_length-y1),W.lookahead-=W.prev_length-1,W.prev_length-=2;do if(++W.strstart<=Z)W.ins_h=J6(W,W.ins_h,W.window[W.strstart+y1-1]),X=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart;while(--W.prev_length!==0);if(W.match_available=0,W.match_length=y1-1,W.strstart++,Y){if(t9(W,!1),W.strm.avail_out===0)return F9}}else if(W.match_available){if(Y=V6(W,0,W.window[W.strstart-1]),Y)t9(W,!1);if(W.strstart++,W.lookahead--,W.strm.avail_out===0)return F9}else W.match_available=1,W.strstart++,W.lookahead--}if(W.match_available)Y=V6(W,0,W.window[W.strstart-1]),W.match_available=0;if(W.insert=W.strstart<y1-1?W.strstart:y1-1,G===A5){if(t9(W,!0),W.strm.avail_out===0)return jW;return eG}if(W.sym_next){if(t9(W,!1),W.strm.avail_out===0)return F9}return tG},Zv=(W,G)=>{let X,Y,Z,V,Q=W.window;for(;;){if(W.lookahead<=Z6){if(aG(W),W.lookahead<=Z6&&G===Q6)return F9;if(W.lookahead===0)break}if(W.match_length=0,W.lookahead>=y1&&W.strstart>0){if(Z=W.strstart-1,Y=Q[Z],Y===Q[++Z]&&Y===Q[++Z]&&Y===Q[++Z]){V=W.strstart+Z6;do;while(Y===Q[++Z]&&Y===Q[++Z]&&Y===Q[++Z]&&Y===Q[++Z]&&Y===Q[++Z]&&Y===Q[++Z]&&Y===Q[++Z]&&Y===Q[++Z]&&Z<V);if(W.match_length=Z6-(V-Z),W.match_length>W.lookahead)W.match_length=W.lookahead}}if(W.match_length>=y1)X=V6(W,1,W.match_length-y1),W.lookahead-=W.match_length,W.strstart+=W.match_length,W.match_length=0;else X=V6(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++;if(X){if(t9(W,!1),W.strm.avail_out===0)return F9}}if(W.insert=0,G===A5){if(t9(W,!0),W.strm.avail_out===0)return jW;return eG}if(W.sym_next){if(t9(W,!1),W.strm.avail_out===0)return F9}return tG},Vv=(W,G)=>{let X;for(;;){if(W.lookahead===0){if(aG(W),W.lookahead===0){if(G===Q6)return F9;break}}if(W.match_length=0,X=V6(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++,X){if(t9(W,!1),W.strm.avail_out===0)return F9}}if(W.insert=0,G===A5){if(t9(W,!0),W.strm.avail_out===0)return jW;return eG}if(W.sym_next){if(t9(W,!1),W.strm.avail_out===0)return F9}return tG};function Q7(W,G,X,Y,Z){this.good_length=W,this.max_lazy=G,this.nice_length=X,this.max_chain=Y,this.func=Z}var IZ=[new Q7(0,0,0,0,jD),new Q7(4,4,8,4,CA),new Q7(4,5,16,8,CA),new Q7(4,6,32,32,CA),new Q7(4,4,16,16,oG),new Q7(8,16,32,32,oG),new Q7(8,16,128,128,oG),new Q7(8,32,128,256,oG),new Q7(32,128,258,1024,oG),new Q7(32,258,258,4096,oG)],Qv=(W)=>{W.window_size=2*W.w_size,Y6(W.head),W.max_lazy_match=IZ[W.level].max_lazy,W.good_match=IZ[W.level].good_length,W.nice_match=IZ[W.level].nice_length,W.max_chain_length=IZ[W.level].max_chain,W.strstart=0,W.block_start=0,W.lookahead=0,W.insert=0,W.match_length=W.prev_length=y1-1,W.match_available=0,W.ins_h=0};function Jv(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=nJ,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(ty*2),this.dyn_dtree=new Uint16Array((2*ay+1)*2),this.bl_tree=new Uint16Array((2*sy+1)*2),Y6(this.dyn_ltree),Y6(this.dyn_dtree),Y6(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(ey+1),this.heap=new Uint16Array(2*xA+1),Y6(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*xA+1),Y6(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var EZ=(W)=>{if(!W)return 1;let G=W.state;if(!G||G.strm!==W||G.status!==rG&&G.status!==fA&&G.status!==kA&&G.status!==_A&&G.status!==yA&&G.status!==vA&&G.status!==zW&&G.status!==zZ)return 1;return 0},OD=(W)=>{if(EZ(W))return IW(W,U7);W.total_in=W.total_out=0,W.data_type=ly;let G=W.state;if(G.pending=0,G.pending_out=0,G.wrap<0)G.wrap=-G.wrap;return G.status=G.wrap===2?fA:G.wrap?rG:zW,W.adler=G.wrap===2?0:1,G.last_flush=-2,_y(G),a8},KD=(W)=>{let G=OD(W);if(G===a8)Qv(W.state);return G},Uv=(W,G)=>{if(EZ(W)||W.state.wrap!==2)return U7;return W.state.gzhead=G,a8},CD=(W,G,X,Y,Z,V)=>{if(!W)return U7;let Q=1;if(G===by)G=6;if(Y<0)Q=0,Y=-Y;else if(Y>15)Q=2,Y-=16;if(Z<1||Z>dy||X!==nJ||Y<8||Y>15||G<0||G>9||V<0||V>cy||Y===8&&Q!==1)return IW(W,U7);if(Y===8)Y=9;let J=new Jv;return W.state=J,J.strm=W,J.status=rG,J.wrap=Q,J.gzhead=null,J.w_bits=Y,J.w_size=1<<J.w_bits,J.w_mask=J.w_size-1,J.hash_bits=Z+7,J.hash_size=1<<J.hash_bits,J.hash_mask=J.hash_size-1,J.hash_shift=~~((J.hash_bits+y1-1)/y1),J.window=new Uint8Array(J.w_size*2),J.head=new Uint16Array(J.hash_size),J.prev=new Uint16Array(J.w_size),J.lit_bufsize=1<<Z+6,J.pending_buf_size=J.lit_bufsize*4,J.pending_buf=new Uint8Array(J.pending_buf_size),J.sym_buf=J.lit_bufsize,J.sym_end=(J.lit_bufsize-1)*3,J.level=G,J.strategy=V,J.method=X,KD(W)},qv=(W,G)=>{return CD(W,G,nJ,oy,ny,py)},Nv=(W,G)=>{if(EZ(W)||G>MC||G<0)return W?IW(W,U7):U7;let X=W.state;if(!W.output||W.avail_in!==0&&!W.input||X.status===zZ&&G!==A5)return IW(W,W.avail_out===0?KA:U7);let Y=X.last_flush;if(X.last_flush=G,X.pending!==0){if(s9(W),W.avail_out===0)return X.last_flush=-1,a8}else if(W.avail_in===0&&PC(G)<=PC(Y)&&G!==A5)return IW(W,KA);if(X.status===zZ&&W.avail_in!==0)return IW(W,KA);if(X.status===rG&&X.wrap===0)X.status=zW;if(X.status===rG){let Z=nJ+(X.w_bits-8<<4)<<8,V=-1;if(X.strategy>=hJ||X.level<2)V=0;else if(X.level<6)V=1;else if(X.level===6)V=2;else V=3;if(Z|=V<<6,X.strstart!==0)Z|=Wv;if(Z+=31-Z%31,AZ(X,Z),X.strstart!==0)AZ(X,W.adler>>>16),AZ(X,W.adler&65535);if(W.adler=1,X.status=zW,s9(W),X.pending!==0)return X.last_flush=-1,a8}if(X.status===fA)if(W.adler=0,n1(X,31),n1(X,139),n1(X,8),!X.gzhead){if(n1(X,0),n1(X,0),n1(X,0),n1(X,0),n1(X,0),n1(X,X.level===9?2:X.strategy>=hJ||X.level<2?4:0),n1(X,Gv),X.status=zW,s9(W),X.pending!==0)return X.last_flush=-1,a8}else{if(n1(X,(X.gzhead.text?1:0)+(X.gzhead.hcrc?2:0)+(!X.gzhead.extra?0:4)+(!X.gzhead.name?0:8)+(!X.gzhead.comment?0:16)),n1(X,X.gzhead.time&255),n1(X,X.gzhead.time>>8&255),n1(X,X.gzhead.time>>16&255),n1(X,X.gzhead.time>>24&255),n1(X,X.level===9?2:X.strategy>=hJ||X.level<2?4:0),n1(X,X.gzhead.os&255),X.gzhead.extra&&X.gzhead.extra.length)n1(X,X.gzhead.extra.length&255),n1(X,X.gzhead.extra.length>>8&255);if(X.gzhead.hcrc)W.adler=d8(W.adler,X.pending_buf,X.pending,0);X.gzindex=0,X.status=kA}if(X.status===kA){if(X.gzhead.extra){let Z=X.pending,V=(X.gzhead.extra.length&65535)-X.gzindex;while(X.pending+V>X.pending_buf_size){let J=X.pending_buf_size-X.pending;if(X.pending_buf.set(X.gzhead.extra.subarray(X.gzindex,X.gzindex+J),X.pending),X.pending=X.pending_buf_size,X.gzhead.hcrc&&X.pending>Z)W.adler=d8(W.adler,X.pending_buf,X.pending-Z,Z);if(X.gzindex+=J,s9(W),X.pending!==0)return X.last_flush=-1,a8;Z=0,V-=J}let Q=new Uint8Array(X.gzhead.extra);if(X.pending_buf.set(Q.subarray(X.gzindex,X.gzindex+V),X.pending),X.pending+=V,X.gzhead.hcrc&&X.pending>Z)W.adler=d8(W.adler,X.pending_buf,X.pending-Z,Z);X.gzindex=0}X.status=_A}if(X.status===_A){if(X.gzhead.name){let Z=X.pending,V;do{if(X.pending===X.pending_buf_size){if(X.gzhead.hcrc&&X.pending>Z)W.adler=d8(W.adler,X.pending_buf,X.pending-Z,Z);if(s9(W),X.pending!==0)return X.last_flush=-1,a8;Z=0}if(X.gzindex<X.gzhead.name.length)V=X.gzhead.name.charCodeAt(X.gzindex++)&255;else V=0;n1(X,V)}while(V!==0);if(X.gzhead.hcrc&&X.pending>Z)W.adler=d8(W.adler,X.pending_buf,X.pending-Z,Z);X.gzindex=0}X.status=yA}if(X.status===yA){if(X.gzhead.comment){let Z=X.pending,V;do{if(X.pending===X.pending_buf_size){if(X.gzhead.hcrc&&X.pending>Z)W.adler=d8(W.adler,X.pending_buf,X.pending-Z,Z);if(s9(W),X.pending!==0)return X.last_flush=-1,a8;Z=0}if(X.gzindex<X.gzhead.comment.length)V=X.gzhead.comment.charCodeAt(X.gzindex++)&255;else V=0;n1(X,V)}while(V!==0);if(X.gzhead.hcrc&&X.pending>Z)W.adler=d8(W.adler,X.pending_buf,X.pending-Z,Z)}X.status=vA}if(X.status===vA){if(X.gzhead.hcrc){if(X.pending+2>X.pending_buf_size){if(s9(W),X.pending!==0)return X.last_flush=-1,a8}n1(X,W.adler&255),n1(X,W.adler>>8&255),W.adler=0}if(X.status=zW,s9(W),X.pending!==0)return X.last_flush=-1,a8}if(W.avail_in!==0||X.lookahead!==0||G!==Q6&&X.status!==zZ){let Z=X.level===0?jD(X,G):X.strategy===hJ?Vv(X,G):X.strategy===fy?Zv(X,G):IZ[X.level].func(X,G);if(Z===jW||Z===eG)X.status=zZ;if(Z===F9||Z===jW){if(W.avail_out===0)X.last_flush=-1;return a8}if(Z===tG){if(G===gy)vy(X);else if(G!==MC){if(SA(X,0,0,!1),G===uy){if(Y6(X.head),X.lookahead===0)X.strstart=0,X.block_start=0,X.insert=0}}if(s9(W),W.avail_out===0)return X.last_flush=-1,a8}}if(G!==A5)return a8;if(X.wrap<=0)return TC;if(X.wrap===2)n1(X,W.adler&255),n1(X,W.adler>>8&255),n1(X,W.adler>>16&255),n1(X,W.adler>>24&255),n1(X,W.total_in&255),n1(X,W.total_in>>8&255),n1(X,W.total_in>>16&255),n1(X,W.total_in>>24&255);else AZ(X,W.adler>>>16),AZ(X,W.adler&65535);if(s9(W),X.wrap>0)X.wrap=-X.wrap;return X.pending!==0?a8:TC},Hv=(W)=>{if(EZ(W))return U7;let G=W.state.status;return W.state=null,G===zW?IW(W,hy):a8},Av=(W,G)=>{let X=G.length;if(EZ(W))return U7;let Y=W.state,Z=Y.wrap;if(Z===2||Z===1&&Y.status!==rG||Y.lookahead)return U7;if(Z===1)W.adler=TZ(W.adler,G,X,0);if(Y.wrap=0,X>=Y.w_size){if(Z===0)Y6(Y.head),Y.strstart=0,Y.block_start=0,Y.insert=0;let U=new Uint8Array(Y.w_size);U.set(G.subarray(X-Y.w_size,X),0),G=U,X=Y.w_size}let{avail_in:V,next_in:Q,input:J}=W;W.avail_in=X,W.next_in=0,W.input=G,aG(Y);while(Y.lookahead>=y1){let U=Y.strstart,q=Y.lookahead-(y1-1);do Y.ins_h=J6(Y,Y.ins_h,Y.window[U+y1-1]),Y.prev[U&Y.w_mask]=Y.head[Y.ins_h],Y.head[Y.ins_h]=U,U++;while(--q);Y.strstart=U,Y.lookahead=y1-1,aG(Y)}return Y.strstart+=Y.lookahead,Y.block_start=Y.strstart,Y.insert=Y.lookahead,Y.lookahead=0,Y.match_length=Y.prev_length=y1-1,Y.match_available=0,W.next_in=Q,W.input=J,W.avail_in=V,Y.wrap=Z,a8},zv=qv,Iv=CD,wv=KD,jv=OD,Ov=Uv,Kv=Nv,Cv=Hv,Dv=Av,Mv="pako deflate (from Nodeca project)",jZ={deflateInit:zv,deflateInit2:Iv,deflateReset:wv,deflateResetKeep:jv,deflateSetHeader:Ov,deflate:Kv,deflateEnd:Cv,deflateSetDictionary:Dv,deflateInfo:Mv},Tv=(W,G)=>{return Object.prototype.hasOwnProperty.call(W,G)},Pv=function(W){let G=Array.prototype.slice.call(arguments,1);while(G.length){let X=G.shift();if(!X)continue;if(typeof X!=="object")throw TypeError(X+"must be non-object");for(let Y in X)if(Tv(X,Y))W[Y]=X[Y]}return W},Rv=(W)=>{let G=0;for(let Y=0,Z=W.length;Y<Z;Y++)G+=W[Y].length;let X=new Uint8Array(G);for(let Y=0,Z=0,V=W.length;Y<V;Y++){let Q=W[Y];X.set(Q,Z),Z+=Q.length}return X},iJ={assign:Pv,flattenChunks:Rv},DD=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(W){DD=!1}var PZ=new Uint8Array(256);for(let W=0;W<256;W++)PZ[W]=W>=252?6:W>=248?5:W>=240?4:W>=224?3:W>=192?2:1;PZ[254]=PZ[254]=1;var Lv=(W)=>{if(typeof TextEncoder==="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(W);let G,X,Y,Z,V,Q=W.length,J=0;for(Z=0;Z<Q;Z++){if(X=W.charCodeAt(Z),(X&64512)===55296&&Z+1<Q){if(Y=W.charCodeAt(Z+1),(Y&64512)===56320)X=65536+(X-55296<<10)+(Y-56320),Z++}J+=X<128?1:X<2048?2:X<65536?3:4}G=new Uint8Array(J);for(V=0,Z=0;V<J;Z++){if(X=W.charCodeAt(Z),(X&64512)===55296&&Z+1<Q){if(Y=W.charCodeAt(Z+1),(Y&64512)===56320)X=65536+(X-55296<<10)+(Y-56320),Z++}if(X<128)G[V++]=X;else if(X<2048)G[V++]=192|X>>>6,G[V++]=128|X&63;else if(X<65536)G[V++]=224|X>>>12,G[V++]=128|X>>>6&63,G[V++]=128|X&63;else G[V++]=240|X>>>18,G[V++]=128|X>>>12&63,G[V++]=128|X>>>6&63,G[V++]=128|X&63}return G},Bv=(W,G)=>{if(G<65534){if(W.subarray&&DD)return String.fromCharCode.apply(null,W.length===G?W:W.subarray(0,G))}let X="";for(let Y=0;Y<G;Y++)X+=String.fromCharCode(W[Y]);return X},Ev=(W,G)=>{let X=G||W.length;if(typeof TextDecoder==="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(W.subarray(0,G));let Y,Z,V=Array(X*2);for(Z=0,Y=0;Y<X;){let Q=W[Y++];if(Q<128){V[Z++]=Q;continue}let J=PZ[Q];if(J>4){V[Z++]=65533,Y+=J-1;continue}Q&=J===2?31:J===3?15:7;while(J>1&&Y<X)Q=Q<<6|W[Y++]&63,J--;if(J>1){V[Z++]=65533;continue}if(Q<65536)V[Z++]=Q;else Q-=65536,V[Z++]=55296|Q>>10&1023,V[Z++]=56320|Q&1023}return Bv(V,Z)},$v=(W,G)=>{if(G=G||W.length,G>W.length)G=W.length;let X=G-1;while(X>=0&&(W[X]&192)===128)X--;if(X<0)return G;if(X===0)return G;return X+PZ[W[X]]>G?X:G},RZ={string2buf:Lv,buf2string:Ev,utf8border:$v};function Fv(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var MD=Fv,TD=Object.prototype.toString,{Z_NO_FLUSH:Sv,Z_SYNC_FLUSH:xv,Z_FULL_FLUSH:kv,Z_FINISH:_v,Z_OK:dJ,Z_STREAM_END:yv,Z_DEFAULT_COMPRESSION:vv,Z_DEFAULT_STRATEGY:gv,Z_DEFLATED:uv}=KW;function $Z(W){this.options=iJ.assign({level:vv,method:uv,chunkSize:16384,windowBits:15,memLevel:8,strategy:gv},W||{});let G=this.options;if(G.raw&&G.windowBits>0)G.windowBits=-G.windowBits;else if(G.gzip&&G.windowBits>0&&G.windowBits<16)G.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new MD,this.strm.avail_out=0;let X=jZ.deflateInit2(this.strm,G.level,G.method,G.windowBits,G.memLevel,G.strategy);if(X!==dJ)throw Error(wW[X]);if(G.header)jZ.deflateSetHeader(this.strm,G.header);if(G.dictionary){let Y;if(typeof G.dictionary==="string")Y=RZ.string2buf(G.dictionary);else if(TD.call(G.dictionary)==="[object ArrayBuffer]")Y=new Uint8Array(G.dictionary);else Y=G.dictionary;if(X=jZ.deflateSetDictionary(this.strm,Y),X!==dJ)throw Error(wW[X]);this._dict_set=!0}}$Z.prototype.push=function(W,G){let X=this.strm,Y=this.options.chunkSize,Z,V;if(this.ended)return!1;if(G===~~G)V=G;else V=G===!0?_v:Sv;if(typeof W==="string")X.input=RZ.string2buf(W);else if(TD.call(W)==="[object ArrayBuffer]")X.input=new Uint8Array(W);else X.input=W;X.next_in=0,X.avail_in=X.input.length;for(;;){if(X.avail_out===0)X.output=new Uint8Array(Y),X.next_out=0,X.avail_out=Y;if((V===xv||V===kv)&&X.avail_out<=6){this.onData(X.output.subarray(0,X.next_out)),X.avail_out=0;continue}if(Z=jZ.deflate(X,V),Z===yv){if(X.next_out>0)this.onData(X.output.subarray(0,X.next_out));return Z=jZ.deflateEnd(this.strm),this.onEnd(Z),this.ended=!0,Z===dJ}if(X.avail_out===0){this.onData(X.output);continue}if(V>0&&X.next_out>0){this.onData(X.output.subarray(0,X.next_out)),X.avail_out=0;continue}if(X.avail_in===0)break}return!0};$Z.prototype.onData=function(W){this.chunks.push(W)};$Z.prototype.onEnd=function(W){if(W===dJ)this.result=iJ.flattenChunks(this.chunks);this.chunks=[],this.err=W,this.msg=this.strm.msg};function cA(W,G){let X=new $Z(G);if(X.push(W,!0),X.err)throw X.msg||wW[X.err];return X.result}function hv(W,G){return G=G||{},G.raw=!0,cA(W,G)}function bv(W,G){return G=G||{},G.gzip=!0,cA(W,G)}var mv=$Z,fv=cA,cv=hv,pv=bv,lv=KW,dv={Deflate:mv,deflate:fv,deflateRaw:cv,gzip:pv,constants:lv},bJ=16209,ov=16191,nv=function(G,X){let Y,Z,V,Q,J,U,q,N,A,H,I,w,C,D,x,h,p,u,n,c,l,G0,m,Y0,U0=G.state;Y=G.next_in,m=G.input,Z=Y+(G.avail_in-5),V=G.next_out,Y0=G.output,Q=V-(X-G.avail_out),J=V+(G.avail_out-257),U=U0.dmax,q=U0.wsize,N=U0.whave,A=U0.wnext,H=U0.window,I=U0.hold,w=U0.bits,C=U0.lencode,D=U0.distcode,x=(1<<U0.lenbits)-1,h=(1<<U0.distbits)-1;W:do{if(w<15)I+=m[Y++]<<w,w+=8,I+=m[Y++]<<w,w+=8;p=C[I&x];G:for(;;){if(u=p>>>24,I>>>=u,w-=u,u=p>>>16&255,u===0)Y0[V++]=p&65535;else if(u&16){if(n=p&65535,u&=15,u){if(w<u)I+=m[Y++]<<w,w+=8;n+=I&(1<<u)-1,I>>>=u,w-=u}if(w<15)I+=m[Y++]<<w,w+=8,I+=m[Y++]<<w,w+=8;p=D[I&h];X:for(;;){if(u=p>>>24,I>>>=u,w-=u,u=p>>>16&255,u&16){if(c=p&65535,u&=15,w<u){if(I+=m[Y++]<<w,w+=8,w<u)I+=m[Y++]<<w,w+=8}if(c+=I&(1<<u)-1,c>U){G.msg="invalid distance too far back",U0.mode=bJ;break W}if(I>>>=u,w-=u,u=V-Q,c>u){if(u=c-u,u>N){if(U0.sane){G.msg="invalid distance too far back",U0.mode=bJ;break W}}if(l=0,G0=H,A===0){if(l+=q-u,u<n){n-=u;do Y0[V++]=H[l++];while(--u);l=V-c,G0=Y0}}else if(A<u){if(l+=q+A-u,u-=A,u<n){n-=u;do Y0[V++]=H[l++];while(--u);if(l=0,A<n){u=A,n-=u;do Y0[V++]=H[l++];while(--u);l=V-c,G0=Y0}}}else if(l+=A-u,u<n){n-=u;do Y0[V++]=H[l++];while(--u);l=V-c,G0=Y0}while(n>2)Y0[V++]=G0[l++],Y0[V++]=G0[l++],Y0[V++]=G0[l++],n-=3;if(n){if(Y0[V++]=G0[l++],n>1)Y0[V++]=G0[l++]}}else{l=V-c;do Y0[V++]=Y0[l++],Y0[V++]=Y0[l++],Y0[V++]=Y0[l++],n-=3;while(n>2);if(n){if(Y0[V++]=Y0[l++],n>1)Y0[V++]=Y0[l++]}}}else if((u&64)===0){p=D[(p&65535)+(I&(1<<u)-1)];continue X}else{G.msg="invalid distance code",U0.mode=bJ;break W}break}}else if((u&64)===0){p=C[(p&65535)+(I&(1<<u)-1)];continue G}else if(u&32){U0.mode=ov;break W}else{G.msg="invalid literal/length code",U0.mode=bJ;break W}break}}while(Y<Z&&V<J);n=w>>3,Y-=n,w-=n<<3,I&=(1<<w)-1,G.next_in=Y,G.next_out=V,G.avail_in=Y<Z?5+(Z-Y):5-(Y-Z),G.avail_out=V<J?257+(J-V):257-(V-J),U0.hold=I,U0.bits=w;return},nG=15,RC=852,LC=592,BC=0,DA=1,EC=2,iv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),av=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),sv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),tv=(W,G,X,Y,Z,V,Q,J)=>{let U=J.bits,q=0,N=0,A=0,H=0,I=0,w=0,C=0,D=0,x=0,h=0,p,u,n,c,l,G0=null,m,Y0=new Uint16Array(nG+1),U0=new Uint16Array(nG+1),y=null,o,B,R;for(q=0;q<=nG;q++)Y0[q]=0;for(N=0;N<Y;N++)Y0[G[X+N]]++;I=U;for(H=nG;H>=1;H--)if(Y0[H]!==0)break;if(I>H)I=H;if(H===0)return Z[V++]=20971520,Z[V++]=20971520,J.bits=1,0;for(A=1;A<H;A++)if(Y0[A]!==0)break;if(I<A)I=A;D=1;for(q=1;q<=nG;q++)if(D<<=1,D-=Y0[q],D<0)return-1;if(D>0&&(W===BC||H!==1))return-1;U0[1]=0;for(q=1;q<nG;q++)U0[q+1]=U0[q]+Y0[q];for(N=0;N<Y;N++)if(G[X+N]!==0)Q[U0[G[X+N]]++]=N;if(W===BC)G0=y=Q,m=20;else if(W===DA)G0=iv,y=rv,m=257;else G0=av,y=sv,m=0;if(h=0,N=0,q=A,l=V,w=I,C=0,n=-1,x=1<<I,c=x-1,W===DA&&x>RC||W===EC&&x>LC)return 1;for(;;){if(o=q-C,Q[N]+1<m)B=0,R=Q[N];else if(Q[N]>=m)B=y[Q[N]-m],R=G0[Q[N]-m];else B=96,R=0;p=1<<q-C,u=1<<w,A=u;do u-=p,Z[l+(h>>C)+u]=o<<24|B<<16|R|0;while(u!==0);p=1<<q-1;while(h&p)p>>=1;if(p!==0)h&=p-1,h+=p;else h=0;if(N++,--Y0[q]===0){if(q===H)break;q=G[X+Q[N]]}if(q>I&&(h&c)!==n){if(C===0)C=I;l+=A,w=q-C,D=1<<w;while(w+C<H){if(D-=Y0[w+C],D<=0)break;w++,D<<=1}if(x+=1<<w,W===DA&&x>RC||W===EC&&x>LC)return 1;n=h&c,Z[n]=I<<24|w<<16|l-V|0}}if(h!==0)Z[l+h]=q-C<<24|4194304|0;return J.bits=I,0},OZ=tv,ev=0,PD=1,RD=2,{Z_FINISH:$C,Z_BLOCK:Wg,Z_TREES:mJ,Z_OK:OW,Z_STREAM_END:Gg,Z_NEED_DICT:Xg,Z_STREAM_ERROR:z5,Z_DATA_ERROR:LD,Z_MEM_ERROR:BD,Z_BUF_ERROR:Yg,Z_DEFLATED:FC}=KW,rJ=16180,SC=16181,xC=16182,kC=16183,_C=16184,yC=16185,vC=16186,gC=16187,uC=16188,hC=16189,oJ=16190,i7=16191,MA=16192,bC=16193,TA=16194,mC=16195,fC=16196,cC=16197,pC=16198,fJ=16199,cJ=16200,lC=16201,dC=16202,oC=16203,nC=16204,iC=16205,PA=16206,rC=16207,aC=16208,N8=16209,ED=16210,$D=16211,Zg=852,Vg=592,Qg=15,Jg=Qg,sC=(W)=>{return(W>>>24&255)+(W>>>8&65280)+((W&65280)<<8)+((W&255)<<24)};function Ug(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var CW=(W)=>{if(!W)return 1;let G=W.state;if(!G||G.strm!==W||G.mode<rJ||G.mode>$D)return 1;return 0},FD=(W)=>{if(CW(W))return z5;let G=W.state;if(W.total_in=W.total_out=G.total=0,W.msg="",G.wrap)W.adler=G.wrap&1;return G.mode=rJ,G.last=0,G.havedict=0,G.flags=-1,G.dmax=32768,G.head=null,G.hold=0,G.bits=0,G.lencode=G.lendyn=new Int32Array(Zg),G.distcode=G.distdyn=new Int32Array(Vg),G.sane=1,G.back=-1,OW},SD=(W)=>{if(CW(W))return z5;let G=W.state;return G.wsize=0,G.whave=0,G.wnext=0,FD(W)},xD=(W,G)=>{let X;if(CW(W))return z5;let Y=W.state;if(G<0)X=0,G=-G;else if(X=(G>>4)+5,G<48)G&=15;if(G&&(G<8||G>15))return z5;if(Y.window!==null&&Y.wbits!==G)Y.window=null;return Y.wrap=X,Y.wbits=G,SD(W)},kD=(W,G)=>{if(!W)return z5;let X=new Ug;W.state=X,X.strm=W,X.window=null,X.mode=rJ;let Y=xD(W,G);if(Y!==OW)W.state=null;return Y},qg=(W)=>{return kD(W,Jg)},tC=!0,RA,LA,Ng=(W)=>{if(tC){RA=new Int32Array(512),LA=new Int32Array(32);let G=0;while(G<144)W.lens[G++]=8;while(G<256)W.lens[G++]=9;while(G<280)W.lens[G++]=7;while(G<288)W.lens[G++]=8;OZ(PD,W.lens,0,288,RA,0,W.work,{bits:9}),G=0;while(G<32)W.lens[G++]=5;OZ(RD,W.lens,0,32,LA,0,W.work,{bits:5}),tC=!1}W.lencode=RA,W.lenbits=9,W.distcode=LA,W.distbits=5},_D=(W,G,X,Y)=>{let Z,V=W.state;if(V.window===null)V.wsize=1<<V.wbits,V.wnext=0,V.whave=0,V.window=new Uint8Array(V.wsize);if(Y>=V.wsize)V.window.set(G.subarray(X-V.wsize,X),0),V.wnext=0,V.whave=V.wsize;else{if(Z=V.wsize-V.wnext,Z>Y)Z=Y;if(V.window.set(G.subarray(X-Y,X-Y+Z),V.wnext),Y-=Z,Y)V.window.set(G.subarray(X-Y,X),0),V.wnext=Y,V.whave=V.wsize;else{if(V.wnext+=Z,V.wnext===V.wsize)V.wnext=0;if(V.whave<V.wsize)V.whave+=Z}}return 0},Hg=(W,G)=>{let X,Y,Z,V,Q,J,U,q,N,A,H,I,w,C,D=0,x,h,p,u,n,c,l,G0,m=new Uint8Array(4),Y0,U0,y=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(CW(W)||!W.output||!W.input&&W.avail_in!==0)return z5;if(X=W.state,X.mode===i7)X.mode=MA;Q=W.next_out,Z=W.output,U=W.avail_out,V=W.next_in,Y=W.input,J=W.avail_in,q=X.hold,N=X.bits,A=J,H=U,G0=OW;W:for(;;)switch(X.mode){case rJ:if(X.wrap===0){X.mode=MA;break}while(N<16){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(X.wrap&2&&q===35615){if(X.wbits===0)X.wbits=15;X.check=0,m[0]=q&255,m[1]=q>>>8&255,X.check=d8(X.check,m,2,0),q=0,N=0,X.mode=SC;break}if(X.head)X.head.done=!1;if(!(X.wrap&1)||(((q&255)<<8)+(q>>8))%31){W.msg="incorrect header check",X.mode=N8;break}if((q&15)!==FC){W.msg="unknown compression method",X.mode=N8;break}if(q>>>=4,N-=4,l=(q&15)+8,X.wbits===0)X.wbits=l;if(l>15||l>X.wbits){W.msg="invalid window size",X.mode=N8;break}X.dmax=1<<X.wbits,X.flags=0,W.adler=X.check=1,X.mode=q&512?hC:i7,q=0,N=0;break;case SC:while(N<16){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(X.flags=q,(X.flags&255)!==FC){W.msg="unknown compression method",X.mode=N8;break}if(X.flags&57344){W.msg="unknown header flags set",X.mode=N8;break}if(X.head)X.head.text=q>>8&1;if(X.flags&512&&X.wrap&4)m[0]=q&255,m[1]=q>>>8&255,X.check=d8(X.check,m,2,0);q=0,N=0,X.mode=xC;case xC:while(N<32){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(X.head)X.head.time=q;if(X.flags&512&&X.wrap&4)m[0]=q&255,m[1]=q>>>8&255,m[2]=q>>>16&255,m[3]=q>>>24&255,X.check=d8(X.check,m,4,0);q=0,N=0,X.mode=kC;case kC:while(N<16){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(X.head)X.head.xflags=q&255,X.head.os=q>>8;if(X.flags&512&&X.wrap&4)m[0]=q&255,m[1]=q>>>8&255,X.check=d8(X.check,m,2,0);q=0,N=0,X.mode=_C;case _C:if(X.flags&1024){while(N<16){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(X.length=q,X.head)X.head.extra_len=q;if(X.flags&512&&X.wrap&4)m[0]=q&255,m[1]=q>>>8&255,X.check=d8(X.check,m,2,0);q=0,N=0}else if(X.head)X.head.extra=null;X.mode=yC;case yC:if(X.flags&1024){if(I=X.length,I>J)I=J;if(I){if(X.head){if(l=X.head.extra_len-X.length,!X.head.extra)X.head.extra=new Uint8Array(X.head.extra_len);X.head.extra.set(Y.subarray(V,V+I),l)}if(X.flags&512&&X.wrap&4)X.check=d8(X.check,Y,I,V);J-=I,V+=I,X.length-=I}if(X.length)break W}X.length=0,X.mode=vC;case vC:if(X.flags&2048){if(J===0)break W;I=0;do if(l=Y[V+I++],X.head&&l&&X.length<65536)X.head.name+=String.fromCharCode(l);while(l&&I<J);if(X.flags&512&&X.wrap&4)X.check=d8(X.check,Y,I,V);if(J-=I,V+=I,l)break W}else if(X.head)X.head.name=null;X.length=0,X.mode=gC;case gC:if(X.flags&4096){if(J===0)break W;I=0;do if(l=Y[V+I++],X.head&&l&&X.length<65536)X.head.comment+=String.fromCharCode(l);while(l&&I<J);if(X.flags&512&&X.wrap&4)X.check=d8(X.check,Y,I,V);if(J-=I,V+=I,l)break W}else if(X.head)X.head.comment=null;X.mode=uC;case uC:if(X.flags&512){while(N<16){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(X.wrap&4&&q!==(X.check&65535)){W.msg="header crc mismatch",X.mode=N8;break}q=0,N=0}if(X.head)X.head.hcrc=X.flags>>9&1,X.head.done=!0;W.adler=X.check=0,X.mode=i7;break;case hC:while(N<32){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}W.adler=X.check=sC(q),q=0,N=0,X.mode=oJ;case oJ:if(X.havedict===0)return W.next_out=Q,W.avail_out=U,W.next_in=V,W.avail_in=J,X.hold=q,X.bits=N,Xg;W.adler=X.check=1,X.mode=i7;case i7:if(G===Wg||G===mJ)break W;case MA:if(X.last){q>>>=N&7,N-=N&7,X.mode=PA;break}while(N<3){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}switch(X.last=q&1,q>>>=1,N-=1,q&3){case 0:X.mode=bC;break;case 1:if(Ng(X),X.mode=fJ,G===mJ){q>>>=2,N-=2;break W}break;case 2:X.mode=fC;break;case 3:W.msg="invalid block type",X.mode=N8}q>>>=2,N-=2;break;case bC:q>>>=N&7,N-=N&7;while(N<32){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if((q&65535)!==(q>>>16^65535)){W.msg="invalid stored block lengths",X.mode=N8;break}if(X.length=q&65535,q=0,N=0,X.mode=TA,G===mJ)break W;case TA:X.mode=mC;case mC:if(I=X.length,I){if(I>J)I=J;if(I>U)I=U;if(I===0)break W;Z.set(Y.subarray(V,V+I),Q),J-=I,V+=I,U-=I,Q+=I,X.length-=I;break}X.mode=i7;break;case fC:while(N<14){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(X.nlen=(q&31)+257,q>>>=5,N-=5,X.ndist=(q&31)+1,q>>>=5,N-=5,X.ncode=(q&15)+4,q>>>=4,N-=4,X.nlen>286||X.ndist>30){W.msg="too many length or distance symbols",X.mode=N8;break}X.have=0,X.mode=cC;case cC:while(X.have<X.ncode){while(N<3){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}X.lens[y[X.have++]]=q&7,q>>>=3,N-=3}while(X.have<19)X.lens[y[X.have++]]=0;if(X.lencode=X.lendyn,X.lenbits=7,Y0={bits:X.lenbits},G0=OZ(ev,X.lens,0,19,X.lencode,0,X.work,Y0),X.lenbits=Y0.bits,G0){W.msg="invalid code lengths set",X.mode=N8;break}X.have=0,X.mode=pC;case pC:while(X.have<X.nlen+X.ndist){for(;;){if(D=X.lencode[q&(1<<X.lenbits)-1],x=D>>>24,h=D>>>16&255,p=D&65535,x<=N)break;if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(p<16)q>>>=x,N-=x,X.lens[X.have++]=p;else{if(p===16){U0=x+2;while(N<U0){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(q>>>=x,N-=x,X.have===0){W.msg="invalid bit length repeat",X.mode=N8;break}l=X.lens[X.have-1],I=3+(q&3),q>>>=2,N-=2}else if(p===17){U0=x+3;while(N<U0){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}q>>>=x,N-=x,l=0,I=3+(q&7),q>>>=3,N-=3}else{U0=x+7;while(N<U0){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}q>>>=x,N-=x,l=0,I=11+(q&127),q>>>=7,N-=7}if(X.have+I>X.nlen+X.ndist){W.msg="invalid bit length repeat",X.mode=N8;break}while(I--)X.lens[X.have++]=l}}if(X.mode===N8)break;if(X.lens[256]===0){W.msg="invalid code -- missing end-of-block",X.mode=N8;break}if(X.lenbits=9,Y0={bits:X.lenbits},G0=OZ(PD,X.lens,0,X.nlen,X.lencode,0,X.work,Y0),X.lenbits=Y0.bits,G0){W.msg="invalid literal/lengths set",X.mode=N8;break}if(X.distbits=6,X.distcode=X.distdyn,Y0={bits:X.distbits},G0=OZ(RD,X.lens,X.nlen,X.ndist,X.distcode,0,X.work,Y0),X.distbits=Y0.bits,G0){W.msg="invalid distances set",X.mode=N8;break}if(X.mode=fJ,G===mJ)break W;case fJ:X.mode=cJ;case cJ:if(J>=6&&U>=258){if(W.next_out=Q,W.avail_out=U,W.next_in=V,W.avail_in=J,X.hold=q,X.bits=N,nv(W,H),Q=W.next_out,Z=W.output,U=W.avail_out,V=W.next_in,Y=W.input,J=W.avail_in,q=X.hold,N=X.bits,X.mode===i7)X.back=-1;break}X.back=0;for(;;){if(D=X.lencode[q&(1<<X.lenbits)-1],x=D>>>24,h=D>>>16&255,p=D&65535,x<=N)break;if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(h&&(h&240)===0){u=x,n=h,c=p;for(;;){if(D=X.lencode[c+((q&(1<<u+n)-1)>>u)],x=D>>>24,h=D>>>16&255,p=D&65535,u+x<=N)break;if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}q>>>=u,N-=u,X.back+=u}if(q>>>=x,N-=x,X.back+=x,X.length=p,h===0){X.mode=iC;break}if(h&32){X.back=-1,X.mode=i7;break}if(h&64){W.msg="invalid literal/length code",X.mode=N8;break}X.extra=h&15,X.mode=lC;case lC:if(X.extra){U0=X.extra;while(N<U0){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}X.length+=q&(1<<X.extra)-1,q>>>=X.extra,N-=X.extra,X.back+=X.extra}X.was=X.length,X.mode=dC;case dC:for(;;){if(D=X.distcode[q&(1<<X.distbits)-1],x=D>>>24,h=D>>>16&255,p=D&65535,x<=N)break;if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if((h&240)===0){u=x,n=h,c=p;for(;;){if(D=X.distcode[c+((q&(1<<u+n)-1)>>u)],x=D>>>24,h=D>>>16&255,p=D&65535,u+x<=N)break;if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}q>>>=u,N-=u,X.back+=u}if(q>>>=x,N-=x,X.back+=x,h&64){W.msg="invalid distance code",X.mode=N8;break}X.offset=p,X.extra=h&15,X.mode=oC;case oC:if(X.extra){U0=X.extra;while(N<U0){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}X.offset+=q&(1<<X.extra)-1,q>>>=X.extra,N-=X.extra,X.back+=X.extra}if(X.offset>X.dmax){W.msg="invalid distance too far back",X.mode=N8;break}X.mode=nC;case nC:if(U===0)break W;if(I=H-U,X.offset>I){if(I=X.offset-I,I>X.whave){if(X.sane){W.msg="invalid distance too far back",X.mode=N8;break}}if(I>X.wnext)I-=X.wnext,w=X.wsize-I;else w=X.wnext-I;if(I>X.length)I=X.length;C=X.window}else C=Z,w=Q-X.offset,I=X.length;if(I>U)I=U;U-=I,X.length-=I;do Z[Q++]=C[w++];while(--I);if(X.length===0)X.mode=cJ;break;case iC:if(U===0)break W;Z[Q++]=X.length,U--,X.mode=cJ;break;case PA:if(X.wrap){while(N<32){if(J===0)break W;J--,q|=Y[V++]<<N,N+=8}if(H-=U,W.total_out+=H,X.total+=H,X.wrap&4&&H)W.adler=X.check=X.flags?d8(X.check,Z,H,Q-H):TZ(X.check,Z,H,Q-H);if(H=U,X.wrap&4&&(X.flags?q:sC(q))!==X.check){W.msg="incorrect data check",X.mode=N8;break}q=0,N=0}X.mode=rC;case rC:if(X.wrap&&X.flags){while(N<32){if(J===0)break W;J--,q+=Y[V++]<<N,N+=8}if(X.wrap&4&&q!==(X.total&4294967295)){W.msg="incorrect length check",X.mode=N8;break}q=0,N=0}X.mode=aC;case aC:G0=Gg;break W;case N8:G0=LD;break W;case ED:return BD;case $D:default:return z5}if(W.next_out=Q,W.avail_out=U,W.next_in=V,W.avail_in=J,X.hold=q,X.bits=N,X.wsize||H!==W.avail_out&&X.mode<N8&&(X.mode<PA||G!==$C)){if(_D(W,W.output,W.next_out,H-W.avail_out));}if(A-=W.avail_in,H-=W.avail_out,W.total_in+=A,W.total_out+=H,X.total+=H,X.wrap&4&&H)W.adler=X.check=X.flags?d8(X.check,Z,H,W.next_out-H):TZ(X.check,Z,H,W.next_out-H);if(W.data_type=X.bits+(X.last?64:0)+(X.mode===i7?128:0)+(X.mode===fJ||X.mode===TA?256:0),(A===0&&H===0||G===$C)&&G0===OW)G0=Yg;return G0},Ag=(W)=>{if(CW(W))return z5;let G=W.state;if(G.window)G.window=null;return W.state=null,OW},zg=(W,G)=>{if(CW(W))return z5;let X=W.state;if((X.wrap&2)===0)return z5;return X.head=G,G.done=!1,OW},Ig=(W,G)=>{let X=G.length,Y,Z,V;if(CW(W))return z5;if(Y=W.state,Y.wrap!==0&&Y.mode!==oJ)return z5;if(Y.mode===oJ){if(Z=1,Z=TZ(Z,G,X,0),Z!==Y.check)return LD}if(V=_D(W,G,X,X),V)return Y.mode=ED,BD;return Y.havedict=1,OW},wg=SD,jg=xD,Og=FD,Kg=qg,Cg=kD,Dg=Hg,Mg=Ag,Tg=zg,Pg=Ig,Rg="pako inflate (from Nodeca project)",a7={inflateReset:wg,inflateReset2:jg,inflateResetKeep:Og,inflateInit:Kg,inflateInit2:Cg,inflate:Dg,inflateEnd:Mg,inflateGetHeader:Tg,inflateSetDictionary:Pg,inflateInfo:Rg};function Lg(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Bg=Lg,yD=Object.prototype.toString,{Z_NO_FLUSH:Eg,Z_FINISH:$g,Z_OK:LZ,Z_STREAM_END:BA,Z_NEED_DICT:EA,Z_STREAM_ERROR:Fg,Z_DATA_ERROR:eC,Z_MEM_ERROR:Sg}=KW;function FZ(W){this.options=iJ.assign({chunkSize:65536,windowBits:15,to:""},W||{});let G=this.options;if(G.raw&&G.windowBits>=0&&G.windowBits<16){if(G.windowBits=-G.windowBits,G.windowBits===0)G.windowBits=-15}if(G.windowBits>=0&&G.windowBits<16&&!(W&&W.windowBits))G.windowBits+=32;if(G.windowBits>15&&G.windowBits<48){if((G.windowBits&15)===0)G.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new MD,this.strm.avail_out=0;let X=a7.inflateInit2(this.strm,G.windowBits);if(X!==LZ)throw Error(wW[X]);if(this.header=new Bg,a7.inflateGetHeader(this.strm,this.header),G.dictionary){if(typeof G.dictionary==="string")G.dictionary=RZ.string2buf(G.dictionary);else if(yD.call(G.dictionary)==="[object ArrayBuffer]")G.dictionary=new Uint8Array(G.dictionary);if(G.raw){if(X=a7.inflateSetDictionary(this.strm,G.dictionary),X!==LZ)throw Error(wW[X])}}}FZ.prototype.push=function(W,G){let X=this.strm,Y=this.options.chunkSize,Z=this.options.dictionary,V,Q,J;if(this.ended)return!1;if(G===~~G)Q=G;else Q=G===!0?$g:Eg;if(yD.call(W)==="[object ArrayBuffer]")X.input=new Uint8Array(W);else X.input=W;X.next_in=0,X.avail_in=X.input.length;for(;;){if(X.avail_out===0)X.output=new Uint8Array(Y),X.next_out=0,X.avail_out=Y;if(V=a7.inflate(X,Q),V===EA&&Z){if(V=a7.inflateSetDictionary(X,Z),V===LZ)V=a7.inflate(X,Q);else if(V===eC)V=EA}while(X.avail_in>0&&V===BA&&X.state.wrap>0&&W[X.next_in]!==0)a7.inflateReset(X),V=a7.inflate(X,Q);switch(V){case Fg:case eC:case EA:case Sg:return this.onEnd(V),this.ended=!0,!1}if(J=X.avail_out,X.next_out){if(X.avail_out===0||V===BA)if(this.options.to==="string"){let U=RZ.utf8border(X.output,X.next_out),q=X.next_out-U,N=RZ.buf2string(X.output,U);if(X.next_out=q,X.avail_out=Y-q,q)X.output.set(X.output.subarray(U,U+q),0);this.onData(N)}else this.onData(X.output.length===X.next_out?X.output:X.output.subarray(0,X.next_out))}if(V===LZ&&J===0)continue;if(V===BA)return V=a7.inflateEnd(this.strm),this.onEnd(V),this.ended=!0,!0;if(X.avail_in===0)break}return!0};FZ.prototype.onData=function(W){this.chunks.push(W)};FZ.prototype.onEnd=function(W){if(W===LZ)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=iJ.flattenChunks(this.chunks);this.chunks=[],this.err=W,this.msg=this.strm.msg};function pA(W,G){let X=new FZ(G);if(X.push(W),X.err)throw X.msg||wW[X.err];return X.result}function xg(W,G){return G=G||{},G.raw=!0,pA(W,G)}var kg=FZ,_g=pA,yg=xg,vg=pA,gg=KW,ug={Inflate:kg,inflate:_g,inflateRaw:yg,ungzip:vg,constants:gg},{Deflate:hg,deflate:bg,deflateRaw:mg,gzip:fg}=dv,{Inflate:cg,inflate:pg,inflateRaw:lg,ungzip:dg}=ug,og=hg,ng=bg,ig=mg,rg=fg,ag=cg,sg=pg,tg=lg,eg=dg,Wu=KW,DW={Deflate:og,deflate:ng,deflateRaw:ig,gzip:rg,Inflate:ag,inflate:sg,inflateRaw:tg,ungzip:eg,constants:Wu};function vD(){let W=Date.now(),G=0;return{now(){return W=Math.max(W,Date.now()),G++,{physical:W,logical:G}},update(X){if(!X||typeof X.physical!=="number"||typeof X.logical!=="number")return;W=Math.max(W,X.physical),G=Math.max(G,X.logical)+1},compare(X,Y){if(!X&&!Y)return 0;if(!X)return-1;if(!Y)return 1;if(X.physical!==Y.physical)return X.physical>Y.physical?1:-1;if(X.logical!==Y.logical)return X.logical>Y.logical?1:-1;return 0}}}function gD(W,G,X){let Y=G.timestamp;if(Y?.physical>Date.now()+7200000)Y={physical:Date.now()+7200000,logical:Y.logical};if(G?.value?.priority===!0&&typeof G.id==="string"&&G.id.startsWith("user:")&&"role"in G.value){let{priority:Z,...V}=G.value;return{resolved:!0,value:V,timestamp:Y}}if(G?.value?.priority!==void 0){let{priority:Z,...V}=G.value;G={...G,value:V}}if(!W?.timestamp)return{resolved:!0,value:G.value,timestamp:Y};if(X.compare(Y,W.timestamp)<=0)return{resolved:!1};return{resolved:!0,value:G.value,timestamp:Y}}var SZ={$eq:(W,G)=>W===G,$ne:(W,G)=>W!==G,$gt:(W,G)=>W>G,$gte:(W,G)=>W>=G,$lt:(W,G)=>W<G,$lte:(W,G)=>W<=G,$in:(W,G)=>Array.isArray(G)&&(Array.isArray(W)?W.some((X)=>G.includes(X)):G.includes(W)),$between:(W,[G,X])=>W>=G&&W<=X,$exists:(W,G)=>G?W!==void 0:W===void 0,$startsWith:(W,G)=>typeof W==="string"&&W.startsWith(G),$endsWith:(W,G)=>typeof W==="string"&&W.endsWith(G),$contains:(W,G)=>typeof W==="string"&&W.includes(G),$text:{global:(W,G)=>{let X=(Z)=>String(Z).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^\w\s]/g,""),Y=X(G);return Object.values(W).some((Z)=>typeof Z==="object"?null.fieldSearch(Z,Y):X(Z).includes(Y))},field:(W,G)=>{let X=(Z)=>String(Z).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^\w\s]/g,""),Y=X(G);return Array.isArray(W)?W.some((Z)=>X(Z).includes(Y)):X(W).includes(Y)}},$like:(W,G)=>typeof W==="string"&&typeof G==="string"&&new RegExp(`^${G.replace(/%/g,".*").replace(/_/g,".")}$`,"i").test(W),$regex:(W,G)=>typeof W==="string"&&new RegExp(G.$regex||G,"i").test(W),$and:(W,G,X)=>G.every((Y)=>X.createFilter(Y,X.allNodes)(W)),$or:(W,G,X)=>G.some((Y)=>X.createFilter(Y,X.allNodes)(W)),$not:(W,G,X)=>!X.createFilter(G,X.allNodes)(W),$edge:(W,G,X)=>{if(!W.edges?.length||typeof G!=="object"||G===null)return!1;let Y=X.createFilter(G,X.allNodes),Z=[...W.edges],V=new Set(Z).add(W.id),Q=[];while(Z.length){let J=Z.shift(),U=X.allNodes[J];if(!U)continue;if(Y(U))Q.push(U);U.edges?.forEach((q)=>!V.has(q)&&V.add(q)&&Z.push(q))}if(Q.length)W._edgeResult=Q;return Q.length>0}},aJ=(W,G)=>G.split(".").reduce((X,Y)=>X&&typeof X==="object"&&(Y in X)?X[Y]:void 0,W),sJ=(W,G)=>{if(Object.keys(W).length===0)return()=>!0;return(X)=>Object.entries(W).every(([Y,Z])=>{if(Y.startsWith("$"))return SZ[Y](X,Z,{createFilter:sJ,allNodes:G});let V=aJ(X.value,Y);if(V===void 0)V=aJ(X,Y);if(typeof Z!=="object"||Z===null)return SZ.$eq(V,Z);return Object.entries(Z).every(([Q,J])=>{if(Q==="$text")return SZ.$text.field(V,J);if(Q==="$between"&&J.every((U)=>U instanceof Date))return SZ.$between(new Date(V),J);return SZ[Q]?.(V,J,{createFilter:sJ,allNodes:G})??!1})})},lA=(W,G)=>{let{$edge:X,...Y}=G.query||{},Z=sJ(Y,W),V=Object.values(W).filter(Z),J=[...X?(()=>{let U=sJ({$edge:X},W);V.forEach((N)=>U(N));let q=new Map;return V.forEach((N)=>{if(N._edgeResult)N._edgeResult.forEach((A)=>q.set(A.id,A)),delete N._edgeResult}),Array.from(q.values())})():V];if(G.field){let U=G.order==="asc"?1:-1;J.sort((q,N)=>{let A=aJ(q.value,G.field),H=aJ(N.value,G.field);if(typeof A==="string"&&typeof H==="string")return A.localeCompare(H)*U;return((A??0)-(H??0))*U})}if(G.$after){let U=J.findIndex((q)=>q.id===G.$after);J=U>=0?J.slice(U+1):[]}if(G.$before){let U=J.findIndex((q)=>q.id===G.$before);J=U>=0?J.slice(0,U):[]}if(G.$limit)J=J.slice(0,G.$limit);return J};var dA=(()=>{let W=()=>{};return new Proxy(console,{get:(G,X)=>globalThis.__gdbDebug?G[X].bind(G):W})})(),WX=typeof globalThis==="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function MU(W){return W instanceof Uint8Array||ArrayBuffer.isView(W)&&W.constructor.name==="Uint8Array"}function Xz(W){if(!Number.isSafeInteger(W)||W<0)throw Error("positive integer expected, got "+W)}function BW(W,...G){if(!MU(W))throw Error("Uint8Array expected");if(G.length>0&&!G.includes(W.length))throw Error("Uint8Array expected of length "+G+", got length="+W.length)}function XM(W){if(typeof W!=="function"||typeof W.create!=="function")throw Error("Hash should be wrapped by utils.createHasher");Xz(W.outputLen),Xz(W.blockLen)}function NU(W,G=!0){if(W.destroyed)throw Error("Hash instance has been destroyed");if(G&&W.finished)throw Error("Hash#digest() has already been called")}function Gu(W,G){BW(W);let X=G.outputLen;if(W.length<X)throw Error("digestInto() expects output buffer of length at least "+X)}function HU(...W){for(let G=0;G<W.length;G++)W[G].fill(0)}function oA(W){return new DataView(W.buffer,W.byteOffset,W.byteLength)}function N7(W,G){return W<<32-G|W>>>G}var YM=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),Xu=Array.from({length:256},(W,G)=>G.toString(16).padStart(2,"0"));function YX(W){if(BW(W),YM)return W.toHex();let G="";for(let X=0;X<W.length;X++)G+=Xu[W[X]];return G}var s7={_0:48,_9:57,A:65,F:70,a:97,f:102};function uD(W){if(W>=s7._0&&W<=s7._9)return W-s7._0;if(W>=s7.A&&W<=s7.F)return W-(s7.A-10);if(W>=s7.a&&W<=s7.f)return W-(s7.a-10);return}function AU(W){if(typeof W!=="string")throw Error("hex string expected, got "+typeof W);if(YM)return Uint8Array.fromHex(W);let G=W.length,X=G/2;if(G%2)throw Error("hex string expected, got unpadded hex of length "+G);let Y=new Uint8Array(X);for(let Z=0,V=0;Z<X;Z++,V+=2){let Q=uD(W.charCodeAt(V)),J=uD(W.charCodeAt(V+1));if(Q===void 0||J===void 0){let U=W[V]+W[V+1];throw Error('hex string expected, got non-hex character "'+U+'" at index '+V)}Y[Z]=Q*16+J}return Y}function ZM(W){if(typeof W!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(W))}function Hz(W){if(typeof W==="string")W=ZM(W);return BW(W),W}function H7(...W){let G=0;for(let Y=0;Y<W.length;Y++){let Z=W[Y];BW(Z),G+=Z.length}let X=new Uint8Array(G);for(let Y=0,Z=0;Y<W.length;Y++){let V=W[Y];X.set(V,Z),Z+=V.length}return X}class Az{}function Yu(W){let G=(Y)=>W().update(Hz(Y)).digest(),X=W();return G.outputLen=X.outputLen,G.blockLen=X.blockLen,G.create=()=>W(),G}function TU(W=32){if(WX&&typeof WX.getRandomValues==="function")return WX.getRandomValues(new Uint8Array(W));if(WX&&typeof WX.randomBytes==="function")return Uint8Array.from(WX.randomBytes(W));throw Error("crypto.getRandomValues must be defined")}function Zu(W,G,X,Y){if(typeof W.setBigUint64==="function")return W.setBigUint64(G,X,Y);let Z=BigInt(32),V=BigInt(4294967295),Q=Number(X>>Z&V),J=Number(X&V),U=Y?4:0,q=Y?0:4;W.setUint32(G+U,Q,Y),W.setUint32(G+q,J,Y)}function Vu(W,G,X){return W&G^~W&X}function Qu(W,G,X){return W&G^W&X^G&X}class VM extends Az{constructor(W,G,X,Y){super();this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=W,this.outputLen=G,this.padOffset=X,this.isLE=Y,this.buffer=new Uint8Array(W),this.view=oA(this.buffer)}update(W){NU(this),W=Hz(W),BW(W);let{view:G,buffer:X,blockLen:Y}=this,Z=W.length;for(let V=0;V<Z;){let Q=Math.min(Y-this.pos,Z-V);if(Q===Y){let J=oA(W);for(;Y<=Z-V;V+=Y)this.process(J,V);continue}if(X.set(W.subarray(V,V+Q),this.pos),this.pos+=Q,V+=Q,this.pos===Y)this.process(G,0),this.pos=0}return this.length+=W.length,this.roundClean(),this}digestInto(W){NU(this),Gu(W,this),this.finished=!0;let{buffer:G,view:X,blockLen:Y,isLE:Z}=this,{pos:V}=this;if(G[V++]=128,HU(this.buffer.subarray(V)),this.padOffset>Y-V)this.process(X,0),V=0;for(let N=V;N<Y;N++)G[N]=0;Zu(X,Y-8,BigInt(this.length*8),Z),this.process(X,0);let Q=oA(W),J=this.outputLen;if(J%4)throw Error("_sha2: outputLen should be aligned to 32bit");let U=J/4,q=this.get();if(U>q.length)throw Error("_sha2: outputLen bigger than state");for(let N=0;N<U;N++)Q.setUint32(4*N,q[N],Z)}digest(){let{buffer:W,outputLen:G}=this;this.digestInto(W);let X=W.slice(0,G);return this.destroy(),X}_cloneInto(W){W||(W=new this.constructor),W.set(...this.get());let{blockLen:G,buffer:X,length:Y,finished:Z,destroyed:V,pos:Q}=this;if(W.destroyed=V,W.finished=Z,W.length=Y,W.pos=Q,Y%G)W.buffer.set(X);return W}clone(){return this._cloneInto()}}var U6=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ju=Uint32Array.from([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]),q6=new Uint32Array(64);class QM extends VM{constructor(W=32){super(64,W,8,!1);this.A=U6[0]|0,this.B=U6[1]|0,this.C=U6[2]|0,this.D=U6[3]|0,this.E=U6[4]|0,this.F=U6[5]|0,this.G=U6[6]|0,this.H=U6[7]|0}get(){let{A:W,B:G,C:X,D:Y,E:Z,F:V,G:Q,H:J}=this;return[W,G,X,Y,Z,V,Q,J]}set(W,G,X,Y,Z,V,Q,J){this.A=W|0,this.B=G|0,this.C=X|0,this.D=Y|0,this.E=Z|0,this.F=V|0,this.G=Q|0,this.H=J|0}process(W,G){for(let N=0;N<16;N++,G+=4)q6[N]=W.getUint32(G,!1);for(let N=16;N<64;N++){let A=q6[N-15],H=q6[N-2],I=N7(A,7)^N7(A,18)^A>>>3,w=N7(H,17)^N7(H,19)^H>>>10;q6[N]=w+q6[N-7]+I+q6[N-16]|0}let{A:X,B:Y,C:Z,D:V,E:Q,F:J,G:U,H:q}=this;for(let N=0;N<64;N++){let A=N7(Q,6)^N7(Q,11)^N7(Q,25),H=q+A+Vu(Q,J,U)+Ju[N]+q6[N]|0,I=(N7(X,2)^N7(X,13)^N7(X,22))+Qu(X,Y,Z)|0;q=U,U=J,J=Q,Q=V+H|0,V=Z,Z=Y,Y=X,X=H+I|0}X=X+this.A|0,Y=Y+this.B|0,Z=Z+this.C|0,V=V+this.D|0,Q=Q+this.E|0,J=J+this.F|0,U=U+this.G|0,q=q+this.H|0,this.set(X,Y,Z,V,Q,J,U,q)}roundClean(){HU(q6)}destroy(){this.set(0,0,0,0,0,0,0,0),HU(this.buffer)}}var Yz=Yu(()=>new QM);class zz extends Az{constructor(W,G){super();this.finished=!1,this.destroyed=!1,XM(W);let X=Hz(G);if(this.iHash=W.create(),typeof this.iHash.update!=="function")throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let Y=this.blockLen,Z=new Uint8Array(Y);Z.set(X.length>Y?W.create().update(X).digest():X);for(let V=0;V<Z.length;V++)Z[V]^=54;this.iHash.update(Z),this.oHash=W.create();for(let V=0;V<Z.length;V++)Z[V]^=106;this.oHash.update(Z),HU(Z)}update(W){return NU(this),this.iHash.update(W),this}digestInto(W){NU(this),BW(W,this.outputLen),this.finished=!0,this.iHash.digestInto(W),this.oHash.update(W),this.oHash.digestInto(W),this.destroy()}digest(){let W=new Uint8Array(this.oHash.outputLen);return this.digestInto(W),W}_cloneInto(W){W||(W=Object.create(Object.getPrototypeOf(this),{}));let{oHash:G,iHash:X,finished:Y,destroyed:Z,blockLen:V,outputLen:Q}=this;return W=W,W.finished=Y,W.destroyed=Z,W.blockLen=V,W.outputLen=Q,W.oHash=G._cloneInto(W.oHash),W.iHash=X._cloneInto(W.iHash),W}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var JM=(W,G,X)=>new zz(W,G).update(X).digest();JM.create=(W,G)=>new zz(W,G);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var Iz=BigInt(0),Zz=BigInt(1);function zU(W,G=""){if(typeof W!=="boolean"){let X=G&&`"${G}"`;throw Error(X+"expected boolean, got type="+typeof W)}return W}function MW(W,G,X=""){let Y=MU(W),Z=W?.length,V=G!==void 0;if(!Y||V&&Z!==G){let Q=X&&`"${X}" `,J=V?` of length ${G}`:"",U=Y?`length=${Z}`:`type=${typeof W}`;throw Error(Q+"expected Uint8Array"+J+", got "+U)}return W}function tJ(W){let G=W.toString(16);return G.length&1?"0"+G:G}function UM(W){if(typeof W!=="string")throw Error("hex string expected, got "+typeof W);return W===""?Iz:BigInt("0x"+W)}function UX(W){return UM(YX(W))}function qM(W){return BW(W),UM(YX(Uint8Array.from(W).reverse()))}function PU(W,G){return AU(W.toString(16).padStart(G*2,"0"))}function NM(W,G){return PU(W,G).reverse()}function u8(W,G,X){let Y;if(typeof G==="string")try{Y=AU(G)}catch(V){throw Error(W+" must be hex string or Uint8Array, cause: "+V)}else if(MU(G))Y=Uint8Array.from(G);else throw Error(W+" must be hex string or Uint8Array");let Z=Y.length;if(typeof X==="number"&&Z!==X)throw Error(W+" of length "+X+" expected, got "+Z);return Y}var nA=(W)=>typeof W==="bigint"&&Iz<=W;function Vz(W,G,X){return nA(W)&&nA(G)&&nA(X)&&G<=W&&W<X}function Uu(W,G,X,Y){if(!Vz(G,X,Y))throw Error("expected valid "+W+": "+X+" <= n < "+Y+", got "+G)}function HM(W){let G;for(G=0;W>Iz;W>>=Zz,G+=1);return G}var uZ=(W)=>(Zz<<BigInt(W))-Zz;function qu(W,G,X){if(typeof W!=="number"||W<2)throw Error("hashLen must be a number");if(typeof G!=="number"||G<2)throw Error("qByteLen must be a number");if(typeof X!=="function")throw Error("hmacFn must be a function");let Y=(H)=>new Uint8Array(H),Z=(H)=>Uint8Array.of(H),V=Y(W),Q=Y(W),J=0,U=()=>{V.fill(1),Q.fill(0),J=0},q=(...H)=>X(Q,V,...H),N=(H=Y(0))=>{if(Q=q(Z(0),H),V=q(),H.length===0)return;Q=q(Z(1),H),V=q()},A=()=>{if(J++>=1000)throw Error("drbg: tried 1000 values");let H=0,I=[];while(H<G){V=q();let w=V.slice();I.push(w),H+=V.length}return H7(...I)};return(H,I)=>{U(),N(H);let w=void 0;while(!(w=I(A())))N();return U(),w}}function wz(W,G,X={}){if(!W||typeof W!=="object")throw Error("expected valid options object");function Y(Z,V,Q){let J=W[Z];if(Q&&J===void 0)return;let U=typeof J;if(U!==V||J===null)throw Error(`param "${Z}" is invalid: expected ${V}, got ${U}`)}Object.entries(G).forEach(([Z,V])=>Y(Z,V,!1)),Object.entries(X).forEach(([Z,V])=>Y(Z,V,!0))}function hD(W){let G=new WeakMap;return(X,...Y)=>{let Z=G.get(X);if(Z!==void 0)return Z;let V=W(X,...Y);return G.set(X,V),V}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var S9=BigInt(0),H9=BigInt(1),TW=BigInt(2),AM=BigInt(3),zM=BigInt(4),IM=BigInt(5),Nu=BigInt(7),wM=BigInt(8),Hu=BigInt(9),jM=BigInt(16);function w5(W,G){let X=W%G;return X>=S9?X:G+X}function I5(W,G,X){let Y=W;while(G-- >S9)Y*=Y,Y%=X;return Y}function bD(W,G){if(W===S9)throw Error("invert: expected non-zero number");if(G<=S9)throw Error("invert: expected positive modulus, got "+G);let X=w5(W,G),Y=G,Z=S9,V=H9,Q=H9,J=S9;while(X!==S9){let U=Y/X,q=Y%X,N=Z-Q*U,A=V-J*U;Y=X,X=q,Z=Q,V=J,Q=N,J=A}if(Y!==H9)throw Error("invert: does not exist");return w5(Z,G)}function jz(W,G,X){if(!W.eql(W.sqr(G),X))throw Error("Cannot find square root")}function OM(W,G){let X=(W.ORDER+H9)/zM,Y=W.pow(G,X);return jz(W,Y,G),Y}function Au(W,G){let X=(W.ORDER-IM)/wM,Y=W.mul(G,TW),Z=W.pow(Y,X),V=W.mul(G,Z),Q=W.mul(W.mul(V,TW),Z),J=W.mul(V,W.sub(Q,W.ONE));return jz(W,J,G),J}function zu(W){let G=hZ(W),X=KM(W),Y=X(G,G.neg(G.ONE)),Z=X(G,Y),V=X(G,G.neg(Y)),Q=(W+Nu)/jM;return(J,U)=>{let q=J.pow(U,Q),N=J.mul(q,Y),A=J.mul(q,Z),H=J.mul(q,V),I=J.eql(J.sqr(N),U),w=J.eql(J.sqr(A),U);q=J.cmov(q,N,I),N=J.cmov(H,A,w);let C=J.eql(J.sqr(N),U),D=J.cmov(q,N,C);return jz(J,D,U),D}}function KM(W){if(W<AM)throw Error("sqrt is not defined for small field");let G=W-H9,X=0;while(G%TW===S9)G/=TW,X++;let Y=TW,Z=hZ(W);while(mD(Z,Y)===1)if(Y++>1000)throw Error("Cannot find square root: probably non-prime P");if(X===1)return OM;let V=Z.pow(Y,G),Q=(G+H9)/TW;return function(J,U){if(J.is0(U))return U;if(mD(J,U)!==1)throw Error("Cannot find square root");let q=X,N=J.mul(J.ONE,V),A=J.pow(U,G),H=J.pow(U,Q);while(!J.eql(A,J.ONE)){if(J.is0(A))return J.ZERO;let I=1,w=J.sqr(A);while(!J.eql(w,J.ONE))if(I++,w=J.sqr(w),I===q)throw Error("Cannot find square root");let C=H9<<BigInt(q-I-1),D=J.pow(N,C);q=I,N=J.sqr(D),A=J.mul(A,N),H=J.mul(H,D)}return H}}function Iu(W){if(W%zM===AM)return OM;if(W%wM===IM)return Au;if(W%jM===Hu)return zu(W);return KM(W)}var wu=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function ju(W){let G={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},X=wu.reduce((Y,Z)=>{return Y[Z]="function",Y},G);return wz(W,X),W}function Ou(W,G,X){if(X<S9)throw Error("invalid exponent, negatives unsupported");if(X===S9)return W.ONE;if(X===H9)return G;let Y=W.ONE,Z=G;while(X>S9){if(X&H9)Y=W.mul(Y,Z);Z=W.sqr(Z),X>>=H9}return Y}function CM(W,G,X=!1){let Y=Array(G.length).fill(X?W.ZERO:void 0),Z=G.reduce((Q,J,U)=>{if(W.is0(J))return Q;return Y[U]=Q,W.mul(Q,J)},W.ONE),V=W.inv(Z);return G.reduceRight((Q,J,U)=>{if(W.is0(J))return Q;return Y[U]=W.mul(Q,Y[U]),W.mul(Q,J)},V),Y}function mD(W,G){let X=(W.ORDER-H9)/TW,Y=W.pow(G,X),Z=W.eql(Y,W.ONE),V=W.eql(Y,W.ZERO),Q=W.eql(Y,W.neg(W.ONE));if(!Z&&!V&&!Q)throw Error("invalid Legendre symbol result");return Z?1:V?0:-1}function DM(W,G){if(G!==void 0)Xz(G);let X=G!==void 0?G:W.toString(2).length,Y=Math.ceil(X/8);return{nBitLength:X,nByteLength:Y}}function hZ(W,G,X=!1,Y={}){if(W<=S9)throw Error("invalid field: expected ORDER > 0, got "+W);let Z=void 0,V=void 0,Q=!1,J=void 0;if(typeof G==="object"&&G!=null){if(Y.sqrt||X)throw Error("cannot specify opts in two arguments");let H=G;if(H.BITS)Z=H.BITS;if(H.sqrt)V=H.sqrt;if(typeof H.isLE==="boolean")X=H.isLE;if(typeof H.modFromBytes==="boolean")Q=H.modFromBytes;J=H.allowedLengths}else{if(typeof G==="number")Z=G;if(Y.sqrt)V=Y.sqrt}let{nBitLength:U,nByteLength:q}=DM(W,Z);if(q>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let N,A=Object.freeze({ORDER:W,isLE:X,BITS:U,BYTES:q,MASK:uZ(U),ZERO:S9,ONE:H9,allowedLengths:J,create:(H)=>w5(H,W),isValid:(H)=>{if(typeof H!=="bigint")throw Error("invalid field element: expected bigint, got "+typeof H);return S9<=H&&H<W},is0:(H)=>H===S9,isValidNot0:(H)=>!A.is0(H)&&A.isValid(H),isOdd:(H)=>(H&H9)===H9,neg:(H)=>w5(-H,W),eql:(H,I)=>H===I,sqr:(H)=>w5(H*H,W),add:(H,I)=>w5(H+I,W),sub:(H,I)=>w5(H-I,W),mul:(H,I)=>w5(H*I,W),pow:(H,I)=>Ou(A,H,I),div:(H,I)=>w5(H*bD(I,W),W),sqrN:(H)=>H*H,addN:(H,I)=>H+I,subN:(H,I)=>H-I,mulN:(H,I)=>H*I,inv:(H)=>bD(H,W),sqrt:V||((H)=>{if(!N)N=Iu(W);return N(A,H)}),toBytes:(H)=>X?NM(H,q):PU(H,q),fromBytes:(H,I=!0)=>{if(J){if(!J.includes(H.length)||H.length>q)throw Error("Field.fromBytes: expected "+J+" bytes, got "+H.length);let C=new Uint8Array(q);C.set(H,X?0:C.length-H.length),H=C}if(H.length!==q)throw Error("Field.fromBytes: expected "+q+" bytes, got "+H.length);let w=X?qM(H):UX(H);if(Q)w=w5(w,W);if(!I){if(!A.isValid(w))throw Error("invalid field element: outside of range 0..ORDER")}return w},invertBatch:(H)=>CM(A,H),cmov:(H,I,w)=>w?I:H});return Object.freeze(A)}function MM(W){if(typeof W!=="bigint")throw Error("field order must be bigint");let G=W.toString(2).length;return Math.ceil(G/8)}function TM(W){let G=MM(W);return G+Math.ceil(G/2)}function PM(W,G,X=!1){let Y=W.length,Z=MM(G),V=TM(G);if(Y<16||Y<V||Y>1024)throw Error("expected "+V+"-1024 bytes of input, got "+Y);let Q=X?qM(W):UX(W),J=w5(Q,G-H9)+H9;return X?NM(J,Z):PU(J,Z)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var QX=BigInt(0),PW=BigInt(1);function IU(W,G){let X=G.negate();return W?X:G}function iA(W,G){let X=CM(W.Fp,G.map((Y)=>Y.Z));return G.map((Y,Z)=>W.fromAffine(Y.toAffine(X[Z])))}function RM(W,G){if(!Number.isSafeInteger(W)||W<=0||W>G)throw Error("invalid window size, expected [1.."+G+"], got W="+W)}function rA(W,G){RM(W,G);let X=Math.ceil(G/W)+1,Y=2**(W-1),Z=2**W,V=uZ(W),Q=BigInt(W);return{windows:X,windowSize:Y,mask:V,maxNumber:Z,shiftBy:Q}}function fD(W,G,X){let{windowSize:Y,mask:Z,maxNumber:V,shiftBy:Q}=X,J=Number(W&Z),U=W>>Q;if(J>Y)J-=V,U+=PW;let q=G*Y,N=q+Math.abs(J)-1,A=J===0,H=J<0,I=G%2!==0;return{nextN:U,offset:N,isZero:A,isNeg:H,isNegF:I,offsetF:q}}function Ku(W,G){if(!Array.isArray(W))throw Error("array expected");W.forEach((X,Y)=>{if(!(X instanceof G))throw Error("invalid point at index "+Y)})}function Cu(W,G){if(!Array.isArray(W))throw Error("array of scalars expected");W.forEach((X,Y)=>{if(!G.isValid(X))throw Error("invalid scalar at index "+Y)})}var aA=new WeakMap,LM=new WeakMap;function sA(W){return LM.get(W)||1}function cD(W){if(W!==QX)throw Error("invalid wNAF")}class BM{constructor(W,G){this.BASE=W.BASE,this.ZERO=W.ZERO,this.Fn=W.Fn,this.bits=G}_unsafeLadder(W,G,X=this.ZERO){let Y=W;while(G>QX){if(G&PW)X=X.add(Y);Y=Y.double(),G>>=PW}return X}precomputeWindow(W,G){let{windows:X,windowSize:Y}=rA(G,this.bits),Z=[],V=W,Q=V;for(let J=0;J<X;J++){Q=V,Z.push(Q);for(let U=1;U<Y;U++)Q=Q.add(V),Z.push(Q);V=Q.double()}return Z}wNAF(W,G,X){if(!this.Fn.isValid(X))throw Error("invalid scalar");let Y=this.ZERO,Z=this.BASE,V=rA(W,this.bits);for(let Q=0;Q<V.windows;Q++){let{nextN:J,offset:U,isZero:q,isNeg:N,isNegF:A,offsetF:H}=fD(X,Q,V);if(X=J,q)Z=Z.add(IU(A,G[H]));else Y=Y.add(IU(N,G[U]))}return cD(X),{p:Y,f:Z}}wNAFUnsafe(W,G,X,Y=this.ZERO){let Z=rA(W,this.bits);for(let V=0;V<Z.windows;V++){if(X===QX)break;let{nextN:Q,offset:J,isZero:U,isNeg:q}=fD(X,V,Z);if(X=Q,U)continue;else{let N=G[J];Y=Y.add(q?N.negate():N)}}return cD(X),Y}getPrecomputes(W,G,X){let Y=aA.get(G);if(!Y){if(Y=this.precomputeWindow(G,W),W!==1){if(typeof X==="function")Y=X(Y);aA.set(G,Y)}}return Y}cached(W,G,X){let Y=sA(W);return this.wNAF(Y,this.getPrecomputes(Y,W,X),G)}unsafe(W,G,X,Y){let Z=sA(W);if(Z===1)return this._unsafeLadder(W,G,Y);return this.wNAFUnsafe(Z,this.getPrecomputes(Z,W,X),G,Y)}createCache(W,G){RM(G,this.bits),LM.set(W,G),aA.delete(W)}hasCache(W){return sA(W)!==1}}function Du(W,G,X,Y){let Z=G,V=W.ZERO,Q=W.ZERO;while(X>QX||Y>QX){if(X&PW)V=V.add(Z);if(Y&PW)Q=Q.add(Z);Z=Z.double(),X>>=PW,Y>>=PW}return{p1:V,p2:Q}}function Mu(W,G,X,Y){Ku(X,W),Cu(Y,G);let Z=X.length,V=Y.length;if(Z!==V)throw Error("arrays of points and scalars must have equal length");let Q=W.ZERO,J=HM(BigInt(Z)),U=1;if(J>12)U=J-3;else if(J>4)U=J-2;else if(J>0)U=2;let q=uZ(U),N=Array(Number(q)+1).fill(Q),A=Math.floor((G.BITS-1)/U)*U,H=Q;for(let I=A;I>=0;I-=U){N.fill(Q);for(let C=0;C<V;C++){let D=Y[C],x=Number(D>>BigInt(I)&q);N[x]=N[x].add(X[C])}let w=Q;for(let C=N.length-1,D=Q;C>0;C--)D=D.add(N[C]),w=w.add(D);if(H=H.add(w),I!==0)for(let C=0;C<U;C++)H=H.double()}return H}function pD(W,G,X){if(G){if(G.ORDER!==W)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return ju(G),G}else return hZ(W,{isLE:X})}function Tu(W,G,X={},Y){if(Y===void 0)Y=W==="edwards";if(!G||typeof G!=="object")throw Error(`expected valid ${W} CURVE object`);for(let J of["p","n","h"]){let U=G[J];if(!(typeof U==="bigint"&&U>QX))throw Error(`CURVE.${J} must be positive bigint`)}let Z=pD(G.p,X.Fp,Y),V=pD(G.n,X.Fn,Y),Q=["Gx","Gy","a",W==="weierstrass"?"b":"d"];for(let J of Q)if(!Z.isValid(G[J]))throw Error(`CURVE.${J} must be valid field element of CURVE.Fp`);return G=Object.freeze(Object.assign({},G)),{CURVE:G,Fp:Z,Fn:V}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var lD=(W,G)=>(W+(W>=0?G:-G)/$M)/G;function Pu(W,G,X){let[[Y,Z],[V,Q]]=G,J=lD(Q*W,X),U=lD(-Z*W,X),q=W-J*Y-U*V,N=-J*Z-U*Q,A=q<W4,H=N<W4;if(A)q=-q;if(H)N=-N;let I=uZ(Math.ceil(HM(X)/2))+ZX;if(q<W4||q>=I||N<W4||N>=I)throw Error("splitScalar (endomorphism): failed, k="+W);return{k1neg:A,k1:q,k2neg:H,k2:N}}function Qz(W){if(!["compact","recovered","der"].includes(W))throw Error('Signature format must be "compact", "recovered", or "der"');return W}function tA(W,G){let X={};for(let Y of Object.keys(G))X[Y]=W[Y]===void 0?G[Y]:W[Y];if(zU(X.lowS,"lowS"),zU(X.prehash,"prehash"),X.format!==void 0)Qz(X.format);return X}class EM extends Error{constructor(W=""){super(W)}}var e7={Err:EM,_tlv:{encode:(W,G)=>{let{Err:X}=e7;if(W<0||W>256)throw new X("tlv.encode: wrong tag");if(G.length&1)throw new X("tlv.encode: unpadded data");let Y=G.length/2,Z=tJ(Y);if(Z.length/2&128)throw new X("tlv.encode: long form length too big");let V=Y>127?tJ(Z.length/2|128):"";return tJ(W)+V+Z+G},decode(W,G){let{Err:X}=e7,Y=0;if(W<0||W>256)throw new X("tlv.encode: wrong tag");if(G.length<2||G[Y++]!==W)throw new X("tlv.decode: wrong tlv");let Z=G[Y++],V=!!(Z&128),Q=0;if(!V)Q=Z;else{let U=Z&127;if(!U)throw new X("tlv.decode(long): indefinite length not supported");if(U>4)throw new X("tlv.decode(long): byte length is too big");let q=G.subarray(Y,Y+U);if(q.length!==U)throw new X("tlv.decode: length bytes not complete");if(q[0]===0)throw new X("tlv.decode(long): zero leftmost byte");for(let N of q)Q=Q<<8|N;if(Y+=U,Q<128)throw new X("tlv.decode(long): not minimal encoding")}let J=G.subarray(Y,Y+Q);if(J.length!==Q)throw new X("tlv.decode: wrong value length");return{v:J,l:G.subarray(Y+Q)}}},_int:{encode(W){let{Err:G}=e7;if(W<W4)throw new G("integer: negative integers are not allowed");let X=tJ(W);if(Number.parseInt(X[0],16)&8)X="00"+X;if(X.length&1)throw new G("unexpected DER parsing assertion: unpadded hex");return X},decode(W){let{Err:G}=e7;if(W[0]&128)throw new G("invalid signature integer: negative");if(W[0]===0&&!(W[1]&128))throw new G("invalid signature integer: unnecessary leading zero");return UX(W)}},toSig(W){let{Err:G,_int:X,_tlv:Y}=e7,Z=u8("signature",W),{v:V,l:Q}=Y.decode(48,Z);if(Q.length)throw new G("invalid signature: left bytes after parsing");let{v:J,l:U}=Y.decode(2,V),{v:q,l:N}=Y.decode(2,U);if(N.length)throw new G("invalid signature: left bytes after parsing");return{r:X.decode(J),s:X.decode(q)}},hexFromSig(W){let{_tlv:G,_int:X}=e7,Y=G.encode(2,X.encode(W.r)),Z=G.encode(2,X.encode(W.s)),V=Y+Z;return G.encode(48,V)}},W4=BigInt(0),ZX=BigInt(1),$M=BigInt(2),eJ=BigInt(3),Ru=BigInt(4);function RW(W,G){let{BYTES:X}=W,Y;if(typeof G==="bigint")Y=G;else{let Z=u8("private key",G);try{Y=W.fromBytes(Z)}catch(V){throw Error(`invalid private key: expected ui8a of size ${X}, got ${typeof G}`)}}if(!W.isValidNot0(Y))throw Error("invalid private key: out of range [1..N-1]");return Y}function Lu(W,G={}){let X=Tu("weierstrass",W,G),{Fp:Y,Fn:Z}=X,V=X.CURVE,{h:Q,n:J}=V;wz(G,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});let{endo:U}=G;if(U){if(!Y.is0(V.a)||typeof U.beta!=="bigint"||!Array.isArray(U.basises))throw Error('invalid endo: expected "beta": bigint and "basises": array')}let q=SM(Y,Z);function N(){if(!Y.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}function A(y,o,B){let{x:R,y:_}=o.toAffine(),S=Y.toBytes(R);if(zU(B,"isCompressed"),B){N();let v=!Y.isOdd(_);return H7(FM(v),S)}else return H7(Uint8Array.of(4),S,Y.toBytes(_))}function H(y){MW(y,void 0,"Point");let{publicKey:o,publicKeyUncompressed:B}=q,R=y.length,_=y[0],S=y.subarray(1);if(R===o&&(_===2||_===3)){let v=Y.fromBytes(S);if(!Y.isValid(v))throw Error("bad point: is not on curve, wrong x");let P=C(v),E;try{E=Y.sqrt(P)}catch(k){let f=k instanceof Error?": "+k.message:"";throw Error("bad point: is not on curve, sqrt error"+f)}N();let b=Y.isOdd(E);if((_&1)===1!==b)E=Y.neg(E);return{x:v,y:E}}else if(R===B&&_===4){let v=Y.BYTES,P=Y.fromBytes(S.subarray(0,v)),E=Y.fromBytes(S.subarray(v,v*2));if(!D(P,E))throw Error("bad point: is not on curve");return{x:P,y:E}}else throw Error(`bad point: got length ${R}, expected compressed=${o} or uncompressed=${B}`)}let I=G.toBytes||A,w=G.fromBytes||H;function C(y){let o=Y.sqr(y),B=Y.mul(o,y);return Y.add(Y.add(B,Y.mul(y,V.a)),V.b)}function D(y,o){let B=Y.sqr(o),R=C(y);return Y.eql(B,R)}if(!D(V.Gx,V.Gy))throw Error("bad curve params: generator point");let x=Y.mul(Y.pow(V.a,eJ),Ru),h=Y.mul(Y.sqr(V.b),BigInt(27));if(Y.is0(Y.add(x,h)))throw Error("bad curve params: a or b");function p(y,o,B=!1){if(!Y.isValid(o)||B&&Y.is0(o))throw Error(`bad point coordinate ${y}`);return o}function u(y){if(!(y instanceof m))throw Error("ProjectivePoint expected")}function n(y){if(!U||!U.basises)throw Error("no endo");return Pu(y,U.basises,Z.ORDER)}let c=hD((y,o)=>{let{X:B,Y:R,Z:_}=y;if(Y.eql(_,Y.ONE))return{x:B,y:R};let S=y.is0();if(o==null)o=S?Y.ONE:Y.inv(_);let v=Y.mul(B,o),P=Y.mul(R,o),E=Y.mul(_,o);if(S)return{x:Y.ZERO,y:Y.ZERO};if(!Y.eql(E,Y.ONE))throw Error("invZ was invalid");return{x:v,y:P}}),l=hD((y)=>{if(y.is0()){if(G.allowInfinityPoint&&!Y.is0(y.Y))return;throw Error("bad point: ZERO")}let{x:o,y:B}=y.toAffine();if(!Y.isValid(o)||!Y.isValid(B))throw Error("bad point: x or y not field elements");if(!D(o,B))throw Error("bad point: equation left != right");if(!y.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});function G0(y,o,B,R,_){return B=new m(Y.mul(B.X,y),B.Y,B.Z),o=IU(R,o),B=IU(_,B),o.add(B)}class m{constructor(y,o,B){this.X=p("x",y),this.Y=p("y",o,!0),this.Z=p("z",B),Object.freeze(this)}static CURVE(){return V}static fromAffine(y){let{x:o,y:B}=y||{};if(!y||!Y.isValid(o)||!Y.isValid(B))throw Error("invalid affine point");if(y instanceof m)throw Error("projective point not allowed");if(Y.is0(o)&&Y.is0(B))return m.ZERO;return new m(o,B,Y.ONE)}static fromBytes(y){let o=m.fromAffine(w(MW(y,void 0,"point")));return o.assertValidity(),o}static fromHex(y){return m.fromBytes(u8("pointHex",y))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(y=8,o=!0){if(U0.createCache(this,y),!o)this.multiply(eJ);return this}assertValidity(){l(this)}hasEvenY(){let{y}=this.toAffine();if(!Y.isOdd)throw Error("Field doesn't support isOdd");return!Y.isOdd(y)}equals(y){u(y);let{X:o,Y:B,Z:R}=this,{X:_,Y:S,Z:v}=y,P=Y.eql(Y.mul(o,v),Y.mul(_,R)),E=Y.eql(Y.mul(B,v),Y.mul(S,R));return P&&E}negate(){return new m(this.X,Y.neg(this.Y),this.Z)}double(){let{a:y,b:o}=V,B=Y.mul(o,eJ),{X:R,Y:_,Z:S}=this,v=Y.ZERO,P=Y.ZERO,E=Y.ZERO,b=Y.mul(R,R),k=Y.mul(_,_),f=Y.mul(S,S),e=Y.mul(R,_);return e=Y.add(e,e),E=Y.mul(R,S),E=Y.add(E,E),v=Y.mul(y,E),P=Y.mul(B,f),P=Y.add(v,P),v=Y.sub(k,P),P=Y.add(k,P),P=Y.mul(v,P),v=Y.mul(e,v),E=Y.mul(B,E),f=Y.mul(y,f),e=Y.sub(b,f),e=Y.mul(y,e),e=Y.add(e,E),E=Y.add(b,b),b=Y.add(E,b),b=Y.add(b,f),b=Y.mul(b,e),P=Y.add(P,b),f=Y.mul(_,S),f=Y.add(f,f),b=Y.mul(f,e),v=Y.sub(v,b),E=Y.mul(f,k),E=Y.add(E,E),E=Y.add(E,E),new m(v,P,E)}add(y){u(y);let{X:o,Y:B,Z:R}=this,{X:_,Y:S,Z:v}=y,P=Y.ZERO,E=Y.ZERO,b=Y.ZERO,k=V.a,f=Y.mul(V.b,eJ),e=Y.mul(o,_),q0=Y.mul(B,S),Q0=Y.mul(R,v),$0=Y.add(o,B),D0=Y.add(_,S);$0=Y.mul($0,D0),D0=Y.add(e,q0),$0=Y.sub($0,D0),D0=Y.add(o,R);let k0=Y.add(_,v);return D0=Y.mul(D0,k0),k0=Y.add(e,Q0),D0=Y.sub(D0,k0),k0=Y.add(B,R),P=Y.add(S,v),k0=Y.mul(k0,P),P=Y.add(q0,Q0),k0=Y.sub(k0,P),b=Y.mul(k,D0),P=Y.mul(f,Q0),b=Y.add(P,b),P=Y.sub(q0,b),b=Y.add(q0,b),E=Y.mul(P,b),q0=Y.add(e,e),q0=Y.add(q0,e),Q0=Y.mul(k,Q0),D0=Y.mul(f,D0),q0=Y.add(q0,Q0),Q0=Y.sub(e,Q0),Q0=Y.mul(k,Q0),D0=Y.add(D0,Q0),e=Y.mul(q0,D0),E=Y.add(E,e),e=Y.mul(k0,D0),P=Y.mul($0,P),P=Y.sub(P,e),e=Y.mul($0,q0),b=Y.mul(k0,b),b=Y.add(b,e),new m(P,E,b)}subtract(y){return this.add(y.negate())}is0(){return this.equals(m.ZERO)}multiply(y){let{endo:o}=G;if(!Z.isValidNot0(y))throw Error("invalid scalar: out of range");let B,R,_=(S)=>U0.cached(this,S,(v)=>iA(m,v));if(o){let{k1neg:S,k1:v,k2neg:P,k2:E}=n(y),{p:b,f:k}=_(v),{p:f,f:e}=_(E);R=k.add(e),B=G0(o.beta,b,f,S,P)}else{let{p:S,f:v}=_(y);B=S,R=v}return iA(m,[B,R])[0]}multiplyUnsafe(y){let{endo:o}=G,B=this;if(!Z.isValid(y))throw Error("invalid scalar: out of range");if(y===W4||B.is0())return m.ZERO;if(y===ZX)return B;if(U0.hasCache(this))return this.multiply(y);if(o){let{k1neg:R,k1:_,k2neg:S,k2:v}=n(y),{p1:P,p2:E}=Du(m,B,_,v);return G0(o.beta,P,E,R,S)}else return U0.unsafe(B,y)}multiplyAndAddUnsafe(y,o,B){let R=this.multiplyUnsafe(o).add(y.multiplyUnsafe(B));return R.is0()?void 0:R}toAffine(y){return c(this,y)}isTorsionFree(){let{isTorsionFree:y}=G;if(Q===ZX)return!0;if(y)return y(m,this);return U0.unsafe(this,J).is0()}clearCofactor(){let{clearCofactor:y}=G;if(Q===ZX)return this;if(y)return y(m,this);return this.multiplyUnsafe(Q)}isSmallOrder(){return this.multiplyUnsafe(Q).is0()}toBytes(y=!0){return zU(y,"isCompressed"),this.assertValidity(),I(m,this,y)}toHex(y=!0){return YX(this.toBytes(y))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(y=!0){return this.toBytes(y)}_setWindowSize(y){this.precompute(y)}static normalizeZ(y){return iA(m,y)}static msm(y,o){return Mu(m,Z,y,o)}static fromPrivateKey(y){return m.BASE.multiply(RW(Z,y))}}m.BASE=new m(V.Gx,V.Gy,Y.ONE),m.ZERO=new m(Y.ZERO,Y.ONE,Y.ZERO),m.Fp=Y,m.Fn=Z;let Y0=Z.BITS,U0=new BM(m,G.endo?Math.ceil(Y0/2):Y0);return m.BASE.precompute(8),m}function FM(W){return Uint8Array.of(W?2:3)}function SM(W,G){return{secretKey:G.BYTES,publicKey:1+W.BYTES,publicKeyUncompressed:1+2*W.BYTES,publicKeyHasPrefix:!0,signature:2*G.BYTES}}function Bu(W,G={}){let{Fn:X}=W,Y=G.randomBytes||TU,Z=Object.assign(SM(W.Fp,X),{seed:TM(X.ORDER)});function V(H){try{return!!RW(X,H)}catch(I){return!1}}function Q(H,I){let{publicKey:w,publicKeyUncompressed:C}=Z;try{let D=H.length;if(I===!0&&D!==w)return!1;if(I===!1&&D!==C)return!1;return!!W.fromBytes(H)}catch(D){return!1}}function J(H=Y(Z.seed)){return PM(MW(H,Z.seed,"seed"),X.ORDER)}function U(H,I=!0){return W.BASE.multiply(RW(X,H)).toBytes(I)}function q(H){let I=J(H);return{secretKey:I,publicKey:U(I)}}function N(H){if(typeof H==="bigint")return!1;if(H instanceof W)return!0;let{secretKey:I,publicKey:w,publicKeyUncompressed:C}=Z;if(X.allowedLengths||I===w)return;let D=u8("key",H).length;return D===w||D===C}function A(H,I,w=!0){if(N(H)===!0)throw Error("first arg must be private key");if(N(I)===!1)throw Error("second arg must be public key");let C=RW(X,H);return W.fromHex(I).multiply(C).toBytes(w)}return Object.freeze({getPublicKey:U,getSharedSecret:A,keygen:q,Point:W,utils:{isValidSecretKey:V,isValidPublicKey:Q,randomSecretKey:J,isValidPrivateKey:V,randomPrivateKey:J,normPrivateKeyToScalar:(H)=>RW(X,H),precompute(H=8,I=W.BASE){return I.precompute(H,!1)}},lengths:Z})}function Eu(W,G,X={}){XM(G),wz(X,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let Y=X.randomBytes||TU,Z=X.hmac||((B,...R)=>JM(G,B,H7(...R))),{Fp:V,Fn:Q}=W,{ORDER:J,BITS:U}=Q,{keygen:q,getPublicKey:N,getSharedSecret:A,utils:H,lengths:I}=Bu(W,X),w={prehash:!1,lowS:typeof X.lowS==="boolean"?X.lowS:!1,format:void 0,extraEntropy:!1},C="compact";function D(B){let R=J>>ZX;return B>R}function x(B,R){if(!Q.isValidNot0(R))throw Error(`invalid signature ${B}: out of range 1..Point.Fn.ORDER`);return R}function h(B,R){Qz(R);let _=I.signature,S=R==="compact"?_:R==="recovered"?_+1:void 0;return MW(B,S,`${R} signature`)}class p{constructor(B,R,_){if(this.r=x("r",B),this.s=x("s",R),_!=null)this.recovery=_;Object.freeze(this)}static fromBytes(B,R=C){h(B,R);let _;if(R==="der"){let{r:E,s:b}=e7.toSig(MW(B));return new p(E,b)}if(R==="recovered")_=B[0],R="compact",B=B.subarray(1);let S=Q.BYTES,v=B.subarray(0,S),P=B.subarray(S,S*2);return new p(Q.fromBytes(v),Q.fromBytes(P),_)}static fromHex(B,R){return this.fromBytes(AU(B),R)}addRecoveryBit(B){return new p(this.r,this.s,B)}recoverPublicKey(B){let R=V.ORDER,{r:_,s:S,recovery:v}=this;if(v==null||![0,1,2,3].includes(v))throw Error("recovery id invalid");if(J*$M<R&&v>1)throw Error("recovery id is ambiguous for h>1 curve");let P=v===2||v===3?_+J:_;if(!V.isValid(P))throw Error("recovery id 2 or 3 invalid");let E=V.toBytes(P),b=W.fromBytes(H7(FM((v&1)===0),E)),k=Q.inv(P),f=n(u8("msgHash",B)),e=Q.create(-f*k),q0=Q.create(S*k),Q0=W.BASE.multiplyUnsafe(e).add(b.multiplyUnsafe(q0));if(Q0.is0())throw Error("point at infinify");return Q0.assertValidity(),Q0}hasHighS(){return D(this.s)}toBytes(B=C){if(Qz(B),B==="der")return AU(e7.hexFromSig(this));let R=Q.toBytes(this.r),_=Q.toBytes(this.s);if(B==="recovered"){if(this.recovery==null)throw Error("recovery bit must be present");return H7(Uint8Array.of(this.recovery),R,_)}return H7(R,_)}toHex(B){return YX(this.toBytes(B))}assertValidity(){}static fromCompact(B){return p.fromBytes(u8("sig",B),"compact")}static fromDER(B){return p.fromBytes(u8("sig",B),"der")}normalizeS(){return this.hasHighS()?new p(this.r,Q.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return YX(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return YX(this.toBytes("compact"))}}let u=X.bits2int||function(B){if(B.length>8192)throw Error("input is too large");let R=UX(B),_=B.length*8-U;return _>0?R>>BigInt(_):R},n=X.bits2int_modN||function(B){return Q.create(u(B))},c=uZ(U);function l(B){return Uu("num < 2^"+U,B,W4,c),Q.toBytes(B)}function G0(B,R){return MW(B,void 0,"message"),R?MW(G(B),void 0,"prehashed message"):B}function m(B,R,_){if(["recovered","canonical"].some((Q0)=>(Q0 in _)))throw Error("sign() legacy options not supported");let{lowS:S,prehash:v,extraEntropy:P}=tA(_,w);B=G0(B,v);let E=n(B),b=RW(Q,R),k=[l(b),l(E)];if(P!=null&&P!==!1){let Q0=P===!0?Y(I.secretKey):P;k.push(u8("extraEntropy",Q0))}let f=H7(...k),e=E;function q0(Q0){let $0=u(Q0);if(!Q.isValidNot0($0))return;let D0=Q.inv($0),k0=W.BASE.multiply($0).toAffine(),H1=Q.create(k0.x);if(H1===W4)return;let U1=Q.create(D0*Q.create(e+H1*b));if(U1===W4)return;let J0=(k0.x===H1?0:2)|Number(k0.y&ZX),B0=U1;if(S&&D(U1))B0=Q.neg(U1),J0^=1;return new p(H1,B0,J0)}return{seed:f,k2sig:q0}}function Y0(B,R,_={}){B=u8("message",B);let{seed:S,k2sig:v}=m(B,R,_);return qu(G.outputLen,Q.BYTES,Z)(S,v)}function U0(B){let R=void 0,_=typeof B==="string"||MU(B),S=!_&&B!==null&&typeof B==="object"&&typeof B.r==="bigint"&&typeof B.s==="bigint";if(!_&&!S)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(S)R=new p(B.r,B.s);else if(_){try{R=p.fromBytes(u8("sig",B),"der")}catch(v){if(!(v instanceof e7.Err))throw v}if(!R)try{R=p.fromBytes(u8("sig",B),"compact")}catch(v){return!1}}if(!R)return!1;return R}function y(B,R,_,S={}){let{lowS:v,prehash:P,format:E}=tA(S,w);if(_=u8("publicKey",_),R=G0(u8("message",R),P),"strict"in S)throw Error("options.strict was renamed to lowS");let b=E===void 0?U0(B):p.fromBytes(u8("sig",B),E);if(b===!1)return!1;try{let k=W.fromBytes(_);if(v&&b.hasHighS())return!1;let{r:f,s:e}=b,q0=n(R),Q0=Q.inv(e),$0=Q.create(q0*Q0),D0=Q.create(f*Q0),k0=W.BASE.multiplyUnsafe($0).add(k.multiplyUnsafe(D0));if(k0.is0())return!1;return Q.create(k0.x)===f}catch(k){return!1}}function o(B,R,_={}){let{prehash:S}=tA(_,w);return R=G0(R,S),p.fromBytes(B,"recovered").recoverPublicKey(R).toBytes()}return Object.freeze({keygen:q,getPublicKey:N,getSharedSecret:A,utils:H,lengths:I,Point:W,sign:Y0,verify:y,recoverPublicKey:o,Signature:p,hash:G})}function $u(W){let G={a:W.a,b:W.b,p:W.Fp.ORDER,n:W.n,h:W.h,Gx:W.Gx,Gy:W.Gy},X=W.Fp,Y=W.allowedPrivateKeyLengths?Array.from(new Set(W.allowedPrivateKeyLengths.map((Q)=>Math.ceil(Q/2)))):void 0,Z=hZ(G.n,{BITS:W.nBitLength,allowedLengths:Y,modFromBytes:W.wrapPrivateKey}),V={Fp:X,Fn:Z,allowInfinityPoint:W.allowInfinityPoint,endo:W.endo,isTorsionFree:W.isTorsionFree,clearCofactor:W.clearCofactor,fromBytes:W.fromBytes,toBytes:W.toBytes};return{CURVE:G,curveOpts:V}}function Fu(W){let{CURVE:G,curveOpts:X}=$u(W),Y={hmac:W.hmac,randomBytes:W.randomBytes,lowS:W.lowS,bits2int:W.bits2int,bits2int_modN:W.bits2int_modN};return{CURVE:G,curveOpts:X,hash:W.hash,ecdsaOpts:Y}}function Su(W,G){let X=G.Point;return Object.assign({},G,{ProjectivePoint:X,CURVE:Object.assign({},W,DM(X.Fn.ORDER,X.Fn.BITS))})}function xu(W){let{CURVE:G,curveOpts:X,hash:Y,ecdsaOpts:Z}=Fu(W),V=Lu(G,X),Q=Eu(V,Y,Z);return Su(W,Q)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ku(W,G){let X=(Y)=>xu({...W,hash:Y});return{...X(G),create:X}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var JX={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},_u={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},yu=BigInt(0),dD=BigInt(1),Jz=BigInt(2);function vu(W){let G=JX.p,X=BigInt(3),Y=BigInt(6),Z=BigInt(11),V=BigInt(22),Q=BigInt(23),J=BigInt(44),U=BigInt(88),q=W*W*W%G,N=q*q*W%G,A=I5(N,X,G)*N%G,H=I5(A,X,G)*N%G,I=I5(H,Jz,G)*q%G,w=I5(I,Z,G)*I%G,C=I5(w,V,G)*w%G,D=I5(C,J,G)*C%G,x=I5(D,U,G)*D%G,h=I5(x,J,G)*C%G,p=I5(h,X,G)*N%G,u=I5(p,Q,G)*w%G,n=I5(u,Y,G)*q%G,c=I5(n,Jz,G);if(!wU.eql(wU.sqr(c),W))throw Error("Cannot find square root");return c}var wU=hZ(JX.p,{sqrt:vu}),xM=ku({...JX,Fp:wU,lowS:!0,endo:_u},Yz),oD={};function jU(W,...G){let X=oD[W];if(X===void 0){let Y=Yz(ZM(W));X=H7(Y,Y),oD[W]=X}return Yz(H7(X,...G))}var Oz=(W)=>W.toBytes(!0).slice(1),qX=(()=>xM.Point)(),Kz=(W)=>W%Jz===yu;function Uz(W){let{Fn:G,BASE:X}=qX,Y=RW(G,W),Z=X.multiply(Y);return{scalar:Kz(Z.y)?Y:G.neg(Y),bytes:Oz(Z)}}function kM(W){let G=wU;if(!G.isValidNot0(W))throw Error("invalid x: Fail if x \u2265 p");let X=G.create(W*W),Y=G.create(X*W+BigInt(7)),Z=G.sqrt(Y);if(!Kz(Z))Z=G.neg(Z);let V=qX.fromAffine({x:W,y:Z});return V.assertValidity(),V}var gZ=UX;function _M(...W){return qX.Fn.create(gZ(jU("BIP0340/challenge",...W)))}function nD(W){return Uz(W).bytes}function gu(W,G,X=TU(32)){let{Fn:Y}=qX,Z=u8("message",W),{bytes:V,scalar:Q}=Uz(G),J=u8("auxRand",X,32),U=Y.toBytes(Q^gZ(jU("BIP0340/aux",J))),q=jU("BIP0340/nonce",U,V,Z),{bytes:N,scalar:A}=Uz(q),H=_M(N,V,Z),I=new Uint8Array(64);if(I.set(N,0),I.set(Y.toBytes(Y.create(A+H*Q)),32),!yM(I,Z,V))throw Error("sign: Invalid signature produced");return I}function yM(W,G,X){let{Fn:Y,BASE:Z}=qX,V=u8("signature",W,64),Q=u8("message",G),J=u8("publicKey",X,32);try{let U=kM(gZ(J)),q=gZ(V.subarray(0,32));if(!Vz(q,dD,JX.p))return!1;let N=gZ(V.subarray(32,64));if(!Vz(N,dD,JX.n))return!1;let A=_M(Y.toBytes(q),Oz(U),Q),H=Z.multiplyUnsafe(N).add(U.multiplyUnsafe(Y.neg(A))),{x:I,y:w}=H.toAffine();if(H.is0()||!Kz(w)||I!==q)return!1;return!0}catch(U){return!1}}var Cz=(()=>{let W=(X=TU(48))=>{return PM(X,JX.n)};xM.utils.randomSecretKey;function G(X){let Y=W(X);return{secretKey:Y,publicKey:nD(Y)}}return{keygen:G,getPublicKey:nD,sign:gu,verify:yM,Point:qX,utils:{randomSecretKey:W,randomPrivateKey:W,taggedHash:jU,lift_x:kM,pointToBytes:Oz,numberToBytesBE:PU,bytesToNumberBE:UX,mod:w5},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:64,seed:48}}})(),uu=new TextEncoder,hu=new TextDecoder,LW=(W)=>uu.encode(W),kZ=(W)=>hu.decode(W),qz=(W)=>Array.from(W,(G)=>G.toString(16).padStart(2,"0")).join(""),G4=JSON.stringify,OU=JSON.parse,vM=(W,G=Number.MAX_SAFE_INTEGER)=>W.split("").reduce((X,Y)=>X+Y.charCodeAt(0),0)%G,Dz="AES-GCM",bu={},gM="$",uM=",",mu=(W)=>{let G=new Uint8Array(W),X=32768,Y="";for(let Z=0;Z<G.length;Z+=32768)Y+=String.fromCharCode(...G.subarray(Z,Z+32768));return btoa(Y)},fu=(W)=>Uint8Array.from(atob(W),(G)=>G.charCodeAt(0)).buffer,WU=(W)=>bu[W]??=crypto.subtle.digest("SHA-1",LW(W)).then((G)=>{let X=new Uint8Array(G),Y="";for(let Z of X)Y+=Z.toString(36);return Y}),cu=async(W,G,X)=>{let Y=await crypto.subtle.digest("SHA-256",LW(`${W}:${G}:${X}`));return crypto.subtle.importKey("raw",Y,{name:Dz},!1,["encrypt","decrypt"])},pu=async(W,G)=>{let X=crypto.getRandomValues(new Uint8Array(12)),Y=await W,Z=await crypto.subtle.encrypt({name:Dz,iv:X},Y,LW(G));return`${X.join(uM)}${gM}${mu(Z)}`},lu=async(W,G)=>{let[X,Y]=G.split(gM);if(!X||!Y)throw Error("Invalid encrypted payload format");let Z=Uint8Array.from(X.split(uM),Number),V=await W,Q=await crypto.subtle.decrypt({name:Dz,iv:Z},V,fu(Y));return kZ(Q)},k5="GenosRTC",Mz=(W,G)=>Array.from({length:W},G),KU=(W)=>Array.from(crypto.getRandomValues(new Uint8Array(W)),(G)=>"0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"[G%62]).join(""),e1=typeof sessionStorage<"u"?sessionStorage.__genosrtcId??=KU(20):KU(20),XX=Promise.all.bind(Promise),du=typeof window<"u",{entries:ou,fromEntries:hM,keys:Re}=Object,nu=()=>{},t7=(W)=>Error(`GenosRTC: ${W}`),GU=(...W)=>W.join("@"),iu=(W,G)=>{let X=[...W],Y=X.length,Z=()=>{let V=Math.sin(G++)*1e4;return V-Math.floor(V)};while(Y){let V=Math.floor(Z()*Y--);[X[Y],X[V]]=[X[V],X[Y]]}return X},ru=5000,iD="icegatheringstatechange",rD="offer",au="answer",su=[...Mz(3,(W,G)=>`stun:stun${G||""}.l.google.com:19302`),"stun:stun.cloudflare.com:3478"].map((W)=>({urls:W})),aD=(W,{rtcConfig:G,rtcPolyfill:X,turnConfig:Y})=>{let Z=new(X||RTCPeerConnection)({iceServers:[...su,...Y||[]],...G}),V={},Q=!1,J=!1,U,q=(H)=>Object.assign(H,{binaryType:"arraybuffer",bufferedAmountLowThreshold:65535,onmessage:(I)=>V.data?.(I.data),onopen:()=>V.connect?.(),onclose:()=>V.close?.(),onerror:(I)=>!I?.error?.message?.includes("User-Initiated Abort")&&V.error?.(I)}),N=()=>Promise.race([new Promise((H)=>{let I=()=>{if(Z.iceGatheringState==="complete")Z.removeEventListener(iD,I),H()};Z.addEventListener(iD,I),I()}),new Promise((H)=>setTimeout(H,ru))]).then(()=>({type:Z.localDescription.type,sdp:Z.localDescription.sdp.replace(/a=ice-options:trickle\s\n/g,"")}));if(W?q(U=Z.createDataChannel("data")):Z.ondatachannel=({channel:H})=>q(U=H),Z.onnegotiationneeded=async()=>{try{Q=!0,await Z.setLocalDescription(),V.signal?.(await N())}catch(H){V.error?.(H)}finally{Q=!1}},Z.onconnectionstatechange=()=>{if(["disconnected","failed","closed"].includes(Z.connectionState))V.close?.()},Z.ontrack=(H)=>{V.track?.(H.track,H.streams[0]),V.stream?.(H.streams[0])},Z.onremovestream=(H)=>V.stream?.(H.stream),W&&!Z.canTrickleIceCandidates)Z.onnegotiationneeded();let A=()=>Z.getSenders();return{created:Date.now(),connection:Z,get channel(){return U},get isDead(){return Z.connectionState==="closed"},async signal(H){if(U?.readyState==="open"&&!H.sdp?.includes("a=rtpmap"))return;try{if(H.type===rD){if(Q||Z.signalingState!=="stable"&&!J){if(W)return;await XX([Z.setLocalDescription({type:"rollback"}),Z.setRemoteDescription(H)])}else await Z.setRemoteDescription(H);await Z.setLocalDescription();let I=await N();return V.signal?.(I),I}if(H.type===au){J=!0;try{await Z.setRemoteDescription(H)}finally{J=!1}}}catch(I){V.error?.(I)}},sendData:(H)=>{if(U?.readyState==="open")U.send(H)},destroy:()=>{U?.close(),Z.close(),Q=J=!1},setHandlers:(H)=>Object.assign(V,H),offerPromise:W?new Promise((H)=>V.signal=(I)=>I.type===rD&&H(I)):Promise.resolve(),addStream:(H)=>H.getTracks().forEach((I)=>Z.addTrack(I,H)),removeStream:(H)=>A().filter((I)=>H.getTracks().includes(I.track)).forEach((I)=>Z.removeTrack(I)),addTrack:(H,I)=>Z.addTrack(H,I),removeTrack:(H)=>{let I=A().find((w)=>w.track===H);if(I)Z.removeTrack(I)},replaceTrack:(H,I)=>A().find((w)=>w.track===H)?.replaceTrack(I)}},tu=Object.getPrototypeOf(Uint8Array),QU=12,bM=0,JU=bM+QU,UU=JU+1,_Z=UU+1,yZ=_Z+1,xZ=16384-yZ,XU=255,eA="bufferedamountlow",GX=(W)=>`@_${W}`,Wz=100,eu=3,Wh=200,Gh=(W,G,X,Y)=>{let Z=new Map,V=new Map,Q=new Map,J={},U={},q={},N={},A=new Map,H=(S,v)=>{if(!A.has(S))A.set(S,new Set);A.get(S).add(v)},I=(S,v)=>A.get(S)?.delete(v),w=(S,...v)=>A.get(S)?.forEach((P)=>P(...v)),C=(S,v)=>{let P=S?Array.isArray(S)?S:[S]:Z.keys();return Array.from(P,(E)=>{let b=Z.get(E);if(!b)return console.warn(`${k5}: no peer with id ${E}`),null;return v(E,b)}).filter(Boolean)},D=(S)=>{if(!Z.has(S))return;Z.delete(S),delete J[S],delete U[S],delete q[S],delete N[S],w("peer:leave",S),G(S)},x=(S)=>new Promise((v,P)=>{let E=setTimeout(()=>{S.removeEventListener(eA,b),P(Error(`${k5}: bufferLow timeout`))},5000);function b(){clearTimeout(E),S.removeEventListener(eA,b),v()}S.addEventListener(eA,b)}),h=(S)=>{if(Q.has(S))return Q.get(S);if(!S)throw t7("action type is required");let v=LW(S);if(v.byteLength>QU)throw t7(`\u274C "${S}" exceeds ${QU} bytes. Use a shorter name.`);let P=new Uint8Array(QU).map((Q0,$0)=>v[$0]||0),E=0,b=new Map([["message",new Set],["progress",new Set]]),k=(Q0,$0)=>b.get(Q0)?.add($0),f=(Q0,$0)=>b.get(Q0)?.delete($0),e=async(Q0,$0,D0,k0)=>{if(D0&&typeof D0!=="object")throw t7("meta must be object");if(Q0===void 0)throw t7("data cannot be undefined");let H1=Q0 instanceof Blob,U1=H1||Q0 instanceof ArrayBuffer||Q0 instanceof tu,J0=typeof Q0!=="string";if(D0&&!U1)throw t7("meta only allowed with binary");let B0=U1?new Uint8Array(H1?await Q0.arrayBuffer():Q0):LW(J0?G4(Q0):Q0),h0=D0?LW(G4(D0)):null,Y1=Math.ceil(B0.byteLength/xZ)+(D0?1:0)||1;if(Y1>Wz)throw t7(`Message too large, exceeds max chunks ${Wz}`);let A8=Mz(Y1,(F1,E0)=>{let l0=E0===Y1-1,q1=D0&&E0===0,d1=q1?h0:B0.subarray(D0?(E0-1)*xZ:E0*xZ,D0?E0*xZ:(E0+1)*xZ),j8=new Uint8Array(yZ+d1.byteLength);return j8.set(P),j8.set([E],JU),j8.set([l0|q1<<1|U1<<2|J0<<3],UU),j8.set([Math.round((E0+1)/Y1*XU)],_Z),j8.set(d1,yZ),j8});return E=E+1&XU,XX(C($0,async(F1,E0)=>{let{channel:l0}=E0;for(let q1=0;q1<Y1;q1++){let d1=0;while(l0.bufferedAmount>l0.bufferedAmountLowThreshold){if(d1++>eu)throw t7(`${k5}: send buffer full, max retries reached for peer ${F1}`);try{await x(l0)}catch(j8){console.warn(j8.message),await new Promise((v8)=>setTimeout(v8,Wh))}}if(!Z.has(F1))break;E0.sendData(A8[q1]),k0?.(A8[q1][_Z]/XU,F1,D0)}}))};V.set(S,{listeners:b,send:e});let q0={send:e,on:k,off:f};return Q.set(S,q0),q0},p=(S,v)=>{try{let P=new Uint8Array(v),E=kZ(P.subarray(bM,JU)).replace(/\x00/g,"");if(!V.has(E))return console.warn(`${k5}: unregistered type (${E})`);let[b]=P.subarray(JU,UU),[k]=P.subarray(UU,_Z),[f]=P.subarray(_Z,yZ),e=P.subarray(yZ),q0=Boolean(k&1),Q0=Boolean(k&2),$0=Boolean(k&4),D0=Boolean(k&8),k0=V.get(E),H1=(J[S]||={})[E]||={};if(H1[b]?.chunks?.length>Wz){console.warn(`${k5}: peer ${S} sent too many chunks for nonce ${b}, ignoring.`);return}let U1=H1[b]||={chunks:[]};if(Q0)try{U1.meta=OU(kZ(e))}catch{console.warn(`${k5}: failed to parse meta from peer ${S} for type ${E}`);return}else U1.chunks.push(e);if(k0.listeners.get("progress").forEach((h0)=>{try{h0(f/XU,S,U1.meta)}catch(Y1){console.error(Y1)}}),!q0)return;let J0=new Uint8Array(U1.chunks.reduce((h0,Y1)=>h0+Y1.byteLength,0));U1.chunks.reduce((h0,Y1)=>(J0.set(Y1,h0),h0+Y1.byteLength),0),delete H1[b];let B0;if($0)B0=J0;else if(D0)try{B0=OU(kZ(J0))}catch{console.warn(`${k5}: failed to parse JSON message data from peer ${S} for type ${E}`);return}else B0=kZ(J0);k0.listeners.get("message").forEach((h0)=>{try{h0(B0,S,U1.meta)}catch(Y1){console.error(Y1)}})}catch(P){console.error(`${k5}: error handling data from peer ${S}:`,P)}},u=async()=>{try{await R(""),await new Promise((S)=>setTimeout(S,99))}catch(S){console.warn(`${k5}: error sending leave`,S)}for(let[S,v]of Z){try{v.destroy()}catch{}Z.delete(S)}X()},{send:n,on:c}=h(GX("ping")),{send:l,on:G0}=h(GX("pong")),{send:m,on:Y0}=h(GX("signal")),{send:U0,on:y}=h(GX("stream")),{send:o,on:B}=h(GX("track")),{send:R,on:_}=h(GX("leave"));if(W((S,v)=>{let P=Z.get(v);if(P===S)return;if(P){let E=()=>{};P.setHandlers({data:E,stream:E,track:E,signal:E,close:E,error:E})}Z.set(v,S),S.setHandlers({data:(E)=>p(v,E),stream:(E)=>{w("stream:add",E,v,q[v]),delete q[v]},track:(E,b)=>{w("track:add",E,b,v,N[v]),delete N[v]},signal:(E)=>m(E,v),close:()=>D(v),error:(E)=>{console.error(`${k5}: peer error for ${v}`,E),D(v)}}),w("peer:join",v,Y?.(v))}),c("message",(S,v)=>l("",v)),G0("message",(S,v)=>{U[v]?.(),delete U[v]}),Y0("message",(S,v)=>Z.get(v)?.signal(S)),y("message",(S,v)=>q[v]=S),B("message",(S,v)=>N[v]=S),_("message",(S,v)=>D(v)),du)addEventListener("beforeunload",u);return{on:H,off:I,channel:h,leave:u,ping:async(S)=>{if(!S)throw t7("ping() requires target peer ID");let v=Date.now();return n("",S),await new Promise((P)=>U[S]=P),Date.now()-v},getPeers:()=>hM(Array.from(Z,([S,v])=>[S,v.connection])),addStream:(S,v,P)=>C(v,async(E,b)=>{if(P)await U0(P,E);b.addStream(S)}),removeStream:(S,v)=>C(v,(P,E)=>E.removeStream(S)),addTrack:(S,v,P,E)=>C(P,async(b,k)=>{if(E)await o(E,b);k.addTrack(S,v)}),removeTrack:(S,v)=>C(v,(P,E)=>E.removeTrack(S)),replaceTrack:(S,v,P,E)=>C(P,async(b,k)=>{if(E)await o(E,b);k.replaceTrack(S,v)})}},Xh=5,Yh=10,Zh=2500,YU=57333,Vh=({init:W,subscribe:G,announce:X})=>{let Y={},Z=!1,V,Q;return(J,U,q)=>{let{appId:N}=J;if(Y[N]?.[U])return Y[N][U];if(!J||!U||!N&&!J.firebaseApp)throw t7(!J?"config required":!U?"roomId required":"appId missing");let A=nu;if(!Z){let _=W(J);Q=Mz(Xh,()=>{try{return aD(!0,J)}catch{return null}}).filter(Boolean),V=Array.isArray(_)?_:[_];let S=setInterval(()=>{Q=Q.filter((v)=>{let P=Date.now()-v.created<YU;if(!P)v.destroy();return P})},YU);Y.offerCleanupTimer||=S,Z=!0}let H={},I={},w=new Map,C=new Map,D={},x=GU(k5,N,U),h=WU(x),p=WU(GU(x,e1)),u=cu(J.password||"",N,U),n=(_)=>async(S)=>({type:S.type,sdp:await _(u,S.sdp)}),c=n(lu),l=n(pu),G0=(_)=>{return setTimeout(()=>{if(!_.isDead&&!Object.values(I).includes(_))_.destroy()},YU),_},m=(_)=>{try{return G0(aD(_,J))}catch{return null}},Y0=(_,S)=>{if(I[S]===_)return;I[S]?.destroy(),I[S]=_,A(_,S),H[S]?.forEach((v)=>v!==_&&v.destroy()),delete H[S]},U0=(_,S)=>{if(I[S]===_)delete I[S]},y=(_)=>async(S,v,P)=>{let[E,b]=await XX([h,p]);if(S!==E&&S!==b)return;let{peerId:k,offer:f,answer:e,type:q0}=typeof v==="string"?OU(v):v;if(k&&k!==e1)C.set(k,Date.now());if(q0&&k)D[k]=q0;if(k===e1||I[k])return;if(J.admit&&!J.admit(k))return;if(f){if(H[k]?.[_]&&e1>k)return;let Q0=m(!1);if(!Q0)return;Q0.setHandlers({connect:()=>Y0(Q0,k),close:()=>U0(Q0,k)});try{let $0=await c(f);if(Q0.isDead)return;let[D0,k0]=await XX([WU(GU(x,k)),Q0.signal($0).then(l)]);P(D0,G4({peerId:e1,answer:k0,...J.type&&{type:J.type}}))}catch{q?.({error:"decryption failed (offer)",appId:N,peerId:k,roomId:U})}}else if(e){let Q0=H[k]?.[_];if(!Q0||Q0.isDead)return;Q0.setHandlers({connect:()=>Y0(Q0,k),close:()=>U0(Q0,k)});try{Q0.signal(await c(e))}catch{q?.({error:"decryption failed (answer)",appId:N,peerId:k,roomId:U})}}else{let Q0=H[k]||=[];if(Q0.forEach((U1,J0)=>{if(U1&&(U1.isDead||Date.now()-(U1.dialedAt??U1.created)>YU)){if(U1.isDead)w.set(k,Date.now()+30000);U1.destroy(),delete Q0[J0]}}),Q0[_]||Q0.filter(Boolean).length>=2||w.get(k)>Date.now())return;if(Object.values(H).reduce((U1,J0)=>U1+J0.filter((B0)=>B0&&!B0.isDead).length,0)>=Yh)return;let $0=Q.pop(),D0=$0?G0($0):m(!0);if(!D0){w.set(k,Date.now()+30000);return}D0.dialedAt=Date.now();let[k0,{offer:H1}]=await XX([WU(GU(x,k)),D0.offerPromise.then(l).then((U1)=>({offer:U1}))]);Q0[_]=D0,D0.setHandlers({connect:()=>Y0(D0,k),close:()=>U0(D0,k)}),P(k0,G4({peerId:e1,offer:H1,peer:D0,...J.type&&{type:J.type}}))}},o=[],B=[];V.forEach(async(_,S)=>{let v=await _;if(!v)return;let[P,E]=await XX([h,p]);B[S]=G(v,P,E,y(S));let b=async()=>{let k=await X(v,P,E);o[S]=setTimeout(b,typeof k==="number"?k:Zh)};b()}),Y[N]||={};let R=Gh((_)=>A=_,(_)=>delete I[_],()=>R.onCleanup?.(),(_)=>D[_]);return R.onCleanup=()=>{if(delete Y[N][U],o.forEach(clearTimeout),B.forEach((_)=>_?.()),Object.keys(Y).length===0)clearInterval(Y.offerCleanupTimer),delete Y.offerCleanupTimer},R._census=()=>{for(let S of Object.keys(I))C.set(S,Date.now());let _=Date.now()-120000;for(let[S,v]of C)if(v<_)C.delete(S);return[...C.keys()]},Y[N][U]=R}},sD=3333,ZU={},mM={},Qh=(W,G)=>{let X={},Y=null,Z=()=>{if(Y)clearTimeout(Y),Y=null;let V=new WebSocket(W);V.onclose=()=>{ZU[W]??=sD,Y=setTimeout(Z,ZU[W]),ZU[W]*=2},V.onmessage=(Q)=>G(Q.data),X.socket=V,X.url=V.url,X.ready=new Promise((Q)=>{V.onopen=()=>{ZU[W]=sD,Q(X)}}),X.send=(Q)=>{if(V.readyState===1)V.send(Q)}};return X.forceReconnect=Z,Z(),mM[W]=X,X};if(typeof window<"u"){let W=()=>{dA.info("\u26A1 [GenosRTC] Network event detected. Forcing reconnection\u2026"),Object.values(mM).forEach((G)=>{if(G.socket&&G.socket.readyState!==WebSocket.OPEN&&G.socket.readyState!==WebSocket.CONNECTING)G.forceReconnect()})};window.addEventListener("online",()=>{dA.info("\u2705 Reconnected to the network."),W()}),window.addEventListener("offline",async()=>{dA.info("\u274C Disconnected from the network.")}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible")W()})}var Jh=(W)=>()=>hM(ou(W).map(([G,X])=>[G,X.socket])),Uh=(W,G,X,Y)=>(W.relayUrls??(Y?iu(G,vM(W.appId)):G)).slice(0,W.relayUrls?.length??W.relayRedundancy??X),qh=["wss://relay.primal.net","wss://ftp.halifax.rwth-aachen.de/nostr","wss://nostr.oxtr.dev","wss://nostr.sathoarder.com","wss://nostr.mom","wss://nos.lol","wss://nostr.vulpem.com","wss://nostr.data.haus"],VX={},Nh=10,fM="x",cM="EVENT",Hh=/pow:\s*(\d+)\s*bits needed\.?/i,Nz=new Set,pM=Cz.utils.randomSecretKey(),Ah=qz(Cz.getPublicKey(pM)),Tz={},vZ={},zh={},lM=()=>Math.floor(Date.now()/1000),dM=(W)=>zh[W]??=vM(W,1e4)+20000,CU=(W)=>W.replace(/\/$/,""),Ih=(W,G)=>{let[X,Y,Z,V]=OU(G);if(X===cM)return vZ[Y]?.(Tz[Y],Z.content);if(X==="NOTICE"||X==="OK"&&!Z){if(+((X==="NOTICE"?Y:V).match(Hh)?.[1]??0)>0){let Q=CU(W);Nz.add(Q),VX[Q]?.close?.(),delete VX[Q]}}},wh=(W)=>{let G=CU(W);if(VX[G])return VX[G];let X=Qh(G,(Y)=>Ih(G,Y));return VX[G]=X},tD=async(W,G)=>{let X={kind:dM(W),content:G,pubkey:Ah,created_at:lM(),tags:[[fM,W]]},Y=LW(G4([0,X.pubkey,X.created_at,X.kind,X.tags,X.content])),Z=new Uint8Array(await crypto.subtle.digest("SHA-256",Y)),V=Cz.sign(Z,pM);return G4([cM,{...X,id:qz(Z),sig:qz(V)}])},eD=(W,G)=>{return Tz[W]=G,G4(["REQ",W,{kinds:[dM(G)],since:lM(),["#"+fM]:[G]}])},WM=(W)=>{return delete Tz[W],G4(["CLOSE",W])},oM=Vh({init:(W)=>{let G=(W?.relayUrls?.length?W.relayUrls:null)??qh;return Uh(W,G,Nh,!1).map(wh).map((X)=>X.ready.then(()=>X).catch(()=>null))},subscribe:(W,G,X,Y)=>{let Z=KU(64),V=KU(64);return vZ[Z]=vZ[V]=(Q,J)=>Y(Q,J,async(U,q)=>{if(Nz.has(CU(W.url)))return;W.send(await tD(U,q))}),W.send(eD(Z,G)),W.send(eD(V,X)),()=>{W.send(WM(Z)),W.send(WM(V)),delete vZ[Z],delete vZ[V]}},announce:async(W,G)=>{if(Nz.has(CU(W.url)))return;W.send(await tD(G,G4({peerId:e1})))}}),Le=Jh(VX),jh={cellSize:"auto",bridgesPerEdge:2,maxCellSize:50,targetCells:100,debug:!1},GM=5000,Oh=3000,Kh=30000,Ch=2000,DU=(W)=>{let G=String(W||"").match(/cell-(\d+)/);return G?Number(G[1]):null},Dh=(W,G)=>{let X=DU(W);if(X==null)return[];let Y=[];for(let Z=1;Z<G;Z*=2){if(X-Z>=0)Y.push(`cell-${X-Z}`);if(X+Z<G)Y.push(`cell-${X+Z}`)}return Y},VU=(W)=>`c${(DU(W)||0).toString(36)}`,Mh=(W,G,X)=>{if(W<=10)return Math.max(2,W);let Y=10,Z=Math.ceil(W/G);return Math.max(Y,Math.min(X,Z))},Th=(W,G)=>{return Math.max(1,Math.ceil(W/G))},nM=(W)=>{let G=0;for(let X=0;X<W.length;X++)G=Math.imul(G^W.charCodeAt(X),2654435761);return G>>>0},Gz=(W,G)=>{let X=0,Y=-1;for(let Z=0;Z<G;Z++){let V=nM(`${W}:${Z}`);if(V>Y)Y=V,X=Z}return X};class qU{constructor(W){this.peerId=W,this.joinedAt=Date.now(),this.lastSeen=Date.now(),this.rttSamples=[],this.stability=1,this.reconnects=0,this.isResponsive=!0,this.connectedCells=new Set}get uptime(){return Date.now()-this.joinedAt}get avgRtt(){if(this.rttSamples.length===0)return 1/0;return Math.round(this.rttSamples.reduce((W,G)=>W+G,0)/this.rttSamples.length)}get healthScore(){let W=this.avgRtt===1/0?0.5:Math.max(0,100-this.avgRtt)/100,G=Math.min(1,this.uptime/60000),X=this.stability,Y=this.isResponsive?1:0.3;return W*0.25+G*0.25+X*0.3+Y*0.2}get isStale(){return Date.now()-this.lastSeen>Kh}addRttSample(W){if(this.rttSamples.push(W),this.rttSamples.length>10)this.rttSamples.shift();this.lastSeen=Date.now(),this.isResponsive=!0}markReconnect(){this.reconnects++,this.stability=Math.max(0,1-this.reconnects*0.1)}markUnresponsive(){this.isResponsive=!1}markSeen(){this.lastSeen=Date.now()}addConnectedCell(W){if(W)this.connectedCells.add(W)}}function Ph(W,G={},X={}){let Y={...jh,...G},Z=!!Y.debug,V=(...$)=>Z&&console.debug("[cells]",...$),Q=Math.max(0,Y.bridgesPerEdge|0),J=Math.max(5,Y.maxCellSize|0),U=Math.max(10,Y.targetCells|0),q=Y.cellSize==="auto",N=q?2:Math.max(1,Y.cellSize|0),A={cellId:null,bridges:[],isBridge:!1},H=null,I=null,w=null,C=new Map,D=new Map,x=new Set,h=new Map,p=new Set,u=new Set,n=0,c=[],l=new Map,G0=new Set,m=new Map,Y0=new Map,U0=1,y=0,o=1,B=0,R=()=>{B0();let $=Th(J0().length,N);if($!==o)o=$,B=Date.now();let d=Date.now()-B;if($>U0&&d>4000)U0=$;else if($<U0&&d>30000)U0=$;return U0},_=()=>Math.min(150,Math.ceil(Math.log2(R()+1))*2+3),S=($)=>Dh($,R()),v=W.on?.bind(W),P=W.off?.bind(W);if(v)W.on=($,d)=>String($).startsWith("mesh:")?k($,d):v($,d);if(P)W.off=($,d)=>String($).startsWith("mesh:")?h.get($)?.delete(d):P($,d);let E=($)=>(x.add($),()=>x.delete($)),b=($,d,X0)=>{if(u.has(X0))return;if(u.add(X0),u.size>GM){let w0=u.values().next().value;u.delete(w0)}for(let w0 of x)try{w0($,d)}catch(e0){V("Error in deliver handler:",e0)}},k=($,d)=>{if(!h.has($))h.set($,new Set);return h.get($).add(d),()=>h.get($)?.delete(d)},f=($,...d)=>{let X0=h.get($);if(X0)for(let w0 of X0)try{w0(...d)}catch{}},e=($)=>{try{return typeof $==="string"?JSON.parse($):$}catch{return null}},q0=()=>`${e1}:${Date.now().toString(36)}:${(n++&65535).toString(36)}`,Q0=()=>{if(p.size>GM)p.delete(p.values().next().value)},$0=($,d,X0=[])=>{if(!$||!d)return;if(C.set($,{cell:d,isBridge:X0.length>0,bridges:[...X0]}),!D.has($))D.set($,new qU($));let w0=D.get($);if(w0.markSeen(),w0.addConnectedCell(d),Y0.set(d,{lastSeen:Date.now(),peerId:$}),X0.length>0)for(let e0 of S(d))w0.addConnectedCell(e0)},D0=($)=>D.get($),k0=($,d)=>{let X0=D.get($);if(X0)X0.addRttSample(d)},H1=($)=>{let d=E0($);if(d.length===0)return null;let X0=0,w0=0;for(let K1 of d){let r0=D.get(K1);if(r0&&!r0.isStale){if(X0+=r0.healthScore,r0.isResponsive)w0++}}let e0=d.filter((K1)=>{let r0=D.get(K1);return r0&&!r0.isStale});return{cellId:$,memberCount:e0.length,avgHealth:e0.length>0?X0/e0.length:0,responsiveRatio:e0.length>0?w0/e0.length:0}},U1=()=>{let $=H1(A.cellId);f("mesh:health",{...A,health:$})},J0=()=>[...new Set([...W._census(),e1])].sort(),B0=()=>{if(!q)return;let $=J0().length,d=Mh($,U,J);if(d!==N)V("cellSize changed:",N,"->",d),N=d},h0=($,d)=>d.filter((X0)=>Gz(X0,R())===$),Y1=($,d)=>{if(Q===0)return[];let X0=DU($),w0=DU(d);if(X0==null||w0==null)return[];let e0=J0(),K1=h0(X0,e0),r0=h0(w0,e0),K0=Math.min(X0,w0),F0=Math.max(X0,w0),g0=(o1)=>nM(`${o1}@${K0}~${F0}`),x0=[...new Set([...K1,...r0])].sort((o1,V7)=>g0(V7)-g0(o1));if(!x0.length)return[];let Q1=new Set(K1),X1=[],S1=(o1)=>o1&&!X1.includes(o1)&&X1.push(o1);S1(x0.find((o1)=>Q1.has(o1))),S1(x0.find((o1)=>!Q1.has(o1)));for(let o1 of x0){if(X1.length>=Math.max(Q,2))break;S1(o1)}return X1},A8=($,d)=>{if(Q===0)return[];let X0=S(d),w0=[];for(let e0 of X0)if(Y1(d,e0).includes($))w0.push(e0);return w0},F1=()=>{B0();let $=J0(),d=Gz(e1,R()),X0=R(),w0=`cell-${d}`,e0=A8(e1,w0),K1=e0.length>0;return V("computeState",{self:e1,myCell:w0,isBridge:K1,bridgeEdges:e0,cellSize:N,rosterSize:$.length,totalCells:X0,dynamicTTL:_()}),{cellId:w0,isBridge:K1,bridges:e0,cellSize:N,dynamicTTL:_(),totalCells:X0}},E0=($)=>{let d=[],X0=new Set(Object.keys(W.getPeers?.()||{}));for(let[w0,e0]of C)if(e0.cell===$){let K1=D.get(w0);if(X0.has(w0)&&(!K1||!K1.isStale))d.push(w0)}return d.sort(),d},l0=()=>{if(!H)return;Q9=qW(),X6=Date.now();let $={t:"state",id:q0(),ttl:_(),data:{id:e1,cell:A.cellId,bridges:A.bridges,health:D.get(e1)?.healthScore||0.5,timestamp:Date.now()},origin:e1,originCell:A.cellId},d=JSON.stringify($);H.send(d),q1(I,d)},q1=($,d)=>{let X0=e(d);if(!X0?.id||!X0?.t)return;let w0=p.has(X0.id);if(!w0)p.add(X0.id),Q0();let{t:e0,id:K1,ttl:r0,data:K0,origin:F0,originCell:g0}=X0,x0=A.cellId;if(e0==="state"&&K0)$0(K0.id,K0.cell,K0.bridges),f("mesh:peer-state",K0);if(e0==="ping"&&K0?.pingId&&F0!==e1){let X1={t:"pong",id:q0(),ttl:_(),data:{pingId:K0.pingId,receivedAt:Date.now()},origin:e1,originCell:x0};H?.send(JSON.stringify(X1))}if(e0==="pong"&&K0?.pingId){let X1=m.get(K0.pingId);if(X1){clearTimeout(X1.timeout);let S1=Date.now()-X1.start;k0(X1.peerId,S1),X1.resolve(S1),m.delete(K0.pingId)}}if(e0==="msg"&&F0!==e1){if(g0===x0||Q>0)b(K0,F0,K1)}if(w0)return;if(!A.isBridge)return;if((r0??0)<=0)return;let Q1=(X1,S1,o1=null)=>{if(!X1)return;let V7={t:e0,id:K1,ttl:o1??(r0??_())-1,data:K0,origin:F0||e1,originCell:g0||x0},NW=JSON.stringify(V7);if(S1?.length){let JZ=new Set(Object.keys(W.getPeers?.()||{})),J9=S1.filter((kJ)=>JZ.has(kJ));if(J9.length>0)X1.send(NW,J9)}else X1.send(NW)};if($===I){for(let X1 of S(x0))Q1(d1(X1),null);return}if(!S(x0).map(VU).includes($))return;Q1(H,null);for(let X1 of S(x0))if(VU(X1)!==$)Q1(d1(X1),null)},d1=($)=>{let d=VU($);if(l.has($))return l.get($);let X0=W.channel(d);if(l.set($,X0),!G0.has(d))G0.add(d),X0.on("message",(w0)=>q1(d,w0));return X0},j8=()=>{if(!A.cellId)return;if(I=VU(A.cellId),H=W.channel(I),!G0.has(I))G0.add(I),H.on("message",($)=>q1(I,$));if(A.isBridge)for(let $ of S(A.cellId))d1($);if(c.length)for(let $ of c.splice(0)){let d={t:"msg",id:q0(),ttl:_(),data:$,origin:e1,originCell:A.cellId},X0=JSON.stringify(d);H.send(X0),q1(I,X0)}l0()},v8=($)=>{if(!A.cellId)return!0;if(!J0().includes($))return!0;let d=`cell-${Gz($,R())}`;if(d===A.cellId)return!0;if(A.bridges.includes(d))return!0;return S(A.cellId).includes(d)&&Y1(d,A.cellId).includes($)},O8=()=>{let $=W.getPeers?.()||{};for(let d of Object.keys($))if(!v8(d))$[d].close?.()};X.admit=v8;let q8=()=>{let $=F1(),d=!A.cellId||A.cellId!==$.cellId||A.isBridge!==$.isBridge||JSON.stringify(A.bridges)!==JSON.stringify($.bridges);if(A=$,$0(e1,$.cellId,$.bridges),d)j8();else l0();O8(),f("mesh:state",$),U1()},Q9="",X6=0,qW=()=>{return`${A.cellId}:${A.isBridge}:${A.bridges.join(",")}`},QZ=()=>{if(w)return;w=setInterval(()=>{let $=R();if($!==y){y=$,q8();return}let d=qW();if(d!==Q9||Date.now()-X6>1e4)l0(),Q9=d;for(let[X0,w0]of D)if(X0!==e1&&w0.isStale)C.delete(X0),D.delete(X0),V("Removed stale peer:",X0)},Ch)},n7=()=>{if(w)clearInterval(w),w=null},i=($)=>{return new Promise((d,X0)=>{let w0=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,e0=Date.now(),K1=setTimeout(()=>{m.delete(w0);let K0=D.get($);if(K0)K0.markUnresponsive();X0(Error("Ping timeout"))},Oh);m.set(w0,{start:e0,resolve:d,reject:X0,timeout:K1,peerId:$});let r0={t:"ping",id:q0(),ttl:_(),data:{pingId:w0,target:$},origin:e1,originCell:A.cellId};H?.send(JSON.stringify(r0))})};if(W.on?.("peer:join",($)=>{if(!D.has($))D.set($,new qU($));else D.get($).markReconnect();q8()}),W.on?.("peer:leave",($)=>{C.delete($),q8()}),!D.has(e1))D.set(e1,new qU(e1));return D.get(e1).addConnectedCell(A.cellId||"cell-0"),q8(),QZ(),{send:($)=>{if(!A.cellId||!H)return c.push($);let d={t:"msg",id:q0(),ttl:_(),data:$,origin:e1,originCell:A.cellId},X0=JSON.stringify(d);H.send(X0),q1(I,X0)},on:($,d)=>$==="message"?E(d):void 0,ping:i,getState:()=>({...A,cellSize:N,health:H1(A.cellId),dynamicTTL:_(),totalCells:R(),knownCells:Y0.size}),getMetrics:D0,getCellHealth:H1,getPeerInfo:()=>new Map(C),getStableRoster:()=>J0(),getKnownCells:()=>new Map(Y0),getCellSize:()=>N,destroy:()=>{n7(),m.forEach(($)=>clearTimeout($.timeout)),m.clear(),u.clear(),Y0.clear()}}}function Rh(W,G,X){let Y={},Z=oM({...W,admit:(U)=>Y.admit?.(U)??!0},G,X),V=W.overlay||{},Q=Ph(Z,V,Y),J=new Map;return{on:(U,q)=>Z.on(U,q),off:(U,q)=>Z.off?.(U,q),channel:(U)=>{if(J.has(U))return J.get(U);let q=Z.channel(U),N={send:(A,H)=>{Q.send({_ch:U,_d:A,_t:H})},on:(A,H)=>{if(A==="message")Q.on("message",(I,w)=>{if(I?._ch===U)H(I._d,w)}),q.on(A,H);else q.on(A,H)},off:(A,H)=>q.off?.(A,H),_original:q};return J.set(U,N),N},get id(){return Z.id},get peers(){return Z.peers},getPeers:()=>Z.getPeers?.()||{},mesh:Q,_room:Z,getState:()=>Q.getState(),getMetrics:(U)=>Q.getMetrics(U),getCellHealth:(U)=>Q.getCellHealth(U),getPeerInfo:()=>Q.getPeerInfo(),ping:(U)=>Q.ping(U),leave:()=>{Q.destroy(),J.clear(),Z.leave()},destroy:()=>{Q.destroy(),J.clear()}}}var Pz=(W,G,X)=>W?.cells||W?.overlay?Rh(W,G,X):oM(W,G,X);import{randomBytes as A2}from"crypto";function Lh(){var W,G=!1,X=this;X._DeArray=function(Y,Z,V){return[Y.slice(Z,Z+V)]},X._EnArray=function(Y,Z,V,Q){for(var J=0;J<V;Y[Z+J]=Q[J]?Q[J]:0,J++);},X._DeChar=function(Y,Z){return String.fromCharCode(Y[Z])},X._EnChar=function(Y,Z,V){Y[Z]=V.charCodeAt(0)},X._DeInt=function(Y,Z){var V=G?W.len-1:0,Q=G?-1:1,J=V+Q*W.len,U,q,N;for(U=0,q=V,N=1;q!=J;U+=Y[Z+q]*N,q+=Q,N*=256);if(W.bSigned&&U&Math.pow(2,W.len*8-1))U-=Math.pow(2,W.len*8);return U},X._EnInt=function(Y,Z,V){var Q=G?W.len-1:0,J=G?-1:1,U=Q+J*W.len,q;V=V<W.min?W.min:V>W.max?W.max:V;for(q=Q;q!=U;Y[Z+q]=V&255,q+=J,V>>=8);},X._DeString=function(Y,Z,V){for(var Q=Array(V),J=0;J<V;Q[J]=String.fromCharCode(Y[Z+J]),J++);return Q.join("")},X._EnString=function(Y,Z,V,Q){for(var J,U=0;U<V;Y[Z+U]=(J=Q.charCodeAt(U))?J:0,U++);},X._De754=function(Y,Z){var V,Q,J,U,q,N,A,H,I,w;A=W.mLen,H=W.len*8-W.mLen-1,w=(1<<H)-1,I=w>>1,U=G?0:W.len-1,q=G?1:-1,V=Y[Z+U],U+=q,N=-7;for(Q=V&(1<<-N)-1,V>>=-N,N+=H;N>0;Q=Q*256+Y[Z+U],U+=q,N-=8);for(J=Q&(1<<-N)-1,Q>>=-N,N+=A;N>0;J=J*256+Y[Z+U],U+=q,N-=8);switch(Q){case 0:Q=1-I;break;case w:return J?NaN:(V?-1:1)*(1/0);default:J=J+Math.pow(2,A),Q=Q-I;break}return(V?-1:1)*J*Math.pow(2,Q-A)},X._En754=function(Y,Z,V){var Q,J,U,q,N,A,H,I,w,C;if(H=W.mLen,I=W.len*8-W.mLen-1,C=(1<<I)-1,w=C>>1,Q=V<0?1:0,V=Math.abs(V),isNaN(V)||V==1/0)U=isNaN(V)?1:0,J=C;else{if(J=Math.floor(Math.log(V)/Math.LN2),V*(A=Math.pow(2,-J))<1)J--,A*=2;if(J+w>=1)V+=W.rt/A;else V+=W.rt*Math.pow(2,1-w);if(V*A>=2)J++,A/=2;if(J+w>=C)U=0,J=C;else if(J+w>=1)U=(V*A-1)*Math.pow(2,H),J=J+w;else U=V*Math.pow(2,w-1)*Math.pow(2,H),J=0}for(q=G?W.len-1:0,N=G?-1:1;H>=8;Y[Z+q]=U&255,q+=N,U/=256,H-=8);for(J=J<<H|U,I+=H;I>0;Y[Z+q]=J&255,q+=N,J/=256,I-=8);Y[Z+q-N]|=Q*128},X._DeInt64=function(Y,Z){var V=G?0:7,Q=G?1:-1,J=V+Q*8,U=[0,0,!W.bSigned],q,N,A;for(q=V,A=1,N=0;q!=J;U[A]=(U[A]<<8>>>0)+Y[Z+q],q+=Q,N++,A=N<4?1:0);return U},X._EnInt64=function(Y,Z,V){var Q=G?0:7,J=G?1:-1,U=Q+J*8,q,N,A,H;for(q=Q,A=1,N=0,H=24;q!=U;Y[Z+q]=V[A]>>H&255,q+=J,N++,A=N<4?1:0,H=24-8*(N%4));},X._sPattern="(\\d + )?([AxcbBhHsfdiIlLqQ])",X._lenLut={A:1,x:1,c:1,b:1,B:1,h:2,H:2,s:1,f:4,d:8,i:4,I:4,l:4,L:4,q:8,Q:8},X._elLut={A:{en:X._EnArray,de:X._DeArray},s:{en:X._EnString,de:X._DeString},c:{en:X._EnChar,de:X._DeChar},b:{en:X._EnInt,de:X._DeInt,len:1,bSigned:!0,min:-Math.pow(2,7),max:Math.pow(2,7)-1},B:{en:X._EnInt,de:X._DeInt,len:1,bSigned:!1,min:0,max:Math.pow(2,8)-1},h:{en:X._EnInt,de:X._DeInt,len:2,bSigned:!0,min:-Math.pow(2,15),max:Math.pow(2,15)-1},H:{en:X._EnInt,de:X._DeInt,len:2,bSigned:!1,min:0,max:Math.pow(2,16)-1},i:{en:X._EnInt,de:X._DeInt,len:4,bSigned:!0,min:-Math.pow(2,31),max:Math.pow(2,31)-1},I:{en:X._EnInt,de:X._DeInt,len:4,bSigned:!1,min:0,max:Math.pow(2,32)-1},l:{en:X._EnInt,de:X._DeInt,len:4,bSigned:!0,min:-Math.pow(2,31),max:Math.pow(2,31)-1},L:{en:X._EnInt,de:X._DeInt,len:4,bSigned:!1,min:0,max:Math.pow(2,32)-1},f:{en:X._En754,de:X._De754,len:4,mLen:23,rt:Math.pow(2,-24)-Math.pow(2,-77)},d:{en:X._En754,de:X._De754,len:8,mLen:52,rt:0},q:{en:X._EnInt64,de:X._DeInt64,bSigned:!0},Q:{en:X._EnInt64,de:X._DeInt64,bSigned:!1}},X._UnpackSeries=function(Y,Z,V,Q){for(var J=W.de,U=[],q=0;q<Y;U.push(J(V,Q+q*Z)),q++);return U},X._PackSeries=function(Y,Z,V,Q,J,U){for(var q=W.en,N=0;N<Y;q(V,Q+N*Z,J[U+N]),N++);},X.Unpack=function(Y,Z,V){G=Y.charAt(0)!="<",V=V?V:0;var Q=new RegExp(this._sPattern,"g"),J,U,q,N=[];while(J=Q.exec(Y)){if(U=J[1]==null||J[1]==""?1:parseInt(J[1]),q=this._lenLut[J[2]],V+U*q>Z.length)return;switch(J[2]){case"A":case"s":N.push(this._elLut[J[2]].de(Z,V,U));break;case"c":case"b":case"B":case"h":case"H":case"i":case"I":case"l":case"L":case"f":case"d":case"q":case"Q":W=this._elLut[J[2]],N.push(this._UnpackSeries(U,q,Z,V));break}V+=U*q}return Array.prototype.concat.apply([],N)},X.PackTo=function(Y,Z,V,Q){G=Y.charAt(0)!="<";var J=new RegExp(this._sPattern,"g"),U,q,N,A,H=0;while(U=J.exec(Y)){if(q=U[1]==null||U[1]==""?1:parseInt(U[1]),N=this._lenLut[U[2]],V+q*N>Z.length)return!1;switch(U[2]){case"A":case"s":if(H+1>Q.length)return!1;this._elLut[U[2]].en(Z,V,q,Q[H]),H+=1;break;case"c":case"b":case"B":case"h":case"H":case"i":case"I":case"l":case"L":case"f":case"d":case"q":case"Q":if(W=this._elLut[U[2]],H+q>Q.length)return!1;this._PackSeries(q,N,Z,V,Q,H),H+=q;break;case"x":for(A=0;A<q;A++)Z[V+A]=0;break}V+=q*N}return Z},X.Pack=function(Y,Z){return this.PackTo(Y,Array(this.CalcLength(Y)),0,Z)},X.CalcLength=function(Y){var Z=new RegExp(this._sPattern,"g"),V=0,Q;while(Q=Z.exec(Y))V+=(Q[1]==null||Q[1]==""?1:parseInt(Q[1]))*this._lenLut[Q[2]];return V}}var r1=new Lh;var P2=_1(YT(),1),qH=_1(gz(),1);import{createSocket as Ld}from"dgram";import{createSocket as $d}from"dgram";import*as R2 from"net";import{connect as Fd}from"net";import{createSign as xd,randomBytes as kd,webcrypto as _d}from"crypto";var Nq0=_1(xT(),1);var C7={};qA(C7,{verifySchema:()=>um,fromBER:()=>Q4,compareSchema:()=>X4,VisibleString:()=>SW,ViewWriter:()=>lZ,VideotexString:()=>TX,ValueBlock:()=>s8,Utf8String:()=>y5,UniversalString:()=>KX,UTCTime:()=>xW,TimeOfDay:()=>aU,TeletexString:()=>MX,TIME:()=>eU,Set:()=>b9,Sequence:()=>x9,Repeated:()=>zX,RelativeObjectIdentifier:()=>iU,RawData:()=>TP,PrintableString:()=>DX,Primitive:()=>w6,OctetString:()=>O7,ObjectIdentifier:()=>jX,NumericString:()=>CX,Null:()=>j7,Integer:()=>j6,IA5String:()=>PX,HexBlock:()=>w7,GraphicString:()=>RX,GeneralizedTime:()=>EX,GeneralString:()=>LX,Enumerated:()=>wX,EndOfContent:()=>oU,Duration:()=>tU,DateTime:()=>sU,DEFAULT_MAX_NODES:()=>lT,DEFAULT_MAX_DEPTH:()=>pT,DEFAULT_MAX_CONTENT_LENGTH:()=>dT,DATE:()=>rU,Constructed:()=>m8,Choice:()=>oZ,CharacterString:()=>BX,Boolean:()=>IX,BmpString:()=>OX,BitString:()=>K7,BaseStringBlock:()=>lU,BaseBlock:()=>F8,Any:()=>Z4});/*!
148
148
  * MIT License
149
149
  *
150
150
  * Copyright (c) 2017-2024 Peculiar Ventures, LLC