diff --git a/JANGAN_UPDATE b/JANGAN_UPDATE index af381488..9e3f1884 100644 --- a/JANGAN_UPDATE +++ b/JANGAN_UPDATE @@ -25,6 +25,6 @@ Jangan Update List Di Bawah Ini [-] socket.io-client: ^2.4.0 [-] swiper: ^6.8.4 [-] typeorm: ^0.2.38 -[-] webtorrent: ^1.5.8 +[-] webtorrent: ^1.9.7 (っ.❛ ᴗ ❛.)っ diff --git a/dist/main-site/browser/index.html b/dist/main-site/browser/index.html index ed8c5c38..24803edd 100644 --- a/dist/main-site/browser/index.html +++ b/dist/main-site/browser/index.html @@ -63,7 +63,7 @@ - + \ No newline at end of file diff --git a/dist/main-site/browser/ngsw.json b/dist/main-site/browser/ngsw.json index 18d2d42a..5558faed 100644 --- a/dist/main-site/browser/ngsw.json +++ b/dist/main-site/browser/ngsw.json @@ -1,6 +1,6 @@ { "configVersion": 1, - "timestamp": 1705156520459, + "timestamp": 1705245069796, "index": "/index.html", "assetGroups": [ { @@ -46,7 +46,7 @@ "/manifest.webmanifest", "/polyfills.c264b580e8a973fe.js", "/runtime.c9f751185e99b509.js", - "/scripts.6711f2f223ff3b40.js", + "/scripts.d530b24d62dab3a0.js", "/styles.b849b3eb93129b2e.css" ], "patterns": [] @@ -116,12 +116,12 @@ "/935.297c8ba9525ff76f.js": "baa0480d7f4c538c4c935a94f0a7577a9b23b246", "/common.5263fd3443c58b74.js": "0fe1dd624ebca3d737e5ec6ab8c53b228a853e67", "/favicon.ico": "071facb8fab2e4b3493dcfbb0b02d7bd21bca97e", - "/index.html": "6053d5db88527a5988c5c0ce57488028c178e6b3", + "/index.html": "d44eb8bbe9258ee86371428135918a30ae4ad51b", "/main.5624f0adecd74b72.js": "1ed143a1e0ce23f9ba32b184f683a6a249422986", "/manifest.webmanifest": "eafb5426cdc9fd714787e5453af315b9972875a3", "/polyfills.c264b580e8a973fe.js": "67f24a57563377058dfcd5306c56c0cd696ba2e5", "/runtime.c9f751185e99b509.js": "4979d1abc0e47b2aa4c6337547227e5c9eaad38d", - "/scripts.6711f2f223ff3b40.js": "35559a6d563d42afebd457f70894e90667cdd981", + "/scripts.d530b24d62dab3a0.js": "2d11a419816b2dd8d9eccaff4f113ae0eafdd306", "/styles.b849b3eb93129b2e.css": "d68b5778bdca764c5297b8067a72b676f8cce12d" }, "navigationUrls": [ diff --git a/dist/main-site/browser/scripts.6711f2f223ff3b40.js b/dist/main-site/browser/scripts.6711f2f223ff3b40.js deleted file mode 100644 index 359e0741..00000000 --- a/dist/main-site/browser/scripts.6711f2f223ff3b40.js +++ /dev/null @@ -1 +0,0 @@ -(function(Kt){var De,Le,j="hasOwnProperty",At=/[\.\/]/,kt=function(){},V=function(G,ue){return G-ue},_={n:{}},oe=function(G,ue){G=String(G);var g,Y=Le,ae=Array.prototype.slice.call(arguments,2),m=oe.listeners(G),B=0,f=[],x={},n=[],c=De;De=G,Le=0;for(var s=0,t=m.length;s',(X=se.firstChild).style.behavior="url(#default#VML)",!X||"object"!=typeof X.adj)return j.type=B;se=null}function ce(P){if("function"==typeof P||Object(P)!==P)return P;var W=new P.constructor;for(var Q in P)P[Le](Q)&&(W[Q]=ce(P[Q]));return W}j.svg=!(j.vml="VML"==j.type),j._Paper=G,j.fn=ue=G.prototype=j.prototype,j._id=0,j._oid=0,j.is=function(P,W){return"finite"==(W=c.call(W))?!Z[Le](+P):"array"==W?P instanceof Array:"null"==W&&null===P||W==typeof P&&null!==P||"object"==W&&P===Object(P)||"array"==W&&Array.isArray&&Array.isArray(P)||I.call(P).slice(8,-1).toLowerCase()==W},j.angle=function(P,W,Q,he,me,Te){if(null==me){var Se=P-Q,Oe=W-he;return Se||Oe?(180+180*u.atan2(-Oe,-Se)/d+360)%360:0}return j.angle(P,W,me,Te)-j.angle(Q,he,me,Te)},j.rad=function(P){return P%360*d/180},j.deg=function(P){return 180*P/d%360},j.snapTo=function(P,W,Q){if(Q=j.is(Q,"finite")?Q:10,j.is(P,p)){for(var he=P.length;he--;)if(o(P[he]-W)<=Q)return P[he]}else{var me=W%(P=+P);if(meP-Q)return W-me+P}return W},j.createUUID=(P=/[xy]/g,W=function(P){var W=16*u.random()|0;return("x"==P?W:3&W|8).toString(16)},function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(P,W).toUpperCase()}),j.setWindow=function(P){yn("raphael.setWindow",j,_.win,P),_.win=P,_.doc=_.win.document,j._engine.initWin&&j._engine.initWin(_.win)};var ie=function(P){if(j.vml){var Q,W=/^\s+|\s+$/g;try{var he=new ActiveXObject("htmlfile");he.write(""),he.close(),Q=he.body}catch{Q=createPopup().document.body}var me=Q.createTextRange();ie=an(function(Se){try{Q.style.color=g(Se).replace(W,B);var Oe=me.queryCommandValue("ForeColor");return"#"+("000000"+(Oe=(255&Oe)<<16|65280&Oe|(16711680&Oe)>>>16).toString(16)).slice(-6)}catch{return"none"}})}else{var Te=_.doc.createElement("i");Te.title="Rapha\xebl Colour Picker",Te.style.display="none",_.doc.body.appendChild(Te),ie=an(function(Se){return Te.style.color=Se,_.doc.defaultView.getComputedStyle(Te,B).getPropertyValue("color")})}return ie(P)},pe=function(){return"hsb("+[this.h,this.s,this.b]+")"},Ye=function(){return"hsl("+[this.h,this.s,this.l]+")"},at=function(){return this.hex},dt=function(P,W,Q){if(null==W&&j.is(P,"object")&&"r"in P&&"g"in P&&"b"in P&&(Q=P.b,W=P.g,P=P.r),null==W&&j.is(P,l)){var he=j.getRGB(P);P=he.r,W=he.g,Q=he.b}return(P>1||W>1||Q>1)&&(P/=255,W/=255,Q/=255),[P,W,Q]},Gt=function(P,W,Q,he){var me={r:P*=255,g:W*=255,b:Q*=255,hex:j.rgb(P,W,Q),toString:at};return j.is(he,"finite")&&(me.opacity=he),me};function an(P,W,Q){return function he(){var me=Array.prototype.slice.call(arguments,0),Te=me.join("\u2400"),Se=he.cache=he.cache||{},Oe=he.count=he.count||[];return Se[Le](Te)?(function Jt(P,W){for(var Q=0,he=P.length;Q=1e3&&delete Se[Oe.shift()],Oe.push(Te),Se[Te]=P[Y](W,me),Q?Q(Se[Te]):Se[Te])}}function hn(){return this.hex}function En(P,W){for(var Q=[],he=0,me=P.length;me-2*!W>he;he+=2){var Te=[{x:+P[he-2],y:+P[he-1]},{x:+P[he],y:+P[he+1]},{x:+P[he+2],y:+P[he+3]},{x:+P[he+4],y:+P[he+5]}];W?he?me-4==he?Te[3]={x:+P[0],y:+P[1]}:me-2==he&&(Te[2]={x:+P[0],y:+P[1]},Te[3]={x:+P[2],y:+P[3]}):Te[0]={x:+P[me-2],y:+P[me-1]}:me-4==he?Te[3]=Te[2]:he||(Te[0]={x:+P[he],y:+P[he+1]}),Q.push(["C",(6*Te[1].x-Te[0].x+Te[2].x)/6,(6*Te[1].y-Te[0].y+Te[2].y)/6,(Te[1].x+6*Te[2].x-Te[3].x)/6,(Te[1].y+6*Te[2].y-Te[3].y)/6,Te[2].x,Te[2].y])}return Q}j.color=function(P){var W;return j.is(P,"object")&&"h"in P&&"s"in P&&"b"in P?(W=j.hsb2rgb(P),P.r=W.r,P.g=W.g,P.b=W.b,P.hex=W.hex):j.is(P,"object")&&"h"in P&&"s"in P&&"l"in P?(W=j.hsl2rgb(P),P.r=W.r,P.g=W.g,P.b=W.b,P.hex=W.hex):(j.is(P,"string")&&(P=j.getRGB(P)),j.is(P,"object")&&"r"in P&&"g"in P&&"b"in P?(W=j.rgb2hsl(P),P.h=W.h,P.s=W.s,P.l=W.l,W=j.rgb2hsb(P),P.v=W.b):(P={hex:"none"}).r=P.g=P.b=P.h=P.s=P.v=P.l=-1),P.toString=at,P},j.hsb2rgb=function(P,W,Q,he){var me,Te,Se,Oe,qe;return this.is(P,"object")&&"h"in P&&"s"in P&&"b"in P&&(Q=P.b,W=P.s,he=(P=P.h).o),Oe=(qe=Q*W)*(1-o((P=(P*=360)%360/60)%2-1)),me=Te=Se=Q-qe,Gt(me+=[qe,Oe,0,0,Oe,qe][P=~~P],Te+=[Oe,qe,qe,Oe,0,0][P],Se+=[0,0,Oe,qe,qe,Oe][P],he)},j.hsl2rgb=function(P,W,Q,he){var me,Te,Se,Oe,qe;return this.is(P,"object")&&"h"in P&&"s"in P&&"l"in P&&(Q=P.l,W=P.s,P=P.h),(P>1||W>1||Q>1)&&(P/=360,W/=100,Q/=100),Oe=(qe=2*W*(Q<.5?Q:1-Q))*(1-o((P=(P*=360)%360/60)%2-1)),me=Te=Se=Q-qe/2,Gt(me+=[qe,Oe,0,0,Oe,qe][P=~~P],Te+=[Oe,qe,qe,Oe,0,0][P],Se+=[0,0,Oe,qe,qe,Oe][P],he)},j.rgb2hsb=function(P,W,Q){var Te,Se;return Q=dt(P,W,Q),{h:((0==(Se=(Te=s(P=Q[0],W=Q[1],Q=Q[2]))-t(P,W,Q))?null:Te==P?(W-Q)/Se:Te==W?(Q-P)/Se+2:(P-W)/Se+4)+360)%6*60/360,s:0==Se?0:Se/Te,b:Te,toString:pe}},j.rgb2hsl=function(P,W,Q){var Te,Se,Oe,qe;return Q=dt(P,W,Q),Te=((Se=s(P=Q[0],W=Q[1],Q=Q[2]))+(Oe=t(P,W,Q)))/2,{h:((0==(qe=Se-Oe)?null:Se==P?(W-Q)/qe:Se==W?(Q-P)/qe+2:(P-W)/qe+4)+360)%6*60/360,s:0==qe?0:Te<.5?qe/(2*Te):qe/(2-2*Te),l:Te,toString:Ye}},j._path2string=function(){return this.join(",").replace(J,"$1")},j._preload=function(P,W){var Q=_.doc.createElement("img");Q.style.cssText="position:absolute;left:-9999em;top:-9999em",Q.onload=function(){W.call(this),this.onload=null,_.doc.body.removeChild(this)},Q.onerror=function(){_.doc.body.removeChild(this)},_.doc.body.appendChild(Q),Q.src=P},j.getRGB=an(function(P){if(!P||(P=g(P)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:hn};if("none"==P)return{r:-1,g:-1,b:-1,hex:"none",toString:hn};!ee[Le](P.toLowerCase().substring(0,2))&&"#"!=P.charAt()&&(P=ie(P));var Q,he,me,Te,Se,Oe,qe=P.match(q);return qe?(qe[2]&&(me=L(qe[2].substring(5),16),he=L(qe[2].substring(3,5),16),Q=L(qe[2].substring(1,3),16)),qe[3]&&(me=L((Se=qe[3].charAt(3))+Se,16),he=L((Se=qe[3].charAt(2))+Se,16),Q=L((Se=qe[3].charAt(1))+Se,16)),qe[4]&&(Oe=qe[4][f](U),Q=A(Oe[0]),"%"==Oe[0].slice(-1)&&(Q*=2.55),he=A(Oe[1]),"%"==Oe[1].slice(-1)&&(he*=2.55),me=A(Oe[2]),"%"==Oe[2].slice(-1)&&(me*=2.55),"rgba"==qe[1].toLowerCase().slice(0,4)&&(Te=A(Oe[3])),Oe[3]&&"%"==Oe[3].slice(-1)&&(Te/=100)),qe[5]?(Oe=qe[5][f](U),Q=A(Oe[0]),"%"==Oe[0].slice(-1)&&(Q*=2.55),he=A(Oe[1]),"%"==Oe[1].slice(-1)&&(he*=2.55),me=A(Oe[2]),"%"==Oe[2].slice(-1)&&(me*=2.55),("deg"==Oe[0].slice(-3)||"\xb0"==Oe[0].slice(-1))&&(Q/=360),"hsba"==qe[1].toLowerCase().slice(0,4)&&(Te=A(Oe[3])),Oe[3]&&"%"==Oe[3].slice(-1)&&(Te/=100),j.hsb2rgb(Q,he,me,Te)):qe[6]?(Oe=qe[6][f](U),Q=A(Oe[0]),"%"==Oe[0].slice(-1)&&(Q*=2.55),he=A(Oe[1]),"%"==Oe[1].slice(-1)&&(he*=2.55),me=A(Oe[2]),"%"==Oe[2].slice(-1)&&(me*=2.55),("deg"==Oe[0].slice(-3)||"\xb0"==Oe[0].slice(-1))&&(Q/=360),"hsla"==qe[1].toLowerCase().slice(0,4)&&(Te=A(Oe[3])),Oe[3]&&"%"==Oe[3].slice(-1)&&(Te/=100),j.hsl2rgb(Q,he,me,Te)):((qe={r:Q,g:he,b:me,toString:hn}).hex="#"+(16777216|me|he<<8|Q<<16).toString(16).slice(1),j.is(Te,"finite")&&(qe.opacity=Te),qe)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:hn}},j),j.hsb=an(function(P,W,Q){return j.hsb2rgb(P,W,Q).hex}),j.hsl=an(function(P,W,Q){return j.hsl2rgb(P,W,Q).hex}),j.rgb=an(function(P,W,Q){return"#"+(16777216|Q|W<<8|P<<16).toString(16).slice(1)}),j.getColor=function(P){var W=this.getColor.start=this.getColor.start||{h:0,s:1,b:P||.75},Q=this.hsb2rgb(W.h,W.s,W.b);return W.h+=.075,W.h>1&&(W.h=0,W.s-=.2,W.s<=0&&(this.getColor.start={h:0,s:1,b:W.b})),Q.hex},j.getColor.reset=function(){delete this.start},j.parsePathString=function(P){if(!P)return null;var W=Xn(P);if(W.arr)return Xe(W.arr);var Q={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},he=[];return j.is(P,p)&&j.is(P[0],p)&&(he=Xe(P)),he.length||g(P).replace(re,function(me,Te,Se){var Oe=[],qe=Te.toLowerCase();if(Se.replace(We,function(yt,jt){jt&&Oe.push(+jt)}),"m"==qe&&Oe.length>2&&(he.push([Te][ae](Oe.splice(0,2))),qe="l",Te="m"==Te?"l":"L"),"r"==qe)he.push([Te][ae](Oe));else for(;Oe.length>=Q[qe]&&(he.push([Te][ae](Oe.splice(0,Q[qe]))),Q[qe]););}),he.toString=j._path2string,W.arr=Xe(he),he},j.parseTransformString=an(function(P){if(!P)return null;var Q=[];return j.is(P,p)&&j.is(P[0],p)&&(Q=Xe(P)),Q.length||g(P).replace(Ue,function(he,me,Te){var Se=[];c.call(me),Te.replace(We,function(qe,yt){yt&&Se.push(+yt)}),Q.push([me][ae](Se))}),Q.toString=j._path2string,Q});var Xn=function(P){var W=Xn.ps=Xn.ps||{};return W[P]?W[P].sleep=100:W[P]={sleep:100},setTimeout(function(){for(var Q in W)W[Le](Q)&&Q!=P&&(W[Q].sleep--,!W[Q].sleep&&delete W[Q])}),W[P]};function An(P,W,Q,he,me){return P*(P*(-3*W+9*Q-9*he+3*me)+6*W-12*Q+6*he)-3*W+3*Q}function Pn(P,W,Q,he,me,Te,Se,Oe,qe){null==qe&&(qe=1);for(var yt=(qe=qe>1?1:qe<0?0:qe)/2,ot=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],lt=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],Dt=0,Yt=0;Yt<12;Yt++){var Tt=yt*ot[Yt]+yt,zt=An(Tt,P,Q,me,Se),Pt=An(Tt,W,he,Te,Oe);Dt+=lt[Yt]*u.sqrt(zt*zt+Pt*Pt)}return yt*Dt}function Mt(P,W,Q,he,me,Te,Se,Oe){if(!(s(P,Q)s(me,Se)||s(W,he)s(Te,Oe))){var jt=(P-Q)*(Te-Oe)-(W-he)*(me-Se);if(jt){var ot=((P*he-W*Q)*(me-Se)-(P-Q)*(me*Oe-Te*Se))/jt,lt=((P*he-W*Q)*(Te-Oe)-(W-he)*(me*Oe-Te*Se))/jt,Dt=+ot.toFixed(2),Yt=+lt.toFixed(2);if(!(Dt<+t(P,Q).toFixed(2)||Dt>+s(P,Q).toFixed(2)||Dt<+t(me,Se).toFixed(2)||Dt>+s(me,Se).toFixed(2)||Yt<+t(W,he).toFixed(2)||Yt>+s(W,he).toFixed(2)||Yt<+t(Te,Oe).toFixed(2)||Yt>+s(Te,Oe).toFixed(2)))return{x:ot,y:lt}}}}function Re(P,W,Q){var he=j.bezierBBox(P),me=j.bezierBBox(W);if(!j.isBBoxIntersect(he,me))return Q?0:[];for(var Te=Pn.apply(0,P),Se=Pn.apply(0,W),Oe=s(~~(Te/5),1),qe=s(~~(Se/5),1),yt=[],jt=[],ot={},lt=Q?0:[],Dt=0;Dt=0&&br<=1.001&&tr>=0&&tr<=1.001&&(Q?lt++:lt.push({x:vr.x,y:vr.y,t1:t(br,1),t2:t(tr,1)}))}}return lt}function je(P,W,Q){P=j._path2curve(P),W=j._path2curve(W);for(var he,me,Te,Se,Oe,qe,yt,jt,ot,lt,Dt=Q?0:[],Yt=0,Tt=P.length;Ytdn||Pt=P.x&&W<=P.x2&&Q>=P.y&&Q<=P.y2},j.isBBoxIntersect=function(P,W){var Q=j.isPointInsideBBox;return Q(W,P.x,P.y)||Q(W,P.x2,P.y)||Q(W,P.x,P.y2)||Q(W,P.x2,P.y2)||Q(P,W.x,W.y)||Q(P,W.x2,W.y)||Q(P,W.x,W.y2)||Q(P,W.x2,W.y2)||(P.xW.x||W.xP.x)&&(P.yW.y||W.yP.y)},j.pathIntersection=function(P,W){return je(P,W)},j.pathIntersectionNumber=function(P,W){return je(P,W,1)},j.isPointInsidePath=function(P,W,Q){var he=j.pathBBox(P);return j.isPointInsideBBox(he,W,Q)&&je(P,[["M",W,Q],["H",he.x2+10]],1)%2==1},j._removedFactory=function(P){return function(){yn("raphael.log",null,"Rapha\xebl: you are calling to method \u201c"+P+"\u201d of removed object",P)}};var Ze=j.pathBBox=function(P){var W=Xn(P);if(W.bbox)return ce(W.bbox);if(!P)return{x:0,y:0,width:0,height:0,x2:0,y2:0};for(var Se,Q=0,he=0,me=[],Te=[],Oe=0,qe=(P=Qt(P)).length;Oe1&&(Q*=rn=u.sqrt(rn),he*=rn);var un=Q*Q,jn=he*he,vr=(Te==Se?-1:1)*u.sqrt(o((un*jn-un*dn*dn-jn*Pt*Pt)/(un*dn*dn+jn*Pt*Pt))),br=vr*Q*dn/he+(P+Oe)/2,tr=vr*-he*Pt/Q+(W+qe)/2,nr=u.asin(((W-tr)/he).toFixed(9)),rr=u.asin(((qe-tr)/he).toFixed(9));(nr=Prr&&(nr-=2*d),!Se&&rr>nr&&(rr-=2*d)}var Jr=rr-nr;if(o(Jr)>jt){var ze=rr,Et=Oe,Wt=qe;Oe=br+Q*u.cos(rr=nr+jt*(Se&&rr>nr?1:-1)),qe=tr+he*u.sin(rr),lt=nn(Oe,qe,Q,he,me,0,Se,Et,Wt,[rr,ze,br,tr])}Jr=rr-nr;var ln=u.cos(nr),$n=u.sin(nr),Fe=u.cos(rr),Ce=u.sin(rr),_t=u.tan(Jr/4),xt=4/3*Q*_t,on=4/3*he*_t,kn=[P,W],pn=[P+xt*$n,W-on*ln],Sn=[Oe+xt*Ce,qe-on*Fe],bn=[Oe,qe];if(pn[0]=2*kn[0]-pn[0],pn[1]=2*kn[1]-pn[1],yt)return[pn,Sn,bn][ae](lt);for(var Ln=[],Wn=0,dr=(lt=[pn,Sn,bn][ae](lt).join()[f](",")).length;Wn"1e12"&&(ot=.5),o(lt)>"1e12"&&(lt=.5),ot>0&&ot<1&&(Tt=_n(P,W,Q,he,me,Te,Se,Oe,ot),Yt.push(Tt.x),Dt.push(Tt.y)),lt>0&<<1&&(Tt=_n(P,W,Q,he,me,Te,Se,Oe,lt),Yt.push(Tt.x),Dt.push(Tt.y)),ot=(-(yt=2*(he-W)-2*(Te-he))+u.sqrt(yt*yt-4*(qe=Te-2*he+W-(Oe-2*Te+he))*(jt=W-he)))/2/qe,lt=(-yt-u.sqrt(yt*yt-4*qe*jt))/2/qe,o(ot)>"1e12"&&(ot=.5),o(lt)>"1e12"&&(lt=.5),ot>0&&ot<1&&(Tt=_n(P,W,Q,he,me,Te,Se,Oe,ot),Yt.push(Tt.x),Dt.push(Tt.y)),lt>0&<<1&&(Tt=_n(P,W,Q,he,me,Te,Se,Oe,lt),Yt.push(Tt.x),Dt.push(Tt.y)),{min:{x:t[Y](0,Yt),y:t[Y](0,Dt)},max:{x:s[Y](0,Yt),y:s[Y](0,Dt)}}}),Qt=j._path2curve=an(function(P,W){var Q=!W&&Xn(P);if(!W&&Q.curve)return Xe(Q.curve);for(var he=tn(P),me=W&&tn(W),Te={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},Se={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},Oe=function(zt,Pt,dn){var rn,un;if(!zt)return["C",Pt.x,Pt.y,Pt.x,Pt.y,Pt.x,Pt.y];switch(!(zt[0]in{T:1,Q:1})&&(Pt.qx=Pt.qy=null),zt[0]){case"M":Pt.X=zt[1],Pt.Y=zt[2];break;case"A":zt=["C"][ae](nn[Y](0,[Pt.x,Pt.y][ae](zt.slice(1))));break;case"S":"C"==dn||"S"==dn?(rn=2*Pt.x-Pt.bx,un=2*Pt.y-Pt.by):(rn=Pt.x,un=Pt.y),zt=["C",rn,un][ae](zt.slice(1));break;case"T":"Q"==dn||"T"==dn?(Pt.qx=2*Pt.x-Pt.qx,Pt.qy=2*Pt.y-Pt.qy):(Pt.qx=Pt.x,Pt.qy=Pt.y),zt=["C"][ae](qt(Pt.x,Pt.y,Pt.qx,Pt.qy,zt[1],zt[2]));break;case"Q":Pt.qx=zt[1],Pt.qy=zt[2],zt=["C"][ae](qt(Pt.x,Pt.y,zt[1],zt[2],zt[3],zt[4]));break;case"L":zt=["C"][ae](Bt(Pt.x,Pt.y,zt[1],zt[2]));break;case"H":zt=["C"][ae](Bt(Pt.x,Pt.y,zt[1],Pt.y));break;case"V":zt=["C"][ae](Bt(Pt.x,Pt.y,Pt.x,zt[1]));break;case"Z":zt=["C"][ae](Bt(Pt.x,Pt.y,Pt.X,Pt.Y))}return zt},qe=function(zt,Pt){if(zt[Pt].length>7){zt[Pt].shift();for(var dn=zt[Pt];dn.length;)zt.splice(Pt++,0,["C"][ae](dn.splice(0,6)));zt.splice(Pt,1),ot=s(he.length,me&&me.length||0)}},yt=function(zt,Pt,dn,rn,un){zt&&Pt&&"M"==zt[un][0]&&"M"!=Pt[un][0]&&(Pt.splice(un,0,["M",rn.x,rn.y]),dn.bx=0,dn.by=0,dn.x=zt[un][1],dn.y=zt[un][2],ot=s(he.length,me&&me.length||0))},jt=0,ot=s(he.length,me&&me.length||0);jt.01;)lt=Pn(P,W,Q,he,me,Te,Se,Oe,ot+=(lthe){if(W&&!jt.start){if(yt+=["C"+(ot=Gr(Te,Se,Oe[1],Oe[2],Oe[3],Oe[4],Oe[5],Oe[6],he-lt)).start.x,ot.start.y,ot.m.x,ot.m.y,ot.x,ot.y],me)return yt;jt.start=yt,yt=["M"+ot.x,ot.y+"C"+ot.n.x,ot.n.y,ot.end.x,ot.end.y,Oe[5],Oe[6]].join(),lt+=qe,Te=+Oe[5],Se=+Oe[6];continue}if(!P&&!W)return{x:(ot=Gr(Te,Se,Oe[1],Oe[2],Oe[3],Oe[4],Oe[5],Oe[6],he-lt)).x,y:ot.y,alpha:ot.alpha}}lt+=qe,Te=+Oe[5],Se=+Oe[6]}yt+=Oe.shift()+Oe}return jt.end=yt,(ot=P?lt:W?jt:j.findDotsAtSegment(Te,Se,Oe[0],Oe[1],Oe[2],Oe[3],Oe[4],Oe[5],1)).alpha&&(ot={x:ot.x,y:ot.y,alpha:ot.alpha}),ot}},Zr=Dr(1),si=Dr(),yi=Dr(0,1);j.getTotalLength=Zr,j.getPointAtLength=si,j.getSubpath=function(P,W,Q){if(this.getTotalLength(P)-Q<1e-6)return yi(P,W).end;var he=yi(P,Q,1);return W?yi(he,W).end:he},hr.getTotalLength=function(){var P=this.getPath();if(P)return this.node.getTotalLength?this.node.getTotalLength():Zr(P)},hr.getPointAtLength=function(P){var W=this.getPath();if(W)return si(W,P)},hr.getPath=function(){var P,W=j._getPath[this.type];if("text"!=this.type&&"set"!=this.type)return W&&(P=W(this)),P},hr.getSubpath=function(P,W){var Q=this.getPath();if(Q)return j.getSubpath(Q,P,W)};var Br=j.easing_formulas={linear:function(P){return P},"<":function(P){return r(P,1.7)},">":function(P){return r(P,.48)},"<>":function(P){var W=.48-P/1.04,Q=u.sqrt(.1734+W*W),he=Q-W,Te=-Q-W,Oe=r(o(he),1/3)*(he<0?-1:1)+r(o(Te),1/3)*(Te<0?-1:1)+.5;return 3*(1-Oe)*Oe*Oe+Oe*Oe*Oe},backIn:function(P){var W=1.70158;return P*P*((W+1)*P-W)},backOut:function(P){var W=1.70158;return(P-=1)*P*((W+1)*P+W)+1},elastic:function(P){return P==!!P?P:r(2,-10*P)*u.sin(2*d*(P-.075)/.3)+1},bounce:function(P){var W=7.5625,Q=2.75;return P<1/Q?W*P*P:P<2/Q?W*(P-=1.5/Q)*P+.75:P<2.5/Q?W*(P-=2.25/Q)*P+.9375:W*(P-=2.625/Q)*P+.984375}};Br.easeIn=Br["ease-in"]=Br["<"],Br.easeOut=Br["ease-out"]=Br[">"],Br.easeInOut=Br["ease-in-out"]=Br["<>"],Br["back-in"]=Br.backIn,Br["back-out"]=Br.backOut;var Jn=[],_r=Kt.requestAnimationFrame||Kt.webkitRequestAnimationFrame||Kt.mozRequestAnimationFrame||Kt.oRequestAnimationFrame||Kt.msRequestAnimationFrame||function(P){setTimeout(P,16)},Wi=function(){for(var P=+new Date,W=0;W1&&!Q.next){for(Yt in qe)qe[Le](Yt)&&(Dt[Yt]=Q.totalOrigin[Yt]);Q.el.attr(Dt),ki(Q.anim,Q.el,Q.anim.percents[0],null,Q.totalOrigin,Q.repeat-1)}Q.next&&!Q.stop&&ki(Q.anim,Q.el,Q.next,null,Q.totalOrigin,Q.repeat)}}}j.svg&&jt&&jt.paper&&jt.paper.safari(),Jn.length&&_r(Wi)},qi=function(P){return P>255?255:P<0?0:P};function _i(P,W){var Q=[],he={};if(this.ms=W,this.times=1,P){for(var me in P)P[Le](me)&&(he[A(me)]=P[me],Q.push(A(me)));Q.sort(Xt)}this.anim=he,this.top=Q[Q.length-1],this.percents=Q}function ki(P,W,Q,he,me,Te){Q=A(Q);var Se,Oe,qe,jt,ot,lt,Dt=P.ms,Yt={},Tt={},zt={};if(he)for(dn=0,rn=Jn.length;dnhe*P.top){Dt=Dt/P.top*((Q=P.percents[dn])-(ot=P.percents[dn-1]||0)),jt=P.percents[dn+1],Se=P.anim[Q];break}he&&W.attr(P.anim[P.percents[dn]])}if(Se){if(Oe)Oe.initstatus=he,Oe.start=new Date-Oe.ms*he;else{for(var un in Se)if(Se[Le](un)&&(C[Le](un)||W.paper.customAttributes[Le](un)))switch(Yt[un]=W.attr(un),null==Yt[un]&&(Yt[un]=y[un]),Tt[un]=Se[un],C[un]){case h:zt[un]=(Tt[un]-Yt[un])/Dt;break;case"colour":Yt[un]=j.getRGB(Yt[un]);var jn=j.getRGB(Tt[un]);zt[un]={r:(jn.r-Yt[un].r)/Dt,g:(jn.g-Yt[un].g)/Dt,b:(jn.b-Yt[un].b)/Dt};break;case"path":var vr=Qt(Yt[un],Tt[un]),br=vr[1];for(Yt[un]=vr[0],zt[un]=[],dn=0,rn=Yt[un].length;dn(dn=1))return dn;for(;Ptun?Pt=rn:dn=rn,rn=(dn-Pt)/2+Pt}return rn}(Tt,zt);return((ot*Pt+jt)*Pt+yt)*Pt}(P,1/(200*Te))}(_t,+Ce[1],+Ce[2],+Ce[3],+Ce[4],Dt)}}else Fe=Ft;if(Pt={anim:P,percent:Q,timestamp:lt=Se.start||P.start||+new Date,start:lt+(P.del||0),status:0,initstatus:he||0,stop:!1,ms:Dt,easing:Fe,from:Yt,diff:zt,to:Tt,el:W,callback:Se.callback,prev:ot,next:jt,repeat:Te||P.times,origin:W.attr(),totalOrigin:me},Jn.push(Pt),he&&!Oe&&!qe&&(Pt.stop=!0,Pt.start=new Date-Dt*he,1==Jn.length))return Wi();qe&&(Pt.start=new Date-Pt.ms*he),1==Jn.length&&_r(Wi)}yn("raphael.anim.start."+W.id,W,P)}}function Pi(P){for(var W=0;W.5)-1;Oe($n-.5,2)+Oe(Fe-.5,2)>.25&&(Fe=me.sqrt(.25-Oe($n-.5,2))*ur+.5)&&.5!=Fe&&(Fe=Fe.toFixed(5)-1e-5*ur)}return""})).split(/\s*\-\s*/),"linear"==Wt){var kn=Et.shift();if(kn=-Q(kn),isNaN(kn))return null;var pn=[0,0,me.cos(j.rad(kn)),me.sin(j.rad(kn))],Sn=1/(Te(Se(pn[2]),Se(pn[3]))||1);pn[2]*=Sn,pn[3]*=Sn,pn[2]<0&&(pn[0]=-pn[2],pn[2]=0),pn[3]<0&&(pn[1]=-pn[3],pn[3]=0)}var bn=j._parseDots(Et);if(!bn)return null;if(ln=ln.replace(/[\(\)\s,\xb0#]/g,"_"),ze.gradient&&ln!=ze.gradient.id&&(_t.defs.removeChild(ze.gradient),delete ze.gradient),!ze.gradient){on=Tt(Wt+"Gradient",{id:ln}),ze.gradient=on,Tt(on,"radial"==Wt?{fx:$n,fy:Fe}:{x1:pn[0],y1:pn[1],x2:pn[2],y2:pn[3],gradientTransform:ze.matrix.invert()}),_t.defs.appendChild(on);for(var Ln=0,Wn=bn.length;Ln1?er.opacity/100:er.opacity});case"stroke":er=j.getRGB(Ce),Wt.setAttribute(Fe,er.hex),"stroke"==Fe&&er[P]("opacity")&&Tt(Wt,{"stroke-opacity":er.opacity>1?er.opacity/100:er.opacity}),"stroke"==Fe&&ze._.arrows&&("startString"in ze._.arrows&&dn(ze,ze._.arrows.startString),"endString"in ze._.arrows&&dn(ze,ze._.arrows.endString,1));break;case"gradient":("circle"==ze.type||"ellipse"==ze.type||"r"!=W(Ce).charAt())&&zt(ze,Ce);break;case"opacity":ln.gradient&&!ln[P]("stroke-opacity")&&Tt(Wt,{"stroke-opacity":Ce>1?Ce/100:Ce});case"fill-opacity":if(ln.gradient){(xr=j._g.doc.getElementById(Wt.getAttribute("fill").replace(/^url\(#|\)$/g,"")))&&(ur=xr.getElementsByTagName("stop"),Tt(ur[ur.length-1],{"stop-opacity":Ce}));break}default:"font-size"==Fe&&(Ce=he(Ce,10)+"px");var Er=Fe.replace(/(\-.)/g,function(pr){return pr.substring(1).toUpperCase()});Wt.style[Er]=Ce,ze._.dirty=1,Wt.setAttribute(Fe,Ce)}}br(ze,Et),Wt.style.visibility=$n},br=function(ze,Et){if("text"==ze.type&&(Et[P]("text")||Et[P]("font")||Et[P]("font-size")||Et[P]("x")||Et[P]("y"))){var Wt=ze.attrs,ln=ze.node,$n=ln.firstChild?he(j._g.doc.defaultView.getComputedStyle(ln.firstChild,"").getPropertyValue("font-size"),10):10;if(Et[P]("text")){for(Wt.text=Et.text;ln.firstChild;)ln.removeChild(ln.firstChild);for(var _t,Fe=W(Et.text).split("\n"),Ce=[],xt=0,on=Fe.length;xt"));var bi=Ki.getBoundingClientRect();bn.W=xt.w=(bi.right-bi.left)/100,bn.H=xt.h=(bi.bottom-bi.top)/100,bn.X=xt.x,bn.Y=xt.y+bn.H/2,("x"in Ce||"y"in Ce)&&(bn.path.v=j.format("m{0},{1}l{2},{1}",me(xt.x*rn),me(xt.y*rn),me(xt.x*rn)+1));for(var Si=["x","y","text","font","font-family","font-weight","font-style","font-size"],ai=0,Mi=Si.length;ai.25&&(pr=he.sqrt(.25-on(Er-.5,2))*(2*(pr>.5)-1)+.5),bn=Er+lt+pr),""})).split(/\s*\-\s*/),"linear"==Sn){var Ln=Ce.shift();if(Ln=-Q(Ln),isNaN(Ln))return null}var Wn=j._parseDots(Ce);if(!Wn)return null;if(Fe=Fe.shape||Fe.node,Wn.length){Fe.removeChild(_t),_t.on=!0,_t.method="none",_t.color=Wn[0].color,_t.color2=Wn[Wn.length-1].color;for(var dr=[],er=0,xr=Wn.length;er')}}catch{Wt=function(xt){return Ce.createElement("<"+xt+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},j._engine.initWin(j._g.win),j._engine.create=function(){var Fe=j._getContainer.apply(0,arguments),Ce=Fe.container,_t=Fe.height,on=Fe.width,kn=Fe.x,pn=Fe.y;if(!Ce)throw new Error("VML container not found.");var Sn=new j._Paper,bn=Sn.canvas=j._g.doc.createElement("div"),Ln=bn.style;return kn=kn||0,pn=pn||0,_t=_t||342,Sn.width=on=on||512,Sn.height=_t,on==+on&&(on+="px"),_t==+_t&&(_t+="px"),Sn.coordsize=1e3*rn+lt+1e3*rn,Sn.coordorigin="0 0",Sn.span=j._g.doc.createElement("span"),Sn.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",bn.appendChild(Sn.span),Ln.cssText=j.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",on,_t),1==Ce?(j._g.doc.body.appendChild(bn),Ln.left=kn+"px",Ln.top=pn+"px",Ln.position="absolute"):Ce.firstChild?Ce.insertBefore(bn,Ce.firstChild):Ce.appendChild(bn),Sn.renderfix=function(){},Sn},j.prototype.clear=function(){j.eve("raphael.clear",this),this.canvas.innerHTML="",this.span=j._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},j.prototype.remove=function(){for(var Fe in j.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas),this)this[Fe]="function"==typeof this[Fe]?j._removedFactory(Fe):null;return!0};var ln=j.st;for(var $n in Et)Et[P]($n)&&!ln[P]($n)&&(ln[$n]=function(Fe){return function(){var Ce=arguments;return this.forEach(function(_t){_t[Fe].apply(_t,Ce)})}}($n))}}(),oe.was?_.win.Raphael=j:Raphael=j,j}),function(){"use strict";var Kt=function(oe,G){if(this.text=oe,this.options=_(Le(Kt.default),G),this.strokes=[],this.papers=[],this.pointer=0,this.timeouts={play:[],erasing:[],drawing:[]},!this.options.skipLoad){var ue=new DmakLoader(this.options.uri),ve=this;ue.load(oe,function(Y){ve.prepare(Y),ve.options.loaded(ve.strokes),ve.options.autoplay&&ve.render()})}};function wt(oe,G,ue){null!==oe.object.text&&oe.object.text.remove();var ve=function(){oe.object.path.remove(),oe.object={path:null,text:null},G.shift()};ue.stroke.animated.erasing?(oe.object.path.node.style.stroke=ue.stroke.attr.active,G.push(De(oe,-1,ue,ve))):ve()}function De(oe,G,ue,ve){return oe.object.path.attr({stroke:ue.stroke.attr.active}),oe.object.path.node.style.transition=oe.object.path.node.style.WebkitTransition="none",oe.object.path.node.style.strokeDasharray=oe.length+" "+oe.length,oe.object.path.node.style.strokeDashoffset=G>0?oe.length:0,oe.object.path.node.getBoundingClientRect(),oe.object.path.node.style.transition=oe.object.path.node.style.WebkitTransition="stroke-dashoffset "+oe.duration+"ms ease",oe.object.path.node.style.strokeDashoffset=G>0?"0":oe.length,setTimeout(ve,oe.duration)}function Le(oe){if(null===oe||"object"!=typeof oe)return oe;var G=oe.constructor();for(var ue in oe)G[ue]=Le(oe[ue]);return G}function _(oe,G){if(2!==arguments.length)throw new Error("Missing arguments in assign function");for(var ue in oe)G.hasOwnProperty(ue)&&(oe[ue]="object"==typeof G[ue]?_(oe[ue],G[ue]):G[ue]);return oe}Kt.VERSION="0.2.0",Kt.default={uri:"",skipLoad:!1,autoplay:!0,height:109,width:109,viewBox:{x:0,y:0,w:109,h:109},step:.03,element:"draw",stroke:{animated:{drawing:!0,erasing:!0},order:{visible:!1,attr:{"font-size":"8",fill:"#999999"}},attr:{active:"#BF0000",stroke:"#2C2C2C","stroke-width":4,"stroke-linecap":"round","stroke-linejoin":"round"}},grid:{show:!0,attr:{stroke:"#CCCCCC","stroke-width":.5,"stroke-dasharray":"--"}},loaded:function(){},erased:function(){},drew:function(){}},Kt.fn=Kt.prototype={prepare:function(oe){this.strokes=function yn(oe,G){var Y,ae,m,ue=[];for(ae=0;ae"u"&&(oe=0);do{this.pointer--,wt(this.strokes[this.pointer],this.timeouts.erasing,this.options),this.options.erased(this.pointer)}while(this.pointer>oe)},render:function(oe){if(this.timeouts.play.length)return!1;if(typeof oe>"u")oe=this.strokes.length;else if(oe>this.strokes.length)return!1;var ve,G=function(Y){(function kt(oe,G,ue,ve){var Y=function(){if(null!==G.object.path){var ae=ve.stroke.attr.stroke;"random"===ve.stroke.attr.stroke&&(ae=Raphael.getColor()),G.object.path.node.style.stroke=ae,G.object.path.node.style.transition=G.object.path.node.style.WebkitTransition="stroke 400ms ease",ue.shift()}};G.object.path=oe.path(G.path),G.object.path.attr(ve.stroke.attr),ve.stroke.order.visible&&function V(oe,G,ue){G.object.text=oe.text(G.text.x,G.text.y,G.text.value),G.object.text.attr(ue.stroke.order.attr)}(oe,G,ve),ve.stroke.animated.drawing?De(G,1,ve,Y):Y()})(Y.papers[Y.strokes[Y.pointer].char],Y.strokes[Y.pointer],Y.timeouts.drawing,Y.options),Y.options.drew(Y.pointer),Y.pointer++,Y.timeouts.play.shift()},ue=0;for(ve=0;ve=oe)&&ue.push(ae);if(G&&ue.length>0&&oe60)console.info("seeked back too far, cleaning prerender buffer"),ue=[];else{console.info("seeked backwards, need to free up some buffer");var m=0,B=.3*j.renderAhead,i=[];for(ve=0,Y=ue.length;ve=B)break;i.push(ae)}ue=i}var g=ue.length"u"){if(!j.video)return;oe=j.video.currentTime+j.timeOffset}for(var ue=0,ve=0,Y=j.renderedItems.length;ve=ae.eventStart&&oeoe))kt(m,oe),ue=!0,G=m.emptyFinish;else if(G>=0){if(!(m.eventStart-G<.01))break;G=m.emptyFinish,ve=m.animated}}ue?At(oe)&&G>=0&&wt(G,ve):Math.abs(j.oneshotState.requestNextTimestamp-oe)>.01&&(At(oe),wt(oe,!0))}}function De(){var oe=j.renderFramesData,G=performance.now();j.ctx.clearRect(0,0,j.canvas.width,j.canvas.height);for(var ue=0;ue=1?Y[ae]:1;var m=new ImageData(Y,ve.w,ve.h);j.bufferCanvasCtx.putImageData(m,0,0),j.ctx.drawImage(j.bufferCanvas,ve.x,ve.y)}if(j.debug){var B=Math.round(performance.now()-G),i=oe.blendTime;console.log(typeof i<"u"?"render: "+Math.round(oe.spentTime-i)+" ms, blend: "+Math.round(i)+" ms, draw: "+B+" ms; TOTAL="+Math.round(oe.spentTime+B)+" ms":Math.round(oe.spentTime)+" ms (+ "+B+" ms draw)"),j.renderStart=performance.now()}}function Le(){var oe=j.renderFramesData,G=performance.now();j.ctx.clearRect(0,0,j.canvas.width,j.canvas.height);for(var ue=0;ue0,dropAllAnimations:j.dropAllAnimations})):j.workerError("worker not supported")},j.createCanvas=function(){j.canvas||(j.video?(j.isOurCanvas=!0,j.canvas=document.createElement("canvas"),j.canvas.className="libassjs-canvas",j.canvas.style.display="none",j.canvasParent=document.createElement("div"),j.canvasParent.className="libassjs-canvas-parent",j.canvasParent.appendChild(j.canvas),j.video.nextSibling?j.video.parentNode.insertBefore(j.canvasParent,j.video.nextSibling):j.video.parentNode.appendChild(j.canvasParent)):j.canvas||j.workerError("Don't know where to render: you should give video or canvas in options.")),j.ctx=j.canvas.getContext("2d"),j.bufferCanvas=document.createElement("canvas"),j.bufferCanvasCtx=j.bufferCanvas.getContext("2d"),j.bufferCanvas.width=1,j.bufferCanvas.height=1;var oe=new Uint8ClampedArray([0,255,0,0]),G=new ImageData(oe,1,1);j.bufferCanvasCtx.clearRect(0,0,1,1),j.ctx.clearRect(0,0,1,1);var ue=j.ctx.getImageData(0,0,1,1).data;j.bufferCanvasCtx.putImageData(G,0,0),j.ctx.drawImage(j.bufferCanvas,0,0);var ve=j.ctx.getImageData(0,0,1,1).data;j.hasAlphaBug=ue[1]!=ve[1],j.hasAlphaBug&&console.log("Detected a browser having issue with transparent pixels, applying workaround")},j.setVideo=function(oe){if(j.video=oe,j.video){var G=function(){j.setCurrentTime(oe.currentTime+j.timeOffset)};j.video.addEventListener("timeupdate",G,!1),j.video.addEventListener("playing",function(){j.setIsPaused(!1,oe.currentTime+j.timeOffset)},!1),j.video.addEventListener("pause",function(){j.setIsPaused(!0,oe.currentTime+j.timeOffset)},!1),j.video.addEventListener("seeking",function(){j.video.removeEventListener("timeupdate",G)},!1),j.video.addEventListener("seeked",function(){j.video.addEventListener("timeupdate",G,!1),j.setCurrentTime(oe.currentTime+j.timeOffset),j.renderAhead>0&&At(oe.currentTime+j.timeOffset,!0)},!1),j.video.addEventListener("ratechange",function(){j.setRate(oe.playbackRate)},!1),j.video.addEventListener("timeupdate",function(){j.setCurrentTime(oe.currentTime+j.timeOffset)},!1),j.video.addEventListener("waiting",function(){j.setIsPaused(!0,oe.currentTime+j.timeOffset)},!1),document.addEventListener("fullscreenchange",j.resizeWithTimeout,!1),document.addEventListener("mozfullscreenchange",j.resizeWithTimeout,!1),document.addEventListener("webkitfullscreenchange",j.resizeWithTimeout,!1),document.addEventListener("msfullscreenchange",j.resizeWithTimeout,!1),window.addEventListener("resize",j.resizeWithTimeout,!1),typeof ResizeObserver<"u"&&(j.ro=new ResizeObserver(j.resizeWithTimeout),j.ro.observe(j.video)),j.video.videoWidth>0?j.resize():j.video.addEventListener("loadedmetadata",function(ue){ue.target.removeEventListener(ue.type,arguments.callee),j.resize()},!1)}},j.getVideoPosition=function(){var oe=j.video.videoWidth/j.video.videoHeight,G=j.video.offsetWidth,ue=j.video.offsetHeight,Y=G,ae=ue;return G/ue>oe?Y=Math.floor(ue*oe):ae=Math.floor(G/oe),{width:Y,height:ae,x:(G-Y)/2,y:(ue-ae)/2}},j.setSubUrl=function(oe){j.subUrl=oe},j.resetRenderAheadCache=function(oe){if(j.renderAhead>0){var G=[];if(oe&&j.oneshotState.prevHeight&&j.oneshotState.prevWidth){if(j.oneshotState.prevHeight==j.canvas.height&&j.oneshotState.prevWidth==j.canvas.width)return;var ue=10,ve=.3*j.renderAhead;j.canvas.height>=j.oneshotState.prevHeight*(1-j.resizeVariation)&&j.canvas.height<=j.oneshotState.prevHeight*(1+j.resizeVariation)&&j.canvas.width>=j.oneshotState.prevWidth*(1-j.resizeVariation)&&j.canvas.width<=j.oneshotState.prevWidth*(1+j.resizeVariation)&&(console.debug("viewport changes are small, leaving more of prerendered buffer"),ue=30,ve=.5*j.renderAhead);for(var Y=j.video.currentTime+j.timeOffset+ue,ae=0,m=0;m=Y||(ae+=B.size)>=ve)break;G.push(B)}}console.info("resetting prerender cache"),j.renderedItems=G,j.oneshotState.eventStart=null,j.oneshotState.iteration++,j.oneshotState.renderRequested=!1,j.oneshotState.prevHeight=j.canvas.height,j.oneshotState.prevWidth=j.canvas.width,window.requestAnimationFrame(V),wt(void 0,!0)}},j.renderFrameData=null,j.workerActive=!1,j.frameId=0,j.onWorkerMessage=function(oe){j.workerActive||(j.workerActive=!0,j.onReadyEvent&&j.onReadyEvent());var G=oe.data;switch(G.target){case"stdout":console.log(G.content);break;case"console-log":console.log.apply(console,JSON.parse(G.content));break;case"console-debug":console.debug.apply(console,JSON.parse(G.content));break;case"console-info":console.info.apply(console,JSON.parse(G.content));break;case"console-warn":console.warn.apply(console,JSON.parse(G.content));break;case"console-error":console.error.apply(console,JSON.parse(G.content));break;case"stderr":console.error(G.content);break;case"window":window[G.method]();break;case"canvas":switch(G.op){case"getContext":j.ctx=j.canvas.getContext(G.type,G.attributes);break;case"resize":j.resize(G.width,G.height);break;case"renderCanvas":j.lastRenderTime.01&&j.renderedItems.push({eventStart:G.lastRenderedTime,eventFinish:G.lastRenderedTime-.001,emptyFinish:G.eventStart,viewport:G.viewport,spentTime:0,blendTime:0,items:[],animated:!1,size:0});for(var ue=[],ve=0,Y=0,ae=G.canvases.length;Y0&&G.emptyFinish-G.eventStart<1/j.targetFps||G.animated){var i=G.eventStart+1/j.targetFps;G.emptyFinish=i,G.eventFinish=i,B=!0}j.renderedItems.push({eventStart:G.eventStart,eventFinish:G.eventFinish,emptyFinish:G.emptyFinish,spentTime:G.spentTime,blendTime:G.blendTime,viewport:G.viewport,items:ue,animated:G.animated,size:ve}),j.renderedItems.sort(function(g,f){return g.eventStart-f.eventStart}),j.oneshotState.requestNextTimestamp>=0?wt(j.oneshotState.requestNextTimestamp,!0):G.eventStart<0?console.info('oneshot received "end of frames" event'):G.emptyFinish>=0?wt(G.emptyFinish,B):console.info("there are no more events to prerender");break;default:throw"eh?"}break;case"tick":j.frameId=G.id,j.worker.postMessage({target:"tock",id:j.frameId});break;case"custom":if(!j.onCustomMessage)throw"Custom message received but client onCustomMessage not implemented.";j.onCustomMessage(oe);break;case"setimmediate":j.worker.postMessage({target:"setimmediate"});break;case"get-events":console.log(G.target),console.log(G.events);break;case"get-styles":console.log(G.target),console.log(G.styles);break;default:throw"what? "+G.target}},j.resize=function(oe,G,ue,ve){var Y=null;if(ue=ue||0,ve=ve||0,(!oe||!G)&&j.video){var ae=function _(oe,G){return null===j.prescaleTradeoff?G>j.hardHeightLimit&&(oe=oe*j.hardHeightLimit/G,G=j.hardHeightLimit):j.prescaleTradeoff>1?G*j.prescaleTradeoff<=j.softHeightLimit?(oe*=j.prescaleTradeoff,G*=j.prescaleTradeoff):G=j.hardHeightLimit&&(oe=oe*j.hardHeightLimit/G,G=j.hardHeightLimit):G>=j.softHeightLimit&&(G*j.prescaleTradeoff<=j.softHeightLimit?(oe=oe*j.softHeightLimit/G,G=j.softHeightLimit):G*j.prescaleTradeoff<=j.hardHeightLimit?(oe*=j.prescaleTradeoff,G*=j.prescaleTradeoff):(oe=oe*j.hardHeightLimit/G,G=j.hardHeightLimit)),{width:oe,height:G}}((Y=j.getVideoPosition()).width*j.pixelRatio,Y.height*j.pixelRatio);oe=ae.width,G=ae.height;var m=j.canvasParent.getBoundingClientRect().top-j.video.getBoundingClientRect().top;ue=Y.y-m,ve=Y.x}oe&&G?(j.canvas.width!=oe||j.canvas.height!=G||j.canvas.style.top!=ue||j.canvas.style.left!=ve)&&(j.canvas.width=oe,j.canvas.height=G,null!=Y&&(j.canvasParent.style.position="relative",j.canvas.style.display="block",j.canvas.style.position="absolute",j.canvas.style.width=Y.width+"px",j.canvas.style.height=Y.height+"px",j.canvas.style.top=ue+"px",j.canvas.style.left=ve+"px",j.canvas.style.pointerEvents="none"),j.worker.postMessage({target:"canvas",width:j.canvas.width,height:j.canvas.height}),j.resetRenderAheadCache(!0)):j.video||console.error("width or height is 0. You should specify width & height for resize.")},j.resizeWithTimeout=function(){j.resize(),setTimeout(j.resize,100)},j.runBenchmark=function(){j.worker.postMessage({target:"runBenchmark"})},j.customMessage=function(oe,G){j.worker.postMessage({target:"custom",userData:oe,preMain:(G=G||{}).preMain})},j.setCurrentTime=function(oe){j.worker.postMessage({target:"video",currentTime:oe})},j.setTrackByUrl=function(oe){j.worker.postMessage({target:"set-track-by-url",url:oe}),j.resetRenderAheadCache(!1)},j.setTrack=function(oe){j.worker.postMessage({target:"set-track",content:oe}),j.resetRenderAheadCache(!1)},j.freeTrack=function(oe){j.worker.postMessage({target:"free-track"}),j.resetRenderAheadCache(!1)},j.render=j.setCurrentTime,j.setIsPaused=function(oe,G){j.worker.postMessage({target:"video",isPaused:oe,currentTime:G})},j.setRate=function(oe){j.worker.postMessage({target:"video",rate:oe})},j.dispose=function(){j.worker.postMessage({target:"destroy"}),j.worker.terminate(),j.workerActive=!1,j.video&&j.video.parentNode.removeChild(j.canvasParent)},j.createEvent=function(oe){j.worker.postMessage({target:"create-event",event:oe})},j.getEvents=function(){j.worker.postMessage({target:"get-events"})},j.setEvent=function(oe,G){j.worker.postMessage({target:"set-event",event:oe,index:G})},j.removeEvent=function(oe){j.worker.postMessage({target:"remove-event",index:oe})},j.createStyle=function(oe){j.worker.postMessage({target:"create-style",style:oe})},j.getStyles=function(){j.worker.postMessage({target:"get-styles"})},j.setStyle=function(oe,G){j.worker.postMessage({target:"set-style",style:oe,index:G})},j.removeStyle=function(oe){j.worker.postMessage({target:"remove-style",index:oe})},j.init()};function _slicedToArray(Kt,yn){return _arrayWithHoles(Kt)||_iterableToArrayLimit(Kt,yn)||_unsupportedIterableToArray(Kt,yn)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(Kt,yn){var j=null==Kt?null:typeof Symbol<"u"&&Kt[Symbol.iterator]||Kt["@@iterator"];if(null!=j){var At,wt,kt=[],V=!0,De=!1;try{for(j=j.call(Kt);!(V=(At=j.next()).done)&&(kt.push(At.value),!yn||kt.length!==yn);V=!0);}catch(Le){De=!0,wt=Le}finally{try{V||null==j.return||j.return()}finally{if(De)throw wt}}return kt}}function _arrayWithHoles(Kt){if(Array.isArray(Kt))return Kt}function _createForOfIteratorHelper(Kt,yn){var j,At=typeof Symbol<"u"&&Kt[Symbol.iterator]||Kt["@@iterator"];if(!At){if(Array.isArray(Kt)||(At=_unsupportedIterableToArray(Kt))||yn&&Kt&&"number"==typeof Kt.length)return At&&(Kt=At),j=0,{s:yn=function(){},n:function(){return j>=Kt.length?{done:!0}:{done:!1,value:Kt[j++]}},e:function(De){throw De},f:yn};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var wt,kt=!0,V=!1;return{s:function(){At=At.call(Kt)},n:function(){var De=At.next();return kt=De.done,De},e:function(De){V=!0,wt=De},f:function(){try{kt||null==At.return||At.return()}finally{if(V)throw wt}}}}function _unsupportedIterableToArray(Kt,yn){if(Kt){if("string"==typeof Kt)return _arrayLikeToArray(Kt,yn);var j=Object.prototype.toString.call(Kt).slice(8,-1);return"Map"===(j="Object"===j&&Kt.constructor?Kt.constructor.name:j)||"Set"===j?Array.from(Kt):"Arguments"===j||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(j)?_arrayLikeToArray(Kt,yn):void 0}}function _arrayLikeToArray(Kt,yn){(null==yn||yn>Kt.length)&&(yn=Kt.length);for(var j=0,At=new Array(yn);j{let D=be.getAttribute("data-bs-target");if(!D||"#"===D){let te=be.getAttribute("href");if(!te||!te.includes("#")&&!te.startsWith("."))return null;te.includes("#")&&!te.startsWith("#")&&(te=`#${te.split("#")[1]}`),D=te&&"#"!==te?te.trim():null}return D},j=be=>{const D=yn(be);return D&&document.querySelector(D)?D:null},At=be=>{const D=yn(be);return D?document.querySelector(D):null},wt=be=>{be.dispatchEvent(new Event(Kt))},kt=be=>!(!be||"object"!=typeof be)&&(void 0!==be.jquery&&(be=be[0]),void 0!==be.nodeType),V=be=>kt(be)?be.jquery?be[0]:be:"string"==typeof be&&be.length>0?document.querySelector(be):null,De=(be,D,te)=>{Object.keys(te).forEach(Pe=>{const et=te[Pe],ut=D[Pe],Nt=ut&&kt(ut)?"element":null==(wn=ut)?`${wn}`:{}.toString.call(wn).match(/\s([a-z]+)/i)[1].toLowerCase();var wn;if(!new RegExp(et).test(Nt))throw new TypeError(`${be.toUpperCase()}: Option "${Pe}" provided type "${Nt}" but expected type "${et}".`)})},Le=be=>!(!kt(be)||0===be.getClientRects().length)&&"visible"===getComputedStyle(be).getPropertyValue("visibility"),_=be=>!be||be.nodeType!==Node.ELEMENT_NODE||!!be.classList.contains("disabled")||(void 0!==be.disabled?be.disabled:be.hasAttribute("disabled")&&"false"!==be.getAttribute("disabled")),oe=be=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof be.getRootNode){const D=be.getRootNode();return D instanceof ShadowRoot?D:null}return be instanceof ShadowRoot?be:be.parentNode?oe(be.parentNode):null},G=()=>{},ve=()=>{const{jQuery:be}=window;return be&&!document.body.hasAttribute("data-bs-no-jquery")?be:null},Y=[],ae=()=>"rtl"===document.documentElement.dir,m=be=>{var D;D=()=>{const te=ve();if(te){const Pe=be.NAME,et=te.fn[Pe];te.fn[Pe]=be.jQueryInterface,te.fn[Pe].Constructor=be,te.fn[Pe].noConflict=()=>(te.fn[Pe]=et,be.jQueryInterface)}},"loading"===document.readyState?(Y.length||document.addEventListener("DOMContentLoaded",()=>{Y.forEach(te=>te())}),Y.push(D)):D()},B=be=>{"function"==typeof be&&be()},i=(be,D,te=!0)=>{if(!te)return void B(be);const Pe=(Nt=>{if(!Nt)return 0;let{transitionDuration:wn,transitionDelay:Rn}=window.getComputedStyle(Nt);const Vn=Number.parseFloat(wn),Zn=Number.parseFloat(Rn);return Vn||Zn?(wn=wn.split(",")[0],Rn=Rn.split(",")[0],1e3*(Number.parseFloat(wn)+Number.parseFloat(Rn))):0})(D)+5;let et=!1;const ut=({target:Nt})=>{Nt===D&&(et=!0,D.removeEventListener(Kt,ut),B(be))};D.addEventListener(Kt,ut),setTimeout(()=>{et||wt(D)},Pe)},g=(be,D,te,Pe)=>{let et=be.indexOf(D);if(-1===et)return be[!te&&Pe?be.length-1:0];const ut=be.length;return et+=te?1:-1,Pe&&(et=(et+ut)%ut),be[Math.max(0,Math.min(et,ut-1))]},f=/[^.]*(?=\..*)\.|.*/,x=/\..*/,n=/::\d+$/,c={};let u=1;const s={mouseenter:"mouseover",mouseleave:"mouseout"},t=/^(mouseenter|mouseleave)/i,o=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function r(be,D){return D&&`${D}::${u++}`||be.uidEvent||u++}function d(be){const D=r(be);return be.uidEvent=D,c[D]=c[D]||{},c[D]}function h(be,D,te=null){const Pe=Object.keys(be);for(let et=0,ut=Pe.length;etfunction(or){if(!or.relatedTarget||or.relatedTarget!==or.delegateTarget&&!or.delegateTarget.contains(or.relatedTarget))return ar.call(this,or)};Pe?Pe=sr(Pe):te=sr(te)}const[ut,Nt,wn]=l(D,te,Pe),Rn=d(be),Vn=Rn[wn]||(Rn[wn]={}),Zn=h(Vn,Nt,ut?te:null);if(Zn)return void(Zn.oneOff=Zn.oneOff&&et);const Bn=r(Nt,D.replace(f,"")),yr=ut?(sr=be,ar=te,or=Pe,function lr(Pr){const wr=sr.querySelectorAll(ar);for(let{target:gr}=Pr;gr&&gr!==this;gr=gr.parentNode)for(let kr=wr.length;kr--;)if(wr[kr]===gr)return Pr.delegateTarget=gr,lr.oneOff&&I.off(sr,Pr.type,ar,or),or.apply(gr,[Pr]);return null}):function(sr,ar){return function or(lr){return lr.delegateTarget=sr,or.oneOff&&I.off(sr,lr.type,ar),ar.apply(sr,[lr])}}(be,te);var sr,ar,or;yr.delegationSelector=ut?te:null,yr.originalHandler=Nt,yr.oneOff=et,yr.uidEvent=Bn,Vn[Bn]=yr,be.addEventListener(wn,yr,ut)}function w(be,D,te,Pe,et){const ut=h(D[te],Pe,et);ut&&(be.removeEventListener(te,ut,Boolean(et)),delete D[te][ut.uidEvent])}function b(be){return be=be.replace(x,""),s[be]||be}const I={on(be,D,te,Pe){p(be,D,te,Pe,!1)},one(be,D,te,Pe){p(be,D,te,Pe,!0)},off(be,D,te,Pe){if("string"!=typeof D||!be)return;const[et,ut,Nt]=l(D,te,Pe),wn=Nt!==D,Rn=d(be),Vn=D.startsWith(".");if(void 0!==ut)return Rn&&Rn[Nt]?void w(be,Rn,Nt,ut,et?te:null):void 0;Vn&&Object.keys(Rn).forEach(Bn=>{!function(yr,sr,ar,or){const lr=sr[ar]||{};Object.keys(lr).forEach(Pr=>{if(Pr.includes(or)){const wr=lr[Pr];w(yr,sr,ar,wr.originalHandler,wr.delegationSelector)}})}(be,Rn,Bn,D.slice(1))});const Zn=Rn[Nt]||{};Object.keys(Zn).forEach(Bn=>{const yr=Bn.replace(n,"");if(!wn||D.includes(yr)){const sr=Zn[Bn];w(be,Rn,Nt,sr.originalHandler,sr.delegationSelector)}})},trigger(be,D,te){if("string"!=typeof D||!be)return null;const Pe=ve(),et=b(D),ut=D!==et,Nt=o.has(et);let wn,Rn=!0,Vn=!0,Zn=!1,Bn=null;return ut&&Pe&&(wn=Pe.Event(D,te),Pe(be).trigger(wn),Rn=!wn.isPropagationStopped(),Vn=!wn.isImmediatePropagationStopped(),Zn=wn.isDefaultPrevented()),Nt?(Bn=document.createEvent("HTMLEvents"),Bn.initEvent(et,Rn,!0)):Bn=new CustomEvent(D,{bubbles:Rn,cancelable:!0}),void 0!==te&&Object.keys(te).forEach(yr=>{Object.defineProperty(Bn,yr,{get:()=>te[yr]})}),Zn&&Bn.preventDefault(),Vn&&be.dispatchEvent(Bn),Bn.defaultPrevented&&void 0!==wn&&wn.preventDefault(),Bn}},S=new Map,R={set(be,D,te){S.has(be)||S.set(be,new Map);const Pe=S.get(be);Pe.has(D)||0===Pe.size?Pe.set(D,te):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(Pe.keys())[0]}.`)},get:(be,D)=>S.has(be)&&S.get(be).get(D)||null,remove(be,D){if(!S.has(be))return;const te=S.get(be);te.delete(D),0===te.size&&S.delete(be)}};class N{constructor(D){(D=V(D))&&(this._element=D,R.set(this._element,this.constructor.DATA_KEY,this))}dispose(){R.remove(this._element,this.constructor.DATA_KEY),I.off(this._element,this.constructor.EVENT_KEY),Object.getOwnPropertyNames(this).forEach(D=>{this[D]=null})}_queueCallback(D,te,Pe=!0){i(D,te,Pe)}static getInstance(D){return R.get(V(D),this.DATA_KEY)}static getOrCreateInstance(D,te={}){return this.getInstance(D)||new this(D,"object"==typeof te?te:null)}static get VERSION(){return"5.1.3"}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}}const q=(be,D="hide")=>{const Pe=be.NAME;I.on(document,`click.dismiss${be.EVENT_KEY}`,`[data-bs-dismiss="${Pe}"]`,function(et){if(["A","AREA"].includes(this.tagName)&&et.preventDefault(),_(this))return;const ut=At(this)||this.closest(`.${Pe}`);be.getOrCreateInstance(ut)[D]()})};class Z extends N{static get NAME(){return"alert"}close(){if(I.trigger(this._element,"close.bs.alert").defaultPrevented)return;this._element.classList.remove("show");const D=this._element.classList.contains("fade");this._queueCallback(()=>this._destroyElement(),this._element,D)}_destroyElement(){this._element.remove(),I.trigger(this._element,"closed.bs.alert"),this.dispose()}static jQueryInterface(D){return this.each(function(){const te=Z.getOrCreateInstance(this);if("string"==typeof D){if(void 0===te[D]||D.startsWith("_")||"constructor"===D)throw new TypeError(`No method named "${D}"`);te[D](this)}})}}q(Z,"close"),m(Z);const le='[data-bs-toggle="button"]';class we extends N{static get NAME(){return"button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(D){return this.each(function(){const te=we.getOrCreateInstance(this);"toggle"===D&&te[D]()})}}function ke(be){return"true"===be||"false"!==be&&(be===Number(be).toString()?Number(be):""===be||"null"===be?null:be)}function A(be){return be.replace(/[A-Z]/g,D=>`-${D.toLowerCase()}`)}I.on(document,"click.bs.button.data-api",le,be=>{be.preventDefault();const D=be.target.closest(le);we.getOrCreateInstance(D).toggle()}),m(we);const L={setDataAttribute(be,D,te){be.setAttribute(`data-bs-${A(D)}`,te)},removeDataAttribute(be,D){be.removeAttribute(`data-bs-${A(D)}`)},getDataAttributes(be){if(!be)return{};const D={};return Object.keys(be.dataset).filter(te=>te.startsWith("bs")).forEach(te=>{let Pe=te.replace(/^bs/,"");Pe=Pe.charAt(0).toLowerCase()+Pe.slice(1,Pe.length),D[Pe]=ke(be.dataset[te])}),D},getDataAttribute:(be,D)=>ke(be.getAttribute(`data-bs-${A(D)}`)),offset(be){const D=be.getBoundingClientRect();return{top:D.top+window.pageYOffset,left:D.left+window.pageXOffset}},position:be=>({top:be.offsetTop,left:be.offsetLeft})},z={find:(be,D=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(D,be)),findOne:(be,D=document.documentElement)=>Element.prototype.querySelector.call(D,be),children:(be,D)=>[].concat(...be.children).filter(te=>te.matches(D)),parents(be,D){const te=[];let Pe=be.parentNode;for(;Pe&&Pe.nodeType===Node.ELEMENT_NODE&&3!==Pe.nodeType;)Pe.matches(D)&&te.push(Pe),Pe=Pe.parentNode;return te},prev(be,D){let te=be.previousElementSibling;for(;te;){if(te.matches(D))return[te];te=te.previousElementSibling}return[]},next(be,D){let te=be.nextElementSibling;for(;te;){if(te.matches(D))return[te];te=te.nextElementSibling}return[]},focusableChildren(be){const D=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map(te=>`${te}:not([tabindex^="-"])`).join(", ");return this.find(D,be).filter(te=>!_(te)&&Le(te))}},y="carousel",C={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0,touch:!0},M={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean",touch:"boolean"},U="next",ee="prev",J="left",re="right",Ue={ArrowLeft:re,ArrowRight:J},We="slid.bs.carousel",Qe="active",ft=".active.carousel-item";class pt extends N{constructor(D,te){super(D),this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this.touchStartX=0,this.touchDeltaX=0,this._config=this._getConfig(te),this._indicatorsElement=z.findOne(".carousel-indicators",this._element),this._touchSupported="ontouchstart"in document.documentElement||navigator.maxTouchPoints>0,this._pointerEvent=Boolean(window.PointerEvent),this._addEventListeners()}static get Default(){return C}static get NAME(){return y}next(){this._slide(U)}nextWhenVisible(){!document.hidden&&Le(this._element)&&this.next()}prev(){this._slide(ee)}pause(D){D||(this._isPaused=!0),z.findOne(".carousel-item-next, .carousel-item-prev",this._element)&&(wt(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null}cycle(D){D||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config&&this._config.interval&&!this._isPaused&&(this._updateInterval(),this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))}to(D){this._activeElement=z.findOne(ft,this._element);const te=this._getItemIndex(this._activeElement);if(!(D>this._items.length-1||D<0)){if(!this._isSliding)return te===D?(this.pause(),void this.cycle()):void this._slide(D>te?U:ee,this._items[D]);I.one(this._element,We,()=>this.to(D))}}_getConfig(D){return D={...C,...L.getDataAttributes(this._element),..."object"==typeof D?D:{}},De(y,D,M),D}_handleSwipe(){const D=Math.abs(this.touchDeltaX);if(D<=40)return;const te=D/this.touchDeltaX;this.touchDeltaX=0,te&&this._slide(te>0?re:J)}_addEventListeners(){this._config.keyboard&&I.on(this._element,"keydown.bs.carousel",D=>this._keydown(D)),"hover"===this._config.pause&&(I.on(this._element,"mouseenter.bs.carousel",D=>this.pause(D)),I.on(this._element,"mouseleave.bs.carousel",D=>this.cycle(D))),this._config.touch&&this._touchSupported&&this._addTouchEventListeners()}_addTouchEventListeners(){const D=ut=>this._pointerEvent&&("pen"===ut.pointerType||"touch"===ut.pointerType),te=ut=>{D(ut)?this.touchStartX=ut.clientX:this._pointerEvent||(this.touchStartX=ut.touches[0].clientX)},Pe=ut=>{this.touchDeltaX=ut.touches&&ut.touches.length>1?0:ut.touches[0].clientX-this.touchStartX},et=ut=>{D(ut)&&(this.touchDeltaX=ut.clientX-this.touchStartX),this._handleSwipe(),"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout(Nt=>this.cycle(Nt),500+this._config.interval))};z.find(".carousel-item img",this._element).forEach(ut=>{I.on(ut,"dragstart.bs.carousel",Nt=>Nt.preventDefault())}),this._pointerEvent?(I.on(this._element,"pointerdown.bs.carousel",ut=>te(ut)),I.on(this._element,"pointerup.bs.carousel",ut=>et(ut)),this._element.classList.add("pointer-event")):(I.on(this._element,"touchstart.bs.carousel",ut=>te(ut)),I.on(this._element,"touchmove.bs.carousel",ut=>Pe(ut)),I.on(this._element,"touchend.bs.carousel",ut=>et(ut)))}_keydown(D){if(/input|textarea/i.test(D.target.tagName))return;const te=Ue[D.key];te&&(D.preventDefault(),this._slide(te))}_getItemIndex(D){return this._items=D&&D.parentNode?z.find(".carousel-item",D.parentNode):[],this._items.indexOf(D)}_getItemByOrder(D,te){return g(this._items,te,D===U,this._config.wrap)}_triggerSlideEvent(D,te){const Pe=this._getItemIndex(D),et=this._getItemIndex(z.findOne(ft,this._element));return I.trigger(this._element,"slide.bs.carousel",{relatedTarget:D,direction:te,from:et,to:Pe})}_setActiveIndicatorElement(D){if(this._indicatorsElement){const te=z.findOne(".active",this._indicatorsElement);te.classList.remove(Qe),te.removeAttribute("aria-current");const Pe=z.find("[data-bs-target]",this._indicatorsElement);for(let et=0;et{I.trigger(this._element,We,{relatedTarget:Nt,direction:yr,from:ut,to:wn})};this._element.classList.contains("slide")?(Nt.classList.add(Bn),et.classList.add(Zn),Nt.classList.add(Zn),this._queueCallback(()=>{Nt.classList.remove(Zn,Bn),Nt.classList.add(Qe),et.classList.remove(Qe,Bn,Zn),this._isSliding=!1,setTimeout(sr,0)},et,!0)):(et.classList.remove(Qe),Nt.classList.add(Qe),this._isSliding=!1,sr()),Rn&&this.cycle()}_directionToOrder(D){return[re,J].includes(D)?ae()?D===J?ee:U:D===J?U:ee:D}_orderToDirection(D){return[U,ee].includes(D)?ae()?D===ee?J:re:D===ee?re:J:D}static carouselInterface(D,te){const Pe=pt.getOrCreateInstance(D,te);let{_config:et}=Pe;"object"==typeof te&&(et={...et,...te});const ut="string"==typeof te?te:et.slide;if("number"==typeof te)Pe.to(te);else if("string"==typeof ut){if(void 0===Pe[ut])throw new TypeError(`No method named "${ut}"`);Pe[ut]()}else et.interval&&et.ride&&(Pe.pause(),Pe.cycle())}static jQueryInterface(D){return this.each(function(){pt.carouselInterface(this,D)})}static dataApiClickHandler(D){const te=At(this);if(!te||!te.classList.contains("carousel"))return;const Pe={...L.getDataAttributes(te),...L.getDataAttributes(this)},et=this.getAttribute("data-bs-slide-to");et&&(Pe.interval=!1),pt.carouselInterface(te,Pe),et&&pt.getInstance(te).to(et),D.preventDefault()}}I.on(document,"click.bs.carousel.data-api","[data-bs-slide], [data-bs-slide-to]",pt.dataApiClickHandler),I.on(window,"load.bs.carousel.data-api",()=>{const be=z.find('[data-bs-ride="carousel"]');for(let D=0,te=be.length;DVn===this._element);null!==wn&&Rn.length&&(this._selector=wn,this._triggerArray.push(Nt))}this._initializeChildren(),this._config.parent||this._addAriaAndCollapsedClass(this._triggerArray,this._isShown()),this._config.toggle&&this.toggle()}static get Default(){return It}static get NAME(){return Xt}toggle(){this._isShown()?this.hide():this.show()}show(){if(this._isTransitioning||this._isShown())return;let D,te=[];if(this._config.parent){const Nt=z.find(se,this._config.parent);te=z.find(".collapse.show, .collapse.collapsing",this._config.parent).filter(wn=>!Nt.includes(wn))}const Pe=z.findOne(this._selector);if(te.length){const Nt=te.find(wn=>Pe!==wn);if(D=Nt?ce.getInstance(Nt):null,D&&D._isTransitioning)return}if(I.trigger(this._element,"show.bs.collapse").defaultPrevented)return;te.forEach(Nt=>{Pe!==Nt&&ce.getOrCreateInstance(Nt,{toggle:!1}).hide(),D||R.set(Nt,"bs.collapse",null)});const et=this._getDimension();this._element.classList.remove(mt),this._element.classList.add(St),this._element.style[et]=0,this._addAriaAndCollapsedClass(this._triggerArray,!0),this._isTransitioning=!0;const ut=`scroll${et[0].toUpperCase()+et.slice(1)}`;this._queueCallback(()=>{this._isTransitioning=!1,this._element.classList.remove(St),this._element.classList.add(mt,Ke),this._element.style[et]="",I.trigger(this._element,"shown.bs.collapse")},this._element,!0),this._element.style[et]=`${this._element[ut]}px`}hide(){if(this._isTransitioning||!this._isShown()||I.trigger(this._element,"hide.bs.collapse").defaultPrevented)return;const D=this._getDimension();this._element.style[D]=`${this._element.getBoundingClientRect()[D]}px`,this._element.classList.add(St),this._element.classList.remove(mt,Ke);const te=this._triggerArray.length;for(let Pe=0;Pe{this._isTransitioning=!1,this._element.classList.remove(St),this._element.classList.add(mt),I.trigger(this._element,"hidden.bs.collapse")},this._element,!0)}_isShown(D=this._element){return D.classList.contains(Ke)}_getConfig(D){return(D={...It,...L.getDataAttributes(this._element),...D}).toggle=Boolean(D.toggle),D.parent=V(D.parent),De(Xt,D,Ft),D}_getDimension(){return this._element.classList.contains("collapse-horizontal")?"width":"height"}_initializeChildren(){if(!this._config.parent)return;const D=z.find(se,this._config.parent);z.find(X,this._config.parent).filter(te=>!D.includes(te)).forEach(te=>{const Pe=At(te);Pe&&this._addAriaAndCollapsedClass([te],this._isShown(Pe))})}_addAriaAndCollapsedClass(D,te){D.length&&D.forEach(Pe=>{te?Pe.classList.remove(K):Pe.classList.add(K),Pe.setAttribute("aria-expanded",te)})}static jQueryInterface(D){return this.each(function(){const te={};"string"==typeof D&&/show|hide/.test(D)&&(te.toggle=!1);const Pe=ce.getOrCreateInstance(this,te);if("string"==typeof D){if(void 0===Pe[D])throw new TypeError(`No method named "${D}"`);Pe[D]()}})}}I.on(document,"click.bs.collapse.data-api",X,function(be){("A"===be.target.tagName||be.delegateTarget&&"A"===be.delegateTarget.tagName)&&be.preventDefault();const D=j(this);z.find(D).forEach(te=>{ce.getOrCreateInstance(te,{toggle:!1}).toggle()})}),m(ce);var Je="top",ie="bottom",pe="right",Ye="left",at="auto",dt=[Je,ie,pe,Ye],Gt="start",Jt="end",an="clippingParents",Cn="viewport",hn="popper",En="reference",Xn=dt.reduce(function(be,D){return be.concat([D+"-"+Gt,D+"-"+Jt])},[]),An=[].concat(dt,[at]).reduce(function(be,D){return be.concat([D,D+"-"+Gt,D+"-"+Jt])},[]),Pn="beforeRead",Mt="afterRead",Kn="beforeMain",Re="afterMain",je="beforeWrite",Xe="afterWrite",st=[Pn,"read",Mt,Kn,"main",Re,je,"write",Xe];function tn(be){return be?(be.nodeName||"").toLowerCase():null}function Bt(be){if(null==be)return window;if("[object Window]"!==be.toString()){var D=be.ownerDocument;return D&&D.defaultView||window}return be}function qt(be){return be instanceof Bt(be).Element||be instanceof Element}function nn(be){return be instanceof Bt(be).HTMLElement||be instanceof HTMLElement}function _n(be){return typeof ShadowRoot<"u"&&(be instanceof Bt(be).ShadowRoot||be instanceof ShadowRoot)}const cn={name:"applyStyles",enabled:!0,phase:"write",fn:function(be){var D=be.state;Object.keys(D.elements).forEach(function(te){var Pe=D.styles[te]||{},et=D.attributes[te]||{},ut=D.elements[te];nn(ut)&&tn(ut)&&(Object.assign(ut.style,Pe),Object.keys(et).forEach(function(Nt){var wn=et[Nt];!1===wn?ut.removeAttribute(Nt):ut.setAttribute(Nt,!0===wn?"":wn)}))})},effect:function(be){var D=be.state,te={popper:{position:D.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(D.elements.popper.style,te.popper),D.styles=te,D.elements.arrow&&Object.assign(D.elements.arrow.style,te.arrow),function(){Object.keys(D.elements).forEach(function(Pe){var et=D.elements[Pe],ut=D.attributes[Pe]||{},Nt=Object.keys(D.styles.hasOwnProperty(Pe)?D.styles[Pe]:te[Pe]).reduce(function(wn,Rn){return wn[Rn]="",wn},{});nn(et)&&tn(et)&&(Object.assign(et.style,Nt),Object.keys(ut).forEach(function(wn){et.removeAttribute(wn)}))})}},requires:["computeStyles"]};function Qt(be){return be.split("-")[0]}function Ee(be,D){var te=be.getBoundingClientRect();return{width:te.width/1,height:te.height/1,top:te.top/1,right:te.right/1,bottom:te.bottom/1,left:te.left/1,x:te.left/1,y:te.top/1}}function Vt(be){var D=Ee(be),te=be.offsetWidth,Pe=be.offsetHeight;return Math.abs(D.width-te)<=1&&(te=D.width),Math.abs(D.height-Pe)<=1&&(Pe=D.height),{x:be.offsetLeft,y:be.offsetTop,width:te,height:Pe}}function Nn(be,D){var te=D.getRootNode&&D.getRootNode();if(be.contains(D))return!0;if(te&&_n(te)){var Pe=D;do{if(Pe&&be.isSameNode(Pe))return!0;Pe=Pe.parentNode||Pe.host}while(Pe)}return!1}function mn(be){return Bt(be).getComputedStyle(be)}function Mn(be){return["table","td","th"].indexOf(tn(be))>=0}function zn(be){return((qt(be)?be.ownerDocument:be.document)||window.document).documentElement}function qn(be){return"html"===tn(be)?be:be.assignedSlot||be.parentNode||(_n(be)?be.host:null)||zn(be)}function Fn(be){return nn(be)&&"fixed"!==mn(be).position?be.offsetParent:null}function Gn(be){for(var D=Bt(be),te=Fn(be);te&&Mn(te)&&"static"===mn(te).position;)te=Fn(te);return te&&("html"===tn(te)||"body"===tn(te)&&"static"===mn(te).position)?D:te||function(Pe){var et=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&nn(Pe)&&"fixed"===mn(Pe).position)return null;for(var ut=qn(Pe);nn(ut)&&["html","body"].indexOf(tn(ut))<0;){var Nt=mn(ut);if("none"!==Nt.transform||"none"!==Nt.perspective||"paint"===Nt.contain||-1!==["transform","perspective"].indexOf(Nt.willChange)||et&&"filter"===Nt.willChange||et&&Nt.filter&&"none"!==Nt.filter)return ut;ut=ut.parentNode}return null}(be)||D}function Hn(be){return["top","bottom"].indexOf(be)>=0?"x":"y"}var Yn=Math.max,rt=Math.min,de=Math.round;function nt(be,D,te){return Yn(be,rt(D,te))}function it(be){return Object.assign({},{top:0,right:0,bottom:0,left:0},be)}function ye(be,D){return D.reduce(function(te,Pe){return te[Pe]=be,te},{})}const ct={name:"arrow",enabled:!0,phase:"main",fn:function(be){var D,Ir,Ur,te=be.state,Pe=be.name,et=be.options,ut=te.elements.arrow,Nt=te.modifiersData.popperOffsets,wn=Qt(te.placement),Rn=Hn(wn),Vn=[Ye,pe].indexOf(wn)>=0?"height":"width";if(ut&&Nt){var Zn=(Ur=te,it("number"!=typeof(Ir="function"==typeof(Ir=et.padding)?Ir(Object.assign({},Ur.rects,{placement:Ur.placement})):Ir)?Ir:ye(Ir,dt))),Bn=Vt(ut),yr="y"===Rn?Je:Ye,sr="y"===Rn?ie:pe,ar=te.rects.reference[Vn]+te.rects.reference[Rn]-Nt[Rn]-te.rects.popper[Vn],or=Nt[Rn]-te.rects.reference[Rn],lr=Gn(ut),Pr=lr?"y"===Rn?lr.clientHeight||0:lr.clientWidth||0:0,Sr=Pr/2-Bn[Vn]/2+(ar/2-or/2),Ar=nt(Zn[yr],Sr,Pr-Bn[Vn]-Zn[sr]);te.modifiersData[Pe]=((D={})[Rn]=Ar,D.centerOffset=Ar-Sr,D)}},effect:function(be){var D=be.state,te=be.options.element,Pe=void 0===te?"[data-popper-arrow]":te;null!=Pe&&("string"!=typeof Pe||(Pe=D.elements.popper.querySelector(Pe)))&&Nn(D.elements.popper,Pe)&&(D.elements.arrow=Pe)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Xr(be){return be.split("-")[1]}var vi={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Kr(be){var D,ui,Ai,$r,te=be.popper,Pe=be.popperRect,et=be.placement,ut=be.variation,Nt=be.offsets,wn=be.position,Rn=be.gpuAcceleration,Vn=be.adaptive,Zn=be.roundOffsets,Bn=!0===Zn?(Ai=(ui=Nt).y,$r=window.devicePixelRatio||1,{x:de(de(ui.x*$r)/$r)||0,y:de(de(Ai*$r)/$r)||0}):"function"==typeof Zn?Zn(Nt):Nt,yr=Bn.x,sr=void 0===yr?0:yr,ar=Bn.y,or=void 0===ar?0:ar,lr=Nt.hasOwnProperty("x"),Pr=Nt.hasOwnProperty("y"),wr=Ye,gr=Je,kr=window;if(Vn){var Sr=Gn(te),Ar="clientHeight",Mr="clientWidth";Sr===Bt(te)&&"static"!==mn(Sr=zn(te)).position&&"absolute"===wn&&(Ar="scrollHeight",Mr="scrollWidth"),et!==Je&&(et!==Ye&&et!==pe||ut!==Jt)||(gr=ie,or-=Sr[Ar]-Pe.height,or*=Rn?1:-1),et!==Ye&&(et!==Je&&et!==ie||ut!==Jt)||(wr=pe,sr-=Sr[Mr]-Pe.width,sr*=Rn?1:-1)}var Ir,Ur=Object.assign({position:wn},Vn&&vi);return Object.assign({},Ur,Rn?((Ir={})[gr]=Pr?"0":"",Ir[wr]=lr?"0":"",Ir.transform=(kr.devicePixelRatio||1)<=1?"translate("+sr+"px, "+or+"px)":"translate3d("+sr+"px, "+or+"px, 0)",Ir):((D={})[gr]=Pr?or+"px":"",D[wr]=lr?sr+"px":"",D.transform="",D))}const oi={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(be){var D=be.state,te=be.options,Pe=te.gpuAcceleration,et=void 0===Pe||Pe,ut=te.adaptive,Nt=void 0===ut||ut,wn=te.roundOffsets,Rn=void 0===wn||wn,Vn={placement:Qt(D.placement),variation:Xr(D.placement),popper:D.elements.popper,popperRect:D.rects.popper,gpuAcceleration:et};null!=D.modifiersData.popperOffsets&&(D.styles.popper=Object.assign({},D.styles.popper,Kr(Object.assign({},Vn,{offsets:D.modifiersData.popperOffsets,position:D.options.strategy,adaptive:Nt,roundOffsets:Rn})))),null!=D.modifiersData.arrow&&(D.styles.arrow=Object.assign({},D.styles.arrow,Kr(Object.assign({},Vn,{offsets:D.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:Rn})))),D.attributes.popper=Object.assign({},D.attributes.popper,{"data-popper-placement":D.placement})},data:{}};var Qr={passive:!0};const hr={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(be){var D=be.state,te=be.instance,Pe=be.options,et=Pe.scroll,ut=void 0===et||et,Nt=Pe.resize,wn=void 0===Nt||Nt,Rn=Bt(D.elements.popper),Vn=[].concat(D.scrollParents.reference,D.scrollParents.popper);return ut&&Vn.forEach(function(Zn){Zn.addEventListener("scroll",te.update,Qr)}),wn&&Rn.addEventListener("resize",te.update,Qr),function(){ut&&Vn.forEach(function(Zn){Zn.removeEventListener("scroll",te.update,Qr)}),wn&&Rn.removeEventListener("resize",te.update,Qr)}},data:{}};var li={left:"right",right:"left",bottom:"top",top:"bottom"};function Vr(be){return be.replace(/left|right|bottom|top/g,function(D){return li[D]})}var zr={start:"end",end:"start"};function Ei(be){return be.replace(/start|end/g,function(D){return zr[D]})}function ei(be){var D=Bt(be);return{scrollLeft:D.pageXOffset,scrollTop:D.pageYOffset}}function ci(be){return Ee(zn(be)).left+ei(be).scrollLeft}function Gr(be){var D=mn(be);return/auto|scroll|overlay|hidden/.test(D.overflow+D.overflowY+D.overflowX)}function Dr(be){return["html","body","#document"].indexOf(tn(be))>=0?be.ownerDocument.body:nn(be)&&Gr(be)?be:Dr(qn(be))}function Zr(be,D){var te;void 0===D&&(D=[]);var Pe=Dr(be),et=Pe===(null==(te=be.ownerDocument)?void 0:te.body),ut=Bt(Pe),Nt=et?[ut].concat(ut.visualViewport||[],Gr(Pe)?Pe:[]):Pe,wn=D.concat(Nt);return et?wn:wn.concat(Zr(qn(Nt)))}function si(be){return Object.assign({},be,{left:be.x,top:be.y,right:be.x+be.width,bottom:be.y+be.height})}function yi(be,D){return D===Cn?si((Pe=Bt(te=be),Nt=(et=zn(te)).clientWidth,wn=et.clientHeight,Rn=0,Vn=0,(ut=Pe.visualViewport)&&(Nt=ut.width,wn=ut.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(Rn=ut.offsetLeft,Vn=ut.offsetTop)),{width:Nt,height:wn,x:Rn+ci(te),y:Vn})):nn(D)?function(te){var Pe=Ee(te);return Pe.top=Pe.top+te.clientTop,Pe.left=Pe.left+te.clientLeft,Pe.bottom=Pe.top+te.clientHeight,Pe.right=Pe.left+te.clientWidth,Pe.width=te.clientWidth,Pe.height=te.clientHeight,Pe.x=Pe.left,Pe.y=Pe.top,Pe}(D):si(function(te){var Pe,et=zn(te),ut=ei(te),Nt=null==(Pe=te.ownerDocument)?void 0:Pe.body,wn=Yn(et.scrollWidth,et.clientWidth,Nt?Nt.scrollWidth:0,Nt?Nt.clientWidth:0),Rn=Yn(et.scrollHeight,et.clientHeight,Nt?Nt.scrollHeight:0,Nt?Nt.clientHeight:0),Vn=-ut.scrollLeft+ci(te),Zn=-ut.scrollTop;return"rtl"===mn(Nt||et).direction&&(Vn+=Yn(et.clientWidth,Nt?Nt.clientWidth:0)-wn),{width:wn,height:Rn,x:Vn,y:Zn}}(zn(be)));var te,Pe,et,ut,Nt,wn,Rn,Vn}function Br(be){var D,te=be.reference,Pe=be.element,et=be.placement,ut=et?Qt(et):null,Nt=et?Xr(et):null,wn=te.x+te.width/2-Pe.width/2,Rn=te.y+te.height/2-Pe.height/2;switch(ut){case Je:D={x:wn,y:te.y-Pe.height};break;case ie:D={x:wn,y:te.y+te.height};break;case pe:D={x:te.x+te.width,y:Rn};break;case Ye:D={x:te.x-Pe.width,y:Rn};break;default:D={x:te.x,y:te.y}}var Vn=ut?Hn(ut):null;if(null!=Vn){var Zn="y"===Vn?"height":"width";switch(Nt){case Gt:D[Vn]=D[Vn]-(te[Zn]/2-Pe[Zn]/2);break;case Jt:D[Vn]=D[Vn]+(te[Zn]/2-Pe[Zn]/2)}}return D}function Jn(be,D){void 0===D&&(D={});var di,Ai,$r,Fr,ho,wi,go,Gi,pi,Pe=D.placement,et=void 0===Pe?be.placement:Pe,ut=D.boundary,Nt=void 0===ut?an:ut,wn=D.rootBoundary,Rn=void 0===wn?Cn:wn,Vn=D.elementContext,Zn=void 0===Vn?hn:Vn,Bn=D.altBoundary,yr=void 0!==Bn&&Bn,sr=D.padding,ar=void 0===sr?0:sr,or=it("number"!=typeof ar?ar:ye(ar,dt)),Pr=be.rects.popper,wr=be.elements[yr?Zn===hn?En:hn:Zn],gr=(di=qt(wr)?wr:wr.contextElement||zn(be.elements.popper),$r=Rn,go="clippingParents"===(Ai=Nt)?(ho=Zr(qn(Fr=di)),qt(wi=["absolute","fixed"].indexOf(mn(Fr).position)>=0&&nn(Fr)?Gn(Fr):Fr)?ho.filter(function(gi){return qt(gi)&&Nn(gi,wi)&&"body"!==tn(gi)}):[]):[].concat(Ai),pi=(Gi=[].concat(go,[$r])).reduce(function(Fr,ho){var wi=yi(di,ho);return Fr.top=Yn(wi.top,Fr.top),Fr.right=rt(wi.right,Fr.right),Fr.bottom=rt(wi.bottom,Fr.bottom),Fr.left=Yn(wi.left,Fr.left),Fr},yi(di,Gi[0])),pi.width=pi.right-pi.left,pi.height=pi.bottom-pi.top,pi.x=pi.left,pi.y=pi.top,pi),kr=Ee(be.elements.reference),Sr=Br({reference:kr,element:Pr,strategy:"absolute",placement:et}),Ar=si(Object.assign({},Pr,Sr)),Mr=Zn===hn?Ar:kr,Ir={top:gr.top-Mr.top+or.top,bottom:Mr.bottom-gr.bottom+or.bottom,left:gr.left-Mr.left+or.left,right:Mr.right-gr.right+or.right},Ur=be.modifiersData.offset;if(Zn===hn&&Ur){var ui=Ur[et];Object.keys(Ir).forEach(function(di){var Ai=[pe,ie].indexOf(di)>=0?1:-1,$r=[Je,ie].indexOf(di)>=0?"y":"x";Ir[di]+=ui[$r]*Ai})}return Ir}const Wi={name:"flip",enabled:!0,phase:"main",fn:function(be){var D=be.state,te=be.options,Pe=be.name;if(!D.modifiersData[Pe]._skip){for(var et=te.mainAxis,ut=void 0===et||et,Nt=te.altAxis,wn=void 0===Nt||Nt,Rn=te.fallbackPlacements,Vn=te.padding,Zn=te.boundary,Bn=te.rootBoundary,yr=te.altBoundary,sr=te.flipVariations,ar=void 0===sr||sr,or=te.allowedAutoPlacements,lr=D.options.placement,Pr=Qt(lr),wr=Rn||(Pr!==lr&&ar?function(gi){if(Qt(gi)===at)return[];var Li=Vr(gi);return[Ei(gi),Li,Ei(Li)]}(lr):[Vr(lr)]),gr=[lr].concat(wr).reduce(function(gi,Li){return gi.concat(Qt(Li)===at?function _r(be,D){void 0===D&&(D={});var et=D.boundary,ut=D.rootBoundary,Nt=D.padding,wn=D.flipVariations,Rn=D.allowedAutoPlacements,Vn=void 0===Rn?An:Rn,Zn=Xr(D.placement),Bn=Zn?wn?Xn:Xn.filter(function(ar){return Xr(ar)===Zn}):dt,yr=Bn.filter(function(ar){return Vn.indexOf(ar)>=0});0===yr.length&&(yr=Bn);var sr=yr.reduce(function(ar,or){return ar[or]=Jn(be,{placement:or,boundary:et,rootBoundary:ut,padding:Nt})[Qt(or)],ar},{});return Object.keys(sr).sort(function(ar,or){return sr[ar]-sr[or]})}(D,{placement:Li,boundary:Zn,rootBoundary:Bn,padding:Vn,flipVariations:ar,allowedAutoPlacements:or}):Li)},[]),kr=D.rects.reference,Sr=D.rects.popper,Ar=new Map,Mr=!0,Ir=gr[0],Ur=0;Ur=0,go=$r?"width":"height",Gi=Jn(D,{placement:ui,boundary:Zn,rootBoundary:Bn,altBoundary:yr,padding:Vn}),Ci=$r?Ai?pe:Ye:Ai?ie:Je;kr[go]>Sr[go]&&(Ci=Vr(Ci));var pi=Vr(Ci),Fr=[];if(ut&&Fr.push(Gi[di]<=0),wn&&Fr.push(Gi[Ci]<=0,Gi[pi]<=0),Fr.every(function(gi){return gi})){Ir=ui,Mr=!1;break}Ar.set(ui,Fr)}if(Mr)for(var ho=function(gi){var Li=gr.find(function(To){var uo=Ar.get(To);if(uo)return uo.slice(0,gi).every(function(mo){return mo})});if(Li)return Ir=Li,"break"},wi=ar?3:1;wi>0&&"break"!==ho(wi);wi--);D.placement!==Ir&&(D.modifiersData[Pe]._skip=!0,D.placement=Ir,D.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function qi(be,D,te){return void 0===te&&(te={x:0,y:0}),{top:be.top-D.height-te.y,right:be.right-D.width+te.x,bottom:be.bottom-D.height+te.y,left:be.left-D.width-te.x}}function eo(be){return[Je,pe,ie,Ye].some(function(D){return be[D]>=0})}const _i={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(be){var D=be.state,te=be.name,Pe=D.rects.reference,et=D.rects.popper,ut=D.modifiersData.preventOverflow,Nt=Jn(D,{elementContext:"reference"}),wn=Jn(D,{altBoundary:!0}),Rn=qi(Nt,Pe),Vn=qi(wn,et,ut),Zn=eo(Rn),Bn=eo(Vn);D.modifiersData[te]={referenceClippingOffsets:Rn,popperEscapeOffsets:Vn,isReferenceHidden:Zn,hasPopperEscaped:Bn},D.attributes.popper=Object.assign({},D.attributes.popper,{"data-popper-reference-hidden":Zn,"data-popper-escaped":Bn})}},ki={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(be){var D=be.state,Pe=be.name,et=be.options.offset,ut=void 0===et?[0,0]:et,Nt=An.reduce(function(Zn,Bn){return Zn[Bn]=(sr=D.rects,ar=ut,or=Qt(yr=Bn),lr=[Ye,Je].indexOf(or)>=0?-1:1,wr=(wr=(Pr="function"==typeof ar?ar(Object.assign({},sr,{placement:yr})):ar)[0])||0,gr=((gr=Pr[1])||0)*lr,[Ye,pe].indexOf(or)>=0?{x:gr,y:wr}:{x:wr,y:gr}),Zn;var yr,sr,ar,or,lr,Pr,wr,gr},{}),wn=Nt[D.placement],Vn=wn.y;null!=D.modifiersData.popperOffsets&&(D.modifiersData.popperOffsets.x+=wn.x,D.modifiersData.popperOffsets.y+=Vn),D.modifiersData[Pe]=Nt}},Pi={name:"popperOffsets",enabled:!0,phase:"read",fn:function(be){var D=be.state;D.modifiersData[be.name]=Br({reference:D.rects.reference,element:D.rects.popper,strategy:"absolute",placement:D.placement})},data:{}},hi={name:"preventOverflow",enabled:!0,phase:"main",fn:function(be){var D=be.state,te=be.options,Pe=be.name,et=te.mainAxis,ut=void 0===et||et,Nt=te.altAxis,wn=void 0!==Nt&&Nt,yr=te.tether,sr=void 0===yr||yr,ar=te.tetherOffset,or=void 0===ar?0:ar,lr=Jn(D,{boundary:te.boundary,rootBoundary:te.rootBoundary,padding:te.padding,altBoundary:te.altBoundary}),Pr=Qt(D.placement),wr=Xr(D.placement),gr=!wr,kr=Hn(Pr),Sr="x"===kr?"y":"x",Ar=D.modifiersData.popperOffsets,Mr=D.rects.reference,Ir=D.rects.popper,Ur="function"==typeof or?or(Object.assign({},D.rects,{placement:D.placement})):or,ui={x:0,y:0};if(Ar){if(ut||wn){var di="y"===kr?Je:Ye,Ai="y"===kr?ie:pe,$r="y"===kr?"height":"width",go=Ar[kr],Gi=Ar[kr]+lr[di],Ci=Ar[kr]-lr[Ai],pi=sr?-Ir[$r]/2:0,Fr=wr===Gt?Mr[$r]:Ir[$r],ho=wr===Gt?-Ir[$r]:-Mr[$r],wi=D.elements.arrow,gi=sr&&wi?Vt(wi):{width:0,height:0},Li=D.modifiersData["arrow#persistent"]?D.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},To=Li[di],uo=Li[Ai],mo=nt(0,Mr[$r],gi[$r]),ss=gr?Mr[$r]/2-pi-mo-To-Ur:Fr-mo-To-Ur,as=gr?-Mr[$r]/2+pi+mo+uo+Ur:ho+mo+uo+Ur,Io=D.elements.arrow&&Gn(D.elements.arrow),xo=D.modifiersData.offset?D.modifiersData.offset[D.placement][kr]:0,$o=Ar[kr]+ss-xo-(Io?"y"===kr?Io.clientTop||0:Io.clientLeft||0:0),cs=Ar[kr]+as-xo;if(ut){var Ro=nt(sr?rt(Gi,$o):Gi,go,sr?Yn(Ci,cs):Ci);Ar[kr]=Ro,ui[kr]=Ro-go}if(wn){var Mo=Ar[Sr],vo=Mo+lr["x"===kr?Je:Ye],lo=Mo-lr["x"===kr?ie:pe],yo=nt(sr?rt(vo,$o):vo,Mo,sr?Yn(lo,cs):lo);Ar[Sr]=yo,ui[Sr]=yo-Mo}}D.modifiersData[Pe]=ui}},requiresIfExists:["offset"]};function Nr(be,D,te){void 0===te&&(te=!1);var Pe=nn(D);nn(D)&&D.getBoundingClientRect();var et,ut,Nt=zn(D),wn=Ee(be),Rn={scrollLeft:0,scrollTop:0},Vn={x:0,y:0};return(Pe||!Pe&&!te)&&(("body"!==tn(D)||Gr(Nt))&&(Rn=(et=D)!==Bt(et)&&nn(et)?{scrollLeft:(ut=et).scrollLeft,scrollTop:ut.scrollTop}:ei(et)),nn(D)?((Vn=Ee(D)).x+=D.clientLeft,Vn.y+=D.clientTop):Nt&&(Vn.x=ci(Nt))),{x:wn.left+Rn.scrollLeft-Vn.x,y:wn.top+Rn.scrollTop-Vn.y,width:wn.width,height:wn.height}}function to(be){var D=new Map,te=new Set,Pe=[];function et(ut){te.add(ut.name),[].concat(ut.requires||[],ut.requiresIfExists||[]).forEach(function(Nt){if(!te.has(Nt)){var wn=D.get(Nt);wn&&et(wn)}}),Pe.push(ut)}return be.forEach(function(ut){D.set(ut.name,ut)}),be.forEach(function(ut){te.has(ut.name)||et(ut)}),Pe}var P={placement:"bottom",modifiers:[],strategy:"absolute"};function W(){for(var be=arguments.length,D=new Array(be),te=0;teI.on(Pe,"mouseover",G)),this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.add(Tt),this._element.classList.add(Tt),I.trigger(this._element,"shown.bs.dropdown",D)}hide(){!_(this._element)&&this._isShown(this._menu)&&this._completeHide({relatedTarget:this._element})}dispose(){this._popper&&this._popper.destroy(),super.dispose()}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update()}_completeHide(D){I.trigger(this._element,"hide.bs.dropdown",D).defaultPrevented||("ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach(te=>I.off(te,"mouseover",G)),this._popper&&this._popper.destroy(),this._menu.classList.remove(Tt),this._element.classList.remove(Tt),this._element.setAttribute("aria-expanded","false"),L.removeDataAttribute(this._menu,"popper"),I.trigger(this._element,"hidden.bs.dropdown",D))}_getConfig(D){if(D={...this.constructor.Default,...L.getDataAttributes(this._element),...D},De(Oe,D,this.constructor.DefaultType),"object"==typeof D.reference&&!kt(D.reference)&&"function"!=typeof D.reference.getBoundingClientRect)throw new TypeError(`${Oe.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);return D}_createPopper(D){if(void 0===Se)throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");let te=this._element;"parent"===this._config.reference?te=D:kt(this._config.reference)?te=V(this._config.reference):"object"==typeof this._config.reference&&(te=this._config.reference);const Pe=this._getPopperConfig(),et=Pe.modifiers.find(ut=>"applyStyles"===ut.name&&!1===ut.enabled);this._popper=Te(te,this._menu,Pe),et&&L.setDataAttribute(this._menu,"popper","static")}_isShown(D=this._element){return D.classList.contains(Tt)}_getMenuElement(){return z.next(this._element,Pt)[0]}_getPlacement(){const D=this._element.parentNode;if(D.classList.contains("dropend"))return vr;if(D.classList.contains("dropstart"))return br;const te="end"===getComputedStyle(this._menu).getPropertyValue("--bs-position").trim();return D.classList.contains("dropup")?te?rn:dn:te?jn:un}_detectNavbar(){return null!==this._element.closest(".navbar")}_getOffset(){const{offset:D}=this._config;return"string"==typeof D?D.split(",").map(te=>Number.parseInt(te,10)):"function"==typeof D?te=>D(te,this._element):D}_getPopperConfig(){const D={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return"static"===this._config.display&&(D.modifiers=[{name:"applyStyles",enabled:!1}]),{...D,..."function"==typeof this._config.popperConfig?this._config.popperConfig(D):this._config.popperConfig}}_selectMenuItem({key:D,target:te}){const Pe=z.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",this._menu).filter(Le);Pe.length&&g(Pe,te,D===ot,!Pe.includes(te)).focus()}static jQueryInterface(D){return this.each(function(){const te=rr.getOrCreateInstance(this,D);if("string"==typeof D){if(void 0===te[D])throw new TypeError(`No method named "${D}"`);te[D]()}})}static clearMenus(D){if(D&&(2===D.button||"keyup"===D.type&&"Tab"!==D.key))return;const te=z.find(zt);for(let Pe=0,et=te.length;Pete+D),this._setElementAttributes(Jr,"paddingRight",te=>te+D),this._setElementAttributes(ze,"marginRight",te=>te-D)}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(D,te,Pe){const et=this.getWidth();this._applyManipulationCallback(D,ut=>{if(ut!==this._element&&window.innerWidth>ut.clientWidth+et)return;this._saveInitialAttribute(ut,te);const Nt=window.getComputedStyle(ut)[te];ut.style[te]=`${Pe(Number.parseFloat(Nt))}px`})}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,"paddingRight"),this._resetElementAttributes(Jr,"paddingRight"),this._resetElementAttributes(ze,"marginRight")}_saveInitialAttribute(D,te){const Pe=D.style[te];Pe&&L.setDataAttribute(D,te,Pe)}_resetElementAttributes(D,te){this._applyManipulationCallback(D,Pe=>{const et=L.getDataAttribute(Pe,te);void 0===et?Pe.style.removeProperty(te):(L.removeDataAttribute(Pe,te),Pe.style[te]=et)})}_applyManipulationCallback(D,te){kt(D)?te(D):z.find(D,this._element).forEach(te)}isOverflowing(){return this.getWidth()>0}}const Wt={className:"modal-backdrop",isVisible:!0,isAnimated:!1,rootElement:"body",clickCallback:null},ln={className:"string",isVisible:"boolean",isAnimated:"boolean",rootElement:"(element|string)",clickCallback:"(function|null)"},Fe="mousedown.bs.backdrop";class Ce{constructor(D){this._config=this._getConfig(D),this._isAppended=!1,this._element=null}show(D){this._config.isVisible?(this._append(),this._config.isAnimated&&this._getElement(),this._getElement().classList.add("show"),this._emulateAnimation(()=>{B(D)})):B(D)}hide(D){this._config.isVisible?(this._getElement().classList.remove("show"),this._emulateAnimation(()=>{this.dispose(),B(D)})):B(D)}_getElement(){if(!this._element){const D=document.createElement("div");D.className=this._config.className,this._config.isAnimated&&D.classList.add("fade"),this._element=D}return this._element}_getConfig(D){return(D={...Wt,..."object"==typeof D?D:{}}).rootElement=V(D.rootElement),De("backdrop",D,ln),D}_append(){this._isAppended||(this._config.rootElement.append(this._getElement()),I.on(this._getElement(),Fe,()=>{B(this._config.clickCallback)}),this._isAppended=!0)}dispose(){this._isAppended&&(I.off(this._element,Fe),this._element.remove(),this._isAppended=!1)}_emulateAnimation(D){i(D,this._getElement(),this._config.isAnimated)}}const _t={trapElement:null,autofocus:!0},xt={trapElement:"element",autofocus:"boolean"},on=".bs.focustrap",kn="backward";class pn{constructor(D){this._config=this._getConfig(D),this._isActive=!1,this._lastTabNavDirection=null}activate(){const{trapElement:D,autofocus:te}=this._config;this._isActive||(te&&D.focus(),I.off(document,on),I.on(document,"focusin.bs.focustrap",Pe=>this._handleFocusin(Pe)),I.on(document,"keydown.tab.bs.focustrap",Pe=>this._handleKeydown(Pe)),this._isActive=!0)}deactivate(){this._isActive&&(this._isActive=!1,I.off(document,on))}_handleFocusin(D){const{target:te}=D,{trapElement:Pe}=this._config;if(te===document||te===Pe||Pe.contains(te))return;const et=z.focusableChildren(Pe);0===et.length?Pe.focus():this._lastTabNavDirection===kn?et[et.length-1].focus():et[0].focus()}_handleKeydown(D){"Tab"===D.key&&(this._lastTabNavDirection=D.shiftKey?kn:"forward")}_getConfig(D){return D={..._t,..."object"==typeof D?D:{}},De("focustrap",D,xt),D}}const Ln={backdrop:!0,keyboard:!0,focus:!0},Wn={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean"},dr="hidden.bs.modal",er="show.bs.modal",xr="resize.bs.modal",ur="click.dismiss.bs.modal",Er="keydown.dismiss.bs.modal",pr="mousedown.dismiss.bs.modal",Cr="modal-open",qr="modal-static";class fi extends N{constructor(D,te){super(D),this._config=this._getConfig(te),this._dialog=z.findOne(".modal-dialog",this._element),this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._isShown=!1,this._ignoreBackdropClick=!1,this._isTransitioning=!1,this._scrollBar=new Et}static get Default(){return Ln}static get NAME(){return"modal"}toggle(D){return this._isShown?this.hide():this.show(D)}show(D){this._isShown||this._isTransitioning||I.trigger(this._element,er,{relatedTarget:D}).defaultPrevented||(this._isShown=!0,this._isAnimated()&&(this._isTransitioning=!0),this._scrollBar.hide(),document.body.classList.add(Cr),this._adjustDialog(),this._setEscapeEvent(),this._setResizeEvent(),I.on(this._dialog,pr,()=>{I.one(this._element,"mouseup.dismiss.bs.modal",te=>{te.target===this._element&&(this._ignoreBackdropClick=!0)})}),this._showBackdrop(()=>this._showElement(D)))}hide(){if(!this._isShown||this._isTransitioning||I.trigger(this._element,"hide.bs.modal").defaultPrevented)return;this._isShown=!1;const D=this._isAnimated();D&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),this._focustrap.deactivate(),this._element.classList.remove("show"),I.off(this._element,ur),I.off(this._dialog,pr),this._queueCallback(()=>this._hideModal(),this._element,D)}dispose(){[window,this._dialog].forEach(D=>I.off(D,".bs.modal")),this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new Ce({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new pn({trapElement:this._element})}_getConfig(D){return D={...Ln,...L.getDataAttributes(this._element),..."object"==typeof D?D:{}},De("modal",D,Wn),D}_showElement(D){const te=this._isAnimated(),Pe=z.findOne(".modal-body",this._dialog);this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.append(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0,Pe&&(Pe.scrollTop=0),this._element.classList.add("show"),this._queueCallback(()=>{this._config.focus&&this._focustrap.activate(),this._isTransitioning=!1,I.trigger(this._element,"shown.bs.modal",{relatedTarget:D})},this._dialog,te)}_setEscapeEvent(){this._isShown?I.on(this._element,Er,D=>{this._config.keyboard&&"Escape"===D.key?(D.preventDefault(),this.hide()):this._config.keyboard||"Escape"!==D.key||this._triggerBackdropTransition()}):I.off(this._element,Er)}_setResizeEvent(){this._isShown?I.on(window,xr,()=>this._adjustDialog()):I.off(window,xr)}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide(()=>{document.body.classList.remove(Cr),this._resetAdjustments(),this._scrollBar.reset(),I.trigger(this._element,dr)})}_showBackdrop(D){I.on(this._element,ur,te=>{this._ignoreBackdropClick?this._ignoreBackdropClick=!1:te.target===te.currentTarget&&(!0===this._config.backdrop?this.hide():"static"===this._config.backdrop&&this._triggerBackdropTransition())}),this._backdrop.show(D)}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if(I.trigger(this._element,"hidePrevented.bs.modal").defaultPrevented)return;const{classList:D,scrollHeight:te,style:Pe}=this._element,et=te>document.documentElement.clientHeight;!et&&"hidden"===Pe.overflowY||D.contains(qr)||(et||(Pe.overflowY="hidden"),D.add(qr),this._queueCallback(()=>{D.remove(qr),et||this._queueCallback(()=>{Pe.overflowY=""},this._dialog)},this._dialog),this._element.focus())}_adjustDialog(){const D=this._element.scrollHeight>document.documentElement.clientHeight,te=this._scrollBar.getWidth(),Pe=te>0;(!Pe&&D&&!ae()||Pe&&!D&&ae())&&(this._element.style.paddingLeft=`${te}px`),(Pe&&!D&&!ae()||!Pe&&D&&ae())&&(this._element.style.paddingRight=`${te}px`)}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}static jQueryInterface(D,te){return this.each(function(){const Pe=fi.getOrCreateInstance(this,D);if("string"==typeof D){if(void 0===Pe[D])throw new TypeError(`No method named "${D}"`);Pe[D](te)}})}}I.on(document,"click.bs.modal.data-api",'[data-bs-toggle="modal"]',function(be){const D=At(this);["A","AREA"].includes(this.tagName)&&be.preventDefault(),I.one(D,er,Pe=>{Pe.defaultPrevented||I.one(D,dr,()=>{Le(this)&&this.focus()})});const te=z.findOne(".modal.show");te&&fi.getInstance(te).hide(),fi.getOrCreateInstance(D).toggle(this)}),q(fi),m(fi);const ti="offcanvas",ni={backdrop:!0,keyboard:!0,scroll:!1},Hr={backdrop:"boolean",keyboard:"boolean",scroll:"boolean"},$i=".offcanvas.show",Ri="hidden.bs.offcanvas";class ri extends N{constructor(D,te){super(D),this._config=this._getConfig(te),this._isShown=!1,this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._addEventListeners()}static get NAME(){return ti}static get Default(){return ni}toggle(D){return this._isShown?this.hide():this.show(D)}show(D){this._isShown||I.trigger(this._element,"show.bs.offcanvas",{relatedTarget:D}).defaultPrevented||(this._isShown=!0,this._element.style.visibility="visible",this._backdrop.show(),this._config.scroll||(new Et).hide(),this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add("show"),this._queueCallback(()=>{this._config.scroll||this._focustrap.activate(),I.trigger(this._element,"shown.bs.offcanvas",{relatedTarget:D})},this._element,!0))}hide(){this._isShown&&(I.trigger(this._element,"hide.bs.offcanvas").defaultPrevented||(this._focustrap.deactivate(),this._element.blur(),this._isShown=!1,this._element.classList.remove("show"),this._backdrop.hide(),this._queueCallback(()=>{this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._element.style.visibility="hidden",this._config.scroll||(new Et).reset(),I.trigger(this._element,Ri)},this._element,!0)))}dispose(){this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}_getConfig(D){return D={...ni,...L.getDataAttributes(this._element),..."object"==typeof D?D:{}},De(ti,D,Hr),D}_initializeBackDrop(){return new Ce({className:"offcanvas-backdrop",isVisible:this._config.backdrop,isAnimated:!0,rootElement:this._element.parentNode,clickCallback:()=>this.hide()})}_initializeFocusTrap(){return new pn({trapElement:this._element})}_addEventListeners(){I.on(this._element,"keydown.dismiss.bs.offcanvas",D=>{this._config.keyboard&&"Escape"===D.key&&this.hide()})}static jQueryInterface(D){return this.each(function(){const te=ri.getOrCreateInstance(this,D);if("string"==typeof D){if(void 0===te[D]||D.startsWith("_")||"constructor"===D)throw new TypeError(`No method named "${D}"`);te[D](this)}})}}I.on(document,"click.bs.offcanvas.data-api",'[data-bs-toggle="offcanvas"]',function(be){const D=At(this);if(["A","AREA"].includes(this.tagName)&&be.preventDefault(),_(this))return;I.one(D,Ri,()=>{Le(this)&&this.focus()});const te=z.findOne($i);te&&te!==D&&ri.getInstance(te).hide(),ri.getOrCreateInstance(D).toggle(this)}),I.on(window,"load.bs.offcanvas.data-api",()=>z.find($i).forEach(be=>ri.getOrCreateInstance(be).show())),q(ri),m(ri);const Ki=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),Ni=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i,Oi=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i,bi=(be,D)=>{const te=be.nodeName.toLowerCase();if(D.includes(te))return!Ki.has(te)||Boolean(Ni.test(be.nodeValue)||Oi.test(be.nodeValue));const Pe=D.filter(et=>et instanceof RegExp);for(let et=0,ut=Pe.length;et{bi(Bn,Zn)||wn.removeAttribute(Bn.nodeName)})}return Pe.body.innerHTML}const ai="tooltip",Mi=new Set(["sanitize","allowList","sanitizeFn"]),Vi={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(array|string|function)",container:"(string|element|boolean)",fallbackPlacements:"array",boundary:"(string|element)",customClass:"(string|function)",sanitize:"boolean",sanitizeFn:"(null|function)",allowList:"object",popperConfig:"(null|object|function)"},Di={AUTO:"auto",TOP:"top",RIGHT:ae()?"left":"right",BOTTOM:"bottom",LEFT:ae()?"right":"left"},Ae={animation:!0,template:'',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:[0,0],container:!1,fallbackPlacements:["top","right","bottom","left"],boundary:"clippingParents",customClass:"",sanitize:!0,sanitizeFn:null,allowList:{"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},popperConfig:null},Ve={HIDE:"hide.bs.tooltip",HIDDEN:"hidden.bs.tooltip",SHOW:"show.bs.tooltip",SHOWN:"shown.bs.tooltip",INSERTED:"inserted.bs.tooltip",CLICK:"click.bs.tooltip",FOCUSIN:"focusin.bs.tooltip",FOCUSOUT:"focusout.bs.tooltip",MOUSEENTER:"mouseenter.bs.tooltip",MOUSELEAVE:"mouseleave.bs.tooltip"},tt="fade",ht="show",Ut="show",Ht=".tooltip-inner",vn="hide.bs.modal",On="hover";class ir extends N{constructor(D,te){if(void 0===Se)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");super(D),this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this._config=this._getConfig(te),this.tip=null,this._setListeners()}static get Default(){return Ae}static get NAME(){return ai}static get Event(){return Ve}static get DefaultType(){return Vi}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}toggleEnabled(){this._isEnabled=!this._isEnabled}toggle(D){if(this._isEnabled)if(D){const te=this._initializeOnDelegatedTarget(D);te._activeTrigger.click=!te._activeTrigger.click,te._isWithActiveTrigger()?te._enter(null,te):te._leave(null,te)}else{if(this.getTipElement().classList.contains(ht))return void this._leave(null,this);this._enter(null,this)}}dispose(){clearTimeout(this._timeout),I.off(this._element.closest(".modal"),vn,this._hideModalHandler),this.tip&&this.tip.remove(),this._disposePopper(),super.dispose()}show(){if("none"===this._element.style.display)throw new Error("Please use show on visible elements");if(!this.isWithContent()||!this._isEnabled)return;const D=I.trigger(this._element,this.constructor.Event.SHOW),te=oe(this._element),Pe=null===te?this._element.ownerDocument.documentElement.contains(this._element):te.contains(this._element);if(D.defaultPrevented||!Pe)return;"tooltip"===this.constructor.NAME&&this.tip&&this.getTitle()!==this.tip.querySelector(Ht).innerHTML&&(this._disposePopper(),this.tip.remove(),this.tip=null);const et=this.getTipElement(),ut=(Bn=>{do{Bn+=Math.floor(1e6*Math.random())}while(document.getElementById(Bn));return Bn})(this.constructor.NAME);et.setAttribute("id",ut),this._element.setAttribute("aria-describedby",ut),this._config.animation&&et.classList.add(tt);const Nt="function"==typeof this._config.placement?this._config.placement.call(this,et,this._element):this._config.placement,wn=this._getAttachment(Nt);this._addAttachmentClass(wn);const{container:Rn}=this._config;R.set(et,this.constructor.DATA_KEY,this),this._element.ownerDocument.documentElement.contains(this.tip)||(Rn.append(et),I.trigger(this._element,this.constructor.Event.INSERTED)),this._popper?this._popper.update():this._popper=Te(this._element,et,this._getPopperConfig(wn)),et.classList.add(ht);const Vn=this._resolvePossibleFunction(this._config.customClass);Vn&&et.classList.add(...Vn.split(" ")),"ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach(Bn=>{I.on(Bn,"mouseover",G)});const Zn=this.tip.classList.contains(tt);this._queueCallback(()=>{const Bn=this._hoverState;this._hoverState=null,I.trigger(this._element,this.constructor.Event.SHOWN),"out"===Bn&&this._leave(null,this)},this.tip,Zn)}hide(){if(!this._popper)return;const D=this.getTipElement();if(I.trigger(this._element,this.constructor.Event.HIDE).defaultPrevented)return;D.classList.remove(ht),"ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach(Pe=>I.off(Pe,"mouseover",G)),this._activeTrigger.click=!1,this._activeTrigger.focus=!1,this._activeTrigger.hover=!1;const te=this.tip.classList.contains(tt);this._queueCallback(()=>{this._isWithActiveTrigger()||(this._hoverState!==Ut&&D.remove(),this._cleanTipClass(),this._element.removeAttribute("aria-describedby"),I.trigger(this._element,this.constructor.Event.HIDDEN),this._disposePopper())},this.tip,te),this._hoverState=""}update(){null!==this._popper&&this._popper.update()}isWithContent(){return Boolean(this.getTitle())}getTipElement(){if(this.tip)return this.tip;const D=document.createElement("div");D.innerHTML=this._config.template;const te=D.children[0];return this.setContent(te),te.classList.remove(tt,ht),this.tip=te,this.tip}setContent(D){this._sanitizeAndSetContent(D,this.getTitle(),Ht)}_sanitizeAndSetContent(D,te,Pe){const et=z.findOne(Pe,D);te||!et?this.setElementContent(et,te):et.remove()}setElementContent(D,te){if(null!==D)return kt(te)?(te=V(te),void(this._config.html?te.parentNode!==D&&(D.innerHTML="",D.append(te)):D.textContent=te.textContent)):void(this._config.html?(this._config.sanitize&&(te=Si(te,this._config.allowList,this._config.sanitizeFn)),D.innerHTML=te):D.textContent=te)}getTitle(){const D=this._element.getAttribute("data-bs-original-title")||this._config.title;return this._resolvePossibleFunction(D)}updateAttachment(D){return"right"===D?"end":"left"===D?"start":D}_initializeOnDelegatedTarget(D,te){return te||this.constructor.getOrCreateInstance(D.delegateTarget,this._getDelegateConfig())}_getOffset(){const{offset:D}=this._config;return"string"==typeof D?D.split(",").map(te=>Number.parseInt(te,10)):"function"==typeof D?te=>D(te,this._element):D}_resolvePossibleFunction(D){return"function"==typeof D?D.call(this._element):D}_getPopperConfig(D){const te={placement:D,modifiers:[{name:"flip",options:{fallbackPlacements:this._config.fallbackPlacements}},{name:"offset",options:{offset:this._getOffset()}},{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"arrow",options:{element:`.${this.constructor.NAME}-arrow`}},{name:"onChange",enabled:!0,phase:"afterWrite",fn:Pe=>this._handlePopperPlacementChange(Pe)}],onFirstUpdate:Pe=>{Pe.options.placement!==Pe.placement&&this._handlePopperPlacementChange(Pe)}};return{...te,..."function"==typeof this._config.popperConfig?this._config.popperConfig(te):this._config.popperConfig}}_addAttachmentClass(D){this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(D)}`)}_getAttachment(D){return Di[D.toUpperCase()]}_setListeners(){this._config.trigger.split(" ").forEach(D=>{if("click"===D)I.on(this._element,this.constructor.Event.CLICK,this._config.selector,te=>this.toggle(te));else if("manual"!==D){const Pe=D===On?this.constructor.Event.MOUSELEAVE:this.constructor.Event.FOCUSOUT;I.on(this._element,D===On?this.constructor.Event.MOUSEENTER:this.constructor.Event.FOCUSIN,this._config.selector,et=>this._enter(et)),I.on(this._element,Pe,this._config.selector,et=>this._leave(et))}}),this._hideModalHandler=()=>{this._element&&this.hide()},I.on(this._element.closest(".modal"),vn,this._hideModalHandler),this._config.selector?this._config={...this._config,trigger:"manual",selector:""}:this._fixTitle()}_fixTitle(){const D=this._element.getAttribute("title"),te=typeof this._element.getAttribute("data-bs-original-title");(D||"string"!==te)&&(this._element.setAttribute("data-bs-original-title",D||""),!D||this._element.getAttribute("aria-label")||this._element.textContent||this._element.setAttribute("aria-label",D),this._element.setAttribute("title",""))}_enter(D,te){te=this._initializeOnDelegatedTarget(D,te),D&&(te._activeTrigger["focusin"===D.type?"focus":On]=!0),te.getTipElement().classList.contains(ht)||te._hoverState===Ut?te._hoverState=Ut:(clearTimeout(te._timeout),te._hoverState=Ut,te._config.delay&&te._config.delay.show?te._timeout=setTimeout(()=>{te._hoverState===Ut&&te.show()},te._config.delay.show):te.show())}_leave(D,te){te=this._initializeOnDelegatedTarget(D,te),D&&(te._activeTrigger["focusout"===D.type?"focus":On]=te._element.contains(D.relatedTarget)),te._isWithActiveTrigger()||(clearTimeout(te._timeout),te._hoverState="out",te._config.delay&&te._config.delay.hide?te._timeout=setTimeout(()=>{"out"===te._hoverState&&te.hide()},te._config.delay.hide):te.hide())}_isWithActiveTrigger(){for(const D in this._activeTrigger)if(this._activeTrigger[D])return!0;return!1}_getConfig(D){const te=L.getDataAttributes(this._element);return Object.keys(te).forEach(Pe=>{Mi.has(Pe)&&delete te[Pe]}),(D={...this.constructor.Default,...te,..."object"==typeof D&&D?D:{}}).container=!1===D.container?document.body:V(D.container),"number"==typeof D.delay&&(D.delay={show:D.delay,hide:D.delay}),"number"==typeof D.title&&(D.title=D.title.toString()),"number"==typeof D.content&&(D.content=D.content.toString()),De(ai,D,this.constructor.DefaultType),D.sanitize&&(D.template=Si(D.template,D.allowList,D.sanitizeFn)),D}_getDelegateConfig(){const D={};for(const te in this._config)this.constructor.Default[te]!==this._config[te]&&(D[te]=this._config[te]);return D}_cleanTipClass(){const D=this.getTipElement(),te=new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`,"g"),Pe=D.getAttribute("class").match(te);null!==Pe&&Pe.length>0&&Pe.map(et=>et.trim()).forEach(et=>D.classList.remove(et))}_getBasicClassPrefix(){return"bs-tooltip"}_handlePopperPlacementChange(D){const{state:te}=D;te&&(this.tip=te.elements.popper,this._cleanTipClass(),this._addAttachmentClass(this._getAttachment(te.placement)))}_disposePopper(){this._popper&&(this._popper.destroy(),this._popper=null)}static jQueryInterface(D){return this.each(function(){const te=ir.getOrCreateInstance(this,D);if("string"==typeof D){if(void 0===te[D])throw new TypeError(`No method named "${D}"`);te[D]()}})}}m(ir);const Lr={...ir.Default,placement:"right",offset:[0,8],trigger:"click",content:"",template:''},Yr={...ir.DefaultType,content:"(string|element|function)"},Wr={HIDE:"hide.bs.popover",HIDDEN:"hidden.bs.popover",SHOW:"show.bs.popover",SHOWN:"shown.bs.popover",INSERTED:"inserted.bs.popover",CLICK:"click.bs.popover",FOCUSIN:"focusin.bs.popover",FOCUSOUT:"focusout.bs.popover",MOUSEENTER:"mouseenter.bs.popover",MOUSELEAVE:"mouseleave.bs.popover"};class Rr extends ir{static get Default(){return Lr}static get NAME(){return"popover"}static get Event(){return Wr}static get DefaultType(){return Yr}isWithContent(){return this.getTitle()||this._getContent()}setContent(D){this._sanitizeAndSetContent(D,this.getTitle(),".popover-header"),this._sanitizeAndSetContent(D,this._getContent(),".popover-body")}_getContent(){return this._resolvePossibleFunction(this._config.content)}_getBasicClassPrefix(){return"bs-popover"}static jQueryInterface(D){return this.each(function(){const te=Rr.getOrCreateInstance(this,D);if("string"==typeof D){if(void 0===te[D])throw new TypeError(`No method named "${D}"`);te[D]()}})}}m(Rr);const jr="scrollspy",zi={offset:10,method:"auto",target:""},no={offset:"number",method:"string",target:"(string|element)"},ji="active",ao=".nav-link, .list-group-item, .dropdown-item",Xi="position";class ro extends N{constructor(D,te){super(D),this._scrollElement="BODY"===this._element.tagName?window:this._element,this._config=this._getConfig(te),this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,I.on(this._scrollElement,"scroll.bs.scrollspy",()=>this._process()),this.refresh(),this._process()}static get Default(){return zi}static get NAME(){return jr}refresh(){const te="auto"===this._config.method?this._scrollElement===this._scrollElement.window?"offset":Xi:this._config.method,Pe=te===Xi?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),z.find(ao,this._config.target).map(et=>{const ut=j(et),Nt=ut?z.findOne(ut):null;if(Nt){const wn=Nt.getBoundingClientRect();if(wn.width||wn.height)return[L[te](Nt).top+Pe,ut]}return null}).filter(et=>et).sort((et,ut)=>et[0]-ut[0]).forEach(et=>{this._offsets.push(et[0]),this._targets.push(et[1])})}dispose(){I.off(this._scrollElement,".bs.scrollspy"),super.dispose()}_getConfig(D){return(D={...zi,...L.getDataAttributes(this._element),..."object"==typeof D&&D?D:{}}).target=V(D.target)||document.documentElement,De(jr,D,no),D}_getScrollTop(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop}_getScrollHeight(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}_getOffsetHeight(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height}_process(){const D=this._getScrollTop()+this._config.offset,te=this._getScrollHeight(),Pe=this._config.offset+te-this._getOffsetHeight();if(this._scrollHeight!==te&&this.refresh(),D>=Pe){const et=this._targets[this._targets.length-1];this._activeTarget!==et&&this._activate(et)}else{if(this._activeTarget&&D0)return this._activeTarget=null,void this._clear();for(let et=this._offsets.length;et--;)this._activeTarget!==this._targets[et]&&D>=this._offsets[et]&&(void 0===this._offsets[et+1]||D`${et}[data-bs-target="${D}"],${et}[href="${D}"]`),Pe=z.findOne(te.join(","),this._config.target);Pe.classList.add(ji),Pe.classList.contains("dropdown-item")?z.findOne(".dropdown-toggle",Pe.closest(".dropdown")).classList.add(ji):z.parents(Pe,".nav, .list-group").forEach(et=>{z.prev(et,".nav-link, .list-group-item").forEach(ut=>ut.classList.add(ji)),z.prev(et,".nav-item").forEach(ut=>{z.children(ut,".nav-link").forEach(Nt=>Nt.classList.add(ji))})}),I.trigger(this._scrollElement,"activate.bs.scrollspy",{relatedTarget:D})}_clear(){z.find(ao,this._config.target).filter(D=>D.classList.contains(ji)).forEach(D=>D.classList.remove(ji))}static jQueryInterface(D){return this.each(function(){const te=ro.getOrCreateInstance(this,D);if("string"==typeof D){if(void 0===te[D])throw new TypeError(`No method named "${D}"`);te[D]()}})}}I.on(window,"load.bs.scrollspy.data-api",()=>{z.find('[data-bs-spy="scroll"]').forEach(be=>new ro(be))}),m(ro);const io="active",Yo=".active",Do=":scope > li > .active";class bo extends N{static get NAME(){return"tab"}show(){if(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&this._element.classList.contains(io))return;let D;const te=At(this._element),Pe=this._element.closest(".nav, .list-group");Pe&&(D=z.find("UL"===Pe.nodeName||"OL"===Pe.nodeName?Do:Yo,Pe),D=D[D.length-1]);const et=D?I.trigger(D,"hide.bs.tab",{relatedTarget:this._element}):null;if(I.trigger(this._element,"show.bs.tab",{relatedTarget:D}).defaultPrevented||null!==et&&et.defaultPrevented)return;this._activate(this._element,Pe);const ut=()=>{I.trigger(D,"hidden.bs.tab",{relatedTarget:this._element}),I.trigger(this._element,"shown.bs.tab",{relatedTarget:D})};te?this._activate(te,te.parentNode,ut):ut()}_activate(D,te,Pe){const et=(!te||"UL"!==te.nodeName&&"OL"!==te.nodeName?z.children(te,Yo):z.find(Do,te))[0],ut=Pe&&et&&et.classList.contains("fade"),Nt=()=>this._transitionComplete(D,et,Pe);et&&ut?(et.classList.remove("show"),this._queueCallback(Nt,D,!0)):Nt()}_transitionComplete(D,te,Pe){if(te){te.classList.remove(io);const ut=z.findOne(":scope > .dropdown-menu .active",te.parentNode);ut&&ut.classList.remove(io),"tab"===te.getAttribute("role")&&te.setAttribute("aria-selected",!1)}D.classList.add(io),"tab"===D.getAttribute("role")&&D.setAttribute("aria-selected",!0),D.classList.contains("fade")&&D.classList.add("show");let et=D.parentNode;if(et&&"LI"===et.nodeName&&(et=et.parentNode),et&&et.classList.contains("dropdown-menu")){const ut=D.closest(".dropdown");ut&&z.find(".dropdown-toggle",ut).forEach(Nt=>Nt.classList.add(io)),D.setAttribute("aria-expanded",!0)}Pe&&Pe()}static jQueryInterface(D){return this.each(function(){const te=bo.getOrCreateInstance(this);if("string"==typeof D){if(void 0===te[D])throw new TypeError(`No method named "${D}"`);te[D]()}})}}I.on(document,"click.bs.tab.data-api",'[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]',function(be){["A","AREA"].includes(this.tagName)&&be.preventDefault(),_(this)||bo.getOrCreateInstance(this).show()}),m(bo);const Ui="show",Uo="showing",Fo={animation:"boolean",autohide:"boolean",delay:"number"},Co={animation:!0,autohide:!0,delay:5e3};class co extends N{constructor(D,te){super(D),this._config=this._getConfig(te),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners()}static get DefaultType(){return Fo}static get Default(){return Co}static get NAME(){return"toast"}show(){I.trigger(this._element,"show.bs.toast").defaultPrevented||(this._clearTimeout(),this._config.animation&&this._element.classList.add("fade"),this._element.classList.remove("hide"),this._element.classList.add(Ui),this._element.classList.add(Uo),this._queueCallback(()=>{this._element.classList.remove(Uo),I.trigger(this._element,"shown.bs.toast"),this._maybeScheduleHide()},this._element,this._config.animation))}hide(){this._element.classList.contains(Ui)&&(I.trigger(this._element,"hide.bs.toast").defaultPrevented||(this._element.classList.add(Uo),this._queueCallback(()=>{this._element.classList.add("hide"),this._element.classList.remove(Uo),this._element.classList.remove(Ui),I.trigger(this._element,"hidden.bs.toast")},this._element,this._config.animation)))}dispose(){this._clearTimeout(),this._element.classList.contains(Ui)&&this._element.classList.remove(Ui),super.dispose()}_getConfig(D){return D={...Co,...L.getDataAttributes(this._element),..."object"==typeof D&&D?D:{}},De("toast",D,this.constructor.DefaultType),D}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout(()=>{this.hide()},this._config.delay)))}_onInteraction(D,te){switch(D.type){case"mouseover":case"mouseout":this._hasMouseInteraction=te;break;case"focusin":case"focusout":this._hasKeyboardInteraction=te}if(te)return void this._clearTimeout();const Pe=D.relatedTarget;this._element===Pe||this._element.contains(Pe)||this._maybeScheduleHide()}_setListeners(){I.on(this._element,"mouseover.bs.toast",D=>this._onInteraction(D,!0)),I.on(this._element,"mouseout.bs.toast",D=>this._onInteraction(D,!1)),I.on(this._element,"focusin.bs.toast",D=>this._onInteraction(D,!0)),I.on(this._element,"focusout.bs.toast",D=>this._onInteraction(D,!1))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(D){return this.each(function(){const te=co.getOrCreateInstance(this,D);if("string"==typeof D){if(void 0===te[D])throw new TypeError(`No method named "${D}"`);te[D](this)}})}}return q(co),m(co),{Alert:Z,Button:we,Carousel:pt,Collapse:ce,Dropdown:rr,Modal:fi,Offcanvas:ri,Popover:Rr,ScrollSpy:ro,Tab:bo,Toast:co,Tooltip:ir}}),function(){"use strict";var Kt,yn=document.createElement("style");yn.innerHTML="@keyframes wb-fade-in{0%{opacity:0}to{opacity:.85}}.no-move:not(.min) .wb-title,.winbox.max .wb-body~div,.winbox.min .wb-body~div,.winbox.modal .wb-body~div,.winbox.modal .wb-title,body.wb-drag iframe{pointer-events:none}.winbox{position:fixed;left:0;top:0;background:#0050ff;box-shadow:0 14px 28px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.22);transition:width .3s,height .3s,transform .3s;transition-timing-function:cubic-bezier(.3,1,.3,1);will-change:transform,width,height;contain:layout size;text-align:left;touch-action:none;min-height:35px}.wb-header,.wb-icon{height:35px}.wb-n,.wb-s{left:0;height:10px;position:absolute}.wb-body{top:35px}.wb-header,.winbox iframe{position:absolute;width:100%}.wb-header{left:0;top:0;color:#fff;overflow:hidden;z-index:1}.wb-body{position:absolute;left:0;right:0;bottom:0;overflow:auto;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;will-change:contents;background:#fff;margin-top:0!important;contain:strict}.wb-title{line-height:35px;font-family:Arial,sans-serif;font-size:14px;padding-left:10px;cursor:move;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wb-n{top:-5px;right:0;cursor:n-resize}.wb-e{position:absolute;top:0;right:-5px;bottom:0;width:10px;cursor:w-resize}.wb-s,.wb-se,.wb-sw{bottom:-5px}.wb-s{right:0;cursor:n-resize}.wb-w{position:absolute;top:0;left:-5px;bottom:0;width:10px;cursor:w-resize}.wb-ne,.wb-nw,.wb-sw{width:15px;height:15px;position:absolute}.wb-nw{top:-5px;left:-5px;cursor:nw-resize}.wb-ne,.wb-sw{cursor:ne-resize}.wb-ne{top:-5px;right:-5px}.wb-sw{left:-5px}.wb-se{position:absolute;right:-5px;width:15px;height:15px;cursor:nw-resize}.wb-icon{float:right;max-width:100%;text-align:center}.wb-icon *{display:inline-block;width:30px;height:100%;background-position:center;background-repeat:no-repeat;cursor:pointer;max-width:100%}.no-close .wb-close,.no-full .wb-full,.no-header .wb-header,.no-max .wb-max,.no-min .wb-min,.no-resize .wb-body~div,.winbox.hide,.winbox.min .wb-body>*,.winbox.min .wb-full,.winbox.min .wb-min,.winbox.modal .wb-full,.winbox.modal .wb-max,.winbox.modal .wb-min{display:none}.winbox.max .wb-title,.winbox.min .wb-title{cursor:default}.wb-min{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAyIj48cGF0aCBmaWxsPSIjZmZmIiBkPSJNOCAwaDdhMSAxIDAgMCAxIDAgMkgxYTEgMSAwIDAgMSAwLTJoN3oiLz48L3N2Zz4=);background-size:14px auto;background-position:center bottom 11px}.wb-max{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmZmYiIHZpZXdCb3g9IjAgMCA5NiA5NiI+PHBhdGggZD0iTTIwIDcxLjMxMUMxNS4zNCA2OS42NyAxMiA2NS4yMyAxMiA2MFYyMGMwLTYuNjMgNS4zNy0xMiAxMi0xMmg0MGM1LjIzIDAgOS42NyAzLjM0IDExLjMxMSA4SDI0Yy0yLjIxIDAtNCAxLjc5LTQgNHY1MS4zMTF6Ii8+PHBhdGggZD0iTTkyIDc2VjM2YzAtNi42My01LjM3LTEyLTEyLTEySDQwYy02LjYzIDAtMTIgNS4zNy0xMiAxMnY0MGMwIDYuNjMgNS4zNyAxMiAxMiAxMmg0MGM2LjYzIDAgMTItNS4zNyAxMi0xMnptLTUyIDRjLTIuMjEgMC00LTEuNzktNC00VjM2YzAtMi4yMSAxLjc5LTQgNC00aDQwYzIuMjEgMCA0IDEuNzkgNCA0djQwYzAgMi4yMS0xLjc5IDQtNCA0SDQweiIvPjwvc3ZnPg==);background-size:17px auto}.wb-close{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ii0xIC0xIDE4IDE4Ij48cGF0aCBmaWxsPSIjZmZmIiBkPSJtMS42MTMuMjEuMDk0LjA4M0w4IDYuNTg1IDE0LjI5My4yOTNsLjA5NC0uMDgzYTEgMSAwIDAgMSAxLjQwMyAxLjQwM2wtLjA4My4wOTRMOS40MTUgOGw2LjI5MiA2LjI5M2ExIDEgMCAwIDEtMS4zMiAxLjQ5N2wtLjA5NC0uMDgzTDggOS40MTVsLTYuMjkzIDYuMjkyLS4wOTQuMDgzQTEgMSAwIDAgMSAuMjEgMTQuMzg3bC4wODMtLjA5NEw2LjU4NSA4IC4yOTMgMS43MDdBMSAxIDAgMCAxIDEuNjEzLjIxeiIvPjwvc3ZnPg==);background-size:15px auto}.wb-full{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2Utd2lkdGg9IjIuNSIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCAzSDVhMiAyIDAgMCAwLTIgMnYzbTE4IDBWNWEyIDIgMCAwIDAtMi0yaC0zbTAgMThoM2EyIDIgMCAwIDAgMi0ydi0zTTMgMTZ2M2EyIDIgMCAwIDAgMiAyaDMiLz48L3N2Zz4=);background-size:16px auto}.winbox.hide{visibility:hidden}.max{box-shadow:none}.max .wb-body{margin:0!important}.winbox iframe{height:100%;border:0}.no-animation,body.wb-drag .winbox{transition:none}.winbox.modal:before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:inherit;border-radius:inherit}.winbox.modal:after{content:'';position:absolute;top:-100vh;left:-100vw;right:-100vw;bottom:-100vh;background:#0d1117;animation:wb-fade-in .2s ease-out forwards;z-index:-1}.no-shadow{box-shadow:none}.no-header .wb-body{top:0}";var j=document.getElementsByTagName("head")[0];j.firstChild?j.insertBefore(yn,j.firstChild):j.appendChild(yn);var At=document.createElement("div");function wt(t,o,r,d){t.addEventListener(o,r,!d&&!1!==d||d)}function kt(t){t.stopPropagation(),t.cancelable&&t.preventDefault()}function V(t,o,r){t["_s_"+o]!==(r=""+r)&&(t.style.setProperty(o,r),t["_s_"+o]=r)}At.innerHTML="
";var Le,G,ue,ve,Y,ae,m,B,De=[],_=0,oe=0;function i(t,o){if(!(this instanceof i))return new i(t);var r,d;if(G||function f(){(Le=document.body)[Y="requestFullscreen"]||Le[Y="msRequestFullscreen"]||Le[Y="webkitRequestFullscreen"]||Le[Y="mozRequestFullscreen"]||(Y=""),ae=Y&&Y.replace("request","exit").replace("mozRequest","mozCancel").replace("Request","Exit"),wt(window,"resize",function(){m=Le.clientWidth,B=Le.clientHeight,c()}),m=Le.clientWidth,B=Le.clientHeight}(),t){if(o){var h=t;t=o}if("string"==typeof t)h=t;else{if(d=t.modal)var l=r="center";var p=t.id,w=t.root,b=t.template;h=h||t.title;var I=t.mount,S=t.html,R=t.url,N=t.width,q=t.height,Z=t.minwidth,le=t.minheight;l=t.x||l,r=t.y||r;var we=t.max,ke=t.hidden,A=t.top,L=t.left,z=t.bottom,y=t.right;G=t.index||G;var C=t.onclose,M=t.onfocus,U=t.onblur,ee=t.onmove,J=t.onresize,re=t.background,Ue=t.border,We=t.class,Qe=t.splitscreen}}this.g=b||At.cloneNode(!0),this.body=this.g.getElementsByClassName("wb-body")[0],re&&this.setBackground(re),Ue&&V(this.body,"margin",Ue+(isNaN(Ue)?"":"px")),this.setTitle(h||""),t=m,o=B,A=A?g(A,o):0,z=z?g(z,o):0,t-=(L=L?g(L,t):0)+(y=y?g(y,t):0),o-=A+z,N=N?g(N,t):t/2|0,q=q?g(q,o):o/2|0,Z=Z?g(Z,t):0,le=le?g(le,o):0,l=l?g(l,t,N):L,r=r?g(r,o,q):A,G=G||10,this.g.id=this.id=p||"winbox-"+ ++_,this.g.className="winbox"+(We?" "+("string"==typeof We?We:We.join(" ")):"")+(d?" modal":""),this.x=l,this.y=r,this.width=N,this.height=q,this.j=Z,this.i=le,this.top=A,this.right=y,this.bottom=z,this.left=L,this.max=this.min=!1,this.onclose=C,this.onfocus=M,this.onblur=U,this.onmove=ee,this.onresize=J,this.l=Qe,we?this.maximize():this.move().resize(),I?this.mount(I):S?this.body.innerHTML=S:R&&this.setUrl(R),ke?this.hide():this.focus(),this.g.winbox=this,function x(t){u(t,"title"),u(t,"n"),u(t,"s"),u(t,"w"),u(t,"e"),u(t,"nw"),u(t,"ne"),u(t,"se"),u(t,"sw"),wt(t.g.getElementsByClassName("wb-min")[0],"click",function(o){kt(o),t.minimize()}),wt(t.g.getElementsByClassName("wb-max")[0],"click",function(o){kt(o),t.focus().maximize()}),Y?wt(t.g.getElementsByClassName("wb-full")[0],"click",function(o){kt(o),t.focus().fullscreen()}):t.addClass("no-full"),wt(t.g.getElementsByClassName("wb-close")[0],"click",function(o){kt(o),t.close()||(t=null)}),wt(t.g,"click",function(){t.focus()},!1)}(this),(w||Le).appendChild(this.g)}function g(t,o,r){return"string"==typeof t&&(t="center"===t?(o-r)/2|0:"right"===t||"bottom"===t?o-r:"%"===(""+(r=parseFloat(t))!==t&&t.substring((""+r).length))?o/100*r|0:r),t}function n(t){De.splice(De.indexOf(t),1),c(),t.removeClass("min"),t.min=!1,t.g.title=""}function c(){for(var h,t=De.length,o={},r={},d=0;dR)return void t.maximize()}t.max||(Le.classList.add("wb-drag"),(p=I.touches)&&(p=p[0])?(I=p,wt(window,"touchmove",d),wt(window,"touchend",h)):(wt(window,"mousemove",d),wt(window,"mouseup",h)),w=I.pageX,b=I.pageY,t.focus())}}function d(I){kt(I),p&&(I=I.touches[0]);var q,S=I.pageX,R=S-w,N=(I=I.pageY)-b;if("title"===o){t.x+=R,t.y+=N;var Z=q=1}else{if("e"===o||"se"===o||"ne"===o){t.width+=R;var le=1}else("w"===o||"sw"===o||"nw"===o)&&(t.x+=R,t.width-=R,Z=le=1);if("s"===o||"se"===o||"sw"===o){t.height+=N;var we=1}else("n"===o||"ne"===o||"nw"===o)&&(t.y+=N,t.height-=N,q=we=1)}(le||we)&&(le&&(t.width=Math.max(Math.min(t.width,m-t.x-t.right),150)),we&&(t.height=Math.max(Math.min(t.height,B-t.y-t.bottom),0)),t.resize()),(Z||q)&&(Z&&(t.x=Math.max(Math.min(t.x,m-t.width-t.right),t.left)),q&&(t.y=Math.max(Math.min(t.y,B-t.height-t.bottom),t.top)),t.move()),w=S,b=I}function h(I){kt(I),Le.classList.remove("wb-drag"),p?(window.removeEventListener("touchmove",d,!0),window.removeEventListener("touchend",h,!0)):(window.removeEventListener("mousemove",d,!0),window.removeEventListener("mouseup",h,!0))}var p,w,b,l=t.g.getElementsByClassName("wb-"+o)[0];wt(l,"mousedown",r),wt(l,"touchstart",r,{passive:!1})}function s(){if(ue=!1,document.fullscreen||document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement)return document[ae](),!0}i.new=function(t){return new i(t)},(Kt=i.prototype).mount=function(t){return this.unmount(),t.h||(t.h=t.parentNode),this.body.textContent="",this.body.appendChild(t),this},Kt.unmount=function(t){var o=this.body.firstChild;if(o){var r=t||o.h;r&&r.appendChild(o),o.h=t}return this},Kt.setTitle=function(t){return t=this.title=t,this.g.getElementsByClassName("wb-title")[0].firstChild.nodeValue=t,this},Kt.setBackground=function(t){return V(this.g,"background",t),this},Kt.setUrl=function(t){return this.body.innerHTML='',this},Kt.focus=function(){return ve!==this&&(V(this.g,"z-index",G++),this.addClass("focus"),ve&&(ve.removeClass("focus"),ve.onblur&&ve.onblur()),ve=this,this.onfocus&&this.onfocus()),this},Kt.hide=function(){return this.addClass("hide")},Kt.show=function(){return this.removeClass("hide")},Kt.minimize=function(t){return ue&&s(),!t&&this.min?(n(this),this.resize().move().focus()):!1===t||this.min||(De.push(this),c(),this.g.title=this.title,this.addClass("min"),this.min=!0),this.max&&(this.removeClass("max"),this.max=!1),this},Kt.maximize=function(t){return(typeof t>"u"||t!==this.max)&&(this.min&&n(this),(this.max=!this.max)?this.addClass("max").resize(m-this.left-this.right,B-this.top-this.bottom,!0).move(this.left,this.top,!0):this.resize().move().removeClass("max")),this},Kt.fullscreen=function(t){return(typeof t>"u"||t!==ue)&&(this.min&&(this.resize().move(),n(this)),ue&&s()||(this.body[Y](),ue=!0)),this},Kt.close=function(t){if(this.onclose&&this.onclose(t))return!0;this.min&&n(this),this.unmount(),this.g.parentNode.removeChild(this.g),ve===this&&(ve=null)},Kt.move=function(t,o,r){return t||0===t?r||(this.x=t?t=g(t,m-this.left-this.right,this.width):0,this.y=o?o=g(o,B-this.top-this.bottom,this.height):0):(t=this.x,o=this.y,this.l&&(0===t||t===m-this.width)&&this.resize(m/2,B)),V(this.g,"transform","translate("+t+"px,"+o+"px)"),this.onmove&&this.onmove(t,o),this},Kt.resize=function(t,o,r){return t||0===t?r||(this.width=t?t=g(t,m-this.left-this.right):0,this.height=o?o=g(o,B-this.top-this.bottom):0):(t=this.width,o=this.height),t=Math.max(t,this.j),o=Math.max(o,this.i),V(this.g,"width",t+"px"),V(this.g,"height",o+"px"),this.onresize&&this.onresize(t,o),this},Kt.addClass=function(t){return this.g.classList.add(t),this},Kt.removeClass=function(t){return this.g.classList.remove(t),this},window.WinBox=i}.call(this),function(Kt){"object"==typeof exports&&typeof module<"u"?module.exports=Kt():"function"==typeof define&&define.amd?define([],Kt):(typeof window>"u"?typeof global>"u"?typeof self>"u"?this:self:global:window).WebTorrent=Kt()}(function(){var Kt=Math.LN2,yn=Math.log,j=Math.pow,At=Math.abs,wt=Math.floor,kt=Math.round,V=Math.sin,De=Math.cos,Le=Math.PI,_=Math.imul,oe=Math.clz32,G=String.fromCharCode,ue=Math.max,ve=Math.ceil,Y=Math.min;return function m(B,i,g){function f(c,u){if(!i[c]){if(!B[c]){var s="function"==typeof require&&require;if(!u&&s)return s(c,!0);if(x)return x(c,!0);var t=new Error("Cannot find module '"+c+"'");throw t.code="MODULE_NOT_FOUND",t}var o=i[c]={exports:{}};B[c][0].call(o.exports,function(r){return f(B[c][1][r]||r)},o,o.exports,m,B,i,g)}return i[c].exports}for(var x="function"==typeof require&&require,n=0;n{this._notify()}),f(this,d=>{this.destroy(d)})}_read(){this._reading||(this._reading=!0,this._notify())}_notify(){if(!this._reading||0===this._missing)return;if(!this._torrent.bitfield.get(this._piece))return this._torrent.critical(this._piece,this._piece+this._criticalLength);if(this._notifying)return;if(this._notifying=!0,this._torrent.destroyed)return this.destroy(new Error("Torrent removed"));const u=this._piece,s={};u===this._torrent.pieces.length-1&&(s.length=this._torrent.lastPieceLength),this._torrent.store.get(u,s,(t,o)=>{if(this._notifying=!1,!this.destroyed)return x("read %s (length %s) (err %s)",u,o&&o.length,t&&t.message),t?this.destroy(t):(this._offset&&(o=o.slice(this._offset),this._offset=0),this._missingle===p.length-1?I:b,q=le=>{const we=le===p.length-1?I:b;return w.get(le)?we:we-p[le].missing};let Z=0;for(let le=S;le<=R;le+=1){const we=q(le);if(Z+=we,le===S&&(Z-=Y(this.offset%b,we)),le===R){const ke=N(R)-(this.offset+this.length)%b;Z-=Y(ke,we)}}return Z}get progress(){return this.length?this.downloaded/this.length:0}select(p){0===this.length||this._torrent.select(this._startPiece,this._endPiece,p)}deselect(){0===this.length||this._torrent.deselect(this._startPiece,this._endPiece,!1)}createReadStream(p){if(0===this.length){const b=new g;return s(()=>{b.end()}),b}const w=new d(this,p);return this._fileStreams.add(w),w.once("close",()=>{this._fileStreams.delete(w)}),w}getBuffer(p){u(this.createReadStream(),this.length,p)}getBlob(p){if(typeof window>"u")throw new Error("browser-only method");n(this.createReadStream(),this._getMimeType()).then(w=>p(null,w),w=>p(w))}getBlobURL(p){if(typeof window>"u")throw new Error("browser-only method");c(this.createReadStream(),this._getMimeType()).then(w=>p(null,w),w=>p(w))}appendTo(p,w,b){if(typeof window>"u")throw new Error("browser-only method");x.append(this,p,w,b)}renderTo(p,w,b){if(typeof window>"u")throw new Error("browser-only method");x.render(this,p,w,b)}_serve(p){const w={status:200,headers:{"Accept-Ranges":"bytes","Content-Type":o.getType(this.name),"Cache-Control":"no-cache, no-store, must-revalidate, max-age=0",Expires:"0"},body:"HEAD"===p.method?"":"STREAM"};"document"===p.destination&&(w.headers["Content-Type"]="application/octet-stream",w.headers["Content-Disposition"]="attachment",w.body="DOWNLOAD");let b=t(this.length,p.headers.range||"");b.constructor===Array?(w.status=206,b=b[0],w.headers["Content-Range"]=`bytes ${b.start}-${b.end}/${this.length}`,w.headers["Content-Length"]=""+(b.end-b.start+1)):w.headers["Content-Length"]=this.length;const I="GET"===p.method&&this.createReadStream(b);let S=null;return I&&this.emit("stream",{stream:I,req:p,file:this},R=>{S=R,r(R,()=>{R&&R.destroy(),I.destroy()})}),[w,S||I,S&&I]}getStreamURL(p=(()=>{})){if(typeof window>"u")throw new Error("browser-only method");if(!this._serviceWorker)throw new Error("No worker registered");if("activated"!==this._serviceWorker.state)throw new Error("Worker isn't activated");p(null,`${this._serviceWorker.scriptURL.substr(0,this._serviceWorker.scriptURL.lastIndexOf("/")+1).slice(window.location.origin.length)}webtorrent/${this._torrent.infoHash}/${encodeURI(this.path)}`)}streamTo(p,w=(()=>{})){if(typeof window>"u")throw new Error("browser-only method");if(!this._serviceWorker)throw new Error("No worker registered");if("activated"!==this._serviceWorker.state)throw new Error("Worker isn't activated");const b=this._serviceWorker.scriptURL.substr(0,this._serviceWorker.scriptURL.lastIndexOf("/")+1).slice(window.location.origin.length);p.src=`${b}webtorrent/${this._torrent.infoHash}/${encodeURI(this.path)}`,w(null,p)}_getMimeType(){return x.mime[f.extname(this.name).toLowerCase()]}_destroy(){this._destroyed=!0,this._torrent=null;for(const p of this._fileStreams)p.destroy();this._fileStreams.clear()}}},{"./file-stream.js":1,"end-of-stream":135,events:70,mime:177,path:71,"queue-microtask":218,"range-parser":223,"render-media":241,stream:72,"stream-to-blob":273,"stream-to-blob-url":272,"stream-with-known-length-to-buffer":274}],3:[function(m,B,i){const g=m("events"),{Transform:f}=m("stream"),x=m("unordered-array-remove"),n=m("debug"),c=m("bittorrent-protocol"),u=n("webtorrent:peer");let s=!1;i.enableSecure=()=>{s=!0},i.createWebRTCPeer=(d,h,l)=>{const p=new r(d.id,"webrtc");if(p.conn=d,p.swarm=h,p.throttleGroups=l,p.conn.connected)p.onConnect();else{const w=()=>{p.conn.removeListener("connect",b),p.conn.removeListener("error",I)},b=()=>{w(),p.onConnect()},I=S=>{w(),p.destroy(S)};p.conn.once("connect",b),p.conn.once("error",I),p.startConnectTimeout()}return p},i.createTCPIncomingPeer=(d,h)=>t(d,"tcpIncoming",h),i.createUTPIncomingPeer=(d,h)=>t(d,"utpIncoming",h),i.createTCPOutgoingPeer=(d,h,l)=>o(d,h,"tcpOutgoing",l),i.createUTPOutgoingPeer=(d,h,l)=>o(d,h,"utpOutgoing",l);const t=(d,h,l)=>{const p=`${d.remoteAddress}:${d.remotePort}`,w=new r(p,h);return w.conn=d,w.addr=p,w.throttleGroups=l,w.onConnect(),w},o=(d,h,l,p)=>{const w=new r(d,l);return w.addr=d,w.swarm=h,w.throttleGroups=p,w};i.createWebSeedPeer=(d,h,l,p)=>{const w=new r(h,"webSeed");return w.swarm=l,w.conn=d,w.throttleGroups=p,w.onConnect(),w};class r extends g{constructor(h,l){super(),this.id=h,this.type=l,u("new %s Peer %s",l,h),this.addr=null,this.conn=null,this.swarm=null,this.wire=null,this.connected=!1,this.destroyed=!1,this.timeout=null,this.retries=0,this.sentPe1=!1,this.sentPe2=!1,this.sentPe3=!1,this.sentPe4=!1,this.sentHandshake=!1}onConnect(){if(!this.destroyed){this.connected=!0,u("Peer %s connected",this.id),clearTimeout(this.connectTimeout);const h=this.conn;h.once("end",()=>{this.destroy()}),h.once("close",()=>{this.destroy()}),h.once("finish",()=>{this.destroy()}),h.once("error",p=>{this.destroy(p)});const l=this.wire=new c(this.type,this.retries,s);l.once("end",()=>{this.destroy()}),l.once("close",()=>{this.destroy()}),l.once("finish",()=>{this.destroy()}),l.once("error",p=>{this.destroy(p)}),l.once("pe1",()=>{this.onPe1()}),l.once("pe2",()=>{this.onPe2()}),l.once("pe3",()=>{this.onPe3()}),l.once("pe4",()=>{this.onPe4()}),l.once("handshake",(p,w)=>{this.onHandshake(p,w)}),this.startHandshakeTimeout(),this.setThrottlePipes(),this.swarm&&("tcpOutgoing"===this.type?s&&0===this.retries&&!this.sentPe1?this.sendPe1():!this.sentHandshake&&this.handshake():"tcpIncoming"!==this.type&&!this.sentHandshake&&this.handshake())}}sendPe1(){this.wire.sendPe1(),this.sentPe1=!0}onPe1(){this.sendPe2()}sendPe2(){this.wire.sendPe2(),this.sentPe2=!0}onPe2(){this.sendPe3()}sendPe3(){this.wire.sendPe3(this.swarm.infoHash),this.sentPe3=!0}onPe3(h){this.swarm&&(this.swarm.infoHashHash!==h&&this.destroy(new Error("unexpected crypto handshake info hash for this swarm")),this.sendPe4())}sendPe4(){this.wire.sendPe4(this.swarm.infoHash),this.sentPe4=!0}onPe4(){this.sentHandshake||this.handshake()}clearPipes(){this.conn.unpipe(),this.wire.unpipe()}setThrottlePipes(){const h=this;this.conn.pipe(this.throttleGroups.down.throttle()).pipe(new f({transform(l,p,w){h.emit("download",l.length),h.destroyed||w(null,l)}})).pipe(this.wire).pipe(this.throttleGroups.up.throttle()).pipe(new f({transform(l,p,w){h.emit("upload",l.length),h.destroyed||w(null,l)}})).pipe(this.conn)}onHandshake(h,l){if(!this.swarm||this.destroyed)return;if(this.swarm.destroyed)return this.destroy(new Error("swarm already destroyed"));if(h!==this.swarm.infoHash)return this.destroy(new Error("unexpected handshake info hash for this swarm"));if(l===this.swarm.peerId)return this.destroy(new Error("refusing to connect to ourselves"));u("Peer %s got handshake %s",this.id,h),clearTimeout(this.handshakeTimeout),this.retries=0;let p=this.addr;!p&&this.conn.remoteAddress&&this.conn.remotePort&&(p=`${this.conn.remoteAddress}:${this.conn.remotePort}`),this.swarm._onWire(this.wire,p),this.swarm&&!this.swarm.destroyed&&(this.sentHandshake||this.handshake())}handshake(){this.wire.handshake(this.swarm.infoHash,this.swarm.client.peerId,{dht:!this.swarm.private&&!!this.swarm.client.dht}),this.sentHandshake=!0}startConnectTimeout(){clearTimeout(this.connectTimeout),this.connectTimeout=setTimeout(()=>{this.destroy(new Error("connect timeout"))},{webrtc:25e3,tcpOutgoing:5e3,utpOutgoing:5e3}[this.type]),this.connectTimeout.unref&&this.connectTimeout.unref()}startHandshakeTimeout(){clearTimeout(this.handshakeTimeout),this.handshakeTimeout=setTimeout(()=>{this.destroy(new Error("handshake timeout"))},25e3),this.handshakeTimeout.unref&&this.handshakeTimeout.unref()}destroy(h){if(this.destroyed)return;this.destroyed=!0,this.connected=!1,u("destroy %s %s (error: %s)",this.type,this.id,h&&(h.message||h)),clearTimeout(this.connectTimeout),clearTimeout(this.handshakeTimeout);const l=this.swarm,p=this.conn,w=this.wire;this.swarm=null,this.conn=null,this.wire=null,l&&w&&x(l.wires,l.wires.indexOf(w)),p&&(p.on("error",()=>{}),p.destroy()),w&&w.destroy(),l&&l.removePeer(this.id)}}},{"bittorrent-protocol":32,debug:105,events:70,stream:72,"unordered-array-remove":284}],4:[function(m,B){B.exports=class{constructor(i){this._torrent=i,this._numPieces=i.pieces.length,this._pieces=Array(this._numPieces),this._onWire=g=>{this.recalculate(),this._initWire(g)},this._onWireHave=g=>{this._pieces[g]+=1},this._onWireBitfield=()=>{this.recalculate()},this._torrent.wires.forEach(g=>{this._initWire(g)}),this._torrent.on("wire",this._onWire),this.recalculate()}getRarestPiece(i){let g=[],f=1/0;for(let x=0;x{this._cleanupWireEvents(i)}),this._torrent=null,this._pieces=null,this._onWire=null,this._onWireHave=null,this._onWireBitfield=null}_initWire(i){i._onClose=()=>{this._cleanupWireEvents(i);for(let g=0;g"u")throw new Error("browser-only property");return this.torrentFile?URL.createObjectURL(new Blob([this.torrentFile],{type:"application/x-bittorrent"})):null}get _numQueued(){return this._queue.length+(this._peersLength-this._numConns)}get _numConns(){let ie=0;for(const pe in this._peers)this._peers[pe].connected&&(ie+=1);return ie}_onTorrentId(ie){if(this.destroyed)return;let pe;try{pe=A(ie)}catch{}pe?(this.infoHash=pe.infoHash,this._debugId=pe.infoHash.toString("hex").substring(0,7),y(()=>{this.destroyed||this._onParsedTorrent(pe)})):A.remote(ie,(Ye,at)=>this.destroyed?void 0:Ye?this._destroy(Ye):void this._onParsedTorrent(at))}_onParsedTorrent(ie){if(!this.destroyed){if(this._processParsedTorrent(ie),!this.infoHash)return this._destroy(new Error("Malformed torrent data: No info hash"));this._rechokeIntervalId=setInterval(()=>{this._rechoke()},1e4),this._rechokeIntervalId.unref&&this._rechokeIntervalId.unref(),this.emit("_infoHash",this.infoHash),!this.destroyed&&(this.emit("infoHash",this.infoHash),this.destroyed||(this.client.listening?this._onListening():this.client.once("listening",()=>{this._onListening()})))}}_processParsedTorrent(ie){this._debugId=ie.infoHash.toString("hex").substring(0,7),typeof this.private<"u"&&(ie.private=this.private),this.announce&&(ie.announce=ie.announce.concat(this.announce)),this.client.tracker&&g.WEBTORRENT_ANNOUNCE&&!ie.private&&(ie.announce=ie.announce.concat(g.WEBTORRENT_ANNOUNCE)),this.urlList&&(ie.urlList=ie.urlList.concat(this.urlList)),ie.announce=Array.from(new Set(ie.announce)),ie.urlList=Array.from(new Set(ie.urlList)),Object.assign(this,ie),this.magnetURI=A.toMagnetURI(ie),this.torrentFile=A.toTorrentFile(ie)}_onListening(){this.destroyed||(this.info?this._onMetadata(this):(this.xs&&this._getMetadataFromServer(),this._startDiscovery()))}_startDiscovery(){if(this.discovery||this.destroyed)return;let ie=this.client.tracker;ie&&(ie=Object.assign({},this.client.tracker,{getAnnounceOpts:()=>{if(!this.destroyed){const pe={uploaded:this.uploaded,downloaded:this.downloaded,left:ue(this.length-this.downloaded,0)};return this.client.tracker.getAnnounceOpts&&Object.assign(pe,this.client.tracker.getAnnounceOpts()),this._getAnnounceOpts&&Object.assign(pe,this._getAnnounceOpts()),pe}}})),this.peerAddresses&&this.peerAddresses.forEach(pe=>this.addPeer(pe)),this.discovery=new I({infoHash:this.infoHash,announce:this.announce,peerId:this.client.peerId,dht:!this.private&&this.client.dht,tracker:ie,port:this.client.torrentPort,userAgent:se,lsd:this.client.lsd}),this.discovery.on("error",pe=>{this._destroy(pe)}),this.discovery.on("peer",(pe,Ye)=>{this._debug("peer %s discovered via %s",pe,Ye),"string"==typeof pe&&this.done||this.addPeer(pe)}),this.discovery.on("trackerAnnounce",()=>{this.emit("trackerAnnounce"),0===this.numPeers&&this.emit("noPeers","tracker")}),this.discovery.on("dhtAnnounce",()=>{this.emit("dhtAnnounce"),0===this.numPeers&&this.emit("noPeers","dht")}),this.discovery.on("warning",pe=>{this.emit("warning",pe)})}_getMetadataFromServer(){const pe=this,at=(Array.isArray(this.xs)?this.xs:[this.xs]).map(dt=>Gt=>{!function ie(dt,Gt){if(0!==dt.indexOf("http://")&&0!==dt.indexOf("https://"))return pe.emit("warning",new Error(`skipping non-http xs param: ${dt}`)),Gt(null);let an;try{an=R.concat({url:dt,method:"GET",headers:{"user-agent":se}},function Jt(Cn,hn,En){if(pe.destroyed||pe.metadata)return Gt(null);if(Cn)return pe.emit("warning",new Error(`http error from xs param: ${dt}`)),Gt(null);if(200!==hn.statusCode)return pe.emit("warning",new Error(`non-200 status code ${hn.statusCode} from xs param: ${dt}`)),Gt(null);let Xn;try{Xn=A(En)}catch{}return Xn?Xn.infoHash===pe.infoHash?(pe._onMetadata(Xn),void Gt(null)):(pe.emit("warning",new Error(`got torrent file with incorrect info hash from xs param: ${dt}`)),Gt(null)):(pe.emit("warning",new Error(`got invalid torrent file from xs param: ${dt}`)),Gt(null))})}catch{return pe.emit("warning",new Error(`skipping invalid url xs param: ${dt}`)),Gt(null)}pe._xsRequests.push(an)}(dt,Gt)});we(at)}_onMetadata(ie){if(this.metadata||this.destroyed)return;let pe;if(this._debug("got metadata"),this._xsRequests.forEach(at=>{at.abort()}),this._xsRequests=[],ie&&ie.infoHash)pe=ie;else try{pe=A(ie)}catch(at){return this._destroy(at)}this._processParsedTorrent(pe),this.metadata=this.torrentFile,this.client.enableWebSeeds&&this.urlList.forEach(at=>{this.addWebSeed(at)}),this._rarityMap=new We(this),this.files=this.files.map(at=>new re(this,at));let Ye=this._preloadedStore;if(Ye||(Ye=new this._store(this.pieceLength,{...this.storeOpts,torrent:this,path:this.path,files:this.files,length:this.length,name:this.name+" - "+this.infoHash.slice(0,8),addUID:this.addUID})),0{this.so.includes(dt)?this.files[dt].select():this.files[dt].deselect()}):0!==this.pieces.length&&this.select(0,this.pieces.length-1,!1),this._hashes=this.pieces,this.pieces=this.pieces.map((at,dt)=>new L(dt===this.pieces.length-1?this.lastPieceLength:this.pieceLength)),this._reservations=this.pieces.map(()=>[]),this.bitfield=new h(this.pieces.length),this.wires.forEach(at=>{at.ut_metadata&&at.ut_metadata.setMetadata(this.metadata),this._onWireWithMetadata(at)}),this.emit("metadata"),!this.destroyed)if(this.skipVerify)this._markAllVerified(),this._onStore();else{const at=dt=>dt?this._destroy(dt):(this._debug("done verifying"),void this._onStore());this._debug("verifying existing torrent data"),this._fileModtimes&&this._store===S?this.getFileModtimes((dt,Gt)=>{if(dt)return this._destroy(dt);this.files.map((an,Cn)=>Gt[Cn]===this._fileModtimes[Cn]).every(an=>an)?(this._markAllVerified(),this._onStore()):this._verifyPieces(at)}):this._verifyPieces(at)}}getFileModtimes(ie){const pe=[];ke(this.files.map((Ye,at)=>dt=>{const Gt=this.addUID?r.join(this.name+" - "+this.infoHash.slice(0,8)):r.join(this.path,Ye.path);s.stat(Gt,(Jt,an)=>Jt&&"ENOENT"!==Jt.code?dt(Jt):(pe[at]=an&&an.mtime.getTime(),void dt(null)))}),mt,Ye=>{this._debug("done getting file modtimes"),ie(Ye,pe)})}_verifyPieces(ie){ke(this.pieces.map((pe,Ye)=>at=>{if(this.destroyed)return at(new Error("torrent is destroyed"));const dt={};Ye===this.pieces.length-1&&(dt.length=this.lastPieceLength),this.store.get(Ye,dt,(Gt,Jt)=>this.destroyed?at(new Error("torrent is destroyed")):Gt?y(()=>at(null)):void M(Jt,an=>this.destroyed?at(new Error("torrent is destroyed")):(an===this._hashes[Ye]?(this._debug("piece verified %s",Ye),this._markVerified(Ye)):this._debug("piece invalid %s",Ye),void at(null))))}),mt,ie)}rescanFiles(ie){if(this.destroyed)throw new Error("torrent is destroyed");ie||(ie=c),this._verifyPieces(pe=>pe?(this._destroy(pe),ie(pe)):(this._checkDone(),void ie(null)))}_markAllVerified(){for(let ie=0;ie{Gt.abort()}),this._rarityMap&&this._rarityMap.destroy(),this._peers)this.removePeer(dt);this.files.forEach(dt=>{dt instanceof re&&dt._destroy()});const at=this._servers.map(dt=>Gt=>{dt.destroy(Gt)});if(this.discovery&&at.push(dt=>{this.discovery.destroy(dt)}),this.store){let dt=this._destroyStoreOnDestroy;pe&&void 0!==pe.destroyStore&&(dt=pe.destroyStore),at.push(Gt=>{dt?this.store.destroy(Gt):this.store.close(Gt)})}we(at,Ye),ie&&(0===this.listenerCount("error")?this.client.emit("error",ie):this.emit("error",ie)),this.emit("close"),this.client=null,this.files=[],this.discovery=null,this.store=null,this._rarityMap=null,this._peers=null,this._servers=null,this._xsRequests=null}}addPeer(ie){if(this.destroyed)throw new Error("torrent is destroyed");if(!this.infoHash)throw new Error("addPeer() must not be called before the `infoHash` event");let pe;if(this.client.blocked){if("string"==typeof ie){let dt;try{dt=d(ie)}catch{return this._debug("ignoring peer: invalid %s",ie),this.emit("invalidPeer",ie),!1}pe=dt[0]}else"string"==typeof ie.remoteAddress&&(pe=ie.remoteAddress);if(pe&&this.client.blocked.contains(pe))return this._debug("ignoring peer: blocked %s",ie),"string"!=typeof ie&&ie.destroy(),this.emit("blockedPeer",ie),!1}const Ye=this.client.utp&&this._isIPv4(pe)?"utp":"tcp",at=!!this._addPeer(ie,Ye);return this.emit(at?"peer":"invalidPeer",ie),at}_addPeer(ie,pe){if(this.destroyed)return"string"!=typeof ie&&ie.destroy(),null;if("string"==typeof ie&&!this._validAddr(ie))return this._debug("ignoring peer: invalid %s",ie),null;const Ye=ie&&ie.id||ie;if(this._peers[Ye])return this._debug("ignoring peer: duplicate (%s)",Ye),"string"!=typeof ie&&ie.destroy(),null;if(this.paused)return this._debug("ignoring peer: torrent is paused"),"string"!=typeof ie&&ie.destroy(),null;let at;return this._debug("add peer %s",Ye),at="string"==typeof ie?"utp"===pe?Ue.createUTPOutgoingPeer(ie,this,this.client.throttleGroups):Ue.createTCPOutgoingPeer(ie,this,this.client.throttleGroups):Ue.createWebRTCPeer(ie,this,this.client.throttleGroups),this._registerPeer(at),"string"==typeof ie&&(this._queue.push(at),this._drain()),at}addWebSeed(ie){if(this.destroyed)throw new Error("torrent is destroyed");let pe,Ye;if("string"==typeof ie){if(pe=ie,!/^https?:\/\/.+/.test(pe))return this.emit("warning",new Error(`ignoring invalid web seed: ${pe}`)),void this.emit("invalidPeer",pe);if(this._peers[pe])return this.emit("warning",new Error(`ignoring duplicate web seed: ${pe}`)),void this.emit("invalidPeer",pe);Ye=new pt(pe,this)}else{if(!ie||"string"!=typeof ie.connId)return void this.emit("warning",new Error("addWebSeed must be passed a string or connection object with id property"));if(Ye=ie,pe=Ye.connId,this._peers[pe])return this.emit("warning",new Error(`ignoring duplicate web seed: ${pe}`)),void this.emit("invalidPeer",pe)}this._debug("add web seed %s",pe);const at=Ue.createWebSeedPeer(Ye,pe,this,this.client.throttleGroups);this._registerPeer(at),this.emit("peer",pe)}_addIncomingPeer(ie){return this.destroyed?ie.destroy(new Error("torrent is destroyed")):this.paused?ie.destroy(new Error("torrent is paused")):(this._debug("add incoming peer %s",ie.id),void this._registerPeer(ie))}_registerPeer(ie){ie.on("download",pe=>{this.destroyed||(this.received+=pe,this._downloadSpeed(pe),this.client._downloadSpeed(pe),this.emit("download",pe),this.destroyed||this.client.emit("download",pe))}),ie.on("upload",pe=>{this.destroyed||(this.uploaded+=pe,this._uploadSpeed(pe),this.client._uploadSpeed(pe),this.emit("upload",pe),this.destroyed||this.client.emit("upload",pe))}),this._peers[ie.id]=ie,this._peersLength+=1}removePeer(ie){const pe=ie&&ie.id||ie;(ie=this._peers[pe])&&(this._debug("removePeer %s",pe),delete this._peers[pe],this._peersLength-=1,ie.destroy(),this._drain())}select(ie,pe,Ye,at){if(this.destroyed)throw new Error("torrent is destroyed");if(0>ie||peGt.priority-dt.priority),this._updateSelections()}deselect(ie,pe,Ye){if(this.destroyed)throw new Error("torrent is destroyed");this._debug("deselect %s-%s (priority %s)",ie,pe,Ye=+Ye||0);for(let at=0;atthis.destroyed||this.client.dht.destroyed?void 0:ie.remoteAddress?0===Ye||65536{this._debug("wire timeout (%s)",pe),ie.destroy()}),"webSeed"!==ie.type&&ie.setTimeout(3e4,!0),ie.setKeepAlive(!0),ie.use(ee(this.metadata)),ie.ut_metadata.on("warning",Ye=>{this._debug("ut_metadata warning: %s",Ye.message)}),this.metadata||(ie.ut_metadata.on("metadata",Ye=>{this._debug("got metadata via ut_metadata"),this._onMetadata(Ye)}),ie.ut_metadata.fetch()),"function"!=typeof J||this.private||(ie.use(J()),ie.ut_pex.on("peer",Ye=>{this.done||(this._debug("ut_pex: got peer: %s (from %s)",Ye,pe),this.addPeer(Ye))}),ie.ut_pex.on("dropped",Ye=>{const at=this._peers[Ye];at&&!at.connected&&(this._debug("ut_pex: dropped peer: %s (from %s)",Ye,pe),this.removePeer(Ye))}),ie.once("close",()=>{ie.ut_pex.reset()})),ie.use(q()),this.emit("wire",ie,pe),this.metadata&&y(()=>{this._onWireWithMetadata(ie)})}_onWireWithMetadata(ie){let pe=null;const Ye=()=>{this.destroyed||ie.destroyed||(this._numQueued>2*(this._numConns-this.numPeers)&&ie.amInterested?ie.destroy():(pe=setTimeout(Ye,5e3),pe.unref&&pe.unref()))};let at;const dt=()=>{if(ie.peerPieces.buffer.length===this.bitfield.buffer.length){for(at=0;at{dt(),this._update(),this._updateWireInterest(ie)}),ie.on("have",()=>{dt(),this._update(),this._updateWireInterest(ie)}),ie.lt_donthave.on("donthave",()=>{dt(),this._update(),this._updateWireInterest(ie)}),ie.once("interested",()=>{ie.unchoke()}),ie.once("close",()=>{clearTimeout(pe)}),ie.on("choke",()=>{clearTimeout(pe),pe=setTimeout(Ye,5e3),pe.unref&&pe.unref()}),ie.on("unchoke",()=>{clearTimeout(pe),this._update()}),ie.on("request",(Gt,Jt,an,Cn)=>an>131072?ie.destroy():void(this.pieces[Gt]||this.store.get(Gt,{offset:Jt,length:an},Cn))),ie.bitfield(this.bitfield),this._updateWireInterest(ie),ie.peerExtensions.dht&&this.client.dht&&this.client.dht.listening&&ie.port(this.client.dht.address().port),"webSeed"!==ie.type&&(pe=setTimeout(Ye,5e3),pe.unref&&pe.unref()),ie.isSeeder=!1,dt()}_updateSelections(){!this.ready||this.destroyed||(y(()=>{this._gcSelections()}),this._updateInterest(),this._update())}_gcSelections(){for(let ie=0;iethis._updateWireInterest(pe)),ie===this._amInterested||this.emit(this._amInterested?"interested":"uninterested")}_updateWireInterest(ie){let pe=!1;for(let Ye=0;Ye{pe._updateWire(ie)},{timeout:250}):pe._updateWire(ie)}_updateWire(ie){function pe(Cn,hn,En,Xn){return An=>An>=Cn&&An<=hn&&!(An in En)&&ie.peerPieces.get(An)&&(!Xn||Xn(An))}function at(Cn){let hn=Cn;for(let Xn=Cn;Xn=an)return!0;const hn=function Ye(){const Cn=ie.downloadSpeed()||1;if(Cn>Ft)return()=>!0;const hn=ue(1,ie.requests.length)*L.BLOCK_LENGTH/Cn;let En=10,Xn=0;return An=>{if(!En||Gt.bitfield.get(An))return!0;for(let Pn=Gt.pieces[An].missing;XnAn));){for(;Gt._request(ie,An,Gt._critical[An]||Cn););if(!(ie.requests.lengthEn));){if(Gt._request(ie,En,!1))return;Pn[En]=!0,mr+=1}}else for(En=hn.to;En>=hn.from+hn.offset;--En)if(ie.peerPieces.get(En)&&Gt._request(ie,En,!1))return}}();const Jt=f(ie,.5);if(ie.requests.length>=Jt)return;const an=f(ie,1);dt(!1)||dt(!0)}_rechoke(){if(this.ready){const ie=this.wires.map(pe=>({wire:pe,random:Math.random()})).sort((pe,Ye)=>{const at=pe.wire,dt=Ye.wire;return at.downloadSpeed()===dt.downloadSpeed()?at.uploadSpeed()===dt.uploadSpeed()?at.amChoking===dt.amChoking?pe.random-Ye.random:at.amChoking?-1:1:at.uploadSpeed()-dt.uploadSpeed():at.downloadSpeed()-dt.downloadSpeed()}).map(pe=>pe.wire);0>=this._rechokeOptimisticTime?this._rechokeOptimisticWire=null:this._rechokeOptimisticTime-=1;for(let pe=0;0Ye.peerInterested);if(0pe!==this._rechokeOptimisticWire).forEach(pe=>pe.choke())}}_hotswap(ie,pe){const Ye=ie.downloadSpeed();if(Ye=Ft||2*Cn>Ye||Cn>dt||(Gt=an,dt=Cn)}if(!Gt)return!1;for(Jt=0;Jt{dt._update()})}const dt=this,Gt=ie.requests.length,Jt="webSeed"===ie.type;if(dt.bitfield.get(pe))return!1;const an=Jt?Y(function x(Je,ie,pe){return 1+ve(ie*Je.downloadSpeed()/pe)}(ie,1,dt.pieceLength),dt.maxWebConns):f(ie,1);if(Gt>=an)return!1;const Cn=dt.pieces[pe];let hn=Jt?Cn.reserveRemaining():Cn.reserve();if(-1===hn&&Ye&&dt._hotswap(ie,pe)&&(hn=Jt?Cn.reserveRemaining():Cn.reserve()),-1===hn)return!1;let En=dt._reservations[pe];En||(En=dt._reservations[pe]=[]);let Xn=En.indexOf(null);-1===Xn&&(Xn=En.length),En[Xn]=ie;const An=Cn.chunkOffset(hn),Pn=Jt?Cn.chunkLengthRemaining(hn):Cn.chunkLength(hn);return ie.request(pe,An,Pn,function mr(Mt,Kn){if(dt.destroyed)return;if(!dt.ready)return dt.once("ready",()=>{mr(Mt,Kn)});if(En[Xn]===ie&&(En[Xn]=null),Cn!==dt.pieces[pe])return at();if(Mt)return dt._debug("error getting piece %s (offset: %s length: %s) from %s: %s",pe,An,Pn,`${ie.remoteAddress}:${ie.remotePort}`,Mt.message),Jt?Cn.cancelRemaining(hn):Cn.cancel(hn),void at();if(dt._debug("got piece %s (offset: %s length: %s) from %s",pe,An,Pn,`${ie.remoteAddress}:${ie.remotePort}`),!Cn.set(hn,Kn,ie))return at();const ge=Cn.flush();M(ge,Re=>{dt.destroyed||(Re===dt._hashes[pe]?(dt._debug("piece verified %s",pe),dt.store.put(pe,ge,je=>je?void dt._destroy(je):(dt.pieces[pe]=null,dt._markVerified(pe),dt.wires.forEach(Ze=>{Ze.have(pe)}),dt._checkDone()&&!dt.destroyed&&dt.discovery.complete(),void at()))):(dt.pieces[pe]=new L(Cn.length),dt.emit("warning",new Error(`Piece ${pe} failed verification`)),at()))})}),!0}_checkDone(){if(this.destroyed)return;this.files.forEach(pe=>{if(!pe.done){for(let Ye=pe._startPiece;Ye<=pe._endPiece;++Ye)if(!this.bitfield.get(Ye))return;pe.done=!0,pe.emit("done"),this._debug(`file done: ${pe.name}`)}});let ie=!0;for(const pe of this._selections){for(let Ye=pe.from;Ye<=pe.to;Ye++)if(!this.bitfield.get(Ye)){ie=!1;break}if(!ie)break}return!this.done&&ie?(this.done=!0,this._debug(`torrent done: ${this.infoHash}`),this.emit("done")):this.done=!1,this._gcSelections(),ie}load(ie,pe){if(this.destroyed)throw new Error("torrent is destroyed");if(!this.ready)return this.once("ready",()=>{this.load(ie,pe)});Array.isArray(ie)||(ie=[ie]),pe||(pe=c);const Ye=new le(ie),at=new p(this.store,this.pieceLength);z(Ye,at,dt=>dt?pe(dt):(this._markAllVerified(),this._checkDone(),void pe(null)))}createServer(ie){if("function"!=typeof Qe)throw new Error("node.js-only method");if(this.destroyed)throw new Error("torrent is destroyed");const pe=new Qe(this,ie);return this._servers.push(pe),pe}pause(){this.destroyed||(this._debug("pause"),this.paused=!0)}resume(){this.destroyed||(this._debug("resume"),this.paused=!1,this._drain())}_debug(){const ie=[].slice.call(arguments);ie[0]=`[${this.client?this.client._debugId:"No Client"}] [${this._debugId}] ${ie[0]}`,Xt(...ie)}_drain(){if(this._debug("_drain numConns %s maxConns %s",this._numConns,this.client.maxConns),"function"!=typeof t.connect||this.destroyed||this.paused||this._numConns>=this.client.maxConns)return;this._debug("drain (%s queued, %s/%s peers)",this._numQueued,this.numPeers,this.client.maxConns);const ie=this._queue.shift();if(!ie)return;this._debug("%s connect attempt to %s",ie.type,ie.addr);const pe=d(ie.addr),Ye={host:pe[0],port:pe[1]};ie.conn=this.client.utp&&"utpOutgoing"===ie.type?ft.connect(Ye.port,Ye.host):t.connect(Ye);const at=ie.conn;at.once("connect",()=>{ie.onConnect()}),at.once("error",dt=>{ie.destroy(dt)}),ie.startConnectTimeout(),at.on("close",()=>{if(!this.destroyed){if(ie.retries>=St.length){if(this.client.utp){const Jt=this._addPeer(ie.addr,"tcp");Jt&&(Jt.retries=0)}else this._debug("conn %s closed: will not re-add (max %s attempts)",ie.addr,St.length);return}const dt=St[ie.retries];this._debug("conn %s closed: will re-add to queue in %sms (attempt %s)",ie.addr,dt,ie.retries+1);const Gt=setTimeout(()=>{if(!this.destroyed){const Jt=d(ie.addr)[0],an=this.client.utp&&this._isIPv4(Jt)?"utp":"tcp",Cn=this._addPeer(ie.addr,an);Cn&&(Cn.retries=ie.retries+1)}},dt);Gt.unref&&Gt.unref()}})}_validAddr(ie){let pe;try{pe=d(ie)}catch{return!1}const at=pe[1];return 0at&&("127.0.0.1"!==pe[0]||at!==this.client.torrentPort)}_isIPv4(ie){return/^((?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$/.test(ie)}}}).call(this)}).call(this,m("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"../package.json":293,"./file.js":2,"./peer.js":3,"./rarity-map.js":4,"./server.js":41,"./utp.js":41,"./webconn.js":6,_process:205,"addr-to-ip-port":7,bitfield:31,"cache-chunk-store":92,"chunk-store-stream/write":93,cpus:96,debug:105,events:70,fs:41,"fs-chunk-store":173,"immediate-chunk-store":158,lt_donthave:169,"memory-chunk-store":173,multistream:189,net:41,os:41,"parse-torrent":197,path:71,pump:213,"queue-microtask":218,"random-iterate":220,"run-parallel":245,"run-parallel-limit":244,"simple-get":258,"simple-sha1":260,speedometer:267,"torrent-discovery":280,"torrent-piece":281,ut_metadata:287,ut_pex:41}],6:[function(m,B){(function(i){(function(){const{default:g}=m("bitfield"),f=m("debug"),x=m("simple-get"),n=m("lt_donthave"),c=m("simple-sha1"),u=m("bittorrent-protocol"),s=f("webtorrent:webconn"),t=m("../package.json").version;B.exports=class extends u{constructor(o,r){super(),this.url=o,this.connId=o,this.webPeerId=c.sync(o),this._torrent=r,this._init()}_init(){this.setKeepAlive(!0),this.use(n()),this.once("handshake",o=>{if(this.destroyed)return;this.handshake(o,this.webPeerId);const r=this._torrent.pieces.length,d=new g(r);for(let h=0;h<=r;h++)d.set(h,!0);this.bitfield(d)}),this.once("interested",()=>{s("interested"),this.unchoke()}),this.on("uninterested",()=>{s("uninterested")}),this.on("choke",()=>{s("choke")}),this.on("unchoke",()=>{s("unchoke")}),this.on("bitfield",()=>{s("bitfield")}),this.lt_donthave.on("donthave",()=>{s("donthave")}),this.on("request",(o,r,d,h)=>{s("request pieceIndex=%d offset=%d length=%d",o,r,d),this.httpRequest(o,r,d,(l,p)=>{if(l){this.lt_donthave.donthave(o);const w=setTimeout(()=>{this.destroyed||this.have(o)},1e4);w.unref&&w.unref()}h(l,p)})})}httpRequest(o,r,d,h){const p=o*this._torrent.pieceLength+r,w=p+d-1,b=this._torrent.files;let I;if(1>=b.length)I=[{url:this.url,start:p,end:w}];else{const q=b.filter(Z=>Z.offset<=w&&Z.offset+Z.length>p);if(1>q.length)return h(new Error("Could not find file corresponding to web seed range request"));I=q.map(Z=>{const le=Z.offset+Z.length-1;return{url:this.url+("/"===this.url[this.url.length-1]?"":"/")+Z.path,fileOffsetInRange:ue(Z.offset-p,0),start:ue(p-Z.offset,0),end:Y(le,w-Z.offset)}})}let N,S=0,R=!1;1{function Z(L,z){return 200>L.statusCode||300<=L.statusCode?R?void 0:(R=!0,h(new Error(`Unexpected HTTP status code ${L.statusCode}`))):(s("Got data of length %d",z.length),void(1===I.length?h(null,z):(z.copy(N,q.fileOffsetInRange),++S===I.length&&h(null,N))))}const le=q.url,we=q.start,ke=q.end;s("Requesting url=%s pieceIndex=%d offset=%d length=%d start=%d end=%d",le,o,r,d,we,ke);const A={url:le,method:"GET",headers:{"user-agent":`WebTorrent/${t} (https://webtorrent.io)`,range:`bytes=${we}-${ke}`},timeout:6e4};x.concat(A,(L,z,y)=>R?void 0:L?typeof window>"u"||le.startsWith(`${window.location.origin}/`)?(R=!0,h(L)):x.head(le,(C,M)=>R?void 0:C?(R=!0,h(C)):200>M.statusCode||300<=M.statusCode?(R=!0,h(new Error(`Unexpected HTTP status code ${M.statusCode}`))):M.url===le?(R=!0,h(L)):(A.url=M.url,void x.concat(A,(U,ee,J)=>R?void 0:U?(R=!0,h(U)):void Z(ee,J)))):void Z(z,y))})}destroy(){super.destroy(),this._torrent=null}}}).call(this)}).call(this,m("buffer").Buffer)},{"../package.json":293,bitfield:31,"bittorrent-protocol":32,buffer:69,debug:105,lt_donthave:169,"simple-get":258,"simple-sha1":260}],7:[function(m,B){let i=new Map;B.exports=function(g){if(1e5===i.size&&i.clear(),!i.has(g)){const f=/^\[?([^\]]+)]?:(\d+)$/.exec(g);if(!f)throw new Error(`invalid addr: ${g}`);i.set(g,[f[1],+f[2]])}return i.get(g)}},{}],8:[function(m,B,i){"use strict";const g=i;g.bignum=m("bn.js"),g.define=m("./asn1/api").define,g.base=m("./asn1/base"),g.constants=m("./asn1/constants"),g.decoders=m("./asn1/decoders"),g.encoders=m("./asn1/encoders")},{"./asn1/api":9,"./asn1/base":11,"./asn1/constants":15,"./asn1/decoders":17,"./asn1/encoders":20,"bn.js":22}],9:[function(m,B,i){"use strict";function g(c,u){this.name=c,this.body=u,this.decoders={},this.encoders={}}const f=m("./encoders"),x=m("./decoders"),n=m("inherits");i.define=function(c,u){return new g(c,u)},g.prototype._createNamed=function(c){function u(t){this._initNamed(t,s)}const s=this.name;return n(u,c),u.prototype._initNamed=function(t,o){c.call(this,t,o)},new u(this)},g.prototype._getDecoder=function(c){return this.decoders.hasOwnProperty(c=c||"der")||(this.decoders[c]=this._createNamed(x[c])),this.decoders[c]},g.prototype.decode=function(c,u,s){return this._getDecoder(u).decode(c,s)},g.prototype._getEncoder=function(c){return this.encoders.hasOwnProperty(c=c||"der")||(this.encoders[c]=this._createNamed(f[c])),this.encoders[c]},g.prototype.encode=function(c,u,s){return this._getEncoder(u).encode(c,s)}},{"./decoders":17,"./encoders":20,inherits:159}],10:[function(m,B,i){"use strict";function g(u,s){return n.call(this,s),c.isBuffer(u)?(this.base=u,this.offset=0,void(this.length=u.length)):void this.error("Input not Buffer")}function f(u,s){if(Array.isArray(u))this.length=0,this.value=u.map(function(t){return f.isEncoderBuffer(t)||(t=new f(t,s)),this.length+=t.length,t},this);else if("number"==typeof u){if(!(0<=u&&255>=u))return s.error("non-byte EncoderBuffer value");this.value=u,this.length=1}else if("string"==typeof u)this.value=u,this.length=c.byteLength(u);else{if(!c.isBuffer(u))return s.error("Unsupported type: "+typeof u);this.value=u,this.length=u.length}}const x=m("inherits"),n=m("../base/reporter").Reporter,c=m("safer-buffer").Buffer;x(g,n),i.DecoderBuffer=g,g.isDecoderBuffer=function(u){return u instanceof g||"object"==typeof u&&c.isBuffer(u.base)&&"DecoderBuffer"===u.constructor.name&&"number"==typeof u.offset&&"number"==typeof u.length&&"function"==typeof u.save&&"function"==typeof u.restore&&"function"==typeof u.isEmpty&&"function"==typeof u.readUInt8&&"function"==typeof u.skip&&"function"==typeof u.raw},g.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},g.prototype.restore=function(u){const s=new g(this.base);return s.offset=u.offset,s.length=this.offset,this.offset=u.offset,n.prototype.restore.call(this,u.reporter),s},g.prototype.isEmpty=function(){return this.offset===this.length},g.prototype.readUInt8=function(u){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(u||"DecoderBuffer overrun")},g.prototype.skip=function(u,s){if(!(this.offset+u<=this.length))return this.error(s||"DecoderBuffer overrun");const t=new g(this.base);return t._reporterState=this._reporterState,t.offset=this.offset,t.length=this.offset+u,this.offset+=u,t},g.prototype.raw=function(u){return this.base.slice(u?u.offset:this.offset,this.length)},i.EncoderBuffer=f,f.isEncoderBuffer=function(u){return u instanceof f||"object"==typeof u&&"EncoderBuffer"===u.constructor.name&&"number"==typeof u.length&&"function"==typeof u.join},f.prototype.join=function(u,s){return u||(u=c.alloc(this.length)),s||(s=0),0===this.length||(Array.isArray(this.value)?this.value.forEach(function(t){t.join(u,s),s+=t.length}):("number"==typeof this.value?u[s]=this.value:"string"==typeof this.value?u.write(this.value,s):c.isBuffer(this.value)&&this.value.copy(u,s),s+=this.length)),u}},{"../base/reporter":13,inherits:159,"safer-buffer":248}],11:[function(m,B,i){"use strict";const g=i;g.Reporter=m("./reporter").Reporter,g.DecoderBuffer=m("./buffer").DecoderBuffer,g.EncoderBuffer=m("./buffer").EncoderBuffer,g.Node=m("./node")},{"./buffer":10,"./node":12,"./reporter":13}],12:[function(m,B){"use strict";function i(t,o,r){const d={};this._baseState=d,d.name=r,d.enc=t,d.parent=o||null,d.children=null,d.tag=null,d.args=null,d.reverseArgs=null,d.choice=null,d.optional=!1,d.any=!1,d.obj=!1,d.use=null,d.useDecoder=null,d.key=null,d.default=null,d.explicit=null,d.implicit=null,d.contains=null,d.parent||(d.children=[],this._wrap())}const g=m("../base/reporter").Reporter,f=m("../base/buffer").EncoderBuffer,x=m("../base/buffer").DecoderBuffer,n=m("minimalistic-assert"),c=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(c);B.exports=i;const s=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];i.prototype.clone=function(){const t=this._baseState,o={};s.forEach(function(d){o[d]=t[d]});const r=new this.constructor(o.parent);return r._baseState=o,r},i.prototype._wrap=function(){const t=this._baseState;u.forEach(function(o){this[o]=function(){const r=new this.constructor(this);return t.children.push(r),r[o].apply(r,arguments)}},this)},i.prototype._init=function(t){const o=this._baseState;n(null===o.parent),t.call(this),o.children=o.children.filter(function(r){return r._baseState.parent===this},this),n.equal(o.children.length,1,"Root node can have only one child")},i.prototype._useArgs=function(t){const o=this._baseState,r=t.filter(function(d){return d instanceof this.constructor},this);t=t.filter(function(d){return!(d instanceof this.constructor)},this),0!==r.length&&(n(null===o.children),o.children=r,r.forEach(function(d){d._baseState.parent=this},this)),0!==t.length&&(n(null===o.args),o.args=t,o.reverseArgs=t.map(function(d){if("object"!=typeof d||d.constructor!==Object)return d;const h={};return Object.keys(d).forEach(function(l){l==(0|l)&&(l|=0),h[d[l]]=l}),h}))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach(function(t){i.prototype[t]=function(){throw new Error(t+" not implemented for encoding: "+this._baseState.enc)}}),c.forEach(function(t){i.prototype[t]=function(){const o=this._baseState,r=Array.prototype.slice.call(arguments);return n(null===o.tag),o.tag=t,this._useArgs(r),this}}),i.prototype.use=function(t){n(t);const o=this._baseState;return n(null===o.use),o.use=t,this},i.prototype.optional=function(){return this._baseState.optional=!0,this},i.prototype.def=function(t){const o=this._baseState;return n(null===o.default),o.default=t,o.optional=!0,this},i.prototype.explicit=function(t){const o=this._baseState;return n(null===o.explicit&&null===o.implicit),o.explicit=t,this},i.prototype.implicit=function(t){const o=this._baseState;return n(null===o.explicit&&null===o.implicit),o.implicit=t,this},i.prototype.obj=function(){const t=this._baseState,o=Array.prototype.slice.call(arguments);return t.obj=!0,0!==o.length&&this._useArgs(o),this},i.prototype.key=function(t){const o=this._baseState;return n(null===o.key),o.key=t,this},i.prototype.any=function(){return this._baseState.any=!0,this},i.prototype.choice=function(t){const o=this._baseState;return n(null===o.choice),o.choice=t,this._useArgs(Object.keys(t).map(function(r){return t[r]})),this},i.prototype.contains=function(t){const o=this._baseState;return n(null===o.use),o.contains=t,this},i.prototype._decode=function(t,o){const r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,o));let p,d=r.default,h=!0,l=null;if(null!==r.key&&(l=t.enterKey(r.key)),r.optional){let w=null;if(null===r.explicit?null===r.implicit?null!==r.tag&&(w=r.tag):w=r.implicit:w=r.explicit,null!==w||r.any){if(h=this._peekTag(t,w,r.any),t.isError(h))return h}else{const b=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,o):this._decodeChoice(t,o),h=!0}catch{h=!1}t.restore(b)}}if(r.obj&&h&&(p=t.enterObject()),h){if(null!==r.explicit){const b=this._decodeTag(t,r.explicit);if(t.isError(b))return b;t=b}const w=t.offset;if(null===r.use&&null===r.choice){let b;r.any&&(b=t.save());const I=this._decodeTag(t,null===r.implicit?r.tag:r.implicit,r.any);if(t.isError(I))return I;r.any?d=t.raw(b):t=I}if(o&&o.track&&null!==r.tag&&o.track(t.path(),w,t.length,"tagged"),o&&o.track&&null!==r.tag&&o.track(t.path(),t.offset,t.length,"content"),r.any||(d=null===r.choice?this._decodeGeneric(r.tag,t,o):this._decodeChoice(t,o)),t.isError(d))return d;if(r.any||null!==r.choice||null===r.children||r.children.forEach(function(b){b._decode(t,o)}),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const b=new x(d);d=this._getUse(r.contains,t._reporterState.obj)._decode(b,o)}}return r.obj&&h&&(d=t.leaveObject(p)),null===r.key||null===d&&!0!==h?null!==l&&t.exitKey(l):t.leaveKey(l,r.key,d),d},i.prototype._decodeGeneric=function(t,o,r){const d=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(o,t,d.args[0],r):/str$/.test(t)?this._decodeStr(o,t,r):"objid"===t&&d.args?this._decodeObjid(o,d.args[0],d.args[1],r):"objid"===t?this._decodeObjid(o,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(o,t,r):"null_"===t?this._decodeNull(o,r):"bool"===t?this._decodeBool(o,r):"objDesc"===t?this._decodeStr(o,t,r):"int"===t||"enum"===t?this._decodeInt(o,d.args&&d.args[0],r):null===d.use?o.error("unknown tag: "+t):this._getUse(d.use,o._reporterState.obj)._decode(o,r)},i.prototype._getUse=function(t,o){const r=this._baseState;return r.useDecoder=this._use(t,o),n(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},i.prototype._decodeChoice=function(t,o){const r=this._baseState;let d=null,h=!1;return Object.keys(r.choice).some(function(l){const p=t.save(),w=r.choice[l];try{const b=w._decode(t,o);if(t.isError(b))return!1;d={type:l,value:b},h=!0}catch{return t.restore(p),!1}return!0},this),h?d:t.error("Choice not matched")},i.prototype._createEncoderBuffer=function(t){return new f(t,this.reporter)},i.prototype._encode=function(t,o,r){const d=this._baseState;if(null===d.default||d.default!==t){const h=this._encodeValue(t,o,r);return void 0===h||this._skipDefault(h,o,r)?void 0:h}},i.prototype._encodeValue=function(t,o,r){const d=this._baseState;if(null===d.parent)return d.children[0]._encode(t,o||new g);let h=null;if(this.reporter=o,d.optional&&void 0===t){if(null===d.default)return;t=d.default}let l=null,p=!1;if(d.any)h=this._createEncoderBuffer(t);else if(d.choice)h=this._encodeChoice(t,o);else if(d.contains)l=this._getUse(d.contains,r)._encode(t,o),p=!0;else if(d.children)l=d.children.map(function(w){if("null_"===w._baseState.tag)return w._encode(null,o,t);if(null===w._baseState.key)return o.error("Child should have a key");const b=o.enterKey(w._baseState.key);if("object"!=typeof t)return o.error("Child expected, but input is not object");const I=w._encode(t[w._baseState.key],o,t);return o.leaveKey(b),I},this).filter(function(w){return w}),l=this._createEncoderBuffer(l);else if("seqof"===d.tag||"setof"===d.tag){if(!d.args||1!==d.args.length)return o.error("Too many args for : "+d.tag);if(!Array.isArray(t))return o.error("seqof/setof, but data is not Array");const w=this.clone();w._baseState.implicit=null,l=this._createEncoderBuffer(t.map(function(b){return this._getUse(this._baseState.args[0],t)._encode(b,o)},w))}else null===d.use?(l=this._encodePrimitive(d.tag,t),p=!0):h=this._getUse(d.use,r)._encode(t,o);if(!d.any&&null===d.choice){const w=null===d.implicit?d.tag:d.implicit,b=null===d.implicit?"universal":"context";null===w?null===d.use&&o.error("Tag could be omitted only for .use()"):null===d.use&&(h=this._encodeComposite(w,p,b,l))}return null!==d.explicit&&(h=this._encodeComposite(d.explicit,!1,"context",h)),h},i.prototype._encodeChoice=function(t,o){const r=this._baseState,d=r.choice[t.type];return d||n(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),d._encode(t.value,o)},i.prototype._encodePrimitive=function(t,o){const r=this._baseState;if(/str$/.test(t))return this._encodeStr(o,t);if("objid"===t&&r.args)return this._encodeObjid(o,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(o,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(o,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(o,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(o);if("objDesc"===t)return this._encodeStr(o,t);throw new Error("Unsupported tag: "+t)},i.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},i.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},{"../base/buffer":10,"../base/reporter":13,"minimalistic-assert":180}],13:[function(m,B,i){"use strict";function g(n){this._reporterState={obj:null,path:[],options:n||{},errors:[]}}function f(n,c){this.path=n,this.rethrow(c)}const x=m("inherits");i.Reporter=g,g.prototype.isError=function(n){return n instanceof f},g.prototype.save=function(){const n=this._reporterState;return{obj:n.obj,pathLen:n.path.length}},g.prototype.restore=function(n){const c=this._reporterState;c.obj=n.obj,c.path=c.path.slice(0,n.pathLen)},g.prototype.enterKey=function(n){return this._reporterState.path.push(n)},g.prototype.exitKey=function(n){const c=this._reporterState;c.path=c.path.slice(0,n-1)},g.prototype.leaveKey=function(n,c,u){const s=this._reporterState;this.exitKey(n),null!==s.obj&&(s.obj[c]=u)},g.prototype.path=function(){return this._reporterState.path.join("/")},g.prototype.enterObject=function(){const n=this._reporterState,c=n.obj;return n.obj={},c},g.prototype.leaveObject=function(n){const c=this._reporterState,u=c.obj;return c.obj=n,u},g.prototype.error=function(n){let c;const u=this._reporterState,s=n instanceof f;if(c=s?n:new f(u.path.map(function(t){return"["+JSON.stringify(t)+"]"}).join(""),n.message||n,n.stack),!u.options.partial)throw c;return s||u.errors.push(c),c},g.prototype.wrapResult=function(n){const c=this._reporterState;return c.options.partial?{result:this.isError(n)?null:n,errors:c.errors}:n},x(f,Error),f.prototype.rethrow=function(n){if(this.message=n+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,f),!this.stack)try{throw new Error(this.message)}catch(c){this.stack=c.stack}return this}},{inherits:159}],14:[function(m,B,i){"use strict";function g(f){const x={};return Object.keys(f).forEach(function(n){(0|n)==n&&(n|=0),x[f[n]]=n}),x}i.tagClass={0:"universal",1:"application",2:"context",3:"private"},i.tagClassByName=g(i.tagClass),i.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},i.tagByName=g(i.tag)},{}],15:[function(m,B,i){"use strict";const g=i;g._reverse=function(f){const x={};return Object.keys(f).forEach(function(n){(0|n)==n&&(n|=0),x[f[n]]=n}),x},g.der=m("./der")},{"./der":14}],16:[function(m,B){"use strict";function i(o){this.enc="der",this.name=o.name,this.entity=o,this.tree=new g,this.tree._init(o.body)}function g(o){s.call(this,"der",o)}function f(o,r){let d=o.readUInt8(r);if(o.isError(d))return d;const h=t.tagClass[d>>6],l=0==(32&d);if(31==(31&d)){let w=d;for(d=0;128==(128&w);){if(w=o.readUInt8(r),o.isError(w))return w;d<<=7,d|=127&w}}else d&=31;return{cls:h,primitive:l,tag:d,tagStr:t.tag[d]}}function x(o,r,d){let h=o.readUInt8(d);if(o.isError(h))return h;if(!r&&128===h)return null;if(!(128&h))return h;const l=127&h;if(4h?2e3+h:1900+h}return Date.UTC(h,l-1,p,w,b,I,0)},g.prototype._decodeNull=function(){return null},g.prototype._decodeBool=function(o){const r=o.readUInt8();return o.isError(r)?r:0!==r},g.prototype._decodeInt=function(o,r){const d=o.raw();let h=new c(d);return r&&(h=r[h.toString(10)]||h),h},g.prototype._use=function(o,r){return"function"==typeof o&&(o=o(r)),o._getDecoder("der").tree}},{"../base/buffer":10,"../base/node":12,"../constants/der":14,"bn.js":22,inherits:159}],17:[function(m,B,i){"use strict";const g=i;g.der=m("./der"),g.pem=m("./pem")},{"./der":16,"./pem":18}],18:[function(m,B){"use strict";function i(n){x.call(this,n),this.enc="pem"}const g=m("inherits"),f=m("safer-buffer").Buffer,x=m("./der");g(i,x),B.exports=i,i.prototype.decode=function(n,c){const u=n.toString().split(/[\r\n]+/g),s=c.label.toUpperCase();let t=-1,o=-1;for(let h=0;ht?"0"+t:t}const n=m("inherits"),c=m("safer-buffer").Buffer,u=m("../base/node"),s=m("../constants/der");B.exports=i,i.prototype.encode=function(t,o){return this.tree._encode(t,o).join()},n(g,u),g.prototype._encodeComposite=function(t,o,r,d){const h=function x(t,o,r,d){let h;if("seqof"===t?t="seq":"setof"==t&&(t="set"),s.tagByName.hasOwnProperty(t))h=s.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return d.error("Unknown tag: "+t);h=t}return 31<=h?d.error("Multi-octet tag encoding unsupported"):(o||(h|=32),h|=s.tagClassByName[r||"universal"]<<6,h)}(t,o,r,this.reporter);if(128>d.length){const w=c.alloc(2);return w[0]=h,w[1]=d.length,this._createEncoderBuffer([w,d])}let l=1;for(let w=d.length;256<=w;w>>=8)l++;const p=c.alloc(2+l);p[0]=h,p[1]=128|l;for(let w=1+l,b=d.length;0>=8)p[w]=255&b;return this._createEncoderBuffer([p,d])},g.prototype._encodeStr=function(t,o){if("bitstr"===o)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===o){const r=c.alloc(2*t.length);for(let d=0;d>=7)d++;const h=c.alloc(d);let l=h.length-1;for(let w,p=t.length-1;0<=p;p--)for(w=t[p],h[l--]=127&w;0<(w>>=7);)h[l--]=128|127&w;return this._createEncoderBuffer(h)},g.prototype._encodeTime=function(t,o){let r;const d=new Date(t);return"gentime"===o?r=[f(d.getUTCFullYear()),f(d.getUTCMonth()+1),f(d.getUTCDate()),f(d.getUTCHours()),f(d.getUTCMinutes()),f(d.getUTCSeconds()),"Z"].join(""):"utctime"===o?r=[f(d.getUTCFullYear()%100),f(d.getUTCMonth()+1),f(d.getUTCDate()),f(d.getUTCHours()),f(d.getUTCMinutes()),f(d.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+o+" time is not supported yet"),this._encodeStr(r,"octstr")},g.prototype._encodeNull=function(){return this._createEncoderBuffer("")},g.prototype._encodeInt=function(t,o){if("string"==typeof t){if(!o)return this.reporter.error("String int or enum given, but no values map");if(!o.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=o[t]}if("number"!=typeof t&&!c.isBuffer(t)){const h=t.toArray();!t.sign&&128&h[0]&&h.unshift(0),t=c.from(h)}if(c.isBuffer(t)){let h=t.length;0===t.length&&h++;const l=c.alloc(h);return t.copy(l),0===t.length&&(l[0]=0),this._createEncoderBuffer(l)}if(128>t)return this._createEncoderBuffer(t);if(256>t)return this._createEncoderBuffer([0,t]);let r=1;for(let h=t;256<=h;h>>=8)r++;const d=Array(r);for(let h=d.length-1;0<=h;h--)d[h]=255&t,t>>=8;return 128&d[0]&&d.unshift(0),this._createEncoderBuffer(c.from(d))},g.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},g.prototype._use=function(t,o){return"function"==typeof t&&(t=t(o)),t._getEncoder("der").tree},g.prototype._skipDefault=function(t,o,r){const d=this._baseState;let h;if(null===d.default)return!1;const l=t.join();if(void 0===d.defaultBuffer&&(d.defaultBuffer=this._encodeValue(d.default,o,r).join()),l.length!==d.defaultBuffer.length)return!1;for(h=0;h=z?z-55:97<=z&&102>=z?z-87:15&z-48}function u(A,L,z){var y=c(A,z);return z-1>=L&&(y|=c(A,z-1)<<4),y}function s(A,L,z,y){for(var ee,C=0,M=Y(A.length,z),U=L;U>>26,We=67108863&J,Qe=Y(re,L.length-1),ft=ue(0,re-A.length+1);ft<=Qe;ft++)Ue+=0|(U=(C=0|A.words[0|re-ft])*(M=0|L.words[ft])+We)/67108864,We=67108863&U;z.words[re]=0|We,J=0|Ue}return 0===J?z.length--:z.words[re]=0|J,z.strip()}function d(A,L,z){return(new h).mulp(A,L,z)}function h(A,L){this.x=A,this.y=L}function l(A,L){this.name=A,this.p=new n(L,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function p(){l.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){l.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){l.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function I(){l.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(A){if("string"==typeof A){var L=n._prime(A);this.m=L.p,this.prime=L}else f(A.gtn(1),"modulus must be greater than 1"),this.m=A,this.prime=null}function R(A){S.call(this,A),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}var N;"object"==typeof i?i.exports=n:g.BN=n,n.BN=n,n.wordSize=26;try{N=typeof window<"u"&&typeof window.Buffer<"u"?window.Buffer:m("buffer").Buffer}catch{}n.isBN=function(A){return A instanceof n||null!==A&&"object"==typeof A&&A.constructor.wordSize===n.wordSize&&Array.isArray(A.words)},n.max=function(A,L){return 0A.cmp(L)?A:L},n.prototype._init=function(A,L,z){if("number"==typeof A)return this._initNumber(A,L,z);if("object"==typeof A)return this._initArray(A,L,z);"hex"===L&&(L=16),f(L===(0|L)&&2<=L&&36>=L);var y=0;"-"===(A=A.toString().replace(/\s+/g,""))[0]&&(y++,this.negative=1),yA&&(this.negative=1,A=-A),67108864>A?(this.words=[67108863&A],this.length=1):4503599627370496>A?(this.words=[67108863&A,67108863&A/67108864],this.length=2):(f(9007199254740992>A),this.words=[67108863&A,67108863&A/67108864,1],this.length=3),"le"!==z||this._initArray(this.toArray(),L,z)},n.prototype._initArray=function(A,L,z){if(f("number"==typeof A.length),0>=A.length)return this.words=[0],this.length=1,this;this.length=ve(A.length/3),this.words=Array(this.length);for(var y=0;y>>26-C,26<=(C+=24)&&(C-=26,M++);else if("le"===z)for(y=0,M=0;y>>26-C,26<=(C+=24)&&(C-=26,M++);return this.strip()},n.prototype._parseHex=function(A,L,z){this.length=ve((A.length-L)/6),this.words=Array(this.length);for(var y=0;y=L;y-=2)U=u(A,L,y)<>>26):C+=8;else for(y=(A.length-L)%2==0?L+1:L;y>>26):C+=8;this.strip()},n.prototype._parseBase=function(A,L,z){this.words=[0],this.length=1;for(var y=0,C=1;67108863>=C;C*=L)y++;y--,C=0|C/L;for(var M=A.length-z,U=M%y,ee=Y(M,M-U)+z,J=0,re=z;rethis.words[0]+J?this.words[0]+=J:this._iaddn(J);if(0!==U){var Ue=1;for(J=s(A,re,A.length,L),re=0;rethis.words[0]+J?this.words[0]+=J:this._iaddn(J)}this.strip()},n.prototype.copy=function(A){A.words=Array(this.length);for(var L=0;L"};var q=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Z=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],le=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(A,L){var z;if(L=0|L||1,16===(A=A||10)||"hex"===A){z="";for(var y=0,C=0,M=0;M>>24-y)||M!==this.length-1?q[6-ee.length]+ee+z:ee+z,26<=(y+=2)&&(y-=26,M--)}for(0!==C&&(z=C.toString(16)+z);z.length%L!=0;)z="0"+z;return 0!==this.negative&&(z="-"+z),z}if(A===(0|A)&&2<=A&&36>=A){var J=Z[A],re=le[A];z="";var Ue=this.clone();for(Ue.negative=0;!Ue.isZero();){var We=Ue.modn(re).toString(A);z=(Ue=Ue.idivn(re)).isZero()?We+z:q[J-We.length]+We+z}for(this.isZero()&&(z="0"+z);z.length%L!=0;)z="0"+z;return 0!==this.negative&&(z="-"+z),z}f(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var A=this.words[0];return 2===this.length?A+=67108864*this.words[1]:3===this.length&&1===this.words[2]?A+=4503599627370496+67108864*this.words[1]:2>>=13),64<=L&&(z+=7,L>>>=7),8<=L&&(z+=4,L>>>=4),2<=L&&(z+=2,L>>>=2),z+L},n.prototype._zeroBits=function(A){if(0===A)return 26;var L=A,z=0;return!(8191&L)&&(z+=13,L>>>=13),!(127&L)&&(z+=7,L>>>=7),!(15&L)&&(z+=4,L>>>=4),!(3&L)&&(z+=2,L>>>=2),!(1&L)&&z++,z},n.prototype.bitLength=function(){var L=this._countBits(this.words[this.length-1]);return 26*(this.length-1)+L},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var z,A=0,L=0;LA.length?this.clone().ior(A):A.clone().ior(this)},n.prototype.uor=function(A){return this.length>A.length?this.clone().iuor(A):A.clone().iuor(this)},n.prototype.iuand=function(A){for(var L=this.length>A.length?A:this,z=0;zA.length?this.clone().iand(A):A.clone().iand(this)},n.prototype.uand=function(A){return this.length>A.length?this.clone().iuand(A):A.clone().iuand(this)},n.prototype.iuxor=function(A){var L,z;this.length>A.length?(L=this,z=A):(L=A,z=this);for(var y=0;yA.length?this.clone().ixor(A):A.clone().ixor(this)},n.prototype.uxor=function(A){return this.length>A.length?this.clone().iuxor(A):A.clone().iuxor(this)},n.prototype.inotn=function(A){f("number"==typeof A&&0<=A);var L=0|ve(A/26),z=A%26;this._expand(L),0>26-z),this.strip()},n.prototype.notn=function(A){return this.clone().inotn(A)},n.prototype.setn=function(A,L){f("number"==typeof A&&0<=A);var z=0|A/26,y=A%26;return this._expand(z+1),L?this.words[z]|=1<A.length?(z=this,y=A):(z=A,y=this);for(var C=0,M=0;M>>26;for(;0!==C&&M>>26;if(this.length=z.length,0!==C)this.words[this.length]=C,this.length++;else if(z!==this)for(;MA.length?this.clone().iadd(A):A.clone().iadd(this)},n.prototype.isub=function(A){if(0!==A.negative){A.negative=0;var L=this.iadd(A);return A.negative=1,L._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(A),this.negative=1,this._normSign();var y,C,z=this.cmp(A);if(0===z)return this.negative=0,this.length=1,this.words[0]=0,this;0>26,this.words[U]=67108863&L;for(;0!==M&&U>26,this.words[U]=67108863&L;if(0===M&&U>>13,Ue=0|y[1],We=8191&Ue,Qe=Ue>>>13,ft=0|y[2],pt=8191&ft,Xt=ft>>>13,It=0|y[3],Ft=8191&It,Ke=It>>>13,mt=0|y[4],St=8191&mt,K=mt>>>13,se=0|y[5],X=8191&se,ce=se>>>13,Je=0|y[6],ie=8191&Je,pe=Je>>>13,Ye=0|y[7],at=8191&Ye,dt=Ye>>>13,Gt=0|y[8],Jt=8191&Gt,an=Gt>>>13,Cn=0|y[9],hn=8191&Cn,En=Cn>>>13,Xn=0|C[0],An=8191&Xn,Pn=Xn>>>13,mr=0|C[1],Mt=8191&mr,Kn=mr>>>13,ge=0|C[2],Re=8191&ge,je=ge>>>13,Ze=0|C[3],Xe=8191&Ze,st=Ze>>>13,tn=0|C[4],Bt=8191&tn,qt=tn>>>13,nn=0|C[5],_n=8191&nn,cn=nn>>>13,Qt=0|C[6],Ee=8191&Qt,Vt=Qt>>>13,Nn=0|C[7],mn=8191&Nn,Mn=Nn>>>13,zn=0|C[8],qn=8191&zn,Fn=zn>>>13,Gn=0|C[9],Hn=8191&Gn,Yn=Gn>>>13;z.negative=A.negative^L.negative,z.length=19;var it=0|(0|U+(rt=_(J,An)))+((8191&(de=0|(de=_(J,Pn))+_(re,An)))<<13);U=0|(0|(nt=_(re,Pn))+(de>>>13))+(it>>>26),it&=67108863,rt=_(We,An),de=0|(de=_(We,Pn))+_(Qe,An),nt=_(Qe,Pn);var ye=0|(0|U+(rt=0|rt+_(J,Mt)))+((8191&(de=0|(de=0|de+_(J,Kn))+_(re,Mt)))<<13);U=0|(0|(nt=0|nt+_(re,Kn))+(de>>>13))+(ye>>>26),ye&=67108863,rt=_(pt,An),de=0|(de=_(pt,Pn))+_(Xt,An),nt=_(Xt,Pn),rt=0|rt+_(We,Mt),de=0|(de=0|de+_(We,Kn))+_(Qe,Mt),nt=0|nt+_(Qe,Kn);var ct=0|(0|U+(rt=0|rt+_(J,Re)))+((8191&(de=0|(de=0|de+_(J,je))+_(re,Re)))<<13);U=0|(0|(nt=0|nt+_(re,je))+(de>>>13))+(ct>>>26),ct&=67108863,rt=_(Ft,An),de=0|(de=_(Ft,Pn))+_(Ke,An),nt=_(Ke,Pn),rt=0|rt+_(pt,Mt),de=0|(de=0|de+_(pt,Kn))+_(Xt,Mt),nt=0|nt+_(Xt,Kn),rt=0|rt+_(We,Re),de=0|(de=0|de+_(We,je))+_(Qe,Re),nt=0|nt+_(Qe,je);var Xr=0|(0|U+(rt=0|rt+_(J,Xe)))+((8191&(de=0|(de=0|de+_(J,st))+_(re,Xe)))<<13);U=0|(0|(nt=0|nt+_(re,st))+(de>>>13))+(Xr>>>26),Xr&=67108863,rt=_(St,An),de=0|(de=_(St,Pn))+_(K,An),nt=_(K,Pn),rt=0|rt+_(Ft,Mt),de=0|(de=0|de+_(Ft,Kn))+_(Ke,Mt),nt=0|nt+_(Ke,Kn),rt=0|rt+_(pt,Re),de=0|(de=0|de+_(pt,je))+_(Xt,Re),nt=0|nt+_(Xt,je),rt=0|rt+_(We,Xe),de=0|(de=0|de+_(We,st))+_(Qe,Xe),nt=0|nt+_(Qe,st);var vi=0|(0|U+(rt=0|rt+_(J,Bt)))+((8191&(de=0|(de=0|de+_(J,qt))+_(re,Bt)))<<13);U=0|(0|(nt=0|nt+_(re,qt))+(de>>>13))+(vi>>>26),vi&=67108863,rt=_(X,An),de=0|(de=_(X,Pn))+_(ce,An),nt=_(ce,Pn),rt=0|rt+_(St,Mt),de=0|(de=0|de+_(St,Kn))+_(K,Mt),nt=0|nt+_(K,Kn),rt=0|rt+_(Ft,Re),de=0|(de=0|de+_(Ft,je))+_(Ke,Re),nt=0|nt+_(Ke,je),rt=0|rt+_(pt,Xe),de=0|(de=0|de+_(pt,st))+_(Xt,Xe),nt=0|nt+_(Xt,st),rt=0|rt+_(We,Bt),de=0|(de=0|de+_(We,qt))+_(Qe,Bt),nt=0|nt+_(Qe,qt);var Kr=0|(0|U+(rt=0|rt+_(J,_n)))+((8191&(de=0|(de=0|de+_(J,cn))+_(re,_n)))<<13);U=0|(0|(nt=0|nt+_(re,cn))+(de>>>13))+(Kr>>>26),Kr&=67108863,rt=_(ie,An),de=0|(de=_(ie,Pn))+_(pe,An),nt=_(pe,Pn),rt=0|rt+_(X,Mt),de=0|(de=0|de+_(X,Kn))+_(ce,Mt),nt=0|nt+_(ce,Kn),rt=0|rt+_(St,Re),de=0|(de=0|de+_(St,je))+_(K,Re),nt=0|nt+_(K,je),rt=0|rt+_(Ft,Xe),de=0|(de=0|de+_(Ft,st))+_(Ke,Xe),nt=0|nt+_(Ke,st),rt=0|rt+_(pt,Bt),de=0|(de=0|de+_(pt,qt))+_(Xt,Bt),nt=0|nt+_(Xt,qt),rt=0|rt+_(We,_n),de=0|(de=0|de+_(We,cn))+_(Qe,_n),nt=0|nt+_(Qe,cn);var oi=0|(0|U+(rt=0|rt+_(J,Ee)))+((8191&(de=0|(de=0|de+_(J,Vt))+_(re,Ee)))<<13);U=0|(0|(nt=0|nt+_(re,Vt))+(de>>>13))+(oi>>>26),oi&=67108863,rt=_(at,An),de=0|(de=_(at,Pn))+_(dt,An),nt=_(dt,Pn),rt=0|rt+_(ie,Mt),de=0|(de=0|de+_(ie,Kn))+_(pe,Mt),nt=0|nt+_(pe,Kn),rt=0|rt+_(X,Re),de=0|(de=0|de+_(X,je))+_(ce,Re),nt=0|nt+_(ce,je),rt=0|rt+_(St,Xe),de=0|(de=0|de+_(St,st))+_(K,Xe),nt=0|nt+_(K,st),rt=0|rt+_(Ft,Bt),de=0|(de=0|de+_(Ft,qt))+_(Ke,Bt),nt=0|nt+_(Ke,qt),rt=0|rt+_(pt,_n),de=0|(de=0|de+_(pt,cn))+_(Xt,_n),nt=0|nt+_(Xt,cn),rt=0|rt+_(We,Ee),de=0|(de=0|de+_(We,Vt))+_(Qe,Ee),nt=0|nt+_(Qe,Vt);var Qr=0|(0|U+(rt=0|rt+_(J,mn)))+((8191&(de=0|(de=0|de+_(J,Mn))+_(re,mn)))<<13);U=0|(0|(nt=0|nt+_(re,Mn))+(de>>>13))+(Qr>>>26),Qr&=67108863,rt=_(Jt,An),de=0|(de=_(Jt,Pn))+_(an,An),nt=_(an,Pn),rt=0|rt+_(at,Mt),de=0|(de=0|de+_(at,Kn))+_(dt,Mt),nt=0|nt+_(dt,Kn),rt=0|rt+_(ie,Re),de=0|(de=0|de+_(ie,je))+_(pe,Re),nt=0|nt+_(pe,je),rt=0|rt+_(X,Xe),de=0|(de=0|de+_(X,st))+_(ce,Xe),nt=0|nt+_(ce,st),rt=0|rt+_(St,Bt),de=0|(de=0|de+_(St,qt))+_(K,Bt),nt=0|nt+_(K,qt),rt=0|rt+_(Ft,_n),de=0|(de=0|de+_(Ft,cn))+_(Ke,_n),nt=0|nt+_(Ke,cn),rt=0|rt+_(pt,Ee),de=0|(de=0|de+_(pt,Vt))+_(Xt,Ee),nt=0|nt+_(Xt,Vt),rt=0|rt+_(We,mn),de=0|(de=0|de+_(We,Mn))+_(Qe,mn),nt=0|nt+_(Qe,Mn);var hr=0|(0|U+(rt=0|rt+_(J,qn)))+((8191&(de=0|(de=0|de+_(J,Fn))+_(re,qn)))<<13);U=0|(0|(nt=0|nt+_(re,Fn))+(de>>>13))+(hr>>>26),hr&=67108863,rt=_(hn,An),de=0|(de=_(hn,Pn))+_(En,An),nt=_(En,Pn),rt=0|rt+_(Jt,Mt),de=0|(de=0|de+_(Jt,Kn))+_(an,Mt),nt=0|nt+_(an,Kn),rt=0|rt+_(at,Re),de=0|(de=0|de+_(at,je))+_(dt,Re),nt=0|nt+_(dt,je),rt=0|rt+_(ie,Xe),de=0|(de=0|de+_(ie,st))+_(pe,Xe),nt=0|nt+_(pe,st),rt=0|rt+_(X,Bt),de=0|(de=0|de+_(X,qt))+_(ce,Bt),nt=0|nt+_(ce,qt),rt=0|rt+_(St,_n),de=0|(de=0|de+_(St,cn))+_(K,_n),nt=0|nt+_(K,cn),rt=0|rt+_(Ft,Ee),de=0|(de=0|de+_(Ft,Vt))+_(Ke,Ee),nt=0|nt+_(Ke,Vt),rt=0|rt+_(pt,mn),de=0|(de=0|de+_(pt,Mn))+_(Xt,mn),nt=0|nt+_(Xt,Mn),rt=0|rt+_(We,qn),de=0|(de=0|de+_(We,Fn))+_(Qe,qn),nt=0|nt+_(Qe,Fn);var li=0|(0|U+(rt=0|rt+_(J,Hn)))+((8191&(de=0|(de=0|de+_(J,Yn))+_(re,Hn)))<<13);U=0|(0|(nt=0|nt+_(re,Yn))+(de>>>13))+(li>>>26),li&=67108863,rt=_(hn,Mt),de=0|(de=_(hn,Kn))+_(En,Mt),nt=_(En,Kn),rt=0|rt+_(Jt,Re),de=0|(de=0|de+_(Jt,je))+_(an,Re),nt=0|nt+_(an,je),rt=0|rt+_(at,Xe),de=0|(de=0|de+_(at,st))+_(dt,Xe),nt=0|nt+_(dt,st),rt=0|rt+_(ie,Bt),de=0|(de=0|de+_(ie,qt))+_(pe,Bt),nt=0|nt+_(pe,qt),rt=0|rt+_(X,_n),de=0|(de=0|de+_(X,cn))+_(ce,_n),nt=0|nt+_(ce,cn),rt=0|rt+_(St,Ee),de=0|(de=0|de+_(St,Vt))+_(K,Ee),nt=0|nt+_(K,Vt),rt=0|rt+_(Ft,mn),de=0|(de=0|de+_(Ft,Mn))+_(Ke,mn),nt=0|nt+_(Ke,Mn),rt=0|rt+_(pt,qn),de=0|(de=0|de+_(pt,Fn))+_(Xt,qn),nt=0|nt+_(Xt,Fn);var Vr=0|(0|U+(rt=0|rt+_(We,Hn)))+((8191&(de=0|(de=0|de+_(We,Yn))+_(Qe,Hn)))<<13);U=0|(0|(nt=0|nt+_(Qe,Yn))+(de>>>13))+(Vr>>>26),Vr&=67108863,rt=_(hn,Re),de=0|(de=_(hn,je))+_(En,Re),nt=_(En,je),rt=0|rt+_(Jt,Xe),de=0|(de=0|de+_(Jt,st))+_(an,Xe),nt=0|nt+_(an,st),rt=0|rt+_(at,Bt),de=0|(de=0|de+_(at,qt))+_(dt,Bt),nt=0|nt+_(dt,qt),rt=0|rt+_(ie,_n),de=0|(de=0|de+_(ie,cn))+_(pe,_n),nt=0|nt+_(pe,cn),rt=0|rt+_(X,Ee),de=0|(de=0|de+_(X,Vt))+_(ce,Ee),nt=0|nt+_(ce,Vt),rt=0|rt+_(St,mn),de=0|(de=0|de+_(St,Mn))+_(K,mn),nt=0|nt+_(K,Mn),rt=0|rt+_(Ft,qn),de=0|(de=0|de+_(Ft,Fn))+_(Ke,qn),nt=0|nt+_(Ke,Fn);var zr=0|(0|U+(rt=0|rt+_(pt,Hn)))+((8191&(de=0|(de=0|de+_(pt,Yn))+_(Xt,Hn)))<<13);U=0|(0|(nt=0|nt+_(Xt,Yn))+(de>>>13))+(zr>>>26),zr&=67108863,rt=_(hn,Xe),de=0|(de=_(hn,st))+_(En,Xe),nt=_(En,st),rt=0|rt+_(Jt,Bt),de=0|(de=0|de+_(Jt,qt))+_(an,Bt),nt=0|nt+_(an,qt),rt=0|rt+_(at,_n),de=0|(de=0|de+_(at,cn))+_(dt,_n),nt=0|nt+_(dt,cn),rt=0|rt+_(ie,Ee),de=0|(de=0|de+_(ie,Vt))+_(pe,Ee),nt=0|nt+_(pe,Vt),rt=0|rt+_(X,mn),de=0|(de=0|de+_(X,Mn))+_(ce,mn),nt=0|nt+_(ce,Mn),rt=0|rt+_(St,qn),de=0|(de=0|de+_(St,Fn))+_(K,qn),nt=0|nt+_(K,Fn);var Ei=0|(0|U+(rt=0|rt+_(Ft,Hn)))+((8191&(de=0|(de=0|de+_(Ft,Yn))+_(Ke,Hn)))<<13);U=0|(0|(nt=0|nt+_(Ke,Yn))+(de>>>13))+(Ei>>>26),Ei&=67108863,rt=_(hn,Bt),de=0|(de=_(hn,qt))+_(En,Bt),nt=_(En,qt),rt=0|rt+_(Jt,_n),de=0|(de=0|de+_(Jt,cn))+_(an,_n),nt=0|nt+_(an,cn),rt=0|rt+_(at,Ee),de=0|(de=0|de+_(at,Vt))+_(dt,Ee),nt=0|nt+_(dt,Vt),rt=0|rt+_(ie,mn),de=0|(de=0|de+_(ie,Mn))+_(pe,mn),nt=0|nt+_(pe,Mn),rt=0|rt+_(X,qn),de=0|(de=0|de+_(X,Fn))+_(ce,qn),nt=0|nt+_(ce,Fn);var ei=0|(0|U+(rt=0|rt+_(St,Hn)))+((8191&(de=0|(de=0|de+_(St,Yn))+_(K,Hn)))<<13);U=0|(0|(nt=0|nt+_(K,Yn))+(de>>>13))+(ei>>>26),ei&=67108863,rt=_(hn,_n),de=0|(de=_(hn,cn))+_(En,_n),nt=_(En,cn),rt=0|rt+_(Jt,Ee),de=0|(de=0|de+_(Jt,Vt))+_(an,Ee),nt=0|nt+_(an,Vt),rt=0|rt+_(at,mn),de=0|(de=0|de+_(at,Mn))+_(dt,mn),nt=0|nt+_(dt,Mn),rt=0|rt+_(ie,qn),de=0|(de=0|de+_(ie,Fn))+_(pe,qn),nt=0|nt+_(pe,Fn);var ci=0|(0|U+(rt=0|rt+_(X,Hn)))+((8191&(de=0|(de=0|de+_(X,Yn))+_(ce,Hn)))<<13);U=0|(0|(nt=0|nt+_(ce,Yn))+(de>>>13))+(ci>>>26),ci&=67108863,rt=_(hn,Ee),de=0|(de=_(hn,Vt))+_(En,Ee),nt=_(En,Vt),rt=0|rt+_(Jt,mn),de=0|(de=0|de+_(Jt,Mn))+_(an,mn),nt=0|nt+_(an,Mn),rt=0|rt+_(at,qn),de=0|(de=0|de+_(at,Fn))+_(dt,qn),nt=0|nt+_(dt,Fn);var Gr=0|(0|U+(rt=0|rt+_(ie,Hn)))+((8191&(de=0|(de=0|de+_(ie,Yn))+_(pe,Hn)))<<13);U=0|(0|(nt=0|nt+_(pe,Yn))+(de>>>13))+(Gr>>>26),Gr&=67108863,rt=_(hn,mn),de=0|(de=_(hn,Mn))+_(En,mn),nt=_(En,Mn),rt=0|rt+_(Jt,qn),de=0|(de=0|de+_(Jt,Fn))+_(an,qn),nt=0|nt+_(an,Fn);var Dr=0|(0|U+(rt=0|rt+_(at,Hn)))+((8191&(de=0|(de=0|de+_(at,Yn))+_(dt,Hn)))<<13);U=0|(0|(nt=0|nt+_(dt,Yn))+(de>>>13))+(Dr>>>26),Dr&=67108863,rt=_(hn,qn),de=0|(de=_(hn,Fn))+_(En,qn),nt=_(En,Fn);var Zr=0|(0|U+(rt=0|rt+_(Jt,Hn)))+((8191&(de=0|(de=0|de+_(Jt,Yn))+_(an,Hn)))<<13);U=0|(0|(nt=0|nt+_(an,Yn))+(de>>>13))+(Zr>>>26),Zr&=67108863;var si=0|(0|U+(rt=_(hn,Hn)))+((8191&(de=0|(de=_(hn,Yn))+_(En,Hn)))<<13);return U=0|(0|(nt=_(En,Yn))+(de>>>13))+(si>>>26),si&=67108863,M[0]=it,M[1]=ye,M[2]=ct,M[3]=Xr,M[4]=vi,M[5]=Kr,M[6]=oi,M[7]=Qr,M[8]=hr,M[9]=li,M[10]=Vr,M[11]=zr,M[12]=Ei,M[13]=ei,M[14]=ci,M[15]=Gr,M[16]=Dr,M[17]=Zr,M[18]=si,0!==U&&(M[19]=U,z.length++),z};_||(we=o),n.prototype.mulTo=function(A,L){var y,z=this.length+A.length;return y=10===this.length&&10===A.length?we(this,A,L):63>z?o(this,A,L):1024>z?function r(A,L,z){z.negative=L.negative^A.negative,z.length=A.length+L.length;for(var U,y=0,C=0,M=0;M>>26))>>>26,U&=67108863}z.words[M]=ee,y=U,U=C}return 0===y?z.length--:z.words[M]=y,z.strip()}(this,A,L):d(this,A,L),y},h.prototype.makeRBT=function(A){for(var L=Array(A),z=n.prototype._countBits(A)-1,y=0;y>=1;return y},h.prototype.permute=function(A,L,z,y,C,M){for(var U=0;U>>=1)C++;return 1<=z))for(var C,y=0;yC?0:0|C/67108864;return A},h.prototype.convert13b=function(A,L,z,y){for(var C=0,M=0;M>>=13),C>>>=13;for(M=2*L;MA);for(var L=0,z=0;z>=26,L+=0|y/67108864,L+=C>>>26,this.words[z]=67108863&C}return 0!==L&&(this.words[z]=L,this.length++),this},n.prototype.muln=function(A){return this.clone().imuln(A)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(A){var L=function t(A){for(var L=Array(A.bitLength()),z=0;z>>C}return L}(A);if(0===L.length)return new n(1);for(var z=this,y=0;y>>26-L<<26-L;this.words[y]=(0|this.words[y])-M<>>26-L}C&&(this.words[y]=C,this.length++)}if(0!==z){for(y=this.length-1;0<=y;y--)this.words[y+z]=this.words[y];for(y=0;yM)for(this.length-=M,ee=0;ee=y);ee--){var re=0|this.words[ee];this.words[ee]=J<<26-C|re>>>C,J=re&(67108863^67108863>>>C<>>L<A),0>A?this.isubn(-A):0===this.negative?this._iaddn(A):1===this.length&&(0|this.words[0])A),0>A)return this.iaddn(-A);if(0!==this.negative)return this.negative=0,this.iaddn(A),this.negative=1,this;if(this.words[0]-=A,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var L=0;Lthis.words[L];L++)this.words[L]+=67108864,this.words[L+1]-=1;return this.strip()},n.prototype.addn=function(A){return this.clone().iaddn(A)},n.prototype.subn=function(A){return this.clone().isubn(A)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(A,L,z){var C;this._expand(A.length+z);var U,M=0;for(C=0;C>26)-(0|ee/67108864),this.words[C+z]=67108863&U}for(;C>26,this.words[C+z]=67108863&U;if(0===M)return this.strip();for(f(-1===M),M=0,C=0;C>26,this.words[C]=67108863&U;return this.negative=1,this.strip()},n.prototype._wordDiv=function(A,L){var z,y=this.clone(),C=A,M=0|C.words[C.length-1];0!=(z=26-this._countBits(M))&&(C=C.ushln(z),y.iushln(z),M=0|C.words[C.length-1]);var J,ee=y.length-C.length;if("mod"!==L){(J=new n(null)).length=ee+1,J.words=Array(J.length);for(var re=0;rethis.length||0>this.cmp(A)?{div:new n(0),mod:this}:1===A.length?"div"===L?{div:this.divn(A.words[0]),mod:null}:"mod"===L?{div:null,mod:new n(this.modn(A.words[0]))}:{div:this.divn(A.words[0]),mod:new n(this.modn(A.words[0]))}:this._wordDiv(A,L);var y,C,M},n.prototype.div=function(A){return this.divmod(A,"div",!1).div},n.prototype.mod=function(A){return this.divmod(A,"mod",!1).mod},n.prototype.umod=function(A){return this.divmod(A,"mod",!0).mod},n.prototype.divRound=function(A){var L=this.divmod(A);if(L.mod.isZero())return L.div;var z=0===L.div.negative?L.mod:L.mod.isub(A),y=A.ushrn(1),C=A.andln(1),M=z.cmp(y);return 0>M||1===C&&0===M?L.div:0===L.div.negative?L.div.iaddn(1):L.div.isubn(1)},n.prototype.modn=function(A){f(67108863>=A);for(var L=0,z=this.length-1;0<=z;z--)L=(67108864%A*L+(0|this.words[z]))%A;return L},n.prototype.idivn=function(A){f(67108863>=A);for(var y,L=0,z=this.length-1;0<=z;z--)this.words[z]=0|(y=(0|this.words[z])+67108864*L)/A,L=y%A;return this.strip()},n.prototype.divn=function(A){return this.clone().idivn(A)},n.prototype.egcd=function(A){f(0===A.negative),f(!A.isZero());var L=this,z=A.clone();L=0===L.negative?L.clone():L.umod(A);for(var y=new n(1),C=new n(0),M=new n(0),U=new n(1),ee=0;L.isEven()&&z.isEven();)L.iushrn(1),z.iushrn(1),++ee;for(var J=z.clone(),re=L.clone();!L.isZero();){for(var Ue=0,We=1;!(L.words[0]&We)&&26>Ue;++Ue,We<<=1);if(0Qe;++Qe,ft<<=1);if(0U;++U,ee<<=1);if(0J;++J,re<<=1);if(0(Ue=0===L.cmpn(1)?y:C).cmpn(0)&&Ue.iadd(A),Ue},n.prototype.gcd=function(A){if(this.isZero())return A.abs();if(A.isZero())return this.abs();var L=this.clone(),z=A.clone();L.negative=0,z.negative=0;for(var y=0;L.isEven()&&z.isEven();y++)L.iushrn(1),z.iushrn(1);for(;;){for(;L.isEven();)L.iushrn(1);for(;z.isEven();)z.iushrn(1);var C=L.cmp(z);if(0>C){var M=L;L=z,z=M}else if(0===C||0===z.cmpn(1))break;L.isub(z)}return z.iushln(y)},n.prototype.invm=function(A){return this.egcd(A).a.umod(A)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(A){return this.words[0]&A},n.prototype.bincn=function(A){f("number"==typeof A);var L=A%26,z=(A-L)/26,y=1<>>26,this.words[M]=U&=67108863;return 0!==C&&(this.words[M]=C,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(A){var z,L=0>A;if(0!==this.negative&&!L)return-1;if(0===this.negative&&L)return 1;if(this.strip(),1=A,"Number is too big");var y=0|this.words[0];z=y===A?0:yA.length)return 1;if(this.lengthC&&(L=1);break}}return L},n.prototype.gtn=function(A){return 1===this.cmpn(A)},n.prototype.gt=function(A){return 1===this.cmp(A)},n.prototype.gten=function(A){return 0<=this.cmpn(A)},n.prototype.gte=function(A){return 0<=this.cmp(A)},n.prototype.ltn=function(A){return-1===this.cmpn(A)},n.prototype.lt=function(A){return-1===this.cmp(A)},n.prototype.lten=function(A){return 0>=this.cmpn(A)},n.prototype.lte=function(A){return 0>=this.cmp(A)},n.prototype.eqn=function(A){return 0===this.cmpn(A)},n.prototype.eq=function(A){return 0===this.cmp(A)},n.red=function(A){return new S(A)},n.prototype.toRed=function(A){return f(!this.red,"Already a number in reduction context"),f(0===this.negative,"red works only with positives"),A.convertTo(this)._forceRed(A)},n.prototype.fromRed=function(){return f(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(A){return this.red=A,this},n.prototype.forceRed=function(A){return f(!this.red,"Already a number in reduction context"),this._forceRed(A)},n.prototype.redAdd=function(A){return f(this.red,"redAdd works only with red numbers"),this.red.add(this,A)},n.prototype.redIAdd=function(A){return f(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,A)},n.prototype.redSub=function(A){return f(this.red,"redSub works only with red numbers"),this.red.sub(this,A)},n.prototype.redISub=function(A){return f(this.red,"redISub works only with red numbers"),this.red.isub(this,A)},n.prototype.redShl=function(A){return f(this.red,"redShl works only with red numbers"),this.red.shl(this,A)},n.prototype.redMul=function(A){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,A),this.red.mul(this,A)},n.prototype.redIMul=function(A){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,A),this.red.imul(this,A)},n.prototype.redSqr=function(){return f(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return f(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return f(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return f(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return f(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(A){return f(this.red&&!A.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,A)};var ke={k256:null,p224:null,p192:null,p25519:null};l.prototype._tmp=function(){var A=new n(null);return A.words=Array(ve(this.n/13)),A},l.prototype.ireduce=function(A){var z,L=A;do{this.split(L,this.tmp),z=(L=(L=this.imulK(L)).iadd(this.tmp)).bitLength()}while(z>this.n);var y=z=A.length)return A.words[0]=0,void(A.length=1);var M=A.words[9];for(L.words[L.length++]=M&z,C=10;C>>22,M=U}A.words[C-10]=M>>>=22,A.length-=0===M&&10>>=26,A.words[z]=C,L=y}return 0!==L&&(A.words[A.length++]=L),A},n._prime=function(L){if(ke[L])return ke[L];var z;if("k256"===L)z=new p;else if("p224"===L)z=new w;else if("p192"===L)z=new b;else{if("p25519"!==L)throw new Error("Unknown prime "+L);z=new I}return ke[L]=z,z},S.prototype._verify1=function(A){f(0===A.negative,"red works only with positives"),f(A.red,"red works only with red numbers")},S.prototype._verify2=function(A,L){f(0==(A.negative|L.negative),"red works only with positives"),f(A.red&&A.red===L.red,"red works only with red numbers")},S.prototype.imod=function(A){return this.prime?this.prime.ireduce(A)._forceRed(this):A.umod(this.m)._forceRed(this)},S.prototype.neg=function(A){return A.isZero()?A.clone():this.m.sub(A)._forceRed(this)},S.prototype.add=function(A,L){this._verify2(A,L);var z=A.add(L);return 0<=z.cmp(this.m)&&z.isub(this.m),z._forceRed(this)},S.prototype.iadd=function(A,L){this._verify2(A,L);var z=A.iadd(L);return 0<=z.cmp(this.m)&&z.isub(this.m),z},S.prototype.sub=function(A,L){this._verify2(A,L);var z=A.sub(L);return 0>z.cmpn(0)&&z.iadd(this.m),z._forceRed(this)},S.prototype.isub=function(A,L){this._verify2(A,L);var z=A.isub(L);return 0>z.cmpn(0)&&z.iadd(this.m),z},S.prototype.shl=function(A,L){return this._verify1(A),this.imod(A.ushln(L))},S.prototype.imul=function(A,L){return this._verify2(A,L),this.imod(A.imul(L))},S.prototype.mul=function(A,L){return this._verify2(A,L),this.imod(A.mul(L))},S.prototype.isqr=function(A){return this.imul(A,A.clone())},S.prototype.sqr=function(A){return this.mul(A,A)},S.prototype.sqrt=function(A){if(A.isZero())return A.clone();var L=this.m.andln(3);if(f(L%2==1),3===L){var z=this.m.add(new n(1)).iushrn(2);return this.pow(A,z)}for(var y=this.m.subn(1),C=0;!y.isZero()&&0===y.andln(1);)C++,y.iushrn(1);f(!y.isZero());var M=new n(1).toRed(this),U=M.redNeg(),ee=this.m.subn(1).iushrn(1),J=this.m.bitLength();for(J=new n(2*J*J).toRed(this);0!==this.pow(J,ee).cmp(U);)J.redIAdd(U);for(var re=this.pow(J,y),Ue=this.pow(A,y.addn(1).iushrn(1)),We=this.pow(A,y),Qe=C;0!==We.cmp(M);){for(var ft=We,pt=0;0!==ft.cmp(M);pt++)ft=ft.redSqr();f(pt>re,C!==z[0]&&(C=this.sqr(C)),0!==Ue||0!==M?(M<<=1,M|=Ue,(4==++U||0===y&&0===re)&&(C=this.mul(C,z[M]),U=0,M=0)):U=0;ee=26}return C},S.prototype.convertTo=function(A){var L=A.umod(this.m);return L===A?L.clone():L},S.prototype.convertFrom=function(A){var L=A.clone();return L.red=null,L},n.mont=function(A){return new R(A)},x(R,S),R.prototype.convertTo=function(A){return this.imod(A.ushln(this.shift))},R.prototype.convertFrom=function(A){var L=this.imod(A.mul(this.rinv));return L.red=null,L},R.prototype.imul=function(A,L){if(A.isZero()||L.isZero())return A.words[0]=0,A.length=1,A;var z=A.imul(L),y=z.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),C=z.isub(y).iushrn(this.shift),M=C;return 0<=C.cmp(this.m)?M=C.isub(this.m):0>C.cmpn(0)&&(M=C.iadd(this.m)),M._forceRed(this)},R.prototype.mul=function(A,L){if(A.isZero()||L.isZero())return new n(0)._forceRed(this);var z=A.mul(L),y=z.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),C=z.isub(y).iushrn(this.shift),M=C;return 0<=C.cmp(this.m)?M=C.isub(this.m):0>C.cmpn(0)&&(M=C.iadd(this.m)),M._forceRed(this)},R.prototype.invm=function(A){return this.imod(A._invmp(this.m).mul(this.r2))._forceRed(this)}}(typeof B>"u"||B,this)},{buffer:41}],23:[function(m,B,i){"use strict";function g(l){var p=l.length;if(0>18]+s[63&l>>12]+s[63&l>>6]+s[63&l]}function c(l,p,w){for(var b=[],I=p;I>16,I[S++]=255&N>>8,I[S++]=255&N;return 2===b&&(N=t[l.charCodeAt(q)]<<2|t[l.charCodeAt(q+1)]>>4,I[S++]=255&N),1===b&&(N=t[l.charCodeAt(q)]<<10|t[l.charCodeAt(q+1)]<<4|t[l.charCodeAt(q+2)]>>2,I[S++]=255&N>>8,I[S++]=255&N),I},i.fromByteArray=function u(l){for(var N,p=l.length,w=p%3,b=[],I=16383,S=0,R=p-w;SR?R:S+I));return 1===w?b.push(s[(N=l[p-1])>>2]+s[63&N<<4]+"=="):2===w&&b.push(s[(N=(l[p-2]<<8)+l[p-1])>>10]+s[63&N>>4]+s[63&N<<2]+"="),b.join("")};for(var s=[],t=[],o=typeof Uint8Array>"u"?Array:Uint8Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,h=r.length;dr&&48<=r)s=10*s+(r-48);else if(o!==c||43!==r){if(o===c&&45===r){t=-1;continue}if(46===r)break;throw new Error("not a number: buffer["+o+"] = "+r)}}return s*t}function f(n,c,u,s){return null==n||0===n.length?null:("number"!=typeof c&&null==s&&(s=c,c=void 0),"number"!=typeof u&&null==s&&(s=u,u=void 0),f.position=0,f.encoding=s||null,f.data=i.isBuffer(n)?n.slice(c,u):i.from(n),f.bytes=f.data.length,f.next())}f.bytes=0,f.position=0,f.data=null,f.encoding=null,f.next=function(){switch(f.data[f.position]){case 100:return f.dictionary();case 108:return f.list();case 105:return f.integer();default:return f.buffer()}},f.find=function(n){let c=f.position;const u=f.data.length,s=f.data;for(;cf?1:0;return f=At(+(f||1)),wt(x(f))+1+n},g.getType=function(f){return i.isBuffer(f)?"buffer":ArrayBuffer.isView(f)?"arraybufferview":Array.isArray(f)?"array":f instanceof Number?"number":f instanceof Boolean?"boolean":f instanceof Set?"set":f instanceof Map?"map":f instanceof String?"string":f instanceof ArrayBuffer?"arraybuffer":typeof f}}).call(this)}).call(this,{isBuffer:m("../../is-buffer/index.js")})},{"../../is-buffer/index.js":161}],29:[function(m,B){function i(g){return g.reduce((x,n)=>{const c=n.split("-").map(u=>parseInt(u));return x.concat(((x,n=x)=>Array.from({length:n-x+1},(c,u)=>u+x))(...c))},[])}B.exports=i,B.exports.parse=i,B.exports.compose=function(g){return g.reduce((f,x,n,c)=>((0===n||x!==c[n-1]+1)&&f.push([]),f[f.length-1].push(x),f),[]).map(f=>1(x|=0)||x>=i.length)throw new RangeError("invalid lower bound");if(void 0===n)n=i.length-1;else if((n|=0)=i.length)throw new RangeError("invalid upper bound");for(;x<=n;)if(0>(u=+f(i[c=x+(n-x>>>1)],g,c,i)))x=c+1;else{if(!(0>3;return x%8!=0&&n++,n}Object.defineProperty(i,"__esModule",{value:!0});var f=function(){function x(n,c){void 0===n&&(n=0);var u=c?.grow;this.grow=u&&isFinite(u)&&g(u)||u||0,this.buffer="number"==typeof n?new Uint8Array(g(n)):n}return x.prototype.get=function(n){var c=n>>3;return c>n%8)},x.prototype.set=function(n,c){void 0===c&&(c=!0);var u=n>>3;if(c){if(this.buffer.length>n%8}else u>n%8))},x.prototype.forEach=function(n,c,u){void 0===c&&(c=0),void 0===u&&(u=8*this.buffer.length);for(var s=c,t=s>>3,o=128>>s%8,r=this.buffer[t];s>1},x}();i.default=f},{}],32:[function(m,B){(function(i){(function(){function g(ke,A){for(let L=ke.length;L--;)ke[L]^=A[L];return ke}const f=m("unordered-array-remove"),x=m("bencode"),n=m("bitfield").default,c=m("crypto"),u=m("debug")("bittorrent-protocol"),s=m("randombytes"),t=m("simple-sha1"),o=m("speedometer"),r=m("readable-stream"),d=m("rc4"),h=i.from("\x13BitTorrent protocol"),l=i.from([0,0,0,0]),p=i.from([0,0,0,1,0]),w=i.from([0,0,0,1,1]),b=i.from([0,0,0,1,2]),I=i.from([0,0,0,1,3]),S=[0,0,0,0,0,0,0,0],R=[0,0,0,3,9,0,0],N=i.from([0,0,0,0,0,0,0,0]),q=i.from([0,0,1,2]),Z=i.from([0,0,0,2]);class le{constructor(A,L,z,y){this.piece=A,this.offset=L,this.length=z,this.callback=y}}B.exports=class we extends r.Duplex{constructor(A=null,L=0,z=!1){super(),this._debugId=s(4).toString("hex"),this._debug("new wire"),this.peerId=null,this.peerIdBuffer=null,this.type=A,this.amChoking=!0,this.amInterested=!1,this.peerChoking=!0,this.peerInterested=!1,this.peerPieces=new n(0,{grow:4e5}),this.peerExtensions={},this.requests=[],this.peerRequests=[],this.extendedMapping={},this.peerExtendedMapping={},this.extendedHandshake={},this.peerExtendedHandshake={},this._ext={},this._nextExt=1,this.uploaded=0,this.downloaded=0,this.uploadSpeed=o(),this.downloadSpeed=o(),this._keepAliveInterval=null,this._timeout=null,this._timeoutMs=0,this._timeoutExpiresAt=null,this.destroyed=!1,this._finished=!1,this._parserSize=0,this._parser=null,this._buffer=[],this._bufferSize=0,this._peEnabled=z,z?(this._dh=c.createDiffieHellman("ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a36210000000000090563","hex",2),this._myPubKey=this._dh.generateKeys("hex")):this._myPubKey=null,this._peerPubKey=null,this._sharedSecret=null,this._peerCryptoProvide=[],this._cryptoHandshakeDone=!1,this._cryptoSyncPattern=null,this._waitMaxBytes=null,this._encryptionMethod=null,this._encryptGenerator=null,this._decryptGenerator=null,this._setGenerators=!1,this.once("finish",()=>this._onFinish()),this.on("finish",this._onFinish),this._debug("type:",this.type),"tcpIncoming"===this.type&&this._peEnabled?this._determineHandshakeType():"tcpOutgoing"===this.type&&this._peEnabled&&0===L?this._parsePe2():this._parseHandshake(null)}setKeepAlive(A){this._debug("setKeepAlive %s",A),clearInterval(this._keepAliveInterval),!1===A||(this._keepAliveInterval=setInterval(()=>{this.keepAlive()},55e3))}setTimeout(A,L){this._debug("setTimeout ms=%d unref=%s",A,L),this._timeoutMs=A,this._timeoutUnref=!!L,this._resetTimeout(!0)}destroy(){this.destroyed||(this.destroyed=!0,this._debug("destroy"),this.emit("close"),this.end())}end(...A){this._debug("end"),this._onUninterested(),this._onChoke(),super.end(...A)}use(A){function L(){}const z=A.prototype.name;if(!z)throw new Error('Extension class requires a "name" property on the prototype');this._debug("use extension.name=%s",z);const y=this._nextExt,C=new A(this);"function"!=typeof C.onHandshake&&(C.onHandshake=L),"function"!=typeof C.onExtendedHandshake&&(C.onExtendedHandshake=L),"function"!=typeof C.onMessage&&(C.onMessage=L),this.extendedMapping[y]=z,this._ext[z]=C,this[z]=C,this._nextExt+=1}keepAlive(){this._debug("keep-alive"),this._push(l)}sendPe1(){if(this._peEnabled){const A=wt(513*Math.random()),L=s(A);this._push(i.concat([i.from(this._myPubKey,"hex"),L]))}}sendPe2(){const A=wt(513*Math.random()),L=s(A);this._push(i.concat([i.from(this._myPubKey,"hex"),L]))}sendPe3(A){this.setEncrypt(this._sharedSecret,A);const L=i.from(t.sync(i.from(this._utfToHex("req1")+this._sharedSecret,"hex")),"hex"),C=g(i.from(t.sync(i.from(this._utfToHex("req2")+A,"hex")),"hex"),i.from(t.sync(i.from(this._utfToHex("req3")+this._sharedSecret,"hex")),"hex")),M=s(2).readUInt16BE(0)%512,U=s(M);let ee=i.alloc(14+M+2);N.copy(ee),q.copy(ee,8),ee.writeInt16BE(M,12),U.copy(ee,14),ee.writeInt16BE(0,14+M),ee=this._encryptHandshake(ee),this._push(i.concat([L,C,ee]))}sendPe4(A){this.setEncrypt(this._sharedSecret,A);const L=s(2).readUInt16BE(0)%512,z=s(L);let y=i.alloc(14+L);N.copy(y),Z.copy(y,8),y.writeInt16BE(L,12),z.copy(y,14),y=this._encryptHandshake(y),this._push(y),this._cryptoHandshakeDone=!0,this._debug("completed crypto handshake")}handshake(A,L,z){let y,C;if("string"==typeof A?(A=A.toLowerCase(),y=i.from(A,"hex")):(y=A,A=y.toString("hex")),"string"==typeof L?C=i.from(L,"hex"):(C=L,L=C.toString("hex")),this._infoHash=y,20!==y.length||20!==C.length)throw new Error("infoHash and peerId MUST have length 20");this._debug("handshake i=%s p=%s exts=%o",A,L,z);const M=i.from(S);M[5]|=16,z&&z.dht&&(M[7]|=1),this._push(i.concat([h,M,y,C])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()}_sendExtendedHandshake(){const A=Object.assign({},this.extendedHandshake);for(const L in A.m={},this.extendedMapping)A.m[this.extendedMapping[L]]=+L;this.extended(0,x.encode(A)),this._extendedHandshakeSent=!0}choke(){if(!this.amChoking){for(this.amChoking=!0,this._debug("choke");this.peerRequests.length;)this.peerRequests.pop();this._push(p)}}unchoke(){this.amChoking&&(this.amChoking=!1,this._debug("unchoke"),this._push(w))}interested(){this.amInterested||(this.amInterested=!0,this._debug("interested"),this._push(b))}uninterested(){this.amInterested&&(this.amInterested=!1,this._debug("uninterested"),this._push(I))}have(A){this._debug("have %d",A),this._message(4,[A],null)}bitfield(A){this._debug("bitfield"),i.isBuffer(A)||(A=A.buffer),this._message(5,[],A)}request(A,L,z,y){return y||(y=()=>{}),this._finished?y(new Error("wire is closed")):this.peerChoking?y(new Error("peer is choking")):(this._debug("request index=%d offset=%d length=%d",A,L,z),this.requests.push(new le(A,L,z,y)),!this._timeout&&this._resetTimeout(!0),void this._message(6,[A,L,z],null))}piece(A,L,z){this._debug("piece index=%d offset=%d",A,L),this._message(7,[A,L],z),this.uploaded+=z.length,this.uploadSpeed(z.length),this.emit("upload",z.length)}cancel(A,L,z){this._debug("cancel index=%d offset=%d length=%d",A,L,z),this._callback(this._pull(this.requests,A,L,z),new Error("request was cancelled"),null),this._message(8,[A,L,z],null)}port(A){this._debug("port %d",A);const L=i.from(R);L.writeUInt16BE(A,5),this._push(L)}extended(A,L){if(this._debug("extended ext=%s",A),"string"==typeof A&&this.peerExtendedMapping[A]&&(A=this.peerExtendedMapping[A]),"number"!=typeof A)throw new Error(`Unrecognized extension: ${A}`);{const z=i.from([A]),y=i.isBuffer(L)?L:x.encode(L);this._message(20,[],i.concat([z,y]))}}setEncrypt(A,L){let z,y,C,M,U,ee;switch(this.type){case"tcpIncoming":z=t.sync(i.from(this._utfToHex("keyB")+A+L,"hex")),y=t.sync(i.from(this._utfToHex("keyA")+A+L,"hex")),C=i.from(z,"hex"),M=[];for(const J of C.values())M.push(J);U=i.from(y,"hex"),ee=[];for(const J of U.values())ee.push(J);this._encryptGenerator=new d(M),this._decryptGenerator=new d(ee);break;case"tcpOutgoing":z=t.sync(i.from(this._utfToHex("keyA")+A+L,"hex")),y=t.sync(i.from(this._utfToHex("keyB")+A+L,"hex")),C=i.from(z,"hex"),M=[];for(const J of C.values())M.push(J);U=i.from(y,"hex"),ee=[];for(const J of U.values())ee.push(J);this._encryptGenerator=new d(M),this._decryptGenerator=new d(ee);break;default:return!1}for(let J=0;1024>J;J++)this._encryptGenerator.randomByte(),this._decryptGenerator.randomByte();return this._setGenerators=!0,!0}_read(){}_message(A,L,z){const y=z?z.length:0,C=i.allocUnsafe(5+4*L.length);C.writeUInt32BE(C.length+y-4,0),C[4]=A;for(let M=0;MC===this._pull(this.peerRequests,A,L,z)?M?this._debug("error satisfying request index=%d offset=%d length=%d (%s)",A,L,z,M.message):void this.piece(A,L,U):void 0,C=new le(A,L,z,y);this.peerRequests.push(C),this.emit("request",A,L,z,y)}_onPiece(A,L,z){this._debug("got piece index=%d offset=%d",A,L),this._callback(this._pull(this.requests,A,L,z.length),null,z),this.downloaded+=z.length,this.downloadSpeed(z.length),this.emit("download",z.length),this.emit("piece",A,L,z)}_onCancel(A,L,z){this._debug("got cancel index=%d offset=%d length=%d",A,L,z),this._pull(this.peerRequests,A,L,z),this.emit("cancel",A,L,z)}_onPort(A){this._debug("got port %d",A),this.emit("port",A)}_onExtended(A,L){if(0===A){let z;try{z=x.decode(L)}catch(y){this._debug("ignoring invalid extended handshake: %s",y.message||y)}if(!z)return;if(this.peerExtendedHandshake=z,"object"==typeof z.m)for(const y in z.m)this.peerExtendedMapping[y]=+z.m[y].toString();for(const y in this._ext)this.peerExtendedMapping[y]&&this._ext[y].onExtendedHandshake(this.peerExtendedHandshake);this._debug("got extended handshake"),this.emit("extended","handshake",this.peerExtendedHandshake)}else this.extendedMapping[A]&&this._ext[A=this.extendedMapping[A]]&&this._ext[A].onMessage(L),this._debug("got extended message ext=%s",A),this.emit("extended",A,L)}_onTimeout(){this._debug("request timed out"),this._callback(this.requests.shift(),new Error("request has timed out"),null),this.emit("timeout")}_write(A,L,z){if(2===this._encryptionMethod&&this._cryptoHandshakeDone&&(A=this._decrypt(A)),this._bufferSize+=A.length,this._buffer.push(A),1this._waitMaxBytes+this._cryptoSyncPattern.length)return this._debug("Error: could not resynchronize"),void this.destroy()}for(;this._bufferSize>=this._parserSize&&!this._cryptoSyncPattern;)if(0===this._parserSize)this._parser(i.from([]));else{const y=this._buffer[0];this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[y.slice(this._parserSize)]:[],this._parser(y.slice(0,this._parserSize))}z(null)}_callback(A,L,z){A&&(this._resetTimeout(!this.peerChoking&&!this._finished),A.callback(L,z))}_resetTimeout(A){if(!A||!this._timeoutMs||!this.requests.length)return clearTimeout(this._timeout),this._timeout=null,void(this._timeoutExpiresAt=null);const L=Date.now()+this._timeoutMs;if(this._timeout){if(L-this._timeoutExpiresAt<.05*this._timeoutMs)return;clearTimeout(this._timeout)}this._timeoutExpiresAt=L,this._timeout=setTimeout(()=>this._onTimeout(),this._timeoutMs),this._timeoutUnref&&this._timeout.unref&&this._timeout.unref()}_parse(A,L){this._parserSize=A,this._parser=L}_parseUntil(A,L){this._cryptoSyncPattern=A,this._waitMaxBytes=L}_onMessageLength(A){const L=A.readUInt32BE(0);0{const L=A.readUInt8(0);19===L?this._parse(L+48,this._onHandshakeBuffer):this._parsePe1(A)})}_parsePe1(A){this._parse(95,L=>{this._onPe1(i.concat([A,L])),this._parsePe3()})}_parsePe2(){this._parse(96,A=>{for(this._onPe2(A);!this._setGenerators;);this._parsePe4()})}_parsePe3(){const A=i.from(t.sync(i.from(this._utfToHex("req1")+this._sharedSecret,"hex")),"hex");this._parseUntil(A,512),this._parse(20,L=>{for(this._onPe3(L);!this._setGenerators;);this._parsePe3Encrypted()})}_parsePe3Encrypted(){this._parse(14,A=>{const L=this._decryptHandshake(A.slice(0,8)),z=this._decryptHandshake(A.slice(8,12)),y=this._decryptHandshake(A.slice(12,14)).readUInt16BE(0);this._parse(y,C=>{C=this._decryptHandshake(C),this._parse(2,M=>{const U=this._decryptHandshake(M).readUInt16BE(0);this._parse(U,ee=>{ee=this._decryptHandshake(ee),this._onPe3Encrypted(L,z,C,ee);const J=U?ee.readUInt8(0):null,re=U?ee.slice(1,20):null;19===J&&"BitTorrent protocol"===re.toString()?this._onHandshakeBuffer(ee.slice(1)):this._parseHandshake()})})})})}_parsePe4(){const A=this._decryptHandshake(N);this._parseUntil(A,512),this._parse(6,L=>{const z=this._decryptHandshake(L.slice(0,4)),y=this._decryptHandshake(L.slice(4,6)).readUInt16BE(0);this._parse(y,C=>{this._decryptHandshake(C),this._onPe4(z),this._parseHandshake(null)})})}_parseHandshake(){this._parse(1,A=>{const L=A.readUInt8(0);return 19===L?void this._parse(L+48,this._onHandshakeBuffer):(this._debug("Error: wire not speaking BitTorrent protocol (%s)",L.toString()),void this.end())})}_onHandshakeBuffer(A){const L=A.slice(0,19);return"BitTorrent protocol"===L.toString()?(A=A.slice(19),this._onHandshake(A.slice(8,28),A.slice(28,48),{dht:!!(1&A[7]),extended:!!(16&A[5])}),void this._parse(4,this._onMessageLength)):(this._debug("Error: wire not speaking BitTorrent protocol (%s)",L.toString()),void this.end())}_onFinish(){for(this._finished=!0,this.push(null);this.read(););for(clearInterval(this._keepAliveInterval),this._parse(Number.MAX_VALUE,()=>{});this.peerRequests.length;)this.peerRequests.pop();for(;this.requests.length;)this._callback(this.requests.pop(),new Error("wire was closed"),null)}_debug(...A){A[0]=`[${this._debugId}] ${A[0]}`,u(...A)}_pull(A,L,z,y){for(let C=0;C("/"===(S=S.toString())[S.length-1]&&(S=S.substring(0,S.length-1)),S)),w=Array.from(new Set(w));const b=!1!==this._wrtc&&(!!this._wrtc||u.WEBRTC_SUPPORT),I=S=>{s(()=>{this.emit("warning",S)})};this._trackers=w.map(S=>{let R;try{R=t.parseUrl(S)}catch{return I(new Error(`Invalid tracker URL: ${S}`)),null}const N=R.port;if(0>N||65535{w.setInterval()})}stop(p){(p=this._defaultAnnounceOpts(p)).event="stopped",f("send `stop` %o",p),this._announce(p)}complete(p){p||(p={}),(p=this._defaultAnnounceOpts(p)).event="completed",f("send `complete` %o",p),this._announce(p)}update(p){(p=this._defaultAnnounceOpts(p)).event&&delete p.event,f("send `update` %o",p),this._announce(p)}_announce(p){this._trackers.forEach(w=>{w.announce(p)})}scrape(p){f("send `scrape`"),p||(p={}),this._trackers.forEach(w=>{w.scrape(p)})}setInterval(p){f("setInterval %d",p),this._trackers.forEach(w=>{w.setInterval(p)})}destroy(p){if(!this.destroyed){this.destroyed=!0,f("destroy");const w=this._trackers.map(b=>I=>{b.destroy(I)});c(w,p),this._trackers=[],this._getAnnounceOpts=null}}_defaultAnnounceOpts(p={}){return null==p.numwant&&(p.numwant=t.DEFAULT_ANNOUNCE_PEERS),null==p.uploaded&&(p.uploaded=0),null==p.downloaded&&(p.downloaded=0),this._getAnnounceOpts&&(p=Object.assign({},p,this._getAnnounceOpts())),p}}h.scrape=(l,p)=>{if(p=n(p),!l.infoHash)throw new Error("Option `infoHash` is required");if(!l.announce)throw new Error("Option `announce` is required");const w=Object.assign({},l,{infoHash:Array.isArray(l.infoHash)?l.infoHash[0]:l.infoHash,peerId:g.from("01234567890123456789"),port:6881}),b=new h(w);b.once("error",p),b.once("warning",p);let I=Array.isArray(l.infoHash)?l.infoHash.length:1;const S={};return b.on("scrape",R=>{if(I-=1,S[R.infoHash]=R,0===I){b.destroy();const N=Object.keys(S);p(null,1===N.length?S[N[0]]:S)}}),l.infoHash=Array.isArray(l.infoHash)?l.infoHash.map(R=>g.from(R,"hex")):g.from(l.infoHash,"hex"),b.scrape({infoHash:l.infoHash}),b},B.exports=h}).call(this)}).call(this,m("_process"),m("buffer").Buffer)},{"./lib/client/http-tracker":41,"./lib/client/udp-tracker":41,"./lib/client/websocket-tracker":35,"./lib/common":36,_process:205,buffer:69,debug:105,events:70,once:191,"queue-microtask":218,"run-parallel":245,"simple-peer":259}],34:[function(m,B){const i=m("events");B.exports=class extends i{constructor(g,f){super(),this.client=g,this.announceUrl=f,this.interval=null,this.destroyed=!1}setInterval(g){null==g&&(g=this.DEFAULT_ANNOUNCE_INTERVAL),clearInterval(this.interval),g&&(this.interval=setInterval(()=>{this.announce(this.client._defaultAnnounceOpts())},g),this.interval.unref&&this.interval.unref())}}},{events:70}],35:[function(m,B){function i(){}const g=m("clone"),f=m("debug")("bittorrent-tracker:websocket-tracker"),x=m("simple-peer"),n=m("randombytes"),c=m("simple-websocket"),u=m("socks"),s=m("../common"),t=m("./tracker"),o={};class r extends t{constructor(h,l){super(h,l),f("new websocket tracker %s",l),this.peers={},this.socket=null,this.reconnecting=!1,this.retries=0,this.reconnectTimer=null,this.expectingResponse=!1,this._openSocket()}announce(h){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once("connect",()=>{this.announce(h)});const l=Object.assign({},h,{action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary});if(this._trackerId&&(l.trackerid=this._trackerId),"stopped"===h.event||"completed"===h.event)this._send(l);else{const p=Y(h.numwant,5);this._generateOffers(p,w=>{l.numwant=p,l.offers=w,this._send(l)})}}scrape(h){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once("connect",()=>{this.scrape(h)});const l=Array.isArray(h.infoHash)&&0p.toString("binary")):h.infoHash&&h.infoHash.toString("binary")||this.client._infoHashBinary;this._send({action:"scrape",info_hash:l})}destroy(h=i){function l(){w&&(clearTimeout(w),w=null),p.removeListener("data",l),p.destroy(),p=null}if(this.destroyed)return h(null);for(const b in this.destroyed=!0,clearInterval(this.interval),clearTimeout(this.reconnectTimer),this.peers){const I=this.peers[b];clearTimeout(I.trackerTimeout),I.destroy()}if(this.peers=null,this.socket&&(this.socket.removeListener("connect",this._onSocketConnectBound),this.socket.removeListener("data",this._onSocketDataBound),this.socket.removeListener("close",this._onSocketCloseBound),this.socket.removeListener("error",this._onSocketErrorBound),this.socket=null),this._onSocketConnectBound=null,this._onSocketErrorBound=null,this._onSocketDataBound=null,this._onSocketCloseBound=null,o[this.announceUrl]&&(o[this.announceUrl].consumers-=1),0{this._onSocketConnect()},this._onSocketErrorBound=h=>{this._onSocketError(h)},this._onSocketDataBound=h=>{this._onSocketData(h)},this._onSocketCloseBound=()=>{this._onSocketClose()},this.socket=o[this.announceUrl],this.socket)o[this.announceUrl].consumers+=1,this.socket.connected&&this._onSocketConnectBound();else{const h=new URL(this.announceUrl);let l;this.client._proxyOpts&&(l="wss:"===h.protocol?this.client._proxyOpts.httpsAgent:this.client._proxyOpts.httpAgent,!l&&this.client._proxyOpts.socksProxy&&(l=new u.Agent(g(this.client._proxyOpts.socksProxy),"wss:"===h.protocol))),this.socket=o[this.announceUrl]=new c({url:this.announceUrl,agent:l}),this.socket.consumers=1,this.socket.once("connect",this._onSocketConnectBound)}this.socket.on("data",this._onSocketDataBound),this.socket.once("close",this._onSocketCloseBound),this.socket.once("error",this._onSocketErrorBound)}_onSocketConnect(){this.destroyed||this.reconnecting&&(this.reconnecting=!1,this.retries=0,this.announce(this.client._defaultAnnounceOpts()))}_onSocketData(h){if(!this.destroyed){this.expectingResponse=!1;try{h=JSON.parse(h)}catch{return void this.client.emit("warning",new Error("Invalid tracker response"))}"announce"===h.action?this._onAnnounceResponse(h):"scrape"===h.action?this._onScrapeResponse(h):this._onSocketError(new Error(`invalid action in WS response: ${h.action}`))}}_onAnnounceResponse(h){if(h.info_hash!==this.client._infoHashBinary)return void f("ignoring websocket data from %s for %s (looking for %s: reused socket)",this.announceUrl,s.binaryToHex(h.info_hash),this.client.infoHash);if(h.peer_id&&h.peer_id===this.client._peerIdBinary)return;f("received %s from %s for %s",JSON.stringify(h),this.announceUrl,this.client.infoHash);const l=h["failure reason"];if(l)return this.client.emit("warning",new Error(l));const p=h["warning message"];p&&this.client.emit("warning",new Error(p));const w=h.interval||h["min interval"];w&&this.setInterval(1e3*w);const b=h["tracker id"];if(b&&(this._trackerId=b),null!=h.complete){const S=Object.assign({},h,{announce:this.announceUrl,infoHash:s.binaryToHex(h.info_hash)});this.client.emit("update",S)}let I;if(h.offer&&h.peer_id&&(f("creating peer (from remote offer)"),I=this._createPeer(),I.id=s.binaryToHex(h.peer_id),I.once("signal",S=>{const R={action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary,to_peer_id:h.peer_id,answer:S,offer_id:h.offer_id};this._trackerId&&(R.trackerid=this._trackerId),this._send(R)}),this.client.emit("peer",I),I.signal(h.offer)),h.answer&&h.peer_id){const S=s.binaryToHex(h.offer_id);I=this.peers[S],I?(I.id=s.binaryToHex(h.peer_id),this.client.emit("peer",I),I.signal(h.answer),clearTimeout(I.trackerTimeout),I.trackerTimeout=null,delete this.peers[S]):f(`got unexpected answer: ${JSON.stringify(h.answer)}`)}}_onScrapeResponse(h){h=h.files||{};const l=Object.keys(h);return 0===l.length?void this.client.emit("warning",new Error("invalid scrape response")):void l.forEach(p=>{const w=Object.assign(h[p],{announce:this.announceUrl,infoHash:s.binaryToHex(p)});this.client.emit("scrape",w)})}_onSocketClose(){this.destroyed||(this.destroy(),this._startReconnectTimer())}_onSocketError(h){this.destroyed||(this.destroy(),this.client.emit("warning",h),this._startReconnectTimer())}_startReconnectTimer(){const h=wt(3e5*Math.random())+Y(1e4*j(2,this.retries),36e5);this.reconnecting=!0,clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout(()=>{this.retries++,this._openSocket()},h),this.reconnectTimer.unref&&this.reconnectTimer.unref(),f("reconnecting socket in %s ms",h)}_send(h){if(!this.destroyed){this.expectingResponse=!0;const l=JSON.stringify(h);f("send %s",l),this.socket.send(l)}}_generateOffers(h,l){function p(){const S=n(20).toString("hex");f("creating peer (from _generateOffers)");const R=b.peers[S]=b._createPeer({initiator:!0});R.once("signal",N=>{I.push({offer:N,offer_id:s.hexToBinary(S)}),w()}),R.trackerTimeout=setTimeout(()=>{f("tracker timeout: destroying peer"),R.trackerTimeout=null,delete b.peers[S],R.destroy()},5e4),R.trackerTimeout.unref&&R.trackerTimeout.unref()}function w(){I.length===h&&(f("generated %s offers",h),l(I))}const b=this,I=[];f("generating %s offers",h);for(let S=0;S("string"!=typeof x&&(x+=""),g.from(x,"binary").toString("hex")),i.hexToBinary=x=>("string"!=typeof x&&(x+=""),g.from(x,"hex").toString("binary")),i.parseUrl=x=>{const n=new URL(x.replace(/^udp:/,"http:"));return x.match(/^udp:/)&&Object.defineProperties(n,{href:{value:n.href.replace(/^http/,"udp")},protocol:{value:n.protocol.replace(/^http/,"udp")},origin:{value:n.origin.replace(/^http/,"udp")}}),n};const f=m("./common-node");Object.assign(i,f)}).call(this)}).call(this,m("buffer").Buffer)},{"./common-node":41,buffer:69}],37:[function(m,B){(function(i){(function(){B.exports=function(g,f){if(typeof Blob>"u"||!(g instanceof Blob))throw new Error("first argument must be a Blob");if("function"!=typeof f)throw new Error("second argument must be a function");const n=new FileReader;n.addEventListener("loadend",function x(c){n.removeEventListener("loadend",x,!1),c.error?f(c.error):f(null,i.from(n.result))},!1),n.readAsArrayBuffer(g)}}).call(this)}).call(this,m("buffer").Buffer)},{buffer:69}],38:[function(m,B){(function(i){(function(){const{Transform:g}=m("readable-stream");B.exports=class extends g{constructor(f,x={}){super(x),"object"==typeof f&&(f=(x=f).size),this.size=f||512;const{nopad:n,zeroPadding:c=!0}=x;this._zeroPadding=!n&&!!c,this._buffered=[],this._bufferedBytes=0}_transform(f,x,n){for(this._bufferedBytes+=f.length,this._buffered.push(f);this._bufferedBytes>=this.size;){this._bufferedBytes-=this.size;const c=[];for(let u=0;u=M?M-48:65<=M&&70>=M?M-55:97<=M&&102>=M?M-87:void f(!1,"Invalid character in "+y)}function u(y,C,M){var U=c(y,M);return M-1>=C&&(U|=c(y,M-1)<<4),U}function s(y,C,M,U){for(var We,ee=0,J=0,re=Y(y.length,M),Ue=C;Ue"}function d(y,C,M){M.negative=C.negative^y.negative;var U=0|y.length+C.length;M.length=U,U=0|U-1;var ee=0|y.words[0],J=0|C.words[0],re=ee*J,We=0|re/67108864;M.words[0]=67108863&re;for(var Qe=1;Qe>>26,pt=67108863&We,Xt=Y(Qe,C.length-1),It=ue(0,Qe-y.length+1);It<=Xt;It++)ft+=0|(re=(ee=0|y.words[0|Qe-It])*(J=0|C.words[It])+pt)/67108864,pt=67108863&re;M.words[Qe]=0|pt,We=0|ft}return 0===We?M.length--:M.words[Qe]=0|We,M._strip()}function h(y,C,M){M.negative=C.negative^y.negative,M.length=y.length+C.length;for(var re,U=0,ee=0,J=0;J>>26))>>>26,re&=67108863}M.words[J]=Ue,U=re,re=ee}return 0===U?M.length--:M.words[J]=U,M._strip()}function l(y,C,M){return h(y,C,M)}function p(y,C){this.x=y,this.y=C}function w(y,C){this.name=y,this.p=new n(C,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function I(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function R(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function N(y){if("string"==typeof y){var C=n._prime(y);this.m=C.p,this.prime=C}else f(y.gtn(1),"modulus must be greater than 1"),this.m=y,this.prime=null}function q(y){N.call(this,y),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}var Z;"object"==typeof i?i.exports=n:g.BN=n,n.BN=n,n.wordSize=26;try{Z=typeof window<"u"&&typeof window.Buffer<"u"?window.Buffer:m("buffer").Buffer}catch{}if(n.isBN=function(y){return y instanceof n||null!==y&&"object"==typeof y&&y.constructor.wordSize===n.wordSize&&Array.isArray(y.words)},n.max=function(y,C){return 0y.cmp(C)?y:C},n.prototype._init=function(y,C,M){if("number"==typeof y)return this._initNumber(y,C,M);if("object"==typeof y)return this._initArray(y,C,M);"hex"===C&&(C=16),f(C===(0|C)&&2<=C&&36>=C);var U=0;"-"===(y=y.toString().replace(/\s+/g,""))[0]&&(U++,this.negative=1),Uy&&(this.negative=1,y=-y),67108864>y?(this.words=[67108863&y],this.length=1):4503599627370496>y?(this.words=[67108863&y,67108863&y/67108864],this.length=2):(f(9007199254740992>y),this.words=[67108863&y,67108863&y/67108864,1],this.length=3),"le"!==M||this._initArray(this.toArray(),C,M)},n.prototype._initArray=function(y,C,M){if(f("number"==typeof y.length),0>=y.length)return this.words=[0],this.length=1,this;this.length=ve(y.length/3),this.words=Array(this.length);for(var U=0;U>>26-ee,26<=(ee+=24)&&(ee-=26,J++);else if("le"===M)for(U=0,J=0;U>>26-ee,26<=(ee+=24)&&(ee-=26,J++);return this._strip()},n.prototype._parseHex=function(y,C,M){this.length=ve((y.length-C)/6),this.words=Array(this.length);for(var U=0;U=C;U-=2)re=u(y,C,U)<>>26):ee+=8;else for(U=(y.length-C)%2==0?C+1:C;U>>26):ee+=8;this._strip()},n.prototype._parseBase=function(y,C,M){this.words=[0],this.length=1;for(var U=0,ee=1;67108863>=ee;ee*=C)U++;U--,ee=0|ee/C;for(var J=y.length-M,re=J%U,Ue=Y(J,J-re)+M,We=0,Qe=M;Qethis.words[0]+We?this.words[0]+=We:this._iaddn(We);if(0!==re){var ft=1;for(We=s(y,Qe,y.length,C),Qe=0;Qethis.words[0]+We?this.words[0]+=We:this._iaddn(We)}this._strip()},n.prototype.copy=function(y){y.words=Array(this.length);for(var C=0;C>>24-U)||J!==this.length-1?le[6-Ue.length]+Ue+M:Ue+M,26<=(U+=2)&&(U-=26,J--)}for(0!==ee&&(M=ee.toString(16)+M);M.length%C!=0;)M="0"+M;return 0!==this.negative&&(M="-"+M),M}if(y===(0|y)&&2<=y&&36>=y){var We=we[y],Qe=ke[y];M="";var ft=this.clone();for(ft.negative=0;!ft.isZero();){var pt=ft.modrn(Qe).toString(y);M=(ft=ft.idivn(Qe)).isZero()?pt+M:le[We-pt.length]+pt+M}for(this.isZero()&&(M="0"+M);M.length%C!=0;)M="0"+M;return 0!==this.negative&&(M="-"+M),M}f(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var y=this.words[0];return 2===this.length?y+=67108864*this.words[1]:3===this.length&&1===this.words[2]?y+=4503599627370496+67108864*this.words[1]:2>8),C>16),6==ee?(C>24),M=0,ee=0):(M=J>>>24,ee+=2);if(C>8),0<=C&&(y[C--]=255&J>>16),6==ee?(0<=C&&(y[C--]=255&J>>24),M=0,ee=0):(M=J>>>24,ee+=2);if(0<=C)for(y[C--]=M;0<=C;)y[C--]=0},n.prototype._countBits=oe?function(y){return 32-oe(y)}:function(y){var C=y,M=0;return 4096<=C&&(M+=13,C>>>=13),64<=C&&(M+=7,C>>>=7),8<=C&&(M+=4,C>>>=4),2<=C&&(M+=2,C>>>=2),M+C},n.prototype._zeroBits=function(y){if(0===y)return 26;var C=y,M=0;return!(8191&C)&&(M+=13,C>>>=13),!(127&C)&&(M+=7,C>>>=7),!(15&C)&&(M+=4,C>>>=4),!(3&C)&&(M+=2,C>>>=2),!(1&C)&&M++,M},n.prototype.bitLength=function(){var C=this._countBits(this.words[this.length-1]);return 26*(this.length-1)+C},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var M,y=0,C=0;Cy.length?this.clone().ior(y):y.clone().ior(this)},n.prototype.uor=function(y){return this.length>y.length?this.clone().iuor(y):y.clone().iuor(this)},n.prototype.iuand=function(y){for(var C=this.length>y.length?y:this,M=0;My.length?this.clone().iand(y):y.clone().iand(this)},n.prototype.uand=function(y){return this.length>y.length?this.clone().iuand(y):y.clone().iuand(this)},n.prototype.iuxor=function(y){var C,M;this.length>y.length?(C=this,M=y):(C=y,M=this);for(var U=0;Uy.length?this.clone().ixor(y):y.clone().ixor(this)},n.prototype.uxor=function(y){return this.length>y.length?this.clone().iuxor(y):y.clone().iuxor(this)},n.prototype.inotn=function(y){f("number"==typeof y&&0<=y);var C=0|ve(y/26),M=y%26;this._expand(C),0>26-M),this._strip()},n.prototype.notn=function(y){return this.clone().inotn(y)},n.prototype.setn=function(y,C){f("number"==typeof y&&0<=y);var M=0|y/26,U=y%26;return this._expand(M+1),C?this.words[M]|=1<y.length?(M=this,U=y):(M=y,U=this);for(var ee=0,J=0;J>>26;for(;0!==ee&&J>>26;if(this.length=M.length,0!==ee)this.words[this.length]=ee,this.length++;else if(M!==this)for(;Jy.length?this.clone().iadd(y):y.clone().iadd(this)},n.prototype.isub=function(y){if(0!==y.negative){y.negative=0;var C=this.iadd(y);return y.negative=1,C._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(y),this.negative=1,this._normSign();var U,ee,M=this.cmp(y);if(0===M)return this.negative=0,this.length=1,this.words[0]=0,this;0>26,this.words[re]=67108863&C;for(;0!==J&&re>26,this.words[re]=67108863&C;if(0===J&&re>>13,ft=0|U[1],pt=8191&ft,Xt=ft>>>13,It=0|U[2],Ft=8191&It,Ke=It>>>13,mt=0|U[3],St=8191&mt,K=mt>>>13,se=0|U[4],X=8191&se,ce=se>>>13,Je=0|U[5],ie=8191&Je,pe=Je>>>13,Ye=0|U[6],at=8191&Ye,dt=Ye>>>13,Gt=0|U[7],Jt=8191&Gt,an=Gt>>>13,Cn=0|U[8],hn=8191&Cn,En=Cn>>>13,Xn=0|U[9],An=8191&Xn,Pn=Xn>>>13,mr=0|ee[0],Mt=8191&mr,Kn=mr>>>13,ge=0|ee[1],Re=8191&ge,je=ge>>>13,Ze=0|ee[2],Xe=8191&Ze,st=Ze>>>13,tn=0|ee[3],Bt=8191&tn,qt=tn>>>13,nn=0|ee[4],_n=8191&nn,cn=nn>>>13,Qt=0|ee[5],Ee=8191&Qt,Vt=Qt>>>13,Nn=0|ee[6],mn=8191&Nn,Mn=Nn>>>13,zn=0|ee[7],qn=8191&zn,Fn=zn>>>13,Gn=0|ee[8],Hn=8191&Gn,Yn=Gn>>>13,rt=0|ee[9],de=8191&rt,nt=rt>>>13;M.negative=y.negative^C.negative,M.length=19;var Xr=0|(0|re+(it=_(We,Mt)))+((8191&(ye=0|(ye=_(We,Kn))+_(Qe,Mt)))<<13);re=0|(0|(ct=_(Qe,Kn))+(ye>>>13))+(Xr>>>26),Xr&=67108863,it=_(pt,Mt),ye=0|(ye=_(pt,Kn))+_(Xt,Mt),ct=_(Xt,Kn);var vi=0|(0|re+(it=0|it+_(We,Re)))+((8191&(ye=0|(ye=0|ye+_(We,je))+_(Qe,Re)))<<13);re=0|(0|(ct=0|ct+_(Qe,je))+(ye>>>13))+(vi>>>26),vi&=67108863,it=_(Ft,Mt),ye=0|(ye=_(Ft,Kn))+_(Ke,Mt),ct=_(Ke,Kn),it=0|it+_(pt,Re),ye=0|(ye=0|ye+_(pt,je))+_(Xt,Re),ct=0|ct+_(Xt,je);var Kr=0|(0|re+(it=0|it+_(We,Xe)))+((8191&(ye=0|(ye=0|ye+_(We,st))+_(Qe,Xe)))<<13);re=0|(0|(ct=0|ct+_(Qe,st))+(ye>>>13))+(Kr>>>26),Kr&=67108863,it=_(St,Mt),ye=0|(ye=_(St,Kn))+_(K,Mt),ct=_(K,Kn),it=0|it+_(Ft,Re),ye=0|(ye=0|ye+_(Ft,je))+_(Ke,Re),ct=0|ct+_(Ke,je),it=0|it+_(pt,Xe),ye=0|(ye=0|ye+_(pt,st))+_(Xt,Xe),ct=0|ct+_(Xt,st);var oi=0|(0|re+(it=0|it+_(We,Bt)))+((8191&(ye=0|(ye=0|ye+_(We,qt))+_(Qe,Bt)))<<13);re=0|(0|(ct=0|ct+_(Qe,qt))+(ye>>>13))+(oi>>>26),oi&=67108863,it=_(X,Mt),ye=0|(ye=_(X,Kn))+_(ce,Mt),ct=_(ce,Kn),it=0|it+_(St,Re),ye=0|(ye=0|ye+_(St,je))+_(K,Re),ct=0|ct+_(K,je),it=0|it+_(Ft,Xe),ye=0|(ye=0|ye+_(Ft,st))+_(Ke,Xe),ct=0|ct+_(Ke,st),it=0|it+_(pt,Bt),ye=0|(ye=0|ye+_(pt,qt))+_(Xt,Bt),ct=0|ct+_(Xt,qt);var Qr=0|(0|re+(it=0|it+_(We,_n)))+((8191&(ye=0|(ye=0|ye+_(We,cn))+_(Qe,_n)))<<13);re=0|(0|(ct=0|ct+_(Qe,cn))+(ye>>>13))+(Qr>>>26),Qr&=67108863,it=_(ie,Mt),ye=0|(ye=_(ie,Kn))+_(pe,Mt),ct=_(pe,Kn),it=0|it+_(X,Re),ye=0|(ye=0|ye+_(X,je))+_(ce,Re),ct=0|ct+_(ce,je),it=0|it+_(St,Xe),ye=0|(ye=0|ye+_(St,st))+_(K,Xe),ct=0|ct+_(K,st),it=0|it+_(Ft,Bt),ye=0|(ye=0|ye+_(Ft,qt))+_(Ke,Bt),ct=0|ct+_(Ke,qt),it=0|it+_(pt,_n),ye=0|(ye=0|ye+_(pt,cn))+_(Xt,_n),ct=0|ct+_(Xt,cn);var hr=0|(0|re+(it=0|it+_(We,Ee)))+((8191&(ye=0|(ye=0|ye+_(We,Vt))+_(Qe,Ee)))<<13);re=0|(0|(ct=0|ct+_(Qe,Vt))+(ye>>>13))+(hr>>>26),hr&=67108863,it=_(at,Mt),ye=0|(ye=_(at,Kn))+_(dt,Mt),ct=_(dt,Kn),it=0|it+_(ie,Re),ye=0|(ye=0|ye+_(ie,je))+_(pe,Re),ct=0|ct+_(pe,je),it=0|it+_(X,Xe),ye=0|(ye=0|ye+_(X,st))+_(ce,Xe),ct=0|ct+_(ce,st),it=0|it+_(St,Bt),ye=0|(ye=0|ye+_(St,qt))+_(K,Bt),ct=0|ct+_(K,qt),it=0|it+_(Ft,_n),ye=0|(ye=0|ye+_(Ft,cn))+_(Ke,_n),ct=0|ct+_(Ke,cn),it=0|it+_(pt,Ee),ye=0|(ye=0|ye+_(pt,Vt))+_(Xt,Ee),ct=0|ct+_(Xt,Vt);var li=0|(0|re+(it=0|it+_(We,mn)))+((8191&(ye=0|(ye=0|ye+_(We,Mn))+_(Qe,mn)))<<13);re=0|(0|(ct=0|ct+_(Qe,Mn))+(ye>>>13))+(li>>>26),li&=67108863,it=_(Jt,Mt),ye=0|(ye=_(Jt,Kn))+_(an,Mt),ct=_(an,Kn),it=0|it+_(at,Re),ye=0|(ye=0|ye+_(at,je))+_(dt,Re),ct=0|ct+_(dt,je),it=0|it+_(ie,Xe),ye=0|(ye=0|ye+_(ie,st))+_(pe,Xe),ct=0|ct+_(pe,st),it=0|it+_(X,Bt),ye=0|(ye=0|ye+_(X,qt))+_(ce,Bt),ct=0|ct+_(ce,qt),it=0|it+_(St,_n),ye=0|(ye=0|ye+_(St,cn))+_(K,_n),ct=0|ct+_(K,cn),it=0|it+_(Ft,Ee),ye=0|(ye=0|ye+_(Ft,Vt))+_(Ke,Ee),ct=0|ct+_(Ke,Vt),it=0|it+_(pt,mn),ye=0|(ye=0|ye+_(pt,Mn))+_(Xt,mn),ct=0|ct+_(Xt,Mn);var Vr=0|(0|re+(it=0|it+_(We,qn)))+((8191&(ye=0|(ye=0|ye+_(We,Fn))+_(Qe,qn)))<<13);re=0|(0|(ct=0|ct+_(Qe,Fn))+(ye>>>13))+(Vr>>>26),Vr&=67108863,it=_(hn,Mt),ye=0|(ye=_(hn,Kn))+_(En,Mt),ct=_(En,Kn),it=0|it+_(Jt,Re),ye=0|(ye=0|ye+_(Jt,je))+_(an,Re),ct=0|ct+_(an,je),it=0|it+_(at,Xe),ye=0|(ye=0|ye+_(at,st))+_(dt,Xe),ct=0|ct+_(dt,st),it=0|it+_(ie,Bt),ye=0|(ye=0|ye+_(ie,qt))+_(pe,Bt),ct=0|ct+_(pe,qt),it=0|it+_(X,_n),ye=0|(ye=0|ye+_(X,cn))+_(ce,_n),ct=0|ct+_(ce,cn),it=0|it+_(St,Ee),ye=0|(ye=0|ye+_(St,Vt))+_(K,Ee),ct=0|ct+_(K,Vt),it=0|it+_(Ft,mn),ye=0|(ye=0|ye+_(Ft,Mn))+_(Ke,mn),ct=0|ct+_(Ke,Mn),it=0|it+_(pt,qn),ye=0|(ye=0|ye+_(pt,Fn))+_(Xt,qn),ct=0|ct+_(Xt,Fn);var zr=0|(0|re+(it=0|it+_(We,Hn)))+((8191&(ye=0|(ye=0|ye+_(We,Yn))+_(Qe,Hn)))<<13);re=0|(0|(ct=0|ct+_(Qe,Yn))+(ye>>>13))+(zr>>>26),zr&=67108863,it=_(An,Mt),ye=0|(ye=_(An,Kn))+_(Pn,Mt),ct=_(Pn,Kn),it=0|it+_(hn,Re),ye=0|(ye=0|ye+_(hn,je))+_(En,Re),ct=0|ct+_(En,je),it=0|it+_(Jt,Xe),ye=0|(ye=0|ye+_(Jt,st))+_(an,Xe),ct=0|ct+_(an,st),it=0|it+_(at,Bt),ye=0|(ye=0|ye+_(at,qt))+_(dt,Bt),ct=0|ct+_(dt,qt),it=0|it+_(ie,_n),ye=0|(ye=0|ye+_(ie,cn))+_(pe,_n),ct=0|ct+_(pe,cn),it=0|it+_(X,Ee),ye=0|(ye=0|ye+_(X,Vt))+_(ce,Ee),ct=0|ct+_(ce,Vt),it=0|it+_(St,mn),ye=0|(ye=0|ye+_(St,Mn))+_(K,mn),ct=0|ct+_(K,Mn),it=0|it+_(Ft,qn),ye=0|(ye=0|ye+_(Ft,Fn))+_(Ke,qn),ct=0|ct+_(Ke,Fn),it=0|it+_(pt,Hn),ye=0|(ye=0|ye+_(pt,Yn))+_(Xt,Hn),ct=0|ct+_(Xt,Yn);var Ei=0|(0|re+(it=0|it+_(We,de)))+((8191&(ye=0|(ye=0|ye+_(We,nt))+_(Qe,de)))<<13);re=0|(0|(ct=0|ct+_(Qe,nt))+(ye>>>13))+(Ei>>>26),Ei&=67108863,it=_(An,Re),ye=0|(ye=_(An,je))+_(Pn,Re),ct=_(Pn,je),it=0|it+_(hn,Xe),ye=0|(ye=0|ye+_(hn,st))+_(En,Xe),ct=0|ct+_(En,st),it=0|it+_(Jt,Bt),ye=0|(ye=0|ye+_(Jt,qt))+_(an,Bt),ct=0|ct+_(an,qt),it=0|it+_(at,_n),ye=0|(ye=0|ye+_(at,cn))+_(dt,_n),ct=0|ct+_(dt,cn),it=0|it+_(ie,Ee),ye=0|(ye=0|ye+_(ie,Vt))+_(pe,Ee),ct=0|ct+_(pe,Vt),it=0|it+_(X,mn),ye=0|(ye=0|ye+_(X,Mn))+_(ce,mn),ct=0|ct+_(ce,Mn),it=0|it+_(St,qn),ye=0|(ye=0|ye+_(St,Fn))+_(K,qn),ct=0|ct+_(K,Fn),it=0|it+_(Ft,Hn),ye=0|(ye=0|ye+_(Ft,Yn))+_(Ke,Hn),ct=0|ct+_(Ke,Yn);var ei=0|(0|re+(it=0|it+_(pt,de)))+((8191&(ye=0|(ye=0|ye+_(pt,nt))+_(Xt,de)))<<13);re=0|(0|(ct=0|ct+_(Xt,nt))+(ye>>>13))+(ei>>>26),ei&=67108863,it=_(An,Xe),ye=0|(ye=_(An,st))+_(Pn,Xe),ct=_(Pn,st),it=0|it+_(hn,Bt),ye=0|(ye=0|ye+_(hn,qt))+_(En,Bt),ct=0|ct+_(En,qt),it=0|it+_(Jt,_n),ye=0|(ye=0|ye+_(Jt,cn))+_(an,_n),ct=0|ct+_(an,cn),it=0|it+_(at,Ee),ye=0|(ye=0|ye+_(at,Vt))+_(dt,Ee),ct=0|ct+_(dt,Vt),it=0|it+_(ie,mn),ye=0|(ye=0|ye+_(ie,Mn))+_(pe,mn),ct=0|ct+_(pe,Mn),it=0|it+_(X,qn),ye=0|(ye=0|ye+_(X,Fn))+_(ce,qn),ct=0|ct+_(ce,Fn),it=0|it+_(St,Hn),ye=0|(ye=0|ye+_(St,Yn))+_(K,Hn),ct=0|ct+_(K,Yn);var ci=0|(0|re+(it=0|it+_(Ft,de)))+((8191&(ye=0|(ye=0|ye+_(Ft,nt))+_(Ke,de)))<<13);re=0|(0|(ct=0|ct+_(Ke,nt))+(ye>>>13))+(ci>>>26),ci&=67108863,it=_(An,Bt),ye=0|(ye=_(An,qt))+_(Pn,Bt),ct=_(Pn,qt),it=0|it+_(hn,_n),ye=0|(ye=0|ye+_(hn,cn))+_(En,_n),ct=0|ct+_(En,cn),it=0|it+_(Jt,Ee),ye=0|(ye=0|ye+_(Jt,Vt))+_(an,Ee),ct=0|ct+_(an,Vt),it=0|it+_(at,mn),ye=0|(ye=0|ye+_(at,Mn))+_(dt,mn),ct=0|ct+_(dt,Mn),it=0|it+_(ie,qn),ye=0|(ye=0|ye+_(ie,Fn))+_(pe,qn),ct=0|ct+_(pe,Fn),it=0|it+_(X,Hn),ye=0|(ye=0|ye+_(X,Yn))+_(ce,Hn),ct=0|ct+_(ce,Yn);var Gr=0|(0|re+(it=0|it+_(St,de)))+((8191&(ye=0|(ye=0|ye+_(St,nt))+_(K,de)))<<13);re=0|(0|(ct=0|ct+_(K,nt))+(ye>>>13))+(Gr>>>26),Gr&=67108863,it=_(An,_n),ye=0|(ye=_(An,cn))+_(Pn,_n),ct=_(Pn,cn),it=0|it+_(hn,Ee),ye=0|(ye=0|ye+_(hn,Vt))+_(En,Ee),ct=0|ct+_(En,Vt),it=0|it+_(Jt,mn),ye=0|(ye=0|ye+_(Jt,Mn))+_(an,mn),ct=0|ct+_(an,Mn),it=0|it+_(at,qn),ye=0|(ye=0|ye+_(at,Fn))+_(dt,qn),ct=0|ct+_(dt,Fn),it=0|it+_(ie,Hn),ye=0|(ye=0|ye+_(ie,Yn))+_(pe,Hn),ct=0|ct+_(pe,Yn);var Dr=0|(0|re+(it=0|it+_(X,de)))+((8191&(ye=0|(ye=0|ye+_(X,nt))+_(ce,de)))<<13);re=0|(0|(ct=0|ct+_(ce,nt))+(ye>>>13))+(Dr>>>26),Dr&=67108863,it=_(An,Ee),ye=0|(ye=_(An,Vt))+_(Pn,Ee),ct=_(Pn,Vt),it=0|it+_(hn,mn),ye=0|(ye=0|ye+_(hn,Mn))+_(En,mn),ct=0|ct+_(En,Mn),it=0|it+_(Jt,qn),ye=0|(ye=0|ye+_(Jt,Fn))+_(an,qn),ct=0|ct+_(an,Fn),it=0|it+_(at,Hn),ye=0|(ye=0|ye+_(at,Yn))+_(dt,Hn),ct=0|ct+_(dt,Yn);var Zr=0|(0|re+(it=0|it+_(ie,de)))+((8191&(ye=0|(ye=0|ye+_(ie,nt))+_(pe,de)))<<13);re=0|(0|(ct=0|ct+_(pe,nt))+(ye>>>13))+(Zr>>>26),Zr&=67108863,it=_(An,mn),ye=0|(ye=_(An,Mn))+_(Pn,mn),ct=_(Pn,Mn),it=0|it+_(hn,qn),ye=0|(ye=0|ye+_(hn,Fn))+_(En,qn),ct=0|ct+_(En,Fn),it=0|it+_(Jt,Hn),ye=0|(ye=0|ye+_(Jt,Yn))+_(an,Hn),ct=0|ct+_(an,Yn);var si=0|(0|re+(it=0|it+_(at,de)))+((8191&(ye=0|(ye=0|ye+_(at,nt))+_(dt,de)))<<13);re=0|(0|(ct=0|ct+_(dt,nt))+(ye>>>13))+(si>>>26),si&=67108863,it=_(An,qn),ye=0|(ye=_(An,Fn))+_(Pn,qn),ct=_(Pn,Fn),it=0|it+_(hn,Hn),ye=0|(ye=0|ye+_(hn,Yn))+_(En,Hn),ct=0|ct+_(En,Yn);var yi=0|(0|re+(it=0|it+_(Jt,de)))+((8191&(ye=0|(ye=0|ye+_(Jt,nt))+_(an,de)))<<13);re=0|(0|(ct=0|ct+_(an,nt))+(ye>>>13))+(yi>>>26),yi&=67108863,it=_(An,Hn),ye=0|(ye=_(An,Yn))+_(Pn,Hn),ct=_(Pn,Yn);var Br=0|(0|re+(it=0|it+_(hn,de)))+((8191&(ye=0|(ye=0|ye+_(hn,nt))+_(En,de)))<<13);re=0|(0|(ct=0|ct+_(En,nt))+(ye>>>13))+(Br>>>26),Br&=67108863;var Jn=0|(0|re+(it=_(An,de)))+((8191&(ye=0|(ye=_(An,nt))+_(Pn,de)))<<13);return re=0|(0|(ct=_(Pn,nt))+(ye>>>13))+(Jn>>>26),Jn&=67108863,J[0]=Xr,J[1]=vi,J[2]=Kr,J[3]=oi,J[4]=Qr,J[5]=hr,J[6]=li,J[7]=Vr,J[8]=zr,J[9]=Ei,J[10]=ei,J[11]=ci,J[12]=Gr,J[13]=Dr,J[14]=Zr,J[15]=si,J[16]=yi,J[17]=Br,J[18]=Jn,0!==re&&(J[19]=re,M.length++),M};_||(L=d),n.prototype.mulTo=function(y,C){var M=this.length+y.length;return 10===this.length&&10===y.length?L(this,y,C):63>M?d(this,y,C):1024>M?h(this,y,C):l(this,y,C)},p.prototype.makeRBT=function(y){for(var C=Array(y),M=n.prototype._countBits(y)-1,U=0;U>=1;return U},p.prototype.permute=function(y,C,M,U,ee,J){for(var re=0;re>>=1)ee++;return 1<=M))for(var ee,U=0;Uee?0:0|ee/67108864;return y},p.prototype.convert13b=function(y,C,M,U){for(var ee=0,J=0;J>>=13),ee>>>=13;for(J=2*C;Jy;C&&(y=-y),f("number"==typeof y),f(67108864>y);for(var M=0,U=0;U>=26,M+=0|ee/67108864,M+=J>>>26,this.words[U]=67108863&J}return 0!==M&&(this.words[U]=M,this.length++),C?this.ineg():this},n.prototype.muln=function(y){return this.clone().imuln(y)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(y){var C=function r(y){for(var C=Array(y.bitLength()),M=0;M>>M%26;return C}(y);if(0===C.length)return new n(1);for(var M=this,U=0;U>>26-C<<26-C;this.words[U]=(0|this.words[U])-J<>>26-C}ee&&(this.words[U]=ee,this.length++)}if(0!==M){for(U=this.length-1;0<=U;U--)this.words[U+M]=this.words[U];for(U=0;UJ)for(this.length-=J,Ue=0;Ue=U);Ue--){var Qe=0|this.words[Ue];this.words[Ue]=We<<26-ee|Qe>>>ee,We=Qe&(67108863^67108863>>>ee<>>C<y),0>y?this.isubn(-y):0===this.negative?this._iaddn(y):1===this.length&&(0|this.words[0])<=y?(this.words[0]=y-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(y),this.negative=1,this)},n.prototype._iaddn=function(y){this.words[0]+=y;for(var C=0;Cy),0>y)return this.iaddn(-y);if(0!==this.negative)return this.negative=0,this.iaddn(y),this.negative=1,this;if(this.words[0]-=y,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var C=0;Cthis.words[C];C++)this.words[C]+=67108864,this.words[C+1]-=1;return this._strip()},n.prototype.addn=function(y){return this.clone().iaddn(y)},n.prototype.subn=function(y){return this.clone().isubn(y)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(y,C,M){var ee;this._expand(y.length+M);var re,J=0;for(ee=0;ee>26)-(0|Ue/67108864),this.words[ee+M]=67108863&re}for(;ee>26,this.words[ee+M]=67108863&re;if(0===J)return this._strip();for(f(-1===J),J=0,ee=0;ee>26,this.words[ee]=67108863&re;return this.negative=1,this._strip()},n.prototype._wordDiv=function(y,C){var M,U=this.clone(),ee=y,J=0|ee.words[ee.length-1];0!=(M=26-this._countBits(J))&&(ee=ee.ushln(M),U.iushln(M),J=0|ee.words[ee.length-1]);var We,Ue=U.length-ee.length;if("mod"!==C){(We=new n(null)).length=Ue+1,We.words=Array(We.length);for(var Qe=0;Qethis.length||0>this.cmp(y)?{div:new n(0),mod:this}:1===y.length?"div"===C?{div:this.divn(y.words[0]),mod:null}:"mod"===C?{div:null,mod:new n(this.modrn(y.words[0]))}:{div:this.divn(y.words[0]),mod:new n(this.modrn(y.words[0]))}:this._wordDiv(y,C);var U,ee,J},n.prototype.div=function(y){return this.divmod(y,"div",!1).div},n.prototype.mod=function(y){return this.divmod(y,"mod",!1).mod},n.prototype.umod=function(y){return this.divmod(y,"mod",!0).mod},n.prototype.divRound=function(y){var C=this.divmod(y);if(C.mod.isZero())return C.div;var M=0===C.div.negative?C.mod:C.mod.isub(y),U=y.ushrn(1),ee=y.andln(1),J=M.cmp(U);return 0>J||1===ee&&0===J?C.div:0===C.div.negative?C.div.iaddn(1):C.div.isubn(1)},n.prototype.modrn=function(y){var C=0>y;C&&(y=-y),f(67108863>=y);for(var M=67108864%y,U=0,ee=this.length-1;0<=ee;ee--)U=(M*U+(0|this.words[ee]))%y;return C?-U:U},n.prototype.modn=function(y){return this.modrn(y)},n.prototype.idivn=function(y){var C=0>y;C&&(y=-y),f(67108863>=y);for(var ee,M=0,U=this.length-1;0<=U;U--)this.words[U]=0|(ee=(0|this.words[U])+67108864*M)/y,M=ee%y;return this._strip(),C?this.ineg():this},n.prototype.divn=function(y){return this.clone().idivn(y)},n.prototype.egcd=function(y){f(0===y.negative),f(!y.isZero());var C=this,M=y.clone();C=0===C.negative?C.clone():C.umod(y);for(var U=new n(1),ee=new n(0),J=new n(0),re=new n(1),Ue=0;C.isEven()&&M.isEven();)C.iushrn(1),M.iushrn(1),++Ue;for(var We=M.clone(),Qe=C.clone();!C.isZero();){for(var ft=0,pt=1;!(C.words[0]&pt)&&26>ft;++ft,pt<<=1);if(0Xt;++Xt,It<<=1);if(0re;++re,Ue<<=1);if(0We;++We,Qe<<=1);if(0(ft=0===C.cmpn(1)?U:ee).cmpn(0)&&ft.iadd(y),ft},n.prototype.gcd=function(y){if(this.isZero())return y.abs();if(y.isZero())return this.abs();var C=this.clone(),M=y.clone();C.negative=0,M.negative=0;for(var U=0;C.isEven()&&M.isEven();U++)C.iushrn(1),M.iushrn(1);for(;;){for(;C.isEven();)C.iushrn(1);for(;M.isEven();)M.iushrn(1);var ee=C.cmp(M);if(0>ee){var J=C;C=M,M=J}else if(0===ee||0===M.cmpn(1))break;C.isub(M)}return M.iushln(U)},n.prototype.invm=function(y){return this.egcd(y).a.umod(y)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(y){return this.words[0]&y},n.prototype.bincn=function(y){f("number"==typeof y);var C=y%26,M=(y-C)/26,U=1<>>26,this.words[J]=re&=67108863;return 0!==ee&&(this.words[J]=ee,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(y){var M,C=0>y;if(0!==this.negative&&!C)return-1;if(0===this.negative&&C)return 1;if(this._strip(),1=y,"Number is too big");var U=0|this.words[0];M=U===y?0:Uy.length)return 1;if(this.lengthee&&(C=1);break}}return C},n.prototype.gtn=function(y){return 1===this.cmpn(y)},n.prototype.gt=function(y){return 1===this.cmp(y)},n.prototype.gten=function(y){return 0<=this.cmpn(y)},n.prototype.gte=function(y){return 0<=this.cmp(y)},n.prototype.ltn=function(y){return-1===this.cmpn(y)},n.prototype.lt=function(y){return-1===this.cmp(y)},n.prototype.lten=function(y){return 0>=this.cmpn(y)},n.prototype.lte=function(y){return 0>=this.cmp(y)},n.prototype.eqn=function(y){return 0===this.cmpn(y)},n.prototype.eq=function(y){return 0===this.cmp(y)},n.red=function(y){return new N(y)},n.prototype.toRed=function(y){return f(!this.red,"Already a number in reduction context"),f(0===this.negative,"red works only with positives"),y.convertTo(this)._forceRed(y)},n.prototype.fromRed=function(){return f(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(y){return this.red=y,this},n.prototype.forceRed=function(y){return f(!this.red,"Already a number in reduction context"),this._forceRed(y)},n.prototype.redAdd=function(y){return f(this.red,"redAdd works only with red numbers"),this.red.add(this,y)},n.prototype.redIAdd=function(y){return f(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,y)},n.prototype.redSub=function(y){return f(this.red,"redSub works only with red numbers"),this.red.sub(this,y)},n.prototype.redISub=function(y){return f(this.red,"redISub works only with red numbers"),this.red.isub(this,y)},n.prototype.redShl=function(y){return f(this.red,"redShl works only with red numbers"),this.red.shl(this,y)},n.prototype.redMul=function(y){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.mul(this,y)},n.prototype.redIMul=function(y){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.imul(this,y)},n.prototype.redSqr=function(){return f(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return f(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return f(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return f(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return f(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(y){return f(this.red&&!y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,y)};var z={k256:null,p224:null,p192:null,p25519:null};w.prototype._tmp=function(){var y=new n(null);return y.words=Array(ve(this.n/13)),y},w.prototype.ireduce=function(y){var M,C=y;do{this.split(C,this.tmp),M=(C=(C=this.imulK(C)).iadd(this.tmp)).bitLength()}while(M>this.n);var U=M=y.length)return y.words[0]=0,void(y.length=1);var J=y.words[9];for(C.words[C.length++]=J&M,ee=10;ee>>22,J=re}y.words[ee-10]=J>>>=22,y.length-=0===J&&10>>=26,y.words[M]=ee,C=U}return 0!==C&&(y.words[y.length++]=C),y},n._prime=function(C){if(z[C])return z[C];var M;if("k256"===C)M=new b;else if("p224"===C)M=new I;else if("p192"===C)M=new S;else{if("p25519"!==C)throw new Error("Unknown prime "+C);M=new R}return z[C]=M,M},N.prototype._verify1=function(y){f(0===y.negative,"red works only with positives"),f(y.red,"red works only with red numbers")},N.prototype._verify2=function(y,C){f(0==(y.negative|C.negative),"red works only with positives"),f(y.red&&y.red===C.red,"red works only with red numbers")},N.prototype.imod=function(y){return this.prime?this.prime.ireduce(y)._forceRed(this):(t(y,y.umod(this.m)._forceRed(this)),y)},N.prototype.neg=function(y){return y.isZero()?y.clone():this.m.sub(y)._forceRed(this)},N.prototype.add=function(y,C){this._verify2(y,C);var M=y.add(C);return 0<=M.cmp(this.m)&&M.isub(this.m),M._forceRed(this)},N.prototype.iadd=function(y,C){this._verify2(y,C);var M=y.iadd(C);return 0<=M.cmp(this.m)&&M.isub(this.m),M},N.prototype.sub=function(y,C){this._verify2(y,C);var M=y.sub(C);return 0>M.cmpn(0)&&M.iadd(this.m),M._forceRed(this)},N.prototype.isub=function(y,C){this._verify2(y,C);var M=y.isub(C);return 0>M.cmpn(0)&&M.iadd(this.m),M},N.prototype.shl=function(y,C){return this._verify1(y),this.imod(y.ushln(C))},N.prototype.imul=function(y,C){return this._verify2(y,C),this.imod(y.imul(C))},N.prototype.mul=function(y,C){return this._verify2(y,C),this.imod(y.mul(C))},N.prototype.isqr=function(y){return this.imul(y,y.clone())},N.prototype.sqr=function(y){return this.mul(y,y)},N.prototype.sqrt=function(y){if(y.isZero())return y.clone();var C=this.m.andln(3);if(f(C%2==1),3===C){var M=this.m.add(new n(1)).iushrn(2);return this.pow(y,M)}for(var U=this.m.subn(1),ee=0;!U.isZero()&&0===U.andln(1);)ee++,U.iushrn(1);f(!U.isZero());var J=new n(1).toRed(this),re=J.redNeg(),Ue=this.m.subn(1).iushrn(1),We=this.m.bitLength();for(We=new n(2*We*We).toRed(this);0!==this.pow(We,Ue).cmp(re);)We.redIAdd(re);for(var Qe=this.pow(We,U),ft=this.pow(y,U.addn(1).iushrn(1)),pt=this.pow(y,U),Xt=ee;0!==pt.cmp(J);){for(var It=pt,Ft=0;0!==It.cmp(J);Ft++)It=It.redSqr();f(Ft>Qe,ee!==M[0]&&(ee=this.sqr(ee)),0!==ft||0!==J?(J<<=1,J|=ft,(4==++re||0===U&&0===Qe)&&(ee=this.mul(ee,M[J]),re=0,J=0)):re=0;Ue=26}return ee},N.prototype.convertTo=function(y){var C=y.umod(this.m);return C===y?C.clone():C},N.prototype.convertFrom=function(y){var C=y.clone();return C.red=null,C},n.mont=function(y){return new q(y)},x(q,N),q.prototype.convertTo=function(y){return this.imod(y.ushln(this.shift))},q.prototype.convertFrom=function(y){var C=this.imod(y.mul(this.rinv));return C.red=null,C},q.prototype.imul=function(y,C){if(y.isZero()||C.isZero())return y.words[0]=0,y.length=1,y;var M=y.imul(C),U=M.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),ee=M.isub(U).iushrn(this.shift),J=ee;return 0<=ee.cmp(this.m)?J=ee.isub(this.m):0>ee.cmpn(0)&&(J=ee.iadd(this.m)),J._forceRed(this)},q.prototype.mul=function(y,C){if(y.isZero()||C.isZero())return new n(0)._forceRed(this);var M=y.mul(C),U=M.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),ee=M.isub(U).iushrn(this.shift),J=ee;return 0<=ee.cmp(this.m)?J=ee.isub(this.m):0>ee.cmpn(0)&&(J=ee.iadd(this.m)),J._forceRed(this)},q.prototype.invm=function(y){return this.imod(y._invmp(this.m).mul(this.r2))._forceRed(this)}}(typeof B>"u"||B,this)},{buffer:41}],40:[function(m,B){function i(x){this.rand=x}var g;if(B.exports=function(x){return g||(g=new i(null)),g.generate(x)},B.exports.Rand=i,i.prototype.generate=function(x){return this._rand(x)},i.prototype._rand=function(x){if(this.rand.getBytes)return this.rand.getBytes(x);for(var n=new Uint8Array(x),c=0;c>>24]^l[255&I>>>16]^p[255&S>>>8]^w[255&R]^t[N++],le=h[I>>>24]^l[255&S>>>16]^p[255&R>>>8]^w[255&b]^t[N++],we=h[S>>>24]^l[255&R>>>16]^p[255&b>>>8]^w[255&I]^t[N++],ke=h[R>>>24]^l[255&b>>>16]^p[255&I>>>8]^w[255&S]^t[N++],b=Z,I=le,S=we,R=ke;return Z=(r[b>>>24]<<24|r[255&I>>>16]<<16|r[255&S>>>8]<<8|r[255&R])^t[N++],le=(r[I>>>24]<<24|r[255&S>>>16]<<16|r[255&R>>>8]<<8|r[255&b])^t[N++],we=(r[S>>>24]<<24|r[255&R>>>16]<<16|r[255&b>>>8]<<8|r[255&I])^t[N++],ke=(r[R>>>24]<<24|r[255&b>>>16]<<16|r[255&I>>>8]<<8|r[255&S])^t[N++],[Z>>>=0,le>>>=0,we>>>=0,ke>>>=0]}function x(s){this._key=i(s),this._reset()}var n=m("safe-buffer").Buffer,c=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var s=Array(256),t=0;256>t;t++)s[t]=128>t?t<<1:283^t<<1;for(var b,o=[],r=[],d=[[],[],[],[]],h=[[],[],[],[]],l=0,p=0,w=0;256>w;++w){o[l]=b=(b=p^p<<1^p<<2^p<<3^p<<4)>>>8^255&b^99,r[b]=l;var I=s[l],S=s[I],R=s[S],N=257*s[b]^16843008*b;d[0][l]=N<<24|N>>>8,d[1][l]=N<<16|N>>>16,d[2][l]=N<<8|N>>>24,d[3][l]=N,h[0][b]=(N=16843009*R^65537*S^257*I^16843008*l)<<24|N>>>8,h[1][b]=N<<16|N>>>16,h[2][b]=N<<8|N>>>24,h[3][b]=N,0===l?l=p=1:(l=I^s[s[s[R^I]]],p^=s[s[p]])}return{SBOX:o,INV_SBOX:r,SUB_MIX:d,INV_SUB_MIX:h}}();x.blockSize=16,x.keySize=32,x.prototype.blockSize=x.blockSize,x.prototype.keySize=x.keySize,x.prototype._reset=function(){for(var s=this._key,t=s.length,o=t+6,r=4*(o+1),d=[],h=0;h>>24)>>>24]<<24|u.SBOX[255&l>>>16]<<16|u.SBOX[255&l>>>8]<<8|u.SBOX[255&l],l^=c[0|h/t]<<24):6>>24]<<24|u.SBOX[255&l>>>16]<<16|u.SBOX[255&l>>>8]<<8|u.SBOX[255&l]),d[h]=d[h-t]^l}for(var p=[],w=0;ww||4>=b?I:u.INV_SUB_MIX[0][u.SBOX[I>>>24]]^u.INV_SUB_MIX[1][u.SBOX[255&I>>>16]]^u.INV_SUB_MIX[2][u.SBOX[255&I>>>8]]^u.INV_SUB_MIX[3][u.SBOX[255&I]]}this._nRounds=o,this._keySchedule=d,this._invKeySchedule=p},x.prototype.encryptBlockRaw=function(s){return f(s=i(s),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},x.prototype.encryptBlock=function(s){var t=this.encryptBlockRaw(s),o=n.allocUnsafe(16);return o.writeUInt32BE(t[0],0),o.writeUInt32BE(t[1],4),o.writeUInt32BE(t[2],8),o.writeUInt32BE(t[3],12),o},x.prototype.decryptBlock=function(s){var t=(s=i(s))[1];s[1]=s[3],s[3]=t;var o=f(s,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),r=n.allocUnsafe(16);return r.writeUInt32BE(o[0],0),r.writeUInt32BE(o[3],4),r.writeUInt32BE(o[2],8),r.writeUInt32BE(o[1],12),r},x.prototype.scrub=function(){g(this._keySchedule),g(this._invKeySchedule),g(this._key)},B.exports.AES=x},{"safe-buffer":247}],43:[function(m,B){function f(r,d,h,l){c.call(this);var p=n.alloc(4,0);this._cipher=new x.AES(d);var w=this._cipher.encryptBlock(p);this._ghash=new s(w),h=function g(r,d,h){if(12===d.length)return r._finID=n.concat([d,n.from([0,0,0,1])]),n.concat([d,n.from([0,0,0,2])]);var l=new s(h),p=d.length,w=p%16;l.update(d),w&&l.update(n.alloc(w=16-w,0)),l.update(n.alloc(8,0));var b=n.alloc(8);b.writeUIntBE(8*p,0,8),l.update(b),r._finID=l.state;var I=n.from(r._finID);return o(I),I}(this,h,w),this._prev=n.from(h),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=l,this._alen=0,this._len=0,this._mode=r,this._authTag=null,this._called=!1}var x=m("./aes"),n=m("safe-buffer").Buffer,c=m("cipher-base"),u=m("inherits"),s=m("./ghash"),t=m("buffer-xor"),o=m("./incr32");u(f,c),f.prototype._update=function(r){if(!this._called&&this._alen){var d=16-this._alen%16;16>d&&(d=n.alloc(d,0),this._ghash.update(d))}this._called=!0;var h=this._mode.encrypt(this,r);return this._ghash.update(this._decrypt?r:h),this._len+=r.length,h},f.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var r=t(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function i(r,d){var h=0;r.length!==d.length&&h++;for(var l=Y(r.length,d.length),p=0;pp||16>>0,0),u.writeUInt32BE(c[1]>>>0,4),u.writeUInt32BE(c[2]>>>0,8),u.writeUInt32BE(c[3]>>>0,12),u}function f(c){this.h=c,this.state=x.alloc(16,0),this.cache=x.allocUnsafe(0)}var x=m("safe-buffer").Buffer,n=x.alloc(16,0);f.prototype.ghash=function(c){for(var u=-1;++u++s;){for(0!=(this.state[~~(s/8)]&1<<7-s%8)&&(u[0]^=c[0],u[1]^=c[1],u[2]^=c[2],u[3]^=c[3]),r=0!=(1&c[3]),t=3;0>>1|(1&c[t-1])<<31;c[0]>>>=1,r&&(c[0]^=-520093696)}this.state=g(u)},f.prototype.update=function(c){this.cache=x.concat([this.cache,c]);for(var u;16<=this.cache.length;)u=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(u)},f.prototype.final=function(c,u){return this.cache.length&&this.ghash(x.concat([this.cache,n],16)),this.ghash(g([0,c,0,u])),this.state},B.exports=f},{"safe-buffer":247}],48:[function(m,B){B.exports=function(i){for(var f,g=i.length;g--;){if(255!==(f=i.readUInt8(g))){f++,i.writeUInt8(f,g);break}i.writeUInt8(0,g)}}},{}],49:[function(m,B,i){var g=m("buffer-xor");i.encrypt=function(f,x){var n=g(x,f._prev);return f._prev=f._cipher.encryptBlock(n),f._prev},i.decrypt=function(f,x){var n=f._prev;f._prev=x;var c=f._cipher.decryptBlock(x);return g(c,n)}},{"buffer-xor":90}],50:[function(m,B,i){function g(n,c,u){var s=c.length,t=x(c,n._cache);return n._cache=n._cache.slice(s),n._prev=f.concat([n._prev,u?c:t]),t}var f=m("safe-buffer").Buffer,x=m("buffer-xor");i.encrypt=function(n,c,u){for(var t,s=f.allocUnsafe(0);c.length;){if(0===n._cache.length&&(n._cache=n._cipher.encryptBlock(n._prev),n._prev=f.allocUnsafe(0)),!(n._cache.length<=c.length)){s=f.concat([s,g(n,c,u)]);break}s=f.concat([s,g(n,c.slice(0,t=n._cache.length),u)]),c=c.slice(t)}return s}},{"buffer-xor":90,"safe-buffer":247}],51:[function(m,B,i){function g(n,c,u){for(var r,d,s=-1,t=0;++s<8;)t+=(128&(d=n._cipher.encryptBlock(n._prev)[0]^(r=c&1<<7-s?128:0)))>>s%8,n._prev=f(n._prev,u?r:d);return t}function f(n,c){var u=n.length,s=-1,t=x.allocUnsafe(n.length);for(n=x.concat([n,x.from([c])]);++s>7;return t}var x=m("safe-buffer").Buffer;i.encrypt=function(n,c,u){for(var s=c.length,t=x.allocUnsafe(s),o=-1;++o=t.cmpn(0))throw new Error("invalid sig");if(t.cmp(o)>=o)throw new Error("invalid sig")}var x=m("safe-buffer").Buffer,n=m("bn.js"),c=m("elliptic").ec,u=m("parse-asn1"),s=m("./curves.json");B.exports=function(t,o,r,d,h){var l=u(r);if("ec"===l.type){if("ecdsa"!==d&&"ecdsa/rsa"!==d)throw new Error("wrong public key type");return function i(t,o,r){var d=s[r.data.algorithm.curve.join(".")];if(!d)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));return new c(d).verify(o,t,r.data.subjectPrivateKey.data)}(t,o,l)}if("dsa"===l.type){if("dsa"!==d)throw new Error("wrong public key type");return function g(t,o,r){var d=r.data.p,h=r.data.q,l=r.data.g,p=r.data.pub_key,w=u.signature.decode(t,"der"),b=w.s,I=w.r;f(b,h),f(I,h);var S=n.mont(d),R=b.invm(h);return 0===l.toRed(S).redPow(new n(o).mul(R).mod(h)).fromRed().mul(p.toRed(S).redPow(I.mul(R).mod(h)).fromRed()).mod(d).mod(h).cmp(I)}(t,o,l)}if("rsa"!==d&&"ecdsa/rsa"!==d)throw new Error("wrong public key type");o=x.concat([h,o]);for(var p=l.modulus.byteLength(),w=[1],b=0;o.length+w.length+2b?1:0;for(p=Y(t.length,w.length),t.length!==w.length&&(R=1),I=-1;++Ise||K.byteLengthK)throw new RangeError('The value "'+K+'" is invalid for option "size"')}function u(K){return n(K),g(0>K?0:0|d(K))}function t(K){for(var se=0>K.length?0:0|d(K.length),X=g(se),ce=0;ce=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|K}function h(K,se){if(f.isBuffer(K))return K.length;if(ArrayBuffer.isView(K)||It(K,ArrayBuffer))return K.byteLength;if("string"!=typeof K)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof K);var X=K.length,ce=2>>1;case"base64":return pt(K).length;default:if(Je)return ce?-1:We(K).length;se=(""+se).toLowerCase(),Je=!0}}function l(K,se,X){var ce=!1;if((void 0===se||0>se)&&(se=0),se>this.length||((void 0===X||X>this.length)&&(X=this.length),0>=X)||(X>>>=0)<=(se>>>=0))return"";for(K||(K="utf8");;)switch(K){case"hex":return z(this,se,X);case"utf8":case"utf-8":return we(this,se,X);case"ascii":return A(this,se,X);case"latin1":case"binary":return L(this,se,X);case"base64":return le(this,se,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y(this,se,X);default:if(ce)throw new TypeError("Unknown encoding: "+K);K=(K+"").toLowerCase(),ce=!0}}function p(K,se,X){var ce=K[se];K[se]=K[X],K[X]=ce}function w(K,se,X,ce,Je){if(0===K.length)return-1;if("string"==typeof X?(ce=X,X=0):2147483647X&&(X=-2147483648),Ft(X=+X)&&(X=Je?0:K.length-1),0>X&&(X=K.length+X),X>=K.length){if(Je)return-1;X=K.length-1}else if(0>X){if(!Je)return-1;X=0}if("string"==typeof se&&(se=f.from(se,ce)),f.isBuffer(se))return 0===se.length?-1:b(K,se,X,ce,Je);if("number"==typeof se)return se&=255,"function"==typeof Uint8Array.prototype.indexOf?Je?Uint8Array.prototype.indexOf.call(K,se,X):Uint8Array.prototype.lastIndexOf.call(K,se,X):b(K,[se],X,ce,Je);throw new TypeError("val must be string, number or Buffer")}function b(K,se,X,ce,Je){function ie(Cn,hn){return 1===pe?Cn[hn]:Cn.readUInt16BE(hn*pe)}var dt,pe=1,Ye=K.length,at=se.length;if(void 0!==ce&&("ucs2"===(ce=(ce+"").toLowerCase())||"ucs-2"===ce||"utf16le"===ce||"utf-16le"===ce)){if(2>K.length||2>se.length)return-1;pe=2,Ye/=2,at/=2,X/=2}if(Je){var Gt=-1;for(dt=X;dtYe&&(X=Ye-at),dt=X;0<=dt;dt--){for(var Jt=!0,an=0;anJe&&(ce=Je):ce=Je;var ie=se.length;ce>ie/2&&(ce=ie/2);for(var Ye,pe=0;pe(se-=2));++ce)ie=(Je=K.charCodeAt(ce))>>8,X.push(Je%256),X.push(ie);return X}(se,K.length-X),K,X,ce)}function le(K,se,X){return Ke.fromByteArray(0===se&&X===K.length?K:K.slice(se,X))}function we(K,se,X){X=Y(K.length,X);for(var ce=[],Je=se;Jeie&&(pe=ie):2===Ye?128==(192&(at=K[Je+1]))&&127<(Jt=(31&ie)<<6|63&at)&&(pe=Jt):3===Ye?(dt=K[Je+2],128==(192&(at=K[Je+1]))&&128==(192&dt)&&2047<(Jt=(15&ie)<<12|(63&at)<<6|63&dt)&&(55296>Jt||57343Jt&&(pe=Jt))),null===pe?(pe=65533,Ye=1):65535>>10),pe=56320|1023&pe),ce.push(pe),Je+=Ye}return function ke(K){var se=K.length;if(se<=4096)return G.apply(String,K);for(var X="",ce=0;cese)&&(se=0),(!X||0>X||X>ce)&&(X=ce);for(var Je="",ie=se;ieK)throw new RangeError("offset is not uint");if(K+se>X)throw new RangeError("Trying to access beyond buffer length")}function M(K,se,X,ce,Je,ie){if(!f.isBuffer(K))throw new TypeError('"buffer" argument must be a Buffer instance');if(se>Je||seK.length)throw new RangeError("Index out of range")}function U(K,se,X,ce){if(X+ce>K.length)throw new RangeError("Index out of range");if(0>X)throw new RangeError("Index out of range")}function ee(K,se,X,ce,Je){return se=+se,X>>>=0,Je||U(K,0,X,4),mt.write(K,se,X,ce,23,4),X+4}function J(K,se,X,ce,Je){return se=+se,X>>>=0,Je||U(K,0,X,8),mt.write(K,se,X,ce,52,8),X+8}function Ue(K){return 16>K?"0"+K.toString(16):K.toString(16)}function We(K,se){se=se||1/0;for(var pe,X=K.length,ce=null,Je=[],ie=0;iepe){if(!ce){if(56319pe){-1<(se-=3)&&Je.push(239,191,189),ce=pe;continue}pe=65536+(ce-55296<<10|pe-56320)}else ce&&-1<(se-=3)&&Je.push(239,191,189);if(ce=null,128>pe){if(0>(se-=1))break;Je.push(pe)}else if(2048>pe){if(0>(se-=2))break;Je.push(192|pe>>6,128|63&pe)}else if(65536>pe){if(0>(se-=3))break;Je.push(224|pe>>12,128|63&pe>>6,128|63&pe)}else{if(!(1114112>pe))throw new Error("Invalid code point");if(0>(se-=4))break;Je.push(240|pe>>18,128|63&pe>>12,128|63&pe>>6,128|63&pe)}}return Je}function pt(K){return Ke.toByteArray(function re(K){if(2>(K=(K=K.split("=")[0]).trim().replace(St,"")).length)return"";for(;K.length%4!=0;)K+="=";return K}(K))}function Xt(K,se,X,ce){for(var Je=0;Je=se.length||Je>=K.length);++Je)se[Je+X]=K[Je];return Je}function It(K,se){return K instanceof se||null!=K&&null!=K.constructor&&null!=K.constructor.name&&K.constructor.name===se.name}function Ft(K){return K!=K}var Ke=m("base64-js"),mt=m("ieee754");i.Buffer=f,i.SlowBuffer=function(K){return+K!=K&&(K=0),f.alloc(+K)},i.INSPECT_MAX_BYTES=50,i.kMaxLength=2147483647,(f.TYPED_ARRAY_SUPPORT=function(){try{var K=new Uint8Array(1);return K.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===K.foo()}catch{return!1}}())||typeof console>"u"||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(f.prototype,"parent",{enumerable:!0,get:function(){return f.isBuffer(this)?this.buffer:void 0}}),Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:function(){return f.isBuffer(this)?this.byteOffset:void 0}}),typeof Symbol<"u"&&null!=Symbol.species&&f[Symbol.species]===f&&Object.defineProperty(f,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),f.poolSize=8192,f.from=function(K,se,X){return x(K,se,X)},f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array,f.alloc=function(K,se,X){return function c(K,se,X){return n(K),0>=K||void 0===se?g(K):"string"==typeof X?g(K).fill(se,X):g(K).fill(se)}(K,se,X)},f.allocUnsafe=function(K){return u(K)},f.allocUnsafeSlow=function(K){return u(K)},f.isBuffer=function(K){return null!=K&&!0===K._isBuffer&&K!==f.prototype},f.compare=function(K,se){if(It(K,Uint8Array)&&(K=f.from(K,K.offset,K.byteLength)),It(se,Uint8Array)&&(se=f.from(se,se.offset,se.byteLength)),!f.isBuffer(K)||!f.isBuffer(se))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(K===se)return 0;for(var X=K.length,ce=se.length,Je=0,ie=Y(X,ce);Jese&&(K+=" ... "),""},f.prototype.compare=function(K,se,X,ce,Je){if(It(K,Uint8Array)&&(K=f.from(K,K.offset,K.byteLength)),!f.isBuffer(K))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof K);if(void 0===se&&(se=0),void 0===X&&(X=K?K.length:0),void 0===ce&&(ce=0),void 0===Je&&(Je=this.length),0>se||X>K.length||0>ce||Je>this.length)throw new RangeError("out of range index");if(ce>=Je&&se>=X)return 0;if(ce>=Je)return-1;if(se>=X)return 1;if(this===K)return 0;for(var ie=(Je>>>=0)-(ce>>>=0),pe=(X>>>=0)-(se>>>=0),Ye=Y(ie,pe),at=this.slice(ce,Je),dt=K.slice(se,X),Gt=0;Gt>>=0,isFinite(X)?(X>>>=0,void 0===ce&&(ce="utf8")):(ce=X,X=void 0)}var Je=this.length-se;if((void 0===X||X>Je)&&(X=Je),0X||0>se)||se>this.length)throw new RangeError("Attempt to write outside buffer bounds");ce||(ce="utf8");for(var ie=!1;;)switch(ce){case"hex":return I(this,K,se,X);case"utf8":case"utf-8":return S(this,K,se,X);case"ascii":return R(this,K,se,X);case"latin1":case"binary":return N(this,K,se,X);case"base64":return q(this,K,se,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Z(this,K,se,X);default:if(ie)throw new TypeError("Unknown encoding: "+ce);ce=(""+ce).toLowerCase(),ie=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},f.prototype.slice=function(K,se){var X=this.length;0>(K=~~K)?0>(K+=X)&&(K=0):K>X&&(K=X),0>(se=void 0===se?X:~~se)?0>(se+=X)&&(se=0):se>X&&(se=X),se>>=0,se>>>=0,X||C(K,se,this.length);for(var ce=this[K],Je=1,ie=0;++ie>>=0,se>>>=0,X||C(K,se,this.length);for(var ce=this[K+--se],Je=1;0>>=0,se||C(K,1,this.length),this[K]},f.prototype.readUInt16LE=function(K,se){return K>>>=0,se||C(K,2,this.length),this[K]|this[K+1]<<8},f.prototype.readUInt16BE=function(K,se){return K>>>=0,se||C(K,2,this.length),this[K]<<8|this[K+1]},f.prototype.readUInt32LE=function(K,se){return K>>>=0,se||C(K,4,this.length),(this[K]|this[K+1]<<8|this[K+2]<<16)+16777216*this[K+3]},f.prototype.readUInt32BE=function(K,se){return K>>>=0,se||C(K,4,this.length),16777216*this[K]+(this[K+1]<<16|this[K+2]<<8|this[K+3])},f.prototype.readIntLE=function(K,se,X){K>>>=0,se>>>=0,X||C(K,se,this.length);for(var ce=this[K],Je=1,ie=0;++ie=(Je*=128)&&(ce-=j(2,8*se)),ce},f.prototype.readIntBE=function(K,se,X){K>>>=0,se>>>=0,X||C(K,se,this.length);for(var ce=se,Je=1,ie=this[K+--ce];0=(Je*=128)&&(ie-=j(2,8*se)),ie},f.prototype.readInt8=function(K,se){return K>>>=0,se||C(K,1,this.length),128&this[K]?-1*(255-this[K]+1):this[K]},f.prototype.readInt16LE=function(K,se){K>>>=0,se||C(K,2,this.length);var X=this[K]|this[K+1]<<8;return 32768&X?4294901760|X:X},f.prototype.readInt16BE=function(K,se){K>>>=0,se||C(K,2,this.length);var X=this[K+1]|this[K]<<8;return 32768&X?4294901760|X:X},f.prototype.readInt32LE=function(K,se){return K>>>=0,se||C(K,4,this.length),this[K]|this[K+1]<<8|this[K+2]<<16|this[K+3]<<24},f.prototype.readInt32BE=function(K,se){return K>>>=0,se||C(K,4,this.length),this[K]<<24|this[K+1]<<16|this[K+2]<<8|this[K+3]},f.prototype.readFloatLE=function(K,se){return K>>>=0,se||C(K,4,this.length),mt.read(this,K,!0,23,4)},f.prototype.readFloatBE=function(K,se){return K>>>=0,se||C(K,4,this.length),mt.read(this,K,!1,23,4)},f.prototype.readDoubleLE=function(K,se){return K>>>=0,se||C(K,8,this.length),mt.read(this,K,!0,52,8)},f.prototype.readDoubleBE=function(K,se){return K>>>=0,se||C(K,8,this.length),mt.read(this,K,!1,52,8)},f.prototype.writeUIntLE=function(K,se,X,ce){K=+K,se>>>=0,X>>>=0,ce||M(this,K,se,X,j(2,8*X)-1,0);var ie=1,pe=0;for(this[se]=255&K;++pe>>=0,X>>>=0,ce||M(this,K,se,X,j(2,8*X)-1,0);var ie=X-1,pe=1;for(this[se+ie]=255&K;0<=--ie&&(pe*=256);)this[se+ie]=255&K/pe;return se+X},f.prototype.writeUInt8=function(K,se,X){return K=+K,se>>>=0,X||M(this,K,se,1,255,0),this[se]=255&K,se+1},f.prototype.writeUInt16LE=function(K,se,X){return K=+K,se>>>=0,X||M(this,K,se,2,65535,0),this[se]=255&K,this[se+1]=K>>>8,se+2},f.prototype.writeUInt16BE=function(K,se,X){return K=+K,se>>>=0,X||M(this,K,se,2,65535,0),this[se]=K>>>8,this[se+1]=255&K,se+2},f.prototype.writeUInt32LE=function(K,se,X){return K=+K,se>>>=0,X||M(this,K,se,4,4294967295,0),this[se+3]=K>>>24,this[se+2]=K>>>16,this[se+1]=K>>>8,this[se]=255&K,se+4},f.prototype.writeUInt32BE=function(K,se,X){return K=+K,se>>>=0,X||M(this,K,se,4,4294967295,0),this[se]=K>>>24,this[se+1]=K>>>16,this[se+2]=K>>>8,this[se+3]=255&K,se+4},f.prototype.writeIntLE=function(K,se,X,ce){if(K=+K,se>>>=0,!ce){var Je=j(2,8*X-1);M(this,K,se,X,Je-1,-Je)}var ie=0,pe=1,Ye=0;for(this[se]=255&K;++ieK&&0===Ye&&0!==this[se+ie-1]&&(Ye=1),this[se+ie]=255&(K/pe>>0)-Ye;return se+X},f.prototype.writeIntBE=function(K,se,X,ce){if(K=+K,se>>>=0,!ce){var Je=j(2,8*X-1);M(this,K,se,X,Je-1,-Je)}var ie=X-1,pe=1,Ye=0;for(this[se+ie]=255&K;0<=--ie&&(pe*=256);)0>K&&0===Ye&&0!==this[se+ie+1]&&(Ye=1),this[se+ie]=255&(K/pe>>0)-Ye;return se+X},f.prototype.writeInt8=function(K,se,X){return K=+K,se>>>=0,X||M(this,K,se,1,127,-128),0>K&&(K=255+K+1),this[se]=255&K,se+1},f.prototype.writeInt16LE=function(K,se,X){return K=+K,se>>>=0,X||M(this,K,se,2,32767,-32768),this[se]=255&K,this[se+1]=K>>>8,se+2},f.prototype.writeInt16BE=function(K,se,X){return K=+K,se>>>=0,X||M(this,K,se,2,32767,-32768),this[se]=K>>>8,this[se+1]=255&K,se+2},f.prototype.writeInt32LE=function(K,se,X){return K=+K,se>>>=0,X||M(this,K,se,4,2147483647,-2147483648),this[se]=255&K,this[se+1]=K>>>8,this[se+2]=K>>>16,this[se+3]=K>>>24,se+4},f.prototype.writeInt32BE=function(K,se,X){return K=+K,se>>>=0,X||M(this,K,se,4,2147483647,-2147483648),0>K&&(K=4294967295+K+1),this[se]=K>>>24,this[se+1]=K>>>16,this[se+2]=K>>>8,this[se+3]=255&K,se+4},f.prototype.writeFloatLE=function(K,se,X){return ee(this,K,se,!0,X)},f.prototype.writeFloatBE=function(K,se,X){return ee(this,K,se,!1,X)},f.prototype.writeDoubleLE=function(K,se,X){return J(this,K,se,!0,X)},f.prototype.writeDoubleBE=function(K,se,X){return J(this,K,se,!1,X)},f.prototype.copy=function(K,se,X,ce){if(!f.isBuffer(K))throw new TypeError("argument should be a Buffer");if(X||(X=0),ce||0===ce||(ce=this.length),se>=K.length&&(se=K.length),se||(se=0),0se)throw new RangeError("targetStart out of bounds");if(0>X||X>=this.length)throw new RangeError("Index out of range");if(0>ce)throw new RangeError("sourceEnd out of bounds");ce>this.length&&(ce=this.length),K.length-seJe||"latin1"===ce)&&(K=Je)}}else"number"==typeof K&&(K&=255);if(0>se||this.length>>=0,X=void 0===X?this.length:X>>>0,K||(K=0),"number"==typeof K)for(ie=se;iele&&!ke.warned){ke.warned=!0;var A=new Error("Possible EventEmitter memory leak detected. "+ke.length+" "+N+" listeners added. Use emitter.setMaxListeners() to increase limit");A.name="MaxListenersExceededWarning",A.emitter=R,A.type=N,A.count=ke.length,function i(R){console&&console.warn&&console.warn(R)}(A)}return R}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(R,N,q){var Z={fired:!1,wrapFn:void 0,target:R,type:N,listener:q},le=c.bind(Z);return le.listener=q,Z.wrapFn=le,le}function s(R,N,q){var Z=R._events;if(void 0===Z)return[];var le=Z[N];return void 0===le?[]:"function"==typeof le?q?[le.listener||le]:[le]:q?function d(R){for(var N=Array(R.length),q=0;qR||I(R))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+R+".");S=R}}),g.init=function(){(void 0===this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},g.prototype.setMaxListeners=function(R){if("number"!=typeof R||0>R||I(R))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+R+".");return this._maxListeners=R,this},g.prototype.getMaxListeners=function(){return x(this)},g.prototype.emit=function(R){for(var N=[],q=1;qle)return this;0===le?q.shift():function r(R,N){for(;N+1s.length||2!==t||46!==s.charCodeAt(s.length-1)||46!==s.charCodeAt(s.length-2))if(2l){if(47===u.charCodeAt(r+w))return u.slice(r+w+1);if(0===w)return u.slice(r+w)}else o>l&&(47===c.charCodeAt(s+w)?p=w:0===w&&(p=0));break}var b=c.charCodeAt(s+w);if(b!==u.charCodeAt(r+w))break;47===b&&(p=w)}var S="";for(w=s+p+1;w<=t;++w)(w===t||47===c.charCodeAt(w))&&(S+=0===S.length?"..":"/..");return 0=o;--p)if(47!==(s=c.charCodeAt(p)))-1===h&&(l=!1,h=p+1),46===s?-1===r?r=p:1!==w&&(w=1):-1!==r&&(w=-1);else if(!l){d=p+1;break}return-1===r||-1===h||0===w||1===w&&r===h-1&&r===d+1?-1!==h&&(u.base=u.name=c.slice(0===d&&t?1:d,h)):(0===d&&t?(u.name=c.slice(1,r),u.base=c.slice(1,h)):(u.name=c.slice(d,r),u.base=c.slice(d,h)),u.ext=c.slice(r,h)),0o?0:+o,t.length)===t}(t,"not ")?(r="must not be",t=t.replace(/^not /,"")):r="must be",function n(s,t,o){return(void 0===o||o>s.length)&&(o=s.length),s.substring(o-t.length,o)===t}(s," argument"))d="The ".concat(s," ").concat(r," ").concat(f(t,"type"));else{var h=function c(s,t,o){return"number"!=typeof o&&(o=0),!(o+t.length>s.length)&&-1!==s.indexOf(t,o)}(s,".")?"property":"argument";d='The "'.concat(s,'" ').concat(h," ").concat(r," ").concat(f(t,"type"))}return d+". Received type ".concat(typeof o)},TypeError),g("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),g("ERR_METHOD_NOT_IMPLEMENTED",function(s){return"The "+s+" method is not implemented"}),g("ERR_STREAM_PREMATURE_CLOSE","Premature close"),g("ERR_STREAM_DESTROYED",function(s){return"Cannot call "+s+" after a stream was destroyed"}),g("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),g("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),g("ERR_STREAM_WRITE_AFTER_END","write after end"),g("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),g("ERR_UNKNOWN_ENCODING",function(s){return"Unknown encoding: "+s},TypeError),g("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),B.exports.codes=u},{}],74:[function(m,B){(function(i){(function(){"use strict";function g(r){return this instanceof g?(c.call(this,r),u.call(this,r),this.allowHalfOpen=!0,void(r&&(!1===r.readable&&(this.readable=!1),!1===r.writable&&(this.writable=!1),!1===r.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",f))))):new g(r)}function f(){this._writableState.ended||i.nextTick(x,this)}function x(r){r.end()}var n=Object.keys||function(r){var d=[];for(var h in r)d.push(h);return d};B.exports=g;var c=m("./_stream_readable"),u=m("./_stream_writable");m("inherits")(g,c);for(var o,s=n(u.prototype),t=0;t=X||0===ce.length&&ce.ended?0:ce.objectMode?1:X==X?(X>ce.highWaterMark&&(ce.highWaterMark=function r(X){return 1073741824<=X?X=1073741824:(X--,X|=X>>>1,X|=X>>>2,X|=X>>>4,X|=X>>>8,X|=X>>>16,X++),X}(X)),X<=ce.length?X:ce.ended?ce.length:(ce.needReadable=!0,0)):ce.flowing&&ce.length?ce.buffer.head.data.length:ce.length}function l(X){var ce=X._readableState;J("emitReadable",ce.needReadable,ce.emittedReadable),ce.needReadable=!1,ce.emittedReadable||(J("emitReadable",ce.flowing),ce.emittedReadable=!0,i.nextTick(p,X))}function p(X){var ce=X._readableState;J("emitReadable_",ce.destroyed,ce.length,ce.ended),!ce.destroyed&&(ce.length||ce.ended)&&(X.emit("readable"),ce.emittedReadable=!1),ce.needReadable=!ce.flowing&&!ce.ended&&ce.length<=ce.highWaterMark,Z(X)}function w(X,ce){ce.readingMore||(ce.readingMore=!0,i.nextTick(b,X,ce))}function b(X,ce){for(;!ce.reading&&!ce.ended&&(ce.length=ce.length?(Je=ce.decoder?ce.buffer.join(""):1===ce.buffer.length?ce.buffer.first():ce.buffer.concat(ce.length),ce.buffer.clear()):Je=ce.buffer.consume(X,ce.decoder),Je);var Je}function we(X){var ce=X._readableState;J("endReadable",ce.endEmitted),ce.endEmitted||(ce.ended=!0,i.nextTick(ke,ce,X))}function ke(X,ce){if(J("endReadableNT",X.endEmitted,X.length),!X.endEmitted&&0===X.length&&(X.endEmitted=!0,ce.readable=!1,ce.emit("end"),X.autoDestroy)){var Je=ce._writableState;(!Je||Je.autoDestroy&&Je.finished)&&ce.destroy()}}function A(X,ce){for(var Je=0,ie=X.length;Je=ce.highWaterMark)||ce.ended))return J("read: emitReadable",ce.length,ce.ended),0===ce.length&&ce.ended?we(this):l(this),null;if(0===(X=d(X,ce))&&ce.ended)return 0===ce.length&&we(this),null;var pe,ie=ce.needReadable;return J("need readable",ie),(0===ce.length||ce.length-X"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"../errors":73,"./_stream_duplex":74,"./internal/streams/async_iterator":79,"./internal/streams/buffer_list":80,"./internal/streams/destroy":81,"./internal/streams/from":83,"./internal/streams/state":85,"./internal/streams/stream":86,_process:205,buffer:69,events:70,inherits:159,"string_decoder/":276,util:41}],77:[function(m,B){"use strict";function i(r,d){var h=this._transformState;h.transforming=!1;var l=h.writecb;if(null===l)return this.emit("error",new u);h.writechunk=null,h.writecb=null,null!=d&&this.push(d),l(r);var p=this._readableState;p.reading=!1,(p.needReadable||p.length"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"../errors":73,"./_stream_duplex":74,"./internal/streams/destroy":81,"./internal/streams/state":85,"./internal/streams/stream":86,_process:205,buffer:69,inherits:159,"util-deprecate":288}],79:[function(m,B){(function(i){(function(){"use strict";function g(I,S,R){return S in I?Object.defineProperty(I,S,{value:R,enumerable:!0,configurable:!0,writable:!0}):I[S]=R,I}function f(I,S){return{value:I,done:S}}function x(I){var S=I[s];if(null!==S){var R=I[l].read();null!==R&&(I[d]=null,I[s]=null,I[t]=null,S(f(R,!1)))}}function n(I){i.nextTick(x,I)}var b,u=m("./end-of-stream"),s=Symbol("lastResolve"),t=Symbol("lastReject"),o=Symbol("error"),r=Symbol("ended"),d=Symbol("lastPromise"),h=Symbol("handlePromise"),l=Symbol("stream"),p=Object.getPrototypeOf(function(){}),w=Object.setPrototypeOf((g(b={get stream(){return this[l]},next:function(){var I=this,S=this[o];if(null!==S)return Promise.reject(S);if(this[r])return Promise.resolve(f(void 0,!0));if(this[l].destroyed)return new Promise(function(Z,le){i.nextTick(function(){I[o]?le(I[o]):Z(f(void 0,!0))})});var N,R=this[d];if(R)N=new Promise(function c(I,S){return function(R,N){I.then(function(){return S[r]?void R(f(void 0,!0)):void S[h](R,N)},N)}}(R,this));else{var q=this[l].read();if(null!==q)return Promise.resolve(f(q,!1));N=new Promise(this[h])}return this[d]=N,N}},Symbol.asyncIterator,function(){return this}),g(b,"return",function(){var I=this;return new Promise(function(S,R){I[l].destroy(null,function(N){return N?void R(N):void S(f(void 0,!0))})})}),b),p);B.exports=function(I){var R,S=Object.create(w,(g(R={},l,{value:I,writable:!0}),g(R,s,{value:null,writable:!0}),g(R,t,{value:null,writable:!0}),g(R,o,{value:null,writable:!0}),g(R,r,{value:I._readableState.endEmitted,writable:!0}),g(R,h,{value:function(N,q){var Z=S[l].read();Z?(S[d]=null,S[s]=null,S[t]=null,N(f(Z,!1))):(S[s]=N,S[t]=q)},writable:!0}),R));return S[d]=null,u(I,function(N){if(N&&"ERR_STREAM_PREMATURE_CLOSE"!==N.code){var q=S[t];return null!==q&&(S[d]=null,S[s]=null,S[t]=null,q(N)),void(S[o]=N)}var Z=S[s];null!==Z&&(S[d]=null,S[s]=null,S[t]=null,Z(f(void 0,!0))),S[r]=!0}),I.on("readable",n.bind(null,S)),S}}).call(this)}).call(this,m("_process"))},{"./end-of-stream":82,_process:205}],80:[function(m,B){"use strict";function i(h,l){var p=Object.keys(h);if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(h);l&&(w=w.filter(function(b){return Object.getOwnPropertyDescriptor(h,b).enumerable})),p.push.apply(p,w)}return p}function f(h,l,p){return l in h?Object.defineProperty(h,l,{value:p,enumerable:!0,configurable:!0,writable:!0}):h[l]=p,h}function n(h,l){for(var w,p=0;p>>0),w=this.head,b=0;w;)u(w.data,p,b),b+=w.data.length,w=w.next;return p}},{key:"consume",value:function(l,p){var w;return lI.length?I.length:l;if(b+=S===I.length?I:I.slice(0,l),0==(l-=S)){S===I.length?(++w,this.head=p.next?p.next:this.tail=null):(this.head=p,p.data=I.slice(S));break}++w}return this.length-=w,b}},{key:"_getBuffer",value:function(l){var p=t.allocUnsafe(l),w=this.head,b=1;for(w.data.copy(p),l-=w.data.length;w=w.next;){var I=w.data,S=l>I.length?I.length:l;if(I.copy(p,p.length-l,0,S),0==(l-=S)){S===I.length?(++b,this.head=w.next?w.next:this.tail=null):(this.head=w,w.data=I.slice(S));break}++b}return this.length-=b,p}},{key:d,value:function(l,p){return r(this,function g(h){for(var p,l=1;lh.length)throw new t("streams");var b,w=h.map(function(I,S){var R=Su)throw new g(c?n:"highWaterMark",u);return wt(u)}return f.objectMode?16:16384}}},{"../../../errors":73}],86:[function(m,B){B.exports=m("events").EventEmitter},{events:70}],87:[function(m,B){(function(i){(function(){B.exports=function(g){if("number"!=typeof g)throw new TypeError('"size" argument must be a number');if(0>g)throw new RangeError('"size" argument must not be negative');return i.allocUnsafe?i.allocUnsafe(g):new i(g)}}).call(this)}).call(this,m("buffer").Buffer)},{buffer:69}],88:[function(m,B){(function(i){(function(){var g=m("buffer-fill"),f=m("buffer-alloc-unsafe");B.exports=function(x,n,c){if("number"!=typeof x)throw new TypeError('"size" argument must be a number');if(0>x)throw new RangeError('"size" argument must not be negative');if(i.alloc)return i.alloc(x,n,c);var u=f(x);return 0===x?u:void 0===n?g(u,0):("string"!=typeof c&&(c=void 0),g(u,n,c))}}).call(this)}).call(this,m("buffer").Buffer)},{buffer:69,"buffer-alloc-unsafe":87,"buffer-fill":89}],89:[function(m,B){(function(i){(function(){function f(c,u,s,t){if(0>s||t>c.length)throw new RangeError("Out of range index");return(t=void 0===t?c.length:t>>>0)>(s>>>=0)&&c.fill(u,s,t),c}var n=function(){try{if(!i.isEncoding("latin1"))return!1;var c=i.alloc?i.alloc(4):new i(4);return c.fill("ab","ucs2"),"61006200"===c.toString("hex")}catch{return!1}}();B.exports=function(c,u,s,t,o){if(n)return c.fill(u,s,t,o);if("number"==typeof u)return f(c,u,s,t);if("string"==typeof u){if("string"==typeof s?(o=s,s=0,t=c.length):"string"==typeof t&&(o=t,t=c.length),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("latin1"===o&&(o="binary"),"string"==typeof o&&!i.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(""===u)return f(c,0,s,t);if(function g(c){return 1===c.length&&256>c.charCodeAt(0)}(u))return f(c,u.charCodeAt(0),s,t);u=new i(u,o)}return i.isBuffer(u)?function x(c,u,s,t){if(0>s||t>c.length)throw new RangeError("Out of range index");if(t<=s)return c;t=void 0===t?c.length:t>>>0;for(var o=s>>>=0,r=u.length;o<=t-r;)u.copy(c,o),o+=r;return o!==t&&u.copy(c,o,0,t-o),c}(c,u,s,t):f(c,0,s,t)}}).call(this)}).call(this,m("buffer").Buffer)},{buffer:69}],90:[function(m,B){(function(i){(function(){B.exports=function(g,f){for(var x=Y(g.length,f.length),n=new i(x),c=0;c{})){return this.cache?(this.cache.remove(f),void this.store.put(f,x,n)):g(()=>n(new Error("CacheStore closed")))}get(f,x,n=(()=>{})){if("function"==typeof x)return this.get(f,null,x);if(!this.cache)return g(()=>n(new Error("CacheStore closed")));x||(x={});let c=this.cache.get(f);if(c){const t=x.offset||0,o=x.length||c.length-t;return(0!==t||o!==c.length)&&(c=c.slice(t,o+t)),g(()=>n(null,c))}let u=this.inProgressGets.get(f);const s=!!u;u||(u=[],this.inProgressGets.set(f,u)),u.push({opts:x,cb:n}),s||this.store.get(f,(t,o)=>{t||null==this.cache||this.cache.set(f,o);const r=this.inProgressGets.get(f);this.inProgressGets.delete(f);for(const{opts:d,cb:h}of r)if(t)h(t);else{const l=d.offset||0,p=d.length||o.length-l;let w=o;(0!==l||p!==o.length)&&(w=o.slice(l,p+l)),h(null,w)}})}close(f=(()=>{})){return this.cache?(this.cache=null,void this.store.close(f)):g(()=>f(new Error("CacheStore closed")))}destroy(f=(()=>{})){return this.cache?(this.cache=null,void this.store.destroy(f)):g(()=>f(new Error("CacheStore closed")))}}},{lru:168,"queue-microtask":218}],93:[function(m,B){const i=m("block-stream2"),g=m("readable-stream");B.exports=class f extends g.Writable{constructor(n,c,u={}){if(super(u),!n||!n.put||!n.get)throw new Error("First argument must be an abstract-chunk-store compliant store");if(!(c=+c))throw new Error("Second argument must be a chunk length");const s=void 0!==u.zeroPadding&&u.zeroPadding;this._blockstream=new i(c,{...u,zeroPadding:s}),this._outstandingPuts=0,this._storeMaxOutstandingPuts=u.storeMaxOutstandingPuts||16;let t=0;this._blockstream.on("data",r=>{this.destroyed||(this._outstandingPuts+=1,this._outstandingPuts>=this._storeMaxOutstandingPuts&&this._blockstream.pause(),n.put(t,r,d=>d?this.destroy(d):(this._outstandingPuts-=1,this._outstandingPuts{this.destroy(r)})}_write(n,c,u){this._blockstream.write(n,c,u)}_final(n){this._blockstream.end(),this._blockstream.once("end",()=>{0===this._outstandingPuts?n(null):this._finalCb=n})}destroy(n){this.destroyed||(this.destroyed=!0,n&&this.emit("error",n),this.emit("close"))}}},{"block-stream2":38,"readable-stream":240}],94:[function(m,B){function i(c){f.call(this),this.hashMode="string"==typeof c,this.hashMode?this[c]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}var g=m("safe-buffer").Buffer,f=m("stream").Transform,x=m("string_decoder").StringDecoder;m("inherits")(i,f),i.prototype.update=function(c,u,s){"string"==typeof c&&(c=g.from(c,u));var t=this._update(c);return this.hashMode?this:(s&&(t=this._toString(t,s)),t)},i.prototype.setAutoPadding=function(){},i.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},i.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},i.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},i.prototype._transform=function(c,u,s){var t;try{this.hashMode?this._update(c):this.push(this._update(c))}catch(o){t=o}finally{s(t)}},i.prototype._flush=function(c){var u;try{this.push(this.__final())}catch(s){u=s}c(u)},i.prototype._finalOrDigest=function(c){var u=this.__final()||g.alloc(0);return c&&(u=this._toString(u,c,!0)),u},i.prototype._toString=function(c,u,s){if(this._decoder||(this._decoder=new x(u),this._encoding=u),this._encoding!==u)throw new Error("can't switch encodings");var t=this._decoder.write(c);return s&&(t+=this._decoder.end()),t},B.exports=i},{inherits:159,"safe-buffer":247,stream:72,string_decoder:276}],95:[function(m,B){(function(i){(function(){var g=function(){"use strict";function f(c,u,s,t){"object"==typeof u&&(s=u.depth,t=u.prototype,u=u.circular);var d=[],h=[],l=typeof i<"u";return typeof u>"u"&&(u=!0),typeof s>"u"&&(s=1/0),function o(p,w){if(null===p)return null;if(0==w)return p;var b,I;if("object"!=typeof p)return p;if(f.__isArray(p))b=[];else if(f.__isRegExp(p))b=new RegExp(p.source,n(p)),p.lastIndex&&(b.lastIndex=p.lastIndex);else if(f.__isDate(p))b=new Date(p.getTime());else{if(l&&i.isBuffer(p))return b=i.allocUnsafe?i.allocUnsafe(p.length):new i(p.length),p.copy(b),b;typeof t>"u"?(I=Object.getPrototypeOf(p),b=Object.create(I)):(b=Object.create(t),I=t)}if(u){var S=d.indexOf(p);if(-1!=S)return h[S];d.push(p),h.push(b)}for(var R in p){var N;I&&(N=Object.getOwnPropertyDescriptor(I,R)),(!N||null!=N.set)&&(b[R]=o(p[R],w-1))}return b}(c,s)}function x(c){return Object.prototype.toString.call(c)}function n(c){var u="";return c.global&&(u+="g"),c.ignoreCase&&(u+="i"),c.multiline&&(u+="m"),u}return f.clonePrototype=function(c){if(null===c)return null;var u=function(){};return u.prototype=c,new u},f.__objToStr=x,f.__isDate=function(c){return"object"==typeof c&&"[object Date]"===x(c)},f.__isArray=function(c){return"object"==typeof c&&"[object Array]"===x(c)},f.__isRegExp=function(c){return"object"==typeof c&&"[object RegExp]"===x(c)},f.__getRegExpFlags=n,f}();"object"==typeof B&&B.exports&&(B.exports=g)}).call(this)}).call(this,m("buffer").Buffer)},{buffer:69}],96:[function(m,B){B.exports=function(){for(var g=navigator.hardwareConcurrency||1,f=[],x=0;xd?r=("rmd160"===o?new u:s(o)).update(r).digest():r.length64?u=c(u):u.length<64&&(u=f.concat([u,n],64));for(var s=this._ipad=f.allocUnsafe(64),t=this._opad=f.allocUnsafe(64),o=0;o<64;o++)s[o]=54^u[o],t[o]=92^u[o];this._hash=[s]}var g=m("inherits"),f=m("safe-buffer").Buffer,x=m("cipher-base"),n=f.alloc(128);g(i,x),i.prototype._update=function(c){this._hash.push(c)},i.prototype._final=function(){var c=this._alg(f.concat(this._hash));return this._alg(f.concat([this._opad,c]))},B.exports=i},{"cipher-base":94,inherits:159,"safe-buffer":247}],103:[function(m,B){(function(i){(function(){function g(L,z,y){function C(){q(L.map(re=>Ue=>{const We={};if(u(re))We.getStream=function o(L){return()=>new b(L)}(re),We.length=re.size;else if(i.isBuffer(re))We.getStream=function r(L){return()=>{const z=new we.PassThrough;return z.end(L),z}}(re),We.length=re.length;else{if(!t(re)){if("string"==typeof re){if("function"!=typeof ke)throw new Error("filesystem paths do not work in the browser");return void ke(re,1{const y=new we.Transform;return y._transform=function(C,M,U){z.length+=C.length,this.push(C),U()},L.pipe(y),y}}(re,We),We.length=0}We.path=re.path,Ue(null,We)}),(re,Ue)=>re?y(re):(Ue=Ue.flat(),void y(null,Ue,J)))}if(function s(L){return typeof FileList<"u"&&L instanceof FileList}(L)&&(L=Array.from(L)),Array.isArray(L)||(L=[L]),0===L.length)throw new Error("invalid input type");L.forEach(re=>{if(null==re)throw new Error(`invalid input type: ${re}`)}),1!==(L=L.map(re=>u(re)&&"string"==typeof re.path&&"function"==typeof ke?re.path:re)).length||"string"==typeof L[0]||L[0].name||(L[0].name=z.name);let M=null;L.forEach((re,Ue)=>{if("string"==typeof re)return;let We=re.fullPath||re.name;We||(We=`Unknown File ${Ue+1}`,re.unknownName=!0),re.path=We.split("/"),re.path[0]||re.path.shift(),2>re.path.length?M=null:0===Ue&&1"string"==typeof re||!n(re.path))),M&&L.forEach(re=>{const Ue=(i.isBuffer(re)||t(re))&&!re.path;"string"==typeof re||Ue||re.path.shift()}),!z.name&&M&&(z.name=M),z.name||L.some(re=>"string"==typeof re?(z.name=w.basename(re),!0):!re.unknownName&&(z.name=re.path[re.path.length-1],!0)),z.name||(z.name=`Unnamed Torrent ${Date.now()}`);const ee=L.reduce((re,Ue)=>re+ +("string"==typeof Ue),0);let J=1===L.length;if(1===L.length&&"string"==typeof L[0]){if("function"!=typeof ke)throw new Error("filesystem paths do not work in the browser");I(L[0],(re,Ue)=>re?y(re):(J=Ue,void C()))}else Z(C)}function n(L){const z=L[L.length-1];return"."===z[0]&&S.is(z)}function c(L,z){return L+z.length}function u(L){return typeof Blob<"u"&&L instanceof Blob}function t(L){return"object"==typeof L&&null!=L&&"function"==typeof L.pipe}const h=m("bencode"),l=m("block-stream2"),p=m("piece-length"),w=m("path"),b=m("filestream/read"),I=m("is-file"),S=m("junk"),R=m("multistream"),N=m("once"),q=m("run-parallel"),Z=m("queue-microtask"),le=m("simple-sha1"),we=m("readable-stream"),ke=m("./get-files"),A=5;B.exports=function(L,z,y){"function"==typeof z&&([z,y]=[y,z]),g(L,z=z?Object.assign({},z):{},(C,M,U)=>C?y(C):(z.singleFileTorrent=U,void function x(L,z,y){let C=z.announceList;C||("string"==typeof z.announce?C=[[z.announce]]:Array.isArray(z.announce)&&(C=z.announce.map(J=>[J]))),C||(C=[]),globalThis.WEBTORRENT_ANNOUNCE&&("string"==typeof globalThis.WEBTORRENT_ANNOUNCE?C.push([[globalThis.WEBTORRENT_ANNOUNCE]]):Array.isArray(globalThis.WEBTORRENT_ANNOUNCE)&&(C=C.concat(globalThis.WEBTORRENT_ANNOUNCE.map(J=>[J])))),void 0===z.announce&&void 0===z.announceList&&(C=C.concat(B.exports.announceList)),"string"==typeof z.urlList&&(z.urlList=[z.urlList]);const M={info:{name:z.name},"creation date":ve((+z.creationDate||Date.now())/1e3),encoding:"UTF-8"};0!==C.length&&(M.announce=C[0][0],M["announce-list"]=C),void 0!==z.comment&&(M.comment=z.comment),void 0!==z.createdBy&&(M["created by"]=z.createdBy),void 0!==z.private&&(M.info.private=+z.private),void 0!==z.info&&Object.assign(M.info,z.info),void 0!==z.sslCert&&(M.info["ssl-cert"]=z.sslCert),void 0!==z.urlList&&(M["url-list"]=z.urlList);const U=L.reduce(c,0),ee=z.pieceLength||p(U);M.info["piece length"]=ee,function f(L,z,y,C,M){function U(St){Qe+=St.length;const K=It;le(St,se=>{We[K]=se,Xt-=1,Xt=A&&mt.pause(),It+=1}function ee(){Ft=!0,Ue()}function J(St){re(),M(St)}function re(){Ke.removeListener("error",J),mt.removeListener("data",U),mt.removeListener("end",ee),mt.removeListener("error",J)}function Ue(){Ft&&0===Xt&&(re(),M(null,i.from(We.join(""),"hex"),Qe))}M=N(M);const We=[];let Qe=0,ft=0;const pt=L.map(St=>St.getStream);let Xt=0,It=0,Ft=!1;const Ke=new R(pt),mt=new l(z,{zeroPadding:!1});Ke.on("error",J),Ke.pipe(mt).on("data",U).on("end",ee).on("error",J)}(L,ee,U,z,(J,re,Ue)=>J?y(J):(M.info.pieces=re,L.forEach(We=>{delete We.getStream}),z.singleFileTorrent?M.info.length=Ue:M.info.files=L,void y(null,h.encode(M))))}(M,z,y)))},B.exports.parseInput=function(L,z,y){"function"==typeof z&&([z,y]=[y,z]),g(L,z=z?Object.assign({},z):{},y)},B.exports.announceList=[["udp://tracker.leechers-paradise.org:6969"],["udp://tracker.coppersurfer.tk:6969"],["udp://tracker.opentrackr.org:1337"],["udp://explodie.org:6969"],["udp://tracker.empire-js.us:1337"],["wss://tracker.btorrent.xyz"],["wss://tracker.openwebtorrent.com"]],B.exports.isJunkPath=n}).call(this)}).call(this,m("buffer").Buffer)},{"./get-files":41,bencode:27,"block-stream2":38,buffer:69,"filestream/read":140,"is-file":41,junk:163,multistream:189,once:191,path:71,"piece-length":204,"queue-microtask":218,"readable-stream":240,"run-parallel":245,"simple-sha1":260}],104:[function(m,B,i){"use strict";i.randomBytes=i.rng=i.pseudoRandomBytes=i.prng=m("randombytes"),i.createHash=i.Hash=m("create-hash"),i.createHmac=i.Hmac=m("create-hmac");var g=m("browserify-sign/algos"),f=Object.keys(g),x=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(f);i.getHashes=function(){return x};var n=m("pbkdf2");i.pbkdf2=n.pbkdf2,i.pbkdf2Sync=n.pbkdf2Sync;var c=m("browserify-cipher");i.Cipher=c.Cipher,i.createCipher=c.createCipher,i.Cipheriv=c.Cipheriv,i.createCipheriv=c.createCipheriv,i.Decipher=c.Decipher,i.createDecipher=c.createDecipher,i.Decipheriv=c.Decipheriv,i.createDecipheriv=c.createDecipheriv,i.getCiphers=c.getCiphers,i.listCiphers=c.listCiphers;var u=m("diffie-hellman");i.DiffieHellmanGroup=u.DiffieHellmanGroup,i.createDiffieHellmanGroup=u.createDiffieHellmanGroup,i.getDiffieHellman=u.getDiffieHellman,i.createDiffieHellman=u.createDiffieHellman,i.DiffieHellman=u.DiffieHellman;var s=m("browserify-sign");i.createSign=s.createSign,i.Sign=s.Sign,i.createVerify=s.createVerify,i.Verify=s.Verify,i.createECDH=m("create-ecdh");var t=m("public-encrypt");i.publicEncrypt=t.publicEncrypt,i.privateEncrypt=t.privateEncrypt,i.publicDecrypt=t.publicDecrypt,i.privateDecrypt=t.privateDecrypt;var o=m("randomfill");i.randomFill=o.randomFill,i.randomFillSync=o.randomFillSync,i.createCredentials=function(){throw new Error("sorry, createCredentials is not implemented yet\nwe accept pull requests\nhttps://github.com/crypto-browserify/crypto-browserify")},i.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},{"browserify-cipher":59,"browserify-sign":66,"browserify-sign/algos":63,"create-ecdh":97,"create-hash":99,"create-hmac":101,"diffie-hellman":113,pbkdf2:198,"public-encrypt":206,randombytes:221,randomfill:222}],105:[function(m,B,i){(function(g){(function(){i.formatArgs=function(n){if(n[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+n[0]+(this.useColors?"%c ":" ")+"+"+B.exports.humanize(this.diff),!this.useColors)return;const c="color: "+this.color;n.splice(1,0,c,"color: inherit");let u=0,s=0;n[0].replace(/%[a-zA-Z%]/g,t=>{"%%"===t||(u++,"%c"===t&&(s=u))}),n.splice(s,0,c)},i.save=function(n){try{n?i.storage.setItem("debug",n):i.storage.removeItem("debug")}catch{}},i.load=function f(){let n;try{n=i.storage.getItem("debug")}catch{}return!n&&typeof g<"u"&&"env"in g&&(n=g.env.DEBUG),n},i.useColors=function(){return!(!(typeof window<"u"&&window.process)||"renderer"!==window.process.type&&!window.process.__nwjs)||!(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},i.storage=function(){try{return localStorage}catch{}}(),i.destroy=(()=>{let n=!1;return()=>{n||(n=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),i.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],i.log=console.debug||console.log||(()=>{}),B.exports=m("./common")(i);const{formatters:x}=B.exports;x.j=function(n){try{return JSON.stringify(n)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}).call(this)}).call(this,m("_process"))},{"./common":106,_process:205}],106:[function(m,B){B.exports=function(i){function g(n){function c(...r){if(!c.enabled)return;const d=c,h=+new Date;d.diff=h-(s||h),d.prev=s,d.curr=h,s=h,r[0]=g.coerce(r[0]),"string"!=typeof r[0]&&r.unshift("%O");let p=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,(b,I)=>{if("%%"===b)return"%";p++;const S=g.formatters[I];return"function"==typeof S&&(b=S.call(d,r[p]),r.splice(p,1),p--),b}),g.formatArgs.call(d,r),(d.log||g.log).apply(d,r)}let s,t,o,u=null;return c.namespace=n,c.useColors=g.useColors(),c.color=g.selectColor(n),c.extend=f,c.destroy=g.destroy,Object.defineProperty(c,"enabled",{enumerable:!0,configurable:!1,get:()=>null===u?(t!==g.namespaces&&(t=g.namespaces,o=g.enabled(n)),o):u,set:r=>{u=r}}),"function"==typeof g.init&&g.init(c),c}function f(n,c){const u=g(this.namespace+(typeof c>"u"?":":c)+n);return u.log=this.log,u}function x(n){return n.toString().substring(2,n.toString().length-2).replace(/\.\*\?$/,"*")}return g.debug=g,g.default=g,g.coerce=function(n){return n instanceof Error?n.stack||n.message:n},g.disable=function(){const n=[...g.names.map(x),...g.skips.map(x).map(c=>"-"+c)].join(",");return g.enable(""),n},g.enable=function(n){let c;g.save(n),g.namespaces=n,g.names=[],g.skips=[];const u=("string"==typeof n?n:"").split(/[\s,]+/),s=u.length;for(c=0;c{g[n]=i[n]}),g.names=[],g.skips=[],g.formatters={},g.selectColor=function(n){let c=0;for(let u=0;u>>1]),r=n.r28shl(r,h),n.pc2(o,r,s.keys,d)},g.prototype._update=function(s,t,o,r){var d=this._desState,h=n.readUInt32BE(s,t),l=n.readUInt32BE(s,t+4);n.ip(h,l,d.tmp,0),h=d.tmp[0],l=d.tmp[1],"encrypt"===this.type?this._encrypt(d,h,l,d.tmp,0):this._decrypt(d,h,l,d.tmp,0),l=d.tmp[1],n.writeUInt32BE(o,h=d.tmp[0],r),n.writeUInt32BE(o,l,r+4)},g.prototype._pad=function(s,t){for(var o=s.length-t,r=t;r>>0,h=R}n.rip(l,h,r,d)},g.prototype._decrypt=function(s,t,o,r,d){for(var h=o,l=t,p=s.keys.length-2;0<=p;p-=2){var w=s.keys[p],b=s.keys[p+1];n.expand(h,s.tmp,0);var I=n.substitute(w^=s.tmp[0],b^=s.tmp[1]),R=h;h=(l^n.permute(I))>>>0,l=R}n.rip(h,l,r,d)}},{"./cipher":109,"./utils":112,inherits:159,"minimalistic-assert":180}],111:[function(m,B){"use strict";function i(u,s){f.equal(s.length,24,"Invalid key length");var t=s.slice(0,8),o=s.slice(8,16),r=s.slice(16,24);this.ciphers="encrypt"===u?[c.create({type:"encrypt",key:t}),c.create({type:"decrypt",key:o}),c.create({type:"encrypt",key:r})]:[c.create({type:"decrypt",key:r}),c.create({type:"encrypt",key:o}),c.create({type:"decrypt",key:t})]}function g(u){n.call(this,u);var s=new i(this.type,this.options.key);this._edeState=s}var f=m("minimalistic-assert"),x=m("inherits"),n=m("./cipher"),c=m("./des");x(g,n),B.exports=g,g.create=function(u){return new g(u)},g.prototype._update=function(u,s,t,o){var r=this._edeState;r.ciphers[0]._update(u,s,t,o),r.ciphers[1]._update(t,o,t,o),r.ciphers[2]._update(t,o,t,o)},g.prototype._pad=c.prototype._pad,g.prototype._unpad=c.prototype._unpad},{"./cipher":109,"./des":110,inherits:159,"minimalistic-assert":180}],112:[function(m,B,i){"use strict";i.readUInt32BE=function(n,c){return(n[0+c]<<24|n[1+c]<<16|n[2+c]<<8|n[3+c])>>>0},i.writeUInt32BE=function(n,c,u){n[0+u]=c>>>24,n[1+u]=255&c>>>16,n[2+u]=255&c>>>8,n[3+u]=255&c},i.ip=function(n,c,u,s){for(var t=0,o=0,r=6;0<=r;r-=2){for(var d=0;24>=d;d+=8)t<<=1,t|=1&c>>>d+r;for(d=0;24>=d;d+=8)t<<=1,t|=1&n>>>d+r}for(r=6;0<=r;r-=2){for(d=1;25>=d;d+=8)o<<=1,o|=1&c>>>d+r;for(d=1;25>=d;d+=8)o<<=1,o|=1&n>>>d+r}u[s+0]=t>>>0,u[s+1]=o>>>0},i.rip=function(n,c,u,s){for(var t=0,o=0,r=0;4>r;r++)for(var d=24;0<=d;d-=8)t<<=1,t|=1&c>>>d+r,t<<=1,t|=1&n>>>d+r;for(r=4;8>r;r++)for(d=24;0<=d;d-=8)o<<=1,o|=1&c>>>d+r,o<<=1,o|=1&n>>>d+r;u[s+0]=t>>>0,u[s+1]=o>>>0},i.pc1=function(n,c,u,s){for(var t=0,o=0,r=7;5<=r;r--){for(var d=0;24>=d;d+=8)t<<=1,t|=1&c>>d+r;for(d=0;24>=d;d+=8)t<<=1,t|=1&n>>d+r}for(d=0;24>=d;d+=8)t<<=1,t|=1&c>>d+r;for(r=1;3>=r;r++){for(d=0;24>=d;d+=8)o<<=1,o|=1&c>>d+r;for(d=0;24>=d;d+=8)o<<=1,o|=1&n>>d+r}for(d=0;24>=d;d+=8)o<<=1,o|=1&n>>d+r;u[s+0]=t>>>0,u[s+1]=o>>>0},i.r28shl=function(n,c){return 268435455&n<>>28-c};var g=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];i.pc2=function(n,c,u,s){for(var t=0,o=0,r=g.length>>>1,d=0;d>>g[d];for(d=r;d>>g[d];u[s+0]=t>>>0,u[s+1]=o>>>0},i.expand=function(n,c,u){var s=0,t=0;s=(1&n)<<5|n>>>27;for(var o=23;15<=o;o-=4)s<<=6,s|=63&n>>>o;for(o=11;3<=o;o-=4)t|=63&n>>>o,t<<=6;t|=(31&n)<<1|n>>>31,c[u+0]=s>>>0,c[u+1]=t>>>0};var f=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];i.substitute=function(n,c){for(var u=0,s=0;4>s;s++)u<<=4,u|=f[64*s+(63&n>>>18-6*s)];for(s=0;4>s;s++)u<<=4,u|=f[256+64*s+(63&c>>>18-6*s)];return u>>>0};var x=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];i.permute=function(n){for(var c=0,u=0;u>>x[u];return c>>>0},i.padSplit=function(n,c,u){for(var s=n.toString(2);s.lengthwe;we+=2){ke=ve(q(we));for(var A=0;Aq)return new c(2===Z||5===Z?[140,123]:[140,39]);Z=new c(Z);for(var le,we;;){for(le=new c(n(ve(q/8)));le.bitLength()>q;)le.ishrn(1);if(le.isEven()&&le.iadd(o),le.testn(1)||le.iadd(r),Z.cmp(r)){if(!Z.cmp(d))for(;le.mod(p).cmp(w);)le.iadd(S)}else for(;le.mod(u).cmp(I);)le.iadd(S);if(g(we=le.shrn(1))&&g(le)&&f(we)&&f(le)&&t.test(we)&&t.test(le))return le}}var n=m("randombytes");B.exports=x,x.simpleSieve=g,x.fermatTest=f;var c=m("bn.js"),u=new c(24),t=new(m("miller-rabin")),o=new c(1),r=new c(2),d=new c(5),p=(new c(16),new c(8),new c(10)),w=new c(3),I=(new c(7),new c(11)),S=new c(4),N=(new c(12),null)},{"bn.js":117,"miller-rabin":174,randombytes:221}],116:[function(m,B){B.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],117:[function(m,B,i){arguments[4][22][0].apply(i,arguments)},{buffer:41,dup:22}],118:[function(m,B,i){"use strict";var g=i;g.version=m("../package.json").version,g.utils=m("./elliptic/utils"),g.rand=m("brorand"),g.curve=m("./elliptic/curve"),g.curves=m("./elliptic/curves"),g.ec=m("./elliptic/ec"),g.eddsa=m("./elliptic/eddsa")},{"../package.json":134,"./elliptic/curve":121,"./elliptic/curves":124,"./elliptic/ec":125,"./elliptic/eddsa":128,"./elliptic/utils":132,brorand:40}],119:[function(m,B){"use strict";function i(s,t){this.type=s,this.p=new f(t.p,16),this.red=t.prime?f.red(t.prime):f.mont(this.p),this.zero=new f(0).toRed(this.red),this.one=new f(1).toRed(this.red),this.two=new f(2).toRed(this.red),this.n=t.n&&new f(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n?this.n.bitLength():0;var o=this.n&&this.p.div(this.n);!o||0=l;w--)p=(p<<1)+r[w];h.push(p)}for(var b=this.jpoint(null,null,null),I=this.jpoint(null,null,null),S=d;0p)break;var b=h[p];u(0!==b),l="affine"===s.type?l.mixedAdd(0>1]:d[-b-1>>1].neg()):l.add(0>1]:d[-b-1>>1].neg())}return"affine"===s.type?l.toP():l},i.prototype._wnafMulAdd=function(s,t,o,r,d){var b,I,S,h=this._wnafT1,l=this._wnafT2,p=this._wnafT3,w=0;for(b=0;bb)break;for(I=0;I>1]:0>M&&(S=l[I][-M-1>>1].neg()),L="affine"===S.type?L.mixedAdd(S):L.add(S))}}for(b=0;b=ve((s.bitLength()+1)/t.step)},g.prototype._getDoubles=function(s,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var o=[this],r=this,d=0;d":""},g.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},g.prototype._extDbl=function(){var s=this.x.redSqr(),t=this.y.redSqr(),o=this.z.redSqr();o=o.redIAdd(o);var r=this.curve._mulA(s),d=this.x.redAdd(this.y).redSqr().redISub(s).redISub(t),h=r.redAdd(t),l=h.redSub(o),p=r.redSub(t),w=d.redMul(l),b=h.redMul(p),I=d.redMul(p),S=l.redMul(h);return this.curve.point(w,b,S,I)},g.prototype._projDbl=function(){var r,d,h,l,p,w,s=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var b=(l=this.curve._mulA(t)).redAdd(o);this.zOne?(r=s.redSub(t).redSub(o).redMul(b.redSub(this.curve.two)),d=b.redMul(l.redSub(o)),h=b.redSqr().redSub(b).redSub(b)):(p=this.z.redSqr(),w=b.redSub(p).redISub(p),r=s.redSub(t).redISub(o).redMul(w),d=b.redMul(l.redSub(o)),h=b.redMul(w))}else l=t.redAdd(o),p=this.curve._mulC(this.z).redSqr(),w=l.redSub(p).redSub(p),r=this.curve._mulC(s.redISub(l)).redMul(w),d=this.curve._mulC(l).redMul(t.redISub(o)),h=l.redMul(w);return this.curve.point(r,d,h)},g.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},g.prototype._extAdd=function(s){var t=this.y.redSub(this.x).redMul(s.y.redSub(s.x)),o=this.y.redAdd(this.x).redMul(s.y.redAdd(s.x)),r=this.t.redMul(this.curve.dd).redMul(s.t),d=this.z.redMul(s.z.redAdd(s.z)),h=o.redSub(t),l=d.redSub(r),p=d.redAdd(r),w=o.redAdd(t),b=h.redMul(l),I=p.redMul(w),S=h.redMul(w),R=l.redMul(p);return this.curve.point(b,I,R,S)},g.prototype._projAdd=function(s){var I,S,t=this.z.redMul(s.z),o=t.redSqr(),r=this.x.redMul(s.x),d=this.y.redMul(s.y),h=this.curve.d.redMul(r).redMul(d),l=o.redSub(h),p=o.redAdd(h),w=this.x.redAdd(this.y).redMul(s.x.redAdd(s.y)).redISub(r).redISub(d),b=t.redMul(l).redMul(w);return this.curve.twisted?(I=t.redMul(p).redMul(d.redSub(this.curve._mulA(r))),S=l.redMul(p)):(I=t.redMul(p).redMul(d.redSub(r)),S=this.curve._mulC(l).redMul(p)),this.curve.point(b,I,S)},g.prototype.add=function(s){return this.isInfinity()?s:s.isInfinity()?this:this.curve.extended?this._extAdd(s):this._projAdd(s)},g.prototype.mul=function(s){return this._hasDoubles(s)?this.curve._fixedNafMul(this,s):this.curve._wnafMul(this,s)},g.prototype.mulAdd=function(s,t,o){return this.curve._wnafMulAdd(1,[this,t],[s,o],2,!1)},g.prototype.jmulAdd=function(s,t,o){return this.curve._wnafMulAdd(1,[this,t],[s,o],2,!0)},g.prototype.normalize=function(){if(this.zOne)return this;var s=this.z.redInvm();return this.x=this.x.redMul(s),this.y=this.y.redMul(s),this.t&&(this.t=this.t.redMul(s)),this.z=this.curve.one,this.zOne=!0,this},g.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},g.prototype.getX=function(){return this.normalize(),this.x.fromRed()},g.prototype.getY=function(){return this.normalize(),this.y.fromRed()},g.prototype.eq=function(s){return this===s||0===this.getX().cmp(s.getX())&&0===this.getY().cmp(s.getY())},g.prototype.eqXToP=function(s){var t=s.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var o=s.clone(),r=this.curve.redN.redMul(this.z);;){if(o.iadd(this.curve.n),0<=o.cmp(this.curve.p))return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}},g.prototype.toP=g.prototype.normalize,g.prototype.mixedAdd=g.prototype.add},{"../utils":132,"./base":119,"bn.js":133,inherits:159}],121:[function(m,B,i){"use strict";var g=i;g.base=m("./base"),g.short=m("./short"),g.mont=m("./mont"),g.edwards=m("./edwards")},{"./base":119,"./edwards":120,"./mont":122,"./short":123}],122:[function(m,B){"use strict";function i(u){n.call(this,"mont",u),this.a=new f(u.a,16).toRed(this.red),this.b=new f(u.b,16).toRed(this.red),this.i4=new f(4).toRed(this.red).redInvm(),this.two=new f(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function g(u,s,t){n.BasePoint.call(this,u,"projective"),null===s&&null===t?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new f(s,16),this.z=new f(t,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),!this.z.red&&(this.z=this.z.toRed(this.curve.red)))}var f=m("bn.js"),x=m("inherits"),n=m("./base"),c=m("../utils");x(i,n),B.exports=i,i.prototype.validate=function(u){var s=u.normalize().x,t=s.redSqr(),o=t.redMul(s).redAdd(t.redMul(this.a)).redAdd(s);return 0===o.redSqrt().redSqr().cmp(o)},x(g,n.BasePoint),i.prototype.decodePoint=function(u,s){return this.point(c.toArray(u,s),1)},i.prototype.point=function(u,s){return new g(this,u,s)},i.prototype.pointFromJSON=function(u){return g.fromJSON(this,u)},g.prototype.precompute=function(){},g.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},g.fromJSON=function(u,s){return new g(u,s[0],s[1]||u.one)},g.prototype.inspect=function(){return this.isInfinity()?"":""},g.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},g.prototype.dbl=function(){var s=this.x.redAdd(this.z).redSqr(),o=this.x.redSub(this.z).redSqr(),r=s.redSub(o),d=s.redMul(o),h=r.redMul(o.redAdd(this.curve.a24.redMul(r)));return this.curve.point(d,h)},g.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},g.prototype.diffAdd=function(u,s){var t=this.x.redAdd(this.z),o=this.x.redSub(this.z),r=u.x.redAdd(u.z),h=u.x.redSub(u.z).redMul(t),l=r.redMul(o),p=s.z.redMul(h.redAdd(l).redSqr()),w=s.x.redMul(h.redISub(l).redSqr());return this.curve.point(p,w)},g.prototype.mul=function(u){for(var s=u.clone(),t=this,o=this.curve.point(null,null),d=[];0!==s.cmpn(0);s.iushrn(1))d.push(s.andln(1));for(var h=d.length-1;0<=h;h--)0===d[h]?(t=t.diffAdd(o,this),o=o.dbl()):(o=t.diffAdd(o,this),t=t.dbl());return o},g.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},g.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},g.prototype.eq=function(u){return 0===this.getX().cmp(u.getX())},g.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},g.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../utils":132,"./base":119,"bn.js":133,inherits:159}],123:[function(m,B){"use strict";function i(t){u.call(this,"short",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}function g(t,o,r,d){u.BasePoint.call(this,t,"affine"),null===o&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new n(o,16),this.y=new n(r,16),d&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),!this.y.red&&(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function f(t,o,r,d){u.BasePoint.call(this,t,"jacobian"),null===o&&null===r&&null===d?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n(0)):(this.x=new n(o,16),this.y=new n(r,16),this.z=new n(d,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var x=m("../utils"),n=m("bn.js"),c=m("inherits"),u=m("./base"),s=x.assert;c(i,u),B.exports=i,i.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var o,r;if(t.beta)o=new n(t.beta,16).toRed(this.red);else{var d=this._getEndoRoots(this.p);o=(o=0>d[0].cmp(d[1])?d[0]:d[1]).toRed(this.red)}if(t.lambda)r=new n(t.lambda,16);else{var h=this._getEndoRoots(this.n);0===this.g.mul(h[0]).x.cmp(this.g.x.redMul(o))?r=h[0]:s(0===this.g.mul(r=h[1]).x.cmp(this.g.x.redMul(o)))}return{beta:o,lambda:r,basis:t.basis?t.basis.map(function(p){return{a:new n(p.a,16),b:new n(p.b,16)}}):this._getEndoBasis(r)}}},i.prototype._getEndoRoots=function(t){var o=t===this.p?this.red:n.mont(t),r=new n(2).toRed(o).redInvm(),d=r.redNeg(),h=new n(3).toRed(o).redNeg().redSqrt().redMul(r);return[d.redAdd(h).fromRed(),d.redSub(h).fromRed()]},i.prototype._getEndoBasis=function(t){for(var I,S,R,N,q,Z,le,we,ke,A,o=this.n.ushrn(wt(this.n.bitLength()/2)),r=t,d=this.n.clone(),h=new n(1),l=new n(0),p=new n(0),w=new n(1),b=0;0!==r.cmpn(0);){A=d.div(r),we=d.sub(A.mul(r)),ke=p.sub(A.mul(h));var L=w.sub(A.mul(l));if(!R&&0>we.cmp(o))I=le.neg(),S=h,R=we.neg(),N=ke;else if(R&&2==++b)break;le=we,d=r,r=we,p=h,h=ke,w=l,l=L}q=we.neg(),Z=ke;var z=R.sqr().add(N.sqr());return 0<=q.sqr().add(Z.sqr()).cmp(z)&&(q=I,Z=S),R.negative&&(R=R.neg(),N=N.neg()),q.negative&&(q=q.neg(),Z=Z.neg()),[{a:R,b:N},{a:q,b:Z}]},i.prototype._endoSplit=function(t){var o=this.endo.basis,r=o[0],d=o[1],h=d.b.mul(t).divRound(this.n),l=r.b.neg().mul(t).divRound(this.n),p=h.mul(r.a),w=l.mul(d.a),b=h.mul(r.b),I=l.mul(d.b);return{k1:t.sub(p).sub(w),k2:b.add(I).neg()}},i.prototype.pointFromX=function(t,o){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),d=r.redSqrt();if(0!==d.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var h=d.fromRed().isOdd();return(o&&!h||!o&&h)&&(d=d.redNeg()),this.point(t,d)},i.prototype.validate=function(t){if(t.inf)return!0;var o=t.x,r=t.y,d=this.a.redMul(o),h=o.redSqr().redMul(o).redIAdd(d).redIAdd(this.b);return 0===r.redSqr().redISub(h).cmpn(0)},i.prototype._endoWnafMulAdd=function(t,o,r){for(var d=this._endoWnafT1,h=this._endoWnafT2,l=0;l":""},g.prototype.isInfinity=function(){return this.inf},g.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var o=this.y.redSub(t.y);0!==o.cmpn(0)&&(o=o.redMul(this.x.redSub(t.x).redInvm()));var r=o.redSqr().redISub(this.x).redISub(t.x),d=o.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,d)},g.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var o=this.curve.a,r=this.x.redSqr(),d=t.redInvm(),h=r.redAdd(r).redIAdd(r).redIAdd(o).redMul(d),l=h.redSqr().redISub(this.x.redAdd(this.x)),p=h.redMul(this.x.redSub(l)).redISub(this.y);return this.curve.point(l,p)},g.prototype.getX=function(){return this.x.fromRed()},g.prototype.getY=function(){return this.y.fromRed()},g.prototype.mul=function(t){return t=new n(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},g.prototype.mulAdd=function(t,o,r){var d=[this,o],h=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(d,h):this.curve._wnafMulAdd(1,d,h,2)},g.prototype.jmulAdd=function(t,o,r){var d=[this,o],h=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(d,h,!0):this.curve._wnafMulAdd(1,d,h,2,!0)},g.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},g.prototype.neg=function(t){if(this.inf)return this;var o=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,d=function(h){return h.neg()};o.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(d)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(d)}}}return o},g.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},c(f,u.BasePoint),i.prototype.jpoint=function(t,o,r){return new f(this,t,o,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),o=t.redSqr(),r=this.x.redMul(o),d=this.y.redMul(o).redMul(t);return this.curve.point(r,d)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var o=t.z.redSqr(),r=this.z.redSqr(),d=this.x.redMul(o),h=t.x.redMul(r),l=this.y.redMul(o.redMul(t.z)),p=t.y.redMul(r.redMul(this.z)),w=d.redSub(h),b=l.redSub(p);if(0===w.cmpn(0))return 0===b.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var I=w.redSqr(),S=I.redMul(w),R=d.redMul(I),N=b.redSqr().redIAdd(S).redISub(R).redISub(R),q=b.redMul(R.redISub(N)).redISub(l.redMul(S)),Z=this.z.redMul(t.z).redMul(w);return this.curve.jpoint(N,q,Z)},f.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var o=this.z.redSqr(),r=this.x,d=t.x.redMul(o),h=this.y,l=t.y.redMul(o).redMul(this.z),p=r.redSub(d),w=h.redSub(l);if(0===p.cmpn(0))return 0===w.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var b=p.redSqr(),I=b.redMul(p),S=r.redMul(b),R=w.redSqr().redIAdd(I).redISub(S).redISub(S),N=w.redMul(S.redISub(R)).redISub(h.redMul(I)),q=this.z.redMul(p);return this.curve.jpoint(R,N,q)},f.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var o;if(this.curve.zeroA||this.curve.threeA){var r=this;for(o=0;o":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../utils":132,"./base":119,"bn.js":133,inherits:159}],124:[function(m,B,i){"use strict";function g(o){this.curve="short"===o.type?new c.short(o):"edwards"===o.type?new c.edwards(o):new c.mont(o),this.g=this.curve.g,this.n=this.curve.n,this.hash=o.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function f(o,r){Object.defineProperty(x,o,{configurable:!0,enumerable:!0,get:function(){var d=new g(r);return Object.defineProperty(x,o,{configurable:!0,enumerable:!0,value:d}),d}})}var t,x=i,n=m("hash.js"),c=m("./curve"),s=m("./utils").assert;x.PresetCurve=g,f("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:n.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),f("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:n.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),f("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:n.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),f("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:n.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),f("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:n.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),f("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["9"]}),f("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{t=m("./precomputed/secp256k1")}catch{t=void 0}f("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:n.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",t]})},{"./curve":121,"./precomputed/secp256k1":131,"./utils":132,"hash.js":143}],125:[function(m,B){"use strict";function i(o){return this instanceof i?("string"==typeof o&&(u(Object.prototype.hasOwnProperty.call(n,o),"Unknown curve "+o),o=n[o]),o instanceof n.PresetCurve&&(o={curve:o}),this.curve=o.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=o.curve.g,this.g.precompute(o.curve.n.bitLength()+1),void(this.hash=o.hash||o.curve.hash)):new i(o)}var g=m("bn.js"),f=m("hmac-drbg"),x=m("../utils"),n=m("../curves"),c=m("brorand"),u=x.assert,s=m("./key"),t=m("./signature");B.exports=i,i.prototype.keyPair=function(o){return new s(this,o)},i.prototype.keyFromPrivate=function(o,r){return s.fromPrivate(this,o,r)},i.prototype.keyFromPublic=function(o,r){return s.fromPublic(this,o,r)},i.prototype.genKeyPair=function(o){o||(o={});for(var r=new f({hash:this.hash,pers:o.pers,persEnc:o.persEnc||"utf8",entropy:o.entropy||c(this.hash.hmacStrength),entropyEnc:o.entropy&&o.entropyEnc||"utf8",nonce:this.n.toArray()}),d=this.n.byteLength(),h=this.n.sub(new g(2));;){var l=new g(r.generate(d));if(!(0=(R=this._truncateToN(R,!0)).cmpn(1)||0<=R.cmp(I))){var N=this.g.mul(R);if(!N.isInfinity()){var q=N.getX(),Z=q.umod(this.n);if(0!==Z.cmpn(0)){var le=R.invm(this.n).mul(Z.mul(r.getPrivate()).iadd(o));if(0!==(le=le.umod(this.n)).cmpn(0)){var we=(N.getY().isOdd()?1:0)|(0===q.cmp(Z)?0:2);return h.canonical&&0l.cmpn(1)||0<=l.cmp(this.n)||0>p.cmpn(1)||0<=p.cmp(this.n))return!1;var S,w=p.invm(this.n),b=w.mul(o).umod(this.n),I=w.mul(l).umod(this.n);return this.curve._maxwellTrick?!(S=this.g.jmulAdd(b,d.getPublic(),I)).isInfinity()&&S.eqXToP(l):!(S=this.g.mulAdd(b,d.getPublic(),I)).isInfinity()&&0===S.getX().umod(this.n).cmp(l)},i.prototype.recoverPubKey=function(o,r,d,h){u((3&d)===d,"The recovery param is more than two bits"),r=new t(r,h);var l=this.n,p=new g(o),w=r.r,b=r.s,I=1&d,S=d>>1;if(0<=w.cmp(this.curve.p.umod(this.curve.n))&&S)throw new Error("Unable to find sencond key candinate");w=this.curve.pointFromX(S?w.add(this.curve.n):w,I);var R=r.r.invm(l),N=l.sub(p).mul(R).umod(l),q=b.mul(R).umod(l);return this.g.mulAdd(N,w,q)},i.prototype.getKeyRecoveryParam=function(o,r,d,h){if(null!==(r=new t(r,h)).recoveryParam)return r.recoveryParam;for(var l=0;4>l;l++){var p;try{p=this.recoverPubKey(o,r,l)}catch{continue}if(p.eq(d))return l}throw new Error("Unable to find valid recovery factor")}},{"../curves":124,"../utils":132,"./key":126,"./signature":127,"bn.js":133,brorand:40,"hmac-drbg":155}],126:[function(m,B){"use strict";function i(n,c){this.ec=n,this.priv=null,this.pub=null,c.priv&&this._importPrivate(c.priv,c.privEnc),c.pub&&this._importPublic(c.pub,c.pubEnc)}var g=m("bn.js"),x=m("../utils").assert;B.exports=i,i.fromPublic=function(n,c,u){return c instanceof i?c:new i(n,{pub:c,pubEnc:u})},i.fromPrivate=function(n,c,u){return c instanceof i?c:new i(n,{priv:c,privEnc:u})},i.prototype.validate=function(){var n=this.getPublic();return n.isInfinity()?{result:!1,reason:"Invalid public key"}:n.validate()?n.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},i.prototype.getPublic=function(n,c){return"string"==typeof n&&(c=n,n=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),c?this.pub.encode(c,n):this.pub},i.prototype.getPrivate=function(n){return"hex"===n?this.priv.toString(16,2):this.priv},i.prototype._importPrivate=function(n,c){this.priv=new g(n,c||16),this.priv=this.priv.umod(this.ec.curve.n)},i.prototype._importPublic=function(n,c){return n.x||n.y?("mont"===this.ec.curve.type?x(n.x,"Need x coordinate"):("short"===this.ec.curve.type||"edwards"===this.ec.curve.type)&&x(n.x&&n.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(n.x,n.y))):void(this.pub=this.ec.curve.decodePoint(n,c))},i.prototype.derive=function(n){return n.validate()||x(n.validate(),"public point not validated"),n.mul(this.priv).getX()},i.prototype.sign=function(n,c,u){return this.ec.sign(n,this,c,u)},i.prototype.verify=function(n,c){return this.ec.verify(n,c,this)},i.prototype.inspect=function(){return""}},{"../utils":132,"bn.js":133}],127:[function(m,B){"use strict";function i(t,o){return t instanceof i?t:void(this._importDER(t,o)||(s(t.r&&t.s,"Signature without r or s"),this.r=new c(t.r,16),this.s=new c(t.s,16),this.recoveryParam=void 0===t.recoveryParam?null:t.recoveryParam))}function g(){this.place=0}function f(t,o){var r=t[o.place++];if(!(128&r))return r;var d=15&r;if(0==d||4>>=0;return!(127>=h)&&(o.place=p,h)}function x(t){for(var o=0,r=t.length-1;!t[o]&&!(128&t[o+1])&&oo)t.push(o);else{var r=1+(yn(o)/Kt>>>3);for(t.push(128|r);--r;)t.push(255&o>>>(r<<3));t.push(o)}}var c=m("bn.js"),u=m("../utils"),s=u.assert;B.exports=i,i.prototype._importDER=function(t,o){t=u.toArray(t,o);var r=new g;if(48!==t[r.place++])return!1;var d=f(t,r);if(!1===d||d+r.place!==t.length||2!==t[r.place++])return!1;var h=f(t,r);if(!1===h)return!1;var l=t.slice(r.place,h+r.place);if(r.place+=h,2!==t[r.place++])return!1;var p=f(t,r);if(!1===p||t.length!==p+r.place)return!1;var w=t.slice(r.place,p+r.place);if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}if(0===w[0]){if(!(128&w[1]))return!1;w=w.slice(1)}return this.r=new c(l),this.s=new c(w),this.recoveryParam=null,!0},i.prototype.toDER=function(t){var o=this.r.toArray(),r=this.s.toArray();for(128&o[0]&&(o=[0].concat(o)),128&r[0]&&(r=[0].concat(r)),o=x(o),r=x(r);!(r[0]||128&r[1]);)r=r.slice(1);var d=[2];n(d,o.length),(d=d.concat(o)).push(2),n(d,r.length);var h=d.concat(r),l=[48];return n(l,h.length),l=l.concat(h),u.encode(l,t)}},{"../utils":132,"bn.js":133}],128:[function(m,B){"use strict";function i(t){return n("ed25519"===t,"only tested with ed25519 so far"),this instanceof i?(this.curve=t=f[t].curve,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=ve(t.n.bitLength()/8),void(this.hash=g.sha512)):new i(t)}var g=m("hash.js"),f=m("../curves"),x=m("../utils"),n=x.assert,c=x.parseBytes,u=m("./key"),s=m("./signature");B.exports=i,i.prototype.sign=function(t,o){t=c(t);var r=this.keyFromSecret(o),d=this.hashInt(r.messagePrefix(),t),h=this.g.mul(d),l=this.encodePoint(h),p=this.hashInt(l,r.pubBytes(),t).mul(r.priv()),w=d.add(p).umod(this.curve.n);return this.makeSignature({R:h,S:w,Rencoded:l})},i.prototype.verify=function(t,o,r){t=c(t),o=this.makeSignature(o);var d=this.keyFromPublic(r),h=this.hashInt(o.Rencoded(),d.pubBytes(),t),l=this.g.mul(o.S());return o.R().add(d.pub().mul(h)).eq(l)},i.prototype.hashInt=function(){for(var t=this.hash(),o=0;o(o>>1)-1?(o>>1)-h:h):l=0,t[d]=l,r.iushrn(1)}return t},g.getJSF=function(c,u){var s=[[],[]];c=c.clone(),u=u.clone();for(var r,t=0,o=0;0{this.push(g(n.result))},n.onerror=()=>{this.emit("error",n.error)},this.reader=n,this._generateHeaderBlocks(f,x,(c,u)=>c?this.emit("error",c):(Array.isArray(u)&&u.forEach(s=>this.push(s)),this._ready=!0,void this.emit("_ready")))}_generateHeaderBlocks(f,x,n){n(null,[])}_read(){if(!this._ready)return void this.once("_ready",this._read.bind(this));const f=this._offset;let x=this._offset+this._chunkSize;return x>this._size&&(x=this._size),f===this._size?(this.destroy(),void this.push(null)):(this.reader.readAsArrayBuffer(this._file.slice(f,x)),void(this._offset=x))}destroy(){if(this._file=null,this.reader){this.reader.onload=null,this.reader.onerror=null;try{this.reader.abort()}catch{}}this.reader=null}}},{"readable-stream":240,"typedarray-to-buffer":282}],141:[function(m,B){B.exports=function(){if(typeof globalThis>"u")return null;var i={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return i.RTCPeerConnection?i:null}},{}],142:[function(m,B){"use strict";function g(c){x.call(this),this._block=f.allocUnsafe(c),this._blockSize=c,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}var f=m("safe-buffer").Buffer,x=m("readable-stream").Transform;m("inherits")(g,x),g.prototype._transform=function(c,u,s){var t=null;try{this.update(c,u)}catch(o){t=o}s(t)},g.prototype._flush=function(c){var u=null;try{this.push(this.digest())}catch(s){u=s}c(u)},g.prototype.update=function(c,u){if(function i(c,u){if(!f.isBuffer(c)&&"string"!=typeof c)throw new TypeError(u+" must be a string or a buffer")}(c,"Data"),this._finalized)throw new Error("Digest already called");f.isBuffer(c)||(c=f.from(c,u));for(var s=this._block,t=0;this._blockOffset+c.length-t>=this._blockSize;){for(var o=this._blockOffset;os;++s)this._length[s]=0;return u},g.prototype._digest=function(){throw new Error("_digest is not implemented")},B.exports=g},{inherits:159,"readable-stream":240,"safe-buffer":247}],143:[function(m,B,i){var g=i;g.utils=m("./hash/utils"),g.common=m("./hash/common"),g.sha=m("./hash/sha"),g.ripemd=m("./hash/ripemd"),g.hmac=m("./hash/hmac"),g.sha1=g.sha.sha1,g.sha256=g.sha.sha256,g.sha224=g.sha.sha224,g.sha384=g.sha.sha384,g.sha512=g.sha.sha512,g.ripemd160=g.ripemd.ripemd160},{"./hash/common":144,"./hash/hmac":145,"./hash/ripemd":146,"./hash/sha":147,"./hash/utils":154}],144:[function(m,B,i){"use strict";function g(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var f=m("./utils"),x=m("minimalistic-assert");i.BlockHash=g,g.prototype.update=function(n,c){if(n=f.toArray(n,c),this.pending=this.pending?this.pending.concat(n):n,this.pendingTotal+=n.length,this.pending.length>=this._delta8){var u=(n=this.pending).length%this._delta8;this.pending=n.slice(n.length-u,n.length),0===this.pending.length&&(this.pending=null),n=f.join32(n,0,n.length-u,this.endian);for(var s=0;s>>24,s[t++]=255&n>>>16,s[t++]=255&n>>>8,s[t++]=255&n}else for(s[t++]=255&n,s[t++]=255&n>>>8,s[t++]=255&n>>>16,s[t++]=255&n>>>24,s[t++]=0,s[t++]=0,s[t++]=0,s[t++]=0,o=8;othis.blockSize&&(x=(new this.Hash).update(x).digest()),f(x.length<=this.blockSize);for(var n=x.length;n=b?I^S^R:31>=b?I&S|~I&R:47>=b?(I|~S)^R:63>=b?I&R|S&~R:I^(S|~R)}function x(b){return 15>=b?0:31>=b?1518500249:47>=b?1859775393:63>=b?2400959708:2840853838}function n(b){return 15>=b?1352829926:31>=b?1548603684:47>=b?1836072691:63>=b?2053994217:0}var c=m("./utils"),u=m("./common"),s=c.rotl32,t=c.sum32,o=c.sum32_3,r=c.sum32_4,d=u.BlockHash;c.inherits(g,d),i.ripemd160=g,g.blockSize=512,g.outSize=160,g.hmacStrength=192,g.padLength=64,g.prototype._update=function(b,I){for(var y,S=this.h[0],R=this.h[1],N=this.h[2],q=this.h[3],Z=this.h[4],le=S,we=R,ke=N,A=q,L=Z,z=0;80>z;z++)y=t(s(r(S,f(z,R,N,q),b[h[z]+I],x(z)),p[z]),Z),S=Z,Z=q,q=s(N,10),N=R,R=y,y=t(s(r(le,f(79-z,we,ke,A),b[l[z]+I],n(z)),w[z]),L),le=L,L=A,A=s(ke,10),ke=we,we=y;y=o(this.h[1],N,A),this.h[1]=o(this.h[2],q,L),this.h[2]=o(this.h[3],Z,le),this.h[3]=o(this.h[4],S,we),this.h[4]=o(this.h[0],R,ke),this.h[0]=y},g.prototype._digest=function(b){return"hex"===b?c.toHex32(this.h,"little"):c.split32(this.h,"little")};var h=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],l=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],p=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],w=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},{"./common":144,"./utils":154}],147:[function(m,B,i){"use strict";i.sha1=m("./sha/1"),i.sha224=m("./sha/224"),i.sha256=m("./sha/256"),i.sha384=m("./sha/384"),i.sha512=m("./sha/512")},{"./sha/1":148,"./sha/224":149,"./sha/256":150,"./sha/384":151,"./sha/512":152}],148:[function(m,B){"use strict";function i(){return this instanceof i?(t.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],void(this.W=Array(80))):new i}var g=m("../utils"),f=m("../common"),x=m("./common"),n=g.rotl32,c=g.sum32,u=g.sum32_5,s=x.ft_1,t=f.BlockHash,o=[1518500249,1859775393,2400959708,3395469782];g.inherits(i,t),B.exports=i,i.blockSize=512,i.outSize=160,i.hmacStrength=80,i.padLength=64,i.prototype._update=function(r,d){for(var h=this.W,l=0;16>l;l++)h[l]=r[d+l];for(;lR;R++)S[R]=b[I+R];for(;RJ&&(J+=4294967296),J}function f(y,C,M,U,ee,J){var re=C&U^~C&J;return 0>re&&(re+=4294967296),re}function x(y,C,M,U,ee){var J=y&M^y&ee^Mⅇreturn 0>J&&(J+=4294967296),J}function n(y,C,M,U,ee,J){var re=C&U^C&J^U&J;return 0>re&&(re+=4294967296),re}function c(y,C){var J=b(y,C,28)^b(C,y,2)^b(C,y,7);return 0>J&&(J+=4294967296),J}function u(y,C){var J=I(y,C,28)^I(C,y,2)^I(C,y,7);return 0>J&&(J+=4294967296),J}function s(y,C){var J=b(y,C,14)^b(y,C,18)^b(C,y,9);return 0>J&&(J+=4294967296),J}function t(y,C){var J=I(y,C,14)^I(y,C,18)^I(C,y,9);return 0>J&&(J+=4294967296),J}function o(y,C){var J=b(y,C,1)^b(y,C,8)^S(y,C,7);return 0>J&&(J+=4294967296),J}function r(y,C){var J=I(y,C,1)^I(y,C,8)^R(y,C,7);return 0>J&&(J+=4294967296),J}function d(y,C){var J=b(y,C,19)^b(C,y,29)^S(y,C,6);return 0>J&&(J+=4294967296),J}function h(y,C){var J=I(y,C,19)^I(C,y,29)^R(y,C,6);return 0>J&&(J+=4294967296),J}var l=m("../utils"),p=m("../common"),w=m("minimalistic-assert"),b=l.rotr64_hi,I=l.rotr64_lo,S=l.shr64_hi,R=l.shr64_lo,N=l.sum64,q=l.sum64_hi,Z=l.sum64_lo,le=l.sum64_4_hi,we=l.sum64_4_lo,ke=l.sum64_5_hi,A=l.sum64_5_lo,L=p.BlockHash,z=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];l.inherits(i,L),B.exports=i,i.blockSize=1024,i.outSize=512,i.hmacStrength=192,i.padLength=128,i.prototype._prepareBlock=function(y,C){for(var M=this.W,U=0;32>U;U++)M[U]=y[C+U];for(;U>>3},i.g1_256=function(u){return c(u,17)^c(u,19)^u>>>10}},{"../utils":154}],154:[function(m,B,i){"use strict";function g(s,t){return 55296==(64512&s.charCodeAt(t))&&!(0>t||t+1>=s.length)&&56320==(64512&s.charCodeAt(t+1))}function f(s){return(s>>>24|65280&s>>>8|16711680&s<<8|(255&s)<<24)>>>0}function x(s){return 1===s.length?"0"+s:s}function n(s){return 7===s.length?"0"+s:6===s.length?"00"+s:5===s.length?"000"+s:4===s.length?"0000"+s:3===s.length?"00000"+s:2===s.length?"000000"+s:1===s.length?"0000000"+s:s}var c=m("minimalistic-assert"),u=m("inherits");i.inherits=u,i.toArray=function(s,t){if(Array.isArray(s))return s.slice();if(!s)return[];var o=[];if("string"!=typeof s)for(d=0;d(h=s.charCodeAt(d))?o[r++]=h:2048>h?(o[r++]=192|h>>6,o[r++]=128|63&h):g(s,d)?(h=65536+((1023&h)<<10)+(1023&s.charCodeAt(++d)),o[r++]=240|h>>18,o[r++]=128|63&h>>12,o[r++]=128|63&h>>6,o[r++]=128|63&h):(o[r++]=224|h>>12,o[r++]=128|63&h>>6,o[r++]=128|63&h);return o},i.toHex=function(s){for(var t="",o=0;o>>0;return h},i.split32=function(s,t){for(var h,o=Array(4*s.length),r=0,d=0;r>>24,o[d+1]=255&h>>>16,o[d+2]=255&h>>>8,o[d+3]=255&h):(o[d+3]=h>>>24,o[d+2]=255&h>>>16,o[d+1]=255&h>>>8,o[d]=255&h);return o},i.rotr32=function(s,t){return s>>>t|s<<32-t},i.rotl32=function(s,t){return s<>>32-t},i.sum32=function(s,t){return s+t>>>0},i.sum32_3=function(s,t,o){return s+t+o>>>0},i.sum32_4=function(s,t,o,r){return s+t+o+r>>>0},i.sum32_5=function(s,t,o,r,d){return s+t+o+r+d>>>0},i.sum64=function(s,t,o,r){var l=r+s[t+1]>>>0;s[t]=(l>>0,s[t+1]=l},i.sum64_hi=function(s,t,o,r){return(t+r>>>0>>0},i.sum64_lo=function(s,t,o,r){return t+r>>>0},i.sum64_4_hi=function(s,t,o,r,d,h,l,p){var w=0,b=t;return w+=(b=b+r>>>0)>>0)>>0)>>0},i.sum64_4_lo=function(s,t,o,r,d,h,l,p){return t+r+h+p>>>0},i.sum64_5_hi=function(s,t,o,r,d,h,l,p,w,b){var I=0,S=t;return I+=(S=S+r>>>0)>>0)>>0)>>0)>>0},i.sum64_5_lo=function(s,t,o,r,d,h,l,p,w,b){return t+r+h+p+b>>>0},i.rotr64_hi=function(s,t,o){return(t<<32-o|s>>>o)>>>0},i.rotr64_lo=function(s,t,o){return(s<<32-o|t>>>o)>>>0},i.shr64_hi=function(s,t,o){return s>>>o},i.shr64_lo=function(s,t,o){return(s<<32-o|t>>>o)>>>0}},{inherits:159,"minimalistic-assert":180}],155:[function(m,B){"use strict";function i(n){if(!(this instanceof i))return new i(n);this.hash=n.hash,this.predResist=!!n.predResist,this.outLen=this.hash.outSize,this.minEntropy=n.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var c=f.toArray(n.entropy,n.entropyEnc||"hex"),u=f.toArray(n.nonce,n.nonceEnc||"hex"),s=f.toArray(n.pers,n.persEnc||"hex");x(c.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(c,u,s)}var g=m("hash.js"),f=m("minimalistic-crypto-utils"),x=m("minimalistic-assert");B.exports=i,i.prototype._init=function(n,c,u){var s=n.concat(c).concat(u);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var t=0;t=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(n.concat(u||[])),this._reseed=1},i.prototype.generate=function(n,c,u,s){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof c&&(s=u,u=c,c=null),u&&(u=f.toArray(u,s||"hex"),this._update(u));for(var t=[];t.length>1,o=-7,r=x?c-1:0,d=x?-1:1,h=g[f+r];for(r+=d,l=h&(1<<-o)-1,h>>=-o,o+=u;0>=-o,o+=n;0>1,r=23===c?j(2,-24)-j(2,-77):0,d=n?0:u-1,h=n?1:-1,l=0>f||0===f&&0>1/f?1:0;for(f=At(f),isNaN(f)||f===1/0?(w=isNaN(f)?1:0,p=t):(p=wt(yn(f)/Kt),1>f*(b=j(2,-p))&&(p--,b*=2),2<=(f+=1<=p+o?r/b:r*j(2,1-o))*b&&(p++,b/=2),p+o>=t?(w=0,p=t):1<=p+o?(w=(f*b-1)*j(2,c),p+=o):(w=f*j(2,o-1)*j(2,c),p=0));8<=c;g[x+d]=255&w,d+=h,w/=256,c-=8);for(p=p<{})){this.mem[g]=f,this.store.put(g,f,n=>{this.mem[g]=null,x(n)})}get(g,f,x=(()=>{})){if("function"==typeof f)return this.get(g,null,f);let n=this.mem[g];if(!n)return this.store.get(g,f,x);f||(f={});const c=f.offset||0,u=f.length||n.length-c;(0!==c||u!==n.length)&&(n=n.slice(c,u+c)),i(()=>x(null,n))}close(g=(()=>{})){this.store.close(g)}destroy(g=(()=>{})){this.store.destroy(g)}}},{"queue-microtask":218}],159:[function(m,B){B.exports="function"==typeof Object.create?function(i,g){g&&(i.super_=g,i.prototype=Object.create(g.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}))}:function(i,g){if(g){i.super_=g;var f=function(){};f.prototype=g.prototype,i.prototype=new f,i.prototype.constructor=i}}},{}],160:[function(m,B){B.exports=function(i){for(var g=0,f=i.length;g127)return!1;return!0}},{}],161:[function(m,B){function i(f){return!!f.constructor&&"function"==typeof f.constructor.isBuffer&&f.constructor.isBuffer(f)}B.exports=function(f){return null!=f&&(i(f)||function g(f){return"function"==typeof f.readFloatLE&&"function"==typeof f.slice&&i(f.slice(0,0))}(f)||!!f._isBuffer)}},{}],162:[function(m,B){function i(c){return g(c)||f(c)}function g(c){return c instanceof Int8Array||c instanceof Int16Array||c instanceof Int32Array||c instanceof Uint8Array||c instanceof Uint8ClampedArray||c instanceof Uint16Array||c instanceof Uint32Array||c instanceof Float32Array||c instanceof Float64Array}function f(c){return n[x.call(c)]}B.exports=i,i.strict=g,i.loose=f;var x=Object.prototype.toString,n={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0}},{}],163:[function(m,B,i){"use strict";i.re=()=>{throw new Error("`junk.re` was renamed to `junk.regex`")},i.regex=new RegExp(["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^Desktop\\.ini$","@eaDir$"].join("|")),i.is=g=>i.regex.test(g),i.not=g=>!i.is(g),i.default=B.exports},{}],164:[function(m,B,i){i.RateLimiter=m("./lib/rateLimiter"),i.TokenBucket=m("./lib/tokenBucket")},{"./lib/rateLimiter":166,"./lib/tokenBucket":167}],165:[function(m,B){(function(i){(function(){B.exports=function(){if(typeof i<"u"&&i.hrtime){var g=i.hrtime();return 1e3*g[0]+wt(g[1]/1e6)}return(new Date).getTime()}}).call(this)}).call(this,m("_process"))},{_process:205}],166:[function(m,B){(function(i){(function(){var g=m("./tokenBucket"),f=m("./clock"),x=function(n,c,u){this.tokenBucket=new g(n,n,c,null),this.tokenBucket.content=n,this.curIntervalStart=f(),this.tokensThisInterval=0,this.fireImmediately=u};x.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(n,c){function u(r,d){return r?c(r,null):(s.tokensThisInterval+=n,void c(null,d))}if(n>this.tokenBucket.bucketSize)return i.nextTick(c.bind(null,"Requested tokens "+n+" exceeds maximum tokens per interval "+this.tokenBucket.bucketSize,null)),!1;var s=this,t=f();if((t=this.tokenBucket.interval)&&(this.curIntervalStart=t,this.tokensThisInterval=0),n>this.tokenBucket.tokensPerInterval-this.tokensThisInterval){if(this.fireImmediately)i.nextTick(c.bind(null,null,-1));else{var o=ve(this.curIntervalStart+this.tokenBucket.interval-t);setTimeout(function(){s.tokenBucket.removeTokens(n,u)},o)}return!1}return this.tokenBucket.removeTokens(n,u)},tryRemoveTokens:function(n){if(n>this.tokenBucket.bucketSize)return!1;var c=f();if((c=this.tokenBucket.interval)&&(this.curIntervalStart=c,this.tokensThisInterval=0),n>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var u=this.tokenBucket.tryRemoveTokens(n);return u&&(this.tokensThisInterval+=n),u},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}},B.exports=x}).call(this)}).call(this,m("_process"))},{"./clock":165,"./tokenBucket":167,_process:205}],167:[function(m,B){(function(i){(function(){var g=function(f,x,n,c){if(this.bucketSize=f,this.tokensPerInterval=x,"string"==typeof n)switch(n){case"sec":case"second":this.interval=1e3;break;case"min":case"minute":this.interval=6e4;break;case"hr":case"hour":this.interval=36e5;break;case"day":this.interval=864e5;break;default:throw new Error("Invaid interval "+n)}else this.interval=n;this.parentBucket=c,this.content=0,this.lastDrip=+new Date};g.prototype={bucketSize:1,tokensPerInterval:1,interval:1e3,parentBucket:null,content:0,lastDrip:0,removeTokens:function(f,x){function n(){var u=ve(c.interval/c.tokensPerInterval*(f-c.content));return setTimeout(function(){c.removeTokens(f,x)},u),!1}var c=this;return this.bucketSize?f>this.bucketSize?(i.nextTick(x.bind(null,"Requested tokens "+f+" exceeds bucket size "+this.bucketSize,null)),!1):(this.drip(),f>this.content?n():this.parentBucket?this.parentBucket.removeTokens(f,function(u,s){return u?x(u,null):f>c.content?n():(c.content-=f,void x(null,Y(s,c.content)))}):(this.content-=f,i.nextTick(x.bind(null,null,this.content)),!0)):(i.nextTick(x.bind(null,null,f,Number.POSITIVE_INFINITY)),!0)},tryRemoveTokens:function(f){return!this.bucketSize||!(f>this.bucketSize)&&(this.drip(),!(f>this.content))&&(!this.parentBucket||this.parentBucket.tryRemoveTokens(f))&&(this.content-=f,!0)},drip:function(){if(this.tokensPerInterval){var f=+new Date,x=ue(f-this.lastDrip,0);this.lastDrip=f,this.content=Y(this.content+x*(this.tokensPerInterval/this.interval),this.bucketSize)}else this.content=this.bucketSize}},B.exports=g}).call(this)}).call(this,m("_process"))},{_process:205}],168:[function(m,B){function i(x){return this instanceof i?("number"==typeof x&&(x={max:x}),!x&&(x={}),g.EventEmitter.call(this),this.cache={},this.head=this.tail=null,this.length=0,this.max=x.max||1e3,void(this.maxAge=x.maxAge||0)):new i(x)}var g=m("events"),f=m("inherits");B.exports=i,f(i,g.EventEmitter),Object.defineProperty(i.prototype,"keys",{get:function(){return Object.keys(this.cache)}}),i.prototype.clear=function(){this.cache={},this.head=this.tail=null,this.length=0},i.prototype.remove=function(x){if("string"!=typeof x&&(x=""+x),this.cache.hasOwnProperty(x)){var n=this.cache[x];return delete this.cache[x],this._unlink(x,n.prev,n.next),n.value}},i.prototype._unlink=function(x,n,c){this.length--,0===this.length?this.head=this.tail=null:this.head===x?(this.head=n,this.cache[this.head].next=null):this.tail===x?(this.tail=c,this.cache[this.tail].prev=null):(this.cache[n].next=c,this.cache[c].prev=n)},i.prototype.peek=function(x){if(this.cache.hasOwnProperty(x)){var n=this.cache[x];return this._checkAge(x,n)?n.value:void 0}},i.prototype.set=function(x,n){var c;if("string"!=typeof x&&(x=""+x),this.cache.hasOwnProperty(x)){if((c=this.cache[x]).value=n,this.maxAge&&(c.modified=Date.now()),x===this.head)return n;this._unlink(x,c.prev,c.next)}else c={value:n,modified:0,next:null,prev:null},this.maxAge&&(c.modified=Date.now()),this.cache[x]=c,this.length===this.max&&this.evict();return this.length++,c.next=null,c.prev=this.head,this.head&&(this.cache[this.head].next=x),this.head=x,this.tail||(this.tail=x),n},i.prototype._checkAge=function(x,n){return!(this.maxAge&&Date.now()-n.modified>this.maxAge&&(this.remove(x),this.emit("evict",{key:x,value:n.value}),1))},i.prototype.get=function(x){if("string"!=typeof x&&(x=""+x),this.cache.hasOwnProperty(x)){var n=this.cache[x];if(this._checkAge(x,n))return this.head!==x&&(x===this.tail?(this.tail=n.next,this.cache[this.tail].prev=null):this.cache[n.prev].next=n.next,this.cache[n.next].prev=n.prev,this.cache[this.head].next=x,n.prev=this.head,n.next=null,this.head=x),n.value}},i.prototype.evict=function(){if(this.tail){var x=this.tail,n=this.remove(this.tail);this.emit("evict",{key:x,value:n})}}},{events:70,inherits:159}],169:[function(m,B){(function(i){(function(){const g=m("unordered-array-remove"),{EventEmitter:f}=m("events"),x=m("debug")("lt_donthave");B.exports=()=>{class n extends f{constructor(u){super(),this._peerSupports=!1,this._wire=u}onExtendedHandshake(){this._peerSupports=!0}onMessage(u){let s;try{s=u.readUInt32BE()}catch{return}this._wire.peerPieces.get(s)&&(x("got donthave %d",s),this._wire.peerPieces.set(s,!1),this.emit("donthave",s),this._failRequests(s))}donthave(u){if(this._peerSupports){x("donthave %d",u);const s=i.alloc(4);s.writeUInt32BE(u),this._wire.extended("lt_donthave",s)}}_failRequests(u){const s=this._wire.requests;for(let t=0;t{const r=o.split("=");if(2!==r.length)return;const d=r[0];let h=r[1];"dn"===d&&(h=decodeURIComponent(h).replace(/\+/g," ")),("tr"===d||"xs"===d||"as"===d||"ws"===d)&&(h=decodeURIComponent(h)),"kt"===d&&(h=decodeURIComponent(h).split("+")),"ix"===d&&(h=+h),"so"===d&&(h=x.parse(decodeURIComponent(h).split(","))),c[d]?(!Array.isArray(c[d])&&(c[d]=[c[d]]),c[d].push(h)):c[d]=h}),c.xt&&(Array.isArray(c.xt)?c.xt:[c.xt]).forEach(r=>{if(t=r.match(/^urn:btih:(.{40})/))c.infoHash=t[1].toLowerCase();else if(t=r.match(/^urn:btih:(.{32})/)){const d=f.decode(t[1]);c.infoHash=i.from(d,"binary").toString("hex")}else(t=r.match(/^urn:btmh:1220(.{64})/))&&(c.infoHashV2=t[1].toLowerCase())}),c.xs&&(Array.isArray(c.xs)?c.xs:[c.xs]).forEach(r=>{(t=r.match(/^urn:btpk:(.{64})/))&&(c.publicKey=t[1].toLowerCase())}),c.infoHash&&(c.infoHashBuffer=i.from(c.infoHash,"hex")),c.infoHashV2&&(c.infoHashV2Buffer=i.from(c.infoHashV2,"hex")),c.publicKey&&(c.publicKeyBuffer=i.from(c.publicKey,"hex")),c.dn&&(c.name=c.dn),c.kt&&(c.keywords=c.kt),c.announce=[],("string"==typeof c.tr||Array.isArray(c.tr))&&(c.announce=c.announce.concat(c.tr)),c.urlList=[],("string"==typeof c.as||Array.isArray(c.as))&&(c.urlList=c.urlList.concat(c.as)),("string"==typeof c.ws||Array.isArray(c.ws))&&(c.urlList=c.urlList.concat(c.ws)),c.peerAddresses=[],("string"==typeof c["x.pe"]||Array.isArray(c["x.pe"]))&&(c.peerAddresses=c.peerAddresses.concat(c["x.pe"])),c.announce=Array.from(new Set(c.announce)),c.urlList=Array.from(new Set(c.urlList)),c.peerAddresses=Array.from(new Set(c.peerAddresses)),c}B.exports=g,B.exports.decode=g,B.exports.encode=function(n){n=Object.assign({},n);let c=new Set;n.xt&&"string"==typeof n.xt&&c.add(n.xt),n.xt&&Array.isArray(n.xt)&&(c=new Set(n.xt)),n.infoHashBuffer&&c.add(`urn:btih:${n.infoHashBuffer.toString("hex")}`),n.infoHash&&c.add(`urn:btih:${n.infoHash}`),n.infoHashV2Buffer&&c.add(n.xt=`urn:btmh:1220${n.infoHashV2Buffer.toString("hex")}`),n.infoHashV2&&c.add(`urn:btmh:1220${n.infoHashV2}`);const u=Array.from(c);1===u.length&&(n.xt=u[0]),12===t.length||"x.pe"===t).forEach((t,o)=>{const r=Array.isArray(n[t])?n[t]:[n[t]];r.forEach((d,h)=>{(0>>32-d}function f(r,d,h,l,p,w,b){return 0|g(0|r+(d&h|~d&l)+p+w,b)+d}function x(r,d,h,l,p,w,b){return 0|g(0|r+(d&l|h&~l)+p+w,b)+d}function n(r,d,h,l,p,w,b){return 0|g(0|r+(d^h^l)+p+w,b)+d}function c(r,d,h,l,p,w,b){return 0|g(0|r+(h^(d|~l))+p+w,b)+d}var u=m("inherits"),s=m("hash-base"),t=m("safe-buffer").Buffer,o=Array(16);u(i,s),i.prototype._update=function(){for(var r=o,d=0;16>d;++d)r[d]=this._block.readInt32LE(4*d);var h=this._a,l=this._b,p=this._c,w=this._d;h=f(h,l,p,w,r[0],3614090360,7),w=f(w,h,l,p,r[1],3905402710,12),p=f(p,w,h,l,r[2],606105819,17),l=f(l,p,w,h,r[3],3250441966,22),h=f(h,l,p,w,r[4],4118548399,7),w=f(w,h,l,p,r[5],1200080426,12),p=f(p,w,h,l,r[6],2821735955,17),l=f(l,p,w,h,r[7],4249261313,22),h=f(h,l,p,w,r[8],1770035416,7),w=f(w,h,l,p,r[9],2336552879,12),p=f(p,w,h,l,r[10],4294925233,17),l=f(l,p,w,h,r[11],2304563134,22),h=f(h,l,p,w,r[12],1804603682,7),w=f(w,h,l,p,r[13],4254626195,12),p=f(p,w,h,l,r[14],2792965006,17),h=x(h,l=f(l,p,w,h,r[15],1236535329,22),p,w,r[1],4129170786,5),w=x(w,h,l,p,r[6],3225465664,9),p=x(p,w,h,l,r[11],643717713,14),l=x(l,p,w,h,r[0],3921069994,20),h=x(h,l,p,w,r[5],3593408605,5),w=x(w,h,l,p,r[10],38016083,9),p=x(p,w,h,l,r[15],3634488961,14),l=x(l,p,w,h,r[4],3889429448,20),h=x(h,l,p,w,r[9],568446438,5),w=x(w,h,l,p,r[14],3275163606,9),p=x(p,w,h,l,r[3],4107603335,14),l=x(l,p,w,h,r[8],1163531501,20),h=x(h,l,p,w,r[13],2850285829,5),w=x(w,h,l,p,r[2],4243563512,9),p=x(p,w,h,l,r[7],1735328473,14),h=n(h,l=x(l,p,w,h,r[12],2368359562,20),p,w,r[5],4294588738,4),w=n(w,h,l,p,r[8],2272392833,11),p=n(p,w,h,l,r[11],1839030562,16),l=n(l,p,w,h,r[14],4259657740,23),h=n(h,l,p,w,r[1],2763975236,4),w=n(w,h,l,p,r[4],1272893353,11),p=n(p,w,h,l,r[7],4139469664,16),l=n(l,p,w,h,r[10],3200236656,23),h=n(h,l,p,w,r[13],681279174,4),w=n(w,h,l,p,r[0],3936430074,11),p=n(p,w,h,l,r[3],3572445317,16),l=n(l,p,w,h,r[6],76029189,23),h=n(h,l,p,w,r[9],3654602809,4),w=n(w,h,l,p,r[12],3873151461,11),p=n(p,w,h,l,r[15],530742520,16),h=c(h,l=n(l,p,w,h,r[2],3299628645,23),p,w,r[0],4096336452,6),w=c(w,h,l,p,r[7],1126891415,10),p=c(p,w,h,l,r[14],2878612391,15),l=c(l,p,w,h,r[5],4237533241,21),h=c(h,l,p,w,r[12],1700485571,6),w=c(w,h,l,p,r[3],2399980690,10),p=c(p,w,h,l,r[10],4293915773,15),l=c(l,p,w,h,r[1],2240044497,21),h=c(h,l,p,w,r[8],1873313359,6),w=c(w,h,l,p,r[15],4264355552,10),p=c(p,w,h,l,r[6],2734768916,15),l=c(l,p,w,h,r[13],1309151649,21),h=c(h,l,p,w,r[4],4149444226,6),w=c(w,h,l,p,r[11],3174756917,10),p=c(p,w,h,l,r[2],718787259,15),l=c(l,p,w,h,r[9],3951481745,21),this._a=0|this._a+h,this._b=0|this._b+l,this._c=0|this._c+p,this._d=0|this._d+w},i.prototype._digest=function(){this._block[this._blockOffset++]=128,56s._bufferDuration)&&s._cb){var t=s._cb;s._cb=null,t()}},g.prototype._getBufferDuration=function(){for(var t=this._sourceBuffer.buffered,o=this._elem.currentTime,r=-1,d=0;do)break;(0<=r||o<=l)&&(r=l)}var p=r-o;return 0>p&&(p=0),p}},{inherits:159,"readable-stream":240,"to-arraybuffer":279}],173:[function(m,B){function i(f,x){if(!(this instanceof i))return new i(f,x);if(x||(x={}),this.chunkLength=+f,!this.chunkLength)throw new Error("First argument must be a chunk length");this.chunks=[],this.closed=!1,this.length=+x.length||1/0,this.length!==1/0&&(this.lastChunkLength=this.length%this.chunkLength||this.chunkLength,this.lastChunkIndex=ve(this.length/this.chunkLength)-1)}B.exports=i;const g=m("queue-microtask");i.prototype.put=function(f,x,n=(()=>{})){if(this.closed)return g(()=>n(new Error("Storage is closed")));const c=f===this.lastChunkIndex;return c&&x.length!==this.lastChunkLength?g(()=>n(new Error("Last chunk length must be "+this.lastChunkLength))):c||x.length===this.chunkLength?(this.chunks[f]=x,void g(()=>n(null))):g(()=>n(new Error("Chunk length must be "+this.chunkLength)))},i.prototype.get=function(f,x,n=(()=>{})){if("function"==typeof x)return this.get(f,null,x);if(this.closed)return g(()=>n(new Error("Storage is closed")));let c=this.chunks[f];if(!c){const t=new Error("Chunk not found");return t.notFound=!0,g(()=>n(t))}x||(x={});const u=x.offset||0,s=x.length||c.length-u;(0!==u||s!==c.length)&&(c=c.slice(u,s+u)),g(()=>n(null,c))},i.prototype.close=i.prototype.destroy=function(f=(()=>{})){return this.closed?g(()=>f(new Error("Storage is closed"))):(this.closed=!0,this.chunks=null,void g(()=>f(null)))}},{"queue-microtask":218}],174:[function(m,B){function i(x){this.rand=x||new f.Rand}var g=m("bn.js"),f=m("brorand");B.exports=i,i.create=function(x){return new i(x)},i.prototype._randbelow=function(x){var n=x.bitLength(),c=ve(n/8);do{var u=new g(this.rand.generate(c))}while(0<=u.cmp(x));return u},i.prototype._randrange=function(x,n){var c=n.sub(x);return x.add(this._randbelow(c))},i.prototype.test=function(x,n,c){var u=x.bitLength(),s=g.mont(x),t=new g(1).toRed(s);n||(n=ue(1,0|u/48));for(var o=x.subn(1),r=0;!o.testn(r);r++);for(var d=x.shrn(r),h=o.toRed(s);0>8,r=255&t;o?u.push(o,r):u.push(r)}return u},x.zero2=g,x.toHex=f,x.encode=function(n,c){return"hex"===c?f(n):n}},{}],182:[function(m,B,i){(function(g){(function(){function f(S,R,N){for(var q=R;q>3:0,L=null;return we&&(L=we.toString(16),A&&(L+="."+A)),{mimeCodec:L,buffer:g.from(S.slice(0))}},i.esds.encodingLength=function(S){return S.buffer.length},i.stsz={},i.stsz.encode=function(S,R,N){var q=S.entries||[];(R=R?R.slice(N):g.alloc(i.stsz.encodingLength(S))).writeUInt32BE(0,0),R.writeUInt32BE(q.length,4);for(var Z=0;Zn&&(d=1),t.writeUInt32BE(d,o),t.write(s.type,o+4,4,"ascii");var h=o+8;if(1===d&&(f.encode(s.length,t,h),h+=8),x.fullBoxes[r]&&(t.writeUInt32BE(s.flags||0,h),t.writeUInt8(s.version||0,h),h+=4),u[r])u[r].forEach(function(b){if(5===b.length){var I=s[b]||[];b=b.substr(0,4),I.forEach(function(S){c._encode(S,t,h),h+=c.encode.bytes})}else s[b]&&(c._encode(s[b],t,h),h+=c.encode.bytes)}),s.otherBoxes&&s.otherBoxes.forEach(function(b){c._encode(b,t,h),h+=c.encode.bytes});else if(x[r]){var p=x[r].encode;p(s,t,h),h+=p.bytes}else{if(!s.buffer)throw new Error("Either `type` must be set to a known type (not'"+r+"') or `buffer` must be set");s.buffer.copy(t,h),h+=s.buffer.length}return c.encode.bytes=h-o,t},c.readHeaders=function(s,t,o){if(8>(o=o||s.length)-(t=t||0))return 8;var l,p,r=s.readUInt32BE(t),d=s.toString("ascii",t+4,t+8),h=t+8;if(1===r){if(16>o-t)return 16;r=f.decode(s,h),h+=8}return x.fullBoxes[d]&&(l=s.readUInt8(h),p=16777215&s.readUInt32BE(h),h+=4),{length:r,headersLen:h-t,contentLen:r-(h-t),type:d,version:l,flags:p}},c.decode=function(s,t,o){var r=c.readHeaders(s,t=t||0,o=o||s.length);if(!r||r.length>o-t)throw new Error("Data too short");return c.decodeWithoutHeaders(r,s,t+r.headersLen,t+r.length)},c.decodeWithoutHeaders=function(s,t,o,r){o=o||0,r=r||t.length;var d=s.type,h={};if(u[d]){h.otherBoxes=[];for(var w,l=u[d],p=o;8<=r-p;)if(p+=(w=c.decode(t,p,r)).length,0<=l.indexOf(w.type))h[w.type]=w;else if(0<=l.indexOf(w.type+"s")){var b=w.type+"s";(h[b]=h[b]||[]).push(w)}else h.otherBoxes.push(w)}else x[d]?h=(0,x[d].decode)(t,o,r):h.buffer=g.from(t.slice(o,r));return h.length=s.length,h.contentLen=s.contentLen,h.type=s.type,h.version=s.version,h.flags=s.flags,h},c.encodingLength=function(s){var t=s.type,o=8;if(x.fullBoxes[t]&&(o+=4),u[t])u[t].forEach(function(d){if(5===d.length){var h=s[d]||[];d=d.substr(0,4),h.forEach(function(p){p.type=d,o+=c.encodingLength(p)})}else if(s[d]){var l=s[d];l.type=d,o+=c.encodingLength(l)}}),s.otherBoxes&&s.otherBoxes.forEach(function(d){o+=c.encodingLength(d)});else if(x[t])o+=x[t].encodingLength(s);else{if(!s.buffer)throw new Error("Either `type` must be set to a known type (not'"+t+"') or `buffer` must be set");o+=s.buffer.length}return o>n&&(o+=8),s.length=o,o}}).call(this)}).call(this,m("buffer").Buffer)},{"./boxes":182,buffer:69,uint64be:283}],185:[function(m,B){(function(i){(function(){var g=m("readable-stream"),f=m("next-event"),x=m("mp4-box-encoding"),n=i.alloc(0);class u extends g.PassThrough{constructor(t){super(),this._parent=t,this.destroyed=!1}destroy(t){this.destroyed||(this.destroyed=!0,this._parent.destroy(t),t&&this.emit("error",t),this.emit("close"))}}B.exports=class c extends g.Writable{constructor(t){super(t),this.destroyed=!1,this._pending=0,this._missing=0,this._ignoreEmpty=!1,this._buf=null,this._str=null,this._cb=null,this._ondrain=null,this._writeBuffer=null,this._writeCb=null,this._ondrain=null,this._kick()}destroy(t){this.destroyed||(this.destroyed=!0,t&&this.emit("error",t),this.emit("close"))}_write(t,o,r){if(!this.destroyed){for(var d=!this._str||!this._str._writableState.needDrain;t.length&&!this.destroyed;){if(!this._missing&&!this._ignoreEmpty)return this._writeBuffer=t,void(this._writeCb=r);var h=t.length{this._pending--,this._kick()}),this._cb=o,this._str}_readBox(){const t=(o,r)=>{this._buffer(o,d=>{r=r?i.concat([r,d]):d;var h=x.readHeaders(r);"number"==typeof h?t(h-r.length,r):(this._pending++,this._headers=h,this.emit("box",h))})};t(8)}stream(){if(!this._headers)throw new Error("this function can only be called once after 'box' is emitted");var t=this._headers;return this._headers=null,this._stream(t.contentLen,()=>{this._pending--,this._kick()})}decode(t){if(!this._headers)throw new Error("this function can only be called once after 'box' is emitted");var o=this._headers;this._headers=null,this._buffer(o.contentLen,r=>{var d=x.decodeWithoutHeaders(o,r);t(d),this._pending--,this._kick()})}ignore(){if(!this._headers)throw new Error("this function can only be called once after 'box' is emitted");var t=this._headers;this._headers=null,this._missing=t.contentLen,0===this._missing&&(this._ignoreEmpty=!0),this._cb=()=>{this._pending--,this._kick()}}_kick(){if(!this._pending&&(this._buf||this._str||this._readBox(),this._writeBuffer)){var t=this._writeCb,o=this._writeBuffer;this._writeBuffer=null,this._writeCb=null,this._write(o,null,t)}}}}).call(this)}).call(this,m("buffer").Buffer)},{buffer:69,"mp4-box-encoding":184,"next-event":190,"readable-stream":240}],186:[function(m,B){(function(i){(function(){function g(){}var f=m("readable-stream"),x=m("mp4-box-encoding"),n=m("queue-microtask");class u extends f.PassThrough{constructor(t){super(),this._parent=t,this.destroyed=!1}destroy(t){this.destroyed||(this.destroyed=!0,this._parent.destroy(t),t&&this.emit("error",t),this.emit("close"))}}B.exports=class c extends f.Readable{constructor(t){super(t),this.destroyed=!1,this._finalized=!1,this._reading=!1,this._stream=null,this._drain=null,this._want=!1,this._onreadable=()=>{this._want&&(this._want=!1,this._read())},this._onend=()=>{this._stream=null}}mdat(t,o){this.mediaData(t,o)}mediaData(t,o){var r=new u(this);return this.box({type:"mdat",contentLength:t,encodeBufferLen:8,stream:r},o),r}box(t,o){if(o||(o=g),this.destroyed)return o(new Error("Encoder is destroyed"));var r;if(t.encodeBufferLen&&(r=i.alloc(t.encodeBufferLen)),t.stream)t.buffer=null,r=x.encode(t,r),this.push(r),this._stream=t.stream,this._stream.on("readable",this._onreadable),this._stream.on("end",this._onend),this._stream.on("end",o),this._forward();else{if(r=x.encode(t,r),this.push(r))return n(o);this._drain=o}}destroy(t){if(!this.destroyed){if(this.destroyed=!0,this._stream&&this._stream.destroy&&this._stream.destroy(),this._stream=null,this._drain){var o=this._drain;this._drain=null,o(t)}t&&this.emit("error",t),this.emit("close")}}finalize(){this._finalized=!0,this._stream||this._drain||this.push(null)}_forward(){if(this._stream)for(;!this.destroyed;){var t=this._stream.read();if(!t)return void(this._want=!!this._stream);if(!this.push(t))return}}_read(){if(!this._reading&&!this.destroyed){if(this._reading=!0,this._stream&&this._forward(),this._drain){var t=this._drain;this._drain=null,t()}this._reading=!1,this._finalized&&this.push(null)}}}}).call(this)}).call(this,m("buffer").Buffer)},{buffer:69,"mp4-box-encoding":184,"queue-microtask":218,"readable-stream":240}],187:[function(m,B,i){const g=m("./decode"),f=m("./encode");i.decode=x=>new g(x),i.encode=x=>new f(x)},{"./decode":185,"./encode":186}],188:[function(m,B){function x(c,u,s,t){return kt(c/s)+" "+t+(u>=1.5*s?"s":"")}B.exports=function(c,u){u=u||{};var s=typeof c;if("string"==s&&0{"function"!=typeof r&&this._attachErrorListener(r)})),this._next()}_read(){this._drained=!0,this._forward()}_forward(){if(!this._forwarding&&this._drained&&this._current){this._forwarding=!0;for(let t;this._drained&&null!==(t=this._current.read());)this._drained=this.push(t);this._forwarding=!1}}_destroy(t,o){let r=[];if(this._current&&r.push(this._current),"function"!=typeof this._queue&&(r=r.concat(this._queue)),0===r.length)o(t);else{let d=r.length,h=t;r.forEach(l=>{!function x(s,t,o){if(!s.destroy||s.destroyed)o(t);else{const r=c(d=>o(d||t));s.on("error",r).on("close",()=>r()).destroy(t,r)}}(l,t,p=>{h=h||p,0==--d&&o(h)})})}}_next(){if(this._current=null,"function"==typeof this._queue)this._queue((t,o)=>t?this.destroy(t):(o=this._toStreams2(o),this._attachErrorListener(o),void this._gotNextStream(o)));else{let t=this._queue.shift();"function"==typeof t&&(t=this._toStreams2(t()),this._attachErrorListener(t)),this._gotNextStream(t)}}_gotNextStream(t){if(!t)return void this.push(null);this._current=t,this._forward();const o=()=>{this._forward()},r=()=>{if(!t._readableState.ended&&!t.destroyed){const h=new Error("ERR_STREAM_PREMATURE_CLOSE");h.code="ERR_STREAM_PREMATURE_CLOSE",this.destroy(h)}},d=()=>{this._current=null,t.removeListener("readable",o),t.removeListener("end",d),t.removeListener("close",r),t.destroy(),this._next()};t.on("readable",o),t.once("end",d),t.once("close",r)}_attachErrorListener(t){if(!t)return;const o=r=>{t.removeListener("error",o),this.destroy(r)};t.once("error",o)}}u.obj=s=>new u(s,{objectMode:!0,highWaterMark:16}),B.exports=u},{once:191,"readable-stream":240}],190:[function(m,B){B.exports=function(i,g){var f=null;return i.on(g,function(x){if(f){var n=f;f=null,n(x)}}),function(x){f=x}}},{}],191:[function(m,B){function i(x){var n=function(){return n.called?n.value:(n.called=!0,n.value=x.apply(this,arguments))};return n.called=!1,n}function g(x){var n=function(){if(n.called)throw new Error(n.onceError);return n.called=!0,n.value=x.apply(this,arguments)};return n.onceError=(x.name||"Function wrapped with `once`")+" shouldn't be called more than once",n.called=!1,n}var f=m("wrappy");B.exports=f(i),B.exports.strict=f(g),i.proto=i(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return g(this)},configurable:!0})})},{wrappy:291}],192:[function(m,B){B.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},{}],193:[function(m,B,i){"use strict";var g=m("asn1.js");i.certificate=m("./certificate");var f=g.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});i.RSAPrivateKey=f;var x=g.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});i.RSAPublicKey=x;var n=g.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(c),this.key("subjectPublicKey").bitstr())});i.PublicKey=n;var c=g.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),u=g.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(c),this.key("subjectPrivateKey").octstr())});i.PrivateKey=u;var s=g.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});i.EncryptedPrivateKey=s;var t=g.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});i.DSAPrivateKey=t,i.DSAparam=g.define("DSAparam",function(){this.int()});var o=g.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(r),this.key("publicKey").optional().explicit(1).bitstr())});i.ECPrivateKey=o;var r=g.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});i.signature=g.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},{"./certificate":194,"asn1.js":8}],194:[function(m,B){"use strict";var i=m("asn1.js"),g=i.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),f=i.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),x=i.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),n=i.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(x),this.key("subjectPublicKey").bitstr())}),c=i.define("RelativeDistinguishedName",function(){this.setof(f)}),u=i.define("RDNSequence",function(){this.seqof(c)}),s=i.define("Name",function(){this.choice({rdnSequence:this.use(u)})}),t=i.define("Validity",function(){this.seq().obj(this.key("notBefore").use(g),this.key("notAfter").use(g))}),o=i.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),r=i.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(x),this.key("issuer").use(s),this.key("validity").use(t),this.key("subject").use(s),this.key("subjectPublicKeyInfo").use(n),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(o).optional())}),d=i.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(r),this.key("signatureAlgorithm").use(x),this.key("signatureValue").bitstr())});B.exports=d},{"asn1.js":8}],195:[function(m,B){var i=m("evp_bytestokey"),g=m("browserify-aes"),f=m("safe-buffer").Buffer;B.exports=function(x,n){var s,c=x.toString(),u=c.match(/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m);if(u){var o="aes"+u[1],r=f.from(u[2],"hex"),d=f.from(u[3].replace(/[\r\n]/g,""),"base64"),h=i(n,r.slice(0,8),parseInt(u[1],10)).key,l=[],p=g.createDecipheriv(o,h,r);l.push(p.update(d)),l.push(p.final()),s=f.concat(l)}else{var t=c.match(/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m);s=f.from(t[2].replace(/[\r\n]/g,""),"base64")}return{tag:c.match(/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m)[1],data:s}}},{"browserify-aes":44,evp_bytestokey:137,"safe-buffer":247}],196:[function(m,B){function i(t){var o;"object"!=typeof t||s.isBuffer(t)||(o=t.passphrase,t=t.key),"string"==typeof t&&(t=s.from(t));var l,p,r=n(t,o),d=r.tag,h=r.data;switch(d){case"CERTIFICATE":p=f.certificate.decode(h,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(p||(p=f.PublicKey.decode(h,"der")),l=p.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return f.RSAPublicKey.decode(p.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return p.subjectPrivateKey=p.subjectPublicKey,{type:"ec",data:p};case"1.2.840.10040.4.1":return p.algorithm.params.pub_key=f.DSAparam.decode(p.subjectPublicKey.data,"der"),{type:"dsa",data:p.algorithm.params};default:throw new Error("unknown key id "+l)}case"ENCRYPTED PRIVATE KEY":h=function g(t,o){var r=t.algorithm.decrypt.kde.kdeparams.salt,d=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),h=x[t.algorithm.decrypt.cipher.algo.join(".")],l=t.algorithm.decrypt.cipher.iv,p=t.subjectPrivateKey,w=parseInt(h.split("-")[1],10)/8,b=u.pbkdf2Sync(o,r,d,w,"sha1"),I=c.createDecipheriv(h,b,l),S=[];return S.push(I.update(p)),S.push(I.final()),s.concat(S)}(h=f.EncryptedPrivateKey.decode(h,"der"),o);case"PRIVATE KEY":switch(l=(p=f.PrivateKey.decode(h,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return f.RSAPrivateKey.decode(p.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:p.algorithm.curve,privateKey:f.ECPrivateKey.decode(p.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return p.algorithm.params.priv_key=f.DSAparam.decode(p.subjectPrivateKey,"der"),{type:"dsa",params:p.algorithm.params};default:throw new Error("unknown key id "+l)}case"RSA PUBLIC KEY":return f.RSAPublicKey.decode(h,"der");case"RSA PRIVATE KEY":return f.RSAPrivateKey.decode(h,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:f.DSAPrivateKey.decode(h,"der")};case"EC PRIVATE KEY":return{curve:(h=f.ECPrivateKey.decode(h,"der")).parameters.value,privateKey:h.privateKey};default:throw new Error("unknown key type "+d)}}var f=m("./asn1"),x=m("./aesid.json"),n=m("./fixProc"),c=m("browserify-aes"),u=m("pbkdf2"),s=m("safe-buffer").Buffer;B.exports=i,i.signature=f.signature},{"./aesid.json":192,"./asn1":193,"./fixProc":195,"browserify-aes":44,pbkdf2:198,"safe-buffer":247}],197:[function(m,B){(function(i){(function(){function g(b){if("string"==typeof b&&/^(stream-)?magnet:/.test(b)){const I=h(b);if(!I.infoHash)throw new Error("Invalid torrent identifier");return I}if("string"==typeof b&&(/^[a-f0-9]{40}$/i.test(b)||/^[a-z2-7]{32}$/i.test(b)))return h(`magnet:?xt=urn:btih:${b}`);if(i.isBuffer(b)&&20===b.length)return h(`magnet:?xt=urn:btih:${b.toString("hex")}`);if(i.isBuffer(b))return function x(b){i.isBuffer(b)&&(b=t.decode(b)),s(b.info,"info"),s(b.info["name.utf-8"]||b.info.name,"info.name"),s(b.info["piece length"],"info['piece length']"),s(b.info.pieces,"info.pieces"),b.info.files?b.info.files.forEach(N=>{s("number"==typeof N.length,"info.files[0].length"),s(N["path.utf-8"]||N.path,"info.files[0].path")}):s("number"==typeof b.info.length,"info.length");const I={info:b.info,infoBuffer:t.encode(b.info),name:(b.info["name.utf-8"]||b.info.name).toString(),announce:[]};I.infoHash=p.sync(I.infoBuffer),I.infoHashBuffer=i.from(I.infoHash,"hex"),void 0!==b.info.private&&(I.private=!!b.info.private),b["creation date"]&&(I.created=new Date(1e3*b["creation date"])),b["created by"]&&(I.createdBy=b["created by"].toString()),i.isBuffer(b.comment)&&(I.comment=b.comment.toString()),Array.isArray(b["announce-list"])&&0{N.forEach(q=>{I.announce.push(q.toString())})}):b.announce&&I.announce.push(b.announce.toString()),i.isBuffer(b["url-list"])&&(b["url-list"]=0N.toString()),I.announce=Array.from(new Set(I.announce)),I.urlList=Array.from(new Set(I.urlList));const S=b.info.files||[b.info];I.files=S.map((N,q)=>{const Z=[].concat(I.name,N["path.utf-8"]||N.path||[]).map(le=>le.toString());return{path:l.join.apply(null,[l.sep].concat(Z)).slice(1),name:Z[Z.length-1],length:N.length,offset:S.slice(0,q).reduce(c,0)}}),I.length=S.reduce(c,0);const R=I.files[I.files.length-1];return I.pieceLength=b.info["piece length"],I.lastPieceLength=(R.offset+R.length)%I.pieceLength||I.pieceLength,I.pieces=function u(b){const I=[];for(let S=0;S{S(null,N)}):function n(b){return typeof Blob<"u"&&b instanceof Blob}(b)?o(b,(q,Z)=>q?S(new Error(`Error converting Blob: ${q.message}`)):void R(Z)):"function"==typeof d&&/^https?:/.test(b)?(I=Object.assign({url:b,timeout:3e4,headers:{"user-agent":"WebTorrent (https://webtorrent.io)"}},I),d.concat(I,(q,Z,le)=>q?S(new Error(`Error downloading torrent: ${q.message}`)):void R(le))):"function"==typeof r.readFile&&"string"==typeof b?r.readFile(b,(q,Z)=>q?S(new Error("Invalid torrent identifier")):void R(Z)):w(()=>{S(new Error("Invalid torrent identifier"))})},B.exports.toMagnetURI=h.encode,B.exports.toTorrentFile=function(b){const I={info:b.info};return I["announce-list"]=(b.announce||[]).map(S=>(I.announce||(I.announce=S),[S=i.from(S,"utf8")])),I["url-list"]=b.urlList||[],void 0!==b.private&&(I.private=+b.private),b.created&&(I["creation date"]=0|b.created.getTime()/1e3),b.createdBy&&(I["created by"]=b.createdBy),b.comment&&(I.comment=b.comment),t.encode(I)},i.alloc(0)}).call(this)}).call(this,m("buffer").Buffer)},{bencode:27,"blob-to-buffer":37,buffer:69,fs:41,"magnet-uri":170,path:71,"queue-microtask":218,"simple-get":258,"simple-sha1":260}],198:[function(m,B,i){i.pbkdf2=m("./lib/async"),i.pbkdf2Sync=m("./lib/sync")},{"./lib/async":199,"./lib/sync":202}],199:[function(m,B){(function(i){(function(){function f(){return p||(p=i.process&&i.process.nextTick?i.process.nextTick:i.queueMicrotask?i.queueMicrotask:i.setImmediate?i.setImmediate:i.setTimeout)}function x(w,b,I,S,R){return r.importKey("raw",w,{name:"PBKDF2"},!1,["deriveBits"]).then(function(N){return r.deriveBits({name:"PBKDF2",salt:b,iterations:I,hash:{name:R}},N,S<<3)}).then(function(N){return c.from(N)})}var l,p,c=m("safe-buffer").Buffer,u=m("./precondition"),s=m("./default-encoding"),t=m("./sync"),o=m("./to-buffer"),r=i.crypto&&i.crypto.subtle,d={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},h=[];B.exports=function(w,b,I,S,R,N){"function"==typeof R&&(N=R,R=void 0);var q=d[(R=R||"sha1").toLowerCase()];if(q&&"function"==typeof i.Promise){if(u(I,S),w=o(w,s,"Password"),b=o(b,s,"Salt"),"function"!=typeof N)throw new Error("No callback provided to pbkdf2");!function n(w,b){w.then(function(I){f()(function(){b(null,I)})},function(I){f()(function(){b(I)})})}(function g(w){if(i.process&&!i.process.browser||!r||!r.importKey||!r.deriveBits)return Promise.resolve(!1);if(void 0!==h[w])return h[w];var b=x(l=l||c.alloc(8),l,10,128,w).then(function(){return!0}).catch(function(){return!1});return h[w]=b,b}(q).then(function(Z){return Z?x(w,b,I,S,q):t(w,b,I,S,R)}),N)}else f()(function(){var Z;try{Z=t(w,b,I,S,R)}catch(le){return N(le)}N(null,Z)})}}).call(this)}).call(this,typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"./default-encoding":200,"./precondition":201,"./sync":202,"./to-buffer":203,"safe-buffer":247}],200:[function(m,B){(function(i,g){(function(){var f;f=g.process&&g.process.browser?"utf-8":g.process&&g.process.version?6<=parseInt(i.version.split(".")[0].slice(1),10)?"utf-8":"binary":"utf-8",B.exports=f}).call(this)}).call(this,m("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{_process:205}],201:[function(m,B){j(2,30),B.exports=function(i,g){if("number"!=typeof i)throw new TypeError("Iterations not a number");if(0>i)throw new TypeError("Bad iterations");if("number"!=typeof g)throw new TypeError("Key length not a number");if(0>g||1073741823w?h=p(h):h.lengthi?1:i/1024)+.5)}},{}],205:[function(m,B){function i(){throw new Error("setTimeout has not been defined")}function g(){throw new Error("clearTimeout has not been defined")}function f(w){if(o===setTimeout)return setTimeout(w,0);if((o===i||!o)&&setTimeout)return o=setTimeout,setTimeout(w,0);try{return o(w,0)}catch{try{return o.call(null,w,0)}catch{return o.call(this,w,0)}}}function n(){h&&p&&(h=!1,p.length?d=p.concat(d):l=-1,d.length&&c())}function c(){if(!h){var w=f(n);h=!0;for(var b=d.length;b;){for(p=d,d=[];++lb||0<=new u(h).cmp(w.modulus))throw new Error("decryption error");var I=l?o(new u(h),w):s(h,w),S=r.alloc(b-I.length);if(I=r.concat([S,I],b),4===p)return function i(d,h){var l=d.modulus.byteLength(),p=t("sha1").update(r.alloc(0)).digest(),w=p.length;if(0!==h[0])throw new Error("decryption error");var b=h.slice(1,w+1),I=h.slice(w+1),S=c(b,n(I,w)),R=c(I,n(S,l-w-1));if(function f(d,h){d=r.from(d),h=r.from(h);var l=0,p=d.length;d.length!==h.length&&(l++,p=Y(d.length,h.length));for(var w=-1;++w=h.length){b++;break}var I=h.slice(2,w-1);if(("0002"!==p.toString("hex")&&!l||"0001"!==p.toString("hex")&&l)&&b++,8>I.length&&b++,b)throw new Error("decryption error");return h.slice(w)}(0,I,l);if(3===p)return I;throw new Error("unknown padding")}},{"./mgf":207,"./withPublic":211,"./xor":212,"bn.js":208,"browserify-rsa":62,"create-hash":99,"parse-asn1":196,"safe-buffer":247}],210:[function(m,B){var x=m("parse-asn1"),n=m("randombytes"),c=m("create-hash"),u=m("./mgf"),s=m("./xor"),t=m("bn.js"),o=m("./withPublic"),r=m("browserify-rsa"),d=m("safe-buffer").Buffer;B.exports=function(h,l,p){var I,w=h.padding?h.padding:p?1:4,b=x(h);if(4===w)I=function i(h,l){var p=h.modulus.byteLength(),w=l.length,b=c("sha1").update(d.alloc(0)).digest(),I=b.length,S=2*I;if(w>p-S-2)throw new Error("message too long");var R=d.alloc(p-w-S-2),N=p-I-1,q=n(I),Z=s(d.concat([b,R,d.alloc(1,1),l],N),u(q,N)),le=s(q,u(Z,I));return new t(d.concat([d.alloc(1),le,Z],p))}(b,l);else if(1===w)I=function g(h,l,p){var I,w=l.length,b=h.modulus.byteLength();if(w>b-11)throw new Error("message too long");return I=p?d.alloc(b-w-3,255):function f(h){for(var I,l=d.allocUnsafe(h),p=0,w=n(2*h),b=0;ph.length)throw new Error("pump requires two streams per minimum");var w,p=h.map(function(b,I){var S=I=A&&we>>10),le=56320|1023&le),we+R(le)}).join("")}function t(Z){return 10>Z-48?Z-22:26>Z-65?Z-65:26>Z-97?Z-97:36}function o(Z,le){return Z+22+75*(26>Z)-((0!=le)<<5)}function r(Z,le,we){var ke=0;for(Z=we?S(Z/700):Z>>1,Z+=S(Z/le);455(y=Z.lastIndexOf("-"))&&(y=0),C=0;C=we&&x("invalid-input"),(36<=(re=t(Z.charCodeAt(M++)))||re>S((2147483647-ke)/ee))&&x("overflow"),ke+=re*ee,!(re<(Ue=J<=L?1:J>=L+26?26:J-L));J+=36)ee>S(2147483647/(We=36-Ue))&&x("overflow"),ee*=We;L=r(ke-U,z=le.length+1,0==U),S(ke/z)>2147483647-A&&x("overflow"),A+=S(ke/z),ke%=z,le.splice(ke++,0,A)}return s(le)}function h(Z){var we,ke,A,L,z,y,C,M,U,ee,J,re,Ue,We,Qe,le=[];for(re=(Z=u(Z)).length,we=128,ke=0,z=72,y=0;y(J=Z[y])&&le.push(R(J));for(A=L=le.length,L&&le.push("-");A=we&&JS((2147483647-ke)/(Ue=A+1))&&x("overflow"),ke+=(C-we)*Ue,we=C,y=0;y=z+26?26:U-z));U+=36)le.push(R(o(ee+(Qe=M-ee)%(We=36-ee),0))),M=S(Qe/We);le.push(R(o(M,0))),z=r(ke,Ue,A==L),ke=0,++A}++ke,++we}return le.join("")}var l="object"==typeof i&&i&&!i.nodeType&&i,p="object"==typeof B&&B&&!B.nodeType&&B,w="object"==typeof g&&g;(w.global===w||w.window===w||w.self===w)&&(f=w);var N,q,b=/[\x2E\u3002\uFF0E\uFF61]/g,I={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=wt,R=G;if(N={version:"1.4.1",ucs2:{decode:u,encode:s},decode:d,encode:h,toASCII:function(Z){return c(Z,function(le){return/[^\x20-\x7E]/.test(le)?"xn--"+h(le):le})},toUnicode:function(Z){return c(Z,function(le){return/^xn--/.test(le)?d(le.slice(4).toLowerCase()):le})}},l&&p)if(B.exports==l)p.exports=N;else for(q in N)N.hasOwnProperty(q)&&(l[q]=N[q]);else f.punycode=N}(this)}).call(this)}).call(this,typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{}],215:[function(m,B){"use strict";function i(f,x){return Object.prototype.hasOwnProperty.call(f,x)}B.exports=function(f,x,n,c){n=n||"=";var u={};if("string"!=typeof f||0===f.length)return u;f=f.split(x=x||"&");var s=1e3;c&&"number"==typeof c.maxKeys&&(s=c.maxKeys);var t=f.length;0s&&(t=s);for(var o=0;o"u"?i:window):f=>(g||(g=Promise.resolve())).then(f).catch(x=>setTimeout(()=>{throw x},0))}).call(this)}).call(this,typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{}],219:[function(m,B){B.exports="function"==typeof queueMicrotask?queueMicrotask:i=>Promise.resolve().then(i)},{}],220:[function(m,B){B.exports=function(i){var g=0;return function(){if(g===i.length)return null;var f=i.length-g,x=0|Math.random()*f,n=i[g+x],c=i[g];return i[g]=n,i[g+x]=c,g++,n}}},{}],221:[function(m,B){(function(i,g){(function(){"use strict";var f=m("safe-buffer").Buffer,x=g.crypto||g.msCrypto;B.exports=x&&x.getRandomValues?function(n,c){if(n>4294967295)throw new RangeError("requested too many random bytes");var u=f.allocUnsafe(n);if(0"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{_process:205,"safe-buffer":247}],222:[function(m,B,i){(function(g,f){(function(){"use strict";function x(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}function n(l,p){if("number"!=typeof l||l!=l)throw new TypeError("offset must be a number");if(4294967295l)throw new TypeError("offset must be a uint32");if(l>r||l>p)throw new RangeError("offset out of range")}function c(l,p,w){if("number"!=typeof l||l!=l)throw new TypeError("size must be a number");if(4294967295l)throw new TypeError("size must be a uint32");if(l+p>w||l>r)throw new RangeError("buffer too small")}function u(l,p,w,b){if(g.browser){var S=new Uint8Array(l.buffer,p,w);return d.getRandomValues(S),b?void g.nextTick(function(){b(null,l)}):l}if(!b)return t(w).copy(l,p),l;t(w,function(N,q){return N?b(N):(q.copy(l,p),void b(null,l))})}var s=m("safe-buffer"),t=m("randombytes"),o=s.Buffer,r=s.kMaxLength,d=f.crypto||f.msCrypto;j(2,32),d&&d.getRandomValues||!g.browser?(i.randomFill=function(l,p,w,b){if(!(o.isBuffer(l)||l instanceof f.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof p)b=p,p=0,w=l.length;else if("function"==typeof w)b=w,w=l.length-p;else if("function"!=typeof b)throw new TypeError('"cb" argument must be a function');return n(p,l.length),c(w,p,l.length),u(l,p,w,b)},i.randomFillSync=function(l,p,w){if(typeof p>"u"&&(p=0),!(o.isBuffer(l)||l instanceof f.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return n(p,l.length),void 0===w&&(w=l.length-p),c(w,p,l.length),u(l,p,w)}):(i.randomFill=x,i.randomFillSync=x)}).call(this)}).call(this,m("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{_process:205,randombytes:221,"safe-buffer":247}],223:[function(m,B){"use strict";function g(c,u){return{start:c.start,end:c.end,index:u}}function f(c){return{start:c.start,end:c.end}}function x(c,u){return c.index-u.index}function n(c,u){return c.start-u.start}B.exports=function(c,u,s){if("string"!=typeof u)throw new TypeError("argument str must be a string");var t=u.indexOf("=");if(-1===t)return-2;var o=u.slice(t+1).split(","),r=[];r.type=u.slice(0,t);for(var d=0;dc-1&&(p=c-1),!(isNaN(l)||isNaN(p)||l>p||0>l)&&r.push({start:l,end:p})}return 1>r.length?-1:s&&s.combine?function i(c){for(var u=c.map(g).sort(n),s=0,t=1;tr.end+1?u[++s]=o:o.end>r.end&&(r.end=o.end,r.index=Y(r.index,o.index))}u.length=s+1;var d=u.sort(x).map(f);return d.type=c.type,d}(r):r}},{}],224:[function(m,B){const{Writable:i,PassThrough:g}=m("readable-stream");B.exports=class extends i{constructor(f,x={}){super(x),this.destroyed=!1,this._queue=[],this._position=f||0,this._cb=null,this._buffer=null,this._out=null}_write(f,x,n){let c=!0;for(;;){if(this.destroyed)return;if(0===this._queue.length)return this._buffer=f,void(this._cb=n);this._buffer=null;var u=this._queue[0];const s=ue(u.start-this._position,0),t=u.end-this._position;if(s>=f.length)return this._position+=f.length,n(null);let o;if(t>f.length){this._position+=f.length,o=0===s?f:f.slice(s),c=u.stream.write(o)&&c;break}this._position+=t,o=0===s&&t===f.length?f:f.slice(s,t),c=u.stream.write(o)&&c,u.last&&u.stream.end(),f=f.slice(t),this._queue.shift()}c?n(null):u.stream.once("drain",n.bind(null,null))}slice(f){if(this.destroyed)return null;Array.isArray(f)||(f=[f]);const x=new g;return f.forEach((n,c)=>{this._queue.push({start:n.start,end:n.end,stream:x,last:c===f.length-1})}),this._buffer&&this._write(this._buffer,null,this._cb),x}destroy(f){this.destroyed||(this.destroyed=!0,f&&this.emit("error",f))}}},{"readable-stream":240}],225:[function(m,B){"use strict";function i(u){return parseInt(u,10)===u}function g(u){function o(r){this.s=function t(r){if(void 0===r){r=Array(u);for(var d=0;du?48+u:97+u-10)}function x(u){return parseInt(u,16)}var n=g(256);n.prototype.randomByte=n.prototype.randomNative;var c=g(16);c.prototype.randomByte=function(){return 16*this.randomNative()+this.randomNative()},c.prototype.currentStateString=function(){var u=this.currentState();return f(u.i)+f(u.j)+u.s.map(f).join("")},c.prototype.setStateString=function(u){if(!u.match(/^[0-9a-f]{18}$/))throw new TypeError("RC4small stateString should be 18 hex character string");var s=x(u[0]),t=x(u[1]),o=u.split("").slice(2).map(x);this.setState({i:s,j:t,s:o})},n.RC4small=c,B.exports=n},{}],226:[function(m,B,i){arguments[4][73][0].apply(i,arguments)},{dup:73}],227:[function(m,B,i){arguments[4][74][0].apply(i,arguments)},{"./_stream_readable":229,"./_stream_writable":231,_process:205,dup:74,inherits:159}],228:[function(m,B,i){arguments[4][75][0].apply(i,arguments)},{"./_stream_transform":230,dup:75,inherits:159}],229:[function(m,B,i){arguments[4][76][0].apply(i,arguments)},{"../errors":226,"./_stream_duplex":227,"./internal/streams/async_iterator":232,"./internal/streams/buffer_list":233,"./internal/streams/destroy":234,"./internal/streams/from":236,"./internal/streams/state":238,"./internal/streams/stream":239,_process:205,buffer:69,dup:76,events:70,inherits:159,"string_decoder/":276,util:41}],230:[function(m,B,i){arguments[4][77][0].apply(i,arguments)},{"../errors":226,"./_stream_duplex":227,dup:77,inherits:159}],231:[function(m,B,i){arguments[4][78][0].apply(i,arguments)},{"../errors":226,"./_stream_duplex":227,"./internal/streams/destroy":234,"./internal/streams/state":238,"./internal/streams/stream":239,_process:205,buffer:69,dup:78,inherits:159,"util-deprecate":288}],232:[function(m,B,i){arguments[4][79][0].apply(i,arguments)},{"./end-of-stream":235,_process:205,dup:79}],233:[function(m,B,i){arguments[4][80][0].apply(i,arguments)},{buffer:69,dup:80,util:41}],234:[function(m,B,i){arguments[4][81][0].apply(i,arguments)},{_process:205,dup:81}],235:[function(m,B,i){arguments[4][82][0].apply(i,arguments)},{"../../../errors":226,dup:82}],236:[function(m,B,i){arguments[4][83][0].apply(i,arguments)},{dup:83}],237:[function(m,B,i){arguments[4][84][0].apply(i,arguments)},{"../../../errors":226,"./end-of-stream":235,dup:84}],238:[function(m,B,i){arguments[4][85][0].apply(i,arguments)},{"../../../errors":226,dup:85}],239:[function(m,B,i){arguments[4][86][0].apply(i,arguments)},{dup:86,events:70}],240:[function(m,B,i){(i=B.exports=m("./lib/_stream_readable.js")).Stream=i,i.Readable=i,i.Writable=m("./lib/_stream_writable.js"),i.Duplex=m("./lib/_stream_duplex.js"),i.Transform=m("./lib/_stream_transform.js"),i.PassThrough=m("./lib/_stream_passthrough.js"),i.finished=m("./lib/internal/streams/end-of-stream.js"),i.pipeline=m("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":227,"./lib/_stream_passthrough.js":228,"./lib/_stream_readable.js":229,"./lib/_stream_transform.js":230,"./lib/_stream_writable.js":231,"./lib/internal/streams/end-of-stream.js":235,"./lib/internal/streams/pipeline.js":237}],241:[function(m,B,i){function g(Z,le,we,ke){function A(){return!("number"==typeof Z.length&&Z.length>we.maxBlobLength&&(s("File length too large for Blob URL approach: %d (max: %d)",Z.length,we.maxBlobLength),M(new Error(`File length too large for Blob URL approach: ${Z.length} (max: ${we.maxBlobLength})`)),1))}function L(re){A()&&(J=le(re),f(Z,(Ue,We)=>Ue?M(Ue):(J.addEventListener("error",M),J.addEventListener("loadstart",z),J.addEventListener("loadedmetadata",y),void(J.src=We))))}function z(){if(J.removeEventListener("loadstart",z),we.autoplay){const re=J.play();typeof re<"u"&&re.catch(M)}}function y(){J.removeEventListener("loadedmetadata",y),ke(null,J)}function C(){f(Z,(re,Ue)=>re?M(re):(".pdf"===U?(J=le("object"),J.setAttribute("typemustmatch",!0),J.setAttribute("type","application/pdf"),J.setAttribute("data",Ue)):(J=le("iframe"),J.sandbox="allow-forms allow-scripts",J.src=Ue),void ke(null,J)))}function M(re){re.message=`Error rendering file "${Z.name}": ${re.message}`,s(re.message),ke(re)}const U=r.extname(Z.name).toLowerCase();let J,ee=0;w.includes(U)?function(){function Ue(){s(`Use MediaSource API for ${Z.name}`),pt(),J.addEventListener("error",ft),J.addEventListener("loadstart",z),J.addEventListener("loadedmetadata",y);const Ft=new o(J).createWriteStream(function n(Z){return{".m4a":'audio/mp4; codecs="mp4a.40.5"',".m4b":'audio/mp4; codecs="mp4a.40.5"',".m4p":'audio/mp4; codecs="mp4a.40.5"',".m4v":'video/mp4; codecs="avc1.640029, mp4a.40.5"',".mkv":'video/webm; codecs="avc1.640029, mp4a.40.5"',".mp3":"audio/mpeg",".mp4":'video/mp4; codecs="avc1.640029, mp4a.40.5"',".webm":'video/webm; codecs="vorbis, vp8"'}[r.extname(Z).toLowerCase()]}(Z.name));Z.createReadStream().pipe(Ft),ee&&(J.currentTime=ee)}function We(){s(`Use Blob URL for ${Z.name}`),pt(),J.addEventListener("error",M),J.addEventListener("loadstart",z),J.addEventListener("loadedmetadata",y),f(Z,(It,Ft)=>It?M(It):(J.src=Ft,void(ee&&(J.currentTime=ee))))}function Qe(It){s("videostream error: fallback to MediaSource API: %o",It.message||It),J.removeEventListener("error",Qe),J.removeEventListener("loadedmetadata",y),Ue()}function ft(It){s("MediaSource API error: fallback to Blob URL: %o",It.message||It),A()&&(J.removeEventListener("error",ft),J.removeEventListener("loadedmetadata",y),We())}function pt(){J||(J=le(Xt),J.addEventListener("progress",()=>{ee=J.currentTime}))}const Xt=p.includes(U)?"video":"audio";q?l.includes(U)?function re(){s(`Use \`videostream\` package for ${Z.name}`),pt(),J.addEventListener("error",Qe),J.addEventListener("loadstart",z),J.addEventListener("loadedmetadata",y),new h(Z,J)}():Ue():We()}():b.includes(U)?L("video"):I.includes(U)?L("audio"):S.includes(U)?(J=le("img"),f(Z,(re,Ue)=>re?M(re):(J.src=Ue,J.alt=Z.name,void ke(null,J)))):R.includes(U)?C():function(){s('Unknown file extension "%s" - will attempt to render into iframe',U);let Ue="";Z.createReadStream({start:0,end:1e3}).setEncoding("utf8").on("data",We=>{Ue+=We}).on("end",function re(){t(Ue)?(s('File extension "%s" appears ascii, so will render.',U),C()):(s('File extension "%s" appears non-ascii, will not render.',U),ke(new Error(`Unsupported file type "${U}": Cannot append to DOM`)))}).on("error",ke)}()}function f(Z,le){const we=r.extname(Z.name).toLowerCase();d(Z.createReadStream(),i.mime[we]).then(ke=>le(null,ke),ke=>le(ke))}function x(Z){if(null==Z)throw new Error("file cannot be null or undefined");if("string"!=typeof Z.name)throw new Error("missing or invalid file.name property");if("function"!=typeof Z.createReadStream)throw new Error("missing or invalid file.createReadStream property")}function c(Z){null==Z.autoplay&&(Z.autoplay=!1),null==Z.muted&&(Z.muted=!1),null==Z.controls&&(Z.controls=!0),null==Z.maxBlobLength&&(Z.maxBlobLength=N)}function u(Z,le){Z.autoplay=!!le.autoplay,Z.muted=!!le.muted,Z.controls=!!le.controls}i.render=function(Z,le,we,ke){"function"==typeof we&&(ke=we,we={}),we||(we={}),ke||(ke=()=>{}),x(Z),c(we),"string"==typeof le&&(le=document.querySelector(le)),g(Z,A=>{if(le.nodeName!==A.toUpperCase()){const L=r.extname(Z.name).toLowerCase();throw new Error(`Cannot render "${L}" inside a "${le.nodeName.toLowerCase()}" element, expected "${A}"`)}return("video"===A||"audio"===A)&&u(le,we),le},we,ke)},i.append=function(Z,le,we,ke){function L(y){const C=document.createElement(y);return le.appendChild(C),C}if("function"==typeof we&&(ke=we,we={}),we||(we={}),ke||(ke=()=>{}),x(Z),c(we),"string"==typeof le&&(le=document.querySelector(le)),le&&("VIDEO"===le.nodeName||"AUDIO"===le.nodeName))throw new Error("Invalid video/audio node argument. Argument must be root element that video/audio tag will be appended to.");g(Z,function(y){return"video"===y||"audio"===y?function A(y){const C=L(y);return u(C,we),le.appendChild(C),C}(y):L(y)},we,function z(y,C){y&&C&&C.remove(),ke(y,C)})},i.mime=m("./lib/mime.json");const s=m("debug")("render-media"),t=m("is-ascii"),o=m("mediasource"),r=m("path"),d=m("stream-to-blob-url"),h=m("videostream"),l=[".m4a",".m4b",".m4p",".m4v",".mp4"],p=[".m4v",".mkv",".mp4",".webm"],w=[].concat(p,[".m4a",".m4b",".m4p",".mp3"]),b=[".mov",".ogv"],I=[".aac",".oga",".ogg",".wav",".flac"],S=[".bmp",".gif",".jpeg",".jpg",".png",".svg"],R=[".css",".html",".js",".md",".pdf",".srt",".txt"],N=2e8,q=typeof window<"u"&&window.MediaSource},{"./lib/mime.json":242,debug:105,"is-ascii":160,mediasource:172,path:71,"stream-to-blob-url":272,videostream:290}],242:[function(m,B){B.exports={".3gp":"video/3gpp",".aac":"audio/aac",".aif":"audio/x-aiff",".aiff":"audio/x-aiff",".atom":"application/atom+xml",".avi":"video/x-msvideo",".bmp":"image/bmp",".bz2":"application/x-bzip2",".conf":"text/plain",".css":"text/css",".csv":"text/plain",".diff":"text/x-diff",".doc":"application/msword",".flv":"video/x-flv",".gif":"image/gif",".gz":"application/x-gzip",".htm":"text/html",".html":"text/html",".ico":"image/vnd.microsoft.icon",".ics":"text/calendar",".iso":"application/octet-stream",".jar":"application/java-archive",".jpeg":"image/jpeg",".jpg":"image/jpeg",".js":"application/javascript",".json":"application/json",".less":"text/css",".log":"text/plain",".m3u":"audio/x-mpegurl",".m4a":"audio/x-m4a",".m4b":"audio/mp4",".m4p":"audio/mp4",".m4v":"video/x-m4v",".manifest":"text/cache-manifest",".markdown":"text/x-markdown",".mathml":"application/mathml+xml",".md":"text/x-markdown",".mid":"audio/midi",".midi":"audio/midi",".mov":"video/quicktime",".mp3":"audio/mpeg",".mp4":"video/mp4",".mp4v":"video/mp4",".mpeg":"video/mpeg",".mpg":"video/mpeg",".odp":"application/vnd.oasis.opendocument.presentation",".ods":"application/vnd.oasis.opendocument.spreadsheet",".odt":"application/vnd.oasis.opendocument.text",".oga":"audio/ogg",".ogg":"application/ogg",".pdf":"application/pdf",".png":"image/png",".pps":"application/vnd.ms-powerpoint",".ppt":"application/vnd.ms-powerpoint",".ps":"application/postscript",".psd":"image/vnd.adobe.photoshop",".qt":"video/quicktime",".rar":"application/x-rar-compressed",".rdf":"application/rdf+xml",".rss":"application/rss+xml",".rtf":"application/rtf",".svg":"image/svg+xml",".svgz":"image/svg+xml",".swf":"application/x-shockwave-flash",".tar":"application/x-tar",".tbz":"application/x-bzip-compressed-tar",".text":"text/plain",".tif":"image/tiff",".tiff":"image/tiff",".torrent":"application/x-bittorrent",".ttf":"application/x-font-ttf",".txt":"text/plain",".wav":"audio/wav",".webm":"video/webm",".wma":"audio/x-ms-wma",".wmv":"video/x-ms-wmv",".xls":"application/vnd.ms-excel",".xml":"application/xml",".yaml":"text/yaml",".yml":"text/yaml",".zip":"application/zip"}},{}],243:[function(m,B){"use strict";function i(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function g(I,S){return I<>>32-S}function f(I,S,R,N,q,Z,le,we){return 0|g(0|I+(S^R^N)+Z+le,we)+q}function x(I,S,R,N,q,Z,le,we){return 0|g(0|I+(S&R|~S&N)+Z+le,we)+q}function n(I,S,R,N,q,Z,le,we){return 0|g(0|I+((S|~R)^N)+Z+le,we)+q}function c(I,S,R,N,q,Z,le,we){return 0|g(0|I+(S&N|R&~N)+Z+le,we)+q}function u(I,S,R,N,q,Z,le,we){return 0|g(0|I+(S^(R|~N))+Z+le,we)+q}var s=m("buffer").Buffer,t=m("inherits"),o=m("hash-base"),r=Array(16),d=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],h=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],l=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],p=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],w=[0,1518500249,1859775393,2400959708,2840853838],b=[1352829926,1548603684,1836072691,2053994217,0];t(i,o),i.prototype._update=function(){for(var I=r,S=0;16>S;++S)I[S]=this._block.readInt32LE(4*S);for(var R=0|this._a,N=0|this._b,q=0|this._c,Z=0|this._d,le=0|this._e,we=0|this._a,ke=0|this._b,A=0|this._c,L=0|this._d,z=0|this._e,y=0;80>y;y+=1){var C,M;16>y?(C=f(R,N,q,Z,le,I[d[y]],w[0],l[y]),M=u(we,ke,A,L,z,I[h[y]],b[0],p[y])):32>y?(C=x(R,N,q,Z,le,I[d[y]],w[1],l[y]),M=c(we,ke,A,L,z,I[h[y]],b[1],p[y])):48>y?(C=n(R,N,q,Z,le,I[d[y]],w[2],l[y]),M=n(we,ke,A,L,z,I[h[y]],b[2],p[y])):64>y?(C=c(R,N,q,Z,le,I[d[y]],w[3],l[y]),M=x(we,ke,A,L,z,I[h[y]],b[3],p[y])):(C=u(R,N,q,Z,le,I[d[y]],w[4],l[y]),M=f(we,ke,A,L,z,I[h[y]],b[4],p[y])),R=le,le=Z,Z=g(q,10),q=N,N=C,we=z,z=L,L=g(A,10),A=ke,ke=M}var U=0|this._b+q+L;this._b=0|this._c+Z+z,this._c=0|this._d+le+we,this._d=0|this._e+R+ke,this._e=0|this._a+N+A,this._a=U},i.prototype._digest=function(){this._block[this._blockOffset++]=128,56"u"?this:self,f=function(){return function(g){function f(n){if(x[n])return x[n].exports;var c=x[n]={i:n,l:!1,exports:{}};return g[n].call(c.exports,c,c.exports,f),c.l=!0,c.exports}var x={};return f.m=g,f.c=x,f.d=function(n,c,u){f.o(n,c)||Object.defineProperty(n,c,{configurable:!1,enumerable:!0,get:u})},f.n=function(n){var c=n&&n.__esModule?function(){return n.default}:function(){return n};return f.d(c,"a",c),c},f.o=function(n,c){return Object.prototype.hasOwnProperty.call(n,c)},f.p="",f(f.s=3)}([function(g,f,x){var c=x(5),u=x(1),s=u.toHex,t=u.ceilHeapSize,o=x(6),r=function(w){for(w+=9;0>2);return function(w,b){var I=new Uint8Array(w.buffer),S=b%4,R=b-S;switch(S){case 0:I[R+3]=0;case 1:I[R+2]=0;case 2:I[R+1]=0;case 3:I[R+0]=0}for(var N=1+(b>>2);N>2]|=128<<24-(b%4<<3),w[14+(-16&2+(b>>2))]=0|I/536870912,w[15+(-16&2+(b>>2))]=I<<3}(R,b,I),S},w.prototype._write=function(b,I,S,R){o(b,this._h8,this._h32,I,S,R||0)},w.prototype._coreCall=function(b,I,S,R,N){var q=S;this._write(b,I,S),N&&(q=this._padChunk(S,R)),this._core.hash(q,this._padMaxChunkLen)},w.prototype.rawDigest=function(b){var I=b.byteLength||b.length||b.size||0;this._initState(this._heap,this._padMaxChunkLen);var S=0,R=this._maxChunkLen;for(S=0;I>S+R;S+=R)this._coreCall(b,S,R,I,!1);return this._coreCall(b,S,I-S,I,!0),l(this._heap,this._padMaxChunkLen)},w.prototype.digest=function(b){return s(this.rawDigest(b).buffer)},w.prototype.digestFromString=function(b){return this.digest(b)},w.prototype.digestFromBuffer=function(b){return this.digest(b)},w.prototype.digestFromArrayBuffer=function(b){return this.digest(b)},w.prototype.resetState=function(){return this._initState(this._heap,this._padMaxChunkLen),this},w.prototype.append=function(b){var I=0,S=b.byteLength||b.length||b.size||0,R=this._offset%this._maxChunkLen,N=void 0;for(this._offset+=S;Ix;x++)f[x]=(16>x?"0":"")+x.toString(16);g.exports.toHex=function(n){for(var c=new Uint8Array(n),u=Array(n.byteLength),s=0;s=n)return 65536;if(16777216>n)for(c=1;c>2],h=0|c[s+324>>2],p=0|c[s+328>>2],b=0|c[s+332>>2],S=0|c[s+336>>2],t=0;(0|t)<(0|u);t=0|t+64){for(d=r,l=h,w=p,I=b,R=S,o=0;64>(0|o);o=0|o+4)N=0|(0|(r<<5|r>>>27)+(h&p|~h&b))+(0|1518500249+(0|(q=0|c[t+o>>2])+S)),S=b,b=p,p=h<<30|h>>>2,h=r,r=N,c[u+o>>2]=q;for(o=0|u+64;(0|o)<(0|u+80);o=0|o+4)N=0|(0|(r<<5|r>>>27)+(h&p|~h&b))+(0|1518500249+(0|(q=(c[o-12>>2]^c[o-32>>2]^c[o-56>>2]^c[o-64>>2])<<1|(c[o-12>>2]^c[o-32>>2]^c[o-56>>2]^c[o-64>>2])>>>31)+S)),S=b,b=p,p=h<<30|h>>>2,h=r,r=N,c[o>>2]=q;for(o=0|u+80;(0|o)<(0|u+160);o=0|o+4)N=0|(0|(r<<5|r>>>27)+(h^p^b))+(0|1859775393+(0|(q=(c[o-12>>2]^c[o-32>>2]^c[o-56>>2]^c[o-64>>2])<<1|(c[o-12>>2]^c[o-32>>2]^c[o-56>>2]^c[o-64>>2])>>>31)+S)),S=b,b=p,p=h<<30|h>>>2,h=r,r=N,c[o>>2]=q;for(o=0|u+160;(0|o)<(0|u+240);o=0|o+4)N=0|(0|(r<<5|r>>>27)+(h&p|h&b|p&b))+(0|(0|(q=(c[o-12>>2]^c[o-32>>2]^c[o-56>>2]^c[o-64>>2])<<1|(c[o-12>>2]^c[o-32>>2]^c[o-56>>2]^c[o-64>>2])>>>31)+S)-1894007588),S=b,b=p,p=h<<30|h>>>2,h=r,r=N,c[o>>2]=q;for(o=0|u+240;(0|o)<(0|u+320);o=0|o+4)N=0|(0|(r<<5|r>>>27)+(h^p^b))+(0|(0|(q=(c[o-12>>2]^c[o-32>>2]^c[o-56>>2]^c[o-64>>2])<<1|(c[o-12>>2]^c[o-32>>2]^c[o-56>>2]^c[o-64>>2])>>>31)+S)-899497514),S=b,b=p,p=h<<30|h>>>2,h=r,r=N,c[o>>2]=q;r=0|r+d,h=0|h+l,p=0|p+w,b=0|b+I,S=0|S+R}c[s+320>>2]=r,c[s+324>>2]=h,c[s+328>>2]=p,c[s+332>>2]=b,c[s+336>>2]=S}}}},function(g){var f=this,x=void 0;typeof self<"u"&&typeof self.FileReaderSync<"u"&&(x=new self.FileReaderSync);var c=function(s,t,o,r,d,h){var b,l=h%4,p=(d+l)%4,w=d-p;switch(l){case 0:t[h]=s[r+3];case 1:t[0|h+1-(l<<1)]=s[r+2];case 2:t[0|h+2-(l<<1)]=s[r+1];case 3:t[0|h+3-(l<<1)]=s[r]}if(!(d>2]=s[r+b]<<24|s[r+b+1]<<16|s[r+b+2]<<8|s[r+b+3];switch(p){case 3:t[0|h+w+1]=s[r+w+2];case 2:t[0|h+w+2]=s[r+w+1];case 1:t[0|h+w+3]=s[r+w]}}};g.exports=function(s,t,o,r,d,h){if("string"==typeof s)return function(s,t,o,r,d,h){var b,l=h%4,p=(d+l)%4,w=d-p;switch(l){case 0:t[h]=s.charCodeAt(r+3);case 1:t[0|h+1-(l<<1)]=s.charCodeAt(r+2);case 2:t[0|h+2-(l<<1)]=s.charCodeAt(r+1);case 3:t[0|h+3-(l<<1)]=s.charCodeAt(r)}if(!(d>2]=s.charCodeAt(r+b)<<24|s.charCodeAt(r+b+1)<<16|s.charCodeAt(r+b+2)<<8|s.charCodeAt(r+b+3);switch(p){case 3:t[0|h+w+1]=s.charCodeAt(r+w+2);case 2:t[0|h+w+2]=s.charCodeAt(r+w+1);case 1:t[0|h+w+3]=s.charCodeAt(r+w)}}}(s,t,o,r,d,h);if(s instanceof Array||f&&f.Buffer&&f.Buffer.isBuffer(s))return c(s,t,o,r,d,h);if(s instanceof ArrayBuffer)return c(new Uint8Array(s),t,o,r,d,h);if(s.buffer instanceof ArrayBuffer)return c(new Uint8Array(s.buffer,s.byteOffset,s.byteLength),t,o,r,d,h);if(s instanceof Blob)return function(s,t,o,r,d,h){var l=void 0,p=h%4,w=(d+p)%4,b=d-w,I=new Uint8Array(x.readAsArrayBuffer(s.slice(r,r+d)));switch(p){case 0:t[h]=I[3];case 1:t[0|h+1-(p<<1)]=I[2];case 2:t[0|h+2-(p<<1)]=I[1];case 3:t[0|h+3-(p<<1)]=I[0]}if(!(d>2]=I[l]<<24|I[l+1]<<16|I[l+2]<<8|I[l+3];switch(w){case 3:t[0|h+b+1]=I[b+2];case 2:t[0|h+b+2]=I[b+1];case 1:t[0|h+b+3]=I[b]}}}(s,t,o,r,d,h);throw new Error("Unsupported data type.")}},function(g,f,x){var c=function(){function r(d,h){for(var p,l=0;l"u")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof u);return f(u,s,t)}),c.alloc||(c.alloc=function(u,s,t){if("number"!=typeof u)throw new TypeError('The "size" argument must be of type number. Received type '+typeof u);if(0>u||2147483648<=u)throw new RangeError('The value "'+u+'" is invalid for option "size"');var o=f(u);return s&&0!==s.length?"string"==typeof t?o.fill(s,t):o.fill(s):o.fill(0),o}),!x.kStringMaxLength)try{x.kStringMaxLength=i.binding("buffer").kStringMaxLength}catch{}x.constants||(x.constants={MAX_LENGTH:x.kMaxLength},x.kStringMaxLength&&(x.constants.MAX_STRING_LENGTH=x.kStringMaxLength)),B.exports=x}).call(this)}).call(this,m("_process"))},{_process:205,buffer:69}],249:[function(m,B){function i(f,x){this._block=g.alloc(f),this._finalSize=x,this._blockSize=f,this._len=0}var g=m("safe-buffer").Buffer;i.prototype.update=function(f,x){"string"==typeof f&&(f=g.from(f,x=x||"utf8"));for(var n=this._block,c=this._blockSize,u=f.length,s=this._len,t=0;t=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(4294967295>=n)this._block.writeUInt32BE(n,this._blockSize-4);else{var c=(4294967295&n)>>>0;this._block.writeUInt32BE((n-c)/4294967296,this._blockSize-8),this._block.writeUInt32BE(c,this._blockSize-4)}this._update(this._block);var u=this._hash();return f?u.toString(f):u},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},B.exports=i},{"safe-buffer":247}],250:[function(m,B,g){(g=B.exports=function(f){f=f.toLowerCase();var x=g[f];if(!x)throw new Error(f+" is not supported (we accept pull requests)");return new x}).sha=m("./sha"),g.sha1=m("./sha1"),g.sha224=m("./sha224"),g.sha256=m("./sha256"),g.sha384=m("./sha384"),g.sha512=m("./sha512")},{"./sha":251,"./sha1":252,"./sha224":253,"./sha256":254,"./sha384":255,"./sha512":256}],251:[function(m,B){function i(){this.init(),this._w=t,c.call(this,64,56)}function g(o){return o<<5|o>>>27}function f(o){return o<<30|o>>>2}function x(o,r,d,h){return 0===o?r&d|~r&h:2===o?r&d|r&h|d&h:r^d^h}var n=m("inherits"),c=m("./hash"),u=m("safe-buffer").Buffer,s=[1518500249,1859775393,-1894007588,-899497514],t=Array(80);n(i,c),i.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},i.prototype._update=function(o){for(var r=this._w,d=0|this._a,h=0|this._b,l=0|this._c,p=0|this._d,w=0|this._e,b=0;16>b;++b)r[b]=o.readInt32BE(4*b);for(;80>b;++b)r[b]=r[b-3]^r[b-8]^r[b-14]^r[b-16];for(var I=0;80>I;++I){var S=~~(I/20),R=0|g(d)+x(S,h,l,p)+w+r[I]+s[S];w=p,p=l,l=f(h),h=d,d=R}this._a=0|d+this._a,this._b=0|h+this._b,this._c=0|l+this._c,this._d=0|p+this._d,this._e=0|w+this._e},i.prototype._hash=function(){var o=u.allocUnsafe(20);return o.writeInt32BE(0|this._a,0),o.writeInt32BE(0|this._b,4),o.writeInt32BE(0|this._c,8),o.writeInt32BE(0|this._d,12),o.writeInt32BE(0|this._e,16),o},B.exports=i},{"./hash":249,inherits:159,"safe-buffer":247}],252:[function(m,B){function i(){this.init(),this._w=o,u.call(this,64,56)}function g(r){return r<<1|r>>>31}function f(r){return r<<5|r>>>27}function x(r){return r<<30|r>>>2}function n(r,d,h,l){return 0===r?d&h|~d&l:2===r?d&h|d&l|h&l:d^h^l}var c=m("inherits"),u=m("./hash"),s=m("safe-buffer").Buffer,t=[1518500249,1859775393,-1894007588,-899497514],o=Array(80);c(i,u),i.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},i.prototype._update=function(r){for(var d=this._w,h=0|this._a,l=0|this._b,p=0|this._c,w=0|this._d,b=0|this._e,I=0;16>I;++I)d[I]=r.readInt32BE(4*I);for(;80>I;++I)d[I]=g(d[I-3]^d[I-8]^d[I-14]^d[I-16]);for(var S=0;80>S;++S){var R=~~(S/20),N=0|f(h)+n(R,l,p,w)+b+d[S]+t[R];b=w,w=p,p=x(l),l=h,h=N}this._a=0|h+this._a,this._b=0|l+this._b,this._c=0|p+this._c,this._d=0|w+this._d,this._e=0|b+this._e},i.prototype._hash=function(){var r=s.allocUnsafe(20);return r.writeInt32BE(0|this._a,0),r.writeInt32BE(0|this._b,4),r.writeInt32BE(0|this._c,8),r.writeInt32BE(0|this._d,12),r.writeInt32BE(0|this._e,16),r},B.exports=i},{"./hash":249,inherits:159,"safe-buffer":247}],253:[function(m,B){function i(){this.init(),this._w=c,x.call(this,64,56)}var g=m("inherits"),f=m("./sha256"),x=m("./hash"),n=m("safe-buffer").Buffer,c=Array(64);g(i,f),i.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},i.prototype._hash=function(){var u=n.allocUnsafe(28);return u.writeInt32BE(this._a,0),u.writeInt32BE(this._b,4),u.writeInt32BE(this._c,8),u.writeInt32BE(this._d,12),u.writeInt32BE(this._e,16),u.writeInt32BE(this._f,20),u.writeInt32BE(this._g,24),u},B.exports=i},{"./hash":249,"./sha256":254,inherits:159,"safe-buffer":247}],254:[function(m,B){function i(){this.init(),this._w=d,t.call(this,64,56)}function g(h,l,p){return p^h&(l^p)}function f(h,l,p){return h&l|p&(h|l)}function x(h){return(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10)}function n(h){return(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7)}function c(h){return(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3}function u(h){return(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10}var s=m("inherits"),t=m("./hash"),o=m("safe-buffer").Buffer,r=[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],d=Array(64);s(i,t),i.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},i.prototype._update=function(h){for(var l=this._w,p=0|this._a,w=0|this._b,b=0|this._c,I=0|this._d,S=0|this._e,R=0|this._f,N=0|this._g,q=0|this._h,Z=0;16>Z;++Z)l[Z]=h.readInt32BE(4*Z);for(;64>Z;++Z)l[Z]=0|u(l[Z-2])+l[Z-7]+c(l[Z-15])+l[Z-16];for(var le=0;64>le;++le){var we=0|q+n(S)+g(S,R,N)+r[le]+l[le],ke=0|x(p)+f(p,w,b);q=N,N=R,R=S,S=0|I+we,I=b,b=w,w=p,p=0|we+ke}this._a=0|p+this._a,this._b=0|w+this._b,this._c=0|b+this._c,this._d=0|I+this._d,this._e=0|S+this._e,this._f=0|R+this._f,this._g=0|N+this._g,this._h=0|q+this._h},i.prototype._hash=function(){var h=o.allocUnsafe(32);return h.writeInt32BE(this._a,0),h.writeInt32BE(this._b,4),h.writeInt32BE(this._c,8),h.writeInt32BE(this._d,12),h.writeInt32BE(this._e,16),h.writeInt32BE(this._f,20),h.writeInt32BE(this._g,24),h.writeInt32BE(this._h,28),h},B.exports=i},{"./hash":249,inherits:159,"safe-buffer":247}],255:[function(m,B){function i(){this.init(),this._w=c,x.call(this,128,112)}var g=m("inherits"),f=m("./sha512"),x=m("./hash"),n=m("safe-buffer").Buffer,c=Array(160);g(i,f),i.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},i.prototype._hash=function(){function u(t,o,r){s.writeInt32BE(t,r),s.writeInt32BE(o,r+4)}var s=n.allocUnsafe(48);return u(this._ah,this._al,0),u(this._bh,this._bl,8),u(this._ch,this._cl,16),u(this._dh,this._dl,24),u(this._eh,this._el,32),u(this._fh,this._fl,40),s},B.exports=i},{"./hash":249,"./sha512":256,inherits:159,"safe-buffer":247}],256:[function(m,B){function i(){this.init(),this._w=p,d.call(this,128,112)}function g(w,b,I){return I^w&(b^I)}function f(w,b,I){return w&b|I&(w|b)}function x(w,b){return(w>>>28|b<<4)^(b>>>2|w<<30)^(b>>>7|w<<25)}function n(w,b){return(w>>>14|b<<18)^(w>>>18|b<<14)^(b>>>9|w<<23)}function c(w,b){return(w>>>1|b<<31)^(w>>>8|b<<24)^w>>>7}function u(w,b){return(w>>>1|b<<31)^(w>>>8|b<<24)^(w>>>7|b<<25)}function s(w,b){return(w>>>19|b<<13)^(b>>>29|w<<3)^w>>>6}function t(w,b){return(w>>>19|b<<13)^(b>>>29|w<<3)^(w>>>6|b<<26)}function o(w,b){return w>>>0>>0?1:0}var r=m("inherits"),d=m("./hash"),h=m("safe-buffer").Buffer,l=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],p=Array(160);r(i,d),i.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},i.prototype._update=function(w){for(var b=this._w,I=0|this._ah,S=0|this._bh,R=0|this._ch,N=0|this._dh,q=0|this._eh,Z=0|this._fh,le=0|this._gh,we=0|this._hh,ke=0|this._al,A=0|this._bl,L=0|this._cl,z=0|this._dl,y=0|this._el,C=0|this._fl,M=0|this._gl,U=0|this._hl,ee=0;32>ee;ee+=2)b[ee]=w.readInt32BE(4*ee),b[ee+1]=w.readInt32BE(4*ee+4);for(;160>ee;ee+=2){var J=b[ee-30],re=b[ee-30+1],Ue=c(J,re),We=u(re,J),Qe=s(J=b[ee-4],re=b[ee-4+1]),ft=t(re,J),It=b[ee-32],Ft=b[ee-32+1],Ke=0|We+b[ee-14+1],mt=0|Ue+b[ee-14]+o(Ke,We);mt=0|(mt=0|mt+Qe+o(Ke=0|Ke+ft,ft))+It+o(Ke=0|Ke+Ft,Ft),b[ee]=mt,b[ee+1]=Ke}for(var St=0;160>St;St+=2){mt=b[St],Ke=b[St+1];var K=f(I,S,R),se=f(ke,A,L),X=x(I,ke),ce=x(ke,I),Je=n(q,y),ie=n(y,q),pe=l[St],Ye=l[St+1],at=g(q,Z,le),dt=g(y,C,M),Gt=0|U+ie,Jt=0|we+Je+o(Gt,U);Jt=0|(Jt=0|(Jt=0|Jt+at+o(Gt=0|Gt+dt,dt))+pe+o(Gt=0|Gt+Ye,Ye))+mt+o(Gt=0|Gt+Ke,Ke);var an=0|ce+se,Cn=0|X+K+o(an,ce);we=le,U=M,le=Z,M=C,Z=q,C=y,q=0|N+Jt+o(y=0|z+Gt,z),N=R,z=L,R=S,L=A,S=I,A=ke,I=0|Jt+Cn+o(ke=0|Gt+an,Gt)}this._al=0|this._al+ke,this._bl=0|this._bl+A,this._cl=0|this._cl+L,this._dl=0|this._dl+z,this._el=0|this._el+y,this._fl=0|this._fl+C,this._gl=0|this._gl+M,this._hl=0|this._hl+U,this._ah=0|this._ah+I+o(this._al,ke),this._bh=0|this._bh+S+o(this._bl,A),this._ch=0|this._ch+R+o(this._cl,L),this._dh=0|this._dh+N+o(this._dl,z),this._eh=0|this._eh+q+o(this._el,y),this._fh=0|this._fh+Z+o(this._fl,C),this._gh=0|this._gh+le+o(this._gl,M),this._hh=0|this._hh+we+o(this._hl,U)},i.prototype._hash=function(){function w(I,S,R){b.writeInt32BE(I,R),b.writeInt32BE(S,R+4)}var b=h.allocUnsafe(64);return w(this._ah,this._al,0),w(this._bh,this._bl,8),w(this._ch,this._cl,16),w(this._dh,this._dl,24),w(this._eh,this._el,32),w(this._fh,this._fl,40),w(this._gh,this._gl,48),w(this._hh,this._hl,56),b},B.exports=i},{"./hash":249,inherits:159,"safe-buffer":247}],257:[function(m,B){(function(i){(function(){B.exports=function(g,f){var x=[];g.on("data",function(n){x.push(n)}),g.once("end",function(){f&&f(null,i.concat(x)),f=null}),g.once("error",function(n){f&&f(n),f=null})}}).call(this)}).call(this,m("buffer").Buffer)},{buffer:69}],258:[function(m,B){(function(i){(function(){function g(r,d){if(r=Object.assign({maxRedirects:10},"string"==typeof r?{url:r}:r),d=u(d),r.url){const{hostname:b,port:I,protocol:S,auth:R,path:N}=t.parse(r.url);delete r.url,b||I||S||R?Object.assign(r,{hostname:b,port:I,protocol:S,auth:R,path:N}):r.path=N}const h={"accept-encoding":"gzip, deflate"};let l;r.headers&&Object.keys(r.headers).forEach(b=>h[b.toLowerCase()]=r.headers[b]),r.headers=h,r.body?l=r.json&&!o(r.body)?JSON.stringify(r.body):r.body:r.form&&(l="string"==typeof r.form?r.form:s.stringify(r.form),r.headers["content-type"]="application/x-www-form-urlencoded"),l&&(!r.method&&(r.method="POST"),!o(l)&&(r.headers["content-length"]=i.byteLength(l)),r.json&&!r.form&&(r.headers["content-type"]="application/json")),delete r.body,delete r.form,r.json&&(r.headers.accept="application/json"),r.method&&(r.method=r.method.toUpperCase());const w=("https:"===r.protocol?c:n).request(r,b=>{if(!1!==r.followRedirects&&300<=b.statusCode&&400>b.statusCode&&b.headers.location)return r.url=b.headers.location,delete r.headers.host,b.resume(),"POST"===r.method&&[301,302].includes(b.statusCode)&&(r.method="GET",delete r.headers["content-length"],delete r.headers["content-type"]),0==r.maxRedirects--?d(new Error("too many redirects")):g(r,d);d(null,"function"==typeof x&&"HEAD"!==r.method?x(b):b)});return w.on("timeout",()=>{w.abort(),d(new Error("Request timed out"))}),w.on("error",d),o(l)?l.on("error",d).pipe(w):w.end(l),w}B.exports=g;const f=m("simple-concat"),x=m("decompress-response"),n=m("http"),c=m("https"),u=m("once"),s=m("querystring"),t=m("url"),o=r=>null!==r&&"object"==typeof r&&"function"==typeof r.pipe;g.concat=(r,d)=>g(r,(h,l)=>h?d(h):void f(l,(p,w)=>{if(p)return d(p);if(r.json)try{w=JSON.parse(w.toString())}catch(b){return d(b,l,w)}d(null,l,w)})),["get","post","put","patch","head","delete"].forEach(r=>{g[r]=(d,h)=>("string"==typeof d&&(d={url:d}),g(Object.assign({method:r.toUpperCase()},d),h))})}).call(this)}).call(this,m("buffer").Buffer)},{buffer:69,"decompress-response":41,http:268,https:156,once:191,querystring:217,"simple-concat":257,url:285}],259:[function(m,B){function i(d){return d.replace(/a=ice-options:trickle\s\n/g,"")}const f=m("debug")("simple-peer"),x=m("get-browser-rtc"),n=m("randombytes"),c=m("readable-stream"),u=m("queue-microtask"),s=m("err-code"),{Buffer:t}=m("buffer"),o=65536;class r extends c.Duplex{constructor(h){if(super(h=Object.assign({allowHalfOpen:!1},h)),this._id=n(4).toString("hex").slice(0,7),this._debug("new peer %o",h),this.channelName=h.initiator?h.channelName||n(20).toString("hex"):null,this.initiator=h.initiator||!1,this.channelConfig=h.channelConfig||r.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},r.config,h.config),this.offerOptions=h.offerOptions||{},this.answerOptions=h.answerOptions||{},this.sdpTransform=h.sdpTransform||(l=>l),this.streams=h.streams||(h.stream?[h.stream]:[]),this.trickle=void 0===h.trickle||h.trickle,this.allowHalfTrickle=void 0!==h.allowHalfTrickle&&h.allowHalfTrickle,this.iceCompleteTimeout=h.iceCompleteTimeout||5e3,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=h.wrtc&&"object"==typeof h.wrtc?h.wrtc:x(),!this._wrtc)throw s(typeof window>"u"?new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"):new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(l){return void this.destroy(s(l,"ERR_PC_CONSTRUCTOR"))}this._isReactNativeWebrtc="number"==typeof this._pc._peerConnectionId,this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=l=>{this._onIceCandidate(l)},"object"==typeof this._pc.peerIdentity&&this._pc.peerIdentity.catch(l=>{this.destroy(s(l,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=l=>{this._setupData(l)},this.streams&&this.streams.forEach(l=>{this.addStream(l)}),this._pc.ontrack=l=>{this._onTrack(l)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&"open"===this._channel.readyState}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(h){if(!this.destroying){if(this.destroyed)throw s(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if("string"==typeof h)try{h=JSON.parse(h)}catch{h={}}this._debug("signal()"),h.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),h.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(h.transceiverRequest.kind,h.transceiverRequest.init)),h.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(h.candidate):this._pendingCandidates.push(h.candidate)),h.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(h)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(l=>{this._addIceCandidate(l)}),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())}).catch(l=>{this.destroy(s(l,"ERR_SET_REMOTE_DESCRIPTION"))}),h.sdp||h.candidate||h.renegotiate||h.transceiverRequest||this.destroy(s(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(h){const l=new this._wrtc.RTCIceCandidate(h);this._pc.addIceCandidate(l).catch(p=>{!l.address||l.address.endsWith(".local")?function g(d){console.warn(d)}("Ignoring unsupported ICE candidate."):this.destroy(s(p,"ERR_ADD_ICE_CANDIDATE"))})}send(h){if(!this.destroying){if(this.destroyed)throw s(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(h)}}addTransceiver(h,l){if(!this.destroying){if(this.destroyed)throw s(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(h,l),this._needsNegotiation()}catch(p){this.destroy(s(p,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:h,init:l}})}}addStream(h){if(!this.destroying){if(this.destroyed)throw s(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),h.getTracks().forEach(l=>{this.addTrack(l,h)})}}addTrack(h,l){if(this.destroying)return;if(this.destroyed)throw s(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");const p=this._senderMap.get(h)||new Map;let w=p.get(l);if(w)throw w.removed?s(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):s(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED");w=this._pc.addTrack(h,l),p.set(l,w),this._senderMap.set(h,p),this._needsNegotiation()}replaceTrack(h,l,p){if(this.destroying)return;if(this.destroyed)throw s(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");const w=this._senderMap.get(h),b=w?w.get(p):null;if(!b)throw s(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");l&&this._senderMap.set(l,w),null==b.replaceTrack?this.destroy(s(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK")):b.replaceTrack(l)}removeTrack(h,l){if(this.destroying)return;if(this.destroyed)throw s(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");const p=this._senderMap.get(h),w=p?p.get(l):null;if(!w)throw s(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{w.removed=!0,this._pc.removeTrack(w)}catch(b){"NS_ERROR_UNEXPECTED"===b.name?this._sendersAwaitingStable.push(w):this.destroy(s(b,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(h){if(!this.destroying){if(this.destroyed)throw s(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),h.getTracks().forEach(l=>{this.removeTrack(l,h)})}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,u(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw s(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(h){this._destroy(h,()=>{})}_destroy(h,l){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",h&&(h.message||h)),u(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",h&&(h.message||h)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch{}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch{}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,h&&this.emit("error",h),this.emit("close"),l()}))}_setupData(h){if(!h.channel)return this.destroy(s(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=h.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=o),this.channelName=this._channel.label,this._channel.onmessage=p=>{this._onChannelMessage(p)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=p=>{const w=p.error instanceof Error?p.error:new Error(`Datachannel error: ${p.message} ${p.filename}:${p.lineno}:${p.colno}`);this.destroy(s(w,"ERR_DATA_CHANNEL"))};let l=!1;this._closingInterval=setInterval(()=>{this._channel&&"closing"===this._channel.readyState?(l&&this._onChannelClose(),l=!0):l=!1},5e3)}_read(){}_write(h,l,p){if(this.destroyed)return p(s(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(h)}catch(w){return this.destroy(s(w,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>o?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=p):p(null)}else this._debug("write before connect"),this._chunk=h,this._cb=p}_onFinish(){if(!this.destroyed){const h=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?h():this.once("connect",h)}}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(h=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(h.sdp=i(h.sdp)),h.sdp=this.sdpTransform(h.sdp);const l=()=>{if(!this.destroyed){const p=this._pc.localDescription||h;this._debug("signal"),this.emit("signal",{type:p.type,sdp:p.sdp})}};this._pc.setLocalDescription(h).then(()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?l():this.once("_iceComplete",l))}).catch(p=>{this.destroy(s(p,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(h=>{this.destroy(s(h,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(h=>{h.mid||!h.sender.track||h.requested||(h.requested=!0,this.addTransceiver(h.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(h=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(h.sdp=i(h.sdp)),h.sdp=this.sdpTransform(h.sdp);const l=()=>{if(!this.destroyed){const p=this._pc.localDescription||h;this._debug("signal"),this.emit("signal",{type:p.type,sdp:p.sdp}),this.initiator||this._requestMissingTransceivers()}};this._pc.setLocalDescription(h).then(()=>{this.destroyed||(this.trickle||this._iceComplete?l():this.once("_iceComplete",l))}).catch(p=>{this.destroy(s(p,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(h=>{this.destroy(s(h,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||"failed"===this._pc.connectionState&&this.destroy(s(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const h=this._pc.iceConnectionState,l=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",h,l),this.emit("iceStateChange",h,l),("connected"===h||"completed"===h)&&(this._pcReady=!0,this._maybeReady()),"failed"===h&&this.destroy(s(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===h&&this.destroy(s(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(h){const l=p=>("[object Array]"===Object.prototype.toString.call(p.values)&&p.values.forEach(w=>{Object.assign(p,w)}),p);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then(p=>{const w=[];p.forEach(b=>{w.push(l(b))}),h(null,w)},p=>h(p)):0{if(this.destroyed)return;const w=[];p.result().forEach(b=>{const I={};b.names().forEach(S=>{I[S]=b.stat(S)}),I.id=b.id,I.type=b.type,I.timestamp=b.timestamp,w.push(l(I))}),h(null,w)},p=>h(p)):h(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const h=()=>{this.destroyed||this.getStats((l,p)=>{if(this.destroyed)return;l&&(p=[]);const w={},b={},I={};let S=!1;p.forEach(N=>{("remotecandidate"===N.type||"remote-candidate"===N.type)&&(w[N.id]=N),("localcandidate"===N.type||"local-candidate"===N.type)&&(b[N.id]=N),("candidatepair"===N.type||"candidate-pair"===N.type)&&(I[N.id]=N)});const R=N=>{S=!0;let q=b[N.localCandidateId];q&&(q.ip||q.address)?(this.localAddress=q.ip||q.address,this.localPort=+q.port):q&&q.ipAddress?(this.localAddress=q.ipAddress,this.localPort=+q.portNumber):"string"==typeof N.googLocalAddress&&(q=N.googLocalAddress.split(":"),this.localAddress=q[0],this.localPort=+q[1]),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let Z=w[N.remoteCandidateId];Z&&(Z.ip||Z.address)?(this.remoteAddress=Z.ip||Z.address,this.remotePort=+Z.port):Z&&Z.ipAddress?(this.remoteAddress=Z.ipAddress,this.remotePort=+Z.portNumber):"string"==typeof N.googRemoteAddress&&(Z=N.googRemoteAddress.split(":"),this.remoteAddress=Z[0],this.remotePort=+Z[1]),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(p.forEach(N=>{"transport"===N.type&&N.selectedCandidatePairId&&R(I[N.selectedCandidatePairId]),("googCandidatePair"===N.type&&"true"===N.googActiveConnection||("candidatepair"===N.type||"candidate-pair"===N.type)&&N.selected)&&R(N)}),S||Object.keys(I).length&&!Object.keys(b).length){if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(q){return this.destroy(s(q,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const N=this._cb;this._cb=null,N(null)}"number"!=typeof this._channel.bufferedAmountLowThreshold&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}else setTimeout(h,100)})};h()}_onInterval(){this._cb&&this._channel&&!(this._channel.bufferedAmount>o)&&this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||("stable"===this._pc.signalingState&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(h=>{this._pc.removeTrack(h),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(h){this.destroyed||(h.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:h.candidate.candidate,sdpMLineIndex:h.candidate.sdpMLineIndex,sdpMid:h.candidate.sdpMid}}):!h.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit("_iceComplete")),h.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(h){if(this.destroyed)return;let l=h.data;l instanceof ArrayBuffer&&(l=t.from(l)),this.push(l)}_onChannelBufferedAmountLow(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const h=this._cb;this._cb=null,h(null)}}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(h){this.destroyed||h.streams.forEach(l=>{this._debug("on track"),this.emit("track",h.track,l),this._remoteTracks.push({track:h.track,stream:l}),this._remoteStreams.some(p=>p.id===l.id)||(this._remoteStreams.push(l),u(()=>{this._debug("on stream"),this.emit("stream",l)}))})}_debug(){const h=[].slice.call(arguments);h[0]="["+this._id+"] "+h[0],f.apply(null,h)}}r.WEBRTC_SUPPORT=!!x(),r.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},r.channelConfig={},B.exports=r},{buffer:69,debug:105,"err-code":136,"get-browser-rtc":141,"queue-microtask":218,randombytes:221,"readable-stream":240}],260:[function(m,B){function i(r){return u.digest(r)}const n=m("rusha"),c=m("./rusha-worker-sha1"),u=new n,s=typeof window>"u"?self:window,t=s.crypto||s.msCrypto||{};let o=t.subtle||t.webkitSubtle;try{o.digest({name:"sha-1"},new Uint8Array).catch(function(){o=!1})}catch{o=!1}B.exports=function g(r,d){return o?("string"==typeof r&&(r=function f(r){const d=r.length,h=new Uint8Array(d);for(let l=0;l>>4).toString(16)),h.push((15&p).toString(16))}return h.join("")}(new Uint8Array(h)))},function(){d(i(r))})):void(typeof window>"u"?queueMicrotask(()=>d(i(r))):c(r,function(h,l){return h?void d(i(r)):void d(l)}))},B.exports.sync=i},{"./rusha-worker-sha1":261,rusha:246}],261:[function(m,B){const f=m("rusha");let x,n,c;B.exports=function g(u,s){x||function i(){x=f.createWorker(),n=1,c={},x.onmessage=function(u){const s=u.data.id,t=c[s];delete c[s],null==u.data.error?t(null,u.data.hash):t(new Error("Rusha worker error: "+u.data.error))}}(),c[n]=s,x.postMessage({id:n,data:u}),n+=1}},{rusha:246}],262:[function(m,B){(function(i){(function(){const g=m("debug")("simple-websocket"),f=m("randombytes"),x=m("readable-stream"),n=m("queue-microtask"),c=m("ws"),u="function"==typeof c?c:WebSocket;class t extends x.Duplex{constructor(r={}){if("string"==typeof r&&(r={url:r}),super(r=Object.assign({allowHalfOpen:!1},r)),null==r.url&&null==r.socket)throw new Error("Missing required `url` or `socket` option");if(null!=r.url&&null!=r.socket)throw new Error("Must specify either `url` or `socket` option, not both");if(this._id=f(4).toString("hex").slice(0,7),this._debug("new websocket: %o",r),this.connected=!1,this.destroyed=!1,this._chunk=null,this._cb=null,this._interval=null,r.socket)this.url=r.socket.url,this._ws=r.socket,this.connected=r.socket.readyState===u.OPEN;else{this.url=r.url;try{this._ws="function"==typeof c?new u(r.url,null,{...r,encoding:void 0}):new u(r.url)}catch(d){return void n(()=>this.destroy(d))}}this._ws.binaryType="arraybuffer",r.socket&&this.connected?n(()=>this._handleOpen()):this._ws.onopen=()=>this._handleOpen(),this._ws.onmessage=d=>this._handleMessage(d),this._ws.onclose=()=>this._handleClose(),this._ws.onerror=d=>this._handleError(d),this._handleFinishBound=()=>this._handleFinish(),this.once("finish",this._handleFinishBound)}send(r){this._ws.send(r)}destroy(r){this._destroy(r,()=>{})}_destroy(r,d){if(!this.destroyed){if(this._debug("destroy (error: %s)",r&&(r.message||r)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this.connected=!1,this.destroyed=!0,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._handleFinishBound&&this.removeListener("finish",this._handleFinishBound),this._handleFinishBound=null,this._ws){const h=this._ws,l=()=>{h.onclose=null};if(h.readyState===u.CLOSED)l();else try{h.onclose=l,h.close()}catch{l()}h.onopen=null,h.onmessage=null,h.onerror=()=>{}}this._ws=null,r&&this.emit("error",r),this.emit("close"),d()}}_read(){}_write(r,d,h){if(this.destroyed)return h(new Error("cannot write after socket is destroyed"));if(this.connected){try{this.send(r)}catch(l){return this.destroy(l)}"function"!=typeof c&&this._ws.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._ws.bufferedAmount),this._cb=h):h(null)}else this._debug("write before connect"),this._chunk=r,this._cb=h}_handleOpen(){if(!this.connected&&!this.destroyed){if(this.connected=!0,this._chunk){try{this.send(this._chunk)}catch(d){return this.destroy(d)}this._chunk=null,this._debug('sent chunk from "write before connect"');const r=this._cb;this._cb=null,r(null)}"function"!=typeof c&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}}_handleMessage(r){if(this.destroyed)return;let d=r.data;d instanceof ArrayBuffer&&(d=i.from(d)),this.push(d)}_handleClose(){this.destroyed||(this._debug("on close"),this.destroy())}_handleError(){this.destroy(new Error(`Error connecting to ${this.url}`))}_handleFinish(){if(!this.destroyed){const r=()=>{setTimeout(()=>this.destroy(),1e3)};this.connected?r():this.once("connect",r)}}_onInterval(){if(this._cb&&this._ws&&!(this._ws.bufferedAmount>65536)){this._debug("ending backpressure: bufferedAmount %d",this._ws.bufferedAmount);const r=this._cb;this._cb=null,r(null)}}_debug(){const r=[].slice.call(arguments);r[0]="["+this._id+"] "+r[0],g.apply(null,r)}}t.WEBSOCKET_SUPPORT=!!u,B.exports=t}).call(this)}).call(this,m("buffer").Buffer)},{buffer:69,debug:105,"queue-microtask":218,randombytes:221,"readable-stream":240,ws:41}],263:[function(m,B){const i=m("./lib/throttle"),g=m("./lib/throttle-group");B.exports={Throttle:i,ThrottleGroup:g}},{"./lib/throttle":265,"./lib/throttle-group":264}],264:[function(m,B){var i=Number.isInteger;const{TokenBucket:g}=m("limiter"),f=m("./throttle");B.exports=class{constructor(x={}){if("object"!=typeof x)throw new Error("Options must be an object");this.throttles=[],this.setEnabled(x.enabled),this.setRate(x.rate,x.chunksize)}getEnabled(){return this._enabled}getRate(){return this.bucket.tokensPerInterval}getChunksize(){return this.chunksize}setEnabled(x=!0){if("boolean"!=typeof x)throw new Error("Enabled must be a boolean");this._enabled=x;for(const n of this.throttles)n.setEnabled(x)}setRate(x,n=null){if(!i(x)||0>x)throw new Error("Rate must be an integer bigger than zero");if(x=parseInt(x),n&&("number"!=typeof n||0>=n))throw new Error("Chunksize must be bigger than zero");if(n=n||ue(parseInt(x/10),1),n=parseInt(n),0x)throw new Error("Chunk size must be smaller than rate");this.bucket||(this.bucket=new g(x,x,"second",null)),this.bucket.bucketSize=x,this.bucket.tokensPerInterval=x,this.chunksize=n}setChunksize(x){if(!i(x)||0>=x)throw new Error("Chunk size must be an integer bigger than zero");const n=this.getRate();if(x=parseInt(x),0n)throw new Error("Chunk size must be smaller than rate");this.chunksize=x}throttle(x={}){if("object"!=typeof x)throw new Error("Options must be an object");return new f({...x,group:this})}destroy(){for(const x of this.throttles)x.destroy();this.throttles=[]}_addThrottle(x){if(!(x instanceof f))throw new Error("Throttle must be an instance of Throttle");this.throttles.push(x)}_removeThrottle(x){const n=this.throttles.indexOf(x);-1{function s(r){if(o._emitter.removeListener("disabled",s),o._emitter.removeListener("destroyed",s),!t)return t=!0,r?u(r):void c()}let t=!1;const o=this;this._emitter.once("disabled",s),this._emitter.once("destroyed",s),this._group.bucket.removeTokens(n,s)})}_areBothEnabled(){return this._enabled&&this._group.getEnabled()}async _processChunk(n,c){if(!this._areBothEnabled())return c(null,n);let u=0,s=this._group.getChunksize(),t=n.slice(u,u+s);for(;0setTimeout(g,i))}}},{}],267:[function(m,B){var n,i=1,g=65535,x=function(){i=i+1&g};B.exports=function(c){n||(n=setInterval(x,250)).unref&&n.unref();var u=4*(c||5),s=[0],t=1,o=i-1&g;return function(r){var d=i-o&g;for(d>u&&(d=u),o=i;d--;)t===u&&(t=0),s[t]=s[0===t?u-1:t-1],t++;r&&(s[t-1]+=r);var h=s[t-1];return s.length<4?h:4*(h-(s.length"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"./lib/request":270,"./lib/response":271,"builtin-status-codes":91,url:285,xtend:292}],269:[function(m,B,i){(function(g){(function(){function f(){if(void 0!==c)return c;if(g.XMLHttpRequest){c=new g.XMLHttpRequest;try{c.open("GET",g.XDomainRequest?"/":"https://example.com")}catch{c=null}}else c=null;return c}function x(u){var s=f();if(!s)return!1;try{return s.responseType=u,s.responseType===u}catch{}return!1}function n(u){return"function"==typeof u}var c;i.fetch=n(g.fetch)&&n(g.ReadableStream),i.writableStream=n(g.WritableStream),i.abortController=n(g.AbortController),i.arraybuffer=i.fetch||x("arraybuffer"),i.msstream=!i.fetch&&x("ms-stream"),i.mozchunkedarraybuffer=!i.fetch&&x("moz-chunked-arraybuffer"),i.overrideMimeType=i.fetch||!!f()&&n(f().overrideMimeType),c=null}).call(this)}).call(this,typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{}],270:[function(m,B){(function(i,g,f){(function(){var c=m("./capability"),u=m("inherits"),s=m("./response"),t=m("readable-stream"),o=s.IncomingMessage,r=s.readyStates,d=B.exports=function(l){var p=this;t.Writable.call(p),p._opts=l,p._body=[],p._headers={},l.auth&&p.setHeader("Authorization","Basic "+f.from(l.auth).toString("base64")),Object.keys(l.headers).forEach(function(I){p.setHeader(I,l.headers[I])});var b,w=!0;if("disable-fetch"===l.mode||"requestTimeout"in l&&!c.abortController)w=!1,b=!0;else if("prefer-streaming"===l.mode)b=!1;else if("allow-wrong-content-type"===l.mode)b=!c.overrideMimeType;else{if(l.mode&&"default"!==l.mode&&"prefer-fast"!==l.mode)throw new Error("Invalid value for opts.mode");b=!0}p._mode=function x(l,p){return c.fetch&&p?"fetch":c.mozchunkedarraybuffer?"moz-chunked-arraybuffer":c.msstream?"ms-stream":c.arraybuffer&&l?"arraybuffer":"text"}(b,w),p._fetchTimer=null,p._socketTimeout=null,p._socketTimer=null,p.on("finish",function(){p._onFinish()})};u(d,t.Writable),d.prototype.setHeader=function(l,p){var b=l.toLowerCase();-1!==h.indexOf(b)||(this._headers[b]={name:l,value:p})},d.prototype.getHeader=function(l){var p=this._headers[l.toLowerCase()];return p?p.value:null},d.prototype.removeHeader=function(l){delete this._headers[l.toLowerCase()]},d.prototype._onFinish=function(){var l=this;if(!l._destroyed){var p=l._opts;"timeout"in p&&0!==p.timeout&&l.setTimeout(p.timeout);var w=l._headers,b=null;"GET"!==p.method&&"HEAD"!==p.method&&(b=new Blob(l._body,{type:(w["content-type"]||{}).value||""}));var I=[];if(Object.keys(w).forEach(function(q){var Z=w[q].name,le=w[q].value;Array.isArray(le)?le.forEach(function(we){I.push([Z,we])}):I.push([Z,le])}),"fetch"===l._mode){var S=null;if(c.abortController){var R=new AbortController;S=R.signal,l._fetchAbortController=R,"requestTimeout"in p&&0!==p.requestTimeout&&(l._fetchTimer=g.setTimeout(function(){l.emit("requestTimeout"),l._fetchAbortController&&l._fetchAbortController.abort()},p.requestTimeout))}g.fetch(l._opts.url,{method:l._opts.method,headers:I,body:b||void 0,mode:"cors",credentials:p.withCredentials?"include":"same-origin",signal:S}).then(function(q){l._fetchResponse=q,l._resetTimers(!1),l._connect()},function(q){l._resetTimers(!0),l._destroyed||l.emit("error",q)})}else{var N=l._xhr=new g.XMLHttpRequest;try{N.open(l._opts.method,l._opts.url,!0)}catch(q){return void i.nextTick(function(){l.emit("error",q)})}"responseType"in N&&(N.responseType=l._mode),"withCredentials"in N&&(N.withCredentials=!!p.withCredentials),"text"===l._mode&&"overrideMimeType"in N&&N.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in p&&(N.timeout=p.requestTimeout,N.ontimeout=function(){l.emit("requestTimeout")}),I.forEach(function(q){N.setRequestHeader(q[0],q[1])}),l._response=null,N.onreadystatechange=function(){switch(N.readyState){case r.LOADING:case r.DONE:l._onXHRProgress()}},"moz-chunked-arraybuffer"===l._mode&&(N.onprogress=function(){l._onXHRProgress()}),N.onerror=function(){l._destroyed||(l._resetTimers(!0),l.emit("error",new Error("XHR error")))};try{N.send(b)}catch(q){return void i.nextTick(function(){l.emit("error",q)})}}}},d.prototype._onXHRProgress=function(){var l=this;l._resetTimers(!1),!function n(l){try{var p=l.status;return null!==p&&0!==p}catch{return!1}}(l._xhr)||l._destroyed||(!l._response&&l._connect(),l._response._onXHRProgress(l._resetTimers.bind(l)))},d.prototype._connect=function(){var l=this;l._destroyed||(l._response=new o(l._xhr,l._fetchResponse,l._mode,l._resetTimers.bind(l)),l._response.on("error",function(p){l.emit("error",p)}),l.emit("response",l._response))},d.prototype._write=function(l,p,w){this._body.push(l),w()},d.prototype._resetTimers=function(l){var p=this;g.clearTimeout(p._socketTimer),p._socketTimer=null,l?(g.clearTimeout(p._fetchTimer),p._fetchTimer=null):p._socketTimeout&&(p._socketTimer=g.setTimeout(function(){p.emit("timeout")},p._socketTimeout))},d.prototype.abort=d.prototype.destroy=function(l){var p=this;p._destroyed=!0,p._resetTimers(!0),p._response&&(p._response._destroyed=!0),p._xhr?p._xhr.abort():p._fetchAbortController&&p._fetchAbortController.abort(),l&&p.emit("error",l)},d.prototype.end=function(l,p,w){"function"==typeof l&&(w=l,l=void 0),t.Writable.prototype.end.call(this,l,p,w)},d.prototype.setTimeout=function(l,p){var w=this;p&&w.once("timeout",p),w._socketTimeout=l,w._resetTimers(!1)},d.prototype.flushHeaders=function(){},d.prototype.setNoDelay=function(){},d.prototype.setSocketKeepAlive=function(){};var h=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}).call(this)}).call(this,m("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global,m("buffer").Buffer)},{"./capability":269,"./response":271,_process:205,buffer:69,inherits:159,"readable-stream":240}],271:[function(m,B,i){(function(g,f,x){(function(){var n=m("./capability"),c=m("inherits"),u=m("readable-stream"),s=i.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},t=i.IncomingMessage=function(o,r,d,h){var l=this;if(u.Readable.call(l),l._mode=d,l.headers={},l.rawHeaders=[],l.trailers={},l.rawTrailers=[],l.on("end",function(){g.nextTick(function(){l.emit("close")})}),"fetch"===d){let N=function(){w.read().then(function(q){if(!l._destroyed)return h(q.done),q.done?void l.push(null):(l.push(x.from(q.value)),void N())}).catch(function(q){h(!0),l._destroyed||l.emit("error",q)})};if(l._fetchResponse=r,l.url=r.url,l.statusCode=r.status,l.statusMessage=r.statusText,r.headers.forEach(function(q,Z){l.headers[Z.toLowerCase()]=q,l.rawHeaders.push(Z,q)}),n.writableStream){var p=new WritableStream({write:function(q){return h(!1),new Promise(function(Z,le){l._destroyed?le():l.push(x.from(q))?Z():l._resumeFetch=Z})},close:function(){h(!0),l._destroyed||l.push(null)},abort:function(q){h(!0),l._destroyed||l.emit("error",q)}});try{return void r.body.pipeTo(p).catch(function(q){h(!0),l._destroyed||l.emit("error",q)})}catch{}}var w=r.body.getReader();N()}else if(l._xhr=o,l._pos=0,l.url=o.responseURL,l.statusCode=o.status,l.statusMessage=o.statusText,o.getAllResponseHeaders().split(/\r?\n/).forEach(function(N){var q=N.match(/^([^:]+):\s*(.*)/);if(q){var Z=q[1].toLowerCase();"set-cookie"===Z?(void 0===l.headers[Z]&&(l.headers[Z]=[]),l.headers[Z].push(q[2])):void 0===l.headers[Z]?l.headers[Z]=q[2]:l.headers[Z]+=", "+q[2],l.rawHeaders.push(q[1],q[2])}}),l._charset="x-user-defined",!n.overrideMimeType){var I=l.rawHeaders["mime-type"];if(I){var S=I.match(/;\s*charset=([^;])(;|$)/);S&&(l._charset=S[1].toLowerCase())}l._charset||(l._charset="utf-8")}};c(t,u.Readable),t.prototype._read=function(){var r=this._resumeFetch;r&&(this._resumeFetch=null,r())},t.prototype._onXHRProgress=function(o){var r=this,d=r._xhr,h=null;switch(r._mode){case"text":if((h=d.responseText).length>r._pos){var l=h.substr(r._pos);if("x-user-defined"===r._charset){for(var p=x.alloc(l.length),w=0;wr._pos&&(r.push(x.from(new Uint8Array(b.result.slice(r._pos)))),r._pos=b.result.byteLength)},b.onload=function(){o(!0),r.push(null)},b.readAsArrayBuffer(h)}r._xhr.readyState===s.DONE&&"ms-stream"!==r._mode&&(o(!0),r.push(null))}}).call(this)}).call(this,m("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global,m("buffer").Buffer)},{"./capability":269,_process:205,buffer:69,inherits:159,"readable-stream":240}],272:[function(m,B){B.exports=async function(g,f){const x=await i(g,f);return URL.createObjectURL(x)};const i=m("stream-to-blob")},{"stream-to-blob":273}],273:[function(m,B){B.exports=function(i,g){if(null!=g&&"string"!=typeof g)throw new Error("Invalid mimetype, expected string.");return new Promise((f,x)=>{const n=[];i.on("data",c=>n.push(c)).once("end",()=>{const c=null==g?new Blob(n):new Blob(n,{type:g});f(c)}).once("error",x)})}},{}],274:[function(m,B){(function(i){(function(){var g=m("once");B.exports=function(f,x,n){n=g(n);var c=i.alloc(x),u=0;f.on("data",function(s){s.copy(c,u),u+=s.length}).on("end",function(){n(null,c)}).on("error",n)}}).call(this)}).call(this,m("buffer").Buffer)},{buffer:69,once:191}],275:[function(m,B){function i(){this.stream._duplexState|=ee,!(this.stream._duplexState&Kn)&&this.updateNextTick()}function g(Qt){const Ee=this.stream;Qt&&Ee.destroy(Qt),!(Ee._duplexState&Cn)&&(Ee._duplexState|=X,Ee.emit("finish")),(Ee._duplexState&En)===an&&(Ee._duplexState|=ke),Ee._duplexState&=pe,this.update()}function f(Qt){const Ee=this.stream;Qt||this.error===R||(Qt=this.error),Qt&&Ee.emit("error",Qt),Ee._duplexState|=A,Ee.emit("close");const Vt=Ee._readableState,Nn=Ee._writableState;null!==Vt&&null!==Vt.pipeline&&Vt.pipeline.done(Ee,Qt),null!==Nn&&null!==Nn.pipeline&&Nn.pipeline.done(Ee,Qt)}function x(Qt){const Ee=this.stream;Qt&&Ee.destroy(Qt),Ee._duplexState&=pe,(Ee._duplexState&Re)===se&&(Ee._duplexState&=at,(Ee._duplexState&ce)===ce&&Ee.emit("drain")),!(Ee._duplexState&St)&&this.update()}function n(Qt){Qt&&this.stream.destroy(Qt),this.stream._duplexState&=Xt,!(this.stream._duplexState&C)&&this.update()}function c(){this.stream._duplexState&=Ft,this.update()}function u(){this.stream._duplexState&=dt,this.update()}function s(Qt){const Ee=this.stream;Qt&&Ee.destroy(Qt),!(Ee._duplexState&ke)&&(!(Ee._duplexState&mr)&&(Ee._duplexState|=y),!(Ee._duplexState&ge)&&(Ee._duplexState|=mt),Ee.emit("open")),Ee._duplexState&=Jt,null!==Ee._writableState&&Ee._writableState.update(),null!==Ee._readableState&&Ee._readableState.update()}function t(Qt,Ee){null!=Ee&&this.push(Ee),this._writableState.afterWrite(Qt)}function o(Qt,Ee){const Vt=this._transformState.afterFinal;return Qt?Vt(Qt):(null!=Ee&&this.push(Ee),this.push(null),void Vt(null))}function r(Qt,...Ee){function Vt(Gn,Hn,Yn,rt){Gn.on("error",rt),Gn.on("close",function(){return Hn&&Gn._readableState&&!Gn._readableState.ended||Yn&&Gn._writableState&&!Gn._writableState.ended?rt(N):void 0})}function Nn(Gn){if(Gn&&!Fn){Fn=Gn;for(const Hn of mn)Hn.destroy(Gn)}}const mn=Array.isArray(Qt)?[...Qt,...Ee]:[Qt,...Ee],Mn=mn.length&&"function"==typeof mn[mn.length-1]?mn.pop():null;if(2>mn.length)throw new Error("Pipeline requires at least 2 streams");let zn=mn[0],qn=null,Fn=null;for(let Gn=1;Gn{Gn=!0}),qn.on("error",Hn=>{Fn=Fn||Hn}),qn.on("close",()=>Mn(Fn||(Gn?null:N)))}return qn}function d(Qt){return!!Qt._readableState||!!Qt._writableState}function h(Qt){return"number"==typeof Qt._duplexState&&d(Qt)}function w(Qt){return function p(Qt){return"object"==typeof Qt&&null!==Qt&&"number"==typeof Qt.byteLength}(Qt)?Qt.byteLength:1024}function b(){}function I(){this.destroy(new Error("Stream aborted."))}const{EventEmitter:S}=m("events"),R=new Error("Stream was destroyed"),N=new Error("Premature close"),q=m("queue-tick"),Z=m("fast-fifo"),le=33554431,ke=2,A=4,L=1^le,y=16,C=32,M=64,U=128,ee=256,J=512,Qe=8192,ft=16392,pt=32768,Xt=8^le,It=le^(U|ee),Ft=le^ft,Ke=65536,mt=131072,St=262144,K=524288,se=1048576,X=2097152,ce=4194304,Je=8454144,ie=16777216,pe=le^Ke,Ye=le^mt,at=le^se,dt=le^Je,Gt=8|Ke,Jt=le^Gt,an=Qe|X,Cn=ke|A,hn=1|Cn,En=Cn|an,Xn=(Je|ft)&Jt,An=Gt|Xn,Pn=hn|Xn,mr=hn|J|Qe,Mt=hn|Qe|M,Kn=8|C,ge=hn|ie|X,Re=K|se|hn|Ke,je=hn|Ke|K,Ze=Symbol.asyncIterator||Symbol("asyncIterator");class Xe{constructor(Ee,{highWaterMark:Vt=16384,map:Nn=null,mapWritable:mn,byteLength:Mn,byteLengthWritable:zn}={}){this.stream=Ee,this.queue=new Z,this.highWaterMark=Vt,this.buffered=0,this.error=null,this.pipeline=null,this.byteLength=zn||Mn||w,this.map=mn||Nn,this.afterWrite=x.bind(this),this.afterUpdateNextTick=u.bind(this)}get ended(){return 0!=(this.stream._duplexState&X)}push(Ee){return null!==this.map&&(Ee=this.map(Ee)),this.buffered+=this.byteLength(Ee),this.queue.push(Ee),this.buffered=Ee._readableState.highWaterMark}static isPaused(Ee){return 0==(Ee._duplexState&U)}[Ze](){function Nn(Gn){null===Fn||(zn?Fn(zn):null!==Gn||Mn._duplexState&Qe?qn({value:Gn,done:null==Gn}):Fn(R),Fn=qn=null)}function mn(Gn){return Mn.destroy(Gn),new Promise((Hn,Yn)=>Mn._duplexState&A?Hn({value:void 0,done:!0}):void Mn.once("close",function(){Gn?Yn(Gn):Hn({value:void 0,done:!0})}))}const Mn=this;let zn=null,qn=null,Fn=null;return this.on("error",Gn=>{zn=Gn}),this.on("readable",function Ee(){null!==qn&&Nn(Mn.read())}),this.on("close",function Vt(){null!==qn&&Nn(null)}),{[Ze](){return this},next:()=>new Promise(function(Gn,Hn){qn=Gn,Fn=Hn;const Yn=Mn.read();null===Yn?Mn._duplexState&A&&Nn(null):Nn(Yn)}),return:()=>mn(null),throw:Gn=>mn(Gn)}}}class _n extends nn{constructor(Ee){super(Ee),this._duplexState=1,this._writableState=new Xe(this,Ee),Ee&&(Ee.writev&&(this._writev=Ee.writev),Ee.write&&(this._write=Ee.write),Ee.final&&(this._final=Ee.final))}_writev(Ee,Vt){Vt(null)}_write(Ee,Vt){this._writableState.autoBatch(Ee,Vt)}_final(Ee){Ee(null)}write(Ee){return this._writableState.updateNextTick(),this._writableState.push(Ee)}end(Ee){return this._writableState.updateNextTick(),this._writableState.end(Ee),this}}class cn extends _n{constructor(Ee){super(Ee),this._transformState=new tn(this),Ee&&(Ee.transform&&(this._transform=Ee.transform),Ee.flush&&(this._flush=Ee.flush))}_write(Ee){this._readableState.buffered>=this._readableState.highWaterMark?this._transformState.data=Ee:this._transform(Ee,this._transformState.afterTransform)}_read(Ee){if(null!==this._transformState.data){const Vt=this._transformState.data;this._transformState.data=null,Ee(null),this._transform(Vt,this._transformState.afterTransform)}else Ee(null)}_transform(Ee,Vt){Vt(null,Ee)}_flush(Ee){Ee(null)}_final(Ee){this._transformState.afterFinal=Ee,this._flush(o.bind(this))}}B.exports={pipeline:r,pipelinePromise:function(...Qt){return new Promise((Ee,Vt)=>r(...Qt,Nn=>Nn?Vt(Nn):void Ee()))},isStream:d,isStreamx:h,Stream:qt,Writable:class extends qt{constructor(Qt){super(Qt),this._duplexState|=1|Qe,this._writableState=new Xe(this,Qt),Qt&&(Qt.writev&&(this._writev=Qt.writev),Qt.write&&(this._write=Qt.write),Qt.final&&(this._final=Qt.final))}_writev(Qt,Ee){Ee(null)}_write(Qt,Ee){this._writableState.autoBatch(Qt,Ee)}_final(Qt){Qt(null)}static isBackpressured(Qt){return 0!=(Qt._duplexState&(se|Cn|ie|X))}write(Qt){return this._writableState.updateNextTick(),this._writableState.push(Qt)}end(Qt){return this._writableState.updateNextTick(),this._writableState.end(Qt),this}},Readable:nn,Duplex:_n,Transform:cn,PassThrough:class extends cn{}}},{events:70,"fast-fifo":139,"queue-tick":219}],276:[function(m,B,i){"use strict";function x(b){var I;switch(this.encoding=function f(b){var I=function g(b){if(!b)return"utf8";for(var I;;)switch(b){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return b;default:if(I)return;b=(""+b).toLowerCase(),I=!0}}(b);if("string"!=typeof I&&(p.isEncoding===w||!w(b)))throw new Error("Unknown encoding: "+b);return I||b}(b),this.encoding){case"utf16le":this.text=t,this.end=o,I=4;break;case"utf8":this.fillLast=s,I=4;break;case"base64":this.text=r,this.end=d,I=3;break;default:return this.write=h,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=p.allocUnsafe(I)}function n(b){return 127>=b?0:b>>5==6?2:b>>4==14?3:b>>3==30?4:b>>6==2?-1:-2}function s(b){var I=this.lastTotal-this.lastNeed,S=function u(b,I){if(128!=(192&I[0]))return b.lastNeed=0,"\ufffd";if(1=R)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=b[b.length-2],this.lastChar[1]=b[b.length-1],S.slice(0,-1)}return S}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=b[b.length-1],b.toString("utf16le",I,b.length-1)}function o(b){var I=b&&b.length?this.write(b):"";return this.lastNeed?I+this.lastChar.toString("utf16le",0,this.lastTotal-this.lastNeed):I}function r(b,I){var S=(b.length-I)%3;return 0==S?b.toString("base64",I):(this.lastNeed=3-S,this.lastTotal=3,1==S?this.lastChar[0]=b[b.length-1]:(this.lastChar[0]=b[b.length-2],this.lastChar[1]=b[b.length-1]),b.toString("base64",I,b.length-S))}function d(b){var I=b&&b.length?this.write(b):"";return this.lastNeed?I+this.lastChar.toString("base64",0,3-this.lastNeed):I}function h(b){return b.toString(this.encoding)}function l(b){return b&&b.length?this.write(b):""}var p=m("safe-buffer").Buffer,w=p.isEncoding||function(b){switch((b=""+b)&&b.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};i.StringDecoder=x,x.prototype.write=function(b){if(0===b.length)return"";var I,S;if(this.lastNeed){if(void 0===(I=this.fillLast(b)))return"";S=this.lastNeed,this.lastNeed=0}else S=0;return S>s)<<(s=(s+5)%8)|(c+1>8-s,c++):(t=31&r>>8-(s+5),0==(s=(s+5)%8)&&c++),o[u]="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".charCodeAt(t),u++}for(c=u;c=c?0==(c=(c+5)%8)?(o[s]=t|=u,s++,t=0):t|=255&u<<8-c:(o[s]=t|=255&u>>>(c=(c+5)%8),s++,t=255&u<<8-c)}return o.slice(0,s)}}).call(this)}).call(this,m("buffer").Buffer)},{buffer:69}],279:[function(m,B){var i=m("buffer").Buffer;B.exports=function(g){if(g instanceof Uint8Array){if(0===g.byteOffset&&g.byteLength===g.buffer.byteLength)return g.buffer;if("function"==typeof g.buffer.slice)return g.buffer.slice(g.byteOffset,g.byteOffset+g.byteLength)}if(i.isBuffer(g)){for(var f=new Uint8Array(g.length),x=g.length,n=0;n{this.emit("warning",o)},this._onError=o=>{this.emit("error",o)},this._onDHTPeer=(o,r)=>{r.toString("hex")!==this.infoHash||this.emit("peer",`${o.host}:${o.port}`,"dht")},this._onTrackerPeer=o=>{this.emit("peer",o,"tracker")},this._onTrackerAnnounce=()=>{this.emit("trackerAnnounce")},this._onLSDPeer=o=>{this.emit("peer",o,"lsd")};const t=(o,r)=>{const d=new f(r);return d.on("warning",this._onWarning),d.on("error",this._onError),d.listen(o),this._internalDHT=!0,d};!1===s.tracker?this.tracker=null:s.tracker&&"object"==typeof s.tracker?(this._trackerOpts=Object.assign({},s.tracker),this.tracker=this._createTracker()):this.tracker=this._createTracker(),this.dht=!1===s.dht||"function"!=typeof f?null:s.dht&&"function"==typeof s.dht.addNode?s.dht:s.dht&&"object"==typeof s.dht?t(s.dhtPort,s.dht):t(s.dhtPort),this.dht&&(this.dht.on("peer",this._onDHTPeer),this._dhtAnnounce()),this.lsd=!1===s.lsd||"function"!=typeof u?null:this._createLSD()}updatePort(s){s===this._port||(this._port=s,this.dht&&this._dhtAnnounce(),this.tracker&&(this.tracker.stop(),this.tracker.destroy(()=>{this.tracker=this._createTracker()})))}complete(s){this.tracker&&this.tracker.complete(s)}destroy(s){if(!this.destroyed){this.destroyed=!0,clearTimeout(this._dhtTimeout);const t=[];this.tracker&&(this.tracker.stop(),this.tracker.removeListener("warning",this._onWarning),this.tracker.removeListener("error",this._onError),this.tracker.removeListener("peer",this._onTrackerPeer),this.tracker.removeListener("update",this._onTrackerAnnounce),t.push(o=>{this.tracker.destroy(o)})),this.dht&&this.dht.removeListener("peer",this._onDHTPeer),this._internalDHT&&(this.dht.removeListener("warning",this._onWarning),this.dht.removeListener("error",this._onError),t.push(o=>{this.dht.destroy(o)})),this.lsd&&(this.lsd.removeListener("warning",this._onWarning),this.lsd.removeListener("error",this._onError),this.lsd.removeListener("peer",this._onLSDPeer),t.push(o=>{this.lsd.destroy(o)})),n(t,s),this.dht=null,this.tracker=null,this.lsd=null,this._announce=null}}_createTracker(){const s=Object.assign({},this._trackerOpts,{infoHash:this.infoHash,announce:this._announce,peerId:this.peerId,port:this._port,userAgent:this._userAgent}),t=new c(s);return t.on("warning",this._onWarning),t.on("error",this._onError),t.on("peer",this._onTrackerPeer),t.on("update",this._onTrackerAnnounce),t.setInterval(this._intervalMs),t.start(),t}_dhtAnnounce(){this._dhtAnnouncing||(g("dht announce"),this._dhtAnnouncing=!0,clearTimeout(this._dhtTimeout),this.dht.announce(this.infoHash,this._port,s=>{this._dhtAnnouncing=!1,g("dht announce complete"),s&&this.emit("warning",s),this.emit("dhtAnnounce"),this.destroyed||(this._dhtTimeout=setTimeout(()=>{this._dhtAnnounce()},this._intervalMs+wt(Math.random()*this._intervalMs/5)),this._dhtTimeout.unref&&this._dhtTimeout.unref())}))}_createLSD(){const s=Object.assign({},{infoHash:this.infoHash,peerId:this.peerId,port:this._port}),t=new u(s);return t.on("warning",this._onWarning),t.on("error",this._onError),t.on("peer",this._onLSDPeer),t.start(),t}}}).call(this)}).call(this,m("_process"))},{_process:205,"bittorrent-dht/client":41,"bittorrent-lsd":41,"bittorrent-tracker/client":33,debug:105,events:70,"run-parallel":245}],281:[function(m,B){(function(i){(function(){class f{constructor(n){this.length=n,this.missing=n,this.sources=null,this._chunks=ve(n/16384),this._remainder=n%16384||16384,this._buffered=0,this._buffer=null,this._cancellations=null,this._reservations=0,this._flushed=!1}chunkLength(n){return n===this._chunks-1?this._remainder:16384}chunkLengthRemaining(n){return this.length-16384*n}chunkOffset(n){return 16384*n}reserve(){return this.init()?this._cancellations.length?this._cancellations.pop():this._reservations=i.length||0>g)){var f=i.pop();if(g",'"',"`"," ","\r","\n","\t"]),u=["'"].concat(c),s=["%","/","?",";","#"].concat(u),t=["/","?","#"],o=/^[+a-z0-9A-Z_-]{0,63}$/,r={javascript:!0,"javascript:":!0},d={javascript:!0,"javascript:":!0},h={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},l=m("querystring");g.prototype.parse=function(p,w,b){if(!n.isString(p))throw new TypeError("Parameter 'url' must be a string, not "+typeof p);var I=p.indexOf("?"),S=-1!==I&&Iee.length&&ee.unshift(""),b.pathname=ee.join("/")}return b.search=p.search,b.query=p.query,b.host=p.host||"",b.auth=p.auth,b.hostname=p.hostname||p.host,b.port=p.port,(b.pathname||b.search)&&(b.path=(b.pathname||"")+(b.search||"")),b.slashes=b.slashes||p.slashes,b.href=b.format(),b}var z=b.pathname&&"/"===b.pathname.charAt(0),y=p.host||p.pathname&&"/"===p.pathname.charAt(0),C=y||z||b.host&&p.pathname,M=C,U=b.pathname&&b.pathname.split("/")||[],J=(ee=p.pathname&&p.pathname.split("/")||[],b.protocol&&!h[b.protocol]);if(J&&(b.hostname="",b.port=null,b.host&&(""===U[0]?U[0]=b.host:U.unshift(b.host)),b.host="",p.protocol&&(p.hostname=null,p.port=null,p.host&&(""===ee[0]?ee[0]=p.host:ee.unshift(p.host)),p.host=null),C=C&&(""===ee[0]||""===U[0])),y)b.host=p.host||""===p.host?p.host:b.host,b.hostname=p.hostname||""===p.hostname?p.hostname:b.hostname,b.search=p.search,b.query=p.query,U=ee;else if(ee.length)U||(U=[]),U.pop(),U=U.concat(ee),b.search=p.search,b.query=p.query;else if(!n.isNullOrUndefined(p.search))return J&&(b.hostname=b.host=U.shift(),(re=!!(b.host&&0{class o extends g{constructor(d){super(),this._wire=d,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new x(0,{grow:1e3}),i.isBuffer(t)&&this.setMetadata(t)}onHandshake(d){this._infoHash=d}onExtendedHandshake(d){return d.m&&d.m.ut_metadata?d.metadata_size?"number"!=typeof d.metadata_size||1e7=d.metadata_size?this.emit("warning",new Error("Peer gave invalid metadata size")):(this._metadataSize=d.metadata_size,this._numPieces=ve(this._metadataSize/s),this._remainingRejects=2*this._numPieces,void this._requestPieces()):this.emit("warning",new Error("Peer does not have metadata")):this.emit("warning",new Error("Peer does not support ut_metadata"))}onMessage(d){let h,l;try{const p=d.toString(),w=p.indexOf("ee")+2;h=f.decode(p.substring(0,w)),l=d.slice(w)}catch{return}switch(h.msg_type){case 0:this._onRequest(h.piece);break;case 1:this._onData(h.piece,l,h.total_size);break;case 2:this._onReject(h.piece)}}fetch(){this._metadataComplete||(this._fetching=!0,this._metadataSize&&this._requestPieces())}cancel(){this._fetching=!1}setMetadata(d){if(this._metadataComplete)return!0;n("set metadata");try{const h=f.decode(d).info;h&&(d=f.encode(h))}catch{}return!(this._infoHash&&this._infoHash!==c.sync(d)||(this.cancel(),this.metadata=d,this._metadataComplete=!0,this._metadataSize=this.metadata.length,this._wire.extendedHandshake.metadata_size=this._metadataSize,this.emit("metadata",f.encode({info:f.decode(this.metadata)})),0))}_send(d,h){let l=f.encode(d);i.isBuffer(h)&&(l=i.concat([l,h])),this._wire.extended("ut_metadata",l)}_request(d){this._send({msg_type:0,piece:d})}_data(d,h,l){const p={msg_type:1,piece:d};"number"==typeof l&&(p.total_size=l),this._send(p,h)}_reject(d){this._send({msg_type:2,piece:d})}_onRequest(d){if(!this._metadataComplete)return void this._reject(d);const h=d*s;let l=h+s;l>this._metadataSize&&(l=this._metadataSize);const p=this.metadata.slice(h,l);this._data(d,p,this._metadataSize)}_onData(d,h){h.length>s||!this._fetching||(h.copy(this.metadata,d*s),this._bitfield.set(d),this._checkDone())}_onReject(d){0"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{}],289:[function(m,B){(function(i){(function(){const f=m("binary-search"),x=m("events"),n=m("mp4-stream"),c=m("mp4-box-encoding"),u=m("range-slice-stream");class s{constructor(o,r){this._entries=o,this._countName=r||"count",this._index=0,this._offset=0,this.value=this._entries[0]}inc(){this._offset++,this._offset>=this._entries[this._index][this._countName]&&(this._index++,this._offset=0),this.value=this._entries[this._index]}}B.exports=class extends x{constructor(t){super(),this._tracks=[],this._file=t,this._decoder=null,this._findMoov(0)}_findMoov(t){this._decoder&&this._decoder.destroy();let o=0;this._decoder=n.decode();const r=this._file.createReadStream({start:t});r.pipe(this._decoder);const d=h=>{"moov"===h.type?(this._decoder.removeListener("box",d),this._decoder.decode(l=>{r.destroy();try{this._processMoov(l)}catch(p){p.message=`Cannot parse mp4 file: ${p.message}`,this.emit("error",p)}})):h.length<4096?(o+=h.length,this._decoder.ignore()):(this._decoder.removeListener("box",d),o+=h.length,r.destroy(),this._decoder.destroy(),this._findMoov(t+o))};this._decoder.on("box",d)}_processMoov(t){const o=t.traks;this._tracks=[],this._hasVideo=!1,this._hasAudio=!1;for(let l=0;l=w.stsz.entries.length)break;if(Z++,we+=U,Z>=r.samplesPerChunk){Z=0,we=0,le++;const We=w.stsc.entries[ke+1];We&&le+1>=We.firstChunk&&ke++}A+=ee,L.inc(),z&&z.inc(),re&&M++}p.mdia.mdhd.duration=0,p.tkhd.duration=0,this._tracks.push({fragmentSequence:1,trackId:p.tkhd.trackId,timeScale:p.mdia.mdhd.timeScale,samples:N,currSample:null,currTime:null,moov:{type:"moov",mvhd:t.mvhd,traks:[{tkhd:p.tkhd,mdia:{mdhd:p.mdia.mdhd,hdlr:p.mdia.hdlr,elng:p.mdia.elng,minf:{vmhd:p.mdia.minf.vmhd,smhd:p.mdia.minf.smhd,dinf:p.mdia.minf.dinf,stbl:{stsd:w.stsd,stts:{version:0,flags:0,entries:[]},ctts:{version:0,flags:0,entries:[]},stsc:{version:0,flags:0,entries:[]},stsz:{version:0,flags:0,entries:[]},stco:{version:0,flags:0,entries:[]},stss:{version:0,flags:0,entries:[]}}}}}],mvex:{mehd:{fragmentDuration:t.mvhd.duration},trexs:[{trackId:p.tkhd.trackId,defaultSampleDescriptionIndex:r.sampleDescriptionId,defaultSampleDuration:0,defaultSampleSize:0,defaultSampleFlags:0}]}},mime:R})}if(0===this._tracks.length)return void this.emit("error",new Error("no playable tracks"));t.mvhd.duration=0,this._ftyp={type:"ftyp",brand:"iso5",brandVersion:0,compatibleBrands:["iso5"]};const d=c.encode(this._ftyp),h=this._tracks.map(l=>{const p=c.encode(l.moov);return{mime:l.mime,init:i.concat([d,p])}});this.emit("ready",h)}seek(t){if(!this._tracks)throw new Error("Not ready yet; wait for 'ready' event");this._fileStream&&(this._fileStream.destroy(),this._fileStream=null);let o=-1;if(this._tracks.map((r,d)=>{r.outStream&&r.outStream.destroy(),r.inStream&&(r.inStream.destroy(),r.inStream=null);const h=r.outStream=n.encode(),l=this._generateFragment(d,t);if(!l)return h.finalize();(-1===o||l.ranges[0].start{h.destroyed||h.box(w.moof,b=>{if(b)return this.emit("error",b);h.destroyed||r.inStream.slice(w.ranges).pipe(h.mediaData(w.length,S=>{if(S)return this.emit("error",S);if(!h.destroyed){const R=this._generateFragment(d);return R?void p(R):h.finalize()}}))})};p(l)}),0<=o){const r=this._fileStream=this._file.createReadStream({start:o});this._tracks.forEach(d=>{d.inStream=new u(o,{highWaterMark:1e7}),r.pipe(d.inStream)})}return this._tracks.map(r=>r.outStream)}_findSampleBefore(t,o){const r=this._tracks[t],d=wt(r.timeScale*o);let h=f(r.samples,d,(l,p)=>l.dts+l.presentationOffset-p);for(-1===h?h=0:0>h&&(h=-h-2);!r.samples[h].sync;)h--;return h}_generateFragment(t,o){const r=this._tracks[t];let d;if(d=void 0===o?r.currSample:this._findSampleBefore(t,o),d>=r.samples.length)return null;const h=r.samples[d].dts;let l=0;const p=[];for(var w=d;w=1*r.timeScale)break;l+=b.size;const I=p.length-1;0>I||p[I].end!==b.offset?p.push({start:b.offset,end:b.offset+b.size}):p[I].end+=b.size}return r.currSample=w,{moof:this._generateMoof(t,d,w),ranges:p,length:l}}_generateMoof(t,o,r){const d=this._tracks[t],h=[];let l=0;for(let w=o;wb.presentationOffset&&(l=1),h.push({sampleDuration:b.duration,sampleSize:b.size,sampleFlags:b.sync?33554432:16842752,sampleCompositionTimeOffset:b.presentationOffset})}const p={type:"moof",mfhd:{sequenceNumber:d.fragmentSequence++},trafs:[{tfhd:{flags:131072,trackId:d.trackId},tfdt:{baseMediaDecodeTime:d.samples[o].dts},trun:{flags:3841,dataOffset:8,entries:h,version:l}}]};return p.trafs[0].trun.dataOffset+=c.encodingLength(p),p}}}).call(this)}).call(this,m("buffer").Buffer)},{"binary-search":30,buffer:69,events:70,"mp4-box-encoding":184,"mp4-stream":187,"range-slice-stream":224}],290:[function(m,B){function i(n,c,u={}){return this instanceof i?(this.detailedError=null,this._elem=c,this._elemWrapper=new g(c),this._waitingFired=!1,this._trackMeta=null,this._file=n,this._tracks=null,"none"!==this._elem.preload&&this._createMuxer(),this._onError=()=>{this.detailedError=this._elemWrapper.detailedError,this.destroy()},this._onWaiting=()=>{this._waitingFired=!0,this._muxer?this._tracks&&this._pump():this._createMuxer()},c.autoplay&&(c.preload="auto"),c.addEventListener("waiting",this._onWaiting),void c.addEventListener("error",this._onError)):(console.warn("Don't invoke VideoStream without the 'new' keyword."),new i(n,c,u))}const g=m("mediasource"),f=m("pump"),x=m("./mp4-remuxer");i.prototype={_createMuxer(){this._muxer=new x(this._file),this._muxer.on("ready",n=>{this._tracks=n.map(c=>{const u=this._elemWrapper.createWriteStream(c.mime);u.on("error",t=>{this._elemWrapper.error(t)});const s={muxed:null,mediaSource:u,initFlushed:!1,onInitFlushed:null};return u.write(c.init,t=>{s.initFlushed=!0,s.onInitFlushed&&s.onInitFlushed(t)}),s}),(this._waitingFired||"auto"===this._elem.preload)&&this._pump()}),this._muxer.on("error",n=>{this._elemWrapper.error(n)})},_pump(){const n=this._muxer.seek(this._elem.currentTime,!this._tracks);this._tracks.forEach((c,u)=>{const s=()=>{c.muxed&&(c.muxed.destroy(),c.mediaSource=this._elemWrapper.createWriteStream(c.mediaSource),c.mediaSource.on("error",t=>{this._elemWrapper.error(t)})),c.muxed=n[u],f(c.muxed,c.mediaSource)};c.initFlushed?s():c.onInitFlushed=t=>t?void this._elemWrapper.error(t):void s()})},destroy(){this.destroyed||(this.destroyed=!0,this._elem.removeEventListener("waiting",this._onWaiting),this._elem.removeEventListener("error",this._onError),this._tracks&&this._tracks.forEach(n=>{n.muxed&&n.muxed.destroy()}),this._elem.src="")}},B.exports=i},{"./mp4-remuxer":289,mediasource:172,pump:213}],291:[function(m,B){B.exports=function i(g,f){function x(){for(var n=Array(arguments.length),c=0;c("0"+we%100).slice(-2)).slice(0,4);class le extends x{constructor(ke={}){super(),this.peerId="string"==typeof ke.peerId?ke.peerId:i.isBuffer(ke.peerId)?ke.peerId.toString("hex"):i.from(`-WW${Z}-`+p(9).toString("base64")).toString("hex"),this.peerIdBuffer=i.from(this.peerId,"hex"),this.nodeId="string"==typeof ke.nodeId?ke.nodeId:i.isBuffer(ke.nodeId)?ke.nodeId.toString("hex"):p(20).toString("hex"),this.nodeIdBuffer=i.from(this.nodeId,"hex"),this._debugId=this.peerId.toString("hex").substring(0,7),this.destroyed=!1,this.listening=!1,this.torrentPort=ke.torrentPort||0,this.dhtPort=ke.dhtPort||0,this.tracker=void 0===ke.tracker?{}:ke.tracker,this.lsd=!1!==ke.lsd,this.torrents=[],this.maxConns=+ke.maxConns||55,this.utp=le.UTP_SUPPORT&&!1!==ke.utp,this._downloadLimit=ue("number"==typeof ke.downloadLimit?ke.downloadLimit:-1,-1),this._uploadLimit=ue("number"==typeof ke.uploadLimit?ke.uploadLimit:-1,-1),this.serviceWorker=null,this.workerKeepAliveInterval=null,this.workerPortCount=0,!0===ke.secure&&m("./lib/peer").enableSecure(),this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.throttleGroups={down:new I({rate:ue(this._downloadLimit,0),enabled:0<=this._downloadLimit}),up:new I({rate:ue(this._uploadLimit,0),enabled:0<=this._uploadLimit})},this.tracker&&("object"!=typeof this.tracker&&(this.tracker={}),globalThis.WRTC&&!this.tracker.wrtc&&(this.tracker.wrtc=globalThis.WRTC)),"function"==typeof S?this._connPool=new S(this):l(()=>{this._onListening()}),this._downloadSpeed=b(),this._uploadSpeed=b(),!1!==ke.dht&&"function"==typeof t?(this.dht=new t(Object.assign({},{nodeId:this.nodeId},ke.dht)),this.dht.once("error",L=>{this._destroy(L)}),this.dht.once("listening",()=>{const L=this.dht.address();L&&(this.dhtPort=L.port)}),this.dht.setMaxListeners(0),this.dht.listen(this.dhtPort)):this.dht=!1,this.enableWebSeeds=!1!==ke.webSeeds;const A=()=>{this.destroyed||(this.ready=!0,this.emit("ready"))};"function"==typeof o&&null!=ke.blocklist?o(ke.blocklist,{headers:{"user-agent":`WebTorrent/${N} (https://webtorrent.io)`}},(L,z)=>L?console.error(`Failed to load blocklist: ${L.message}`):(this.blocked=z,void A())):l(A)}loadWorker(ke,A=(()=>{})){if(!(ke instanceof ServiceWorker))throw new Error("Invalid worker registration");if("activated"!==ke.state)throw new Error("Worker isn't activated");this.serviceWorker=ke,navigator.serviceWorker.addEventListener("message",L=>{const{data:z}=L;if(!z.type||"webtorrent"===!z.type||!z.url)return null;let[y,...C]=z.url.slice(z.url.indexOf(z.scope+"webtorrent/")+11+z.scope.length).split("/");if(C=decodeURI(C.join("/")),!y||!C)return null;const[M]=L.ports,U=this.get(y)&&this.get(y).files.find(Qe=>Qe.path===C);if(!U)return null;const[ee,J,re]=U._serve(z),Ue=J&&J[Symbol.asyncIterator](),We=()=>{M.onmessage=null,J&&J.destroy(),re&&re.destroy(),this.workerPortCount--,this.workerPortCount||(clearInterval(this.workerKeepAliveInterval),this.workerKeepAliveInterval=null)};M.onmessage=async Qe=>{if(Qe.data){let ft;try{ft=(await Ue.next()).value}catch{}M.postMessage(ft),ft||We(),this.workerKeepAliveInterval||(this.workerKeepAliveInterval=setInterval(()=>fetch(`${this.serviceWorker.scriptURL.substr(0,this.serviceWorker.scriptURL.lastIndexOf("/")+1).slice(window.location.origin.length)}webtorrent/keepalive/`),2e4))}else We()},this.workerPortCount++,M.postMessage(ee)}),A(this.serviceWorker)}get downloadSpeed(){return this._downloadSpeed()}get uploadSpeed(){return this._uploadSpeed()}get progress(){const ke=this.torrents.filter(z=>1!==z.progress);return ke.reduce((z,y)=>z+y.downloaded,0)/(ke.reduce((z,y)=>z+(y.length||0),0)||1)}get ratio(){return this.torrents.reduce((L,z)=>L+z.uploaded,0)/(this.torrents.reduce((L,z)=>L+z.received,0)||1)}get(ke){if(ke instanceof R){if(this.torrents.includes(ke))return ke}else{let A;try{A=d(ke)}catch{}if(!A)return null;if(!A.infoHash)throw new Error("Invalid torrent identifier");for(const L of this.torrents)if(L.infoHash===A.infoHash)return L}return null}add(ke,A={},L=(()=>{})){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof A&&([A,L]=[{},A]);const y=()=>{if(!this.destroyed)for(const U of this.torrents)if(U.infoHash===M.infoHash&&U!==M)return void M._destroy(new Error(`Cannot add duplicate torrent ${M.infoHash}`))},C=()=>{this.destroyed||(L(M),this.emit("torrent",M))};this._debug("add"),A=A?Object.assign({},A):{};const M=new R(ke,this,A);return this.torrents.push(M),M.once("_infoHash",y),M.once("ready",C),M.once("close",function z(){M.removeListener("_infoHash",y),M.removeListener("ready",C),M.removeListener("close",z)}),M}seed(ke,A,L){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof A&&([A,L]=[{},A]),this._debug("seed"),(A=A?Object.assign({},A):{}).skipVerify=!0;const z="string"==typeof ke;z&&(A.path=n.dirname(ke)),A.createdBy||(A.createdBy=`WebTorrent/${Z}`);const y=U=>{this._debug("on seed"),"function"==typeof L&&L(U),U.emit("seed"),this.emit("seed",U)},C=this.add(null,A,U=>{const ee=[J=>z||A.preloadedStore?J():void U.load(M,J)];this.dht&&ee.push(J=>{U.once("dhtAnnounce",J)}),r(ee,J=>this.destroyed?void 0:J?U._destroy(J):void y(U))});let M;return function f(we){return typeof FileList<"u"&&we instanceof FileList}(ke)?ke=Array.from(ke):!Array.isArray(ke)&&(ke=[ke]),r(ke.map(U=>ee=>{!A.preloadedStore&&function g(we){return"object"==typeof we&&null!=we&&"function"==typeof we.pipe}(U)?c(U,(J,re)=>J?ee(J):(re.name=U.name,void ee(null,re))):ee(null,U)}),(U,ee)=>this.destroyed?void 0:U?C._destroy(U):void u.parseInput(ee,A,(J,re)=>this.destroyed?void 0:J?C._destroy(J):(M=re.map(Ue=>Ue.getStream),void u(ee,A,(Ue,We)=>{if(!this.destroyed){if(Ue)return C._destroy(Ue);const Qe=this.get(We);Qe?C._destroy(new Error(`Cannot add duplicate torrent ${Qe.infoHash}`)):C._onTorrentId(We)}})))),C}remove(ke,A,L){if("function"==typeof A)return this.remove(ke,null,A);if(this._debug("remove"),!this.get(ke))throw new Error(`No torrent with id ${ke}`);this._remove(ke,A,L)}_remove(ke,A,L){if("function"==typeof A)return this._remove(ke,null,A);const z=this.get(ke);z&&(this.torrents.splice(this.torrents.indexOf(z),1),z.destroy(A,L),this.dht&&this.dht._tables.remove(z.infoHash))}address(){return this.listening?this._connPool?this._connPool.tcpServer.address():{address:"0.0.0.0",family:"IPv4",port:0}:null}throttleDownload(ke){return ke=+ke,!(isNaN(ke)||!isFinite(ke)||-1>ke)&&(this._downloadLimit=ke,0>this._downloadLimit?this.throttleGroups.down.setEnabled(!1):(this.throttleGroups.down.setEnabled(!0),void this.throttleGroups.down.setRate(this._downloadLimit)))}throttleUpload(ke){return ke=+ke,!(isNaN(ke)||!isFinite(ke)||-1>ke)&&(this._uploadLimit=ke,0>this._uploadLimit?this.throttleGroups.up.setEnabled(!1):(this.throttleGroups.up.setEnabled(!0),void this.throttleGroups.up.setRate(this._uploadLimit)))}destroy(ke){if(this.destroyed)throw new Error("client already destroyed");this._destroy(null,ke)}_destroy(ke,A){this._debug("client destroy"),this.destroyed=!0;const L=this.torrents.map(z=>y=>{z.destroy(y)});this._connPool&&L.push(z=>{this._connPool.destroy(z)}),this.dht&&L.push(z=>{this.dht.destroy(z)}),r(L,A),ke&&this.emit("error",ke),this.torrents=[],this._connPool=null,this.dht=null,this.throttleGroups.down.destroy(),this.throttleGroups.up.destroy()}_onListening(){if(this._debug("listening"),this.listening=!0,this._connPool){const ke=this._connPool.tcpServer.address();ke&&(this.torrentPort=ke.port)}this.emit("listening")}_debug(){const ke=[].slice.call(arguments);ke[0]=`[${this._debugId}] ${ke[0]}`,q(...ke)}_getByHash(ke){for(const A of this.torrents)if(A.infoHashHash||(A.infoHashHash=w.sync(i.from("72657132"+A.infoHash,"hex"))),ke===A.infoHashHash)return A;return null}}le.WEBRTC_SUPPORT=h.WEBRTC_SUPPORT,le.UTP_SUPPORT=S.UTP_SUPPORT,le.VERSION=N,B.exports=le}).call(this)}).call(this,m("buffer").Buffer)},{"./lib/conn-pool.js":41,"./lib/peer":3,"./lib/torrent.js":5,"./package.json":293,"bittorrent-dht/client":41,buffer:69,"create-torrent":103,debug:105,events:70,"load-ip-set":41,"parse-torrent":197,path:71,"queue-microtask":218,randombytes:221,"run-parallel":245,"simple-concat":257,"simple-peer":259,"simple-sha1":260,"speed-limiter":263,speedometer:267}]},{},[294])(294)}),function(Kt){"object"==typeof exports&&typeof module<"u"?module.exports=Kt():"function"==typeof define&&define.amd?define([],Kt):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).Kuroshiro=Kt()}(function(){return function At(wt,kt,V){function De(oe,G){if(!kt[oe]){if(!wt[oe]){var ue="function"==typeof require&&require;if(!G&&ue)return ue(oe,!0);if(Le)return Le(oe,!0);var ve=new Error("Cannot find module '"+oe+"'");throw ve.code="MODULE_NOT_FOUND",ve}var Y=kt[oe]={exports:{}};wt[oe][0].call(Y.exports,function(ae){return De(wt[oe][1][ae]||ae)},Y,Y.exports,At,wt,kt,V)}return kt[oe].exports}for(var Le="function"==typeof require&&require,_=0;_=0,Le=De&&V.regeneratorRuntime;if(V.regeneratorRuntime=void 0,wt.exports=At("./runtime"),De)V.regeneratorRuntime=Le;else try{delete V.regeneratorRuntime}catch{V.regeneratorRuntime=void 0}},{"./runtime":3}],3:[function(At,wt,kt){!function(V){"use strict";var De,Le=Object.prototype,_=Le.hasOwnProperty,oe="function"==typeof Symbol?Symbol:{},G=oe.iterator||"@@iterator",ue=oe.asyncIterator||"@@asyncIterator",ve=oe.toStringTag||"@@toStringTag",Y="object"==typeof wt,ae=V.regeneratorRuntime;if(ae)Y&&(wt.exports=ae);else{(ae=V.regeneratorRuntime=Y?wt.exports:{}).wrap=s;var m="suspendedStart",B="suspendedYield",i="executing",g="completed",f={},x={};x[G]=function(){return this};var n=Object.getPrototypeOf,c=n&&n(n(S([])));c&&c!==Le&&_.call(c,G)&&(x=c);var u=d.prototype=o.prototype=Object.create(x);r.prototype=u.constructor=d,d.constructor=r,d[ve]=r.displayName="GeneratorFunction",ae.isGeneratorFunction=function(N){var q="function"==typeof N&&N.constructor;return!!q&&(q===r||"GeneratorFunction"===(q.displayName||q.name))},ae.mark=function(N){return Object.setPrototypeOf?Object.setPrototypeOf(N,d):(N.__proto__=d,ve in N||(N[ve]="GeneratorFunction")),N.prototype=Object.create(u),N},ae.awrap=function(N){return{__await:N}},h(l.prototype),l.prototype[ue]=function(){return this},ae.AsyncIterator=l,ae.async=function(N,q,Z,le){var we=new l(s(N,q,Z,le));return ae.isGeneratorFunction(q)?we:we.next().then(function(ke){return ke.done?ke.value:we.next()})},h(u),u[ve]="Generator",u[G]=function(){return this},u.toString=function(){return"[object Generator]"},ae.keys=function(N){var q=[];for(var Z in N)q.push(Z);return q.reverse(),function le(){for(;q.length;){var we=q.pop();if(we in N)return le.value=we,le.done=!1,le}return le.done=!0,le}},ae.values=S,I.prototype={constructor:I,reset:function(N){if(this.prev=0,this.next=0,this.sent=this._sent=De,this.done=!1,this.delegate=null,this.method="next",this.arg=De,this.tryEntries.forEach(b),!N)for(var q in this)"t"===q.charAt(0)&&_.call(this,q)&&!isNaN(+q.slice(1))&&(this[q]=De)},stop:function(){this.done=!0;var N=this.tryEntries[0].completion;if("throw"===N.type)throw N.arg;return this.rval},dispatchException:function(N){if(this.done)throw N;var q=this;function Z(z,y){return ke.type="throw",ke.arg=N,q.next=z,y&&(q.method="next",q.arg=De),!!y}for(var le=this.tryEntries.length-1;le>=0;--le){var we=this.tryEntries[le],ke=we.completion;if("root"===we.tryLoc)return Z("end");if(we.tryLoc<=this.prev){var A=_.call(we,"catchLoc"),L=_.call(we,"finallyLoc");if(A&&L){if(this.prev=0;--Z){var le=this.tryEntries[Z];if(le.tryLoc<=this.prev&&_.call(le,"finallyLoc")&&this.prev=0;--q){var Z=this.tryEntries[q];if(Z.finallyLoc===N)return this.complete(Z.completion,Z.afterLoc),b(Z),f}},catch:function(N){for(var q=this.tryEntries.length-1;q>=0;--q){var Z=this.tryEntries[q];if(Z.tryLoc===N){var le=Z.completion;if("throw"===le.type){var we=le.arg;b(Z)}return we}}throw new Error("illegal catch attempt")},delegateYield:function(N,q,Z){return this.delegate={iterator:S(N),resultName:q,nextLoc:Z},"next"===this.method&&(this.arg=De),f}}}function s(N,q,Z,le){var L,z,y,C,ke=Object.create((q&&q.prototype instanceof o?q:o).prototype),A=new I(le||[]);return ke._invoke=(L=N,z=Z,y=A,C=m,function(M,U){if(C===i)throw new Error("Generator is already running");if(C===g){if("throw"===M)throw U;return R()}for(y.method=M,y.arg=U;;){var ee=y.delegate;if(ee){var J=p(ee,y);if(J){if(J===f)continue;return J}}if("next"===y.method)y.sent=y._sent=y.arg;else if("throw"===y.method){if(C===m)throw C=g,y.arg;y.dispatchException(y.arg)}else"return"===y.method&&y.abrupt("return",y.arg);C=i;var re=t(L,z,y);if("normal"===re.type){if(C=y.done?g:B,re.arg===f)continue;return{value:re.arg,done:y.done}}"throw"===re.type&&(C=g,y.method="throw",y.arg=re.arg)}}),ke}function t(N,q,Z){try{return{type:"normal",arg:N.call(q,Z)}}catch(le){return{type:"throw",arg:le}}}function o(){}function r(){}function d(){}function h(N){["next","throw","return"].forEach(function(q){N[q]=function(Z){return this._invoke(q,Z)}})}function l(N){var q;this._invoke=function(Z,le){function we(){return new Promise(function(ke,A){!function L(z,y,C,M){var U=t(N[z],N,y);if("throw"!==U.type){var ee=U.arg,J=ee.value;return J&&"object"==typeof J&&_.call(J,"__await")?Promise.resolve(J.__await).then(function(re){L("next",re,C,M)},function(re){L("throw",re,C,M)}):Promise.resolve(J).then(function(re){ee.value=re,C(ee)},M)}M(U.arg)}(Z,le,ke,A)})}return q=q?q.then(we,we):we()}}function p(N,q){var Z=N.iterator[q.method];if(Z===De){if(q.delegate=null,"throw"===q.method){if(N.iterator.return&&(q.method="return",q.arg=De,p(N,q),"throw"===q.method))return f;q.method="throw",q.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var le=t(Z,N.iterator,q.arg);if("throw"===le.type)return q.method="throw",q.arg=le.arg,q.delegate=null,f;var we=le.arg;return we?we.done?(q[N.resultName]=we.value,q.next=N.nextLoc,"return"!==q.method&&(q.method="next",q.arg=De),q.delegate=null,f):we:(q.method="throw",q.arg=new TypeError("iterator result is not an object"),q.delegate=null,f)}function w(N){var q={tryLoc:N[0]};1 in N&&(q.catchLoc=N[1]),2 in N&&(q.finallyLoc=N[2],q.afterLoc=N[3]),this.tryEntries.push(q)}function b(N){var q=N.completion||{};q.type="normal",delete q.arg,N.completion=q}function I(N){this.tryEntries=[{tryLoc:"root"}],N.forEach(w,this),this.reset(!0)}function S(N){if(N){var q=N[G];if(q)return q.call(N);if("function"==typeof N.next)return N;if(!isNaN(N.length)){var Z=-1,le=function we(){for(;++Z"+w[C][0]+""+x.delimiter_start+""+(0,G.toRawKatakana)(w[C][2])+""+x.delimiter_end+"";return re.abrupt("return",z);case 68:if("okurigana"===x.mode)for(M=0;M",U=0;U"+x.delimiter_start+""+(0,G.toRawRomaji)(w[U][3],x.romajiSystem)+""+x.delimiter_end+"";z+=""}return re.abrupt("return",z);case 70:if("okurigana"===x.mode)for(ee=0;ee"+w[J][0]+""+x.delimiter_start+""+w[J][2]+""+x.delimiter_end+"";return re.abrupt("return",z);case 72:throw new Error("Invalid Target Syllabary.");case 73:case"end":return re.stop()}},g,this)}));return function(g,f){return i.apply(this,arguments)}}()}]),B;var i}();ae.Util={isHiragana:G.isHiragana,isKatakana:G.isKatakana,isKana:G.isKana,isKanji:G.isKanji,isJapanese:G.isJapanese,hasHiragana:G.hasHiragana,hasKatakana:G.hasKatakana,hasKana:G.hasKana,hasKanji:G.hasKanji,hasJapanese:G.hasJapanese,kanaToHiragna:G.kanaToHiragna,kanaToKatakana:G.kanaToKatakana,kanaToRomaji:G.kanaToRomaji},kt.default=ae,wt.exports=kt.default},{"./util":6,"babel-runtime/regenerator":1}],5:[function(At,wt,kt){"use strict";Object.defineProperty(kt,"__esModule",{value:!0});var De=function Le(_){return _&&_.__esModule?_:{default:_}}(At("./core"));kt.default=De.default,wt.exports=kt.default},{"./core":4}],6:[function(At,wt,kt){"use strict";function V(r){if(Array.isArray(r)){for(var d=0,h=Array(r.length);d="\u3040"&&r<="\u309f"},G=function(r){return(r=r[0])>="\u30a0"&&r<="\u30ff"},ue=function(r){return oe(r)||G(r)},ve=function(r){return(r=r[0])>="\u4e00"&&r<="\u9fcf"||r>="\uf900"&&r<="\ufaff"||r>="\u3400"&&r<="\u4dbf"},Y=function(r){return ue(r)||ve(r)},ae=function(r){for(var d=0;d"\u30a0"&&d<"\u30f7"?String.fromCharCode(d.charCodeAt(0)+De):d}).join("")},x=function(r){return[].concat(V(r)).map(function(d){return d>"\u3040"&&d<"\u3097"?String.fromCharCode(d.charCodeAt(0)+Le):d}).join("")},n=function(r,d){var h={nippon:{"\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\uff10":"0","\uff01":"!","\u201c":'"',"\u201d":'"',"\uff03":"#","\uff04":"$","\uff05":"%","\uff06":"&","\u2019":"'","\uff08":"(","\uff09":")","\uff1d":"=","\uff5e":"~","\uff5c":"|","\uff20":"@","\u2018":"`","\uff0b":"+","\uff0a":"*","\uff1b":";","\uff1a":":","\uff1c":"<","\uff1e":">","\u3001":",","\u3002":".","\uff0f":"/","\uff1f":"?","\uff3f":"_","\u30fb":"\uff65","\u300c":'"',"\u300d":'"',"\uff5b":"{","\uff5d":"}","\uffe5":"\\","\uff3e":"^",\u3042:"a",\u3044:"i",\u3046:"u",\u3048:"e",\u304a:"o",\u30a2:"a",\u30a4:"i",\u30a6:"u",\u30a8:"e",\u30aa:"o",\u304b:"ka",\u304d:"ki",\u304f:"ku",\u3051:"ke",\u3053:"ko",\u30ab:"ka",\u30ad:"ki",\u30af:"ku",\u30b1:"ke",\u30b3:"ko",\u3055:"sa",\u3057:"si",\u3059:"su",\u305b:"se",\u305d:"so",\u30b5:"sa",\u30b7:"si",\u30b9:"su",\u30bb:"se",\u30bd:"so",\u305f:"ta",\u3061:"ti",\u3064:"tu",\u3066:"te",\u3068:"to",\u30bf:"ta",\u30c1:"ti",\u30c4:"tu",\u30c6:"te",\u30c8:"to",\u306a:"na",\u306b:"ni",\u306c:"nu",\u306d:"ne",\u306e:"no",\u30ca:"na",\u30cb:"ni",\u30cc:"nu",\u30cd:"ne",\u30ce:"no",\u306f:"ha",\u3072:"hi",\u3075:"hu",\u3078:"he",\u307b:"ho",\u30cf:"ha",\u30d2:"hi",\u30d5:"hu",\u30d8:"he",\u30db:"ho",\u307e:"ma",\u307f:"mi",\u3080:"mu",\u3081:"me",\u3082:"mo",\u30de:"ma",\u30df:"mi",\u30e0:"mu",\u30e1:"me",\u30e2:"mo",\u3084:"ya",\u3086:"yu",\u3088:"yo",\u30e4:"ya",\u30e6:"yu",\u30e8:"yo",\u3089:"ra",\u308a:"ri",\u308b:"ru",\u308c:"re",\u308d:"ro",\u30e9:"ra",\u30ea:"ri",\u30eb:"ru",\u30ec:"re",\u30ed:"ro",\u308f:"wa",\u3090:"wi",\u3091:"we",\u3092:"wo",\u30ef:"wa",\u30f0:"wi",\u30f1:"we",\u30f2:"wo",\u304c:"ga",\u304e:"gi",\u3050:"gu",\u3052:"ge",\u3054:"go",\u30ac:"ga",\u30ae:"gi",\u30b0:"gu",\u30b2:"ge",\u30b4:"go",\u3056:"za",\u3058:"zi",\u305a:"zu",\u305c:"ze",\u305e:"zo",\u30b6:"za",\u30b8:"zi",\u30ba:"zu",\u30bc:"ze",\u30be:"zo",\u3060:"da",\u3062:"di",\u3065:"du",\u3067:"de",\u3069:"do",\u30c0:"da",\u30c2:"di",\u30c5:"du",\u30c7:"de",\u30c9:"do",\u3070:"ba",\u3073:"bi",\u3076:"bu",\u3079:"be",\u307c:"bo",\u30d0:"ba",\u30d3:"bi",\u30d6:"bu",\u30d9:"be",\u30dc:"bo",\u3071:"pa",\u3074:"pi",\u3077:"pu",\u307a:"pe",\u307d:"po",\u30d1:"pa",\u30d4:"pi",\u30d7:"pu",\u30da:"pe",\u30dd:"po",\u304d\u3083:"kya",\u304d\u3085:"kyu",\u304d\u3087:"kyo",\u3057\u3083:"sya",\u3057\u3085:"syu",\u3057\u3087:"syo",\u3061\u3083:"tya",\u3061\u3085:"tyu",\u3061\u3087:"tyo",\u306b\u3083:"nya",\u306b\u3085:"nyu",\u306b\u3087:"nyo",\u3072\u3083:"hya",\u3072\u3085:"hyu",\u3072\u3087:"hyo",\u307f\u3083:"mya",\u307f\u3085:"myu",\u307f\u3087:"myo",\u308a\u3083:"rya",\u308a\u3085:"ryu",\u308a\u3087:"ryo",\u30ad\u30e3:"kya",\u30ad\u30e5:"kyu",\u30ad\u30e7:"kyo",\u30b7\u30e3:"sya",\u30b7\u30e5:"syu",\u30b7\u30e7:"syo",\u30c1\u30e3:"tya",\u30c1\u30e5:"tyu",\u30c1\u30e7:"tyo",\u30cb\u30e3:"nya",\u30cb\u30e5:"nyu",\u30cb\u30e7:"nyo",\u30d2\u30e3:"hya",\u30d2\u30e5:"hyu",\u30d2\u30e7:"hyo",\u30df\u30e3:"mya",\u30df\u30e5:"myu",\u30df\u30e7:"myo",\u30ea\u30e3:"rya",\u30ea\u30e5:"ryu",\u30ea\u30e7:"ryo",\u304e\u3083:"gya",\u304e\u3085:"gyu",\u304e\u3087:"gyo",\u3058\u3083:"zya",\u3058\u3085:"zyu",\u3058\u3087:"zyo",\u3062\u3083:"dya",\u3062\u3085:"dyu",\u3062\u3087:"dyo",\u3073\u3083:"bya",\u3073\u3085:"byu",\u3073\u3087:"byo",\u3074\u3083:"pya",\u3074\u3085:"pyu",\u3074\u3087:"pyo",\u304f\u308e:"kwa",\u3050\u308e:"gwa",\u30ae\u30e3:"gya",\u30ae\u30e5:"gyu",\u30ae\u30e7:"gyo",\u30b8\u30e3:"zya",\u30b8\u30e5:"zyu",\u30b8\u30e7:"zyo",\u30c2\u30e3:"dya",\u30c2\u30e5:"dyu",\u30c2\u30e7:"dyo",\u30d3\u30e3:"bya",\u30d3\u30e5:"byu",\u30d3\u30e7:"byo",\u30d4\u30e3:"pya",\u30d4\u30e5:"pyu",\u30d4\u30e7:"pyo",\u30af\u30ee:"kwa",\u30b0\u30ee:"gwa",\u3041:"a",\u3043:"i",\u3045:"u",\u3047:"e",\u3049:"o",\u3083:"ya",\u3085:"yu",\u3087:"yo",\u308e:"wa",\u30a1:"a",\u30a3:"i",\u30a5:"u",\u30a7:"e",\u30a9:"o",\u30e3:"ya",\u30e5:"yu",\u30e7:"yo",\u30ee:"wa",\u30f5:"ka",\u30f6:"ke",\u3093:"n",\u30f3:"n","\u3000":" ",\u3044\u3047:"ye",\u304d\u3047:"kye",\u304f\u3043:"kwi",\u304f\u3047:"kwe",\u304f\u3049:"kwo",\u3050\u3043:"gwi",\u3050\u3047:"gwe",\u3050\u3049:"gwo",\u30a4\u30a7:"ye",\u30ad\u30a7:"kya",\u30af\u30a3:"kwi",\u30af\u30a7:"kwe",\u30af\u30a9:"kwo",\u30b0\u30a3:"gwi",\u30b0\u30a7:"gwe",\u30b0\u30a9:"gwo",\u3057\u3047:"sye",\u3058\u3047:"zye",\u3059\u3043:"swi",\u305a\u3043:"zwi",\u3061\u3047:"tye",\u3064\u3041:"twa",\u3064\u3043:"twi",\u3064\u3047:"twe",\u3064\u3049:"two",\u306b\u3047:"nye",\u3072\u3047:"hye",\u3075\u3041:"hwa",\u3075\u3043:"hwi",\u3075\u3047:"hwe",\u3075\u3049:"hwo",\u3075\u3085:"hwyu",\u3075\u3087:"hwyo",\u30b7\u30a7:"sye",\u30b8\u30a7:"zye",\u30b9\u30a3:"swi",\u30ba\u30a3:"zwi",\u30c1\u30a7:"tye",\u30c4\u30a1:"twa",\u30c4\u30a3:"twi",\u30c4\u30a7:"twe",\u30c4\u30a9:"two",\u30cb\u30a7:"nye",\u30d2\u30a7:"hye",\u30d5\u30a1:"hwa",\u30d5\u30a3:"hwi",\u30d5\u30a7:"hwe",\u30d5\u30a9:"hwo",\u30d5\u30e5:"hwyu",\u30d5\u30e7:"hwyo"},passport:{"\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\uff10":"0","\uff01":"!","\u201c":'"',"\u201d":'"',"\uff03":"#","\uff04":"$","\uff05":"%","\uff06":"&","\u2019":"'","\uff08":"(","\uff09":")","\uff1d":"=","\uff5e":"~","\uff5c":"|","\uff20":"@","\u2018":"`","\uff0b":"+","\uff0a":"*","\uff1b":";","\uff1a":":","\uff1c":"<","\uff1e":">","\u3001":",","\u3002":".","\uff0f":"/","\uff1f":"?","\uff3f":"_","\u30fb":"\uff65","\u300c":'"',"\u300d":'"',"\uff5b":"{","\uff5d":"}","\uffe5":"\\","\uff3e":"^",\u3042:"a",\u3044:"i",\u3046:"u",\u3048:"e",\u304a:"o",\u30a2:"a",\u30a4:"i",\u30a6:"u",\u30a8:"e",\u30aa:"o",\u304b:"ka",\u304d:"ki",\u304f:"ku",\u3051:"ke",\u3053:"ko",\u30ab:"ka",\u30ad:"ki",\u30af:"ku",\u30b1:"ke",\u30b3:"ko",\u3055:"sa",\u3057:"shi",\u3059:"su",\u305b:"se",\u305d:"so",\u30b5:"sa",\u30b7:"shi",\u30b9:"su",\u30bb:"se",\u30bd:"so",\u305f:"ta",\u3061:"chi",\u3064:"tsu",\u3066:"te",\u3068:"to",\u30bf:"ta",\u30c1:"chi",\u30c4:"tsu",\u30c6:"te",\u30c8:"to",\u306a:"na",\u306b:"ni",\u306c:"nu",\u306d:"ne",\u306e:"no",\u30ca:"na",\u30cb:"ni",\u30cc:"nu",\u30cd:"ne",\u30ce:"no",\u306f:"ha",\u3072:"hi",\u3075:"fu",\u3078:"he",\u307b:"ho",\u30cf:"ha",\u30d2:"hi",\u30d5:"fu",\u30d8:"he",\u30db:"ho",\u307e:"ma",\u307f:"mi",\u3080:"mu",\u3081:"me",\u3082:"mo",\u30de:"ma",\u30df:"mi",\u30e0:"mu",\u30e1:"me",\u30e2:"mo",\u3084:"ya",\u3086:"yu",\u3088:"yo",\u30e4:"ya",\u30e6:"yu",\u30e8:"yo",\u3089:"ra",\u308a:"ri",\u308b:"ru",\u308c:"re",\u308d:"ro",\u30e9:"ra",\u30ea:"ri",\u30eb:"ru",\u30ec:"re",\u30ed:"ro",\u308f:"wa",\u3090:"i",\u3091:"e",\u3092:"o",\u30ef:"wa",\u30f0:"i",\u30f1:"e",\u30f2:"o",\u304c:"ga",\u304e:"gi",\u3050:"gu",\u3052:"ge",\u3054:"go",\u30ac:"ga",\u30ae:"gi",\u30b0:"gu",\u30b2:"ge",\u30b4:"go",\u3056:"za",\u3058:"ji",\u305a:"zu",\u305c:"ze",\u305e:"zo",\u30b6:"za",\u30b8:"ji",\u30ba:"zu",\u30bc:"ze",\u30be:"zo",\u3060:"da",\u3062:"ji",\u3065:"zu",\u3067:"de",\u3069:"do",\u30c0:"da",\u30c2:"ji",\u30c5:"zu",\u30c7:"de",\u30c9:"do",\u3070:"ba",\u3073:"bi",\u3076:"bu",\u3079:"be",\u307c:"bo",\u30d0:"ba",\u30d3:"bi",\u30d6:"bu",\u30d9:"be",\u30dc:"bo",\u3071:"pa",\u3074:"pi",\u3077:"pu",\u307a:"pe",\u307d:"po",\u30d1:"pa",\u30d4:"pi",\u30d7:"pu",\u30da:"pe",\u30dd:"po",\u304d\u3083:"kya",\u304d\u3085:"kyu",\u304d\u3087:"kyo",\u3057\u3083:"sha",\u3057\u3085:"shu",\u3057\u3087:"sho",\u3061\u3083:"cha",\u3061\u3085:"chu",\u3061\u3087:"cho",\u306b\u3083:"nya",\u306b\u3085:"nyu",\u306b\u3087:"nyo",\u3072\u3083:"hya",\u3072\u3085:"hyu",\u3072\u3087:"hyo",\u307f\u3083:"mya",\u307f\u3085:"myu",\u307f\u3087:"myo",\u308a\u3083:"rya",\u308a\u3085:"ryu",\u308a\u3087:"ryo",\u30ad\u30e3:"kya",\u30ad\u30e5:"kyu",\u30ad\u30e7:"kyo",\u30b7\u30e3:"sha",\u30b7\u30e5:"shu",\u30b7\u30e7:"sho",\u30c1\u30e3:"cha",\u30c1\u30e5:"chu",\u30c1\u30e7:"cho",\u30cb\u30e3:"nya",\u30cb\u30e5:"nyu",\u30cb\u30e7:"nyo",\u30d2\u30e3:"hya",\u30d2\u30e5:"hyu",\u30d2\u30e7:"hyo",\u30df\u30e3:"mya",\u30df\u30e5:"myu",\u30df\u30e7:"myo",\u30ea\u30e3:"rya",\u30ea\u30e5:"ryu",\u30ea\u30e7:"ryo",\u304e\u3083:"gya",\u304e\u3085:"gyu",\u304e\u3087:"gyo",\u3058\u3083:"ja",\u3058\u3085:"ju",\u3058\u3087:"jo",\u3062\u3083:"ja",\u3062\u3085:"ju",\u3062\u3087:"jo",\u3073\u3083:"bya",\u3073\u3085:"byu",\u3073\u3087:"byo",\u3074\u3083:"pya",\u3074\u3085:"pyu",\u3074\u3087:"pyo",\u30ae\u30e3:"gya",\u30ae\u30e5:"gyu",\u30ae\u30e7:"gyo",\u30b8\u30e3:"ja",\u30b8\u30e5:"ju",\u30b8\u30e7:"jo",\u30c2\u30e3:"ja",\u30c2\u30e5:"ju",\u30c2\u30e7:"jo",\u30d3\u30e3:"bya",\u30d3\u30e5:"byu",\u30d3\u30e7:"byo",\u30d4\u30e3:"pya",\u30d4\u30e5:"pyu",\u30d4\u30e7:"pyo",\u3041:"a",\u3043:"i",\u3045:"u",\u3047:"e",\u3049:"o",\u3083:"ya",\u3085:"yu",\u3087:"yo",\u308e:"wa",\u30a1:"a",\u30a3:"i",\u30a5:"u",\u30a7:"e",\u30a9:"o",\u30e3:"ya",\u30e5:"yu",\u30e7:"yo",\u30ee:"wa",\u30f5:"ka",\u30f6:"ke",\u3093:"n",\u30f3:"n","\u3000":" ",\u30f4:"b"},hepburn:{"\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\uff10":"0","\uff01":"!","\u201c":'"',"\u201d":'"',"\uff03":"#","\uff04":"$","\uff05":"%","\uff06":"&","\u2019":"'","\uff08":"(","\uff09":")","\uff1d":"=","\uff5e":"~","\uff5c":"|","\uff20":"@","\u2018":"`","\uff0b":"+","\uff0a":"*","\uff1b":";","\uff1a":":","\uff1c":"<","\uff1e":">","\u3001":",","\u3002":".","\uff0f":"/","\uff1f":"?","\uff3f":"_","\u30fb":"\uff65","\u300c":'"',"\u300d":'"',"\uff5b":"{","\uff5d":"}","\uffe5":"\\","\uff3e":"^",\u3042:"a",\u3044:"i",\u3046:"u",\u3048:"e",\u304a:"o",\u30a2:"a",\u30a4:"i",\u30a6:"u",\u30a8:"e",\u30aa:"o",\u304b:"ka",\u304d:"ki",\u304f:"ku",\u3051:"ke",\u3053:"ko",\u30ab:"ka",\u30ad:"ki",\u30af:"ku",\u30b1:"ke",\u30b3:"ko",\u3055:"sa",\u3057:"shi",\u3059:"su",\u305b:"se",\u305d:"so",\u30b5:"sa",\u30b7:"shi",\u30b9:"su",\u30bb:"se",\u30bd:"so",\u305f:"ta",\u3061:"chi",\u3064:"tsu",\u3066:"te",\u3068:"to",\u30bf:"ta",\u30c1:"chi",\u30c4:"tsu",\u30c6:"te",\u30c8:"to",\u306a:"na",\u306b:"ni",\u306c:"nu",\u306d:"ne",\u306e:"no",\u30ca:"na",\u30cb:"ni",\u30cc:"nu",\u30cd:"ne",\u30ce:"no",\u306f:"ha",\u3072:"hi",\u3075:"fu",\u3078:"he",\u307b:"ho",\u30cf:"ha",\u30d2:"hi",\u30d5:"fu",\u30d8:"he",\u30db:"ho",\u307e:"ma",\u307f:"mi",\u3080:"mu",\u3081:"me",\u3082:"mo",\u30de:"ma",\u30df:"mi",\u30e0:"mu",\u30e1:"me",\u30e2:"mo",\u3084:"ya",\u3086:"yu",\u3088:"yo",\u30e4:"ya",\u30e6:"yu",\u30e8:"yo",\u3089:"ra",\u308a:"ri",\u308b:"ru",\u308c:"re",\u308d:"ro",\u30e9:"ra",\u30ea:"ri",\u30eb:"ru",\u30ec:"re",\u30ed:"ro",\u308f:"wa",\u3090:"i",\u3091:"e",\u3092:"o",\u30ef:"wa",\u30f0:"i",\u30f1:"e",\u30f2:"o",\u304c:"ga",\u304e:"gi",\u3050:"gu",\u3052:"ge",\u3054:"go",\u30ac:"ga",\u30ae:"gi",\u30b0:"gu",\u30b2:"ge",\u30b4:"go",\u3056:"za",\u3058:"ji",\u305a:"zu",\u305c:"ze",\u305e:"zo",\u30b6:"za",\u30b8:"ji",\u30ba:"zu",\u30bc:"ze",\u30be:"zo",\u3060:"da",\u3062:"ji",\u3065:"zu",\u3067:"de",\u3069:"do",\u30c0:"da",\u30c2:"ji",\u30c5:"zu",\u30c7:"de",\u30c9:"do",\u3070:"ba",\u3073:"bi",\u3076:"bu",\u3079:"be",\u307c:"bo",\u30d0:"ba",\u30d3:"bi",\u30d6:"bu",\u30d9:"be",\u30dc:"bo",\u3071:"pa",\u3074:"pi",\u3077:"pu",\u307a:"pe",\u307d:"po",\u30d1:"pa",\u30d4:"pi",\u30d7:"pu",\u30da:"pe",\u30dd:"po",\u304d\u3083:"kya",\u304d\u3085:"kyu",\u304d\u3087:"kyo",\u3057\u3083:"sha",\u3057\u3085:"shu",\u3057\u3087:"sho",\u3061\u3083:"cha",\u3061\u3085:"chu",\u3061\u3087:"cho",\u306b\u3083:"nya",\u306b\u3085:"nyu",\u306b\u3087:"nyo",\u3072\u3083:"hya",\u3072\u3085:"hyu",\u3072\u3087:"hyo",\u307f\u3083:"mya",\u307f\u3085:"myu",\u307f\u3087:"myo",\u308a\u3083:"rya",\u308a\u3085:"ryu",\u308a\u3087:"ryo",\u30ad\u30e3:"kya",\u30ad\u30e5:"kyu",\u30ad\u30e7:"kyo",\u30b7\u30e3:"sha",\u30b7\u30e5:"shu",\u30b7\u30e7:"sho",\u30c1\u30e3:"cha",\u30c1\u30e5:"chu",\u30c1\u30e7:"cho",\u30cb\u30e3:"nya",\u30cb\u30e5:"nyu",\u30cb\u30e7:"nyo",\u30d2\u30e3:"hya",\u30d2\u30e5:"hyu",\u30d2\u30e7:"hyo",\u30df\u30e3:"mya",\u30df\u30e5:"myu",\u30df\u30e7:"myo",\u30ea\u30e3:"rya",\u30ea\u30e5:"ryu",\u30ea\u30e7:"ryo",\u304e\u3083:"gya",\u304e\u3085:"gyu",\u304e\u3087:"gyo",\u3058\u3083:"ja",\u3058\u3085:"ju",\u3058\u3087:"jo",\u3062\u3083:"ja",\u3062\u3085:"ju",\u3062\u3087:"jo",\u3073\u3083:"bya",\u3073\u3085:"byu",\u3073\u3087:"byo",\u3074\u3083:"pya",\u3074\u3085:"pyu",\u3074\u3087:"pyo",\u30ae\u30e3:"gya",\u30ae\u30e5:"gyu",\u30ae\u30e7:"gyo",\u30b8\u30e3:"ja",\u30b8\u30e5:"ju",\u30b8\u30e7:"jo",\u30c2\u30e3:"ja",\u30c2\u30e5:"ju",\u30c2\u30e7:"jo",\u30d3\u30e3:"bya",\u30d3\u30e5:"byu",\u30d3\u30e7:"byo",\u30d4\u30e3:"pya",\u30d4\u30e5:"pyu",\u30d4\u30e7:"pyo",\u3041:"a",\u3043:"i",\u3045:"u",\u3047:"e",\u3049:"o",\u3083:"ya",\u3085:"yu",\u3087:"yo",\u308e:"wa",\u30a1:"a",\u30a3:"i",\u30a5:"u",\u30a7:"e",\u30a9:"o",\u30e3:"ya",\u30e5:"yu",\u30e7:"yo",\u30ee:"wa",\u30f5:"ka",\u30f6:"ke",\u3093:"n",\u30f3:"n","\u3000":" ",\u3044\u3047:"ye",\u3046\u3043:"wi",\u3046\u3047:"we",\u3046\u3049:"wo",\u304d\u3047:"kye",\u304f\u3041:"kwa",\u304f\u3043:"kwi",\u304f\u3047:"kwe",\u304f\u3049:"kwo",\u3050\u3041:"gwa",\u3050\u3043:"gwi",\u3050\u3047:"gwe",\u3050\u3049:"gwo",\u30a4\u30a7:"ye",\u30a6\u30a3:"wi",\u30a6\u30a7:"we",\u30a6\u30a9:"wo",\u30f4:"vu",\u30f4\u30a1:"va",\u30f4\u30a3:"vi",\u30f4\u30a7:"ve",\u30f4\u30a9:"vo",\u30f4\u30e5:"vyu",\u30f4\u30e7:"vyo",\u30ad\u30a7:"kya",\u30af\u30a1:"kwa",\u30af\u30a3:"kwi",\u30af\u30a7:"kwe",\u30af\u30a9:"kwo",\u30b0\u30a1:"gwa",\u30b0\u30a3:"gwi",\u30b0\u30a7:"gwe",\u30b0\u30a9:"gwo",\u3057\u3047:"she",\u3058\u3047:"je",\u3061\u3047:"che",\u3064\u3041:"tsa",\u3064\u3043:"tsi",\u3064\u3047:"tse",\u3064\u3049:"tso",\u3066\u3043:"ti",\u3066\u3085:"tyu",\u3067\u3043:"di",\u3067\u3085:"dyu",\u3068\u3045:"tu",\u3069\u3045:"du",\u306b\u3047:"nye",\u3072\u3047:"hye",\u3075\u3041:"fa",\u3075\u3043:"fi",\u3075\u3047:"fe",\u3075\u3049:"fo",\u3075\u3085:"fyu",\u3075\u3087:"fyo",\u30b7\u30a7:"she",\u30b8\u30a7:"je",\u30c1\u30a7:"che",\u30c4\u30a1:"tsa",\u30c4\u30a3:"tsi",\u30c4\u30a7:"tse",\u30c4\u30a9:"tso",\u30c6\u30a3:"ti",\u30c6\u30e5:"tyu",\u30c7\u30a3:"di",\u30c7\u30e5:"dyu",\u30c8\u30a5:"tu",\u30c9\u30a5:"du",\u30cb\u30a7:"nye",\u30d2\u30a7:"hye",\u30d5\u30a1:"fa",\u30d5\u30a3:"fi",\u30d5\u30a7:"fe",\u30d5\u30a9:"fo",\u30d5\u30e5:"fyu",\u30d5\u30e7:"fyo"}},l=0,p=void 0,w=void 0,b="";if((d=d||_.HEPBURN)===_.PASSPORT&&(r=r.replace(/\u30fc/gm,"")),d===_.NIPPON||d===_.HEPBURN){for(var I=new RegExp(/(\u3093|\u30f3)(?=\u3042|\u3044|\u3046|\u3048|\u304a|\u30a2|\u30a4|\u30a6|\u30a8|\u30aa|\u3041|\u3043|\u3045|\u3047|\u3049|\u30a1|\u30a3|\u30a5|\u30a7|\u30a9|\u3084|\u3086|\u3088|\u30e4|\u30e6|\u30e8|\u3083|\u3085|\u3087|\u30e3|\u30e5|\u30e7)/g),S=void 0,R=[];null!==(S=I.exec(r));)R.push(S.index+1);if(0!==R.length){for(var N="",q=0;q=0&&r[h-1].pos&&"\u52d5\u8a5e"===r[h-1].pos&&(r[h-1].surface_form+="\u3046",r[h-1].pronunciation?r[h-1].pronunciation+="\u30fc":r[h-1].pronunciation=r[h-1].reading+"\u30fc",r[h-1].reading+="\u30a6",r.splice(h,1),h--);for(var l=0;l1&&("\u3063"===r[l].surface_form[r[l].surface_form.length-1]||"\u30c3"===r[l].surface_form[r[l].surface_form.length-1])&&l+1-1&&Ae%1==0&&Ae<=ke}function L(Ae){return null!=Ae&&A(Ae.length)&&!function(Ve){if(!ve(Ve))return!1;var tt=N(Ve);return tt==Z||tt==le||tt==q||tt==we}(Ae)}var z={};function y(){}function C(Ae){return function(){if(null!==Ae){var Ve=Ae;Ae=null,Ve.apply(this,arguments)}}}var M="function"==typeof Symbol&&Symbol.iterator,U=function(Ae){return M&&Ae[M]&&Ae[M]()};function ee(Ae){return null!=Ae&&"object"==typeof Ae}var J="[object Arguments]";function re(Ae){return ee(Ae)&&N(Ae)==J}var Ue=Object.prototype,We=Ue.hasOwnProperty,Qe=Ue.propertyIsEnumerable,ft=re(function(){return arguments}())?re:function(Ae){return ee(Ae)&&We.call(Ae,"callee")&&!Qe.call(Ae,"callee")},pt=Array.isArray,Xt="object"==typeof _&&_&&!_.nodeType&&_,It=Xt&&"object"==typeof wt&&wt&&!wt.nodeType&&wt,Ft=It&&It.exports===Xt?r.Buffer:void 0,Ke=(Ft?Ft.isBuffer:void 0)||function(){return!1},mt=9007199254740991,St=/^(?:0|[1-9]\d*)$/;function K(Ae,Ve){var tt=typeof Ae;return!!(Ve=Ve??mt)&&("number"==tt||"symbol"!=tt&&St.test(Ae))&&Ae>-1&&Ae%1==0&&Ae2&&(Xi=oe(arguments,1)),ao){var ro={};Ee(Ut,function(io,So){ro[So]=io}),ro[jr]=Xi,Ht=!0,Zt=Object.create(null),tt(ao,ro)}else Ut[jr]=Xi,_n(Zt[jr]||[],function(io){io()}),Lr()});Rt++;var ji=u(zi[zi.length-1]);zi.length>1?ji(Ut,no):ji(no)}}(Wr,Rr)})}function Lr(){if(0===vn.length&&0===Rt)return tt(null,Ut);for(;vn.length&&Rt=0&&Rr.push(zi)}),Rr}Ee(Ae,function(Wr,Rr){if(!pt(Wr))return ir(Rr,[Wr]),void On.push(Rr);var jr=Wr.slice(0,Wr.length-1),zi=jr.length;if(0===zi)return ir(Rr,Wr),void On.push(Rr);Dn[Rr]=zi,_n(jr,function(no){if(!Ae[no])throw new Error("async.auto task `"+Rr+"` has a non-existent dependency `"+no+"` in "+jr.join(", "));var ji,Xi;(Xi=Zt[ji=no])||(Xi=Zt[ji]=[]),Xi.push(function(){0==--zi&&ir(Rr,Wr)})})}),function(){for(var Rr=0;On.length;)Rr++,_n(Yr(On.pop()),function(jr){0==--Dn[jr]&&On.push(jr)});if(Rr!==ht)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),Lr()};function Mn(Ae,Ve){for(var tt=-1,ht=null==Ae?0:Ae.length,Ut=Array(ht);++tt0?On:ht);else if(vn)tt[Ut]=ht;else{if(Rt=Ht=(Ht=(Ht=(Ht=(Ht=ht).toString().replace(ci,"")).match(zr)[2].replace(" ",""))?Ht.split(Ei):[]).map(function(Dn){return function Vr(Ae,Ve,tt){var ht;if((Ae=null==(ht=Ae)?"":Hn(ht))&&(tt||void 0===Ve))return Ae.replace(li,"");if(!Ae||!(Ve=Hn(Ve)))return Ae;var Ut=hr(Ae),Rt=hr(Ve);return function Yn(Ae,Ve,tt){var ht=Ae.length;return tt=void 0===tt?ht:tt,!Ve&&tt>=ht?Ae:function(Ut,Rt,Ht){var Zt=-1,vn=Ut.length;Rt<0&&(Rt=-Rt>vn?0:vn+Rt),(Ht=Ht>vn?vn:Ht)<0&&(Ht+=vn),vn=Rt>Ht?0:Ht-Rt>>>0,Rt>>>=0;for(var On=Array(vn);++Zt-1;);return vn}(Ut,Rt),function(Ht,Zt){for(var vn=Ht.length;vn--&&Nn(Zt,Ht[vn],0)>-1;);return vn}(Ut,Rt)+1).join("")}(Dn.replace(ei,""))}),0===ht.length&&!Zt&&0===Rt.length)throw new Error("autoInject task functions require explicit parameters.");Zt||Rt.pop(),tt[Ut]=Rt.concat(On)}function On(Dn,ir){var Lr=Mn(Rt,function(Yr){return Dn[Yr]});Lr.push(ir),u(ht).apply(null,Lr)}}),mn(tt,Ve)}function Dr(){this.head=this.tail=null,this.length=0}function Zr(Ae,Ve){Ae.length=1,Ae.head=Ae.tail=Ve}function si(Ae,Ve,tt){if(null==Ve)Ve=1;else if(0===Ve)throw new Error("Concurrency must not be zero");var ht=u(Ae),Ut=0,Rt=[],Ht=!1;function Zt(ir,Lr,Yr){if(null!=Yr&&"function"!=typeof Yr)throw new Error("task callback must be a function");if(Dn.started=!0,pt(ir)||(ir=[ir]),0===ir.length&&Dn.idle())return i(function(){Dn.drain()});for(var Wr=0,Rr=ir.length;Wr0&&Rt.splice(jr,1),Rr.callback.apply(Rr,arguments),null!=Lr&&Dn.error(Lr,Rr.data)}Ut<=Dn.concurrency-Dn.buffer&&Dn.unsaturated(),Dn.idle()&&Dn.drain(),Dn.process()}}var On=!1,Dn={_tasks:new Dr,concurrency:Ve,payload:tt,saturated:y,unsaturated:y,buffer:Ve/4,empty:y,drain:y,error:y,started:!1,paused:!1,push:function(ir,Lr){Zt(ir,!1,Lr)},kill:function(){Dn.drain=y,Dn._tasks.empty()},unshift:function(ir,Lr){Zt(ir,!0,Lr)},remove:function(ir){Dn._tasks.remove(ir)},process:function(){if(!On){for(On=!0;!Dn.paused&&Ut2&&(vn=oe(arguments,1)),ht[Rt]=vn,Ht(Zt)})},function(Ut){tt(Ut,ht)})}function on(Ae,Ve){xt(Re,Ae,Ve)}function kn(Ae,Ve,tt){xt(Pn(Ve),Ae,tt)}var pn=function(Ae,Ve){var tt=u(Ae);return si(function(ht,Ut){tt(ht[0],Ut)},Ve,1)},Sn=function(Ae,Ve){var tt=pn(Ae,Ve);return tt.push=function(ht,Ut,Rt){if(null==Rt&&(Rt=y),"function"!=typeof Rt)throw new Error("task callback must be a function");if(tt.started=!0,pt(ht)||(ht=[ht]),0===ht.length)return i(function(){tt.drain()});Ut=Ut||0;for(var Ht=tt._tasks.head;Ht&&Ut>=Ht.priority;)Ht=Ht.next;for(var Zt=0,vn=ht.length;Ztvn?1:0}Xe(Ae,function(Rt,Ht){ht(Rt,function(Zt,vn){if(Zt)return Ht(Zt);Ht(null,{value:Rt,criteria:vn})})},function(Rt,Ht){if(Rt)return tt(Rt);tt(null,Mn(Ht.sort(Ut),dn("value")))})}function Yi(Ae,Ve,tt){var ht=u(Ae);return ue(function(Ut,Rt){var Ht,Zt=!1;Ut.push(function(){Zt||(Rt.apply(null,arguments),clearTimeout(Ht))}),Ht=setTimeout(function(){var On=new Error('Callback function "'+(Ae.name||"anonymous")+'" timed out.');On.code="ETIMEDOUT",tt&&(On.info=tt),Zt=!0,Rt(On)},Ve),ht.apply(null,Ut)})}var $i=Math.ceil,Ri=Math.max;function ri(Ae,Ve,tt,ht){var Ut=u(tt);Bt(function(Rt,Ht,Zt,vn){for(var On=-1,Dn=Ri($i((Ht-Rt)/1),0),ir=Array(Dn);Dn--;)ir[++On]=Rt,Rt+=1;return ir}(0,Ae),Ve,Ut,ht)}var Ki=Mt(ri,1/0),Ni=Mt(ri,1);function Oi(Ae,Ve,tt,ht){arguments.length<=3&&(ht=tt,tt=Ve,Ve=pt(Ae)?[]:{}),ht=C(ht||y);var Ut=u(tt);Re(Ae,function(Rt,Ht,Zt){Ut(Ve,Rt,Ht,Zt)},function(Rt){ht(Rt,Ve)})}function bi(Ae,Ve){var tt,ht=null;Ve=Ve||y,lt(Ae,function(Ut,Rt){u(Ut)(function(Ht,Zt){tt=arguments.length>2?oe(arguments,1):Zt,ht=Ht,Rt(!Ht)})},function(){Ve(ht,tt)})}function Si(Ae){return function(){return(Ae.unmemoized||Ae).apply(null,arguments)}}function ai(Ae,Ve,tt){tt=An(tt||y);var ht=u(Ve);if(!Ae())return tt(null);var Ut=function(Rt){if(Rt)return tt(Rt);if(Ae())return ht(Ut);var Ht=oe(arguments,1);tt.apply(null,[null].concat(Ht))};ht(Ut)}function Mi(Ae,Ve,tt){ai(function(){return!Ae.apply(this,arguments)},Ve,tt)}var Vi=function(Ae,Ve){if(Ve=C(Ve||y),!pt(Ae))return Ve(new Error("First argument to waterfall must be an array of functions"));if(!Ae.length)return Ve();var tt=0;function ht(Rt){var Ht=u(Ae[tt++]);Rt.push(An(Ut)),Ht.apply(null,Rt)}function Ut(Rt){if(Rt||tt===Ae.length)return Ve.apply(null,arguments);ht(oe(arguments,1))}ht([])};_.default={apply:G,applyEach:st,applyEachSeries:nn,asyncify:g,auto:mn,autoInject:Gr,cargo:yi,compose:Wi,concat:_i,concatLimit:eo,concatSeries:ki,constant:Pi,detect:P,detectLimit:W,detectSeries:Q,dir:me,doDuring:Te,doUntil:Oe,doWhilst:Se,during:qe,each:jt,eachLimit:ot,eachOf:Re,eachOfLimit:mr,eachOfSeries:Br,eachSeries:lt,ensureAsync:Dt,every:Tt,everyLimit:zt,everySeries:Pt,filter:vr,filterLimit:br,filterSeries:tr,forever:nr,groupBy:Jr,groupByLimit:rr,groupBySeries:ze,log:Et,map:Xe,mapLimit:Bt,mapSeries:qt,mapValues:ln,mapValuesLimit:Wt,mapValuesSeries:$n,memoize:Ce,nextTick:_t,parallel:on,parallelLimit:kn,priorityQueue:Sn,queue:pn,race:bn,reduce:Jn,reduceRight:Ln,reflect:Wn,reflectAll:dr,reject:xr,rejectLimit:ur,rejectSeries:Er,retry:Cr,retryable:fr,seq:_r,series:qr,setImmediate:i,some:fi,someLimit:ti,someSeries:ni,sortBy:Hr,timeout:Yi,times:Ki,timesLimit:ri,timesSeries:Ni,transform:Oi,tryEach:bi,unmemoize:Si,until:Mi,waterfall:Vi,whilst:ai,all:Tt,allLimit:zt,allSeries:Pt,any:fi,anyLimit:ti,anySeries:ni,find:P,findLimit:W,findSeries:Q,forEach:jt,forEachSeries:lt,forEachLimit:ot,forEachOf:Re,forEachOfSeries:Br,forEachOfLimit:mr,inject:Jn,foldl:Jn,foldr:Ln,select:vr,selectLimit:br,selectSeries:tr,wrapSync:g},_.apply=G,_.applyEach=st,_.applyEachSeries=nn,_.asyncify=g,_.auto=mn,_.autoInject=Gr,_.cargo=yi,_.compose=Wi,_.concat=_i,_.concatLimit=eo,_.concatSeries=ki,_.constant=Pi,_.detect=P,_.detectLimit=W,_.detectSeries=Q,_.dir=me,_.doDuring=Te,_.doUntil=Oe,_.doWhilst=Se,_.during=qe,_.each=jt,_.eachLimit=ot,_.eachOf=Re,_.eachOfLimit=mr,_.eachOfSeries=Br,_.eachSeries=lt,_.ensureAsync=Dt,_.every=Tt,_.everyLimit=zt,_.everySeries=Pt,_.filter=vr,_.filterLimit=br,_.filterSeries=tr,_.forever=nr,_.groupBy=Jr,_.groupByLimit=rr,_.groupBySeries=ze,_.log=Et,_.map=Xe,_.mapLimit=Bt,_.mapSeries=qt,_.mapValues=ln,_.mapValuesLimit=Wt,_.mapValuesSeries=$n,_.memoize=Ce,_.nextTick=_t,_.parallel=on,_.parallelLimit=kn,_.priorityQueue=Sn,_.queue=pn,_.race=bn,_.reduce=Jn,_.reduceRight=Ln,_.reflect=Wn,_.reflectAll=dr,_.reject=xr,_.rejectLimit=ur,_.rejectSeries=Er,_.retry=Cr,_.retryable=fr,_.seq=_r,_.series=qr,_.setImmediate=i,_.some=fi,_.someLimit=ti,_.someSeries=ni,_.sortBy=Hr,_.timeout=Yi,_.times=Ki,_.timesLimit=ri,_.timesSeries=Ni,_.transform=Oi,_.tryEach=bi,_.unmemoize=Si,_.until=Mi,_.waterfall=Vi,_.whilst=ai,_.all=Tt,_.allLimit=zt,_.allSeries=Pt,_.any=fi,_.anyLimit=ti,_.anySeries=ni,_.find=P,_.findLimit=W,_.findSeries=Q,_.forEach=jt,_.forEachSeries=lt,_.forEachLimit=ot,_.forEachOf=Re,_.forEachOfSeries=Br,_.forEachOfLimit=mr,_.inject=Jn,_.foldl=Jn,_.foldr=Ln,_.select=vr,_.selectLimit=br,_.selectSeries=tr,_.wrapSync=g,Object.defineProperty(_,"__esModule",{value:!0})},oe("object"==typeof kt&&typeof wt<"u"?kt:this.async=this.async||{})}).call(this,At("_process"),typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},At("timers").setImmediate)},{_process:26,timers:27}],2:[function(At,wt,kt){!function(){"use strict";var V=function(Y){null==Y&&(Y=1024);var ae=function(x,n,c){for(var u=n;u=55296&&g<=56319){var f=g,x=Y.charCodeAt(m++);if(!(x>=56320&&x<=57343))return null;i=1024*(f-55296)+65536+(x-56320)}else i=g;i<128?ae[B++]=i:i<2048?(ae[B++]=i>>>6|192,ae[B++]=63&i|128):i<65536?(ae[B++]=i>>>12|224,ae[B++]=i>>6&63|128,ae[B++]=63&i|128):i<1<<21&&(ae[B++]=i>>>18|240,ae[B++]=i>>12&63|128,ae[B++]=i>>6&63|128,ae[B++]=63&i|128)}return ae.subarray(0,B)},ue=function(Y){for(var ae,m,B,g="",f=0;f>5==6?(31&m)<<6|63&Y[f++]:m>>4==14?(15&m)<<12|(63&Y[f++])<<6|63&Y[f++]:(7&m)<<18|(63&Y[f++])<<12|(63&Y[f++])<<6|63&Y[f++])<65536?g+=String.fromCharCode(ae):(B=55296|(ae-=65536)>>10,g+=String.fromCharCode(B,56320|1023&ae));return g},ve={builder:function(Y){return new De(Y)},load:function(Y,ae){var m=V(0);return m.loadBaseBuffer(Y),m.loadCheckBuffer(ae),new Le(m)}};typeof wt>"u"?window.doublearray=ve:wt.exports=ve}()},{}],3:[function(At,wt,kt){"use strict";var V=At("./viterbi/ViterbiBuilder"),De=At("./viterbi/ViterbiSearcher"),Le=At("./util/IpadicFormatter"),_=/\u3001|\u3002/;function oe(G){this.token_info_dictionary=G.token_info_dictionary,this.unknown_dictionary=G.unknown_dictionary,this.viterbi_builder=new V(G),this.viterbi_searcher=new De(G.connection_costs),this.formatter=new Le}oe.splitByPunctuation=function(G){for(var ue=[],ve=G;""!==ve;){var Y=ve.search(_);if(Y<0){ue.push(ve);break}ue.push(ve.substring(0,Y+1)),ve=ve.substring(Y+1)}return ue},oe.prototype.tokenize=function(G){for(var ue=oe.splitByPunctuation(G),ve=[],Y=0;Y0&&(ae=ue[ue.length-1].word_position);for(var m=0;m65535)&&console.log("char.def parse error. CODE is invalid:"+ue),{start:ue,default:ve,compatible:Y}},oe.parseRangeCategoryMapping=function(G){var ue=parseInt(G[1]),ve=parseInt(G[2]),Y=G[3],ae=465535)&&console.log("char.def parse error. CODE is invalid:"+ue),(!isFinite(ve)||ve<0||ve>65535)&&console.log("char.def parse error. CODE is invalid:"+ve),{start:ue,end:ve,default:Y,compatible:ae}},oe.prototype.initCategoryMappings=function(G){var ue;if(null!=G)for(var ve=0;ve>>31==1){var m=this.invoke_definition_map.getCharacterClass(ae);if(null==m)continue;ve.push(m)}return ve},oe.prototype.lookup=function(G){var ue,ve=G.charCodeAt(0);return Le.isSurrogatePair(G)?ue=this.invoke_definition_map.lookup(_):ve0&&200!==this.status)oe(G.statusText,null);else{var ve=new V.Zlib.Gunzip(new Uint8Array(this.response)).decompress();oe(null,ve.buffer)}},G.onerror=function(ue){oe(ue,null)},G.send()},wt.exports=Le},{"./DictionaryLoader":17,"zlibjs/bin/gunzip.min.js":28}],17:[function(At,wt,kt){"use strict";var V=At("path"),De=At("async"),Le=At("../dict/DynamicDictionaries");function _(oe){this.dic=new Le,this.dic_path=oe}_.prototype.loadArrayBuffer=function(oe,G){throw new Error("DictionaryLoader#loadArrayBuffer should be overwrite")},_.prototype.load=function(oe){var G=this.dic,ue=this.dic_path,ve=this.loadArrayBuffer;De.parallel([function(Y){De.map(["base.dat.gz","check.dat.gz"],function(ae,m){ve(V.join(ue,ae),function(B,i){if(B)return m(B);m(null,i)})},function(ae,m){if(ae)return Y(ae);var B=new Int32Array(m[0]),i=new Int32Array(m[1]);G.loadTrie(B,i),Y(null)})},function(Y){De.map(["tid.dat.gz","tid_pos.dat.gz","tid_map.dat.gz"],function(ae,m){ve(V.join(ue,ae),function(B,i){if(B)return m(B);m(null,i)})},function(ae,m){if(ae)return Y(ae);var B=new Uint8Array(m[0]),i=new Uint8Array(m[1]),g=new Uint8Array(m[2]);G.loadTokenInfoDictionaries(B,i,g),Y(null)})},function(Y){ve(V.join(ue,"cc.dat.gz"),function(ae,m){if(ae)return Y(ae);var B=new Int16Array(m);G.loadConnectionCosts(B),Y(null)})},function(Y){De.map(["unk.dat.gz","unk_pos.dat.gz","unk_map.dat.gz","unk_char.dat.gz","unk_compat.dat.gz","unk_invoke.dat.gz"],function(ae,m){ve(V.join(ue,ae),function(B,i){if(B)return m(B);m(null,i)})},function(ae,m){if(ae)return Y(ae);var B=new Uint8Array(m[0]),i=new Uint8Array(m[1]),g=new Uint8Array(m[2]),f=new Uint8Array(m[3]),x=new Uint32Array(m[4]),n=new Uint8Array(m[5]);G.loadUnknownDictionaries(B,i,g,f,x,n),Y(null)})}],function(Y){oe(Y,G)})},wt.exports=_},{"../dict/DynamicDictionaries":8,async:1,path:25}],18:[function(At,wt,kt){"use strict";function Le(_){var oe;if(null==_)oe=1048576;else{if("number"!=typeof _){if(_ instanceof Uint8Array)return this.buffer=_,void(this.position=0);throw typeof _+" is invalid parameter type for ByteBuffer constructor"}oe=_}this.buffer=new Uint8Array(oe),this.position=0}Le.prototype.size=function(){return this.buffer.length},Le.prototype.reallocate=function(){var _=new Uint8Array(2*this.buffer.length);_.set(this.buffer),this.buffer=_},Le.prototype.shrink=function(){return this.buffer=this.buffer.subarray(0,this.position),this.buffer},Le.prototype.put=function(_){this.buffer.length>8;this.put(255&_),this.put(G)},Le.prototype.getShort=function(_){if(null==_&&(_=this.position,this.position+=2),this.buffer.length<_+2)return 0;var G=(this.buffer[_+1]<<8)+this.buffer[_];return 32768&G&&(G=-(G-1^65535)),G},Le.prototype.putInt=function(_){if(4294967295<_)throw _+" is over integer value";var G=(65280&_)>>8,ue=(16711680&_)>>16,ve=(4278190080&_)>>24;this.put(255&_),this.put(G),this.put(ue),this.put(ve)},Le.prototype.getInt=function(_){return null==_&&(_=this.position,this.position+=4),this.buffer.length<_+4?0:(this.buffer[_+3]<<24)+(this.buffer[_+2]<<16)+(this.buffer[_+1]<<8)+this.buffer[_]},Le.prototype.readInt=function(){var _=this.position;return this.position+=4,this.getInt(_)},Le.prototype.putString=function(_){for(var oe=function(_){for(var oe=new Uint8Array(4*_.length),G=0,ue=0;G<_.length;){var ve,Y=_.charCodeAt(G++);if(Y>=55296&&Y<=56319){var ae=Y,m=_.charCodeAt(G++);if(!(m>=56320&&m<=57343))return null;ve=1024*(ae-55296)+65536+(m-56320)}else ve=Y;ve<128?oe[ue++]=ve:ve<2048?(oe[ue++]=ve>>>6|192,oe[ue++]=63&ve|128):ve<65536?(oe[ue++]=ve>>>12|224,oe[ue++]=ve>>6&63|128,oe[ue++]=63&ve|128):ve<2097152&&(oe[ue++]=ve>>>18|240,oe[ue++]=ve>>12&63|128,oe[ue++]=ve>>6&63|128,oe[ue++]=63&ve|128)}return oe.subarray(0,ue)}(_),G=0;G>5==6?(31&G)<<6|63&_[ae++]:G>>4==14?(15&G)<<12|(63&_[ae++])<<6|63&_[ae++]:(7&G)<<18|(63&_[ae++])<<12|(63&_[ae++])<<6|63&_[ae++])<65536?Y+=String.fromCharCode(oe):(ue=55296|(oe-=65536)>>10,Y+=String.fromCharCode(ue,56320|1023&oe));return Y}(G)},wt.exports=Le},{}],19:[function(At,wt,kt){"use strict";function V(){}V.prototype.formatEntry=function(De,Le,_,oe){var G={};return G.word_id=De,G.word_type=_,G.word_position=Le,G.surface_form=oe[0],G.pos=oe[1],G.pos_detail_1=oe[2],G.pos_detail_2=oe[3],G.pos_detail_3=oe[4],G.conjugated_type=oe[5],G.conjugated_form=oe[6],G.basic_form=oe[7],G.reading=oe[8],G.pronunciation=oe[9],G},V.prototype.formatUnknownEntry=function(De,Le,_,oe,G){var ue={};return ue.word_id=De,ue.word_type=_,ue.word_position=Le,ue.surface_form=G,ue.pos=oe[1],ue.pos_detail_1=oe[2],ue.pos_detail_2=oe[3],ue.pos_detail_3=oe[4],ue.conjugated_type=oe[5],ue.conjugated_form=oe[6],ue.basic_form=oe[7],ue},wt.exports=V},{}],20:[function(At,wt,kt){"use strict";function V(De){this.str=De,this.index_mapping=[];for(var Le=0;Le=55296&&oe<=56319&&_=56320&&Le<=57343?1024*(oe-55296)+Le-56320+65536:oe},V.prototype.toString=function(){return this.str},V.isSurrogatePair=function(De){var Le=De.charCodeAt(0);return Le>=55296&&Le<=56319},wt.exports=V},{}],21:[function(At,wt,kt){"use strict";var V=At("./ViterbiNode"),De=At("./ViterbiLattice"),Le=At("../util/SurrogateAwareString");function _(oe){this.trie=oe.trie,this.token_info_dictionary=oe.token_info_dictionary,this.unknown_dictionary=oe.unknown_dictionary}_.prototype.build=function(oe){for(var G,ve,Y,ae,m=new De,B=new Le(oe),i=0;i=0;Y--){var ae=G[Y];"."===ae?G.splice(Y,1):".."===ae?(G.splice(Y,1),ve++):ve&&(G.splice(Y,1),ve--)}if(ue)for(;ve--;ve)G.unshift("..");return G}function _(G,ue){if(G.filter)return G.filter(ue);for(var ve=[],Y=0;Y=-1&&!ue;ve--){var Y=ve>=0?arguments[ve]:V.cwd();if("string"!=typeof Y)throw new TypeError("Arguments to path.resolve must be strings");Y&&(G=Y+"/"+G,ue="/"===Y.charAt(0))}return(ue?"/":"")+(G=De(_(G.split("/"),function(ae){return!!ae}),!ue).join("/"))||"."},kt.normalize=function(G){var ue=kt.isAbsolute(G),ve="/"===oe(G,-1);return(G=De(_(G.split("/"),function(Y){return!!Y}),!ue).join("/"))||ue||(G="."),G&&ve&&(G+="/"),(ue?"/":"")+G},kt.isAbsolute=function(G){return"/"===G.charAt(0)},kt.join=function(){var G=Array.prototype.slice.call(arguments,0);return kt.normalize(_(G,function(ue,ve){if("string"!=typeof ue)throw new TypeError("Arguments to path.join must be strings");return ue}).join("/"))},kt.relative=function(G,ue){function ve(f){for(var x=0;x=0&&""===f[n];n--);return x>n?[]:f.slice(x,n-x+1)}G=kt.resolve(G).substr(1),ue=kt.resolve(ue).substr(1);for(var Y=ve(G.split("/")),ae=ve(ue.split("/")),m=Math.min(Y.length,ae.length),B=m,i=0;i=1;--m)if(47===(ue=G.charCodeAt(m))){if(!ae){Y=m;break}}else ae=!1;return-1===Y?ve?"/":".":ve&&1===Y?"/":G.slice(0,Y)},kt.basename=function(G,ue){var ve=function Le(G){"string"!=typeof G&&(G+="");var ue,ve=0,Y=-1,ae=!0;for(ue=G.length-1;ue>=0;--ue)if(47===G.charCodeAt(ue)){if(!ae){ve=ue+1;break}}else-1===Y&&(ae=!1,Y=ue+1);return-1===Y?"":G.slice(ve,Y)}(G);return ue&&ve.substr(-1*ue.length)===ue&&(ve=ve.substr(0,ve.length-ue.length)),ve},kt.extname=function(G){"string"!=typeof G&&(G+="");for(var ue=-1,ve=0,Y=-1,ae=!0,m=0,B=G.length-1;B>=0;--B){var i=G.charCodeAt(B);if(47!==i)-1===Y&&(ae=!1,Y=B+1),46===i?-1===ue?ue=B:1!==m&&(m=1):-1!==ue&&(m=-1);else if(!ae){ve=B+1;break}}return-1===ue||-1===Y||0===m||1===m&&ue===Y-1&&ue===ve+1?"":G.slice(ue,Y)};var oe="b"==="ab".substr(-1)?function(G,ue,ve){return G.substr(ue,ve)}:function(G,ue,ve){return ue<0&&(ue=G.length+ue),G.substr(ue,ve)}}).call(this,At("_process"))},{_process:26}],26:[function(At,wt,kt){var V,De,Le=wt.exports={};function _(){throw new Error("setTimeout has not been defined")}function oe(){throw new Error("clearTimeout has not been defined")}function G(x){if(V===setTimeout)return setTimeout(x,0);if((V===_||!V)&&setTimeout)return V=setTimeout,setTimeout(x,0);try{return V(x,0)}catch{try{return V.call(null,x,0)}catch{return V.call(this,x,0)}}}!function(){try{V="function"==typeof setTimeout?setTimeout:_}catch{V=_}try{De="function"==typeof clearTimeout?clearTimeout:oe}catch{De=oe}}();var ve,Y=[],ae=!1,m=-1;function B(){ae&&ve&&(ae=!1,ve.length?Y=ve.concat(Y):m=-1,Y.length&&i())}function i(){if(!ae){var x=G(B);ae=!0;for(var n=Y.length;n;){for(ve=Y,Y=[];++m1)for(var c=1;c=0&&(Y._idleTimeoutId=setTimeout(function(){Y._onTimeout&&Y._onTimeout()},ae))},kt.setImmediate="function"==typeof V?V:function(Y){var ae=ue++,m=!(arguments.length<2)&&oe.call(arguments,1);return G[ae]=!0,Le(function(){G[ae]&&(m?Y.apply(null,m):Y.call(null),kt.clearImmediate(ae))}),ae},kt.clearImmediate="function"==typeof De?De:function(Y){delete G[Y]}}).call(this,At("timers").setImmediate,At("timers").clearImmediate)},{"process/browser.js":26,timers:27}],28:[function(At,wt,kt){(function(){"use strict";function V(L){throw L}var De=void 0,Le=this;function _(L,z){var y,C=L.split("."),M=Le;for((!(C[0]in M)&&M.execScript&&M.execScript("var "+C[0]));C.length&&(y=C.shift());)C.length||z===De?M=M[y]?M[y]:M[y]={}:M[y]=z}var oe,G=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u"&&typeof DataView<"u";for(new(G?Uint8Array:Array)(256),oe=0;256>oe;++oe)for(var ue=(ue=oe)>>>1;ue;ue>>>=1);function ve(L,z,y){var C,M="number"==typeof z?z:z=0,U="number"==typeof y?y:L.length;for(C=-1,M=7&U;M--;++z)C=C>>>8^ae[255&(C^L[z])];for(M=U>>3;M--;z+=8)C=(C=(C=(C=(C=(C=(C=(C=C>>>8^ae[255&(C^L[z])])>>>8^ae[255&(C^L[z+1])])>>>8^ae[255&(C^L[z+2])])>>>8^ae[255&(C^L[z+3])])>>>8^ae[255&(C^L[z+4])])>>>8^ae[255&(C^L[z+5])])>>>8^ae[255&(C^L[z+6])])>>>8^ae[255&(C^L[z+7])];return(4294967295^C)>>>0}var Y=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],ae=G?new Uint32Array(Y):Y;function m(){}function B(L){var z,y,C,M,U,ee,J,re,Ue,We,Qe=L.length,ft=0,pt=Number.POSITIVE_INFINITY;for(re=0;reft&&(ft=L[re]),L[re]>=1;for(We=C<<16|re,Ue=ee;Uei;i++)switch(!0){case 143>=i:g.push([i+48,8]);break;case 255>=i:g.push([i-144+400,9]);break;case 279>=i:g.push([i-256+0,7]);break;case 287>=i:g.push([i-280+192,8]);break;default:V("invalid literal: "+i)}var f=function(){function L(M){switch(!0){case 3===M:return[257,M-3,0];case 4===M:return[258,M-4,0];case 5===M:return[259,M-5,0];case 6===M:return[260,M-6,0];case 7===M:return[261,M-7,0];case 8===M:return[262,M-8,0];case 9===M:return[263,M-9,0];case 10===M:return[264,M-10,0];case 12>=M:return[265,M-11,1];case 14>=M:return[266,M-13,1];case 16>=M:return[267,M-15,1];case 18>=M:return[268,M-17,1];case 22>=M:return[269,M-19,2];case 26>=M:return[270,M-23,2];case 30>=M:return[271,M-27,2];case 34>=M:return[272,M-31,2];case 42>=M:return[273,M-35,3];case 50>=M:return[274,M-43,3];case 58>=M:return[275,M-51,3];case 66>=M:return[276,M-59,3];case 82>=M:return[277,M-67,4];case 98>=M:return[278,M-83,4];case 114>=M:return[279,M-99,4];case 130>=M:return[280,M-115,4];case 162>=M:return[281,M-131,5];case 194>=M:return[282,M-163,5];case 226>=M:return[283,M-195,5];case 257>=M:return[284,M-227,5];case 258===M:return[285,M-258,0];default:V("invalid length: "+M)}}var z,y,C=[];for(z=3;258>=z;z++)y=L(z),C[z]=y[2]<<24|y[1]<<16|y[0];return C}();function x(L,z){switch(this.i=[],this.j=32768,this.d=this.f=this.c=this.n=0,this.input=G?new Uint8Array(L):L,this.o=!1,this.k=c,this.w=!1,!z&&(z={})||(z.index&&(this.c=z.index),z.bufferSize&&(this.j=z.bufferSize),z.bufferType&&(this.k=z.bufferType),z.resize&&(this.w=z.resize)),this.k){case n:this.a=32768,this.b=new(G?Uint8Array:Array)(32768+this.j+258);break;case c:this.a=0,this.b=new(G?Uint8Array:Array)(this.j),this.e=this.D,this.q=this.A,this.l=this.C;break;default:V(Error("invalid inflate mode"))}}G&&new Uint32Array(f);var n=0,c=1;x.prototype.g=function(){for(;!this.o;){var L=we(this,3);switch(1&L&&(this.o=!0),L>>>=1){case 0:var z=this.input,y=this.c,C=this.b,M=this.a,U=z.length,ee=De,J=C.length,re=De;switch(this.d=this.f=0,y+1>=U&&V(Error("invalid uncompressed block header: LEN")),ee=z[y++]|z[y++]<<8,y+1>=U&&V(Error("invalid uncompressed block header: NLEN")),ee===~(z[y++]|z[y++]<<8)&&V(Error("invalid uncompressed block header: length verify")),y+ee>z.length&&V(Error("input buffer is broken")),this.k){case n:for(;M+ee>C.length;){if(ee-=re=J-M,G)C.set(z.subarray(y,y+re),M),M+=re,y+=re;else for(;re--;)C[M++]=z[y++];this.a=M,C=this.e(),M=this.a}break;case c:for(;M+ee>C.length;)C=this.e({t:2});break;default:V(Error("invalid inflate mode"))}if(G)C.set(z.subarray(y,y+ee),M),M+=ee,y+=ee;else for(;ee--;)C[M++]=z[y++];this.c=y,this.a=M,this.b=C;break;case 1:this.l(q,le);break;case 2:var Ue,We,Qe,ft,pt=we(this,5)+257,Xt=we(this,5)+1,It=we(this,4)+4,Ft=new(G?Uint8Array:Array)(o.length),Ke=De,mt=De,St=De,K=De,se=De;for(se=0;se=u?8:255>=u?9:279>=u?7:8;var R,N,q=B(S),Z=new(G?Uint8Array:Array)(30);for(R=0,N=Z.length;R=J&&V(Error("input buffer is broken")),C|=U[ee++]<>>z,L.d=M-z,L.c=ee,y}function ke(L,z){for(var y,C,M=L.f,U=L.d,ee=L.input,J=L.c,re=ee.length,Ue=z[0],We=z[1];U=re);)M|=ee[J++]<>>16)>U&&V(Error("invalid code length: "+C)),L.f=M>>C,L.d=U-C,L.c=J,65535&y}function A(L){this.input=L,this.c=0,this.m=[],this.s=!1}x.prototype.l=function(L,z){var y=this.b,C=this.a;this.r=L;for(var M,U,ee,J,re=y.length-258;256!==(M=ke(this,L));)if(256>M)C>=re&&(this.a=C,y=this.e(),C=this.a),y[C++]=M;else for(J=d[U=M-257],0=re&&(this.a=C,y=this.e(),C=this.a);J--;)y[C]=y[C++-ee];for(;8<=this.d;)this.d-=8,this.c--;this.a=C},x.prototype.C=function(L,z){var y=this.b,C=this.a;this.r=L;for(var M,U,ee,J,re=y.length;256!==(M=ke(this,L));)if(256>M)C>=re&&(re=(y=this.e()).length),y[C++]=M;else for(J=d[U=M-257],0re&&(re=(y=this.e()).length);J--;)y[C]=y[C++-ee];for(;8<=this.d;)this.d-=8,this.c--;this.a=C},x.prototype.e=function(){var L,z,y=new(G?Uint8Array:Array)(this.a-32768),C=this.a-32768,M=this.b;if(G)y.set(M.subarray(32768,y.length));else for(L=0,z=y.length;LL;++L)M[L]=M[C+L];return this.a=32768,M},x.prototype.D=function(L){var z,y,C,M=this.input.length/this.c+1|0,ee=this.b;return L&&("number"==typeof L.t&&(M=L.t),"number"==typeof L.z&&(M+=L.z)),y=2>M?(C=(this.input.length-this.c)/this.r[2]/2*258|0)z&&(this.b.length=z),L=this.b),this.buffer=L},A.prototype.F=function(){return this.s||this.g(),this.m.slice()},A.prototype.g=function(){for(var L=this.input.length;this.c>>0,ve(z,De,De)!==We&&V(Error("invalid CRC-32 checksum: 0x"+ve(z,De,De).toString(16)+" / 0x"+We.toString(16))),C.L=M=(Qe[ft++]|Qe[ft++]<<8|Qe[ft++]<<16|Qe[ft++]<<24)>>>0,(4294967295&z.length)!==M&&V(Error("invalid input size: "+(4294967295&z.length)+" / "+M)),this.m.push(C),this.c=ft}this.s=!0;var pt,Xt,It,Ft=this.m,Ke=0,mt=0;for(pt=0,Xt=Ft.length;pt0&&void 0!==arguments[0]?arguments[0]:{}).dictPath;(function oe(Y,ae){if(!(Y instanceof ae))throw new TypeError("Cannot call a class as a function")})(this,Y),this._analyzer=null,this._dictPath=ae||(G?At.resolve("kuromoji").replace(/src(?!.*src).*/,"dict/"):"node_modules/kuromoji/dict/")}return V(Y,[{key:"init",value:function(){var ae=this;return new Promise(function(m,B){var i=ae;null==ae._analyzer?Le.default.builder({dicPath:ae._dictPath}).build(function(g,f){if(g)return B(g);i._analyzer=f,m()}):B(new Error("This analyzer has already been initialized."))})}},{key:"parse",value:function(){var ae=this,m=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return new Promise(function(B,i){if(""===m.trim())return B([]);for(var g=ae._analyzer.tokenize(m),f=0;fa?1:e>=a?0:NaN}function i(e){return null===e?NaN:+e}function g(e){return!isNaN(e)}function f(e){return{left:function(a,v,E,k){for(arguments.length<3&&(E=0),arguments.length<4&&(k=a.length);E>>1;e(a[T],v)<0?E=T+1:k=T}return E},right:function(a,v,E,k){for(arguments.length<3&&(E=0),arguments.length<4&&(k=a.length);E>>1;e(a[T],v)>0?k=T:E=T+1}return E}}}V.ascending=B,V.descending=function(e,a){return ae?1:a>=e?0:NaN},V.min=function(e,a){var k,T,v=-1,E=e.length;if(1===arguments.length){for(;++v=T){k=T;break}for(;++vT&&(k=T)}else{for(;++v=T){k=T;break}for(;++vT&&(k=T)}return k},V.max=function(e,a){var k,T,v=-1,E=e.length;if(1===arguments.length){for(;++v=T){k=T;break}for(;++vk&&(k=T)}else{for(;++v=T){k=T;break}for(;++vk&&(k=T)}return k},V.extent=function(e,a){var k,T,F,v=-1,E=e.length;if(1===arguments.length){for(;++v=T){k=F=T;break}for(;++vT&&(k=T),F=T){k=F=T;break}for(;++vT&&(k=T),F1)return F/(H-1)},V.deviation=function(){var e=V.variance.apply(this,arguments);return e&&Math.sqrt(e)};var x=f(B);function n(e){return e.length}V.bisectLeft=x.left,V.bisect=V.bisectRight=x.right,V.bisector=function(e){return f(1===e.length?function(a,v){return B(e(a),v)}:e)},V.shuffle=function(e,a,v){(E=arguments.length)<3&&(v=e.length,E<2&&(a=0));for(var k,T,E=v-a;E;)T=Math.random()*E--|0,k=e[E+a],e[E+a]=e[T+a],e[T+a]=k;return e},V.permute=function(e,a){for(var v=a.length,E=new Array(v);v--;)E[v]=e[a[v]];return E},V.pairs=function(e){for(var a=0,v=e.length-1,k=e[0],T=new Array(v<0?0:v);a=0;)for(v=(F=e[a]).length;--v>=0;)T[--k]=F[v];return T};var c=Math.abs;function s(e,a){for(var v in a)Object.defineProperty(e.prototype,v,{value:a[v],enumerable:!1})}function t(){this._=Object.create(null)}V.range=function(e,a,v){if(arguments.length<3&&(v=1,arguments.length<2&&(a=e,e=0)),(a-e)/v==1/0)throw new Error("infinite range");var F,E=[],k=function u(e){for(var a=1;e*a%1;)a*=10;return a}(c(v)),T=-1;if(e*=k,a*=k,(v*=k)<0)for(;(F=e+v*++T)>a;)E.push(F/k);else for(;(F=e+v*++T)=a.length)return k?k.call(e,H):E?H.sort(E):H;for(var Me,$e,xe,Be,ne=-1,fe=H.length,_e=a[$++],Ie=new t;++ne=a.length)return O;var $=[],ne=v[H++];return O.forEach(function(fe,_e){$.push({key:fe,values:F(_e,H)})}),ne?$.sort(function(fe,_e){return ne(fe.key,_e.key)}):$}return e.map=function(O,H){return T(H,O,0)},e.entries=function(O){return F(T(V.map,O,0),0)},e.key=function(O){return a.push(O),e},e.sortKeys=function(O){return v[a.length-1]=O,e},e.sortValues=function(O){return E=O,e},e.rollup=function(O){return k=O,e},e},V.set=function(e){var a=new S;if(e)for(var v=0,E=e.length;v=0&&(E=e.slice(v+1),e=e.slice(0,v)),e)return arguments.length<2?this[e].on(E):this[e].on(E,a);if(2===arguments.length){if(null==a)for(e in this)this.hasOwnProperty(e)&&this[e].on(E,null);return this}},V.event=null,V.requote=function(e){return e.replace(y,"\\$&")};var y=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,C={}.__proto__?function(e,a){e.__proto__=a}:function(e,a){for(var v in a)e[v]=a[v]};function M(e){return C(e,re),e}var U=function(e,a){return a.querySelector(e)},ee=function(e,a){return a.querySelectorAll(e)},J=function(e,a){var v=e.matches||e[q(e,"matchesSelector")];return(J=function(E,k){return v.call(E,k)})(e,a)};"function"==typeof Sizzle&&(U=function(e,a){return Sizzle(e,a)[0]||null},ee=Sizzle,J=Sizzle.matchesSelector),V.selection=function(){return V.select(_.documentElement)};var re=V.selection.prototype=[];function Ue(e){return"function"==typeof e?e:function(){return U(e,this)}}function We(e){return"function"==typeof e?e:function(){return ee(e,this)}}re.select=function(e){var v,E,k,T,a=[];e=Ue(e);for(var F=-1,O=this.length;++F=0&&"xmlns"!==(v=e.slice(0,a))&&(e=e.slice(a+1)),ft.hasOwnProperty(v)?{space:ft[v],local:e}:e}},re.attr=function(e,a){if(arguments.length<2){if("string"==typeof e){var v=this.node();return(e=V.ns.qualify(e)).local?v.getAttributeNS(e.space,e.local):v.getAttribute(e)}for(a in e)this.each(pt(a,e[a]));return this}return this.each(pt(e,a))},re.classed=function(e,a){if(arguments.length<2){if("string"==typeof e){var v=this.node(),E=(e=Ft(e)).length,k=-1;if(a=v.classList){for(;++k=0;)(T=v[E])&&(k&&k!==T.nextSibling&&k.parentNode.insertBefore(T,k),k=T);return this},re.sort=function(e){e=ie.apply(this,arguments);for(var a=-1,v=this.length;++a0&&(e=e.slice(0,k));var F=Jt.get(e);function O(){var ne=this[E];ne&&(this.removeEventListener(e,ne,ne.$),delete this[E])}return F&&(e=F,T=Cn),k?a?function H(){var ne=T(a,Le(arguments));O.call(this),this.addEventListener(e,this[E]=ne,ne.$=v),ne._=a}:O:a?le:function $(){var fe,ne=new RegExp("^__on([^.]+)"+V.requote(e)+"$");for(var _e in this)if(fe=_e.match(ne)){var Me=this[_e];this.removeEventListener(fe[1],Me,Me.$),delete this[_e]}}}V.selection.enter=Ye,V.selection.enter.prototype=at,at.append=re.append,at.empty=re.empty,at.node=re.node,at.call=re.call,at.size=re.size,at.select=function(e){for(var v,E,k,T,F,a=[],O=-1,H=this.length;++O=a&&(a=k+1);!(H=F[a])&&++a0?1:e<0?-1:0}function Bt(e,a,v){return(a[0]-e[0])*(v[1]-e[1])-(a[1]-e[1])*(v[0]-e[0])}function qt(e){return e>1?0:e<-1?ge:Math.acos(e)}function nn(e){return e>1?Ze:e<-1?-Ze:Math.asin(e)}function cn(e){return((e=Math.exp(e))+1/e)/2}function Ee(e){return(e=Math.sin(e/2))*e}var Vt=Math.SQRT2;V.interpolateZoom=function(e,a){var fe,_e,v=e[0],E=e[1],k=e[2],O=a[2],H=a[0]-v,$=a[1]-E,ne=H*H+$*$;if(ne0&&(Ot=Ot.transition().duration(F)),Ot.call(Ne.event)}function $t(){Ie&&Ie.domain(xe.range().map(function(Ot){return(Ot-e.x)/e.k}).map(xe.invert)),Ge&&Ge.domain(Be.range().map(function(Ot){return(Ot-e.y)/e.k}).map(Be.invert))}function sn(Ot){O++||Ot({type:"zoomstart"})}function In(Ot){$t(),Ot({type:"zoom",scale:e.k,translate:[e.x,e.y]})}function xn(Ot){--O||(Ot({type:"zoomend"}),v=null)}function Tn(){var Ot=this,fn=$e.of(Ot,arguments),Un=0,Qn=V.select(G(Ot)).on($,function Or(){Un=1,bt(V.mouse(Ot),cr),In(fn)}).on(ne,function Ti(){Qn.on($,null).on(ne,null),Tr(Un),xn(fn)}),cr=He(V.mouse(Ot)),Tr=Xn(Ot);Es.call(Ot),sn(fn)}function Lt(){var cr,Ot=this,fn=$e.of(Ot,arguments),Un={},Qn=0,Tr=".zoom-"+V.event.changedTouches[0].identifier,Or="touchmove"+Tr,Ti="touchend"+Tr,Bi=[],Ii=V.select(Ot),Fi=Xn(Ot);function xi(){var so=V.touches(Ot);return cr=e.k,so.forEach(function(mi){mi.identifier in Un&&(Un[mi.identifier]=He(mi))}),so}function Hi(){var so=V.event.target;V.select(so).on(Or,No).on(Ti,lu),Bi.push(so);for(var mi=V.event.changedTouches,Ji=0,po=mi.length;Ji1){var Oo,ko=Qi[1],Cs=(Oo=Qi[0])[0]-ko[0],lc=Oo[1]-ko[1];Qn=Cs*Cs+lc*lc}}function No(){var mi,Ji,po,Qi,so=V.touches(Ot);Es.call(Ot);for(var Go=0,Oo=so.length;Go360?O-=360:O<0&&(O+=360),O<60?E+(k-E)*O/60:O<180?k:O<240?E+(k-E)*(240-O)/60:E}(O))}return e=isNaN(e)?0:(e%=360)<0?e+360:e,a=isNaN(a)||a<0?0:a>1?1:a,E=2*(v=v<0?0:v>1?1:v)-(k=v<=.5?v*(1+a):v+a-v*a),new zr(F(e+120),F(e),F(e-120))}function rt(e,a,v){return this instanceof rt?(this.h=+e,this.c=+a,void(this.l=+v)):arguments.length<2?e instanceof rt?new rt(e.h,e.c,e.l):function Qr(e,a,v){return e>0?new rt(Math.atan2(v,a)*st,Math.sqrt(a*a+v*v),e):new rt(NaN,NaN,e)}(e instanceof it?e.l:(e=si((e=V.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new rt(e,a,v)}Hn.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),new Gn(this.h,this.s,this.l/e)},Hn.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new Gn(this.h,this.s,e*this.l)},Hn.rgb=function(){return Yn(this.h,this.s,this.l)},V.hcl=rt;var de=rt.prototype=new Fn;function nt(e,a,v){return isNaN(e)&&(e=0),isNaN(a)&&(a=0),new it(v,Math.cos(e*=Xe)*a,Math.sin(e)*a)}function it(e,a,v){return this instanceof it?(this.l=+e,this.a=+a,void(this.b=+v)):arguments.length<2?e instanceof it?new it(e.l,e.a,e.b):e instanceof rt?nt(e.h,e.c,e.l):si((e=zr(e)).r,e.g,e.b):new it(e,a,v)}de.brighter=function(e){return new rt(this.h,this.c,Math.min(100,this.l+ye*(arguments.length?e:1)))},de.darker=function(e){return new rt(this.h,this.c,Math.max(0,this.l-ye*(arguments.length?e:1)))},de.rgb=function(){return nt(this.h,this.c,this.l).rgb()},V.lab=it;var ye=18,ct=.95047,Xr=1,vi=1.08883,Kr=it.prototype=new Fn;function oi(e,a,v){var E=(e+16)/116,k=E+a/500,T=E-v/200;return new zr(Vr(3.2404542*(k=hr(k)*ct)-1.5371385*(E=hr(E)*Xr)-.4985314*(T=hr(T)*vi)),Vr(-.969266*k+1.8760108*E+.041556*T),Vr(.0556434*k-.2040259*E+1.0572252*T))}function hr(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function li(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function Vr(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function zr(e,a,v){return this instanceof zr?(this.r=~~e,this.g=~~a,void(this.b=~~v)):arguments.length<2?e instanceof zr?new zr(e.r,e.g,e.b):Dr(""+e,zr,Yn):new zr(e,a,v)}function Ei(e){return new zr(e>>16,e>>8&255,255&e)}function ei(e){return Ei(e)+""}Kr.brighter=function(e){return new it(Math.min(100,this.l+ye*(arguments.length?e:1)),this.a,this.b)},Kr.darker=function(e){return new it(Math.max(0,this.l-ye*(arguments.length?e:1)),this.a,this.b)},Kr.rgb=function(){return oi(this.l,this.a,this.b)},V.rgb=zr;var ci=zr.prototype=new Fn;function Gr(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function Dr(e,a,v){var F,O,H,E=0,k=0,T=0;if(F=/([a-z]+)\((.*)\)/.exec(e=e.toLowerCase()))switch(O=F[2].split(","),F[1]){case"hsl":return v(parseFloat(O[0]),parseFloat(O[1])/100,parseFloat(O[2])/100);case"rgb":return a(Br(O[0]),Br(O[1]),Br(O[2]))}return(H=Jn.get(e))?a(H.r,H.g,H.b):(null!=e&&"#"===e.charAt(0)&&!isNaN(H=parseInt(e.slice(1),16))&&(4===e.length?(E=(3840&H)>>4,E|=E>>4,k=240&H,k|=k>>4,T=15&H,T|=T<<4):7===e.length&&(E=(16711680&H)>>16,k=(65280&H)>>8,T=255&H)),a(E,k,T))}function Zr(e,a,v){var F,O,E=Math.min(e/=255,a/=255,v/=255),k=Math.max(e,a,v),T=k-E,H=(k+E)/2;return T?(O=H<.5?T/(k+E):T/(2-k-E),F=e==k?(a-v)/T+(a0&&H<1?0:F),new Gn(F,O,H)}function si(e,a,v){var E=li((.4124564*(e=yi(e))+.3575761*(a=yi(a))+.1804375*(v=yi(v)))/ct),k=li((.2126729*e+.7151522*a+.072175*v)/Xr);return it(116*k-16,500*(E-k),200*(k-li((.0193339*e+.119192*a+.9503041*v)/vi)))}function yi(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Br(e){var a=parseFloat(e);return"%"===e.charAt(e.length-1)?Math.round(2.55*a):a}ci.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var a=this.r,v=this.g,E=this.b,k=30;return a||v||E?(a&&a=200&&ne<300||304===ne){try{fe=v.call(k,O)}catch(_e){return void T.error.call(k,_e)}T.load.call(k,fe)}else T.error.call(k,O)}return this.XDomainRequest&&!("withCredentials"in O)&&/^(http(s)?:)?\/\//.test(e)&&(O=new XDomainRequest),"onload"in O?O.onload=O.onerror=$:O.onreadystatechange=function(){O.readyState>3&&$()},O.onprogress=function(ne){var fe=V.event;V.event=ne;try{T.progress.call(k,O)}finally{V.event=fe}},k.header=function(ne,fe){return ne=(ne+"").toLowerCase(),arguments.length<2?F[ne]:(null==fe?delete F[ne]:F[ne]=fe+"",k)},k.mimeType=function(ne){return arguments.length?(a=null==ne?null:ne+"",k):a},k.responseType=function(ne){return arguments.length?(H=ne,k):H},k.response=function(ne){return v=ne,k},["get","post"].forEach(function(ne){k[ne]=function(){return k.send.apply(k,[ne].concat(Le(arguments)))}}),k.send=function(ne,fe,_e){if(2===arguments.length&&"function"==typeof fe&&(_e=fe,fe=null),O.open(ne,e,!0),null!=a&&!("accept"in F)&&(F.accept=a+",*/*"),O.setRequestHeader)for(var Me in F)O.setRequestHeader(Me,F[Me]);return null!=a&&O.overrideMimeType&&O.overrideMimeType(a),null!=H&&(O.responseType=H),null!=_e&&k.on("error",_e).on("load",function($e){_e(null,$e)}),T.beforesend.call(k,O),O.send(fe??null),k},k.abort=function(){return O.abort(),k},V.rebind(k,T,"on"),null==E?k:k.get(function eo(e){return 1===e.length?function(a,v){e(null==a?v:null)}:e}(E))}Jn.forEach(function(e,a){Jn.set(e,Ei(a))}),V.functor=_r,V.xhr=Wi(R),V.dsv=function(e,a){var v=new RegExp('["'+e+"\n]"),E=e.charCodeAt(0);function k($,ne,fe){arguments.length<3&&(fe=ne,ne=null);var _e=qi($,a,null==ne?T:F(ne),fe);return _e.row=function(Me){return arguments.length?_e.response(null==(ne=Me)?T:F(Me)):ne},_e}function T($){return k.parse($.responseText)}function F($){return function(ne){return k.parse(ne.responseText,$)}}function O($){return $.map(H).join(e)}function H($){return v.test($)?'"'+$.replace(/\"/g,'""')+'"':$}return k.parse=function($,ne){var fe;return k.parseRows($,function(_e,Me){if(fe)return fe(_e,Me-1);var $e=new Function("d","return {"+_e.map(function(xe,Ie){return JSON.stringify(xe)+": d["+Ie+"]"}).join(",")+"}");fe=ne?function(xe,Ie){return ne($e(xe),Ie)}:$e})},k.parseRows=function($,ne){var Be,Ge,fe={},_e={},Me=[],$e=$.length,xe=0,Ie=0;function Ne(){if(xe>=$e)return _e;if(Ge)return Ge=!1,fe;var Ct=xe;if(34===$.charCodeAt(Ct)){for(var vt=Ct;vt++<$e;)if(34===$.charCodeAt(vt)){if(34!==$.charCodeAt(vt+1))break;++vt}return xe=vt+2,13===(bt=$.charCodeAt(vt+1))?(Ge=!0,10===$.charCodeAt(vt+2)&&++xe):10===bt&&(Ge=!0),$.slice(Ct+1,vt).replace(/""/g,'"')}for(;xe<$e;){var bt,gt=1;if(10===(bt=$.charCodeAt(xe++)))Ge=!0;else if(13===bt)Ge=!0,10===$.charCodeAt(xe)&&(++xe,++gt);else if(bt!==E)continue;return $.slice(Ct,xe-gt)}return $.slice(Ct)}for(;(Be=Ne())!==_e;){for(var He=[];Be!==fe&&Be!==_e;)He.push(Be),Be=Ne();ne&&null==(He=ne(He,Ie++))||Me.push(He)}return Me},k.format=function($){if(Array.isArray($[0]))return k.formatRows($);var ne=new S,fe=[];return $.forEach(function(_e){for(var Me in _e)ne.has(Me)||fe.push(ne.add(Me))}),[fe.map(H).join(e)].concat($.map(function(_e){return fe.map(function(Me){return H(_e[Me])}).join(e)})).join("\n")},k.formatRows=function($){return $.map(O).join("\n")},k},V.csv=V.dsv(",","text/csv"),V.tsv=V.dsv("\t","text/tab-separated-values");var ki,Pi,hi,Nr,to=this[q(this,"requestAnimationFrame")]||function(e){setTimeout(e,17)};function P(e,a,v){var E=arguments.length;E<2&&(a=0),E<3&&(v=Date.now());var T={c:e,t:v+a,n:null};return Pi?Pi.n=T:ki=T,Pi=T,hi||(Nr=clearTimeout(Nr),hi=1,to(W)),T}function W(){var e=Q(),a=he()-e;a>24?(isFinite(a)&&(clearTimeout(Nr),Nr=setTimeout(W,a)),hi=0):(hi=1,to(W))}function Q(){for(var e=Date.now(),a=ki;a;)e>=a.t&&a.c(e-a.t)&&(a.c=null),a=a.n;return e}function he(){for(var e,a=ki,v=1/0;a;)a.c?(a.t8?function(E){return E/v}:function(E){return E*v},symbol:e}});function Oe(e){var a=e.decimal,v=e.thousands,E=e.grouping,k=e.currency,T=E&&v?function(F,O){for(var H=F.length,$=[],ne=0,fe=E[0],_e=0;H>0&&fe>0&&(_e+fe+1>O&&(fe=Math.max(1,O-_e)),$.push(F.substring(H-=fe,H+fe)),!((_e+=fe+1)>O));)fe=E[ne=(ne+1)%E.length];return $.reverse().join(v)}:R;return function(F){var O=qe.exec(F),H=O[1]||" ",$=O[2]||">",ne=O[3]||"-",fe=O[4]||"",_e=O[5],Me=+O[6],$e=O[7],xe=O[8],Ie=O[9],Be=1,Ge="",Ne="",He=!1,Ct=!0;switch(xe&&(xe=+xe.substring(1)),(_e||"0"===H&&"="===$)&&(_e=H="0",$="="),Ie){case"n":$e=!0,Ie="g";break;case"%":Be=100,Ne="%",Ie="f";break;case"p":Be=100,Ne="%",Ie="r";break;case"b":case"o":case"x":case"X":"#"===fe&&(Ge="0"+Ie.toLowerCase());case"c":Ct=!1;case"d":He=!0,xe=0;break;case"s":Be=-1,Ie="r"}"$"===fe&&(Ge=k[0],Ne=k[1]),"r"==Ie&&!xe&&(Ie="g"),null!=xe&&("g"==Ie?xe=Math.max(1,Math.min(21,xe)):("e"==Ie||"f"==Ie)&&(xe=Math.max(0,Math.min(20,xe)))),Ie=yt.get(Ie)||jt;var vt=_e&&$e;return function(bt){var gt=Ne;if(He&&bt%1)return"";var $t=bt<0||0===bt&&1/bt<0?(bt=-bt,"-"):"-"===ne?"":ne;if(Be<0){var sn=V.formatPrefix(bt,xe);bt=sn.scale(bt),gt=sn.symbol+Ne}else bt*=Be;var xn,Tn,In=(bt=Ie(bt,xe)).lastIndexOf(".");if(In<0){var Lt=Ct?bt.lastIndexOf("e"):-1;Lt<0?(xn=bt,Tn=""):(xn=bt.substring(0,Lt),Tn=bt.substring(Lt))}else xn=bt.substring(0,In),Tn=a+bt.substring(In+1);!_e&&$e&&(xn=T(xn,1/0));var en=Ge.length+xn.length+Tn.length+(vt?0:$t.length),gn=en"===$?gn+$t+bt:"^"===$?gn.substring(0,en>>=1)+$t+bt+gn.substring(en):$t+(vt?bt:gn+bt))+gt}}}V.formatPrefix=function(e,a){var v=0;return(e=+e)&&(e<0&&(e*=-1),a&&(e=V.round(e,me(e,a))),v=1+Math.floor(1e-12+Math.log(e)/Math.LN10),v=Math.max(-24,Math.min(24,3*Math.floor((v-1)/3)))),Te[8+v/3]};var qe=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,yt=V.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,a){return e.toPrecision(a)},e:function(e,a){return e.toExponential(a)},f:function(e,a){return e.toFixed(a)},r:function(e,a){return(e=V.round(e,me(e,a))).toFixed(Math.max(0,Math.min(20,me(e*(1+1e-15),a))))}});function jt(e){return e+""}var ot=V.time={},lt=Date;function Dt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Dt.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Yt.setUTCDate.apply(this._,arguments)},setDay:function(){Yt.setUTCDay.apply(this._,arguments)},setFullYear:function(){Yt.setUTCFullYear.apply(this._,arguments)},setHours:function(){Yt.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Yt.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Yt.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Yt.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Yt.setUTCSeconds.apply(this._,arguments)},setTime:function(){Yt.setTime.apply(this._,arguments)}};var Yt=Date.prototype;function Tt(e,a,v){function E($){var ne=e($),fe=T(ne,1);return $-ne1)for(;_e=Or)return-1;if(37===(fn=en.charCodeAt(cr++))){if(Qn=en.charAt(cr++),!(Un=Ct[Qn in dn?en.charAt(cr++):Qn])||(Ot=Un(Lt,gn,Ot))<0)return-1}else if(fn!=gn.charCodeAt(Ot++))return-1}return Ot}$.utc=function(Lt){var en=$(Lt);function gn(Ot){try{var fn=new(lt=Dt);return fn._=Ot,en(fn)}finally{lt=Date}}return gn.parse=function(Ot){try{lt=Dt;var fn=en.parse(Ot);return fn&&fn._}finally{lt=Date}},gn.toString=en.toString,gn},$.multi=$.utc.multi=Sn;var fe=V.map(),_e=vr(T),Me=br(T),$e=vr(F),xe=br(F),Ie=vr(O),Be=br(O),Ge=vr(H),Ne=br(H);k.forEach(function(Lt,en){fe.set(Lt.toLowerCase(),en)});var He={a:function(Lt){return F[Lt.getDay()]},A:function(Lt){return T[Lt.getDay()]},b:function(Lt){return H[Lt.getMonth()]},B:function(Lt){return O[Lt.getMonth()]},c:$(a),d:function(Lt,en){return jn(Lt.getDate(),en,2)},e:function(Lt,en){return jn(Lt.getDate(),en,2)},H:function(Lt,en){return jn(Lt.getHours(),en,2)},I:function(Lt,en){return jn(Lt.getHours()%12||12,en,2)},j:function(Lt,en){return jn(1+ot.dayOfYear(Lt),en,3)},L:function(Lt,en){return jn(Lt.getMilliseconds(),en,3)},m:function(Lt,en){return jn(Lt.getMonth()+1,en,2)},M:function(Lt,en){return jn(Lt.getMinutes(),en,2)},p:function(Lt){return k[+(Lt.getHours()>=12)]},S:function(Lt,en){return jn(Lt.getSeconds(),en,2)},U:function(Lt,en){return jn(ot.sundayOfYear(Lt),en,2)},w:function(Lt){return Lt.getDay()},W:function(Lt,en){return jn(ot.mondayOfYear(Lt),en,2)},x:$(v),X:$(E),y:function(Lt,en){return jn(Lt.getFullYear()%100,en,2)},Y:function(Lt,en){return jn(Lt.getFullYear()%1e4,en,4)},Z:kn,"%":function(){return"%"}},Ct={a:function vt(Lt,en,gn){$e.lastIndex=0;var Ot=$e.exec(en.slice(gn));return Ot?(Lt.w=xe.get(Ot[0].toLowerCase()),gn+Ot[0].length):-1},A:function bt(Lt,en,gn){_e.lastIndex=0;var Ot=_e.exec(en.slice(gn));return Ot?(Lt.w=Me.get(Ot[0].toLowerCase()),gn+Ot[0].length):-1},b:function gt(Lt,en,gn){Ge.lastIndex=0;var Ot=Ge.exec(en.slice(gn));return Ot?(Lt.m=Ne.get(Ot[0].toLowerCase()),gn+Ot[0].length):-1},B:function $t(Lt,en,gn){Ie.lastIndex=0;var Ot=Ie.exec(en.slice(gn));return Ot?(Lt.m=Be.get(Ot[0].toLowerCase()),gn+Ot[0].length):-1},c:function sn(Lt,en,gn){return ne(Lt,He.c.toString(),en,gn)},d:$n,e:$n,H:Ce,I:Ce,j:Fe,L:on,m:ln,M:_t,p:function Tn(Lt,en,gn){var Ot=fe.get(en.slice(gn,gn+=2).toLowerCase());return null==Ot?-1:(Lt.p=Ot,gn)},S:xt,U:nr,w:tr,W:rr,x:function In(Lt,en,gn){return ne(Lt,He.x.toString(),en,gn)},X:function xn(Lt,en,gn){return ne(Lt,He.X.toString(),en,gn)},y:ze,Y:Jr,Z:Et,"%":pn};return $}ot.year=Tt(function(e){return(e=ot.day(e)).setMonth(0,1),e},function(e,a){e.setFullYear(e.getFullYear()+a)},function(e){return e.getFullYear()}),ot.years=ot.year.range,ot.years.utc=ot.year.utc.range,ot.day=Tt(function(e){var a=new lt(2e3,0);return a.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),a},function(e,a){e.setDate(e.getDate()+a)},function(e){return e.getDate()-1}),ot.days=ot.day.range,ot.days.utc=ot.day.utc.range,ot.dayOfYear=function(e){var a=ot.year(e);return Math.floor((e-a-6e4*(e.getTimezoneOffset()-a.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(e,a){a=7-a;var v=ot[e]=Tt(function(E){return(E=ot.day(E)).setDate(E.getDate()-(E.getDay()+a)%7),E},function(E,k){E.setDate(E.getDate()+7*Math.floor(k))},function(E){var k=ot.year(E).getDay();return Math.floor((ot.dayOfYear(E)+(k+a)%7)/7)-(k!==a)});ot[e+"s"]=v.range,ot[e+"s"].utc=v.utc.range,ot[e+"OfYear"]=function(E){var k=ot.year(E).getDay();return Math.floor((ot.dayOfYear(E)+(k+a)%7)/7)}}),ot.week=ot.sunday,ot.weeks=ot.sunday.range,ot.weeks.utc=ot.sunday.utc.range,ot.weekOfYear=ot.sundayOfYear;var dn={"-":"",_:" ",0:"0"},rn=/^\s*\d+/,un=/^%/;function jn(e,a,v){var E=e<0?"-":"",k=(E?-e:e)+"",T=k.length;return E+(T68?1900:2e3)}(+E[0]),v+E[0].length):-1}function Et(e,a,v){return/^[+-]\d{4}$/.test(a=a.slice(v,v+5))?(e.Z=-a,v+5):-1}function ln(e,a,v){rn.lastIndex=0;var E=rn.exec(a.slice(v,v+2));return E?(e.m=E[0]-1,v+E[0].length):-1}function $n(e,a,v){rn.lastIndex=0;var E=rn.exec(a.slice(v,v+2));return E?(e.d=+E[0],v+E[0].length):-1}function Fe(e,a,v){rn.lastIndex=0;var E=rn.exec(a.slice(v,v+3));return E?(e.j=+E[0],v+E[0].length):-1}function Ce(e,a,v){rn.lastIndex=0;var E=rn.exec(a.slice(v,v+2));return E?(e.H=+E[0],v+E[0].length):-1}function _t(e,a,v){rn.lastIndex=0;var E=rn.exec(a.slice(v,v+2));return E?(e.M=+E[0],v+E[0].length):-1}function xt(e,a,v){rn.lastIndex=0;var E=rn.exec(a.slice(v,v+2));return E?(e.S=+E[0],v+E[0].length):-1}function on(e,a,v){rn.lastIndex=0;var E=rn.exec(a.slice(v,v+3));return E?(e.L=+E[0],v+E[0].length):-1}function kn(e){var a=e.getTimezoneOffset(),v=a>0?"-":"+",E=c(a)/60|0,k=c(a)%60;return v+jn(E,"0",2)+jn(k,"0",2)}function pn(e,a,v){un.lastIndex=0;var E=un.exec(a.slice(v,v+1));return E?v+E[0].length:-1}function Sn(e){for(var a=e.length,v=-1;++v=0?1:-1,ne=$*H,fe=Math.cos(O),_e=Math.sin(O),Me=k*_e,$e=E*fe+Me*Math.cos(ne),xe=Me*$*Math.sin(ne);fr.add(Math.atan2(xe,$e)),v=F,E=fe,k=_e}qr.point=function(F,O){qr.point=T,v=(e=F)*Xe,E=Math.cos(O=(a=O)*Xe/2+ge/4),k=Math.sin(O)},qr.lineEnd=function(){T(e,a)}}function ti(e){var a=e[0],v=e[1],E=Math.cos(v);return[E*Math.cos(a),E*Math.sin(a),Math.sin(v)]}function ni(e,a){return e[0]*a[0]+e[1]*a[1]+e[2]*a[2]}function Hr(e,a){return[e[1]*a[2]-e[2]*a[1],e[2]*a[0]-e[0]*a[2],e[0]*a[1]-e[1]*a[0]]}function Yi(e,a){e[0]+=a[0],e[1]+=a[1],e[2]+=a[2]}function $i(e,a){return[e[0]*a,e[1]*a,e[2]*a]}function Ri(e){var a=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=a,e[1]/=a,e[2]/=a}function ri(e){return[Math.atan2(e[1],e[0]),nn(e[2])]}function Ki(e,a){return c(e[0]-a[0])Mt?E=90:H<-Mt&&(a=-90),ne[0]=e,ne[1]=v}};function _e(vt,bt){$.push(ne=[e=vt,v=vt]),btE&&(E=bt)}function Me(vt,bt){var gt=ti([vt*Xe,bt*Xe]);if(O){var $t=Hr(O,gt),In=Hr([$t[1],-$t[0],0],$t);Ri(In),In=ri(In);var xn=vt-k,Tn=xn>0?1:-1,Lt=In[0]*st*Tn,en=c(xn)>180;if(en^(Tn*kE&&(E=gn);else if(en^(Tn*k<(Lt=(Lt+360)%360-180)&&LtE&&(E=bt);en?vtNe(e,v)&&(v=vt):Ne(vt,v)>Ne(e,v)&&(e=vt):v>=e?(vtv&&(v=vt)):vt>k?Ne(e,vt)>Ne(e,v)&&(v=vt):Ne(vt,v)>Ne(e,v)&&(e=vt)}else _e(vt,bt);O=gt,k=vt}function $e(){fe.point=Me}function xe(){ne[0]=e,ne[1]=v,fe.point=_e,O=null}function Ie(vt,bt){if(O){var gt=vt-k;H+=c(gt)>180?gt+(gt>0?360:-360):gt}else T=vt,F=bt;qr.point(vt,bt),Me(vt,bt)}function Be(){qr.lineStart()}function Ge(){Ie(T,F),qr.lineEnd(),c(H)>Mt&&(e=-(v=180)),ne[0]=e,ne[1]=v,O=null}function Ne(vt,bt){return(bt-=vt)<0?bt+360:bt}function He(vt,bt){return vt[0]-bt[0]}function Ct(vt,bt){return bt[0]<=bt[1]?bt[0]<=vt&&vt<=bt[1]:vtNe($t[0],$t[1])&&($t[1]=sn[1]),Ne(sn[0],$t[1])>Ne($t[0],$t[1])&&($t[0]=sn[0])):In.push($t=sn);for(var Tn,bt,sn,xn=-1/0,$t=(gt=0,In[bt=In.length-1]);gt<=bt;$t=sn,++gt)(Tn=Ne($t[1],(sn=In[gt])[0]))>xn&&(xn=Tn,e=sn[0],v=$t[1])}return $=ne=null,e===1/0||a===1/0?[[NaN,NaN],[NaN,NaN]]:[[e,a],[v,E]]}}(),V.geo.centroid=function(e){Ni=Oi=bi=Si=ai=Mi=Vi=Di=Ae=Ve=tt=0,V.geo.stream(e,ht);var a=Ae,v=Ve,E=tt,k=a*a+v*v+E*E;return k=0;--O)k.point((_e=fe[O])[0],_e[1]);else E(Me.x,Me.p.x,-1,k);Me=Me.p}fe=(Me=Me.o).z,$e=!$e}while(!Me.v);k.lineEnd()}}}function Lr(e){if(a=e.length){for(var a,k,v=0,E=e[0];++v=0?1:-1,bt=vt*Ct,gt=bt>ge,$t=$e*Ne;if(fr.add(Math.atan2($t*vt*Math.sin(bt),xe*He+$t*Math.cos(bt))),T+=gt?Ct+vt*Re:Ct,gt^_e>=v^Be>=v){var sn=Hr(ti(fe),ti(e));Ri(sn);var In=Hr(k,sn);Ri(In);var xn=(gt^Ct>=0?-1:1)*nn(In[2]);(E>xn||E===xn&&(sn[0]||sn[1]))&&(F+=gt^Ct>=0?1:-1)}if(!Ie++)break;_e=Be,$e=Ne,xe=He,fe=e}}return(T<-Mt||T0){for(Ie||(T.polygonStart(),Ie=!0),T.lineStart();++sn<$t;)T.point((In=gt[sn])[0],In[1]);T.lineEnd()}return}$t>1&&2&vt&&bt.push(bt.pop().concat(bt.shift())),Me.push(bt.filter(Rr))}}return H}}function Rr(e){return e.length>1}function jr(){var a,e=[];return{lineStart:function(){e.push(a=[])},point:function(v,E){a.push([v,E])},lineEnd:le,buffer:function(){var v=e;return e=[],a=null,v},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function zi(e,a){return((e=e.x)[0]<0?e[1]-Ze-Mt:Ze-e[1])-((a=a.x)[0]<0?a[1]-Ze-Mt:Ze-a[1])}var no=Wr(Dn,function ji(e){var k,a=NaN,v=NaN,E=NaN;return{lineStart:function(){e.lineStart(),k=1},point:function(T,F){var O=T>0?ge:-ge,H=c(T-a);c(H-ge)0?Ze:-Ze),e.point(E,v),e.lineEnd(),e.lineStart(),e.point(O,v),e.point(T,v),k=0):E!==O&&H>=ge&&(c(a-E)Mt?Math.atan((Math.sin(a)*(T=Math.cos(E))*Math.sin(v)-Math.sin(E)*(k=Math.cos(a))*Math.sin(e))/(k*T*F)):(a+E)/2}(a,v,T,F),e.point(E,v),e.lineEnd(),e.lineStart(),e.point(O,v),k=0),e.point(a=T,v=F),E=O},lineEnd:function(){e.lineEnd(),a=v=NaN},clean:function(){return 2-k}}},function Xi(e,a,v,E){var k;if(null==e)E.point(-ge,k=v*Ze),E.point(0,k),E.point(ge,k),E.point(ge,0),E.point(ge,-k),E.point(0,-k),E.point(-ge,-k),E.point(-ge,0),E.point(-ge,k);else if(c(e[0]-a[0])>Mt){var T=e[0]0)){if(xe/=Me,Me<0){if(xe0){if(xe>_e)return;xe>fe&&(fe=xe)}if(xe=v-O,Me||!(xe<0)){if(xe/=Me,Me<0){if(xe>_e)return;xe>fe&&(fe=xe)}else if(Me>0){if(xe0)){if(xe/=$e,$e<0){if(xe0){if(xe>_e)return;xe>fe&&(fe=xe)}if(xe=E-H,$e||!(xe<0)){if(xe/=$e,$e<0){if(xe>_e)return;xe>fe&&(fe=xe)}else if($e>0){if(xe0&&(k.a={x:O+fe*Me,y:H+fe*$e}),_e<1&&(k.b={x:O+_e*Me,y:H+_e*$e}),k}}}}}}var Ao=1e9;function Yo(e,a,v,E){return function(O){var fe,_e,Me,Ne,He,Ct,vt,bt,gt,$t,sn,H=O,$=jr(),ne=So(e,a,v,E),$e={point:Ge,lineStart:function In(){$e.point=Tn,_e&&_e.push(Me=[]),$t=!0,gt=!1,vt=bt=NaN},lineEnd:function xn(){fe&&(Tn(Ne,He),Ct&>&&$.rejoin(),fe.push($.buffer())),$e.point=Ge,gt&&O.lineEnd()},polygonStart:function(){O=$,fe=[],_e=[],sn=!0},polygonEnd:function(){O=H,fe=V.merge(fe);var Lt=function xe(Lt){for(var en=0,gn=_e.length,Ot=Lt[1],fn=0;fnOt&&Bt(Tr,Or,Lt)>0&&++en:Or[1]<=Ot&&Bt(Tr,Or,Lt)<0&&--en,Tr=Or;return 0!==en}([e,E]),en=sn&&Lt,gn=fe.length;(en||gn)&&(O.polygonStart(),en&&(O.lineStart(),Ie(null,null,1,O),O.lineEnd()),gn&&ir(fe,T,Lt,Ie,O),O.polygonEnd()),fe=_e=Me=null}};function Ie(Lt,en,gn,Ot){var fn=0,Un=0;if(null==Lt||(fn=k(Lt,gn))!==(Un=k(en,gn))||F(Lt,en)<0^gn>0)do{Ot.point(0===fn||3===fn?e:v,fn>1?E:a)}while((fn=(fn+gn+4)%4)!==Un);else Ot.point(en[0],en[1])}function Be(Lt,en){return e<=Lt&&Lt<=v&&a<=en&&en<=E}function Ge(Lt,en){Be(Lt,en)&&O.point(Lt,en)}function Tn(Lt,en){var gn=Be(Lt=Math.max(-Ao,Math.min(Ao,Lt)),en=Math.max(-Ao,Math.min(Ao,en)));if(_e&&Me.push([Lt,en]),$t)Ne=Lt,He=en,Ct=gn,$t=!1,gn&&(O.lineStart(),O.point(Lt,en));else if(gn&>)O.point(Lt,en);else{var Ot={a:{x:vt,y:bt},b:{x:Lt,y:en}};ne(Ot)?(gt||(O.lineStart(),O.point(Ot.a.x,Ot.a.y)),O.point(Ot.b.x,Ot.b.y),gn||O.lineEnd(),sn=!1):gn&&(O.lineStart(),O.point(Lt,en),sn=!1)}vt=Lt,bt=en,gt=gn}return $e};function k(O,H){return c(O[0]-e)0?0:3:c(O[0]-v)0?2:1:c(O[1]-a)0?1:0:H>0?3:2}function T(O,H){return F(O.x,H.x)}function F(O,H){var $=k(O,1),ne=k(H,1);return $!==ne?$-ne:0===$?H[1]-O[1]:1===$?O[0]-H[0]:2===$?O[1]-H[1]:H[0]-O[0]}}function Do(e){var a=0,v=ge/3,E=lr(e),k=E(a,v);return k.parallels=function(T){return arguments.length?E(a=T[0]*ge/180,v=T[1]*ge/180):[a/ge*180,v/ge*180]},k}function bo(e,a){var v=Math.sin(e),E=(v+Math.sin(a))/2,k=1+v*(2*E-v),T=Math.sqrt(k)/E;function F(O,H){var $=Math.sqrt(k-2*E*Math.sin(H))/E;return[$*Math.sin(O*=E),T-$*Math.cos(O)]}return F.invert=function(O,H){var $=T-H;return[Math.atan2(O,$)/E,nn((k-(O*O+$*$)*E*E)/(2*E))]},F}V.geo.clipExtent=function(){var e,a,v,E,k,T,F={stream:function(O){return k&&(k.valid=!1),(k=T(O)).valid=!0,k},extent:function(O){return arguments.length?(T=Yo(e=+O[0][0],a=+O[0][1],v=+O[1][0],E=+O[1][1]),k&&(k.valid=!1,k=null),F):[[e,a],[v,E]]}};return F.extent([[0,0],[960,500]])},(V.geo.conicEqualArea=function(){return Do(bo)}).raw=bo,V.geo.albers=function(){return V.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},V.geo.albersUsa=function(){var E,T,F,O,e=V.geo.albers(),a=V.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),v=V.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),k={point:function($,ne){E=[$,ne]}};function H($){var ne=$[0],fe=$[1];return E=null,T(ne,fe),E||(F(ne,fe),E)||O(ne,fe),E}return H.invert=function($){var ne=e.scale(),fe=e.translate(),_e=($[0]-fe[0])/ne,Me=($[1]-fe[1])/ne;return(Me>=.12&&Me<.234&&_e>=-.425&&_e<-.214?a:Me>=.166&&Me<.234&&_e>=-.214&&_e<-.115?v:e).invert($)},H.stream=function($){var ne=e.stream($),fe=a.stream($),_e=v.stream($);return{point:function(Me,$e){ne.point(Me,$e),fe.point(Me,$e),_e.point(Me,$e)},sphere:function(){ne.sphere(),fe.sphere(),_e.sphere()},lineStart:function(){ne.lineStart(),fe.lineStart(),_e.lineStart()},lineEnd:function(){ne.lineEnd(),fe.lineEnd(),_e.lineEnd()},polygonStart:function(){ne.polygonStart(),fe.polygonStart(),_e.polygonStart()},polygonEnd:function(){ne.polygonEnd(),fe.polygonEnd(),_e.polygonEnd()}}},H.precision=function($){return arguments.length?(e.precision($),a.precision($),v.precision($),H):e.precision()},H.scale=function($){return arguments.length?(e.scale($),a.scale(.35*$),v.scale($),H.translate(e.translate())):e.scale()},H.translate=function($){if(!arguments.length)return e.translate();var ne=e.scale(),fe=+$[0],_e=+$[1];return T=e.translate($).clipExtent([[fe-.455*ne,_e-.238*ne],[fe+.455*ne,_e+.238*ne]]).stream(k).point,F=a.translate([fe-.307*ne,_e+.201*ne]).clipExtent([[fe-.425*ne+Mt,_e+.12*ne+Mt],[fe-.214*ne-Mt,_e+.234*ne-Mt]]).stream(k).point,O=v.translate([fe-.205*ne,_e+.212*ne]).clipExtent([[fe-.214*ne+Mt,_e+.166*ne+Mt],[fe-.115*ne-Mt,_e+.234*ne-Mt]]).stream(k).point,H},H.scale(1070)};var zo,jo,Ui={point:le,lineStart:le,lineEnd:le,polygonStart:function(){jo=0,Ui.lineStart=Uo},polygonEnd:function(){Ui.lineStart=Ui.lineEnd=Ui.point=le,zo+=c(jo/2)}};function Uo(){var e,a,v,E;function k(T,F){jo+=E*T-v*F,v=T,E=F}Ui.point=function(T,F){Ui.point=k,e=v=T,a=E=F},Ui.lineEnd=function(){k(e,a)}}var Fo,Co,co,be,D={point:function te(e,a){eco&&(co=e),abe&&(be=a)},lineStart:le,lineEnd:le,polygonStart:le,polygonEnd:le};function Pe(){var e=et(4.5),a=[],v={point:E,lineStart:function(){v.point=k},lineEnd:F,polygonStart:function(){v.lineEnd=O},polygonEnd:function(){v.lineEnd=F,v.point=E},pointRadius:function(H){return e=et(H),v},result:function(){if(a.length){var H=a.join("");return a=[],H}}};function E(H,$){a.push("M",H,",",$,e)}function k(H,$){a.push("M",H,",",$),v.point=T}function T(H,$){a.push("L",H,",",$)}function F(){v.point=E}function O(){a.push("Z")}return v}function et(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}var ut={point:Nt,lineStart:wn,lineEnd:Rn,polygonStart:function(){ut.lineStart=Vn},polygonEnd:function(){ut.point=Nt,ut.lineStart=wn,ut.lineEnd=Rn}};function Nt(e,a){bi+=e,Si+=a,++ai}function wn(){var e,a;function v(E,k){var T=E-e,F=k-a,O=Math.sqrt(T*T+F*F);Mi+=O*(e+E)/2,Vi+=O*(a+k)/2,Di+=O,Nt(e=E,a=k)}ut.point=function(E,k){ut.point=v,Nt(e=E,a=k)}}function Rn(){ut.point=Nt}function Vn(){var e,a,v,E;function k(T,F){var O=T-v,H=F-E,$=Math.sqrt(O*O+H*H);Mi+=$*(v+T)/2,Vi+=$*(E+F)/2,Di+=$,Ae+=($=E*T-v*F)*(v+T),Ve+=$*(E+F),tt+=3*$,Nt(v=T,E=F)}ut.point=function(T,F){ut.point=k,Nt(e=v=T,a=E=F)},ut.lineEnd=function(){k(e,a)}}function Zn(e){var a=4.5,v={point:E,lineStart:function(){v.point=k},lineEnd:F,polygonStart:function(){v.lineEnd=O},polygonEnd:function(){v.lineEnd=F,v.point=E},pointRadius:function(H){return a=H,v},result:le};function E(H,$){e.moveTo(H+a,$),e.arc(H,$,a,0,Re)}function k(H,$){e.moveTo(H,$),v.point=T}function T(H,$){e.lineTo(H,$)}function F(){v.point=E}function O(){e.closePath()}return v}function Bn(e){var a=.5,v=Math.cos(30*Xe),E=16;function k(H){return(E?F:T)(H)}function T(H){return ar(H,function($,ne){$=e($,ne),H.point($[0],$[1])})}function F(H){var $,fe,_e,Me,$e,xe,Ie,Be,Ge,Ne,He,Ct,vt={point:bt,lineStart:gt,lineEnd:sn,polygonStart:function(){H.polygonStart(),vt.lineStart=In},polygonEnd:function(){H.polygonEnd(),vt.lineStart=gt}};function bt(Lt,en){Lt=e(Lt,en),H.point(Lt[0],Lt[1])}function gt(){Be=NaN,vt.point=$t,H.lineStart()}function $t(Lt,en){var gn=ti([Lt,en]),Ot=e(Lt,en);O(Be,Ge,Ie,Ne,He,Ct,Be=Ot[0],Ge=Ot[1],Ie=Lt,Ne=gn[0],He=gn[1],Ct=gn[2],E,H),H.point(Be,Ge)}function sn(){vt.point=bt,H.lineEnd()}function In(){gt(),vt.point=xn,vt.lineEnd=Tn}function xn(Lt,en){$t($=Lt,en),fe=Be,_e=Ge,Me=Ne,$e=He,xe=Ct,vt.point=$t}function Tn(){O(Be,Ge,Ie,Ne,He,Ct,fe,_e,$,Me,$e,xe,E,H),vt.lineEnd=sn,sn()}return vt}function O(H,$,ne,fe,_e,Me,$e,xe,Ie,Be,Ge,Ne,He,Ct){var vt=$e-H,bt=xe-$,gt=vt*vt+bt*bt;if(gt>4*a&&He--){var $t=fe+Be,sn=_e+Ge,In=Me+Ne,xn=Math.sqrt($t*$t+sn*sn+In*In),Tn=Math.asin(In/=xn),Lt=c(c(In)-1)a||c((vt*fn+bt*Un)/gt-.5)>.3||fe*Be+_e*Ge+Me*Ne0&&16,k):Math.sqrt(a)},k}function sr(e){this.stream=e}function ar(e,a){return{point:a,sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}function or(e){return lr(function(){return e})()}function lr(e){var a,v,E,Me,$e,Ne,k=Bn(function(gt,$t){return[(gt=a(gt,$t))[0]*T+Me,$e-gt[1]*T]}),T=150,F=480,O=250,H=0,$=0,ne=0,fe=0,_e=0,xe=no,Ie=R,Be=null,Ge=null;function He(gt){return[(gt=E(gt[0]*Xe,gt[1]*Xe))[0]*T+Me,$e-gt[1]*T]}function Ct(gt){return(gt=E.invert((gt[0]-Me)/T,($e-gt[1])/T))&&[gt[0]*st,gt[1]*st]}function vt(){E=On(v=kr(ne,fe,_e),a);var gt=a(H,$);return Me=F-gt[0]*T,$e=O+gt[1]*T,bt()}function bt(){return Ne&&(Ne.valid=!1,Ne=null),He}return He.stream=function(gt){return Ne&&(Ne.valid=!1),(Ne=Pr(xe(v,k(Ie(gt))))).valid=!0,Ne},He.clipAngle=function(gt){return arguments.length?(xe=null==gt?(Be=gt,no):function io(e){var a=Math.cos(e),v=a>0,E=c(a)>Mt;return Wr(T,function F($){var ne,fe,_e,Me,$e;return{lineStart:function(){Me=_e=!1,$e=1},point:function(xe,Ie){var Ge,Be=[xe,Ie],Ne=T(xe,Ie),He=v?Ne?0:H(xe,Ie):Ne?H(xe+(xe<0?ge:-ge),Ie):0;if(!ne&&(Me=_e=Ne)&&$.lineStart(),Ne!==_e&&(Ge=O(ne,Be),(Ki(ne,Ge)||Ki(Be,Ge))&&(Be[0]+=Mt,Be[1]+=Mt,Ne=T(Be[0],Be[1]))),Ne!==_e)$e=0,Ne?($.lineStart(),Ge=O(Be,ne),$.point(Ge[0],Ge[1])):(Ge=O(ne,Be),$.point(Ge[0],Ge[1]),$.lineEnd()),ne=Ge;else if(E&&ne&&v^Ne){var Ct;!(He&fe)&&(Ct=O(Be,ne,!0))&&($e=0,v?($.lineStart(),$.point(Ct[0][0],Ct[0][1]),$.point(Ct[1][0],Ct[1][1]),$.lineEnd()):($.point(Ct[1][0],Ct[1][1]),$.lineEnd(),$.lineStart(),$.point(Ct[0][0],Ct[0][1])))}Ne&&(!ne||!Ki(ne,Be))&&$.point(Be[0],Be[1]),ne=Be,_e=Ne,fe=He},lineEnd:function(){_e&&$.lineEnd(),ne=null},clean:function(){return $e|(Me&&_e)<<1}}},Ir(e,6*Xe),v?[0,-e]:[-ge,e-ge]);function T($,ne){return Math.cos($)*Math.cos(ne)>a}function O($,ne,fe){var $e=[1,0,0],xe=Hr(ti($),ti(ne)),Ie=ni(xe,xe),Be=xe[0],Ge=Ie-Be*Be;if(!Ge)return!fe&&$;var Ne=a*Ie/Ge,He=-a*Be/Ge,Ct=Hr($e,xe),vt=$i($e,Ne);Yi(vt,$i(xe,He));var gt=Ct,$t=ni(vt,gt),sn=ni(gt,gt),In=$t*$t-sn*(ni(vt,vt)-1);if(!(In<0)){var xn=Math.sqrt(In),Tn=$i(gt,(-$t-xn)/sn);if(Yi(Tn,vt),Tn=ri(Tn),!fe)return Tn;var fn,Lt=$[0],en=ne[0],gn=$[1],Ot=ne[1];en0^Tn[1]<(c(Tn[0]-Lt)ge^(Lt<=Tn[0]&&Tn[0]<=en)){var Tr=$i(gt,(-$t+xn)/sn);return Yi(Tr,vt),[Tn,ri(Tr)]}}}function H($,ne){var fe=v?e:ge-e,_e=0;return $<-fe?_e|=1:$>fe&&(_e|=2),ne<-fe?_e|=4:ne>fe&&(_e|=8),_e}}((Be=+gt)*Xe),bt()):Be},He.clipExtent=function(gt){return arguments.length?(Ge=gt,Ie=gt?Yo(gt[0][0],gt[0][1],gt[1][0],gt[1][1]):R,bt()):Ge},He.scale=function(gt){return arguments.length?(T=+gt,vt()):T},He.translate=function(gt){return arguments.length?(F=+gt[0],O=+gt[1],vt()):[F,O]},He.center=function(gt){return arguments.length?(H=gt[0]%360*Xe,$=gt[1]%360*Xe,vt()):[H*st,$*st]},He.rotate=function(gt){return arguments.length?(ne=gt[0]%360*Xe,fe=gt[1]%360*Xe,_e=gt.length>2?gt[2]%360*Xe:0,vt()):[ne*st,fe*st,_e*st]},V.rebind(He,k,"precision"),function(){return a=e.apply(this,arguments),He.invert=a.invert&&Ct,vt()}}function Pr(e){return ar(e,function(a,v){e.point(a*Xe,v*Xe)})}function wr(e,a){return[e,a]}function gr(e,a){return[e>ge?e-Re:e<-ge?e+Re:e,a]}function kr(e,a,v){return e?a||v?On(Ar(e),Mr(a,v)):Ar(e):a||v?Mr(a,v):gr}function Sr(e){return function(a,v){return[(a+=e)>ge?a-Re:a<-ge?a+Re:a,v]}}function Ar(e){var a=Sr(e);return a.invert=Sr(-e),a}function Mr(e,a){var v=Math.cos(e),E=Math.sin(e),k=Math.cos(a),T=Math.sin(a);function F(O,H){var $=Math.cos(H),ne=Math.cos(O)*$,fe=Math.sin(O)*$,_e=Math.sin(H),Me=_e*v+ne*E;return[Math.atan2(fe*k-Me*T,ne*v-_e*E),nn(Me*k+fe*T)]}return F.invert=function(O,H){var $=Math.cos(H),ne=Math.cos(O)*$,fe=Math.sin(O)*$,_e=Math.sin(H),Me=_e*k-fe*T;return[Math.atan2(fe*k+_e*T,ne*v+Me*E),nn(Me*v-ne*E)]},F}function Ir(e,a){var v=Math.cos(e),E=Math.sin(e);return function(k,T,F,O){var H=F*a;null!=k?(k=Ur(v,k),T=Ur(v,T),(F>0?kT)&&(k+=F*Re)):(k=e+F*Re,T=e-.5*H);for(var $,ne=k;F>0?ne>T:ne2?e[2]*Xe:0),a.invert=function(v){return(v=e.invert(v[0]*Xe,v[1]*Xe))[0]*=st,v[1]*=st,v},a},gr.invert=wr,V.geo.circle=function(){var a,E,e=[0,0],v=6;function k(){var T="function"==typeof e?e.apply(this,arguments):e,F=kr(-T[0]*Xe,-T[1]*Xe,0).invert,O=[];return E(null,null,1,{point:function(H,$){O.push(H=F(H,$)),H[0]*=st,H[1]*=st}}),{type:"Polygon",coordinates:[O]}}return k.origin=function(T){return arguments.length?(e=T,k):e},k.angle=function(T){return arguments.length?(E=Ir((a=+T)*Xe,v*Xe),k):a},k.precision=function(T){return arguments.length?(E=Ir(a*Xe,(v=+T)*Xe),k):v},k.angle(90)},V.geo.distance=function(e,a){var fe,v=(a[0]-e[0])*Xe,E=e[1]*Xe,k=a[1]*Xe,T=Math.sin(v),F=Math.cos(v),O=Math.sin(E),H=Math.cos(E),$=Math.sin(k),ne=Math.cos(k);return Math.atan2(Math.sqrt((fe=ne*T)*fe+(fe=H*$-O*ne*F)*fe),O*$+H*ne*F)},V.geo.graticule=function(){var e,a,v,E,k,T,F,O,_e,Me,$e,xe,H=10,$=H,ne=90,fe=360,Ie=2.5;function Be(){return{type:"MultiLineString",coordinates:Ge()}}function Ge(){return V.range(Math.ceil(E/ne)*ne,v,ne).map($e).concat(V.range(Math.ceil(O/fe)*fe,F,fe).map(xe)).concat(V.range(Math.ceil(a/H)*H,e,H).filter(function(Ne){return c(Ne%ne)>Mt}).map(_e)).concat(V.range(Math.ceil(T/$)*$,k,$).filter(function(Ne){return c(Ne%fe)>Mt}).map(Me))}return Be.lines=function(){return Ge().map(function(Ne){return{type:"LineString",coordinates:Ne}})},Be.outline=function(){return{type:"Polygon",coordinates:[$e(E).concat(xe(F).slice(1),$e(v).reverse().slice(1),xe(O).reverse().slice(1))]}},Be.extent=function(Ne){return arguments.length?Be.majorExtent(Ne).minorExtent(Ne):Be.minorExtent()},Be.majorExtent=function(Ne){return arguments.length?(O=+Ne[0][1],F=+Ne[1][1],(E=+Ne[0][0])>(v=+Ne[1][0])&&(Ne=E,E=v,v=Ne),O>F&&(Ne=O,O=F,F=Ne),Be.precision(Ie)):[[E,O],[v,F]]},Be.minorExtent=function(Ne){return arguments.length?(T=+Ne[0][1],k=+Ne[1][1],(a=+Ne[0][0])>(e=+Ne[1][0])&&(Ne=a,a=e,e=Ne),T>k&&(Ne=T,T=k,k=Ne),Be.precision(Ie)):[[a,T],[e,k]]},Be.step=function(Ne){return arguments.length?Be.majorStep(Ne).minorStep(Ne):Be.minorStep()},Be.majorStep=function(Ne){return arguments.length?(ne=+Ne[0],fe=+Ne[1],Be):[ne,fe]},Be.minorStep=function(Ne){return arguments.length?(H=+Ne[0],$=+Ne[1],Be):[H,$]},Be.precision=function(Ne){return arguments.length?(Ie=+Ne,_e=ui(T,k,90),Me=di(a,e,Ie),$e=ui(O,F,90),xe=di(E,v,Ie),Be):Ie},Be.majorExtent([[-180,-90+Mt],[180,90-Mt]]).minorExtent([[-180,-80-Mt],[180,80+Mt]])},V.geo.greatArc=function(){var a,E,e=Ai,v=$r;function k(){return{type:"LineString",coordinates:[a||e.apply(this,arguments),E||v.apply(this,arguments)]}}return k.distance=function(){return V.geo.distance(a||e.apply(this,arguments),E||v.apply(this,arguments))},k.source=function(T){return arguments.length?(e=T,a="function"==typeof T?null:T,k):e},k.target=function(T){return arguments.length?(v=T,E="function"==typeof T?null:T,k):v},k.precision=function(){return arguments.length?k:0},k},V.geo.interpolate=function(e,a){return function go(e,a,v,E){var k=Math.cos(a),T=Math.sin(a),F=Math.cos(E),O=Math.sin(E),H=k*Math.cos(e),$=k*Math.sin(e),ne=F*Math.cos(v),fe=F*Math.sin(v),_e=2*Math.asin(Math.sqrt(Ee(E-a)+k*F*Ee(v-e))),Me=1/Math.sin(_e),$e=_e?function(xe){var Ie=Math.sin(xe*=_e)*Me,Be=Math.sin(_e-xe)*Me,Ge=Be*H+Ie*ne,Ne=Be*$+Ie*fe,He=Be*T+Ie*O;return[Math.atan2(Ne,Ge)*st,Math.atan2(He,Math.sqrt(Ge*Ge+Ne*Ne))*st]}:function(){return[e*st,a*st]};return $e.distance=_e,$e}(e[0]*Xe,e[1]*Xe,a[0]*Xe,a[1]*Xe)},V.geo.length=function(e){return Gi=0,V.geo.stream(e,Ci),Gi};var Gi,Ci={sphere:le,point:le,lineStart:function pi(){var e,a,v;function E(k,T){var F=Math.sin(T*=Xe),O=Math.cos(T),H=c((k*=Xe)-e),$=Math.cos(H);Gi+=Math.atan2(Math.sqrt((H=O*Math.sin(H))*H+(H=v*F-a*O*$)*H),a*F+v*O*$),e=k,a=F,v=O}Ci.point=function(k,T){e=k*Xe,a=Math.sin(T*=Xe),v=Math.cos(T),Ci.point=E},Ci.lineEnd=function(){Ci.point=Ci.lineEnd=le}},lineEnd:le,polygonStart:le,polygonEnd:le};function Fr(e,a){function v(E,k){var T=Math.cos(E),F=Math.cos(k),O=e(T*F);return[O*F*Math.sin(E),O*Math.sin(k)]}return v.invert=function(E,k){var T=Math.sqrt(E*E+k*k),F=a(T),O=Math.sin(F),H=Math.cos(F);return[Math.atan2(E*O,T*H),Math.asin(T&&k*O/T)]},v}var ho=Fr(function(e){return Math.sqrt(2/(1+e))},function(e){return 2*Math.asin(e/2)});(V.geo.azimuthalEqualArea=function(){return or(ho)}).raw=ho;var wi=Fr(function(e){var a=Math.acos(e);return a&&a/Math.sin(a)},R);function gi(e,a){var v=Math.cos(e),E=function(O){return Math.tan(ge/4+O/2)},k=e===a?Math.sin(e):Math.log(v/Math.cos(a))/Math.log(E(a)/E(e)),T=v*Math.pow(E(e),k)/k;if(!k)return uo;function F(O,H){T>0?H<-Ze+Mt&&(H=-Ze+Mt):H>Ze-Mt&&(H=Ze-Mt);var $=T/Math.pow(E(H),k);return[$*Math.sin(k*O),T-$*Math.cos(k*O)]}return F.invert=function(O,H){var $=T-H,ne=tn(k)*Math.sqrt(O*O+$*$);return[Math.atan2(O,$)/k,2*Math.atan(Math.pow(T/ne,1/k))-Ze]},F}function Li(e,a){var v=Math.cos(e),E=e===a?Math.sin(e):(v-Math.cos(a))/(a-e),k=v/E+e;if(c(E)1&&Bt(e[v[E-2]],e[v[E-1]],e[k])<=0;)--E;v[E++]=k}return v.slice(0,E)}function cs(e,a){return e[0]-a[0]||e[1]-a[1]}(V.geo.stereographic=function(){return or(as)}).raw=as,Io.invert=function(e,a){return[-a,2*Math.atan(Math.exp(e))-Ze]},(V.geo.transverseMercator=function(){var e=mo(Io),a=e.center,v=e.rotate;return e.center=function(E){return E?a([-E[1],E[0]]):[(E=a())[1],-E[0]]},e.rotate=function(E){return E?v([E[0],E[1],E.length>2?E[2]+90:90]):[(E=v())[0],E[1],E[2]-90]},v([0,0,90])}).raw=Io,V.geom={},V.geom.hull=function(e){var a=wo,v=xo;if(arguments.length)return E(e);function E(k){if(k.length<3)return[];var O,T=_r(a),F=_r(v),H=k.length,$=[],ne=[];for(O=0;O=0;--O)xe.push(k[$[fe[O]][2]]);for(O=+Me;O<_e.length-$e;++O)xe.push(k[$[_e[O]][2]]);return xe}return E.x=function(k){return arguments.length?(a=k,E):a},E.y=function(k){return arguments.length?(v=k,E):v},E},V.geom.polygon=function(e){return C(e,Ro),e};var Ro=V.geom.polygon.prototype=[];function Xo(e,a,v){return(v[0]-a[0])*(e[1]-a[1])<(v[1]-a[1])*(e[0]-a[0])}function Zo(e,a,v,E){var k=e[0],T=v[0],F=a[0]-k,O=E[0]-T,H=e[1],$=v[1],ne=a[1]-H,fe=E[1]-$,_e=(O*(H-$)-fe*(k-T))/(fe*F-O*ne);return[k+_e*F,H+_e*ne]}function Mo(e){var a=e[0],v=e[e.length-1];return!(a[0]-v[0]||a[1]-v[1])}Ro.area=function(){for(var v,e=-1,a=this.length,E=this[a-1],k=0;++eMt)O=O.L;else{if(!((F=a-gc(O,v))>Mt)){T>-Mt?(E=O.P,k=O):F>-Mt?(E=O,k=O.N):E=k=O;break}if(!O.R){E=O;break}O=O.R}var H=oa(e);if(yo.insert(E,H),E||k){if(E===k)return Wo(E),k=oa(E.site),yo.insert(H,k),H.edge=k.edge=Qo(E.site,H.site),Ho(E),void Ho(k);if(!k)return void(H.edge=Qo(E.site,H.site));Wo(E),Wo(k);var $=E.site,ne=$.x,fe=$.y,_e=e.x-ne,Me=e.y-fe,$e=k.site,xe=$e.x-ne,Ie=$e.y-fe,Be=2*(_e*Ie-Me*xe),Ge=_e*_e+Me*Me,Ne=xe*xe+Ie*Ie,He={x:(Ie*Ge-Me*Ne)/Be+ne,y:(_e*Ne-xe*Ge)/Be+fe};hs(k.edge,$,$e,He),H.edge=Qo($,e,null,He),k.edge=Qo(e,$e,null,He),Ho(E),Ho(k)}}function sa(e,a){var v=e.site,E=v.x,k=v.y,T=k-a;if(!T)return E;var F=e.P;if(!F)return-1/0;var O=(v=F.site).x,H=v.y,$=H-a;if(!$)return O;var ne=O-E,fe=1/T-1/$,_e=ne/$;return fe?(-_e+Math.sqrt(_e*_e-2*fe*(ne*ne/(-2*$)-H+$/2+k-T/2)))/fe+E:(E+O)/2}function gc(e,a){var v=e.N;if(v)return sa(v,a);var E=e.site;return E.y===a?E.x:1/0}function aa(e){this.site=e,this.edges=[]}function ca(e,a){return a.angle-e.angle}function vc(){ls(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ho(e){var a=e.P,v=e.N;if(a&&v){var E=a.site,k=e.site,T=v.site;if(E!==T){var F=k.x,O=k.y,H=E.x-F,$=E.y-O,ne=T.x-F,fe=2*(H*(Ie=T.y-O)-$*ne);if(!(fe>=-Kn)){var _e=H*H+$*$,Me=ne*ne+Ie*Ie,$e=(Ie*_e-$*Me)/fe,xe=(H*Me-ne*_e)/fe,Ie=xe+O,Be=ia.pop()||new vc;Be.arc=e,Be.site=k,Be.x=$e+F,Be.y=Ie+Math.sqrt($e*$e+xe*xe),Be.cy=Ie,e.circle=Be;for(var Ge=null,Ne=Jo._;Ne;)if(Be.y=T)return;if(ne>_e){if(E){if(E.y>=O)return}else E={x:$e,y:F};v={x:$e,y:O}}else{if(E){if(E.y1)if(ne>_e){if(E){if(E.y>=O)return}else E={x:(F-Be)/Ie,y:F};v={x:(O-Be)/Ie,y:O}}else{if(E){if(E.y=T)return}else E={x:k,y:Ie*k+Be};v={x:T,y:Ie*T+Be}}else{if(E){if(E.xMt||c(H-F)>Mt)&&(Me.splice(_e,0,new us(bc(fe.site,Ie,c(O-a)Mt?{x:a,y:c(T-a)Mt?{x:c(F-k)Mt?{x:v,y:c(T-v)Mt?{x:c(F-E)=ne&&Be.x<=_e&&Be.y>=fe&&Be.y<=Me?[[ne,Me],[_e,Me],[_e,fe],[ne,fe]]:[]).point=H[xe]}),$}function O(H){return H.map(function($,ne){return{x:Math.round(E($,ne)/Mt)*Mt,y:Math.round(k($,ne)/Mt)*Mt,i:ne}})}return F.links=function(H){return Ms(O(H)).edges.filter(function($){return $.l&&$.r}).map(function($){return{source:H[$.l.i],target:H[$.r.i]}})},F.triangles=function(H){var $=[];return Ms(O(H)).cells.forEach(function(ne,fe){for(var Be,_e=ne.site,Me=ne.edges.sort(ca),$e=-1,xe=Me.length,Ge=Me[xe-1].edge,Ne=Ge.l===_e?Ge.r:Ge.l;++$ev&&(T=a.slice(v,T),O[F]?O[F]+=T:O[++F]=T),(E=E[0])===(k=k[0])?O[F]?O[F]+=k:O[++F]=k:(O[++F]=null,H.push({i:F,x:_o(E,k)})),v=Ps.lastIndex;return vNe&&(Ne=ne.x),ne.y>He&&(He=ne.y),Me.push(ne.x),$e.push(ne.y);else for(xe=0;xeNe&&(Ne=Ct),vt>He&&(He=vt),Me.push(Ct),$e.push(vt)}var bt=Ne-Be,gt=He-Ge;function $t(xn,Tn,Lt,en,gn,Ot,fn,Un){if(!isNaN(Lt)&&!isNaN(en))if(xn.leaf){var Qn=xn.x,cr=xn.y;if(null!=Qn)if(c(Qn-Lt)+c(cr-en)<.01)sn(xn,Tn,Lt,en,gn,Ot,fn,Un);else{var Tr=xn.point;xn.x=xn.y=xn.point=null,sn(xn,Tr,Qn,cr,gn,Ot,fn,Un),sn(xn,Tn,Lt,en,gn,Ot,fn,Un)}else xn.x=Lt,xn.y=en,xn.point=Tn}else sn(xn,Tn,Lt,en,gn,Ot,fn,Un)}function sn(xn,Tn,Lt,en,gn,Ot,fn,Un){var Qn=.5*(gn+fn),cr=.5*(Ot+Un),Tr=Lt>=Qn,Or=en>=cr,Ti=Or<<1|Tr;xn.leaf=!1,Tr?gn=Qn:fn=Qn,Or?Ot=cr:Un=cr,$t(xn=xn.nodes[Ti]||(xn.nodes[Ti]={leaf:!0,nodes:[],point:null,x:null,y:null}),Tn,Lt,en,gn,Ot,fn,Un)}bt>gt?He=Ge+bt:Ne=Be+gt;var In={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(xn){$t(In,xn,+fe(xn,++xe),+_e(xn,xe),Be,Ge,Ne,He)}};if(In.visit=function(xn){ns(xn,In,Be,Ge,Ne,He)},In.find=function(xn){return function Sc(e,a,v,E,k,T,F){var H,O=1/0;return function $(ne,fe,_e,Me,$e){if(!(fe>T||_e>F||Me=vt)<<1|a>=Ct,sn=$t+4;$t=0&&!(E=V.interpolators[v](e,a)););return E}function ds(e,a){var O,v=[],E=[],k=e.length,T=a.length,F=Math.min(e.length,a.length);for(O=0;O=1)return 1;var a=e*e,v=a*e;return 4*(e<.5?v:3*(e-a)+v-.75)}function Bc(e){return 1-Math.cos(e*Ze)}function Pc(e){return Math.pow(2,10*(e-1))}function Nc(e){return 1-Math.sqrt(1-e*e)}function zc(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function va(e,a){return a-=e,function(v){return Math.round(e+a*v)}}function ya(e){var a=[e.a,e.b],v=[e.c,e.d],E=ba(a),k=_a(a,v),T=ba(function Hc(e,a,v){return e[0]+=v*a[0],e[1]+=v*a[1],e}(v,a,-k))||0;a[0]*v[1]=0?e.slice(0,a):e,E=a>=0?e.slice(a+1):"in";return v=Ac.get(v)||pa,function Tc(e){return function(a){return a<=0?0:a>=1?1:e(a)}}((E=Cc.get(E)||R)(v.apply(null,De.call(arguments,1))))},V.interpolateHcl=function jc(e,a){e=V.hcl(e),a=V.hcl(a);var v=e.h,E=e.c,k=e.l,T=a.h-v,F=a.c-E,O=a.l-k;return isNaN(F)&&(F=0,E=isNaN(E)?a.c:E),isNaN(T)?(T=0,v=isNaN(v)?a.h:v):T>180?T-=360:T<-180&&(T+=360),function(H){return nt(v+T*H,E+F*H,k+O*H)+""}},V.interpolateHsl=function Uc(e,a){e=V.hsl(e),a=V.hsl(a);var v=e.h,E=e.s,k=e.l,T=a.h-v,F=a.s-E,O=a.l-k;return isNaN(F)&&(F=0,E=isNaN(E)?a.s:E),isNaN(T)?(T=0,v=isNaN(v)?a.h:v):T>180?T-=360:T<-180&&(T+=360),function(H){return Yn(v+T*H,E+F*H,k+O*H)+""}},V.interpolateLab=function Fc(e,a){e=V.lab(e),a=V.lab(a);var v=e.l,E=e.a,k=e.b,T=a.l-v,F=a.a-E,O=a.b-k;return function(H){return oi(v+T*H,E+F*H,k+O*H)+""}},V.interpolateRound=va,V.transform=function(e){var a=_.createElementNS(V.ns.prefix.svg,"g");return(V.transform=function(v){if(null!=v){a.setAttribute("transform",v);var E=a.transform.baseVal.consolidate()}return new ya(E?E.matrix:Wc)})(e)},ya.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var Wc={a:1,b:0,c:0,d:1,e:0,f:0};function qo(e){return e.length?e.pop()+",":""}function wa(e,a){var v=[],E=[];return e=V.transform(e),a=V.transform(a),function qc(e,a,v,E){if(e[0]!==a[0]||e[1]!==a[1]){var k=v.push("translate(",null,",",null,")");E.push({i:k-4,x:_o(e[0],a[0])},{i:k-2,x:_o(e[1],a[1])})}else(a[0]||a[1])&&v.push("translate("+a+")")}(e.translate,a.translate,v,E),function Kc(e,a,v,E){e!==a?(e-a>180?a+=360:a-e>180&&(e+=360),E.push({i:v.push(qo(v)+"rotate(",null,")")-2,x:_o(e,a)})):a&&v.push(qo(v)+"rotate("+a+")")}(e.rotate,a.rotate,v,E),function Vc(e,a,v,E){e!==a?E.push({i:v.push(qo(v)+"skewX(",null,")")-2,x:_o(e,a)}):a&&v.push(qo(v)+"skewX("+a+")")}(e.skew,a.skew,v,E),function Gc(e,a,v,E){if(e[0]!==a[0]||e[1]!==a[1]){var k=v.push(qo(v)+"scale(",null,",",null,")");E.push({i:k-4,x:_o(e[0],a[0])},{i:k-2,x:_o(e[1],a[1])})}else(1!==a[0]||1!==a[1])&&v.push(qo(v)+"scale("+a+")")}(e.scale,a.scale,v,E),e=a=null,function(k){for(var O,T=-1,F=E.length;++T0?T=He:(v.c=null,v.t=NaN,v=null,a.end({type:"end",alpha:T=0})):He>0&&(a.start({type:"start",alpha:T=He}),v=P(e.tick)),e):T},e.start=function(){var He,$t,sn,Ct=Me.length,vt=$e.length,bt=E[0],gt=E[1];for(He=0;He=0;)v.push(k[E])}function fo(e,a){for(var v=[e],E=[];null!=(e=v.pop());)if(E.push(e),(F=e.children)&&(T=F.length))for(var T,F,k=-1;++k=0;)T.push(ne=$[H]),ne.parent=O,ne.depth=O.depth+1;v&&(O.value=0),O.children=$}else v&&(O.value=+v.call(E,O,O.depth)||0),delete O.children;return fo(k,function(fe){var _e,Me;e&&(_e=fe.children)&&_e.sort(e),v&&(Me=fe.parent)&&(Me.value+=fe.value)}),F}return E.sort=function(k){return arguments.length?(e=k,E):e},E.children=function(k){return arguments.length?(a=k,E):a},E.value=function(k){return arguments.length?(v=k,E):v},E.revalue=function(k){return v&&(is(k,function(T){T.children&&(T.value=0)}),fo(k,function(T){var F;T.children||(T.value=+v.call(E,T,T.depth)||0),(F=T.parent)&&(F.value+=T.value)})),k},E},V.layout.partition=function(){var e=V.layout.hierarchy(),a=[1,1];function v(T,F,O,H){var $=T.children;if(T.x=F,T.y=T.depth*H,T.dx=O,T.dy=H,$&&(fe=$.length)){var fe,_e,Me,ne=-1;for(O=T.value?O/T.value:0;++nek&&(k=O),E.push(O)}for(F=0;FE&&(v=a,E=k);return v}function gh(e){return e.reduce(mh,0)}function mh(e,a){return e+a[1]}function vh(e,a){return Sa(e,Math.ceil(Math.log(a.length)/Math.LN2+1))}function Sa(e,a){for(var v=-1,E=+e[0],k=(e[1]-E)/a,T=[];++v<=a;)T[v]=k*v+E;return T}function yh(e){return[V.min(e),V.max(e)]}function _h(e,a){return e.value-a.value}function Ds(e,a){var v=e._pack_next;e._pack_next=a,a._pack_prev=e,a._pack_next=v,v._pack_prev=a}function Aa(e,a){e._pack_next=a,a._pack_prev=e}function Ca(e,a){var v=a.x-e.x,E=a.y-e.y,k=e.r+a.r;return.999*k*k>v*v+E*E}function Ta(e){if((a=e.children)&&(_e=a.length)){var a,F,O,H,$,ne,fe,_e,v=1/0,E=-1/0,k=1/0,T=-1/0;if(a.forEach(bh),(F=a[0]).x=-F.r,F.y=0,Me(F),_e>1&&((O=a[1]).x=O.r,O.y=0,Me(O),_e>2))for(Ra(F,O,H=a[2]),Me(H),Ds(F,H),F._pack_prev=H,Ds(H,O),O=F._pack_next,$=3;$<_e;$++){Ra(F,O,H=a[$]);var $e=0,xe=1,Ie=1;for(ne=O._pack_next;ne!==O;ne=ne._pack_next,xe++)if(Ca(ne,H)){$e=1;break}if(1==$e)for(fe=F._pack_prev;fe!==ne._pack_prev&&!Ca(fe,H);fe=fe._pack_prev,Ie++);$e?(xe0)for(_e=-1;++_e=$[0]&&Ie<=$[1]&&((fe=O[V.bisect(ne,Ie,1,$e)-1]).y+=xe,fe.push(T[_e]));return O}return k.value=function(T){return arguments.length?(a=T,k):a},k.range=function(T){return arguments.length?(v=_r(T),k):v},k.bins=function(T){return arguments.length?(E="number"==typeof T?function(F){return Sa(F,T)}:_r(T),k):E},k.frequency=function(T){return arguments.length?(e=!!T,k):e},k},V.layout.pack=function(){var E,e=V.layout.hierarchy().sort(_h),a=0,v=[1,1];function k(T,F){var O=e.call(this,T,F),H=O[0],$=v[0],ne=v[1],fe=null==E?Math.sqrt:"function"==typeof E?E:function(){return E};if(H.x=H.y=0,fo(H,function(Me){Me.r=+fe(Me.value)}),fo(H,Ta),a){var _e=a*(E?1:Math.max(2*H.r/$,2*H.r/ne))/2;fo(H,function(Me){Me.r+=_e}),fo(H,Ta),fo(H,function(Me){Me.r-=_e})}return Ia(H,$/2,ne/2,E?1:1/Math.max(2*H.r/$,2*H.r/ne)),O}return k.size=function(T){return arguments.length?(v=T,k):v},k.radius=function(T){return arguments.length?(E=null==T||"function"==typeof T?T:+T,k):E},k.padding=function(T){return arguments.length?(a=+T,k):a},rs(k,e)},V.layout.tree=function(){var e=V.layout.hierarchy().sort(null).value(null),a=Ma,v=[1,1],E=null;function k(ne,fe){var _e=e.call(this,ne,fe),Me=_e[0],$e=function T(ne){for(var Me,fe={A:null,children:[ne]},_e=[fe];null!=(Me=_e.pop());)for(var xe,$e=Me.children,Ie=0,Be=$e.length;IeIe.x&&(Ie=Ct),Ct.depth>Be.depth&&(Be=Ct)});var Ge=a(xe,Ie)/2-xe.x,Ne=v[0]/(Ie.x+a(Ie,xe)/2+Ge),He=v[1]/(Be.depth||1);is(Me,function(Ct){Ct.x=(Ct.x+Ge)*Ne,Ct.y=Ct.depth*He})}return _e}function F(ne){var fe=ne.children,_e=ne.parent.children,Me=ne.i?_e[ne.i-1]:null;if(fe.length){!function Eh(e){for(var T,a=0,v=0,E=e.children,k=E.length;--k>=0;)(T=E[k]).z+=a,T.m+=a,a+=T.s+(v+=T.c)}(ne);var $e=(fe[0].z+fe[fe.length-1].z)/2;Me?(ne.z=Me.z+a(ne._,Me._),ne.m=ne.z-$e):ne.z=$e}else Me&&(ne.z=Me.z+a(ne._,Me._));ne.parent.A=function H(ne,fe,_e){if(fe){for(var Ct,Me=ne,$e=ne,xe=fe,Ie=Me.parent.children[0],Be=Me.m,Ge=$e.m,Ne=xe.m,He=Ie.m;xe=js(xe),Me=zs(Me),xe&&Me;)Ie=zs(Ie),($e=js($e)).a=ne,(Ct=xe.z+Ne-Me.z-Be+a(xe._,Me._))>0&&(xh(kh(xe,ne,_e),ne,Ct),Be+=Ct,Ge+=Ct),Ne+=xe.m,Be+=Me.m,He+=Ie.m,Ge+=$e.m;xe&&!js($e)&&($e.t=xe,$e.m+=Ne-Ge),Me&&!zs(Ie)&&(Ie.t=Me,Ie.m+=Be-He,_e=ne)}return _e}(ne,Me,ne.parent.A||_e[0])}function O(ne){ne._.x=ne.z+ne.parent.m,ne.m+=ne.parent.m}function $(ne){ne.x*=v[0],ne.y=ne.depth*v[1]}return k.separation=function(ne){return arguments.length?(a=ne,k):a},k.size=function(ne){return arguments.length?(E=null==(v=ne)?$:null,k):E?null:v},k.nodeSize=function(ne){return arguments.length?(E=null==(v=ne)?null:$,k):E?v:null},rs(k,e)},V.layout.cluster=function(){var e=V.layout.hierarchy().sort(null).value(null),a=Ma,v=[1,1],E=!1;function k(T,F){var $,O=e.call(this,T,F),H=O[0],ne=0;fo(H,function(xe){var Ie=xe.children;Ie&&Ie.length?(xe.x=function Ah(e){return e.reduce(function(a,v){return a+v.x},0)/e.length}(Ie),xe.y=function Sh(e){return 1+V.max(e,function(a){return a.y})}(Ie)):(xe.x=$?ne+=a(xe,$):0,xe.y=0,$=xe)});var fe=La(H),_e=Ba(H),Me=fe.x-a(fe,_e)/2,$e=_e.x+a(_e,fe)/2;return fo(H,E?function(xe){xe.x=(xe.x-H.x)*v[0],xe.y=(H.y-xe.y)*v[1]}:function(xe){xe.x=(xe.x-Me)/($e-Me)*v[0],xe.y=(1-(H.y?xe.y/H.y:1))*v[1]}),O}return k.separation=function(T){return arguments.length?(a=T,k):a},k.size=function(T){return arguments.length?(E=null==(v=T),k):E?null:v},k.nodeSize=function(T){return arguments.length?(E=null!=(v=T),k):E?v:null},rs(k,e)},V.layout.treemap=function(){var F,e=V.layout.hierarchy(),a=Math.round,v=[1,1],E=null,k=Us,T=!1,O="squarify",H=.5*(1+Math.sqrt(5));function $(xe,Ie){for(var Ne,He,Be=-1,Ge=xe.length;++Be0;)Ge.push(He=Ne[gt-1]),Ge.area+=He.area,"squarify"!==O||(vt=_e(Ge,bt))<=Ct?(Ne.pop(),Ct=vt):(Ge.area-=Ge.pop().area,Me(Ge,bt,Be,!1),bt=Math.min(Be.dx,Be.dy),Ge.length=Ge.area=0,Ct=1/0);Ge.length&&(Me(Ge,bt,Be,!0),Ge.length=Ge.area=0),Ie.forEach(ne)}}function fe(xe){var Ie=xe.children;if(Ie&&Ie.length){var Ne,Be=k(xe),Ge=Ie.slice(),He=[];for($(Ge,Be.dx*Be.dy/xe.value),He.area=0;Ne=Ge.pop();)He.push(Ne),He.area+=Ne.area,null!=Ne.z&&(Me(He,Ne.z?Be.dx:Be.dy,Be,!Ge.length),He.length=He.area=0);Ie.forEach(fe)}}function _e(xe,Ie){for(var Ge,Be=xe.area,Ne=0,He=1/0,Ct=-1,vt=xe.length;++CtNe&&(Ne=Ge));return Ie*=Ie,(Be*=Be)?Math.max(Ie*Ne*H/Be,Be/(Ie*He*H)):1/0}function Me(xe,Ie,Be,Ge){var gt,Ne=-1,He=xe.length,Ct=Be.x,vt=Be.y,bt=Ie?a(xe.area/Ie):0;if(Ie==Be.dx){for((Ge||bt>Be.dy)&&(bt=Be.dy);++NeBe.dx)&&(bt=Be.dx);++Ne1);return e+a*E*Math.sqrt(-2*Math.log(T)/T)}},logNormal:function(){var e=V.random.normal.apply(V,arguments);return function(){return Math.exp(e())}},bates:function(e){var a=V.random.irwinHall(e);return function(){return a()/e}},irwinHall:function(e){return function(){for(var a=0,v=0;v2?Ih:Ch,$=E?$c:Yc;return k=H(e,a,$,v),T=H(a,e,$,Lo),O}function O(H){return k(H)}return O.invert=function(H){return T(H)},O.domain=function(H){return arguments.length?(e=H.map(Number),F()):e},O.range=function(H){return arguments.length?(a=H,F()):a},O.rangeRound=function(H){return O.range(H).interpolate(va)},O.clamp=function(H){return arguments.length?(E=H,F()):E},O.interpolate=function(H){return arguments.length?(v=H,F()):v},O.ticks=function(H){return Hs(e,H)},O.tickFormat=function(H,$){return Ws(e,H,$)},O.nice=function(H){return Da(e,H),F()},O.copy=function(){return Oa(e,a,v,E)},F()}function Fs(e,a){return V.rebind(e,a,"range","rangeRound","interpolate","clamp")}function Da(e,a){return gs(e,Na(Vo(e,a)[2])),gs(e,Na(Vo(e,a)[2])),e}function Vo(e,a){null==a&&(a=10);var v=Ko(e),E=v[1]-v[0],k=Math.pow(10,Math.floor(Math.log(E/a)/Math.LN10)),T=a/E*k;return T<=.15?k*=10:T<=.35?k*=5:T<=.75&&(k*=2),v[0]=Math.ceil(v[0]/k)*k,v[1]=Math.floor(v[1]/k)*k+.5*k,v[2]=k,v}function Hs(e,a){return V.range.apply(V,Vo(e,a))}function Ws(e,a,v){var E=Vo(e,a);if(v){var k=qe.exec(v);if(k.shift(),"s"===k[8]){var T=V.formatPrefix(Math.max(c(E[0]),c(E[1])));return k[7]||(k[7]="."+ms(T.scale(E[2]))),k[8]="f",v=V.format(k.join("")),function(F){return v(T.scale(F))+T.symbol}}k[7]||(k[7]="."+function Mh(e,a){var v=ms(a[2]);return e in Rh?Math.abs(v-ms(Math.max(c(a[0]),c(a[1]))))+ +("e"!==e):v-2*("%"===e)}(k[8],E)),v=k.join("")}else v=",."+ms(E[2])+"f";return V.format(v)}V.scale.linear=function(){return Oa([0,1],[0,1],Lo,!1)};var Rh={s:1,g:1,p:1,r:1,e:1};function ms(e){return-Math.floor(Math.log(e)/Math.LN10+.01)}function za(e,a,v,E){function k(O){return(v?Math.log(O<0?0:O):-Math.log(O>0?0:-O))/Math.log(a)}function T(O){return v?Math.pow(a,O):-Math.pow(a,-O)}function F(O){return e(k(O))}return F.invert=function(O){return T(e.invert(O))},F.domain=function(O){return arguments.length?(v=O[0]>=0,e.domain((E=O.map(Number)).map(k)),F):E},F.base=function(O){return arguments.length?(a=+O,e.domain(E.map(k)),F):a},F.nice=function(){var O=gs(E.map(k),v?Math:Lh);return e.domain(O),E=O.map(T),F},F.ticks=function(){var O=Ko(E),H=[],$=O[0],ne=O[1],fe=Math.floor(k($)),_e=Math.ceil(k(ne)),Me=a%1?2:a;if(isFinite(_e-fe)){if(v){for(;fe<_e;fe++)for(var $e=1;$e0;$e--)H.push(T(fe)*$e);for(fe=0;H[fe]<$;fe++);for(_e=H.length;H[_e-1]>ne;_e--);H=H.slice(fe,_e)}return H},F.tickFormat=function(O,H){if(!arguments.length)return ja;arguments.length<2?H=ja:"function"!=typeof H&&(H=V.format(H));var $=Math.max(1,a*O/F.ticks().length);return function(ne){var fe=ne/T(Math.round(k(ne)));return fe*a0?v[T-1]:e[0],T_e?0:1;if(ne<$&&(xe=ne,ne=$,$=xe),Me>=je)return H(ne,$e)+($?H($,1-$e):"")+"Z";var xe,Ie,Be,Ge,Ct,vt,bt,gt,$t,sn,In,xn,Ne=0,He=0,Tn=[];if((Ge=(+F.apply(this,arguments)||0)/2)&&(Be=E===ys?Math.sqrt($*$+ne*ne):+E.apply(this,arguments),$e||(He*=-1),ne&&(He=nn(Be/ne*Math.sin(Ge))),$&&(Ne=nn(Be/$*Math.sin(Ge)))),ne){Ct=ne*Math.cos(fe+He),vt=ne*Math.sin(fe+He),bt=ne*Math.cos(_e-He),gt=ne*Math.sin(_e-He);var Lt=Math.abs(_e-fe-2*He)<=ge?0:1;if(He&&_s(Ct,vt,bt,gt)===$e^Lt){var en=(fe+_e)/2;Ct=ne*Math.cos(en),vt=ne*Math.sin(en),bt=gt=null}}else Ct=vt=0;if($){$t=$*Math.cos(_e-Ne),sn=$*Math.sin(_e-Ne),In=$*Math.cos(fe+Ne),xn=$*Math.sin(fe+Ne);var gn=Math.abs(fe-_e+2*Ne)<=ge?0:1;if(Ne&&_s($t,sn,In,xn)===1-$e^gn){var Ot=(fe+_e)/2;$t=$*Math.cos(Ot),sn=$*Math.sin(Ot),In=xn=null}}else $t=sn=0;if(Me>Mt&&(xe=Math.min(Math.abs(ne-$)/2,+v.apply(this,arguments)))>.001){Ie=$0?0:1}function bs(e,a,v,E,k){var T=e[0]-a[0],F=e[1]-a[1],O=(k?E:-E)/Math.sqrt(T*T+F*F),H=O*F,$=-O*T,ne=e[0]+H,fe=e[1]+$,_e=a[0]+H,Me=a[1]+$,$e=(ne+_e)/2,xe=(fe+Me)/2,Ie=_e-ne,Be=Me-fe,Ge=Ie*Ie+Be*Be,Ne=v-E,He=ne*Me-_e*fe,Ct=(Be<0?-1:1)*Math.sqrt(Math.max(0,Ne*Ne*Ge-He*He)),vt=(He*Be-Ie*Ct)/Ge,bt=(-He*Ie-Be*Ct)/Ge,gt=(He*Be+Ie*Ct)/Ge,$t=(-He*Ie+Be*Ct)/Ge,sn=vt-$e,In=bt-xe,xn=gt-$e,Tn=$t-xe;return sn*sn+In*In>xn*xn+Tn*Tn&&(vt=gt,bt=$t),[[vt-H,bt-$],[vt*v/Ne,bt*v/Ne]]}function Ya(e){var a=wo,v=xo,E=Dn,k=oo,T=k.key,F=.7;function O(H){var Me,$=[],ne=[],fe=-1,_e=H.length,$e=_r(a),xe=_r(v);function Ie(){$.push("M",k(e(ne),F))}for(;++fe<_e;)E.call(this,Me=H[fe],fe)?ne.push([+$e.call(this,Me,fe),+xe.call(this,Me,fe)]):ne.length&&(Ie(),ne=[]);return ne.length&&Ie(),$.length?$.join(""):null}return O.x=function(H){return arguments.length?(a=H,O):a},O.y=function(H){return arguments.length?(v=H,O):v},O.defined=function(H){return arguments.length?(E=H,O):E},O.interpolate=function(H){return arguments.length?(T="function"==typeof H?k=H:(k=qs.get(H)||oo).key,O):T},O.tension=function(H){return arguments.length?(F=H,O):F},O}V.svg.line=function(){return Ya(R)};var qs=V.map({linear:oo,"linear-closed":$a,step:function Fh(e){for(var a=0,v=e.length,E=e[0],k=[E[0],",",E[1]];++a1&&k.push("H",E[0]),k.join("")},"step-before":Ks,"step-after":Vs,basis:Xa,"basis-open":function Kh(e){if(e.length<4)return oo(e);for(var k,a=[],v=-1,E=e.length,T=[0],F=[0];++v<3;)T.push((k=e[v])[0]),F.push(k[1]);for(a.push(Zi(Eo,T)+","+Zi(Eo,F)),--v;++v9&&(T=3*v/Math.sqrt(T),F[O]=T*E,F[O+1]=T*k);for(O=-1;++O<=H;)T=(e[Math.min(H,O+1)][0]-e[Math.max(0,O-1)][0])/(6*(1+F[O]*F[O])),a.push([T||0,F[O]*T||0]);return a}(e))}});function oo(e){return e.length>1?e.join("L"):e+"Z"}function $a(e){return e.join("L")+"Z"}function Ks(e){for(var a=0,v=e.length,E=e[0],k=[E[0],",",E[1]];++a1){T=e[H],H++,E+="C"+(k[0]+F[0])+","+(k[1]+F[1])+","+(T[0]-(O=a[1])[0])+","+(T[1]-O[1])+","+T[0]+","+T[1];for(var $=2;$ge)+",1 "+fe}function $(ne,fe,_e,Me){return"Q 0,0 "+Me}return T.radius=function(ne){return arguments.length?(v=_r(ne),T):v},T.source=function(ne){return arguments.length?(e=_r(ne),T):e},T.target=function(ne){return arguments.length?(a=_r(ne),T):a},T.startAngle=function(ne){return arguments.length?(E=_r(ne),T):E},T.endAngle=function(ne){return arguments.length?(k=_r(ne),T):k},T},V.svg.diagonal=function(){var e=Ai,a=$r,v=tc;function E(k,T){var F=e.call(this,k,T),O=a.call(this,k,T),H=(F.y+O.y)/2,$=[F,{x:F.x,y:H},{x:O.x,y:H},O];return"M"+($=$.map(v))[0]+"C"+$[1]+" "+$[2]+" "+$[3]}return E.source=function(k){return arguments.length?(e=_r(k),E):e},E.target=function(k){return arguments.length?(a=_r(k),E):a},E.projection=function(k){return arguments.length?(v=k,E):v},E},V.svg.diagonal.radial=function(){var e=V.svg.diagonal(),a=tc,v=e.projection;return e.projection=function(E){return arguments.length?v(function Jh(e){return function(){var a=e.apply(this,arguments),v=a[0],E=a[1]-Ze;return[v*Math.cos(E),v*Math.sin(E)]}}(a=E)):a},e},V.svg.symbol=function(){var e=eu,a=Qh;function v(E,k){return(rc.get(e.call(this,E,k))||nc)(a.call(this,E,k))}return v.type=function(E){return arguments.length?(e=_r(E),v):e},v.size=function(E){return arguments.length?(a=_r(E),v):a},v};var rc=V.map({circle:nc,cross:function(e){var a=Math.sqrt(e/5)/2;return"M"+-3*a+","+-a+"H"+-a+"V"+-3*a+"H"+a+"V"+-a+"H"+3*a+"V"+a+"H"+a+"V"+3*a+"H"+-a+"V"+a+"H"+-3*a+"Z"},diamond:function(e){var a=Math.sqrt(e/(2*ic)),v=a*ic;return"M0,"+-a+"L"+v+",0 0,"+a+" "+-v+",0Z"},square:function(e){var a=Math.sqrt(e)/2;return"M"+-a+","+-a+"L"+a+","+-a+" "+a+","+a+" "+-a+","+a+"Z"},"triangle-down":function(e){var a=Math.sqrt(e/xs),v=a*xs/2;return"M0,"+v+"L"+a+","+-v+" "+-a+","+-v+"Z"},"triangle-up":function(e){var a=Math.sqrt(e/xs),v=a*xs/2;return"M0,"+-v+"L"+a+","+v+" "+-a+","+v+"Z"}});V.svg.symbolTypes=rc.keys();var xs=Math.sqrt(3),ic=Math.tan(30*Xe);re.transition=function(e){for(var k,T,a=Bo||++sc,v=Zs(e),E=[],F=ks||{time:Date.now(),ease:Mc,delay:0,duration:250},O=-1,H=this.length;++O0;)fe[--Ge].call(e,Be);if(Ie>=1)return F.event&&F.event.end.call(e,e.__data__,a),--T.count?delete T[E]:delete e[v],1}F||(H=P(function _e(xe){var Ie=F.delay;if(H.t=Ie+O,Ie<=xe)return Me(xe-Ie);H.c=Me},0,O=k.time),F=T[E]={tween:new t,time:O,timer:H,delay:k.delay,duration:k.duration,ease:k.ease,index:a},k=null,++T.count)}ii.call=re.call,ii.empty=re.empty,ii.node=re.node,ii.size=re.size,V.transition=function(e,a){return e&&e.transition?Bo?e.transition(a):e:V.selection().transition(e)},V.transition.prototype=ii,ii.select=function(e){var k,T,F,a=this.id,v=this.namespace,E=[];e=Ue(e);for(var O=-1,H=this.length;++Orect,.s>rect").attr("width",E[1]-E[0])}function Me(xe){xe.select(".extent").attr("y",k[0]),xe.selectAll(".extent,.e>rect,.w>rect").attr("height",k[1]-k[0])}function $e(){var gt,sn,xe=this,Ie=V.select(V.event.target),Be=e.of(xe,arguments),Ge=V.select(xe),Ne=Ie.datum(),He=!/^(n|s)$/.test(Ne)&&a,Ct=!/^(e|w)$/.test(Ne)&&v,vt=Ie.classed("extent"),bt=Xn(xe),$t=V.mouse(xe),In=V.select(G(xe)).on("keydown.brush",function Lt(){32==V.event.keyCode&&(vt||(gt=null,$t[0]-=E[1],$t[1]-=k[1],vt=2),A())}).on("keyup.brush",function en(){32==V.event.keyCode&&2==vt&&($t[0]+=E[1],$t[1]+=k[1],vt=0,A())});if(V.event.changedTouches?In.on("touchmove.brush",gn).on("touchend.brush",fn):In.on("mousemove.brush",gn).on("mouseup.brush",fn),Ge.interrupt().selectAll("*").interrupt(),vt)$t[0]=E[0]-$t[0],$t[1]=k[0]-$t[1];else if(Ne){var xn=+/w$/.test(Ne),Tn=+/^n/.test(Ne);sn=[E[1-xn]-$t[0],k[1-Tn]-$t[1]],$t[0]=E[xn],$t[1]=k[Tn]}else V.event.altKey&&(gt=$t.slice());function gn(){var Un=V.mouse(xe),Qn=!1;sn&&(Un[0]+=sn[0],Un[1]+=sn[1]),vt||(V.event.altKey?(gt||(gt=[(E[0]+E[1])/2,(k[0]+k[1])/2]),$t[0]=E[+(Un[0]1?{floor:function(fe){for(;ne(fe=T.floor(fe));)fe=Po(fe-1);return fe},ceil:function(fe){for(;ne(fe=T.ceil(fe));)fe=Po(+fe+1);return fe}}:T))},E.ticks=function(T,F){var O=Ko(E.domain()),H=null==T?k(O,10):"number"==typeof T?k(O,T):!T.range&&[{range:T},F];return H&&(T=H[0],F=H[1]),T.range(O[0],Po(+O[1]+1),F<1?1:F)},E.tickFormat=function(){return v},E.copy=function(){return ta(e.copy(),a,v)},Fs(E,e)}function Po(e){return new Date(e)}Qs.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?ea:hc,ea.parse=function(e){var a=new Date(e);return isNaN(a)?null:a},ea.toString=hc.toString,ot.second=Tt(function(e){return new lt(1e3*Math.floor(e/1e3))},function(e,a){e.setTime(e.getTime()+1e3*Math.floor(a))},function(e){return e.getSeconds()}),ot.seconds=ot.second.range,ot.seconds.utc=ot.second.utc.range,ot.minute=Tt(function(e){return new lt(6e4*Math.floor(e/6e4))},function(e,a){e.setTime(e.getTime()+6e4*Math.floor(a))},function(e){return e.getMinutes()}),ot.minutes=ot.minute.range,ot.minutes.utc=ot.minute.utc.range,ot.hour=Tt(function(e){var a=e.getTimezoneOffset()/60;return new lt(36e5*(Math.floor(e/36e5-a)+a))},function(e,a){e.setTime(e.getTime()+36e5*Math.floor(a))},function(e){return e.getHours()}),ot.hours=ot.hour.range,ot.hours.utc=ot.hour.utc.range,ot.month=Tt(function(e){return(e=ot.day(e)).setDate(1),e},function(e,a){e.setMonth(e.getMonth()+a)},function(e){return e.getMonth()}),ot.months=ot.month.range,ot.months.utc=ot.month.utc.range;var As=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],na=[[ot.second,1],[ot.second,5],[ot.second,15],[ot.second,30],[ot.minute,1],[ot.minute,5],[ot.minute,15],[ot.minute,30],[ot.hour,1],[ot.hour,3],[ot.hour,6],[ot.hour,12],[ot.day,1],[ot.day,2],[ot.week,1],[ot.month,1],[ot.month,3],[ot.year,1]],su=Qs.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%a %d",function(e){return e.getDay()&&1!=e.getDate()}],["%b %d",function(e){return 1!=e.getDate()}],["%B",function(e){return e.getMonth()}],["%Y",Dn]]),au={range:function(e,a,v){return V.range(Math.ceil(e/v)*v,+a,v).map(Po)},floor:R,ceil:R};na.year=ot.year,ot.scale=function(){return ta(V.scale.linear(),na,su)};var uc=na.map(function(e){return[e[0].utc,e[1]]}),cu=cc.multi([[".%L",function(e){return e.getUTCMilliseconds()}],[":%S",function(e){return e.getUTCSeconds()}],["%I:%M",function(e){return e.getUTCMinutes()}],["%I %p",function(e){return e.getUTCHours()}],["%a %d",function(e){return e.getUTCDay()&&1!=e.getUTCDate()}],["%b %d",function(e){return 1!=e.getUTCDate()}],["%B",function(e){return e.getUTCMonth()}],["%Y",Dn]]);function hu(e){return JSON.parse(e.responseText)}function uu(e){var a=_.createRange();return a.selectNode(_.body),a.createContextualFragment(e.responseText)}uc.year=ot.year.utc,ot.scale.utc=function(){return ta(V.scale.linear(),uc,cu)},V.text=Wi(function(e){return e.responseText}),V.json=function(e,a){return qi(e,"application/json",hu,a)},V.html=function(e,a){return qi(e,"text/html",uu,a)},V.xml=Wi(function(e){return e.responseXML}),"object"==typeof wt&&wt.exports?wt.exports=V:this.d3=V}()},{}],2:[function(At,wt,kt){(function(V){kt.log=function _(...Y){return"object"==typeof console&&console.log&&console.log(...Y)},kt.formatArgs=function Le(Y){if(Y[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+Y[0]+(this.useColors?"%c ":" ")+"+"+wt.exports.humanize(this.diff),!this.useColors)return;const ae="color: "+this.color;Y.splice(1,0,ae,"color: inherit");let m=0,B=0;Y[0].replace(/%[a-zA-Z%]/g,i=>{"%%"!==i&&(m++,"%c"===i&&(B=m))}),Y.splice(B,0,ae)},kt.save=function oe(Y){try{Y?kt.storage.setItem("debug",Y):kt.storage.removeItem("debug")}catch{}},kt.load=function G(){let Y;try{Y=kt.storage.getItem("debug")}catch{}return!Y&&typeof V<"u"&&"env"in V&&(Y=V.env.DEBUG),Y},kt.useColors=function De(){return!(!(typeof window<"u"&&window.process)||"renderer"!==window.process.type&&!window.process.__nwjs)||!(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},kt.storage=function ue(){try{return localStorage}catch{}}(),kt.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],wt.exports=At("./common")(kt);const{formatters:ve}=wt.exports;ve.j=function(Y){try{return JSON.stringify(Y)}catch(ae){return"[UnexpectedJSONParseError]: "+ae.message}}}).call(this,At("_process"))},{"./common":3,_process:7}],3:[function(At,wt,kt){wt.exports=function V(De){function Le(B){let i=0;for(let g=0;g{if("%%"===t)return t;u++;const r=_.formatters[o];return"function"==typeof r&&(t=r.call(x,f[u]),f.splice(u,1),u--),t}),_.formatArgs.call(x,f),(x.log||_.log).apply(x,f)}return g.namespace=B,g.enabled=_.enabled(B),g.useColors=_.useColors(),g.color=Le(B),g.destroy=oe,g.extend=G,"function"==typeof _.init&&_.init(g),_.instances.push(g),g}function oe(){const B=_.instances.indexOf(this);return-1!==B&&(_.instances.splice(B,1),!0)}function G(B,i){const g=_(this.namespace+(typeof i>"u"?":":i)+B);return g.log=this.log,g}function ae(B){return B.toString().substring(2,B.toString().length-2).replace(/\.\*\?$/,"*")}return _.debug=_,_.default=_,_.coerce=function m(B){return B instanceof Error?B.stack||B.message:B},_.disable=function ve(){const B=[..._.names.map(ae),..._.skips.map(ae).map(i=>"-"+i)].join(",");return _.enable(""),B},_.enable=function ue(B){let i;_.save(B),_.names=[],_.skips=[];const g=("string"==typeof B?B:"").split(/[\s,]+/),f=g.length;for(i=0;i{_[B]=De[B]}),_.instances=[],_.names=[],_.skips=[],_.formatters={},_.selectColor=Le,_.enable(_.load()),_}},{ms:6}],4:[function(At,wt,kt){var V=Object.create||function o(h){var l=function(){};return l.prototype=h,new l},De=Object.keys||function r(h){var l=[];for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&l.push(p);return p},Le=Function.prototype.bind||function d(h){var l=this;return function(){return l.apply(h,arguments)}};function _(){(!this._events||!Object.prototype.hasOwnProperty.call(this,"_events"))&&(this._events=V(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}wt.exports=_,_.EventEmitter=_,_.prototype._events=void 0,_.prototype._maxListeners=void 0;var G,oe=10;try{var ue={};Object.defineProperty&&Object.defineProperty(ue,"x",{value:0}),G=0===ue.x}catch{G=!1}function ve(h){return void 0===h._maxListeners?_.defaultMaxListeners:h._maxListeners}function g(h,l,p,w){var b,I,S;if("function"!=typeof p)throw new TypeError('"listener" argument must be a function');if((I=h._events)?(I.newListener&&(h.emit("newListener",l,p.listener?p.listener:p),I=h._events),S=I[l]):(I=h._events=V(null),h._eventsCount=0),S){if("function"==typeof S?S=I[l]=w?[p,S]:[S,p]:w?S.unshift(p):S.push(p),!S.warned&&(b=ve(h))&&b>0&&S.length>b){S.warned=!0;var R=new Error("Possible EventEmitter memory leak detected. "+S.length+' "'+String(l)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');R.name="MaxListenersExceededWarning",R.emitter=h,R.type=l,R.count=S.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",R.name,R.message)}}else S=I[l]=p,++h._eventsCount;return h}function f(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var h=new Array(arguments.length),l=0;l1&&(p=arguments[1]),p instanceof Error)throw p;var q=new Error('Unhandled "error" event. ('+p+")");throw q.context=p,q}if(!(w=R[l]))return!1;var Z="function"==typeof w;switch(b=arguments.length){case 1:!function Y(h,l,p){if(l)h.call(p);else for(var w=h.length,b=s(h,w),I=0;I=0;S--)if(w[S]===p||w[S].listener===p){R=w[S].listener,I=S;break}if(I<0)return this;0===I?w.shift():function u(h,l){for(var p=l,w=p+1,b=h.length;w=0;b--)this.removeListener(l,p[b]);return this},_.prototype.listeners=function(l){return n(this,l,!0)},_.prototype.rawListeners=function(l){return n(this,l,!1)},_.listenerCount=function(h,l){return"function"==typeof h.listenerCount?h.listenerCount(l):c.call(h,l)},_.prototype.listenerCount=c,_.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],5:[function(At,wt,kt){wt.exports="function"==typeof Object.create?function(De,Le){Le&&(De.super_=Le,De.prototype=Object.create(Le.prototype,{constructor:{value:De,enumerable:!1,writable:!0,configurable:!0}}))}:function(De,Le){if(Le){De.super_=Le;var _=function(){};_.prototype=Le.prototype,De.prototype=new _,De.prototype.constructor=De}}},{}],6:[function(At,wt,kt){var V=1e3,De=60*V,Le=60*De,_=24*Le;function ae(m,B,i,g){var f=B>=1.5*i;return Math.round(m/i)+" "+g+(f?"s":"")}wt.exports=function(m,B){B=B||{};var i=typeof m;if("string"===i&&m.length>0)return function ue(m){if(!((m=String(m)).length>100)){var B=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(m);if(B){var i=parseFloat(B[1]);switch((B[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*i;case"weeks":case"week":case"w":return 6048e5*i;case"days":case"day":case"d":return i*_;case"hours":case"hour":case"hrs":case"hr":case"h":return i*Le;case"minutes":case"minute":case"mins":case"min":case"m":return i*De;case"seconds":case"second":case"secs":case"sec":case"s":return i*V;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return i;default:return}}}}(m);if("number"===i&&isFinite(m))return B.long?function Y(m){var B=Math.abs(m);return B>=_?ae(m,B,_,"day"):B>=Le?ae(m,B,Le,"hour"):B>=De?ae(m,B,De,"minute"):B>=V?ae(m,B,V,"second"):m+" ms"}(m):function ve(m){var B=Math.abs(m);return B>=_?Math.round(m/_)+"d":B>=Le?Math.round(m/Le)+"h":B>=De?Math.round(m/De)+"m":B>=V?Math.round(m/V)+"s":m+"ms"}(m);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(m))}},{}],7:[function(At,wt,kt){var De,Le,V=wt.exports={};function _(){throw new Error("setTimeout has not been defined")}function oe(){throw new Error("clearTimeout has not been defined")}function G(x){if(De===setTimeout)return setTimeout(x,0);if((De===_||!De)&&setTimeout)return De=setTimeout,setTimeout(x,0);try{return De(x,0)}catch{try{return De.call(null,x,0)}catch{return De.call(this,x,0)}}}!function(){try{De="function"==typeof setTimeout?setTimeout:_}catch{De=_}try{Le="function"==typeof clearTimeout?clearTimeout:oe}catch{Le=oe}}();var ae,ve=[],Y=!1,m=-1;function B(){!Y||!ae||(Y=!1,ae.length?ve=ae.concat(ve):m=-1,ve.length&&i())}function i(){if(!Y){var x=G(B);Y=!0;for(var n=ve.length;n;){for(ae=ve,ve=[];++m1)for(var c=1;c=Le?Y():ue=setTimeout(Y,Le-m)),G};function Y(){ue=0,ve=+new Date,G=De.apply(_,oe),_=null,oe=null}}},{}],9:[function(At,wt,kt){wt.exports=ve;var V=At("d3"),De=At("debug")("p2p-graph"),Le=At("events"),_=At("inherits"),oe=At("throttleit"),G_links={width:.7,maxWidth:5,maxBytes:2097152},ue_links_color="#C8C8C8",ue_nodes_method=function(Y,ae){return V.hsl(Y.me?210:Y.seeder?120:55,.7,.725)},ue_nodes_hover="#A9A9A9",ue_nodes_dep="#252929";function ve(Y){var ae=this;if(!(ae instanceof ve))return new ve(Y);Le.call(ae),"string"==typeof Y&&(Y=document.querySelector(Y)),ae._root=Y,ae._model={nodes:[],links:[],focused:null},ae._model.links.forEach(function(m){var B=ae._model.nodes[m.source],i=ae._model.nodes[m.target];B.children=B.children||[],B.children.push(m.target),i.parents=i.parents||[],i.parents.push(m.source)}),ae._svg=V.select(ae._root).append("svg"),ae._resize(),ae._force=V.layout.force().size([ae._width,ae._height]).nodes(ae._model.nodes).links(ae._model.links).on("tick",function(){ae._link.attr("x1",function(m){return m.source.x}).attr("y1",function(m){return m.source.y}).attr("x2",function(m){return m.target.x}).attr("y2",function(m){return m.target.y}),ae._node.attr("cx",function(m){return m.x}).attr("cy",function(m){return m.y}),ae._node.attr("transform",function(m){return"translate("+m.x+","+m.y+")"})}),ae._node=ae._svg.selectAll(".node"),ae._link=ae._svg.selectAll(".link"),ae._update(),ae._resizeThrottled=oe(function(){ae._resize()},500),window.addEventListener("resize",ae._resizeThrottled)}_(ve,Le),ve.prototype.list=function(){return De("list"),this._model.nodes},ve.prototype.add=function(Y){if(De("add %s %o",Y.id,Y),this._getNode(Y.id))throw new Error("add: cannot add duplicate node");this._model.nodes.push(Y),this._update()},ve.prototype.remove=function(Y){var ae=this;De("remove %s",Y);var m=ae._getNodeIndex(Y);if(-1===m)throw new Error("remove: node does not exist");ae._model.focused&&ae._model.focused.id===Y&&(ae._model.focused=null,ae.emit("select",!1)),ae._model.nodes.splice(m,1),ae._update()},ve.prototype.connect=function(Y,ae){var m=this;De("connect %s %s",Y,ae);var B=m._getNode(Y);if(!B)throw new Error("connect: invalid source id");var i=m._getNode(ae);if(!i)throw new Error("connect: invalid target id");if(m.getLink(B.index,i.index))throw new Error("connect: cannot make duplicate connection");m._model.links.push({source:B.index,target:i.index}),m._update()},ve.prototype.disconnect=function(Y,ae){var m=this;De("disconnect %s %s",Y,ae);var B=m._getNode(Y);if(!B)throw new Error("disconnect: invalid source id");var i=m._getNode(ae);if(!i)throw new Error("disconnect: invalid target id");var g=m.getLinkIndex(B.index,i.index);if(-1===g)throw new Error("disconnect: connection does not exist");m._model.links.splice(g,1),m._update()},ve.prototype.hasPeer=function(){var Y=this,ae=Array.prototype.slice.call(arguments,0);return De("Checking for peers:",ae),ae.every(function(m){return Y._getNode(m)})},ve.prototype.hasLink=function(Y,ae){var m=this,B=m._getNode(Y);if(!B)throw new Error("hasLink: invalid source id");var i=m._getNode(ae);if(!i)throw new Error("hasLink: invalid target id");return!!m.getLink(B.index,i.index)},ve.prototype.areConnected=function(Y,ae){var m=this,B=m._getNode(Y);if(!B)throw new Error("areConnected: invalid source id");var i=m._getNode(ae);if(!i)throw new Error("areConnected: invalid target id");return m.getLink(B.index,i.index)||m.getLink(i.index,B.index)},ve.prototype.unchoke=function(Y,ae){De("unchoke %s %s",Y,ae)},ve.prototype.choke=function(Y,ae){De("choke %s %s",Y,ae)},ve.prototype.seed=function(Y,ae){var m=this;if(De(Y,"isSeeding:",ae),"boolean"!=typeof ae)throw new Error("seed: 2nd param must be a boolean");var B=m._getNodeIndex(Y);if(-1===B)throw new Error("seed: node does not exist");m._model.nodes[B].seeder=ae,m._update()},ve.prototype.rate=function(Y,ae,m){var B=this;if(De("rate update:",Y+"<->"+ae,"at",m),"number"!=typeof m||m<0)throw new Error("rate: 3th param must be a positive number");var i=B._getNode(Y);if(!i)throw new Error("rate: invalid source id");var g=B._getNode(ae);if(!g)throw new Error("rate: invalid target id");var f=B.getLinkIndex(i.index,g.index);if(-1===f)throw new Error("rate: connection does not exist");B._model.links[f].rate=function x(n){return Math.min(n,G_links.maxBytes)*G_links.maxWidth/G_links.maxBytes}(m),De("rate:",B._model.links[f].rate),B._update()},ve.prototype.getLink=function(Y,ae){for(var m=this,B=0,i=m._model.links.length;B=900?400:250,ae._svg.attr("width",ae._width).attr("height",ae._height),ae._force&&ae._force.size([ae._width,ae._height]).resume()},ve.prototype._getNodeIndex=function(Y){for(var m=0,B=this._model.nodes.length;m=this.length||this.viewed&&Re===this.index)return this;if(!this.isShown)return this.index=Re,this.show();this.viewing&&this.viewing.abort();var cn,Qt,je=this.element,Ze=this.options,Xe=this.title,st=this.canvas,tn=this.items[Re],Bt=tn.querySelector("img"),Ee=K(Bt,"originalUrl"),qt=Bt.getAttribute("alt"),nn=document.createElement("img");if(We(Ze.inheritedAttributes,function(Vt){var Nn=Bt.getAttribute(Vt);null!==Nn&&nn.setAttribute(Vt,Nn)}),nn.src=Ee,nn.alt=qt,Ue(Ze.view)&&pe(je,"view",Ze.view,{once:!0}),!1===Ye(je,"view",{originalImage:this.images[Re],index:Re,image:nn})||!this.isShown||this.hiding||this.played)return this;function _n(){var Vt=ge.imageData,Nn=Array.isArray(Ze.title)?Ze.title[1]:Ze.title;Xe.innerHTML=y(Nn=Ue(Nn)?Nn.call(ge,nn,Vt):"".concat(qt," (").concat(Vt.naturalWidth," \xd7 ").concat(Vt.naturalHeight,")"))?Nn.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">"):Nn}return(Ee=this.items[this.index])&&(Ft(Ee,oe),Ee.removeAttribute("aria-selected")),It(tn,oe),tn.setAttribute("aria-selected",!0),Ze.focus&&tn.focus(),this.image=nn,this.viewed=!1,this.index=Re,this.imageData={},It(nn,x),Ze.loading&&It(st,n),st.innerHTML="",st.appendChild(nn),this.renderList(),Xe.innerHTML="",pe(je,we,_n,{once:!0}),this.viewing={abort:function(){ie(je,we,_n),nn.complete?ge.imageRendering?ge.imageRendering.abort():ge.imageInitializing&&ge.imageInitializing.abort():(nn.src="",ie(nn,p,cn),ge.timeout&&clearTimeout(ge.timeout))}},nn.complete?this.load():(pe(nn,p,cn=function(){ie(nn,w,Qt),ge.load()},{once:!0}),pe(nn,w,Qt=function(){ie(nn,p,cn),ge.timeout&&(clearTimeout(ge.timeout),ge.timeout=!1),Ft(nn,x),Ze.loading&&Ft(ge.canvas,n)},{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){Ft(nn,x),ge.timeout=!1},1e3)),this},prev:function(){var ge=this.index-1;return ge<0&&(ge=0Math.abs(Bt)&&(this.pointers={},1
',mn=(Bt=mn.querySelector(".".concat(V,"-container"))).querySelector(".".concat(V,"-title")),qt=Bt.querySelector(".".concat(V,"-toolbar")),Mn=Bt.querySelector(".".concat(V,"-navbar")),nn=Bt.querySelector(".".concat(V,"-button")),_n=Bt.querySelector(".".concat(V,"-canvas")),this.parent=tn,this.viewer=Bt,this.title=mn,this.toolbar=qt,this.navbar=Mn,this.button=nn,this.canvas=_n,this.footer=Bt.querySelector(".".concat(V,"-footer")),this.tooltipBox=Bt.querySelector(".".concat(V,"-tooltip")),this.player=Bt.querySelector(".".concat(V,"-player")),this.list=Bt.querySelector(".".concat(V,"-list")),Bt.id="".concat(V).concat(this.id),mn.id="".concat(V,"Title").concat(this.id),It(mn,st.title?Jt(Array.isArray(st.title)?st.title[0]:st.title):m),It(Mn,st.navbar?Jt(st.navbar):m),Ke(nn,m,!st.button),st.keyboard&&nn.setAttribute("tabindex",0),st.backdrop&&(It(Bt,"".concat(V,"-backdrop")),st.inline||"static"===st.backdrop||se(_n,A,"hide")),y(st.className)&&st.className&&st.className.split(L).forEach(function(zn){It(Bt,zn)}),st.toolbar?(cn=document.createElement("ul"),Qt=re(st.toolbar),Ee=z.slice(0,3),Vt=z.slice(7,9),Nn=z.slice(9),Qt||It(qt,Jt(st.toolbar)),We(Qt?st.toolbar:z,function(zn,Hn){var Fn,Gn=Qt&&re(zn),Yn=(Hn=Qt?St(Hn):zn,Gn&&!U(zn.show)?zn.show:zn);!Yn||!st.zoomable&&-1!==Ee.indexOf(Hn)||!st.rotatable&&-1!==Vt.indexOf(Hn)||!st.scalable&&-1!==Nn.indexOf(Hn)||(Fn=Gn&&!U(zn.size)?zn.size:zn,Gn=Gn&&!U(zn.click)?zn.click:zn,zn=document.createElement("li"),st.keyboard&&zn.setAttribute("tabindex",0),zn.setAttribute("role","button"),It(zn,"".concat(V,"-").concat(Hn)),Ue(Gn)||se(zn,A,Hn),M(Yn)&&It(zn,Jt(Yn)),-1!==["small","large"].indexOf(Fn)?It(zn,"".concat(V,"-").concat(Fn)):"play"===Hn&&It(zn,"".concat(V,"-large")),Ue(Gn)&&pe(zn,o,Gn),cn.appendChild(zn))}),qt.appendChild(cn)):It(qt,m),st.rotatable||(It(mn=qt.querySelectorAll('li[class*="rotate"]'),x),We(mn,function(zn){qt.appendChild(zn)})),st.inline?(It(nn,Y),pt(Bt,{zIndex:st.zIndexInline}),"static"===window.getComputedStyle(tn).position&&pt(tn,{position:"relative"}),tn.insertBefore(Bt,Xe.nextSibling)):(It(nn,G),It(Bt,ve),It(Bt,ue),It(Bt,m),pt(Bt,{zIndex:st.zIndex}),(Mn=(Mn=y(Mn=st.container)?Xe.ownerDocument.querySelector(Mn):Mn)||this.body).appendChild(Bt)),st.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,Ue(st.ready)&&pe(Xe,Z,st.ready,{once:!0}),!1===Ye(Xe,Z)?this.ready=!1:this.ready&&st.inline&&this.view(this.index))}}])&&At(Re.prototype,je),Ze&&At(Re,Ze),Object.defineProperty(Re,"prototype",{writable:!1}),ge}(),Qe(Kn.prototype,hn,En,Xn,An,Pn),Kn}); \ No newline at end of file diff --git a/dist/main-site/browser/scripts.d530b24d62dab3a0.js b/dist/main-site/browser/scripts.d530b24d62dab3a0.js new file mode 100644 index 00000000..b15d05e8 --- /dev/null +++ b/dist/main-site/browser/scripts.d530b24d62dab3a0.js @@ -0,0 +1 @@ +(function(Gt){var je,Pe,H="hasOwnProperty",At=/[\.\/]/,kt=function(){},Q=function(te,pe){return te-pe},y={n:{}},he=function(te,pe){te=String(te);var f,ne=Pe,le=Array.prototype.slice.call(arguments,2),d=he.listeners(te),N=0,b=[],m={},_=[],n=je;je=te,Pe=0;for(var h=0,s=d.length;h',(Yt=nt.firstChild).style.behavior="url(#default#VML)",!Yt||"object"!=typeof Yt.adj)return H.type=N;nt=null}function Tn(P){if("function"==typeof P||Object(P)!==P)return P;var Z=new P.constructor;for(var ie in P)P[Pe](ie)&&(Z[ie]=Tn(P[ie]));return Z}H.svg=!(H.vml="VML"==H.type),H._Paper=te,H.fn=pe=te.prototype=H.prototype,H._id=0,H._oid=0,H.is=function(P,Z){return"finite"==(Z=n.call(Z))?!V[Pe](+P):"array"==Z?P instanceof Array:"null"==Z&&null===P||Z==typeof P&&null!==P||"object"==Z&&P===Object(P)||"array"==Z&&Array.isArray&&Array.isArray(P)||E.call(P).slice(8,-1).toLowerCase()==Z},H.angle=function(P,Z,ie,fe,ye,Me){if(null==ye){var Ce=P-ie,Ue=Z-fe;return Ce||Ue?(180+180*g.atan2(-Ue,-Ce)/t+360)%360:0}return H.angle(P,Z,ye,Me)-H.angle(ie,fe,ye,Me)},H.rad=function(P){return P%360*t/180},H.deg=function(P){return 180*P/t%360},H.snapTo=function(P,Z,ie){if(ie=H.is(ie,"finite")?ie:10,H.is(P,c)){for(var fe=P.length;fe--;)if(u(P[fe]-Z)<=ie)return P[fe]}else{var ye=Z%(P=+P);if(yeP-ie)return Z-ye+P}return Z},H.createUUID=(P=/[xy]/g,Z=function(P){var Z=16*g.random()|0;return("x"==P?Z:3&Z|8).toString(16)},function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(P,Z).toUpperCase()}),H.setWindow=function(P){gn("raphael.setWindow",H,y.win,P),y.win=P,y.doc=y.win.document,H._engine.initWin&&H._engine.initWin(y.win)};var O=function(P){if(H.vml){var ie,Z=/^\s+|\s+$/g;try{var fe=new ActiveXObject("htmlfile");fe.write(""),fe.close(),ie=fe.body}catch{ie=createPopup().document.body}var ye=ie.createTextRange();O=Jt(function(Ce){try{ie.style.color=f(Ce).replace(Z,N);var Ue=ye.queryCommandValue("ForeColor");return"#"+("000000"+(Ue=(255&Ue)<<16|65280&Ue|(16711680&Ue)>>>16).toString(16)).slice(-6)}catch{return"none"}})}else{var Me=y.doc.createElement("i");Me.title="Rapha\xebl Colour Picker",Me.style.display="none",y.doc.body.appendChild(Me),O=Jt(function(Ce){return Me.style.color=Ce,y.doc.defaultView.getComputedStyle(Me,N).getPropertyValue("color")})}return O(P)},W=function(){return"hsb("+[this.h,this.s,this.b]+")"},ee=function(){return"hsl("+[this.h,this.s,this.l]+")"},ve=function(){return this.hex},He=function(P,Z,ie){if(null==Z&&H.is(P,"object")&&"r"in P&&"g"in P&&"b"in P&&(ie=P.b,Z=P.g,P=P.r),null==Z&&H.is(P,a)){var fe=H.getRGB(P);P=fe.r,Z=fe.g,ie=fe.b}return(P>1||Z>1||ie>1)&&(P/=255,Z/=255,ie/=255),[P,Z,ie]},ht=function(P,Z,ie,fe){var ye={r:P*=255,g:Z*=255,b:ie*=255,hex:H.rgb(P,Z,ie),toString:ve};return H.is(fe,"finite")&&(ye.opacity=fe),ye};function Jt(P,Z,ie){return function fe(){var ye=Array.prototype.slice.call(arguments,0),Me=ye.join("\u2400"),Ce=fe.cache=fe.cache||{},Ue=fe.count=fe.count||[];return Ce[Pe](Me)?(function st(P,Z){for(var ie=0,fe=P.length;ie=1e3&&delete Ce[Ue.shift()],Ue.push(Me),Ce[Me]=P[ne](Z,ye),ie?ie(Ce[Me]):Ce[Me])}}function Ht(){return this.hex}function wn(P,Z){for(var ie=[],fe=0,ye=P.length;ye-2*!Z>fe;fe+=2){var Me=[{x:+P[fe-2],y:+P[fe-1]},{x:+P[fe],y:+P[fe+1]},{x:+P[fe+2],y:+P[fe+3]},{x:+P[fe+4],y:+P[fe+5]}];Z?fe?ye-4==fe?Me[3]={x:+P[0],y:+P[1]}:ye-2==fe&&(Me[2]={x:+P[0],y:+P[1]},Me[3]={x:+P[2],y:+P[3]}):Me[0]={x:+P[ye-2],y:+P[ye-1]}:ye-4==fe?Me[3]=Me[2]:fe||(Me[0]={x:+P[fe],y:+P[fe+1]}),ie.push(["C",(6*Me[1].x-Me[0].x+Me[2].x)/6,(6*Me[1].y-Me[0].y+Me[2].y)/6,(Me[1].x+6*Me[2].x-Me[3].x)/6,(Me[1].y+6*Me[2].y-Me[3].y)/6,Me[2].x,Me[2].y])}return ie}H.color=function(P){var Z;return H.is(P,"object")&&"h"in P&&"s"in P&&"b"in P?(Z=H.hsb2rgb(P),P.r=Z.r,P.g=Z.g,P.b=Z.b,P.hex=Z.hex):H.is(P,"object")&&"h"in P&&"s"in P&&"l"in P?(Z=H.hsl2rgb(P),P.r=Z.r,P.g=Z.g,P.b=Z.b,P.hex=Z.hex):(H.is(P,"string")&&(P=H.getRGB(P)),H.is(P,"object")&&"r"in P&&"g"in P&&"b"in P?(Z=H.rgb2hsl(P),P.h=Z.h,P.s=Z.s,P.l=Z.l,Z=H.rgb2hsb(P),P.v=Z.b):(P={hex:"none"}).r=P.g=P.b=P.h=P.s=P.v=P.l=-1),P.toString=ve,P},H.hsb2rgb=function(P,Z,ie,fe){var ye,Me,Ce,Ue,Ge;return this.is(P,"object")&&"h"in P&&"s"in P&&"b"in P&&(ie=P.b,Z=P.s,fe=(P=P.h).o),Ue=(Ge=ie*Z)*(1-u((P=(P*=360)%360/60)%2-1)),ye=Me=Ce=ie-Ge,ht(ye+=[Ge,Ue,0,0,Ue,Ge][P=~~P],Me+=[Ue,Ge,Ge,Ue,0,0][P],Ce+=[0,0,Ue,Ge,Ge,Ue][P],fe)},H.hsl2rgb=function(P,Z,ie,fe){var ye,Me,Ce,Ue,Ge;return this.is(P,"object")&&"h"in P&&"s"in P&&"l"in P&&(ie=P.l,Z=P.s,P=P.h),(P>1||Z>1||ie>1)&&(P/=360,Z/=100,ie/=100),Ue=(Ge=2*Z*(ie<.5?ie:1-ie))*(1-u((P=(P*=360)%360/60)%2-1)),ye=Me=Ce=ie-Ge/2,ht(ye+=[Ge,Ue,0,0,Ue,Ge][P=~~P],Me+=[Ue,Ge,Ge,Ue,0,0][P],Ce+=[0,0,Ue,Ge,Ge,Ue][P],fe)},H.rgb2hsb=function(P,Z,ie){var Me,Ce;return ie=He(P,Z,ie),{h:((0==(Ce=(Me=h(P=ie[0],Z=ie[1],ie=ie[2]))-s(P,Z,ie))?null:Me==P?(Z-ie)/Ce:Me==Z?(ie-P)/Ce+2:(P-Z)/Ce+4)+360)%6*60/360,s:0==Ce?0:Ce/Me,b:Me,toString:W}},H.rgb2hsl=function(P,Z,ie){var Me,Ce,Ue,Ge;return ie=He(P,Z,ie),Me=((Ce=h(P=ie[0],Z=ie[1],ie=ie[2]))+(Ue=s(P,Z,ie)))/2,{h:((0==(Ge=Ce-Ue)?null:Ce==P?(Z-ie)/Ge:Ce==Z?(ie-P)/Ge+2:(P-Z)/Ge+4)+360)%6*60/360,s:0==Ge?0:Me<.5?Ge/(2*Me):Ge/(2-2*Me),l:Me,toString:ee}},H._path2string=function(){return this.join(",").replace(q,"$1")},H._preload=function(P,Z){var ie=y.doc.createElement("img");ie.style.cssText="position:absolute;left:-9999em;top:-9999em",ie.onload=function(){Z.call(this),this.onload=null,y.doc.body.removeChild(this)},ie.onerror=function(){y.doc.body.removeChild(this)},y.doc.body.appendChild(ie),ie.src=P},H.getRGB=Jt(function(P){if(!P||(P=f(P)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:Ht};if("none"==P)return{r:-1,g:-1,b:-1,hex:"none",toString:Ht};!F[Pe](P.toLowerCase().substring(0,2))&&"#"!=P.charAt()&&(P=O(P));var ie,fe,ye,Me,Ce,Ue,Ge=P.match(I);return Ge?(Ge[2]&&(ye=X(Ge[2].substring(5),16),fe=X(Ge[2].substring(3,5),16),ie=X(Ge[2].substring(1,3),16)),Ge[3]&&(ye=X((Ce=Ge[3].charAt(3))+Ce,16),fe=X((Ce=Ge[3].charAt(2))+Ce,16),ie=X((Ce=Ge[3].charAt(1))+Ce,16)),Ge[4]&&(Ue=Ge[4][b](B),ie=Ae(Ue[0]),"%"==Ue[0].slice(-1)&&(ie*=2.55),fe=Ae(Ue[1]),"%"==Ue[1].slice(-1)&&(fe*=2.55),ye=Ae(Ue[2]),"%"==Ue[2].slice(-1)&&(ye*=2.55),"rgba"==Ge[1].toLowerCase().slice(0,4)&&(Me=Ae(Ue[3])),Ue[3]&&"%"==Ue[3].slice(-1)&&(Me/=100)),Ge[5]?(Ue=Ge[5][b](B),ie=Ae(Ue[0]),"%"==Ue[0].slice(-1)&&(ie*=2.55),fe=Ae(Ue[1]),"%"==Ue[1].slice(-1)&&(fe*=2.55),ye=Ae(Ue[2]),"%"==Ue[2].slice(-1)&&(ye*=2.55),("deg"==Ue[0].slice(-3)||"\xb0"==Ue[0].slice(-1))&&(ie/=360),"hsba"==Ge[1].toLowerCase().slice(0,4)&&(Me=Ae(Ue[3])),Ue[3]&&"%"==Ue[3].slice(-1)&&(Me/=100),H.hsb2rgb(ie,fe,ye,Me)):Ge[6]?(Ue=Ge[6][b](B),ie=Ae(Ue[0]),"%"==Ue[0].slice(-1)&&(ie*=2.55),fe=Ae(Ue[1]),"%"==Ue[1].slice(-1)&&(fe*=2.55),ye=Ae(Ue[2]),"%"==Ue[2].slice(-1)&&(ye*=2.55),("deg"==Ue[0].slice(-3)||"\xb0"==Ue[0].slice(-1))&&(ie/=360),"hsla"==Ge[1].toLowerCase().slice(0,4)&&(Me=Ae(Ue[3])),Ue[3]&&"%"==Ue[3].slice(-1)&&(Me/=100),H.hsl2rgb(ie,fe,ye,Me)):((Ge={r:ie,g:fe,b:ye,toString:Ht}).hex="#"+(16777216|ye|fe<<8|ie<<16).toString(16).slice(1),H.is(Me,"finite")&&(Ge.opacity=Me),Ge)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:Ht}},H),H.hsb=Jt(function(P,Z,ie){return H.hsb2rgb(P,Z,ie).hex}),H.hsl=Jt(function(P,Z,ie){return H.hsl2rgb(P,Z,ie).hex}),H.rgb=Jt(function(P,Z,ie){return"#"+(16777216|ie|Z<<8|P<<16).toString(16).slice(1)}),H.getColor=function(P){var Z=this.getColor.start=this.getColor.start||{h:0,s:1,b:P||.75},ie=this.hsb2rgb(Z.h,Z.s,Z.b);return Z.h+=.075,Z.h>1&&(Z.h=0,Z.s-=.2,Z.s<=0&&(this.getColor.start={h:0,s:1,b:Z.b})),ie.hex},H.getColor.reset=function(){delete this.start},H.parsePathString=function(P){if(!P)return null;var Z=sn(P);if(Z.arr)return Ze(Z.arr);var ie={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},fe=[];return H.is(P,c)&&H.is(P[0],c)&&(fe=Ze(P)),fe.length||f(P).replace(L,function(ye,Me,Ce){var Ue=[],Ge=Me.toLowerCase();if(Ce.replace(se,function(_t,Ft){Ft&&Ue.push(+Ft)}),"m"==Ge&&Ue.length>2&&(fe.push([Me][le](Ue.splice(0,2))),Ge="l",Me="m"==Me?"l":"L"),"r"==Ge)fe.push([Me][le](Ue));else for(;Ue.length>=ie[Ge]&&(fe.push([Me][le](Ue.splice(0,ie[Ge]))),ie[Ge]););}),fe.toString=H._path2string,Z.arr=Ze(fe),fe},H.parseTransformString=Jt(function(P){if(!P)return null;var ie=[];return H.is(P,c)&&H.is(P[0],c)&&(ie=Ze(P)),ie.length||f(P).replace(Y,function(fe,ye,Me){var Ce=[];n.call(ye),Me.replace(se,function(Ge,_t){_t&&Ce.push(+_t)}),ie.push([ye][le](Ce))}),ie.toString=H._path2string,ie});var sn=function(P){var Z=sn.ps=sn.ps||{};return Z[P]?Z[P].sleep=100:Z[P]={sleep:100},setTimeout(function(){for(var ie in Z)Z[Pe](ie)&&ie!=P&&(Z[ie].sleep--,!Z[ie].sleep&&delete Z[ie])}),Z[P]};function Sn(P,Z,ie,fe,ye){return P*(P*(-3*Z+9*ie-9*fe+3*ye)+6*Z-12*ie+6*fe)-3*Z+3*ie}function fr(P,Z,ie,fe,ye,Me,Ce,Ue,Ge){null==Ge&&(Ge=1);for(var _t=(Ge=Ge>1?1:Ge<0?0:Ge)/2,lt=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],mt=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],Ut=0,Xt=0;Xt<12;Xt++){var It=_t*lt[Xt]+_t,jt=Sn(It,P,ie,ye,Ce),Pt=Sn(It,Z,fe,Me,Ue);Ut+=mt[Xt]*g.sqrt(jt*jt+Pt*Pt)}return _t*Ut}function Rt(P,Z,ie,fe,ye,Me,Ce,Ue){if(!(h(P,ie)h(ye,Ce)||h(Z,fe)h(Me,Ue))){var Ft=(P-ie)*(Me-Ue)-(Z-fe)*(ye-Ce);if(Ft){var lt=((P*fe-Z*ie)*(ye-Ce)-(P-ie)*(ye*Ue-Me*Ce))/Ft,mt=((P*fe-Z*ie)*(Me-Ue)-(Z-fe)*(ye*Ue-Me*Ce))/Ft,Ut=+lt.toFixed(2),Xt=+mt.toFixed(2);if(!(Ut<+s(P,ie).toFixed(2)||Ut>+h(P,ie).toFixed(2)||Ut<+s(ye,Ce).toFixed(2)||Ut>+h(ye,Ce).toFixed(2)||Xt<+s(Z,fe).toFixed(2)||Xt>+h(Z,fe).toFixed(2)||Xt<+s(Me,Ue).toFixed(2)||Xt>+h(Me,Ue).toFixed(2)))return{x:lt,y:mt}}}}function Le(P,Z,ie){var fe=H.bezierBBox(P),ye=H.bezierBBox(Z);if(!H.isBBoxIntersect(fe,ye))return ie?0:[];for(var Me=fr.apply(0,P),Ce=fr.apply(0,Z),Ue=h(~~(Me/5),1),Ge=h(~~(Ce/5),1),_t=[],Ft=[],lt={},mt=ie?0:[],Ut=0;Ut=0&&kr<=1.001&&rr>=0&&rr<=1.001&&(ie?mt++:mt.push({x:xr.x,y:xr.y,t1:s(kr,1),t2:s(rr,1)}))}}return mt}function et(P,Z,ie){P=H._path2curve(P),Z=H._path2curve(Z);for(var fe,ye,Me,Ce,Ue,Ge,_t,Ft,lt,mt,Ut=ie?0:[],Xt=0,It=P.length;Xtun||Pt=P.x&&Z<=P.x2&&ie>=P.y&&ie<=P.y2},H.isBBoxIntersect=function(P,Z){var ie=H.isPointInsideBBox;return ie(Z,P.x,P.y)||ie(Z,P.x2,P.y)||ie(Z,P.x,P.y2)||ie(Z,P.x2,P.y2)||ie(P,Z.x,Z.y)||ie(P,Z.x2,Z.y)||ie(P,Z.x,Z.y2)||ie(P,Z.x2,Z.y2)||(P.xZ.x||Z.xP.x)&&(P.yZ.y||Z.yP.y)},H.pathIntersection=function(P,Z){return et(P,Z)},H.pathIntersectionNumber=function(P,Z){return et(P,Z,1)},H.isPointInsidePath=function(P,Z,ie){var fe=H.pathBBox(P);return H.isPointInsideBBox(fe,Z,ie)&&et(P,[["M",Z,ie],["H",fe.x2+10]],1)%2==1},H._removedFactory=function(P){return function(){gn("raphael.log",null,"Rapha\xebl: you are calling to method \u201c"+P+"\u201d of removed object",P)}};var qe=H.pathBBox=function(P){var Z=sn(P);if(Z.bbox)return Tn(Z.bbox);if(!P)return{x:0,y:0,width:0,height:0,x2:0,y2:0};for(var Ce,ie=0,fe=0,ye=[],Me=[],Ue=0,Ge=(P=vn(P)).length;Ue1&&(ie*=tn=g.sqrt(tn),fe*=tn);var an=ie*ie,Hn=fe*fe,xr=(Me==Ce?-1:1)*g.sqrt(u((an*Hn-an*un*un-Hn*Pt*Pt)/(an*un*un+Hn*Pt*Pt))),kr=xr*ie*un/fe+(P+Ue)/2,rr=xr*-fe*Pt/ie+(Z+Ge)/2,ir=g.asin(((Z-rr)/fe).toFixed(9)),or=g.asin(((Ge-rr)/fe).toFixed(9));(ir=Por&&(ir-=2*t),!Ce&&or>ir&&(or-=2*t)}var fi=or-ir;if(u(fi)>Ft){var Fe=or,St=Ue,Vt=Ge;Ue=kr+ie*g.cos(or=ir+Ft*(Ce&&or>ir?1:-1)),Ge=rr+fe*g.sin(or),mt=Ot(Ue,Ge,ie,fe,ye,0,Ce,St,Vt,[or,Fe,kr,rr])}fi=or-ir;var cn=g.cos(ir),$n=g.sin(ir),Ke=g.cos(or),Re=g.sin(or),bt=g.tan(fi/4),Et=4/3*ie*bt,nn=4/3*fe*bt,xn=[P,Z],fn=[P+Et*$n,Z-nn*cn],En=[Ue+Et*Re,Ge-nn*Ke],yn=[Ue,Ge];if(fn[0]=2*xn[0]-fn[0],fn[1]=2*xn[1]-fn[1],_t)return[fn,En,yn][le](mt);for(var Pn=[],qn=0,_r=(mt=[fn,En,yn][le](mt).join()[b](",")).length;qn<_r;qn++)Pn[qn]=qn%2?Xt(mt[qn-1],mt[qn],lt).y:Xt(mt[qn],mt[qn+1],lt).x;return Pn},mn=function(P,Z,ie,fe,ye,Me,Ce,Ue,Ge){var _t=1-Ge;return{x:o(_t,3)*P+3*o(_t,2)*Ge*ie+3*_t*Ge*Ge*ye+o(Ge,3)*Ce,y:o(_t,3)*Z+3*o(_t,2)*Ge*fe+3*_t*Ge*Ge*Me+o(Ge,3)*Ue}},kn=Jt(function(P,Z,ie,fe,ye,Me,Ce,Ue){var It,Ge=ye-2*ie+P-(Ce-2*ye+ie),_t=2*(ie-P)-2*(ye-ie),Ft=P-ie,lt=(-_t+g.sqrt(_t*_t-4*Ge*Ft))/2/Ge,mt=(-_t-g.sqrt(_t*_t-4*Ge*Ft))/2/Ge,Ut=[Z,Ue],Xt=[P,Ce];return u(lt)>"1e12"&&(lt=.5),u(mt)>"1e12"&&(mt=.5),lt>0&<<1&&(It=mn(P,Z,ie,fe,ye,Me,Ce,Ue,lt),Xt.push(It.x),Ut.push(It.y)),mt>0&&mt<1&&(It=mn(P,Z,ie,fe,ye,Me,Ce,Ue,mt),Xt.push(It.x),Ut.push(It.y)),lt=(-(_t=2*(fe-Z)-2*(Me-fe))+g.sqrt(_t*_t-4*(Ge=Me-2*fe+Z-(Ue-2*Me+fe))*(Ft=Z-fe)))/2/Ge,mt=(-_t-g.sqrt(_t*_t-4*Ge*Ft))/2/Ge,u(lt)>"1e12"&&(lt=.5),u(mt)>"1e12"&&(mt=.5),lt>0&<<1&&(It=mn(P,Z,ie,fe,ye,Me,Ce,Ue,lt),Xt.push(It.x),Ut.push(It.y)),mt>0&&mt<1&&(It=mn(P,Z,ie,fe,ye,Me,Ce,Ue,mt),Xt.push(It.x),Ut.push(It.y)),{min:{x:s[ne](0,Xt),y:s[ne](0,Ut)},max:{x:h[ne](0,Xt),y:h[ne](0,Ut)}}}),vn=H._path2curve=Jt(function(P,Z){var ie=!Z&&sn(P);if(!Z&&ie.curve)return Ze(ie.curve);for(var fe=Nt(P),ye=Z&&Nt(Z),Me={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},Ce={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},Ue=function(jt,Pt,un){var tn,an;if(!jt)return["C",Pt.x,Pt.y,Pt.x,Pt.y,Pt.x,Pt.y];switch(!(jt[0]in{T:1,Q:1})&&(Pt.qx=Pt.qy=null),jt[0]){case"M":Pt.X=jt[1],Pt.Y=jt[2];break;case"A":jt=["C"][le](Ot[ne](0,[Pt.x,Pt.y][le](jt.slice(1))));break;case"S":"C"==un||"S"==un?(tn=2*Pt.x-Pt.bx,an=2*Pt.y-Pt.by):(tn=Pt.x,an=Pt.y),jt=["C",tn,an][le](jt.slice(1));break;case"T":"Q"==un||"T"==un?(Pt.qx=2*Pt.x-Pt.qx,Pt.qy=2*Pt.y-Pt.qy):(Pt.qx=Pt.x,Pt.qy=Pt.y),jt=["C"][le](ln(Pt.x,Pt.y,Pt.qx,Pt.qy,jt[1],jt[2]));break;case"Q":Pt.qx=jt[1],Pt.qy=jt[2],jt=["C"][le](ln(Pt.x,Pt.y,jt[1],jt[2],jt[3],jt[4]));break;case"L":jt=["C"][le](Bt(Pt.x,Pt.y,jt[1],jt[2]));break;case"H":jt=["C"][le](Bt(Pt.x,Pt.y,jt[1],Pt.y));break;case"V":jt=["C"][le](Bt(Pt.x,Pt.y,Pt.x,jt[1]));break;case"Z":jt=["C"][le](Bt(Pt.x,Pt.y,Pt.X,Pt.Y))}return jt},Ge=function(jt,Pt){if(jt[Pt].length>7){jt[Pt].shift();for(var un=jt[Pt];un.length;)jt.splice(Pt++,0,["C"][le](un.splice(0,6)));jt.splice(Pt,1),lt=h(fe.length,ye&&ye.length||0)}},_t=function(jt,Pt,un,tn,an){jt&&Pt&&"M"==jt[an][0]&&"M"!=Pt[an][0]&&(Pt.splice(an,0,["M",tn.x,tn.y]),un.bx=0,un.by=0,un.x=jt[an][1],un.y=jt[an][2],lt=h(fe.length,ye&&ye.length||0))},Ft=0,lt=h(fe.length,ye&&ye.length||0);Ft.01;)mt=fr(P,Z,ie,fe,ye,Me,Ce,Ue,lt+=(mtfe){if(Z&&!Ft.start){if(_t+=["C"+(lt=Vr(Me,Ce,Ue[1],Ue[2],Ue[3],Ue[4],Ue[5],Ue[6],fe-mt)).start.x,lt.start.y,lt.m.x,lt.m.y,lt.x,lt.y],ye)return _t;Ft.start=_t,_t=["M"+lt.x,lt.y+"C"+lt.n.x,lt.n.y,lt.end.x,lt.end.y,Ue[5],Ue[6]].join(),mt+=Ge,Me=+Ue[5],Ce=+Ue[6];continue}if(!P&&!Z)return{x:(lt=Vr(Me,Ce,Ue[1],Ue[2],Ue[3],Ue[4],Ue[5],Ue[6],fe-mt)).x,y:lt.y,alpha:lt.alpha}}mt+=Ge,Me=+Ue[5],Ce=+Ue[6]}_t+=Ue.shift()+Ue}return Ft.end=_t,(lt=P?mt:Z?Ft:H.findDotsAtSegment(Me,Ce,Ue[0],Ue[1],Ue[2],Ue[3],Ue[4],Ue[5],1)).alpha&&(lt={x:lt.x,y:lt.y,alpha:lt.alpha}),lt}},Un=Fr(1),We=Fr(),Mn=Fr(0,1);H.getTotalLength=Un,H.getPointAtLength=We,H.getSubpath=function(P,Z,ie){if(this.getTotalLength(P)-ie<1e-6)return Mn(P,Z).end;var fe=Mn(P,ie,1);return Z?Mn(fe,Z).end:fe},cr.getTotalLength=function(){var P=this.getPath();if(P)return this.node.getTotalLength?this.node.getTotalLength():Un(P)},cr.getPointAtLength=function(P){var Z=this.getPath();if(Z)return We(Z,P)},cr.getPath=function(){var P,Z=H._getPath[this.type];if("text"!=this.type&&"set"!=this.type)return Z&&(P=Z(this)),P},cr.getSubpath=function(P,Z){var ie=this.getPath();if(ie)return H.getSubpath(ie,P,Z)};var Yn=H.easing_formulas={linear:function(P){return P},"<":function(P){return o(P,1.7)},">":function(P){return o(P,.48)},"<>":function(P){var Z=.48-P/1.04,ie=g.sqrt(.1734+Z*Z),fe=ie-Z,Me=-ie-Z,Ue=o(u(fe),1/3)*(fe<0?-1:1)+o(u(Me),1/3)*(Me<0?-1:1)+.5;return 3*(1-Ue)*Ue*Ue+Ue*Ue*Ue},backIn:function(P){var Z=1.70158;return P*P*((Z+1)*P-Z)},backOut:function(P){var Z=1.70158;return(P-=1)*P*((Z+1)*P+Z)+1},elastic:function(P){return P==!!P?P:o(2,-10*P)*g.sin(2*t*(P-.075)/.3)+1},bounce:function(P){var Z=7.5625,ie=2.75;return P<1/ie?Z*P*P:P<2/ie?Z*(P-=1.5/ie)*P+.75:P<2.5/ie?Z*(P-=2.25/ie)*P+.9375:Z*(P-=2.625/ie)*P+.984375}};Yn.easeIn=Yn["ease-in"]=Yn["<"],Yn.easeOut=Yn["ease-out"]=Yn[">"],Yn.easeInOut=Yn["ease-in-out"]=Yn["<>"],Yn["back-in"]=Yn.backIn,Yn["back-out"]=Yn.backOut;var Cn=[],Jn=Gt.requestAnimationFrame||Gt.webkitRequestAnimationFrame||Gt.mozRequestAnimationFrame||Gt.oRequestAnimationFrame||Gt.msRequestAnimationFrame||function(P){setTimeout(P,16)},Er=function(){for(var P=+new Date,Z=0;Z1&&!ie.next){for(Xt in Ge)Ge[Pe](Xt)&&(Ut[Xt]=ie.totalOrigin[Xt]);ie.el.attr(Ut),Qr(ie.anim,ie.el,ie.anim.percents[0],null,ie.totalOrigin,ie.repeat-1)}ie.next&&!ie.stop&&Qr(ie.anim,ie.el,ie.next,null,ie.totalOrigin,ie.repeat)}}}H.svg&&Ft&&Ft.paper&&Ft.paper.safari(),Cn.length&&Jn(Er)},Gr=function(P){return P>255?255:P<0?0:P};function dr(P,Z){var ie=[],fe={};if(this.ms=Z,this.times=1,P){for(var ye in P)P[Pe](ye)&&(fe[Ae(ye)]=P[ye],ie.push(Ae(ye)));ie.sort(Qe)}this.anim=fe,this.top=ie[ie.length-1],this.percents=ie}function Qr(P,Z,ie,fe,ye,Me){ie=Ae(ie);var Ce,Ue,Ge,Ft,lt,mt,Ut=P.ms,Xt={},It={},jt={};if(fe)for(un=0,tn=Cn.length;unfe*P.top){Ut=Ut/P.top*((ie=P.percents[un])-(lt=P.percents[un-1]||0)),Ft=P.percents[un+1],Ce=P.anim[ie];break}fe&&Z.attr(P.anim[P.percents[un]])}if(Ce){if(Ue)Ue.initstatus=fe,Ue.start=new Date-Ue.ms*fe;else{for(var an in Ce)if(Ce[Pe](an)&&(M[Pe](an)||Z.paper.customAttributes[Pe](an)))switch(Xt[an]=Z.attr(an),null==Xt[an]&&(Xt[an]=D[an]),It[an]=Ce[an],M[an]){case r:jt[an]=(It[an]-Xt[an])/Ut;break;case"colour":Xt[an]=H.getRGB(Xt[an]);var Hn=H.getRGB(It[an]);jt[an]={r:(Hn.r-Xt[an].r)/Ut,g:(Hn.g-Xt[an].g)/Ut,b:(Hn.b-Xt[an].b)/Ut};break;case"path":var xr=vn(Xt[an],It[an]),kr=xr[1];for(Xt[an]=xr[0],jt[an]=[],un=0,tn=Xt[an].length;un(un=1))return un;for(;Ptan?Pt=tn:un=tn,tn=(un-Pt)/2+Pt}return tn}(It,jt);return((lt*Pt+Ft)*Pt+_t)*Pt}(P,1/(200*Me))}(bt,+Re[1],+Re[2],+Re[3],+Re[4],Ut)}}else Ke=ut;if(Pt={anim:P,percent:ie,timestamp:mt=Ce.start||P.start||+new Date,start:mt+(P.del||0),status:0,initstatus:fe||0,stop:!1,ms:Ut,easing:Ke,from:Xt,diff:jt,to:It,el:Z,callback:Ce.callback,prev:lt,next:Ft,repeat:Me||P.times,origin:Z.attr(),totalOrigin:ye},Cn.push(Pt),fe&&!Ue&&!Ge&&(Pt.stop=!0,Pt.start=new Date-Ut*fe,1==Cn.length))return Er();Ge&&(Pt.start=new Date-Pt.ms*fe),1==Cn.length&&Jn(Er)}gn("raphael.anim.start."+Z.id,Z,P)}}function di(P){for(var Z=0;Z.5)-1;Ue($n-.5,2)+Ue(Ke-.5,2)>.25&&(Ke=ye.sqrt(.25-Ue($n-.5,2))*gr+.5)&&.5!=Ke&&(Ke=Ke.toFixed(5)-1e-5*gr)}return""})).split(/\s*\-\s*/),"linear"==Vt){var xn=St.shift();if(xn=-ie(xn),isNaN(xn))return null;var fn=[0,0,ye.cos(H.rad(xn)),ye.sin(H.rad(xn))],En=1/(Me(Ce(fn[2]),Ce(fn[3]))||1);fn[2]*=En,fn[3]*=En,fn[2]<0&&(fn[0]=-fn[2],fn[2]=0),fn[3]<0&&(fn[1]=-fn[3],fn[3]=0)}var yn=H._parseDots(St);if(!yn)return null;if(cn=cn.replace(/[\(\)\s,\xb0#]/g,"_"),Fe.gradient&&cn!=Fe.gradient.id&&(bt.defs.removeChild(Fe.gradient),delete Fe.gradient),!Fe.gradient){nn=It(Vt+"Gradient",{id:cn}),Fe.gradient=nn,It(nn,"radial"==Vt?{fx:$n,fy:Ke}:{x1:fn[0],y1:fn[1],x2:fn[2],y2:fn[3],gradientTransform:Fe.matrix.invert()}),bt.defs.appendChild(nn);for(var Pn=0,qn=yn.length;Pn1?nr.opacity/100:nr.opacity});case"stroke":nr=H.getRGB(Re),Vt.setAttribute(Ke,nr.hex),"stroke"==Ke&&nr[P]("opacity")&&It(Vt,{"stroke-opacity":nr.opacity>1?nr.opacity/100:nr.opacity}),"stroke"==Ke&&Fe._.arrows&&("startString"in Fe._.arrows&&un(Fe,Fe._.arrows.startString),"endString"in Fe._.arrows&&un(Fe,Fe._.arrows.endString,1));break;case"gradient":("circle"==Fe.type||"ellipse"==Fe.type||"r"!=Z(Re).charAt())&&jt(Fe,Re);break;case"opacity":cn.gradient&&!cn[P]("stroke-opacity")&&It(Vt,{"stroke-opacity":Re>1?Re/100:Re});case"fill-opacity":if(cn.gradient){(Cr=H._g.doc.getElementById(Vt.getAttribute("fill").replace(/^url\(#|\)$/g,"")))&&(gr=Cr.getElementsByTagName("stop"),It(gr[gr.length-1],{"stop-opacity":Re}));break}default:"font-size"==Ke&&(Re=fe(Re,10)+"px");var Tr=Ke.replace(/(\-.)/g,function(br){return br.substring(1).toUpperCase()});Vt.style[Tr]=Re,Fe._.dirty=1,Vt.setAttribute(Ke,Re)}}kr(Fe,St),Vt.style.visibility=$n},kr=function(Fe,St){if("text"==Fe.type&&(St[P]("text")||St[P]("font")||St[P]("font-size")||St[P]("x")||St[P]("y"))){var Vt=Fe.attrs,cn=Fe.node,$n=cn.firstChild?fe(H._g.doc.defaultView.getComputedStyle(cn.firstChild,"").getPropertyValue("font-size"),10):10;if(St[P]("text")){for(Vt.text=St.text;cn.firstChild;)cn.removeChild(cn.firstChild);for(var bt,Ke=Z(St.text).split("\n"),Re=[],Et=0,nn=Ke.length;Et"));var Ai=Vi.getBoundingClientRect();yn.W=Et.w=(Ai.right-Ai.left)/100,yn.H=Et.h=(Ai.bottom-Ai.top)/100,yn.X=Et.x,yn.Y=Et.y+yn.H/2,("x"in Re||"y"in Re)&&(yn.path.v=H.format("m{0},{1}l{2},{1}",ye(Et.x*tn),ye(Et.y*tn),ye(Et.x*tn)+1));for(var Ii=["x","y","text","font","font-family","font-weight","font-style","font-size"],_i=0,Pi=Ii.length;_i.25&&(br=fe.sqrt(.25-nn(Tr-.5,2))*(2*(br>.5)-1)+.5),yn=Tr+mt+br),""})).split(/\s*\-\s*/),"linear"==En){var Pn=Re.shift();if(Pn=-ie(Pn),isNaN(Pn))return null}var qn=H._parseDots(Re);if(!qn)return null;if(Ke=Ke.shape||Ke.node,qn.length){Ke.removeChild(bt),bt.on=!0,bt.method="none",bt.color=qn[0].color,bt.color2=qn[qn.length-1].color;for(var _r=[],nr=0,Cr=qn.length;nr')}}catch{Vt=function(Et){return Re.createElement("<"+Et+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},H._engine.initWin(H._g.win),H._engine.create=function(){var Ke=H._getContainer.apply(0,arguments),Re=Ke.container,bt=Ke.height,nn=Ke.width,xn=Ke.x,fn=Ke.y;if(!Re)throw new Error("VML container not found.");var En=new H._Paper,yn=En.canvas=H._g.doc.createElement("div"),Pn=yn.style;return xn=xn||0,fn=fn||0,bt=bt||342,En.width=nn=nn||512,En.height=bt,nn==+nn&&(nn+="px"),bt==+bt&&(bt+="px"),En.coordsize=1e3*tn+mt+1e3*tn,En.coordorigin="0 0",En.span=H._g.doc.createElement("span"),En.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",yn.appendChild(En.span),Pn.cssText=H.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",nn,bt),1==Re?(H._g.doc.body.appendChild(yn),Pn.left=xn+"px",Pn.top=fn+"px",Pn.position="absolute"):Re.firstChild?Re.insertBefore(yn,Re.firstChild):Re.appendChild(yn),En.renderfix=function(){},En},H.prototype.clear=function(){H.eve("raphael.clear",this),this.canvas.innerHTML="",this.span=H._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},H.prototype.remove=function(){for(var Ke in H.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas),this)this[Ke]="function"==typeof this[Ke]?H._removedFactory(Ke):null;return!0};var cn=H.st;for(var $n in St)St[P]($n)&&!cn[P]($n)&&(cn[$n]=function(Ke){return function(){var Re=arguments;return this.forEach(function(bt){bt[Ke].apply(bt,Re)})}}($n))}}(),he.was?y.win.Raphael=H:Raphael=H,H}),function(){"use strict";var Gt=function(he,te){if(this.text=he,this.options=y(Pe(Gt.default),te),this.strokes=[],this.papers=[],this.pointer=0,this.timeouts={play:[],erasing:[],drawing:[]},!this.options.skipLoad){var pe=new DmakLoader(this.options.uri),_e=this;pe.load(he,function(ne){_e.prepare(ne),_e.options.loaded(_e.strokes),_e.options.autoplay&&_e.render()})}};function xt(he,te,pe){null!==he.object.text&&he.object.text.remove();var _e=function(){he.object.path.remove(),he.object={path:null,text:null},te.shift()};pe.stroke.animated.erasing?(he.object.path.node.style.stroke=pe.stroke.attr.active,te.push(je(he,-1,pe,_e))):_e()}function je(he,te,pe,_e){return he.object.path.attr({stroke:pe.stroke.attr.active}),he.object.path.node.style.transition=he.object.path.node.style.WebkitTransition="none",he.object.path.node.style.strokeDasharray=he.length+" "+he.length,he.object.path.node.style.strokeDashoffset=te>0?he.length:0,he.object.path.node.getBoundingClientRect(),he.object.path.node.style.transition=he.object.path.node.style.WebkitTransition="stroke-dashoffset "+he.duration+"ms ease",he.object.path.node.style.strokeDashoffset=te>0?"0":he.length,setTimeout(_e,he.duration)}function Pe(he){if(null===he||"object"!=typeof he)return he;var te=he.constructor();for(var pe in he)te[pe]=Pe(he[pe]);return te}function y(he,te){if(2!==arguments.length)throw new Error("Missing arguments in assign function");for(var pe in he)te.hasOwnProperty(pe)&&(he[pe]="object"==typeof te[pe]?y(he[pe],te[pe]):te[pe]);return he}Gt.VERSION="0.2.0",Gt.default={uri:"",skipLoad:!1,autoplay:!0,height:109,width:109,viewBox:{x:0,y:0,w:109,h:109},step:.03,element:"draw",stroke:{animated:{drawing:!0,erasing:!0},order:{visible:!1,attr:{"font-size":"8",fill:"#999999"}},attr:{active:"#BF0000",stroke:"#2C2C2C","stroke-width":4,"stroke-linecap":"round","stroke-linejoin":"round"}},grid:{show:!0,attr:{stroke:"#CCCCCC","stroke-width":.5,"stroke-dasharray":"--"}},loaded:function(){},erased:function(){},drew:function(){}},Gt.fn=Gt.prototype={prepare:function(he){this.strokes=function gn(he,te){var ne,le,d,pe=[];for(le=0;le"u"&&(he=0);do{this.pointer--,xt(this.strokes[this.pointer],this.timeouts.erasing,this.options),this.options.erased(this.pointer)}while(this.pointer>he)},render:function(he){if(this.timeouts.play.length)return!1;if(typeof he>"u")he=this.strokes.length;else if(he>this.strokes.length)return!1;var _e,te=function(ne){(function kt(he,te,pe,_e){var ne=function(){if(null!==te.object.path){var le=_e.stroke.attr.stroke;"random"===_e.stroke.attr.stroke&&(le=Raphael.getColor()),te.object.path.node.style.stroke=le,te.object.path.node.style.transition=te.object.path.node.style.WebkitTransition="stroke 400ms ease",pe.shift()}};te.object.path=he.path(te.path),te.object.path.attr(_e.stroke.attr),_e.stroke.order.visible&&function Q(he,te,pe){te.object.text=he.text(te.text.x,te.text.y,te.text.value),te.object.text.attr(pe.stroke.order.attr)}(he,te,_e),_e.stroke.animated.drawing?je(te,1,_e,ne):ne()})(ne.papers[ne.strokes[ne.pointer].char],ne.strokes[ne.pointer],ne.timeouts.drawing,ne.options),ne.options.drew(ne.pointer),ne.pointer++,ne.timeouts.play.shift()},pe=0;for(_e=0;_e=he)&&pe.push(le);if(te&&pe.length>0&&he60)console.info("seeked back too far, cleaning prerender buffer"),pe=[];else{console.info("seeked backwards, need to free up some buffer");var d=0,N=.3*H.renderAhead,A=[];for(_e=0,ne=pe.length;_e=N)break;A.push(le)}pe=A}var f=pe.length"u"){if(!H.video)return;he=H.video.currentTime+H.timeOffset}for(var pe=0,_e=0,ne=H.renderedItems.length;_e=le.eventStart&&hehe))kt(d,he),pe=!0,te=d.emptyFinish;else if(te>=0){if(!(d.eventStart-te<.01))break;te=d.emptyFinish,_e=d.animated}}pe?At(he)&&te>=0&&xt(te,_e):Math.abs(H.oneshotState.requestNextTimestamp-he)>.01&&(At(he),xt(he,!0))}}function je(){var he=H.renderFramesData,te=performance.now();H.ctx.clearRect(0,0,H.canvas.width,H.canvas.height);for(var pe=0;pe=1?ne[le]:1;var d=new ImageData(ne,_e.w,_e.h);H.bufferCanvasCtx.putImageData(d,0,0),H.ctx.drawImage(H.bufferCanvas,_e.x,_e.y)}if(H.debug){var N=Math.round(performance.now()-te),A=he.blendTime;console.log(typeof A<"u"?"render: "+Math.round(he.spentTime-A)+" ms, blend: "+Math.round(A)+" ms, draw: "+N+" ms; TOTAL="+Math.round(he.spentTime+N)+" ms":Math.round(he.spentTime)+" ms (+ "+N+" ms draw)"),H.renderStart=performance.now()}}function Pe(){var he=H.renderFramesData,te=performance.now();H.ctx.clearRect(0,0,H.canvas.width,H.canvas.height);for(var pe=0;pe0,dropAllAnimations:H.dropAllAnimations})):H.workerError("worker not supported")},H.createCanvas=function(){H.canvas||(H.video?(H.isOurCanvas=!0,H.canvas=document.createElement("canvas"),H.canvas.className="libassjs-canvas",H.canvas.style.display="none",H.canvasParent=document.createElement("div"),H.canvasParent.className="libassjs-canvas-parent",H.canvasParent.appendChild(H.canvas),H.video.nextSibling?H.video.parentNode.insertBefore(H.canvasParent,H.video.nextSibling):H.video.parentNode.appendChild(H.canvasParent)):H.canvas||H.workerError("Don't know where to render: you should give video or canvas in options.")),H.ctx=H.canvas.getContext("2d"),H.bufferCanvas=document.createElement("canvas"),H.bufferCanvasCtx=H.bufferCanvas.getContext("2d"),H.bufferCanvas.width=1,H.bufferCanvas.height=1;var he=new Uint8ClampedArray([0,255,0,0]),te=new ImageData(he,1,1);H.bufferCanvasCtx.clearRect(0,0,1,1),H.ctx.clearRect(0,0,1,1);var pe=H.ctx.getImageData(0,0,1,1).data;H.bufferCanvasCtx.putImageData(te,0,0),H.ctx.drawImage(H.bufferCanvas,0,0);var _e=H.ctx.getImageData(0,0,1,1).data;H.hasAlphaBug=pe[1]!=_e[1],H.hasAlphaBug&&console.log("Detected a browser having issue with transparent pixels, applying workaround")},H.setVideo=function(he){if(H.video=he,H.video){var te=function(){H.setCurrentTime(he.currentTime+H.timeOffset)};H.video.addEventListener("timeupdate",te,!1),H.video.addEventListener("playing",function(){H.setIsPaused(!1,he.currentTime+H.timeOffset)},!1),H.video.addEventListener("pause",function(){H.setIsPaused(!0,he.currentTime+H.timeOffset)},!1),H.video.addEventListener("seeking",function(){H.video.removeEventListener("timeupdate",te)},!1),H.video.addEventListener("seeked",function(){H.video.addEventListener("timeupdate",te,!1),H.setCurrentTime(he.currentTime+H.timeOffset),H.renderAhead>0&&At(he.currentTime+H.timeOffset,!0)},!1),H.video.addEventListener("ratechange",function(){H.setRate(he.playbackRate)},!1),H.video.addEventListener("timeupdate",function(){H.setCurrentTime(he.currentTime+H.timeOffset)},!1),H.video.addEventListener("waiting",function(){H.setIsPaused(!0,he.currentTime+H.timeOffset)},!1),document.addEventListener("fullscreenchange",H.resizeWithTimeout,!1),document.addEventListener("mozfullscreenchange",H.resizeWithTimeout,!1),document.addEventListener("webkitfullscreenchange",H.resizeWithTimeout,!1),document.addEventListener("msfullscreenchange",H.resizeWithTimeout,!1),window.addEventListener("resize",H.resizeWithTimeout,!1),typeof ResizeObserver<"u"&&(H.ro=new ResizeObserver(H.resizeWithTimeout),H.ro.observe(H.video)),H.video.videoWidth>0?H.resize():H.video.addEventListener("loadedmetadata",function(pe){pe.target.removeEventListener(pe.type,arguments.callee),H.resize()},!1)}},H.getVideoPosition=function(){var he=H.video.videoWidth/H.video.videoHeight,te=H.video.offsetWidth,pe=H.video.offsetHeight,ne=te,le=pe;return te/pe>he?ne=Math.floor(pe*he):le=Math.floor(te/he),{width:ne,height:le,x:(te-ne)/2,y:(pe-le)/2}},H.setSubUrl=function(he){H.subUrl=he},H.resetRenderAheadCache=function(he){if(H.renderAhead>0){var te=[];if(he&&H.oneshotState.prevHeight&&H.oneshotState.prevWidth){if(H.oneshotState.prevHeight==H.canvas.height&&H.oneshotState.prevWidth==H.canvas.width)return;var pe=10,_e=.3*H.renderAhead;H.canvas.height>=H.oneshotState.prevHeight*(1-H.resizeVariation)&&H.canvas.height<=H.oneshotState.prevHeight*(1+H.resizeVariation)&&H.canvas.width>=H.oneshotState.prevWidth*(1-H.resizeVariation)&&H.canvas.width<=H.oneshotState.prevWidth*(1+H.resizeVariation)&&(console.debug("viewport changes are small, leaving more of prerendered buffer"),pe=30,_e=.5*H.renderAhead);for(var ne=H.video.currentTime+H.timeOffset+pe,le=0,d=0;d=ne||(le+=N.size)>=_e)break;te.push(N)}}console.info("resetting prerender cache"),H.renderedItems=te,H.oneshotState.eventStart=null,H.oneshotState.iteration++,H.oneshotState.renderRequested=!1,H.oneshotState.prevHeight=H.canvas.height,H.oneshotState.prevWidth=H.canvas.width,window.requestAnimationFrame(Q),xt(void 0,!0)}},H.renderFrameData=null,H.workerActive=!1,H.frameId=0,H.onWorkerMessage=function(he){H.workerActive||(H.workerActive=!0,H.onReadyEvent&&H.onReadyEvent());var te=he.data;switch(te.target){case"stdout":console.log(te.content);break;case"console-log":console.log.apply(console,JSON.parse(te.content));break;case"console-debug":console.debug.apply(console,JSON.parse(te.content));break;case"console-info":console.info.apply(console,JSON.parse(te.content));break;case"console-warn":console.warn.apply(console,JSON.parse(te.content));break;case"console-error":console.error.apply(console,JSON.parse(te.content));break;case"stderr":console.error(te.content);break;case"window":window[te.method]();break;case"canvas":switch(te.op){case"getContext":H.ctx=H.canvas.getContext(te.type,te.attributes);break;case"resize":H.resize(te.width,te.height);break;case"renderCanvas":H.lastRenderTime.01&&H.renderedItems.push({eventStart:te.lastRenderedTime,eventFinish:te.lastRenderedTime-.001,emptyFinish:te.eventStart,viewport:te.viewport,spentTime:0,blendTime:0,items:[],animated:!1,size:0});for(var pe=[],_e=0,ne=0,le=te.canvases.length;ne0&&te.emptyFinish-te.eventStart<1/H.targetFps||te.animated){var A=te.eventStart+1/H.targetFps;te.emptyFinish=A,te.eventFinish=A,N=!0}H.renderedItems.push({eventStart:te.eventStart,eventFinish:te.eventFinish,emptyFinish:te.emptyFinish,spentTime:te.spentTime,blendTime:te.blendTime,viewport:te.viewport,items:pe,animated:te.animated,size:_e}),H.renderedItems.sort(function(f,b){return f.eventStart-b.eventStart}),H.oneshotState.requestNextTimestamp>=0?xt(H.oneshotState.requestNextTimestamp,!0):te.eventStart<0?console.info('oneshot received "end of frames" event'):te.emptyFinish>=0?xt(te.emptyFinish,N):console.info("there are no more events to prerender");break;default:throw"eh?"}break;case"tick":H.frameId=te.id,H.worker.postMessage({target:"tock",id:H.frameId});break;case"custom":if(!H.onCustomMessage)throw"Custom message received but client onCustomMessage not implemented.";H.onCustomMessage(he);break;case"setimmediate":H.worker.postMessage({target:"setimmediate"});break;case"get-events":console.log(te.target),console.log(te.events);break;case"get-styles":console.log(te.target),console.log(te.styles);break;default:throw"what? "+te.target}},H.resize=function(he,te,pe,_e){var ne=null;if(pe=pe||0,_e=_e||0,(!he||!te)&&H.video){var le=function y(he,te){return null===H.prescaleTradeoff?te>H.hardHeightLimit&&(he=he*H.hardHeightLimit/te,te=H.hardHeightLimit):H.prescaleTradeoff>1?te*H.prescaleTradeoff<=H.softHeightLimit?(he*=H.prescaleTradeoff,te*=H.prescaleTradeoff):te=H.hardHeightLimit&&(he=he*H.hardHeightLimit/te,te=H.hardHeightLimit):te>=H.softHeightLimit&&(te*H.prescaleTradeoff<=H.softHeightLimit?(he=he*H.softHeightLimit/te,te=H.softHeightLimit):te*H.prescaleTradeoff<=H.hardHeightLimit?(he*=H.prescaleTradeoff,te*=H.prescaleTradeoff):(he=he*H.hardHeightLimit/te,te=H.hardHeightLimit)),{width:he,height:te}}((ne=H.getVideoPosition()).width*H.pixelRatio,ne.height*H.pixelRatio);he=le.width,te=le.height;var d=H.canvasParent.getBoundingClientRect().top-H.video.getBoundingClientRect().top;pe=ne.y-d,_e=ne.x}he&&te?(H.canvas.width!=he||H.canvas.height!=te||H.canvas.style.top!=pe||H.canvas.style.left!=_e)&&(H.canvas.width=he,H.canvas.height=te,null!=ne&&(H.canvasParent.style.position="relative",H.canvas.style.display="block",H.canvas.style.position="absolute",H.canvas.style.width=ne.width+"px",H.canvas.style.height=ne.height+"px",H.canvas.style.top=pe+"px",H.canvas.style.left=_e+"px",H.canvas.style.pointerEvents="none"),H.worker.postMessage({target:"canvas",width:H.canvas.width,height:H.canvas.height}),H.resetRenderAheadCache(!0)):H.video||console.error("width or height is 0. You should specify width & height for resize.")},H.resizeWithTimeout=function(){H.resize(),setTimeout(H.resize,100)},H.runBenchmark=function(){H.worker.postMessage({target:"runBenchmark"})},H.customMessage=function(he,te){H.worker.postMessage({target:"custom",userData:he,preMain:(te=te||{}).preMain})},H.setCurrentTime=function(he){H.worker.postMessage({target:"video",currentTime:he})},H.setTrackByUrl=function(he){H.worker.postMessage({target:"set-track-by-url",url:he}),H.resetRenderAheadCache(!1)},H.setTrack=function(he){H.worker.postMessage({target:"set-track",content:he}),H.resetRenderAheadCache(!1)},H.freeTrack=function(he){H.worker.postMessage({target:"free-track"}),H.resetRenderAheadCache(!1)},H.render=H.setCurrentTime,H.setIsPaused=function(he,te){H.worker.postMessage({target:"video",isPaused:he,currentTime:te})},H.setRate=function(he){H.worker.postMessage({target:"video",rate:he})},H.dispose=function(){H.worker.postMessage({target:"destroy"}),H.worker.terminate(),H.workerActive=!1,H.video&&H.video.parentNode.removeChild(H.canvasParent)},H.createEvent=function(he){H.worker.postMessage({target:"create-event",event:he})},H.getEvents=function(){H.worker.postMessage({target:"get-events"})},H.setEvent=function(he,te){H.worker.postMessage({target:"set-event",event:he,index:te})},H.removeEvent=function(he){H.worker.postMessage({target:"remove-event",index:he})},H.createStyle=function(he){H.worker.postMessage({target:"create-style",style:he})},H.getStyles=function(){H.worker.postMessage({target:"get-styles"})},H.setStyle=function(he,te){H.worker.postMessage({target:"set-style",style:he,index:te})},H.removeStyle=function(he){H.worker.postMessage({target:"remove-style",index:he})},H.init()};function _slicedToArray(Gt,gn){return _arrayWithHoles(Gt)||_iterableToArrayLimit(Gt,gn)||_unsupportedIterableToArray(Gt,gn)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(Gt,gn){var H=null==Gt?null:typeof Symbol<"u"&&Gt[Symbol.iterator]||Gt["@@iterator"];if(null!=H){var At,xt,kt=[],Q=!0,je=!1;try{for(H=H.call(Gt);!(Q=(At=H.next()).done)&&(kt.push(At.value),!gn||kt.length!==gn);Q=!0);}catch(Pe){je=!0,xt=Pe}finally{try{Q||null==H.return||H.return()}finally{if(je)throw xt}}return kt}}function _arrayWithHoles(Gt){if(Array.isArray(Gt))return Gt}function _createForOfIteratorHelper(Gt,gn){var H,At=typeof Symbol<"u"&&Gt[Symbol.iterator]||Gt["@@iterator"];if(!At){if(Array.isArray(Gt)||(At=_unsupportedIterableToArray(Gt))||gn&&Gt&&"number"==typeof Gt.length)return At&&(Gt=At),H=0,{s:gn=function(){},n:function(){return H>=Gt.length?{done:!0}:{done:!1,value:Gt[H++]}},e:function(je){throw je},f:gn};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var xt,kt=!0,Q=!1;return{s:function(){At=At.call(Gt)},n:function(){var je=At.next();return kt=je.done,je},e:function(je){Q=!0,xt=je},f:function(){try{kt||null==At.return||At.return()}finally{if(Q)throw xt}}}}function _unsupportedIterableToArray(Gt,gn){if(Gt){if("string"==typeof Gt)return _arrayLikeToArray(Gt,gn);var H=Object.prototype.toString.call(Gt).slice(8,-1);return"Map"===(H="Object"===H&&Gt.constructor?Gt.constructor.name:H)||"Set"===H?Array.from(Gt):"Arguments"===H||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H)?_arrayLikeToArray(Gt,gn):void 0}}function _arrayLikeToArray(Gt,gn){(null==gn||gn>Gt.length)&&(gn=Gt.length);for(var H=0,At=new Array(gn);H{let j=xe.getAttribute("data-bs-target");if(!j||"#"===j){let ae=xe.getAttribute("href");if(!ae||!ae.includes("#")&&!ae.startsWith("."))return null;ae.includes("#")&&!ae.startsWith("#")&&(ae=`#${ae.split("#")[1]}`),j=ae&&"#"!==ae?ae.trim():null}return j},H=xe=>{const j=gn(xe);return j&&document.querySelector(j)?j:null},At=xe=>{const j=gn(xe);return j?document.querySelector(j):null},xt=xe=>{xe.dispatchEvent(new Event(Gt))},kt=xe=>!(!xe||"object"!=typeof xe)&&(void 0!==xe.jquery&&(xe=xe[0]),void 0!==xe.nodeType),Q=xe=>kt(xe)?xe.jquery?xe[0]:xe:"string"==typeof xe&&xe.length>0?document.querySelector(xe):null,je=(xe,j,ae)=>{Object.keys(ae).forEach(De=>{const rt=ae[De],gt=j[De],Dt=gt&&kt(gt)?"element":null==(_n=gt)?`${_n}`:{}.toString.call(_n).match(/\s([a-z]+)/i)[1].toLowerCase();var _n;if(!new RegExp(rt).test(Dt))throw new TypeError(`${xe.toUpperCase()}: Option "${De}" provided type "${Dt}" but expected type "${rt}".`)})},Pe=xe=>!(!kt(xe)||0===xe.getClientRects().length)&&"visible"===getComputedStyle(xe).getPropertyValue("visibility"),y=xe=>!xe||xe.nodeType!==Node.ELEMENT_NODE||!!xe.classList.contains("disabled")||(void 0!==xe.disabled?xe.disabled:xe.hasAttribute("disabled")&&"false"!==xe.getAttribute("disabled")),he=xe=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof xe.getRootNode){const j=xe.getRootNode();return j instanceof ShadowRoot?j:null}return xe instanceof ShadowRoot?xe:xe.parentNode?he(xe.parentNode):null},te=()=>{},_e=()=>{const{jQuery:xe}=window;return xe&&!document.body.hasAttribute("data-bs-no-jquery")?xe:null},ne=[],le=()=>"rtl"===document.documentElement.dir,d=xe=>{var j;j=()=>{const ae=_e();if(ae){const De=xe.NAME,rt=ae.fn[De];ae.fn[De]=xe.jQueryInterface,ae.fn[De].Constructor=xe,ae.fn[De].noConflict=()=>(ae.fn[De]=rt,xe.jQueryInterface)}},"loading"===document.readyState?(ne.length||document.addEventListener("DOMContentLoaded",()=>{ne.forEach(ae=>ae())}),ne.push(j)):j()},N=xe=>{"function"==typeof xe&&xe()},A=(xe,j,ae=!0)=>{if(!ae)return void N(xe);const De=(Dt=>{if(!Dt)return 0;let{transitionDuration:_n,transitionDelay:Bn}=window.getComputedStyle(Dt);const Vn=Number.parseFloat(_n),Xn=Number.parseFloat(Bn);return Vn||Xn?(_n=_n.split(",")[0],Bn=Bn.split(",")[0],1e3*(Number.parseFloat(_n)+Number.parseFloat(Bn))):0})(j)+5;let rt=!1;const gt=({target:Dt})=>{Dt===j&&(rt=!0,j.removeEventListener(Gt,gt),N(xe))};j.addEventListener(Gt,gt),setTimeout(()=>{rt||xt(j)},De)},f=(xe,j,ae,De)=>{let rt=xe.indexOf(j);if(-1===rt)return xe[!ae&&De?xe.length-1:0];const gt=xe.length;return rt+=ae?1:-1,De&&(rt=(rt+gt)%gt),xe[Math.max(0,Math.min(rt,gt-1))]},b=/[^.]*(?=\..*)\.|.*/,m=/\..*/,_=/::\d+$/,n={};let g=1;const h={mouseenter:"mouseover",mouseleave:"mouseout"},s=/^(mouseenter|mouseleave)/i,u=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function o(xe,j){return j&&`${j}::${g++}`||xe.uidEvent||g++}function t(xe){const j=o(xe);return xe.uidEvent=j,n[j]=n[j]||{},n[j]}function r(xe,j,ae=null){const De=Object.keys(xe);for(let rt=0,gt=De.length;rtfunction(ar){if(!ar.relatedTarget||ar.relatedTarget!==ar.delegateTarget&&!ar.delegateTarget.contains(ar.relatedTarget))return ur.call(this,ar)};De?De=hr(De):ae=hr(ae)}const[gt,Dt,_n]=a(j,ae,De),Bn=t(xe),Vn=Bn[_n]||(Bn[_n]={}),Xn=r(Vn,Dt,gt?ae:null);if(Xn)return void(Xn.oneOff=Xn.oneOff&&rt);const On=o(Dt,j.replace(b,"")),Sr=gt?(hr=xe,ur=ae,ar=De,function mr(Hr){const Ar=hr.querySelectorAll(ur);for(let{target:wr}=Hr;wr&&wr!==this;wr=wr.parentNode)for(let Ir=Ar.length;Ir--;)if(Ar[Ir]===wr)return Hr.delegateTarget=wr,mr.oneOff&&E.off(hr,Hr.type,ur,ar),ar.apply(wr,[Hr]);return null}):function(hr,ur){return function ar(mr){return mr.delegateTarget=hr,ar.oneOff&&E.off(hr,mr.type,ur),ur.apply(hr,[mr])}}(xe,ae);var hr,ur,ar;Sr.delegationSelector=gt?ae:null,Sr.originalHandler=Dt,Sr.oneOff=rt,Sr.uidEvent=On,Vn[On]=Sr,xe.addEventListener(_n,Sr,gt)}function l(xe,j,ae,De,rt){const gt=r(j[ae],De,rt);gt&&(xe.removeEventListener(ae,gt,Boolean(rt)),delete j[ae][gt.uidEvent])}function w(xe){return xe=xe.replace(m,""),h[xe]||xe}const E={on(xe,j,ae,De){c(xe,j,ae,De,!1)},one(xe,j,ae,De){c(xe,j,ae,De,!0)},off(xe,j,ae,De){if("string"!=typeof j||!xe)return;const[rt,gt,Dt]=a(j,ae,De),_n=Dt!==j,Bn=t(xe),Vn=j.startsWith(".");if(void 0!==gt)return Bn&&Bn[Dt]?void l(xe,Bn,Dt,gt,rt?ae:null):void 0;Vn&&Object.keys(Bn).forEach(On=>{!function(Sr,hr,ur,ar){const mr=hr[ur]||{};Object.keys(mr).forEach(Hr=>{if(Hr.includes(ar)){const Ar=mr[Hr];l(Sr,hr,ur,Ar.originalHandler,Ar.delegationSelector)}})}(xe,Bn,On,j.slice(1))});const Xn=Bn[Dt]||{};Object.keys(Xn).forEach(On=>{const Sr=On.replace(_,"");if(!_n||j.includes(Sr)){const hr=Xn[On];l(xe,Bn,Dt,hr.originalHandler,hr.delegationSelector)}})},trigger(xe,j,ae){if("string"!=typeof j||!xe)return null;const De=_e(),rt=w(j),gt=j!==rt,Dt=u.has(rt);let _n,Bn=!0,Vn=!0,Xn=!1,On=null;return gt&&De&&(_n=De.Event(j,ae),De(xe).trigger(_n),Bn=!_n.isPropagationStopped(),Vn=!_n.isImmediatePropagationStopped(),Xn=_n.isDefaultPrevented()),Dt?(On=document.createEvent("HTMLEvents"),On.initEvent(rt,Bn,!0)):On=new CustomEvent(j,{bubbles:Bn,cancelable:!0}),void 0!==ae&&Object.keys(ae).forEach(Sr=>{Object.defineProperty(On,Sr,{get:()=>ae[Sr]})}),Xn&&On.preventDefault(),Vn&&xe.dispatchEvent(On),On.defaultPrevented&&void 0!==_n&&_n.preventDefault(),On}},C=new Map,z={set(xe,j,ae){C.has(xe)||C.set(xe,new Map);const De=C.get(xe);De.has(j)||0===De.size?De.set(j,ae):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(De.keys())[0]}.`)},get:(xe,j)=>C.has(xe)&&C.get(xe).get(j)||null,remove(xe,j){if(!C.has(xe))return;const ae=C.get(xe);ae.delete(j),0===ae.size&&C.delete(xe)}};class k{constructor(j){(j=Q(j))&&(this._element=j,z.set(this._element,this.constructor.DATA_KEY,this))}dispose(){z.remove(this._element,this.constructor.DATA_KEY),E.off(this._element,this.constructor.EVENT_KEY),Object.getOwnPropertyNames(this).forEach(j=>{this[j]=null})}_queueCallback(j,ae,De=!0){A(j,ae,De)}static getInstance(j){return z.get(Q(j),this.DATA_KEY)}static getOrCreateInstance(j,ae={}){return this.getInstance(j)||new this(j,"object"==typeof ae?ae:null)}static get VERSION(){return"5.1.3"}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}}const I=(xe,j="hide")=>{const De=xe.NAME;E.on(document,`click.dismiss${xe.EVENT_KEY}`,`[data-bs-dismiss="${De}"]`,function(rt){if(["A","AREA"].includes(this.tagName)&&rt.preventDefault(),y(this))return;const gt=At(this)||this.closest(`.${De}`);xe.getOrCreateInstance(gt)[j]()})};class V extends k{static get NAME(){return"alert"}close(){if(E.trigger(this._element,"close.bs.alert").defaultPrevented)return;this._element.classList.remove("show");const j=this._element.classList.contains("fade");this._queueCallback(()=>this._destroyElement(),this._element,j)}_destroyElement(){this._element.remove(),E.trigger(this._element,"closed.bs.alert"),this.dispose()}static jQueryInterface(j){return this.each(function(){const ae=V.getOrCreateInstance(this);if("string"==typeof j){if(void 0===ae[j]||j.startsWith("_")||"constructor"===j)throw new TypeError(`No method named "${j}"`);ae[j](this)}})}}I(V,"close"),d(V);const $='[data-bs-toggle="button"]';class oe extends k{static get NAME(){return"button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(j){return this.each(function(){const ae=oe.getOrCreateInstance(this);"toggle"===j&&ae[j]()})}}function ue(xe){return"true"===xe||"false"!==xe&&(xe===Number(xe).toString()?Number(xe):""===xe||"null"===xe?null:xe)}function Ae(xe){return xe.replace(/[A-Z]/g,j=>`-${j.toLowerCase()}`)}E.on(document,"click.bs.button.data-api",$,xe=>{xe.preventDefault();const j=xe.target.closest($);oe.getOrCreateInstance(j).toggle()}),d(oe);const X={setDataAttribute(xe,j,ae){xe.setAttribute(`data-bs-${Ae(j)}`,ae)},removeDataAttribute(xe,j){xe.removeAttribute(`data-bs-${Ae(j)}`)},getDataAttributes(xe){if(!xe)return{};const j={};return Object.keys(xe.dataset).filter(ae=>ae.startsWith("bs")).forEach(ae=>{let De=ae.replace(/^bs/,"");De=De.charAt(0).toLowerCase()+De.slice(1,De.length),j[De]=ue(xe.dataset[ae])}),j},getDataAttribute:(xe,j)=>ue(xe.getAttribute(`data-bs-${Ae(j)}`)),offset(xe){const j=xe.getBoundingClientRect();return{top:j.top+window.pageYOffset,left:j.left+window.pageXOffset}},position:xe=>({top:xe.offsetTop,left:xe.offsetLeft})},T={find:(xe,j=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(j,xe)),findOne:(xe,j=document.documentElement)=>Element.prototype.querySelector.call(j,xe),children:(xe,j)=>[].concat(...xe.children).filter(ae=>ae.matches(j)),parents(xe,j){const ae=[];let De=xe.parentNode;for(;De&&De.nodeType===Node.ELEMENT_NODE&&3!==De.nodeType;)De.matches(j)&&ae.push(De),De=De.parentNode;return ae},prev(xe,j){let ae=xe.previousElementSibling;for(;ae;){if(ae.matches(j))return[ae];ae=ae.previousElementSibling}return[]},next(xe,j){let ae=xe.nextElementSibling;for(;ae;){if(ae.matches(j))return[ae];ae=ae.nextElementSibling}return[]},focusableChildren(xe){const j=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map(ae=>`${ae}:not([tabindex^="-"])`).join(", ");return this.find(j,xe).filter(ae=>!y(ae)&&Pe(ae))}},D="carousel",M={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0,touch:!0},v={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean",touch:"boolean"},B="next",F="prev",q="left",L="right",Y={ArrowLeft:L,ArrowRight:q},se="slid.bs.carousel",Ee="active",Se=".active.carousel-item";class Ie extends k{constructor(j,ae){super(j),this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this.touchStartX=0,this.touchDeltaX=0,this._config=this._getConfig(ae),this._indicatorsElement=T.findOne(".carousel-indicators",this._element),this._touchSupported="ontouchstart"in document.documentElement||navigator.maxTouchPoints>0,this._pointerEvent=Boolean(window.PointerEvent),this._addEventListeners()}static get Default(){return M}static get NAME(){return D}next(){this._slide(B)}nextWhenVisible(){!document.hidden&&Pe(this._element)&&this.next()}prev(){this._slide(F)}pause(j){j||(this._isPaused=!0),T.findOne(".carousel-item-next, .carousel-item-prev",this._element)&&(xt(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null}cycle(j){j||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config&&this._config.interval&&!this._isPaused&&(this._updateInterval(),this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))}to(j){this._activeElement=T.findOne(Se,this._element);const ae=this._getItemIndex(this._activeElement);if(!(j>this._items.length-1||j<0)){if(!this._isSliding)return ae===j?(this.pause(),void this.cycle()):void this._slide(j>ae?B:F,this._items[j]);E.one(this._element,se,()=>this.to(j))}}_getConfig(j){return j={...M,...X.getDataAttributes(this._element),..."object"==typeof j?j:{}},je(D,j,v),j}_handleSwipe(){const j=Math.abs(this.touchDeltaX);if(j<=40)return;const ae=j/this.touchDeltaX;this.touchDeltaX=0,ae&&this._slide(ae>0?L:q)}_addEventListeners(){this._config.keyboard&&E.on(this._element,"keydown.bs.carousel",j=>this._keydown(j)),"hover"===this._config.pause&&(E.on(this._element,"mouseenter.bs.carousel",j=>this.pause(j)),E.on(this._element,"mouseleave.bs.carousel",j=>this.cycle(j))),this._config.touch&&this._touchSupported&&this._addTouchEventListeners()}_addTouchEventListeners(){const j=gt=>this._pointerEvent&&("pen"===gt.pointerType||"touch"===gt.pointerType),ae=gt=>{j(gt)?this.touchStartX=gt.clientX:this._pointerEvent||(this.touchStartX=gt.touches[0].clientX)},De=gt=>{this.touchDeltaX=gt.touches&>.touches.length>1?0:gt.touches[0].clientX-this.touchStartX},rt=gt=>{j(gt)&&(this.touchDeltaX=gt.clientX-this.touchStartX),this._handleSwipe(),"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout(Dt=>this.cycle(Dt),500+this._config.interval))};T.find(".carousel-item img",this._element).forEach(gt=>{E.on(gt,"dragstart.bs.carousel",Dt=>Dt.preventDefault())}),this._pointerEvent?(E.on(this._element,"pointerdown.bs.carousel",gt=>ae(gt)),E.on(this._element,"pointerup.bs.carousel",gt=>rt(gt)),this._element.classList.add("pointer-event")):(E.on(this._element,"touchstart.bs.carousel",gt=>ae(gt)),E.on(this._element,"touchmove.bs.carousel",gt=>De(gt)),E.on(this._element,"touchend.bs.carousel",gt=>rt(gt)))}_keydown(j){if(/input|textarea/i.test(j.target.tagName))return;const ae=Y[j.key];ae&&(j.preventDefault(),this._slide(ae))}_getItemIndex(j){return this._items=j&&j.parentNode?T.find(".carousel-item",j.parentNode):[],this._items.indexOf(j)}_getItemByOrder(j,ae){return f(this._items,ae,j===B,this._config.wrap)}_triggerSlideEvent(j,ae){const De=this._getItemIndex(j),rt=this._getItemIndex(T.findOne(Se,this._element));return E.trigger(this._element,"slide.bs.carousel",{relatedTarget:j,direction:ae,from:rt,to:De})}_setActiveIndicatorElement(j){if(this._indicatorsElement){const ae=T.findOne(".active",this._indicatorsElement);ae.classList.remove(Ee),ae.removeAttribute("aria-current");const De=T.find("[data-bs-target]",this._indicatorsElement);for(let rt=0;rt{E.trigger(this._element,se,{relatedTarget:Dt,direction:Sr,from:gt,to:_n})};this._element.classList.contains("slide")?(Dt.classList.add(On),rt.classList.add(Xn),Dt.classList.add(Xn),this._queueCallback(()=>{Dt.classList.remove(Xn,On),Dt.classList.add(Ee),rt.classList.remove(Ee,On,Xn),this._isSliding=!1,setTimeout(hr,0)},rt,!0)):(rt.classList.remove(Ee),Dt.classList.add(Ee),this._isSliding=!1,hr()),Bn&&this.cycle()}_directionToOrder(j){return[L,q].includes(j)?le()?j===q?F:B:j===q?B:F:j}_orderToDirection(j){return[B,F].includes(j)?le()?j===F?q:L:j===F?L:q:j}static carouselInterface(j,ae){const De=Ie.getOrCreateInstance(j,ae);let{_config:rt}=De;"object"==typeof ae&&(rt={...rt,...ae});const gt="string"==typeof ae?ae:rt.slide;if("number"==typeof ae)De.to(ae);else if("string"==typeof gt){if(void 0===De[gt])throw new TypeError(`No method named "${gt}"`);De[gt]()}else rt.interval&&rt.ride&&(De.pause(),De.cycle())}static jQueryInterface(j){return this.each(function(){Ie.carouselInterface(this,j)})}static dataApiClickHandler(j){const ae=At(this);if(!ae||!ae.classList.contains("carousel"))return;const De={...X.getDataAttributes(ae),...X.getDataAttributes(this)},rt=this.getAttribute("data-bs-slide-to");rt&&(De.interval=!1),Ie.carouselInterface(ae,De),rt&&Ie.getInstance(ae).to(rt),j.preventDefault()}}E.on(document,"click.bs.carousel.data-api","[data-bs-slide], [data-bs-slide-to]",Ie.dataApiClickHandler),E.on(window,"load.bs.carousel.data-api",()=>{const xe=T.find('[data-bs-ride="carousel"]');for(let j=0,ae=xe.length;jVn===this._element);null!==_n&&Bn.length&&(this._selector=_n,this._triggerArray.push(Dt))}this._initializeChildren(),this._config.parent||this._addAriaAndCollapsedClass(this._triggerArray,this._isShown()),this._config.toggle&&this.toggle()}static get Default(){return Je}static get NAME(){return Qe}toggle(){this._isShown()?this.hide():this.show()}show(){if(this._isTransitioning||this._isShown())return;let j,ae=[];if(this._config.parent){const Dt=T.find(nt,this._config.parent);ae=T.find(".collapse.show, .collapse.collapsing",this._config.parent).filter(_n=>!Dt.includes(_n))}const De=T.findOne(this._selector);if(ae.length){const Dt=ae.find(_n=>De!==_n);if(j=Dt?Tn.getInstance(Dt):null,j&&j._isTransitioning)return}if(E.trigger(this._element,"show.bs.collapse").defaultPrevented)return;ae.forEach(Dt=>{De!==Dt&&Tn.getOrCreateInstance(Dt,{toggle:!1}).hide(),j||z.set(Dt,"bs.collapse",null)});const rt=this._getDimension();this._element.classList.remove(qt),this._element.classList.add(tt),this._element.style[rt]=0,this._addAriaAndCollapsedClass(this._triggerArray,!0),this._isTransitioning=!0;const gt=`scroll${rt[0].toUpperCase()+rt.slice(1)}`;this._queueCallback(()=>{this._isTransitioning=!1,this._element.classList.remove(tt),this._element.classList.add(qt,$t),this._element.style[rt]="",E.trigger(this._element,"shown.bs.collapse")},this._element,!0),this._element.style[rt]=`${this._element[gt]}px`}hide(){if(this._isTransitioning||!this._isShown()||E.trigger(this._element,"hide.bs.collapse").defaultPrevented)return;const j=this._getDimension();this._element.style[j]=`${this._element.getBoundingClientRect()[j]}px`,this._element.classList.add(tt),this._element.classList.remove(qt,$t);const ae=this._triggerArray.length;for(let De=0;De{this._isTransitioning=!1,this._element.classList.remove(tt),this._element.classList.add(qt),E.trigger(this._element,"hidden.bs.collapse")},this._element,!0)}_isShown(j=this._element){return j.classList.contains($t)}_getConfig(j){return(j={...Je,...X.getDataAttributes(this._element),...j}).toggle=Boolean(j.toggle),j.parent=Q(j.parent),je(Qe,j,ut),j}_getDimension(){return this._element.classList.contains("collapse-horizontal")?"width":"height"}_initializeChildren(){if(!this._config.parent)return;const j=T.find(nt,this._config.parent);T.find(Yt,this._config.parent).filter(ae=>!j.includes(ae)).forEach(ae=>{const De=At(ae);De&&this._addAriaAndCollapsedClass([ae],this._isShown(De))})}_addAriaAndCollapsedClass(j,ae){j.length&&j.forEach(De=>{ae?De.classList.remove(at):De.classList.add(at),De.setAttribute("aria-expanded",ae)})}static jQueryInterface(j){return this.each(function(){const ae={};"string"==typeof j&&/show|hide/.test(j)&&(ae.toggle=!1);const De=Tn.getOrCreateInstance(this,ae);if("string"==typeof j){if(void 0===De[j])throw new TypeError(`No method named "${j}"`);De[j]()}})}}E.on(document,"click.bs.collapse.data-api",Yt,function(xe){("A"===xe.target.tagName||xe.delegateTarget&&"A"===xe.delegateTarget.tagName)&&xe.preventDefault();const j=H(this);T.find(j).forEach(ae=>{Tn.getOrCreateInstance(ae,{toggle:!1}).toggle()})}),d(Tn);var J="top",O="bottom",W="right",ee="left",ve="auto",He=[J,O,W,ee],ht="start",st="end",Jt="clippingParents",on="viewport",Ht="popper",wn="reference",sn=He.reduce(function(xe,j){return xe.concat([j+"-"+ht,j+"-"+st])},[]),Sn=[].concat(He,[ve]).reduce(function(xe,j){return xe.concat([j,j+"-"+ht,j+"-"+st])},[]),fr="beforeRead",Rt="afterRead",vr="beforeMain",Le="afterMain",et="beforeWrite",Ze="afterWrite",Ct=[fr,"read",Rt,vr,"main",Le,et,"write",Ze];function Nt(xe){return xe?(xe.nodeName||"").toLowerCase():null}function Bt(xe){if(null==xe)return window;if("[object Window]"!==xe.toString()){var j=xe.ownerDocument;return j&&j.defaultView||window}return xe}function ln(xe){return xe instanceof Bt(xe).Element||xe instanceof Element}function Ot(xe){return xe instanceof Bt(xe).HTMLElement||xe instanceof HTMLElement}function mn(xe){return typeof ShadowRoot<"u"&&(xe instanceof Bt(xe).ShadowRoot||xe instanceof ShadowRoot)}const kn={name:"applyStyles",enabled:!0,phase:"write",fn:function(xe){var j=xe.state;Object.keys(j.elements).forEach(function(ae){var De=j.styles[ae]||{},rt=j.attributes[ae]||{},gt=j.elements[ae];Ot(gt)&&Nt(gt)&&(Object.assign(gt.style,De),Object.keys(rt).forEach(function(Dt){var _n=rt[Dt];!1===_n?gt.removeAttribute(Dt):gt.setAttribute(Dt,!0===_n?"":_n)}))})},effect:function(xe){var j=xe.state,ae={popper:{position:j.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(j.elements.popper.style,ae.popper),j.styles=ae,j.elements.arrow&&Object.assign(j.elements.arrow.style,ae.arrow),function(){Object.keys(j.elements).forEach(function(De){var rt=j.elements[De],gt=j.attributes[De]||{},Dt=Object.keys(j.styles.hasOwnProperty(De)?j.styles[De]:ae[De]).reduce(function(_n,Bn){return _n[Bn]="",_n},{});Ot(rt)&&Nt(rt)&&(Object.assign(rt.style,Dt),Object.keys(gt).forEach(function(_n){rt.removeAttribute(_n)}))})}},requires:["computeStyles"]};function vn(xe){return xe.split("-")[0]}function In(xe,j){var ae=xe.getBoundingClientRect();return{width:ae.width/1,height:ae.height/1,top:ae.top/1,right:ae.right/1,bottom:ae.bottom/1,left:ae.left/1,x:ae.left/1,y:ae.top/1}}function pr(xe){var j=In(xe),ae=xe.offsetWidth,De=xe.offsetHeight;return Math.abs(j.width-ae)<=1&&(ae=j.width),Math.abs(j.height-De)<=1&&(De=j.height),{x:xe.offsetLeft,y:xe.offsetTop,width:ae,height:De}}function Nn(xe,j){var ae=j.getRootNode&&j.getRootNode();if(xe.contains(j))return!0;if(ae&&mn(ae)){var De=j;do{if(De&&xe.isSameNode(De))return!0;De=De.parentNode||De.host}while(De)}return!1}function zn(xe){return Bt(xe).getComputedStyle(xe)}function Br(xe){return["table","td","th"].indexOf(Nt(xe))>=0}function Rn(xe){return((ln(xe)?xe.ownerDocument:xe.document)||window.document).documentElement}function Qn(xe){return"html"===Nt(xe)?xe:xe.assignedSlot||xe.parentNode||(mn(xe)?xe.host:null)||Rn(xe)}function Wr(xe){return Ot(xe)&&"fixed"!==zn(xe).position?xe.offsetParent:null}function Kn(xe){for(var j=Bt(xe),ae=Wr(xe);ae&&Br(ae)&&"static"===zn(ae).position;)ae=Wr(ae);return ae&&("html"===Nt(ae)||"body"===Nt(ae)&&"static"===zn(ae).position)?j:ae||function(De){var rt=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&Ot(De)&&"fixed"===zn(De).position)return null;for(var gt=Qn(De);Ot(gt)&&["html","body"].indexOf(Nt(gt))<0;){var Dt=zn(gt);if("none"!==Dt.transform||"none"!==Dt.perspective||"paint"===Dt.contain||-1!==["transform","perspective"].indexOf(Dt.willChange)||rt&&"filter"===Dt.willChange||rt&&Dt.filter&&"none"!==Dt.filter)return gt;gt=gt.parentNode}return null}(xe)||j}function Zn(xe){return["top","bottom"].indexOf(xe)>=0?"x":"y"}var Kr=Math.max,Gn=Math.min,er=Math.round;function ct(xe,j,ae){return Kr(xe,Gn(j,ae))}function me(xe){return Object.assign({},{top:0,right:0,bottom:0,left:0},xe)}function ot(xe,j){return j.reduce(function(ae,De){return ae[De]=xe,ae},{})}const ft={name:"arrow",enabled:!0,phase:"main",fn:function(xe){var j,Pr,$r,ae=xe.state,De=xe.name,rt=xe.options,gt=ae.elements.arrow,Dt=ae.modifiersData.popperOffsets,_n=vn(ae.placement),Bn=Zn(_n),Vn=[ee,W].indexOf(_n)>=0?"height":"width";if(gt&&Dt){var Xn=($r=ae,me("number"!=typeof(Pr="function"==typeof(Pr=rt.padding)?Pr(Object.assign({},$r.rects,{placement:$r.placement})):Pr)?Pr:ot(Pr,He))),On=pr(gt),Sr="y"===Bn?J:ee,hr="y"===Bn?O:W,ur=ae.rects.reference[Vn]+ae.rects.reference[Bn]-Dt[Bn]-ae.rects.popper[Vn],ar=Dt[Bn]-ae.rects.reference[Bn],mr=Kn(gt),Hr=mr?"y"===Bn?mr.clientHeight||0:mr.clientWidth||0:0,Rr=Hr/2-On[Vn]/2+(ur/2-ar/2),Mr=ct(Xn[Sr],Rr,Hr-On[Vn]-Xn[hr]);ae.modifiersData[De]=((j={})[Bn]=Mr,j.centerOffset=Mr-Rr,j)}},effect:function(xe){var j=xe.state,ae=xe.options.element,De=void 0===ae?"[data-popper-arrow]":ae;null!=De&&("string"!=typeof De||(De=j.elements.popper.querySelector(De)))&&Nn(j.elements.popper,De)&&(j.elements.arrow=De)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function be(xe){return xe.split("-")[1]}var dt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Zr(xe){var j,bi,Ri,oi,ae=xe.popper,De=xe.popperRect,rt=xe.placement,gt=xe.variation,Dt=xe.offsets,_n=xe.position,Bn=xe.gpuAcceleration,Vn=xe.adaptive,Xn=xe.roundOffsets,On=!0===Xn?(Ri=(bi=Dt).y,oi=window.devicePixelRatio||1,{x:er(er(bi.x*oi)/oi)||0,y:er(er(Ri*oi)/oi)||0}):"function"==typeof Xn?Xn(Dt):Dt,Sr=On.x,hr=void 0===Sr?0:Sr,ur=On.y,ar=void 0===ur?0:ur,mr=Dt.hasOwnProperty("x"),Hr=Dt.hasOwnProperty("y"),Ar=ee,wr=J,Ir=window;if(Vn){var Rr=Kn(ae),Mr="clientHeight",Dr="clientWidth";Rr===Bt(ae)&&"static"!==zn(Rr=Rn(ae)).position&&"absolute"===_n&&(Mr="scrollHeight",Dr="scrollWidth"),rt!==J&&(rt!==ee&&rt!==W||gt!==st)||(wr=O,ar-=Rr[Mr]-De.height,ar*=Bn?1:-1),rt!==ee&&(rt!==J&&rt!==O||gt!==st)||(Ar=W,hr-=Rr[Dr]-De.width,hr*=Bn?1:-1)}var Pr,$r=Object.assign({position:_n},Vn&&dt);return Object.assign({},$r,Bn?((Pr={})[wr]=Hr?"0":"",Pr[Ar]=mr?"0":"",Pr.transform=(Ir.devicePixelRatio||1)<=1?"translate("+hr+"px, "+ar+"px)":"translate3d("+hr+"px, "+ar+"px, 0)",Pr):((j={})[wr]=Hr?ar+"px":"",j[Ar]=mr?hr+"px":"",j.transform="",j))}const ri={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(xe){var j=xe.state,ae=xe.options,De=ae.gpuAcceleration,rt=void 0===De||De,gt=ae.adaptive,Dt=void 0===gt||gt,_n=ae.roundOffsets,Bn=void 0===_n||_n,Vn={placement:vn(j.placement),variation:be(j.placement),popper:j.elements.popper,popperRect:j.rects.popper,gpuAcceleration:rt};null!=j.modifiersData.popperOffsets&&(j.styles.popper=Object.assign({},j.styles.popper,Zr(Object.assign({},Vn,{offsets:j.modifiersData.popperOffsets,position:j.options.strategy,adaptive:Dt,roundOffsets:Bn})))),null!=j.modifiersData.arrow&&(j.styles.arrow=Object.assign({},j.styles.arrow,Zr(Object.assign({},Vn,{offsets:j.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:Bn})))),j.attributes.popper=Object.assign({},j.attributes.popper,{"data-popper-placement":j.placement})},data:{}};var si={passive:!0};const cr={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(xe){var j=xe.state,ae=xe.instance,De=xe.options,rt=De.scroll,gt=void 0===rt||rt,Dt=De.resize,_n=void 0===Dt||Dt,Bn=Bt(j.elements.popper),Vn=[].concat(j.scrollParents.reference,j.scrollParents.popper);return gt&&Vn.forEach(function(Xn){Xn.addEventListener("scroll",ae.update,si)}),_n&&Bn.addEventListener("resize",ae.update,si),function(){gt&&Vn.forEach(function(Xn){Xn.removeEventListener("scroll",ae.update,si)}),_n&&Bn.removeEventListener("resize",ae.update,si)}},data:{}};var yi={left:"right",right:"left",bottom:"top",top:"bottom"};function Jr(xe){return xe.replace(/left|right|bottom|top/g,function(j){return yi[j]})}var zr={start:"end",end:"start"};function ui(xe){return xe.replace(/start|end/g,function(j){return zr[j]})}function ai(xe){var j=Bt(xe);return{scrollLeft:j.pageXOffset,scrollTop:j.pageYOffset}}function li(xe){return In(Rn(xe)).left+ai(xe).scrollLeft}function Vr(xe){var j=zn(xe);return/auto|scroll|overlay|hidden/.test(j.overflow+j.overflowY+j.overflowX)}function Fr(xe){return["html","body","#document"].indexOf(Nt(xe))>=0?xe.ownerDocument.body:Ot(xe)&&Vr(xe)?xe:Fr(Qn(xe))}function Un(xe,j){var ae;void 0===j&&(j=[]);var De=Fr(xe),rt=De===(null==(ae=xe.ownerDocument)?void 0:ae.body),gt=Bt(De),Dt=rt?[gt].concat(gt.visualViewport||[],Vr(De)?De:[]):De,_n=j.concat(Dt);return rt?_n:_n.concat(Un(Qn(Dt)))}function We(xe){return Object.assign({},xe,{left:xe.x,top:xe.y,right:xe.x+xe.width,bottom:xe.y+xe.height})}function Mn(xe,j){return j===on?We((De=Bt(ae=xe),Dt=(rt=Rn(ae)).clientWidth,_n=rt.clientHeight,Bn=0,Vn=0,(gt=De.visualViewport)&&(Dt=gt.width,_n=gt.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(Bn=gt.offsetLeft,Vn=gt.offsetTop)),{width:Dt,height:_n,x:Bn+li(ae),y:Vn})):Ot(j)?function(ae){var De=In(ae);return De.top=De.top+ae.clientTop,De.left=De.left+ae.clientLeft,De.bottom=De.top+ae.clientHeight,De.right=De.left+ae.clientWidth,De.width=ae.clientWidth,De.height=ae.clientHeight,De.x=De.left,De.y=De.top,De}(j):We(function(ae){var De,rt=Rn(ae),gt=ai(ae),Dt=null==(De=ae.ownerDocument)?void 0:De.body,_n=Kr(rt.scrollWidth,rt.clientWidth,Dt?Dt.scrollWidth:0,Dt?Dt.clientWidth:0),Bn=Kr(rt.scrollHeight,rt.clientHeight,Dt?Dt.scrollHeight:0,Dt?Dt.clientHeight:0),Vn=-gt.scrollLeft+li(ae),Xn=-gt.scrollTop;return"rtl"===zn(Dt||rt).direction&&(Vn+=Kr(rt.clientWidth,Dt?Dt.clientWidth:0)-_n),{width:_n,height:Bn,x:Vn,y:Xn}}(Rn(xe)));var ae,De,rt,gt,Dt,_n,Bn,Vn}function Yn(xe){var j,ae=xe.reference,De=xe.element,rt=xe.placement,gt=rt?vn(rt):null,Dt=rt?be(rt):null,_n=ae.x+ae.width/2-De.width/2,Bn=ae.y+ae.height/2-De.height/2;switch(gt){case J:j={x:_n,y:ae.y-De.height};break;case O:j={x:_n,y:ae.y+ae.height};break;case W:j={x:ae.x+ae.width,y:Bn};break;case ee:j={x:ae.x-De.width,y:Bn};break;default:j={x:ae.x,y:ae.y}}var Vn=gt?Zn(gt):null;if(null!=Vn){var Xn="y"===Vn?"height":"width";switch(Dt){case ht:j[Vn]=j[Vn]-(ae[Xn]/2-De[Xn]/2);break;case st:j[Vn]=j[Vn]+(ae[Xn]/2-De[Xn]/2)}}return j}function Cn(xe,j){void 0===j&&(j={});var xi,Ri,oi,Xr,ho,Ci,go,Yi,Ei,De=j.placement,rt=void 0===De?xe.placement:De,gt=j.boundary,Dt=void 0===gt?Jt:gt,_n=j.rootBoundary,Bn=void 0===_n?on:_n,Vn=j.elementContext,Xn=void 0===Vn?Ht:Vn,On=j.altBoundary,Sr=void 0!==On&&On,hr=j.padding,ur=void 0===hr?0:hr,ar=me("number"!=typeof ur?ur:ot(ur,He)),Hr=xe.rects.popper,Ar=xe.elements[Sr?Xn===Ht?wn:Ht:Xn],wr=(xi=ln(Ar)?Ar:Ar.contextElement||Rn(xe.elements.popper),oi=Bn,go="clippingParents"===(Ri=Dt)?(ho=Un(Qn(Xr=xi)),ln(Ci=["absolute","fixed"].indexOf(zn(Xr).position)>=0&&Ot(Xr)?Kn(Xr):Xr)?ho.filter(function(Si){return ln(Si)&&Nn(Si,Ci)&&"body"!==Nt(Si)}):[]):[].concat(Ri),Ei=(Yi=[].concat(go,[oi])).reduce(function(Xr,ho){var Ci=Mn(xi,ho);return Xr.top=Kr(Ci.top,Xr.top),Xr.right=Gn(Ci.right,Xr.right),Xr.bottom=Gn(Ci.bottom,Xr.bottom),Xr.left=Kr(Ci.left,Xr.left),Xr},Mn(xi,Yi[0])),Ei.width=Ei.right-Ei.left,Ei.height=Ei.bottom-Ei.top,Ei.x=Ei.left,Ei.y=Ei.top,Ei),Ir=In(xe.elements.reference),Rr=Yn({reference:Ir,element:Hr,strategy:"absolute",placement:rt}),Mr=We(Object.assign({},Hr,Rr)),Dr=Xn===Ht?Mr:Ir,Pr={top:wr.top-Dr.top+ar.top,bottom:Dr.bottom-wr.bottom+ar.bottom,left:wr.left-Dr.left+ar.left,right:Dr.right-wr.right+ar.right},$r=xe.modifiersData.offset;if(Xn===Ht&&$r){var bi=$r[rt];Object.keys(Pr).forEach(function(xi){var Ri=[W,O].indexOf(xi)>=0?1:-1,oi=[J,O].indexOf(xi)>=0?"y":"x";Pr[xi]+=bi[oi]*Ri})}return Pr}const Er={name:"flip",enabled:!0,phase:"main",fn:function(xe){var j=xe.state,ae=xe.options,De=xe.name;if(!j.modifiersData[De]._skip){for(var rt=ae.mainAxis,gt=void 0===rt||rt,Dt=ae.altAxis,_n=void 0===Dt||Dt,Bn=ae.fallbackPlacements,Vn=ae.padding,Xn=ae.boundary,On=ae.rootBoundary,Sr=ae.altBoundary,hr=ae.flipVariations,ur=void 0===hr||hr,ar=ae.allowedAutoPlacements,mr=j.options.placement,Hr=vn(mr),Ar=Bn||(Hr!==mr&&ur?function(Si){if(vn(Si)===ve)return[];var Oi=Jr(Si);return[ui(Si),Oi,ui(Oi)]}(mr):[Jr(mr)]),wr=[mr].concat(Ar).reduce(function(Si,Oi){return Si.concat(vn(Oi)===ve?function Jn(xe,j){void 0===j&&(j={});var rt=j.boundary,gt=j.rootBoundary,Dt=j.padding,_n=j.flipVariations,Bn=j.allowedAutoPlacements,Vn=void 0===Bn?Sn:Bn,Xn=be(j.placement),On=Xn?_n?sn:sn.filter(function(ur){return be(ur)===Xn}):He,Sr=On.filter(function(ur){return Vn.indexOf(ur)>=0});0===Sr.length&&(Sr=On);var hr=Sr.reduce(function(ur,ar){return ur[ar]=Cn(xe,{placement:ar,boundary:rt,rootBoundary:gt,padding:Dt})[vn(ar)],ur},{});return Object.keys(hr).sort(function(ur,ar){return hr[ur]-hr[ar]})}(j,{placement:Oi,boundary:Xn,rootBoundary:On,padding:Vn,flipVariations:ur,allowedAutoPlacements:ar}):Oi)},[]),Ir=j.rects.reference,Rr=j.rects.popper,Mr=new Map,Dr=!0,Pr=wr[0],$r=0;$r=0,go=oi?"width":"height",Yi=Cn(j,{placement:bi,boundary:Xn,rootBoundary:On,altBoundary:Sr,padding:Vn}),Mi=oi?Ri?W:ee:Ri?O:J;Ir[go]>Rr[go]&&(Mi=Jr(Mi));var Ei=Jr(Mi),Xr=[];if(gt&&Xr.push(Yi[xi]<=0),_n&&Xr.push(Yi[Mi]<=0,Yi[Ei]<=0),Xr.every(function(Si){return Si})){Pr=bi,Dr=!1;break}Mr.set(bi,Xr)}if(Dr)for(var ho=function(Si){var Oi=wr.find(function(To){var uo=Mr.get(To);if(uo)return uo.slice(0,Si).every(function(mo){return mo})});if(Oi)return Pr=Oi,"break"},Ci=ur?3:1;Ci>0&&"break"!==ho(Ci);Ci--);j.placement!==Pr&&(j.modifiersData[De]._skip=!0,j.placement=Pr,j.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Gr(xe,j,ae){return void 0===ae&&(ae={x:0,y:0}),{top:xe.top-j.height-ae.y,right:xe.right-j.width+ae.x,bottom:xe.bottom-j.height+ae.y,left:xe.left-j.width-ae.x}}function ci(xe){return[J,W,O,ee].some(function(j){return xe[j]>=0})}const dr={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(xe){var j=xe.state,ae=xe.name,De=j.rects.reference,rt=j.rects.popper,gt=j.modifiersData.preventOverflow,Dt=Cn(j,{elementContext:"reference"}),_n=Cn(j,{altBoundary:!0}),Bn=Gr(Dt,De),Vn=Gr(_n,rt,gt),Xn=ci(Bn),On=ci(Vn);j.modifiersData[ae]={referenceClippingOffsets:Bn,popperEscapeOffsets:Vn,isReferenceHidden:Xn,hasPopperEscaped:On},j.attributes.popper=Object.assign({},j.attributes.popper,{"data-popper-reference-hidden":Xn,"data-popper-escaped":On})}},Qr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(xe){var j=xe.state,De=xe.name,rt=xe.options.offset,gt=void 0===rt?[0,0]:rt,Dt=Sn.reduce(function(Xn,On){return Xn[On]=(hr=j.rects,ur=gt,ar=vn(Sr=On),mr=[ee,J].indexOf(ar)>=0?-1:1,Ar=(Ar=(Hr="function"==typeof ur?ur(Object.assign({},hr,{placement:Sr})):ur)[0])||0,wr=((wr=Hr[1])||0)*mr,[ee,W].indexOf(ar)>=0?{x:wr,y:Ar}:{x:Ar,y:wr}),Xn;var Sr,hr,ur,ar,mr,Hr,Ar,wr},{}),_n=Dt[j.placement],Vn=_n.y;null!=j.modifiersData.popperOffsets&&(j.modifiersData.popperOffsets.x+=_n.x,j.modifiersData.popperOffsets.y+=Vn),j.modifiersData[De]=Dt}},di={name:"popperOffsets",enabled:!0,phase:"read",fn:function(xe){var j=xe.state;j.modifiersData[xe.name]=Yn({reference:j.rects.reference,element:j.rects.popper,strategy:"absolute",placement:j.placement})},data:{}},hi={name:"preventOverflow",enabled:!0,phase:"main",fn:function(xe){var j=xe.state,ae=xe.options,De=xe.name,rt=ae.mainAxis,gt=void 0===rt||rt,Dt=ae.altAxis,_n=void 0!==Dt&&Dt,Sr=ae.tether,hr=void 0===Sr||Sr,ur=ae.tetherOffset,ar=void 0===ur?0:ur,mr=Cn(j,{boundary:ae.boundary,rootBoundary:ae.rootBoundary,padding:ae.padding,altBoundary:ae.altBoundary}),Hr=vn(j.placement),Ar=be(j.placement),wr=!Ar,Ir=Zn(Hr),Rr="x"===Ir?"y":"x",Mr=j.modifiersData.popperOffsets,Dr=j.rects.reference,Pr=j.rects.popper,$r="function"==typeof ar?ar(Object.assign({},j.rects,{placement:j.placement})):ar,bi={x:0,y:0};if(Mr){if(gt||_n){var xi="y"===Ir?J:ee,Ri="y"===Ir?O:W,oi="y"===Ir?"height":"width",go=Mr[Ir],Yi=Mr[Ir]+mr[xi],Mi=Mr[Ir]-mr[Ri],Ei=hr?-Pr[oi]/2:0,Xr=Ar===ht?Dr[oi]:Pr[oi],ho=Ar===ht?-Pr[oi]:-Dr[oi],Ci=j.elements.arrow,Si=hr&&Ci?pr(Ci):{width:0,height:0},Oi=j.modifiersData["arrow#persistent"]?j.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},To=Oi[xi],uo=Oi[Ri],mo=ct(0,Dr[oi],Si[oi]),ss=wr?Dr[oi]/2-Ei-mo-To-$r:Xr-mo-To-$r,as=wr?-Dr[oi]/2+Ei+mo+uo+$r:ho+mo+uo+$r,Io=j.elements.arrow&&Kn(j.elements.arrow),xo=j.modifiersData.offset?j.modifiersData.offset[j.placement][Ir]:0,$o=Mr[Ir]+ss-xo-(Io?"y"===Ir?Io.clientTop||0:Io.clientLeft||0:0),cs=Mr[Ir]+as-xo;if(gt){var Ro=ct(hr?Gn(Yi,$o):Yi,go,hr?Kr(Mi,cs):Mi);Mr[Ir]=Ro,bi[Ir]=Ro-go}if(_n){var Mo=Mr[Rr],vo=Mo+mr["x"===Ir?J:ee],lo=Mo-mr["x"===Ir?O:W],yo=ct(hr?Gn(vo,$o):vo,Mo,hr?Kr(lo,cs):lo);Mr[Rr]=yo,bi[Rr]=yo-Mo}}j.modifiersData[De]=bi}},requiresIfExists:["offset"]};function Ur(xe,j,ae){void 0===ae&&(ae=!1);var De=Ot(j);Ot(j)&&j.getBoundingClientRect();var rt,gt,Dt=Rn(j),_n=In(xe),Bn={scrollLeft:0,scrollTop:0},Vn={x:0,y:0};return(De||!De&&!ae)&&(("body"!==Nt(j)||Vr(Dt))&&(Bn=(rt=j)!==Bt(rt)&&Ot(rt)?{scrollLeft:(gt=rt).scrollLeft,scrollTop:gt.scrollTop}:ai(rt)),Ot(j)?((Vn=In(j)).x+=j.clientLeft,Vn.y+=j.clientTop):Dt&&(Vn.x=li(Dt))),{x:_n.left+Bn.scrollLeft-Vn.x,y:_n.top+Bn.scrollTop-Vn.y,width:_n.width,height:_n.height}}function to(xe){var j=new Map,ae=new Set,De=[];function rt(gt){ae.add(gt.name),[].concat(gt.requires||[],gt.requiresIfExists||[]).forEach(function(Dt){if(!ae.has(Dt)){var _n=j.get(Dt);_n&&rt(_n)}}),De.push(gt)}return xe.forEach(function(gt){j.set(gt.name,gt)}),xe.forEach(function(gt){ae.has(gt.name)||rt(gt)}),De}var P={placement:"bottom",modifiers:[],strategy:"absolute"};function Z(){for(var xe=arguments.length,j=new Array(xe),ae=0;aeE.on(De,"mouseover",te)),this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.add(It),this._element.classList.add(It),E.trigger(this._element,"shown.bs.dropdown",j)}hide(){!y(this._element)&&this._isShown(this._menu)&&this._completeHide({relatedTarget:this._element})}dispose(){this._popper&&this._popper.destroy(),super.dispose()}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update()}_completeHide(j){E.trigger(this._element,"hide.bs.dropdown",j).defaultPrevented||("ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach(ae=>E.off(ae,"mouseover",te)),this._popper&&this._popper.destroy(),this._menu.classList.remove(It),this._element.classList.remove(It),this._element.setAttribute("aria-expanded","false"),X.removeDataAttribute(this._menu,"popper"),E.trigger(this._element,"hidden.bs.dropdown",j))}_getConfig(j){if(j={...this.constructor.Default,...X.getDataAttributes(this._element),...j},je(Ue,j,this.constructor.DefaultType),"object"==typeof j.reference&&!kt(j.reference)&&"function"!=typeof j.reference.getBoundingClientRect)throw new TypeError(`${Ue.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);return j}_createPopper(j){if(void 0===Ce)throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");let ae=this._element;"parent"===this._config.reference?ae=j:kt(this._config.reference)?ae=Q(this._config.reference):"object"==typeof this._config.reference&&(ae=this._config.reference);const De=this._getPopperConfig(),rt=De.modifiers.find(gt=>"applyStyles"===gt.name&&!1===gt.enabled);this._popper=Me(ae,this._menu,De),rt&&X.setDataAttribute(this._menu,"popper","static")}_isShown(j=this._element){return j.classList.contains(It)}_getMenuElement(){return T.next(this._element,Pt)[0]}_getPlacement(){const j=this._element.parentNode;if(j.classList.contains("dropend"))return xr;if(j.classList.contains("dropstart"))return kr;const ae="end"===getComputedStyle(this._menu).getPropertyValue("--bs-position").trim();return j.classList.contains("dropup")?ae?tn:un:ae?Hn:an}_detectNavbar(){return null!==this._element.closest(".navbar")}_getOffset(){const{offset:j}=this._config;return"string"==typeof j?j.split(",").map(ae=>Number.parseInt(ae,10)):"function"==typeof j?ae=>j(ae,this._element):j}_getPopperConfig(){const j={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return"static"===this._config.display&&(j.modifiers=[{name:"applyStyles",enabled:!1}]),{...j,..."function"==typeof this._config.popperConfig?this._config.popperConfig(j):this._config.popperConfig}}_selectMenuItem({key:j,target:ae}){const De=T.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",this._menu).filter(Pe);De.length&&f(De,ae,j===lt,!De.includes(ae)).focus()}static jQueryInterface(j){return this.each(function(){const ae=or.getOrCreateInstance(this,j);if("string"==typeof j){if(void 0===ae[j])throw new TypeError(`No method named "${j}"`);ae[j]()}})}static clearMenus(j){if(j&&(2===j.button||"keyup"===j.type&&"Tab"!==j.key))return;const ae=T.find(jt);for(let De=0,rt=ae.length;Deae+j),this._setElementAttributes(fi,"paddingRight",ae=>ae+j),this._setElementAttributes(Fe,"marginRight",ae=>ae-j)}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(j,ae,De){const rt=this.getWidth();this._applyManipulationCallback(j,gt=>{if(gt!==this._element&&window.innerWidth>gt.clientWidth+rt)return;this._saveInitialAttribute(gt,ae);const Dt=window.getComputedStyle(gt)[ae];gt.style[ae]=`${De(Number.parseFloat(Dt))}px`})}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,"paddingRight"),this._resetElementAttributes(fi,"paddingRight"),this._resetElementAttributes(Fe,"marginRight")}_saveInitialAttribute(j,ae){const De=j.style[ae];De&&X.setDataAttribute(j,ae,De)}_resetElementAttributes(j,ae){this._applyManipulationCallback(j,De=>{const rt=X.getDataAttribute(De,ae);void 0===rt?De.style.removeProperty(ae):(X.removeDataAttribute(De,ae),De.style[ae]=rt)})}_applyManipulationCallback(j,ae){kt(j)?ae(j):T.find(j,this._element).forEach(ae)}isOverflowing(){return this.getWidth()>0}}const Vt={className:"modal-backdrop",isVisible:!0,isAnimated:!1,rootElement:"body",clickCallback:null},cn={className:"string",isVisible:"boolean",isAnimated:"boolean",rootElement:"(element|string)",clickCallback:"(function|null)"},Ke="mousedown.bs.backdrop";class Re{constructor(j){this._config=this._getConfig(j),this._isAppended=!1,this._element=null}show(j){this._config.isVisible?(this._append(),this._config.isAnimated&&this._getElement(),this._getElement().classList.add("show"),this._emulateAnimation(()=>{N(j)})):N(j)}hide(j){this._config.isVisible?(this._getElement().classList.remove("show"),this._emulateAnimation(()=>{this.dispose(),N(j)})):N(j)}_getElement(){if(!this._element){const j=document.createElement("div");j.className=this._config.className,this._config.isAnimated&&j.classList.add("fade"),this._element=j}return this._element}_getConfig(j){return(j={...Vt,..."object"==typeof j?j:{}}).rootElement=Q(j.rootElement),je("backdrop",j,cn),j}_append(){this._isAppended||(this._config.rootElement.append(this._getElement()),E.on(this._getElement(),Ke,()=>{N(this._config.clickCallback)}),this._isAppended=!0)}dispose(){this._isAppended&&(E.off(this._element,Ke),this._element.remove(),this._isAppended=!1)}_emulateAnimation(j){A(j,this._getElement(),this._config.isAnimated)}}const bt={trapElement:null,autofocus:!0},Et={trapElement:"element",autofocus:"boolean"},nn=".bs.focustrap",xn="backward";class fn{constructor(j){this._config=this._getConfig(j),this._isActive=!1,this._lastTabNavDirection=null}activate(){const{trapElement:j,autofocus:ae}=this._config;this._isActive||(ae&&j.focus(),E.off(document,nn),E.on(document,"focusin.bs.focustrap",De=>this._handleFocusin(De)),E.on(document,"keydown.tab.bs.focustrap",De=>this._handleKeydown(De)),this._isActive=!0)}deactivate(){this._isActive&&(this._isActive=!1,E.off(document,nn))}_handleFocusin(j){const{target:ae}=j,{trapElement:De}=this._config;if(ae===document||ae===De||De.contains(ae))return;const rt=T.focusableChildren(De);0===rt.length?De.focus():this._lastTabNavDirection===xn?rt[rt.length-1].focus():rt[0].focus()}_handleKeydown(j){"Tab"===j.key&&(this._lastTabNavDirection=j.shiftKey?xn:"forward")}_getConfig(j){return j={...bt,..."object"==typeof j?j:{}},je("focustrap",j,Et),j}}const Pn={backdrop:!0,keyboard:!0,focus:!0},qn={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean"},_r="hidden.bs.modal",nr="show.bs.modal",Cr="resize.bs.modal",gr="click.dismiss.bs.modal",Tr="keydown.dismiss.bs.modal",br="mousedown.dismiss.bs.modal",Lr="modal-open",ni="modal-static";class wi extends k{constructor(j,ae){super(j),this._config=this._getConfig(ae),this._dialog=T.findOne(".modal-dialog",this._element),this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._isShown=!1,this._ignoreBackdropClick=!1,this._isTransitioning=!1,this._scrollBar=new St}static get Default(){return Pn}static get NAME(){return"modal"}toggle(j){return this._isShown?this.hide():this.show(j)}show(j){this._isShown||this._isTransitioning||E.trigger(this._element,nr,{relatedTarget:j}).defaultPrevented||(this._isShown=!0,this._isAnimated()&&(this._isTransitioning=!0),this._scrollBar.hide(),document.body.classList.add(Lr),this._adjustDialog(),this._setEscapeEvent(),this._setResizeEvent(),E.on(this._dialog,br,()=>{E.one(this._element,"mouseup.dismiss.bs.modal",ae=>{ae.target===this._element&&(this._ignoreBackdropClick=!0)})}),this._showBackdrop(()=>this._showElement(j)))}hide(){if(!this._isShown||this._isTransitioning||E.trigger(this._element,"hide.bs.modal").defaultPrevented)return;this._isShown=!1;const j=this._isAnimated();j&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),this._focustrap.deactivate(),this._element.classList.remove("show"),E.off(this._element,gr),E.off(this._dialog,br),this._queueCallback(()=>this._hideModal(),this._element,j)}dispose(){[window,this._dialog].forEach(j=>E.off(j,".bs.modal")),this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new Re({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new fn({trapElement:this._element})}_getConfig(j){return j={...Pn,...X.getDataAttributes(this._element),..."object"==typeof j?j:{}},je("modal",j,qn),j}_showElement(j){const ae=this._isAnimated(),De=T.findOne(".modal-body",this._dialog);this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.append(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0,De&&(De.scrollTop=0),this._element.classList.add("show"),this._queueCallback(()=>{this._config.focus&&this._focustrap.activate(),this._isTransitioning=!1,E.trigger(this._element,"shown.bs.modal",{relatedTarget:j})},this._dialog,ae)}_setEscapeEvent(){this._isShown?E.on(this._element,Tr,j=>{this._config.keyboard&&"Escape"===j.key?(j.preventDefault(),this.hide()):this._config.keyboard||"Escape"!==j.key||this._triggerBackdropTransition()}):E.off(this._element,Tr)}_setResizeEvent(){this._isShown?E.on(window,Cr,()=>this._adjustDialog()):E.off(window,Cr)}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide(()=>{document.body.classList.remove(Lr),this._resetAdjustments(),this._scrollBar.reset(),E.trigger(this._element,_r)})}_showBackdrop(j){E.on(this._element,gr,ae=>{this._ignoreBackdropClick?this._ignoreBackdropClick=!1:ae.target===ae.currentTarget&&(!0===this._config.backdrop?this.hide():"static"===this._config.backdrop&&this._triggerBackdropTransition())}),this._backdrop.show(j)}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if(E.trigger(this._element,"hidePrevented.bs.modal").defaultPrevented)return;const{classList:j,scrollHeight:ae,style:De}=this._element,rt=ae>document.documentElement.clientHeight;!rt&&"hidden"===De.overflowY||j.contains(ni)||(rt||(De.overflowY="hidden"),j.add(ni),this._queueCallback(()=>{j.remove(ni),rt||this._queueCallback(()=>{De.overflowY=""},this._dialog)},this._dialog),this._element.focus())}_adjustDialog(){const j=this._element.scrollHeight>document.documentElement.clientHeight,ae=this._scrollBar.getWidth(),De=ae>0;(!De&&j&&!le()||De&&!j&&le())&&(this._element.style.paddingLeft=`${ae}px`),(De&&!j&&!le()||!De&&j&&le())&&(this._element.style.paddingRight=`${ae}px`)}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}static jQueryInterface(j,ae){return this.each(function(){const De=wi.getOrCreateInstance(this,j);if("string"==typeof j){if(void 0===De[j])throw new TypeError(`No method named "${j}"`);De[j](ae)}})}}E.on(document,"click.bs.modal.data-api",'[data-bs-toggle="modal"]',function(xe){const j=At(this);["A","AREA"].includes(this.tagName)&&xe.preventDefault(),E.one(j,nr,De=>{De.defaultPrevented||E.one(j,_r,()=>{Pe(this)&&this.focus()})});const ae=T.findOne(".modal.show");ae&&wi.getInstance(ae).hide(),wi.getOrCreateInstance(j).toggle(this)}),I(wi),d(wi);const pi="offcanvas",gi={backdrop:!0,keyboard:!0,scroll:!1},ei={backdrop:"boolean",keyboard:"boolean",scroll:"boolean"},Xi=".offcanvas.show",Ni="hidden.bs.offcanvas";class mi extends k{constructor(j,ae){super(j),this._config=this._getConfig(ae),this._isShown=!1,this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._addEventListeners()}static get NAME(){return pi}static get Default(){return gi}toggle(j){return this._isShown?this.hide():this.show(j)}show(j){this._isShown||E.trigger(this._element,"show.bs.offcanvas",{relatedTarget:j}).defaultPrevented||(this._isShown=!0,this._element.style.visibility="visible",this._backdrop.show(),this._config.scroll||(new St).hide(),this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add("show"),this._queueCallback(()=>{this._config.scroll||this._focustrap.activate(),E.trigger(this._element,"shown.bs.offcanvas",{relatedTarget:j})},this._element,!0))}hide(){this._isShown&&(E.trigger(this._element,"hide.bs.offcanvas").defaultPrevented||(this._focustrap.deactivate(),this._element.blur(),this._isShown=!1,this._element.classList.remove("show"),this._backdrop.hide(),this._queueCallback(()=>{this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._element.style.visibility="hidden",this._config.scroll||(new St).reset(),E.trigger(this._element,Ni)},this._element,!0)))}dispose(){this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}_getConfig(j){return j={...gi,...X.getDataAttributes(this._element),..."object"==typeof j?j:{}},je(pi,j,ei),j}_initializeBackDrop(){return new Re({className:"offcanvas-backdrop",isVisible:this._config.backdrop,isAnimated:!0,rootElement:this._element.parentNode,clickCallback:()=>this.hide()})}_initializeFocusTrap(){return new fn({trapElement:this._element})}_addEventListeners(){E.on(this._element,"keydown.dismiss.bs.offcanvas",j=>{this._config.keyboard&&"Escape"===j.key&&this.hide()})}static jQueryInterface(j){return this.each(function(){const ae=mi.getOrCreateInstance(this,j);if("string"==typeof j){if(void 0===ae[j]||j.startsWith("_")||"constructor"===j)throw new TypeError(`No method named "${j}"`);ae[j](this)}})}}E.on(document,"click.bs.offcanvas.data-api",'[data-bs-toggle="offcanvas"]',function(xe){const j=At(this);if(["A","AREA"].includes(this.tagName)&&xe.preventDefault(),y(this))return;E.one(j,Ni,()=>{Pe(this)&&this.focus()});const ae=T.findOne(Xi);ae&&ae!==j&&mi.getInstance(ae).hide(),mi.getOrCreateInstance(j).toggle(this)}),E.on(window,"load.bs.offcanvas.data-api",()=>T.find(Xi).forEach(xe=>mi.getOrCreateInstance(xe).show())),I(mi),d(mi);const Vi=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),zi=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i,Ui=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i,Ai=(xe,j)=>{const ae=xe.nodeName.toLowerCase();if(j.includes(ae))return!Vi.has(ae)||Boolean(zi.test(xe.nodeValue)||Ui.test(xe.nodeValue));const De=j.filter(rt=>rt instanceof RegExp);for(let rt=0,gt=De.length;rt{Ai(On,Xn)||_n.removeAttribute(On.nodeName)})}return De.body.innerHTML}const _i="tooltip",Pi=new Set(["sanitize","allowList","sanitizeFn"]),Gi={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(array|string|function)",container:"(string|element|boolean)",fallbackPlacements:"array",boundary:"(string|element)",customClass:"(string|function)",sanitize:"boolean",sanitizeFn:"(null|function)",allowList:"object",popperConfig:"(null|object|function)"},ji={AUTO:"auto",TOP:"top",RIGHT:le()?"left":"right",BOTTOM:"bottom",LEFT:le()?"right":"left"},Te={animation:!0,template:'',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:[0,0],container:!1,fallbackPlacements:["top","right","bottom","left"],boundary:"clippingParents",customClass:"",sanitize:!0,sanitizeFn:null,allowList:{"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},popperConfig:null},Ye={HIDE:"hide.bs.tooltip",HIDDEN:"hidden.bs.tooltip",SHOW:"show.bs.tooltip",SHOWN:"shown.bs.tooltip",INSERTED:"inserted.bs.tooltip",CLICK:"click.bs.tooltip",FOCUSIN:"focusin.bs.tooltip",FOCUSOUT:"focusout.bs.tooltip",MOUSEENTER:"mouseenter.bs.tooltip",MOUSELEAVE:"mouseleave.bs.tooltip"},it="fade",pt="show",Wt="show",Kt=".tooltip-inner",pn="hide.bs.modal",jn="hover";class sr extends k{constructor(j,ae){if(void 0===Ce)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");super(j),this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this._config=this._getConfig(ae),this.tip=null,this._setListeners()}static get Default(){return Te}static get NAME(){return _i}static get Event(){return Ye}static get DefaultType(){return Gi}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}toggleEnabled(){this._isEnabled=!this._isEnabled}toggle(j){if(this._isEnabled)if(j){const ae=this._initializeOnDelegatedTarget(j);ae._activeTrigger.click=!ae._activeTrigger.click,ae._isWithActiveTrigger()?ae._enter(null,ae):ae._leave(null,ae)}else{if(this.getTipElement().classList.contains(pt))return void this._leave(null,this);this._enter(null,this)}}dispose(){clearTimeout(this._timeout),E.off(this._element.closest(".modal"),pn,this._hideModalHandler),this.tip&&this.tip.remove(),this._disposePopper(),super.dispose()}show(){if("none"===this._element.style.display)throw new Error("Please use show on visible elements");if(!this.isWithContent()||!this._isEnabled)return;const j=E.trigger(this._element,this.constructor.Event.SHOW),ae=he(this._element),De=null===ae?this._element.ownerDocument.documentElement.contains(this._element):ae.contains(this._element);if(j.defaultPrevented||!De)return;"tooltip"===this.constructor.NAME&&this.tip&&this.getTitle()!==this.tip.querySelector(Kt).innerHTML&&(this._disposePopper(),this.tip.remove(),this.tip=null);const rt=this.getTipElement(),gt=(On=>{do{On+=Math.floor(1e6*Math.random())}while(document.getElementById(On));return On})(this.constructor.NAME);rt.setAttribute("id",gt),this._element.setAttribute("aria-describedby",gt),this._config.animation&&rt.classList.add(it);const Dt="function"==typeof this._config.placement?this._config.placement.call(this,rt,this._element):this._config.placement,_n=this._getAttachment(Dt);this._addAttachmentClass(_n);const{container:Bn}=this._config;z.set(rt,this.constructor.DATA_KEY,this),this._element.ownerDocument.documentElement.contains(this.tip)||(Bn.append(rt),E.trigger(this._element,this.constructor.Event.INSERTED)),this._popper?this._popper.update():this._popper=Me(this._element,rt,this._getPopperConfig(_n)),rt.classList.add(pt);const Vn=this._resolvePossibleFunction(this._config.customClass);Vn&&rt.classList.add(...Vn.split(" ")),"ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach(On=>{E.on(On,"mouseover",te)});const Xn=this.tip.classList.contains(it);this._queueCallback(()=>{const On=this._hoverState;this._hoverState=null,E.trigger(this._element,this.constructor.Event.SHOWN),"out"===On&&this._leave(null,this)},this.tip,Xn)}hide(){if(!this._popper)return;const j=this.getTipElement();if(E.trigger(this._element,this.constructor.Event.HIDE).defaultPrevented)return;j.classList.remove(pt),"ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach(De=>E.off(De,"mouseover",te)),this._activeTrigger.click=!1,this._activeTrigger.focus=!1,this._activeTrigger.hover=!1;const ae=this.tip.classList.contains(it);this._queueCallback(()=>{this._isWithActiveTrigger()||(this._hoverState!==Wt&&j.remove(),this._cleanTipClass(),this._element.removeAttribute("aria-describedby"),E.trigger(this._element,this.constructor.Event.HIDDEN),this._disposePopper())},this.tip,ae),this._hoverState=""}update(){null!==this._popper&&this._popper.update()}isWithContent(){return Boolean(this.getTitle())}getTipElement(){if(this.tip)return this.tip;const j=document.createElement("div");j.innerHTML=this._config.template;const ae=j.children[0];return this.setContent(ae),ae.classList.remove(it,pt),this.tip=ae,this.tip}setContent(j){this._sanitizeAndSetContent(j,this.getTitle(),Kt)}_sanitizeAndSetContent(j,ae,De){const rt=T.findOne(De,j);ae||!rt?this.setElementContent(rt,ae):rt.remove()}setElementContent(j,ae){if(null!==j)return kt(ae)?(ae=Q(ae),void(this._config.html?ae.parentNode!==j&&(j.innerHTML="",j.append(ae)):j.textContent=ae.textContent)):void(this._config.html?(this._config.sanitize&&(ae=Ii(ae,this._config.allowList,this._config.sanitizeFn)),j.innerHTML=ae):j.textContent=ae)}getTitle(){const j=this._element.getAttribute("data-bs-original-title")||this._config.title;return this._resolvePossibleFunction(j)}updateAttachment(j){return"right"===j?"end":"left"===j?"start":j}_initializeOnDelegatedTarget(j,ae){return ae||this.constructor.getOrCreateInstance(j.delegateTarget,this._getDelegateConfig())}_getOffset(){const{offset:j}=this._config;return"string"==typeof j?j.split(",").map(ae=>Number.parseInt(ae,10)):"function"==typeof j?ae=>j(ae,this._element):j}_resolvePossibleFunction(j){return"function"==typeof j?j.call(this._element):j}_getPopperConfig(j){const ae={placement:j,modifiers:[{name:"flip",options:{fallbackPlacements:this._config.fallbackPlacements}},{name:"offset",options:{offset:this._getOffset()}},{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"arrow",options:{element:`.${this.constructor.NAME}-arrow`}},{name:"onChange",enabled:!0,phase:"afterWrite",fn:De=>this._handlePopperPlacementChange(De)}],onFirstUpdate:De=>{De.options.placement!==De.placement&&this._handlePopperPlacementChange(De)}};return{...ae,..."function"==typeof this._config.popperConfig?this._config.popperConfig(ae):this._config.popperConfig}}_addAttachmentClass(j){this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(j)}`)}_getAttachment(j){return ji[j.toUpperCase()]}_setListeners(){this._config.trigger.split(" ").forEach(j=>{if("click"===j)E.on(this._element,this.constructor.Event.CLICK,this._config.selector,ae=>this.toggle(ae));else if("manual"!==j){const De=j===jn?this.constructor.Event.MOUSELEAVE:this.constructor.Event.FOCUSOUT;E.on(this._element,j===jn?this.constructor.Event.MOUSEENTER:this.constructor.Event.FOCUSIN,this._config.selector,rt=>this._enter(rt)),E.on(this._element,De,this._config.selector,rt=>this._leave(rt))}}),this._hideModalHandler=()=>{this._element&&this.hide()},E.on(this._element.closest(".modal"),pn,this._hideModalHandler),this._config.selector?this._config={...this._config,trigger:"manual",selector:""}:this._fixTitle()}_fixTitle(){const j=this._element.getAttribute("title"),ae=typeof this._element.getAttribute("data-bs-original-title");(j||"string"!==ae)&&(this._element.setAttribute("data-bs-original-title",j||""),!j||this._element.getAttribute("aria-label")||this._element.textContent||this._element.setAttribute("aria-label",j),this._element.setAttribute("title",""))}_enter(j,ae){ae=this._initializeOnDelegatedTarget(j,ae),j&&(ae._activeTrigger["focusin"===j.type?"focus":jn]=!0),ae.getTipElement().classList.contains(pt)||ae._hoverState===Wt?ae._hoverState=Wt:(clearTimeout(ae._timeout),ae._hoverState=Wt,ae._config.delay&&ae._config.delay.show?ae._timeout=setTimeout(()=>{ae._hoverState===Wt&&ae.show()},ae._config.delay.show):ae.show())}_leave(j,ae){ae=this._initializeOnDelegatedTarget(j,ae),j&&(ae._activeTrigger["focusout"===j.type?"focus":jn]=ae._element.contains(j.relatedTarget)),ae._isWithActiveTrigger()||(clearTimeout(ae._timeout),ae._hoverState="out",ae._config.delay&&ae._config.delay.hide?ae._timeout=setTimeout(()=>{"out"===ae._hoverState&&ae.hide()},ae._config.delay.hide):ae.hide())}_isWithActiveTrigger(){for(const j in this._activeTrigger)if(this._activeTrigger[j])return!0;return!1}_getConfig(j){const ae=X.getDataAttributes(this._element);return Object.keys(ae).forEach(De=>{Pi.has(De)&&delete ae[De]}),(j={...this.constructor.Default,...ae,..."object"==typeof j&&j?j:{}}).container=!1===j.container?document.body:Q(j.container),"number"==typeof j.delay&&(j.delay={show:j.delay,hide:j.delay}),"number"==typeof j.title&&(j.title=j.title.toString()),"number"==typeof j.content&&(j.content=j.content.toString()),je(_i,j,this.constructor.DefaultType),j.sanitize&&(j.template=Ii(j.template,j.allowList,j.sanitizeFn)),j}_getDelegateConfig(){const j={};for(const ae in this._config)this.constructor.Default[ae]!==this._config[ae]&&(j[ae]=this._config[ae]);return j}_cleanTipClass(){const j=this.getTipElement(),ae=new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`,"g"),De=j.getAttribute("class").match(ae);null!==De&&De.length>0&&De.map(rt=>rt.trim()).forEach(rt=>j.classList.remove(rt))}_getBasicClassPrefix(){return"bs-tooltip"}_handlePopperPlacementChange(j){const{state:ae}=j;ae&&(this.tip=ae.elements.popper,this._cleanTipClass(),this._addAttachmentClass(this._getAttachment(ae.placement)))}_disposePopper(){this._popper&&(this._popper.destroy(),this._popper=null)}static jQueryInterface(j){return this.each(function(){const ae=sr.getOrCreateInstance(this,j);if("string"==typeof j){if(void 0===ae[j])throw new TypeError(`No method named "${j}"`);ae[j]()}})}}d(sr);const jr={...sr.Default,placement:"right",offset:[0,8],trigger:"click",content:"",template:''},ii={...sr.DefaultType,content:"(string|element|function)"},ti={HIDE:"hide.bs.popover",HIDDEN:"hidden.bs.popover",SHOW:"show.bs.popover",SHOWN:"shown.bs.popover",INSERTED:"inserted.bs.popover",CLICK:"click.bs.popover",FOCUSIN:"focusin.bs.popover",FOCUSOUT:"focusout.bs.popover",MOUSEENTER:"mouseenter.bs.popover",MOUSELEAVE:"mouseleave.bs.popover"};class Or extends sr{static get Default(){return jr}static get NAME(){return"popover"}static get Event(){return ti}static get DefaultType(){return ii}isWithContent(){return this.getTitle()||this._getContent()}setContent(j){this._sanitizeAndSetContent(j,this.getTitle(),".popover-header"),this._sanitizeAndSetContent(j,this._getContent(),".popover-body")}_getContent(){return this._resolvePossibleFunction(this._config.content)}_getBasicClassPrefix(){return"bs-popover"}static jQueryInterface(j){return this.each(function(){const ae=Or.getOrCreateInstance(this,j);if("string"==typeof j){if(void 0===ae[j])throw new TypeError(`No method named "${j}"`);ae[j]()}})}}d(Or);const Yr="scrollspy",Fi={offset:10,method:"auto",target:""},no={offset:"number",method:"string",target:"(string|element)"},Hi="active",ao=".nav-link, .list-group-item, .dropdown-item",Zi="position";class ro extends k{constructor(j,ae){super(j),this._scrollElement="BODY"===this._element.tagName?window:this._element,this._config=this._getConfig(ae),this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,E.on(this._scrollElement,"scroll.bs.scrollspy",()=>this._process()),this.refresh(),this._process()}static get Default(){return Fi}static get NAME(){return Yr}refresh(){const ae="auto"===this._config.method?this._scrollElement===this._scrollElement.window?"offset":Zi:this._config.method,De=ae===Zi?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),T.find(ao,this._config.target).map(rt=>{const gt=H(rt),Dt=gt?T.findOne(gt):null;if(Dt){const _n=Dt.getBoundingClientRect();if(_n.width||_n.height)return[X[ae](Dt).top+De,gt]}return null}).filter(rt=>rt).sort((rt,gt)=>rt[0]-gt[0]).forEach(rt=>{this._offsets.push(rt[0]),this._targets.push(rt[1])})}dispose(){E.off(this._scrollElement,".bs.scrollspy"),super.dispose()}_getConfig(j){return(j={...Fi,...X.getDataAttributes(this._element),..."object"==typeof j&&j?j:{}}).target=Q(j.target)||document.documentElement,je(Yr,j,no),j}_getScrollTop(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop}_getScrollHeight(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}_getOffsetHeight(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height}_process(){const j=this._getScrollTop()+this._config.offset,ae=this._getScrollHeight(),De=this._config.offset+ae-this._getOffsetHeight();if(this._scrollHeight!==ae&&this.refresh(),j>=De){const rt=this._targets[this._targets.length-1];this._activeTarget!==rt&&this._activate(rt)}else{if(this._activeTarget&&j0)return this._activeTarget=null,void this._clear();for(let rt=this._offsets.length;rt--;)this._activeTarget!==this._targets[rt]&&j>=this._offsets[rt]&&(void 0===this._offsets[rt+1]||j`${rt}[data-bs-target="${j}"],${rt}[href="${j}"]`),De=T.findOne(ae.join(","),this._config.target);De.classList.add(Hi),De.classList.contains("dropdown-item")?T.findOne(".dropdown-toggle",De.closest(".dropdown")).classList.add(Hi):T.parents(De,".nav, .list-group").forEach(rt=>{T.prev(rt,".nav-link, .list-group-item").forEach(gt=>gt.classList.add(Hi)),T.prev(rt,".nav-item").forEach(gt=>{T.children(gt,".nav-link").forEach(Dt=>Dt.classList.add(Hi))})}),E.trigger(this._scrollElement,"activate.bs.scrollspy",{relatedTarget:j})}_clear(){T.find(ao,this._config.target).filter(j=>j.classList.contains(Hi)).forEach(j=>j.classList.remove(Hi))}static jQueryInterface(j){return this.each(function(){const ae=ro.getOrCreateInstance(this,j);if("string"==typeof j){if(void 0===ae[j])throw new TypeError(`No method named "${j}"`);ae[j]()}})}}E.on(window,"load.bs.scrollspy.data-api",()=>{T.find('[data-bs-spy="scroll"]').forEach(xe=>new ro(xe))}),d(ro);const io="active",Yo=".active",Do=":scope > li > .active";class bo extends k{static get NAME(){return"tab"}show(){if(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&this._element.classList.contains(io))return;let j;const ae=At(this._element),De=this._element.closest(".nav, .list-group");De&&(j=T.find("UL"===De.nodeName||"OL"===De.nodeName?Do:Yo,De),j=j[j.length-1]);const rt=j?E.trigger(j,"hide.bs.tab",{relatedTarget:this._element}):null;if(E.trigger(this._element,"show.bs.tab",{relatedTarget:j}).defaultPrevented||null!==rt&&rt.defaultPrevented)return;this._activate(this._element,De);const gt=()=>{E.trigger(j,"hidden.bs.tab",{relatedTarget:this._element}),E.trigger(this._element,"shown.bs.tab",{relatedTarget:j})};ae?this._activate(ae,ae.parentNode,gt):gt()}_activate(j,ae,De){const rt=(!ae||"UL"!==ae.nodeName&&"OL"!==ae.nodeName?T.children(ae,Yo):T.find(Do,ae))[0],gt=De&&rt&&rt.classList.contains("fade"),Dt=()=>this._transitionComplete(j,rt,De);rt&>?(rt.classList.remove("show"),this._queueCallback(Dt,j,!0)):Dt()}_transitionComplete(j,ae,De){if(ae){ae.classList.remove(io);const gt=T.findOne(":scope > .dropdown-menu .active",ae.parentNode);gt&>.classList.remove(io),"tab"===ae.getAttribute("role")&&ae.setAttribute("aria-selected",!1)}j.classList.add(io),"tab"===j.getAttribute("role")&&j.setAttribute("aria-selected",!0),j.classList.contains("fade")&&j.classList.add("show");let rt=j.parentNode;if(rt&&"LI"===rt.nodeName&&(rt=rt.parentNode),rt&&rt.classList.contains("dropdown-menu")){const gt=j.closest(".dropdown");gt&&T.find(".dropdown-toggle",gt).forEach(Dt=>Dt.classList.add(io)),j.setAttribute("aria-expanded",!0)}De&&De()}static jQueryInterface(j){return this.each(function(){const ae=bo.getOrCreateInstance(this);if("string"==typeof j){if(void 0===ae[j])throw new TypeError(`No method named "${j}"`);ae[j]()}})}}E.on(document,"click.bs.tab.data-api",'[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]',function(xe){["A","AREA"].includes(this.tagName)&&xe.preventDefault(),y(this)||bo.getOrCreateInstance(this).show()}),d(bo);const Wi="show",jo="showing",Fo={animation:"boolean",autohide:"boolean",delay:"number"},Co={animation:!0,autohide:!0,delay:5e3};class co extends k{constructor(j,ae){super(j),this._config=this._getConfig(ae),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners()}static get DefaultType(){return Fo}static get Default(){return Co}static get NAME(){return"toast"}show(){E.trigger(this._element,"show.bs.toast").defaultPrevented||(this._clearTimeout(),this._config.animation&&this._element.classList.add("fade"),this._element.classList.remove("hide"),this._element.classList.add(Wi),this._element.classList.add(jo),this._queueCallback(()=>{this._element.classList.remove(jo),E.trigger(this._element,"shown.bs.toast"),this._maybeScheduleHide()},this._element,this._config.animation))}hide(){this._element.classList.contains(Wi)&&(E.trigger(this._element,"hide.bs.toast").defaultPrevented||(this._element.classList.add(jo),this._queueCallback(()=>{this._element.classList.add("hide"),this._element.classList.remove(jo),this._element.classList.remove(Wi),E.trigger(this._element,"hidden.bs.toast")},this._element,this._config.animation)))}dispose(){this._clearTimeout(),this._element.classList.contains(Wi)&&this._element.classList.remove(Wi),super.dispose()}_getConfig(j){return j={...Co,...X.getDataAttributes(this._element),..."object"==typeof j&&j?j:{}},je("toast",j,this.constructor.DefaultType),j}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout(()=>{this.hide()},this._config.delay)))}_onInteraction(j,ae){switch(j.type){case"mouseover":case"mouseout":this._hasMouseInteraction=ae;break;case"focusin":case"focusout":this._hasKeyboardInteraction=ae}if(ae)return void this._clearTimeout();const De=j.relatedTarget;this._element===De||this._element.contains(De)||this._maybeScheduleHide()}_setListeners(){E.on(this._element,"mouseover.bs.toast",j=>this._onInteraction(j,!0)),E.on(this._element,"mouseout.bs.toast",j=>this._onInteraction(j,!1)),E.on(this._element,"focusin.bs.toast",j=>this._onInteraction(j,!0)),E.on(this._element,"focusout.bs.toast",j=>this._onInteraction(j,!1))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(j){return this.each(function(){const ae=co.getOrCreateInstance(this,j);if("string"==typeof j){if(void 0===ae[j])throw new TypeError(`No method named "${j}"`);ae[j](this)}})}}return I(co),d(co),{Alert:V,Button:oe,Carousel:Ie,Collapse:Tn,Dropdown:or,Modal:wi,Offcanvas:mi,Popover:Or,ScrollSpy:ro,Tab:bo,Toast:co,Tooltip:sr}}),function(){"use strict";var Gt,gn=document.createElement("style");gn.innerHTML="@keyframes wb-fade-in{0%{opacity:0}to{opacity:.85}}.no-move:not(.min) .wb-title,.winbox.max .wb-body~div,.winbox.min .wb-body~div,.winbox.modal .wb-body~div,.winbox.modal .wb-title,body.wb-drag iframe{pointer-events:none}.winbox{position:fixed;left:0;top:0;background:#0050ff;box-shadow:0 14px 28px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.22);transition:width .3s,height .3s,transform .3s;transition-timing-function:cubic-bezier(.3,1,.3,1);will-change:transform,width,height;contain:layout size;text-align:left;touch-action:none;min-height:35px}.wb-header,.wb-icon{height:35px}.wb-n,.wb-s{left:0;height:10px;position:absolute}.wb-body{top:35px}.wb-header,.winbox iframe{position:absolute;width:100%}.wb-header{left:0;top:0;color:#fff;overflow:hidden;z-index:1}.wb-body{position:absolute;left:0;right:0;bottom:0;overflow:auto;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;will-change:contents;background:#fff;margin-top:0!important;contain:strict}.wb-title{line-height:35px;font-family:Arial,sans-serif;font-size:14px;padding-left:10px;cursor:move;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wb-n{top:-5px;right:0;cursor:n-resize}.wb-e{position:absolute;top:0;right:-5px;bottom:0;width:10px;cursor:w-resize}.wb-s,.wb-se,.wb-sw{bottom:-5px}.wb-s{right:0;cursor:n-resize}.wb-w{position:absolute;top:0;left:-5px;bottom:0;width:10px;cursor:w-resize}.wb-ne,.wb-nw,.wb-sw{width:15px;height:15px;position:absolute}.wb-nw{top:-5px;left:-5px;cursor:nw-resize}.wb-ne,.wb-sw{cursor:ne-resize}.wb-ne{top:-5px;right:-5px}.wb-sw{left:-5px}.wb-se{position:absolute;right:-5px;width:15px;height:15px;cursor:nw-resize}.wb-icon{float:right;max-width:100%;text-align:center}.wb-icon *{display:inline-block;width:30px;height:100%;background-position:center;background-repeat:no-repeat;cursor:pointer;max-width:100%}.no-close .wb-close,.no-full .wb-full,.no-header .wb-header,.no-max .wb-max,.no-min .wb-min,.no-resize .wb-body~div,.winbox.hide,.winbox.min .wb-body>*,.winbox.min .wb-full,.winbox.min .wb-min,.winbox.modal .wb-full,.winbox.modal .wb-max,.winbox.modal .wb-min{display:none}.winbox.max .wb-title,.winbox.min .wb-title{cursor:default}.wb-min{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAyIj48cGF0aCBmaWxsPSIjZmZmIiBkPSJNOCAwaDdhMSAxIDAgMCAxIDAgMkgxYTEgMSAwIDAgMSAwLTJoN3oiLz48L3N2Zz4=);background-size:14px auto;background-position:center bottom 11px}.wb-max{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmZmYiIHZpZXdCb3g9IjAgMCA5NiA5NiI+PHBhdGggZD0iTTIwIDcxLjMxMUMxNS4zNCA2OS42NyAxMiA2NS4yMyAxMiA2MFYyMGMwLTYuNjMgNS4zNy0xMiAxMi0xMmg0MGM1LjIzIDAgOS42NyAzLjM0IDExLjMxMSA4SDI0Yy0yLjIxIDAtNCAxLjc5LTQgNHY1MS4zMTF6Ii8+PHBhdGggZD0iTTkyIDc2VjM2YzAtNi42My01LjM3LTEyLTEyLTEySDQwYy02LjYzIDAtMTIgNS4zNy0xMiAxMnY0MGMwIDYuNjMgNS4zNyAxMiAxMiAxMmg0MGM2LjYzIDAgMTItNS4zNyAxMi0xMnptLTUyIDRjLTIuMjEgMC00LTEuNzktNC00VjM2YzAtMi4yMSAxLjc5LTQgNC00aDQwYzIuMjEgMCA0IDEuNzkgNCA0djQwYzAgMi4yMS0xLjc5IDQtNCA0SDQweiIvPjwvc3ZnPg==);background-size:17px auto}.wb-close{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ii0xIC0xIDE4IDE4Ij48cGF0aCBmaWxsPSIjZmZmIiBkPSJtMS42MTMuMjEuMDk0LjA4M0w4IDYuNTg1IDE0LjI5My4yOTNsLjA5NC0uMDgzYTEgMSAwIDAgMSAxLjQwMyAxLjQwM2wtLjA4My4wOTRMOS40MTUgOGw2LjI5MiA2LjI5M2ExIDEgMCAwIDEtMS4zMiAxLjQ5N2wtLjA5NC0uMDgzTDggOS40MTVsLTYuMjkzIDYuMjkyLS4wOTQuMDgzQTEgMSAwIDAgMSAuMjEgMTQuMzg3bC4wODMtLjA5NEw2LjU4NSA4IC4yOTMgMS43MDdBMSAxIDAgMCAxIDEuNjEzLjIxeiIvPjwvc3ZnPg==);background-size:15px auto}.wb-full{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2Utd2lkdGg9IjIuNSIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCAzSDVhMiAyIDAgMCAwLTIgMnYzbTE4IDBWNWEyIDIgMCAwIDAtMi0yaC0zbTAgMThoM2EyIDIgMCAwIDAgMi0ydi0zTTMgMTZ2M2EyIDIgMCAwIDAgMiAyaDMiLz48L3N2Zz4=);background-size:16px auto}.winbox.hide{visibility:hidden}.max{box-shadow:none}.max .wb-body{margin:0!important}.winbox iframe{height:100%;border:0}.no-animation,body.wb-drag .winbox{transition:none}.winbox.modal:before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:inherit;border-radius:inherit}.winbox.modal:after{content:'';position:absolute;top:-100vh;left:-100vw;right:-100vw;bottom:-100vh;background:#0d1117;animation:wb-fade-in .2s ease-out forwards;z-index:-1}.no-shadow{box-shadow:none}.no-header .wb-body{top:0}";var H=document.getElementsByTagName("head")[0];H.firstChild?H.insertBefore(gn,H.firstChild):H.appendChild(gn);var At=document.createElement("div");function xt(s,u,o,t){s.addEventListener(u,o,!t&&!1!==t||t)}function kt(s){s.stopPropagation(),s.cancelable&&s.preventDefault()}function Q(s,u,o){s["_s_"+u]!==(o=""+o)&&(s.style.setProperty(u,o),s["_s_"+u]=o)}At.innerHTML="
";var Pe,te,pe,_e,ne,le,d,N,je=[],y=0,he=0;function A(s,u){if(!(this instanceof A))return new A(s);var o,t;if(te||function b(){(Pe=document.body)[ne="requestFullscreen"]||Pe[ne="msRequestFullscreen"]||Pe[ne="webkitRequestFullscreen"]||Pe[ne="mozRequestFullscreen"]||(ne=""),le=ne&&ne.replace("request","exit").replace("mozRequest","mozCancel").replace("Request","Exit"),xt(window,"resize",function(){d=Pe.clientWidth,N=Pe.clientHeight,n()}),d=Pe.clientWidth,N=Pe.clientHeight}(),s){if(u){var r=s;s=u}if("string"==typeof s)r=s;else{if(t=s.modal)var a=o="center";var c=s.id,l=s.root,w=s.template;r=r||s.title;var E=s.mount,C=s.html,z=s.url,k=s.width,I=s.height,V=s.minwidth,$=s.minheight;a=s.x||a,o=s.y||o;var oe=s.max,ue=s.hidden,Ae=s.top,X=s.left,T=s.bottom,D=s.right;te=s.index||te;var M=s.onclose,v=s.onfocus,B=s.onblur,F=s.onmove,q=s.onresize,L=s.background,Y=s.border,se=s.class,Ee=s.splitscreen}}this.g=w||At.cloneNode(!0),this.body=this.g.getElementsByClassName("wb-body")[0],L&&this.setBackground(L),Y&&Q(this.body,"margin",Y+(isNaN(Y)?"":"px")),this.setTitle(r||""),s=d,u=N,Ae=Ae?f(Ae,u):0,T=T?f(T,u):0,s-=(X=X?f(X,s):0)+(D=D?f(D,s):0),u-=Ae+T,k=k?f(k,s):s/2|0,I=I?f(I,u):u/2|0,V=V?f(V,s):0,$=$?f($,u):0,a=a?f(a,s,k):X,o=o?f(o,u,I):Ae,te=te||10,this.g.id=this.id=c||"winbox-"+ ++y,this.g.className="winbox"+(se?" "+("string"==typeof se?se:se.join(" ")):"")+(t?" modal":""),this.x=a,this.y=o,this.width=k,this.height=I,this.j=V,this.i=$,this.top=Ae,this.right=D,this.bottom=T,this.left=X,this.max=this.min=!1,this.onclose=M,this.onfocus=v,this.onblur=B,this.onmove=F,this.onresize=q,this.l=Ee,oe?this.maximize():this.move().resize(),E?this.mount(E):C?this.body.innerHTML=C:z&&this.setUrl(z),ue?this.hide():this.focus(),this.g.winbox=this,function m(s){g(s,"title"),g(s,"n"),g(s,"s"),g(s,"w"),g(s,"e"),g(s,"nw"),g(s,"ne"),g(s,"se"),g(s,"sw"),xt(s.g.getElementsByClassName("wb-min")[0],"click",function(u){kt(u),s.minimize()}),xt(s.g.getElementsByClassName("wb-max")[0],"click",function(u){kt(u),s.focus().maximize()}),ne?xt(s.g.getElementsByClassName("wb-full")[0],"click",function(u){kt(u),s.focus().fullscreen()}):s.addClass("no-full"),xt(s.g.getElementsByClassName("wb-close")[0],"click",function(u){kt(u),s.close()||(s=null)}),xt(s.g,"click",function(){s.focus()},!1)}(this),(l||Pe).appendChild(this.g)}function f(s,u,o){return"string"==typeof s&&(s="center"===s?(u-o)/2|0:"right"===s||"bottom"===s?u-o:"%"===(""+(o=parseFloat(s))!==s&&s.substring((""+o).length))?u/100*o|0:o),s}function _(s){je.splice(je.indexOf(s),1),n(),s.removeClass("min"),s.min=!1,s.g.title=""}function n(){for(var r,s=je.length,u={},o={},t=0;tz)return void s.maximize()}s.max||(Pe.classList.add("wb-drag"),(c=E.touches)&&(c=c[0])?(E=c,xt(window,"touchmove",t),xt(window,"touchend",r)):(xt(window,"mousemove",t),xt(window,"mouseup",r)),l=E.pageX,w=E.pageY,s.focus())}}function t(E){kt(E),c&&(E=E.touches[0]);var I,C=E.pageX,z=C-l,k=(E=E.pageY)-w;if("title"===u){s.x+=z,s.y+=k;var V=I=1}else{if("e"===u||"se"===u||"ne"===u){s.width+=z;var $=1}else("w"===u||"sw"===u||"nw"===u)&&(s.x+=z,s.width-=z,V=$=1);if("s"===u||"se"===u||"sw"===u){s.height+=k;var oe=1}else("n"===u||"ne"===u||"nw"===u)&&(s.y+=k,s.height-=k,I=oe=1)}($||oe)&&($&&(s.width=Math.max(Math.min(s.width,d-s.x-s.right),150)),oe&&(s.height=Math.max(Math.min(s.height,N-s.y-s.bottom),0)),s.resize()),(V||I)&&(V&&(s.x=Math.max(Math.min(s.x,d-s.width-s.right),s.left)),I&&(s.y=Math.max(Math.min(s.y,N-s.height-s.bottom),s.top)),s.move()),l=C,w=E}function r(E){kt(E),Pe.classList.remove("wb-drag"),c?(window.removeEventListener("touchmove",t,!0),window.removeEventListener("touchend",r,!0)):(window.removeEventListener("mousemove",t,!0),window.removeEventListener("mouseup",r,!0))}var c,l,w,a=s.g.getElementsByClassName("wb-"+u)[0];xt(a,"mousedown",o),xt(a,"touchstart",o,{passive:!1})}function h(){if(pe=!1,document.fullscreen||document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement)return document[le](),!0}A.new=function(s){return new A(s)},(Gt=A.prototype).mount=function(s){return this.unmount(),s.h||(s.h=s.parentNode),this.body.textContent="",this.body.appendChild(s),this},Gt.unmount=function(s){var u=this.body.firstChild;if(u){var o=s||u.h;o&&o.appendChild(u),u.h=s}return this},Gt.setTitle=function(s){return s=this.title=s,this.g.getElementsByClassName("wb-title")[0].firstChild.nodeValue=s,this},Gt.setBackground=function(s){return Q(this.g,"background",s),this},Gt.setUrl=function(s){return this.body.innerHTML='',this},Gt.focus=function(){return _e!==this&&(Q(this.g,"z-index",te++),this.addClass("focus"),_e&&(_e.removeClass("focus"),_e.onblur&&_e.onblur()),_e=this,this.onfocus&&this.onfocus()),this},Gt.hide=function(){return this.addClass("hide")},Gt.show=function(){return this.removeClass("hide")},Gt.minimize=function(s){return pe&&h(),!s&&this.min?(_(this),this.resize().move().focus()):!1===s||this.min||(je.push(this),n(),this.g.title=this.title,this.addClass("min"),this.min=!0),this.max&&(this.removeClass("max"),this.max=!1),this},Gt.maximize=function(s){return(typeof s>"u"||s!==this.max)&&(this.min&&_(this),(this.max=!this.max)?this.addClass("max").resize(d-this.left-this.right,N-this.top-this.bottom,!0).move(this.left,this.top,!0):this.resize().move().removeClass("max")),this},Gt.fullscreen=function(s){return(typeof s>"u"||s!==pe)&&(this.min&&(this.resize().move(),_(this)),pe&&h()||(this.body[ne](),pe=!0)),this},Gt.close=function(s){if(this.onclose&&this.onclose(s))return!0;this.min&&_(this),this.unmount(),this.g.parentNode.removeChild(this.g),_e===this&&(_e=null)},Gt.move=function(s,u,o){return s||0===s?o||(this.x=s?s=f(s,d-this.left-this.right,this.width):0,this.y=u?u=f(u,N-this.top-this.bottom,this.height):0):(s=this.x,u=this.y,this.l&&(0===s||s===d-this.width)&&this.resize(d/2,N)),Q(this.g,"transform","translate("+s+"px,"+u+"px)"),this.onmove&&this.onmove(s,u),this},Gt.resize=function(s,u,o){return s||0===s?o||(this.width=s?s=f(s,d-this.left-this.right):0,this.height=u?u=f(u,N-this.top-this.bottom):0):(s=this.width,u=this.height),s=Math.max(s,this.j),u=Math.max(u,this.i),Q(this.g,"width",s+"px"),Q(this.g,"height",u+"px"),this.onresize&&this.onresize(s,u),this},Gt.addClass=function(s){return this.g.classList.add(s),this},Gt.removeClass=function(s){return this.g.classList.remove(s),this},window.WinBox=A}.call(this),function(Gt){"object"==typeof exports&&typeof module<"u"?module.exports=Gt():"function"==typeof define&&define.amd?define([],Gt):(typeof window>"u"?typeof global>"u"?typeof self>"u"?this:self:global:window).WebTorrent=Gt()}(function(){var Gt=Math.LN2,gn=Math.log,H=Math.pow,At=Math.abs,xt=Math.floor,kt=Math.round,Q=Math.sin,je=Math.cos,Pe=Math.PI,y=Math.imul,he=Math.clz32,te=String.fromCharCode,pe=Math.max,_e=Math.ceil,ne=Math.min;return function d(N,A,f){function b(n,g){if(!A[n]){if(!N[n]){var h="function"==typeof require&&require;if(!g&&h)return h(n,!0);if(m)return m(n,!0);var s=new Error("Cannot find module '"+n+"'");throw s.code="MODULE_NOT_FOUND",s}var u=A[n]={exports:{}};N[n][0].call(u.exports,function(o){return b(N[n][1][o]||o)},u,u.exports,d,N,A,f)}return A[n].exports}for(var m="function"==typeof require&&require,_=0;_{this._notify()})}_read(m){this._reading||(this._reading=!0,this._notify(m))}_notify(m=(()=>{})){if(!this._reading||0===this._missing)return m();if(!this._torrent.bitfield.get(this._piece))return m(),this._torrent.critical(this._piece,this._piece+this._criticalLength);if(this._notifying)return m();if(this._notifying=!0,this._torrent.destroyed)return this.destroy(new Error("Torrent removed"));const _=this._piece,n={};_===this._torrent.pieces.length-1&&(n.length=this._torrent.lastPieceLength),this._torrent.store.get(_,n,(g,h)=>{if(this._notifying=!1,!this.destroyed)return b("read %s (length %s) (err %s)",_,h&&h.length,g&&g.message),g?this.destroy(g):(this._offset&&(h=h.slice(this._offset),this._offset=0),this._missingk===t.length-1?c:a,C=k=>{const I=k===t.length-1?c:a;return r.get(k)?I:I-t[k].missing};let z=0;for(let k=l;k<=w;k+=1){const I=C(k);if(z+=I,k===l&&(z-=ne(this.offset%a,I)),k===w){const V=E(w)-(this.offset+this.length)%a;z-=ne(V,I)}}return z}get progress(){return this.length?this.downloaded/this.length:0}select(t){0===this.length||this._torrent.select(this._startPiece,this._endPiece,t)}deselect(){0===this.length||this._torrent.deselect(this._startPiece,this._endPiece,!1)}createReadStream(t){if(0===this.length){const a=new f;return g(()=>{a.end()}),a}const r=new o(this,t);return this._fileStreams.add(r),r.once("close",()=>{this._fileStreams.delete(r)}),r}getBuffer(t){n(this.createReadStream(),this.length,t)}getBlob(t){if(typeof window>"u")throw new Error("browser-only method");const r=new _(a=>{t(null,a)},{mimeType:this._getMimeType()});this.createReadStream().pipe(r)}getBlobURL(t){this.getBlob((r,a)=>{t(null,URL.createObjectURL(a))})}appendTo(t,r,a){if(typeof window>"u")throw new Error("browser-only method");m.append(this,t,r,a)}renderTo(t,r,a){if(typeof window>"u")throw new Error("browser-only method");m.render(this,t,r,a)}_serve(t){const r={status:200,headers:{"Accept-Ranges":"bytes","Content-Type":s.getType(this.name),"Cache-Control":"no-cache, no-store, must-revalidate, max-age=0",Expires:"0"},body:"HEAD"===t.method?"":"STREAM"};"document"===t.destination&&(r.headers["Content-Type"]="application/octet-stream",r.headers["Content-Disposition"]="attachment",r.body="DOWNLOAD");let a=h(this.length,t.headers.range||"");a.constructor===Array?(r.status=206,a=a[0],r.headers["Content-Range"]=`bytes ${a.start}-${a.end}/${this.length}`,r.headers["Content-Length"]=""+(a.end-a.start+1)):r.headers["Content-Length"]=this.length;const c="GET"===t.method&&this.createReadStream(a);let l=null;return c&&this.emit("stream",{stream:c,req:t,file:this},w=>{l=w,u(w,()=>{w&&w.destroy(),c.destroy()})}),[r,l||c,l&&c]}getStreamURL(t=(()=>{})){if(typeof window>"u")throw new Error("browser-only method");if(!this._serviceWorker)throw new Error("No worker registered");if("activated"!==this._serviceWorker.state)throw new Error("Worker isn't activated");t(null,`${this._serviceWorker.scriptURL.slice(0,this._serviceWorker.scriptURL.lastIndexOf("/")+1).slice(window.location.origin.length)}webtorrent/${this._torrent.infoHash}/${encodeURI(this.path)}`)}streamTo(t,r=(()=>{})){if(typeof window>"u")throw new Error("browser-only method");if(!this._serviceWorker)throw new Error("No worker registered");if("activated"!==this._serviceWorker.state)throw new Error("Worker isn't activated");const a=this._serviceWorker.scriptURL.slice(0,this._serviceWorker.scriptURL.lastIndexOf("/")+1).slice(window.location.origin.length);t.src=`${a}webtorrent/${this._torrent.infoHash}/${encodeURI(this.path)}`,r(null,t)}_getMimeType(){return m.mime[b.extname(this.name).toLowerCase()]}_destroy(){this._destroyed=!0,this._torrent=null;for(const t of this._fileStreams)t.destroy();this._fileStreams.clear()}}},{"./file-stream.js":1,"end-of-stream":121,events:123,"fast-blob-stream":125,mime:165,path:185,"queue-microtask":206,"range-parser":211,"render-media":229,"stream-with-known-length-to-buffer":263,streamx:264}],3:[function(d,N,A){const f=d("events"),{Transform:b}=d("stream"),m=d("unordered-array-remove"),_=d("debug"),n=d("bittorrent-protocol"),g=_("webtorrent:peer");let h=!1;A.enableSecure=()=>{h=!0},A.createWebRTCPeer=(t,r,a)=>{const c=new o(t.id,"webrtc");if(c.conn=t,c.swarm=r,c.throttleGroups=a,c.conn.connected)c.onConnect();else{const l=()=>{c.conn.removeListener("connect",w),c.conn.removeListener("error",E)},w=()=>{l(),c.onConnect()},E=C=>{l(),c.destroy(C)};c.conn.once("connect",w),c.conn.once("error",E),c.startConnectTimeout()}return c},A.createTCPIncomingPeer=(t,r)=>s(t,"tcpIncoming",r),A.createUTPIncomingPeer=(t,r)=>s(t,"utpIncoming",r),A.createTCPOutgoingPeer=(t,r,a)=>u(t,r,"tcpOutgoing",a),A.createUTPOutgoingPeer=(t,r,a)=>u(t,r,"utpOutgoing",a);const s=(t,r,a)=>{const c=`${t.remoteAddress}:${t.remotePort}`,l=new o(c,r);return l.conn=t,l.addr=c,l.throttleGroups=a,l.onConnect(),l},u=(t,r,a,c)=>{const l=new o(t,a);return l.addr=t,l.swarm=r,l.throttleGroups=c,l};A.createWebSeedPeer=(t,r,a,c)=>{const l=new o(r,"webSeed");return l.swarm=a,l.conn=t,l.throttleGroups=c,l.onConnect(),l};class o extends f{constructor(r,a){super(),this.id=r,this.type=a,g("new %s Peer %s",a,r),this.addr=null,this.conn=null,this.swarm=null,this.wire=null,this.connected=!1,this.destroyed=!1,this.timeout=null,this.retries=0,this.sentPe1=!1,this.sentPe2=!1,this.sentPe3=!1,this.sentPe4=!1,this.sentHandshake=!1}onConnect(){if(!this.destroyed){this.connected=!0,g("Peer %s connected",this.id),clearTimeout(this.connectTimeout);const r=this.conn;r.once("end",()=>{this.destroy()}),r.once("close",()=>{this.destroy()}),r.once("finish",()=>{this.destroy()}),r.once("error",c=>{this.destroy(c)});const a=this.wire=new n(this.type,this.retries,h);a.once("end",()=>{this.destroy()}),a.once("close",()=>{this.destroy()}),a.once("finish",()=>{this.destroy()}),a.once("error",c=>{this.destroy(c)}),a.once("pe1",()=>{this.onPe1()}),a.once("pe2",()=>{this.onPe2()}),a.once("pe3",()=>{this.onPe3()}),a.once("pe4",()=>{this.onPe4()}),a.once("handshake",(c,l)=>{this.onHandshake(c,l)}),this.startHandshakeTimeout(),this.setThrottlePipes(),this.swarm&&("tcpOutgoing"===this.type?h&&0===this.retries&&!this.sentPe1?this.sendPe1():!this.sentHandshake&&this.handshake():"tcpIncoming"!==this.type&&!this.sentHandshake&&this.handshake())}}sendPe1(){this.wire.sendPe1(),this.sentPe1=!0}onPe1(){this.sendPe2()}sendPe2(){this.wire.sendPe2(),this.sentPe2=!0}onPe2(){this.sendPe3()}sendPe3(){this.wire.sendPe3(this.swarm.infoHash),this.sentPe3=!0}onPe3(r){this.swarm&&(this.swarm.infoHashHash!==r&&this.destroy(new Error("unexpected crypto handshake info hash for this swarm")),this.sendPe4())}sendPe4(){this.wire.sendPe4(this.swarm.infoHash),this.sentPe4=!0}onPe4(){this.sentHandshake||this.handshake()}clearPipes(){this.conn.unpipe(),this.wire.unpipe()}setThrottlePipes(){const r=this;this.conn.pipe(this.throttleGroups.down.throttle()).pipe(new b({transform(a,c,l){r.emit("download",a.length),r.destroyed||l(null,a)}})).pipe(this.wire).pipe(this.throttleGroups.up.throttle()).pipe(new b({transform(a,c,l){r.emit("upload",a.length),r.destroyed||l(null,a)}})).pipe(this.conn)}onHandshake(r,a){if(!this.swarm||this.destroyed)return;if(this.swarm.destroyed)return this.destroy(new Error("swarm already destroyed"));if(r!==this.swarm.infoHash)return this.destroy(new Error("unexpected handshake info hash for this swarm"));if(a===this.swarm.peerId)return this.destroy(new Error("refusing to connect to ourselves"));g("Peer %s got handshake %s",this.id,r),clearTimeout(this.handshakeTimeout),this.retries=0;let c=this.addr;!c&&this.conn.remoteAddress&&this.conn.remotePort&&(c=`${this.conn.remoteAddress}:${this.conn.remotePort}`),this.swarm._onWire(this.wire,c),this.swarm&&!this.swarm.destroyed&&(this.sentHandshake||this.handshake())}handshake(){this.wire.handshake(this.swarm.infoHash,this.swarm.client.peerId,{dht:!this.swarm.private&&!!this.swarm.client.dht,fast:!0}),this.sentHandshake=!0}startConnectTimeout(){clearTimeout(this.connectTimeout),this.connectTimeout=setTimeout(()=>{this.destroy(new Error("connect timeout"))},{webrtc:25e3,tcpOutgoing:5e3,utpOutgoing:5e3}[this.type]),this.connectTimeout.unref&&this.connectTimeout.unref()}startHandshakeTimeout(){clearTimeout(this.handshakeTimeout),this.handshakeTimeout=setTimeout(()=>{this.destroy(new Error("handshake timeout"))},25e3),this.handshakeTimeout.unref&&this.handshakeTimeout.unref()}destroy(r){if(this.destroyed)return;this.destroyed=!0,this.connected=!1,g("destroy %s %s (error: %s)",this.type,this.id,r&&(r.message||r)),clearTimeout(this.connectTimeout),clearTimeout(this.handshakeTimeout);const a=this.swarm,c=this.conn,l=this.wire;this.swarm=null,this.conn=null,this.wire=null,a&&l&&m(a.wires,a.wires.indexOf(l)),c&&(c.on("error",()=>{}),c.destroy()),l&&l.destroy(),a&&a.removePeer(this.id)}}},{"bittorrent-protocol":32,debug:91,events:123,stream:256,"unordered-array-remove":273}],4:[function(d,N){N.exports=class{constructor(A){this._torrent=A,this._numPieces=A.pieces.length,this._pieces=Array(this._numPieces),this._onWire=f=>{this.recalculate(),this._initWire(f)},this._onWireHave=f=>{this._pieces[f]+=1},this._onWireBitfield=()=>{this.recalculate()},this._torrent.wires.forEach(f=>{this._initWire(f)}),this._torrent.on("wire",this._onWire),this.recalculate()}getRarestPiece(A){let f=[],b=1/0;for(let m=0;m{this._cleanupWireEvents(A)}),this._torrent=null,this._pieces=null,this._onWire=null,this._onWireHave=null,this._onWireBitfield=null}_initWire(A){A._onClose=()=>{this._cleanupWireEvents(A);for(let f=0;f"u")throw new Error("browser-only property");return this.torrentFile?URL.createObjectURL(new Blob([this.torrentFile],{type:"application/x-bittorrent"})):null}get _numQueued(){return this._queue.length+(this._peersLength-this._numConns)}get _numConns(){let J=0;for(const O in this._peers)this._peers[O].connected&&(J+=1);return J}_onTorrentId(J){if(this.destroyed)return;let O;try{O=Ae(J)}catch{}O?(this.infoHash=O.infoHash,this._debugId=O.infoHash.toString("hex").substring(0,7),D(()=>{this.destroyed||this._onParsedTorrent(O)})):Ae.remote(J,(W,ee)=>this.destroyed?void 0:W?this._destroy(W):void this._onParsedTorrent(ee))}_onParsedTorrent(J){if(!this.destroyed){if(this._processParsedTorrent(J),!this.infoHash)return this._destroy(new Error("Malformed torrent data: No info hash"));this._rechokeIntervalId=setInterval(()=>{this._rechoke()},1e4),this._rechokeIntervalId.unref&&this._rechokeIntervalId.unref(),this.emit("_infoHash",this.infoHash),!this.destroyed&&(this.emit("infoHash",this.infoHash),this.destroyed||(this.client.listening?this._onListening():this.client.once("listening",()=>{this._onListening()})))}}_processParsedTorrent(J){this._debugId=J.infoHash.toString("hex").substring(0,7),typeof this.private<"u"&&(J.private=this.private),this.announce&&(J.announce=J.announce.concat(this.announce)),this.client.tracker&&f.WEBTORRENT_ANNOUNCE&&!J.private&&(J.announce=J.announce.concat(f.WEBTORRENT_ANNOUNCE)),this.urlList&&(J.urlList=J.urlList.concat(this.urlList)),J.announce=Array.from(new Set(J.announce)),J.urlList=Array.from(new Set(J.urlList)),Object.assign(this,J),this.magnetURI=Ae.toMagnetURI(J),this.torrentFile=Ae.toTorrentFile(J)}_onListening(){this.destroyed||(this.info?this._onMetadata(this):(this.xs&&this._getMetadataFromServer(),this._startDiscovery()))}_startDiscovery(){if(this.discovery||this.destroyed)return;let J=this.client.tracker;J&&(J=Object.assign({},this.client.tracker,{getAnnounceOpts:()=>{if(!this.destroyed){const O={uploaded:this.uploaded,downloaded:this.downloaded,left:pe(this.length-this.downloaded,0)};return this.client.tracker.getAnnounceOpts&&Object.assign(O,this.client.tracker.getAnnounceOpts()),this._getAnnounceOpts&&Object.assign(O,this._getAnnounceOpts()),O}}})),this.peerAddresses&&this.peerAddresses.forEach(O=>this.addPeer(O)),this.discovery=new E({infoHash:this.infoHash,announce:this.announce,peerId:this.client.peerId,dht:!this.private&&this.client.dht,tracker:J,port:this.client.torrentPort,userAgent:Yt,lsd:this.client.lsd}),this.discovery.on("error",O=>{this._destroy(O)}),this.discovery.on("peer",(O,W)=>{this._debug("peer %s discovered via %s",O,W),"string"==typeof O&&this.done||this.addPeer(O)}),this.discovery.on("trackerAnnounce",()=>{this.emit("trackerAnnounce"),0===this.numPeers&&this.emit("noPeers","tracker")}),this.discovery.on("dhtAnnounce",()=>{this.emit("dhtAnnounce"),0===this.numPeers&&this.emit("noPeers","dht")}),this.discovery.on("warning",O=>{this.emit("warning",O)})}_getMetadataFromServer(){const O=this,ee=(Array.isArray(this.xs)?this.xs:[this.xs]).map(ve=>He=>{!function J(ve,He){if(0!==ve.indexOf("http://")&&0!==ve.indexOf("https://"))return O.emit("warning",new Error(`skipping non-http xs param: ${ve}`)),He(null);let st;try{st=z.concat({url:ve,method:"GET",headers:{"user-agent":Yt}},function ht(Jt,on,Ht){if(O.destroyed||O.metadata)return He(null);if(Jt)return O.emit("warning",new Error(`http error from xs param: ${ve}`)),He(null);if(200!==on.statusCode)return O.emit("warning",new Error(`non-200 status code ${on.statusCode} from xs param: ${ve}`)),He(null);let wn;try{wn=Ae(Ht)}catch{}return wn?wn.infoHash===O.infoHash?(O._onMetadata(wn),void He(null)):(O.emit("warning",new Error(`got torrent file with incorrect info hash from xs param: ${ve}`)),He(null)):(O.emit("warning",new Error(`got invalid torrent file from xs param: ${ve}`)),He(null))})}catch{return O.emit("warning",new Error(`skipping invalid url xs param: ${ve}`)),He(null)}O._xsRequests.push(st)}(ve,He)});oe(ee)}_onMetadata(J){if(this.metadata||this.destroyed)return;let O;if(this._debug("got metadata"),this._xsRequests.forEach(ee=>{ee.abort()}),this._xsRequests=[],J&&J.infoHash)O=J;else try{O=Ae(J)}catch(ee){return this._destroy(ee)}this._processParsedTorrent(O),this.metadata=this.torrentFile,this.client.enableWebSeeds&&this.urlList.forEach(ee=>{this.addWebSeed(ee)}),this._rarityMap=new Ee(this),this.files=this.files.map(ee=>new Y(this,ee));let W=this._preloadedStore;if(W||(W=new this._store(this.pieceLength,{...this.storeOpts,torrent:this,path:this.path,files:this.files,length:this.length,name:this.name+" - "+this.infoHash.slice(0,8),addUID:this.addUID})),0{this.so.includes(ve)?this.files[ve].select():this.files[ve].deselect()}):0!==this.pieces.length&&this.select(0,this.pieces.length-1,!1),this._hashes=this.pieces,this.pieces=this.pieces.map((ee,ve)=>new X(ve===this.pieces.length-1?this.lastPieceLength:this.pieceLength)),this._reservations=this.pieces.map(()=>[]),this.bitfield=new r(this.pieces.length),this.emit("metadata"),!this.destroyed)if(this.skipVerify)this._markAllVerified(),this._onStore();else{const ee=ve=>ve?this._destroy(ve):(this._debug("done verifying"),void this._onStore());this._debug("verifying existing torrent data"),this._fileModtimes&&this._store===C?this.getFileModtimes((ve,He)=>{if(ve)return this._destroy(ve);this.files.map((st,Jt)=>He[Jt]===this._fileModtimes[Jt]).every(st=>st)?(this._markAllVerified(),this._onStore()):this._verifyPieces(ee)}):this._verifyPieces(ee)}}getFileModtimes(J){const O=[];ue(this.files.map((W,ee)=>ve=>{const He=this.addUID?o.join(this.name+" - "+this.infoHash.slice(0,8)):o.join(this.path,W.path);h.stat(He,(ht,st)=>ht&&"ENOENT"!==ht.code?ve(ht):(O[ee]=st&&st.mtime.getTime(),void ve(null)))}),tt,W=>{this._debug("done getting file modtimes"),J(W,O)})}_verifyPieces(J){ue(this.pieces.map((O,W)=>ee=>{if(this.destroyed)return ee(new Error("torrent is destroyed"));const ve={};W===this.pieces.length-1&&(ve.length=this.lastPieceLength),this.store.get(W,ve,(He,ht)=>this.destroyed?ee(new Error("torrent is destroyed")):He?D(()=>ee(null)):void v(ht,st=>this.destroyed?ee(new Error("torrent is destroyed")):(st===this._hashes[W]?(this._debug("piece verified %s",W),this._markVerified(W)):this._debug("piece invalid %s",W),void ee(null))))}),tt,J)}rescanFiles(J){if(this.destroyed)throw new Error("torrent is destroyed");J||(J=n),this._verifyPieces(O=>O?(this._destroy(O),J(O)):(this._checkDone(),void J(null)))}_markAllVerified(){for(let J=0;JJ))return!0;return!1}_onStore(){this.destroyed||(this._debug("on store"),this._startDiscovery(),this.ready=!0,this.emit("ready"),this._checkDone(),this._updateSelections(),this.wires.forEach(J=>{J.ut_metadata&&J.ut_metadata.setMetadata(this.metadata),this._onWireWithMetadata(J)}))}destroy(J,O){return"function"==typeof J?this.destroy(null,J):void this._destroy(null,J,O)}_destroy(J,O,W){if("function"==typeof O)return this._destroy(J,null,O);if(!this.destroyed){for(const ve in this.destroyed=!0,this._debug("destroy"),this.client._remove(this),clearInterval(this._rechokeIntervalId),this._xsRequests.forEach(He=>{He.abort()}),this._rarityMap&&this._rarityMap.destroy(),this._peers)this.removePeer(ve);this.files.forEach(ve=>{ve instanceof Y&&ve._destroy()});const ee=this._servers.map(ve=>He=>{ve.destroy(He)});if(this.discovery&&ee.push(ve=>{this.discovery.destroy(ve)}),this.store){let ve=this._destroyStoreOnDestroy;O&&void 0!==O.destroyStore&&(ve=O.destroyStore),ee.push(He=>{ve?this.store.destroy(He):this.store.close(He)})}oe(ee,W),J&&(0===this.listenerCount("error")?this.client.emit("error",J):this.emit("error",J)),this.emit("close"),this.client=null,this.files=[],this.discovery=null,this.store=null,this._rarityMap=null,this._peers=null,this._servers=null,this._xsRequests=null}}addPeer(J){if(this.destroyed)throw new Error("torrent is destroyed");if(!this.infoHash)throw new Error("addPeer() must not be called before the `infoHash` event");let O;if(this.client.blocked){if("string"==typeof J){let ve;try{ve=t(J)}catch{return this._debug("ignoring peer: invalid %s",J),this.emit("invalidPeer",J),!1}O=ve[0]}else"string"==typeof J.remoteAddress&&(O=J.remoteAddress);if(O&&this.client.blocked.contains(O))return this._debug("ignoring peer: blocked %s",J),"string"!=typeof J&&J.destroy(),this.emit("blockedPeer",J),!1}const W=this.client.utp&&this._isIPv4(O)?"utp":"tcp",ee=!!this._addPeer(J,W);return this.emit(ee?"peer":"invalidPeer",J),ee}_addPeer(J,O){if(this.destroyed)return"string"!=typeof J&&J.destroy(),null;if("string"==typeof J&&!this._validAddr(J))return this._debug("ignoring peer: invalid %s",J),null;const W=J&&J.id||J;if(this._peers[W])return this._debug("ignoring peer: duplicate (%s)",W),"string"!=typeof J&&J.destroy(),null;if(this.paused)return this._debug("ignoring peer: torrent is paused"),"string"!=typeof J&&J.destroy(),null;let ee;return this._debug("add peer %s",W),ee="string"==typeof J?"utp"===O?se.createUTPOutgoingPeer(J,this,this.client.throttleGroups):se.createTCPOutgoingPeer(J,this,this.client.throttleGroups):se.createWebRTCPeer(J,this,this.client.throttleGroups),this._registerPeer(ee),"string"==typeof J&&(this._queue.push(ee),this._drain()),ee}addWebSeed(J){if(this.destroyed)throw new Error("torrent is destroyed");let O,W;if("string"==typeof J){if(O=J,!/^https?:\/\/.+/.test(O))return this.emit("warning",new Error(`ignoring invalid web seed: ${O}`)),void this.emit("invalidPeer",O);if(this._peers[O])return this.emit("warning",new Error(`ignoring duplicate web seed: ${O}`)),void this.emit("invalidPeer",O);W=new Qe(O,this)}else{if(!J||"string"!=typeof J.connId)return void this.emit("warning",new Error("addWebSeed must be passed a string or connection object with id property"));if(W=J,O=W.connId,this._peers[O])return this.emit("warning",new Error(`ignoring duplicate web seed: ${O}`)),void this.emit("invalidPeer",O)}this._debug("add web seed %s",O);const ee=se.createWebSeedPeer(W,O,this,this.client.throttleGroups);this._registerPeer(ee),this.emit("peer",O)}_addIncomingPeer(J){return this.destroyed?J.destroy(new Error("torrent is destroyed")):this.paused?J.destroy(new Error("torrent is paused")):(this._debug("add incoming peer %s",J.id),void this._registerPeer(J))}_registerPeer(J){J.on("download",O=>{this.destroyed||(this.received+=O,this._downloadSpeed(O),this.client._downloadSpeed(O),this.emit("download",O),this.destroyed||this.client.emit("download",O))}),J.on("upload",O=>{this.destroyed||(this.uploaded+=O,this._uploadSpeed(O),this.client._uploadSpeed(O),this.emit("upload",O),this.destroyed||this.client.emit("upload",O))}),this._peers[J.id]=J,this._peersLength+=1}removePeer(J){const O=J?.id||J;J&&!J.id&&(J=this._peers?.[O]),J&&(J.destroy(),this.destroyed||(this._debug("removePeer %s",O),delete this._peers[O],this._peersLength-=1,this._drain()))}select(J,O,W,ee){if(this.destroyed)throw new Error("torrent is destroyed");if(0>J||OHe.priority-ve.priority),this._updateSelections()}deselect(J,O,W){if(this.destroyed)throw new Error("torrent is destroyed");this._debug("deselect %s-%s (priority %s)",J,O,W=+W||0);for(let ee=0;eethis.destroyed||this.client.dht.destroyed?void 0:J.remoteAddress?0===W||65536{this._debug("wire timeout (%s)",O),J.destroy()}),"webSeed"!==J.type&&J.setTimeout(3e4,!0),J.setKeepAlive(!0),J.use(F(this.metadata)),J.ut_metadata.on("warning",W=>{this._debug("ut_metadata warning: %s",W.message)}),this.metadata||(J.ut_metadata.on("metadata",W=>{this._debug("got metadata via ut_metadata"),this._onMetadata(W)}),J.ut_metadata.fetch()),"function"!=typeof q||this.private||(J.use(q()),J.ut_pex.on("peer",W=>{this.done||(this._debug("ut_pex: got peer: %s (from %s)",W,O),this.addPeer(W))}),J.ut_pex.on("dropped",W=>{const ee=this._peers[W];ee&&!ee.connected&&(this._debug("ut_pex: dropped peer: %s (from %s)",W,O),this.removePeer(W))}),J.once("close",()=>{J.ut_pex.reset()})),J.use(I()),this.emit("wire",J,O),this.ready&&D(()=>{this._onWireWithMetadata(J)})}_onWireWithMetadata(J){let O=null;const W=()=>{this.destroyed||J.destroyed||(this._numQueued>2*(this._numConns-this.numPeers)&&J.amInterested?J.destroy():(O=setTimeout(W,5e3),O.unref&&O.unref()))};let ee;const ve=()=>{if(J.peerPieces.buffer.length===this.bitfield.buffer.length){for(ee=0;ee{ve(),this._update(),this._updateWireInterest(J)}),J.on("have",()=>{ve(),this._update(),this._updateWireInterest(J)}),J.lt_donthave.on("donthave",()=>{ve(),this._update(),this._updateWireInterest(J)}),J.on("have-all",()=>{J.isSeeder=!0,J.choke(),this._update(),this._updateWireInterest(J)}),J.on("have-none",()=>{J.isSeeder=!1,this._update(),this._updateWireInterest(J)}),J.on("allowed-fast",()=>{this._update()}),J.once("interested",()=>{J.unchoke()}),J.once("close",()=>{clearTimeout(O)}),J.on("choke",()=>{clearTimeout(O),O=setTimeout(W,5e3),O.unref&&O.unref()}),J.on("unchoke",()=>{clearTimeout(O),this._update()}),J.on("request",(He,ht,st,Jt)=>st>131072?J.destroy():void(this.pieces[He]||this.store.get(He,{offset:ht,length:st},Jt))),J.hasFast&&this._hasAllPieces()?J.haveAll():J.hasFast&&this._hasNoPieces()?J.haveNone():J.bitfield(this.bitfield),this._updateWireInterest(J),J.peerExtensions.dht&&this.client.dht&&this.client.dht.listening&&J.port(this.client.dht.address().port),"webSeed"!==J.type&&(O=setTimeout(W,5e3),O.unref&&O.unref()),J.isSeeder=!1,ve()}_updateSelections(){!this.ready||this.destroyed||(D(()=>{this._gcSelections()}),this._updateInterest(),this._update())}_gcSelections(){for(let J=0;Jthis._updateWireInterest(O)),J===this._amInterested||this.emit(this._amInterested?"interested":"uninterested")}_updateWireInterest(J){let O=!1;for(let W=0;W{O._updateWire(J)},{timeout:250}):O._updateWire(J)}_updateWire(J){function O(Jt,on,Ht,wn){return sn=>sn>=Jt&&sn<=on&&!(sn in Ht)&&J.peerPieces.get(sn)&&(!wn||wn(sn))}function ee(Jt){let on=Jt;for(let wn=Jt;wn=st)return!0;const on=function W(){const Jt=J.downloadSpeed()||1;if(Jt>$t)return()=>!0;const on=pe(1,J.requests.length)*X.BLOCK_LENGTH/Jt;let Ht=10,wn=0;return sn=>{if(!Ht||He.bitfield.get(sn))return!0;for(let Sn=He.pieces[sn].missing;wnsn));){for(;He._request(J,sn,He._critical[sn]||Jt)&&J.requests.length=ht)return;const st=b(J,1);return J.peerChoking?void(J.hasFast&&0=st)return!1;for(const Jt of J.peerAllowedFastSet){if(J.peerPieces.get(Jt)&&!He.bitfield.get(Jt))for(;He._request(J,Jt,!1)&&J.requests.lengthHt));){if(He._request(J,Ht,!1))return;Sn[Ht]=!0,fr+=1}}else for(Ht=on.to;Ht>=on.from+on.offset;--Ht)if(J.peerPieces.get(Ht)&&He._request(J,Ht,!1))return}}()}_rechoke(){if(this.ready){const J=this.wires.map(O=>({wire:O,random:Math.random()})).sort((O,W)=>{const ee=O.wire,ve=W.wire;return ee.downloadSpeed()===ve.downloadSpeed()?ee.uploadSpeed()===ve.uploadSpeed()?ee.amChoking===ve.amChoking?O.random-W.random:ee.amChoking?-1:1:ee.uploadSpeed()-ve.uploadSpeed():ee.downloadSpeed()-ve.downloadSpeed()}).map(O=>O.wire);0>=this._rechokeOptimisticTime?this._rechokeOptimisticWire=null:this._rechokeOptimisticTime-=1;for(let O=0;0W.peerInterested);if(0O!==this._rechokeOptimisticWire).forEach(O=>O.choke())}}_hotswap(J,O){const W=J.downloadSpeed();if(W=$t||2*Jt>W||Jt>ve||(He=st,ve=Jt)}if(!He)return!1;for(ht=0;ht{ve._update()})}const ve=this,He=J.requests.length,ht="webSeed"===J.type;if(ve.bitfield.get(O))return!1;const st=ht?ne(function m(J,O,W){return 1+_e(O*J.downloadSpeed()/W)}(J,1,ve.pieceLength),ve.maxWebConns):b(J,1);if(He>=st)return!1;const Jt=ve.pieces[O];let on=ht?Jt.reserveRemaining():Jt.reserve();if(-1===on&&W&&ve._hotswap(J,O)&&(on=ht?Jt.reserveRemaining():Jt.reserve()),-1===on)return!1;let Ht=ve._reservations[O];Ht||(Ht=ve._reservations[O]=[]);let wn=Ht.indexOf(null);-1===wn&&(wn=Ht.length),Ht[wn]=J;const sn=Jt.chunkOffset(on),Sn=ht?Jt.chunkLengthRemaining(on):Jt.chunkLength(on);return J.request(O,sn,Sn,function fr(Dn,Rt){if(ve.destroyed)return;if(!ve.ready)return ve.once("ready",()=>{fr(Dn,Rt)});if(Ht[wn]===J&&(Ht[wn]=null),Jt!==ve.pieces[O])return ee();if(Dn)return ve._debug("error getting piece %s (offset: %s length: %s) from %s: %s",O,sn,Sn,`${J.remoteAddress}:${J.remotePort}`,Dn.message),ht?Jt.cancelRemaining(on):Jt.cancel(on),void ee();if(ve._debug("got piece %s (offset: %s length: %s) from %s",O,sn,Sn,`${J.remoteAddress}:${J.remotePort}`),!Jt.set(on,Rt,J))return ee();const vr=Jt.flush();v(vr,de=>{ve.destroyed||(de===ve._hashes[O]?(ve._debug("piece verified %s",O),ve.store.put(O,vr,Le=>Le?void ve._destroy(Le):(ve.pieces[O]=null,ve._markVerified(O),ve.wires.forEach(et=>{et.have(O)}),ve._checkDone()&&!ve.destroyed&&ve.discovery.complete(),void ee()))):(ve.pieces[O]=new X(Jt.length),ve.emit("warning",new Error(`Piece ${O} failed verification`)),ee()))})}),!0}_checkDone(){if(this.destroyed)return;this.files.forEach(O=>{if(!O.done){for(let W=O._startPiece;W<=O._endPiece;++W)if(!this.bitfield.get(W))return;O.done=!0,O.emit("done"),this._debug(`file done: ${O.name}`)}});let J=!0;for(const O of this._selections){for(let W=O.from;W<=O.to;W++)if(!this.bitfield.get(W)){J=!1;break}if(!J)break}return!this.done&&J?(this.done=!0,this._debug(`torrent done: ${this.infoHash}`),this.emit("done")):this.done=!1,this._gcSelections(),J}load(J,O){if(this.destroyed)throw new Error("torrent is destroyed");if(!this.ready)return this.once("ready",()=>{this.load(J,O)});Array.isArray(J)||(J=[J]),O||(O=n);const W=L.from($(J)),ee=new c(this.store,this.pieceLength);T(W,ee,ve=>ve?O(ve):(this._markAllVerified(),this._checkDone(),void O(null)))}createServer(J){if("function"!=typeof Se)throw new Error("node.js-only method");if(this.destroyed)throw new Error("torrent is destroyed");const O=new Se(this,J);return this._servers.push(O),O}pause(){this.destroyed||(this._debug("pause"),this.paused=!0)}resume(){this.destroyed||(this._debug("resume"),this.paused=!1,this._drain())}_debug(){const J=[].slice.call(arguments);J[0]=`[${this.client?this.client._debugId:"No Client"}] [${this._debugId}] ${J[0]}`,Je(...J)}_drain(){if(this._debug("_drain numConns %s maxConns %s",this._numConns,this.client.maxConns),"function"!=typeof s.connect||this.destroyed||this.paused||this._numConns>=this.client.maxConns)return;this._debug("drain (%s queued, %s/%s peers)",this._numQueued,this.numPeers,this.client.maxConns);const J=this._queue.shift();if(!J)return;this._debug("%s connect attempt to %s",J.type,J.addr);const O=t(J.addr),W={host:O[0],port:O[1]};J.conn=this.client.utp&&"utpOutgoing"===J.type?Ie.connect(W.port,W.host):s.connect(W);const ee=J.conn;ee.once("connect",()=>{this.destroyed||J.onConnect()}),ee.once("error",ve=>{J.destroy(ve)}),J.startConnectTimeout(),ee.on("close",()=>{if(!this.destroyed){if(J.retries>=at.length){if(this.client.utp){const ht=this._addPeer(J.addr,"tcp");ht&&(ht.retries=0)}else this._debug("conn %s closed: will not re-add (max %s attempts)",J.addr,at.length);return}const ve=at[J.retries];this._debug("conn %s closed: will re-add to queue in %sms (attempt %s)",J.addr,ve,J.retries+1);const He=setTimeout(()=>{if(!this.destroyed){const ht=t(J.addr)[0],st=this.client.utp&&this._isIPv4(ht)?"utp":"tcp",Jt=this._addPeer(J.addr,st);Jt&&(Jt.retries=J.retries+1)}},ve);He.unref&&He.unref()}})}_validAddr(J){let O;try{O=t(J)}catch{return!1}const ee=O[1];return 0ee&&("127.0.0.1"!==O[0]||ee!==this.client.torrentPort)}_isIPv4(J){return/^((?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$/.test(J)}}}).call(this)}).call(this,d("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"../package.json":282,"./file.js":2,"./peer.js":3,"./rarity-map.js":4,"./server.js":42,"./utp.js":42,"./webconn.js":6,_process:193,"addr-to-ip-port":7,bitfield:31,"cache-chunk-store":78,"chunk-store-stream/write":79,cpus:82,debug:91,events:123,fs:42,"fs-chunk-store":161,"immediate-chunk-store":146,"join-async-iterator":150,lt_donthave:157,"memory-chunk-store":161,net:42,os:42,"parse-torrent":184,path:185,pump:201,"queue-microtask":206,"random-iterate":208,"run-parallel":233,"run-parallel-limit":232,"simple-get":246,"simple-sha1":248,streamx:264,throughput:268,"torrent-discovery":270,"torrent-piece":271,ut_metadata:276,ut_pex:42}],6:[function(d,N,A){(function(f){(function(){const{default:b}=d("bitfield"),m=d("debug"),_=d("simple-get"),n=d("lt_donthave"),g=d("simple-sha1"),h=d("bittorrent-protocol"),s=m("webtorrent:webconn"),u=d("../package.json").version;N.exports=class r extends h{constructor(c,l){super(),this.url=c,this.connId=c,this.webPeerId=g.sync(c),this._torrent=l,this._init()}_init(){this.setKeepAlive(!0),this.use(n()),this.once("handshake",(c,l)=>{if(this.destroyed)return;this.handshake(c,this.webPeerId);const w=this._torrent.pieces.length,E=new b(w);for(let C=0;C<=w;C++)E.set(C,!0);this.bitfield(E)}),this.once("interested",()=>{s("interested"),this.unchoke()}),this.on("uninterested",()=>{s("uninterested")}),this.on("choke",()=>{s("choke")}),this.on("unchoke",()=>{s("unchoke")}),this.on("bitfield",()=>{s("bitfield")}),this.lt_donthave.on("donthave",()=>{s("donthave")}),this.on("request",(c,l,w,E)=>{s("request pieceIndex=%d offset=%d length=%d",c,l,w),this.httpRequest(c,l,w,(C,z)=>{if(C){this.lt_donthave.donthave(c);const k=setTimeout(()=>{this.destroyed||this.have(c)},1e4);k.unref&&k.unref()}E(C,z)})})}httpRequest(c,l,w,E){const z=c*this._torrent.pieceLength+l,k=z+w-1,I=this._torrent.files;let V;if(1>=I.length)V=[{url:this.url,start:z,end:k}];else{const Ae=I.filter(X=>X.offset<=k&&X.offset+X.length>z);if(1>Ae.length)return E(new Error("Could not find file corresponding to web seed range request"));V=Ae.map(X=>{const T=X.offset+X.length-1;return{url:this.url+("/"===this.url[this.url.length-1]?"":"/")+X.path.replace(this._torrent.path,""),fileOffsetInRange:pe(X.offset-z,0),start:pe(z-X.offset,0),end:ne(T,k-X.offset)}})}let ue,$=0,oe=!1;1{function X(B,F){return 200>B.statusCode||300<=B.statusCode?oe?void 0:(oe=!0,E(new Error(`Unexpected HTTP status code ${B.statusCode}`))):(s("Got data of length %d",F.length),void(1===V.length?E(null,F):(F.copy(ue,Ae.fileOffsetInRange),++$===V.length&&E(null,ue))))}const T=Ae.url,D=Ae.start,M=Ae.end;s("Requesting url=%s pieceIndex=%d offset=%d length=%d start=%d end=%d",T,c,l,w,D,M);const v={url:T,method:"GET",headers:{"user-agent":`WebTorrent/${u} (https://webtorrent.io)`,range:`bytes=${D}-${M}`},timeout:6e4};_.concat(v,(B,F,q)=>oe?void 0:B?typeof window>"u"||T.startsWith(`${window.location.origin}/`)?(oe=!0,E(B)):_.head(T,(L,Y)=>oe?void 0:L?(oe=!0,E(L)):200>Y.statusCode||300<=Y.statusCode?(oe=!0,E(new Error(`Unexpected HTTP status code ${Y.statusCode}`))):Y.url===T?(oe=!0,E(B)):(v.url=Y.url,void _.concat(v,(se,Ee,Se)=>oe?void 0:se?(oe=!0,E(se)):void X(Ee,Se)))):void X(F,q))})}destroy(){super.destroy(),this._torrent=null}}}).call(this)}).call(this,d("buffer").Buffer)},{"../package.json":282,bitfield:31,"bittorrent-protocol":32,buffer:76,debug:91,lt_donthave:157,"simple-get":246,"simple-sha1":248}],7:[function(d,N,A){const f=/^\[?([^\]]+)]?:(\d+)$/;let b=new Map;N.exports=function(_){if(1e5===b.size&&b.clear(),!b.has(_)){const n=f.exec(_);if(!n)throw new Error(`invalid addr: ${_}`);b.set(_,[n[1],+n[2]])}return b.get(_)}},{}],8:[function(d,N,A){"use strict";const f=A;f.bignum=d("bn.js"),f.define=d("./asn1/api").define,f.base=d("./asn1/base"),f.constants=d("./asn1/constants"),f.decoders=d("./asn1/decoders"),f.encoders=d("./asn1/encoders")},{"./asn1/api":9,"./asn1/base":11,"./asn1/constants":15,"./asn1/decoders":17,"./asn1/encoders":20,"bn.js":22}],9:[function(d,N,A){"use strict";function f(g,h){this.name=g,this.body=h,this.decoders={},this.encoders={}}const b=d("./encoders"),m=d("./decoders"),_=d("inherits");A.define=function(h,s){return new f(h,s)},f.prototype._createNamed=function(h){function s(o){this._initNamed(o,u)}const u=this.name;return _(s,h),s.prototype._initNamed=function(t,r){h.call(this,t,r)},new s(this)},f.prototype._getDecoder=function(h){return this.decoders.hasOwnProperty(h=h||"der")||(this.decoders[h]=this._createNamed(m[h])),this.decoders[h]},f.prototype.decode=function(h,s,u){return this._getDecoder(s).decode(h,u)},f.prototype._getEncoder=function(h){return this.encoders.hasOwnProperty(h=h||"der")||(this.encoders[h]=this._createNamed(b[h])),this.encoders[h]},f.prototype.encode=function(h,s,u){return this._getEncoder(s).encode(h,u)}},{"./decoders":17,"./encoders":20,inherits:147}],10:[function(d,N,A){"use strict";function f(g,h){return _.call(this,h),n.isBuffer(g)?(this.base=g,this.offset=0,void(this.length=g.length)):void this.error("Input not Buffer")}function b(g,h){if(Array.isArray(g))this.length=0,this.value=g.map(function(s){return b.isEncoderBuffer(s)||(s=new b(s,h)),this.length+=s.length,s},this);else if("number"==typeof g){if(!(0<=g&&255>=g))return h.error("non-byte EncoderBuffer value");this.value=g,this.length=1}else if("string"==typeof g)this.value=g,this.length=n.byteLength(g);else{if(!n.isBuffer(g))return h.error("Unsupported type: "+typeof g);this.value=g,this.length=g.length}}const m=d("inherits"),_=d("../base/reporter").Reporter,n=d("safer-buffer").Buffer;m(f,_),A.DecoderBuffer=f,f.isDecoderBuffer=function(h){return h instanceof f||"object"==typeof h&&n.isBuffer(h.base)&&"DecoderBuffer"===h.constructor.name&&"number"==typeof h.offset&&"number"==typeof h.length&&"function"==typeof h.save&&"function"==typeof h.restore&&"function"==typeof h.isEmpty&&"function"==typeof h.readUInt8&&"function"==typeof h.skip&&"function"==typeof h.raw},f.prototype.save=function(){return{offset:this.offset,reporter:_.prototype.save.call(this)}},f.prototype.restore=function(h){const s=new f(this.base);return s.offset=h.offset,s.length=this.offset,this.offset=h.offset,_.prototype.restore.call(this,h.reporter),s},f.prototype.isEmpty=function(){return this.offset===this.length},f.prototype.readUInt8=function(h){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(h||"DecoderBuffer overrun")},f.prototype.skip=function(h,s){if(!(this.offset+h<=this.length))return this.error(s||"DecoderBuffer overrun");const u=new f(this.base);return u._reporterState=this._reporterState,u.offset=this.offset,u.length=this.offset+h,this.offset+=h,u},f.prototype.raw=function(h){return this.base.slice(h?h.offset:this.offset,this.length)},A.EncoderBuffer=b,b.isEncoderBuffer=function(h){return h instanceof b||"object"==typeof h&&"EncoderBuffer"===h.constructor.name&&"number"==typeof h.length&&"function"==typeof h.join},b.prototype.join=function(h,s){return h||(h=n.alloc(this.length)),s||(s=0),0===this.length||(Array.isArray(this.value)?this.value.forEach(function(u){u.join(h,s),s+=u.length}):("number"==typeof this.value?h[s]=this.value:"string"==typeof this.value?h.write(this.value,s):n.isBuffer(this.value)&&this.value.copy(h,s),s+=this.length)),h}},{"../base/reporter":13,inherits:147,"safer-buffer":236}],11:[function(d,N,A){"use strict";const f=A;f.Reporter=d("./reporter").Reporter,f.DecoderBuffer=d("./buffer").DecoderBuffer,f.EncoderBuffer=d("./buffer").EncoderBuffer,f.Node=d("./node")},{"./buffer":10,"./node":12,"./reporter":13}],12:[function(d,N,A){"use strict";function f(o,t,r){const a={};this._baseState=a,a.name=r,a.enc=o,a.parent=t||null,a.children=null,a.tag=null,a.args=null,a.reverseArgs=null,a.choice=null,a.optional=!1,a.any=!1,a.obj=!1,a.use=null,a.useDecoder=null,a.key=null,a.default=null,a.explicit=null,a.implicit=null,a.contains=null,a.parent||(a.children=[],this._wrap())}const b=d("../base/reporter").Reporter,m=d("../base/buffer").EncoderBuffer,_=d("../base/buffer").DecoderBuffer,n=d("minimalistic-assert"),g=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],h=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(g);N.exports=f;const u=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];f.prototype.clone=function(){const t=this._baseState,r={};u.forEach(function(c){r[c]=t[c]});const a=new this.constructor(r.parent);return a._baseState=r,a},f.prototype._wrap=function(){const t=this._baseState;h.forEach(function(r){this[r]=function(){const c=new this.constructor(this);return t.children.push(c),c[r].apply(c,arguments)}},this)},f.prototype._init=function(t){const r=this._baseState;n(null===r.parent),t.call(this),r.children=r.children.filter(function(a){return a._baseState.parent===this},this),n.equal(r.children.length,1,"Root node can have only one child")},f.prototype._useArgs=function(t){const r=this._baseState,a=t.filter(function(c){return c instanceof this.constructor},this);t=t.filter(function(c){return!(c instanceof this.constructor)},this),0!==a.length&&(n(null===r.children),r.children=a,a.forEach(function(c){c._baseState.parent=this},this)),0!==t.length&&(n(null===r.args),r.args=t,r.reverseArgs=t.map(function(c){if("object"!=typeof c||c.constructor!==Object)return c;const l={};return Object.keys(c).forEach(function(w){w==(0|w)&&(w|=0),l[c[w]]=w}),l}))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach(function(o){f.prototype[o]=function(){throw new Error(o+" not implemented for encoding: "+this._baseState.enc)}}),g.forEach(function(o){f.prototype[o]=function(){const r=this._baseState,a=Array.prototype.slice.call(arguments);return n(null===r.tag),r.tag=o,this._useArgs(a),this}}),f.prototype.use=function(t){n(t);const r=this._baseState;return n(null===r.use),r.use=t,this},f.prototype.optional=function(){return this._baseState.optional=!0,this},f.prototype.def=function(t){const r=this._baseState;return n(null===r.default),r.default=t,r.optional=!0,this},f.prototype.explicit=function(t){const r=this._baseState;return n(null===r.explicit&&null===r.implicit),r.explicit=t,this},f.prototype.implicit=function(t){const r=this._baseState;return n(null===r.explicit&&null===r.implicit),r.implicit=t,this},f.prototype.obj=function(){const t=this._baseState,r=Array.prototype.slice.call(arguments);return t.obj=!0,0!==r.length&&this._useArgs(r),this},f.prototype.key=function(t){const r=this._baseState;return n(null===r.key),r.key=t,this},f.prototype.any=function(){return this._baseState.any=!0,this},f.prototype.choice=function(t){const r=this._baseState;return n(null===r.choice),r.choice=t,this._useArgs(Object.keys(t).map(function(a){return t[a]})),this},f.prototype.contains=function(t){const r=this._baseState;return n(null===r.use),r.contains=t,this},f.prototype._decode=function(t,r){const a=this._baseState;if(null===a.parent)return t.wrapResult(a.children[0]._decode(t,r));let E,c=a.default,l=!0,w=null;if(null!==a.key&&(w=t.enterKey(a.key)),a.optional){let C=null;if(null===a.explicit?null===a.implicit?null!==a.tag&&(C=a.tag):C=a.implicit:C=a.explicit,null!==C||a.any){if(l=this._peekTag(t,C,a.any),t.isError(l))return l}else{const z=t.save();try{null===a.choice?this._decodeGeneric(a.tag,t,r):this._decodeChoice(t,r),l=!0}catch{l=!1}t.restore(z)}}if(a.obj&&l&&(E=t.enterObject()),l){if(null!==a.explicit){const z=this._decodeTag(t,a.explicit);if(t.isError(z))return z;t=z}const C=t.offset;if(null===a.use&&null===a.choice){let z;a.any&&(z=t.save());const k=this._decodeTag(t,null===a.implicit?a.tag:a.implicit,a.any);if(t.isError(k))return k;a.any?c=t.raw(z):t=k}if(r&&r.track&&null!==a.tag&&r.track(t.path(),C,t.length,"tagged"),r&&r.track&&null!==a.tag&&r.track(t.path(),t.offset,t.length,"content"),a.any||(c=null===a.choice?this._decodeGeneric(a.tag,t,r):this._decodeChoice(t,r)),t.isError(c))return c;if(a.any||null!==a.choice||null===a.children||a.children.forEach(function(k){k._decode(t,r)}),a.contains&&("octstr"===a.tag||"bitstr"===a.tag)){const z=new _(c);c=this._getUse(a.contains,t._reporterState.obj)._decode(z,r)}}return a.obj&&l&&(c=t.leaveObject(E)),null===a.key||null===c&&!0!==l?null!==w&&t.exitKey(w):t.leaveKey(w,a.key,c),c},f.prototype._decodeGeneric=function(t,r,a){const c=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(r,t,c.args[0],a):/str$/.test(t)?this._decodeStr(r,t,a):"objid"===t&&c.args?this._decodeObjid(r,c.args[0],c.args[1],a):"objid"===t?this._decodeObjid(r,null,null,a):"gentime"===t||"utctime"===t?this._decodeTime(r,t,a):"null_"===t?this._decodeNull(r,a):"bool"===t?this._decodeBool(r,a):"objDesc"===t?this._decodeStr(r,t,a):"int"===t||"enum"===t?this._decodeInt(r,c.args&&c.args[0],a):null===c.use?r.error("unknown tag: "+t):this._getUse(c.use,r._reporterState.obj)._decode(r,a)},f.prototype._getUse=function(t,r){const a=this._baseState;return a.useDecoder=this._use(t,r),n(null===a.useDecoder._baseState.parent),a.useDecoder=a.useDecoder._baseState.children[0],a.implicit!==a.useDecoder._baseState.implicit&&(a.useDecoder=a.useDecoder.clone(),a.useDecoder._baseState.implicit=a.implicit),a.useDecoder},f.prototype._decodeChoice=function(t,r){const a=this._baseState;let c=null,l=!1;return Object.keys(a.choice).some(function(w){const E=t.save(),C=a.choice[w];try{const z=C._decode(t,r);if(t.isError(z))return!1;c={type:w,value:z},l=!0}catch{return t.restore(E),!1}return!0},this),l?c:t.error("Choice not matched")},f.prototype._createEncoderBuffer=function(t){return new m(t,this.reporter)},f.prototype._encode=function(t,r,a){const c=this._baseState;if(null===c.default||c.default!==t){const l=this._encodeValue(t,r,a);return void 0===l||this._skipDefault(l,r,a)?void 0:l}},f.prototype._encodeValue=function(t,r,a){const c=this._baseState;if(null===c.parent)return c.children[0]._encode(t,r||new b);let l=null;if(this.reporter=r,c.optional&&void 0===t){if(null===c.default)return;t=c.default}let w=null,E=!1;if(c.any)l=this._createEncoderBuffer(t);else if(c.choice)l=this._encodeChoice(t,r);else if(c.contains)w=this._getUse(c.contains,a)._encode(t,r),E=!0;else if(c.children)w=c.children.map(function(C){if("null_"===C._baseState.tag)return C._encode(null,r,t);if(null===C._baseState.key)return r.error("Child should have a key");const z=r.enterKey(C._baseState.key);if("object"!=typeof t)return r.error("Child expected, but input is not object");const k=C._encode(t[C._baseState.key],r,t);return r.leaveKey(z),k},this).filter(function(C){return C}),w=this._createEncoderBuffer(w);else if("seqof"===c.tag||"setof"===c.tag){if(!c.args||1!==c.args.length)return r.error("Too many args for : "+c.tag);if(!Array.isArray(t))return r.error("seqof/setof, but data is not Array");const C=this.clone();C._baseState.implicit=null,w=this._createEncoderBuffer(t.map(function(z){return this._getUse(this._baseState.args[0],t)._encode(z,r)},C))}else null===c.use?(w=this._encodePrimitive(c.tag,t),E=!0):l=this._getUse(c.use,a)._encode(t,r);if(!c.any&&null===c.choice){const C=null===c.implicit?c.tag:c.implicit,z=null===c.implicit?"universal":"context";null===C?null===c.use&&r.error("Tag could be omitted only for .use()"):null===c.use&&(l=this._encodeComposite(C,E,z,w))}return null!==c.explicit&&(l=this._encodeComposite(c.explicit,!1,"context",l)),l},f.prototype._encodeChoice=function(t,r){const a=this._baseState,c=a.choice[t.type];return c||n(!1,t.type+" not found in "+JSON.stringify(Object.keys(a.choice))),c._encode(t.value,r)},f.prototype._encodePrimitive=function(t,r){const a=this._baseState;if(/str$/.test(t))return this._encodeStr(r,t);if("objid"===t&&a.args)return this._encodeObjid(r,a.reverseArgs[0],a.args[1]);if("objid"===t)return this._encodeObjid(r,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(r,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(r,a.args&&a.reverseArgs[0]);if("bool"===t)return this._encodeBool(r);if("objDesc"===t)return this._encodeStr(r,t);throw new Error("Unsupported tag: "+t)},f.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},f.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},{"../base/buffer":10,"../base/reporter":13,"minimalistic-assert":168}],13:[function(d,N,A){"use strict";function f(_){this._reporterState={obj:null,path:[],options:_||{},errors:[]}}function b(_,n){this.path=_,this.rethrow(n)}const m=d("inherits");A.Reporter=f,f.prototype.isError=function(n){return n instanceof b},f.prototype.save=function(){const n=this._reporterState;return{obj:n.obj,pathLen:n.path.length}},f.prototype.restore=function(n){const g=this._reporterState;g.obj=n.obj,g.path=g.path.slice(0,n.pathLen)},f.prototype.enterKey=function(n){return this._reporterState.path.push(n)},f.prototype.exitKey=function(n){const g=this._reporterState;g.path=g.path.slice(0,n-1)},f.prototype.leaveKey=function(n,g,h){const s=this._reporterState;this.exitKey(n),null!==s.obj&&(s.obj[g]=h)},f.prototype.path=function(){return this._reporterState.path.join("/")},f.prototype.enterObject=function(){const n=this._reporterState,g=n.obj;return n.obj={},g},f.prototype.leaveObject=function(n){const g=this._reporterState,h=g.obj;return g.obj=n,h},f.prototype.error=function(n){let g;const h=this._reporterState,s=n instanceof b;if(g=s?n:new b(h.path.map(function(u){return"["+JSON.stringify(u)+"]"}).join(""),n.message||n,n.stack),!h.options.partial)throw g;return s||h.errors.push(g),g},f.prototype.wrapResult=function(n){const g=this._reporterState;return g.options.partial?{result:this.isError(n)?null:n,errors:g.errors}:n},m(b,Error),b.prototype.rethrow=function(n){if(this.message=n+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,b),!this.stack)try{throw new Error(this.message)}catch(g){this.stack=g.stack}return this}},{inherits:147}],14:[function(d,N,A){"use strict";function f(b){const m={};return Object.keys(b).forEach(function(_){(0|_)==_&&(_|=0),m[b[_]]=_}),m}A.tagClass={0:"universal",1:"application",2:"context",3:"private"},A.tagClassByName=f(A.tagClass),A.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},A.tagByName=f(A.tag)},{}],15:[function(d,N,A){"use strict";const f=A;f._reverse=function(m){const _={};return Object.keys(m).forEach(function(n){(0|n)==n&&(n|=0),_[m[n]]=n}),_},f.der=d("./der")},{"./der":14}],16:[function(d,N,A){"use strict";function f(o){this.enc="der",this.name=o.name,this.entity=o,this.tree=new b,this.tree._init(o.body)}function b(o){s.call(this,"der",o)}function m(o,t){let r=o.readUInt8(t);if(o.isError(r))return r;const a=u.tagClass[r>>6],c=0==(32&r);if(31==(31&r)){let w=r;for(r=0;128==(128&w);){if(w=o.readUInt8(t),o.isError(w))return w;r<<=7,r|=127&w}}else r&=31;return{cls:a,primitive:c,tag:r,tagStr:u.tag[r]}}function _(o,t,r){let a=o.readUInt8(r);if(o.isError(a))return a;if(!t&&128===a)return null;if(!(128&a))return a;const c=127&a;if(4c?2e3+c:1900+c}return Date.UTC(c,l-1,w,E,C,z,0)},b.prototype._decodeNull=function(){return null},b.prototype._decodeBool=function(t){const r=t.readUInt8();return t.isError(r)?r:0!==r},b.prototype._decodeInt=function(t,r){const a=t.raw();let c=new g(a);return r&&(c=r[c.toString(10)]||c),c},b.prototype._use=function(t,r){return"function"==typeof t&&(t=t(r)),t._getDecoder("der").tree}},{"../base/buffer":10,"../base/node":12,"../constants/der":14,"bn.js":22,inherits:147}],17:[function(d,N,A){"use strict";const f=A;f.der=d("./der"),f.pem=d("./pem")},{"./der":16,"./pem":18}],18:[function(d,N,A){"use strict";function f(n){_.call(this,n),this.enc="pem"}const b=d("inherits"),m=d("safer-buffer").Buffer,_=d("./der");b(f,_),N.exports=f,f.prototype.decode=function(g,h){const s=g.toString().split(/[\r\n]+/g),u=h.label.toUpperCase(),o=/^-----(BEGIN|END) ([^-]+)-----$/;let t=-1,r=-1;for(let l=0;lu?"0"+u:u}const n=d("inherits"),g=d("safer-buffer").Buffer,h=d("../base/node"),s=d("../constants/der");N.exports=f,f.prototype.encode=function(o,t){return this.tree._encode(o,t).join()},n(b,h),b.prototype._encodeComposite=function(o,t,r,a){const c=function _(u,o,t,r){let a;if("seqof"===u?u="seq":"setof"==u&&(u="set"),s.tagByName.hasOwnProperty(u))a=s.tagByName[u];else{if("number"!=typeof u||(0|u)!==u)return r.error("Unknown tag: "+u);a=u}return 31<=a?r.error("Multi-octet tag encoding unsupported"):(o||(a|=32),a|=s.tagClassByName[t||"universal"]<<6,a)}(o,t,r,this.reporter);if(128>a.length){const E=g.alloc(2);return E[0]=c,E[1]=a.length,this._createEncoderBuffer([E,a])}let l=1;for(let E=a.length;256<=E;E>>=8)l++;const w=g.alloc(2+l);w[0]=c,w[1]=128|l;for(let E=1+l,C=a.length;0>=8)w[E]=255&C;return this._createEncoderBuffer([w,a])},b.prototype._encodeStr=function(o,t){if("bitstr"===t)return this._createEncoderBuffer([0|o.unused,o.data]);if("bmpstr"===t){const r=g.alloc(2*o.length);for(let a=0;a>=7)a++;const c=g.alloc(a);let l=c.length-1;for(let E,w=o.length-1;0<=w;w--)for(E=o[w],c[l--]=127&E;0<(E>>=7);)c[l--]=128|127&E;return this._createEncoderBuffer(c)},b.prototype._encodeTime=function(o,t){let r;const a=new Date(o);return"gentime"===t?r=[m(a.getUTCFullYear()),m(a.getUTCMonth()+1),m(a.getUTCDate()),m(a.getUTCHours()),m(a.getUTCMinutes()),m(a.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[m(a.getUTCFullYear()%100),m(a.getUTCMonth()+1),m(a.getUTCDate()),m(a.getUTCHours()),m(a.getUTCMinutes()),m(a.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},b.prototype._encodeNull=function(){return this._createEncoderBuffer("")},b.prototype._encodeInt=function(o,t){if("string"==typeof o){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(o))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(o));o=t[o]}if("number"!=typeof o&&!g.isBuffer(o)){const c=o.toArray();!o.sign&&128&c[0]&&c.unshift(0),o=g.from(c)}if(g.isBuffer(o)){let c=o.length;0===o.length&&c++;const l=g.alloc(c);return o.copy(l),0===o.length&&(l[0]=0),this._createEncoderBuffer(l)}if(128>o)return this._createEncoderBuffer(o);if(256>o)return this._createEncoderBuffer([0,o]);let r=1;for(let c=o;256<=c;c>>=8)r++;const a=Array(r);for(let c=a.length-1;0<=c;c--)a[c]=255&o,o>>=8;return 128&a[0]&&a.unshift(0),this._createEncoderBuffer(g.from(a))},b.prototype._encodeBool=function(o){return this._createEncoderBuffer(o?255:0)},b.prototype._use=function(o,t){return"function"==typeof o&&(o=o(t)),o._getEncoder("der").tree},b.prototype._skipDefault=function(o,t,r){const a=this._baseState;let c;if(null===a.default)return!1;const l=o.join();if(void 0===a.defaultBuffer&&(a.defaultBuffer=this._encodeValue(a.default,t,r).join()),l.length!==a.defaultBuffer.length)return!1;for(c=0;c=D?D-55:97<=D&&102>=D?D-87:15&D-48}function h(X,T,D){var M=g(X,D);return D-1>=T&&(M|=g(X,D-1)<<4),M}function s(X,T,D,M){for(var q,v=0,B=ne(X.length,D),F=T;F>>26,Ee=67108863&L,Se=ne(Y,T.length-1),Ie=pe(0,Y-X.length+1);Ie<=Se;Ie++)se+=0|(F=(v=0|X.words[0|Y-Ie])*(B=0|T.words[Ie])+Ee)/67108864,Ee=67108863&F;D.words[Y]=0|Ee,L=0|se}return 0===L?D.length--:D.words[Y]=0|L,D.strip()}function r(X,T,D){return(new a).mulp(X,T,D)}function a(X,T){this.x=X,this.y=T}function c(X,T){this.name=X,this.p=new n(T,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function l(){c.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){c.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){c.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function C(){c.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function z(X){if("string"==typeof X){var T=n._prime(X);this.m=T.p,this.prime=T}else m(X.gtn(1),"modulus must be greater than 1"),this.m=X,this.prime=null}function k(X){z.call(this,X),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}var I;"object"==typeof f?f.exports=n:b.BN=n,n.BN=n,n.wordSize=26;try{I=typeof window<"u"&&typeof window.Buffer<"u"?window.Buffer:d("buffer").Buffer}catch{}n.isBN=function(T){return T instanceof n||null!==T&&"object"==typeof T&&T.constructor.wordSize===n.wordSize&&Array.isArray(T.words)},n.max=function(T,D){return 0T.cmp(D)?T:D},n.prototype._init=function(T,D,M){if("number"==typeof T)return this._initNumber(T,D,M);if("object"==typeof T)return this._initArray(T,D,M);"hex"===D&&(D=16),m(D===(0|D)&&2<=D&&36>=D);var v=0;"-"===(T=T.toString().replace(/\s+/g,""))[0]&&(v++,this.negative=1),vT&&(this.negative=1,T=-T),67108864>T?(this.words=[67108863&T],this.length=1):4503599627370496>T?(this.words=[67108863&T,67108863&T/67108864],this.length=2):(m(9007199254740992>T),this.words=[67108863&T,67108863&T/67108864,1],this.length=3),"le"!==M||this._initArray(this.toArray(),D,M)},n.prototype._initArray=function(T,D,M){if(m("number"==typeof T.length),0>=T.length)return this.words=[0],this.length=1,this;this.length=_e(T.length/3),this.words=Array(this.length);for(var v=0;v>>26-B,26<=(B+=24)&&(B-=26,F++);else if("le"===M)for(v=0,F=0;v>>26-B,26<=(B+=24)&&(B-=26,F++);return this.strip()},n.prototype._parseHex=function(T,D,M){this.length=_e((T.length-D)/6),this.words=Array(this.length);for(var v=0;v=D;v-=2)q=h(T,D,v)<>>26):B+=8;else for(v=(T.length-D)%2==0?D+1:D;v>>26):B+=8;this.strip()},n.prototype._parseBase=function(T,D,M){this.words=[0],this.length=1;for(var v=0,B=1;67108863>=B;B*=D)v++;v--,B=0|B/D;for(var F=T.length-M,q=F%v,L=ne(F,F-q)+M,Y=0,se=M;sethis.words[0]+Y?this.words[0]+=Y:this._iaddn(Y);if(0!==q){var Ee=1;for(Y=s(T,se,T.length,D),se=0;sethis.words[0]+Y?this.words[0]+=Y:this._iaddn(Y)}this.strip()},n.prototype.copy=function(T){T.words=Array(this.length);for(var D=0;D"};var V=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],$=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],oe=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(T,D){var M;if(D=0|D||1,16===(T=T||10)||"hex"===T){M="";for(var v=0,B=0,F=0;F>>24-v)||F!==this.length-1?V[6-L.length]+L+M:L+M,26<=(v+=2)&&(v-=26,F--)}for(0!==B&&(M=B.toString(16)+M);M.length%D!=0;)M="0"+M;return 0!==this.negative&&(M="-"+M),M}if(T===(0|T)&&2<=T&&36>=T){var Y=$[T],se=oe[T];M="";var Ee=this.clone();for(Ee.negative=0;!Ee.isZero();){var Se=Ee.modn(se).toString(T);M=(Ee=Ee.idivn(se)).isZero()?Se+M:V[Y-Se.length]+Se+M}for(this.isZero()&&(M="0"+M);M.length%D!=0;)M="0"+M;return 0!==this.negative&&(M="-"+M),M}m(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var T=this.words[0];return 2===this.length?T+=67108864*this.words[1]:3===this.length&&1===this.words[2]?T+=4503599627370496+67108864*this.words[1]:2>>=13),64<=D&&(M+=7,D>>>=7),8<=D&&(M+=4,D>>>=4),2<=D&&(M+=2,D>>>=2),M+D},n.prototype._zeroBits=function(T){if(0===T)return 26;var D=T,M=0;return!(8191&D)&&(M+=13,D>>>=13),!(127&D)&&(M+=7,D>>>=7),!(15&D)&&(M+=4,D>>>=4),!(3&D)&&(M+=2,D>>>=2),!(1&D)&&M++,M},n.prototype.bitLength=function(){var D=this._countBits(this.words[this.length-1]);return 26*(this.length-1)+D},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var M,T=0,D=0;DT.length?this.clone().ior(T):T.clone().ior(this)},n.prototype.uor=function(T){return this.length>T.length?this.clone().iuor(T):T.clone().iuor(this)},n.prototype.iuand=function(T){var D;D=this.length>T.length?T:this;for(var M=0;MT.length?this.clone().iand(T):T.clone().iand(this)},n.prototype.uand=function(T){return this.length>T.length?this.clone().iuand(T):T.clone().iuand(this)},n.prototype.iuxor=function(T){var D,M;this.length>T.length?(D=this,M=T):(D=T,M=this);for(var v=0;vT.length?this.clone().ixor(T):T.clone().ixor(this)},n.prototype.uxor=function(T){return this.length>T.length?this.clone().iuxor(T):T.clone().iuxor(this)},n.prototype.inotn=function(T){m("number"==typeof T&&0<=T);var D=0|_e(T/26),M=T%26;this._expand(D),0>26-M),this.strip()},n.prototype.notn=function(T){return this.clone().inotn(T)},n.prototype.setn=function(T,D){m("number"==typeof T&&0<=T);var M=0|T/26,v=T%26;return this._expand(M+1),D?this.words[M]|=1<T.length?(M=this,v=T):(M=T,v=this);for(var B=0,F=0;F>>26;for(;0!==B&&F>>26;if(this.length=M.length,0!==B)this.words[this.length]=B,this.length++;else if(M!==this)for(;FT.length?this.clone().iadd(T):T.clone().iadd(this)},n.prototype.isub=function(T){if(0!==T.negative){T.negative=0;var D=this.iadd(T);return T.negative=1,D._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(T),this.negative=1,this._normSign();var v,B,M=this.cmp(T);if(0===M)return this.negative=0,this.length=1,this.words[0]=0,this;0>26,this.words[q]=67108863&D;for(;0!==F&&q>26,this.words[q]=67108863&D;if(0===F&&q>>13,Ee=0|v[1],Se=8191&Ee,Ie=Ee>>>13,Qe=0|v[2],Je=8191&Qe,ut=Qe>>>13,$t=0|v[3],qt=8191&$t,tt=$t>>>13,at=0|v[4],nt=8191&at,Yt=at>>>13,Tn=0|v[5],J=8191&Tn,O=Tn>>>13,W=0|v[6],ee=8191&W,ve=W>>>13,He=0|v[7],ht=8191&He,st=He>>>13,Jt=0|v[8],on=8191&Jt,Ht=Jt>>>13,wn=0|v[9],sn=8191&wn,Sn=wn>>>13,fr=0|B[0],Dn=8191&fr,Rt=fr>>>13,vr=0|B[1],de=8191&vr,Le=vr>>>13,et=0|B[2],qe=8191&et,Ze=et>>>13,Ct=0|B[3],Nt=8191&Ct,Bt=Ct>>>13,ln=0|B[4],Ot=8191&ln,mn=ln>>>13,kn=0|B[5],vn=8191&kn,In=kn>>>13,pr=0|B[6],Nn=8191&pr,zn=pr>>>13,Br=0|B[7],Rn=8191&Br,Qn=Br>>>13,Wr=0|B[8],Kn=8191&Wr,Zn=Wr>>>13,Kr=0|B[9],Gn=8191&Kr,er=Kr>>>13;M.negative=T.negative^D.negative,M.length=19;var ft=0|(0|q+(ct=y(Y,Dn)))+((8191&(me=0|(me=y(Y,Rt))+y(se,Dn)))<<13);q=0|(0|(ot=y(se,Rt))+(me>>>13))+(ft>>>26),ft&=67108863,ct=y(Se,Dn),me=0|(me=y(Se,Rt))+y(Ie,Dn),ot=y(Ie,Rt);var be=0|(0|q+(ct=0|ct+y(Y,de)))+((8191&(me=0|(me=0|me+y(Y,Le))+y(se,de)))<<13);q=0|(0|(ot=0|ot+y(se,Le))+(me>>>13))+(be>>>26),be&=67108863,ct=y(Je,Dn),me=0|(me=y(Je,Rt))+y(ut,Dn),ot=y(ut,Rt),ct=0|ct+y(Se,de),me=0|(me=0|me+y(Se,Le))+y(Ie,de),ot=0|ot+y(Ie,Le);var dt=0|(0|q+(ct=0|ct+y(Y,qe)))+((8191&(me=0|(me=0|me+y(Y,Ze))+y(se,qe)))<<13);q=0|(0|(ot=0|ot+y(se,Ze))+(me>>>13))+(dt>>>26),dt&=67108863,ct=y(qt,Dn),me=0|(me=y(qt,Rt))+y(tt,Dn),ot=y(tt,Rt),ct=0|ct+y(Je,de),me=0|(me=0|me+y(Je,Le))+y(ut,de),ot=0|ot+y(ut,Le),ct=0|ct+y(Se,qe),me=0|(me=0|me+y(Se,Ze))+y(Ie,qe),ot=0|ot+y(Ie,Ze);var Zr=0|(0|q+(ct=0|ct+y(Y,Nt)))+((8191&(me=0|(me=0|me+y(Y,Bt))+y(se,Nt)))<<13);q=0|(0|(ot=0|ot+y(se,Bt))+(me>>>13))+(Zr>>>26),Zr&=67108863,ct=y(nt,Dn),me=0|(me=y(nt,Rt))+y(Yt,Dn),ot=y(Yt,Rt),ct=0|ct+y(qt,de),me=0|(me=0|me+y(qt,Le))+y(tt,de),ot=0|ot+y(tt,Le),ct=0|ct+y(Je,qe),me=0|(me=0|me+y(Je,Ze))+y(ut,qe),ot=0|ot+y(ut,Ze),ct=0|ct+y(Se,Nt),me=0|(me=0|me+y(Se,Bt))+y(Ie,Nt),ot=0|ot+y(Ie,Bt);var ri=0|(0|q+(ct=0|ct+y(Y,Ot)))+((8191&(me=0|(me=0|me+y(Y,mn))+y(se,Ot)))<<13);q=0|(0|(ot=0|ot+y(se,mn))+(me>>>13))+(ri>>>26),ri&=67108863,ct=y(J,Dn),me=0|(me=y(J,Rt))+y(O,Dn),ot=y(O,Rt),ct=0|ct+y(nt,de),me=0|(me=0|me+y(nt,Le))+y(Yt,de),ot=0|ot+y(Yt,Le),ct=0|ct+y(qt,qe),me=0|(me=0|me+y(qt,Ze))+y(tt,qe),ot=0|ot+y(tt,Ze),ct=0|ct+y(Je,Nt),me=0|(me=0|me+y(Je,Bt))+y(ut,Nt),ot=0|ot+y(ut,Bt),ct=0|ct+y(Se,Ot),me=0|(me=0|me+y(Se,mn))+y(Ie,Ot),ot=0|ot+y(Ie,mn);var si=0|(0|q+(ct=0|ct+y(Y,vn)))+((8191&(me=0|(me=0|me+y(Y,In))+y(se,vn)))<<13);q=0|(0|(ot=0|ot+y(se,In))+(me>>>13))+(si>>>26),si&=67108863,ct=y(ee,Dn),me=0|(me=y(ee,Rt))+y(ve,Dn),ot=y(ve,Rt),ct=0|ct+y(J,de),me=0|(me=0|me+y(J,Le))+y(O,de),ot=0|ot+y(O,Le),ct=0|ct+y(nt,qe),me=0|(me=0|me+y(nt,Ze))+y(Yt,qe),ot=0|ot+y(Yt,Ze),ct=0|ct+y(qt,Nt),me=0|(me=0|me+y(qt,Bt))+y(tt,Nt),ot=0|ot+y(tt,Bt),ct=0|ct+y(Je,Ot),me=0|(me=0|me+y(Je,mn))+y(ut,Ot),ot=0|ot+y(ut,mn),ct=0|ct+y(Se,vn),me=0|(me=0|me+y(Se,In))+y(Ie,vn),ot=0|ot+y(Ie,In);var cr=0|(0|q+(ct=0|ct+y(Y,Nn)))+((8191&(me=0|(me=0|me+y(Y,zn))+y(se,Nn)))<<13);q=0|(0|(ot=0|ot+y(se,zn))+(me>>>13))+(cr>>>26),cr&=67108863,ct=y(ht,Dn),me=0|(me=y(ht,Rt))+y(st,Dn),ot=y(st,Rt),ct=0|ct+y(ee,de),me=0|(me=0|me+y(ee,Le))+y(ve,de),ot=0|ot+y(ve,Le),ct=0|ct+y(J,qe),me=0|(me=0|me+y(J,Ze))+y(O,qe),ot=0|ot+y(O,Ze),ct=0|ct+y(nt,Nt),me=0|(me=0|me+y(nt,Bt))+y(Yt,Nt),ot=0|ot+y(Yt,Bt),ct=0|ct+y(qt,Ot),me=0|(me=0|me+y(qt,mn))+y(tt,Ot),ot=0|ot+y(tt,mn),ct=0|ct+y(Je,vn),me=0|(me=0|me+y(Je,In))+y(ut,vn),ot=0|ot+y(ut,In),ct=0|ct+y(Se,Nn),me=0|(me=0|me+y(Se,zn))+y(Ie,Nn),ot=0|ot+y(Ie,zn);var yi=0|(0|q+(ct=0|ct+y(Y,Rn)))+((8191&(me=0|(me=0|me+y(Y,Qn))+y(se,Rn)))<<13);q=0|(0|(ot=0|ot+y(se,Qn))+(me>>>13))+(yi>>>26),yi&=67108863,ct=y(on,Dn),me=0|(me=y(on,Rt))+y(Ht,Dn),ot=y(Ht,Rt),ct=0|ct+y(ht,de),me=0|(me=0|me+y(ht,Le))+y(st,de),ot=0|ot+y(st,Le),ct=0|ct+y(ee,qe),me=0|(me=0|me+y(ee,Ze))+y(ve,qe),ot=0|ot+y(ve,Ze),ct=0|ct+y(J,Nt),me=0|(me=0|me+y(J,Bt))+y(O,Nt),ot=0|ot+y(O,Bt),ct=0|ct+y(nt,Ot),me=0|(me=0|me+y(nt,mn))+y(Yt,Ot),ot=0|ot+y(Yt,mn),ct=0|ct+y(qt,vn),me=0|(me=0|me+y(qt,In))+y(tt,vn),ot=0|ot+y(tt,In),ct=0|ct+y(Je,Nn),me=0|(me=0|me+y(Je,zn))+y(ut,Nn),ot=0|ot+y(ut,zn),ct=0|ct+y(Se,Rn),me=0|(me=0|me+y(Se,Qn))+y(Ie,Rn),ot=0|ot+y(Ie,Qn);var Jr=0|(0|q+(ct=0|ct+y(Y,Kn)))+((8191&(me=0|(me=0|me+y(Y,Zn))+y(se,Kn)))<<13);q=0|(0|(ot=0|ot+y(se,Zn))+(me>>>13))+(Jr>>>26),Jr&=67108863,ct=y(sn,Dn),me=0|(me=y(sn,Rt))+y(Sn,Dn),ot=y(Sn,Rt),ct=0|ct+y(on,de),me=0|(me=0|me+y(on,Le))+y(Ht,de),ot=0|ot+y(Ht,Le),ct=0|ct+y(ht,qe),me=0|(me=0|me+y(ht,Ze))+y(st,qe),ot=0|ot+y(st,Ze),ct=0|ct+y(ee,Nt),me=0|(me=0|me+y(ee,Bt))+y(ve,Nt),ot=0|ot+y(ve,Bt),ct=0|ct+y(J,Ot),me=0|(me=0|me+y(J,mn))+y(O,Ot),ot=0|ot+y(O,mn),ct=0|ct+y(nt,vn),me=0|(me=0|me+y(nt,In))+y(Yt,vn),ot=0|ot+y(Yt,In),ct=0|ct+y(qt,Nn),me=0|(me=0|me+y(qt,zn))+y(tt,Nn),ot=0|ot+y(tt,zn),ct=0|ct+y(Je,Rn),me=0|(me=0|me+y(Je,Qn))+y(ut,Rn),ot=0|ot+y(ut,Qn),ct=0|ct+y(Se,Kn),me=0|(me=0|me+y(Se,Zn))+y(Ie,Kn),ot=0|ot+y(Ie,Zn);var zr=0|(0|q+(ct=0|ct+y(Y,Gn)))+((8191&(me=0|(me=0|me+y(Y,er))+y(se,Gn)))<<13);q=0|(0|(ot=0|ot+y(se,er))+(me>>>13))+(zr>>>26),zr&=67108863,ct=y(sn,de),me=0|(me=y(sn,Le))+y(Sn,de),ot=y(Sn,Le),ct=0|ct+y(on,qe),me=0|(me=0|me+y(on,Ze))+y(Ht,qe),ot=0|ot+y(Ht,Ze),ct=0|ct+y(ht,Nt),me=0|(me=0|me+y(ht,Bt))+y(st,Nt),ot=0|ot+y(st,Bt),ct=0|ct+y(ee,Ot),me=0|(me=0|me+y(ee,mn))+y(ve,Ot),ot=0|ot+y(ve,mn),ct=0|ct+y(J,vn),me=0|(me=0|me+y(J,In))+y(O,vn),ot=0|ot+y(O,In),ct=0|ct+y(nt,Nn),me=0|(me=0|me+y(nt,zn))+y(Yt,Nn),ot=0|ot+y(Yt,zn),ct=0|ct+y(qt,Rn),me=0|(me=0|me+y(qt,Qn))+y(tt,Rn),ot=0|ot+y(tt,Qn),ct=0|ct+y(Je,Kn),me=0|(me=0|me+y(Je,Zn))+y(ut,Kn),ot=0|ot+y(ut,Zn);var ui=0|(0|q+(ct=0|ct+y(Se,Gn)))+((8191&(me=0|(me=0|me+y(Se,er))+y(Ie,Gn)))<<13);q=0|(0|(ot=0|ot+y(Ie,er))+(me>>>13))+(ui>>>26),ui&=67108863,ct=y(sn,qe),me=0|(me=y(sn,Ze))+y(Sn,qe),ot=y(Sn,Ze),ct=0|ct+y(on,Nt),me=0|(me=0|me+y(on,Bt))+y(Ht,Nt),ot=0|ot+y(Ht,Bt),ct=0|ct+y(ht,Ot),me=0|(me=0|me+y(ht,mn))+y(st,Ot),ot=0|ot+y(st,mn),ct=0|ct+y(ee,vn),me=0|(me=0|me+y(ee,In))+y(ve,vn),ot=0|ot+y(ve,In),ct=0|ct+y(J,Nn),me=0|(me=0|me+y(J,zn))+y(O,Nn),ot=0|ot+y(O,zn),ct=0|ct+y(nt,Rn),me=0|(me=0|me+y(nt,Qn))+y(Yt,Rn),ot=0|ot+y(Yt,Qn),ct=0|ct+y(qt,Kn),me=0|(me=0|me+y(qt,Zn))+y(tt,Kn),ot=0|ot+y(tt,Zn);var ai=0|(0|q+(ct=0|ct+y(Je,Gn)))+((8191&(me=0|(me=0|me+y(Je,er))+y(ut,Gn)))<<13);q=0|(0|(ot=0|ot+y(ut,er))+(me>>>13))+(ai>>>26),ai&=67108863,ct=y(sn,Nt),me=0|(me=y(sn,Bt))+y(Sn,Nt),ot=y(Sn,Bt),ct=0|ct+y(on,Ot),me=0|(me=0|me+y(on,mn))+y(Ht,Ot),ot=0|ot+y(Ht,mn),ct=0|ct+y(ht,vn),me=0|(me=0|me+y(ht,In))+y(st,vn),ot=0|ot+y(st,In),ct=0|ct+y(ee,Nn),me=0|(me=0|me+y(ee,zn))+y(ve,Nn),ot=0|ot+y(ve,zn),ct=0|ct+y(J,Rn),me=0|(me=0|me+y(J,Qn))+y(O,Rn),ot=0|ot+y(O,Qn),ct=0|ct+y(nt,Kn),me=0|(me=0|me+y(nt,Zn))+y(Yt,Kn),ot=0|ot+y(Yt,Zn);var li=0|(0|q+(ct=0|ct+y(qt,Gn)))+((8191&(me=0|(me=0|me+y(qt,er))+y(tt,Gn)))<<13);q=0|(0|(ot=0|ot+y(tt,er))+(me>>>13))+(li>>>26),li&=67108863,ct=y(sn,Ot),me=0|(me=y(sn,mn))+y(Sn,Ot),ot=y(Sn,mn),ct=0|ct+y(on,vn),me=0|(me=0|me+y(on,In))+y(Ht,vn),ot=0|ot+y(Ht,In),ct=0|ct+y(ht,Nn),me=0|(me=0|me+y(ht,zn))+y(st,Nn),ot=0|ot+y(st,zn),ct=0|ct+y(ee,Rn),me=0|(me=0|me+y(ee,Qn))+y(ve,Rn),ot=0|ot+y(ve,Qn),ct=0|ct+y(J,Kn),me=0|(me=0|me+y(J,Zn))+y(O,Kn),ot=0|ot+y(O,Zn);var Vr=0|(0|q+(ct=0|ct+y(nt,Gn)))+((8191&(me=0|(me=0|me+y(nt,er))+y(Yt,Gn)))<<13);q=0|(0|(ot=0|ot+y(Yt,er))+(me>>>13))+(Vr>>>26),Vr&=67108863,ct=y(sn,vn),me=0|(me=y(sn,In))+y(Sn,vn),ot=y(Sn,In),ct=0|ct+y(on,Nn),me=0|(me=0|me+y(on,zn))+y(Ht,Nn),ot=0|ot+y(Ht,zn),ct=0|ct+y(ht,Rn),me=0|(me=0|me+y(ht,Qn))+y(st,Rn),ot=0|ot+y(st,Qn),ct=0|ct+y(ee,Kn),me=0|(me=0|me+y(ee,Zn))+y(ve,Kn),ot=0|ot+y(ve,Zn);var Fr=0|(0|q+(ct=0|ct+y(J,Gn)))+((8191&(me=0|(me=0|me+y(J,er))+y(O,Gn)))<<13);q=0|(0|(ot=0|ot+y(O,er))+(me>>>13))+(Fr>>>26),Fr&=67108863,ct=y(sn,Nn),me=0|(me=y(sn,zn))+y(Sn,Nn),ot=y(Sn,zn),ct=0|ct+y(on,Rn),me=0|(me=0|me+y(on,Qn))+y(Ht,Rn),ot=0|ot+y(Ht,Qn),ct=0|ct+y(ht,Kn),me=0|(me=0|me+y(ht,Zn))+y(st,Kn),ot=0|ot+y(st,Zn);var Un=0|(0|q+(ct=0|ct+y(ee,Gn)))+((8191&(me=0|(me=0|me+y(ee,er))+y(ve,Gn)))<<13);q=0|(0|(ot=0|ot+y(ve,er))+(me>>>13))+(Un>>>26),Un&=67108863,ct=y(sn,Rn),me=0|(me=y(sn,Qn))+y(Sn,Rn),ot=y(Sn,Qn),ct=0|ct+y(on,Kn),me=0|(me=0|me+y(on,Zn))+y(Ht,Kn),ot=0|ot+y(Ht,Zn);var We=0|(0|q+(ct=0|ct+y(ht,Gn)))+((8191&(me=0|(me=0|me+y(ht,er))+y(st,Gn)))<<13);q=0|(0|(ot=0|ot+y(st,er))+(me>>>13))+(We>>>26),We&=67108863,ct=y(sn,Kn),me=0|(me=y(sn,Zn))+y(Sn,Kn),ot=y(Sn,Zn);var Mn=0|(0|q+(ct=0|ct+y(on,Gn)))+((8191&(me=0|(me=0|me+y(on,er))+y(Ht,Gn)))<<13);q=0|(0|(ot=0|ot+y(Ht,er))+(me>>>13))+(Mn>>>26),Mn&=67108863;var Yn=0|(0|q+(ct=y(sn,Gn)))+((8191&(me=0|(me=y(sn,er))+y(Sn,Gn)))<<13);return q=0|(0|(ot=y(Sn,er))+(me>>>13))+(Yn>>>26),Yn&=67108863,F[0]=ft,F[1]=be,F[2]=dt,F[3]=Zr,F[4]=ri,F[5]=si,F[6]=cr,F[7]=yi,F[8]=Jr,F[9]=zr,F[10]=ui,F[11]=ai,F[12]=li,F[13]=Vr,F[14]=Fr,F[15]=Un,F[16]=We,F[17]=Mn,F[18]=Yn,0!==q&&(F[19]=q,M.length++),M};y||(ue=o),n.prototype.mulTo=function(T,D){var v,M=this.length+T.length;return v=10===this.length&&10===T.length?ue(this,T,D):63>M?o(this,T,D):1024>M?function t(X,T,D){D.negative=T.negative^X.negative,D.length=X.length+T.length;for(var F,M=0,v=0,B=0;B>>26))>>>26,F&=67108863}D.words[B]=q,M=F,F=v}return 0===M?D.length--:D.words[B]=M,D.strip()}(this,T,D):r(this,T,D),v},a.prototype.makeRBT=function(T){for(var D=Array(T),M=n.prototype._countBits(T)-1,v=0;v>=1;return v},a.prototype.permute=function(T,D,M,v,B,F){for(var q=0;q>>=1)B++;return 1<=M))for(var B,v=0;vB?0:0|B/67108864;return T},a.prototype.convert13b=function(T,D,M,v){for(var B=0,F=0;F>>=13),B>>>=13;for(F=2*D;FT);for(var D=0,M=0;M>=26,D+=0|v/67108864,D+=B>>>26,this.words[M]=67108863&B}return 0!==D&&(this.words[M]=D,this.length++),this},n.prototype.muln=function(T){return this.clone().imuln(T)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(T){var D=function u(X){for(var T=Array(X.bitLength()),D=0;D>>v}return T}(T);if(0===D.length)return new n(1);for(var M=this,v=0;v>>26-D<<26-D;if(0!=D){var F=0;for(B=0;B>>26-D}F&&(this.words[B]=F,this.length++)}if(0!==M){for(B=this.length-1;0<=B;B--)this.words[B+M]=this.words[B];for(B=0;B>>B<F)for(this.length-=F,Y=0;Y=v);Y--){var Ee=0|this.words[Y];this.words[Y]=se<<26-B|Ee>>>B,se=Ee&q}return L&&0!==se&&(L.words[L.length++]=se),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(T,D,M){return m(0===this.negative),this.iushrn(T,D,M)},n.prototype.shln=function(T){return this.clone().ishln(T)},n.prototype.ushln=function(T){return this.clone().iushln(T)},n.prototype.shrn=function(T){return this.clone().ishrn(T)},n.prototype.ushrn=function(T){return this.clone().iushrn(T)},n.prototype.testn=function(T){m("number"==typeof T&&0<=T);var D=T%26,M=(T-D)/26;return!(this.length<=M||!(this.words[M]&1<>>D<T),0>T?this.isubn(-T):0===this.negative?this._iaddn(T):1===this.length&&(0|this.words[0])T),0>T)return this.iaddn(-T);if(0!==this.negative)return this.negative=0,this.iaddn(T),this.negative=1,this;if(this.words[0]-=T,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var D=0;Dthis.words[D];D++)this.words[D]+=67108864,this.words[D+1]-=1;return this.strip()},n.prototype.addn=function(T){return this.clone().iaddn(T)},n.prototype.subn=function(T){return this.clone().isubn(T)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(T,D,M){var B;this._expand(T.length+M);var q,F=0;for(B=0;B>26)-(0|L/67108864),this.words[B+M]=67108863&q}for(;B>26,this.words[B+M]=67108863&q;if(0===F)return this.strip();for(m(-1===F),F=0,B=0;B>26,this.words[B]=67108863&q;return this.negative=1,this.strip()},n.prototype._wordDiv=function(T,D){var M,v=this.clone(),B=T,F=0|B.words[B.length-1];0!=(M=26-this._countBits(F))&&(B=B.ushln(M),v.iushln(M),F=0|B.words[B.length-1]);var Y,L=v.length-B.length;if("mod"!==D){(Y=new n(null)).length=L+1,Y.words=Array(Y.length);for(var se=0;sethis.length||0>this.cmp(T)?{div:new n(0),mod:this}:1===T.length?"div"===D?{div:this.divn(T.words[0]),mod:null}:"mod"===D?{div:null,mod:new n(this.modn(T.words[0]))}:{div:this.divn(T.words[0]),mod:new n(this.modn(T.words[0]))}:this._wordDiv(T,D);var v,B,F},n.prototype.div=function(T){return this.divmod(T,"div",!1).div},n.prototype.mod=function(T){return this.divmod(T,"mod",!1).mod},n.prototype.umod=function(T){return this.divmod(T,"mod",!0).mod},n.prototype.divRound=function(T){var D=this.divmod(T);if(D.mod.isZero())return D.div;var M=0===D.div.negative?D.mod:D.mod.isub(T),v=T.ushrn(1),B=T.andln(1),F=M.cmp(v);return 0>F||1===B&&0===F?D.div:0===D.div.negative?D.div.iaddn(1):D.div.isubn(1)},n.prototype.modn=function(T){m(67108863>=T);for(var D=67108864%T,M=0,v=this.length-1;0<=v;v--)M=(D*M+(0|this.words[v]))%T;return M},n.prototype.idivn=function(T){m(67108863>=T);for(var v,D=0,M=this.length-1;0<=M;M--)this.words[M]=0|(v=(0|this.words[M])+67108864*D)/T,D=v%T;return this.strip()},n.prototype.divn=function(T){return this.clone().idivn(T)},n.prototype.egcd=function(T){m(0===T.negative),m(!T.isZero());var D=this,M=T.clone();D=0===D.negative?D.clone():D.umod(T);for(var v=new n(1),B=new n(0),F=new n(0),q=new n(1),L=0;D.isEven()&&M.isEven();)D.iushrn(1),M.iushrn(1),++L;for(var Y=M.clone(),se=D.clone();!D.isZero();){for(var Ee=0,Se=1;!(D.words[0]&Se)&&26>Ee;++Ee,Se<<=1);if(0Ie;++Ie,Qe<<=1);if(0q;++q,L<<=1);if(0Y;++Y,se<<=1);if(0(Ee=0===D.cmpn(1)?v:B).cmpn(0)&&Ee.iadd(T),Ee},n.prototype.gcd=function(T){if(this.isZero())return T.abs();if(T.isZero())return this.abs();var D=this.clone(),M=T.clone();D.negative=0,M.negative=0;for(var v=0;D.isEven()&&M.isEven();v++)D.iushrn(1),M.iushrn(1);for(;;){for(;D.isEven();)D.iushrn(1);for(;M.isEven();)M.iushrn(1);var B=D.cmp(M);if(0>B){var F=D;D=M,M=F}else if(0===B||0===M.cmpn(1))break;D.isub(M)}return M.iushln(v)},n.prototype.invm=function(T){return this.egcd(T).a.umod(T)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(T){return this.words[0]&T},n.prototype.bincn=function(T){m("number"==typeof T);var D=T%26,M=(T-D)/26,v=1<>>26,this.words[F]=q&=67108863;return 0!==B&&(this.words[F]=B,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(T){var M,D=0>T;if(0!==this.negative&&!D)return-1;if(0===this.negative&&D)return 1;if(this.strip(),1=T,"Number is too big");var v=0|this.words[0];M=v===T?0:vT.length)return 1;if(this.lengthB&&(D=1);break}}return D},n.prototype.gtn=function(T){return 1===this.cmpn(T)},n.prototype.gt=function(T){return 1===this.cmp(T)},n.prototype.gten=function(T){return 0<=this.cmpn(T)},n.prototype.gte=function(T){return 0<=this.cmp(T)},n.prototype.ltn=function(T){return-1===this.cmpn(T)},n.prototype.lt=function(T){return-1===this.cmp(T)},n.prototype.lten=function(T){return 0>=this.cmpn(T)},n.prototype.lte=function(T){return 0>=this.cmp(T)},n.prototype.eqn=function(T){return 0===this.cmpn(T)},n.prototype.eq=function(T){return 0===this.cmp(T)},n.red=function(T){return new z(T)},n.prototype.toRed=function(T){return m(!this.red,"Already a number in reduction context"),m(0===this.negative,"red works only with positives"),T.convertTo(this)._forceRed(T)},n.prototype.fromRed=function(){return m(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(T){return this.red=T,this},n.prototype.forceRed=function(T){return m(!this.red,"Already a number in reduction context"),this._forceRed(T)},n.prototype.redAdd=function(T){return m(this.red,"redAdd works only with red numbers"),this.red.add(this,T)},n.prototype.redIAdd=function(T){return m(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,T)},n.prototype.redSub=function(T){return m(this.red,"redSub works only with red numbers"),this.red.sub(this,T)},n.prototype.redISub=function(T){return m(this.red,"redISub works only with red numbers"),this.red.isub(this,T)},n.prototype.redShl=function(T){return m(this.red,"redShl works only with red numbers"),this.red.shl(this,T)},n.prototype.redMul=function(T){return m(this.red,"redMul works only with red numbers"),this.red._verify2(this,T),this.red.mul(this,T)},n.prototype.redIMul=function(T){return m(this.red,"redMul works only with red numbers"),this.red._verify2(this,T),this.red.imul(this,T)},n.prototype.redSqr=function(){return m(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return m(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return m(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return m(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return m(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(T){return m(this.red&&!T.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,T)};var Ae={k256:null,p224:null,p192:null,p25519:null};c.prototype._tmp=function(){var T=new n(null);return T.words=Array(_e(this.n/13)),T},c.prototype.ireduce=function(T){var M,D=T;do{this.split(D,this.tmp),M=(D=(D=this.imulK(D)).iadd(this.tmp)).bitLength()}while(M>this.n);var v=M=T.length)return T.words[0]=0,void(T.length=1);var F=T.words[9];for(D.words[D.length++]=F&M,B=10;B>>22,F=q}T.words[B-10]=F>>>=22,T.length-=0===F&&10>>=26,T.words[M]=B,D=v}return 0!==D&&(T.words[T.length++]=D),T},n._prime=function(T){if(Ae[T])return Ae[T];var D;if("k256"===T)D=new l;else if("p224"===T)D=new w;else if("p192"===T)D=new E;else{if("p25519"!==T)throw new Error("Unknown prime "+T);D=new C}return Ae[T]=D,D},z.prototype._verify1=function(T){m(0===T.negative,"red works only with positives"),m(T.red,"red works only with red numbers")},z.prototype._verify2=function(T,D){m(0==(T.negative|D.negative),"red works only with positives"),m(T.red&&T.red===D.red,"red works only with red numbers")},z.prototype.imod=function(T){return this.prime?this.prime.ireduce(T)._forceRed(this):T.umod(this.m)._forceRed(this)},z.prototype.neg=function(T){return T.isZero()?T.clone():this.m.sub(T)._forceRed(this)},z.prototype.add=function(T,D){this._verify2(T,D);var M=T.add(D);return 0<=M.cmp(this.m)&&M.isub(this.m),M._forceRed(this)},z.prototype.iadd=function(T,D){this._verify2(T,D);var M=T.iadd(D);return 0<=M.cmp(this.m)&&M.isub(this.m),M},z.prototype.sub=function(T,D){this._verify2(T,D);var M=T.sub(D);return 0>M.cmpn(0)&&M.iadd(this.m),M._forceRed(this)},z.prototype.isub=function(T,D){this._verify2(T,D);var M=T.isub(D);return 0>M.cmpn(0)&&M.iadd(this.m),M},z.prototype.shl=function(T,D){return this._verify1(T),this.imod(T.ushln(D))},z.prototype.imul=function(T,D){return this._verify2(T,D),this.imod(T.imul(D))},z.prototype.mul=function(T,D){return this._verify2(T,D),this.imod(T.mul(D))},z.prototype.isqr=function(T){return this.imul(T,T.clone())},z.prototype.sqr=function(T){return this.mul(T,T)},z.prototype.sqrt=function(T){if(T.isZero())return T.clone();var D=this.m.andln(3);if(m(D%2==1),3===D){var M=this.m.add(new n(1)).iushrn(2);return this.pow(T,M)}for(var v=this.m.subn(1),B=0;!v.isZero()&&0===v.andln(1);)B++,v.iushrn(1);m(!v.isZero());var F=new n(1).toRed(this),q=F.redNeg(),L=this.m.subn(1).iushrn(1),Y=this.m.bitLength();for(Y=new n(2*Y*Y).toRed(this);0!==this.pow(Y,L).cmp(q);)Y.redIAdd(q);for(var se=this.pow(Y,v),Ee=this.pow(T,v.addn(1).iushrn(1)),Se=this.pow(T,v),Ie=B;0!==Se.cmp(F);){for(var Qe=Se,Je=0;0!==Qe.cmp(F);Je++)Qe=Qe.redSqr();m(Je>Ee,F!==v[0]&&(F=this.sqr(F)),0!==Se||0!==q?(q<<=1,q|=Se,(4==++L||0===B&&0===Ee)&&(F=this.mul(F,v[q]),L=0,q=0)):L=0;Y=26}return F},z.prototype.convertTo=function(T){var D=T.umod(this.m);return D===T?D.clone():D},z.prototype.convertFrom=function(T){var D=T.clone();return D.red=null,D},n.mont=function(T){return new k(T)},_(k,z),k.prototype.convertTo=function(T){return this.imod(T.ushln(this.shift))},k.prototype.convertFrom=function(T){var D=this.imod(T.mul(this.rinv));return D.red=null,D},k.prototype.imul=function(T,D){if(T.isZero()||D.isZero())return T.words[0]=0,T.length=1,T;var M=T.imul(D),v=M.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),B=M.isub(v).iushrn(this.shift),F=B;return 0<=B.cmp(this.m)?F=B.isub(this.m):0>B.cmpn(0)&&(F=B.iadd(this.m)),F._forceRed(this)},k.prototype.mul=function(T,D){if(T.isZero()||D.isZero())return new n(0)._forceRed(this);var M=T.mul(D),v=M.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),B=M.isub(v).iushrn(this.shift),F=B;return 0<=B.cmp(this.m)?F=B.isub(this.m):0>B.cmpn(0)&&(F=B.iadd(this.m)),F._forceRed(this)},k.prototype.invm=function(T){return this.imod(T._invmp(this.m).mul(this.r2))._forceRed(this)}}(typeof N>"u"||N,this)},{buffer:42}],23:[function(d,N,A){"use strict";function f(c){var l=c.length;if(0>18]+s[63&c>>12]+s[63&c>>6]+s[63&c]}function g(c,l,w){for(var E=[],C=l;C>16,C[z++]=255&I>>8,C[z++]=255&I;return 2===E&&(I=u[c.charCodeAt(V)]<<2|u[c.charCodeAt(V+1)]>>4,C[z++]=255&I),1===E&&(I=u[c.charCodeAt(V)]<<10|u[c.charCodeAt(V+1)]<<4|u[c.charCodeAt(V+2)]>>2,C[z++]=255&I>>8,C[z++]=255&I),C},A.fromByteArray=function h(c){for(var I,l=c.length,w=l%3,E=[],C=16383,z=0,k=l-w;zk?k:z+C));return 1===w?E.push(s[(I=c[l-1])>>2]+s[63&I<<4]+"=="):2===w&&E.push(s[(I=(c[l-2]<<8)+c[l-1])>>10]+s[63&I>>4]+s[63&I<<2]+"="),E.join("")};for(var s=[],u=[],o=typeof Uint8Array>"u"?Array:Uint8Array,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,a=t.length;rl&&48<=l)r=10*r+(l-48);else if(c!==o||43!==l){if(c===o&&45===l){a=-1;continue}if(46===l)break;throw new Error("not a number: buffer["+c+"] = "+l)}}return r*a}function m(u,o,t,r){return null==u||0===u.length?null:("number"!=typeof o&&null==r&&(r=o,o=void 0),"number"!=typeof t&&null==r&&(r=t,t=void 0),m.position=0,m.encoding=r||null,m.data=f.isBuffer(u)?u.slice(o,t):f.from(u),m.bytes=m.data.length,m.next())}m.bytes=0,m.position=0,m.data=null,m.encoding=null,m.next=function(){switch(m.data[m.position]){case 100:return m.dictionary();case 108:return m.list();case 105:return m.integer();default:return m.buffer()}},m.find=function(u){let o=m.position;const t=m.data.length,r=m.data;for(;o_?1:0;return _=At(+(_||1)),xt(n(_))+1+g},b.getType=function(_){return f.isBuffer(_)?"buffer":ArrayBuffer.isView(_)?"arraybufferview":Array.isArray(_)?"array":_ instanceof Number?"number":_ instanceof Boolean?"boolean":_ instanceof Set?"set":_ instanceof Map?"map":_ instanceof String?"string":_ instanceof ArrayBuffer?"arraybuffer":typeof _}}).call(this)}).call(this,{isBuffer:d("../../is-buffer/index.js")})},{"../../is-buffer/index.js":149}],29:[function(d,N,A){function b(m){return m.reduce((n,g,h,s)=>{const u=g.split("-").map(o=>parseInt(o));return n.concat(((n,g=n)=>Array.from({length:g-n+1},(h,s)=>s+n))(...u))},[])}N.exports=b,N.exports.parse=b,N.exports.compose=function f(m){return m.reduce((_,n,g,h)=>((0===g||n!==h[g-1]+1)&&_.push([]),_[_.length-1].push(n),_),[]).map(_=>1<_.length?`${_[0]}-${_[_.length-1]}`:`${_[0]}`)}},{}],30:[function(d,N,A){N.exports=function(f,b,m,_,n){var g,h;if(void 0===_)_=0;else if(0>(_|=0)||_>=f.length)throw new RangeError("invalid lower bound");if(void 0===n)n=f.length-1;else if((n|=0)<_||n>=f.length)throw new RangeError("invalid upper bound");for(;_<=n;)if(0>(h=+m(f[g=_+(n-_>>>1)],b,g,f)))_=g+1;else{if(!(0>3;return m%8!=0&&_++,_}Object.defineProperty(A,"__esModule",{value:!0});var b=function(){function m(_,n){void 0===_&&(_=0);var g=n?.grow;this.grow=g&&isFinite(g)&&f(g)||g||0,this.buffer="number"==typeof _?new Uint8Array(f(_)):_}return m.prototype.get=function(_){var n=_>>3;return n>_%8)},m.prototype.set=function(_,n){void 0===n&&(n=!0);var g=_>>3;if(n){if(this.buffer.length>_%8}else g>_%8))},m.prototype.forEach=function(_,n,g){void 0===n&&(n=0),void 0===g&&(g=8*this.buffer.length);for(var h=n,s=h>>3,u=128>>h%8,o=this.buffer[s];h>1},m}();A.default=b},{}],32:[function(d,N,A){(function(f){(function(){function b(q,L){for(let Y=q.length;Y--;)q[Y]^=L[Y];return q}const m=d("unordered-array-remove"),_=d("bencode"),n=d("bitfield").default,g=d("crypto"),h=d("debug")("bittorrent-protocol"),s=d("randombytes"),u=d("simple-sha1"),o=d("speedometer"),t=d("readable-stream"),r=d("rc4"),w=f.from("\x13BitTorrent protocol"),E=f.from([0,0,0,0]),C=f.from([0,0,0,1,0]),z=f.from([0,0,0,1,1]),k=f.from([0,0,0,1,2]),I=f.from([0,0,0,1,3]),V=[0,0,0,0,0,0,0,0],$=[0,0,0,3,9,0,0],oe=f.from([0,0,0,1,14]),ue=f.from([0,0,0,1,15]),T=f.from([0,0,0,0,0,0,0,0]),D=f.from([0,0,1,2]),M=f.from([0,0,0,2]);class v{constructor(L,Y,se,Ee){this.piece=L,this.offset=Y,this.length=se,this.callback=Ee}}class B{constructor(){this.buffer=new Uint8Array}get(L){return!0}set(L){}}N.exports=class F extends t.Duplex{constructor(L=null,Y=0,se=!1){super(),this._debugId=s(4).toString("hex"),this._debug("new wire"),this.peerId=null,this.peerIdBuffer=null,this.type=L,this.amChoking=!0,this.amInterested=!1,this.peerChoking=!0,this.peerInterested=!1,this.peerPieces=new n(0,{grow:4e5}),this.extensions={},this.peerExtensions={},this.requests=[],this.peerRequests=[],this.extendedMapping={},this.peerExtendedMapping={},this.extendedHandshake={},this.peerExtendedHandshake={},this.hasFast=!1,this.allowedFastSet=[],this.peerAllowedFastSet=[],this._ext={},this._nextExt=1,this.uploaded=0,this.downloaded=0,this.uploadSpeed=o(),this.downloadSpeed=o(),this._keepAliveInterval=null,this._timeout=null,this._timeoutMs=0,this._timeoutExpiresAt=null,this.destroyed=!1,this._finished=!1,this._parserSize=0,this._parser=null,this._buffer=[],this._bufferSize=0,this._peEnabled=se,se?(this._dh=g.createDiffieHellman("ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a36210000000000090563","hex",2),this._myPubKey=this._dh.generateKeys("hex")):this._myPubKey=null,this._peerPubKey=null,this._sharedSecret=null,this._peerCryptoProvide=[],this._cryptoHandshakeDone=!1,this._cryptoSyncPattern=null,this._waitMaxBytes=null,this._encryptionMethod=null,this._encryptGenerator=null,this._decryptGenerator=null,this._setGenerators=!1,this.once("finish",()=>this._onFinish()),this.on("finish",this._onFinish),this._debug("type:",this.type),"tcpIncoming"===this.type&&this._peEnabled?this._determineHandshakeType():"tcpOutgoing"===this.type&&this._peEnabled&&0===Y?this._parsePe2():this._parseHandshake(null)}setKeepAlive(L){this._debug("setKeepAlive %s",L),clearInterval(this._keepAliveInterval),!1===L||(this._keepAliveInterval=setInterval(()=>{this.keepAlive()},55e3))}setTimeout(L,Y){this._debug("setTimeout ms=%d unref=%s",L,Y),this._timeoutMs=L,this._timeoutUnref=!!Y,this._resetTimeout(!0)}destroy(){if(!this.destroyed)return this.destroyed=!0,this._debug("destroy"),this.emit("close"),this.end(),this}end(...L){return this._debug("end"),this._onUninterested(),this._onChoke(),super.end(...L)}use(L){function Y(){}const se=L.prototype.name;if(!se)throw new Error('Extension class requires a "name" property on the prototype');this._debug("use extension.name=%s",se);const Ee=this._nextExt,Se=new L(this);"function"!=typeof Se.onHandshake&&(Se.onHandshake=Y),"function"!=typeof Se.onExtendedHandshake&&(Se.onExtendedHandshake=Y),"function"!=typeof Se.onMessage&&(Se.onMessage=Y),this.extendedMapping[Ee]=se,this._ext[se]=Se,this[se]=Se,this._nextExt+=1}keepAlive(){this._debug("keep-alive"),this._push(E)}sendPe1(){if(this._peEnabled){const L=xt(513*Math.random()),Y=s(L);this._push(f.concat([f.from(this._myPubKey,"hex"),Y]))}}sendPe2(){const L=xt(513*Math.random()),Y=s(L);this._push(f.concat([f.from(this._myPubKey,"hex"),Y]))}sendPe3(L){this.setEncrypt(this._sharedSecret,L);const Y=f.from(u.sync(f.from(this._utfToHex("req1")+this._sharedSecret,"hex")),"hex"),Se=b(f.from(u.sync(f.from(this._utfToHex("req2")+L,"hex")),"hex"),f.from(u.sync(f.from(this._utfToHex("req3")+this._sharedSecret,"hex")),"hex")),Ie=s(2).readUInt16BE(0)%512,Qe=s(Ie);let Je=f.alloc(14+Ie+2);T.copy(Je),D.copy(Je,8),Je.writeInt16BE(Ie,12),Qe.copy(Je,14),Je.writeInt16BE(0,14+Ie),Je=this._encryptHandshake(Je),this._push(f.concat([Y,Se,Je]))}sendPe4(L){this.setEncrypt(this._sharedSecret,L);const Y=s(2).readUInt16BE(0)%512,se=s(Y);let Ee=f.alloc(14+Y);T.copy(Ee),M.copy(Ee,8),Ee.writeInt16BE(Y,12),se.copy(Ee,14),Ee=this._encryptHandshake(Ee),this._push(Ee),this._cryptoHandshakeDone=!0,this._debug("completed crypto handshake")}handshake(L,Y,se){let Ee,Se;if("string"==typeof L?(L=L.toLowerCase(),Ee=f.from(L,"hex")):(Ee=L,L=Ee.toString("hex")),"string"==typeof Y?Se=f.from(Y,"hex"):(Se=Y,Y=Se.toString("hex")),this._infoHash=Ee,20!==Ee.length||20!==Se.length)throw new Error("infoHash and peerId MUST have length 20");this._debug("handshake i=%s p=%s exts=%o",L,Y,se);const Ie=f.from(V);this.extensions={extended:!0,dht:!(!se||!se.dht),fast:!(!se||!se.fast)},Ie[5]|=16,this.extensions.dht&&(Ie[7]|=1),this.extensions.fast&&(Ie[7]|=4),this.extensions.fast&&this.peerExtensions.fast&&(this._debug("fast extension is enabled"),this.hasFast=!0),this._push(f.concat([w,Ie,Ee,Se])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()}_sendExtendedHandshake(){const L=Object.assign({},this.extendedHandshake);for(const Y in L.m={},this.extendedMapping)L.m[this.extendedMapping[Y]]=+Y;this.extended(0,_.encode(L)),this._extendedHandshakeSent=!0}choke(){if(!this.amChoking)if(this.amChoking=!0,this._debug("choke"),this._push(C),this.hasFast)for(let L=0;this.peerRequests.length>L;){const Y=this.peerRequests[L];this.allowedFastSet.includes(Y.piece)?++L:this.reject(Y.piece,Y.offset,Y.length)}else for(;this.peerRequests.length;)this.peerRequests.pop()}unchoke(){this.amChoking&&(this.amChoking=!1,this._debug("unchoke"),this._push(z))}interested(){this.amInterested||(this.amInterested=!0,this._debug("interested"),this._push(k))}uninterested(){this.amInterested&&(this.amInterested=!1,this._debug("uninterested"),this._push(I))}have(L){this._debug("have %d",L),this._message(4,[L],null)}bitfield(L){this._debug("bitfield"),f.isBuffer(L)||(L=L.buffer),this._message(5,[],L)}request(L,Y,se,Ee){return Ee||(Ee=()=>{}),this._finished?Ee(new Error("wire is closed")):!this.peerChoking||this.hasFast&&this.peerAllowedFastSet.includes(L)?(this._debug("request index=%d offset=%d length=%d",L,Y,se),this.requests.push(new v(L,Y,se,Ee)),!this._timeout&&this._resetTimeout(!0),void this._message(6,[L,Y,se],null)):Ee(new Error("peer is choking"))}piece(L,Y,se){this._debug("piece index=%d offset=%d",L,Y),this._message(7,[L,Y],se),this.uploaded+=se.length,this.uploadSpeed(se.length),this.emit("upload",se.length)}cancel(L,Y,se){this._debug("cancel index=%d offset=%d length=%d",L,Y,se),this._callback(this._pull(this.requests,L,Y,se),new Error("request was cancelled"),null),this._message(8,[L,Y,se],null)}port(L){this._debug("port %d",L);const Y=f.from($);Y.writeUInt16BE(L,5),this._push(Y)}suggest(L){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("suggest %d",L),this._message(13,[L],null)}haveAll(){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("have-all"),this._push(oe)}haveNone(){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("have-none"),this._push(ue)}reject(L,Y,se){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("reject index=%d offset=%d length=%d",L,Y,se),this._pull(this.peerRequests,L,Y,se),this._message(16,[L,Y,se],null)}allowedFast(L){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("allowed-fast %d",L),this.allowedFastSet.includes(L)||this.allowedFastSet.push(L),this._message(17,[L],null)}extended(L,Y){if(this._debug("extended ext=%s",L),"string"==typeof L&&this.peerExtendedMapping[L]&&(L=this.peerExtendedMapping[L]),"number"!=typeof L)throw new Error(`Unrecognized extension: ${L}`);{const se=f.from([L]),Ee=f.isBuffer(Y)?Y:_.encode(Y);this._message(20,[],f.concat([se,Ee]))}}setEncrypt(L,Y){let se,Ee,Se,Ie,Qe,Je;switch(this.type){case"tcpIncoming":se=u.sync(f.from(this._utfToHex("keyB")+L+Y,"hex")),Ee=u.sync(f.from(this._utfToHex("keyA")+L+Y,"hex")),Se=f.from(se,"hex"),Ie=[];for(const ut of Se.values())Ie.push(ut);Qe=f.from(Ee,"hex"),Je=[];for(const ut of Qe.values())Je.push(ut);this._encryptGenerator=new r(Ie),this._decryptGenerator=new r(Je);break;case"tcpOutgoing":se=u.sync(f.from(this._utfToHex("keyA")+L+Y,"hex")),Ee=u.sync(f.from(this._utfToHex("keyB")+L+Y,"hex")),Se=f.from(se,"hex"),Ie=[];for(const ut of Se.values())Ie.push(ut);Qe=f.from(Ee,"hex"),Je=[];for(const ut of Qe.values())Je.push(ut);this._encryptGenerator=new r(Ie),this._decryptGenerator=new r(Je);break;default:return!1}for(let ut=0;1024>ut;ut++)this._encryptGenerator.randomByte(),this._decryptGenerator.randomByte();return this._setGenerators=!0,!0}_read(){}_message(L,Y,se){const Ee=se?se.length:0,Se=f.allocUnsafe(5+4*Y.length);Se.writeUInt32BE(Se.length+Ee-4,0),Se[4]=L;for(let Ie=0;IeSe===this._pull(this.peerRequests,L,Y,se)?Ie?(this._debug("error satisfying request index=%d offset=%d length=%d (%s)",L,Y,se,Ie.message),void(this.hasFast&&this.reject(L,Y,se))):void this.piece(L,Y,Qe):void 0,Se=new v(L,Y,se,Ee);this.peerRequests.push(Se),this.emit("request",L,Y,se,Ee)}_onPiece(L,Y,se){this._debug("got piece index=%d offset=%d",L,Y),this._callback(this._pull(this.requests,L,Y,se.length),null,se),this.downloaded+=se.length,this.downloadSpeed(se.length),this.emit("download",se.length),this.emit("piece",L,Y,se)}_onCancel(L,Y,se){this._debug("got cancel index=%d offset=%d length=%d",L,Y,se),this._pull(this.peerRequests,L,Y,se),this.emit("cancel",L,Y,se)}_onPort(L){this._debug("got port %d",L),this.emit("port",L)}_onSuggest(L){return this.hasFast?(this._debug("got suggest %d",L),void this.emit("suggest",L)):(this._debug("Error: got suggest whereas fast extension is disabled"),void this.destroy())}_onHaveAll(){return this.hasFast?(this._debug("got have-all"),this.peerPieces=new B,void this.emit("have-all")):(this._debug("Error: got have-all whereas fast extension is disabled"),void this.destroy())}_onHaveNone(){return this.hasFast?(this._debug("got have-none"),void this.emit("have-none")):(this._debug("Error: got have-none whereas fast extension is disabled"),void this.destroy())}_onReject(L,Y,se){return this.hasFast?(this._debug("got reject index=%d offset=%d length=%d",L,Y,se),this._callback(this._pull(this.requests,L,Y,se),new Error("request was rejected"),null),void this.emit("reject",L,Y,se)):(this._debug("Error: got reject whereas fast extension is disabled"),void this.destroy())}_onAllowedFast(L){return this.hasFast?(this._debug("got allowed-fast %d",L),!this.peerAllowedFastSet.includes(L)&&this.peerAllowedFastSet.push(L),this.peerAllowedFastSet.length>100&&this.peerAllowedFastSet.shift(),void this.emit("allowed-fast",L)):(this._debug("Error: got allowed-fast whereas fast extension is disabled"),void this.destroy())}_onExtended(L,Y){if(0===L){let se;try{se=_.decode(Y)}catch(Ee){this._debug("ignoring invalid extended handshake: %s",Ee.message||Ee)}if(!se)return;if(this.peerExtendedHandshake=se,"object"==typeof se.m)for(const Ee in se.m)this.peerExtendedMapping[Ee]=+se.m[Ee].toString();for(const Ee in this._ext)this.peerExtendedMapping[Ee]&&this._ext[Ee].onExtendedHandshake(this.peerExtendedHandshake);this._debug("got extended handshake"),this.emit("extended","handshake",this.peerExtendedHandshake)}else this.extendedMapping[L]&&this._ext[L=this.extendedMapping[L]]&&this._ext[L].onMessage(Y),this._debug("got extended message ext=%s",L),this.emit("extended",L,Y)}_onTimeout(){this._debug("request timed out"),this._callback(this.requests.shift(),new Error("request has timed out"),null),this.emit("timeout")}_write(L,Y,se){if(2===this._encryptionMethod&&this._cryptoHandshakeDone&&(L=this._decrypt(L)),this._bufferSize+=L.length,this._buffer.push(L),1this._waitMaxBytes+this._cryptoSyncPattern.length)return this._debug("Error: could not resynchronize"),void this.destroy()}for(;this._bufferSize>=this._parserSize&&!this._cryptoSyncPattern;)if(0===this._parserSize)this._parser(f.from([]));else{const Ee=this._buffer[0];this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[Ee.slice(this._parserSize)]:[],this._parser(Ee.slice(0,this._parserSize))}se(null)}_callback(L,Y,se){L&&(this._resetTimeout(!this.peerChoking&&!this._finished),L.callback(Y,se))}_resetTimeout(L){if(!L||!this._timeoutMs||!this.requests.length)return clearTimeout(this._timeout),this._timeout=null,void(this._timeoutExpiresAt=null);const Y=Date.now()+this._timeoutMs;if(this._timeout){if(Y-this._timeoutExpiresAt<.05*this._timeoutMs)return;clearTimeout(this._timeout)}this._timeoutExpiresAt=Y,this._timeout=setTimeout(()=>this._onTimeout(),this._timeoutMs),this._timeoutUnref&&this._timeout.unref&&this._timeout.unref()}_parse(L,Y){this._parserSize=L,this._parser=Y}_parseUntil(L,Y){this._cryptoSyncPattern=L,this._waitMaxBytes=Y}_onMessageLength(L){const Y=L.readUInt32BE(0);0{const Y=L.readUInt8(0);19===Y?this._parse(Y+48,this._onHandshakeBuffer):this._parsePe1(L)})}_parsePe1(L){this._parse(95,Y=>{this._onPe1(f.concat([L,Y])),this._parsePe3()})}_parsePe2(){this._parse(96,L=>{for(this._onPe2(L);!this._setGenerators;);this._parsePe4()})}_parsePe3(){const L=f.from(u.sync(f.from(this._utfToHex("req1")+this._sharedSecret,"hex")),"hex");this._parseUntil(L,512),this._parse(20,Y=>{for(this._onPe3(Y);!this._setGenerators;);this._parsePe3Encrypted()})}_parsePe3Encrypted(){this._parse(14,L=>{const Y=this._decryptHandshake(L.slice(0,8)),se=this._decryptHandshake(L.slice(8,12)),Ee=this._decryptHandshake(L.slice(12,14)).readUInt16BE(0);this._parse(Ee,Se=>{Se=this._decryptHandshake(Se),this._parse(2,Ie=>{const Qe=this._decryptHandshake(Ie).readUInt16BE(0);this._parse(Qe,Je=>{Je=this._decryptHandshake(Je),this._onPe3Encrypted(Y,se,Se,Je);const ut=Qe?Je.readUInt8(0):null,$t=Qe?Je.slice(1,20):null;19===ut&&"BitTorrent protocol"===$t.toString()?this._onHandshakeBuffer(Je.slice(1)):this._parseHandshake()})})})})}_parsePe4(){const L=this._decryptHandshake(T);this._parseUntil(L,512),this._parse(6,Y=>{const se=this._decryptHandshake(Y.slice(0,4)),Ee=this._decryptHandshake(Y.slice(4,6)).readUInt16BE(0);this._parse(Ee,Se=>{this._decryptHandshake(Se),this._onPe4(se),this._parseHandshake(null)})})}_parseHandshake(){this._parse(1,L=>{const Y=L.readUInt8(0);return 19===Y?void this._parse(Y+48,this._onHandshakeBuffer):(this._debug("Error: wire not speaking BitTorrent protocol (%s)",Y.toString()),void this.end())})}_onHandshakeBuffer(L){const Y=L.slice(0,19);return"BitTorrent protocol"===Y.toString()?(L=L.slice(19),this._onHandshake(L.slice(8,28),L.slice(28,48),{dht:!!(1&L[7]),fast:!!(4&L[7]),extended:!!(16&L[5])}),void this._parse(4,this._onMessageLength)):(this._debug("Error: wire not speaking BitTorrent protocol (%s)",Y.toString()),void this.end())}_onFinish(){for(this._finished=!0,this.push(null);this.read(););for(clearInterval(this._keepAliveInterval),this._parse(Number.MAX_VALUE,()=>{});this.peerRequests.length;)this.peerRequests.pop();for(;this.requests.length;)this._callback(this.requests.pop(),new Error("wire was closed"),null)}_debug(...L){L[0]=`[${this._debugId}] ${L[0]}`,h(...L)}_pull(L,Y,se,Ee){for(let Se=0;Se("/"===(z=z.toString())[z.length-1]&&(z=z.substring(0,z.length-1)),z)),w=Array.from(new Set(w));const E=!1!==this._wrtc&&(!!this._wrtc||h.WEBRTC_SUPPORT),C=z=>{s(()=>{this.emit("warning",z)})};this._trackers=w.map(z=>{let k;try{k=u.parseUrl(z)}catch{return C(new Error(`Invalid tracker URL: ${z}`)),null}const I=k.port;if(0>I||65535{w.setInterval()})}stop(l){(l=this._defaultAnnounceOpts(l)).event="stopped",m("send `stop` %o",l),this._announce(l)}complete(l){l||(l={}),(l=this._defaultAnnounceOpts(l)).event="completed",m("send `complete` %o",l),this._announce(l)}update(l){(l=this._defaultAnnounceOpts(l)).event&&delete l.event,m("send `update` %o",l),this._announce(l)}_announce(l){this._trackers.forEach(w=>{w.announce(l)})}scrape(l){m("send `scrape`"),l||(l={}),this._trackers.forEach(w=>{w.scrape(l)})}setInterval(l){m("setInterval %d",l),this._trackers.forEach(w=>{w.setInterval(l)})}destroy(l){if(!this.destroyed){this.destroyed=!0,m("destroy");const w=this._trackers.map(E=>C=>{E.destroy(C)});g(w,l),this._trackers=[],this._getAnnounceOpts=null}}_defaultAnnounceOpts(l={}){return null==l.numwant&&(l.numwant=u.DEFAULT_ANNOUNCE_PEERS),null==l.uploaded&&(l.uploaded=0),null==l.downloaded&&(l.downloaded=0),this._getAnnounceOpts&&(l=Object.assign({},l,this._getAnnounceOpts())),l}}a.scrape=(c,l)=>{if(l=n(l),!c.infoHash)throw new Error("Option `infoHash` is required");if(!c.announce)throw new Error("Option `announce` is required");const w=Object.assign({},c,{infoHash:Array.isArray(c.infoHash)?c.infoHash[0]:c.infoHash,peerId:b.from("01234567890123456789"),port:6881}),E=new a(w);E.once("error",l),E.once("warning",l);let C=Array.isArray(c.infoHash)?c.infoHash.length:1;const z={};return E.on("scrape",k=>{if(C-=1,z[k.infoHash]=k,0===C){E.destroy();const I=Object.keys(z);l(null,1===I.length?z[I[0]]:z)}}),c.infoHash=Array.isArray(c.infoHash)?c.infoHash.map(k=>b.from(k,"hex")):b.from(c.infoHash,"hex"),E.scrape({infoHash:c.infoHash}),E},N.exports=a}).call(this)}).call(this,d("_process"),d("buffer").Buffer)},{"./lib/client/http-tracker":42,"./lib/client/udp-tracker":42,"./lib/client/websocket-tracker":35,"./lib/common":36,_process:193,buffer:76,debug:91,events:123,once:178,"queue-microtask":206,"run-parallel":233,"simple-peer":247}],34:[function(d,N,A){const f=d("events");N.exports=class b extends f{constructor(_,n){super(),this.client=_,this.announceUrl=n,this.interval=null,this.destroyed=!1}setInterval(_){null==_&&(_=this.DEFAULT_ANNOUNCE_INTERVAL),clearInterval(this.interval),_&&(this.interval=setInterval(()=>{this.announce(this.client._defaultAnnounceOpts())},_),this.interval.unref&&this.interval.unref())}}},{events:123}],35:[function(d,N,A){function f(){}const b=d("clone"),m=d("debug")("bittorrent-tracker:websocket-tracker"),_=d("simple-peer"),n=d("randombytes"),g=d("simple-websocket"),h=d("socks"),s=d("../common"),u=d("./tracker"),o={},c=5e4;class l extends u{constructor(E,C){super(E,C),m("new websocket tracker %s",C),this.peers={},this.socket=null,this.reconnecting=!1,this.retries=0,this.reconnectTimer=null,this.expectingResponse=!1,this._openSocket()}announce(E){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once("connect",()=>{this.announce(E)});const C=Object.assign({},E,{action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary});if(this._trackerId&&(C.trackerid=this._trackerId),"stopped"===E.event||"completed"===E.event)this._send(C);else{const z=ne(E.numwant,5);this._generateOffers(z,k=>{C.numwant=z,C.offers=k,this._send(C)})}}scrape(E){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once("connect",()=>{this.scrape(E)});const C=Array.isArray(E.infoHash)&&0k.toString("binary")):E.infoHash&&E.infoHash.toString("binary")||this.client._infoHashBinary;this._send({action:"scrape",info_hash:C})}destroy(E=f){function C(){k&&(clearTimeout(k),k=null),z.removeListener("data",C),z.destroy(),z=null}if(this.destroyed)return E(null);for(const I in this.destroyed=!0,clearInterval(this.interval),clearTimeout(this.reconnectTimer),this.peers){const V=this.peers[I];clearTimeout(V.trackerTimeout),V.destroy()}if(this.peers=null,this.socket&&(this.socket.removeListener("connect",this._onSocketConnectBound),this.socket.removeListener("data",this._onSocketDataBound),this.socket.removeListener("close",this._onSocketCloseBound),this.socket.removeListener("error",this._onSocketErrorBound),this.socket=null),this._onSocketConnectBound=null,this._onSocketErrorBound=null,this._onSocketDataBound=null,this._onSocketCloseBound=null,o[this.announceUrl]&&(o[this.announceUrl].consumers-=1),0{this._onSocketConnect()},this._onSocketErrorBound=E=>{this._onSocketError(E)},this._onSocketDataBound=E=>{this._onSocketData(E)},this._onSocketCloseBound=()=>{this._onSocketClose()},this.socket=o[this.announceUrl],this.socket)o[this.announceUrl].consumers+=1,this.socket.connected&&this._onSocketConnectBound();else{const E=new URL(this.announceUrl);let C;this.client._proxyOpts&&(C="wss:"===E.protocol?this.client._proxyOpts.httpsAgent:this.client._proxyOpts.httpAgent,!C&&this.client._proxyOpts.socksProxy&&(C=new h.Agent(b(this.client._proxyOpts.socksProxy),"wss:"===E.protocol))),this.socket=o[this.announceUrl]=new g({url:this.announceUrl,agent:C}),this.socket.consumers=1,this.socket.once("connect",this._onSocketConnectBound)}this.socket.on("data",this._onSocketDataBound),this.socket.once("close",this._onSocketCloseBound),this.socket.once("error",this._onSocketErrorBound)}_onSocketConnect(){this.destroyed||this.reconnecting&&(this.reconnecting=!1,this.retries=0,this.announce(this.client._defaultAnnounceOpts()))}_onSocketData(E){if(!this.destroyed){this.expectingResponse=!1;try{E=JSON.parse(E)}catch{return void this.client.emit("warning",new Error("Invalid tracker response"))}"announce"===E.action?this._onAnnounceResponse(E):"scrape"===E.action?this._onScrapeResponse(E):this._onSocketError(new Error(`invalid action in WS response: ${E.action}`))}}_onAnnounceResponse(E){if(E.info_hash!==this.client._infoHashBinary)return void m("ignoring websocket data from %s for %s (looking for %s: reused socket)",this.announceUrl,s.binaryToHex(E.info_hash),this.client.infoHash);if(E.peer_id&&E.peer_id===this.client._peerIdBinary)return;m("received %s from %s for %s",JSON.stringify(E),this.announceUrl,this.client.infoHash);const C=E["failure reason"];if(C)return this.client.emit("warning",new Error(C));const z=E["warning message"];z&&this.client.emit("warning",new Error(z));const k=E.interval||E["min interval"];k&&this.setInterval(1e3*k);const I=E["tracker id"];if(I&&(this._trackerId=I),null!=E.complete){const $=Object.assign({},E,{announce:this.announceUrl,infoHash:s.binaryToHex(E.info_hash)});this.client.emit("update",$)}let V;if(E.offer&&E.peer_id&&(m("creating peer (from remote offer)"),V=this._createPeer(),V.id=s.binaryToHex(E.peer_id),V.once("signal",$=>{const oe={action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary,to_peer_id:E.peer_id,answer:$,offer_id:E.offer_id};this._trackerId&&(oe.trackerid=this._trackerId),this._send(oe)}),this.client.emit("peer",V),V.signal(E.offer)),E.answer&&E.peer_id){const $=s.binaryToHex(E.offer_id);V=this.peers[$],V?(V.id=s.binaryToHex(E.peer_id),this.client.emit("peer",V),V.signal(E.answer),clearTimeout(V.trackerTimeout),V.trackerTimeout=null,delete this.peers[$]):m(`got unexpected answer: ${JSON.stringify(E.answer)}`)}}_onScrapeResponse(E){E=E.files||{};const C=Object.keys(E);return 0===C.length?void this.client.emit("warning",new Error("invalid scrape response")):void C.forEach(z=>{const k=Object.assign(E[z],{announce:this.announceUrl,infoHash:s.binaryToHex(z)});this.client.emit("scrape",k)})}_onSocketClose(){this.destroyed||(this.destroy(),this._startReconnectTimer())}_onSocketError(E){this.destroyed||(this.destroy(),this.client.emit("warning",E),this._startReconnectTimer())}_startReconnectTimer(){const E=xt(3e5*Math.random())+ne(1e4*H(2,this.retries),36e5);this.reconnecting=!0,clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout(()=>{this.retries++,this._openSocket()},E),this.reconnectTimer.unref&&this.reconnectTimer.unref(),m("reconnecting socket in %s ms",E)}_send(E){if(!this.destroyed){this.expectingResponse=!0;const C=JSON.stringify(E);m("send %s",C),this.socket.send(C)}}_generateOffers(E,C){function z(){const $=n(20).toString("hex");m("creating peer (from _generateOffers)");const oe=I.peers[$]=I._createPeer({initiator:!0});oe.once("signal",ue=>{V.push({offer:ue,offer_id:s.hexToBinary($)}),k()}),oe.trackerTimeout=setTimeout(()=>{m("tracker timeout: destroying peer"),oe.trackerTimeout=null,delete I.peers[$],oe.destroy()},c),oe.trackerTimeout.unref&&oe.trackerTimeout.unref()}function k(){V.length===E&&(m("generated %s offers",E),C(V))}const I=this,V=[];m("generating %s offers",E);for(let $=0;$("string"!=typeof m&&(m+=""),f.from(m,"binary").toString("hex")),A.hexToBinary=m=>("string"!=typeof m&&(m+=""),f.from(m,"hex").toString("binary")),A.parseUrl=m=>{const _=new URL(m.replace(/^udp:/,"http:"));return m.match(/^udp:/)&&Object.defineProperties(_,{href:{value:_.href.replace(/^http/,"udp")},protocol:{value:_.protocol.replace(/^http/,"udp")},origin:{value:_.origin.replace(/^http/,"udp")}}),_};const b=d("./common-node");Object.assign(A,b)}).call(this)}).call(this,d("buffer").Buffer)},{"./common-node":42,buffer:76}],37:[function(d,N,A){(function(f){(function(){N.exports=function(m,_){if(typeof Blob>"u"||!(m instanceof Blob))throw new Error("first argument must be a Blob");if("function"!=typeof _)throw new Error("second argument must be a function");const g=new FileReader;g.addEventListener("loadend",function n(h){g.removeEventListener("loadend",n,!1),h.error?_(h.error):_(null,f.from(g.result))},!1),g.readAsArrayBuffer(m)}}).call(this)}).call(this,d("buffer").Buffer)},{buffer:76}],38:[function(d,N,A){function f(b,m){if("string"==typeof b[0])return b.join("");if("number"==typeof b[0])return new Uint8Array(b);const _=new Uint8Array(m);let n=0;for(let g=0,h=b.length;g=m){const o=f(h,s);let t=0;for(;s>=m;)yield o.slice(t,t+m),s-=m,t+=m;h=[o.slice(t,o.length)]}s&&(yield f(h,g?m:s))}},{}],39:[function(d,N,A){(function(f){(function(){const{Transform:b}=d("readable-stream");N.exports=class m extends b{constructor(n,g={}){super(g),"object"==typeof n&&(n=(g=n).size),this.size=n||512;const{nopad:h,zeroPadding:s=!0}=g;this._zeroPadding=!h&&!!s,this._buffered=[],this._bufferedBytes=0}_transform(n,g,h){for(this._bufferedBytes+=n.length,this._buffered.push(n);this._bufferedBytes>=this.size;){this._bufferedBytes-=this.size;const s=[];for(let u=0;u=B?B-48:65<=B&&70>=B?B-55:97<=B&&102>=B?B-87:void m(!1,"Invalid character in "+M)}function h(M,v,B){var F=g(M,B);return B-1>=v&&(F|=g(M,B-1)<<4),F}function s(M,v,B,F){for(var Ee,q=0,L=0,Y=ne(M.length,B),se=v;se"}function r(M,v,B){B.negative=v.negative^M.negative;var F=0|M.length+v.length;B.length=F,F=0|F-1;var q=0|M.words[0],L=0|v.words[0],Y=q*L,Ee=0|Y/67108864;B.words[0]=67108863&Y;for(var Se=1;Se>>26,Qe=67108863&Ee,Je=ne(Se,v.length-1),ut=pe(0,Se-M.length+1);ut<=Je;ut++)Ie+=0|(Y=(q=0|M.words[0|Se-ut])*(L=0|v.words[ut])+Qe)/67108864,Qe=67108863&Y;B.words[Se]=0|Qe,Ee=0|Ie}return 0===Ee?B.length--:B.words[Se]=0|Ee,B._strip()}function a(M,v,B){B.negative=v.negative^M.negative,B.length=M.length+v.length;for(var Y,F=0,q=0,L=0;L>>26))>>>26,Y&=67108863}B.words[L]=se,F=Y,Y=q}return 0===F?B.length--:B.words[L]=F,B._strip()}function c(M,v,B){return a(M,v,B)}function l(M,v){this.x=M,this.y=v}function w(M,v){this.name=M,this.p=new n(v,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function E(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function C(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function z(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function k(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(M){if("string"==typeof M){var v=n._prime(M);this.m=v.p,this.prime=v}else m(M.gtn(1),"modulus must be greater than 1"),this.m=M,this.prime=null}function V(M){I.call(this,M),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}var $;"object"==typeof f?f.exports=n:b.BN=n,n.BN=n,n.wordSize=26;try{$=typeof window<"u"&&typeof window.Buffer<"u"?window.Buffer:d("buffer").Buffer}catch{}if(n.isBN=function(v){return v instanceof n||null!==v&&"object"==typeof v&&v.constructor.wordSize===n.wordSize&&Array.isArray(v.words)},n.max=function(v,B){return 0v.cmp(B)?v:B},n.prototype._init=function(v,B,F){if("number"==typeof v)return this._initNumber(v,B,F);if("object"==typeof v)return this._initArray(v,B,F);"hex"===B&&(B=16),m(B===(0|B)&&2<=B&&36>=B);var q=0;"-"===(v=v.toString().replace(/\s+/g,""))[0]&&(q++,this.negative=1),qv&&(this.negative=1,v=-v),67108864>v?(this.words=[67108863&v],this.length=1):4503599627370496>v?(this.words=[67108863&v,67108863&v/67108864],this.length=2):(m(9007199254740992>v),this.words=[67108863&v,67108863&v/67108864,1],this.length=3),"le"!==F||this._initArray(this.toArray(),B,F)},n.prototype._initArray=function(v,B,F){if(m("number"==typeof v.length),0>=v.length)return this.words=[0],this.length=1,this;this.length=_e(v.length/3),this.words=Array(this.length);for(var q=0;q>>26-L,26<=(L+=24)&&(L-=26,Y++);else if("le"===F)for(q=0,Y=0;q>>26-L,26<=(L+=24)&&(L-=26,Y++);return this._strip()},n.prototype._parseHex=function(v,B,F){this.length=_e((v.length-B)/6),this.words=Array(this.length);for(var q=0;q=B;q-=2)se=h(v,B,q)<>>26):L+=8;else for(q=(v.length-B)%2==0?B+1:B;q>>26):L+=8;this._strip()},n.prototype._parseBase=function(v,B,F){this.words=[0],this.length=1;for(var q=0,L=1;67108863>=L;L*=B)q++;q--,L=0|L/B;for(var Y=v.length-F,se=Y%q,Ee=ne(Y,Y-se)+F,Se=0,Ie=F;Iethis.words[0]+Se?this.words[0]+=Se:this._iaddn(Se);if(0!==se){var Qe=1;for(Se=s(v,Ie,v.length,B),Ie=0;Iethis.words[0]+Se?this.words[0]+=Se:this._iaddn(Se)}this._strip()},n.prototype.copy=function(v){v.words=Array(this.length);for(var B=0;B>>24-q,26<=(q+=2)&&(q-=26,Y--),F=0!==L||Y!==this.length-1?oe[6-Ee.length]+Ee+F:Ee+F}for(0!==L&&(F=L.toString(16)+F);F.length%B!=0;)F="0"+F;return 0!==this.negative&&(F="-"+F),F}if(v===(0|v)&&2<=v&&36>=v){var Se=ue[v],Ie=Ae[v];F="";var Qe=this.clone();for(Qe.negative=0;!Qe.isZero();){var Je=Qe.modrn(Ie).toString(v);F=(Qe=Qe.idivn(Ie)).isZero()?Je+F:oe[Se-Je.length]+Je+F}for(this.isZero()&&(F="0"+F);F.length%B!=0;)F="0"+F;return 0!==this.negative&&(F="-"+F),F}m(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var v=this.words[0];return 2===this.length?v+=67108864*this.words[1]:3===this.length&&1===this.words[2]?v+=4503599627370496+67108864*this.words[1]:2>8),F>16),6==Y?(F>24),q=0,Y=0):(q=se>>>24,Y+=2);if(F>8),0<=F&&(v[F--]=255&se>>16),6==Y?(0<=F&&(v[F--]=255&se>>24),q=0,Y=0):(q=se>>>24,Y+=2);if(0<=F)for(v[F--]=q;0<=F;)v[F--]=0},n.prototype._countBits=he?function(v){return 32-he(v)}:function(v){var B=v,F=0;return 4096<=B&&(F+=13,B>>>=13),64<=B&&(F+=7,B>>>=7),8<=B&&(F+=4,B>>>=4),2<=B&&(F+=2,B>>>=2),F+B},n.prototype._zeroBits=function(v){if(0===v)return 26;var B=v,F=0;return!(8191&B)&&(F+=13,B>>>=13),!(127&B)&&(F+=7,B>>>=7),!(15&B)&&(F+=4,B>>>=4),!(3&B)&&(F+=2,B>>>=2),!(1&B)&&F++,F},n.prototype.bitLength=function(){var B=this._countBits(this.words[this.length-1]);return 26*(this.length-1)+B},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var F,v=0,B=0;Bv.length?this.clone().ior(v):v.clone().ior(this)},n.prototype.uor=function(v){return this.length>v.length?this.clone().iuor(v):v.clone().iuor(this)},n.prototype.iuand=function(v){var B;B=this.length>v.length?v:this;for(var F=0;Fv.length?this.clone().iand(v):v.clone().iand(this)},n.prototype.uand=function(v){return this.length>v.length?this.clone().iuand(v):v.clone().iuand(this)},n.prototype.iuxor=function(v){var B,F;this.length>v.length?(B=this,F=v):(B=v,F=this);for(var q=0;qv.length?this.clone().ixor(v):v.clone().ixor(this)},n.prototype.uxor=function(v){return this.length>v.length?this.clone().iuxor(v):v.clone().iuxor(this)},n.prototype.inotn=function(v){m("number"==typeof v&&0<=v);var B=0|_e(v/26),F=v%26;this._expand(B),0>26-F),this._strip()},n.prototype.notn=function(v){return this.clone().inotn(v)},n.prototype.setn=function(v,B){m("number"==typeof v&&0<=v);var F=0|v/26,q=v%26;return this._expand(F+1),B?this.words[F]|=1<v.length?(F=this,q=v):(F=v,q=this);for(var L=0,Y=0;Y>>26;for(;0!==L&&Y>>26;if(this.length=F.length,0!==L)this.words[this.length]=L,this.length++;else if(F!==this)for(;Yv.length?this.clone().iadd(v):v.clone().iadd(this)},n.prototype.isub=function(v){if(0!==v.negative){v.negative=0;var B=this.iadd(v);return v.negative=1,B._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(v),this.negative=1,this._normSign();var q,L,F=this.cmp(v);if(0===F)return this.negative=0,this.length=1,this.words[0]=0,this;0>26,this.words[se]=67108863&B;for(;0!==Y&&se>26,this.words[se]=67108863&B;if(0===Y&&se>>13,Qe=0|q[1],Je=8191&Qe,ut=Qe>>>13,$t=0|q[2],qt=8191&$t,tt=$t>>>13,at=0|q[3],nt=8191&at,Yt=at>>>13,Tn=0|q[4],J=8191&Tn,O=Tn>>>13,W=0|q[5],ee=8191&W,ve=W>>>13,He=0|q[6],ht=8191&He,st=He>>>13,Jt=0|q[7],on=8191&Jt,Ht=Jt>>>13,wn=0|q[8],sn=8191&wn,Sn=wn>>>13,fr=0|q[9],Dn=8191&fr,Rt=fr>>>13,vr=0|L[0],de=8191&vr,Le=vr>>>13,et=0|L[1],qe=8191&et,Ze=et>>>13,Ct=0|L[2],Nt=8191&Ct,Bt=Ct>>>13,ln=0|L[3],Ot=8191&ln,mn=ln>>>13,kn=0|L[4],vn=8191&kn,In=kn>>>13,pr=0|L[5],Nn=8191&pr,zn=pr>>>13,Br=0|L[6],Rn=8191&Br,Qn=Br>>>13,Wr=0|L[7],Kn=8191&Wr,Zn=Wr>>>13,Kr=0|L[8],Gn=8191&Kr,er=Kr>>>13,ct=0|L[9],me=8191&ct,ot=ct>>>13;F.negative=v.negative^B.negative,F.length=19;var Zr=0|(0|se+(ft=y(Se,de)))+((8191&(be=0|(be=y(Se,Le))+y(Ie,de)))<<13);se=0|(0|(dt=y(Ie,Le))+(be>>>13))+(Zr>>>26),Zr&=67108863,ft=y(Je,de),be=0|(be=y(Je,Le))+y(ut,de),dt=y(ut,Le);var ri=0|(0|se+(ft=0|ft+y(Se,qe)))+((8191&(be=0|(be=0|be+y(Se,Ze))+y(Ie,qe)))<<13);se=0|(0|(dt=0|dt+y(Ie,Ze))+(be>>>13))+(ri>>>26),ri&=67108863,ft=y(qt,de),be=0|(be=y(qt,Le))+y(tt,de),dt=y(tt,Le),ft=0|ft+y(Je,qe),be=0|(be=0|be+y(Je,Ze))+y(ut,qe),dt=0|dt+y(ut,Ze);var si=0|(0|se+(ft=0|ft+y(Se,Nt)))+((8191&(be=0|(be=0|be+y(Se,Bt))+y(Ie,Nt)))<<13);se=0|(0|(dt=0|dt+y(Ie,Bt))+(be>>>13))+(si>>>26),si&=67108863,ft=y(nt,de),be=0|(be=y(nt,Le))+y(Yt,de),dt=y(Yt,Le),ft=0|ft+y(qt,qe),be=0|(be=0|be+y(qt,Ze))+y(tt,qe),dt=0|dt+y(tt,Ze),ft=0|ft+y(Je,Nt),be=0|(be=0|be+y(Je,Bt))+y(ut,Nt),dt=0|dt+y(ut,Bt);var cr=0|(0|se+(ft=0|ft+y(Se,Ot)))+((8191&(be=0|(be=0|be+y(Se,mn))+y(Ie,Ot)))<<13);se=0|(0|(dt=0|dt+y(Ie,mn))+(be>>>13))+(cr>>>26),cr&=67108863,ft=y(J,de),be=0|(be=y(J,Le))+y(O,de),dt=y(O,Le),ft=0|ft+y(nt,qe),be=0|(be=0|be+y(nt,Ze))+y(Yt,qe),dt=0|dt+y(Yt,Ze),ft=0|ft+y(qt,Nt),be=0|(be=0|be+y(qt,Bt))+y(tt,Nt),dt=0|dt+y(tt,Bt),ft=0|ft+y(Je,Ot),be=0|(be=0|be+y(Je,mn))+y(ut,Ot),dt=0|dt+y(ut,mn);var yi=0|(0|se+(ft=0|ft+y(Se,vn)))+((8191&(be=0|(be=0|be+y(Se,In))+y(Ie,vn)))<<13);se=0|(0|(dt=0|dt+y(Ie,In))+(be>>>13))+(yi>>>26),yi&=67108863,ft=y(ee,de),be=0|(be=y(ee,Le))+y(ve,de),dt=y(ve,Le),ft=0|ft+y(J,qe),be=0|(be=0|be+y(J,Ze))+y(O,qe),dt=0|dt+y(O,Ze),ft=0|ft+y(nt,Nt),be=0|(be=0|be+y(nt,Bt))+y(Yt,Nt),dt=0|dt+y(Yt,Bt),ft=0|ft+y(qt,Ot),be=0|(be=0|be+y(qt,mn))+y(tt,Ot),dt=0|dt+y(tt,mn),ft=0|ft+y(Je,vn),be=0|(be=0|be+y(Je,In))+y(ut,vn),dt=0|dt+y(ut,In);var Jr=0|(0|se+(ft=0|ft+y(Se,Nn)))+((8191&(be=0|(be=0|be+y(Se,zn))+y(Ie,Nn)))<<13);se=0|(0|(dt=0|dt+y(Ie,zn))+(be>>>13))+(Jr>>>26),Jr&=67108863,ft=y(ht,de),be=0|(be=y(ht,Le))+y(st,de),dt=y(st,Le),ft=0|ft+y(ee,qe),be=0|(be=0|be+y(ee,Ze))+y(ve,qe),dt=0|dt+y(ve,Ze),ft=0|ft+y(J,Nt),be=0|(be=0|be+y(J,Bt))+y(O,Nt),dt=0|dt+y(O,Bt),ft=0|ft+y(nt,Ot),be=0|(be=0|be+y(nt,mn))+y(Yt,Ot),dt=0|dt+y(Yt,mn),ft=0|ft+y(qt,vn),be=0|(be=0|be+y(qt,In))+y(tt,vn),dt=0|dt+y(tt,In),ft=0|ft+y(Je,Nn),be=0|(be=0|be+y(Je,zn))+y(ut,Nn),dt=0|dt+y(ut,zn);var zr=0|(0|se+(ft=0|ft+y(Se,Rn)))+((8191&(be=0|(be=0|be+y(Se,Qn))+y(Ie,Rn)))<<13);se=0|(0|(dt=0|dt+y(Ie,Qn))+(be>>>13))+(zr>>>26),zr&=67108863,ft=y(on,de),be=0|(be=y(on,Le))+y(Ht,de),dt=y(Ht,Le),ft=0|ft+y(ht,qe),be=0|(be=0|be+y(ht,Ze))+y(st,qe),dt=0|dt+y(st,Ze),ft=0|ft+y(ee,Nt),be=0|(be=0|be+y(ee,Bt))+y(ve,Nt),dt=0|dt+y(ve,Bt),ft=0|ft+y(J,Ot),be=0|(be=0|be+y(J,mn))+y(O,Ot),dt=0|dt+y(O,mn),ft=0|ft+y(nt,vn),be=0|(be=0|be+y(nt,In))+y(Yt,vn),dt=0|dt+y(Yt,In),ft=0|ft+y(qt,Nn),be=0|(be=0|be+y(qt,zn))+y(tt,Nn),dt=0|dt+y(tt,zn),ft=0|ft+y(Je,Rn),be=0|(be=0|be+y(Je,Qn))+y(ut,Rn),dt=0|dt+y(ut,Qn);var ui=0|(0|se+(ft=0|ft+y(Se,Kn)))+((8191&(be=0|(be=0|be+y(Se,Zn))+y(Ie,Kn)))<<13);se=0|(0|(dt=0|dt+y(Ie,Zn))+(be>>>13))+(ui>>>26),ui&=67108863,ft=y(sn,de),be=0|(be=y(sn,Le))+y(Sn,de),dt=y(Sn,Le),ft=0|ft+y(on,qe),be=0|(be=0|be+y(on,Ze))+y(Ht,qe),dt=0|dt+y(Ht,Ze),ft=0|ft+y(ht,Nt),be=0|(be=0|be+y(ht,Bt))+y(st,Nt),dt=0|dt+y(st,Bt),ft=0|ft+y(ee,Ot),be=0|(be=0|be+y(ee,mn))+y(ve,Ot),dt=0|dt+y(ve,mn),ft=0|ft+y(J,vn),be=0|(be=0|be+y(J,In))+y(O,vn),dt=0|dt+y(O,In),ft=0|ft+y(nt,Nn),be=0|(be=0|be+y(nt,zn))+y(Yt,Nn),dt=0|dt+y(Yt,zn),ft=0|ft+y(qt,Rn),be=0|(be=0|be+y(qt,Qn))+y(tt,Rn),dt=0|dt+y(tt,Qn),ft=0|ft+y(Je,Kn),be=0|(be=0|be+y(Je,Zn))+y(ut,Kn),dt=0|dt+y(ut,Zn);var ai=0|(0|se+(ft=0|ft+y(Se,Gn)))+((8191&(be=0|(be=0|be+y(Se,er))+y(Ie,Gn)))<<13);se=0|(0|(dt=0|dt+y(Ie,er))+(be>>>13))+(ai>>>26),ai&=67108863,ft=y(Dn,de),be=0|(be=y(Dn,Le))+y(Rt,de),dt=y(Rt,Le),ft=0|ft+y(sn,qe),be=0|(be=0|be+y(sn,Ze))+y(Sn,qe),dt=0|dt+y(Sn,Ze),ft=0|ft+y(on,Nt),be=0|(be=0|be+y(on,Bt))+y(Ht,Nt),dt=0|dt+y(Ht,Bt),ft=0|ft+y(ht,Ot),be=0|(be=0|be+y(ht,mn))+y(st,Ot),dt=0|dt+y(st,mn),ft=0|ft+y(ee,vn),be=0|(be=0|be+y(ee,In))+y(ve,vn),dt=0|dt+y(ve,In),ft=0|ft+y(J,Nn),be=0|(be=0|be+y(J,zn))+y(O,Nn),dt=0|dt+y(O,zn),ft=0|ft+y(nt,Rn),be=0|(be=0|be+y(nt,Qn))+y(Yt,Rn),dt=0|dt+y(Yt,Qn),ft=0|ft+y(qt,Kn),be=0|(be=0|be+y(qt,Zn))+y(tt,Kn),dt=0|dt+y(tt,Zn),ft=0|ft+y(Je,Gn),be=0|(be=0|be+y(Je,er))+y(ut,Gn),dt=0|dt+y(ut,er);var li=0|(0|se+(ft=0|ft+y(Se,me)))+((8191&(be=0|(be=0|be+y(Se,ot))+y(Ie,me)))<<13);se=0|(0|(dt=0|dt+y(Ie,ot))+(be>>>13))+(li>>>26),li&=67108863,ft=y(Dn,qe),be=0|(be=y(Dn,Ze))+y(Rt,qe),dt=y(Rt,Ze),ft=0|ft+y(sn,Nt),be=0|(be=0|be+y(sn,Bt))+y(Sn,Nt),dt=0|dt+y(Sn,Bt),ft=0|ft+y(on,Ot),be=0|(be=0|be+y(on,mn))+y(Ht,Ot),dt=0|dt+y(Ht,mn),ft=0|ft+y(ht,vn),be=0|(be=0|be+y(ht,In))+y(st,vn),dt=0|dt+y(st,In),ft=0|ft+y(ee,Nn),be=0|(be=0|be+y(ee,zn))+y(ve,Nn),dt=0|dt+y(ve,zn),ft=0|ft+y(J,Rn),be=0|(be=0|be+y(J,Qn))+y(O,Rn),dt=0|dt+y(O,Qn),ft=0|ft+y(nt,Kn),be=0|(be=0|be+y(nt,Zn))+y(Yt,Kn),dt=0|dt+y(Yt,Zn),ft=0|ft+y(qt,Gn),be=0|(be=0|be+y(qt,er))+y(tt,Gn),dt=0|dt+y(tt,er);var Vr=0|(0|se+(ft=0|ft+y(Je,me)))+((8191&(be=0|(be=0|be+y(Je,ot))+y(ut,me)))<<13);se=0|(0|(dt=0|dt+y(ut,ot))+(be>>>13))+(Vr>>>26),Vr&=67108863,ft=y(Dn,Nt),be=0|(be=y(Dn,Bt))+y(Rt,Nt),dt=y(Rt,Bt),ft=0|ft+y(sn,Ot),be=0|(be=0|be+y(sn,mn))+y(Sn,Ot),dt=0|dt+y(Sn,mn),ft=0|ft+y(on,vn),be=0|(be=0|be+y(on,In))+y(Ht,vn),dt=0|dt+y(Ht,In),ft=0|ft+y(ht,Nn),be=0|(be=0|be+y(ht,zn))+y(st,Nn),dt=0|dt+y(st,zn),ft=0|ft+y(ee,Rn),be=0|(be=0|be+y(ee,Qn))+y(ve,Rn),dt=0|dt+y(ve,Qn),ft=0|ft+y(J,Kn),be=0|(be=0|be+y(J,Zn))+y(O,Kn),dt=0|dt+y(O,Zn),ft=0|ft+y(nt,Gn),be=0|(be=0|be+y(nt,er))+y(Yt,Gn),dt=0|dt+y(Yt,er);var Fr=0|(0|se+(ft=0|ft+y(qt,me)))+((8191&(be=0|(be=0|be+y(qt,ot))+y(tt,me)))<<13);se=0|(0|(dt=0|dt+y(tt,ot))+(be>>>13))+(Fr>>>26),Fr&=67108863,ft=y(Dn,Ot),be=0|(be=y(Dn,mn))+y(Rt,Ot),dt=y(Rt,mn),ft=0|ft+y(sn,vn),be=0|(be=0|be+y(sn,In))+y(Sn,vn),dt=0|dt+y(Sn,In),ft=0|ft+y(on,Nn),be=0|(be=0|be+y(on,zn))+y(Ht,Nn),dt=0|dt+y(Ht,zn),ft=0|ft+y(ht,Rn),be=0|(be=0|be+y(ht,Qn))+y(st,Rn),dt=0|dt+y(st,Qn),ft=0|ft+y(ee,Kn),be=0|(be=0|be+y(ee,Zn))+y(ve,Kn),dt=0|dt+y(ve,Zn),ft=0|ft+y(J,Gn),be=0|(be=0|be+y(J,er))+y(O,Gn),dt=0|dt+y(O,er);var Un=0|(0|se+(ft=0|ft+y(nt,me)))+((8191&(be=0|(be=0|be+y(nt,ot))+y(Yt,me)))<<13);se=0|(0|(dt=0|dt+y(Yt,ot))+(be>>>13))+(Un>>>26),Un&=67108863,ft=y(Dn,vn),be=0|(be=y(Dn,In))+y(Rt,vn),dt=y(Rt,In),ft=0|ft+y(sn,Nn),be=0|(be=0|be+y(sn,zn))+y(Sn,Nn),dt=0|dt+y(Sn,zn),ft=0|ft+y(on,Rn),be=0|(be=0|be+y(on,Qn))+y(Ht,Rn),dt=0|dt+y(Ht,Qn),ft=0|ft+y(ht,Kn),be=0|(be=0|be+y(ht,Zn))+y(st,Kn),dt=0|dt+y(st,Zn),ft=0|ft+y(ee,Gn),be=0|(be=0|be+y(ee,er))+y(ve,Gn),dt=0|dt+y(ve,er);var We=0|(0|se+(ft=0|ft+y(J,me)))+((8191&(be=0|(be=0|be+y(J,ot))+y(O,me)))<<13);se=0|(0|(dt=0|dt+y(O,ot))+(be>>>13))+(We>>>26),We&=67108863,ft=y(Dn,Nn),be=0|(be=y(Dn,zn))+y(Rt,Nn),dt=y(Rt,zn),ft=0|ft+y(sn,Rn),be=0|(be=0|be+y(sn,Qn))+y(Sn,Rn),dt=0|dt+y(Sn,Qn),ft=0|ft+y(on,Kn),be=0|(be=0|be+y(on,Zn))+y(Ht,Kn),dt=0|dt+y(Ht,Zn),ft=0|ft+y(ht,Gn),be=0|(be=0|be+y(ht,er))+y(st,Gn),dt=0|dt+y(st,er);var Mn=0|(0|se+(ft=0|ft+y(ee,me)))+((8191&(be=0|(be=0|be+y(ee,ot))+y(ve,me)))<<13);se=0|(0|(dt=0|dt+y(ve,ot))+(be>>>13))+(Mn>>>26),Mn&=67108863,ft=y(Dn,Rn),be=0|(be=y(Dn,Qn))+y(Rt,Rn),dt=y(Rt,Qn),ft=0|ft+y(sn,Kn),be=0|(be=0|be+y(sn,Zn))+y(Sn,Kn),dt=0|dt+y(Sn,Zn),ft=0|ft+y(on,Gn),be=0|(be=0|be+y(on,er))+y(Ht,Gn),dt=0|dt+y(Ht,er);var Yn=0|(0|se+(ft=0|ft+y(ht,me)))+((8191&(be=0|(be=0|be+y(ht,ot))+y(st,me)))<<13);se=0|(0|(dt=0|dt+y(st,ot))+(be>>>13))+(Yn>>>26),Yn&=67108863,ft=y(Dn,Kn),be=0|(be=y(Dn,Zn))+y(Rt,Kn),dt=y(Rt,Zn),ft=0|ft+y(sn,Gn),be=0|(be=0|be+y(sn,er))+y(Sn,Gn),dt=0|dt+y(Sn,er);var Cn=0|(0|se+(ft=0|ft+y(on,me)))+((8191&(be=0|(be=0|be+y(on,ot))+y(Ht,me)))<<13);se=0|(0|(dt=0|dt+y(Ht,ot))+(be>>>13))+(Cn>>>26),Cn&=67108863,ft=y(Dn,Gn),be=0|(be=y(Dn,er))+y(Rt,Gn),dt=y(Rt,er);var Jn=0|(0|se+(ft=0|ft+y(sn,me)))+((8191&(be=0|(be=0|be+y(sn,ot))+y(Sn,me)))<<13);se=0|(0|(dt=0|dt+y(Sn,ot))+(be>>>13))+(Jn>>>26),Jn&=67108863;var Er=0|(0|se+(ft=y(Dn,me)))+((8191&(be=0|(be=y(Dn,ot))+y(Rt,me)))<<13);return se=0|(0|(dt=y(Rt,ot))+(be>>>13))+(Er>>>26),Er&=67108863,Y[0]=Zr,Y[1]=ri,Y[2]=si,Y[3]=cr,Y[4]=yi,Y[5]=Jr,Y[6]=zr,Y[7]=ui,Y[8]=ai,Y[9]=li,Y[10]=Vr,Y[11]=Fr,Y[12]=Un,Y[13]=We,Y[14]=Mn,Y[15]=Yn,Y[16]=Cn,Y[17]=Jn,Y[18]=Er,0!==se&&(Y[19]=se,F.length++),F};y||(T=r),n.prototype.mulTo=function(v,B){var F=this.length+v.length;return 10===this.length&&10===v.length?T(this,v,B):63>F?r(this,v,B):1024>F?a(this,v,B):c(this,v,B)},l.prototype.makeRBT=function(v){for(var B=Array(v),F=n.prototype._countBits(v)-1,q=0;q>=1;return q},l.prototype.permute=function(v,B,F,q,L,Y){for(var se=0;se>>=1)L++;return 1<=F))for(var L,q=0;qL?0:0|L/67108864;return v},l.prototype.convert13b=function(v,B,F,q){for(var L=0,Y=0;Y>>=13),L>>>=13;for(Y=2*B;Yv;B&&(v=-v),m("number"==typeof v),m(67108864>v);for(var F=0,q=0;q>=26,F+=0|L/67108864,F+=Y>>>26,this.words[q]=67108863&Y}return 0!==F&&(this.words[q]=F,this.length++),B?this.ineg():this},n.prototype.muln=function(v){return this.clone().imuln(v)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(v){var B=function t(M){for(var v=Array(M.bitLength()),B=0;B>>B%26;return v}(v);if(0===B.length)return new n(1);for(var F=this,q=0;q>>26-B<<26-B;if(0!=B){var Y=0;for(L=0;L>>26-B}Y&&(this.words[L]=Y,this.length++)}if(0!==F){for(L=this.length-1;0<=L;L--)this.words[L+F]=this.words[L];for(L=0;L>>L<Y)for(this.length-=Y,Se=0;Se=q);Se--){var Qe=0|this.words[Se];this.words[Se]=Ie<<26-L|Qe>>>L,Ie=Qe&se}return Ee&&0!==Ie&&(Ee.words[Ee.length++]=Ie),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(v,B,F){return m(0===this.negative),this.iushrn(v,B,F)},n.prototype.shln=function(v){return this.clone().ishln(v)},n.prototype.ushln=function(v){return this.clone().iushln(v)},n.prototype.shrn=function(v){return this.clone().ishrn(v)},n.prototype.ushrn=function(v){return this.clone().iushrn(v)},n.prototype.testn=function(v){m("number"==typeof v&&0<=v);var B=v%26,F=(v-B)/26;return!(this.length<=F||!(this.words[F]&1<>>B<v),0>v?this.isubn(-v):0===this.negative?this._iaddn(v):1===this.length&&(0|this.words[0])<=v?(this.words[0]=v-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(v),this.negative=1,this)},n.prototype._iaddn=function(v){this.words[0]+=v;for(var B=0;Bv),0>v)return this.iaddn(-v);if(0!==this.negative)return this.negative=0,this.iaddn(v),this.negative=1,this;if(this.words[0]-=v,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var B=0;Bthis.words[B];B++)this.words[B]+=67108864,this.words[B+1]-=1;return this._strip()},n.prototype.addn=function(v){return this.clone().iaddn(v)},n.prototype.subn=function(v){return this.clone().isubn(v)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(v,B,F){var L;this._expand(v.length+F);var se,Y=0;for(L=0;L>26)-(0|Ee/67108864),this.words[L+F]=67108863&se}for(;L>26,this.words[L+F]=67108863&se;if(0===Y)return this._strip();for(m(-1===Y),Y=0,L=0;L>26,this.words[L]=67108863&se;return this.negative=1,this._strip()},n.prototype._wordDiv=function(v,B){var F,q=this.clone(),L=v,Y=0|L.words[L.length-1];0!=(F=26-this._countBits(Y))&&(L=L.ushln(F),q.iushln(F),Y=0|L.words[L.length-1]);var Se,Ee=q.length-L.length;if("mod"!==B){(Se=new n(null)).length=Ee+1,Se.words=Array(Se.length);for(var Ie=0;Iethis.length||0>this.cmp(v)?{div:new n(0),mod:this}:1===v.length?"div"===B?{div:this.divn(v.words[0]),mod:null}:"mod"===B?{div:null,mod:new n(this.modrn(v.words[0]))}:{div:this.divn(v.words[0]),mod:new n(this.modrn(v.words[0]))}:this._wordDiv(v,B);var q,L,Y},n.prototype.div=function(v){return this.divmod(v,"div",!1).div},n.prototype.mod=function(v){return this.divmod(v,"mod",!1).mod},n.prototype.umod=function(v){return this.divmod(v,"mod",!0).mod},n.prototype.divRound=function(v){var B=this.divmod(v);if(B.mod.isZero())return B.div;var F=0===B.div.negative?B.mod:B.mod.isub(v),q=v.ushrn(1),L=v.andln(1),Y=F.cmp(q);return 0>Y||1===L&&0===Y?B.div:0===B.div.negative?B.div.iaddn(1):B.div.isubn(1)},n.prototype.modrn=function(v){var B=0>v;B&&(v=-v),m(67108863>=v);for(var F=67108864%v,q=0,L=this.length-1;0<=L;L--)q=(F*q+(0|this.words[L]))%v;return B?-q:q},n.prototype.modn=function(v){return this.modrn(v)},n.prototype.idivn=function(v){var B=0>v;B&&(v=-v),m(67108863>=v);for(var L,F=0,q=this.length-1;0<=q;q--)this.words[q]=0|(L=(0|this.words[q])+67108864*F)/v,F=L%v;return this._strip(),B?this.ineg():this},n.prototype.divn=function(v){return this.clone().idivn(v)},n.prototype.egcd=function(v){m(0===v.negative),m(!v.isZero());var B=this,F=v.clone();B=0===B.negative?B.clone():B.umod(v);for(var q=new n(1),L=new n(0),Y=new n(0),se=new n(1),Ee=0;B.isEven()&&F.isEven();)B.iushrn(1),F.iushrn(1),++Ee;for(var Se=F.clone(),Ie=B.clone();!B.isZero();){for(var Qe=0,Je=1;!(B.words[0]&Je)&&26>Qe;++Qe,Je<<=1);if(0ut;++ut,$t<<=1);if(0se;++se,Ee<<=1);if(0Se;++Se,Ie<<=1);if(0(Qe=0===B.cmpn(1)?q:L).cmpn(0)&&Qe.iadd(v),Qe},n.prototype.gcd=function(v){if(this.isZero())return v.abs();if(v.isZero())return this.abs();var B=this.clone(),F=v.clone();B.negative=0,F.negative=0;for(var q=0;B.isEven()&&F.isEven();q++)B.iushrn(1),F.iushrn(1);for(;;){for(;B.isEven();)B.iushrn(1);for(;F.isEven();)F.iushrn(1);var L=B.cmp(F);if(0>L){var Y=B;B=F,F=Y}else if(0===L||0===F.cmpn(1))break;B.isub(F)}return F.iushln(q)},n.prototype.invm=function(v){return this.egcd(v).a.umod(v)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(v){return this.words[0]&v},n.prototype.bincn=function(v){m("number"==typeof v);var B=v%26,F=(v-B)/26,q=1<>>26,this.words[Y]=se&=67108863;return 0!==L&&(this.words[Y]=L,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(v){var F,B=0>v;if(0!==this.negative&&!B)return-1;if(0===this.negative&&B)return 1;if(this._strip(),1=v,"Number is too big");var q=0|this.words[0];F=q===v?0:qv.length)return 1;if(this.lengthL&&(B=1);break}}return B},n.prototype.gtn=function(v){return 1===this.cmpn(v)},n.prototype.gt=function(v){return 1===this.cmp(v)},n.prototype.gten=function(v){return 0<=this.cmpn(v)},n.prototype.gte=function(v){return 0<=this.cmp(v)},n.prototype.ltn=function(v){return-1===this.cmpn(v)},n.prototype.lt=function(v){return-1===this.cmp(v)},n.prototype.lten=function(v){return 0>=this.cmpn(v)},n.prototype.lte=function(v){return 0>=this.cmp(v)},n.prototype.eqn=function(v){return 0===this.cmpn(v)},n.prototype.eq=function(v){return 0===this.cmp(v)},n.red=function(v){return new I(v)},n.prototype.toRed=function(v){return m(!this.red,"Already a number in reduction context"),m(0===this.negative,"red works only with positives"),v.convertTo(this)._forceRed(v)},n.prototype.fromRed=function(){return m(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(v){return this.red=v,this},n.prototype.forceRed=function(v){return m(!this.red,"Already a number in reduction context"),this._forceRed(v)},n.prototype.redAdd=function(v){return m(this.red,"redAdd works only with red numbers"),this.red.add(this,v)},n.prototype.redIAdd=function(v){return m(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,v)},n.prototype.redSub=function(v){return m(this.red,"redSub works only with red numbers"),this.red.sub(this,v)},n.prototype.redISub=function(v){return m(this.red,"redISub works only with red numbers"),this.red.isub(this,v)},n.prototype.redShl=function(v){return m(this.red,"redShl works only with red numbers"),this.red.shl(this,v)},n.prototype.redMul=function(v){return m(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.mul(this,v)},n.prototype.redIMul=function(v){return m(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.imul(this,v)},n.prototype.redSqr=function(){return m(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return m(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return m(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return m(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return m(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(v){return m(this.red&&!v.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,v)};var D={k256:null,p224:null,p192:null,p25519:null};w.prototype._tmp=function(){var v=new n(null);return v.words=Array(_e(this.n/13)),v},w.prototype.ireduce=function(v){var F,B=v;do{this.split(B,this.tmp),F=(B=(B=this.imulK(B)).iadd(this.tmp)).bitLength()}while(F>this.n);var q=F=v.length)return v.words[0]=0,void(v.length=1);var Y=v.words[9];for(B.words[B.length++]=Y&F,L=10;L>>22,Y=se}v.words[L-10]=Y>>>=22,v.length-=0===Y&&10>>=26,v.words[F]=L,B=q}return 0!==B&&(v.words[v.length++]=B),v},n._prime=function(v){if(D[v])return D[v];var B;if("k256"===v)B=new E;else if("p224"===v)B=new C;else if("p192"===v)B=new z;else{if("p25519"!==v)throw new Error("Unknown prime "+v);B=new k}return D[v]=B,B},I.prototype._verify1=function(v){m(0===v.negative,"red works only with positives"),m(v.red,"red works only with red numbers")},I.prototype._verify2=function(v,B){m(0==(v.negative|B.negative),"red works only with positives"),m(v.red&&v.red===B.red,"red works only with red numbers")},I.prototype.imod=function(v){return this.prime?this.prime.ireduce(v)._forceRed(this):(u(v,v.umod(this.m)._forceRed(this)),v)},I.prototype.neg=function(v){return v.isZero()?v.clone():this.m.sub(v)._forceRed(this)},I.prototype.add=function(v,B){this._verify2(v,B);var F=v.add(B);return 0<=F.cmp(this.m)&&F.isub(this.m),F._forceRed(this)},I.prototype.iadd=function(v,B){this._verify2(v,B);var F=v.iadd(B);return 0<=F.cmp(this.m)&&F.isub(this.m),F},I.prototype.sub=function(v,B){this._verify2(v,B);var F=v.sub(B);return 0>F.cmpn(0)&&F.iadd(this.m),F._forceRed(this)},I.prototype.isub=function(v,B){this._verify2(v,B);var F=v.isub(B);return 0>F.cmpn(0)&&F.iadd(this.m),F},I.prototype.shl=function(v,B){return this._verify1(v),this.imod(v.ushln(B))},I.prototype.imul=function(v,B){return this._verify2(v,B),this.imod(v.imul(B))},I.prototype.mul=function(v,B){return this._verify2(v,B),this.imod(v.mul(B))},I.prototype.isqr=function(v){return this.imul(v,v.clone())},I.prototype.sqr=function(v){return this.mul(v,v)},I.prototype.sqrt=function(v){if(v.isZero())return v.clone();var B=this.m.andln(3);if(m(B%2==1),3===B){var F=this.m.add(new n(1)).iushrn(2);return this.pow(v,F)}for(var q=this.m.subn(1),L=0;!q.isZero()&&0===q.andln(1);)L++,q.iushrn(1);m(!q.isZero());var Y=new n(1).toRed(this),se=Y.redNeg(),Ee=this.m.subn(1).iushrn(1),Se=this.m.bitLength();for(Se=new n(2*Se*Se).toRed(this);0!==this.pow(Se,Ee).cmp(se);)Se.redIAdd(se);for(var Ie=this.pow(Se,q),Qe=this.pow(v,q.addn(1).iushrn(1)),Je=this.pow(v,q),ut=L;0!==Je.cmp(Y);){for(var $t=Je,qt=0;0!==$t.cmp(Y);qt++)$t=$t.redSqr();m(qt>Qe,Y!==q[0]&&(Y=this.sqr(Y)),0!==Je||0!==se?(se<<=1,se|=Je,(4==++Ee||0===L&&0===Qe)&&(Y=this.mul(Y,q[se]),Ee=0,se=0)):Ee=0;Se=26}return Y},I.prototype.convertTo=function(v){var B=v.umod(this.m);return B===v?B.clone():B},I.prototype.convertFrom=function(v){var B=v.clone();return B.red=null,B},n.mont=function(v){return new V(v)},_(V,I),V.prototype.convertTo=function(v){return this.imod(v.ushln(this.shift))},V.prototype.convertFrom=function(v){var B=this.imod(v.mul(this.rinv));return B.red=null,B},V.prototype.imul=function(v,B){if(v.isZero()||B.isZero())return v.words[0]=0,v.length=1,v;var F=v.imul(B),q=F.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),L=F.isub(q).iushrn(this.shift),Y=L;return 0<=L.cmp(this.m)?Y=L.isub(this.m):0>L.cmpn(0)&&(Y=L.iadd(this.m)),Y._forceRed(this)},V.prototype.mul=function(v,B){if(v.isZero()||B.isZero())return new n(0)._forceRed(this);var F=v.mul(B),q=F.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),L=F.isub(q).iushrn(this.shift),Y=L;return 0<=L.cmp(this.m)?Y=L.isub(this.m):0>L.cmpn(0)&&(Y=L.iadd(this.m)),Y._forceRed(this)},V.prototype.invm=function(v){return this.imod(v._invmp(this.m).mul(this.r2))._forceRed(this)}}(typeof N>"u"||N,this)},{buffer:42}],41:[function(d,N,A){function f(_){this.rand=_}var b;if(N.exports=function(n){return b||(b=new f(null)),b.generate(n)},N.exports.Rand=f,f.prototype.generate=function(n){return this._rand(n)},f.prototype._rand=function(n){if(this.rand.getBytes)return this.rand.getBytes(n);for(var g=new Uint8Array(n),h=0;h>>24]^c[255&C>>>16]^l[255&z>>>8]^w[255&k]^u[I++],oe=a[C>>>24]^c[255&z>>>16]^l[255&k>>>8]^w[255&E]^u[I++],ue=a[z>>>24]^c[255&k>>>16]^l[255&E>>>8]^w[255&C]^u[I++],Ae=a[k>>>24]^c[255&E>>>16]^l[255&C>>>8]^w[255&z]^u[I++],E=$,C=oe,z=ue,k=Ae;return $=(t[E>>>24]<<24|t[255&C>>>16]<<16|t[255&z>>>8]<<8|t[255&k])^u[I++],oe=(t[C>>>24]<<24|t[255&z>>>16]<<16|t[255&k>>>8]<<8|t[255&E])^u[I++],ue=(t[z>>>24]<<24|t[255&k>>>16]<<16|t[255&E>>>8]<<8|t[255&C])^u[I++],Ae=(t[k>>>24]<<24|t[255&E>>>16]<<16|t[255&C>>>8]<<8|t[255&z])^u[I++],[$>>>=0,oe>>>=0,ue>>>=0,Ae>>>=0]}function _(s){this._key=f(s),this._reset()}var n=d("safe-buffer").Buffer,g=[0,1,2,4,8,16,32,64,128,27,54],h=function(){for(var s=Array(256),u=0;256>u;u++)s[u]=128>u?u<<1:283^u<<1;for(var E,o=[],t=[],r=[[],[],[],[]],a=[[],[],[],[]],c=0,l=0,w=0;256>w;++w){o[c]=E=(E=l^l<<1^l<<2^l<<3^l<<4)>>>8^255&E^99,t[E]=c;var C=s[c],z=s[C],k=s[z],I=257*s[E]^16843008*E;r[0][c]=I<<24|I>>>8,r[1][c]=I<<16|I>>>16,r[2][c]=I<<8|I>>>24,r[3][c]=I,a[0][E]=(I=16843009*k^65537*z^257*C^16843008*c)<<24|I>>>8,a[1][E]=I<<16|I>>>16,a[2][E]=I<<8|I>>>24,a[3][E]=I,0===c?c=l=1:(c=C^s[s[s[k^C]]],l^=s[s[l]])}return{SBOX:o,INV_SBOX:t,SUB_MIX:r,INV_SUB_MIX:a}}();_.blockSize=16,_.keySize=32,_.prototype.blockSize=_.blockSize,_.prototype.keySize=_.keySize,_.prototype._reset=function(){for(var s=this._key,u=s.length,o=u+6,t=4*(o+1),r=[],a=0;a>>24)>>>24]<<24|h.SBOX[255&c>>>16]<<16|h.SBOX[255&c>>>8]<<8|h.SBOX[255&c],c^=g[0|a/u]<<24):6>>24]<<24|h.SBOX[255&c>>>16]<<16|h.SBOX[255&c>>>8]<<8|h.SBOX[255&c]),r[a]=r[a-u]^c}for(var l=[],w=0;ww||4>=E?C:h.INV_SUB_MIX[0][h.SBOX[C>>>24]]^h.INV_SUB_MIX[1][h.SBOX[255&C>>>16]]^h.INV_SUB_MIX[2][h.SBOX[255&C>>>8]]^h.INV_SUB_MIX[3][h.SBOX[255&C]]}this._nRounds=o,this._keySchedule=r,this._invKeySchedule=l},_.prototype.encryptBlockRaw=function(s){return m(s=f(s),this._keySchedule,h.SUB_MIX,h.SBOX,this._nRounds)},_.prototype.encryptBlock=function(s){var u=this.encryptBlockRaw(s),o=n.allocUnsafe(16);return o.writeUInt32BE(u[0],0),o.writeUInt32BE(u[1],4),o.writeUInt32BE(u[2],8),o.writeUInt32BE(u[3],12),o},_.prototype.decryptBlock=function(s){var u=(s=f(s))[1];s[1]=s[3],s[3]=u;var o=m(s,this._invKeySchedule,h.INV_SUB_MIX,h.INV_SBOX,this._nRounds),t=n.allocUnsafe(16);return t.writeUInt32BE(o[0],0),t.writeUInt32BE(o[3],4),t.writeUInt32BE(o[2],8),t.writeUInt32BE(o[1],12),t},_.prototype.scrub=function(){b(this._keySchedule),b(this._invKeySchedule),b(this._key)},N.exports.AES=_},{"safe-buffer":235}],44:[function(d,N,A){function m(t,r,a,c){g.call(this);var l=n.alloc(4,0);this._cipher=new _.AES(r);var w=this._cipher.encryptBlock(l);this._ghash=new s(w),a=function b(t,r,a){if(12===r.length)return t._finID=n.concat([r,n.from([0,0,0,1])]),n.concat([r,n.from([0,0,0,2])]);var c=new s(a),l=r.length,w=l%16;c.update(r),w&&c.update(n.alloc(w=16-w,0)),c.update(n.alloc(8,0));var E=8*l,C=n.alloc(8);C.writeUIntBE(E,0,8),c.update(C),t._finID=c.state;var z=n.from(t._finID);return o(z),z}(this,a,w),this._prev=n.from(a),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=c,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}var _=d("./aes"),n=d("safe-buffer").Buffer,g=d("cipher-base"),h=d("inherits"),s=d("./ghash"),u=d("buffer-xor"),o=d("./incr32");h(m,g),m.prototype._update=function(t){if(!this._called&&this._alen){var r=16-this._alen%16;16>r&&(r=n.alloc(r,0),this._ghash.update(r))}this._called=!0;var a=this._mode.encrypt(this,t);return this._ghash.update(this._decrypt?t:a),this._len+=t.length,a},m.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function f(t,r){var a=0;t.length!==r.length&&a++;for(var c=ne(t.length,r.length),l=0;ll||16>>0,0),h.writeUInt32BE(g[1]>>>0,4),h.writeUInt32BE(g[2]>>>0,8),h.writeUInt32BE(g[3]>>>0,12),h}function m(g){this.h=g,this.state=_.alloc(16,0),this.cache=_.allocUnsafe(0)}var _=d("safe-buffer").Buffer,n=_.alloc(16,0);m.prototype.ghash=function(g){for(var h=-1;++h++s;){for(0!=(this.state[~~(s/8)]&1<<7-s%8)&&(h[0]^=g[0],h[1]^=g[1],h[2]^=g[2],h[3]^=g[3]),t=0!=(1&g[3]),u=3;0>>1|(1&g[u-1])<<31;g[0]>>>=1,t&&(g[0]^=-520093696)}this.state=b(h)},m.prototype.update=function(g){this.cache=_.concat([this.cache,g]);for(var h;16<=this.cache.length;)h=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(h)},m.prototype.final=function(g,h){return this.cache.length&&this.ghash(_.concat([this.cache,n],16)),this.ghash(b([0,g,0,h])),this.state},N.exports=m},{"safe-buffer":235}],49:[function(d,N,A){N.exports=function f(b){for(var _,m=b.length;m--;){if(255!==(_=b.readUInt8(m))){_++,b.writeUInt8(_,m);break}b.writeUInt8(0,m)}}},{}],50:[function(d,N,A){var f=d("buffer-xor");A.encrypt=function(b,m){var _=f(m,b._prev);return b._prev=b._cipher.encryptBlock(_),b._prev},A.decrypt=function(b,m){var _=b._prev;b._prev=m;var n=b._cipher.decryptBlock(m);return f(n,_)}},{"buffer-xor":75}],51:[function(d,N,A){function f(_,n,g){var h=n.length,s=m(n,_._cache);return _._cache=_._cache.slice(h),_._prev=b.concat([_._prev,g?n:s]),s}var b=d("safe-buffer").Buffer,m=d("buffer-xor");A.encrypt=function(_,n,g){for(var s,h=b.allocUnsafe(0);n.length;){if(0===_._cache.length&&(_._cache=_._cipher.encryptBlock(_._prev),_._prev=b.allocUnsafe(0)),!(_._cache.length<=n.length)){h=b.concat([h,f(_,n,g)]);break}h=b.concat([h,f(_,n.slice(0,s=_._cache.length),g)]),n=n.slice(s)}return h}},{"buffer-xor":75,"safe-buffer":235}],52:[function(d,N,A){function f(_,n,g){for(var t,r,h=-1,u=0;++h<8;)u+=(128&(r=_._cipher.encryptBlock(_._prev)[0]^(t=n&1<<7-h?128:0)))>>h%8,_._prev=b(_._prev,g?t:r);return u}function b(_,n){var g=_.length,h=-1,s=m.allocUnsafe(_.length);for(_=m.concat([_,m.from([n])]);++h>7;return s}var m=d("safe-buffer").Buffer;A.encrypt=function(_,n,g){for(var h=n.length,s=m.allocUnsafe(h),u=-1;++u=o.cmpn(0))throw new Error("invalid sig");if(o.cmp(t)>=t)throw new Error("invalid sig")}var n=d("safe-buffer").Buffer,g=d("bn.js"),h=d("elliptic").ec,s=d("parse-asn1"),u=d("./curves.json");N.exports=function f(o,t,r,a,c){var l=s(r);if("ec"===l.type){if("ecdsa"!==a&&"ecdsa/rsa"!==a)throw new Error("wrong public key type");return function b(o,t,r){var a=u[r.data.algorithm.curve.join(".")];if(!a)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));return new h(a).verify(t,o,r.data.subjectPrivateKey.data)}(o,t,l)}if("dsa"===l.type){if("dsa"!==a)throw new Error("wrong public key type");return function m(o,t,r){var a=r.data.p,c=r.data.q,l=r.data.g,w=r.data.pub_key,E=s.signature.decode(o,"der"),C=E.s,z=E.r;_(C,c),_(z,c);var k=g.mont(a),I=C.invm(c);return 0===l.toRed(k).redPow(new g(t).mul(I).mod(c)).fromRed().mul(w.toRed(k).redPow(z.mul(I).mod(c)).fromRed()).mod(a).mod(c).cmp(z)}(o,t,l)}if("rsa"!==a&&"ecdsa/rsa"!==a)throw new Error("wrong public key type");t=n.concat([c,t]);for(var w=l.modulus.byteLength(),E=[1],C=0;t.length+E.length+2C?1:0;for(w=ne(o.length,E.length),o.length!==E.length&&(I=1),z=-1;++z=C?0:C>>5==6?2:C>>4==14?3:C>>3==30?4:C>>6==2?-1:-2}function h(C){var z=this.lastTotal-this.lastNeed,k=function g(C,z,k){if(128!=(192&z[0]))return C.lastNeed=0,"\ufffd";if(1=I)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=C[C.length-2],this.lastChar[1]=C[C.length-1],k.slice(0,-1)}return k}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=C[C.length-1],C.toString("utf16le",z,C.length-1)}function t(C){var z=C&&C.length?this.write(C):"";return this.lastNeed?z+this.lastChar.toString("utf16le",0,this.lastTotal-this.lastNeed):z}function r(C,z){var k=(C.length-z)%3;return 0==k?C.toString("base64",z):(this.lastNeed=3-k,this.lastTotal=3,1==k?this.lastChar[0]=C[C.length-1]:(this.lastChar[0]=C[C.length-2],this.lastChar[1]=C[C.length-1]),C.toString("base64",z,C.length-k))}function a(C){var z=C&&C.length?this.write(C):"";return this.lastNeed?z+this.lastChar.toString("base64",0,3-this.lastNeed):z}function c(C){return C.toString(this.encoding)}function l(C){return C&&C.length?this.write(C):""}var w=d("safe-buffer").Buffer,E=w.isEncoding||function(C){switch((C=""+C)&&C.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};A.StringDecoder=m,m.prototype.write=function(C){if(0===C.length)return"";var z,k;if(this.lastNeed){if(void 0===(z=this.fillLast(C)))return"";k=this.lastNeed,this.lastNeed=0}else k=0;return km)throw new RangeError('"size" argument must not be negative');return f.allocUnsafe?f.allocUnsafe(m):new f(m)}}).call(this)}).call(this,d("buffer").Buffer)},{buffer:76}],73:[function(d,N,A){(function(f){(function(){var b=d("buffer-fill"),m=d("buffer-alloc-unsafe");N.exports=function(n,g,h){if("number"!=typeof n)throw new TypeError('"size" argument must be a number');if(0>n)throw new RangeError('"size" argument must not be negative');if(f.alloc)return f.alloc(n,g,h);var s=m(n);return 0===n?s:void 0===g?b(s,0):("string"!=typeof h&&(h=void 0),b(s,g,h))}}).call(this)}).call(this,d("buffer").Buffer)},{buffer:76,"buffer-alloc-unsafe":72,"buffer-fill":74}],74:[function(d,N,A){(function(f){(function(){function m(h,s,u,o){if(0>u||o>h.length)throw new RangeError("Out of range index");return(o=void 0===o?h.length:o>>>0)>(u>>>=0)&&h.fill(s,u,o),h}var g=function(){try{if(!f.isEncoding("latin1"))return!1;var h=f.alloc?f.alloc(4):new f(4);return h.fill("ab","ucs2"),"61006200"===h.toString("hex")}catch{return!1}}();N.exports=function n(h,s,u,o,t){if(g)return h.fill(s,u,o,t);if("number"==typeof s)return m(h,s,u,o);if("string"==typeof s){if("string"==typeof u?(t=u,u=0,o=h.length):"string"==typeof o&&(t=o,o=h.length),void 0!==t&&"string"!=typeof t)throw new TypeError("encoding must be a string");if("latin1"===t&&(t="binary"),"string"==typeof t&&!f.isEncoding(t))throw new TypeError("Unknown encoding: "+t);if(""===s)return m(h,0,u,o);if(function b(h){return 1===h.length&&256>h.charCodeAt(0)}(s))return m(h,s.charCodeAt(0),u,o);s=new f(s,t)}return f.isBuffer(s)?function _(h,s,u,o){if(0>u||o>h.length)throw new RangeError("Out of range index");if(o<=u)return h;o=void 0===o?h.length:o>>>0;for(var t=u>>>=0,r=s.length;t<=o-r;)s.copy(h,t),t+=r;return t!==o&&s.copy(h,t,0,o-t),h}(h,s,u,o):m(h,0,u,o)}}).call(this)}).call(this,d("buffer").Buffer)},{buffer:76}],75:[function(d,N,A){(function(f){(function(){N.exports=function(m,_){for(var n=ne(m.length,_.length),g=new f(n),h=0;hW||O.byteLengthO)throw new RangeError('The value "'+O+'" is invalid for option "size"')}function s(O){return g(O),m(0>O?0:0|a(O))}function o(O){for(var W=0>O.length?0:0|a(O.length),ee=m(W),ve=0;ve=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|O}function l(O,W){if(_.isBuffer(O))return O.length;if(ArrayBuffer.isView(O)||qt(O,ArrayBuffer))return O.byteLength;if("string"!=typeof O)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof O);var ee=O.length,ve=2>>1;case"base64":return ut(O).length;default:if(He)return ve?-1:Ie(O).length;W=(""+W).toLowerCase(),He=!0}}function w(O,W,ee){var ve=!1;if((void 0===W||0>W)&&(W=0),W>this.length||((void 0===ee||ee>this.length)&&(ee=this.length),0>=ee)||(ee>>>=0)<=(W>>>=0))return"";for(O||(O="utf8");;)switch(O){case"hex":return v(this,W,ee);case"utf8":case"utf-8":return X(this,W,ee);case"ascii":return D(this,W,ee);case"latin1":case"binary":return M(this,W,ee);case"base64":return Ae(this,W,ee);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,W,ee);default:if(ve)throw new TypeError("Unknown encoding: "+O);O=(O+"").toLowerCase(),ve=!0}}function E(O,W,ee){var ve=O[W];O[W]=O[ee],O[ee]=ve}function C(O,W,ee,ve,He){if(0===O.length)return-1;if("string"==typeof ee?(ve=ee,ee=0):2147483647ee&&(ee=-2147483648),tt(ee=+ee)&&(ee=He?0:O.length-1),0>ee&&(ee=O.length+ee),ee>=O.length){if(He)return-1;ee=O.length-1}else if(0>ee){if(!He)return-1;ee=0}if("string"==typeof W&&(W=_.from(W,ve)),_.isBuffer(W))return 0===W.length?-1:z(O,W,ee,ve,He);if("number"==typeof W)return W&=255,"function"==typeof Uint8Array.prototype.indexOf?He?Uint8Array.prototype.indexOf.call(O,W,ee):Uint8Array.prototype.lastIndexOf.call(O,W,ee):z(O,[W],ee,ve,He);throw new TypeError("val must be string, number or Buffer")}function z(O,W,ee,ve,He){function ht(fr,Dn){return 1===st?fr[Dn]:fr.readUInt16BE(Dn*st)}var Ht,st=1,Jt=O.length,on=W.length;if(void 0!==ve&&("ucs2"===(ve=(ve+"").toLowerCase())||"ucs-2"===ve||"utf16le"===ve||"utf-16le"===ve)){if(2>O.length||2>W.length)return-1;st=2,Jt/=2,on/=2,ee/=2}if(He){var wn=-1;for(Ht=ee;HtJt&&(ee=Jt-on),Ht=ee;0<=Ht;Ht--){for(var sn=!0,Sn=0;SnHe&&(ve=He):ve=He;var ht=W.length;ve>ht/2&&(ve=ht/2);for(var Jt,st=0;st(W-=2));++ve)ht=(He=O.charCodeAt(ve))>>8,ee.push(He%256),ee.push(ht);return ee}(W,O.length-ee),O,ee,ve)}function Ae(O,W,ee){return at.fromByteArray(0===W&&ee===O.length?O:O.slice(W,ee))}function X(O,W,ee){ee=ne(O.length,ee);for(var ve=[],He=W;Heht&&(st=ht):2===Jt?128==(192&(on=O[He+1]))&&127<(sn=(31&ht)<<6|63&on)&&(st=sn):3===Jt?(Ht=O[He+2],128==(192&(on=O[He+1]))&&128==(192&Ht)&&2047<(sn=(15&ht)<<12|(63&on)<<6|63&Ht)&&(55296>sn||57343sn&&(st=sn))),null===st?(st=65533,Jt=1):65535>>10),st=56320|1023&st),ve.push(st),He+=Jt}return function T(O){var W=O.length;if(W<=4096)return te.apply(String,O);for(var ee="",ve=0;veW)&&(W=0),(!ee||0>ee||ee>ve)&&(ee=ve);for(var He="",ht=W;htO)throw new RangeError("offset is not uint");if(O+W>ee)throw new RangeError("Trying to access beyond buffer length")}function q(O,W,ee,ve,He,ht){if(!_.isBuffer(O))throw new TypeError('"buffer" argument must be a Buffer instance');if(W>He||WO.length)throw new RangeError("Index out of range")}function L(O,W,ee,ve,He,ht){if(ee+ve>O.length)throw new RangeError("Index out of range");if(0>ee)throw new RangeError("Index out of range")}function Y(O,W,ee,ve,He){return W=+W,ee>>>=0,He||L(O,0,ee,4),nt.write(O,W,ee,ve,23,4),ee+4}function se(O,W,ee,ve,He){return W=+W,ee>>>=0,He||L(O,0,ee,8),nt.write(O,W,ee,ve,52,8),ee+8}function Se(O){return 16>O?"0"+O.toString(16):O.toString(16)}function Ie(O,W){W=W||1/0;for(var st,ee=O.length,ve=null,He=[],ht=0;htst){if(!ve){if(56319st){-1<(W-=3)&&He.push(239,191,189),ve=st;continue}st=65536+(ve-55296<<10|st-56320)}else ve&&-1<(W-=3)&&He.push(239,191,189);if(ve=null,128>st){if(0>(W-=1))break;He.push(st)}else if(2048>st){if(0>(W-=2))break;He.push(192|st>>6,128|63&st)}else if(65536>st){if(0>(W-=3))break;He.push(224|st>>12,128|63&st>>6,128|63&st)}else{if(!(1114112>st))throw new Error("Invalid code point");if(0>(W-=4))break;He.push(240|st>>18,128|63&st>>12,128|63&st>>6,128|63&st)}}return He}function ut(O){return at.toByteArray(function Ee(O){if(2>(O=(O=O.split("=")[0]).trim().replace(J,"")).length)return"";for(;O.length%4!=0;)O+="=";return O}(O))}function $t(O,W,ee,ve){for(var He=0;He=W.length||He>=O.length);++He)W[He+ee]=O[He];return He}function qt(O,W){return O instanceof W||null!=O&&null!=O.constructor&&null!=O.constructor.name&&O.constructor.name===W.name}function tt(O){return O!=O}var at=d("base64-js"),nt=d("ieee754");A.Buffer=_,A.SlowBuffer=function c(O){return+O!=O&&(O=0),_.alloc(+O)},A.INSPECT_MAX_BYTES=50,A.kMaxLength=2147483647,(_.TYPED_ARRAY_SUPPORT=function b(){try{var O=new Uint8Array(1);return O.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===O.foo()}catch{return!1}}())||typeof console>"u"||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(_.prototype,"parent",{enumerable:!0,get:function(){return _.isBuffer(this)?this.buffer:void 0}}),Object.defineProperty(_.prototype,"offset",{enumerable:!0,get:function(){return _.isBuffer(this)?this.byteOffset:void 0}}),typeof Symbol<"u"&&null!=Symbol.species&&_[Symbol.species]===_&&Object.defineProperty(_,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),_.poolSize=8192,_.from=function(O,W,ee){return n(O,W,ee)},_.prototype.__proto__=Uint8Array.prototype,_.__proto__=Uint8Array,_.alloc=function(O,W,ee){return function h(O,W,ee){return g(O),0>=O||void 0===W?m(O):"string"==typeof ee?m(O).fill(W,ee):m(O).fill(W)}(O,W,ee)},_.allocUnsafe=function(O){return s(O)},_.allocUnsafeSlow=function(O){return s(O)},_.isBuffer=function(W){return null!=W&&!0===W._isBuffer&&W!==_.prototype},_.compare=function(W,ee){if(qt(W,Uint8Array)&&(W=_.from(W,W.offset,W.byteLength)),qt(ee,Uint8Array)&&(ee=_.from(ee,ee.offset,ee.byteLength)),!_.isBuffer(W)||!_.isBuffer(ee))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(W===ee)return 0;for(var ve=W.length,He=ee.length,ht=0,st=ne(ve,He);htee&&(W+=" ... "),""},_.prototype.compare=function(W,ee,ve,He,ht){if(qt(W,Uint8Array)&&(W=_.from(W,W.offset,W.byteLength)),!_.isBuffer(W))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof W);if(void 0===ee&&(ee=0),void 0===ve&&(ve=W?W.length:0),void 0===He&&(He=0),void 0===ht&&(ht=this.length),0>ee||ve>W.length||0>He||ht>this.length)throw new RangeError("out of range index");if(He>=ht&&ee>=ve)return 0;if(He>=ht)return-1;if(ee>=ve)return 1;if(this===W)return 0;for(var st=(ht>>>=0)-(He>>>=0),Jt=(ve>>>=0)-(ee>>>=0),on=ne(st,Jt),Ht=this.slice(He,ht),wn=W.slice(ee,ve),sn=0;sn>>=0,isFinite(ve)?(ve>>>=0,void 0===He&&(He="utf8")):(He=ve,ve=void 0)}var ht=this.length-ee;if((void 0===ve||ve>ht)&&(ve=ht),0ve||0>ee)||ee>this.length)throw new RangeError("Attempt to write outside buffer bounds");He||(He="utf8");for(var st=!1;;)switch(He){case"hex":return k(this,W,ee,ve);case"utf8":case"utf-8":return I(this,W,ee,ve);case"ascii":return V(this,W,ee,ve);case"latin1":case"binary":return $(this,W,ee,ve);case"base64":return oe(this,W,ee,ve);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ue(this,W,ee,ve);default:if(st)throw new TypeError("Unknown encoding: "+He);He=(""+He).toLowerCase(),st=!0}},_.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},_.prototype.slice=function(W,ee){var ve=this.length;0>(W=~~W)?0>(W+=ve)&&(W=0):W>ve&&(W=ve),0>(ee=void 0===ee?ve:~~ee)?0>(ee+=ve)&&(ee=0):ee>ve&&(ee=ve),ee>>=0,ee>>>=0,ve||F(W,ee,this.length);for(var He=this[W],ht=1,st=0;++st>>=0,ee>>>=0,ve||F(W,ee,this.length);for(var He=this[W+--ee],ht=1;0>>=0,ee||F(W,1,this.length),this[W]},_.prototype.readUInt16LE=function(W,ee){return W>>>=0,ee||F(W,2,this.length),this[W]|this[W+1]<<8},_.prototype.readUInt16BE=function(W,ee){return W>>>=0,ee||F(W,2,this.length),this[W]<<8|this[W+1]},_.prototype.readUInt32LE=function(W,ee){return W>>>=0,ee||F(W,4,this.length),(this[W]|this[W+1]<<8|this[W+2]<<16)+16777216*this[W+3]},_.prototype.readUInt32BE=function(W,ee){return W>>>=0,ee||F(W,4,this.length),16777216*this[W]+(this[W+1]<<16|this[W+2]<<8|this[W+3])},_.prototype.readIntLE=function(W,ee,ve){W>>>=0,ee>>>=0,ve||F(W,ee,this.length);for(var He=this[W],ht=1,st=0;++st=(ht*=128)&&(He-=H(2,8*ee)),He},_.prototype.readIntBE=function(W,ee,ve){W>>>=0,ee>>>=0,ve||F(W,ee,this.length);for(var He=ee,ht=1,st=this[W+--He];0=(ht*=128)&&(st-=H(2,8*ee)),st},_.prototype.readInt8=function(W,ee){return W>>>=0,ee||F(W,1,this.length),128&this[W]?-1*(255-this[W]+1):this[W]},_.prototype.readInt16LE=function(W,ee){W>>>=0,ee||F(W,2,this.length);var ve=this[W]|this[W+1]<<8;return 32768&ve?4294901760|ve:ve},_.prototype.readInt16BE=function(W,ee){W>>>=0,ee||F(W,2,this.length);var ve=this[W+1]|this[W]<<8;return 32768&ve?4294901760|ve:ve},_.prototype.readInt32LE=function(W,ee){return W>>>=0,ee||F(W,4,this.length),this[W]|this[W+1]<<8|this[W+2]<<16|this[W+3]<<24},_.prototype.readInt32BE=function(W,ee){return W>>>=0,ee||F(W,4,this.length),this[W]<<24|this[W+1]<<16|this[W+2]<<8|this[W+3]},_.prototype.readFloatLE=function(W,ee){return W>>>=0,ee||F(W,4,this.length),nt.read(this,W,!0,23,4)},_.prototype.readFloatBE=function(W,ee){return W>>>=0,ee||F(W,4,this.length),nt.read(this,W,!1,23,4)},_.prototype.readDoubleLE=function(W,ee){return W>>>=0,ee||F(W,8,this.length),nt.read(this,W,!0,52,8)},_.prototype.readDoubleBE=function(W,ee){return W>>>=0,ee||F(W,8,this.length),nt.read(this,W,!1,52,8)},_.prototype.writeUIntLE=function(W,ee,ve,He){W=+W,ee>>>=0,ve>>>=0,He||q(this,W,ee,ve,H(2,8*ve)-1,0);var st=1,Jt=0;for(this[ee]=255&W;++Jt>>=0,ve>>>=0,He||q(this,W,ee,ve,H(2,8*ve)-1,0);var st=ve-1,Jt=1;for(this[ee+st]=255&W;0<=--st&&(Jt*=256);)this[ee+st]=255&W/Jt;return ee+ve},_.prototype.writeUInt8=function(W,ee,ve){return W=+W,ee>>>=0,ve||q(this,W,ee,1,255,0),this[ee]=255&W,ee+1},_.prototype.writeUInt16LE=function(W,ee,ve){return W=+W,ee>>>=0,ve||q(this,W,ee,2,65535,0),this[ee]=255&W,this[ee+1]=W>>>8,ee+2},_.prototype.writeUInt16BE=function(W,ee,ve){return W=+W,ee>>>=0,ve||q(this,W,ee,2,65535,0),this[ee]=W>>>8,this[ee+1]=255&W,ee+2},_.prototype.writeUInt32LE=function(W,ee,ve){return W=+W,ee>>>=0,ve||q(this,W,ee,4,4294967295,0),this[ee+3]=W>>>24,this[ee+2]=W>>>16,this[ee+1]=W>>>8,this[ee]=255&W,ee+4},_.prototype.writeUInt32BE=function(W,ee,ve){return W=+W,ee>>>=0,ve||q(this,W,ee,4,4294967295,0),this[ee]=W>>>24,this[ee+1]=W>>>16,this[ee+2]=W>>>8,this[ee+3]=255&W,ee+4},_.prototype.writeIntLE=function(W,ee,ve,He){if(W=+W,ee>>>=0,!He){var ht=H(2,8*ve-1);q(this,W,ee,ve,ht-1,-ht)}var st=0,Jt=1,on=0;for(this[ee]=255&W;++stW&&0===on&&0!==this[ee+st-1]&&(on=1),this[ee+st]=255&(W/Jt>>0)-on;return ee+ve},_.prototype.writeIntBE=function(W,ee,ve,He){if(W=+W,ee>>>=0,!He){var ht=H(2,8*ve-1);q(this,W,ee,ve,ht-1,-ht)}var st=ve-1,Jt=1,on=0;for(this[ee+st]=255&W;0<=--st&&(Jt*=256);)0>W&&0===on&&0!==this[ee+st+1]&&(on=1),this[ee+st]=255&(W/Jt>>0)-on;return ee+ve},_.prototype.writeInt8=function(W,ee,ve){return W=+W,ee>>>=0,ve||q(this,W,ee,1,127,-128),0>W&&(W=255+W+1),this[ee]=255&W,ee+1},_.prototype.writeInt16LE=function(W,ee,ve){return W=+W,ee>>>=0,ve||q(this,W,ee,2,32767,-32768),this[ee]=255&W,this[ee+1]=W>>>8,ee+2},_.prototype.writeInt16BE=function(W,ee,ve){return W=+W,ee>>>=0,ve||q(this,W,ee,2,32767,-32768),this[ee]=W>>>8,this[ee+1]=255&W,ee+2},_.prototype.writeInt32LE=function(W,ee,ve){return W=+W,ee>>>=0,ve||q(this,W,ee,4,2147483647,-2147483648),this[ee]=255&W,this[ee+1]=W>>>8,this[ee+2]=W>>>16,this[ee+3]=W>>>24,ee+4},_.prototype.writeInt32BE=function(W,ee,ve){return W=+W,ee>>>=0,ve||q(this,W,ee,4,2147483647,-2147483648),0>W&&(W=4294967295+W+1),this[ee]=W>>>24,this[ee+1]=W>>>16,this[ee+2]=W>>>8,this[ee+3]=255&W,ee+4},_.prototype.writeFloatLE=function(W,ee,ve){return Y(this,W,ee,!0,ve)},_.prototype.writeFloatBE=function(W,ee,ve){return Y(this,W,ee,!1,ve)},_.prototype.writeDoubleLE=function(W,ee,ve){return se(this,W,ee,!0,ve)},_.prototype.writeDoubleBE=function(W,ee,ve){return se(this,W,ee,!1,ve)},_.prototype.copy=function(W,ee,ve,He){if(!_.isBuffer(W))throw new TypeError("argument should be a Buffer");if(ve||(ve=0),He||0===He||(He=this.length),ee>=W.length&&(ee=W.length),ee||(ee=0),0ee)throw new RangeError("targetStart out of bounds");if(0>ve||ve>=this.length)throw new RangeError("Index out of range");if(0>He)throw new RangeError("sourceEnd out of bounds");He>this.length&&(He=this.length),W.length-eeht||"latin1"===He)&&(W=ht)}}else"number"==typeof W&&(W&=255);if(0>ee||this.length>>=0,ve=void 0===ve?this.length:ve>>>0,W||(W=0),"number"==typeof W)for(st=ee;st{})){return this.cache?(this.cache.remove(n),void this.store.put(n,g,h)):b(()=>h(new Error("CacheStore closed")))}get(n,g,h=(()=>{})){if("function"==typeof g)return this.get(n,null,g);if(!this.cache)return b(()=>h(new Error("CacheStore closed")));g||(g={});let s=this.cache.get(n);if(s){const t=g.offset||0,r=g.length||s.length-t;return(0!==t||r!==s.length)&&(s=s.slice(t,r+t)),b(()=>h(null,s))}let u=this.inProgressGets.get(n);const o=!!u;u||(u=[],this.inProgressGets.set(n,u)),u.push({opts:g,cb:h}),o||this.store.get(n,(t,r)=>{t||null==this.cache||this.cache.set(n,r);const a=this.inProgressGets.get(n);this.inProgressGets.delete(n);for(const{opts:c,cb:l}of a)if(t)l(t);else{const w=c.offset||0,E=c.length||r.length-w;let C=r;(0!==w||E!==r.length)&&(C=r.slice(w,E+w)),l(null,C)}})}close(n=(()=>{})){return this.cache?(this.cache=null,void this.store.close(n)):b(()=>n(new Error("CacheStore closed")))}destroy(n=(()=>{})){return this.cache?(this.cache=null,void this.store.destroy(n)):b(()=>n(new Error("CacheStore closed")))}}},{lru:156,"queue-microtask":206}],79:[function(d,N,A){const f=d("block-stream2"),b=d("readable-stream");N.exports=class m extends b.Writable{constructor(n,g,h={}){if(super(h),!n||!n.put||!n.get)throw new Error("First argument must be an abstract-chunk-store compliant store");if(!(g=+g))throw new Error("Second argument must be a chunk length");const s=void 0!==h.zeroPadding&&h.zeroPadding;this._blockstream=new f(g,{...h,zeroPadding:s}),this._outstandingPuts=0,this._storeMaxOutstandingPuts=h.storeMaxOutstandingPuts||16;let u=0;this._blockstream.on("data",t=>{this.destroyed||(this._outstandingPuts+=1,this._outstandingPuts>=this._storeMaxOutstandingPuts&&this._blockstream.pause(),n.put(u,t,r=>r?this.destroy(r):(this._outstandingPuts-=1,this._outstandingPuts{this.destroy(t)})}_write(n,g,h){this._blockstream.write(n,g,h)}_final(n){this._blockstream.end(),this._blockstream.once("end",()=>{0===this._outstandingPuts?n(null):this._finalCb=n})}destroy(n){this.destroyed||(this.destroyed=!0,n&&this.emit("error",n),this.emit("close"))}}},{"block-stream2":39,"readable-stream":228}],80:[function(d,N,A){function f(g){m.call(this),this.hashMode="string"==typeof g,this.hashMode?this[g]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}var b=d("safe-buffer").Buffer,m=d("stream").Transform,_=d("string_decoder").StringDecoder;d("inherits")(f,m),f.prototype.update=function(g,h,s){"string"==typeof g&&(g=b.from(g,h));var u=this._update(g);return this.hashMode?this:(s&&(u=this._toString(u,s)),u)},f.prototype.setAutoPadding=function(){},f.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},f.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},f.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},f.prototype._transform=function(g,h,s){var u;try{this.hashMode?this._update(g):this.push(this._update(g))}catch(o){u=o}finally{s(u)}},f.prototype._flush=function(g){var h;try{this.push(this.__final())}catch(s){h=s}g(h)},f.prototype._finalOrDigest=function(g){var h=this.__final()||b.alloc(0);return g&&(h=this._toString(h,g,!0)),h},f.prototype._toString=function(g,h,s){if(this._decoder||(this._decoder=new _(h),this._encoding=h),this._encoding!==h)throw new Error("can't switch encodings");var u=this._decoder.write(g);return s&&(u+=this._decoder.end()),u},N.exports=f},{inherits:147,"safe-buffer":235,stream:256,string_decoder:71}],81:[function(d,N,A){(function(f){(function(){var b=function(){"use strict";function m(a,c){return null!=c&&a instanceof c}function _(a,c,l,w,E){"object"==typeof c&&(l=c.depth,w=c.prototype,E=c.includeNonEnumerable,c=c.circular);var z=[],k=[],I=typeof f<"u";return typeof c>"u"&&(c=!0),typeof l>"u"&&(l=1/0),function C(V,$){if(null===V)return null;if(0===$)return V;var oe,ue;if("object"!=typeof V)return V;if(m(V,o))oe=new o;else if(m(V,t))oe=new t;else if(m(V,r))oe=new r(function(q,L){V.then(function(Y){q(C(Y,$-1))},function(Y){L(C(Y,$-1))})});else if(_.__isArray(V))oe=[];else if(_.__isRegExp(V))oe=new RegExp(V.source,u(V)),V.lastIndex&&(oe.lastIndex=V.lastIndex);else if(_.__isDate(V))oe=new Date(V.getTime());else{if(I&&f.isBuffer(V))return oe=f.allocUnsafe?f.allocUnsafe(V.length):new f(V.length),V.copy(oe),oe;m(V,Error)?oe=Object.create(V):typeof w>"u"?(ue=Object.getPrototypeOf(V),oe=Object.create(ue)):(oe=Object.create(w),ue=w)}if(c){var Ae=z.indexOf(V);if(-1!=Ae)return k[Ae];z.push(V),k.push(oe)}for(var X in m(V,o)&&V.forEach(function(q,L){var Y=C(L,$-1),se=C(q,$-1);oe.set(Y,se)}),m(V,t)&&V.forEach(function(q){var L=C(q,$-1);oe.add(L)}),V){var T;ue&&(T=Object.getOwnPropertyDescriptor(ue,X)),(!T||null!=T.set)&&(oe[X]=C(V[X],$-1))}if(Object.getOwnPropertySymbols){var D=Object.getOwnPropertySymbols(V);for(X=0;Xr?t=("rmd160"===o?new h:s(o)).update(t).digest():t.length64?s=h(s):s.length<64&&(s=m.concat([s,n],64));for(var u=this._ipad=m.allocUnsafe(64),o=this._opad=m.allocUnsafe(64),t=0;t<64;t++)u[t]=54^s[t],o[t]=92^s[t];this._hash=[u]}var b=d("inherits"),m=d("safe-buffer").Buffer,_=d("cipher-base"),n=m.alloc(128);b(f,_),f.prototype._update=function(h){this._hash.push(h)},f.prototype._final=function(){var h=this._alg(m.concat(this._hash));return this._alg(m.concat([this._opad,h]))},N.exports=f},{"cipher-base":80,inherits:147,"safe-buffer":235}],89:[function(d,N,A){(function(f){(function(){function _(X,T,D){function M(){k(X.map(L=>Y=>{const se={};if(u(L))se.getStream=L.stream(),se.length=L.size;else if(f.isBuffer(L))se.getStream=[L],se.length=L.length;else{if(!t(L)){if("string"==typeof L){if("function"!=typeof $)throw new Error("filesystem paths do not work in the browser");return void $(L,1L?D(L):(Y=Y.flat(),void D(null,Y,q)))}if(function o(X){return typeof FileList<"u"&&X instanceof FileList}(X)&&(X=Array.from(X)),Array.isArray(X)||(X=[X]),0===X.length)throw new Error("invalid input type");X.forEach(L=>{if(null==L)throw new Error(`invalid input type: ${L}`)}),1!==(X=X.map(L=>u(L)&&"string"==typeof L.path&&"function"==typeof $?L.path:L)).length||"string"==typeof X[0]||X[0].name||(X[0].name=T.name);let v=null;X.forEach((L,Y)=>{if("string"==typeof L)return;let se=L.fullPath||L.name;se||(se=`Unknown File ${Y+1}`,L.unknownName=!0),L[ue]=se.split("/"),L[ue][0]||L[ue].shift(),2>L[ue].length?v=null:0===Y&&1"string"==typeof L||!h(L[ue]))),v&&X.forEach(L=>{const Y=(f.isBuffer(L)||t(L))&&!L[ue];"string"==typeof L||Y||L[ue].shift()}),!T.name&&v&&(T.name=v),T.name||X.some(L=>"string"==typeof L?(T.name=w.basename(L),!0):!L.unknownName&&(T.name=L[ue][L[ue].length-1],!0)),T.name||(T.name=`Unnamed Torrent ${Date.now()}`);const F=X.reduce((L,Y)=>L+ +("string"==typeof Y),0);let q=1===X.length;if(1===X.length&&"string"==typeof X[0]){if("function"!=typeof $)throw new Error("filesystem paths do not work in the browser");E(X[0],(L,Y)=>L?D(L):(q=Y,void M()))}else I(M)}function h(X){const T=X[X.length-1];return"."===T[0]&&C.is(T)}function s(X,T){return X+T.length}function u(X){return typeof Blob<"u"&&X instanceof Blob}function t(X){return"object"==typeof X&&null!=X&&"function"==typeof X.pipe}const a=d("bencode"),c=d("block-iterator"),l=d("piece-length"),w=d("path"),E=d("is-file"),C=d("junk"),z=d("join-async-iterator"),k=d("run-parallel"),I=d("queue-microtask"),V=d("simple-sha1");d("fast-readable-async-iterator");const $=d("./get-files"),ue=Symbol("itemPath");N.exports=function b(X,T,D){"function"==typeof T&&([T,D]=[D,T]),_(X,T=T?Object.assign({},T):{},(M,v,B)=>M?D(M):(T.singleFileTorrent=B,void function g(X,T,D){let M=T.announceList;M||("string"==typeof T.announce?M=[[T.announce]]:Array.isArray(T.announce)&&(M=T.announce.map(q=>[q]))),M||(M=[]),globalThis.WEBTORRENT_ANNOUNCE&&("string"==typeof globalThis.WEBTORRENT_ANNOUNCE?M.push([[globalThis.WEBTORRENT_ANNOUNCE]]):Array.isArray(globalThis.WEBTORRENT_ANNOUNCE)&&(M=M.concat(globalThis.WEBTORRENT_ANNOUNCE.map(q=>[q])))),void 0===T.announce&&void 0===T.announceList&&(M=M.concat(N.exports.announceList)),"string"==typeof T.urlList&&(T.urlList=[T.urlList]);const v={info:{name:T.name},"creation date":_e((+T.creationDate||Date.now())/1e3),encoding:"UTF-8"};0!==M.length&&(v.announce=M[0][0],v["announce-list"]=M),void 0!==T.comment&&(v.comment=T.comment),void 0!==T.createdBy&&(v["created by"]=T.createdBy),void 0!==T.private&&(v.info.private=+T.private),void 0!==T.info&&Object.assign(v.info,T.info),void 0!==T.sslCert&&(v.info["ssl-cert"]=T.sslCert),void 0!==T.urlList&&(v["url-list"]=T.urlList);const B=X.reduce(s,0),F=T.pieceLength||l(B);v.info["piece length"]=F,async function n(X,T,D,M,v){const B=[];let F=0,q=0;const L=X.map(Qe=>Qe.getStream),Y=M.onProgress;let se=0,Ee=0,Se=!1;const Ie=c(z(L),T,{zeroPadding:!1});try{for await(const Qe of Ie)await new Promise(Je=>{F+=Qe.length;const ut=Ee;++Ee,++se<5&&Je(),V(Qe,$t=>{B[ut]=$t,--se,q+=Qe.length,Y&&Y(q,D),Je(),Se&&0==se&&v(null,f.from(B.join(""),"hex"),F)})});if(0==se)return v(null,f.from(B.join(""),"hex"),F);Se=!0}catch(Qe){v(Qe)}}(X,F,B,T,(q,L,Y)=>q?D(q):(v.info.pieces=L,X.forEach(se=>{delete se.getStream}),T.singleFileTorrent?v.info.length=Y:v.info.files=X,void D(null,a.encode(v))))}(v,T,D)))},N.exports.parseInput=function m(X,T,D){"function"==typeof T&&([T,D]=[D,T]),_(X,T=T?Object.assign({},T):{},D)},N.exports.announceList=[["udp://tracker.leechers-paradise.org:6969"],["udp://tracker.coppersurfer.tk:6969"],["udp://tracker.opentrackr.org:1337"],["udp://explodie.org:6969"],["udp://tracker.empire-js.us:1337"],["wss://tracker.btorrent.xyz"],["wss://tracker.openwebtorrent.com"]],N.exports.isJunkPath=h}).call(this)}).call(this,d("buffer").Buffer)},{"./get-files":42,bencode:27,"block-iterator":38,buffer:76,"fast-readable-async-iterator":128,"is-file":42,"join-async-iterator":150,junk:151,path:185,"piece-length":192,"queue-microtask":206,"run-parallel":233,"simple-sha1":248}],90:[function(d,N,A){"use strict";A.randomBytes=A.rng=A.pseudoRandomBytes=A.prng=d("randombytes"),A.createHash=A.Hash=d("create-hash"),A.createHmac=A.Hmac=d("create-hmac");var f=d("browserify-sign/algos"),b=Object.keys(f),m=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(b);A.getHashes=function(){return m};var _=d("pbkdf2");A.pbkdf2=_.pbkdf2,A.pbkdf2Sync=_.pbkdf2Sync;var n=d("browserify-cipher");A.Cipher=n.Cipher,A.createCipher=n.createCipher,A.Cipheriv=n.Cipheriv,A.createCipheriv=n.createCipheriv,A.Decipher=n.Decipher,A.createDecipher=n.createDecipher,A.Decipheriv=n.Decipheriv,A.createDecipheriv=n.createDecipheriv,A.getCiphers=n.getCiphers,A.listCiphers=n.listCiphers;var g=d("diffie-hellman");A.DiffieHellmanGroup=g.DiffieHellmanGroup,A.createDiffieHellmanGroup=g.createDiffieHellmanGroup,A.getDiffieHellman=g.getDiffieHellman,A.createDiffieHellman=g.createDiffieHellman,A.DiffieHellman=g.DiffieHellman;var h=d("browserify-sign");A.createSign=h.createSign,A.Sign=h.Sign,A.createVerify=h.createVerify,A.Verify=h.Verify,A.createECDH=d("create-ecdh");var s=d("public-encrypt");A.publicEncrypt=s.publicEncrypt,A.privateEncrypt=s.privateEncrypt,A.publicDecrypt=s.publicDecrypt,A.privateDecrypt=s.privateDecrypt;var u=d("randomfill");A.randomFill=u.randomFill,A.randomFillSync=u.randomFillSync,A.createCredentials=function(){throw new Error("sorry, createCredentials is not implemented yet\nwe accept pull requests\nhttps://github.com/crypto-browserify/crypto-browserify")},A.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},{"browserify-cipher":60,"browserify-sign":67,"browserify-sign/algos":64,"create-ecdh":83,"create-hash":85,"create-hmac":87,"diffie-hellman":99,pbkdf2:186,"public-encrypt":194,randombytes:209,randomfill:210}],91:[function(d,N,A){(function(f){(function(){A.formatArgs=function m(s){if(s[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+s[0]+(this.useColors?"%c ":" ")+"+"+N.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;s.splice(1,0,u,"color: inherit");let o=0,t=0;s[0].replace(/%[a-zA-Z%]/g,r=>{"%%"===r||(o++,"%c"===r&&(t=o))}),s.splice(t,0,u)},A.save=function _(s){try{s?A.storage.setItem("debug",s):A.storage.removeItem("debug")}catch{}},A.load=function n(){let s;try{s=A.storage.getItem("debug")}catch{}return!s&&typeof f<"u"&&"env"in f&&(s=f.env.DEBUG),s},A.useColors=function b(){return!(!(typeof window<"u"&&window.process)||"renderer"!==window.process.type&&!window.process.__nwjs)||!(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},A.storage=function g(){try{return localStorage}catch{}}(),A.destroy=(()=>{let s=!1;return()=>{s||(s=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),A.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],A.log=console.debug||console.log||(()=>{}),N.exports=d("./common")(A);const{formatters:h}=N.exports;h.j=function(s){try{return JSON.stringify(s)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}}).call(this)}).call(this,d("_process"))},{"./common":92,_process:193}],92:[function(d,N,A){N.exports=function f(b){function _(r){function a(...C){if(!a.enabled)return;const z=a,k=+new Date;z.diff=k-(l||k),z.prev=l,z.curr=k,l=k,C[0]=_.coerce(C[0]),"string"!=typeof C[0]&&C.unshift("%O");let V=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(oe,ue)=>{if("%%"===oe)return"%";V++;const Ae=_.formatters[ue];return"function"==typeof Ae&&(oe=Ae.call(z,C[V]),C.splice(V,1),V--),oe}),_.formatArgs.call(z,C),(z.log||_.log).apply(z,C)}let l,w,E,c=null;return a.namespace=r,a.useColors=_.useColors(),a.color=_.selectColor(r),a.extend=n,a.destroy=_.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null===c?(w!==_.namespaces&&(w=_.namespaces,E=_.enabled(r)),E):c,set:C=>{c=C}}),"function"==typeof _.init&&_.init(a),a}function n(r,a){const c=_(this.namespace+(typeof a>"u"?":":a)+r);return c.log=this.log,c}function u(r){return r.toString().substring(2,r.toString().length-2).replace(/\.\*\?$/,"*")}return _.debug=_,_.default=_,_.coerce=function o(r){return r instanceof Error?r.stack||r.message:r},_.disable=function h(){const r=[..._.names.map(u),..._.skips.map(u).map(a=>"-"+a)].join(",");return _.enable(""),r},_.enable=function g(r){let a;_.save(r),_.namespaces=r,_.names=[],_.skips=[];const c=("string"==typeof r?r:"").split(/[\s,]+/),l=c.length;for(a=0;a{_[r]=b[r]}),_.names=[],_.skips=[],_.formatters={},_.selectColor=function m(r){let a=0;for(let c=0;c>>1]),r=n.r28shl(r,c),n.pc2(t,r,u.keys,a)},b.prototype._update=function(u,o,t,r){var a=this._desState,c=n.readUInt32BE(u,o),l=n.readUInt32BE(u,o+4);n.ip(c,l,a.tmp,0),c=a.tmp[0],l=a.tmp[1],"encrypt"===this.type?this._encrypt(a,c,l,a.tmp,0):this._decrypt(a,c,l,a.tmp,0),l=a.tmp[1],n.writeUInt32BE(t,c=a.tmp[0],r),n.writeUInt32BE(t,l,r+4)},b.prototype._pad=function(u,o){for(var t=u.length-o,r=o;r>>0,c=I}n.rip(l,c,r,a)},b.prototype._decrypt=function(u,o,t,r,a){for(var c=t,l=o,w=u.keys.length-2;0<=w;w-=2){var E=u.keys[w],C=u.keys[w+1];n.expand(c,u.tmp,0);var z=n.substitute(E^=u.tmp[0],C^=u.tmp[1]),I=c;c=(l^n.permute(z))>>>0,l=I}n.rip(c,l,r,a)}},{"./cipher":95,"./utils":98,inherits:147,"minimalistic-assert":168}],97:[function(d,N,A){"use strict";function f(h,s){m.equal(s.length,24,"Invalid key length");var u=s.slice(0,8),o=s.slice(8,16),t=s.slice(16,24);this.ciphers="encrypt"===h?[g.create({type:"encrypt",key:u}),g.create({type:"decrypt",key:o}),g.create({type:"encrypt",key:t})]:[g.create({type:"decrypt",key:t}),g.create({type:"encrypt",key:o}),g.create({type:"decrypt",key:u})]}function b(h){n.call(this,h);var s=new f(this.type,this.options.key);this._edeState=s}var m=d("minimalistic-assert"),_=d("inherits"),n=d("./cipher"),g=d("./des");_(b,n),N.exports=b,b.create=function(s){return new b(s)},b.prototype._update=function(s,u,o,t){var r=this._edeState;r.ciphers[0]._update(s,u,o,t),r.ciphers[1]._update(o,t,o,t),r.ciphers[2]._update(o,t,o,t)},b.prototype._pad=g.prototype._pad,b.prototype._unpad=g.prototype._unpad},{"./cipher":95,"./des":96,inherits:147,"minimalistic-assert":168}],98:[function(d,N,A){"use strict";A.readUInt32BE=function(n,g){return(n[0+g]<<24|n[1+g]<<16|n[2+g]<<8|n[3+g])>>>0},A.writeUInt32BE=function(n,g,h){n[0+h]=g>>>24,n[1+h]=255&g>>>16,n[2+h]=255&g>>>8,n[3+h]=255&g},A.ip=function(n,g,h,s){for(var u=0,o=0,t=6;0<=t;t-=2){for(var r=0;24>=r;r+=8)u<<=1,u|=1&g>>>r+t;for(r=0;24>=r;r+=8)u<<=1,u|=1&n>>>r+t}for(t=6;0<=t;t-=2){for(r=1;25>=r;r+=8)o<<=1,o|=1&g>>>r+t;for(r=1;25>=r;r+=8)o<<=1,o|=1&n>>>r+t}h[s+0]=u>>>0,h[s+1]=o>>>0},A.rip=function(n,g,h,s){for(var u=0,o=0,t=0;4>t;t++)for(var r=24;0<=r;r-=8)u<<=1,u|=1&g>>>r+t,u<<=1,u|=1&n>>>r+t;for(t=4;8>t;t++)for(r=24;0<=r;r-=8)o<<=1,o|=1&g>>>r+t,o<<=1,o|=1&n>>>r+t;h[s+0]=u>>>0,h[s+1]=o>>>0},A.pc1=function(n,g,h,s){for(var u=0,o=0,t=7;5<=t;t--){for(var r=0;24>=r;r+=8)u<<=1,u|=1&g>>r+t;for(r=0;24>=r;r+=8)u<<=1,u|=1&n>>r+t}for(r=0;24>=r;r+=8)u<<=1,u|=1&g>>r+t;for(t=1;3>=t;t++){for(r=0;24>=r;r+=8)o<<=1,o|=1&g>>r+t;for(r=0;24>=r;r+=8)o<<=1,o|=1&n>>r+t}for(r=0;24>=r;r+=8)o<<=1,o|=1&n>>r+t;h[s+0]=u>>>0,h[s+1]=o>>>0},A.r28shl=function(n,g){return 268435455&n<>>28-g};var f=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];A.pc2=function(n,g,h,s){for(var u=0,o=0,t=f.length>>>1,r=0;r>>f[r];for(r=t;r>>f[r];h[s+0]=u>>>0,h[s+1]=o>>>0},A.expand=function(n,g,h){var s=0,u=0;s=(1&n)<<5|n>>>27;for(var o=23;15<=o;o-=4)s<<=6,s|=63&n>>>o;for(o=11;3<=o;o-=4)u|=63&n>>>o,u<<=6;u|=(31&n)<<1|n>>>31,g[h+0]=s>>>0,g[h+1]=u>>>0};var b=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];A.substitute=function(n,g){for(var h=0,s=0;4>s;s++)h<<=4,h|=b[64*s+(63&n>>>18-6*s)];for(s=0;4>s;s++)h<<=4,h|=b[256+64*s+(63&g>>>18-6*s)];return h>>>0};var m=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];A.permute=function(n){for(var g=0,h=0;h>>m[h];return g>>>0},A.padSplit=function(n,g,h){for(var s=n.toString(2);s.lengthAe;Ae+=2){X=_e(V(Ae));for(var T=0;TV)return new g(2===$||5===$?[140,123]:[140,39]);$=new g($);for(var oe,ue;;){for(oe=new g(n(_e(V/8)));oe.bitLength()>V;)oe.ishrn(1);if(oe.isEven()&&oe.iadd(o),oe.testn(1)||oe.iadd(t),$.cmp(t)){if(!$.cmp(r))for(;oe.mod(l).cmp(w);)oe.iadd(z)}else for(;oe.mod(h).cmp(C);)oe.iadd(z);if(b(ue=oe.shrn(1))&&b(oe)&&m(ue)&&m(oe)&&u.test(ue)&&u.test(oe))return oe}}var n=d("randombytes");N.exports=_,_.simpleSieve=b,_.fermatTest=m;var g=d("bn.js"),h=new g(24),u=new(d("miller-rabin")),o=new g(1),t=new g(2),r=new g(5),l=(new g(16),new g(8),new g(10)),w=new g(3),C=(new g(7),new g(11)),z=new g(4),I=(new g(12),null)},{"bn.js":103,"miller-rabin":162,randombytes:209}],102:[function(d,N,A){N.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],103:[function(d,N,A){arguments[4][22][0].apply(A,arguments)},{buffer:42,dup:22}],104:[function(d,N,A){"use strict";var f=A;f.version=d("../package.json").version,f.utils=d("./elliptic/utils"),f.rand=d("brorand"),f.curve=d("./elliptic/curve"),f.curves=d("./elliptic/curves"),f.ec=d("./elliptic/ec"),f.eddsa=d("./elliptic/eddsa")},{"../package.json":120,"./elliptic/curve":107,"./elliptic/curves":110,"./elliptic/ec":111,"./elliptic/eddsa":114,"./elliptic/utils":118,brorand:41}],105:[function(d,N,A){"use strict";function f(s,u){this.type=s,this.p=new m(u.p,16),this.red=u.prime?m.red(u.prime):m.mont(this.p),this.zero=new m(0).toRed(this.red),this.one=new m(1).toRed(this.red),this.two=new m(2).toRed(this.red),this.n=u.n&&new m(u.n,16),this.g=u.g&&this.pointFromJSON(u.g,u.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n?this.n.bitLength():0;var o=this.n&&this.p.div(this.n);!o||0=l;E--)w=(w<<1)+r[E];c.push(w)}for(var C=this.jpoint(null,null,null),z=this.jpoint(null,null,null),k=a;0w)break;var C=c[w];h(0!==C),l="affine"===u.type?l.mixedAdd(0>1]:a[-C-1>>1].neg()):l.add(0>1]:a[-C-1>>1].neg())}return"affine"===u.type?l.toP():l},f.prototype._wnafMulAdd=function(u,o,t,r,a){var C,z,k,c=this._wnafT1,l=this._wnafT2,w=this._wnafT3,E=0;for(C=0;CC)break;for(z=0;z>1]:0>F&&(k=l[z][-F-1>>1].neg()),D="affine"===k.type?D.mixedAdd(k):D.add(k))}}for(C=0;C=_e((u.bitLength()+1)/o.step)},b.prototype._getDoubles=function(u,o){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var t=[this],r=this,a=0;a":""},b.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},b.prototype._extDbl=function(){var u=this.x.redSqr(),o=this.y.redSqr(),t=this.z.redSqr();t=t.redIAdd(t);var r=this.curve._mulA(u),a=this.x.redAdd(this.y).redSqr().redISub(u).redISub(o),c=r.redAdd(o),l=c.redSub(t),w=r.redSub(o),E=a.redMul(l),C=c.redMul(w),z=a.redMul(w),k=l.redMul(c);return this.curve.point(E,C,k,z)},b.prototype._projDbl=function(){var r,a,c,l,w,E,u=this.x.redAdd(this.y).redSqr(),o=this.x.redSqr(),t=this.y.redSqr();if(this.curve.twisted){var C=(l=this.curve._mulA(o)).redAdd(t);this.zOne?(r=u.redSub(o).redSub(t).redMul(C.redSub(this.curve.two)),a=C.redMul(l.redSub(t)),c=C.redSqr().redSub(C).redSub(C)):(w=this.z.redSqr(),E=C.redSub(w).redISub(w),r=u.redSub(o).redISub(t).redMul(E),a=C.redMul(l.redSub(t)),c=C.redMul(E))}else l=o.redAdd(t),w=this.curve._mulC(this.z).redSqr(),E=l.redSub(w).redSub(w),r=this.curve._mulC(u.redISub(l)).redMul(E),a=this.curve._mulC(l).redMul(o.redISub(t)),c=l.redMul(E);return this.curve.point(r,a,c)},b.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},b.prototype._extAdd=function(u){var o=this.y.redSub(this.x).redMul(u.y.redSub(u.x)),t=this.y.redAdd(this.x).redMul(u.y.redAdd(u.x)),r=this.t.redMul(this.curve.dd).redMul(u.t),a=this.z.redMul(u.z.redAdd(u.z)),c=t.redSub(o),l=a.redSub(r),w=a.redAdd(r),E=t.redAdd(o),C=c.redMul(l),z=w.redMul(E),k=c.redMul(E),I=l.redMul(w);return this.curve.point(C,z,I,k)},b.prototype._projAdd=function(u){var z,k,o=this.z.redMul(u.z),t=o.redSqr(),r=this.x.redMul(u.x),a=this.y.redMul(u.y),c=this.curve.d.redMul(r).redMul(a),l=t.redSub(c),w=t.redAdd(c),E=this.x.redAdd(this.y).redMul(u.x.redAdd(u.y)).redISub(r).redISub(a),C=o.redMul(l).redMul(E);return this.curve.twisted?(z=o.redMul(w).redMul(a.redSub(this.curve._mulA(r))),k=l.redMul(w)):(z=o.redMul(w).redMul(a.redSub(r)),k=this.curve._mulC(l).redMul(w)),this.curve.point(C,z,k)},b.prototype.add=function(u){return this.isInfinity()?u:u.isInfinity()?this:this.curve.extended?this._extAdd(u):this._projAdd(u)},b.prototype.mul=function(u){return this._hasDoubles(u)?this.curve._fixedNafMul(this,u):this.curve._wnafMul(this,u)},b.prototype.mulAdd=function(u,o,t){return this.curve._wnafMulAdd(1,[this,o],[u,t],2,!1)},b.prototype.jmulAdd=function(u,o,t){return this.curve._wnafMulAdd(1,[this,o],[u,t],2,!0)},b.prototype.normalize=function(){if(this.zOne)return this;var u=this.z.redInvm();return this.x=this.x.redMul(u),this.y=this.y.redMul(u),this.t&&(this.t=this.t.redMul(u)),this.z=this.curve.one,this.zOne=!0,this},b.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},b.prototype.getX=function(){return this.normalize(),this.x.fromRed()},b.prototype.getY=function(){return this.normalize(),this.y.fromRed()},b.prototype.eq=function(u){return this===u||0===this.getX().cmp(u.getX())&&0===this.getY().cmp(u.getY())},b.prototype.eqXToP=function(u){var o=u.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(o))return!0;for(var t=u.clone(),r=this.curve.redN.redMul(this.z);;){if(t.iadd(this.curve.n),0<=t.cmp(this.curve.p))return!1;if(o.redIAdd(r),0===this.x.cmp(o))return!0}},b.prototype.toP=b.prototype.normalize,b.prototype.mixedAdd=b.prototype.add},{"../utils":118,"./base":105,"bn.js":119,inherits:147}],107:[function(d,N,A){"use strict";var f=A;f.base=d("./base"),f.short=d("./short"),f.mont=d("./mont"),f.edwards=d("./edwards")},{"./base":105,"./edwards":106,"./mont":108,"./short":109}],108:[function(d,N,A){"use strict";function f(h){n.call(this,"mont",h),this.a=new m(h.a,16).toRed(this.red),this.b=new m(h.b,16).toRed(this.red),this.i4=new m(4).toRed(this.red).redInvm(),this.two=new m(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function b(h,s,u){n.BasePoint.call(this,h,"projective"),null===s&&null===u?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new m(s,16),this.z=new m(u,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),!this.z.red&&(this.z=this.z.toRed(this.curve.red)))}var m=d("bn.js"),_=d("inherits"),n=d("./base"),g=d("../utils");_(f,n),N.exports=f,f.prototype.validate=function(s){var u=s.normalize().x,o=u.redSqr(),t=o.redMul(u).redAdd(o.redMul(this.a)).redAdd(u);return 0===t.redSqrt().redSqr().cmp(t)},_(b,n.BasePoint),f.prototype.decodePoint=function(s,u){return this.point(g.toArray(s,u),1)},f.prototype.point=function(s,u){return new b(this,s,u)},f.prototype.pointFromJSON=function(s){return b.fromJSON(this,s)},b.prototype.precompute=function(){},b.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},b.fromJSON=function(s,u){return new b(s,u[0],u[1]||s.one)},b.prototype.inspect=function(){return this.isInfinity()?"":""},b.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},b.prototype.dbl=function(){var u=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=u.redSub(t),a=u.redMul(t),c=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(a,c)},b.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},b.prototype.diffAdd=function(s,u){var o=this.x.redAdd(this.z),t=this.x.redSub(this.z),r=s.x.redAdd(s.z),c=s.x.redSub(s.z).redMul(o),l=r.redMul(t),w=u.z.redMul(c.redAdd(l).redSqr()),E=u.x.redMul(c.redISub(l).redSqr());return this.curve.point(w,E)},b.prototype.mul=function(s){for(var u=s.clone(),o=this,t=this.curve.point(null,null),a=[];0!==u.cmpn(0);u.iushrn(1))a.push(u.andln(1));for(var c=a.length-1;0<=c;c--)0===a[c]?(o=o.diffAdd(t,this),t=t.dbl()):(t=o.diffAdd(t,this),o=o.dbl());return t},b.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},b.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},b.prototype.eq=function(s){return 0===this.getX().cmp(s.getX())},b.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},b.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../utils":118,"./base":105,"bn.js":119,inherits:147}],109:[function(d,N,A){"use strict";function f(u){h.call(this,"short",u),this.a=new n(u.a,16).toRed(this.red),this.b=new n(u.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(u),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}function b(u,o,t,r){h.BasePoint.call(this,u,"affine"),null===o&&null===t?(this.x=null,this.y=null,this.inf=!0):(this.x=new n(o,16),this.y=new n(t,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),!this.y.red&&(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function m(u,o,t,r){h.BasePoint.call(this,u,"jacobian"),null===o&&null===t&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n(0)):(this.x=new n(o,16),this.y=new n(t,16),this.z=new n(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var _=d("../utils"),n=d("bn.js"),g=d("inherits"),h=d("./base"),s=_.assert;g(f,h),N.exports=f,f.prototype._getEndomorphism=function(o){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(o.beta)t=new n(o.beta,16).toRed(this.red);else{var a=this._getEndoRoots(this.p);t=(t=0>a[0].cmp(a[1])?a[0]:a[1]).toRed(this.red)}if(o.lambda)r=new n(o.lambda,16);else{var c=this._getEndoRoots(this.n);0===this.g.mul(c[0]).x.cmp(this.g.x.redMul(t))?r=c[0]:s(0===this.g.mul(r=c[1]).x.cmp(this.g.x.redMul(t)))}return{beta:t,lambda:r,basis:o.basis?o.basis.map(function(w){return{a:new n(w.a,16),b:new n(w.b,16)}}):this._getEndoBasis(r)}}},f.prototype._getEndoRoots=function(o){var t=o===this.p?this.red:n.mont(o),r=new n(2).toRed(t).redInvm(),a=r.redNeg(),c=new n(3).toRed(t).redNeg().redSqrt().redMul(r);return[a.redAdd(c).fromRed(),a.redSub(c).fromRed()]},f.prototype._getEndoBasis=function(o){for(var z,k,I,V,$,oe,ue,Ae,X,T,t=this.n.ushrn(xt(this.n.bitLength()/2)),r=o,a=this.n.clone(),c=new n(1),l=new n(0),w=new n(0),E=new n(1),C=0;0!==r.cmpn(0);){T=a.div(r),Ae=a.sub(T.mul(r)),X=w.sub(T.mul(c));var D=E.sub(T.mul(l));if(!I&&0>Ae.cmp(t))z=ue.neg(),k=c,I=Ae.neg(),V=X;else if(I&&2==++C)break;ue=Ae,a=r,r=Ae,w=c,c=X,E=l,l=D}$=Ae.neg(),oe=X;var M=I.sqr().add(V.sqr());return 0<=$.sqr().add(oe.sqr()).cmp(M)&&($=z,oe=k),I.negative&&(I=I.neg(),V=V.neg()),$.negative&&($=$.neg(),oe=oe.neg()),[{a:I,b:V},{a:$,b:oe}]},f.prototype._endoSplit=function(o){var t=this.endo.basis,r=t[0],a=t[1],c=a.b.mul(o).divRound(this.n),l=r.b.neg().mul(o).divRound(this.n),w=c.mul(r.a),E=l.mul(a.a),C=c.mul(r.b),z=l.mul(a.b);return{k1:o.sub(w).sub(E),k2:C.add(z).neg()}},f.prototype.pointFromX=function(o,t){(o=new n(o,16)).red||(o=o.toRed(this.red));var r=o.redSqr().redMul(o).redIAdd(o.redMul(this.a)).redIAdd(this.b),a=r.redSqrt();if(0!==a.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var c=a.fromRed().isOdd();return(t&&!c||!t&&c)&&(a=a.redNeg()),this.point(o,a)},f.prototype.validate=function(o){if(o.inf)return!0;var t=o.x,r=o.y,a=this.a.redMul(t),c=t.redSqr().redMul(t).redIAdd(a).redIAdd(this.b);return 0===r.redSqr().redISub(c).cmpn(0)},f.prototype._endoWnafMulAdd=function(o,t,r){for(var a=this._endoWnafT1,c=this._endoWnafT2,l=0;l":""},b.prototype.isInfinity=function(){return this.inf},b.prototype.add=function(o){if(this.inf)return o;if(o.inf)return this;if(this.eq(o))return this.dbl();if(this.neg().eq(o))return this.curve.point(null,null);if(0===this.x.cmp(o.x))return this.curve.point(null,null);var t=this.y.redSub(o.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(o.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(o.x),a=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,a)},b.prototype.dbl=function(){if(this.inf)return this;var o=this.y.redAdd(this.y);if(0===o.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),a=o.redInvm(),c=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(a),l=c.redSqr().redISub(this.x.redAdd(this.x)),w=c.redMul(this.x.redSub(l)).redISub(this.y);return this.curve.point(l,w)},b.prototype.getX=function(){return this.x.fromRed()},b.prototype.getY=function(){return this.y.fromRed()},b.prototype.mul=function(o){return o=new n(o,16),this.isInfinity()?this:this._hasDoubles(o)?this.curve._fixedNafMul(this,o):this.curve.endo?this.curve._endoWnafMulAdd([this],[o]):this.curve._wnafMul(this,o)},b.prototype.mulAdd=function(o,t,r){var a=[this,t],c=[o,r];return this.curve.endo?this.curve._endoWnafMulAdd(a,c):this.curve._wnafMulAdd(1,a,c,2)},b.prototype.jmulAdd=function(o,t,r){var a=[this,t],c=[o,r];return this.curve.endo?this.curve._endoWnafMulAdd(a,c,!0):this.curve._wnafMulAdd(1,a,c,2,!0)},b.prototype.eq=function(o){return this===o||this.inf===o.inf&&(this.inf||0===this.x.cmp(o.x)&&0===this.y.cmp(o.y))},b.prototype.neg=function(o){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(o&&this.precomputed){var r=this.precomputed,a=function(c){return c.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(a)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(a)}}}return t},b.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},g(m,h.BasePoint),f.prototype.jpoint=function(o,t,r){return new m(this,o,t,r)},m.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var o=this.z.redInvm(),t=o.redSqr(),r=this.x.redMul(t),a=this.y.redMul(t).redMul(o);return this.curve.point(r,a)},m.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},m.prototype.add=function(o){if(this.isInfinity())return o;if(o.isInfinity())return this;var t=o.z.redSqr(),r=this.z.redSqr(),a=this.x.redMul(t),c=o.x.redMul(r),l=this.y.redMul(t.redMul(o.z)),w=o.y.redMul(r.redMul(this.z)),E=a.redSub(c),C=l.redSub(w);if(0===E.cmpn(0))return 0===C.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var z=E.redSqr(),k=z.redMul(E),I=a.redMul(z),V=C.redSqr().redIAdd(k).redISub(I).redISub(I),$=C.redMul(I.redISub(V)).redISub(l.redMul(k)),oe=this.z.redMul(o.z).redMul(E);return this.curve.jpoint(V,$,oe)},m.prototype.mixedAdd=function(o){if(this.isInfinity())return o.toJ();if(o.isInfinity())return this;var t=this.z.redSqr(),r=this.x,a=o.x.redMul(t),c=this.y,l=o.y.redMul(t).redMul(this.z),w=r.redSub(a),E=c.redSub(l);if(0===w.cmpn(0))return 0===E.cmpn(0)?this.dbl():this.curve.jpoint(null,null,null);var C=w.redSqr(),z=C.redMul(w),k=r.redMul(C),I=E.redSqr().redIAdd(z).redISub(k).redISub(k),V=E.redMul(k.redISub(I)).redISub(c.redMul(z)),$=this.z.redMul(w);return this.curve.jpoint(I,V,$)},m.prototype.dblp=function(o){if(0===o)return this;if(this.isInfinity())return this;if(!o)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t":""},m.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../utils":118,"./base":105,"bn.js":119,inherits:147}],110:[function(d,N,A){"use strict";function f(u){this.curve="short"===u.type?new n.short(u):"edwards"===u.type?new n.edwards(u):new n.mont(u),this.g=this.curve.g,this.n=this.curve.n,this.hash=u.hash,h(this.g.validate(),"Invalid curve"),h(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function b(u,o){Object.defineProperty(m,u,{configurable:!0,enumerable:!0,get:function(){var t=new f(o);return Object.defineProperty(m,u,{configurable:!0,enumerable:!0,value:t}),t}})}var s,m=A,_=d("hash.js"),n=d("./curve"),h=d("./utils").assert;m.PresetCurve=f,b("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:_.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),b("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:_.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),b("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:_.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),b("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:_.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),b("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:_.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),b("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_.sha256,gRed:!1,g:["9"]}),b("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{s=d("./precomputed/secp256k1")}catch{s=void 0}b("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:_.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",s]})},{"./curve":107,"./precomputed/secp256k1":117,"./utils":118,"hash.js":131}],111:[function(d,N,A){"use strict";function f(o){return this instanceof f?("string"==typeof o&&(h(Object.prototype.hasOwnProperty.call(n,o),"Unknown curve "+o),o=n[o]),o instanceof n.PresetCurve&&(o={curve:o}),this.curve=o.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=o.curve.g,this.g.precompute(o.curve.n.bitLength()+1),void(this.hash=o.hash||o.curve.hash)):new f(o)}var b=d("bn.js"),m=d("hmac-drbg"),_=d("../utils"),n=d("../curves"),g=d("brorand"),h=_.assert,s=d("./key"),u=d("./signature");N.exports=f,f.prototype.keyPair=function(t){return new s(this,t)},f.prototype.keyFromPrivate=function(t,r){return s.fromPrivate(this,t,r)},f.prototype.keyFromPublic=function(t,r){return s.fromPublic(this,t,r)},f.prototype.genKeyPair=function(t){t||(t={});for(var r=new m({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||g(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),a=this.n.byteLength(),c=this.n.sub(new b(2));;){var l=new b(r.generate(a));if(!(0=(I=this._truncateToN(I,!0)).cmpn(1)||0<=I.cmp(z))){var V=this.g.mul(I);if(!V.isInfinity()){var $=V.getX(),oe=$.umod(this.n);if(0!==oe.cmpn(0)){var ue=I.invm(this.n).mul(oe.mul(r.getPrivate()).iadd(t));if(0!==(ue=ue.umod(this.n)).cmpn(0)){var Ae=(V.getY().isOdd()?1:0)|(0===$.cmp(oe)?0:2);return c.canonical&&0l.cmpn(1)||0<=l.cmp(this.n)||0>w.cmpn(1)||0<=w.cmp(this.n))return!1;var k,E=w.invm(this.n),C=E.mul(t).umod(this.n),z=E.mul(l).umod(this.n);return this.curve._maxwellTrick?!(k=this.g.jmulAdd(C,a.getPublic(),z)).isInfinity()&&k.eqXToP(l):!(k=this.g.mulAdd(C,a.getPublic(),z)).isInfinity()&&0===k.getX().umod(this.n).cmp(l)},f.prototype.recoverPubKey=function(o,t,r,a){h((3&r)===r,"The recovery param is more than two bits"),t=new u(t,a);var c=this.n,l=new b(o),w=t.r,E=t.s,C=1&r,z=r>>1;if(0<=w.cmp(this.curve.p.umod(this.curve.n))&&z)throw new Error("Unable to find sencond key candinate");w=this.curve.pointFromX(z?w.add(this.curve.n):w,C);var k=t.r.invm(c),I=c.sub(l).mul(k).umod(c),V=E.mul(k).umod(c);return this.g.mulAdd(I,w,V)},f.prototype.getKeyRecoveryParam=function(o,t,r,a){if(null!==(t=new u(t,a)).recoveryParam)return t.recoveryParam;for(var c=0;4>c;c++){var l;try{l=this.recoverPubKey(o,t,c)}catch{continue}if(l.eq(r))return c}throw new Error("Unable to find valid recovery factor")}},{"../curves":110,"../utils":118,"./key":112,"./signature":113,"bn.js":119,brorand:41,"hmac-drbg":143}],112:[function(d,N,A){"use strict";function f(n,g){this.ec=n,this.priv=null,this.pub=null,g.priv&&this._importPrivate(g.priv,g.privEnc),g.pub&&this._importPublic(g.pub,g.pubEnc)}var b=d("bn.js"),_=d("../utils").assert;N.exports=f,f.fromPublic=function(g,h,s){return h instanceof f?h:new f(g,{pub:h,pubEnc:s})},f.fromPrivate=function(g,h,s){return h instanceof f?h:new f(g,{priv:h,privEnc:s})},f.prototype.validate=function(){var g=this.getPublic();return g.isInfinity()?{result:!1,reason:"Invalid public key"}:g.validate()?g.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},f.prototype.getPublic=function(g,h){return"string"==typeof g&&(h=g,g=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),h?this.pub.encode(h,g):this.pub},f.prototype.getPrivate=function(g){return"hex"===g?this.priv.toString(16,2):this.priv},f.prototype._importPrivate=function(g,h){this.priv=new b(g,h||16),this.priv=this.priv.umod(this.ec.curve.n)},f.prototype._importPublic=function(g,h){return g.x||g.y?("mont"===this.ec.curve.type?_(g.x,"Need x coordinate"):("short"===this.ec.curve.type||"edwards"===this.ec.curve.type)&&_(g.x&&g.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(g.x,g.y))):void(this.pub=this.ec.curve.decodePoint(g,h))},f.prototype.derive=function(g){return g.validate()||_(g.validate(),"public point not validated"),g.mul(this.priv).getX()},f.prototype.sign=function(g,h,s){return this.ec.sign(g,this,h,s)},f.prototype.verify=function(g,h){return this.ec.verify(g,h,this)},f.prototype.inspect=function(){return""}},{"../utils":118,"bn.js":119}],113:[function(d,N,A){"use strict";function f(u,o){return u instanceof f?u:void(this._importDER(u,o)||(s(u.r&&u.s,"Signature without r or s"),this.r=new g(u.r,16),this.s=new g(u.s,16),this.recoveryParam=void 0===u.recoveryParam?null:u.recoveryParam))}function b(){this.place=0}function m(u,o){var t=u[o.place++];if(!(128&t))return t;var r=15&t;if(0==r||4>>=0;return!(127>=a)&&(o.place=l,a)}function _(u){for(var o=0,t=u.length-1;!u[o]&&!(128&u[o+1])&&oo)u.push(o);else{var t=1+(gn(o)/Gt>>>3);for(u.push(128|t);--t;)u.push(255&o>>>(t<<3));u.push(o)}}var g=d("bn.js"),h=d("../utils"),s=h.assert;N.exports=f,f.prototype._importDER=function(o,t){o=h.toArray(o,t);var r=new b;if(48!==o[r.place++])return!1;var a=m(o,r);if(!1===a||a+r.place!==o.length||2!==o[r.place++])return!1;var c=m(o,r);if(!1===c)return!1;var l=o.slice(r.place,c+r.place);if(r.place+=c,2!==o[r.place++])return!1;var w=m(o,r);if(!1===w||o.length!==w+r.place)return!1;var E=o.slice(r.place,w+r.place);if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}if(0===E[0]){if(!(128&E[1]))return!1;E=E.slice(1)}return this.r=new g(l),this.s=new g(E),this.recoveryParam=null,!0},f.prototype.toDER=function(o){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=_(t),r=_(r);!(r[0]||128&r[1]);)r=r.slice(1);var a=[2];n(a,t.length),(a=a.concat(t)).push(2),n(a,r.length);var c=a.concat(r),l=[48];return n(l,c.length),l=l.concat(c),h.encode(l,o)}},{"../utils":118,"bn.js":119}],114:[function(d,N,A){"use strict";function f(u){return n("ed25519"===u,"only tested with ed25519 so far"),this instanceof f?(this.curve=u=m[u].curve,this.g=u.g,this.g.precompute(u.n.bitLength()+1),this.pointClass=u.point().constructor,this.encodingLength=_e(u.n.bitLength()/8),void(this.hash=b.sha512)):new f(u)}var b=d("hash.js"),m=d("../curves"),_=d("../utils"),n=_.assert,g=_.parseBytes,h=d("./key"),s=d("./signature");N.exports=f,f.prototype.sign=function(o,t){o=g(o);var r=this.keyFromSecret(t),a=this.hashInt(r.messagePrefix(),o),c=this.g.mul(a),l=this.encodePoint(c),w=this.hashInt(l,r.pubBytes(),o).mul(r.priv()),E=a.add(w).umod(this.curve.n);return this.makeSignature({R:c,S:E,Rencoded:l})},f.prototype.verify=function(o,t,r){o=g(o),t=this.makeSignature(t);var a=this.keyFromPublic(r),c=this.hashInt(t.Rencoded(),a.pubBytes(),o),l=this.g.mul(t.S());return t.R().add(a.pub().mul(c)).eq(l)},f.prototype.hashInt=function(){for(var o=this.hash(),t=0;t(c>>1)-1?(c>>1)-E:E):C=0,a[w]=C,l.iushrn(1)}return a},g.getJSF=function b(o,t){var r=[[],[]];o=o.clone(),t=t.clone();for(var l,a=0,c=0;0",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}},{}],121:[function(d,N,A){(function(f){(function(){var b=d("once"),m=function(){},g=function(h,s,u){if("function"==typeof s)return g(h,null,s);s||(s={}),u=b(u||m);var o=h._writableState,t=h._readableState,r=s.readable||!1!==s.readable&&h.readable,a=s.writable||!1!==s.writable&&h.writable,c=!1,l=function(){h.writable||w()},w=function(){a=!1,r||u.call(h)},E=function(){r=!1,a||u.call(h)},C=function($){u.call(h,$?new Error("exited with error code: "+$):null)},z=function($){u.call(h,$)},k=function(){f.nextTick(I)},I=function(){return c||(!r||t&&t.ended&&!t.destroyed)&&(!a||o&&o.ended&&!o.destroyed)?void 0:u.call(h,new Error("premature close"))},V=function(){h.req.on("finish",w)};return function(h){return h.setHeader&&"function"==typeof h.abort}(h)?(h.on("complete",w),h.on("abort",k),h.req?V():h.on("request",V)):a&&!o&&(h.on("end",l),h.on("close",l)),function(h){return h.stdio&&Array.isArray(h.stdio)&&3===h.stdio.length}(h)&&h.on("exit",C),h.on("end",E),h.on("finish",w),!1!==s.error&&h.on("error",z),h.on("close",k),function(){c=!0,h.removeListener("complete",w),h.removeListener("abort",k),h.removeListener("request",V),h.req&&h.req.removeListener("finish",w),h.removeListener("end",l),h.removeListener("close",l),h.removeListener("finish",w),h.removeListener("exit",C),h.removeListener("end",E),h.removeListener("error",z),h.removeListener("close",k)}};N.exports=g}).call(this)}).call(this,d("_process"))},{_process:193,once:178}],122:[function(d,N,A){"use strict";function f(m,_){for(const n in _)Object.defineProperty(m,n,{value:_[n],enumerable:!0,configurable:!0});return m}N.exports=function b(m,_,n){if(!m||"string"==typeof m)throw new TypeError("Please pass an Error to err-code");n||(n={}),"object"==typeof _&&(n=_,_=""),_&&(n.code=_);try{return f(m,n)}catch{n.message=m.message,n.stack=m.stack;const h=function(){};return h.prototype=Object.create(Object.getPrototypeOf(m)),f(new h,n)}}},{}],123:[function(d,N,A){"use strict";function b(){b.init.call(this)}function m(I){if("function"!=typeof I)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof I)}function _(I){return void 0===I._maxListeners?b.defaultMaxListeners:I._maxListeners}function n(I,V,$,oe){var ue,Ae,X;if(m($),void 0===(Ae=I._events)?(Ae=I._events=Object.create(null),I._eventsCount=0):(void 0!==Ae.newListener&&(I.emit("newListener",V,$.listener?$.listener:$),Ae=I._events),X=Ae[V]),void 0===X)X=Ae[V]=$,++I._eventsCount;else if("function"==typeof X?X=Ae[V]=oe?[$,X]:[X,$]:oe?X.unshift($):X.push($),0<(ue=_(I))&&X.length>ue&&!X.warned){X.warned=!0;var T=new Error("Possible EventEmitter memory leak detected. "+X.length+" "+V+" listeners added. Use emitter.setMaxListeners() to increase limit");T.name="MaxListenersExceededWarning",T.emitter=I,T.type=V,T.count=X.length,function f(I){console&&console.warn&&console.warn(I)}(T)}return I}function g(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(I,V,$){var oe={fired:!1,wrapFn:void 0,target:I,type:V,listener:$},ue=g.bind(oe);return ue.listener=$,oe.wrapFn=ue,ue}function s(I,V,$){var oe=I._events;if(void 0===oe)return[];var ue=oe[V];return void 0===ue?[]:"function"==typeof ue?$?[ue.listener||ue]:[ue]:$?function r(I){for(var V=Array(I.length),$=0;$I||z(I))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+I+".");k=I}}),b.init=function(){(void 0===this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},b.prototype.setMaxListeners=function(V){if("number"!=typeof V||0>V||z(V))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+V+".");return this._maxListeners=V,this},b.prototype.getMaxListeners=function(){return _(this)},b.prototype.emit=function(V){for(var $=[],oe=1;oeAe)return this;0===Ae?oe.shift():function t(I,V){for(;V+1{const u=null==s?new Blob(this.chunks):new Blob(this.chunks,{type:s});g(u),this.emit("blob",u)})}_write(g,h){this.chunks.push(g),h()}},BlobReadStream:function f(n,g={}){return b.from(n.stream(),g)}}},{"fast-readable-async-iterator":128,streamx:264}],126:[function(d,N,A){N.exports=class{constructor(b){if(!(0"u"||ReadableStream.prototype[Symbol.asyncIterator]||(ReadableStream.prototype[Symbol.asyncIterator]=function(){const f=this.getReader();let b=f.read();return{next(){const m=b;return b=f.read(),m},return(){b.then(()=>f.releaseLock())},throw(m){throw this.return(),m},[Symbol.asyncIterator](){return this}}})},{}],129:[function(d,N,A){N.exports=function(){if(typeof globalThis>"u")return null;var b={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return b.RTCPeerConnection?b:null}},{}],130:[function(d,N,A){"use strict";function b(g){_.call(this),this._block=m.allocUnsafe(g),this._blockSize=g,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}var m=d("safe-buffer").Buffer,_=d("readable-stream").Transform;d("inherits")(b,_),b.prototype._transform=function(g,h,s){var u=null;try{this.update(g,h)}catch(o){u=o}s(u)},b.prototype._flush=function(g){var h=null;try{this.push(this.digest())}catch(s){h=s}g(h)},b.prototype.update=function(g,h){if(function f(g,h){if(!m.isBuffer(g)&&"string"!=typeof g)throw new TypeError(h+" must be a string or a buffer")}(g,"Data"),this._finalized)throw new Error("Digest already called");m.isBuffer(g)||(g=m.from(g,h));for(var s=this._block,u=0;this._blockOffset+g.length-u>=this._blockSize;){for(var o=this._blockOffset;os;++s)this._length[s]=0;return h},b.prototype._digest=function(){throw new Error("_digest is not implemented")},N.exports=b},{inherits:147,"readable-stream":228,"safe-buffer":235}],131:[function(d,N,A){var f=A;f.utils=d("./hash/utils"),f.common=d("./hash/common"),f.sha=d("./hash/sha"),f.ripemd=d("./hash/ripemd"),f.hmac=d("./hash/hmac"),f.sha1=f.sha.sha1,f.sha256=f.sha.sha256,f.sha224=f.sha.sha224,f.sha384=f.sha.sha384,f.sha512=f.sha.sha512,f.ripemd160=f.ripemd.ripemd160},{"./hash/common":132,"./hash/hmac":133,"./hash/ripemd":134,"./hash/sha":135,"./hash/utils":142}],132:[function(d,N,A){"use strict";function f(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var b=d("./utils"),m=d("minimalistic-assert");A.BlockHash=f,f.prototype.update=function(n,g){if(n=b.toArray(n,g),this.pending=this.pending?this.pending.concat(n):n,this.pendingTotal+=n.length,this.pending.length>=this._delta8){var h=(n=this.pending).length%this._delta8;this.pending=n.slice(n.length-h,n.length),0===this.pending.length&&(this.pending=null),n=b.join32(n,0,n.length-h,this.endian);for(var s=0;s>>24,s[u++]=255&n>>>16,s[u++]=255&n>>>8,s[u++]=255&n}else for(s[u++]=255&n,s[u++]=255&n>>>8,s[u++]=255&n>>>16,s[u++]=255&n>>>24,s[u++]=0,s[u++]=0,s[u++]=0,s[u++]=0,o=8;othis.blockSize&&(n=(new this.Hash).update(n).digest()),m(n.length<=this.blockSize);for(var g=n.length;g=w?E^C^z:31>=w?E&C|~E&z:47>=w?(E|~C)^z:63>=w?E&z|C&~z:E^(C|~z)}function _(w){return 15>=w?1352829926:31>=w?1548603684:47>=w?1836072691:63>=w?2053994217:0}var n=d("./utils"),g=d("./common"),h=n.rotl32,s=n.sum32,u=n.sum32_3,o=n.sum32_4,t=g.BlockHash;n.inherits(f,t),A.ripemd160=f,f.blockSize=512,f.outSize=160,f.hmacStrength=192,f.padLength=64,f.prototype._update=function(E,C){for(var M,z=this.h[0],k=this.h[1],I=this.h[2],V=this.h[3],$=this.h[4],oe=z,ue=k,Ae=I,X=V,T=$,D=0;80>D;D++)M=s(h(o(z,b(D,k,I,V),E[r[D]+C],15>=(w=D)?0:31>=w?1518500249:47>=w?1859775393:63>=w?2400959708:2840853838),c[D]),$),z=$,$=V,V=h(I,10),I=k,k=M,M=s(h(o(oe,b(79-D,ue,Ae,X),E[a[D]+C],_(D)),l[D]),T),oe=T,T=X,X=h(Ae,10),Ae=ue,ue=M;var w;M=u(this.h[1],I,X),this.h[1]=u(this.h[2],V,T),this.h[2]=u(this.h[3],$,oe),this.h[3]=u(this.h[4],z,ue),this.h[4]=u(this.h[0],k,Ae),this.h[0]=M},f.prototype._digest=function(E){return"hex"===E?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var r=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],a=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],c=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],l=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},{"./common":132,"./utils":142}],135:[function(d,N,A){"use strict";A.sha1=d("./sha/1"),A.sha224=d("./sha/224"),A.sha256=d("./sha/256"),A.sha384=d("./sha/384"),A.sha512=d("./sha/512")},{"./sha/1":136,"./sha/224":137,"./sha/256":138,"./sha/384":139,"./sha/512":140}],136:[function(d,N,A){"use strict";function f(){return this instanceof f?(u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],void(this.W=Array(80))):new f}var b=d("../utils"),m=d("../common"),_=d("./common"),n=b.rotl32,g=b.sum32,h=b.sum32_5,s=_.ft_1,u=m.BlockHash,o=[1518500249,1859775393,2400959708,3395469782];b.inherits(f,u),N.exports=f,f.blockSize=512,f.outSize=160,f.hmacStrength=80,f.padLength=64,f.prototype._update=function(r,a){for(var c=this.W,l=0;16>l;l++)c[l]=r[a+l];for(;lI;I++)k[I]=C[z+I];for(;IL&&(L+=4294967296),L}function m(M,v,B,F,q,L){var Y=v&F^~v&L;return 0>Y&&(Y+=4294967296),Y}function _(M,v,B,F,q){var L=M&B^M&q^B&q;return 0>L&&(L+=4294967296),L}function n(M,v,B,F,q,L){var Y=v&F^v&L^F&L;return 0>Y&&(Y+=4294967296),Y}function g(M,v){var L=E(M,v,28)^E(v,M,2)^E(v,M,7);return 0>L&&(L+=4294967296),L}function h(M,v){var L=C(M,v,28)^C(v,M,2)^C(v,M,7);return 0>L&&(L+=4294967296),L}function s(M,v){var L=E(M,v,14)^E(M,v,18)^E(v,M,9);return 0>L&&(L+=4294967296),L}function u(M,v){var L=C(M,v,14)^C(M,v,18)^C(v,M,9);return 0>L&&(L+=4294967296),L}function o(M,v){var L=E(M,v,1)^E(M,v,8)^z(M,v,7);return 0>L&&(L+=4294967296),L}function t(M,v){var L=C(M,v,1)^C(M,v,8)^k(M,v,7);return 0>L&&(L+=4294967296),L}function r(M,v){var L=E(M,v,19)^E(v,M,29)^z(M,v,6);return 0>L&&(L+=4294967296),L}function a(M,v){var L=C(M,v,19)^C(v,M,29)^k(M,v,6);return 0>L&&(L+=4294967296),L}var c=d("../utils"),l=d("../common"),w=d("minimalistic-assert"),E=c.rotr64_hi,C=c.rotr64_lo,z=c.shr64_hi,k=c.shr64_lo,I=c.sum64,V=c.sum64_hi,$=c.sum64_lo,oe=c.sum64_4_hi,ue=c.sum64_4_lo,Ae=c.sum64_5_hi,X=c.sum64_5_lo,T=l.BlockHash,D=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];c.inherits(f,T),N.exports=f,f.blockSize=1024,f.outSize=512,f.hmacStrength=192,f.padLength=128,f.prototype._prepareBlock=function(v,B){for(var F=this.W,q=0;32>q;q++)F[q]=v[B+q];for(;q>>3},A.g1_256=function s(t){return o(t,17)^o(t,19)^t>>>10}},{"../utils":142}],142:[function(d,N,A){"use strict";function f(D,M){return 55296==(64512&D.charCodeAt(M))&&!(0>M||M+1>=D.length)&&56320==(64512&D.charCodeAt(M+1))}function _(D){return(D>>>24|65280&D>>>8|16711680&D<<8|(255&D)<<24)>>>0}function g(D){return 1===D.length?"0"+D:D}function h(D){return 7===D.length?"0"+D:6===D.length?"00"+D:5===D.length?"000"+D:4===D.length?"0000"+D:3===D.length?"00000"+D:2===D.length?"000000"+D:1===D.length?"0000000"+D:D}var X=d("minimalistic-assert"),T=d("inherits");A.inherits=T,A.toArray=function b(D,M){if(Array.isArray(D))return D.slice();if(!D)return[];var v=[];if("string"!=typeof D)for(F=0;F(q=D.charCodeAt(F))?v[B++]=q:2048>q?(v[B++]=192|q>>6,v[B++]=128|63&q):f(D,F)?(q=65536+((1023&q)<<10)+(1023&D.charCodeAt(++F)),v[B++]=240|q>>18,v[B++]=128|63&q>>12,v[B++]=128|63&q>>6,v[B++]=128|63&q):(v[B++]=224|q>>12,v[B++]=128|63&q>>6,v[B++]=128|63&q);return v},A.toHex=function m(D){for(var M="",v=0;v>>0;return q},A.split32=function u(D,M){for(var q,v=Array(4*D.length),B=0,F=0;B>>24,v[F+1]=255&q>>>16,v[F+2]=255&q>>>8,v[F+3]=255&q):(v[F+3]=q>>>24,v[F+2]=255&q>>>16,v[F+1]=255&q>>>8,v[F]=255&q);return v},A.rotr32=function o(D,M){return D>>>M|D<<32-M},A.rotl32=function t(D,M){return D<>>32-M},A.sum32=function r(D,M){return D+M>>>0},A.sum32_3=function a(D,M,v){return D+M+v>>>0},A.sum32_4=function c(D,M,v,B){return D+M+v+B>>>0},A.sum32_5=function l(D,M,v,B,F){return D+M+v+B+F>>>0},A.sum64=function w(D,M,v,B){var L=B+D[M+1]>>>0;D[M]=(L>>0,D[M+1]=L},A.sum64_hi=function E(D,M,v,B){return(M+B>>>0>>0},A.sum64_lo=function C(D,M,v,B){return M+B>>>0},A.sum64_4_hi=function z(D,M,v,B,F,q,L,Y){var se=0,Ee=M;return se+=(Ee=Ee+B>>>0)>>0)>>0)>>0},A.sum64_4_lo=function k(D,M,v,B,F,q,L,Y){return M+B+q+Y>>>0},A.sum64_5_hi=function I(D,M,v,B,F,q,L,Y,se,Ee){var Se=0,Ie=M;return Se+=(Ie=Ie+B>>>0)>>0)>>0)>>0)>>0},A.sum64_5_lo=function V(D,M,v,B,F,q,L,Y,se,Ee){return M+B+q+Y+Ee>>>0},A.rotr64_hi=function $(D,M,v){return(M<<32-v|D>>>v)>>>0},A.rotr64_lo=function oe(D,M,v){return(D<<32-v|M>>>v)>>>0},A.shr64_hi=function ue(D,M,v){return D>>>v},A.shr64_lo=function Ae(D,M,v){return(D<<32-v|M>>>v)>>>0}},{inherits:147,"minimalistic-assert":168}],143:[function(d,N,A){"use strict";function f(n){if(!(this instanceof f))return new f(n);this.hash=n.hash,this.predResist=!!n.predResist,this.outLen=this.hash.outSize,this.minEntropy=n.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var g=m.toArray(n.entropy,n.entropyEnc||"hex"),h=m.toArray(n.nonce,n.nonceEnc||"hex"),s=m.toArray(n.pers,n.persEnc||"hex");_(g.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(g,h,s)}var b=d("hash.js"),m=d("minimalistic-crypto-utils"),_=d("minimalistic-assert");N.exports=f,f.prototype._init=function(g,h,s){var u=g.concat(h).concat(s);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(g.concat(s||[])),this._reseed=1},f.prototype.generate=function(g,h,s,u){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof h&&(u=s,s=h,h=null),s&&(s=m.toArray(s,u||"hex"),this._update(s));for(var o=[];o.length>1,u=-7,o=m?n-1:0,t=m?-1:1,r=f[b+o];for(o+=t,a=r&(1<<-u)-1,r>>=-u,u+=g;0>=-u,u+=_;0>1,o=23===n?H(2,-24)-H(2,-77):0,t=_?0:g-1,r=_?1:-1,a=0>b||0===b&&0>1/b?1:0;for(b=At(b),isNaN(b)||b===1/0?(l=isNaN(b)?1:0,c=s):(c=xt(gn(b)/Gt),1>b*(w=H(2,-c))&&(c--,w*=2),2<=(b+=1<=c+u?o/w:o*H(2,1-u))*w&&(c++,w/=2),c+u>=s?(l=0,c=s):1<=c+u?(l=(b*w-1)*H(2,n),c+=u):(l=b*H(2,u-1)*H(2,n),c=0));8<=n;f[m+t]=255&l,t+=r,l/=256,n-=8);for(c=c<{})){this.mem[_]=n,this.store.put(_,n,h=>{this.mem[_]=null,g(h)})}get(_,n,g=(()=>{})){if("function"==typeof n)return this.get(_,null,n);let h=this.mem[_];if(!h)return this.store.get(_,n,g);n||(n={});const s=n.offset||0,u=n.length||h.length-s;(0!==s||u!==h.length)&&(h=h.slice(s,u+s)),f(()=>g(null,h))}close(_=(()=>{})){this.store.close(_)}destroy(_=(()=>{})){this.store.destroy(_)}}},{"queue-microtask":206}],147:[function(d,N,A){N.exports="function"==typeof Object.create?function(b,m){m&&(b.super_=m,b.prototype=Object.create(m.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}))}:function(b,m){if(m){b.super_=m;var _=function(){};_.prototype=m.prototype,b.prototype=new _,b.prototype.constructor=b}}},{}],148:[function(d,N,A){N.exports=function(m){for(var _=0,n=m.length;_127)return!1;return!0}},{}],149:[function(d,N,A){function f(m){return!!m.constructor&&"function"==typeof m.constructor.isBuffer&&m.constructor.isBuffer(m)}N.exports=function(m){return null!=m&&(f(m)||function b(m){return"function"==typeof m.readFloatLE&&"function"==typeof m.slice&&f(m.slice(0,0))}(m)||!!m._isBuffer)}},{}],150:[function(d,N,A){N.exports=async function*(f){for(let b of f)"function"==typeof b&&(b=b()),yield*b}},{}],151:[function(d,N,A){"use strict";A.re=()=>{throw new Error("`junk.re` was renamed to `junk.regex`")},A.regex=new RegExp(["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^Desktop\\.ini$","@eaDir$"].join("|")),A.is=b=>A.regex.test(b),A.not=b=>!A.is(b),A.default=N.exports},{}],152:[function(d,N,A){A.RateLimiter=d("./lib/rateLimiter"),A.TokenBucket=d("./lib/tokenBucket")},{"./lib/rateLimiter":154,"./lib/tokenBucket":155}],153:[function(d,N,A){(function(f){(function(){N.exports=function(){if(typeof f<"u"&&f.hrtime){var m=f.hrtime();return 1e3*m[0]+xt(m[1]/1e6)}return(new Date).getTime()}}).call(this)}).call(this,d("_process"))},{_process:193}],154:[function(d,N,A){(function(f){(function(){var b=d("./tokenBucket"),m=d("./clock"),_=function(n,g,h){this.tokenBucket=new b(n,n,g,null),this.tokenBucket.content=n,this.curIntervalStart=m(),this.tokensThisInterval=0,this.fireImmediately=h};_.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(n,g){function h(t,r){return t?g(t,null):(s.tokensThisInterval+=n,void g(null,r))}if(n>this.tokenBucket.bucketSize)return f.nextTick(g.bind(null,"Requested tokens "+n+" exceeds maximum tokens per interval "+this.tokenBucket.bucketSize,null)),!1;var s=this,u=m();if((u=this.tokenBucket.interval)&&(this.curIntervalStart=u,this.tokensThisInterval=0),n>this.tokenBucket.tokensPerInterval-this.tokensThisInterval){if(this.fireImmediately)f.nextTick(g.bind(null,null,-1));else{var o=_e(this.curIntervalStart+this.tokenBucket.interval-u);setTimeout(function(){s.tokenBucket.removeTokens(n,h)},o)}return!1}return this.tokenBucket.removeTokens(n,h)},tryRemoveTokens:function(n){if(n>this.tokenBucket.bucketSize)return!1;var g=m();if((g=this.tokenBucket.interval)&&(this.curIntervalStart=g,this.tokensThisInterval=0),n>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var h=this.tokenBucket.tryRemoveTokens(n);return h&&(this.tokensThisInterval+=n),h},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}},N.exports=_}).call(this)}).call(this,d("_process"))},{"./clock":153,"./tokenBucket":155,_process:193}],155:[function(d,N,A){(function(f){(function(){var b=function(m,_,n,g){if(this.bucketSize=m,this.tokensPerInterval=_,"string"==typeof n)switch(n){case"sec":case"second":this.interval=1e3;break;case"min":case"minute":this.interval=6e4;break;case"hr":case"hour":this.interval=36e5;break;case"day":this.interval=864e5;break;default:throw new Error("Invaid interval "+n)}else this.interval=n;this.parentBucket=g,this.content=0,this.lastDrip=+new Date};b.prototype={bucketSize:1,tokensPerInterval:1,interval:1e3,parentBucket:null,content:0,lastDrip:0,removeTokens:function(m,_){function n(){var h=_e(g.interval/g.tokensPerInterval*(m-g.content));return setTimeout(function(){g.removeTokens(m,_)},h),!1}var g=this;return this.bucketSize?m>this.bucketSize?(f.nextTick(_.bind(null,"Requested tokens "+m+" exceeds bucket size "+this.bucketSize,null)),!1):(this.drip(),m>this.content?n():this.parentBucket?this.parentBucket.removeTokens(m,function(h,s){return h?_(h,null):m>g.content?n():(g.content-=m,void _(null,ne(s,g.content)))}):(this.content-=m,f.nextTick(_.bind(null,null,this.content)),!0)):(f.nextTick(_.bind(null,null,m,Number.POSITIVE_INFINITY)),!0)},tryRemoveTokens:function(m){return!this.bucketSize||!(m>this.bucketSize)&&(this.drip(),!(m>this.content))&&(!this.parentBucket||this.parentBucket.tryRemoveTokens(m))&&(this.content-=m,!0)},drip:function(){if(this.tokensPerInterval){var m=+new Date,_=pe(m-this.lastDrip,0);this.lastDrip=m,this.content=ne(this.content+_*(this.tokensPerInterval/this.interval),this.bucketSize)}else this.content=this.bucketSize}},N.exports=b}).call(this)}).call(this,d("_process"))},{_process:193}],156:[function(d,N,A){function f(_){return this instanceof f?("number"==typeof _&&(_={max:_}),!_&&(_={}),b.EventEmitter.call(this),this.cache={},this.head=this.tail=null,this.length=0,this.max=_.max||1e3,void(this.maxAge=_.maxAge||0)):new f(_)}var b=d("events"),m=d("inherits");N.exports=f,m(f,b.EventEmitter),Object.defineProperty(f.prototype,"keys",{get:function(){return Object.keys(this.cache)}}),f.prototype.clear=function(){this.cache={},this.head=this.tail=null,this.length=0},f.prototype.remove=function(_){if("string"!=typeof _&&(_=""+_),this.cache.hasOwnProperty(_)){var n=this.cache[_];return delete this.cache[_],this._unlink(_,n.prev,n.next),n.value}},f.prototype._unlink=function(_,n,g){this.length--,0===this.length?this.head=this.tail=null:this.head===_?(this.head=n,this.cache[this.head].next=null):this.tail===_?(this.tail=g,this.cache[this.tail].prev=null):(this.cache[n].next=g,this.cache[g].prev=n)},f.prototype.peek=function(_){if(this.cache.hasOwnProperty(_)){var n=this.cache[_];return this._checkAge(_,n)?n.value:void 0}},f.prototype.set=function(_,n){var g;if("string"!=typeof _&&(_=""+_),this.cache.hasOwnProperty(_)){if((g=this.cache[_]).value=n,this.maxAge&&(g.modified=Date.now()),_===this.head)return n;this._unlink(_,g.prev,g.next)}else g={value:n,modified:0,next:null,prev:null},this.maxAge&&(g.modified=Date.now()),this.cache[_]=g,this.length===this.max&&this.evict();return this.length++,g.next=null,g.prev=this.head,this.head&&(this.cache[this.head].next=_),this.head=_,this.tail||(this.tail=_),n},f.prototype._checkAge=function(_,n){return!(this.maxAge&&Date.now()-n.modified>this.maxAge&&(this.remove(_),this.emit("evict",{key:_,value:n.value}),1))},f.prototype.get=function(_){if("string"!=typeof _&&(_=""+_),this.cache.hasOwnProperty(_)){var n=this.cache[_];if(this._checkAge(_,n))return this.head!==_&&(_===this.tail?(this.tail=n.next,this.cache[this.tail].prev=null):this.cache[n.prev].next=n.next,this.cache[n.next].prev=n.prev,this.cache[this.head].next=_,n.prev=this.head,n.next=null,this.head=_),n.value}},f.prototype.evict=function(){if(this.tail){var _=this.tail,n=this.remove(this.tail);this.emit("evict",{key:_,value:n})}}},{events:123,inherits:147}],157:[function(d,N,A){(function(f){(function(){const b=d("unordered-array-remove"),{EventEmitter:m}=d("events"),_=d("debug")("lt_donthave");N.exports=()=>{class n extends m{constructor(h){super(),this._peerSupports=!1,this._wire=h}onExtendedHandshake(){this._peerSupports=!0}onMessage(h){let s;try{s=h.readUInt32BE()}catch{return}this._wire.peerPieces.get(s)&&(_("got donthave %d",s),this._wire.peerPieces.set(s,!1),this.emit("donthave",s),this._failRequests(s))}donthave(h){if(this._peerSupports){_("donthave %d",h);const s=f.alloc(4);s.writeUInt32BE(h),this._wire.extended("lt_donthave",s)}}_failRequests(h){const s=this._wire.requests;for(let u=0;u{const r=t.split("=");if(2!==r.length)return;const a=r[0];let c=r[1];"dn"===a&&(c=decodeURIComponent(c).replace(/\+/g," ")),("tr"===a||"xs"===a||"as"===a||"ws"===a)&&(c=decodeURIComponent(c)),"kt"===a&&(c=decodeURIComponent(c).split("+")),"ix"===a&&(c=+c),"so"===a&&(c=n.parse(decodeURIComponent(c).split(","))),h[a]?(!Array.isArray(h[a])&&(h[a]=[h[a]]),h[a].push(c)):h[a]=c}),h.xt&&(Array.isArray(h.xt)?h.xt:[h.xt]).forEach(r=>{if(o=r.match(/^urn:btih:(.{40})/))h.infoHash=o[1].toLowerCase();else if(o=r.match(/^urn:btih:(.{32})/)){const a=_.decode(o[1]);h.infoHash=f.from(a,"binary").toString("hex")}else(o=r.match(/^urn:btmh:1220(.{64})/))&&(h.infoHashV2=o[1].toLowerCase())}),h.xs&&(Array.isArray(h.xs)?h.xs:[h.xs]).forEach(r=>{(o=r.match(/^urn:btpk:(.{64})/))&&(h.publicKey=o[1].toLowerCase())}),h.infoHash&&(h.infoHashBuffer=f.from(h.infoHash,"hex")),h.infoHashV2&&(h.infoHashV2Buffer=f.from(h.infoHashV2,"hex")),h.publicKey&&(h.publicKeyBuffer=f.from(h.publicKey,"hex")),h.dn&&(h.name=h.dn),h.kt&&(h.keywords=h.kt),h.announce=[],("string"==typeof h.tr||Array.isArray(h.tr))&&(h.announce=h.announce.concat(h.tr)),h.urlList=[],("string"==typeof h.as||Array.isArray(h.as))&&(h.urlList=h.urlList.concat(h.as)),("string"==typeof h.ws||Array.isArray(h.ws))&&(h.urlList=h.urlList.concat(h.ws)),h.peerAddresses=[],("string"==typeof h["x.pe"]||Array.isArray(h["x.pe"]))&&(h.peerAddresses=h.peerAddresses.concat(h["x.pe"])),h.announce=Array.from(new Set(h.announce)),h.urlList=Array.from(new Set(h.urlList)),h.peerAddresses=Array.from(new Set(h.peerAddresses)),h}N.exports=b,N.exports.decode=b,N.exports.encode=function m(g){g=Object.assign({},g);let h=new Set;g.xt&&"string"==typeof g.xt&&h.add(g.xt),g.xt&&Array.isArray(g.xt)&&(h=new Set(g.xt)),g.infoHashBuffer&&h.add(`urn:btih:${g.infoHashBuffer.toString("hex")}`),g.infoHash&&h.add(`urn:btih:${g.infoHash}`),g.infoHashV2Buffer&&h.add(g.xt=`urn:btmh:1220${g.infoHashV2Buffer.toString("hex")}`),g.infoHashV2&&h.add(`urn:btmh:1220${g.infoHashV2}`);const s=Array.from(h);1===s.length&&(g.xt=s[0]),12===o.length||"x.pe"===o).forEach((o,t)=>{const r=Array.isArray(g[o])?g[o]:[g[o]];r.forEach((a,c)=>{(0>>32-r}function m(t,r,a,c,l,w,E){return 0|b(0|t+(r&a|~r&c)+l+w,E)+r}function _(t,r,a,c,l,w,E){return 0|b(0|t+(r&c|a&~c)+l+w,E)+r}function n(t,r,a,c,l,w,E){return 0|b(0|t+(r^a^c)+l+w,E)+r}function g(t,r,a,c,l,w,E){return 0|b(0|t+(a^(r|~c))+l+w,E)+r}var h=d("inherits"),s=d("hash-base"),u=d("safe-buffer").Buffer,o=Array(16);h(f,s),f.prototype._update=function(){for(var t=o,r=0;16>r;++r)t[r]=this._block.readInt32LE(4*r);var a=this._a,c=this._b,l=this._c,w=this._d;a=m(a,c,l,w,t[0],3614090360,7),w=m(w,a,c,l,t[1],3905402710,12),l=m(l,w,a,c,t[2],606105819,17),c=m(c,l,w,a,t[3],3250441966,22),a=m(a,c,l,w,t[4],4118548399,7),w=m(w,a,c,l,t[5],1200080426,12),l=m(l,w,a,c,t[6],2821735955,17),c=m(c,l,w,a,t[7],4249261313,22),a=m(a,c,l,w,t[8],1770035416,7),w=m(w,a,c,l,t[9],2336552879,12),l=m(l,w,a,c,t[10],4294925233,17),c=m(c,l,w,a,t[11],2304563134,22),a=m(a,c,l,w,t[12],1804603682,7),w=m(w,a,c,l,t[13],4254626195,12),l=m(l,w,a,c,t[14],2792965006,17),a=_(a,c=m(c,l,w,a,t[15],1236535329,22),l,w,t[1],4129170786,5),w=_(w,a,c,l,t[6],3225465664,9),l=_(l,w,a,c,t[11],643717713,14),c=_(c,l,w,a,t[0],3921069994,20),a=_(a,c,l,w,t[5],3593408605,5),w=_(w,a,c,l,t[10],38016083,9),l=_(l,w,a,c,t[15],3634488961,14),c=_(c,l,w,a,t[4],3889429448,20),a=_(a,c,l,w,t[9],568446438,5),w=_(w,a,c,l,t[14],3275163606,9),l=_(l,w,a,c,t[3],4107603335,14),c=_(c,l,w,a,t[8],1163531501,20),a=_(a,c,l,w,t[13],2850285829,5),w=_(w,a,c,l,t[2],4243563512,9),l=_(l,w,a,c,t[7],1735328473,14),a=n(a,c=_(c,l,w,a,t[12],2368359562,20),l,w,t[5],4294588738,4),w=n(w,a,c,l,t[8],2272392833,11),l=n(l,w,a,c,t[11],1839030562,16),c=n(c,l,w,a,t[14],4259657740,23),a=n(a,c,l,w,t[1],2763975236,4),w=n(w,a,c,l,t[4],1272893353,11),l=n(l,w,a,c,t[7],4139469664,16),c=n(c,l,w,a,t[10],3200236656,23),a=n(a,c,l,w,t[13],681279174,4),w=n(w,a,c,l,t[0],3936430074,11),l=n(l,w,a,c,t[3],3572445317,16),c=n(c,l,w,a,t[6],76029189,23),a=n(a,c,l,w,t[9],3654602809,4),w=n(w,a,c,l,t[12],3873151461,11),l=n(l,w,a,c,t[15],530742520,16),a=g(a,c=n(c,l,w,a,t[2],3299628645,23),l,w,t[0],4096336452,6),w=g(w,a,c,l,t[7],1126891415,10),l=g(l,w,a,c,t[14],2878612391,15),c=g(c,l,w,a,t[5],4237533241,21),a=g(a,c,l,w,t[12],1700485571,6),w=g(w,a,c,l,t[3],2399980690,10),l=g(l,w,a,c,t[10],4293915773,15),c=g(c,l,w,a,t[1],2240044497,21),a=g(a,c,l,w,t[8],1873313359,6),w=g(w,a,c,l,t[15],4264355552,10),l=g(l,w,a,c,t[6],2734768916,15),c=g(c,l,w,a,t[13],1309151649,21),a=g(a,c,l,w,t[4],4149444226,6),w=g(w,a,c,l,t[11],3174756917,10),l=g(l,w,a,c,t[2],718787259,15),c=g(c,l,w,a,t[9],3951481745,21),this._a=0|this._a+a,this._b=0|this._b+c,this._c=0|this._c+l,this._d=0|this._d+w},f.prototype._digest=function(){this._block[this._blockOffset++]=128,56o._bufferDuration)&&o._cb){var t=o._cb;o._cb=null,t()}},b.prototype._getBufferDuration=function(){for(var t=this._sourceBuffer.buffered,r=this._elem.currentTime,a=-1,c=0;cr)break;(0<=a||r<=w)&&(a=w)}var E=a-r;return 0>E&&(E=0),E}},{inherits:147,"readable-stream":228,"to-arraybuffer":269}],161:[function(d,N,A){function f(m,_){if(!(this instanceof f))return new f(m,_);if(_||(_={}),this.chunkLength=+m,!this.chunkLength)throw new Error("First argument must be a chunk length");this.chunks=[],this.closed=!1,this.length=+_.length||1/0,this.length!==1/0&&(this.lastChunkLength=this.length%this.chunkLength||this.chunkLength,this.lastChunkIndex=_e(this.length/this.chunkLength)-1)}N.exports=f;const b=d("queue-microtask");f.prototype.put=function(m,_,n=(()=>{})){if(this.closed)return b(()=>n(new Error("Storage is closed")));const g=m===this.lastChunkIndex;return g&&_.length!==this.lastChunkLength?b(()=>n(new Error("Last chunk length must be "+this.lastChunkLength))):g||_.length===this.chunkLength?(this.chunks[m]=_,void b(()=>n(null))):b(()=>n(new Error("Chunk length must be "+this.chunkLength)))},f.prototype.get=function(m,_,n=(()=>{})){if("function"==typeof _)return this.get(m,null,_);if(this.closed)return b(()=>n(new Error("Storage is closed")));let g=this.chunks[m];if(!g){const u=new Error("Chunk not found");return u.notFound=!0,b(()=>n(u))}_||(_={});const h=_.offset||0,s=_.length||g.length-h;(0!==h||s!==g.length)&&(g=g.slice(h,s+h)),b(()=>n(null,g))},f.prototype.close=f.prototype.destroy=function(m=(()=>{})){return this.closed?b(()=>m(new Error("Storage is closed"))):(this.closed=!0,this.chunks=null,void b(()=>m(null)))}},{"queue-microtask":206}],162:[function(d,N,A){function f(_){this.rand=_||new m.Rand}var b=d("bn.js"),m=d("brorand");N.exports=f,f.create=function(n){return new f(n)},f.prototype._randbelow=function(n){var g=n.bitLength(),h=_e(g/8);do{var s=new b(this.rand.generate(h))}while(0<=s.cmp(n));return s},f.prototype._randrange=function(n,g){var h=g.sub(n);return n.add(this._randbelow(h))},f.prototype.test=function(n,g,h){var s=n.bitLength(),u=b.mont(n),o=new b(1).toRed(u);g||(g=pe(1,0|s/48));for(var t=n.subn(1),r=0;!t.testn(r);r++);for(var a=n.shrn(r),c=t.toRed(u);0>8,t=255&u;o?h.push(o,t):h.push(t)}return h},_.zero2=b,_.toHex=m,_.encode=function(g,h){return"hex"===h?m(g):g}},{}],170:[function(d,N,A){(function(f){(function(){function b(k,I,V){for(var $=I;$>3:0,D=null;return Ae&&(D=Ae.toString(16),T&&(D+="."+T)),{mimeCodec:D,buffer:f.from(k.slice(0))}},A.esds.encodingLength=function(k){return k.buffer.length},A.stsz={},A.stsz.encode=function(k,I,V){var $=k.entries||[];(I=I?I.slice(V):f.alloc(A.stsz.encodingLength(k))).writeUInt32BE(0,0),I.writeUInt32BE($.length,4);for(var oe=0;oe<$.length;oe++)I.writeUInt32BE($[oe],4*oe+8);return A.stsz.encode.bytes=8+4*$.length,I},A.stsz.decode=function(k,I){for(var V=(k=k.slice(I)).readUInt32BE(0),$=k.readUInt32BE(4),oe=Array($),ue=0;ue<$;ue++)oe[ue]=0===V?k.readUInt32BE(4*ue+8):V;return{entries:oe}},A.stsz.encodingLength=function(k){return 8+4*k.entries.length},A.stss=A.stco={},A.stco.encode=function(k,I,V){var $=k.entries||[];(I=I?I.slice(V):f.alloc(A.stco.encodingLength(k))).writeUInt32BE($.length,0);for(var oe=0;oe<$.length;oe++)I.writeUInt32BE($[oe],4*oe+4);return A.stco.encode.bytes=4+4*$.length,I},A.stco.decode=function(k,I){for(var V=(k=k.slice(I)).readUInt32BE(0),$=Array(V),oe=0;oe_&&(t=1),s.writeUInt32BE(t,u),s.write(h.type,u+4,4,"ascii");var r=u+8;if(1===t&&(b.encode(h.length,s,r),r+=8),m.fullBoxes[o]&&(s.writeUInt32BE(h.flags||0,r),s.writeUInt8(h.version||0,r),r+=4),g[o])g[o].forEach(function(w){if(5===w.length){var E=h[w]||[];w=w.substr(0,4),E.forEach(function(C){n._encode(C,s,r),r+=n.encode.bytes})}else h[w]&&(n._encode(h[w],s,r),r+=n.encode.bytes)}),h.otherBoxes&&h.otherBoxes.forEach(function(w){n._encode(w,s,r),r+=n.encode.bytes});else if(m[o]){var c=m[o].encode;c(h,s,r),r+=c.bytes}else{if(!h.buffer)throw new Error("Either `type` must be set to a known type (not'"+o+"') or `buffer` must be set");h.buffer.copy(s,r),r+=h.buffer.length}return n.encode.bytes=r-u,s},n.readHeaders=function(h,s,u){if(8>(u=u||h.length)-(s=s||0))return 8;var a,c,o=h.readUInt32BE(s),t=h.toString("ascii",s+4,s+8),r=s+8;if(1===o){if(16>u-s)return 16;o=b.decode(h,r),r+=8}return m.fullBoxes[t]&&(a=h.readUInt8(r),c=16777215&h.readUInt32BE(r),r+=4),{length:o,headersLen:r-s,contentLen:o-(r-s),type:t,version:a,flags:c}},n.decode=function(h,s,u){var o=n.readHeaders(h,s=s||0,u=u||h.length);if(!o||o.length>u-s)throw new Error("Data too short");return n.decodeWithoutHeaders(o,h,s+o.headersLen,s+o.length)},n.decodeWithoutHeaders=function(h,s,u,o){u=u||0,o=o||s.length;var t=h.type,r={};if(g[t]){r.otherBoxes=[];for(var l,a=g[t],c=u;8<=o-c;)if(c+=(l=n.decode(s,c,o)).length,0<=a.indexOf(l.type))r[l.type]=l;else if(0<=a.indexOf(l.type+"s")){var w=l.type+"s";(r[w]=r[w]||[]).push(l)}else r.otherBoxes.push(l)}else m[t]?r=(0,m[t].decode)(s,u,o):r.buffer=f.from(s.slice(u,o));return r.length=h.length,r.contentLen=h.contentLen,r.type=h.type,r.version=h.version,r.flags=h.flags,r},n.encodingLength=function(h){var s=h.type,u=8;if(m.fullBoxes[s]&&(u+=4),g[s])g[s].forEach(function(t){if(5===t.length){var r=h[t]||[];t=t.substr(0,4),r.forEach(function(c){c.type=t,u+=n.encodingLength(c)})}else if(h[t]){var a=h[t];a.type=t,u+=n.encodingLength(a)}}),h.otherBoxes&&h.otherBoxes.forEach(function(t){u+=n.encodingLength(t)});else if(m[s])u+=m[s].encodingLength(h);else{if(!h.buffer)throw new Error("Either `type` must be set to a known type (not'"+s+"') or `buffer` must be set");u+=h.buffer.length}return u>_&&(u+=8),h.length=u,u}}).call(this)}).call(this,d("buffer").Buffer)},{"./boxes":170,buffer:76,uint64be:272}],173:[function(d,N,A){(function(f){(function(){var b=d("readable-stream"),m=d("next-event"),_=d("mp4-box-encoding"),n=f.alloc(0);class h extends b.PassThrough{constructor(u){super(),this._parent=u,this.destroyed=!1}destroy(u){this.destroyed||(this.destroyed=!0,this._parent.destroy(u),u&&this.emit("error",u),this.emit("close"))}}N.exports=class g extends b.Writable{constructor(u){super(u),this.destroyed=!1,this._pending=0,this._missing=0,this._ignoreEmpty=!1,this._buf=null,this._str=null,this._cb=null,this._ondrain=null,this._writeBuffer=null,this._writeCb=null,this._ondrain=null,this._kick()}destroy(u){this.destroyed||(this.destroyed=!0,u&&this.emit("error",u),this.emit("close"))}_write(u,o,t){if(!this.destroyed){for(var r=!this._str||!this._str._writableState.needDrain;u.length&&!this.destroyed;){if(!this._missing&&!this._ignoreEmpty)return this._writeBuffer=u,void(this._writeCb=t);var a=u.length{this._pending--,this._kick()}),this._cb=o,this._str}_readBox(){const u=(o,t)=>{this._buffer(o,r=>{t=t?f.concat([t,r]):r;var a=_.readHeaders(t);"number"==typeof a?u(a-t.length,t):(this._pending++,this._headers=a,this.emit("box",a))})};u(8)}stream(){if(!this._headers)throw new Error("this function can only be called once after 'box' is emitted");var u=this._headers;return this._headers=null,this._stream(u.contentLen,()=>{this._pending--,this._kick()})}decode(u){if(!this._headers)throw new Error("this function can only be called once after 'box' is emitted");var o=this._headers;this._headers=null,this._buffer(o.contentLen,t=>{var r=_.decodeWithoutHeaders(o,t);u(r),this._pending--,this._kick()})}ignore(){if(!this._headers)throw new Error("this function can only be called once after 'box' is emitted");var u=this._headers;this._headers=null,this._missing=u.contentLen,0===this._missing&&(this._ignoreEmpty=!0),this._cb=()=>{this._pending--,this._kick()}}_kick(){if(!this._pending&&(this._buf||this._str||this._readBox(),this._writeBuffer)){var u=this._writeCb,o=this._writeBuffer;this._writeBuffer=null,this._writeCb=null,this._write(o,null,u)}}}}).call(this)}).call(this,d("buffer").Buffer)},{buffer:76,"mp4-box-encoding":172,"next-event":177,"readable-stream":228}],174:[function(d,N,A){(function(f){(function(){function b(){}var m=d("readable-stream"),_=d("mp4-box-encoding"),n=d("queue-microtask");class h extends m.PassThrough{constructor(u){super(),this._parent=u,this.destroyed=!1}destroy(u){this.destroyed||(this.destroyed=!0,this._parent.destroy(u),u&&this.emit("error",u),this.emit("close"))}}N.exports=class g extends m.Readable{constructor(u){super(u),this.destroyed=!1,this._finalized=!1,this._reading=!1,this._stream=null,this._drain=null,this._want=!1,this._onreadable=()=>{this._want&&(this._want=!1,this._read())},this._onend=()=>{this._stream=null}}mdat(u,o){this.mediaData(u,o)}mediaData(u,o){var t=new h(this);return this.box({type:"mdat",contentLength:u,encodeBufferLen:8,stream:t},o),t}box(u,o){if(o||(o=b),this.destroyed)return o(new Error("Encoder is destroyed"));var t;if(u.encodeBufferLen&&(t=f.alloc(u.encodeBufferLen)),u.stream)u.buffer=null,t=_.encode(u,t),this.push(t),this._stream=u.stream,this._stream.on("readable",this._onreadable),this._stream.on("end",this._onend),this._stream.on("end",o),this._forward();else{if(t=_.encode(u,t),this.push(t))return n(o);this._drain=o}}destroy(u){if(!this.destroyed){if(this.destroyed=!0,this._stream&&this._stream.destroy&&this._stream.destroy(),this._stream=null,this._drain){var o=this._drain;this._drain=null,o(u)}u&&this.emit("error",u),this.emit("close")}}finalize(){this._finalized=!0,this._stream||this._drain||this.push(null)}_forward(){if(this._stream)for(;!this.destroyed;){var u=this._stream.read();if(!u)return void(this._want=!!this._stream);if(!this.push(u))return}}_read(){if(!this._reading&&!this.destroyed){if(this._reading=!0,this._stream&&this._forward(),this._drain){var u=this._drain;this._drain=null,u()}this._reading=!1,this._finalized&&this.push(null)}}}}).call(this)}).call(this,d("buffer").Buffer)},{buffer:76,"mp4-box-encoding":172,"queue-microtask":206,"readable-stream":228}],175:[function(d,N,A){const f=d("./decode"),b=d("./encode");A.decode=m=>new f(m),A.encode=m=>new b(m)},{"./decode":173,"./encode":174}],176:[function(d,N,A){function _(t,r,a,c){var l=r>=1.5*a;return kt(t/a)+" "+c+(l?"s":"")}N.exports=function(t,r){r=r||{};var a=typeof t;if("string"==a&&0{u("number"==typeof V.length,"info.files[0].length"),u(V["path.utf-8"]||V.path,"info.files[0].path")}):u("number"==typeof C.info.length,"info.length");const z={info:C.info,infoBuffer:o.encode(C.info),name:(C.info["name.utf-8"]||C.info.name).toString(),announce:[]};z.infoHash=w.sync(z.infoBuffer),z.infoHashBuffer=f.from(z.infoHash,"hex"),void 0!==C.info.private&&(z.private=!!C.info.private),C["creation date"]&&(z.created=new Date(1e3*C["creation date"])),C["created by"]&&(z.createdBy=C["created by"].toString()),f.isBuffer(C.comment)&&(z.comment=C.comment.toString()),Array.isArray(C["announce-list"])&&0{V.forEach($=>{z.announce.push($.toString())})}):C.announce&&z.announce.push(C.announce.toString()),f.isBuffer(C["url-list"])&&(C["url-list"]=0V.toString()),z.announce=Array.from(new Set(z.announce)),z.urlList=Array.from(new Set(z.urlList));const k=C.info.files||[C.info];z.files=k.map((V,$)=>{const oe=[].concat(z.name,V["path.utf-8"]||V.path||[]).map(ue=>ue.toString());return{path:l.join.apply(null,[l.sep].concat(oe)).slice(1),name:oe[oe.length-1],length:V.length,offset:k.slice(0,$).reduce(h,0)}}),z.length=k.reduce(h,0);const I=z.files[z.files.length-1];return z.pieceLength=C.info["piece length"],z.lastPieceLength=(I.offset+I.length)%z.pieceLength||z.pieceLength,z.pieces=function s(C){const z=[];for(let k=0;k{k(null,V)}):function g(C){return typeof Blob<"u"&&C instanceof Blob}(C)?t(C,($,oe)=>$?k(new Error(`Error converting Blob: ${$.message}`)):void I(oe)):"function"==typeof a&&/^https?:/.test(C)?(z=Object.assign({url:C,timeout:3e4,headers:{"user-agent":"WebTorrent (https://webtorrent.io)"}},z),a.concat(z,($,oe,ue)=>$?k(new Error(`Error downloading torrent: ${$.message}`)):void I(ue))):"function"==typeof r.readFile&&"string"==typeof C?r.readFile(C,($,oe)=>$?k(new Error("Invalid torrent identifier")):void I(oe)):E(()=>{k(new Error("Invalid torrent identifier"))})},N.exports.toMagnetURI=c.encode,N.exports.toTorrentFile=function n(C){const z={info:C.info};return z["announce-list"]=(C.announce||[]).map(k=>(z.announce||(z.announce=k),[k=f.from(k,"utf8")])),z["url-list"]=C.urlList||[],void 0!==C.private&&(z.private=+C.private),C.created&&(z["creation date"]=0|C.created.getTime()/1e3),C.createdBy&&(z["created by"]=C.createdBy),C.comment&&(z.comment=C.comment),o.encode(z)},f.alloc(0)}).call(this)}).call(this,d("buffer").Buffer)},{bencode:27,"blob-to-buffer":37,buffer:76,fs:42,"magnet-uri":158,path:185,"queue-microtask":206,"simple-get":246,"simple-sha1":248}],185:[function(d,N,A){(function(f){(function(){"use strict";function b(g){if("string"!=typeof g)throw new TypeError("Path must be a string. Received "+JSON.stringify(g))}function m(g,h){for(var a,s="",u=0,o=-1,t=0,r=0;r<=g.length;++r){if(rs.length||2!==u||46!==s.charCodeAt(s.length-1)||46!==s.charCodeAt(s.length-2))if(2l){if(47===s.charCodeAt(r+E))return s.slice(r+E+1);if(0===E)return s.slice(r+E)}else t>l&&(47===h.charCodeAt(u+E)?w=E:0===E&&(w=0));break}var C=h.charCodeAt(u+E);if(C!==s.charCodeAt(r+E))break;47===C&&(w=E)}var k="";for(E=u+w+1;E<=o;++E)(E===o||47===h.charCodeAt(E))&&(k+=0===k.length?"..":"/..");return 0=t;--w)if(47!==(u=h.charCodeAt(w)))-1===c&&(l=!1,c=w+1),46===u?-1===r?r=w:1!==E&&(E=1):-1!==r&&(E=-1);else if(!l){a=w+1;break}return-1===r||-1===c||0===E||1===E&&r===c-1&&r===a+1?-1!==c&&(s.base=s.name=h.slice(0===a&&o?1:a,c)):(0===a&&o?(s.name=h.slice(1,r),s.base=h.slice(1,c)):(s.name=h.slice(a,r),s.base=h.slice(a,c)),s.ext=h.slice(r,c)),0"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"./default-encoding":188,"./precondition":189,"./sync":190,"./to-buffer":191,"safe-buffer":235}],188:[function(d,N,A){(function(f,b){(function(){var m;m=b.process&&b.process.browser?"utf-8":b.process&&b.process.version?6<=parseInt(f.version.split(".")[0].slice(1),10)?"utf-8":"binary":"utf-8",N.exports=m}).call(this)}).call(this,d("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{_process:193}],189:[function(d,N,A){H(2,30),N.exports=function(b,m){if("number"!=typeof b)throw new TypeError("Iterations not a number");if(0>b)throw new TypeError("Bad iterations");if("number"!=typeof m)throw new TypeError("Key length not a number");if(0>m||1073741823E?c=w(c):c.lengthb?1:b/1024)+.5)}},{}],193:[function(d,N,A){function f(){throw new Error("setTimeout has not been defined")}function b(){throw new Error("clearTimeout has not been defined")}function m(w){if(o===setTimeout)return setTimeout(w,0);if((o===f||!o)&&setTimeout)return o=setTimeout,setTimeout(w,0);try{return o(w,0)}catch{try{return o.call(null,w,0)}catch{return o.call(this,w,0)}}}function n(){a&&l&&(a=!1,l.length?r=l.concat(r):c=-1,r.length&&g())}function g(){if(!a){var w=m(n);a=!0;for(var E=r.length;E;){for(l=r,r=[];++cC||0<=new h(c).cmp(E.modulus))throw new Error("decryption error");z=l?o(new h(c),E):s(c,E);var k=t.alloc(C-z.length);if(z=t.concat([k,z],C),4===w)return function f(r,a){var c=r.modulus.byteLength(),l=u("sha1").update(t.alloc(0)).digest(),w=l.length;if(0!==a[0])throw new Error("decryption error");var E=a.slice(1,w+1),C=a.slice(w+1),z=g(E,n(C,w)),k=g(C,n(z,c-w-1));if(function m(r,a){r=t.from(r),a=t.from(a);var c=0,l=r.length;r.length!==a.length&&(c++,l=ne(r.length,a.length));for(var w=-1;++w=a.length){E++;break}var C=a.slice(2,w-1);if(("0002"!==l.toString("hex")&&!c||"0001"!==l.toString("hex")&&c)&&E++,8>C.length&&E++,E)throw new Error("decryption error");return a.slice(w)}(0,z,l);if(3===w)return z;throw new Error("unknown padding")}},{"./mgf":195,"./withPublic":199,"./xor":200,"bn.js":196,"browserify-rsa":63,"create-hash":85,"parse-asn1":183,"safe-buffer":235}],198:[function(d,N,A){var _=d("parse-asn1"),n=d("randombytes"),g=d("create-hash"),h=d("./mgf"),s=d("./xor"),u=d("bn.js"),o=d("./withPublic"),t=d("browserify-rsa"),r=d("safe-buffer").Buffer;N.exports=function(c,l,w){var E;E=c.padding?c.padding:w?1:4;var z,C=_(c);if(4===E)z=function f(a,c){var l=a.modulus.byteLength(),w=c.length,E=g("sha1").update(r.alloc(0)).digest(),C=E.length,z=2*C;if(w>l-z-2)throw new Error("message too long");var k=r.alloc(l-w-z-2),I=l-C-1,V=n(C),$=s(r.concat([E,k,r.alloc(1,1),c],I),h(V,I)),oe=s(V,h($,C));return new u(r.concat([r.alloc(1),oe,$],l))}(C,l);else if(1===E)z=function b(a,c,l){var C,w=c.length,E=a.modulus.byteLength();if(w>E-11)throw new Error("message too long");return C=l?r.alloc(E-w-3,255):function m(a){for(var C,c=r.allocUnsafe(a),l=0,w=n(2*a),E=0;lc.length)throw new Error("pump requires two streams per minimum");var E,w=c.map(function(C,z){var k=z=Ie&&Ee>>10),se=56320|1023&se),Ee+F(se)}).join("")}function s(Y){return 10>Y-48?Y-22:26>Y-65?Y-65:26>Y-97?Y-97:36}function u(Y,se){return Y+22+75*(26>Y)-((0!=se)<<5)}function o(Y,se,Ee){var Se=0;for(Y=Ee?B(Y/700):Y>>1,Y+=B(Y/se);455(ut=Y.lastIndexOf("-"))&&(ut=0),$t=0;$t=Ee&&m("invalid-input"),(36<=(Yt=s(Y.charCodeAt(qt++)))||Yt>B((2147483647-Se)/at))&&m("overflow"),Se+=Yt*at,!(Yt<(Tn=nt<=Qe?1:nt>=Qe+26?26:nt-Qe));nt+=36)at>B(2147483647/(J=36-Tn))&&m("overflow"),at*=J;Qe=o(Se-tt,Je=se.length+1,0==tt),B(Se/Je)>2147483647-Ie&&m("overflow"),Ie+=B(Se/Je),Se%=Je,se.splice(Se++,0,Ie)}return h(se)}function r(Y){var Ee,Se,Ie,Qe,Je,ut,$t,qt,tt,at,nt,Yt,Tn,J,O,se=[];for(Yt=(Y=g(Y)).length,Ee=128,Se=0,Je=72,ut=0;ut(nt=Y[ut])&&se.push(F(nt));for(Ie=Qe=se.length,Qe&&se.push("-");Ie=Ee&&nt<$t&&($t=nt);for($t-Ee>B((2147483647-Se)/(Tn=Ie+1))&&m("overflow"),Se+=($t-Ee)*Tn,Ee=$t,ut=0;ut=Je+26?26:tt-Je));tt+=36)se.push(F(u(at+(O=qt-at)%(J=36-at),0))),qt=B(O/J);se.push(F(u(qt,0))),Je=o(Se,Tn,Ie==Qe),Se=0,++Ie}++Se,++Ee}return se.join("")}var l="object"==typeof A&&A&&!A.nodeType&&A,w="object"==typeof N&&N&&!N.nodeType&&N,E="object"==typeof f&&f;(E.global===E||E.window===E||E.self===E)&&(b=E);var q,L,X=/^xn--/,T=/[^\x20-\x7E]/,D=/[\x2E\u3002\uFF0E\uFF61]/g,M={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},B=xt,F=te;if(q={version:"1.4.1",ucs2:{decode:g,encode:h},decode:t,encode:r,toASCII:function c(Y){return n(Y,function(se){return T.test(se)?"xn--"+r(se):se})},toUnicode:function a(Y){return n(Y,function(se){return X.test(se)?t(se.slice(4).toLowerCase()):se})}},l&&w)if(N.exports==l)w.exports=q;else for(L in q)q.hasOwnProperty(L)&&(l[L]=q[L]);else b.punycode=q}(this)}).call(this)}).call(this,typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{}],203:[function(d,N,A){"use strict";function f(m,_){return Object.prototype.hasOwnProperty.call(m,_)}N.exports=function(m,_,n,g){n=n||"=";var h={};if("string"!=typeof m||0===m.length)return h;var s=/\+/g;m=m.split(_=_||"&");var u=1e3;g&&"number"==typeof g.maxKeys&&(u=g.maxKeys);var o=m.length;0u&&(o=u);for(var t=0;t"u"?f:window):m=>(b||(b=Promise.resolve())).then(m).catch(_=>setTimeout(()=>{throw _},0))}).call(this)}).call(this,typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{}],207:[function(d,N,A){N.exports="function"==typeof queueMicrotask?queueMicrotask:f=>Promise.resolve().then(f)},{}],208:[function(d,N,A){N.exports=function(b){var m=0;return function(){if(m===b.length)return null;var _=b.length-m,n=0|Math.random()*_,g=b[m+n],h=b[m];return b[m]=g,b[m+n]=h,m++,g}}},{}],209:[function(d,N,A){(function(f,b){(function(){"use strict";var h=d("safe-buffer").Buffer,s=b.crypto||b.msCrypto;N.exports=s&&s.getRandomValues?function _(u,o){if(u>4294967295)throw new RangeError("requested too many random bytes");var t=h.allocUnsafe(u);if(0"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{_process:193,"safe-buffer":235}],210:[function(d,N,A){(function(f,b){(function(){"use strict";function m(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}function _(l,w){if("number"!=typeof l||l!=l)throw new TypeError("offset must be a number");if(4294967295l)throw new TypeError("offset must be a uint32");if(l>r||l>w)throw new RangeError("offset out of range")}function n(l,w,E){if("number"!=typeof l||l!=l)throw new TypeError("size must be a number");if(4294967295l)throw new TypeError("size must be a uint32");if(l+w>E||l>r)throw new RangeError("buffer too small")}function h(l,w,E,C){if(f.browser){var k=new Uint8Array(l.buffer,w,E);return a.getRandomValues(k),C?void f.nextTick(function(){C(null,l)}):l}if(!C)return o(E).copy(l,w),l;o(E,function(V,$){return V?C(V):($.copy(l,w),void C(null,l))})}var u=d("safe-buffer"),o=d("randombytes"),t=u.Buffer,r=u.kMaxLength,a=b.crypto||b.msCrypto;H(2,32),a&&a.getRandomValues||!f.browser?(A.randomFill=function g(l,w,E,C){if(!(t.isBuffer(l)||l instanceof b.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof w)C=w,w=0,E=l.length;else if("function"==typeof E)C=E,E=l.length-w;else if("function"!=typeof C)throw new TypeError('"cb" argument must be a function');return _(w,l.length),n(E,w,l.length),h(l,w,E,C)},A.randomFillSync=function s(l,w,E){if(typeof w>"u"&&(w=0),!(t.isBuffer(l)||l instanceof b.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return _(w,l.length),void 0===E&&(E=l.length-w),n(E,w,l.length),h(l,w,E)}):(A.randomFill=m,A.randomFillSync=m)}).call(this)}).call(this,d("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{_process:193,randombytes:209,"safe-buffer":235}],211:[function(d,N,A){"use strict";function m(h,s){return{start:h.start,end:h.end,index:s}}function _(h){return{start:h.start,end:h.end}}function n(h,s){return h.index-s.index}function g(h,s){return h.start-s.start}N.exports=function f(h,s,u){if("string"!=typeof s)throw new TypeError("argument str must be a string");var o=s.indexOf("=");if(-1===o)return-2;var t=s.slice(o+1).split(","),r=[];r.type=s.slice(0,o);for(var a=0;ah-1&&(w=h-1),!(isNaN(l)||isNaN(w)||l>w||0>l)&&r.push({start:l,end:w})}return 1>r.length?-1:u&&u.combine?function b(h){for(var s=h.map(m).sort(g),u=0,o=1;or.end+1?s[++u]=t:t.end>r.end&&(r.end=t.end,r.index=ne(r.index,t.index))}s.length=u+1;var a=s.sort(n).map(_);return a.type=h.type,a}(r):r}},{}],212:[function(d,N,A){const{Writable:f,PassThrough:b}=d("readable-stream");N.exports=class m extends f{constructor(n,g={}){super(g),this.destroyed=!1,this._queue=[],this._position=n||0,this._cb=null,this._buffer=null,this._out=null}_write(n,g,h){let s=!0;for(;;){if(this.destroyed)return;if(0===this._queue.length)return this._buffer=n,void(this._cb=h);this._buffer=null;var u=this._queue[0];const o=pe(u.start-this._position,0),t=u.end-this._position;if(o>=n.length)return this._position+=n.length,h(null);let r;if(t>n.length){this._position+=n.length,r=0===o?n:n.slice(o),s=u.stream.write(r)&&s;break}this._position+=t,r=0===o&&t===n.length?n:n.slice(o,t),s=u.stream.write(r)&&s,u.last&&u.stream.end(),n=n.slice(t),this._queue.shift()}s?h(null):u.stream.once("drain",h.bind(null,null))}slice(n){if(this.destroyed)return null;Array.isArray(n)||(n=[n]);const g=new b;return n.forEach((h,s)=>{this._queue.push({start:h.start,end:h.end,stream:g,last:s===n.length-1})}),this._buffer&&this._write(this._buffer,null,this._cb),g}destroy(n){this.destroyed||(this.destroyed=!0,n&&this.emit("error",n))}}},{"readable-stream":228}],213:[function(d,N,A){"use strict";function f(u){return parseInt(u,10)===u}function b(u){function r(a){this.s=function t(a){if(void 0===a){a=Array(u);for(var c=0;cu?48+u:97+u-10)}function _(u){return parseInt(u,16)}var n=b(256);n.prototype.randomByte=n.prototype.randomNative;var g=b(16);g.prototype.randomByte=function(){return 16*this.randomNative()+this.randomNative()},g.prototype.currentStateString=function(){var u=this.currentState();return m(u.i)+m(u.j)+u.s.map(m).join("")},g.prototype.setStateString=function(u){if(!u.match(/^[0-9a-f]{18}$/))throw new TypeError("RC4small stateString should be 18 hex character string");var o=_(u[0]),t=_(u[1]),r=u.split("").slice(2).map(_);this.setState({i:o,j:t,s:r})},n.RC4small=g,N.exports=n},{}],214:[function(d,N,A){"use strict";function b(s,u,o){o||(o=Error);var r=function(a){function c(l,w,E){return a.call(this,function t(a,c,l){return"string"==typeof u?u:u(a,c,l)}(l,w,E))||this}return function f(s,u){s.prototype=Object.create(u.prototype),s.prototype.constructor=s,s.__proto__=u}(c,a),c}(o);r.prototype.name=o.name,r.prototype.code=s,h[s]=r}function m(s,u){if(Array.isArray(s)){var o=s.length;return s=s.map(function(t){return t+""}),2o?0:+o,u.length)===u}(u,"not ")?(t="must not be",u=u.replace(/^not /,"")):t="must be",function n(s,u,o){return(void 0===o||o>s.length)&&(o=s.length),s.substring(o-u.length,o)===u}(s," argument"))r="The ".concat(s," ").concat(t," ").concat(m(u,"type"));else{var a=function g(s,u,o){return"number"!=typeof o&&(o=0),!(o+u.length>s.length)&&-1!==s.indexOf(u,o)}(s,".")?"property":"argument";r='The "'.concat(s,'" ').concat(a," ").concat(t," ").concat(m(u,"type"))}return r+". Received type ".concat(typeof o)},TypeError),b("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),b("ERR_METHOD_NOT_IMPLEMENTED",function(s){return"The "+s+" method is not implemented"}),b("ERR_STREAM_PREMATURE_CLOSE","Premature close"),b("ERR_STREAM_DESTROYED",function(s){return"Cannot call "+s+" after a stream was destroyed"}),b("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),b("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),b("ERR_STREAM_WRITE_AFTER_END","write after end"),b("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),b("ERR_UNKNOWN_ENCODING",function(s){return"Unknown encoding: "+s},TypeError),b("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),N.exports.codes=h},{}],215:[function(d,N,A){(function(f){(function(){"use strict";function b(t){return this instanceof b?(g.call(this,t),h.call(this,t),this.allowHalfOpen=!0,void(t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",m))))):new b(t)}function m(){this._writableState.ended||f.nextTick(_,this)}function _(t){t.end()}var n=Object.keys||function(t){var r=[];for(var a in t)r.push(a);return r};N.exports=b;var g=d("./_stream_readable"),h=d("./_stream_writable");d("inherits")(b,g);for(var o,s=n(h.prototype),u=0;u=J||0===O.length&&O.ended?0:O.objectMode?1:J==J?(J>O.highWaterMark&&(O.highWaterMark=function t(J){return 1073741824<=J?J=1073741824:(J--,J|=J>>>1,J|=J>>>2,J|=J>>>4,J|=J>>>8,J|=J>>>16,J++),J}(J)),J<=O.length?J:O.ended?O.length:(O.needReadable=!0,0)):O.flowing&&O.length?O.buffer.head.data.length:O.length}function c(J){var O=J._readableState;L("emitReadable",O.needReadable,O.emittedReadable),O.needReadable=!1,O.emittedReadable||(L("emitReadable",O.flowing),O.emittedReadable=!0,f.nextTick(l,J))}function l(J){var O=J._readableState;L("emitReadable_",O.destroyed,O.length,O.ended),!O.destroyed&&(O.length||O.ended)&&(J.emit("readable"),O.emittedReadable=!1),O.needReadable=!O.flowing&&!O.ended&&O.length<=O.highWaterMark,$(J)}function w(J,O){O.readingMore||(O.readingMore=!0,f.nextTick(E,J,O))}function E(J,O){for(;!O.reading&&!O.ended&&(O.length=O.length?(W=O.decoder?O.buffer.join(""):1===O.buffer.length?O.buffer.first():O.buffer.concat(O.length),O.buffer.clear()):W=O.buffer.consume(J,O.decoder),W);var W}function ue(J){var O=J._readableState;L("endReadable",O.endEmitted),O.endEmitted||(O.ended=!0,f.nextTick(Ae,O,J))}function Ae(J,O){if(L("endReadableNT",J.endEmitted,J.length),!J.endEmitted&&0===J.length&&(J.endEmitted=!0,O.readable=!1,O.emit("end"),J.autoDestroy)){var W=O._writableState;(!W||W.autoDestroy&&W.finished)&&O.destroy()}}function X(J,O){for(var W=0,ee=J.length;W=O.highWaterMark)||O.ended))return L("read: emitReadable",O.length,O.ended),0===O.length&&O.ended?ue(this):c(this),null;if(0===(J=r(J,O))&&O.ended)return 0===O.length&&ue(this),null;var ve,ee=O.needReadable;return L("need readable",ee),(0===O.length||O.length-J"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"../errors":214,"./_stream_duplex":215,"./internal/streams/async_iterator":220,"./internal/streams/buffer_list":221,"./internal/streams/destroy":222,"./internal/streams/from":224,"./internal/streams/state":226,"./internal/streams/stream":227,_process:193,buffer:76,events:123,inherits:147,"string_decoder/":265,util:42}],218:[function(d,N,A){"use strict";function f(t,r){var a=this._transformState;a.transforming=!1;var c=a.writecb;if(null===c)return this.emit("error",new h);a.writechunk=null,a.writecb=null,null!=r&&this.push(r),c(t);var l=this._readableState;l.reading=!1,(l.needReadable||l.length"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"../errors":214,"./_stream_duplex":215,"./internal/streams/destroy":222,"./internal/streams/state":226,"./internal/streams/stream":227,_process:193,buffer:76,inherits:147,"util-deprecate":277}],220:[function(d,N,A){(function(f){(function(){"use strict";function b(z,k,I){return k in z?Object.defineProperty(z,k,{value:I,enumerable:!0,configurable:!0,writable:!0}):z[k]=I,z}function m(z,k){return{value:z,done:k}}function _(z){var k=z[s];if(null!==k){var I=z[c].read();null!==I&&(z[r]=null,z[s]=null,z[u]=null,k(m(I,!1)))}}function n(z){f.nextTick(_,z)}var C,h=d("./end-of-stream"),s=Symbol("lastResolve"),u=Symbol("lastReject"),o=Symbol("error"),t=Symbol("ended"),r=Symbol("lastPromise"),a=Symbol("handlePromise"),c=Symbol("stream"),l=Object.getPrototypeOf(function(){}),w=Object.setPrototypeOf((b(C={get stream(){return this[c]},next:function(){var k=this,I=this[o];if(null!==I)return Promise.reject(I);if(this[t])return Promise.resolve(m(void 0,!0));if(this[c].destroyed)return new Promise(function(ue,Ae){f.nextTick(function(){k[o]?Ae(k[o]):ue(m(void 0,!0))})});var $,V=this[r];if(V)$=new Promise(function g(z,k){return function(I,V){z.then(function(){return k[t]?void I(m(void 0,!0)):void k[a](I,V)},V)}}(V,this));else{var oe=this[c].read();if(null!==oe)return Promise.resolve(m(oe,!1));$=new Promise(this[a])}return this[r]=$,$}},Symbol.asyncIterator,function(){return this}),b(C,"return",function(){var k=this;return new Promise(function(I,V){k[c].destroy(null,function($){return $?void V($):void I(m(void 0,!0))})})}),C),l);N.exports=function(k){var V,I=Object.create(w,(b(V={},c,{value:k,writable:!0}),b(V,s,{value:null,writable:!0}),b(V,u,{value:null,writable:!0}),b(V,o,{value:null,writable:!0}),b(V,t,{value:k._readableState.endEmitted,writable:!0}),b(V,a,{value:function(oe,ue){var Ae=I[c].read();Ae?(I[r]=null,I[s]=null,I[u]=null,oe(m(Ae,!1))):(I[s]=oe,I[u]=ue)},writable:!0}),V));return I[r]=null,h(k,function($){if($&&"ERR_STREAM_PREMATURE_CLOSE"!==$.code){var oe=I[u];return null!==oe&&(I[r]=null,I[s]=null,I[u]=null,oe($)),void(I[o]=$)}var ue=I[s];null!==ue&&(I[r]=null,I[s]=null,I[u]=null,ue(m(void 0,!0))),I[t]=!0}),k.on("readable",n.bind(null,I)),I}}).call(this)}).call(this,d("_process"))},{"./end-of-stream":223,_process:193}],221:[function(d,N,A){"use strict";function f(a,c){var l=Object.keys(a);if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(a);c&&(w=w.filter(function(E){return Object.getOwnPropertyDescriptor(a,E).enumerable})),l.push.apply(l,w)}return l}function m(a,c,l){return c in a?Object.defineProperty(a,c,{value:l,enumerable:!0,configurable:!0,writable:!0}):a[c]=l,a}function n(a,c){for(var w,l=0;l>>0),E=this.head,C=0;E;)h(E.data,w,C),C+=E.data.length,E=E.next;return w}},{key:"consume",value:function(l,w){var E;return lz.length?z.length:l;if(C+=k===z.length?z:z.slice(0,l),0==(l-=k)){k===z.length?(++E,this.head=w.next?w.next:this.tail=null):(this.head=w,w.data=z.slice(k));break}++E}return this.length-=E,C}},{key:"_getBuffer",value:function(l){var w=u.allocUnsafe(l),E=this.head,C=1;for(E.data.copy(w),l-=E.data.length;E=E.next;){var z=E.data,k=l>z.length?z.length:l;if(z.copy(w,w.length-l,0,k),0==(l-=k)){k===z.length?(++C,this.head=E.next?E.next:this.tail=null):(this.head=E,E.data=z.slice(k));break}++C}return this.length-=C,w}},{key:r,value:function(l,w){return t(this,function b(a){for(var l,c=1;cc.length)throw new o("streams");var C,E=c.map(function(z,k){var I=ks)throw new m(h?g:"highWaterMark",s);return xt(s)}return _.objectMode?16:16384}}},{"../../../errors":214}],227:[function(d,N,A){N.exports=d("events").EventEmitter},{events:123}],228:[function(d,N,A){(A=N.exports=d("./lib/_stream_readable.js")).Stream=A,A.Readable=A,A.Writable=d("./lib/_stream_writable.js"),A.Duplex=d("./lib/_stream_duplex.js"),A.Transform=d("./lib/_stream_transform.js"),A.PassThrough=d("./lib/_stream_passthrough.js"),A.finished=d("./lib/internal/streams/end-of-stream.js"),A.pipeline=d("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":215,"./lib/_stream_passthrough.js":216,"./lib/_stream_readable.js":217,"./lib/_stream_transform.js":218,"./lib/_stream_writable.js":219,"./lib/internal/streams/end-of-stream.js":223,"./lib/internal/streams/pipeline.js":225}],229:[function(d,N,A){function m(ue,Ae,X,T){function M(){return!("number"==typeof ue.length&&ue.length>X.maxBlobLength&&(u("File length too large for Blob URL approach: %d (max: %d)",ue.length,X.maxBlobLength),se(new Error(`File length too large for Blob URL approach: ${ue.length} (max: ${X.maxBlobLength})`)),1))}function v(Qe){M()&&(Ie=Ae(Qe),_(ue,(Je,ut)=>Je?se(Je):(Ie.addEventListener("error",se),Ie.addEventListener("loadstart",B),Ie.addEventListener("loadedmetadata",F),void(Ie.src=ut))))}function B(){if(Ie.removeEventListener("loadstart",B),X.autoplay){const Qe=Ie.play();typeof Qe<"u"&&Qe.catch(se)}}function F(){Ie.removeEventListener("loadedmetadata",F),T(null,Ie)}function L(){_(ue,(Qe,Je)=>Qe?se(Qe):(".pdf"===Ee?(Ie=Ae("object"),Ie.setAttribute("typemustmatch",!0),Ie.setAttribute("type","application/pdf"),Ie.setAttribute("data",Je)):(Ie=Ae("iframe"),Ie.sandbox="allow-forms allow-scripts",Ie.src=Je),void T(null,Ie)))}function se(Qe){Qe.message=`Error rendering file "${ue.name}": ${Qe.message}`,u(Qe.message),T(Qe)}const Ee=r.extname(ue.name).toLowerCase();let Ie,Se=0;C.includes(Ee)?function D(){function Je(){u(`Use MediaSource API for ${ue.name}`),tt(),Ie.addEventListener("error",qt),Ie.addEventListener("loadstart",B),Ie.addEventListener("loadedmetadata",F);const Yt=new t(Ie).createWriteStream(function g(ue){return{".m4a":'audio/mp4; codecs="mp4a.40.5"',".m4b":'audio/mp4; codecs="mp4a.40.5"',".m4p":'audio/mp4; codecs="mp4a.40.5"',".m4v":'video/mp4; codecs="avc1.640029, mp4a.40.5"',".mkv":'video/webm; codecs="avc1.640029, mp4a.40.5"',".mp3":"audio/mpeg",".mp4":'video/mp4; codecs="avc1.640029, mp4a.40.5"',".webm":'video/webm; codecs="vorbis, vp8"'}[r.extname(ue).toLowerCase()]}(ue.name));ue.createReadStream().pipe(Yt),Se&&(Ie.currentTime=Se)}function ut(){u(`Use Blob URL for ${ue.name}`),tt(),Ie.addEventListener("error",se),Ie.addEventListener("loadstart",B),Ie.addEventListener("loadedmetadata",F),_(ue,(nt,Yt)=>nt?se(nt):(Ie.src=Yt,void(Se&&(Ie.currentTime=Se))))}function $t(nt){u("videostream error: fallback to MediaSource API: %o",nt.message||nt),Ie.removeEventListener("error",$t),Ie.removeEventListener("loadedmetadata",F),Je()}function qt(nt){u("MediaSource API error: fallback to Blob URL: %o",nt.message||nt),M()&&(Ie.removeEventListener("error",qt),Ie.removeEventListener("loadedmetadata",F),ut())}function tt(){Ie||(Ie=Ae(at),Ie.addEventListener("progress",()=>{Se=Ie.currentTime}))}const at=w.includes(Ee)?"video":"audio";oe?l.includes(Ee)?function Qe(){u(`Use \`videostream\` package for ${ue.name}`),tt(),Ie.addEventListener("error",$t),Ie.addEventListener("loadstart",B),Ie.addEventListener("loadedmetadata",F),new c(ue,Ie)}():Je():ut()}():z.includes(Ee)?v("video"):k.includes(Ee)?v("audio"):I.includes(Ee)?function q(){Ie=Ae("img"),_(ue,(Qe,Je)=>Qe?se(Qe):(Ie.src=Je,Ie.alt=ue.name,void T(null,Ie)))}():V.includes(Ee)?L():function Y(){u('Unknown file extension "%s" - will attempt to render into iframe',Ee);let Je="";ue.createReadStream({start:0,end:1e3}).setEncoding("utf8").on("data",ut=>{Je+=ut}).on("end",function Qe(){o(Je)?(u('File extension "%s" appears ascii, so will render.',Ee),L()):(u('File extension "%s" appears non-ascii, will not render.',Ee),T(new Error(`Unsupported file type "${Ee}": Cannot append to DOM`)))}).on("error",T)}()}function _(ue,Ae){const X=r.extname(ue.name).toLowerCase();a(ue.createReadStream(),A.mime[X]).then(T=>Ae(null,T),T=>Ae(T))}function n(ue){if(null==ue)throw new Error("file cannot be null or undefined");if("string"!=typeof ue.name)throw new Error("missing or invalid file.name property");if("function"!=typeof ue.createReadStream)throw new Error("missing or invalid file.createReadStream property")}function h(ue){null==ue.autoplay&&(ue.autoplay=!1),null==ue.muted&&(ue.muted=!1),null==ue.controls&&(ue.controls=!0),null==ue.maxBlobLength&&(ue.maxBlobLength=$)}function s(ue,Ae){ue.autoplay=!!Ae.autoplay,ue.muted=!!Ae.muted,ue.controls=!!Ae.controls}A.render=function f(ue,Ae,X,T){"function"==typeof X&&(T=X,X={}),X||(X={}),T||(T=()=>{}),n(ue),h(X),"string"==typeof Ae&&(Ae=document.querySelector(Ae)),m(ue,D=>{if(Ae.nodeName!==D.toUpperCase()){const M=r.extname(ue.name).toLowerCase();throw new Error(`Cannot render "${M}" inside a "${Ae.nodeName.toLowerCase()}" element, expected "${D}"`)}return("video"===D||"audio"===D)&&s(Ae,X),Ae},X,T)},A.append=function b(ue,Ae,X,T){function v(F){const q=document.createElement(F);return Ae.appendChild(q),q}if("function"==typeof X&&(T=X,X={}),X||(X={}),T||(T=()=>{}),n(ue),h(X),"string"==typeof Ae&&(Ae=document.querySelector(Ae)),Ae&&("VIDEO"===Ae.nodeName||"AUDIO"===Ae.nodeName))throw new Error("Invalid video/audio node argument. Argument must be root element that video/audio tag will be appended to.");m(ue,function D(F){return"video"===F||"audio"===F?function M(F){const q=v(F);return s(q,X),Ae.appendChild(q),q}(F):v(F)},X,function B(F,q){F&&q&&q.remove(),T(F,q)})},A.mime=d("./lib/mime.json");const u=d("debug")("render-media"),o=d("is-ascii"),t=d("mediasource"),r=d("path"),a=d("stream-to-blob-url"),c=d("videostream"),l=[".m4a",".m4b",".m4p",".m4v",".mp4"],w=[".m4v",".mkv",".mp4",".webm"],C=[].concat(w,[".m4a",".m4b",".m4p",".mp3"]),z=[".mov",".ogv"],k=[".aac",".oga",".ogg",".wav",".flac"],I=[".bmp",".gif",".jpeg",".jpg",".png",".svg"],V=[".css",".html",".js",".md",".pdf",".srt",".txt"],$=2e8,oe=typeof window<"u"&&window.MediaSource},{"./lib/mime.json":230,debug:91,"is-ascii":148,mediasource:160,path:185,"stream-to-blob-url":261,videostream:279}],230:[function(d,N,A){N.exports={".3gp":"video/3gpp",".aac":"audio/aac",".aif":"audio/x-aiff",".aiff":"audio/x-aiff",".atom":"application/atom+xml",".avi":"video/x-msvideo",".bmp":"image/bmp",".bz2":"application/x-bzip2",".conf":"text/plain",".css":"text/css",".csv":"text/plain",".diff":"text/x-diff",".doc":"application/msword",".flv":"video/x-flv",".gif":"image/gif",".gz":"application/x-gzip",".htm":"text/html",".html":"text/html",".ico":"image/vnd.microsoft.icon",".ics":"text/calendar",".iso":"application/octet-stream",".jar":"application/java-archive",".jpeg":"image/jpeg",".jpg":"image/jpeg",".js":"application/javascript",".json":"application/json",".less":"text/css",".log":"text/plain",".m3u":"audio/x-mpegurl",".m4a":"audio/x-m4a",".m4b":"audio/mp4",".m4p":"audio/mp4",".m4v":"video/x-m4v",".manifest":"text/cache-manifest",".markdown":"text/x-markdown",".mathml":"application/mathml+xml",".md":"text/x-markdown",".mid":"audio/midi",".midi":"audio/midi",".mov":"video/quicktime",".mp3":"audio/mpeg",".mp4":"video/mp4",".mp4v":"video/mp4",".mpeg":"video/mpeg",".mpg":"video/mpeg",".odp":"application/vnd.oasis.opendocument.presentation",".ods":"application/vnd.oasis.opendocument.spreadsheet",".odt":"application/vnd.oasis.opendocument.text",".oga":"audio/ogg",".ogg":"application/ogg",".pdf":"application/pdf",".png":"image/png",".pps":"application/vnd.ms-powerpoint",".ppt":"application/vnd.ms-powerpoint",".ps":"application/postscript",".psd":"image/vnd.adobe.photoshop",".qt":"video/quicktime",".rar":"application/x-rar-compressed",".rdf":"application/rdf+xml",".rss":"application/rss+xml",".rtf":"application/rtf",".svg":"image/svg+xml",".svgz":"image/svg+xml",".swf":"application/x-shockwave-flash",".tar":"application/x-tar",".tbz":"application/x-bzip-compressed-tar",".text":"text/plain",".tif":"image/tiff",".tiff":"image/tiff",".torrent":"application/x-bittorrent",".ttf":"application/x-font-ttf",".txt":"text/plain",".wav":"audio/wav",".webm":"video/webm",".wma":"audio/x-ms-wma",".wmv":"video/x-ms-wmv",".xls":"application/vnd.ms-excel",".xml":"application/xml",".yaml":"text/yaml",".yml":"text/yaml",".zip":"application/zip"}},{}],231:[function(d,N,A){"use strict";function f(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function b(C,z){return C<>>32-z}function m(C,z,k,I,V,$,oe,ue){return 0|b(0|C+(z^k^I)+$+oe,ue)+V}function _(C,z,k,I,V,$,oe,ue){return 0|b(0|C+(z&k|~z&I)+$+oe,ue)+V}function n(C,z,k,I,V,$,oe,ue){return 0|b(0|C+((z|~k)^I)+$+oe,ue)+V}function g(C,z,k,I,V,$,oe,ue){return 0|b(0|C+(z&I|k&~I)+$+oe,ue)+V}function h(C,z,k,I,V,$,oe,ue){return 0|b(0|C+(z^(k|~I))+$+oe,ue)+V}var s=d("buffer").Buffer,u=d("inherits"),o=d("hash-base"),t=Array(16),r=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],a=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],c=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],l=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],w=[0,1518500249,1859775393,2400959708,2840853838],E=[1352829926,1548603684,1836072691,2053994217,0];u(f,o),f.prototype._update=function(){for(var C=t,z=0;16>z;++z)C[z]=this._block.readInt32LE(4*z);for(var k=0|this._a,I=0|this._b,V=0|this._c,$=0|this._d,oe=0|this._e,ue=0|this._a,Ae=0|this._b,X=0|this._c,T=0|this._d,D=0|this._e,M=0;80>M;M+=1){var v,B;16>M?(v=m(k,I,V,$,oe,C[r[M]],w[0],c[M]),B=h(ue,Ae,X,T,D,C[a[M]],E[0],l[M])):32>M?(v=_(k,I,V,$,oe,C[r[M]],w[1],c[M]),B=g(ue,Ae,X,T,D,C[a[M]],E[1],l[M])):48>M?(v=n(k,I,V,$,oe,C[r[M]],w[2],c[M]),B=n(ue,Ae,X,T,D,C[a[M]],E[2],l[M])):64>M?(v=g(k,I,V,$,oe,C[r[M]],w[3],c[M]),B=_(ue,Ae,X,T,D,C[a[M]],E[3],l[M])):(v=h(k,I,V,$,oe,C[r[M]],w[4],c[M]),B=m(ue,Ae,X,T,D,C[a[M]],E[4],l[M])),k=oe,oe=$,$=b(V,10),V=I,I=v,ue=D,D=T,T=b(X,10),X=Ae,Ae=B}var F=0|this._b+V+T;this._b=0|this._c+$+D,this._c=0|this._d+oe+ue,this._d=0|this._e+k+Ae,this._e=0|this._a+I+X,this._a=F},f.prototype._digest=function(){this._block[this._blockOffset++]=128,56"u"?this:self,m=function(){return function(f){function b(_){if(m[_])return m[_].exports;var n=m[_]={i:_,l:!1,exports:{}};return f[_].call(n.exports,n,n.exports,b),n.l=!0,n.exports}var m={};return b.m=f,b.c=m,b.d=function(_,n,g){b.o(_,n)||Object.defineProperty(_,n,{configurable:!1,enumerable:!0,get:g})},b.n=function(_){var n=_&&_.__esModule?function(){return _.default}:function(){return _};return b.d(n,"a",n),n},b.o=function(_,n){return Object.prototype.hasOwnProperty.call(_,n)},b.p="",b(b.s=3)}([function(f,b,m){var n=m(5),g=m(1),h=g.toHex,s=g.ceilHeapSize,u=m(6),o=function(l){for(l+=9;0>2);return function(l,w){var E=new Uint8Array(l.buffer),C=w%4,z=w-C;switch(C){case 0:E[z+3]=0;case 1:E[z+2]=0;case 2:E[z+1]=0;case 3:E[z+0]=0}for(var k=1+(w>>2);k>2]|=128<<24-(w%4<<3),l[14+(-16&2+(w>>2))]=0|E/536870912,l[15+(-16&2+(w>>2))]=E<<3}(k,E,C),z},l.prototype._write=function(E,C,z,k){u(E,this._h8,this._h32,C,z,k||0)},l.prototype._coreCall=function(E,C,z,k,I){var V=z;this._write(E,C,z),I&&(V=this._padChunk(z,k)),this._core.hash(V,this._padMaxChunkLen)},l.prototype.rawDigest=function(E){var C=E.byteLength||E.length||E.size||0;this._initState(this._heap,this._padMaxChunkLen);var z=0,k=this._maxChunkLen;for(z=0;C>z+k;z+=k)this._coreCall(E,z,k,C,!1);return this._coreCall(E,z,C-z,C,!0),a(this._heap,this._padMaxChunkLen)},l.prototype.digest=function(E){return h(this.rawDigest(E).buffer)},l.prototype.digestFromString=function(E){return this.digest(E)},l.prototype.digestFromBuffer=function(E){return this.digest(E)},l.prototype.digestFromArrayBuffer=function(E){return this.digest(E)},l.prototype.resetState=function(){return this._initState(this._heap,this._padMaxChunkLen),this},l.prototype.append=function(E){var C=0,z=E.byteLength||E.length||E.size||0,k=this._offset%this._maxChunkLen,I=void 0;for(this._offset+=z;C_;_++)m[_]=(16>_?"0":"")+_.toString(16);f.exports.toHex=function(n){for(var g=new Uint8Array(n),h=Array(n.byteLength),s=0;s=n)return 65536;if(16777216>n)for(g=1;g>2],l=0|s[o+324>>2],E=0|s[o+328>>2],z=0|s[o+332>>2],I=0|s[o+336>>2],t=0;(0|t)<(0|u);t=0|t+64){for(c=a,w=l,C=E,k=z,V=I,r=0;64>(0|r);r=0|r+4)$=0|(0|(a<<5|a>>>27)+(l&E|~l&z))+(0|1518500249+(0|(oe=0|s[t+r>>2])+I)),I=z,z=E,E=l<<30|l>>>2,l=a,a=$,s[u+r>>2]=oe;for(r=0|u+64;(0|r)<(0|u+80);r=0|r+4)$=0|(0|(a<<5|a>>>27)+(l&E|~l&z))+(0|1518500249+(0|(oe=(s[r-12>>2]^s[r-32>>2]^s[r-56>>2]^s[r-64>>2])<<1|(s[r-12>>2]^s[r-32>>2]^s[r-56>>2]^s[r-64>>2])>>>31)+I)),I=z,z=E,E=l<<30|l>>>2,l=a,a=$,s[r>>2]=oe;for(r=0|u+80;(0|r)<(0|u+160);r=0|r+4)$=0|(0|(a<<5|a>>>27)+(l^E^z))+(0|1859775393+(0|(oe=(s[r-12>>2]^s[r-32>>2]^s[r-56>>2]^s[r-64>>2])<<1|(s[r-12>>2]^s[r-32>>2]^s[r-56>>2]^s[r-64>>2])>>>31)+I)),I=z,z=E,E=l<<30|l>>>2,l=a,a=$,s[r>>2]=oe;for(r=0|u+160;(0|r)<(0|u+240);r=0|r+4)$=0|(0|(a<<5|a>>>27)+(l&E|l&z|E&z))+(0|(0|(oe=(s[r-12>>2]^s[r-32>>2]^s[r-56>>2]^s[r-64>>2])<<1|(s[r-12>>2]^s[r-32>>2]^s[r-56>>2]^s[r-64>>2])>>>31)+I)-1894007588),I=z,z=E,E=l<<30|l>>>2,l=a,a=$,s[r>>2]=oe;for(r=0|u+240;(0|r)<(0|u+320);r=0|r+4)$=0|(0|(a<<5|a>>>27)+(l^E^z))+(0|(0|(oe=(s[r-12>>2]^s[r-32>>2]^s[r-56>>2]^s[r-64>>2])<<1|(s[r-12>>2]^s[r-32>>2]^s[r-56>>2]^s[r-64>>2])>>>31)+I)-899497514),I=z,z=E,E=l<<30|l>>>2,l=a,a=$,s[r>>2]=oe;a=0|a+c,l=0|l+w,E=0|E+C,z=0|z+k,I=0|I+V}s[o+320>>2]=a,s[o+324>>2]=l,s[o+328>>2]=E,s[o+332>>2]=z,s[o+336>>2]=I}}}},function(f,b){var m=this,_=void 0;typeof self<"u"&&typeof self.FileReaderSync<"u"&&(_=new self.FileReaderSync);var g=function(s,u,o,t,r,a){var E,c=a%4,l=(r+c)%4,w=r-l;switch(c){case 0:u[a]=s[t+3];case 1:u[0|a+1-(c<<1)]=s[t+2];case 2:u[0|a+2-(c<<1)]=s[t+1];case 3:u[0|a+3-(c<<1)]=s[t]}if(!(r>2]=s[t+E]<<24|s[t+E+1]<<16|s[t+E+2]<<8|s[t+E+3];switch(l){case 3:u[0|a+w+1]=s[t+w+2];case 2:u[0|a+w+2]=s[t+w+1];case 1:u[0|a+w+3]=s[t+w]}}};f.exports=function(s,u,o,t,r,a){if("string"==typeof s)return function(s,u,o,t,r,a){var E,c=a%4,l=(r+c)%4,w=r-l;switch(c){case 0:u[a]=s.charCodeAt(t+3);case 1:u[0|a+1-(c<<1)]=s.charCodeAt(t+2);case 2:u[0|a+2-(c<<1)]=s.charCodeAt(t+1);case 3:u[0|a+3-(c<<1)]=s.charCodeAt(t)}if(!(r>2]=s.charCodeAt(t+E)<<24|s.charCodeAt(t+E+1)<<16|s.charCodeAt(t+E+2)<<8|s.charCodeAt(t+E+3);switch(l){case 3:u[0|a+w+1]=s.charCodeAt(t+w+2);case 2:u[0|a+w+2]=s.charCodeAt(t+w+1);case 1:u[0|a+w+3]=s.charCodeAt(t+w)}}}(s,u,o,t,r,a);if(s instanceof Array||m&&m.Buffer&&m.Buffer.isBuffer(s))return g(s,u,o,t,r,a);if(s instanceof ArrayBuffer)return g(new Uint8Array(s),u,o,t,r,a);if(s.buffer instanceof ArrayBuffer)return g(new Uint8Array(s.buffer,s.byteOffset,s.byteLength),u,o,t,r,a);if(s instanceof Blob)return function(s,u,o,t,r,a){var c=void 0,l=a%4,w=(r+l)%4,E=r-w,C=new Uint8Array(_.readAsArrayBuffer(s.slice(t,t+r)));switch(l){case 0:u[a]=C[3];case 1:u[0|a+1-(l<<1)]=C[2];case 2:u[0|a+2-(l<<1)]=C[1];case 3:u[0|a+3-(l<<1)]=C[0]}if(!(r>2]=C[c]<<24|C[c+1]<<16|C[c+2]<<8|C[c+3];switch(w){case 3:u[0|a+E+1]=C[E+2];case 2:u[0|a+E+2]=C[E+1];case 1:u[0|a+E+3]=C[E]}}}(s,u,o,t,r,a);throw new Error("Unsupported data type.")}},function(f,b,m){var n=function(){function o(t,r){for(var c,a=0;a"u")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof h);return m(h,s,u)}),g.alloc||(g.alloc=function(h,s,u){if("number"!=typeof h)throw new TypeError('The "size" argument must be of type number. Received type '+typeof h);if(0>h||2147483648<=h)throw new RangeError('The value "'+h+'" is invalid for option "size"');var o=m(h);return s&&0!==s.length?"string"==typeof u?o.fill(s,u):o.fill(s):o.fill(0),o}),!_.kStringMaxLength)try{_.kStringMaxLength=f.binding("buffer").kStringMaxLength}catch{}_.constants||(_.constants={MAX_LENGTH:_.kMaxLength},_.kStringMaxLength&&(_.constants.MAX_STRING_LENGTH=_.kStringMaxLength)),N.exports=_}).call(this)}).call(this,d("_process"))},{_process:193,buffer:76}],237:[function(d,N,A){function f(m,_){this._block=b.alloc(m),this._finalSize=_,this._blockSize=m,this._len=0}var b=d("safe-buffer").Buffer;f.prototype.update=function(m,_){"string"==typeof m&&(m=b.from(m,_=_||"utf8"));for(var n=this._block,g=this._blockSize,h=m.length,s=this._len,u=0;u=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(4294967295>=n)this._block.writeUInt32BE(n,this._blockSize-4);else{var g=(4294967295&n)>>>0;this._block.writeUInt32BE((n-g)/4294967296,this._blockSize-8),this._block.writeUInt32BE(g,this._blockSize-4)}this._update(this._block);var s=this._hash();return m?s.toString(m):s},f.prototype._update=function(){throw new Error("_update must be implemented by subclass")},N.exports=f},{"safe-buffer":235}],238:[function(d,N,f){(f=N.exports=function(m){m=m.toLowerCase();var _=f[m];if(!_)throw new Error(m+" is not supported (we accept pull requests)");return new _}).sha=d("./sha"),f.sha1=d("./sha1"),f.sha224=d("./sha224"),f.sha256=d("./sha256"),f.sha384=d("./sha384"),f.sha512=d("./sha512")},{"./sha":239,"./sha1":240,"./sha224":241,"./sha256":242,"./sha384":243,"./sha512":244}],239:[function(d,N,A){function f(){this.init(),this._w=u,g.call(this,64,56)}function b(o){return o<<5|o>>>27}function m(o){return o<<30|o>>>2}function _(o,t,r,a){return 0===o?t&r|~t&a:2===o?t&r|t&a|r&a:t^r^a}var n=d("inherits"),g=d("./hash"),h=d("safe-buffer").Buffer,s=[1518500249,1859775393,-1894007588,-899497514],u=Array(80);n(f,g),f.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},f.prototype._update=function(o){for(var t=this._w,r=0|this._a,a=0|this._b,c=0|this._c,l=0|this._d,w=0|this._e,E=0;16>E;++E)t[E]=o.readInt32BE(4*E);for(;80>E;++E)t[E]=t[E-3]^t[E-8]^t[E-14]^t[E-16];for(var C=0;80>C;++C){var z=~~(C/20),k=0|b(r)+_(z,a,c,l)+w+t[C]+s[z];w=l,l=c,c=m(a),a=r,r=k}this._a=0|r+this._a,this._b=0|a+this._b,this._c=0|c+this._c,this._d=0|l+this._d,this._e=0|w+this._e},f.prototype._hash=function(){var o=h.allocUnsafe(20);return o.writeInt32BE(0|this._a,0),o.writeInt32BE(0|this._b,4),o.writeInt32BE(0|this._c,8),o.writeInt32BE(0|this._d,12),o.writeInt32BE(0|this._e,16),o},N.exports=f},{"./hash":237,inherits:147,"safe-buffer":235}],240:[function(d,N,A){function f(){this.init(),this._w=o,h.call(this,64,56)}function b(t){return t<<1|t>>>31}function m(t){return t<<5|t>>>27}function _(t){return t<<30|t>>>2}function n(t,r,a,c){return 0===t?r&a|~r&c:2===t?r&a|r&c|a&c:r^a^c}var g=d("inherits"),h=d("./hash"),s=d("safe-buffer").Buffer,u=[1518500249,1859775393,-1894007588,-899497514],o=Array(80);g(f,h),f.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},f.prototype._update=function(t){for(var r=this._w,a=0|this._a,c=0|this._b,l=0|this._c,w=0|this._d,E=0|this._e,C=0;16>C;++C)r[C]=t.readInt32BE(4*C);for(;80>C;++C)r[C]=b(r[C-3]^r[C-8]^r[C-14]^r[C-16]);for(var z=0;80>z;++z){var k=~~(z/20),I=0|m(a)+n(k,c,l,w)+E+r[z]+u[k];E=w,w=l,l=_(c),c=a,a=I}this._a=0|a+this._a,this._b=0|c+this._b,this._c=0|l+this._c,this._d=0|w+this._d,this._e=0|E+this._e},f.prototype._hash=function(){var t=s.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},N.exports=f},{"./hash":237,inherits:147,"safe-buffer":235}],241:[function(d,N,A){function f(){this.init(),this._w=g,_.call(this,64,56)}var b=d("inherits"),m=d("./sha256"),_=d("./hash"),n=d("safe-buffer").Buffer,g=Array(64);b(f,m),f.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},f.prototype._hash=function(){var h=n.allocUnsafe(28);return h.writeInt32BE(this._a,0),h.writeInt32BE(this._b,4),h.writeInt32BE(this._c,8),h.writeInt32BE(this._d,12),h.writeInt32BE(this._e,16),h.writeInt32BE(this._f,20),h.writeInt32BE(this._g,24),h},N.exports=f},{"./hash":237,"./sha256":242,inherits:147,"safe-buffer":235}],242:[function(d,N,A){function f(){this.init(),this._w=r,u.call(this,64,56)}function b(a,c,l){return l^a&(c^l)}function m(a,c,l){return a&c|l&(a|c)}function _(a){return(a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10)}function n(a){return(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7)}function g(a){return(a>>>7|a<<25)^(a>>>18|a<<14)^a>>>3}function h(a){return(a>>>17|a<<15)^(a>>>19|a<<13)^a>>>10}var s=d("inherits"),u=d("./hash"),o=d("safe-buffer").Buffer,t=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],r=Array(64);s(f,u),f.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},f.prototype._update=function(a){for(var c=this._w,l=0|this._a,w=0|this._b,E=0|this._c,C=0|this._d,z=0|this._e,k=0|this._f,I=0|this._g,V=0|this._h,$=0;16>$;++$)c[$]=a.readInt32BE(4*$);for(;64>$;++$)c[$]=0|h(c[$-2])+c[$-7]+g(c[$-15])+c[$-16];for(var oe=0;64>oe;++oe){var ue=0|V+n(z)+b(z,k,I)+t[oe]+c[oe],Ae=0|_(l)+m(l,w,E);V=I,I=k,k=z,z=0|C+ue,C=E,E=w,w=l,l=0|ue+Ae}this._a=0|l+this._a,this._b=0|w+this._b,this._c=0|E+this._c,this._d=0|C+this._d,this._e=0|z+this._e,this._f=0|k+this._f,this._g=0|I+this._g,this._h=0|V+this._h},f.prototype._hash=function(){var a=o.allocUnsafe(32);return a.writeInt32BE(this._a,0),a.writeInt32BE(this._b,4),a.writeInt32BE(this._c,8),a.writeInt32BE(this._d,12),a.writeInt32BE(this._e,16),a.writeInt32BE(this._f,20),a.writeInt32BE(this._g,24),a.writeInt32BE(this._h,28),a},N.exports=f},{"./hash":237,inherits:147,"safe-buffer":235}],243:[function(d,N,A){function f(){this.init(),this._w=g,_.call(this,128,112)}var b=d("inherits"),m=d("./sha512"),_=d("./hash"),n=d("safe-buffer").Buffer,g=Array(160);b(f,m),f.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},f.prototype._hash=function(){function h(u,o,t){s.writeInt32BE(u,t),s.writeInt32BE(o,t+4)}var s=n.allocUnsafe(48);return h(this._ah,this._al,0),h(this._bh,this._bl,8),h(this._ch,this._cl,16),h(this._dh,this._dl,24),h(this._eh,this._el,32),h(this._fh,this._fl,40),s},N.exports=f},{"./hash":237,"./sha512":244,inherits:147,"safe-buffer":235}],244:[function(d,N,A){function f(){this.init(),this._w=l,r.call(this,128,112)}function b(w,E,C){return C^w&(E^C)}function m(w,E,C){return w&E|C&(w|E)}function _(w,E){return(w>>>28|E<<4)^(E>>>2|w<<30)^(E>>>7|w<<25)}function n(w,E){return(w>>>14|E<<18)^(w>>>18|E<<14)^(E>>>9|w<<23)}function g(w,E){return(w>>>1|E<<31)^(w>>>8|E<<24)^w>>>7}function h(w,E){return(w>>>1|E<<31)^(w>>>8|E<<24)^(w>>>7|E<<25)}function s(w,E){return(w>>>19|E<<13)^(E>>>29|w<<3)^w>>>6}function u(w,E){return(w>>>19|E<<13)^(E>>>29|w<<3)^(w>>>6|E<<26)}function o(w,E){return w>>>0>>0?1:0}var t=d("inherits"),r=d("./hash"),a=d("safe-buffer").Buffer,c=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],l=Array(160);t(f,r),f.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},f.prototype._update=function(w){for(var E=this._w,C=0|this._ah,z=0|this._bh,k=0|this._ch,I=0|this._dh,V=0|this._eh,$=0|this._fh,oe=0|this._gh,ue=0|this._hh,Ae=0|this._al,X=0|this._bl,T=0|this._cl,D=0|this._dl,M=0|this._el,v=0|this._fl,B=0|this._gl,F=0|this._hl,q=0;32>q;q+=2)E[q]=w.readInt32BE(4*q),E[q+1]=w.readInt32BE(4*q+4);for(;160>q;q+=2){var L=E[q-30],Y=E[q-30+1],se=g(L,Y),Ee=h(Y,L),Se=s(L=E[q-4],Y=E[q-4+1]),Ie=u(Y,L),ut=E[q-32],$t=E[q-32+1],qt=0|Ee+E[q-14+1],tt=0|se+E[q-14]+o(qt,Ee);tt=0|(tt=0|tt+Se+o(qt=0|qt+Ie,Ie))+ut+o(qt=0|qt+$t,$t),E[q]=tt,E[q+1]=qt}for(var at=0;160>at;at+=2){tt=E[at],qt=E[at+1];var nt=m(C,z,k),Yt=m(Ae,X,T),Tn=_(C,Ae),J=_(Ae,C),O=n(V,M),W=n(M,V),ee=c[at],ve=c[at+1],He=b(V,$,oe),ht=b(M,v,B),st=0|F+W,Jt=0|ue+O+o(st,F);Jt=0|(Jt=0|(Jt=0|Jt+He+o(st=0|st+ht,ht))+ee+o(st=0|st+ve,ve))+tt+o(st=0|st+qt,qt);var on=0|J+Yt,Ht=0|Tn+nt+o(on,J);ue=oe,F=B,oe=$,B=v,$=V,v=M,V=0|I+Jt+o(M=0|D+st,D),I=k,D=T,k=z,T=X,z=C,X=Ae,C=0|Jt+Ht+o(Ae=0|st+on,st)}this._al=0|this._al+Ae,this._bl=0|this._bl+X,this._cl=0|this._cl+T,this._dl=0|this._dl+D,this._el=0|this._el+M,this._fl=0|this._fl+v,this._gl=0|this._gl+B,this._hl=0|this._hl+F,this._ah=0|this._ah+C+o(this._al,Ae),this._bh=0|this._bh+z+o(this._bl,X),this._ch=0|this._ch+k+o(this._cl,T),this._dh=0|this._dh+I+o(this._dl,D),this._eh=0|this._eh+V+o(this._el,M),this._fh=0|this._fh+$+o(this._fl,v),this._gh=0|this._gh+oe+o(this._gl,B),this._hh=0|this._hh+ue+o(this._hl,F)},f.prototype._hash=function(){function w(C,z,k){E.writeInt32BE(C,k),E.writeInt32BE(z,k+4)}var E=a.allocUnsafe(64);return w(this._ah,this._al,0),w(this._bh,this._bl,8),w(this._ch,this._cl,16),w(this._dh,this._dl,24),w(this._eh,this._el,32),w(this._fh,this._fl,40),w(this._gh,this._gl,48),w(this._hh,this._hl,56),E},N.exports=f},{"./hash":237,inherits:147,"safe-buffer":235}],245:[function(d,N,A){(function(f){(function(){N.exports=function(b,m){var _=[];b.on("data",function(n){_.push(n)}),b.once("end",function(){m&&m(null,f.concat(_)),m=null}),b.once("error",function(n){m&&m(n),m=null})}}).call(this)}).call(this,d("buffer").Buffer)},{buffer:76}],246:[function(d,N,A){(function(f){(function(){function b(t,r){if(t=Object.assign({maxRedirects:10},"string"==typeof t?{url:t}:t),r=h(r),t.url){const{hostname:C,port:z,protocol:k,auth:I,path:V}=u.parse(t.url);delete t.url,C||z||k||I?Object.assign(t,{hostname:C,port:z,protocol:k,auth:I,path:V}):t.path=V}const a={"accept-encoding":"gzip, deflate"};let c;t.headers&&Object.keys(t.headers).forEach(C=>a[C.toLowerCase()]=t.headers[C]),t.headers=a,t.body?c=t.json&&!o(t.body)?JSON.stringify(t.body):t.body:t.form&&(c="string"==typeof t.form?t.form:s.stringify(t.form),t.headers["content-type"]="application/x-www-form-urlencoded"),c&&(!t.method&&(t.method="POST"),!o(c)&&(t.headers["content-length"]=f.byteLength(c)),t.json&&!t.form&&(t.headers["content-type"]="application/json")),delete t.body,delete t.form,t.json&&(t.headers.accept="application/json"),t.method&&(t.method=t.method.toUpperCase());const l=t.hostname,E=("https:"===t.protocol?g:n).request(t,C=>{if(!1!==t.followRedirects&&300<=C.statusCode&&400>C.statusCode&&C.headers.location){t.url=C.headers.location,delete t.headers.host,C.resume();const k=u.parse(t.url).hostname;return null!==k&&k!==l&&(delete t.headers.cookie,delete t.headers.authorization),"POST"===t.method&&[301,302].includes(C.statusCode)&&(t.method="GET",delete t.headers["content-length"],delete t.headers["content-type"]),0==t.maxRedirects--?r(new Error("too many redirects")):b(t,r)}r(null,"function"==typeof _&&"HEAD"!==t.method?_(C):C)});return E.on("timeout",()=>{E.abort(),r(new Error("Request timed out"))}),E.on("error",r),o(c)?c.on("error",r).pipe(E):E.end(c),E}N.exports=b;const m=d("simple-concat"),_=d("decompress-response"),n=d("http"),g=d("https"),h=d("once"),s=d("querystring"),u=d("url"),o=t=>null!==t&&"object"==typeof t&&"function"==typeof t.pipe;b.concat=(t,r)=>b(t,(a,c)=>a?r(a):void m(c,(l,w)=>{if(l)return r(l);if(t.json)try{w=JSON.parse(w.toString())}catch(E){return r(E,c,w)}r(null,c,w)})),["get","post","put","patch","head","delete"].forEach(t=>{b[t]=(r,a)=>("string"==typeof r&&(r={url:r}),b(Object.assign({method:t.toUpperCase()},r),a))})}).call(this)}).call(this,d("buffer").Buffer)},{buffer:76,"decompress-response":42,http:257,https:144,once:178,querystring:205,"simple-concat":245,url:274}],247:[function(d,N,A){function f(c){return c.replace(/a=ice-options:trickle\s\n/g,"")}const m=d("debug")("simple-peer"),_=d("get-browser-rtc"),n=d("randombytes"),g=d("readable-stream"),h=d("queue-microtask"),s=d("err-code"),{Buffer:u}=d("buffer"),o=65536;class a extends g.Duplex{constructor(l){if(super(l=Object.assign({allowHalfOpen:!1},l)),this._id=n(4).toString("hex").slice(0,7),this._debug("new peer %o",l),this.channelName=l.initiator?l.channelName||n(20).toString("hex"):null,this.initiator=l.initiator||!1,this.channelConfig=l.channelConfig||a.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},a.config,l.config),this.offerOptions=l.offerOptions||{},this.answerOptions=l.answerOptions||{},this.sdpTransform=l.sdpTransform||(w=>w),this.streams=l.streams||(l.stream?[l.stream]:[]),this.trickle=void 0===l.trickle||l.trickle,this.allowHalfTrickle=void 0!==l.allowHalfTrickle&&l.allowHalfTrickle,this.iceCompleteTimeout=l.iceCompleteTimeout||5e3,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=l.wrtc&&"object"==typeof l.wrtc?l.wrtc:_(),!this._wrtc)throw s(typeof window>"u"?new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"):new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(w){return void this.destroy(s(w,"ERR_PC_CONSTRUCTOR"))}this._isReactNativeWebrtc="number"==typeof this._pc._peerConnectionId,this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=w=>{this._onIceCandidate(w)},"object"==typeof this._pc.peerIdentity&&this._pc.peerIdentity.catch(w=>{this.destroy(s(w,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=w=>{this._setupData(w)},this.streams&&this.streams.forEach(w=>{this.addStream(w)}),this._pc.ontrack=w=>{this._onTrack(w)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&"open"===this._channel.readyState}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(l){if(!this.destroying){if(this.destroyed)throw s(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if("string"==typeof l)try{l=JSON.parse(l)}catch{l={}}this._debug("signal()"),l.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),l.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(l.transceiverRequest.kind,l.transceiverRequest.init)),l.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(l.candidate):this._pendingCandidates.push(l.candidate)),l.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(l)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(w=>{this._addIceCandidate(w)}),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())}).catch(w=>{this.destroy(s(w,"ERR_SET_REMOTE_DESCRIPTION"))}),l.sdp||l.candidate||l.renegotiate||l.transceiverRequest||this.destroy(s(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(l){const w=new this._wrtc.RTCIceCandidate(l);this._pc.addIceCandidate(w).catch(E=>{!w.address||w.address.endsWith(".local")?function b(c){console.warn(c)}("Ignoring unsupported ICE candidate."):this.destroy(s(E,"ERR_ADD_ICE_CANDIDATE"))})}send(l){if(!this.destroying){if(this.destroyed)throw s(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(l)}}addTransceiver(l,w){if(!this.destroying){if(this.destroyed)throw s(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(l,w),this._needsNegotiation()}catch(E){this.destroy(s(E,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:l,init:w}})}}addStream(l){if(!this.destroying){if(this.destroyed)throw s(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),l.getTracks().forEach(w=>{this.addTrack(w,l)})}}addTrack(l,w){if(this.destroying)return;if(this.destroyed)throw s(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");const E=this._senderMap.get(l)||new Map;let C=E.get(w);if(C)throw C.removed?s(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):s(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED");C=this._pc.addTrack(l,w),E.set(w,C),this._senderMap.set(l,E),this._needsNegotiation()}replaceTrack(l,w,E){if(this.destroying)return;if(this.destroyed)throw s(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");const C=this._senderMap.get(l),z=C?C.get(E):null;if(!z)throw s(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");w&&this._senderMap.set(w,C),null==z.replaceTrack?this.destroy(s(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK")):z.replaceTrack(w)}removeTrack(l,w){if(this.destroying)return;if(this.destroyed)throw s(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");const E=this._senderMap.get(l),C=E?E.get(w):null;if(!C)throw s(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{C.removed=!0,this._pc.removeTrack(C)}catch(z){"NS_ERROR_UNEXPECTED"===z.name?this._sendersAwaitingStable.push(C):this.destroy(s(z,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(l){if(!this.destroying){if(this.destroyed)throw s(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),l.getTracks().forEach(w=>{this.removeTrack(w,l)})}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,h(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw s(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(l){this._destroy(l,()=>{})}_destroy(l,w){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",l&&(l.message||l)),h(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",l&&(l.message||l)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch{}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch{}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,l&&this.emit("error",l),this.emit("close"),w()}))}_setupData(l){if(!l.channel)return this.destroy(s(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=l.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=o),this.channelName=this._channel.label,this._channel.onmessage=E=>{this._onChannelMessage(E)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=E=>{const C=E.error instanceof Error?E.error:new Error(`Datachannel error: ${E.message} ${E.filename}:${E.lineno}:${E.colno}`);this.destroy(s(C,"ERR_DATA_CHANNEL"))};let w=!1;this._closingInterval=setInterval(()=>{this._channel&&"closing"===this._channel.readyState?(w&&this._onChannelClose(),w=!0):w=!1},5e3)}_read(){}_write(l,w,E){if(this.destroyed)return E(s(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(l)}catch(C){return this.destroy(s(C,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>o?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=E):E(null)}else this._debug("write before connect"),this._chunk=l,this._cb=E}_onFinish(){if(!this.destroyed){const l=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?l():this.once("connect",l)}}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(l=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(l.sdp=f(l.sdp)),l.sdp=this.sdpTransform(l.sdp);const w=()=>{if(!this.destroyed){const z=this._pc.localDescription||l;this._debug("signal"),this.emit("signal",{type:z.type,sdp:z.sdp})}};this._pc.setLocalDescription(l).then(()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?w():this.once("_iceComplete",w))}).catch(z=>{this.destroy(s(z,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(l=>{this.destroy(s(l,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(l=>{l.mid||!l.sender.track||l.requested||(l.requested=!0,this.addTransceiver(l.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(l=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(l.sdp=f(l.sdp)),l.sdp=this.sdpTransform(l.sdp);const w=()=>{if(!this.destroyed){const z=this._pc.localDescription||l;this._debug("signal"),this.emit("signal",{type:z.type,sdp:z.sdp}),this.initiator||this._requestMissingTransceivers()}};this._pc.setLocalDescription(l).then(()=>{this.destroyed||(this.trickle||this._iceComplete?w():this.once("_iceComplete",w))}).catch(z=>{this.destroy(s(z,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(l=>{this.destroy(s(l,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||"failed"===this._pc.connectionState&&this.destroy(s(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const l=this._pc.iceConnectionState,w=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",l,w),this.emit("iceStateChange",l,w),("connected"===l||"completed"===l)&&(this._pcReady=!0,this._maybeReady()),"failed"===l&&this.destroy(s(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===l&&this.destroy(s(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(l){const w=E=>("[object Array]"===Object.prototype.toString.call(E.values)&&E.values.forEach(C=>{Object.assign(E,C)}),E);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then(E=>{const C=[];E.forEach(z=>{C.push(w(z))}),l(null,C)},E=>l(E)):0{if(this.destroyed)return;const C=[];E.result().forEach(z=>{const k={};z.names().forEach(I=>{k[I]=z.stat(I)}),k.id=z.id,k.type=z.type,k.timestamp=z.timestamp,C.push(w(k))}),l(null,C)},E=>l(E)):l(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const l=()=>{this.destroyed||this.getStats((w,E)=>{if(this.destroyed)return;w&&(E=[]);const C={},z={},k={};let I=!1;E.forEach($=>{("remotecandidate"===$.type||"remote-candidate"===$.type)&&(C[$.id]=$),("localcandidate"===$.type||"local-candidate"===$.type)&&(z[$.id]=$),("candidatepair"===$.type||"candidate-pair"===$.type)&&(k[$.id]=$)});const V=$=>{I=!0;let oe=z[$.localCandidateId];oe&&(oe.ip||oe.address)?(this.localAddress=oe.ip||oe.address,this.localPort=+oe.port):oe&&oe.ipAddress?(this.localAddress=oe.ipAddress,this.localPort=+oe.portNumber):"string"==typeof $.googLocalAddress&&(oe=$.googLocalAddress.split(":"),this.localAddress=oe[0],this.localPort=+oe[1]),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let ue=C[$.remoteCandidateId];ue&&(ue.ip||ue.address)?(this.remoteAddress=ue.ip||ue.address,this.remotePort=+ue.port):ue&&ue.ipAddress?(this.remoteAddress=ue.ipAddress,this.remotePort=+ue.portNumber):"string"==typeof $.googRemoteAddress&&(ue=$.googRemoteAddress.split(":"),this.remoteAddress=ue[0],this.remotePort=+ue[1]),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(E.forEach($=>{"transport"===$.type&&$.selectedCandidatePairId&&V(k[$.selectedCandidatePairId]),("googCandidatePair"===$.type&&"true"===$.googActiveConnection||("candidatepair"===$.type||"candidate-pair"===$.type)&&$.selected)&&V($)}),I||Object.keys(k).length&&!Object.keys(z).length){if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(oe){return this.destroy(s(oe,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const $=this._cb;this._cb=null,$(null)}"number"!=typeof this._channel.bufferedAmountLowThreshold&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}else setTimeout(l,100)})};l()}_onInterval(){this._cb&&this._channel&&!(this._channel.bufferedAmount>o)&&this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||("stable"===this._pc.signalingState&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(l=>{this._pc.removeTrack(l),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(l){this.destroyed||(l.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:l.candidate.candidate,sdpMLineIndex:l.candidate.sdpMLineIndex,sdpMid:l.candidate.sdpMid}}):!l.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit("_iceComplete")),l.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(l){if(this.destroyed)return;let w=l.data;w instanceof ArrayBuffer&&(w=u.from(w)),this.push(w)}_onChannelBufferedAmountLow(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const l=this._cb;this._cb=null,l(null)}}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(l){this.destroyed||l.streams.forEach(w=>{this._debug("on track"),this.emit("track",l.track,w),this._remoteTracks.push({track:l.track,stream:w}),this._remoteStreams.some(E=>E.id===w.id)||(this._remoteStreams.push(w),h(()=>{this._debug("on stream"),this.emit("stream",w)}))})}_debug(){const l=[].slice.call(arguments);l[0]="["+this._id+"] "+l[0],m.apply(null,l)}}a.WEBRTC_SUPPORT=!!_(),a.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},a.channelConfig={},N.exports=a},{buffer:76,debug:91,"err-code":122,"get-browser-rtc":129,"queue-microtask":206,randombytes:209,"readable-stream":228}],248:[function(d,N,A){function f(t){return h.digest(t)}const n=d("rusha"),g=d("./rusha-worker-sha1"),h=new n,s=typeof window>"u"?self:window,u=s.crypto||s.msCrypto||{};let o=u.subtle||u.webkitSubtle;try{o.digest({name:"sha-1"},new Uint8Array).catch(function(){o=!1})}catch{o=!1}N.exports=function b(t,r){return o?("string"==typeof t&&(t=function m(t){const r=t.length,a=new Uint8Array(r);for(let c=0;c>>4).toString(16)),a.push((15&l).toString(16))}return a.join("")}(new Uint8Array(c)))},function(){r(f(t))})):void(typeof window>"u"?queueMicrotask(()=>r(f(t))):g(t,function(c,l){return c?void r(f(t)):void r(l)}))},N.exports.sync=f},{"./rusha-worker-sha1":249,rusha:234}],249:[function(d,N,A){const m=d("rusha");let _,n,g;N.exports=function b(h,s){_||function f(){_=m.createWorker(),n=1,g={},_.onmessage=function(s){const u=s.data.id,o=g[u];delete g[u],null==s.data.error?o(null,s.data.hash):o(new Error("Rusha worker error: "+s.data.error))}}(),g[n]=s,_.postMessage({id:n,data:h}),n+=1}},{rusha:234}],250:[function(d,N,A){(function(f){(function(){const b=d("debug")("simple-websocket"),m=d("randombytes"),_=d("readable-stream"),n=d("queue-microtask"),g=d("ws"),h="function"==typeof g?g:WebSocket;class u extends _.Duplex{constructor(t={}){if("string"==typeof t&&(t={url:t}),super(t=Object.assign({allowHalfOpen:!1},t)),null==t.url&&null==t.socket)throw new Error("Missing required `url` or `socket` option");if(null!=t.url&&null!=t.socket)throw new Error("Must specify either `url` or `socket` option, not both");if(this._id=m(4).toString("hex").slice(0,7),this._debug("new websocket: %o",t),this.connected=!1,this.destroyed=!1,this._chunk=null,this._cb=null,this._interval=null,t.socket)this.url=t.socket.url,this._ws=t.socket,this.connected=t.socket.readyState===h.OPEN;else{this.url=t.url;try{this._ws="function"==typeof g?new h(t.url,null,{...t,encoding:void 0}):new h(t.url)}catch(r){return void n(()=>this.destroy(r))}}this._ws.binaryType="arraybuffer",t.socket&&this.connected?n(()=>this._handleOpen()):this._ws.onopen=()=>this._handleOpen(),this._ws.onmessage=r=>this._handleMessage(r),this._ws.onclose=()=>this._handleClose(),this._ws.onerror=r=>this._handleError(r),this._handleFinishBound=()=>this._handleFinish(),this.once("finish",this._handleFinishBound)}send(t){this._ws.send(t)}destroy(t){this._destroy(t,()=>{})}_destroy(t,r){if(!this.destroyed){if(this._debug("destroy (error: %s)",t&&(t.message||t)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this.connected=!1,this.destroyed=!0,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._handleFinishBound&&this.removeListener("finish",this._handleFinishBound),this._handleFinishBound=null,this._ws){const a=this._ws,c=()=>{a.onclose=null};if(a.readyState===h.CLOSED)c();else try{a.onclose=c,a.close()}catch{c()}a.onopen=null,a.onmessage=null,a.onerror=()=>{}}this._ws=null,t&&this.emit("error",t),this.emit("close"),r()}}_read(){}_write(t,r,a){if(this.destroyed)return a(new Error("cannot write after socket is destroyed"));if(this.connected){try{this.send(t)}catch(c){return this.destroy(c)}"function"!=typeof g&&this._ws.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._ws.bufferedAmount),this._cb=a):a(null)}else this._debug("write before connect"),this._chunk=t,this._cb=a}_handleOpen(){if(!this.connected&&!this.destroyed){if(this.connected=!0,this._chunk){try{this.send(this._chunk)}catch(r){return this.destroy(r)}this._chunk=null,this._debug('sent chunk from "write before connect"');const t=this._cb;this._cb=null,t(null)}"function"!=typeof g&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}}_handleMessage(t){if(this.destroyed)return;let r=t.data;r instanceof ArrayBuffer&&(r=f.from(r)),this.push(r)}_handleClose(){this.destroyed||(this._debug("on close"),this.destroy())}_handleError(t){this.destroy(new Error(`Error connecting to ${this.url}`))}_handleFinish(){if(!this.destroyed){const t=()=>{setTimeout(()=>this.destroy(),1e3)};this.connected?t():this.once("connect",t)}}_onInterval(){if(this._cb&&this._ws&&!(this._ws.bufferedAmount>65536)){this._debug("ending backpressure: bufferedAmount %d",this._ws.bufferedAmount);const t=this._cb;this._cb=null,t(null)}}_debug(){const t=[].slice.call(arguments);t[0]="["+this._id+"] "+t[0],b.apply(null,t)}}u.WEBSOCKET_SUPPORT=!!h,N.exports=u}).call(this)}).call(this,d("buffer").Buffer)},{buffer:76,debug:91,"queue-microtask":206,randombytes:209,"readable-stream":228,ws:42}],251:[function(d,N,A){const f=d("./lib/throttle"),b=d("./lib/throttle-group");N.exports={Throttle:f,ThrottleGroup:b}},{"./lib/throttle":253,"./lib/throttle-group":252}],252:[function(d,N,A){var f=Number.isInteger;const{TokenBucket:b}=d("limiter"),m=d("./throttle");N.exports=class _{constructor(g={}){if("object"!=typeof g)throw new Error("Options must be an object");this.throttles=[],this.setEnabled(g.enabled),this.setRate(g.rate,g.chunksize)}getEnabled(){return this._enabled}getRate(){return this.bucket.tokensPerInterval}getChunksize(){return this.chunksize}setEnabled(g=!0){if("boolean"!=typeof g)throw new Error("Enabled must be a boolean");this._enabled=g;for(const h of this.throttles)h.setEnabled(g)}setRate(g,h=null){if(!f(g)||0>g)throw new Error("Rate must be an integer bigger than zero");if(g=parseInt(g),h&&("number"!=typeof h||0>=h))throw new Error("Chunksize must be bigger than zero");if(h=h||pe(parseInt(g/10),1),h=parseInt(h),0g)throw new Error("Chunk size must be smaller than rate");this.bucket||(this.bucket=new b(g,g,"second",null)),this.bucket.bucketSize=g,this.bucket.tokensPerInterval=g,this.chunksize=h}setChunksize(g){if(!f(g)||0>=g)throw new Error("Chunk size must be an integer bigger than zero");const h=this.getRate();if(g=parseInt(g),0h)throw new Error("Chunk size must be smaller than rate");this.chunksize=g}throttle(g={}){if("object"!=typeof g)throw new Error("Options must be an object");return new m({...g,group:this})}destroy(){for(const g of this.throttles)g.destroy();this.throttles=[]}_addThrottle(g){if(!(g instanceof m))throw new Error("Throttle must be an instance of Throttle");this.throttles.push(g)}_removeThrottle(g){const h=this.throttles.indexOf(g);-1{function o(a){if(r._emitter.removeListener("disabled",o),r._emitter.removeListener("destroyed",o),!t)return t=!0,a?u(a):void s()}let t=!1;const r=this;this._emitter.once("disabled",o),this._emitter.once("destroyed",o),this._group.bucket.removeTokens(h,o)})}_areBothEnabled(){return this._enabled&&this._group.getEnabled()}async _processChunk(h,s){if(!this._areBothEnabled())return s(null,h);let u=0,o=this._group.getChunksize(),t=h.slice(u,u+o);for(;0setTimeout(m,b))}}},{}],255:[function(d,N,A){var n,f=1,b=65535,_=function(){f=f+1&b};N.exports=function(g){n||(n=setInterval(_,250)).unref&&n.unref();var h=4*(g||5),s=[0],u=1,o=f-1&b;return function(t){var r=f-o&b;for(r>h&&(r=h),o=f;r--;)u===h&&(u=0),s[u]=s[0===u?h-1:u-1],u++;t&&(s[u-1]+=t);var a=s[u-1];return s.length<4?a:4*(a-(s.length"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"./lib/request":259,"./lib/response":260,"builtin-status-codes":77,url:274,xtend:281}],258:[function(d,N,A){(function(f){(function(){function b(){if(void 0!==n)return n;if(f.XMLHttpRequest){n=new f.XMLHttpRequest;try{n.open("GET",f.XDomainRequest?"/":"https://example.com")}catch{n=null}}else n=null;return n}function m(g){var h=b();if(!h)return!1;try{return h.responseType=g,h.responseType===g}catch{}return!1}function _(g){return"function"==typeof g}var n;A.fetch=_(f.fetch)&&_(f.ReadableStream),A.writableStream=_(f.WritableStream),A.abortController=_(f.AbortController),A.arraybuffer=A.fetch||m("arraybuffer"),A.msstream=!A.fetch&&m("ms-stream"),A.mozchunkedarraybuffer=!A.fetch&&m("moz-chunked-arraybuffer"),A.overrideMimeType=A.fetch||!!b()&&_(b().overrideMimeType),n=null}).call(this)}).call(this,typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{}],259:[function(d,N,A){(function(f,b,m){(function(){var g=d("./capability"),h=d("inherits"),s=d("./response"),u=d("readable-stream"),o=s.IncomingMessage,t=s.readyStates,r=N.exports=function(c){var l=this;u.Writable.call(l),l._opts=c,l._body=[],l._headers={},c.auth&&l.setHeader("Authorization","Basic "+m.from(c.auth).toString("base64")),Object.keys(c.headers).forEach(function(C){l.setHeader(C,c.headers[C])});var E,w=!0;if("disable-fetch"===c.mode||"requestTimeout"in c&&!g.abortController)w=!1,E=!0;else if("prefer-streaming"===c.mode)E=!1;else if("allow-wrong-content-type"===c.mode)E=!g.overrideMimeType;else{if(c.mode&&"default"!==c.mode&&"prefer-fast"!==c.mode)throw new Error("Invalid value for opts.mode");E=!0}l._mode=function _(c,l){return g.fetch&&l?"fetch":g.mozchunkedarraybuffer?"moz-chunked-arraybuffer":g.msstream?"ms-stream":g.arraybuffer&&c?"arraybuffer":"text"}(E,w),l._fetchTimer=null,l._socketTimeout=null,l._socketTimer=null,l.on("finish",function(){l._onFinish()})};h(r,u.Writable),r.prototype.setHeader=function(c,l){var E=c.toLowerCase();-1!==a.indexOf(E)||(this._headers[E]={name:c,value:l})},r.prototype.getHeader=function(c){var l=this._headers[c.toLowerCase()];return l?l.value:null},r.prototype.removeHeader=function(c){delete this._headers[c.toLowerCase()]},r.prototype._onFinish=function(){var c=this;if(!c._destroyed){var l=c._opts;"timeout"in l&&0!==l.timeout&&c.setTimeout(l.timeout);var w=c._headers,E=null;"GET"!==l.method&&"HEAD"!==l.method&&(E=new Blob(c._body,{type:(w["content-type"]||{}).value||""}));var C=[];if(Object.keys(w).forEach(function(V){var $=w[V].name,oe=w[V].value;Array.isArray(oe)?oe.forEach(function(ue){C.push([$,ue])}):C.push([$,oe])}),"fetch"===c._mode){var z=null;if(g.abortController){var k=new AbortController;z=k.signal,c._fetchAbortController=k,"requestTimeout"in l&&0!==l.requestTimeout&&(c._fetchTimer=b.setTimeout(function(){c.emit("requestTimeout"),c._fetchAbortController&&c._fetchAbortController.abort()},l.requestTimeout))}b.fetch(c._opts.url,{method:c._opts.method,headers:C,body:E||void 0,mode:"cors",credentials:l.withCredentials?"include":"same-origin",signal:z}).then(function(V){c._fetchResponse=V,c._resetTimers(!1),c._connect()},function(V){c._resetTimers(!0),c._destroyed||c.emit("error",V)})}else{var I=c._xhr=new b.XMLHttpRequest;try{I.open(c._opts.method,c._opts.url,!0)}catch(V){return void f.nextTick(function(){c.emit("error",V)})}"responseType"in I&&(I.responseType=c._mode),"withCredentials"in I&&(I.withCredentials=!!l.withCredentials),"text"===c._mode&&"overrideMimeType"in I&&I.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in l&&(I.timeout=l.requestTimeout,I.ontimeout=function(){c.emit("requestTimeout")}),C.forEach(function(V){I.setRequestHeader(V[0],V[1])}),c._response=null,I.onreadystatechange=function(){switch(I.readyState){case t.LOADING:case t.DONE:c._onXHRProgress()}},"moz-chunked-arraybuffer"===c._mode&&(I.onprogress=function(){c._onXHRProgress()}),I.onerror=function(){c._destroyed||(c._resetTimers(!0),c.emit("error",new Error("XHR error")))};try{I.send(E)}catch(V){return void f.nextTick(function(){c.emit("error",V)})}}}},r.prototype._onXHRProgress=function(){var c=this;c._resetTimers(!1),!function n(c){try{var l=c.status;return null!==l&&0!==l}catch{return!1}}(c._xhr)||c._destroyed||(!c._response&&c._connect(),c._response._onXHRProgress(c._resetTimers.bind(c)))},r.prototype._connect=function(){var c=this;c._destroyed||(c._response=new o(c._xhr,c._fetchResponse,c._mode,c._resetTimers.bind(c)),c._response.on("error",function(l){c.emit("error",l)}),c.emit("response",c._response))},r.prototype._write=function(c,l,w){this._body.push(c),w()},r.prototype._resetTimers=function(c){var l=this;b.clearTimeout(l._socketTimer),l._socketTimer=null,c?(b.clearTimeout(l._fetchTimer),l._fetchTimer=null):l._socketTimeout&&(l._socketTimer=b.setTimeout(function(){l.emit("timeout")},l._socketTimeout))},r.prototype.abort=r.prototype.destroy=function(c){var l=this;l._destroyed=!0,l._resetTimers(!0),l._response&&(l._response._destroyed=!0),l._xhr?l._xhr.abort():l._fetchAbortController&&l._fetchAbortController.abort(),c&&l.emit("error",c)},r.prototype.end=function(c,l,w){"function"==typeof c&&(w=c,c=void 0),u.Writable.prototype.end.call(this,c,l,w)},r.prototype.setTimeout=function(c,l){var w=this;l&&w.once("timeout",l),w._socketTimeout=c,w._resetTimers(!1)},r.prototype.flushHeaders=function(){},r.prototype.setNoDelay=function(){},r.prototype.setSocketKeepAlive=function(){};var a=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}).call(this)}).call(this,d("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global,d("buffer").Buffer)},{"./capability":258,"./response":260,_process:193,buffer:76,inherits:147,"readable-stream":228}],260:[function(d,N,A){(function(f,b,m){(function(){var _=d("./capability"),n=d("inherits"),g=d("readable-stream"),h=A.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},s=A.IncomingMessage=function(u,o,t,r){var a=this;if(g.Readable.call(a),a._mode=t,a.headers={},a.rawHeaders=[],a.trailers={},a.rawTrailers=[],a.on("end",function(){f.nextTick(function(){a.emit("close")})}),"fetch"===t){let k=function(){l.read().then(function(I){if(!a._destroyed)return r(I.done),I.done?void a.push(null):(a.push(m.from(I.value)),void k())}).catch(function(I){r(!0),a._destroyed||a.emit("error",I)})};if(a._fetchResponse=o,a.url=o.url,a.statusCode=o.status,a.statusMessage=o.statusText,o.headers.forEach(function(I,V){a.headers[V.toLowerCase()]=I,a.rawHeaders.push(V,I)}),_.writableStream){var c=new WritableStream({write:function(I){return r(!1),new Promise(function(V,$){a._destroyed?$():a.push(m.from(I))?V():a._resumeFetch=V})},close:function(){r(!0),a._destroyed||a.push(null)},abort:function(I){r(!0),a._destroyed||a.emit("error",I)}});try{return void o.body.pipeTo(c).catch(function(I){r(!0),a._destroyed||a.emit("error",I)})}catch{}}var l=o.body.getReader();k()}else if(a._xhr=u,a._pos=0,a.url=u.responseURL,a.statusCode=u.status,a.statusMessage=u.statusText,u.getAllResponseHeaders().split(/\r?\n/).forEach(function(k){var I=k.match(/^([^:]+):\s*(.*)/);if(I){var V=I[1].toLowerCase();"set-cookie"===V?(void 0===a.headers[V]&&(a.headers[V]=[]),a.headers[V].push(I[2])):void 0===a.headers[V]?a.headers[V]=I[2]:a.headers[V]+=", "+I[2],a.rawHeaders.push(I[1],I[2])}}),a._charset="x-user-defined",!_.overrideMimeType){var E=a.rawHeaders["mime-type"];if(E){var C=E.match(/;\s*charset=([^;])(;|$)/);C&&(a._charset=C[1].toLowerCase())}a._charset||(a._charset="utf-8")}};n(s,g.Readable),s.prototype._read=function(){var o=this._resumeFetch;o&&(this._resumeFetch=null,o())},s.prototype._onXHRProgress=function(u){var o=this,t=o._xhr,r=null;switch(o._mode){case"text":if((r=t.responseText).length>o._pos){var a=r.substr(o._pos);if("x-user-defined"===o._charset){for(var c=m.alloc(a.length),l=0;lo._pos&&(o.push(m.from(new Uint8Array(w.result.slice(o._pos)))),o._pos=w.result.byteLength)},w.onload=function(){u(!0),o.push(null)},w.readAsArrayBuffer(r)}o._xhr.readyState===h.DONE&&"ms-stream"!==o._mode&&(u(!0),o.push(null))}}).call(this)}).call(this,d("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global,d("buffer").Buffer)},{"./capability":258,_process:193,buffer:76,inherits:147,"readable-stream":228}],261:[function(d,N,A){N.exports=async function f(m,_){const n=await b(m,_);return URL.createObjectURL(n)};const b=d("stream-to-blob")},{"stream-to-blob":262}],262:[function(d,N,A){N.exports=function f(b,m){if(null!=m&&"string"!=typeof m)throw new Error("Invalid mimetype, expected string.");return new Promise((_,n)=>{const g=[];b.on("data",h=>g.push(h)).once("end",()=>{const h=null==m?new Blob(g):new Blob(g,{type:m});_(h)}).once("error",n)})}},{}],263:[function(d,N,A){(function(f){(function(){var b=d("once");N.exports=function(_,n,g){g=b(g);var h=f.alloc(n),s=0;_.on("data",function(u){u.copy(h,s),s+=u.length}).on("end",function(){g(null,h)}).on("error",g)}}).call(this)}).call(this,d("buffer").Buffer)},{buffer:76,once:178}],264:[function(d,N,A){function f(){this.stream._duplexState|=Ee,this.stream._duplexState&at?this.drain():this.updateNextTick()}function b(Un){const We=this.stream;Un&&We.destroy(Un),!(We._duplexState&kn)&&(We._duplexState|=Dn,We.emit("finish")),(We._duplexState&In)===mn&&(We._duplexState|=D),We._duplexState&=Le,this.update()}function m(Un){const We=this.stream;Un||this.error===V||(Un=this.error),Un&&We.emit("error",Un),We._duplexState|=M,We.emit("close");const Mn=We._readableState,Yn=We._writableState;null!==Mn&&null!==Mn.pipeline&&Mn.pipeline.done(We,Un),null!==Yn&&null!==Yn.pipeline&&Yn.pipeline.done(We,Un)}function _(Un){const We=this.stream;Un&&We.destroy(Un),We._duplexState&=Le,(We._duplexState&me)===fr&&(We._duplexState&=Ct,(We._duplexState&Rt)===Rt&&We.emit("drain")),!(We._duplexState&sn)&&this.update()}function n(Un){Un&&this.stream.destroy(Un),this.stream._duplexState&=J,!(this.stream._duplexState&L)&&this.update()}function g(){this.stream._duplexState&=on,this.update()}function h(){this.stream._duplexState&=Bt,this.update()}function s(Un){const We=this.stream;Un&&We.destroy(Un),!(We._duplexState&D)&&(!(We._duplexState&Rn)&&(We._duplexState|=q),!(We._duplexState&Gn)&&(We._duplexState|=wn),We.emit("open")),We._duplexState&=Ot,null!==We._writableState&&We._writableState.update(),null!==We._readableState&&We._readableState.update()}function u(Un,We){null!=We&&this.push(We),this._writableState.afterWrite(Un)}function o(Un,We){const Mn=this._transformState.afterFinal;return Un?Mn(Un):(null!=We&&this.push(We),this.push(null),void Mn(null))}function r(Un,...We){function Mn(dr,Qr,di,hi){dr.on("error",hi),dr.on("close",function Ur(){return Qr&&dr._readableState&&!dr._readableState.ended||di&&dr._writableState&&!dr._writableState.ended?hi($):void 0})}function Yn(dr){if(dr&&!ci){ci=dr;for(const Qr of Cn)Qr.destroy(dr)}}const Cn=Array.isArray(Un)?[...Un,...We]:[Un,...We],Jn=Cn.length&&"function"==typeof Cn[Cn.length-1]?Cn.pop():null;if(2>Cn.length)throw new Error("Pipeline requires at least 2 streams");let Er=Cn[0],Gr=null,ci=null;for(let dr=1;dr{dr=!0}),Gr.on("error",Qr=>{ci=ci||Qr}),Gr.on("close",()=>Jn(ci||(dr?null:$)))}return Gr}function a(Un){return!!Un._readableState||!!Un._writableState}function c(Un){return"number"==typeof Un._duplexState&&a(Un)}function C(Un){return function E(Un){return"object"==typeof Un&&null!==Un&&"number"==typeof Un.byteLength}(Un)?Un.byteLength:1024}function z(){}function k(){this.destroy(new Error("Stream aborted."))}const{EventEmitter:I}=d("events"),V=new Error("Stream was destroyed"),$=new Error("Premature close"),oe=d("queue-tick"),ue=d("fast-fifo"),Ae=67108863,D=4,M=8,v=1^Ae,F=16,q=32,L=64,Y=128,Ee=512,Se=1024,ut=16384,$t=32784,tt=256|Ee,at=F|L,nt=F|L|65536,Yt=q|F,J=Ae^F,W=Ae^(65536|q),ee=Ae^L,Jt=Ae^tt,on=Ae^$t,Ht=131072,wn=262144,sn=524288,Sn=1048576,fr=2097152,Dn=4194304,Rt=8388608,vr=16908288,de=33554432,Le=Ae^Ht,et=Ae^sn,qe=Ae^wn,Ct=Ae^fr,Bt=Ae^vr,ln=F|Ht,Ot=Ae^ln,mn=ut|Dn,kn=D|M|2,vn=1|kn,In=kn|mn,pr=qe&(Ae^q),Nn=vr|$t,Br=vn|Nn&Ot,Rn=vn|Se|ut,Qn=vn|ut|Y,Wr=vn|Se|Y,Kn=4096|vn|Y|8192,Zn=vn|F|Se|ut|65536,Kr=kn|Se|ut,Gn=vn|de|Dn,er=Sn|fr,me=Sn|fr|vn|Ht,ot=vn|Ht|Sn,ft=wn|Ht,be=Ht|sn,dt=vn|de|1179648|Dn,Zr=fr|kn|de|Dn,ri=Symbol.asyncIterator||Symbol("asyncIterator");class si{constructor(We,{highWaterMark:Mn=16384,map:Yn=null,mapWritable:Cn,byteLength:Jn,byteLengthWritable:Er}={}){this.stream=We,this.queue=new ue,this.highWaterMark=Mn,this.buffered=0,this.error=null,this.pipeline=null,this.byteLength=Er||Jn||C,this.map=Cn||Yn,this.afterWrite=_.bind(this),this.afterUpdateNextTick=h.bind(this)}get ended(){return 0!=(this.stream._duplexState&Dn)}push(We){return null!==this.map&&(We=this.map(We)),this.buffered+=this.byteLength(We),this.queue.push(We),this.bufferedCn?void Cn.then(Er.bind(null,null)).catch(Er):Er(null)});return Jn}static from(We,Mn){if(function w(Un){return c(Un)&&Un.readable}(We))return We;if(We[ri])return this._fromAsyncIterator(We[ri](),Mn);Array.isArray(We)||(We=void 0===We?[]:[We]);let Yn=0;return new ui({...Mn,read(Cn){this.push(Yn===We.length?null:We[Yn++]),Cn(null)}})}static isBackpressured(We){return 0!=(We._duplexState&Kr)||We._readableState.buffered>=We._readableState.highWaterMark}static isPaused(We){return 0==(256&We._duplexState)}[ri](){function Yn(dr){null===ci||(Er?ci(Er):null!==dr||Jn._duplexState&ut?Gr({value:dr,done:null==dr}):ci(V),ci=Gr=null)}function Cn(dr){return Jn.destroy(dr),new Promise((Qr,di)=>Jn._duplexState&M?Qr({value:void 0,done:!0}):void Jn.once("close",function(){dr?di(dr):Qr({value:void 0,done:!0})}))}const Jn=this;let Er=null,Gr=null,ci=null;return this.on("error",dr=>{Er=dr}),this.on("readable",function We(){null!==Gr&&Yn(Jn.read())}),this.on("close",function Mn(){null!==Gr&&Yn(null)}),{[ri](){return this},next:()=>new Promise(function(dr,Qr){Gr=dr,ci=Qr;const di=Jn.read();null===di?Jn._duplexState&M&&Yn(null):Yn(di)}),return:()=>Cn(null),throw:dr=>Cn(dr)}}}class li extends ui{constructor(We){super(We),this._duplexState=1,this._writableState=new si(this,We),We&&(We.writev&&(this._writev=We.writev),We.write&&(this._write=We.write),We.final&&(this._final=We.final))}_writev(We,Mn){Mn(null)}_write(We,Mn){this._writableState.autoBatch(We,Mn)}_final(We){We(null)}write(We){return this._writableState.updateNextTick(),this._writableState.push(We)}end(We){return this._writableState.updateNextTick(),this._writableState.end(We),this}}class Vr extends li{constructor(We){super(We),this._transformState=new yi(this),We&&(We.transform&&(this._transform=We.transform),We.flush&&(this._flush=We.flush))}_write(We,Mn){this._readableState.buffered>=this._readableState.highWaterMark?this._transformState.data=We:this._transform(We,this._transformState.afterTransform)}_read(We){if(null!==this._transformState.data){const Mn=this._transformState.data;this._transformState.data=null,We(null),this._transform(Mn,this._transformState.afterTransform)}else We(null)}_transform(We,Mn){Mn(null,We)}_flush(We){We(null)}_final(We){this._transformState.afterFinal=We,this._flush(o.bind(this))}}N.exports={pipeline:r,pipelinePromise:function t(...Un){return new Promise((We,Mn)=>r(...Un,Yn=>Yn?Mn(Yn):void We()))},isStream:a,isStreamx:c,getStreamError:function l(Un){return Un._readableState&&Un._readableState.error||Un._writableState&&Un._writableState.error},Stream:zr,Writable:class ai extends zr{constructor(We){super(We),this._duplexState|=1|ut,this._writableState=new si(this,We),We&&(We.writev&&(this._writev=We.writev),We.write&&(this._write=We.write),We.final&&(this._final=We.final))}_writev(We,Mn){Mn(null)}_write(We,Mn){this._writableState.autoBatch(We,Mn)}_final(We){We(null)}static isBackpressured(We){return 0!=(We._duplexState&Zr)}write(We){return this._writableState.updateNextTick(),this._writableState.push(We)}end(We){return this._writableState.updateNextTick(),this._writableState.end(We),this}},Readable:ui,Duplex:li,Transform:Vr,PassThrough:class Fr extends Vr{}}},{events:123,"fast-fifo":127,"queue-tick":207}],265:[function(d,N,A){arguments[4][71][0].apply(A,arguments)},{dup:71,"safe-buffer":235}],266:[function(d,N,A){var f=d("./thirty-two");A.encode=f.encode,A.decode=f.decode},{"./thirty-two":267}],267:[function(d,N,A){(function(f){(function(){"use strict";var _=[255,255,26,27,28,29,30,31,255,255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255];A.encode=function(n){f.isBuffer(n)||(n=new f(n));for(var g=0,h=0,s=0,u=0,o=new f(8*function b(n){var g=xt(n.length/5);return n.length%5==0?g:g+1}(n));g>s)<<(s=(s+5)%8)|(g+1>8-s,g++):(u=31&t>>8-(s+5),0==(s=(s+5)%8)&&g++),o[h]="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".charCodeAt(u),h++}for(g=h;g=g?0==(g=(g+5)%8)?(o[s]=u|=h,s++,u=0):u|=255&h<<8-g:(o[s]=u|=255&h>>>(g=(g+5)%8),s++,u=255&h<<8-g)}return o.slice(0,s)}}).call(this)}).call(this,d("buffer").Buffer)},{buffer:76}],268:[function(d,N,A){function f(n){return 65535&(+Date.now()-n)/_}const _=100;N.exports=function(n){const g=+Date.now(),h=10*(n||5),s=[0];let u=1,o=f(g)-1&65535;return function(t){const r=f(g);let a=r-o&65535;for(a>h&&(a=h),o=r;a--;)u===h&&(u=0),s[u]=s[0==u?h-1:u-1],u++;t&&(s[u-1]+=t);const c=s[u-1];return s.length<10?c:10*(c-(s.length{this.emit("warning",r)},this._onError=r=>{this.emit("error",r)},this._onDHTPeer=(r,a)=>{a.toString("hex")!==this.infoHash||this.emit("peer",`${r.host}:${r.port}`,"dht")},this._onTrackerPeer=r=>{this.emit("peer",r,"tracker")},this._onTrackerAnnounce=()=>{this.emit("trackerAnnounce")},this._onLSDPeer=(r,a)=>{this.emit("peer",r,"lsd")};const t=(r,a)=>{const c=new m(a);return c.on("warning",this._onWarning),c.on("error",this._onError),c.listen(r),this._internalDHT=!0,c};!1===o.tracker?this.tracker=null:o.tracker&&"object"==typeof o.tracker?(this._trackerOpts=Object.assign({},o.tracker),this.tracker=this._createTracker()):this.tracker=this._createTracker(),this.dht=!1===o.dht||"function"!=typeof m?null:o.dht&&"function"==typeof o.dht.addNode?o.dht:o.dht&&"object"==typeof o.dht?t(o.dhtPort,o.dht):t(o.dhtPort),this.dht&&(this.dht.on("peer",this._onDHTPeer),this._dhtAnnounce()),this.lsd=!1===o.lsd||"function"!=typeof h?null:this._createLSD()}updatePort(o){o===this._port||(this._port=o,this.dht&&this._dhtAnnounce(),this.tracker&&(this.tracker.stop(),this.tracker.destroy(()=>{this.tracker=this._createTracker()})))}complete(o){this.tracker&&this.tracker.complete(o)}destroy(o){if(!this.destroyed){this.destroyed=!0,clearTimeout(this._dhtTimeout);const t=[];this.tracker&&(this.tracker.stop(),this.tracker.removeListener("warning",this._onWarning),this.tracker.removeListener("error",this._onError),this.tracker.removeListener("peer",this._onTrackerPeer),this.tracker.removeListener("update",this._onTrackerAnnounce),t.push(r=>{this.tracker.destroy(r)})),this.dht&&this.dht.removeListener("peer",this._onDHTPeer),this._internalDHT&&(this.dht.removeListener("warning",this._onWarning),this.dht.removeListener("error",this._onError),t.push(r=>{this.dht.destroy(r)})),this.lsd&&(this.lsd.removeListener("warning",this._onWarning),this.lsd.removeListener("error",this._onError),this.lsd.removeListener("peer",this._onLSDPeer),t.push(r=>{this.lsd.destroy(r)})),n(t,o),this.dht=null,this.tracker=null,this.lsd=null,this._announce=null}}_createTracker(){const o=Object.assign({},this._trackerOpts,{infoHash:this.infoHash,announce:this._announce,peerId:this.peerId,port:this._port,userAgent:this._userAgent}),t=new g(o);return t.on("warning",this._onWarning),t.on("error",this._onError),t.on("peer",this._onTrackerPeer),t.on("update",this._onTrackerAnnounce),t.setInterval(this._intervalMs),t.start(),t}_dhtAnnounce(){this._dhtAnnouncing||(b("dht announce"),this._dhtAnnouncing=!0,clearTimeout(this._dhtTimeout),this.dht.announce(this.infoHash,this._port,o=>{this._dhtAnnouncing=!1,b("dht announce complete"),o&&this.emit("warning",o),this.emit("dhtAnnounce"),this.destroyed||(this._dhtTimeout=setTimeout(()=>{this._dhtAnnounce()},this._intervalMs+xt(Math.random()*this._intervalMs/5)),this._dhtTimeout.unref&&this._dhtTimeout.unref())}))}_createLSD(){const o=Object.assign({},{infoHash:this.infoHash,peerId:this.peerId,port:this._port}),t=new h(o);return t.on("warning",this._onWarning),t.on("error",this._onError),t.on("peer",this._onLSDPeer),t.start(),t}}}).call(this)}).call(this,d("_process"))},{_process:193,"bittorrent-dht/client":42,"bittorrent-lsd":42,"bittorrent-tracker/client":33,debug:91,events:123,"run-parallel":233}],271:[function(d,N,A){(function(f){(function(){class m{constructor(n){this.length=n,this.missing=n,this.sources=null,this._chunks=_e(n/16384),this._remainder=n%16384||16384,this._buffered=0,this._buffer=null,this._cancellations=null,this._reservations=0,this._flushed=!1}chunkLength(n){return n===this._chunks-1?this._remainder:16384}chunkLengthRemaining(n){return this.length-16384*n}chunkOffset(n){return 16384*n}reserve(){return this.init()?this._cancellations.length?this._cancellations.pop():this._reservations=b.length||0>m)){var _=b.pop();if(m",'"',"`"," ","\r","\n","\t"]),a=["'"].concat(r),c=["%","/","?",";","#"].concat(a),l=["/","?","#"],E=/^[+a-z0-9A-Z_-]{0,63}$/,C=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,z={javascript:!0,"javascript:":!0},k={javascript:!0,"javascript:":!0},I={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},V=d("querystring");f.prototype.parse=function($,oe,ue){if(!h.isString($))throw new TypeError("Parameter 'url' must be a string, not "+typeof $);var Ae=$.indexOf("?"),X=-1!==Ae&&Ae<$.indexOf("#")?"?":"#",T=$.split(X);T[0]=T[0].replace(/\\/g,"/");var M=$=T.join(X);if(M=M.trim(),!ue&&1===$.split("#").length){var v=o.exec(M);if(v)return this.path=M,this.href=M,this.pathname=v[1],v[2]?(this.search=v[2],this.query=oe?V.parse(this.search.substr(1)):this.search.substr(1)):oe&&(this.search="",this.query={}),this}var O,B=s.exec(M);if(B){var F=(B=B[0]).toLowerCase();this.protocol=F,M=M.substr(B.length)}if(ue||B||M.match(/^\/\/[^@\/]+@[^@\/]+/)){var q="//"===M.substr(0,2);q&&(!B||!k[B])&&(M=M.substr(2),this.slashes=!0)}if(!k[B]&&(q||B&&!I[B])){for(var L=-1,Y=0;YJe.length&&Je.unshift(""),ue.pathname=Je.join("/")}return ue.search=$.search,ue.query=$.query,ue.host=$.host||"",ue.auth=$.auth,ue.hostname=$.hostname||$.host,ue.port=$.port,(ue.pathname||ue.search)&&(ue.path=(ue.pathname||"")+(ue.search||"")),ue.slashes=ue.slashes||$.slashes,ue.href=ue.format(),ue}var se=ue.pathname&&"/"===ue.pathname.charAt(0),Ee=$.host||$.pathname&&"/"===$.pathname.charAt(0),Se=Ee||se||ue.host&&$.pathname,Ie=Se,Qe=ue.pathname&&ue.pathname.split("/")||[],ut=(Je=$.pathname&&$.pathname.split("/")||[],ue.protocol&&!I[ue.protocol]);if(ut&&(ue.hostname="",ue.port=null,ue.host&&(""===Qe[0]?Qe[0]=ue.host:Qe.unshift(ue.host)),ue.host="",$.protocol&&($.hostname=null,$.port=null,$.host&&(""===Je[0]?Je[0]=$.host:Je.unshift($.host)),$.host=null),Se=Se&&(""===Je[0]||""===Qe[0])),Ee)ue.host=$.host||""===$.host?$.host:ue.host,ue.hostname=$.hostname||""===$.hostname?$.hostname:ue.hostname,ue.search=$.search,ue.query=$.query,Qe=Je;else if(Je.length)Qe||(Qe=[]),Qe.pop(),Qe=Qe.concat(Je),ue.search=$.search,ue.query=$.query;else if(!h.isNullOrUndefined($.search))return ut&&(ue.hostname=ue.host=Qe.shift(),($t=!!(ue.host&&0{class t extends b{constructor(a){super(),this._wire=a,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new _(0,{grow:1e3}),f.isBuffer(o)&&this.setMetadata(o)}onHandshake(a,c,l){this._infoHash=a}onExtendedHandshake(a){return a.m&&a.m.ut_metadata?a.metadata_size?"number"!=typeof a.metadata_size||1e7=a.metadata_size?this.emit("warning",new Error("Peer gave invalid metadata size")):(this._metadataSize=a.metadata_size,this._numPieces=_e(this._metadataSize/u),this._remainingRejects=2*this._numPieces,void this._requestPieces()):this.emit("warning",new Error("Peer does not have metadata")):this.emit("warning",new Error("Peer does not support ut_metadata"))}onMessage(a){let c,l;try{const w=a.toString(),E=w.indexOf("ee")+2;c=m.decode(w.substring(0,E)),l=a.slice(E)}catch{return}switch(c.msg_type){case 0:this._onRequest(c.piece);break;case 1:this._onData(c.piece,l,c.total_size);break;case 2:this._onReject(c.piece)}}fetch(){this._metadataComplete||(this._fetching=!0,this._metadataSize&&this._requestPieces())}cancel(){this._fetching=!1}setMetadata(a){if(this._metadataComplete)return!0;n("set metadata");try{const c=m.decode(a).info;c&&(a=m.encode(c))}catch{}return!(this._infoHash&&this._infoHash!==g.sync(a)||(this.cancel(),this.metadata=a,this._metadataComplete=!0,this._metadataSize=this.metadata.length,this._wire.extendedHandshake.metadata_size=this._metadataSize,this.emit("metadata",m.encode({info:m.decode(this.metadata)})),0))}_send(a,c){let l=m.encode(a);f.isBuffer(c)&&(l=f.concat([l,c])),this._wire.extended("ut_metadata",l)}_request(a){this._send({msg_type:0,piece:a})}_data(a,c,l){const w={msg_type:1,piece:a};"number"==typeof l&&(w.total_size=l),this._send(w,c)}_reject(a){this._send({msg_type:2,piece:a})}_onRequest(a){if(!this._metadataComplete)return void this._reject(a);const c=a*u;let l=c+u;l>this._metadataSize&&(l=this._metadataSize);const w=this.metadata.slice(c,l);this._data(a,w,this._metadataSize)}_onData(a,c,l){c.length>u||!this._fetching||(c.copy(this.metadata,a*u),this._bitfield.set(a),this._checkDone())}_onReject(a){0"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{}],278:[function(d,N,A){(function(f){(function(){const m=d("binary-search"),_=d("events"),n=d("mp4-stream"),g=d("mp4-box-encoding"),h=d("range-slice-stream");class o{constructor(a,c){this._entries=a,this._countName=c||"count",this._index=0,this._offset=0,this.value=this._entries[0]}inc(){this._offset++,this._offset>=this._entries[this._index][this._countName]&&(this._index++,this._offset=0),this.value=this._entries[this._index]}}N.exports=class u extends _{constructor(a){super(),this._tracks=[],this._file=a,this._decoder=null,this._findMoov(0)}_findMoov(a){this._decoder&&this._decoder.destroy();let c=0;this._decoder=n.decode();const l=this._file.createReadStream({start:a});l.pipe(this._decoder);const w=E=>{"moov"===E.type?(this._decoder.removeListener("box",w),this._decoder.decode(C=>{l.destroy();try{this._processMoov(C)}catch(z){z.message=`Cannot parse mp4 file: ${z.message}`,this.emit("error",z)}})):E.length<4096?(c+=E.length,this._decoder.ignore()):(this._decoder.removeListener("box",w),c+=E.length,l.destroy(),this._decoder.destroy(),this._findMoov(a+c))};this._decoder.on("box",w)}_processMoov(a){const c=a.traks;this._tracks=[],this._hasVideo=!1,this._hasAudio=!1;for(let C=0;C=k.stsz.entries.length)break;if(X++,D+=se,X>=l.samplesPerChunk){X=0,D=0,T++;const Je=k.stsc.entries[M+1];Je&&T+1>=Je.firstChunk&&M++}v+=Ee,B.inc(),F&&F.inc(),Ie&&Y++}z.mdia.mdhd.duration=0,z.tkhd.duration=0,this._tracks.push({fragmentSequence:1,trackId:z.tkhd.trackId,timeScale:z.mdia.mdhd.timeScale,samples:ue,currSample:null,currTime:null,moov:{type:"moov",mvhd:a.mvhd,traks:[{tkhd:z.tkhd,mdia:{mdhd:z.mdia.mdhd,hdlr:z.mdia.hdlr,elng:z.mdia.elng,minf:{vmhd:z.mdia.minf.vmhd,smhd:z.mdia.minf.smhd,dinf:z.mdia.minf.dinf,stbl:{stsd:k.stsd,stts:{version:0,flags:0,entries:[]},ctts:{version:0,flags:0,entries:[]},stsc:{version:0,flags:0,entries:[]},stsz:{version:0,flags:0,entries:[]},stco:{version:0,flags:0,entries:[]},stss:{version:0,flags:0,entries:[]}}}}}],mvex:{mehd:{fragmentDuration:a.mvhd.duration},trexs:[{trackId:z.tkhd.trackId,defaultSampleDescriptionIndex:l.sampleDescriptionId,defaultSampleDuration:0,defaultSampleSize:0,defaultSampleFlags:0}]}},mime:oe})}if(0===this._tracks.length)return void this.emit("error",new Error("no playable tracks"));a.mvhd.duration=0,this._ftyp={type:"ftyp",brand:"iso5",brandVersion:0,compatibleBrands:["iso5"]};const w=g.encode(this._ftyp),E=this._tracks.map(C=>{const z=g.encode(C.moov);return{mime:C.mime,init:f.concat([w,z])}});this.emit("ready",E)}seek(a){if(!this._tracks)throw new Error("Not ready yet; wait for 'ready' event");this._fileStream&&(this._fileStream.destroy(),this._fileStream=null);let c=-1;if(this._tracks.map((l,w)=>{l.outStream&&l.outStream.destroy(),l.inStream&&(l.inStream.destroy(),l.inStream=null);const E=l.outStream=n.encode(),C=this._generateFragment(w,a);if(!C)return E.finalize();(-1===c||C.ranges[0].start{E.destroyed||E.box(k.moof,I=>{if(I)return this.emit("error",I);E.destroyed||l.inStream.slice(k.ranges).pipe(E.mediaData(k.length,$=>{if($)return this.emit("error",$);if(!E.destroyed){const oe=this._generateFragment(w);return oe?void z(oe):E.finalize()}}))})};z(C)}),0<=c){const l=this._fileStream=this._file.createReadStream({start:c});this._tracks.forEach(w=>{w.inStream=new h(c,{highWaterMark:1e7}),l.pipe(w.inStream)})}return this._tracks.map(l=>l.outStream)}_findSampleBefore(a,c){const l=this._tracks[a],w=xt(l.timeScale*c);let E=m(l.samples,w,(C,z)=>C.dts+C.presentationOffset-z);for(-1===E?E=0:0>E&&(E=-E-2);!l.samples[E].sync;)E--;return E}_generateFragment(a,c){const l=this._tracks[a];let w;if(w=void 0===c?l.currSample:this._findSampleBefore(a,c),w>=l.samples.length)return null;const E=l.samples[w].dts;let C=0;const z=[];for(var k=w;k=1*l.timeScale)break;C+=I.size;const V=z.length-1;0>V||z[V].end!==I.offset?z.push({start:I.offset,end:I.offset+I.size}):z[V].end+=I.size}return l.currSample=k,{moof:this._generateMoof(a,w,k),ranges:z,length:C}}_generateMoof(a,c,l){const w=this._tracks[a],E=[];let C=0;for(let k=c;kI.presentationOffset&&(C=1),E.push({sampleDuration:I.duration,sampleSize:I.size,sampleFlags:I.sync?33554432:16842752,sampleCompositionTimeOffset:I.presentationOffset})}const z={type:"moof",mfhd:{sequenceNumber:w.fragmentSequence++},trafs:[{tfhd:{flags:131072,trackId:w.trackId},tfdt:{baseMediaDecodeTime:w.samples[c].dts},trun:{flags:3841,dataOffset:8,entries:E,version:C}}]};return z.trafs[0].trun.dataOffset+=g.encodingLength(z),z}}}).call(this)}).call(this,d("buffer").Buffer)},{"binary-search":30,buffer:76,events:123,"mp4-box-encoding":172,"mp4-stream":175,"range-slice-stream":212}],279:[function(d,N,A){function f(n,g,h={}){return this instanceof f?(this.detailedError=null,this._elem=g,this._elemWrapper=new b(g),this._waitingFired=!1,this._trackMeta=null,this._file=n,this._tracks=null,"none"!==this._elem.preload&&this._createMuxer(),this._onError=()=>{this.detailedError=this._elemWrapper.detailedError,this.destroy()},this._onWaiting=()=>{this._waitingFired=!0,this._muxer?this._tracks&&this._pump():this._createMuxer()},g.autoplay&&(g.preload="auto"),g.addEventListener("waiting",this._onWaiting),void g.addEventListener("error",this._onError)):(console.warn("Don't invoke VideoStream without the 'new' keyword."),new f(n,g,h))}const b=d("mediasource"),m=d("pump"),_=d("./mp4-remuxer");f.prototype={_createMuxer(){this._muxer=new _(this._file),this._muxer.on("ready",n=>{this._tracks=n.map(g=>{const h=this._elemWrapper.createWriteStream(g.mime);h.on("error",u=>{this._elemWrapper.error(u)});const s={muxed:null,mediaSource:h,initFlushed:!1,onInitFlushed:null};return h.write(g.init,u=>{s.initFlushed=!0,s.onInitFlushed&&s.onInitFlushed(u)}),s}),(this._waitingFired||"auto"===this._elem.preload)&&this._pump()}),this._muxer.on("error",n=>{this._elemWrapper.error(n)})},_pump(){const n=this._muxer.seek(this._elem.currentTime,!this._tracks);this._tracks.forEach((g,h)=>{const s=()=>{g.muxed&&(g.muxed.destroy(),g.mediaSource=this._elemWrapper.createWriteStream(g.mediaSource),g.mediaSource.on("error",u=>{this._elemWrapper.error(u)})),g.muxed=n[h],m(g.muxed,g.mediaSource)};g.initFlushed?s():g.onInitFlushed=u=>u?void this._elemWrapper.error(u):void s()})},destroy(){this.destroyed||(this.destroyed=!0,this._elem.removeEventListener("waiting",this._onWaiting),this._elem.removeEventListener("error",this._onError),this._tracks&&this._tracks.forEach(n=>{n.muxed&&n.muxed.destroy()}),this._elem.src="")}},N.exports=f},{"./mp4-remuxer":278,mediasource:160,pump:201}],280:[function(d,N,A){N.exports=function f(b,m){function _(){for(var n=Array(arguments.length),g=0;g("0"+Ae%100).slice(-2)).slice(0,4),oe=`-WW${$}-`;class ue extends _{constructor(X={}){super(),this.peerId="string"==typeof X.peerId?X.peerId:f.isBuffer(X.peerId)?X.peerId.toString("hex"):f.from(oe+l(9).toString("base64")).toString("hex"),this.peerIdBuffer=f.from(this.peerId,"hex"),this.nodeId="string"==typeof X.nodeId?X.nodeId:f.isBuffer(X.nodeId)?X.nodeId.toString("hex"):l(20).toString("hex"),this.nodeIdBuffer=f.from(this.nodeId,"hex"),this._debugId=this.peerId.toString("hex").substring(0,7),this.destroyed=!1,this.listening=!1,this.torrentPort=X.torrentPort||0,this.dhtPort=X.dhtPort||0,this.tracker=void 0===X.tracker?{}:X.tracker,this.lsd=!1!==X.lsd,this.torrents=[],this.maxConns=+X.maxConns||55,this.utp=ue.UTP_SUPPORT&&!1!==X.utp,this._downloadLimit=pe("number"==typeof X.downloadLimit?X.downloadLimit:-1,-1),this._uploadLimit=pe("number"==typeof X.uploadLimit?X.uploadLimit:-1,-1),this.serviceWorker=null,this.workerKeepAliveInterval=null,this.workerPortCount=0,!0===X.secure&&d("./lib/peer").enableSecure(),this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.throttleGroups={down:new C({rate:pe(this._downloadLimit,0),enabled:0<=this._downloadLimit}),up:new C({rate:pe(this._uploadLimit,0),enabled:0<=this._uploadLimit})},this.tracker&&("object"!=typeof this.tracker&&(this.tracker={}),globalThis.WRTC&&!this.tracker.wrtc&&(this.tracker.wrtc=globalThis.WRTC)),"function"==typeof z?this._connPool=new z(this):c(()=>{this._onListening()}),this._downloadSpeed=E(),this._uploadSpeed=E(),!1!==X.dht&&"function"==typeof u?(this.dht=new u(Object.assign({},{nodeId:this.nodeId},X.dht)),this.dht.once("error",D=>{this._destroy(D)}),this.dht.once("listening",()=>{const D=this.dht.address();D&&(this.dhtPort=D.port)}),this.dht.setMaxListeners(0),this.dht.listen(this.dhtPort)):this.dht=!1,this.enableWebSeeds=!1!==X.webSeeds;const T=()=>{this.destroyed||(this.ready=!0,this.emit("ready"))};"function"==typeof o&&null!=X.blocklist?o(X.blocklist,{headers:{"user-agent":`WebTorrent/${I} (https://webtorrent.io)`}},(D,M)=>D?console.error(`Failed to load blocklist: ${D.message}`):(this.blocked=M,void T())):c(T)}loadWorker(X,T=(()=>{})){if(!(X instanceof ServiceWorker))throw new Error("Invalid worker registration");if("activated"!==X.state)throw new Error("Worker isn't activated");this.serviceWorker=X,navigator.serviceWorker.addEventListener("message",M=>{const{data:v}=M;if(!v.type||"webtorrent"===!v.type||!v.url)return null;let[B,...F]=v.url.slice(v.url.indexOf(v.scope+"webtorrent/")+11+v.scope.length).split("/");if(F=decodeURI(F.join("/")),!B||!F)return null;const[q]=M.ports,L=this.get(B)&&this.get(B).files.find(Qe=>Qe.path===F);if(!L)return null;const[Y,se,Ee]=L._serve(v),Se=se&&se[Symbol.asyncIterator](),Ie=()=>{q.onmessage=null,se&&se.destroy(),Ee&&Ee.destroy(),this.workerPortCount--,this.workerPortCount||(clearInterval(this.workerKeepAliveInterval),this.workerKeepAliveInterval=null)};q.onmessage=async Qe=>{if(Qe.data){let Je;try{Je=(await Se.next()).value}catch{}q.postMessage(Je),Je||Ie(),this.workerKeepAliveInterval||(this.workerKeepAliveInterval=setInterval(()=>fetch(`${this.serviceWorker.scriptURL.slice(0,this.serviceWorker.scriptURL.lastIndexOf("/")+1).slice(window.location.origin.length)}webtorrent/keepalive/`),2e4))}else Ie()},this.workerPortCount++,q.postMessage(Y)}),fetch(`${this.serviceWorker.scriptURL.slice(0,this.serviceWorker.scriptURL.lastIndexOf("/")+1).slice(window.location.origin.length)}webtorrent/cancel/`).then(M=>{M.body.cancel()}),T(null,this.serviceWorker)}get downloadSpeed(){return this._downloadSpeed()}get uploadSpeed(){return this._uploadSpeed()}get progress(){const X=this.torrents.filter(M=>1!==M.progress);return X.reduce((M,v)=>M+v.downloaded,0)/(X.reduce((M,v)=>M+(v.length||0),0)||1)}get ratio(){return this.torrents.reduce((D,M)=>D+M.uploaded,0)/(this.torrents.reduce((D,M)=>D+M.received,0)||1)}get(X){if(X instanceof k){if(this.torrents.includes(X))return X}else{let T;try{T=r(X)}catch{}if(!T)return null;if(!T.infoHash)throw new Error("Invalid torrent identifier");for(const D of this.torrents)if(D.infoHash===T.infoHash)return D}return null}add(X,T={},D=(()=>{})){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof T&&([T,D]=[{},T]);const v=()=>{if(!this.destroyed)for(const q of this.torrents)if(q.infoHash===F.infoHash&&q!==F)return F._destroy(new Error(`Cannot add duplicate torrent ${F.infoHash}`)),void D(q)},B=()=>{this.destroyed||(D(F),this.emit("torrent",F))};this._debug("add"),T=T?Object.assign({},T):{};const F=new k(X,this,T);return this.torrents.push(F),F.once("_infoHash",v),F.once("ready",B),F.once("close",function M(){F.removeListener("_infoHash",v),F.removeListener("ready",B),F.removeListener("close",M)}),F}seed(X,T,D){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof T&&([T,D]=[{},T]),this._debug("seed"),(T=T?Object.assign({},T):{}).skipVerify=!0;const M="string"==typeof X;M&&(T.path=n.dirname(X)),T.createdBy||(T.createdBy=`WebTorrent/${$}`);const B=L=>{this._debug("on seed"),"function"==typeof D&&D(L),L.emit("seed"),this.emit("seed",L)},F=this.add(null,T,L=>{const Y=[se=>M||T.preloadedStore?se():void L.load(q,se)];this.dht&&Y.push(se=>{L.once("dhtAnnounce",se)}),t(Y,se=>this.destroyed?void 0:se?L._destroy(se):void B(L))});let q;return function m(Ae){return typeof FileList<"u"&&Ae instanceof FileList}(X)?X=Array.from(X):!Array.isArray(X)&&(X=[X]),t(X.map(L=>Y=>{!T.preloadedStore&&function b(Ae){return"object"==typeof Ae&&null!=Ae&&"function"==typeof Ae.pipe}(L)?g(L,(se,Ee)=>se?Y(se):(Ee.name=L.name,void Y(null,Ee))):Y(null,L)}),(L,Y)=>this.destroyed?void 0:L?F._destroy(L):void h.parseInput(Y,T,(se,Ee)=>this.destroyed?void 0:se?F._destroy(se):(q=Ee.map(Se=>Se.getStream),void h(Y,T,(Se,Ie)=>{if(!this.destroyed){if(Se)return F._destroy(Se);const Qe=this.get(Ie);Qe?(console.warn("A torrent with the same id is already being seeded"),F._destroy(),"function"==typeof D&&D(Qe)):F._onTorrentId(Ie)}})))),F}remove(X,T,D){if("function"==typeof T)return this.remove(X,null,T);if(this._debug("remove"),!this.get(X))throw new Error(`No torrent with id ${X}`);this._remove(X,T,D)}_remove(X,T,D){if("function"==typeof T)return this._remove(X,null,T);const M=this.get(X);M&&(this.torrents.splice(this.torrents.indexOf(M),1),M.destroy(T,D),this.dht&&this.dht._tables.remove(M.infoHash))}address(){return this.listening?this._connPool?this._connPool.tcpServer.address():{address:"0.0.0.0",family:"IPv4",port:0}:null}throttleDownload(X){return X=+X,!(isNaN(X)||!isFinite(X)||-1>X)&&(this._downloadLimit=X,0>this._downloadLimit?this.throttleGroups.down.setEnabled(!1):(this.throttleGroups.down.setEnabled(!0),void this.throttleGroups.down.setRate(this._downloadLimit)))}throttleUpload(X){return X=+X,!(isNaN(X)||!isFinite(X)||-1>X)&&(this._uploadLimit=X,0>this._uploadLimit?this.throttleGroups.up.setEnabled(!1):(this.throttleGroups.up.setEnabled(!0),void this.throttleGroups.up.setRate(this._uploadLimit)))}destroy(X){if(this.destroyed)throw new Error("client already destroyed");this._destroy(null,X)}_destroy(X,T){this._debug("client destroy"),this.destroyed=!0;const D=this.torrents.map(M=>v=>{M.destroy(v)});this._connPool&&D.push(M=>{this._connPool.destroy(M)}),this.dht&&D.push(M=>{this.dht.destroy(M)}),t(D,T),X&&this.emit("error",X),this.torrents=[],this._connPool=null,this.dht=null,this.throttleGroups.down.destroy(),this.throttleGroups.up.destroy()}_onListening(){if(this._debug("listening"),this.listening=!0,this._connPool){const X=this._connPool.tcpServer.address();X&&(this.torrentPort=X.port)}this.emit("listening")}_debug(){const X=[].slice.call(arguments);X[0]=`[${this._debugId}] ${X[0]}`,V(...X)}_getByHash(X){for(const T of this.torrents)if(T.infoHashHash||(T.infoHashHash=w.sync(f.from("72657132"+T.infoHash,"hex"))),X===T.infoHashHash)return T;return null}}ue.WEBRTC_SUPPORT=a.WEBRTC_SUPPORT,ue.UTP_SUPPORT=z.UTP_SUPPORT,ue.VERSION=I,N.exports=ue}).call(this)}).call(this,d("buffer").Buffer)},{"./lib/conn-pool.js":42,"./lib/peer":3,"./lib/torrent.js":5,"./package.json":282,"bittorrent-dht/client":42,buffer:76,"create-torrent":89,debug:91,events:123,"load-ip-set":42,"parse-torrent":184,path:185,"queue-microtask":206,randombytes:209,"run-parallel":233,"simple-concat":245,"simple-peer":247,"simple-sha1":248,"speed-limiter":251,throughput:268}]},{},[283])(283)}),function(Gt){"object"==typeof exports&&typeof module<"u"?module.exports=Gt():"function"==typeof define&&define.amd?define([],Gt):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).Kuroshiro=Gt()}(function(){return function At(xt,kt,Q){function je(he,te){if(!kt[he]){if(!xt[he]){var pe="function"==typeof require&&require;if(!te&&pe)return pe(he,!0);if(Pe)return Pe(he,!0);var _e=new Error("Cannot find module '"+he+"'");throw _e.code="MODULE_NOT_FOUND",_e}var ne=kt[he]={exports:{}};xt[he][0].call(ne.exports,function(le){return je(xt[he][1][le]||le)},ne,ne.exports,At,xt,kt,Q)}return kt[he].exports}for(var Pe="function"==typeof require&&require,y=0;y=0,Pe=je&&Q.regeneratorRuntime;if(Q.regeneratorRuntime=void 0,xt.exports=At("./runtime"),je)Q.regeneratorRuntime=Pe;else try{delete Q.regeneratorRuntime}catch{Q.regeneratorRuntime=void 0}},{"./runtime":3}],3:[function(At,xt,kt){!function(Q){"use strict";var je,Pe=Object.prototype,y=Pe.hasOwnProperty,he="function"==typeof Symbol?Symbol:{},te=he.iterator||"@@iterator",pe=he.asyncIterator||"@@asyncIterator",_e=he.toStringTag||"@@toStringTag",ne="object"==typeof xt,le=Q.regeneratorRuntime;if(le)ne&&(xt.exports=le);else{(le=Q.regeneratorRuntime=ne?xt.exports:{}).wrap=h;var d="suspendedStart",N="suspendedYield",A="executing",f="completed",b={},m={};m[te]=function(){return this};var _=Object.getPrototypeOf,n=_&&_(_(C([])));n&&n!==Pe&&y.call(n,te)&&(m=n);var g=t.prototype=u.prototype=Object.create(m);o.prototype=g.constructor=t,t.constructor=o,t[_e]=o.displayName="GeneratorFunction",le.isGeneratorFunction=function(k){var I="function"==typeof k&&k.constructor;return!!I&&(I===o||"GeneratorFunction"===(I.displayName||I.name))},le.mark=function(k){return Object.setPrototypeOf?Object.setPrototypeOf(k,t):(k.__proto__=t,_e in k||(k[_e]="GeneratorFunction")),k.prototype=Object.create(g),k},le.awrap=function(k){return{__await:k}},r(a.prototype),a.prototype[pe]=function(){return this},le.AsyncIterator=a,le.async=function(k,I,V,$){var oe=new a(h(k,I,V,$));return le.isGeneratorFunction(I)?oe:oe.next().then(function(ue){return ue.done?ue.value:oe.next()})},r(g),g[_e]="Generator",g[te]=function(){return this},g.toString=function(){return"[object Generator]"},le.keys=function(k){var I=[];for(var V in k)I.push(V);return I.reverse(),function $(){for(;I.length;){var oe=I.pop();if(oe in k)return $.value=oe,$.done=!1,$}return $.done=!0,$}},le.values=C,E.prototype={constructor:E,reset:function(k){if(this.prev=0,this.next=0,this.sent=this._sent=je,this.done=!1,this.delegate=null,this.method="next",this.arg=je,this.tryEntries.forEach(w),!k)for(var I in this)"t"===I.charAt(0)&&y.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=je)},stop:function(){this.done=!0;var k=this.tryEntries[0].completion;if("throw"===k.type)throw k.arg;return this.rval},dispatchException:function(k){if(this.done)throw k;var I=this;function V(T,D){return ue.type="throw",ue.arg=k,I.next=T,D&&(I.method="next",I.arg=je),!!D}for(var $=this.tryEntries.length-1;$>=0;--$){var oe=this.tryEntries[$],ue=oe.completion;if("root"===oe.tryLoc)return V("end");if(oe.tryLoc<=this.prev){var Ae=y.call(oe,"catchLoc"),X=y.call(oe,"finallyLoc");if(Ae&&X){if(this.prev=0;--V){var $=this.tryEntries[V];if($.tryLoc<=this.prev&&y.call($,"finallyLoc")&&this.prev<$.finallyLoc){var oe=$;break}}oe&&("break"===k||"continue"===k)&&oe.tryLoc<=I&&I<=oe.finallyLoc&&(oe=null);var ue=oe?oe.completion:{};return ue.type=k,ue.arg=I,oe?(this.method="next",this.next=oe.finallyLoc,b):this.complete(ue)},complete:function(k,I){if("throw"===k.type)throw k.arg;return"break"===k.type||"continue"===k.type?this.next=k.arg:"return"===k.type?(this.rval=this.arg=k.arg,this.method="return",this.next="end"):"normal"===k.type&&I&&(this.next=I),b},finish:function(k){for(var I=this.tryEntries.length-1;I>=0;--I){var V=this.tryEntries[I];if(V.finallyLoc===k)return this.complete(V.completion,V.afterLoc),w(V),b}},catch:function(k){for(var I=this.tryEntries.length-1;I>=0;--I){var V=this.tryEntries[I];if(V.tryLoc===k){var $=V.completion;if("throw"===$.type){var oe=$.arg;w(V)}return oe}}throw new Error("illegal catch attempt")},delegateYield:function(k,I,V){return this.delegate={iterator:C(k),resultName:I,nextLoc:V},"next"===this.method&&(this.arg=je),b}}}function h(k,I,V,$){var X,T,D,M,ue=Object.create((I&&I.prototype instanceof u?I:u).prototype),Ae=new E($||[]);return ue._invoke=(X=k,T=V,D=Ae,M=d,function(v,B){if(M===A)throw new Error("Generator is already running");if(M===f){if("throw"===v)throw B;return z()}for(D.method=v,D.arg=B;;){var F=D.delegate;if(F){var q=c(F,D);if(q){if(q===b)continue;return q}}if("next"===D.method)D.sent=D._sent=D.arg;else if("throw"===D.method){if(M===d)throw M=f,D.arg;D.dispatchException(D.arg)}else"return"===D.method&&D.abrupt("return",D.arg);M=A;var L=s(X,T,D);if("normal"===L.type){if(M=D.done?f:N,L.arg===b)continue;return{value:L.arg,done:D.done}}"throw"===L.type&&(M=f,D.method="throw",D.arg=L.arg)}}),ue}function s(k,I,V){try{return{type:"normal",arg:k.call(I,V)}}catch($){return{type:"throw",arg:$}}}function u(){}function o(){}function t(){}function r(k){["next","throw","return"].forEach(function(I){k[I]=function(V){return this._invoke(I,V)}})}function a(k){var I;this._invoke=function(V,$){function oe(){return new Promise(function(ue,Ae){!function X(T,D,M,v){var B=s(k[T],k,D);if("throw"!==B.type){var F=B.arg,q=F.value;return q&&"object"==typeof q&&y.call(q,"__await")?Promise.resolve(q.__await).then(function(L){X("next",L,M,v)},function(L){X("throw",L,M,v)}):Promise.resolve(q).then(function(L){F.value=L,M(F)},v)}v(B.arg)}(V,$,ue,Ae)})}return I=I?I.then(oe,oe):oe()}}function c(k,I){var V=k.iterator[I.method];if(V===je){if(I.delegate=null,"throw"===I.method){if(k.iterator.return&&(I.method="return",I.arg=je,c(k,I),"throw"===I.method))return b;I.method="throw",I.arg=new TypeError("The iterator does not provide a 'throw' method")}return b}var $=s(V,k.iterator,I.arg);if("throw"===$.type)return I.method="throw",I.arg=$.arg,I.delegate=null,b;var oe=$.arg;return oe?oe.done?(I[k.resultName]=oe.value,I.next=k.nextLoc,"return"!==I.method&&(I.method="next",I.arg=je),I.delegate=null,b):oe:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,b)}function l(k){var I={tryLoc:k[0]};1 in k&&(I.catchLoc=k[1]),2 in k&&(I.finallyLoc=k[2],I.afterLoc=k[3]),this.tryEntries.push(I)}function w(k){var I=k.completion||{};I.type="normal",delete I.arg,k.completion=I}function E(k){this.tryEntries=[{tryLoc:"root"}],k.forEach(l,this),this.reset(!0)}function C(k){if(k){var I=k[te];if(I)return I.call(k);if("function"==typeof k.next)return k;if(!isNaN(k.length)){var V=-1,$=function oe(){for(;++V"+l[M][0]+""+m.delimiter_start+""+(0,te.toRawKatakana)(l[M][2])+""+m.delimiter_end+"";return L.abrupt("return",T);case 68:if("okurigana"===m.mode)for(v=0;v",B=0;B"+m.delimiter_start+""+(0,te.toRawRomaji)(l[B][3],m.romajiSystem)+""+m.delimiter_end+"";T+=""}return L.abrupt("return",T);case 70:if("okurigana"===m.mode)for(F=0;F"+l[q][0]+""+m.delimiter_start+""+l[q][2]+""+m.delimiter_end+"";return L.abrupt("return",T);case 72:throw new Error("Invalid Target Syllabary.");case 73:case"end":return L.stop()}},f,this)}));return function(f,b){return A.apply(this,arguments)}}()}]),N;var A}();le.Util={isHiragana:te.isHiragana,isKatakana:te.isKatakana,isKana:te.isKana,isKanji:te.isKanji,isJapanese:te.isJapanese,hasHiragana:te.hasHiragana,hasKatakana:te.hasKatakana,hasKana:te.hasKana,hasKanji:te.hasKanji,hasJapanese:te.hasJapanese,kanaToHiragna:te.kanaToHiragna,kanaToKatakana:te.kanaToKatakana,kanaToRomaji:te.kanaToRomaji},kt.default=le,xt.exports=kt.default},{"./util":6,"babel-runtime/regenerator":1}],5:[function(At,xt,kt){"use strict";Object.defineProperty(kt,"__esModule",{value:!0});var je=function Pe(y){return y&&y.__esModule?y:{default:y}}(At("./core"));kt.default=je.default,xt.exports=kt.default},{"./core":4}],6:[function(At,xt,kt){"use strict";function Q(o){if(Array.isArray(o)){for(var t=0,r=Array(o.length);t="\u3040"&&o<="\u309f"},te=function(o){return(o=o[0])>="\u30a0"&&o<="\u30ff"},pe=function(o){return he(o)||te(o)},_e=function(o){return(o=o[0])>="\u4e00"&&o<="\u9fcf"||o>="\uf900"&&o<="\ufaff"||o>="\u3400"&&o<="\u4dbf"},ne=function(o){return pe(o)||_e(o)},le=function(o){for(var t=0;t"\u30a0"&&t<"\u30f7"?String.fromCharCode(t.charCodeAt(0)+je):t}).join("")},m=function(o){return[].concat(Q(o)).map(function(t){return t>"\u3040"&&t<"\u3097"?String.fromCharCode(t.charCodeAt(0)+Pe):t}).join("")},_=function(o,t){var r={nippon:{"\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\uff10":"0","\uff01":"!","\u201c":'"',"\u201d":'"',"\uff03":"#","\uff04":"$","\uff05":"%","\uff06":"&","\u2019":"'","\uff08":"(","\uff09":")","\uff1d":"=","\uff5e":"~","\uff5c":"|","\uff20":"@","\u2018":"`","\uff0b":"+","\uff0a":"*","\uff1b":";","\uff1a":":","\uff1c":"<","\uff1e":">","\u3001":",","\u3002":".","\uff0f":"/","\uff1f":"?","\uff3f":"_","\u30fb":"\uff65","\u300c":'"',"\u300d":'"',"\uff5b":"{","\uff5d":"}","\uffe5":"\\","\uff3e":"^",\u3042:"a",\u3044:"i",\u3046:"u",\u3048:"e",\u304a:"o",\u30a2:"a",\u30a4:"i",\u30a6:"u",\u30a8:"e",\u30aa:"o",\u304b:"ka",\u304d:"ki",\u304f:"ku",\u3051:"ke",\u3053:"ko",\u30ab:"ka",\u30ad:"ki",\u30af:"ku",\u30b1:"ke",\u30b3:"ko",\u3055:"sa",\u3057:"si",\u3059:"su",\u305b:"se",\u305d:"so",\u30b5:"sa",\u30b7:"si",\u30b9:"su",\u30bb:"se",\u30bd:"so",\u305f:"ta",\u3061:"ti",\u3064:"tu",\u3066:"te",\u3068:"to",\u30bf:"ta",\u30c1:"ti",\u30c4:"tu",\u30c6:"te",\u30c8:"to",\u306a:"na",\u306b:"ni",\u306c:"nu",\u306d:"ne",\u306e:"no",\u30ca:"na",\u30cb:"ni",\u30cc:"nu",\u30cd:"ne",\u30ce:"no",\u306f:"ha",\u3072:"hi",\u3075:"hu",\u3078:"he",\u307b:"ho",\u30cf:"ha",\u30d2:"hi",\u30d5:"hu",\u30d8:"he",\u30db:"ho",\u307e:"ma",\u307f:"mi",\u3080:"mu",\u3081:"me",\u3082:"mo",\u30de:"ma",\u30df:"mi",\u30e0:"mu",\u30e1:"me",\u30e2:"mo",\u3084:"ya",\u3086:"yu",\u3088:"yo",\u30e4:"ya",\u30e6:"yu",\u30e8:"yo",\u3089:"ra",\u308a:"ri",\u308b:"ru",\u308c:"re",\u308d:"ro",\u30e9:"ra",\u30ea:"ri",\u30eb:"ru",\u30ec:"re",\u30ed:"ro",\u308f:"wa",\u3090:"wi",\u3091:"we",\u3092:"wo",\u30ef:"wa",\u30f0:"wi",\u30f1:"we",\u30f2:"wo",\u304c:"ga",\u304e:"gi",\u3050:"gu",\u3052:"ge",\u3054:"go",\u30ac:"ga",\u30ae:"gi",\u30b0:"gu",\u30b2:"ge",\u30b4:"go",\u3056:"za",\u3058:"zi",\u305a:"zu",\u305c:"ze",\u305e:"zo",\u30b6:"za",\u30b8:"zi",\u30ba:"zu",\u30bc:"ze",\u30be:"zo",\u3060:"da",\u3062:"di",\u3065:"du",\u3067:"de",\u3069:"do",\u30c0:"da",\u30c2:"di",\u30c5:"du",\u30c7:"de",\u30c9:"do",\u3070:"ba",\u3073:"bi",\u3076:"bu",\u3079:"be",\u307c:"bo",\u30d0:"ba",\u30d3:"bi",\u30d6:"bu",\u30d9:"be",\u30dc:"bo",\u3071:"pa",\u3074:"pi",\u3077:"pu",\u307a:"pe",\u307d:"po",\u30d1:"pa",\u30d4:"pi",\u30d7:"pu",\u30da:"pe",\u30dd:"po",\u304d\u3083:"kya",\u304d\u3085:"kyu",\u304d\u3087:"kyo",\u3057\u3083:"sya",\u3057\u3085:"syu",\u3057\u3087:"syo",\u3061\u3083:"tya",\u3061\u3085:"tyu",\u3061\u3087:"tyo",\u306b\u3083:"nya",\u306b\u3085:"nyu",\u306b\u3087:"nyo",\u3072\u3083:"hya",\u3072\u3085:"hyu",\u3072\u3087:"hyo",\u307f\u3083:"mya",\u307f\u3085:"myu",\u307f\u3087:"myo",\u308a\u3083:"rya",\u308a\u3085:"ryu",\u308a\u3087:"ryo",\u30ad\u30e3:"kya",\u30ad\u30e5:"kyu",\u30ad\u30e7:"kyo",\u30b7\u30e3:"sya",\u30b7\u30e5:"syu",\u30b7\u30e7:"syo",\u30c1\u30e3:"tya",\u30c1\u30e5:"tyu",\u30c1\u30e7:"tyo",\u30cb\u30e3:"nya",\u30cb\u30e5:"nyu",\u30cb\u30e7:"nyo",\u30d2\u30e3:"hya",\u30d2\u30e5:"hyu",\u30d2\u30e7:"hyo",\u30df\u30e3:"mya",\u30df\u30e5:"myu",\u30df\u30e7:"myo",\u30ea\u30e3:"rya",\u30ea\u30e5:"ryu",\u30ea\u30e7:"ryo",\u304e\u3083:"gya",\u304e\u3085:"gyu",\u304e\u3087:"gyo",\u3058\u3083:"zya",\u3058\u3085:"zyu",\u3058\u3087:"zyo",\u3062\u3083:"dya",\u3062\u3085:"dyu",\u3062\u3087:"dyo",\u3073\u3083:"bya",\u3073\u3085:"byu",\u3073\u3087:"byo",\u3074\u3083:"pya",\u3074\u3085:"pyu",\u3074\u3087:"pyo",\u304f\u308e:"kwa",\u3050\u308e:"gwa",\u30ae\u30e3:"gya",\u30ae\u30e5:"gyu",\u30ae\u30e7:"gyo",\u30b8\u30e3:"zya",\u30b8\u30e5:"zyu",\u30b8\u30e7:"zyo",\u30c2\u30e3:"dya",\u30c2\u30e5:"dyu",\u30c2\u30e7:"dyo",\u30d3\u30e3:"bya",\u30d3\u30e5:"byu",\u30d3\u30e7:"byo",\u30d4\u30e3:"pya",\u30d4\u30e5:"pyu",\u30d4\u30e7:"pyo",\u30af\u30ee:"kwa",\u30b0\u30ee:"gwa",\u3041:"a",\u3043:"i",\u3045:"u",\u3047:"e",\u3049:"o",\u3083:"ya",\u3085:"yu",\u3087:"yo",\u308e:"wa",\u30a1:"a",\u30a3:"i",\u30a5:"u",\u30a7:"e",\u30a9:"o",\u30e3:"ya",\u30e5:"yu",\u30e7:"yo",\u30ee:"wa",\u30f5:"ka",\u30f6:"ke",\u3093:"n",\u30f3:"n","\u3000":" ",\u3044\u3047:"ye",\u304d\u3047:"kye",\u304f\u3043:"kwi",\u304f\u3047:"kwe",\u304f\u3049:"kwo",\u3050\u3043:"gwi",\u3050\u3047:"gwe",\u3050\u3049:"gwo",\u30a4\u30a7:"ye",\u30ad\u30a7:"kya",\u30af\u30a3:"kwi",\u30af\u30a7:"kwe",\u30af\u30a9:"kwo",\u30b0\u30a3:"gwi",\u30b0\u30a7:"gwe",\u30b0\u30a9:"gwo",\u3057\u3047:"sye",\u3058\u3047:"zye",\u3059\u3043:"swi",\u305a\u3043:"zwi",\u3061\u3047:"tye",\u3064\u3041:"twa",\u3064\u3043:"twi",\u3064\u3047:"twe",\u3064\u3049:"two",\u306b\u3047:"nye",\u3072\u3047:"hye",\u3075\u3041:"hwa",\u3075\u3043:"hwi",\u3075\u3047:"hwe",\u3075\u3049:"hwo",\u3075\u3085:"hwyu",\u3075\u3087:"hwyo",\u30b7\u30a7:"sye",\u30b8\u30a7:"zye",\u30b9\u30a3:"swi",\u30ba\u30a3:"zwi",\u30c1\u30a7:"tye",\u30c4\u30a1:"twa",\u30c4\u30a3:"twi",\u30c4\u30a7:"twe",\u30c4\u30a9:"two",\u30cb\u30a7:"nye",\u30d2\u30a7:"hye",\u30d5\u30a1:"hwa",\u30d5\u30a3:"hwi",\u30d5\u30a7:"hwe",\u30d5\u30a9:"hwo",\u30d5\u30e5:"hwyu",\u30d5\u30e7:"hwyo"},passport:{"\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\uff10":"0","\uff01":"!","\u201c":'"',"\u201d":'"',"\uff03":"#","\uff04":"$","\uff05":"%","\uff06":"&","\u2019":"'","\uff08":"(","\uff09":")","\uff1d":"=","\uff5e":"~","\uff5c":"|","\uff20":"@","\u2018":"`","\uff0b":"+","\uff0a":"*","\uff1b":";","\uff1a":":","\uff1c":"<","\uff1e":">","\u3001":",","\u3002":".","\uff0f":"/","\uff1f":"?","\uff3f":"_","\u30fb":"\uff65","\u300c":'"',"\u300d":'"',"\uff5b":"{","\uff5d":"}","\uffe5":"\\","\uff3e":"^",\u3042:"a",\u3044:"i",\u3046:"u",\u3048:"e",\u304a:"o",\u30a2:"a",\u30a4:"i",\u30a6:"u",\u30a8:"e",\u30aa:"o",\u304b:"ka",\u304d:"ki",\u304f:"ku",\u3051:"ke",\u3053:"ko",\u30ab:"ka",\u30ad:"ki",\u30af:"ku",\u30b1:"ke",\u30b3:"ko",\u3055:"sa",\u3057:"shi",\u3059:"su",\u305b:"se",\u305d:"so",\u30b5:"sa",\u30b7:"shi",\u30b9:"su",\u30bb:"se",\u30bd:"so",\u305f:"ta",\u3061:"chi",\u3064:"tsu",\u3066:"te",\u3068:"to",\u30bf:"ta",\u30c1:"chi",\u30c4:"tsu",\u30c6:"te",\u30c8:"to",\u306a:"na",\u306b:"ni",\u306c:"nu",\u306d:"ne",\u306e:"no",\u30ca:"na",\u30cb:"ni",\u30cc:"nu",\u30cd:"ne",\u30ce:"no",\u306f:"ha",\u3072:"hi",\u3075:"fu",\u3078:"he",\u307b:"ho",\u30cf:"ha",\u30d2:"hi",\u30d5:"fu",\u30d8:"he",\u30db:"ho",\u307e:"ma",\u307f:"mi",\u3080:"mu",\u3081:"me",\u3082:"mo",\u30de:"ma",\u30df:"mi",\u30e0:"mu",\u30e1:"me",\u30e2:"mo",\u3084:"ya",\u3086:"yu",\u3088:"yo",\u30e4:"ya",\u30e6:"yu",\u30e8:"yo",\u3089:"ra",\u308a:"ri",\u308b:"ru",\u308c:"re",\u308d:"ro",\u30e9:"ra",\u30ea:"ri",\u30eb:"ru",\u30ec:"re",\u30ed:"ro",\u308f:"wa",\u3090:"i",\u3091:"e",\u3092:"o",\u30ef:"wa",\u30f0:"i",\u30f1:"e",\u30f2:"o",\u304c:"ga",\u304e:"gi",\u3050:"gu",\u3052:"ge",\u3054:"go",\u30ac:"ga",\u30ae:"gi",\u30b0:"gu",\u30b2:"ge",\u30b4:"go",\u3056:"za",\u3058:"ji",\u305a:"zu",\u305c:"ze",\u305e:"zo",\u30b6:"za",\u30b8:"ji",\u30ba:"zu",\u30bc:"ze",\u30be:"zo",\u3060:"da",\u3062:"ji",\u3065:"zu",\u3067:"de",\u3069:"do",\u30c0:"da",\u30c2:"ji",\u30c5:"zu",\u30c7:"de",\u30c9:"do",\u3070:"ba",\u3073:"bi",\u3076:"bu",\u3079:"be",\u307c:"bo",\u30d0:"ba",\u30d3:"bi",\u30d6:"bu",\u30d9:"be",\u30dc:"bo",\u3071:"pa",\u3074:"pi",\u3077:"pu",\u307a:"pe",\u307d:"po",\u30d1:"pa",\u30d4:"pi",\u30d7:"pu",\u30da:"pe",\u30dd:"po",\u304d\u3083:"kya",\u304d\u3085:"kyu",\u304d\u3087:"kyo",\u3057\u3083:"sha",\u3057\u3085:"shu",\u3057\u3087:"sho",\u3061\u3083:"cha",\u3061\u3085:"chu",\u3061\u3087:"cho",\u306b\u3083:"nya",\u306b\u3085:"nyu",\u306b\u3087:"nyo",\u3072\u3083:"hya",\u3072\u3085:"hyu",\u3072\u3087:"hyo",\u307f\u3083:"mya",\u307f\u3085:"myu",\u307f\u3087:"myo",\u308a\u3083:"rya",\u308a\u3085:"ryu",\u308a\u3087:"ryo",\u30ad\u30e3:"kya",\u30ad\u30e5:"kyu",\u30ad\u30e7:"kyo",\u30b7\u30e3:"sha",\u30b7\u30e5:"shu",\u30b7\u30e7:"sho",\u30c1\u30e3:"cha",\u30c1\u30e5:"chu",\u30c1\u30e7:"cho",\u30cb\u30e3:"nya",\u30cb\u30e5:"nyu",\u30cb\u30e7:"nyo",\u30d2\u30e3:"hya",\u30d2\u30e5:"hyu",\u30d2\u30e7:"hyo",\u30df\u30e3:"mya",\u30df\u30e5:"myu",\u30df\u30e7:"myo",\u30ea\u30e3:"rya",\u30ea\u30e5:"ryu",\u30ea\u30e7:"ryo",\u304e\u3083:"gya",\u304e\u3085:"gyu",\u304e\u3087:"gyo",\u3058\u3083:"ja",\u3058\u3085:"ju",\u3058\u3087:"jo",\u3062\u3083:"ja",\u3062\u3085:"ju",\u3062\u3087:"jo",\u3073\u3083:"bya",\u3073\u3085:"byu",\u3073\u3087:"byo",\u3074\u3083:"pya",\u3074\u3085:"pyu",\u3074\u3087:"pyo",\u30ae\u30e3:"gya",\u30ae\u30e5:"gyu",\u30ae\u30e7:"gyo",\u30b8\u30e3:"ja",\u30b8\u30e5:"ju",\u30b8\u30e7:"jo",\u30c2\u30e3:"ja",\u30c2\u30e5:"ju",\u30c2\u30e7:"jo",\u30d3\u30e3:"bya",\u30d3\u30e5:"byu",\u30d3\u30e7:"byo",\u30d4\u30e3:"pya",\u30d4\u30e5:"pyu",\u30d4\u30e7:"pyo",\u3041:"a",\u3043:"i",\u3045:"u",\u3047:"e",\u3049:"o",\u3083:"ya",\u3085:"yu",\u3087:"yo",\u308e:"wa",\u30a1:"a",\u30a3:"i",\u30a5:"u",\u30a7:"e",\u30a9:"o",\u30e3:"ya",\u30e5:"yu",\u30e7:"yo",\u30ee:"wa",\u30f5:"ka",\u30f6:"ke",\u3093:"n",\u30f3:"n","\u3000":" ",\u30f4:"b"},hepburn:{"\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\uff10":"0","\uff01":"!","\u201c":'"',"\u201d":'"',"\uff03":"#","\uff04":"$","\uff05":"%","\uff06":"&","\u2019":"'","\uff08":"(","\uff09":")","\uff1d":"=","\uff5e":"~","\uff5c":"|","\uff20":"@","\u2018":"`","\uff0b":"+","\uff0a":"*","\uff1b":";","\uff1a":":","\uff1c":"<","\uff1e":">","\u3001":",","\u3002":".","\uff0f":"/","\uff1f":"?","\uff3f":"_","\u30fb":"\uff65","\u300c":'"',"\u300d":'"',"\uff5b":"{","\uff5d":"}","\uffe5":"\\","\uff3e":"^",\u3042:"a",\u3044:"i",\u3046:"u",\u3048:"e",\u304a:"o",\u30a2:"a",\u30a4:"i",\u30a6:"u",\u30a8:"e",\u30aa:"o",\u304b:"ka",\u304d:"ki",\u304f:"ku",\u3051:"ke",\u3053:"ko",\u30ab:"ka",\u30ad:"ki",\u30af:"ku",\u30b1:"ke",\u30b3:"ko",\u3055:"sa",\u3057:"shi",\u3059:"su",\u305b:"se",\u305d:"so",\u30b5:"sa",\u30b7:"shi",\u30b9:"su",\u30bb:"se",\u30bd:"so",\u305f:"ta",\u3061:"chi",\u3064:"tsu",\u3066:"te",\u3068:"to",\u30bf:"ta",\u30c1:"chi",\u30c4:"tsu",\u30c6:"te",\u30c8:"to",\u306a:"na",\u306b:"ni",\u306c:"nu",\u306d:"ne",\u306e:"no",\u30ca:"na",\u30cb:"ni",\u30cc:"nu",\u30cd:"ne",\u30ce:"no",\u306f:"ha",\u3072:"hi",\u3075:"fu",\u3078:"he",\u307b:"ho",\u30cf:"ha",\u30d2:"hi",\u30d5:"fu",\u30d8:"he",\u30db:"ho",\u307e:"ma",\u307f:"mi",\u3080:"mu",\u3081:"me",\u3082:"mo",\u30de:"ma",\u30df:"mi",\u30e0:"mu",\u30e1:"me",\u30e2:"mo",\u3084:"ya",\u3086:"yu",\u3088:"yo",\u30e4:"ya",\u30e6:"yu",\u30e8:"yo",\u3089:"ra",\u308a:"ri",\u308b:"ru",\u308c:"re",\u308d:"ro",\u30e9:"ra",\u30ea:"ri",\u30eb:"ru",\u30ec:"re",\u30ed:"ro",\u308f:"wa",\u3090:"i",\u3091:"e",\u3092:"o",\u30ef:"wa",\u30f0:"i",\u30f1:"e",\u30f2:"o",\u304c:"ga",\u304e:"gi",\u3050:"gu",\u3052:"ge",\u3054:"go",\u30ac:"ga",\u30ae:"gi",\u30b0:"gu",\u30b2:"ge",\u30b4:"go",\u3056:"za",\u3058:"ji",\u305a:"zu",\u305c:"ze",\u305e:"zo",\u30b6:"za",\u30b8:"ji",\u30ba:"zu",\u30bc:"ze",\u30be:"zo",\u3060:"da",\u3062:"ji",\u3065:"zu",\u3067:"de",\u3069:"do",\u30c0:"da",\u30c2:"ji",\u30c5:"zu",\u30c7:"de",\u30c9:"do",\u3070:"ba",\u3073:"bi",\u3076:"bu",\u3079:"be",\u307c:"bo",\u30d0:"ba",\u30d3:"bi",\u30d6:"bu",\u30d9:"be",\u30dc:"bo",\u3071:"pa",\u3074:"pi",\u3077:"pu",\u307a:"pe",\u307d:"po",\u30d1:"pa",\u30d4:"pi",\u30d7:"pu",\u30da:"pe",\u30dd:"po",\u304d\u3083:"kya",\u304d\u3085:"kyu",\u304d\u3087:"kyo",\u3057\u3083:"sha",\u3057\u3085:"shu",\u3057\u3087:"sho",\u3061\u3083:"cha",\u3061\u3085:"chu",\u3061\u3087:"cho",\u306b\u3083:"nya",\u306b\u3085:"nyu",\u306b\u3087:"nyo",\u3072\u3083:"hya",\u3072\u3085:"hyu",\u3072\u3087:"hyo",\u307f\u3083:"mya",\u307f\u3085:"myu",\u307f\u3087:"myo",\u308a\u3083:"rya",\u308a\u3085:"ryu",\u308a\u3087:"ryo",\u30ad\u30e3:"kya",\u30ad\u30e5:"kyu",\u30ad\u30e7:"kyo",\u30b7\u30e3:"sha",\u30b7\u30e5:"shu",\u30b7\u30e7:"sho",\u30c1\u30e3:"cha",\u30c1\u30e5:"chu",\u30c1\u30e7:"cho",\u30cb\u30e3:"nya",\u30cb\u30e5:"nyu",\u30cb\u30e7:"nyo",\u30d2\u30e3:"hya",\u30d2\u30e5:"hyu",\u30d2\u30e7:"hyo",\u30df\u30e3:"mya",\u30df\u30e5:"myu",\u30df\u30e7:"myo",\u30ea\u30e3:"rya",\u30ea\u30e5:"ryu",\u30ea\u30e7:"ryo",\u304e\u3083:"gya",\u304e\u3085:"gyu",\u304e\u3087:"gyo",\u3058\u3083:"ja",\u3058\u3085:"ju",\u3058\u3087:"jo",\u3062\u3083:"ja",\u3062\u3085:"ju",\u3062\u3087:"jo",\u3073\u3083:"bya",\u3073\u3085:"byu",\u3073\u3087:"byo",\u3074\u3083:"pya",\u3074\u3085:"pyu",\u3074\u3087:"pyo",\u30ae\u30e3:"gya",\u30ae\u30e5:"gyu",\u30ae\u30e7:"gyo",\u30b8\u30e3:"ja",\u30b8\u30e5:"ju",\u30b8\u30e7:"jo",\u30c2\u30e3:"ja",\u30c2\u30e5:"ju",\u30c2\u30e7:"jo",\u30d3\u30e3:"bya",\u30d3\u30e5:"byu",\u30d3\u30e7:"byo",\u30d4\u30e3:"pya",\u30d4\u30e5:"pyu",\u30d4\u30e7:"pyo",\u3041:"a",\u3043:"i",\u3045:"u",\u3047:"e",\u3049:"o",\u3083:"ya",\u3085:"yu",\u3087:"yo",\u308e:"wa",\u30a1:"a",\u30a3:"i",\u30a5:"u",\u30a7:"e",\u30a9:"o",\u30e3:"ya",\u30e5:"yu",\u30e7:"yo",\u30ee:"wa",\u30f5:"ka",\u30f6:"ke",\u3093:"n",\u30f3:"n","\u3000":" ",\u3044\u3047:"ye",\u3046\u3043:"wi",\u3046\u3047:"we",\u3046\u3049:"wo",\u304d\u3047:"kye",\u304f\u3041:"kwa",\u304f\u3043:"kwi",\u304f\u3047:"kwe",\u304f\u3049:"kwo",\u3050\u3041:"gwa",\u3050\u3043:"gwi",\u3050\u3047:"gwe",\u3050\u3049:"gwo",\u30a4\u30a7:"ye",\u30a6\u30a3:"wi",\u30a6\u30a7:"we",\u30a6\u30a9:"wo",\u30f4:"vu",\u30f4\u30a1:"va",\u30f4\u30a3:"vi",\u30f4\u30a7:"ve",\u30f4\u30a9:"vo",\u30f4\u30e5:"vyu",\u30f4\u30e7:"vyo",\u30ad\u30a7:"kya",\u30af\u30a1:"kwa",\u30af\u30a3:"kwi",\u30af\u30a7:"kwe",\u30af\u30a9:"kwo",\u30b0\u30a1:"gwa",\u30b0\u30a3:"gwi",\u30b0\u30a7:"gwe",\u30b0\u30a9:"gwo",\u3057\u3047:"she",\u3058\u3047:"je",\u3061\u3047:"che",\u3064\u3041:"tsa",\u3064\u3043:"tsi",\u3064\u3047:"tse",\u3064\u3049:"tso",\u3066\u3043:"ti",\u3066\u3085:"tyu",\u3067\u3043:"di",\u3067\u3085:"dyu",\u3068\u3045:"tu",\u3069\u3045:"du",\u306b\u3047:"nye",\u3072\u3047:"hye",\u3075\u3041:"fa",\u3075\u3043:"fi",\u3075\u3047:"fe",\u3075\u3049:"fo",\u3075\u3085:"fyu",\u3075\u3087:"fyo",\u30b7\u30a7:"she",\u30b8\u30a7:"je",\u30c1\u30a7:"che",\u30c4\u30a1:"tsa",\u30c4\u30a3:"tsi",\u30c4\u30a7:"tse",\u30c4\u30a9:"tso",\u30c6\u30a3:"ti",\u30c6\u30e5:"tyu",\u30c7\u30a3:"di",\u30c7\u30e5:"dyu",\u30c8\u30a5:"tu",\u30c9\u30a5:"du",\u30cb\u30a7:"nye",\u30d2\u30a7:"hye",\u30d5\u30a1:"fa",\u30d5\u30a3:"fi",\u30d5\u30a7:"fe",\u30d5\u30a9:"fo",\u30d5\u30e5:"fyu",\u30d5\u30e7:"fyo"}},a=0,c=void 0,l=void 0,w="";if((t=t||y.HEPBURN)===y.PASSPORT&&(o=o.replace(/\u30fc/gm,"")),t===y.NIPPON||t===y.HEPBURN){for(var E=new RegExp(/(\u3093|\u30f3)(?=\u3042|\u3044|\u3046|\u3048|\u304a|\u30a2|\u30a4|\u30a6|\u30a8|\u30aa|\u3041|\u3043|\u3045|\u3047|\u3049|\u30a1|\u30a3|\u30a5|\u30a7|\u30a9|\u3084|\u3086|\u3088|\u30e4|\u30e6|\u30e8|\u3083|\u3085|\u3087|\u30e3|\u30e5|\u30e7)/g),C=void 0,z=[];null!==(C=E.exec(o));)z.push(C.index+1);if(0!==z.length){for(var k="",I=0;I=0&&o[r-1].pos&&"\u52d5\u8a5e"===o[r-1].pos&&(o[r-1].surface_form+="\u3046",o[r-1].pronunciation?o[r-1].pronunciation+="\u30fc":o[r-1].pronunciation=o[r-1].reading+"\u30fc",o[r-1].reading+="\u30a6",o.splice(r,1),r--);for(var a=0;a1&&("\u3063"===o[a].surface_form[o[a].surface_form.length-1]||"\u30c3"===o[a].surface_form[o[a].surface_form.length-1])&&a+1-1&&Te%1==0&&Te<=ue}function X(Te){return null!=Te&&Ae(Te.length)&&!function(Ye){if(!_e(Ye))return!1;var it=k(Ye);return it==V||it==$||it==I||it==oe}(Te)}var T={};function D(){}function M(Te){return function(){if(null!==Te){var Ye=Te;Te=null,Ye.apply(this,arguments)}}}var v="function"==typeof Symbol&&Symbol.iterator,B=function(Te){return v&&Te[v]&&Te[v]()};function F(Te){return null!=Te&&"object"==typeof Te}var q="[object Arguments]";function L(Te){return F(Te)&&k(Te)==q}var Y=Object.prototype,se=Y.hasOwnProperty,Ee=Y.propertyIsEnumerable,Se=L(function(){return arguments}())?L:function(Te){return F(Te)&&se.call(Te,"callee")&&!Ee.call(Te,"callee")},Ie=Array.isArray,Qe="object"==typeof y&&y&&!y.nodeType&&y,Je=Qe&&"object"==typeof xt&&xt&&!xt.nodeType&&xt,ut=Je&&Je.exports===Qe?o.Buffer:void 0,$t=(ut?ut.isBuffer:void 0)||function(){return!1},qt=9007199254740991,tt=/^(?:0|[1-9]\d*)$/;function at(Te,Ye){var it=typeof Te;return!!(Ye=Ye??qt)&&("number"==it||"symbol"!=it&&tt.test(Te))&&Te>-1&&Te%1==0&&Te2&&(Zi=he(arguments,1)),ao){var ro={};In(Wt,function(io,ko){ro[ko]=io}),ro[Yr]=Zi,Kt=!0,Qt=Object.create(null),it(ao,ro)}else Wt[Yr]=Zi,mn(Qt[Yr]||[],function(io){io()}),jr()});Mt++;var Hi=g(Fi[Fi.length-1]);Fi.length>1?Hi(Wt,no):Hi(no)}}(ti,Or)})}function jr(){if(0===pn.length&&0===Mt)return it(null,Wt);for(;pn.length&&Mt=0&&Or.push(Fi)}),Or}In(Te,function(ti,Or){if(!Ie(ti))return sr(Or,[ti]),void jn.push(Or);var Yr=ti.slice(0,ti.length-1),Fi=Yr.length;if(0===Fi)return sr(Or,ti),void jn.push(Or);Fn[Or]=Fi,mn(Yr,function(no){if(!Te[no])throw new Error("async.auto task `"+Or+"` has a non-existent dependency `"+no+"` in "+Yr.join(", "));var Hi,Zi;(Zi=Qt[Hi=no])||(Zi=Qt[Hi]=[]),Zi.push(function(){0==--Fi&&sr(Or,ti)})})}),function(){for(var Or=0;jn.length;)Or++,mn(ii(jn.pop()),function(Yr){0==--Fn[Yr]&&jn.push(Yr)});if(Or!==pt)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),jr()};function Br(Te,Ye){for(var it=-1,pt=null==Te?0:Te.length,Wt=Array(pt);++it0?jn:pt);else if(pn)it[Wt]=pt;else{if(Mt=Kt=(Kt=(Kt=(Kt=(Kt=pt).toString().replace(li,"")).match(zr)[2].replace(" ",""))?Kt.split(ui):[]).map(function(Fn){return function Jr(Te,Ye,it){var pt;if((Te=null==(pt=Te)?"":Zn(pt))&&(it||void 0===Ye))return Te.replace(yi,"");if(!Te||!(Ye=Zn(Ye)))return Te;var Wt=cr(Te),Mt=cr(Ye);return function Kr(Te,Ye,it){var pt=Te.length;return it=void 0===it?pt:it,!Ye&&it>=pt?Te:function(Wt,Mt,Kt){var Qt=-1,pn=Wt.length;Mt<0&&(Mt=-Mt>pn?0:pn+Mt),(Kt=Kt>pn?pn:Kt)<0&&(Kt+=pn),pn=Mt>Kt?0:Kt-Mt>>>0,Mt>>>=0;for(var jn=Array(pn);++Qt-1;);return pn}(Wt,Mt),function(Kt,Qt){for(var pn=Kt.length;pn--&&Nn(Qt,Kt[pn],0)>-1;);return pn}(Wt,Mt)+1).join("")}(Fn.replace(ai,""))}),0===pt.length&&!Qt&&0===Mt.length)throw new Error("autoInject task functions require explicit parameters.");Qt||Mt.pop(),it[Wt]=Mt.concat(jn)}function jn(Fn,sr){var jr=Br(Mt,function(ii){return Fn[ii]});jr.push(sr),g(pt).apply(null,jr)}}),zn(it,Ye)}function Fr(){this.head=this.tail=null,this.length=0}function Un(Te,Ye){Te.length=1,Te.head=Te.tail=Ye}function We(Te,Ye,it){if(null==Ye)Ye=1;else if(0===Ye)throw new Error("Concurrency must not be zero");var pt=g(Te),Wt=0,Mt=[],Kt=!1;function Qt(sr,jr,ii){if(null!=ii&&"function"!=typeof ii)throw new Error("task callback must be a function");if(Fn.started=!0,Ie(sr)||(sr=[sr]),0===sr.length&&Fn.idle())return A(function(){Fn.drain()});for(var ti=0,Or=sr.length;ti0&&Mt.splice(Yr,1),Or.callback.apply(Or,arguments),null!=jr&&Fn.error(jr,Or.data)}Wt<=Fn.concurrency-Fn.buffer&&Fn.unsaturated(),Fn.idle()&&Fn.drain(),Fn.process()}}var jn=!1,Fn={_tasks:new Fr,concurrency:Ye,payload:it,saturated:D,unsaturated:D,buffer:Ye/4,empty:D,drain:D,error:D,started:!1,paused:!1,push:function(sr,jr){Qt(sr,!1,jr)},kill:function(){Fn.drain=D,Fn._tasks.empty()},unshift:function(sr,jr){Qt(sr,!0,jr)},remove:function(sr){Fn._tasks.remove(sr)},process:function(){if(!jn){for(jn=!0;!Fn.paused&&Wt2&&(pn=he(arguments,1)),pt[Mt]=pn,Kt(Qt)})},function(Wt){it(Wt,pt)})}function nn(Te,Ye){Et(Le,Te,Ye)}function xn(Te,Ye,it){Et(fr(Ye),Te,it)}var fn=function(Te,Ye){var it=g(Te);return We(function(pt,Wt){it(pt[0],Wt)},Ye,1)},En=function(Te,Ye){var it=fn(Te,Ye);return it.push=function(pt,Wt,Mt){if(null==Mt&&(Mt=D),"function"!=typeof Mt)throw new Error("task callback must be a function");if(it.started=!0,Ie(pt)||(pt=[pt]),0===pt.length)return A(function(){it.drain()});Wt=Wt||0;for(var Kt=it._tasks.head;Kt&&Wt>=Kt.priority;)Kt=Kt.next;for(var Qt=0,pn=pt.length;Qtpn?1:0}Ze(Te,function(Mt,Kt){pt(Mt,function(Qt,pn){if(Qt)return Kt(Qt);Kt(null,{value:Mt,criteria:pn})})},function(Mt,Kt){if(Mt)return it(Mt);it(null,Br(Kt.sort(Wt),un("value")))})}function $i(Te,Ye,it){var pt=g(Te);return pe(function(Wt,Mt){var Kt,Qt=!1;Wt.push(function(){Qt||(Mt.apply(null,arguments),clearTimeout(Kt))}),Kt=setTimeout(function(){var jn=new Error('Callback function "'+(Te.name||"anonymous")+'" timed out.');jn.code="ETIMEDOUT",it&&(jn.info=it),Qt=!0,Mt(jn)},Ye),pt.apply(null,Wt)})}var Xi=Math.ceil,Ni=Math.max;function mi(Te,Ye,it,pt){var Wt=g(it);Bt(function(Mt,Kt,Qt,pn){for(var jn=-1,Fn=Ni(Xi((Kt-Mt)/1),0),sr=Array(Fn);Fn--;)sr[++jn]=Mt,Mt+=1;return sr}(0,Te),Ye,Wt,pt)}var Vi=Rt(mi,1/0),zi=Rt(mi,1);function Ui(Te,Ye,it,pt){arguments.length<=3&&(pt=it,it=Ye,Ye=Ie(Te)?[]:{}),pt=M(pt||D);var Wt=g(it);Le(Te,function(Mt,Kt,Qt){Wt(Ye,Mt,Kt,Qt)},function(Mt){pt(Mt,Ye)})}function Ai(Te,Ye){var it,pt=null;Ye=Ye||D,mt(Te,function(Wt,Mt){g(Wt)(function(Kt,Qt){it=arguments.length>2?he(arguments,1):Qt,pt=Kt,Mt(!Kt)})},function(){Ye(pt,it)})}function Ii(Te){return function(){return(Te.unmemoized||Te).apply(null,arguments)}}function _i(Te,Ye,it){it=Sn(it||D);var pt=g(Ye);if(!Te())return it(null);var Wt=function(Mt){if(Mt)return it(Mt);if(Te())return pt(Wt);var Kt=he(arguments,1);it.apply(null,[null].concat(Kt))};pt(Wt)}function Pi(Te,Ye,it){_i(function(){return!Te.apply(this,arguments)},Ye,it)}var Gi=function(Te,Ye){if(Ye=M(Ye||D),!Ie(Te))return Ye(new Error("First argument to waterfall must be an array of functions"));if(!Te.length)return Ye();var it=0;function pt(Mt){var Kt=g(Te[it++]);Mt.push(Sn(Wt)),Kt.apply(null,Mt)}function Wt(Mt){if(Mt||it===Te.length)return Ye.apply(null,arguments);pt(he(arguments,1))}pt([])};y.default={apply:te,applyEach:Ct,applyEachSeries:Ot,asyncify:f,auto:zn,autoInject:Vr,cargo:Mn,compose:Er,concat:dr,concatLimit:ci,concatSeries:Qr,constant:di,detect:P,detectLimit:Z,detectSeries:ie,dir:ye,doDuring:Me,doUntil:Ue,doWhilst:Ce,during:Ge,each:Ft,eachLimit:lt,eachOf:Le,eachOfLimit:Dn,eachOfSeries:Yn,eachSeries:mt,ensureAsync:Ut,every:It,everyLimit:jt,everySeries:Pt,filter:xr,filterLimit:kr,filterSeries:rr,forever:ir,groupBy:fi,groupByLimit:or,groupBySeries:Fe,log:St,map:Ze,mapLimit:Bt,mapSeries:ln,mapValues:cn,mapValuesLimit:Vt,mapValuesSeries:$n,memoize:Re,nextTick:bt,parallel:nn,parallelLimit:xn,priorityQueue:En,queue:fn,race:yn,reduce:Cn,reduceRight:Pn,reflect:qn,reflectAll:_r,reject:Cr,rejectLimit:gr,rejectSeries:Tr,retry:Lr,retryable:yr,seq:Jn,series:ni,setImmediate:A,some:wi,someLimit:pi,someSeries:gi,sortBy:ei,timeout:$i,times:Vi,timesLimit:mi,timesSeries:zi,transform:Ui,tryEach:Ai,unmemoize:Ii,until:Pi,waterfall:Gi,whilst:_i,all:It,allLimit:jt,allSeries:Pt,any:wi,anyLimit:pi,anySeries:gi,find:P,findLimit:Z,findSeries:ie,forEach:Ft,forEachSeries:mt,forEachLimit:lt,forEachOf:Le,forEachOfSeries:Yn,forEachOfLimit:Dn,inject:Cn,foldl:Cn,foldr:Pn,select:xr,selectLimit:kr,selectSeries:rr,wrapSync:f},y.apply=te,y.applyEach=Ct,y.applyEachSeries=Ot,y.asyncify=f,y.auto=zn,y.autoInject=Vr,y.cargo=Mn,y.compose=Er,y.concat=dr,y.concatLimit=ci,y.concatSeries=Qr,y.constant=di,y.detect=P,y.detectLimit=Z,y.detectSeries=ie,y.dir=ye,y.doDuring=Me,y.doUntil=Ue,y.doWhilst=Ce,y.during=Ge,y.each=Ft,y.eachLimit=lt,y.eachOf=Le,y.eachOfLimit=Dn,y.eachOfSeries=Yn,y.eachSeries=mt,y.ensureAsync=Ut,y.every=It,y.everyLimit=jt,y.everySeries=Pt,y.filter=xr,y.filterLimit=kr,y.filterSeries=rr,y.forever=ir,y.groupBy=fi,y.groupByLimit=or,y.groupBySeries=Fe,y.log=St,y.map=Ze,y.mapLimit=Bt,y.mapSeries=ln,y.mapValues=cn,y.mapValuesLimit=Vt,y.mapValuesSeries=$n,y.memoize=Re,y.nextTick=bt,y.parallel=nn,y.parallelLimit=xn,y.priorityQueue=En,y.queue=fn,y.race=yn,y.reduce=Cn,y.reduceRight=Pn,y.reflect=qn,y.reflectAll=_r,y.reject=Cr,y.rejectLimit=gr,y.rejectSeries=Tr,y.retry=Lr,y.retryable=yr,y.seq=Jn,y.series=ni,y.setImmediate=A,y.some=wi,y.someLimit=pi,y.someSeries=gi,y.sortBy=ei,y.timeout=$i,y.times=Vi,y.timesLimit=mi,y.timesSeries=zi,y.transform=Ui,y.tryEach=Ai,y.unmemoize=Ii,y.until=Pi,y.waterfall=Gi,y.whilst=_i,y.all=It,y.allLimit=jt,y.allSeries=Pt,y.any=wi,y.anyLimit=pi,y.anySeries=gi,y.find=P,y.findLimit=Z,y.findSeries=ie,y.forEach=Ft,y.forEachSeries=mt,y.forEachLimit=lt,y.forEachOf=Le,y.forEachOfSeries=Yn,y.forEachOfLimit=Dn,y.inject=Cn,y.foldl=Cn,y.foldr=Pn,y.select=xr,y.selectLimit=kr,y.selectSeries=rr,y.wrapSync=f,Object.defineProperty(y,"__esModule",{value:!0})},he("object"==typeof kt&&typeof xt<"u"?kt:this.async=this.async||{})}).call(this,At("_process"),typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},At("timers").setImmediate)},{_process:26,timers:27}],2:[function(At,xt,kt){!function(){"use strict";var Q=function(ne){null==ne&&(ne=1024);var le=function(m,_,n){for(var g=_;g=55296&&f<=56319){var b=f,m=ne.charCodeAt(d++);if(!(m>=56320&&m<=57343))return null;A=1024*(b-55296)+65536+(m-56320)}else A=f;A<128?le[N++]=A:A<2048?(le[N++]=A>>>6|192,le[N++]=63&A|128):A<65536?(le[N++]=A>>>12|224,le[N++]=A>>6&63|128,le[N++]=63&A|128):A<1<<21&&(le[N++]=A>>>18|240,le[N++]=A>>12&63|128,le[N++]=A>>6&63|128,le[N++]=63&A|128)}return le.subarray(0,N)},pe=function(ne){for(var le,d,N,f="",b=0;b>5==6?(31&d)<<6|63&ne[b++]:d>>4==14?(15&d)<<12|(63&ne[b++])<<6|63&ne[b++]:(7&d)<<18|(63&ne[b++])<<12|(63&ne[b++])<<6|63&ne[b++])<65536?f+=String.fromCharCode(le):(N=55296|(le-=65536)>>10,f+=String.fromCharCode(N,56320|1023&le));return f},_e={builder:function(ne){return new je(ne)},load:function(ne,le){var d=Q(0);return d.loadBaseBuffer(ne),d.loadCheckBuffer(le),new Pe(d)}};typeof xt>"u"?window.doublearray=_e:xt.exports=_e}()},{}],3:[function(At,xt,kt){"use strict";var Q=At("./viterbi/ViterbiBuilder"),je=At("./viterbi/ViterbiSearcher"),Pe=At("./util/IpadicFormatter"),y=/\u3001|\u3002/;function he(te){this.token_info_dictionary=te.token_info_dictionary,this.unknown_dictionary=te.unknown_dictionary,this.viterbi_builder=new Q(te),this.viterbi_searcher=new je(te.connection_costs),this.formatter=new Pe}he.splitByPunctuation=function(te){for(var pe=[],_e=te;""!==_e;){var ne=_e.search(y);if(ne<0){pe.push(_e);break}pe.push(_e.substring(0,ne+1)),_e=_e.substring(ne+1)}return pe},he.prototype.tokenize=function(te){for(var pe=he.splitByPunctuation(te),_e=[],ne=0;ne0&&(le=pe[pe.length-1].word_position);for(var d=0;d65535)&&console.log("char.def parse error. CODE is invalid:"+pe),{start:pe,default:_e,compatible:ne}},he.parseRangeCategoryMapping=function(te){var pe=parseInt(te[1]),_e=parseInt(te[2]),ne=te[3],le=465535)&&console.log("char.def parse error. CODE is invalid:"+pe),(!isFinite(_e)||_e<0||_e>65535)&&console.log("char.def parse error. CODE is invalid:"+_e),{start:pe,end:_e,default:ne,compatible:le}},he.prototype.initCategoryMappings=function(te){var pe;if(null!=te)for(var _e=0;_e>>31==1){var d=this.invoke_definition_map.getCharacterClass(le);if(null==d)continue;_e.push(d)}return _e},he.prototype.lookup=function(te){var pe,_e=te.charCodeAt(0);return Pe.isSurrogatePair(te)?pe=this.invoke_definition_map.lookup(y):_e0&&200!==this.status)he(te.statusText,null);else{var _e=new Q.Zlib.Gunzip(new Uint8Array(this.response)).decompress();he(null,_e.buffer)}},te.onerror=function(pe){he(pe,null)},te.send()},xt.exports=Pe},{"./DictionaryLoader":17,"zlibjs/bin/gunzip.min.js":28}],17:[function(At,xt,kt){"use strict";var Q=At("path"),je=At("async"),Pe=At("../dict/DynamicDictionaries");function y(he){this.dic=new Pe,this.dic_path=he}y.prototype.loadArrayBuffer=function(he,te){throw new Error("DictionaryLoader#loadArrayBuffer should be overwrite")},y.prototype.load=function(he){var te=this.dic,pe=this.dic_path,_e=this.loadArrayBuffer;je.parallel([function(ne){je.map(["base.dat.gz","check.dat.gz"],function(le,d){_e(Q.join(pe,le),function(N,A){if(N)return d(N);d(null,A)})},function(le,d){if(le)return ne(le);var N=new Int32Array(d[0]),A=new Int32Array(d[1]);te.loadTrie(N,A),ne(null)})},function(ne){je.map(["tid.dat.gz","tid_pos.dat.gz","tid_map.dat.gz"],function(le,d){_e(Q.join(pe,le),function(N,A){if(N)return d(N);d(null,A)})},function(le,d){if(le)return ne(le);var N=new Uint8Array(d[0]),A=new Uint8Array(d[1]),f=new Uint8Array(d[2]);te.loadTokenInfoDictionaries(N,A,f),ne(null)})},function(ne){_e(Q.join(pe,"cc.dat.gz"),function(le,d){if(le)return ne(le);var N=new Int16Array(d);te.loadConnectionCosts(N),ne(null)})},function(ne){je.map(["unk.dat.gz","unk_pos.dat.gz","unk_map.dat.gz","unk_char.dat.gz","unk_compat.dat.gz","unk_invoke.dat.gz"],function(le,d){_e(Q.join(pe,le),function(N,A){if(N)return d(N);d(null,A)})},function(le,d){if(le)return ne(le);var N=new Uint8Array(d[0]),A=new Uint8Array(d[1]),f=new Uint8Array(d[2]),b=new Uint8Array(d[3]),m=new Uint32Array(d[4]),_=new Uint8Array(d[5]);te.loadUnknownDictionaries(N,A,f,b,m,_),ne(null)})}],function(ne){he(ne,te)})},xt.exports=y},{"../dict/DynamicDictionaries":8,async:1,path:25}],18:[function(At,xt,kt){"use strict";function Pe(y){var he;if(null==y)he=1048576;else{if("number"!=typeof y){if(y instanceof Uint8Array)return this.buffer=y,void(this.position=0);throw typeof y+" is invalid parameter type for ByteBuffer constructor"}he=y}this.buffer=new Uint8Array(he),this.position=0}Pe.prototype.size=function(){return this.buffer.length},Pe.prototype.reallocate=function(){var y=new Uint8Array(2*this.buffer.length);y.set(this.buffer),this.buffer=y},Pe.prototype.shrink=function(){return this.buffer=this.buffer.subarray(0,this.position),this.buffer},Pe.prototype.put=function(y){this.buffer.length>8;this.put(255&y),this.put(te)},Pe.prototype.getShort=function(y){if(null==y&&(y=this.position,this.position+=2),this.buffer.length>8,pe=(16711680&y)>>16,_e=(4278190080&y)>>24;this.put(255&y),this.put(te),this.put(pe),this.put(_e)},Pe.prototype.getInt=function(y){return null==y&&(y=this.position,this.position+=4),this.buffer.length=55296&&ne<=56319){var le=ne,d=y.charCodeAt(te++);if(!(d>=56320&&d<=57343))return null;_e=1024*(le-55296)+65536+(d-56320)}else _e=ne;_e<128?he[pe++]=_e:_e<2048?(he[pe++]=_e>>>6|192,he[pe++]=63&_e|128):_e<65536?(he[pe++]=_e>>>12|224,he[pe++]=_e>>6&63|128,he[pe++]=63&_e|128):_e<2097152&&(he[pe++]=_e>>>18|240,he[pe++]=_e>>12&63|128,he[pe++]=_e>>6&63|128,he[pe++]=63&_e|128)}return he.subarray(0,pe)}(y),te=0;te>5==6?(31&te)<<6|63&y[le++]:te>>4==14?(15&te)<<12|(63&y[le++])<<6|63&y[le++]:(7&te)<<18|(63&y[le++])<<12|(63&y[le++])<<6|63&y[le++])<65536?ne+=String.fromCharCode(he):(pe=55296|(he-=65536)>>10,ne+=String.fromCharCode(pe,56320|1023&he));return ne}(te)},xt.exports=Pe},{}],19:[function(At,xt,kt){"use strict";function Q(){}Q.prototype.formatEntry=function(je,Pe,y,he){var te={};return te.word_id=je,te.word_type=y,te.word_position=Pe,te.surface_form=he[0],te.pos=he[1],te.pos_detail_1=he[2],te.pos_detail_2=he[3],te.pos_detail_3=he[4],te.conjugated_type=he[5],te.conjugated_form=he[6],te.basic_form=he[7],te.reading=he[8],te.pronunciation=he[9],te},Q.prototype.formatUnknownEntry=function(je,Pe,y,he,te){var pe={};return pe.word_id=je,pe.word_type=y,pe.word_position=Pe,pe.surface_form=te,pe.pos=he[1],pe.pos_detail_1=he[2],pe.pos_detail_2=he[3],pe.pos_detail_3=he[4],pe.conjugated_type=he[5],pe.conjugated_form=he[6],pe.basic_form=he[7],pe},xt.exports=Q},{}],20:[function(At,xt,kt){"use strict";function Q(je){this.str=je,this.index_mapping=[];for(var Pe=0;Pe=55296&&he<=56319&&y=56320&&Pe<=57343?1024*(he-55296)+Pe-56320+65536:he},Q.prototype.toString=function(){return this.str},Q.isSurrogatePair=function(je){var Pe=je.charCodeAt(0);return Pe>=55296&&Pe<=56319},xt.exports=Q},{}],21:[function(At,xt,kt){"use strict";var Q=At("./ViterbiNode"),je=At("./ViterbiLattice"),Pe=At("../util/SurrogateAwareString");function y(he){this.trie=he.trie,this.token_info_dictionary=he.token_info_dictionary,this.unknown_dictionary=he.unknown_dictionary}y.prototype.build=function(he){for(var te,_e,ne,le,d=new je,N=new Pe(he),A=0;A=0;ne--){var le=te[ne];"."===le?te.splice(ne,1):".."===le?(te.splice(ne,1),_e++):_e&&(te.splice(ne,1),_e--)}if(pe)for(;_e--;_e)te.unshift("..");return te}function y(te,pe){if(te.filter)return te.filter(pe);for(var _e=[],ne=0;ne=-1&&!pe;_e--){var ne=_e>=0?arguments[_e]:Q.cwd();if("string"!=typeof ne)throw new TypeError("Arguments to path.resolve must be strings");ne&&(te=ne+"/"+te,pe="/"===ne.charAt(0))}return(pe?"/":"")+(te=je(y(te.split("/"),function(le){return!!le}),!pe).join("/"))||"."},kt.normalize=function(te){var pe=kt.isAbsolute(te),_e="/"===he(te,-1);return(te=je(y(te.split("/"),function(ne){return!!ne}),!pe).join("/"))||pe||(te="."),te&&_e&&(te+="/"),(pe?"/":"")+te},kt.isAbsolute=function(te){return"/"===te.charAt(0)},kt.join=function(){var te=Array.prototype.slice.call(arguments,0);return kt.normalize(y(te,function(pe,_e){if("string"!=typeof pe)throw new TypeError("Arguments to path.join must be strings");return pe}).join("/"))},kt.relative=function(te,pe){function _e(b){for(var m=0;m=0&&""===b[_];_--);return m>_?[]:b.slice(m,_-m+1)}te=kt.resolve(te).substr(1),pe=kt.resolve(pe).substr(1);for(var ne=_e(te.split("/")),le=_e(pe.split("/")),d=Math.min(ne.length,le.length),N=d,A=0;A=1;--d)if(47===(pe=te.charCodeAt(d))){if(!le){ne=d;break}}else le=!1;return-1===ne?_e?"/":".":_e&&1===ne?"/":te.slice(0,ne)},kt.basename=function(te,pe){var _e=function Pe(te){"string"!=typeof te&&(te+="");var pe,_e=0,ne=-1,le=!0;for(pe=te.length-1;pe>=0;--pe)if(47===te.charCodeAt(pe)){if(!le){_e=pe+1;break}}else-1===ne&&(le=!1,ne=pe+1);return-1===ne?"":te.slice(_e,ne)}(te);return pe&&_e.substr(-1*pe.length)===pe&&(_e=_e.substr(0,_e.length-pe.length)),_e},kt.extname=function(te){"string"!=typeof te&&(te+="");for(var pe=-1,_e=0,ne=-1,le=!0,d=0,N=te.length-1;N>=0;--N){var A=te.charCodeAt(N);if(47!==A)-1===ne&&(le=!1,ne=N+1),46===A?-1===pe?pe=N:1!==d&&(d=1):-1!==pe&&(d=-1);else if(!le){_e=N+1;break}}return-1===pe||-1===ne||0===d||1===d&&pe===ne-1&&pe===_e+1?"":te.slice(pe,ne)};var he="b"==="ab".substr(-1)?function(te,pe,_e){return te.substr(pe,_e)}:function(te,pe,_e){return pe<0&&(pe=te.length+pe),te.substr(pe,_e)}}).call(this,At("_process"))},{_process:26}],26:[function(At,xt,kt){var Q,je,Pe=xt.exports={};function y(){throw new Error("setTimeout has not been defined")}function he(){throw new Error("clearTimeout has not been defined")}function te(m){if(Q===setTimeout)return setTimeout(m,0);if((Q===y||!Q)&&setTimeout)return Q=setTimeout,setTimeout(m,0);try{return Q(m,0)}catch{try{return Q.call(null,m,0)}catch{return Q.call(this,m,0)}}}!function(){try{Q="function"==typeof setTimeout?setTimeout:y}catch{Q=y}try{je="function"==typeof clearTimeout?clearTimeout:he}catch{je=he}}();var _e,ne=[],le=!1,d=-1;function N(){le&&_e&&(le=!1,_e.length?ne=_e.concat(ne):d=-1,ne.length&&A())}function A(){if(!le){var m=te(N);le=!0;for(var _=ne.length;_;){for(_e=ne,ne=[];++d<_;)_e&&_e[d].run();d=-1,_=ne.length}_e=null,le=!1,function pe(m){if(je===clearTimeout)return clearTimeout(m);if((je===he||!je)&&clearTimeout)return je=clearTimeout,clearTimeout(m);try{je(m)}catch{try{return je.call(null,m)}catch{return je.call(this,m)}}}(m)}}function f(m,_){this.fun=m,this.array=_}function b(){}Pe.nextTick=function(m){var _=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n=0&&(ne._idleTimeoutId=setTimeout(function(){ne._onTimeout&&ne._onTimeout()},le))},kt.setImmediate="function"==typeof Q?Q:function(ne){var le=pe++,d=!(arguments.length<2)&&he.call(arguments,1);return te[le]=!0,Pe(function(){te[le]&&(d?ne.apply(null,d):ne.call(null),kt.clearImmediate(le))}),le},kt.clearImmediate="function"==typeof je?je:function(ne){delete te[ne]}}).call(this,At("timers").setImmediate,At("timers").clearImmediate)},{"process/browser.js":26,timers:27}],28:[function(At,xt,kt){(function(){"use strict";function Q(X){throw X}var je=void 0,Pe=this;function y(X,T){var D,M=X.split("."),v=Pe;for((!(M[0]in v)&&v.execScript&&v.execScript("var "+M[0]));M.length&&(D=M.shift());)M.length||T===je?v=v[D]?v[D]:v[D]={}:v[D]=T}var he,te=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u"&&typeof DataView<"u";for(new(te?Uint8Array:Array)(256),he=0;256>he;++he)for(var pe=(pe=he)>>>1;pe;pe>>>=1);function _e(X,T,D){var M,v="number"==typeof T?T:T=0,B="number"==typeof D?D:X.length;for(M=-1,v=7&B;v--;++T)M=M>>>8^le[255&(M^X[T])];for(v=B>>3;v--;T+=8)M=(M=(M=(M=(M=(M=(M=(M=M>>>8^le[255&(M^X[T])])>>>8^le[255&(M^X[T+1])])>>>8^le[255&(M^X[T+2])])>>>8^le[255&(M^X[T+3])])>>>8^le[255&(M^X[T+4])])>>>8^le[255&(M^X[T+5])])>>>8^le[255&(M^X[T+6])])>>>8^le[255&(M^X[T+7])];return(4294967295^M)>>>0}var ne=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],le=te?new Uint32Array(ne):ne;function d(){}function N(X){var T,D,M,v,B,F,q,L,Y,se,Ee=X.length,Se=0,Ie=Number.POSITIVE_INFINITY;for(L=0;LSe&&(Se=X[L]),X[L]>=1;for(se=M<<16|L,Y=F;YA;A++)switch(!0){case 143>=A:f.push([A+48,8]);break;case 255>=A:f.push([A-144+400,9]);break;case 279>=A:f.push([A-256+0,7]);break;case 287>=A:f.push([A-280+192,8]);break;default:Q("invalid literal: "+A)}var b=function(){function X(v){switch(!0){case 3===v:return[257,v-3,0];case 4===v:return[258,v-4,0];case 5===v:return[259,v-5,0];case 6===v:return[260,v-6,0];case 7===v:return[261,v-7,0];case 8===v:return[262,v-8,0];case 9===v:return[263,v-9,0];case 10===v:return[264,v-10,0];case 12>=v:return[265,v-11,1];case 14>=v:return[266,v-13,1];case 16>=v:return[267,v-15,1];case 18>=v:return[268,v-17,1];case 22>=v:return[269,v-19,2];case 26>=v:return[270,v-23,2];case 30>=v:return[271,v-27,2];case 34>=v:return[272,v-31,2];case 42>=v:return[273,v-35,3];case 50>=v:return[274,v-43,3];case 58>=v:return[275,v-51,3];case 66>=v:return[276,v-59,3];case 82>=v:return[277,v-67,4];case 98>=v:return[278,v-83,4];case 114>=v:return[279,v-99,4];case 130>=v:return[280,v-115,4];case 162>=v:return[281,v-131,5];case 194>=v:return[282,v-163,5];case 226>=v:return[283,v-195,5];case 257>=v:return[284,v-227,5];case 258===v:return[285,v-258,0];default:Q("invalid length: "+v)}}var T,D,M=[];for(T=3;258>=T;T++)D=X(T),M[T]=D[2]<<24|D[1]<<16|D[0];return M}();function m(X,T){switch(this.i=[],this.j=32768,this.d=this.f=this.c=this.n=0,this.input=te?new Uint8Array(X):X,this.o=!1,this.k=n,this.w=!1,!T&&(T={})||(T.index&&(this.c=T.index),T.bufferSize&&(this.j=T.bufferSize),T.bufferType&&(this.k=T.bufferType),T.resize&&(this.w=T.resize)),this.k){case _:this.a=32768,this.b=new(te?Uint8Array:Array)(32768+this.j+258);break;case n:this.a=0,this.b=new(te?Uint8Array:Array)(this.j),this.e=this.D,this.q=this.A,this.l=this.C;break;default:Q(Error("invalid inflate mode"))}}te&&new Uint32Array(b);var _=0,n=1;m.prototype.g=function(){for(;!this.o;){var X=oe(this,3);switch(1&X&&(this.o=!0),X>>>=1){case 0:var T=this.input,D=this.c,M=this.b,v=this.a,B=T.length,F=je,q=M.length,L=je;switch(this.d=this.f=0,D+1>=B&&Q(Error("invalid uncompressed block header: LEN")),F=T[D++]|T[D++]<<8,D+1>=B&&Q(Error("invalid uncompressed block header: NLEN")),F===~(T[D++]|T[D++]<<8)&&Q(Error("invalid uncompressed block header: length verify")),D+F>T.length&&Q(Error("input buffer is broken")),this.k){case _:for(;v+F>M.length;){if(F-=L=q-v,te)M.set(T.subarray(D,D+L),v),v+=L,D+=L;else for(;L--;)M[v++]=T[D++];this.a=v,M=this.e(),v=this.a}break;case n:for(;v+F>M.length;)M=this.e({t:2});break;default:Q(Error("invalid inflate mode"))}if(te)M.set(T.subarray(D,D+F),v),v+=F,D+=F;else for(;F--;)M[v++]=T[D++];this.c=D,this.a=v,this.b=M;break;case 1:this.l(I,$);break;case 2:var Y,se,Ee,Se,Ie=oe(this,5)+257,Qe=oe(this,5)+1,Je=oe(this,4)+4,ut=new(te?Uint8Array:Array)(u.length),$t=je,qt=je,tt=je,at=je,nt=je;for(nt=0;nt=g?8:255>=g?9:279>=g?7:8;var z,k,I=N(C),V=new(te?Uint8Array:Array)(30);for(z=0,k=V.length;z=q&&Q(Error("input buffer is broken")),M|=B[F++]<>>T,X.d=v-T,X.c=F,D}function ue(X,T){for(var D,M,v=X.f,B=X.d,F=X.input,q=X.c,L=F.length,Y=T[0],se=T[1];B=L);)v|=F[q++]<>>16)>B&&Q(Error("invalid code length: "+M)),X.f=v>>M,X.d=B-M,X.c=q,65535&D}function Ae(X){this.input=X,this.c=0,this.m=[],this.s=!1}m.prototype.l=function(X,T){var D=this.b,M=this.a;this.r=X;for(var v,B,F,q,L=D.length-258;256!==(v=ue(this,X));)if(256>v)M>=L&&(this.a=M,D=this.e(),M=this.a),D[M++]=v;else for(q=t[B=v-257],0=L&&(this.a=M,D=this.e(),M=this.a);q--;)D[M]=D[M++-F];for(;8<=this.d;)this.d-=8,this.c--;this.a=M},m.prototype.C=function(X,T){var D=this.b,M=this.a;this.r=X;for(var v,B,F,q,L=D.length;256!==(v=ue(this,X));)if(256>v)M>=L&&(L=(D=this.e()).length),D[M++]=v;else for(q=t[B=v-257],0L&&(L=(D=this.e()).length);q--;)D[M]=D[M++-F];for(;8<=this.d;)this.d-=8,this.c--;this.a=M},m.prototype.e=function(){var X,T,D=new(te?Uint8Array:Array)(this.a-32768),M=this.a-32768,v=this.b;if(te)D.set(v.subarray(32768,D.length));else for(X=0,T=D.length;XX;++X)v[X]=v[M+X];return this.a=32768,v},m.prototype.D=function(X){var T,D,M,v=this.input.length/this.c+1|0,F=this.b;return X&&("number"==typeof X.t&&(v=X.t),"number"==typeof X.z&&(v+=X.z)),D=2>v?(M=(this.input.length-this.c)/this.r[2]/2*258|0)T&&(this.b.length=T),X=this.b),this.buffer=X},Ae.prototype.F=function(){return this.s||this.g(),this.m.slice()},Ae.prototype.g=function(){for(var X=this.input.length;this.c>>0,_e(T,je,je)!==se&&Q(Error("invalid CRC-32 checksum: 0x"+_e(T,je,je).toString(16)+" / 0x"+se.toString(16))),M.L=v=(Ee[Se++]|Ee[Se++]<<8|Ee[Se++]<<16|Ee[Se++]<<24)>>>0,(4294967295&T.length)!==v&&Q(Error("invalid input size: "+(4294967295&T.length)+" / "+v)),this.m.push(M),this.c=Se}this.s=!0;var Ie,Qe,Je,ut=this.m,$t=0,qt=0;for(Ie=0,Qe=ut.length;Ie0&&void 0!==arguments[0]?arguments[0]:{}).dictPath;(function he(ne,le){if(!(ne instanceof le))throw new TypeError("Cannot call a class as a function")})(this,ne),this._analyzer=null,this._dictPath=le||(te?At.resolve("kuromoji").replace(/src(?!.*src).*/,"dict/"):"node_modules/kuromoji/dict/")}return Q(ne,[{key:"init",value:function(){var le=this;return new Promise(function(d,N){var A=le;null==le._analyzer?Pe.default.builder({dicPath:le._dictPath}).build(function(f,b){if(f)return N(f);A._analyzer=b,d()}):N(new Error("This analyzer has already been initialized."))})}},{key:"parse",value:function(){var le=this,d=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return new Promise(function(N,A){if(""===d.trim())return N([]);for(var f=le._analyzer.tokenize(d),b=0;bi?1:e>=i?0:NaN}function A(e){return null===e?NaN:+e}function f(e){return!isNaN(e)}function b(e){return{left:function(i,p,x,S){for(arguments.length<3&&(x=0),arguments.length<4&&(S=i.length);x>>1;e(i[R],p)<0?x=R+1:S=R}return x},right:function(i,p,x,S){for(arguments.length<3&&(x=0),arguments.length<4&&(S=i.length);x>>1;e(i[R],p)>0?S=R:x=R+1}return x}}}Q.ascending=N,Q.descending=function(e,i){return ie?1:i>=e?0:NaN},Q.min=function(e,i){var S,R,p=-1,x=e.length;if(1===arguments.length){for(;++p=R){S=R;break}for(;++pR&&(S=R)}else{for(;++p=R){S=R;break}for(;++pR&&(S=R)}return S},Q.max=function(e,i){var S,R,p=-1,x=e.length;if(1===arguments.length){for(;++p=R){S=R;break}for(;++pS&&(S=R)}else{for(;++p=R){S=R;break}for(;++pS&&(S=R)}return S},Q.extent=function(e,i){var S,R,K,p=-1,x=e.length;if(1===arguments.length){for(;++p=R){S=K=R;break}for(;++pR&&(S=R),K=R){S=K=R;break}for(;++pR&&(S=R),K1)return K/(G-1)},Q.deviation=function(){var e=Q.variance.apply(this,arguments);return e&&Math.sqrt(e)};var m=b(N);function _(e){return e.length}Q.bisectLeft=m.left,Q.bisect=Q.bisectRight=m.right,Q.bisector=function(e){return b(1===e.length?function(i,p){return N(e(i),p)}:e)},Q.shuffle=function(e,i,p){(x=arguments.length)<3&&(p=e.length,x<2&&(i=0));for(var S,R,x=p-i;x;)R=Math.random()*x--|0,S=e[x+i],e[x+i]=e[R+i],e[R+i]=S;return e},Q.permute=function(e,i){for(var p=i.length,x=new Array(p);p--;)x[p]=e[i[p]];return x},Q.pairs=function(e){for(var i=0,p=e.length-1,S=e[0],R=new Array(p<0?0:p);i=0;)for(p=(K=e[i]).length;--p>=0;)R[--S]=K[p];return R};var n=Math.abs;function h(e,i){for(var p in i)Object.defineProperty(e.prototype,p,{value:i[p],enumerable:!1})}function s(){this._=Object.create(null)}Q.range=function(e,i,p){if(arguments.length<3&&(p=1,arguments.length<2&&(i=e,e=0)),(i-e)/p==1/0)throw new Error("infinite range");var K,x=[],S=function g(e){for(var i=1;e*i%1;)i*=10;return i}(n(p)),R=-1;if(e*=S,i*=S,(p*=S)<0)for(;(K=e+p*++R)>i;)x.push(K/S);else for(;(K=e+p*++R)=i.length)return S?S.call(e,G):x?G.sort(x):G;for(var Ne,Xe,ke,Oe,ce=-1,ge=G.length,we=i[re++],Be=new s;++ce=i.length)return U;var re=[],ce=p[G++];return U.forEach(function(ge,we){re.push({key:ge,values:K(we,G)})}),ce?re.sort(function(ge,we){return ce(ge.key,we.key)}):re}return e.map=function(U,G){return R(G,U,0)},e.entries=function(U){return K(R(Q.map,U,0),0)},e.key=function(U){return i.push(U),e},e.sortKeys=function(U){return p[i.length-1]=U,e},e.sortValues=function(U){return x=U,e},e.rollup=function(U){return S=U,e},e},Q.set=function(e){var i=new C;if(e)for(var p=0,x=e.length;p=0&&(x=e.slice(p+1),e=e.slice(0,p)),e)return arguments.length<2?this[e].on(x):this[e].on(x,i);if(2===arguments.length){if(null==i)for(e in this)this.hasOwnProperty(e)&&this[e].on(x,null);return this}},Q.event=null,Q.requote=function(e){return e.replace(D,"\\$&")};var D=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,M={}.__proto__?function(e,i){e.__proto__=i}:function(e,i){for(var p in i)e[p]=i[p]};function v(e){return M(e,L),e}var B=function(e,i){return i.querySelector(e)},F=function(e,i){return i.querySelectorAll(e)},q=function(e,i){var p=e.matches||e[I(e,"matchesSelector")];return(q=function(x,S){return p.call(x,S)})(e,i)};"function"==typeof Sizzle&&(B=function(e,i){return Sizzle(e,i)[0]||null},F=Sizzle,q=Sizzle.matchesSelector),Q.selection=function(){return Q.select(y.documentElement)};var L=Q.selection.prototype=[];function Y(e){return"function"==typeof e?e:function(){return B(e,this)}}function se(e){return"function"==typeof e?e:function(){return F(e,this)}}L.select=function(e){var p,x,S,R,i=[];e=Y(e);for(var K=-1,U=this.length;++K=0&&"xmlns"!==(p=e.slice(0,i))&&(e=e.slice(i+1)),Se.hasOwnProperty(p)?{space:Se[p],local:e}:e}},L.attr=function(e,i){if(arguments.length<2){if("string"==typeof e){var p=this.node();return(e=Q.ns.qualify(e)).local?p.getAttributeNS(e.space,e.local):p.getAttribute(e)}for(i in e)this.each(Ie(i,e[i]));return this}return this.each(Ie(e,i))},L.classed=function(e,i){if(arguments.length<2){if("string"==typeof e){var p=this.node(),x=(e=ut(e)).length,S=-1;if(i=p.classList){for(;++S=0;)(R=p[x])&&(S&&S!==R.nextSibling&&S.parentNode.insertBefore(R,S),S=R);return this},L.sort=function(e){e=O.apply(this,arguments);for(var i=-1,p=this.length;++i0&&(e=e.slice(0,S));var K=st.get(e);function U(){var ce=this[x];ce&&(this.removeEventListener(e,ce,ce.$),delete this[x])}return K&&(e=K,R=on),S?i?function G(){var ce=R(i,Pe(arguments));U.call(this),this.addEventListener(e,this[x]=ce,ce.$=p),ce._=i}:U:i?$:function re(){var ge,ce=new RegExp("^__on([^.]+)"+Q.requote(e)+"$");for(var we in this)if(ge=we.match(ce)){var Ne=this[we];this.removeEventListener(ge[1],Ne,Ne.$),delete this[we]}}}Q.selection.enter=ee,Q.selection.enter.prototype=ve,ve.append=L.append,ve.empty=L.empty,ve.node=L.node,ve.call=L.call,ve.size=L.size,ve.select=function(e){for(var p,x,S,R,K,i=[],U=-1,G=this.length;++U=i&&(i=S+1);!(G=K[i])&&++i0?1:e<0?-1:0}function Bt(e,i,p){return(i[0]-e[0])*(p[1]-e[1])-(i[1]-e[1])*(p[0]-e[0])}function ln(e){return e>1?0:e<-1?de:Math.acos(e)}function Ot(e){return e>1?qe:e<-1?-qe:Math.asin(e)}function kn(e){return((e=Math.exp(e))+1/e)/2}function In(e){return(e=Math.sin(e/2))*e}var pr=Math.SQRT2;Q.interpolateZoom=function(e,i){var ge,we,p=e[0],x=e[1],S=e[2],U=i[2],G=i[0]-p,re=i[1]-x,ce=G*G+re*re;if(ce0&&(zt=zt.transition().duration(K)),zt.call(ze.event)}function Zt(){Be&&Be.domain(ke.range().map(function(zt){return(zt-e.x)/e.k}).map(ke.invert)),$e&&$e.domain(Oe.range().map(function(zt){return(zt-e.y)/e.k}).map(Oe.invert))}function rn(zt){U++||zt({type:"zoomstart"})}function Ln(zt){Zt(),zt({type:"zoom",scale:e.k,translate:[e.x,e.y]})}function bn(zt){--U||(zt({type:"zoomend"}),p=null)}function An(){var zt=this,hn=Xe.of(zt,arguments),Wn=0,tr=Q.select(te(zt)).on(re,function qr(){Wn=1,wt(Q.mouse(zt),lr),Ln(hn)}).on(ce,function Li(){tr.on(re,null).on(ce,null),Nr(Wn),bn(hn)}),lr=Ve(Q.mouse(zt)),Nr=sn(zt);Es.call(zt),rn(hn)}function Lt(){var lr,zt=this,hn=Xe.of(zt,arguments),Wn={},tr=0,Nr=".zoom-"+Q.event.changedTouches[0].identifier,qr="touchmove"+Nr,Li="touchend"+Nr,Di=[],Bi=Q.select(zt),qi=sn(zt);function Ti(){var so=Q.touches(zt);return lr=e.k,so.forEach(function(ki){ki.identifier in Wn&&(Wn[ki.identifier]=Ve(ki))}),so}function Ki(){var so=Q.event.target;Q.select(so).on(qr,Po).on(Li,lu),Di.push(so);for(var ki=Q.event.changedTouches,Qi=0,po=ki.length;Qi1){var Oo,So=eo[1],Cs=(Oo=eo[0])[0]-So[0],lc=Oo[1]-So[1];tr=Cs*Cs+lc*lc}}function Po(){var ki,Qi,po,eo,so=Q.touches(zt);Es.call(zt);for(var Go=0,Oo=so.length;Go360?U-=360:U<0&&(U+=360),U<60?x+(S-x)*U/60:U<180?S:U<240?x+(S-x)*(240-U)/60:x}(U))}return e=isNaN(e)?0:(e%=360)<0?e+360:e,i=isNaN(i)||i<0?0:i>1?1:i,x=2*(p=p<0?0:p>1?1:p)-(S=p<=.5?p*(1+i):p+i-p*i),new zr(K(e+120),K(e),K(e-120))}function Gn(e,i,p){return this instanceof Gn?(this.h=+e,this.c=+i,void(this.l=+p)):arguments.length<2?e instanceof Gn?new Gn(e.h,e.c,e.l):function si(e,i,p){return e>0?new Gn(Math.atan2(p,i)*Ct,Math.sqrt(i*i+p*p),e):new Gn(NaN,NaN,e)}(e instanceof me?e.l:(e=We((e=Q.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Gn(e,i,p)}Zn.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),new Kn(this.h,this.s,this.l/e)},Zn.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new Kn(this.h,this.s,e*this.l)},Zn.rgb=function(){return Kr(this.h,this.s,this.l)},Q.hcl=Gn;var er=Gn.prototype=new Wr;function ct(e,i,p){return isNaN(e)&&(e=0),isNaN(i)&&(i=0),new me(p,Math.cos(e*=Ze)*i,Math.sin(e)*i)}function me(e,i,p){return this instanceof me?(this.l=+e,this.a=+i,void(this.b=+p)):arguments.length<2?e instanceof me?new me(e.l,e.a,e.b):e instanceof Gn?ct(e.h,e.c,e.l):We((e=zr(e)).r,e.g,e.b):new me(e,i,p)}er.brighter=function(e){return new Gn(this.h,this.c,Math.min(100,this.l+ot*(arguments.length?e:1)))},er.darker=function(e){return new Gn(this.h,this.c,Math.max(0,this.l-ot*(arguments.length?e:1)))},er.rgb=function(){return ct(this.h,this.c,this.l).rgb()},Q.lab=me;var ot=18,ft=.95047,be=1,dt=1.08883,Zr=me.prototype=new Wr;function ri(e,i,p){var x=(e+16)/116,S=x+i/500,R=x-p/200;return new zr(Jr(3.2404542*(S=cr(S)*ft)-1.5371385*(x=cr(x)*be)-.4985314*(R=cr(R)*dt)),Jr(-.969266*S+1.8760108*x+.041556*R),Jr(.0556434*S-.2040259*x+1.0572252*R))}function cr(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function yi(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function Jr(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function zr(e,i,p){return this instanceof zr?(this.r=~~e,this.g=~~i,void(this.b=~~p)):arguments.length<2?e instanceof zr?new zr(e.r,e.g,e.b):Fr(""+e,zr,Kr):new zr(e,i,p)}function ui(e){return new zr(e>>16,e>>8&255,255&e)}function ai(e){return ui(e)+""}Zr.brighter=function(e){return new me(Math.min(100,this.l+ot*(arguments.length?e:1)),this.a,this.b)},Zr.darker=function(e){return new me(Math.max(0,this.l-ot*(arguments.length?e:1)),this.a,this.b)},Zr.rgb=function(){return ri(this.l,this.a,this.b)},Q.rgb=zr;var li=zr.prototype=new Wr;function Vr(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function Fr(e,i,p){var K,U,G,x=0,S=0,R=0;if(K=/([a-z]+)\((.*)\)/.exec(e=e.toLowerCase()))switch(U=K[2].split(","),K[1]){case"hsl":return p(parseFloat(U[0]),parseFloat(U[1])/100,parseFloat(U[2])/100);case"rgb":return i(Yn(U[0]),Yn(U[1]),Yn(U[2]))}return(G=Cn.get(e))?i(G.r,G.g,G.b):(null!=e&&"#"===e.charAt(0)&&!isNaN(G=parseInt(e.slice(1),16))&&(4===e.length?(x=(3840&G)>>4,x|=x>>4,S=240&G,S|=S>>4,R=15&G,R|=R<<4):7===e.length&&(x=(16711680&G)>>16,S=(65280&G)>>8,R=255&G)),i(x,S,R))}function Un(e,i,p){var K,U,x=Math.min(e/=255,i/=255,p/=255),S=Math.max(e,i,p),R=S-x,G=(S+x)/2;return R?(U=G<.5?R/(S+x):R/(2-S-x),K=e==S?(i-p)/R+(i0&&G<1?0:K),new Kn(K,U,G)}function We(e,i,p){var x=yi((.4124564*(e=Mn(e))+.3575761*(i=Mn(i))+.1804375*(p=Mn(p)))/ft),S=yi((.2126729*e+.7151522*i+.072175*p)/be);return me(116*S-16,500*(x-S),200*(S-yi((.0193339*e+.119192*i+.9503041*p)/dt)))}function Mn(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Yn(e){var i=parseFloat(e);return"%"===e.charAt(e.length-1)?Math.round(2.55*i):i}li.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var i=this.r,p=this.g,x=this.b,S=30;return i||p||x?(i&&i=200&&ce<300||304===ce){try{ge=p.call(S,U)}catch(we){return void R.error.call(S,we)}R.load.call(S,ge)}else R.error.call(S,U)}return this.XDomainRequest&&!("withCredentials"in U)&&/^(http(s)?:)?\/\//.test(e)&&(U=new XDomainRequest),"onload"in U?U.onload=U.onerror=re:U.onreadystatechange=function(){U.readyState>3&&re()},U.onprogress=function(ce){var ge=Q.event;Q.event=ce;try{R.progress.call(S,U)}finally{Q.event=ge}},S.header=function(ce,ge){return ce=(ce+"").toLowerCase(),arguments.length<2?K[ce]:(null==ge?delete K[ce]:K[ce]=ge+"",S)},S.mimeType=function(ce){return arguments.length?(i=null==ce?null:ce+"",S):i},S.responseType=function(ce){return arguments.length?(G=ce,S):G},S.response=function(ce){return p=ce,S},["get","post"].forEach(function(ce){S[ce]=function(){return S.send.apply(S,[ce].concat(Pe(arguments)))}}),S.send=function(ce,ge,we){if(2===arguments.length&&"function"==typeof ge&&(we=ge,ge=null),U.open(ce,e,!0),null!=i&&!("accept"in K)&&(K.accept=i+",*/*"),U.setRequestHeader)for(var Ne in K)U.setRequestHeader(Ne,K[Ne]);return null!=i&&U.overrideMimeType&&U.overrideMimeType(i),null!=G&&(U.responseType=G),null!=we&&S.on("error",we).on("load",function(Xe){we(null,Xe)}),R.beforesend.call(S,U),U.send(ge??null),S},S.abort=function(){return U.abort(),S},Q.rebind(S,R,"on"),null==x?S:S.get(function ci(e){return 1===e.length?function(i,p){e(null==i?p:null)}:e}(x))}Cn.forEach(function(e,i){Cn.set(e,ui(i))}),Q.functor=Jn,Q.xhr=Er(z),Q.dsv=function(e,i){var p=new RegExp('["'+e+"\n]"),x=e.charCodeAt(0);function S(re,ce,ge){arguments.length<3&&(ge=ce,ce=null);var we=Gr(re,i,null==ce?R:K(ce),ge);return we.row=function(Ne){return arguments.length?we.response(null==(ce=Ne)?R:K(Ne)):ce},we}function R(re){return S.parse(re.responseText)}function K(re){return function(ce){return S.parse(ce.responseText,re)}}function U(re){return re.map(G).join(e)}function G(re){return p.test(re)?'"'+re.replace(/\"/g,'""')+'"':re}return S.parse=function(re,ce){var ge;return S.parseRows(re,function(we,Ne){if(ge)return ge(we,Ne-1);var Xe=new Function("d","return {"+we.map(function(ke,Be){return JSON.stringify(ke)+": d["+Be+"]"}).join(",")+"}");ge=ce?function(ke,Be){return ce(Xe(ke),Be)}:Xe})},S.parseRows=function(re,ce){var Oe,$e,ge={},we={},Ne=[],Xe=re.length,ke=0,Be=0;function ze(){if(ke>=Xe)return we;if($e)return $e=!1,ge;var Tt=ke;if(34===re.charCodeAt(Tt)){for(var yt=Tt;yt++24?(isFinite(i)&&(clearTimeout(Ur),Ur=setTimeout(Z,i)),hi=0):(hi=1,to(Z))}function ie(){for(var e=Date.now(),i=Qr;i;)e>=i.t&&i.c(e-i.t)&&(i.c=null),i=i.n;return e}function fe(){for(var e,i=Qr,p=1/0;i;)i.c?(i.t8?function(x){return x/p}:function(x){return x*p},symbol:e}});function Ue(e){var i=e.decimal,p=e.thousands,x=e.grouping,S=e.currency,R=x&&p?function(K,U){for(var G=K.length,re=[],ce=0,ge=x[0],we=0;G>0&&ge>0&&(we+ge+1>U&&(ge=Math.max(1,U-we)),re.push(K.substring(G-=ge,G+ge)),!((we+=ge+1)>U));)ge=x[ce=(ce+1)%x.length];return re.reverse().join(p)}:z;return function(K){var U=Ge.exec(K),G=U[1]||" ",re=U[2]||">",ce=U[3]||"-",ge=U[4]||"",we=U[5],Ne=+U[6],Xe=U[7],ke=U[8],Be=U[9],Oe=1,$e="",ze="",Ve=!1,Tt=!0;switch(ke&&(ke=+ke.substring(1)),(we||"0"===G&&"="===re)&&(we=G="0",re="="),Be){case"n":Xe=!0,Be="g";break;case"%":Oe=100,ze="%",Be="f";break;case"p":Oe=100,ze="%",Be="r";break;case"b":case"o":case"x":case"X":"#"===ge&&($e="0"+Be.toLowerCase());case"c":Tt=!1;case"d":Ve=!0,ke=0;break;case"s":Oe=-1,Be="r"}"$"===ge&&($e=S[0],ze=S[1]),"r"==Be&&!ke&&(Be="g"),null!=ke&&("g"==Be?ke=Math.max(1,Math.min(21,ke)):("e"==Be||"f"==Be)&&(ke=Math.max(0,Math.min(20,ke)))),Be=_t.get(Be)||Ft;var yt=we&&Xe;return function(wt){var vt=ze;if(Ve&&wt%1)return"";var Zt=wt<0||0===wt&&1/wt<0?(wt=-wt,"-"):"-"===ce?"":ce;if(Oe<0){var rn=Q.formatPrefix(wt,ke);wt=rn.scale(wt),vt=rn.symbol+ze}else wt*=Oe;var bn,An,Ln=(wt=Be(wt,ke)).lastIndexOf(".");if(Ln<0){var Lt=Tt?wt.lastIndexOf("e"):-1;Lt<0?(bn=wt,An=""):(bn=wt.substring(0,Lt),An=wt.substring(Lt))}else bn=wt.substring(0,Ln),An=i+wt.substring(Ln+1);!we&&Xe&&(bn=R(bn,1/0));var en=$e.length+bn.length+An.length+(yt?0:Zt.length),dn=en"===re?dn+Zt+wt:"^"===re?dn.substring(0,en>>=1)+Zt+wt+dn.substring(en):Zt+(yt?wt:dn+wt))+vt}}}Q.formatPrefix=function(e,i){var p=0;return(e=+e)&&(e<0&&(e*=-1),i&&(e=Q.round(e,ye(e,i))),p=1+Math.floor(1e-12+Math.log(e)/Math.LN10),p=Math.max(-24,Math.min(24,3*Math.floor((p-1)/3)))),Me[8+p/3]};var Ge=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,_t=Q.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,i){return e.toPrecision(i)},e:function(e,i){return e.toExponential(i)},f:function(e,i){return e.toFixed(i)},r:function(e,i){return(e=Q.round(e,ye(e,i))).toFixed(Math.max(0,Math.min(20,ye(e*(1+1e-15),i))))}});function Ft(e){return e+""}var lt=Q.time={},mt=Date;function Ut(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Ut.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Xt.setUTCDate.apply(this._,arguments)},setDay:function(){Xt.setUTCDay.apply(this._,arguments)},setFullYear:function(){Xt.setUTCFullYear.apply(this._,arguments)},setHours:function(){Xt.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Xt.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Xt.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Xt.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Xt.setUTCSeconds.apply(this._,arguments)},setTime:function(){Xt.setTime.apply(this._,arguments)}};var Xt=Date.prototype;function It(e,i,p){function x(re){var ce=e(re),ge=R(ce,1);return re-ce1)for(;we=qr)return-1;if(37===(hn=en.charCodeAt(lr++))){if(tr=en.charAt(lr++),!(Wn=Tt[tr in un?en.charAt(lr++):tr])||(zt=Wn(Lt,dn,zt))<0)return-1}else if(hn!=dn.charCodeAt(zt++))return-1}return zt}re.utc=function(Lt){var en=re(Lt);function dn(zt){try{var hn=new(mt=Ut);return hn._=zt,en(hn)}finally{mt=Date}}return dn.parse=function(zt){try{mt=Ut;var hn=en.parse(zt);return hn&&hn._}finally{mt=Date}},dn.toString=en.toString,dn},re.multi=re.utc.multi=En;var ge=Q.map(),we=xr(R),Ne=kr(R),Xe=xr(K),ke=kr(K),Be=xr(U),Oe=kr(U),$e=xr(G),ze=kr(G);S.forEach(function(Lt,en){ge.set(Lt.toLowerCase(),en)});var Ve={a:function(Lt){return K[Lt.getDay()]},A:function(Lt){return R[Lt.getDay()]},b:function(Lt){return G[Lt.getMonth()]},B:function(Lt){return U[Lt.getMonth()]},c:re(i),d:function(Lt,en){return Hn(Lt.getDate(),en,2)},e:function(Lt,en){return Hn(Lt.getDate(),en,2)},H:function(Lt,en){return Hn(Lt.getHours(),en,2)},I:function(Lt,en){return Hn(Lt.getHours()%12||12,en,2)},j:function(Lt,en){return Hn(1+lt.dayOfYear(Lt),en,3)},L:function(Lt,en){return Hn(Lt.getMilliseconds(),en,3)},m:function(Lt,en){return Hn(Lt.getMonth()+1,en,2)},M:function(Lt,en){return Hn(Lt.getMinutes(),en,2)},p:function(Lt){return S[+(Lt.getHours()>=12)]},S:function(Lt,en){return Hn(Lt.getSeconds(),en,2)},U:function(Lt,en){return Hn(lt.sundayOfYear(Lt),en,2)},w:function(Lt){return Lt.getDay()},W:function(Lt,en){return Hn(lt.mondayOfYear(Lt),en,2)},x:re(p),X:re(x),y:function(Lt,en){return Hn(Lt.getFullYear()%100,en,2)},Y:function(Lt,en){return Hn(Lt.getFullYear()%1e4,en,4)},Z:xn,"%":function(){return"%"}},Tt={a:function yt(Lt,en,dn){Xe.lastIndex=0;var zt=Xe.exec(en.slice(dn));return zt?(Lt.w=ke.get(zt[0].toLowerCase()),dn+zt[0].length):-1},A:function wt(Lt,en,dn){we.lastIndex=0;var zt=we.exec(en.slice(dn));return zt?(Lt.w=Ne.get(zt[0].toLowerCase()),dn+zt[0].length):-1},b:function vt(Lt,en,dn){$e.lastIndex=0;var zt=$e.exec(en.slice(dn));return zt?(Lt.m=ze.get(zt[0].toLowerCase()),dn+zt[0].length):-1},B:function Zt(Lt,en,dn){Be.lastIndex=0;var zt=Be.exec(en.slice(dn));return zt?(Lt.m=Oe.get(zt[0].toLowerCase()),dn+zt[0].length):-1},c:function rn(Lt,en,dn){return ce(Lt,Ve.c.toString(),en,dn)},d:$n,e:$n,H:Re,I:Re,j:Ke,L:nn,m:cn,M:bt,p:function An(Lt,en,dn){var zt=ge.get(en.slice(dn,dn+=2).toLowerCase());return null==zt?-1:(Lt.p=zt,dn)},S:Et,U:ir,w:rr,W:or,x:function Ln(Lt,en,dn){return ce(Lt,Ve.x.toString(),en,dn)},X:function bn(Lt,en,dn){return ce(Lt,Ve.X.toString(),en,dn)},y:Fe,Y:fi,Z:St,"%":fn};return re}lt.year=It(function(e){return(e=lt.day(e)).setMonth(0,1),e},function(e,i){e.setFullYear(e.getFullYear()+i)},function(e){return e.getFullYear()}),lt.years=lt.year.range,lt.years.utc=lt.year.utc.range,lt.day=It(function(e){var i=new mt(2e3,0);return i.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),i},function(e,i){e.setDate(e.getDate()+i)},function(e){return e.getDate()-1}),lt.days=lt.day.range,lt.days.utc=lt.day.utc.range,lt.dayOfYear=function(e){var i=lt.year(e);return Math.floor((e-i-6e4*(e.getTimezoneOffset()-i.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(e,i){i=7-i;var p=lt[e]=It(function(x){return(x=lt.day(x)).setDate(x.getDate()-(x.getDay()+i)%7),x},function(x,S){x.setDate(x.getDate()+7*Math.floor(S))},function(x){var S=lt.year(x).getDay();return Math.floor((lt.dayOfYear(x)+(S+i)%7)/7)-(S!==i)});lt[e+"s"]=p.range,lt[e+"s"].utc=p.utc.range,lt[e+"OfYear"]=function(x){var S=lt.year(x).getDay();return Math.floor((lt.dayOfYear(x)+(S+i)%7)/7)}}),lt.week=lt.sunday,lt.weeks=lt.sunday.range,lt.weeks.utc=lt.sunday.utc.range,lt.weekOfYear=lt.sundayOfYear;var un={"-":"",_:" ",0:"0"},tn=/^\s*\d+/,an=/^%/;function Hn(e,i,p){var x=e<0?"-":"",S=(x?-e:e)+"",R=S.length;return x+(R68?1900:2e3)}(+x[0]),p+x[0].length):-1}function St(e,i,p){return/^[+-]\d{4}$/.test(i=i.slice(p,p+5))?(e.Z=-i,p+5):-1}function cn(e,i,p){tn.lastIndex=0;var x=tn.exec(i.slice(p,p+2));return x?(e.m=x[0]-1,p+x[0].length):-1}function $n(e,i,p){tn.lastIndex=0;var x=tn.exec(i.slice(p,p+2));return x?(e.d=+x[0],p+x[0].length):-1}function Ke(e,i,p){tn.lastIndex=0;var x=tn.exec(i.slice(p,p+3));return x?(e.j=+x[0],p+x[0].length):-1}function Re(e,i,p){tn.lastIndex=0;var x=tn.exec(i.slice(p,p+2));return x?(e.H=+x[0],p+x[0].length):-1}function bt(e,i,p){tn.lastIndex=0;var x=tn.exec(i.slice(p,p+2));return x?(e.M=+x[0],p+x[0].length):-1}function Et(e,i,p){tn.lastIndex=0;var x=tn.exec(i.slice(p,p+2));return x?(e.S=+x[0],p+x[0].length):-1}function nn(e,i,p){tn.lastIndex=0;var x=tn.exec(i.slice(p,p+3));return x?(e.L=+x[0],p+x[0].length):-1}function xn(e){var i=e.getTimezoneOffset(),p=i>0?"-":"+",x=n(i)/60|0,S=n(i)%60;return p+Hn(x,"0",2)+Hn(S,"0",2)}function fn(e,i,p){an.lastIndex=0;var x=an.exec(i.slice(p,p+1));return x?p+x[0].length:-1}function En(e){for(var i=e.length,p=-1;++p=0?1:-1,ce=re*G,ge=Math.cos(U),we=Math.sin(U),Ne=S*we,Xe=x*ge+Ne*Math.cos(ce),ke=Ne*re*Math.sin(ce);yr.add(Math.atan2(ke,Xe)),p=K,x=ge,S=we}ni.point=function(K,U){ni.point=R,p=(e=K)*Ze,x=Math.cos(U=(i=U)*Ze/2+de/4),S=Math.sin(U)},ni.lineEnd=function(){R(e,i)}}function pi(e){var i=e[0],p=e[1],x=Math.cos(p);return[x*Math.cos(i),x*Math.sin(i),Math.sin(p)]}function gi(e,i){return e[0]*i[0]+e[1]*i[1]+e[2]*i[2]}function ei(e,i){return[e[1]*i[2]-e[2]*i[1],e[2]*i[0]-e[0]*i[2],e[0]*i[1]-e[1]*i[0]]}function $i(e,i){e[0]+=i[0],e[1]+=i[1],e[2]+=i[2]}function Xi(e,i){return[e[0]*i,e[1]*i,e[2]*i]}function Ni(e){var i=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=i,e[1]/=i,e[2]/=i}function mi(e){return[Math.atan2(e[1],e[0]),Ot(e[2])]}function Vi(e,i){return n(e[0]-i[0])Rt?x=90:G<-Rt&&(i=-90),ce[0]=e,ce[1]=p}};function we(yt,wt){re.push(ce=[e=yt,p=yt]),wtx&&(x=wt)}function Ne(yt,wt){var vt=pi([yt*Ze,wt*Ze]);if(U){var Zt=ei(U,vt),Ln=ei([Zt[1],-Zt[0],0],Zt);Ni(Ln),Ln=mi(Ln);var bn=yt-S,An=bn>0?1:-1,Lt=Ln[0]*Ct*An,en=n(bn)>180;if(en^(An*Sx&&(x=dn);else if(en^(An*S<(Lt=(Lt+360)%360-180)&&Ltx&&(x=wt);en?ytze(e,p)&&(p=yt):ze(yt,p)>ze(e,p)&&(e=yt):p>=e?(ytp&&(p=yt)):yt>S?ze(e,yt)>ze(e,p)&&(p=yt):ze(yt,p)>ze(e,p)&&(e=yt)}else we(yt,wt);U=vt,S=yt}function Xe(){ge.point=Ne}function ke(){ce[0]=e,ce[1]=p,ge.point=we,U=null}function Be(yt,wt){if(U){var vt=yt-S;G+=n(vt)>180?vt+(vt>0?360:-360):vt}else R=yt,K=wt;ni.point(yt,wt),Ne(yt,wt)}function Oe(){ni.lineStart()}function $e(){Be(R,K),ni.lineEnd(),n(G)>Rt&&(e=-(p=180)),ce[0]=e,ce[1]=p,U=null}function ze(yt,wt){return(wt-=yt)<0?wt+360:wt}function Ve(yt,wt){return yt[0]-wt[0]}function Tt(yt,wt){return wt[0]<=wt[1]?wt[0]<=yt&&yt<=wt[1]:ytze(Zt[0],Zt[1])&&(Zt[1]=rn[1]),ze(rn[0],Zt[1])>ze(Zt[0],Zt[1])&&(Zt[0]=rn[0])):Ln.push(Zt=rn);for(var An,wt,rn,bn=-1/0,Zt=(vt=0,Ln[wt=Ln.length-1]);vt<=wt;Zt=rn,++vt)(An=ze(Zt[1],(rn=Ln[vt])[0]))>bn&&(bn=An,e=rn[0],p=Zt[1])}return re=ce=null,e===1/0||i===1/0?[[NaN,NaN],[NaN,NaN]]:[[e,i],[p,x]]}}(),Q.geo.centroid=function(e){zi=Ui=Ai=Ii=_i=Pi=Gi=ji=Te=Ye=it=0,Q.geo.stream(e,pt);var i=Te,p=Ye,x=it,S=i*i+p*p+x*x;return S=0;--U)S.point((we=ge[U])[0],we[1]);else x(Ne.x,Ne.p.x,-1,S);Ne=Ne.p}ge=(Ne=Ne.o).z,Xe=!Xe}while(!Ne.v);S.lineEnd()}}}function jr(e){if(i=e.length){for(var i,S,p=0,x=e[0];++p=0?1:-1,wt=yt*Tt,vt=wt>de,Zt=Xe*ze;if(yr.add(Math.atan2(Zt*yt*Math.sin(wt),ke*Ve+Zt*Math.cos(wt))),R+=vt?Tt+yt*Le:Tt,vt^we>=p^Oe>=p){var rn=ei(pi(ge),pi(e));Ni(rn);var Ln=ei(S,rn);Ni(Ln);var bn=(vt^Tt>=0?-1:1)*Ot(Ln[2]);(x>bn||x===bn&&(rn[0]||rn[1]))&&(K+=vt^Tt>=0?1:-1)}if(!Be++)break;we=Oe,Xe=ze,ke=Ve,ge=e}}return(R<-Rt||R0){for(Be||(R.polygonStart(),Be=!0),R.lineStart();++rn1&&2&yt&&wt.push(wt.pop().concat(wt.shift())),Ne.push(wt.filter(Or))}}return G}}function Or(e){return e.length>1}function Yr(){var i,e=[];return{lineStart:function(){e.push(i=[])},point:function(p,x){i.push([p,x])},lineEnd:$,buffer:function(){var p=e;return e=[],i=null,p},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function Fi(e,i){return((e=e.x)[0]<0?e[1]-qe-Rt:qe-e[1])-((i=i.x)[0]<0?i[1]-qe-Rt:qe-i[1])}var no=ti(Fn,function Hi(e){var S,i=NaN,p=NaN,x=NaN;return{lineStart:function(){e.lineStart(),S=1},point:function(R,K){var U=R>0?de:-de,G=n(R-i);n(G-de)0?qe:-qe),e.point(x,p),e.lineEnd(),e.lineStart(),e.point(U,p),e.point(R,p),S=0):x!==U&&G>=de&&(n(i-x)Rt?Math.atan((Math.sin(i)*(R=Math.cos(x))*Math.sin(p)-Math.sin(x)*(S=Math.cos(i))*Math.sin(e))/(S*R*K)):(i+x)/2}(i,p,R,K),e.point(x,p),e.lineEnd(),e.lineStart(),e.point(U,p),S=0),e.point(i=R,p=K),x=U},lineEnd:function(){e.lineEnd(),i=p=NaN},clean:function(){return 2-S}}},function Zi(e,i,p,x){var S;if(null==e)x.point(-de,S=p*qe),x.point(0,S),x.point(de,S),x.point(de,0),x.point(de,-S),x.point(0,-S),x.point(-de,-S),x.point(-de,0),x.point(-de,S);else if(n(e[0]-i[0])>Rt){var R=e[0]0)){if(ke/=Ne,Ne<0){if(ke0){if(ke>we)return;ke>ge&&(ge=ke)}if(ke=p-U,Ne||!(ke<0)){if(ke/=Ne,Ne<0){if(ke>we)return;ke>ge&&(ge=ke)}else if(Ne>0){if(ke0)){if(ke/=Xe,Xe<0){if(ke0){if(ke>we)return;ke>ge&&(ge=ke)}if(ke=x-G,Xe||!(ke<0)){if(ke/=Xe,Xe<0){if(ke>we)return;ke>ge&&(ge=ke)}else if(Xe>0){if(ke0&&(S.a={x:U+ge*Ne,y:G+ge*Xe}),we<1&&(S.b={x:U+we*Ne,y:G+we*Xe}),S}}}}}}var Ao=1e9;function Yo(e,i,p,x){return function(U){var ge,we,Ne,ze,Ve,Tt,yt,wt,vt,Zt,rn,G=U,re=Yr(),ce=ko(e,i,p,x),Xe={point:$e,lineStart:function Ln(){Xe.point=An,we&&we.push(Ne=[]),Zt=!0,vt=!1,yt=wt=NaN},lineEnd:function bn(){ge&&(An(ze,Ve),Tt&&vt&&re.rejoin(),ge.push(re.buffer())),Xe.point=$e,vt&&U.lineEnd()},polygonStart:function(){U=re,ge=[],we=[],rn=!0},polygonEnd:function(){U=G,ge=Q.merge(ge);var Lt=function ke(Lt){for(var en=0,dn=we.length,zt=Lt[1],hn=0;hnzt&&Bt(Nr,qr,Lt)>0&&++en:qr[1]<=zt&&Bt(Nr,qr,Lt)<0&&--en,Nr=qr;return 0!==en}([e,x]),en=rn&&Lt,dn=ge.length;(en||dn)&&(U.polygonStart(),en&&(U.lineStart(),Be(null,null,1,U),U.lineEnd()),dn&&sr(ge,R,Lt,Be,U),U.polygonEnd()),ge=we=Ne=null}};function Be(Lt,en,dn,zt){var hn=0,Wn=0;if(null==Lt||(hn=S(Lt,dn))!==(Wn=S(en,dn))||K(Lt,en)<0^dn>0)do{zt.point(0===hn||3===hn?e:p,hn>1?x:i)}while((hn=(hn+dn+4)%4)!==Wn);else zt.point(en[0],en[1])}function Oe(Lt,en){return e<=Lt&&Lt<=p&&i<=en&&en<=x}function $e(Lt,en){Oe(Lt,en)&&U.point(Lt,en)}function An(Lt,en){var dn=Oe(Lt=Math.max(-Ao,Math.min(Ao,Lt)),en=Math.max(-Ao,Math.min(Ao,en)));if(we&&Ne.push([Lt,en]),Zt)ze=Lt,Ve=en,Tt=dn,Zt=!1,dn&&(U.lineStart(),U.point(Lt,en));else if(dn&&vt)U.point(Lt,en);else{var zt={a:{x:yt,y:wt},b:{x:Lt,y:en}};ce(zt)?(vt||(U.lineStart(),U.point(zt.a.x,zt.a.y)),U.point(zt.b.x,zt.b.y),dn||U.lineEnd(),rn=!1):dn&&(U.lineStart(),U.point(Lt,en),rn=!1)}yt=Lt,wt=en,vt=dn}return Xe};function S(U,G){return n(U[0]-e)0?0:3:n(U[0]-p)0?2:1:n(U[1]-i)0?1:0:G>0?3:2}function R(U,G){return K(U.x,G.x)}function K(U,G){var re=S(U,1),ce=S(G,1);return re!==ce?re-ce:0===re?G[1]-U[1]:1===re?U[0]-G[0]:2===re?U[1]-G[1]:G[0]-U[0]}}function Do(e){var i=0,p=de/3,x=mr(e),S=x(i,p);return S.parallels=function(R){return arguments.length?x(i=R[0]*de/180,p=R[1]*de/180):[i/de*180,p/de*180]},S}function bo(e,i){var p=Math.sin(e),x=(p+Math.sin(i))/2,S=1+p*(2*x-p),R=Math.sqrt(S)/x;function K(U,G){var re=Math.sqrt(S-2*x*Math.sin(G))/x;return[re*Math.sin(U*=x),R-re*Math.cos(U)]}return K.invert=function(U,G){var re=R-G;return[Math.atan2(U,re)/x,Ot((S-(U*U+re*re)*x*x)/(2*x))]},K}Q.geo.clipExtent=function(){var e,i,p,x,S,R,K={stream:function(U){return S&&(S.valid=!1),(S=R(U)).valid=!0,S},extent:function(U){return arguments.length?(R=Yo(e=+U[0][0],i=+U[0][1],p=+U[1][0],x=+U[1][1]),S&&(S.valid=!1,S=null),K):[[e,i],[p,x]]}};return K.extent([[0,0],[960,500]])},(Q.geo.conicEqualArea=function(){return Do(bo)}).raw=bo,Q.geo.albers=function(){return Q.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},Q.geo.albersUsa=function(){var x,R,K,U,e=Q.geo.albers(),i=Q.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),p=Q.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),S={point:function(re,ce){x=[re,ce]}};function G(re){var ce=re[0],ge=re[1];return x=null,R(ce,ge),x||(K(ce,ge),x)||U(ce,ge),x}return G.invert=function(re){var ce=e.scale(),ge=e.translate(),we=(re[0]-ge[0])/ce,Ne=(re[1]-ge[1])/ce;return(Ne>=.12&&Ne<.234&&we>=-.425&&we<-.214?i:Ne>=.166&&Ne<.234&&we>=-.214&&we<-.115?p:e).invert(re)},G.stream=function(re){var ce=e.stream(re),ge=i.stream(re),we=p.stream(re);return{point:function(Ne,Xe){ce.point(Ne,Xe),ge.point(Ne,Xe),we.point(Ne,Xe)},sphere:function(){ce.sphere(),ge.sphere(),we.sphere()},lineStart:function(){ce.lineStart(),ge.lineStart(),we.lineStart()},lineEnd:function(){ce.lineEnd(),ge.lineEnd(),we.lineEnd()},polygonStart:function(){ce.polygonStart(),ge.polygonStart(),we.polygonStart()},polygonEnd:function(){ce.polygonEnd(),ge.polygonEnd(),we.polygonEnd()}}},G.precision=function(re){return arguments.length?(e.precision(re),i.precision(re),p.precision(re),G):e.precision()},G.scale=function(re){return arguments.length?(e.scale(re),i.scale(.35*re),p.scale(re),G.translate(e.translate())):e.scale()},G.translate=function(re){if(!arguments.length)return e.translate();var ce=e.scale(),ge=+re[0],we=+re[1];return R=e.translate(re).clipExtent([[ge-.455*ce,we-.238*ce],[ge+.455*ce,we+.238*ce]]).stream(S).point,K=i.translate([ge-.307*ce,we+.201*ce]).clipExtent([[ge-.425*ce+Rt,we+.12*ce+Rt],[ge-.214*ce-Rt,we+.234*ce-Rt]]).stream(S).point,U=p.translate([ge-.205*ce,we+.212*ce]).clipExtent([[ge-.214*ce+Rt,we+.166*ce+Rt],[ge-.115*ce-Rt,we+.234*ce-Rt]]).stream(S).point,G},G.scale(1070)};var zo,Uo,Wi={point:$,lineStart:$,lineEnd:$,polygonStart:function(){Uo=0,Wi.lineStart=jo},polygonEnd:function(){Wi.lineStart=Wi.lineEnd=Wi.point=$,zo+=n(Uo/2)}};function jo(){var e,i,p,x;function S(R,K){Uo+=x*R-p*K,p=R,x=K}Wi.point=function(R,K){Wi.point=S,e=p=R,i=x=K},Wi.lineEnd=function(){S(e,i)}}var Fo,Co,co,xe,j={point:function ae(e,i){eco&&(co=e),ixe&&(xe=i)},lineStart:$,lineEnd:$,polygonStart:$,polygonEnd:$};function De(){var e=rt(4.5),i=[],p={point:x,lineStart:function(){p.point=S},lineEnd:K,polygonStart:function(){p.lineEnd=U},polygonEnd:function(){p.lineEnd=K,p.point=x},pointRadius:function(G){return e=rt(G),p},result:function(){if(i.length){var G=i.join("");return i=[],G}}};function x(G,re){i.push("M",G,",",re,e)}function S(G,re){i.push("M",G,",",re),p.point=R}function R(G,re){i.push("L",G,",",re)}function K(){p.point=x}function U(){i.push("Z")}return p}function rt(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}var gt={point:Dt,lineStart:_n,lineEnd:Bn,polygonStart:function(){gt.lineStart=Vn},polygonEnd:function(){gt.point=Dt,gt.lineStart=_n,gt.lineEnd=Bn}};function Dt(e,i){Ai+=e,Ii+=i,++_i}function _n(){var e,i;function p(x,S){var R=x-e,K=S-i,U=Math.sqrt(R*R+K*K);Pi+=U*(e+x)/2,Gi+=U*(i+S)/2,ji+=U,Dt(e=x,i=S)}gt.point=function(x,S){gt.point=p,Dt(e=x,i=S)}}function Bn(){gt.point=Dt}function Vn(){var e,i,p,x;function S(R,K){var U=R-p,G=K-x,re=Math.sqrt(U*U+G*G);Pi+=re*(p+R)/2,Gi+=re*(x+K)/2,ji+=re,Te+=(re=x*R-p*K)*(p+R),Ye+=re*(x+K),it+=3*re,Dt(p=R,x=K)}gt.point=function(R,K){gt.point=S,Dt(e=p=R,i=x=K)},gt.lineEnd=function(){S(e,i)}}function Xn(e){var i=4.5,p={point:x,lineStart:function(){p.point=S},lineEnd:K,polygonStart:function(){p.lineEnd=U},polygonEnd:function(){p.lineEnd=K,p.point=x},pointRadius:function(G){return i=G,p},result:$};function x(G,re){e.moveTo(G+i,re),e.arc(G,re,i,0,Le)}function S(G,re){e.moveTo(G,re),p.point=R}function R(G,re){e.lineTo(G,re)}function K(){p.point=x}function U(){e.closePath()}return p}function On(e){var i=.5,p=Math.cos(30*Ze),x=16;function S(G){return(x?K:R)(G)}function R(G){return ur(G,function(re,ce){re=e(re,ce),G.point(re[0],re[1])})}function K(G){var re,ge,we,Ne,Xe,ke,Be,Oe,$e,ze,Ve,Tt,yt={point:wt,lineStart:vt,lineEnd:rn,polygonStart:function(){G.polygonStart(),yt.lineStart=Ln},polygonEnd:function(){G.polygonEnd(),yt.lineStart=vt}};function wt(Lt,en){Lt=e(Lt,en),G.point(Lt[0],Lt[1])}function vt(){Oe=NaN,yt.point=Zt,G.lineStart()}function Zt(Lt,en){var dn=pi([Lt,en]),zt=e(Lt,en);U(Oe,$e,Be,ze,Ve,Tt,Oe=zt[0],$e=zt[1],Be=Lt,ze=dn[0],Ve=dn[1],Tt=dn[2],x,G),G.point(Oe,$e)}function rn(){yt.point=wt,G.lineEnd()}function Ln(){vt(),yt.point=bn,yt.lineEnd=An}function bn(Lt,en){Zt(re=Lt,en),ge=Oe,we=$e,Ne=ze,Xe=Ve,ke=Tt,yt.point=Zt}function An(){U(Oe,$e,Be,ze,Ve,Tt,ge,we,re,Ne,Xe,ke,x,G),yt.lineEnd=rn,rn()}return yt}function U(G,re,ce,ge,we,Ne,Xe,ke,Be,Oe,$e,ze,Ve,Tt){var yt=Xe-G,wt=ke-re,vt=yt*yt+wt*wt;if(vt>4*i&&Ve--){var Zt=ge+Oe,rn=we+$e,Ln=Ne+ze,bn=Math.sqrt(Zt*Zt+rn*rn+Ln*Ln),An=Math.asin(Ln/=bn),Lt=n(n(Ln)-1)i||n((yt*hn+wt*Wn)/vt-.5)>.3||ge*Oe+we*$e+Ne*ze0&&16,S):Math.sqrt(i)},S}function hr(e){this.stream=e}function ur(e,i){return{point:i,sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}function ar(e){return mr(function(){return e})()}function mr(e){var i,p,x,Ne,Xe,ze,S=On(function(vt,Zt){return[(vt=i(vt,Zt))[0]*R+Ne,Xe-vt[1]*R]}),R=150,K=480,U=250,G=0,re=0,ce=0,ge=0,we=0,ke=no,Be=z,Oe=null,$e=null;function Ve(vt){return[(vt=x(vt[0]*Ze,vt[1]*Ze))[0]*R+Ne,Xe-vt[1]*R]}function Tt(vt){return(vt=x.invert((vt[0]-Ne)/R,(Xe-vt[1])/R))&&[vt[0]*Ct,vt[1]*Ct]}function yt(){x=jn(p=Ir(ce,ge,we),i);var vt=i(G,re);return Ne=K-vt[0]*R,Xe=U+vt[1]*R,wt()}function wt(){return ze&&(ze.valid=!1,ze=null),Ve}return Ve.stream=function(vt){return ze&&(ze.valid=!1),(ze=Hr(ke(p,S(Be(vt))))).valid=!0,ze},Ve.clipAngle=function(vt){return arguments.length?(ke=null==vt?(Oe=vt,no):function io(e){var i=Math.cos(e),p=i>0,x=n(i)>Rt;return ti(R,function K(re){var ce,ge,we,Ne,Xe;return{lineStart:function(){Ne=we=!1,Xe=1},point:function(ke,Be){var $e,Oe=[ke,Be],ze=R(ke,Be),Ve=p?ze?0:G(ke,Be):ze?G(ke+(ke<0?de:-de),Be):0;if(!ce&&(Ne=we=ze)&&re.lineStart(),ze!==we&&($e=U(ce,Oe),(Vi(ce,$e)||Vi(Oe,$e))&&(Oe[0]+=Rt,Oe[1]+=Rt,ze=R(Oe[0],Oe[1]))),ze!==we)Xe=0,ze?(re.lineStart(),$e=U(Oe,ce),re.point($e[0],$e[1])):($e=U(ce,Oe),re.point($e[0],$e[1]),re.lineEnd()),ce=$e;else if(x&&ce&&p^ze){var Tt;!(Ve&ge)&&(Tt=U(Oe,ce,!0))&&(Xe=0,p?(re.lineStart(),re.point(Tt[0][0],Tt[0][1]),re.point(Tt[1][0],Tt[1][1]),re.lineEnd()):(re.point(Tt[1][0],Tt[1][1]),re.lineEnd(),re.lineStart(),re.point(Tt[0][0],Tt[0][1])))}ze&&(!ce||!Vi(ce,Oe))&&re.point(Oe[0],Oe[1]),ce=Oe,we=ze,ge=Ve},lineEnd:function(){we&&re.lineEnd(),ce=null},clean:function(){return Xe|(Ne&&we)<<1}}},Pr(e,6*Ze),p?[0,-e]:[-de,e-de]);function R(re,ce){return Math.cos(re)*Math.cos(ce)>i}function U(re,ce,ge){var Xe=[1,0,0],ke=ei(pi(re),pi(ce)),Be=gi(ke,ke),Oe=ke[0],$e=Be-Oe*Oe;if(!$e)return!ge&&re;var ze=i*Be/$e,Ve=-i*Oe/$e,Tt=ei(Xe,ke),yt=Xi(Xe,ze);$i(yt,Xi(ke,Ve));var vt=Tt,Zt=gi(yt,vt),rn=gi(vt,vt),Ln=Zt*Zt-rn*(gi(yt,yt)-1);if(!(Ln<0)){var bn=Math.sqrt(Ln),An=Xi(vt,(-Zt-bn)/rn);if($i(An,yt),An=mi(An),!ge)return An;var hn,Lt=re[0],en=ce[0],dn=re[1],zt=ce[1];en0^An[1]<(n(An[0]-Lt)de^(Lt<=An[0]&&An[0]<=en)){var Nr=Xi(vt,(-Zt+bn)/rn);return $i(Nr,yt),[An,mi(Nr)]}}}function G(re,ce){var ge=p?e:de-e,we=0;return re<-ge?we|=1:re>ge&&(we|=2),ce<-ge?we|=4:ce>ge&&(we|=8),we}}((Oe=+vt)*Ze),wt()):Oe},Ve.clipExtent=function(vt){return arguments.length?($e=vt,Be=vt?Yo(vt[0][0],vt[0][1],vt[1][0],vt[1][1]):z,wt()):$e},Ve.scale=function(vt){return arguments.length?(R=+vt,yt()):R},Ve.translate=function(vt){return arguments.length?(K=+vt[0],U=+vt[1],yt()):[K,U]},Ve.center=function(vt){return arguments.length?(G=vt[0]%360*Ze,re=vt[1]%360*Ze,yt()):[G*Ct,re*Ct]},Ve.rotate=function(vt){return arguments.length?(ce=vt[0]%360*Ze,ge=vt[1]%360*Ze,we=vt.length>2?vt[2]%360*Ze:0,yt()):[ce*Ct,ge*Ct,we*Ct]},Q.rebind(Ve,S,"precision"),function(){return i=e.apply(this,arguments),Ve.invert=i.invert&&Tt,yt()}}function Hr(e){return ur(e,function(i,p){e.point(i*Ze,p*Ze)})}function Ar(e,i){return[e,i]}function wr(e,i){return[e>de?e-Le:e<-de?e+Le:e,i]}function Ir(e,i,p){return e?i||p?jn(Mr(e),Dr(i,p)):Mr(e):i||p?Dr(i,p):wr}function Rr(e){return function(i,p){return[(i+=e)>de?i-Le:i<-de?i+Le:i,p]}}function Mr(e){var i=Rr(e);return i.invert=Rr(-e),i}function Dr(e,i){var p=Math.cos(e),x=Math.sin(e),S=Math.cos(i),R=Math.sin(i);function K(U,G){var re=Math.cos(G),ce=Math.cos(U)*re,ge=Math.sin(U)*re,we=Math.sin(G),Ne=we*p+ce*x;return[Math.atan2(ge*S-Ne*R,ce*p-we*x),Ot(Ne*S+ge*R)]}return K.invert=function(U,G){var re=Math.cos(G),ce=Math.cos(U)*re,ge=Math.sin(U)*re,we=Math.sin(G),Ne=we*S-ge*R;return[Math.atan2(ge*S+we*R,ce*p+Ne*x),Ot(Ne*p-ce*x)]},K}function Pr(e,i){var p=Math.cos(e),x=Math.sin(e);return function(S,R,K,U){var G=K*i;null!=S?(S=$r(p,S),R=$r(p,R),(K>0?SR)&&(S+=K*Le)):(S=e+K*Le,R=e-.5*G);for(var re,ce=S;K>0?ce>R:ce2?e[2]*Ze:0),i.invert=function(p){return(p=e.invert(p[0]*Ze,p[1]*Ze))[0]*=Ct,p[1]*=Ct,p},i},wr.invert=Ar,Q.geo.circle=function(){var i,x,e=[0,0],p=6;function S(){var R="function"==typeof e?e.apply(this,arguments):e,K=Ir(-R[0]*Ze,-R[1]*Ze,0).invert,U=[];return x(null,null,1,{point:function(G,re){U.push(G=K(G,re)),G[0]*=Ct,G[1]*=Ct}}),{type:"Polygon",coordinates:[U]}}return S.origin=function(R){return arguments.length?(e=R,S):e},S.angle=function(R){return arguments.length?(x=Pr((i=+R)*Ze,p*Ze),S):i},S.precision=function(R){return arguments.length?(x=Pr(i*Ze,(p=+R)*Ze),S):p},S.angle(90)},Q.geo.distance=function(e,i){var ge,p=(i[0]-e[0])*Ze,x=e[1]*Ze,S=i[1]*Ze,R=Math.sin(p),K=Math.cos(p),U=Math.sin(x),G=Math.cos(x),re=Math.sin(S),ce=Math.cos(S);return Math.atan2(Math.sqrt((ge=ce*R)*ge+(ge=G*re-U*ce*K)*ge),U*re+G*ce*K)},Q.geo.graticule=function(){var e,i,p,x,S,R,K,U,we,Ne,Xe,ke,G=10,re=G,ce=90,ge=360,Be=2.5;function Oe(){return{type:"MultiLineString",coordinates:$e()}}function $e(){return Q.range(Math.ceil(x/ce)*ce,p,ce).map(Xe).concat(Q.range(Math.ceil(U/ge)*ge,K,ge).map(ke)).concat(Q.range(Math.ceil(i/G)*G,e,G).filter(function(ze){return n(ze%ce)>Rt}).map(we)).concat(Q.range(Math.ceil(R/re)*re,S,re).filter(function(ze){return n(ze%ge)>Rt}).map(Ne))}return Oe.lines=function(){return $e().map(function(ze){return{type:"LineString",coordinates:ze}})},Oe.outline=function(){return{type:"Polygon",coordinates:[Xe(x).concat(ke(K).slice(1),Xe(p).reverse().slice(1),ke(U).reverse().slice(1))]}},Oe.extent=function(ze){return arguments.length?Oe.majorExtent(ze).minorExtent(ze):Oe.minorExtent()},Oe.majorExtent=function(ze){return arguments.length?(U=+ze[0][1],K=+ze[1][1],(x=+ze[0][0])>(p=+ze[1][0])&&(ze=x,x=p,p=ze),U>K&&(ze=U,U=K,K=ze),Oe.precision(Be)):[[x,U],[p,K]]},Oe.minorExtent=function(ze){return arguments.length?(R=+ze[0][1],S=+ze[1][1],(i=+ze[0][0])>(e=+ze[1][0])&&(ze=i,i=e,e=ze),R>S&&(ze=R,R=S,S=ze),Oe.precision(Be)):[[i,R],[e,S]]},Oe.step=function(ze){return arguments.length?Oe.majorStep(ze).minorStep(ze):Oe.minorStep()},Oe.majorStep=function(ze){return arguments.length?(ce=+ze[0],ge=+ze[1],Oe):[ce,ge]},Oe.minorStep=function(ze){return arguments.length?(G=+ze[0],re=+ze[1],Oe):[G,re]},Oe.precision=function(ze){return arguments.length?(Be=+ze,we=bi(R,S,90),Ne=xi(i,e,Be),Xe=bi(U,K,90),ke=xi(x,p,Be),Oe):Be},Oe.majorExtent([[-180,-90+Rt],[180,90-Rt]]).minorExtent([[-180,-80-Rt],[180,80+Rt]])},Q.geo.greatArc=function(){var i,x,e=Ri,p=oi;function S(){return{type:"LineString",coordinates:[i||e.apply(this,arguments),x||p.apply(this,arguments)]}}return S.distance=function(){return Q.geo.distance(i||e.apply(this,arguments),x||p.apply(this,arguments))},S.source=function(R){return arguments.length?(e=R,i="function"==typeof R?null:R,S):e},S.target=function(R){return arguments.length?(p=R,x="function"==typeof R?null:R,S):p},S.precision=function(){return arguments.length?S:0},S},Q.geo.interpolate=function(e,i){return function go(e,i,p,x){var S=Math.cos(i),R=Math.sin(i),K=Math.cos(x),U=Math.sin(x),G=S*Math.cos(e),re=S*Math.sin(e),ce=K*Math.cos(p),ge=K*Math.sin(p),we=2*Math.asin(Math.sqrt(In(x-i)+S*K*In(p-e))),Ne=1/Math.sin(we),Xe=we?function(ke){var Be=Math.sin(ke*=we)*Ne,Oe=Math.sin(we-ke)*Ne,$e=Oe*G+Be*ce,ze=Oe*re+Be*ge,Ve=Oe*R+Be*U;return[Math.atan2(ze,$e)*Ct,Math.atan2(Ve,Math.sqrt($e*$e+ze*ze))*Ct]}:function(){return[e*Ct,i*Ct]};return Xe.distance=we,Xe}(e[0]*Ze,e[1]*Ze,i[0]*Ze,i[1]*Ze)},Q.geo.length=function(e){return Yi=0,Q.geo.stream(e,Mi),Yi};var Yi,Mi={sphere:$,point:$,lineStart:function Ei(){var e,i,p;function x(S,R){var K=Math.sin(R*=Ze),U=Math.cos(R),G=n((S*=Ze)-e),re=Math.cos(G);Yi+=Math.atan2(Math.sqrt((G=U*Math.sin(G))*G+(G=p*K-i*U*re)*G),i*K+p*U*re),e=S,i=K,p=U}Mi.point=function(S,R){e=S*Ze,i=Math.sin(R*=Ze),p=Math.cos(R),Mi.point=x},Mi.lineEnd=function(){Mi.point=Mi.lineEnd=$}},lineEnd:$,polygonStart:$,polygonEnd:$};function Xr(e,i){function p(x,S){var R=Math.cos(x),K=Math.cos(S),U=e(R*K);return[U*K*Math.sin(x),U*Math.sin(S)]}return p.invert=function(x,S){var R=Math.sqrt(x*x+S*S),K=i(R),U=Math.sin(K),G=Math.cos(K);return[Math.atan2(x*U,R*G),Math.asin(R&&S*U/R)]},p}var ho=Xr(function(e){return Math.sqrt(2/(1+e))},function(e){return 2*Math.asin(e/2)});(Q.geo.azimuthalEqualArea=function(){return ar(ho)}).raw=ho;var Ci=Xr(function(e){var i=Math.acos(e);return i&&i/Math.sin(i)},z);function Si(e,i){var p=Math.cos(e),x=function(U){return Math.tan(de/4+U/2)},S=e===i?Math.sin(e):Math.log(p/Math.cos(i))/Math.log(x(i)/x(e)),R=p*Math.pow(x(e),S)/S;if(!S)return uo;function K(U,G){R>0?G<-qe+Rt&&(G=-qe+Rt):G>qe-Rt&&(G=qe-Rt);var re=R/Math.pow(x(G),S);return[re*Math.sin(S*U),R-re*Math.cos(S*U)]}return K.invert=function(U,G){var re=R-G,ce=Nt(S)*Math.sqrt(U*U+re*re);return[Math.atan2(U,re)/S,2*Math.atan(Math.pow(R/ce,1/S))-qe]},K}function Oi(e,i){var p=Math.cos(e),x=e===i?Math.sin(e):(p-Math.cos(i))/(i-e),S=p/x+e;if(n(x)1&&Bt(e[p[x-2]],e[p[x-1]],e[S])<=0;)--x;p[x++]=S}return p.slice(0,x)}function cs(e,i){return e[0]-i[0]||e[1]-i[1]}(Q.geo.stereographic=function(){return ar(as)}).raw=as,Io.invert=function(e,i){return[-i,2*Math.atan(Math.exp(e))-qe]},(Q.geo.transverseMercator=function(){var e=mo(Io),i=e.center,p=e.rotate;return e.center=function(x){return x?i([-x[1],x[0]]):[(x=i())[1],-x[0]]},e.rotate=function(x){return x?p([x[0],x[1],x.length>2?x[2]+90:90]):[(x=p())[0],x[1],x[2]-90]},p([0,0,90])}).raw=Io,Q.geom={},Q.geom.hull=function(e){var i=wo,p=xo;if(arguments.length)return x(e);function x(S){if(S.length<3)return[];var U,R=Jn(i),K=Jn(p),G=S.length,re=[],ce=[];for(U=0;U=0;--U)ke.push(S[re[ge[U]][2]]);for(U=+Ne;URt)U=U.L;else{if(!((K=i-gc(U,p))>Rt)){R>-Rt?(x=U.P,S=U):K>-Rt?(x=U,S=U.N):x=S=U;break}if(!U.R){x=U;break}U=U.R}var G=oa(e);if(yo.insert(x,G),x||S){if(x===S)return Wo(x),S=oa(x.site),yo.insert(G,S),G.edge=S.edge=Qo(x.site,G.site),Ho(x),void Ho(S);if(!S)return void(G.edge=Qo(x.site,G.site));Wo(x),Wo(S);var re=x.site,ce=re.x,ge=re.y,we=e.x-ce,Ne=e.y-ge,Xe=S.site,ke=Xe.x-ce,Be=Xe.y-ge,Oe=2*(we*Be-Ne*ke),$e=we*we+Ne*Ne,ze=ke*ke+Be*Be,Ve={x:(Be*$e-Ne*ze)/Oe+ce,y:(we*ze-ke*$e)/Oe+ge};hs(S.edge,re,Xe,Ve),G.edge=Qo(re,e,null,Ve),S.edge=Qo(e,Xe,null,Ve),Ho(x),Ho(S)}}function sa(e,i){var p=e.site,x=p.x,S=p.y,R=S-i;if(!R)return x;var K=e.P;if(!K)return-1/0;var U=(p=K.site).x,G=p.y,re=G-i;if(!re)return U;var ce=U-x,ge=1/R-1/re,we=ce/re;return ge?(-we+Math.sqrt(we*we-2*ge*(ce*ce/(-2*re)-G+re/2+S-R/2)))/ge+x:(x+U)/2}function gc(e,i){var p=e.N;if(p)return sa(p,i);var x=e.site;return x.y===i?x.x:1/0}function aa(e){this.site=e,this.edges=[]}function ca(e,i){return i.angle-e.angle}function vc(){ls(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ho(e){var i=e.P,p=e.N;if(i&&p){var x=i.site,S=e.site,R=p.site;if(x!==R){var K=S.x,U=S.y,G=x.x-K,re=x.y-U,ce=R.x-K,ge=2*(G*(Be=R.y-U)-re*ce);if(!(ge>=-vr)){var we=G*G+re*re,Ne=ce*ce+Be*Be,Xe=(Be*we-re*Ne)/ge,ke=(G*Ne-ce*we)/ge,Be=ke+U,Oe=ia.pop()||new vc;Oe.arc=e,Oe.site=S,Oe.x=Xe+K,Oe.y=Be+Math.sqrt(Xe*Xe+ke*ke),Oe.cy=Be,e.circle=Oe;for(var $e=null,ze=Jo._;ze;)if(Oe.y=R)return;if(ce>we){if(x){if(x.y>=U)return}else x={x:Xe,y:K};p={x:Xe,y:U}}else{if(x){if(x.y1)if(ce>we){if(x){if(x.y>=U)return}else x={x:(K-Oe)/Be,y:K};p={x:(U-Oe)/Be,y:U}}else{if(x){if(x.y=R)return}else x={x:S,y:Be*S+Oe};p={x:R,y:Be*R+Oe}}else{if(x){if(x.xRt||n(G-K)>Rt)&&(Ne.splice(we,0,new us(bc(ge.site,Be,n(U-i)Rt?{x:i,y:n(R-i)Rt?{x:n(K-S)Rt?{x:p,y:n(R-p)Rt?{x:n(K-x)=ce&&Oe.x<=we&&Oe.y>=ge&&Oe.y<=Ne?[[ce,Ne],[we,Ne],[we,ge],[ce,ge]]:[]).point=G[ke]}),re}function U(G){return G.map(function(re,ce){return{x:Math.round(x(re,ce)/Rt)*Rt,y:Math.round(S(re,ce)/Rt)*Rt,i:ce}})}return K.links=function(G){return Ms(U(G)).edges.filter(function(re){return re.l&&re.r}).map(function(re){return{source:G[re.l.i],target:G[re.r.i]}})},K.triangles=function(G){var re=[];return Ms(U(G)).cells.forEach(function(ce,ge){for(var Oe,we=ce.site,Ne=ce.edges.sort(ca),Xe=-1,ke=Ne.length,$e=Ne[ke-1].edge,ze=$e.l===we?$e.r:$e.l;++Xep&&(R=i.slice(p,R),U[K]?U[K]+=R:U[++K]=R),(x=x[0])===(S=S[0])?U[K]?U[K]+=S:U[++K]=S:(U[++K]=null,G.push({i:K,x:_o(x,S)})),p=Ns.lastIndex;return pze&&(ze=ce.x),ce.y>Ve&&(Ve=ce.y),Ne.push(ce.x),Xe.push(ce.y);else for(ke=0;keze&&(ze=Tt),yt>Ve&&(Ve=yt),Ne.push(Tt),Xe.push(yt)}var wt=ze-Oe,vt=Ve-$e;function Zt(bn,An,Lt,en,dn,zt,hn,Wn){if(!isNaN(Lt)&&!isNaN(en))if(bn.leaf){var tr=bn.x,lr=bn.y;if(null!=tr)if(n(tr-Lt)+n(lr-en)<.01)rn(bn,An,Lt,en,dn,zt,hn,Wn);else{var Nr=bn.point;bn.x=bn.y=bn.point=null,rn(bn,Nr,tr,lr,dn,zt,hn,Wn),rn(bn,An,Lt,en,dn,zt,hn,Wn)}else bn.x=Lt,bn.y=en,bn.point=An}else rn(bn,An,Lt,en,dn,zt,hn,Wn)}function rn(bn,An,Lt,en,dn,zt,hn,Wn){var tr=.5*(dn+hn),lr=.5*(zt+Wn),Nr=Lt>=tr,qr=en>=lr,Li=qr<<1|Nr;bn.leaf=!1,Nr?dn=tr:hn=tr,qr?zt=lr:Wn=lr,Zt(bn=bn.nodes[Li]||(bn.nodes[Li]={leaf:!0,nodes:[],point:null,x:null,y:null}),An,Lt,en,dn,zt,hn,Wn)}wt>vt?Ve=$e+wt:ze=Oe+vt;var Ln={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(bn){Zt(Ln,bn,+ge(bn,++ke),+we(bn,ke),Oe,$e,ze,Ve)}};if(Ln.visit=function(bn){ns(bn,Ln,Oe,$e,ze,Ve)},Ln.find=function(bn){return function kc(e,i,p,x,S,R,K){var G,U=1/0;return function re(ce,ge,we,Ne,Xe){if(!(ge>R||we>K||Ne=yt)<<1|i>=Tt,rn=Zt+4;Zt=0&&!(x=Q.interpolators[p](e,i)););return x}function ds(e,i){var U,p=[],x=[],S=e.length,R=i.length,K=Math.min(e.length,i.length);for(U=0;U=1)return 1;var i=e*e,p=i*e;return 4*(e<.5?p:3*(e-i)+p-.75)}function Bc(e){return 1-Math.cos(e*qe)}function Nc(e){return Math.pow(2,10*(e-1))}function Pc(e){return 1-Math.sqrt(1-e*e)}function zc(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function va(e,i){return i-=e,function(p){return Math.round(e+i*p)}}function ya(e){var i=[e.a,e.b],p=[e.c,e.d],x=ba(i),S=_a(i,p),R=ba(function Hc(e,i,p){return e[0]+=p*i[0],e[1]+=p*i[1],e}(p,i,-S))||0;i[0]*p[1]=0?e.slice(0,i):e,x=i>=0?e.slice(i+1):"in";return p=Ac.get(p)||pa,function Tc(e){return function(i){return i<=0?0:i>=1?1:e(i)}}((x=Cc.get(x)||z)(p.apply(null,je.call(arguments,1))))},Q.interpolateHcl=function Uc(e,i){e=Q.hcl(e),i=Q.hcl(i);var p=e.h,x=e.c,S=e.l,R=i.h-p,K=i.c-x,U=i.l-S;return isNaN(K)&&(K=0,x=isNaN(x)?i.c:x),isNaN(R)?(R=0,p=isNaN(p)?i.h:p):R>180?R-=360:R<-180&&(R+=360),function(G){return ct(p+R*G,x+K*G,S+U*G)+""}},Q.interpolateHsl=function jc(e,i){e=Q.hsl(e),i=Q.hsl(i);var p=e.h,x=e.s,S=e.l,R=i.h-p,K=i.s-x,U=i.l-S;return isNaN(K)&&(K=0,x=isNaN(x)?i.s:x),isNaN(R)?(R=0,p=isNaN(p)?i.h:p):R>180?R-=360:R<-180&&(R+=360),function(G){return Kr(p+R*G,x+K*G,S+U*G)+""}},Q.interpolateLab=function Fc(e,i){e=Q.lab(e),i=Q.lab(i);var p=e.l,x=e.a,S=e.b,R=i.l-p,K=i.a-x,U=i.b-S;return function(G){return ri(p+R*G,x+K*G,S+U*G)+""}},Q.interpolateRound=va,Q.transform=function(e){var i=y.createElementNS(Q.ns.prefix.svg,"g");return(Q.transform=function(p){if(null!=p){i.setAttribute("transform",p);var x=i.transform.baseVal.consolidate()}return new ya(x?x.matrix:Wc)})(e)},ya.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var Wc={a:1,b:0,c:0,d:1,e:0,f:0};function qo(e){return e.length?e.pop()+",":""}function wa(e,i){var p=[],x=[];return e=Q.transform(e),i=Q.transform(i),function qc(e,i,p,x){if(e[0]!==i[0]||e[1]!==i[1]){var S=p.push("translate(",null,",",null,")");x.push({i:S-4,x:_o(e[0],i[0])},{i:S-2,x:_o(e[1],i[1])})}else(i[0]||i[1])&&p.push("translate("+i+")")}(e.translate,i.translate,p,x),function Kc(e,i,p,x){e!==i?(e-i>180?i+=360:i-e>180&&(e+=360),x.push({i:p.push(qo(p)+"rotate(",null,")")-2,x:_o(e,i)})):i&&p.push(qo(p)+"rotate("+i+")")}(e.rotate,i.rotate,p,x),function Vc(e,i,p,x){e!==i?x.push({i:p.push(qo(p)+"skewX(",null,")")-2,x:_o(e,i)}):i&&p.push(qo(p)+"skewX("+i+")")}(e.skew,i.skew,p,x),function Gc(e,i,p,x){if(e[0]!==i[0]||e[1]!==i[1]){var S=p.push(qo(p)+"scale(",null,",",null,")");x.push({i:S-4,x:_o(e[0],i[0])},{i:S-2,x:_o(e[1],i[1])})}else(1!==i[0]||1!==i[1])&&p.push(qo(p)+"scale("+i+")")}(e.scale,i.scale,p,x),e=i=null,function(S){for(var U,R=-1,K=x.length;++R0?R=Ve:(p.c=null,p.t=NaN,p=null,i.end({type:"end",alpha:R=0})):Ve>0&&(i.start({type:"start",alpha:R=Ve}),p=P(e.tick)),e):R},e.start=function(){var Ve,Zt,rn,Tt=Ne.length,yt=Xe.length,wt=x[0],vt=x[1];for(Ve=0;Ve=0;)p.push(S[x])}function fo(e,i){for(var p=[e],x=[];null!=(e=p.pop());)if(x.push(e),(K=e.children)&&(R=K.length))for(var R,K,S=-1;++S=0;)R.push(ce=re[G]),ce.parent=U,ce.depth=U.depth+1;p&&(U.value=0),U.children=re}else p&&(U.value=+p.call(x,U,U.depth)||0),delete U.children;return fo(S,function(ge){var we,Ne;e&&(we=ge.children)&&we.sort(e),p&&(Ne=ge.parent)&&(Ne.value+=ge.value)}),K}return x.sort=function(S){return arguments.length?(e=S,x):e},x.children=function(S){return arguments.length?(i=S,x):i},x.value=function(S){return arguments.length?(p=S,x):p},x.revalue=function(S){return p&&(is(S,function(R){R.children&&(R.value=0)}),fo(S,function(R){var K;R.children||(R.value=+p.call(x,R,R.depth)||0),(K=R.parent)&&(K.value+=R.value)})),S},x},Q.layout.partition=function(){var e=Q.layout.hierarchy(),i=[1,1];function p(R,K,U,G){var re=R.children;if(R.x=K,R.y=R.depth*G,R.dx=U,R.dy=G,re&&(ge=re.length)){var ge,we,Ne,ce=-1;for(U=R.value?U/R.value:0;++ceS&&(S=U),x.push(U)}for(K=0;Kx&&(p=i,x=S);return p}function gh(e){return e.reduce(mh,0)}function mh(e,i){return e+i[1]}function vh(e,i){return ka(e,Math.ceil(Math.log(i.length)/Math.LN2+1))}function ka(e,i){for(var p=-1,x=+e[0],S=(e[1]-x)/i,R=[];++p<=i;)R[p]=S*p+x;return R}function yh(e){return[Q.min(e),Q.max(e)]}function _h(e,i){return e.value-i.value}function Ds(e,i){var p=e._pack_next;e._pack_next=i,i._pack_prev=e,i._pack_next=p,p._pack_prev=i}function Aa(e,i){e._pack_next=i,i._pack_prev=e}function Ca(e,i){var p=i.x-e.x,x=i.y-e.y,S=e.r+i.r;return.999*S*S>p*p+x*x}function Ta(e){if((i=e.children)&&(we=i.length)){var i,K,U,G,re,ce,ge,we,p=1/0,x=-1/0,S=1/0,R=-1/0;if(i.forEach(bh),(K=i[0]).x=-K.r,K.y=0,Ne(K),we>1&&((U=i[1]).x=U.r,U.y=0,Ne(U),we>2))for(Ra(K,U,G=i[2]),Ne(G),Ds(K,G),K._pack_prev=G,Ds(G,U),U=K._pack_next,re=3;re0)for(we=-1;++we=re[0]&&Be<=re[1]&&((ge=U[Q.bisect(ce,Be,1,Xe)-1]).y+=ke,ge.push(R[we]));return U}return S.value=function(R){return arguments.length?(i=R,S):i},S.range=function(R){return arguments.length?(p=Jn(R),S):p},S.bins=function(R){return arguments.length?(x="number"==typeof R?function(K){return ka(K,R)}:Jn(R),S):x},S.frequency=function(R){return arguments.length?(e=!!R,S):e},S},Q.layout.pack=function(){var x,e=Q.layout.hierarchy().sort(_h),i=0,p=[1,1];function S(R,K){var U=e.call(this,R,K),G=U[0],re=p[0],ce=p[1],ge=null==x?Math.sqrt:"function"==typeof x?x:function(){return x};if(G.x=G.y=0,fo(G,function(Ne){Ne.r=+ge(Ne.value)}),fo(G,Ta),i){var we=i*(x?1:Math.max(2*G.r/re,2*G.r/ce))/2;fo(G,function(Ne){Ne.r+=we}),fo(G,Ta),fo(G,function(Ne){Ne.r-=we})}return Ia(G,re/2,ce/2,x?1:1/Math.max(2*G.r/re,2*G.r/ce)),U}return S.size=function(R){return arguments.length?(p=R,S):p},S.radius=function(R){return arguments.length?(x=null==R||"function"==typeof R?R:+R,S):x},S.padding=function(R){return arguments.length?(i=+R,S):i},rs(S,e)},Q.layout.tree=function(){var e=Q.layout.hierarchy().sort(null).value(null),i=Ma,p=[1,1],x=null;function S(ce,ge){var we=e.call(this,ce,ge),Ne=we[0],Xe=function R(ce){for(var Ne,ge={A:null,children:[ce]},we=[ge];null!=(Ne=we.pop());)for(var ke,Xe=Ne.children,Be=0,Oe=Xe.length;BeBe.x&&(Be=Tt),Tt.depth>Oe.depth&&(Oe=Tt)});var $e=i(ke,Be)/2-ke.x,ze=p[0]/(Be.x+i(Be,ke)/2+$e),Ve=p[1]/(Oe.depth||1);is(Ne,function(Tt){Tt.x=(Tt.x+$e)*ze,Tt.y=Tt.depth*Ve})}return we}function K(ce){var ge=ce.children,we=ce.parent.children,Ne=ce.i?we[ce.i-1]:null;if(ge.length){!function Eh(e){for(var R,i=0,p=0,x=e.children,S=x.length;--S>=0;)(R=x[S]).z+=i,R.m+=i,i+=R.s+(p+=R.c)}(ce);var Xe=(ge[0].z+ge[ge.length-1].z)/2;Ne?(ce.z=Ne.z+i(ce._,Ne._),ce.m=ce.z-Xe):ce.z=Xe}else Ne&&(ce.z=Ne.z+i(ce._,Ne._));ce.parent.A=function G(ce,ge,we){if(ge){for(var Tt,Ne=ce,Xe=ce,ke=ge,Be=Ne.parent.children[0],Oe=Ne.m,$e=Xe.m,ze=ke.m,Ve=Be.m;ke=Us(ke),Ne=zs(Ne),ke&&Ne;)Be=zs(Be),(Xe=Us(Xe)).a=ce,(Tt=ke.z+ze-Ne.z-Oe+i(ke._,Ne._))>0&&(xh(Sh(ke,ce,we),ce,Tt),Oe+=Tt,$e+=Tt),ze+=ke.m,Oe+=Ne.m,Ve+=Be.m,$e+=Xe.m;ke&&!Us(Xe)&&(Xe.t=ke,Xe.m+=ze-$e),Ne&&!zs(Be)&&(Be.t=Ne,Be.m+=Oe-Ve,we=ce)}return we}(ce,Ne,ce.parent.A||we[0])}function U(ce){ce._.x=ce.z+ce.parent.m,ce.m+=ce.parent.m}function re(ce){ce.x*=p[0],ce.y=ce.depth*p[1]}return S.separation=function(ce){return arguments.length?(i=ce,S):i},S.size=function(ce){return arguments.length?(x=null==(p=ce)?re:null,S):x?null:p},S.nodeSize=function(ce){return arguments.length?(x=null==(p=ce)?null:re,S):x?p:null},rs(S,e)},Q.layout.cluster=function(){var e=Q.layout.hierarchy().sort(null).value(null),i=Ma,p=[1,1],x=!1;function S(R,K){var re,U=e.call(this,R,K),G=U[0],ce=0;fo(G,function(ke){var Be=ke.children;Be&&Be.length?(ke.x=function Ah(e){return e.reduce(function(i,p){return i+p.x},0)/e.length}(Be),ke.y=function kh(e){return 1+Q.max(e,function(i){return i.y})}(Be)):(ke.x=re?ce+=i(ke,re):0,ke.y=0,re=ke)});var ge=La(G),we=Ba(G),Ne=ge.x-i(ge,we)/2,Xe=we.x+i(we,ge)/2;return fo(G,x?function(ke){ke.x=(ke.x-G.x)*p[0],ke.y=(G.y-ke.y)*p[1]}:function(ke){ke.x=(ke.x-Ne)/(Xe-Ne)*p[0],ke.y=(1-(G.y?ke.y/G.y:1))*p[1]}),U}return S.separation=function(R){return arguments.length?(i=R,S):i},S.size=function(R){return arguments.length?(x=null==(p=R),S):x?null:p},S.nodeSize=function(R){return arguments.length?(x=null!=(p=R),S):x?p:null},rs(S,e)},Q.layout.treemap=function(){var K,e=Q.layout.hierarchy(),i=Math.round,p=[1,1],x=null,S=js,R=!1,U="squarify",G=.5*(1+Math.sqrt(5));function re(ke,Be){for(var ze,Ve,Oe=-1,$e=ke.length;++Oe<$e;)Ve=(ze=ke[Oe]).value*(Be<0?0:Be),ze.area=isNaN(Ve)||Ve<=0?0:Ve}function ce(ke){var Be=ke.children;if(Be&&Be.length){var Ve,yt,vt,Oe=S(ke),$e=[],ze=Be.slice(),Tt=1/0,wt="slice"===U?Oe.dx:"dice"===U?Oe.dy:"slice-dice"===U?1&ke.depth?Oe.dy:Oe.dx:Math.min(Oe.dx,Oe.dy);for(re(ze,Oe.dx*Oe.dy/ke.value),$e.area=0;(vt=ze.length)>0;)$e.push(Ve=ze[vt-1]),$e.area+=Ve.area,"squarify"!==U||(yt=we($e,wt))<=Tt?(ze.pop(),Tt=yt):($e.area-=$e.pop().area,Ne($e,wt,Oe,!1),wt=Math.min(Oe.dx,Oe.dy),$e.length=$e.area=0,Tt=1/0);$e.length&&(Ne($e,wt,Oe,!0),$e.length=$e.area=0),Be.forEach(ce)}}function ge(ke){var Be=ke.children;if(Be&&Be.length){var ze,Oe=S(ke),$e=Be.slice(),Ve=[];for(re($e,Oe.dx*Oe.dy/ke.value),Ve.area=0;ze=$e.pop();)Ve.push(ze),Ve.area+=ze.area,null!=ze.z&&(Ne(Ve,ze.z?Oe.dx:Oe.dy,Oe,!$e.length),Ve.length=Ve.area=0);Be.forEach(ge)}}function we(ke,Be){for(var $e,Oe=ke.area,ze=0,Ve=1/0,Tt=-1,yt=ke.length;++Ttze&&(ze=$e));return Be*=Be,(Oe*=Oe)?Math.max(Be*ze*G/Oe,Oe/(Be*Ve*G)):1/0}function Ne(ke,Be,Oe,$e){var vt,ze=-1,Ve=ke.length,Tt=Oe.x,yt=Oe.y,wt=Be?i(ke.area/Be):0;if(Be==Oe.dx){for(($e||wt>Oe.dy)&&(wt=Oe.dy);++zeOe.dx)&&(wt=Oe.dx);++ze1);return e+i*x*Math.sqrt(-2*Math.log(R)/R)}},logNormal:function(){var e=Q.random.normal.apply(Q,arguments);return function(){return Math.exp(e())}},bates:function(e){var i=Q.random.irwinHall(e);return function(){return i()/e}},irwinHall:function(e){return function(){for(var i=0,p=0;p2?Ih:Ch,re=x?$c:Yc;return S=G(e,i,re,p),R=G(i,e,re,Lo),U}function U(G){return S(G)}return U.invert=function(G){return R(G)},U.domain=function(G){return arguments.length?(e=G.map(Number),K()):e},U.range=function(G){return arguments.length?(i=G,K()):i},U.rangeRound=function(G){return U.range(G).interpolate(va)},U.clamp=function(G){return arguments.length?(x=G,K()):x},U.interpolate=function(G){return arguments.length?(p=G,K()):p},U.ticks=function(G){return Hs(e,G)},U.tickFormat=function(G,re){return Ws(e,G,re)},U.nice=function(G){return Da(e,G),K()},U.copy=function(){return Oa(e,i,p,x)},K()}function Fs(e,i){return Q.rebind(e,i,"range","rangeRound","interpolate","clamp")}function Da(e,i){return gs(e,Pa(Vo(e,i)[2])),gs(e,Pa(Vo(e,i)[2])),e}function Vo(e,i){null==i&&(i=10);var p=Ko(e),x=p[1]-p[0],S=Math.pow(10,Math.floor(Math.log(x/i)/Math.LN10)),R=i/x*S;return R<=.15?S*=10:R<=.35?S*=5:R<=.75&&(S*=2),p[0]=Math.ceil(p[0]/S)*S,p[1]=Math.floor(p[1]/S)*S+.5*S,p[2]=S,p}function Hs(e,i){return Q.range.apply(Q,Vo(e,i))}function Ws(e,i,p){var x=Vo(e,i);if(p){var S=Ge.exec(p);if(S.shift(),"s"===S[8]){var R=Q.formatPrefix(Math.max(n(x[0]),n(x[1])));return S[7]||(S[7]="."+ms(R.scale(x[2]))),S[8]="f",p=Q.format(S.join("")),function(K){return p(R.scale(K))+R.symbol}}S[7]||(S[7]="."+function Mh(e,i){var p=ms(i[2]);return e in Rh?Math.abs(p-ms(Math.max(n(i[0]),n(i[1]))))+ +("e"!==e):p-2*("%"===e)}(S[8],x)),p=S.join("")}else p=",."+ms(x[2])+"f";return Q.format(p)}Q.scale.linear=function(){return Oa([0,1],[0,1],Lo,!1)};var Rh={s:1,g:1,p:1,r:1,e:1};function ms(e){return-Math.floor(Math.log(e)/Math.LN10+.01)}function za(e,i,p,x){function S(U){return(p?Math.log(U<0?0:U):-Math.log(U>0?0:-U))/Math.log(i)}function R(U){return p?Math.pow(i,U):-Math.pow(i,-U)}function K(U){return e(S(U))}return K.invert=function(U){return R(e.invert(U))},K.domain=function(U){return arguments.length?(p=U[0]>=0,e.domain((x=U.map(Number)).map(S)),K):x},K.base=function(U){return arguments.length?(i=+U,e.domain(x.map(S)),K):i},K.nice=function(){var U=gs(x.map(S),p?Math:Lh);return e.domain(U),x=U.map(R),K},K.ticks=function(){var U=Ko(x),G=[],re=U[0],ce=U[1],ge=Math.floor(S(re)),we=Math.ceil(S(ce)),Ne=i%1?2:i;if(isFinite(we-ge)){if(p){for(;ge0;Xe--)G.push(R(ge)*Xe);for(ge=0;G[ge]ce;we--);G=G.slice(ge,we)}return G},K.tickFormat=function(U,G){if(!arguments.length)return Ua;arguments.length<2?G=Ua:"function"!=typeof G&&(G=Q.format(G));var re=Math.max(1,i*U/K.ticks().length);return function(ce){var ge=ce/R(Math.round(S(ce)));return ge*i0?p[R-1]:e[0],Rwe?0:1;if(ce=et)return G(ce,Xe)+(re?G(re,1-Xe):"")+"Z";var ke,Be,Oe,$e,Tt,yt,wt,vt,Zt,rn,Ln,bn,ze=0,Ve=0,An=[];if(($e=(+K.apply(this,arguments)||0)/2)&&(Oe=x===ys?Math.sqrt(re*re+ce*ce):+x.apply(this,arguments),Xe||(Ve*=-1),ce&&(Ve=Ot(Oe/ce*Math.sin($e))),re&&(ze=Ot(Oe/re*Math.sin($e)))),ce){Tt=ce*Math.cos(ge+Ve),yt=ce*Math.sin(ge+Ve),wt=ce*Math.cos(we-Ve),vt=ce*Math.sin(we-Ve);var Lt=Math.abs(we-ge-2*Ve)<=de?0:1;if(Ve&&_s(Tt,yt,wt,vt)===Xe^Lt){var en=(ge+we)/2;Tt=ce*Math.cos(en),yt=ce*Math.sin(en),wt=vt=null}}else Tt=yt=0;if(re){Zt=re*Math.cos(we-ze),rn=re*Math.sin(we-ze),Ln=re*Math.cos(ge+ze),bn=re*Math.sin(ge+ze);var dn=Math.abs(ge-we+2*ze)<=de?0:1;if(ze&&_s(Zt,rn,Ln,bn)===1-Xe^dn){var zt=(ge+we)/2;Zt=re*Math.cos(zt),rn=re*Math.sin(zt),Ln=bn=null}}else Zt=rn=0;if(Ne>Rt&&(ke=Math.min(Math.abs(ce-re)/2,+p.apply(this,arguments)))>.001){Be=re0?0:1}function bs(e,i,p,x,S){var R=e[0]-i[0],K=e[1]-i[1],U=(S?x:-x)/Math.sqrt(R*R+K*K),G=U*K,re=-U*R,ce=e[0]+G,ge=e[1]+re,we=i[0]+G,Ne=i[1]+re,Xe=(ce+we)/2,ke=(ge+Ne)/2,Be=we-ce,Oe=Ne-ge,$e=Be*Be+Oe*Oe,ze=p-x,Ve=ce*Ne-we*ge,Tt=(Oe<0?-1:1)*Math.sqrt(Math.max(0,ze*ze*$e-Ve*Ve)),yt=(Ve*Oe-Be*Tt)/$e,wt=(-Ve*Be-Oe*Tt)/$e,vt=(Ve*Oe+Be*Tt)/$e,Zt=(-Ve*Be+Oe*Tt)/$e,rn=yt-Xe,Ln=wt-ke,bn=vt-Xe,An=Zt-ke;return rn*rn+Ln*Ln>bn*bn+An*An&&(yt=vt,wt=Zt),[[yt-G,wt-re],[yt*p/ze,wt*p/ze]]}function Ya(e){var i=wo,p=xo,x=Fn,S=oo,R=S.key,K=.7;function U(G){var Ne,re=[],ce=[],ge=-1,we=G.length,Xe=Jn(i),ke=Jn(p);function Be(){re.push("M",S(e(ce),K))}for(;++ge1&&S.push("H",x[0]),S.join("")},"step-before":Ks,"step-after":Vs,basis:Xa,"basis-open":function Kh(e){if(e.length<4)return oo(e);for(var S,i=[],p=-1,x=e.length,R=[0],K=[0];++p<3;)R.push((S=e[p])[0]),K.push(S[1]);for(i.push(Ji(Eo,R)+","+Ji(Eo,K)),--p;++p9&&(R=3*p/Math.sqrt(R),K[U]=R*x,K[U+1]=R*S);for(U=-1;++U<=G;)R=(e[Math.min(G,U+1)][0]-e[Math.max(0,U-1)][0])/(6*(1+K[U]*K[U])),i.push([R||0,K[U]*R||0]);return i}(e))}});function oo(e){return e.length>1?e.join("L"):e+"Z"}function $a(e){return e.join("L")+"Z"}function Ks(e){for(var i=0,p=e.length,x=e[0],S=[x[0],",",x[1]];++i1){R=e[G],G++,x+="C"+(S[0]+K[0])+","+(S[1]+K[1])+","+(R[0]-(U=i[1])[0])+","+(R[1]-U[1])+","+R[0]+","+R[1];for(var re=2;rede)+",1 "+ge}function re(ce,ge,we,Ne){return"Q 0,0 "+Ne}return R.radius=function(ce){return arguments.length?(p=Jn(ce),R):p},R.source=function(ce){return arguments.length?(e=Jn(ce),R):e},R.target=function(ce){return arguments.length?(i=Jn(ce),R):i},R.startAngle=function(ce){return arguments.length?(x=Jn(ce),R):x},R.endAngle=function(ce){return arguments.length?(S=Jn(ce),R):S},R},Q.svg.diagonal=function(){var e=Ri,i=oi,p=tc;function x(S,R){var K=e.call(this,S,R),U=i.call(this,S,R),G=(K.y+U.y)/2,re=[K,{x:K.x,y:G},{x:U.x,y:G},U];return"M"+(re=re.map(p))[0]+"C"+re[1]+" "+re[2]+" "+re[3]}return x.source=function(S){return arguments.length?(e=Jn(S),x):e},x.target=function(S){return arguments.length?(i=Jn(S),x):i},x.projection=function(S){return arguments.length?(p=S,x):p},x},Q.svg.diagonal.radial=function(){var e=Q.svg.diagonal(),i=tc,p=e.projection;return e.projection=function(x){return arguments.length?p(function Jh(e){return function(){var i=e.apply(this,arguments),p=i[0],x=i[1]-qe;return[p*Math.cos(x),p*Math.sin(x)]}}(i=x)):i},e},Q.svg.symbol=function(){var e=eu,i=Qh;function p(x,S){return(rc.get(e.call(this,x,S))||nc)(i.call(this,x,S))}return p.type=function(x){return arguments.length?(e=Jn(x),p):e},p.size=function(x){return arguments.length?(i=Jn(x),p):i},p};var rc=Q.map({circle:nc,cross:function(e){var i=Math.sqrt(e/5)/2;return"M"+-3*i+","+-i+"H"+-i+"V"+-3*i+"H"+i+"V"+-i+"H"+3*i+"V"+i+"H"+i+"V"+3*i+"H"+-i+"V"+i+"H"+-3*i+"Z"},diamond:function(e){var i=Math.sqrt(e/(2*ic)),p=i*ic;return"M0,"+-i+"L"+p+",0 0,"+i+" "+-p+",0Z"},square:function(e){var i=Math.sqrt(e)/2;return"M"+-i+","+-i+"L"+i+","+-i+" "+i+","+i+" "+-i+","+i+"Z"},"triangle-down":function(e){var i=Math.sqrt(e/xs),p=i*xs/2;return"M0,"+p+"L"+i+","+-p+" "+-i+","+-p+"Z"},"triangle-up":function(e){var i=Math.sqrt(e/xs),p=i*xs/2;return"M0,"+-p+"L"+i+","+p+" "+-i+","+p+"Z"}});Q.svg.symbolTypes=rc.keys();var xs=Math.sqrt(3),ic=Math.tan(30*Ze);L.transition=function(e){for(var S,R,i=Bo||++sc,p=Zs(e),x=[],K=Ss||{time:Date.now(),ease:Mc,delay:0,duration:250},U=-1,G=this.length;++U0;)ge[--$e].call(e,Oe);if(Be>=1)return K.event&&K.event.end.call(e,e.__data__,i),--R.count?delete R[x]:delete e[p],1}K||(G=P(function we(ke){var Be=K.delay;if(G.t=Be+U,Be<=ke)return Ne(ke-Be);G.c=Ne},0,U=S.time),K=R[x]={tween:new s,time:U,timer:G,delay:S.delay,duration:S.duration,ease:S.ease,index:i},S=null,++R.count)}vi.call=L.call,vi.empty=L.empty,vi.node=L.node,vi.size=L.size,Q.transition=function(e,i){return e&&e.transition?Bo?e.transition(i):e:Q.selection().transition(e)},Q.transition.prototype=vi,vi.select=function(e){var S,R,K,i=this.id,p=this.namespace,x=[];e=Y(e);for(var U=-1,G=this.length;++Urect,.s>rect").attr("width",x[1]-x[0])}function Ne(ke){ke.select(".extent").attr("y",S[0]),ke.selectAll(".extent,.e>rect,.w>rect").attr("height",S[1]-S[0])}function Xe(){var vt,rn,ke=this,Be=Q.select(Q.event.target),Oe=e.of(ke,arguments),$e=Q.select(ke),ze=Be.datum(),Ve=!/^(n|s)$/.test(ze)&&i,Tt=!/^(e|w)$/.test(ze)&&p,yt=Be.classed("extent"),wt=sn(ke),Zt=Q.mouse(ke),Ln=Q.select(te(ke)).on("keydown.brush",function Lt(){32==Q.event.keyCode&&(yt||(vt=null,Zt[0]-=x[1],Zt[1]-=S[1],yt=2),Ae())}).on("keyup.brush",function en(){32==Q.event.keyCode&&2==yt&&(Zt[0]+=x[1],Zt[1]+=S[1],yt=0,Ae())});if(Q.event.changedTouches?Ln.on("touchmove.brush",dn).on("touchend.brush",hn):Ln.on("mousemove.brush",dn).on("mouseup.brush",hn),$e.interrupt().selectAll("*").interrupt(),yt)Zt[0]=x[0]-Zt[0],Zt[1]=S[0]-Zt[1];else if(ze){var bn=+/w$/.test(ze),An=+/^n/.test(ze);rn=[x[1-bn]-Zt[0],S[1-An]-Zt[1]],Zt[0]=x[bn],Zt[1]=S[An]}else Q.event.altKey&&(vt=Zt.slice());function dn(){var Wn=Q.mouse(ke),tr=!1;rn&&(Wn[0]+=rn[0],Wn[1]+=rn[1]),yt||(Q.event.altKey?(vt||(vt=[(x[0]+x[1])/2,(S[0]+S[1])/2]),Zt[0]=x[+(Wn[0]1?{floor:function(ge){for(;ce(ge=R.floor(ge));)ge=No(ge-1);return ge},ceil:function(ge){for(;ce(ge=R.ceil(ge));)ge=No(+ge+1);return ge}}:R))},x.ticks=function(R,K){var U=Ko(x.domain()),G=null==R?S(U,10):"number"==typeof R?S(U,R):!R.range&&[{range:R},K];return G&&(R=G[0],K=G[1]),R.range(U[0],No(+U[1]+1),K<1?1:K)},x.tickFormat=function(){return p},x.copy=function(){return ta(e.copy(),i,p)},Fs(x,e)}function No(e){return new Date(e)}Qs.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?ea:hc,ea.parse=function(e){var i=new Date(e);return isNaN(i)?null:i},ea.toString=hc.toString,lt.second=It(function(e){return new mt(1e3*Math.floor(e/1e3))},function(e,i){e.setTime(e.getTime()+1e3*Math.floor(i))},function(e){return e.getSeconds()}),lt.seconds=lt.second.range,lt.seconds.utc=lt.second.utc.range,lt.minute=It(function(e){return new mt(6e4*Math.floor(e/6e4))},function(e,i){e.setTime(e.getTime()+6e4*Math.floor(i))},function(e){return e.getMinutes()}),lt.minutes=lt.minute.range,lt.minutes.utc=lt.minute.utc.range,lt.hour=It(function(e){var i=e.getTimezoneOffset()/60;return new mt(36e5*(Math.floor(e/36e5-i)+i))},function(e,i){e.setTime(e.getTime()+36e5*Math.floor(i))},function(e){return e.getHours()}),lt.hours=lt.hour.range,lt.hours.utc=lt.hour.utc.range,lt.month=It(function(e){return(e=lt.day(e)).setDate(1),e},function(e,i){e.setMonth(e.getMonth()+i)},function(e){return e.getMonth()}),lt.months=lt.month.range,lt.months.utc=lt.month.utc.range;var As=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],na=[[lt.second,1],[lt.second,5],[lt.second,15],[lt.second,30],[lt.minute,1],[lt.minute,5],[lt.minute,15],[lt.minute,30],[lt.hour,1],[lt.hour,3],[lt.hour,6],[lt.hour,12],[lt.day,1],[lt.day,2],[lt.week,1],[lt.month,1],[lt.month,3],[lt.year,1]],su=Qs.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%a %d",function(e){return e.getDay()&&1!=e.getDate()}],["%b %d",function(e){return 1!=e.getDate()}],["%B",function(e){return e.getMonth()}],["%Y",Fn]]),au={range:function(e,i,p){return Q.range(Math.ceil(e/p)*p,+i,p).map(No)},floor:z,ceil:z};na.year=lt.year,lt.scale=function(){return ta(Q.scale.linear(),na,su)};var uc=na.map(function(e){return[e[0].utc,e[1]]}),cu=cc.multi([[".%L",function(e){return e.getUTCMilliseconds()}],[":%S",function(e){return e.getUTCSeconds()}],["%I:%M",function(e){return e.getUTCMinutes()}],["%I %p",function(e){return e.getUTCHours()}],["%a %d",function(e){return e.getUTCDay()&&1!=e.getUTCDate()}],["%b %d",function(e){return 1!=e.getUTCDate()}],["%B",function(e){return e.getUTCMonth()}],["%Y",Fn]]);function hu(e){return JSON.parse(e.responseText)}function uu(e){var i=y.createRange();return i.selectNode(y.body),i.createContextualFragment(e.responseText)}uc.year=lt.year.utc,lt.scale.utc=function(){return ta(Q.scale.linear(),uc,cu)},Q.text=Er(function(e){return e.responseText}),Q.json=function(e,i){return Gr(e,"application/json",hu,i)},Q.html=function(e,i){return Gr(e,"text/html",uu,i)},Q.xml=Er(function(e){return e.responseXML}),"object"==typeof xt&&xt.exports?xt.exports=Q:this.d3=Q}()},{}],2:[function(At,xt,kt){(function(Q){kt.log=function y(...ne){return"object"==typeof console&&console.log&&console.log(...ne)},kt.formatArgs=function Pe(ne){if(ne[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+ne[0]+(this.useColors?"%c ":" ")+"+"+xt.exports.humanize(this.diff),!this.useColors)return;const le="color: "+this.color;ne.splice(1,0,le,"color: inherit");let d=0,N=0;ne[0].replace(/%[a-zA-Z%]/g,A=>{"%%"!==A&&(d++,"%c"===A&&(N=d))}),ne.splice(N,0,le)},kt.save=function he(ne){try{ne?kt.storage.setItem("debug",ne):kt.storage.removeItem("debug")}catch{}},kt.load=function te(){let ne;try{ne=kt.storage.getItem("debug")}catch{}return!ne&&typeof Q<"u"&&"env"in Q&&(ne=Q.env.DEBUG),ne},kt.useColors=function je(){return!(!(typeof window<"u"&&window.process)||"renderer"!==window.process.type&&!window.process.__nwjs)||!(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},kt.storage=function pe(){try{return localStorage}catch{}}(),kt.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],xt.exports=At("./common")(kt);const{formatters:_e}=xt.exports;_e.j=function(ne){try{return JSON.stringify(ne)}catch(le){return"[UnexpectedJSONParseError]: "+le.message}}}).call(this,At("_process"))},{"./common":3,_process:7}],3:[function(At,xt,kt){xt.exports=function Q(je){function Pe(N){let A=0;for(let f=0;f{if("%%"===s)return s;g++;const o=y.formatters[u];return"function"==typeof o&&(s=o.call(m,b[g]),b.splice(g,1),g--),s}),y.formatArgs.call(m,b),(m.log||y.log).apply(m,b)}return f.namespace=N,f.enabled=y.enabled(N),f.useColors=y.useColors(),f.color=Pe(N),f.destroy=he,f.extend=te,"function"==typeof y.init&&y.init(f),y.instances.push(f),f}function he(){const N=y.instances.indexOf(this);return-1!==N&&(y.instances.splice(N,1),!0)}function te(N,A){const f=y(this.namespace+(typeof A>"u"?":":A)+N);return f.log=this.log,f}function le(N){return N.toString().substring(2,N.toString().length-2).replace(/\.\*\?$/,"*")}return y.debug=y,y.default=y,y.coerce=function d(N){return N instanceof Error?N.stack||N.message:N},y.disable=function _e(){const N=[...y.names.map(le),...y.skips.map(le).map(A=>"-"+A)].join(",");return y.enable(""),N},y.enable=function pe(N){let A;y.save(N),y.names=[],y.skips=[];const f=("string"==typeof N?N:"").split(/[\s,]+/),b=f.length;for(A=0;A{y[N]=je[N]}),y.instances=[],y.names=[],y.skips=[],y.formatters={},y.selectColor=Pe,y.enable(y.load()),y}},{ms:6}],4:[function(At,xt,kt){var Q=Object.create||function u(r){var a=function(){};return a.prototype=r,new a},je=Object.keys||function o(r){var a=[];for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&a.push(c);return c},Pe=Function.prototype.bind||function t(r){var a=this;return function(){return a.apply(r,arguments)}};function y(){(!this._events||!Object.prototype.hasOwnProperty.call(this,"_events"))&&(this._events=Q(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}xt.exports=y,y.EventEmitter=y,y.prototype._events=void 0,y.prototype._maxListeners=void 0;var te,he=10;try{var pe={};Object.defineProperty&&Object.defineProperty(pe,"x",{value:0}),te=0===pe.x}catch{te=!1}function _e(r){return void 0===r._maxListeners?y.defaultMaxListeners:r._maxListeners}function f(r,a,c,l){var w,E,C;if("function"!=typeof c)throw new TypeError('"listener" argument must be a function');if((E=r._events)?(E.newListener&&(r.emit("newListener",a,c.listener?c.listener:c),E=r._events),C=E[a]):(E=r._events=Q(null),r._eventsCount=0),C){if("function"==typeof C?C=E[a]=l?[c,C]:[C,c]:l?C.unshift(c):C.push(c),!C.warned&&(w=_e(r))&&w>0&&C.length>w){C.warned=!0;var z=new Error("Possible EventEmitter memory leak detected. "+C.length+' "'+String(a)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');z.name="MaxListenersExceededWarning",z.emitter=r,z.type=a,z.count=C.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",z.name,z.message)}}else C=E[a]=c,++r._eventsCount;return r}function b(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var r=new Array(arguments.length),a=0;a1&&(c=arguments[1]),c instanceof Error)throw c;var I=new Error('Unhandled "error" event. ('+c+")");throw I.context=c,I}if(!(l=z[a]))return!1;var V="function"==typeof l;switch(w=arguments.length){case 1:!function ne(r,a,c){if(a)r.call(c);else for(var l=r.length,w=h(r,l),E=0;E=0;C--)if(l[C]===c||l[C].listener===c){z=l[C].listener,E=C;break}if(E<0)return this;0===E?l.shift():function g(r,a){for(var c=a,l=c+1,w=r.length;l=0;w--)this.removeListener(a,c[w]);return this},y.prototype.listeners=function(a){return _(this,a,!0)},y.prototype.rawListeners=function(a){return _(this,a,!1)},y.listenerCount=function(r,a){return"function"==typeof r.listenerCount?r.listenerCount(a):n.call(r,a)},y.prototype.listenerCount=n,y.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],5:[function(At,xt,kt){xt.exports="function"==typeof Object.create?function(je,Pe){Pe&&(je.super_=Pe,je.prototype=Object.create(Pe.prototype,{constructor:{value:je,enumerable:!1,writable:!0,configurable:!0}}))}:function(je,Pe){if(Pe){je.super_=Pe;var y=function(){};y.prototype=Pe.prototype,je.prototype=new y,je.prototype.constructor=je}}},{}],6:[function(At,xt,kt){var Q=1e3,je=60*Q,Pe=60*je,y=24*Pe;function le(d,N,A,f){var b=N>=1.5*A;return Math.round(d/A)+" "+f+(b?"s":"")}xt.exports=function(d,N){N=N||{};var A=typeof d;if("string"===A&&d.length>0)return function pe(d){if(!((d=String(d)).length>100)){var N=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(N){var A=parseFloat(N[1]);switch((N[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*A;case"weeks":case"week":case"w":return 6048e5*A;case"days":case"day":case"d":return A*y;case"hours":case"hour":case"hrs":case"hr":case"h":return A*Pe;case"minutes":case"minute":case"mins":case"min":case"m":return A*je;case"seconds":case"second":case"secs":case"sec":case"s":return A*Q;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return A;default:return}}}}(d);if("number"===A&&isFinite(d))return N.long?function ne(d){var N=Math.abs(d);return N>=y?le(d,N,y,"day"):N>=Pe?le(d,N,Pe,"hour"):N>=je?le(d,N,je,"minute"):N>=Q?le(d,N,Q,"second"):d+" ms"}(d):function _e(d){var N=Math.abs(d);return N>=y?Math.round(d/y)+"d":N>=Pe?Math.round(d/Pe)+"h":N>=je?Math.round(d/je)+"m":N>=Q?Math.round(d/Q)+"s":d+"ms"}(d);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(d))}},{}],7:[function(At,xt,kt){var je,Pe,Q=xt.exports={};function y(){throw new Error("setTimeout has not been defined")}function he(){throw new Error("clearTimeout has not been defined")}function te(m){if(je===setTimeout)return setTimeout(m,0);if((je===y||!je)&&setTimeout)return je=setTimeout,setTimeout(m,0);try{return je(m,0)}catch{try{return je.call(null,m,0)}catch{return je.call(this,m,0)}}}!function(){try{je="function"==typeof setTimeout?setTimeout:y}catch{je=y}try{Pe="function"==typeof clearTimeout?clearTimeout:he}catch{Pe=he}}();var le,_e=[],ne=!1,d=-1;function N(){!ne||!le||(ne=!1,le.length?_e=le.concat(_e):d=-1,_e.length&&A())}function A(){if(!ne){var m=te(N);ne=!0;for(var _=_e.length;_;){for(le=_e,_e=[];++d<_;)le&&le[d].run();d=-1,_=_e.length}le=null,ne=!1,function pe(m){if(Pe===clearTimeout)return clearTimeout(m);if((Pe===he||!Pe)&&clearTimeout)return Pe=clearTimeout,clearTimeout(m);try{Pe(m)}catch{try{return Pe.call(null,m)}catch{return Pe.call(this,m)}}}(m)}}function f(m,_){this.fun=m,this.array=_}function b(){}Q.nextTick=function(m){var _=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n=Pe?ne():pe=setTimeout(ne,Pe-d)),te};function ne(){pe=0,_e=+new Date,te=je.apply(y,he),y=null,he=null}}},{}],9:[function(At,xt,kt){xt.exports=_e;var Q=At("d3"),je=At("debug")("p2p-graph"),Pe=At("events"),y=At("inherits"),he=At("throttleit"),te_links={width:.7,maxWidth:5,maxBytes:2097152},pe_links_color="#C8C8C8",pe_nodes_method=function(ne,le){return Q.hsl(ne.me?210:ne.seeder?120:55,.7,.725)},pe_nodes_hover="#A9A9A9",pe_nodes_dep="#252929";function _e(ne){var le=this;if(!(le instanceof _e))return new _e(ne);Pe.call(le),"string"==typeof ne&&(ne=document.querySelector(ne)),le._root=ne,le._model={nodes:[],links:[],focused:null},le._model.links.forEach(function(d){var N=le._model.nodes[d.source],A=le._model.nodes[d.target];N.children=N.children||[],N.children.push(d.target),A.parents=A.parents||[],A.parents.push(d.source)}),le._svg=Q.select(le._root).append("svg"),le._resize(),le._force=Q.layout.force().size([le._width,le._height]).nodes(le._model.nodes).links(le._model.links).on("tick",function(){le._link.attr("x1",function(d){return d.source.x}).attr("y1",function(d){return d.source.y}).attr("x2",function(d){return d.target.x}).attr("y2",function(d){return d.target.y}),le._node.attr("cx",function(d){return d.x}).attr("cy",function(d){return d.y}),le._node.attr("transform",function(d){return"translate("+d.x+","+d.y+")"})}),le._node=le._svg.selectAll(".node"),le._link=le._svg.selectAll(".link"),le._update(),le._resizeThrottled=he(function(){le._resize()},500),window.addEventListener("resize",le._resizeThrottled)}y(_e,Pe),_e.prototype.list=function(){return je("list"),this._model.nodes},_e.prototype.add=function(ne){if(je("add %s %o",ne.id,ne),this._getNode(ne.id))throw new Error("add: cannot add duplicate node");this._model.nodes.push(ne),this._update()},_e.prototype.remove=function(ne){var le=this;je("remove %s",ne);var d=le._getNodeIndex(ne);if(-1===d)throw new Error("remove: node does not exist");le._model.focused&&le._model.focused.id===ne&&(le._model.focused=null,le.emit("select",!1)),le._model.nodes.splice(d,1),le._update()},_e.prototype.connect=function(ne,le){var d=this;je("connect %s %s",ne,le);var N=d._getNode(ne);if(!N)throw new Error("connect: invalid source id");var A=d._getNode(le);if(!A)throw new Error("connect: invalid target id");if(d.getLink(N.index,A.index))throw new Error("connect: cannot make duplicate connection");d._model.links.push({source:N.index,target:A.index}),d._update()},_e.prototype.disconnect=function(ne,le){var d=this;je("disconnect %s %s",ne,le);var N=d._getNode(ne);if(!N)throw new Error("disconnect: invalid source id");var A=d._getNode(le);if(!A)throw new Error("disconnect: invalid target id");var f=d.getLinkIndex(N.index,A.index);if(-1===f)throw new Error("disconnect: connection does not exist");d._model.links.splice(f,1),d._update()},_e.prototype.hasPeer=function(){var ne=this,le=Array.prototype.slice.call(arguments,0);return je("Checking for peers:",le),le.every(function(d){return ne._getNode(d)})},_e.prototype.hasLink=function(ne,le){var d=this,N=d._getNode(ne);if(!N)throw new Error("hasLink: invalid source id");var A=d._getNode(le);if(!A)throw new Error("hasLink: invalid target id");return!!d.getLink(N.index,A.index)},_e.prototype.areConnected=function(ne,le){var d=this,N=d._getNode(ne);if(!N)throw new Error("areConnected: invalid source id");var A=d._getNode(le);if(!A)throw new Error("areConnected: invalid target id");return d.getLink(N.index,A.index)||d.getLink(A.index,N.index)},_e.prototype.unchoke=function(ne,le){je("unchoke %s %s",ne,le)},_e.prototype.choke=function(ne,le){je("choke %s %s",ne,le)},_e.prototype.seed=function(ne,le){var d=this;if(je(ne,"isSeeding:",le),"boolean"!=typeof le)throw new Error("seed: 2nd param must be a boolean");var N=d._getNodeIndex(ne);if(-1===N)throw new Error("seed: node does not exist");d._model.nodes[N].seeder=le,d._update()},_e.prototype.rate=function(ne,le,d){var N=this;if(je("rate update:",ne+"<->"+le,"at",d),"number"!=typeof d||d<0)throw new Error("rate: 3th param must be a positive number");var A=N._getNode(ne);if(!A)throw new Error("rate: invalid source id");var f=N._getNode(le);if(!f)throw new Error("rate: invalid target id");var b=N.getLinkIndex(A.index,f.index);if(-1===b)throw new Error("rate: connection does not exist");N._model.links[b].rate=function m(_){return Math.min(_,te_links.maxBytes)*te_links.maxWidth/te_links.maxBytes}(d),je("rate:",N._model.links[b].rate),N._update()},_e.prototype.getLink=function(ne,le){for(var d=this,N=0,A=d._model.links.length;N=900?400:250,le._svg.attr("width",le._width).attr("height",le._height),le._force&&le._force.size([le._width,le._height]).resume()},_e.prototype._getNodeIndex=function(ne){for(var d=0,N=this._model.nodes.length;d=this.length||this.viewed&&Le===this.index)return this;if(!this.isShown)return this.index=Le,this.show();this.viewing&&this.viewing.abort();var kn,vn,et=this.element,qe=this.options,Ze=this.title,Ct=this.canvas,Nt=this.items[Le],Bt=Nt.querySelector("img"),In=at(Bt,"originalUrl"),ln=Bt.getAttribute("alt"),Ot=document.createElement("img");if(se(qe.inheritedAttributes,function(pr){var Nn=Bt.getAttribute(pr);null!==Nn&&Ot.setAttribute(pr,Nn)}),Ot.src=In,Ot.alt=ln,Y(qe.view)&&W(et,"view",qe.view,{once:!0}),!1===ee(et,"view",{originalImage:this.images[Le],index:Le,image:Ot})||!this.isShown||this.hiding||this.played)return this;function mn(){var pr=de.imageData,Nn=Array.isArray(qe.title)?qe.title[1]:qe.title;Ze.innerHTML=D(Nn=Y(Nn)?Nn.call(de,Ot,pr):"".concat(ln," (").concat(pr.naturalWidth," \xd7 ").concat(pr.naturalHeight,")"))?Nn.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">"):Nn}return(In=this.items[this.index])&&(ut(In,he),In.removeAttribute("aria-selected")),Je(Nt,he),Nt.setAttribute("aria-selected",!0),qe.focus&&Nt.focus(),this.image=Ot,this.viewed=!1,this.index=Le,this.imageData={},Je(Ot,m),qe.loading&&Je(Ct,_),Ct.innerHTML="",Ct.appendChild(Ot),this.renderList(),Ze.innerHTML="",W(et,oe,mn,{once:!0}),this.viewing={abort:function(){O(et,oe,mn),Ot.complete?de.imageRendering?de.imageRendering.abort():de.imageInitializing&&de.imageInitializing.abort():(Ot.src="",O(Ot,c,kn),de.timeout&&clearTimeout(de.timeout))}},Ot.complete?this.load():(W(Ot,c,kn=function(){O(Ot,l,vn),de.load()},{once:!0}),W(Ot,l,vn=function(){O(Ot,c,kn),de.timeout&&(clearTimeout(de.timeout),de.timeout=!1),ut(Ot,m),qe.loading&&ut(de.canvas,_)},{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){ut(Ot,m),de.timeout=!1},1e3)),this},prev:function(){var de=this.index-1;return de<0&&(de=0Math.abs(Bt)&&(this.pointers={},1
',zn=(Bt=zn.querySelector(".".concat(Q,"-container"))).querySelector(".".concat(Q,"-title")),ln=Bt.querySelector(".".concat(Q,"-toolbar")),Br=Bt.querySelector(".".concat(Q,"-navbar")),Ot=Bt.querySelector(".".concat(Q,"-button")),mn=Bt.querySelector(".".concat(Q,"-canvas")),this.parent=Nt,this.viewer=Bt,this.title=zn,this.toolbar=ln,this.navbar=Br,this.button=Ot,this.canvas=mn,this.footer=Bt.querySelector(".".concat(Q,"-footer")),this.tooltipBox=Bt.querySelector(".".concat(Q,"-tooltip")),this.player=Bt.querySelector(".".concat(Q,"-player")),this.list=Bt.querySelector(".".concat(Q,"-list")),Bt.id="".concat(Q).concat(this.id),zn.id="".concat(Q,"Title").concat(this.id),Je(zn,Ct.title?st(Array.isArray(Ct.title)?Ct.title[0]:Ct.title):d),Je(Br,Ct.navbar?st(Ct.navbar):d),$t(Ot,d,!Ct.button),Ct.keyboard&&Ot.setAttribute("tabindex",0),Ct.backdrop&&(Je(Bt,"".concat(Q,"-backdrop")),Ct.inline||"static"===Ct.backdrop||nt(mn,Ae,"hide")),D(Ct.className)&&Ct.className&&Ct.className.split(X).forEach(function(Rn){Je(Bt,Rn)}),Ct.toolbar?(kn=document.createElement("ul"),vn=L(Ct.toolbar),In=T.slice(0,3),pr=T.slice(7,9),Nn=T.slice(9),vn||Je(ln,st(Ct.toolbar)),se(vn?Ct.toolbar:T,function(Rn,Zn){var Wr,Kn=vn&&L(Rn),Kr=(Zn=vn?tt(Zn):Rn,Kn&&!B(Rn.show)?Rn.show:Rn);!Kr||!Ct.zoomable&&-1!==In.indexOf(Zn)||!Ct.rotatable&&-1!==pr.indexOf(Zn)||!Ct.scalable&&-1!==Nn.indexOf(Zn)||(Wr=Kn&&!B(Rn.size)?Rn.size:Rn,Kn=Kn&&!B(Rn.click)?Rn.click:Rn,Rn=document.createElement("li"),Ct.keyboard&&Rn.setAttribute("tabindex",0),Rn.setAttribute("role","button"),Je(Rn,"".concat(Q,"-").concat(Zn)),Y(Kn)||nt(Rn,Ae,Zn),v(Kr)&&Je(Rn,st(Kr)),-1!==["small","large"].indexOf(Wr)?Je(Rn,"".concat(Q,"-").concat(Wr)):"play"===Zn&&Je(Rn,"".concat(Q,"-large")),Y(Kn)&&W(Rn,u,Kn),kn.appendChild(Rn))}),ln.appendChild(kn)):Je(ln,d),Ct.rotatable||(Je(zn=ln.querySelectorAll('li[class*="rotate"]'),m),se(zn,function(Rn){ln.appendChild(Rn)})),Ct.inline?(Je(Ot,ne),Ie(Bt,{zIndex:Ct.zIndexInline}),"static"===window.getComputedStyle(Nt).position&&Ie(Nt,{position:"relative"}),Nt.insertBefore(Bt,Ze.nextSibling)):(Je(Ot,te),Je(Bt,_e),Je(Bt,pe),Je(Bt,d),Ie(Bt,{zIndex:Ct.zIndex}),(Br=(Br=D(Br=Ct.container)?Ze.ownerDocument.querySelector(Br):Br)||this.body).appendChild(Bt)),Ct.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,Y(Ct.ready)&&W(Ze,V,Ct.ready,{once:!0}),!1===ee(Ze,V)?this.ready=!1:this.ready&&Ct.inline&&this.view(this.index))}}])&&At(Le.prototype,et),qe&&At(Le,qe),Object.defineProperty(Le,"prototype",{writable:!1}),de}(),Ee(vr.prototype,Ht,wn,sn,Sn,fr),vr}); \ No newline at end of file diff --git a/dist/main-site/server/main.js b/dist/main-site/server/main.js index ea1624d7..f8485962 100644 --- a/dist/main-site/server/main.js +++ b/dist/main-site/server/main.js @@ -1 +1 @@ -var __defProp=Object.defineProperty,__name=(target,value)=>__defProp(target,"name",{value,configurable:!0});(()=>{var __webpack_modules__={62547:(module2,__unused_webpack_exports2,__webpack_require__2)=>{"use strict";var __create=Object.create,__defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__name2=__name((target,value)=>__defProp2(target,"name",{value,configurable:!0}),"__name"),__export=__name((target,all)=>{for(var name in all)__defProp2(target,name,{get:all[name],enumerable:!0})},"__export"),__copyProps=__name((to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp2(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},"__copyProps"),__reExport=__name((target,mod,secondTarget)=>(__copyProps(target,mod,"default"),secondTarget&&__copyProps(secondTarget,mod,"default")),"__reExport"),__toESM=__name((mod,isNodeMode,target)=>(target=null!=mod?__create(__getProtoOf(mod)):{},__copyProps(!isNodeMode&&mod&&mod.__esModule?target:__defProp2(target,"default",{value:mod,enumerable:!0}),mod)),"__toESM"),__toCommonJS=__name(mod=>__copyProps(__defProp2({},"__esModule",{value:!0}),mod),"__toCommonJS"),__decorateClass=__name((decorators,target,key,kind)=>{for(var decorator,result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i2=decorators.length-1;i2>=0;i2--)(decorator=decorators[i2])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),src_exports={};__export(src_exports,{ActionRowBuilder:()=>ActionRowBuilder,ApplicationCommandNumericOptionMinMaxValueMixin:()=>ApplicationCommandNumericOptionMinMaxValueMixin,ApplicationCommandOptionBase:()=>ApplicationCommandOptionBase,ApplicationCommandOptionChannelTypesMixin:()=>ApplicationCommandOptionChannelTypesMixin,ApplicationCommandOptionWithChoicesAndAutocompleteMixin:()=>ApplicationCommandOptionWithChoicesAndAutocompleteMixin,BaseSelectMenuBuilder:()=>BaseSelectMenuBuilder,ButtonBuilder:()=>ButtonBuilder,ChannelSelectMenuBuilder:()=>ChannelSelectMenuBuilder,ComponentAssertions:()=>Assertions_exports2,ComponentBuilder:()=>ComponentBuilder,ContextMenuCommandAssertions:()=>Assertions_exports6,ContextMenuCommandBuilder:()=>ContextMenuCommandBuilder,EmbedAssertions:()=>Assertions_exports,EmbedBuilder:()=>EmbedBuilder,MentionableSelectMenuBuilder:()=>MentionableSelectMenuBuilder,ModalAssertions:()=>Assertions_exports4,ModalBuilder:()=>ModalBuilder,RoleSelectMenuBuilder:()=>RoleSelectMenuBuilder,SelectMenuBuilder:()=>StringSelectMenuBuilder,SelectMenuOptionBuilder:()=>StringSelectMenuOptionBuilder,SharedNameAndDescription:()=>SharedNameAndDescription,SharedSlashCommandOptions:()=>SharedSlashCommandOptions,SlashCommandAssertions:()=>Assertions_exports5,SlashCommandAttachmentOption:()=>SlashCommandAttachmentOption,SlashCommandBooleanOption:()=>SlashCommandBooleanOption,SlashCommandBuilder:()=>SlashCommandBuilder,SlashCommandChannelOption:()=>SlashCommandChannelOption,SlashCommandIntegerOption:()=>SlashCommandIntegerOption,SlashCommandMentionableOption:()=>SlashCommandMentionableOption,SlashCommandNumberOption:()=>SlashCommandNumberOption,SlashCommandRoleOption:()=>SlashCommandRoleOption,SlashCommandStringOption:()=>SlashCommandStringOption,SlashCommandSubcommandBuilder:()=>SlashCommandSubcommandBuilder,SlashCommandSubcommandGroupBuilder:()=>SlashCommandSubcommandGroupBuilder,SlashCommandUserOption:()=>SlashCommandUserOption,StringSelectMenuBuilder:()=>StringSelectMenuBuilder,StringSelectMenuOptionBuilder:()=>StringSelectMenuOptionBuilder,TextInputAssertions:()=>Assertions_exports3,TextInputBuilder:()=>TextInputBuilder,UserSelectMenuBuilder:()=>UserSelectMenuBuilder,createComponentBuilder:()=>createComponentBuilder,disableValidators:()=>disableValidators,embedLength:()=>embedLength,enableValidators:()=>enableValidators,isValidationEnabled:()=>isValidationEnabled,normalizeArray:()=>normalizeArray,version:()=>version}),module2.exports=__toCommonJS(src_exports);var Assertions_exports={};__export(Assertions_exports,{RGBPredicate:()=>RGBPredicate,authorNamePredicate:()=>authorNamePredicate,colorPredicate:()=>colorPredicate,descriptionPredicate:()=>descriptionPredicate,embedAuthorPredicate:()=>embedAuthorPredicate,embedFieldPredicate:()=>embedFieldPredicate,embedFieldsArrayPredicate:()=>embedFieldsArrayPredicate,embedFooterPredicate:()=>embedFooterPredicate,fieldInlinePredicate:()=>fieldInlinePredicate,fieldLengthPredicate:()=>fieldLengthPredicate,fieldNamePredicate:()=>fieldNamePredicate,fieldValuePredicate:()=>fieldValuePredicate,footerTextPredicate:()=>footerTextPredicate,imageURLPredicate:()=>imageURLPredicate,timestampPredicate:()=>timestampPredicate,titlePredicate:()=>titlePredicate,urlPredicate:()=>urlPredicate,validateFieldLength:()=>validateFieldLength});var import_shapeshift=__webpack_require__2(2409),validate=!0;function enableValidators(){return validate=!0}function disableValidators(){return validate=!1}function isValidationEnabled(){return validate}__name(enableValidators,"enableValidators"),__name2(enableValidators,"enableValidators"),__name(disableValidators,"disableValidators"),__name2(disableValidators,"disableValidators"),__name(isValidationEnabled,"isValidationEnabled"),__name2(isValidationEnabled,"isValidationEnabled");var fieldNamePredicate=import_shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(256).setValidationEnabled(isValidationEnabled),fieldValuePredicate=import_shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(1024).setValidationEnabled(isValidationEnabled),fieldInlinePredicate=import_shapeshift.s.boolean.optional,embedFieldPredicate=import_shapeshift.s.object({name:fieldNamePredicate,value:fieldValuePredicate,inline:fieldInlinePredicate}).setValidationEnabled(isValidationEnabled),embedFieldsArrayPredicate=embedFieldPredicate.array.setValidationEnabled(isValidationEnabled),fieldLengthPredicate=import_shapeshift.s.number.lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);function validateFieldLength(amountAdding,fields){fieldLengthPredicate.parse((fields?.length??0)+amountAdding)}__name(validateFieldLength,"validateFieldLength"),__name2(validateFieldLength,"validateFieldLength");var authorNamePredicate=fieldNamePredicate.nullable.setValidationEnabled(isValidationEnabled),imageURLPredicate=import_shapeshift.s.string.url({allowedProtocols:["http:","https:","attachment:"]}).nullish.setValidationEnabled(isValidationEnabled),urlPredicate=import_shapeshift.s.string.url({allowedProtocols:["http:","https:"]}).nullish.setValidationEnabled(isValidationEnabled),embedAuthorPredicate=import_shapeshift.s.object({name:authorNamePredicate,iconURL:imageURLPredicate,url:urlPredicate}).setValidationEnabled(isValidationEnabled),RGBPredicate=import_shapeshift.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(255).setValidationEnabled(isValidationEnabled),colorPredicate=import_shapeshift.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(16777215).or(import_shapeshift.s.tuple([RGBPredicate,RGBPredicate,RGBPredicate])).nullable.setValidationEnabled(isValidationEnabled),descriptionPredicate=import_shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(4096).nullable.setValidationEnabled(isValidationEnabled),footerTextPredicate=import_shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(2048).nullable.setValidationEnabled(isValidationEnabled),embedFooterPredicate=import_shapeshift.s.object({text:footerTextPredicate,iconURL:imageURLPredicate}).setValidationEnabled(isValidationEnabled),timestampPredicate=import_shapeshift.s.union(import_shapeshift.s.number,import_shapeshift.s.date).nullable.setValidationEnabled(isValidationEnabled),titlePredicate=fieldNamePredicate.nullable.setValidationEnabled(isValidationEnabled);function normalizeArray(arr){return Array.isArray(arr[0])?arr[0]:arr}__name(normalizeArray,"normalizeArray"),__name2(normalizeArray,"normalizeArray");var EmbedBuilder=__name(class{static#_=__name2(this,"EmbedBuilder");data;constructor(data={}){this.data={...data},data.timestamp&&(this.data.timestamp=new Date(data.timestamp).toISOString())}addFields(...fields){const normalizedFields=normalizeArray(fields);return validateFieldLength(normalizedFields.length,this.data.fields),embedFieldsArrayPredicate.parse(normalizedFields),this.data.fields?this.data.fields.push(...normalizedFields):this.data.fields=normalizedFields,this}spliceFields(index,deleteCount,...fields){return validateFieldLength(fields.length-deleteCount,this.data.fields),embedFieldsArrayPredicate.parse(fields),this.data.fields?this.data.fields.splice(index,deleteCount,...fields):this.data.fields=fields,this}setFields(...fields){return this.spliceFields(0,this.data.fields?.length??0,...normalizeArray(fields)),this}setAuthor(options){return null===options?(this.data.author=void 0,this):(embedAuthorPredicate.parse(options),this.data.author={name:options.name,url:options.url,icon_url:options.iconURL},this)}setColor(color){if(colorPredicate.parse(color),Array.isArray(color)){const[red,green,blue]=color;return this.data.color=(red<<16)+(green<<8)+blue,this}return this.data.color=color??void 0,this}setDescription(description){return descriptionPredicate.parse(description),this.data.description=description??void 0,this}setFooter(options){return null===options?(this.data.footer=void 0,this):(embedFooterPredicate.parse(options),this.data.footer={text:options.text,icon_url:options.iconURL},this)}setImage(url){return imageURLPredicate.parse(url),this.data.image=url?{url}:void 0,this}setThumbnail(url){return imageURLPredicate.parse(url),this.data.thumbnail=url?{url}:void 0,this}setTimestamp(timestamp=Date.now()){return timestampPredicate.parse(timestamp),this.data.timestamp=timestamp?new Date(timestamp).toISOString():void 0,this}setTitle(title){return titlePredicate.parse(title),this.data.title=title??void 0,this}setURL(url){return urlPredicate.parse(url),this.data.url=url??void 0,this}toJSON(){return{...this.data}}},"EmbedBuilder");__reExport(src_exports,__webpack_require__2(5806),module2.exports);var Assertions_exports2={};__export(Assertions_exports2,{buttonLabelValidator:()=>buttonLabelValidator,buttonStyleValidator:()=>buttonStyleValidator,channelTypesValidator:()=>channelTypesValidator,customIdValidator:()=>customIdValidator,defaultValidator:()=>defaultValidator,disabledValidator:()=>disabledValidator,emojiValidator:()=>emojiValidator,jsonOptionValidator:()=>jsonOptionValidator,labelValueDescriptionValidator:()=>labelValueDescriptionValidator,minMaxValidator:()=>minMaxValidator,optionValidator:()=>optionValidator,optionsLengthValidator:()=>optionsLengthValidator,optionsValidator:()=>optionsValidator,placeholderValidator:()=>placeholderValidator,urlValidator:()=>urlValidator,validateRequiredButtonParameters:()=>validateRequiredButtonParameters,validateRequiredSelectMenuOptionParameters:()=>validateRequiredSelectMenuOptionParameters,validateRequiredSelectMenuParameters:()=>validateRequiredSelectMenuParameters});var import_shapeshift2=__webpack_require__2(2409),import_v10=__webpack_require__2(26538),StringSelectMenuOptionBuilder=__name(class{constructor(data={}){this.data=data}static#_=__name2(this,"StringSelectMenuOptionBuilder");setLabel(label){return this.data.label=labelValueDescriptionValidator.parse(label),this}setValue(value){return this.data.value=labelValueDescriptionValidator.parse(value),this}setDescription(description){return this.data.description=labelValueDescriptionValidator.parse(description),this}setDefault(isDefault=!0){return this.data.default=defaultValidator.parse(isDefault),this}setEmoji(emoji){return this.data.emoji=emojiValidator.parse(emoji),this}toJSON(){return validateRequiredSelectMenuOptionParameters(this.data.label,this.data.value),{...this.data}}},"StringSelectMenuOptionBuilder"),customIdValidator=import_shapeshift2.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled),emojiValidator=import_shapeshift2.s.object({id:import_shapeshift2.s.string,name:import_shapeshift2.s.string,animated:import_shapeshift2.s.boolean}).partial.strict.setValidationEnabled(isValidationEnabled),disabledValidator=import_shapeshift2.s.boolean,buttonLabelValidator=import_shapeshift2.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(80).setValidationEnabled(isValidationEnabled),buttonStyleValidator=import_shapeshift2.s.nativeEnum(import_v10.ButtonStyle),placeholderValidator=import_shapeshift2.s.string.lengthLessThanOrEqual(150).setValidationEnabled(isValidationEnabled),minMaxValidator=import_shapeshift2.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(25).setValidationEnabled(isValidationEnabled),labelValueDescriptionValidator=import_shapeshift2.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled),jsonOptionValidator=import_shapeshift2.s.object({label:labelValueDescriptionValidator,value:labelValueDescriptionValidator,description:labelValueDescriptionValidator.optional,emoji:emojiValidator.optional,default:import_shapeshift2.s.boolean.optional}).setValidationEnabled(isValidationEnabled),optionValidator=import_shapeshift2.s.instance(StringSelectMenuOptionBuilder).setValidationEnabled(isValidationEnabled),optionsValidator=optionValidator.array.lengthGreaterThanOrEqual(0).setValidationEnabled(isValidationEnabled),optionsLengthValidator=import_shapeshift2.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);function validateRequiredSelectMenuParameters(options,customId){customIdValidator.parse(customId),optionsValidator.parse(options)}__name(validateRequiredSelectMenuParameters,"validateRequiredSelectMenuParameters"),__name2(validateRequiredSelectMenuParameters,"validateRequiredSelectMenuParameters");var defaultValidator=import_shapeshift2.s.boolean;function validateRequiredSelectMenuOptionParameters(label,value){labelValueDescriptionValidator.parse(label),labelValueDescriptionValidator.parse(value)}__name(validateRequiredSelectMenuOptionParameters,"validateRequiredSelectMenuOptionParameters"),__name2(validateRequiredSelectMenuOptionParameters,"validateRequiredSelectMenuOptionParameters");var channelTypesValidator=import_shapeshift2.s.nativeEnum(import_v10.ChannelType).array.setValidationEnabled(isValidationEnabled),urlValidator=import_shapeshift2.s.string.url({allowedProtocols:["http:","https:","discord:"]}).setValidationEnabled(isValidationEnabled);function validateRequiredButtonParameters(style,label,emoji,customId,url){if(url&&customId)throw new RangeError("URL and custom id are mutually exclusive");if(!label&&!emoji)throw new RangeError("Buttons must have a label and/or an emoji");if(style===import_v10.ButtonStyle.Link){if(!url)throw new RangeError("Link buttons must have a url")}else if(url)throw new RangeError("Non-link buttons cannot have a url")}__name(validateRequiredButtonParameters,"validateRequiredButtonParameters"),__name2(validateRequiredButtonParameters,"validateRequiredButtonParameters");var import_v1011=__webpack_require__2(26538),ComponentBuilder=__name(class{static#_=__name2(this,"ComponentBuilder");data;constructor(data){this.data=data}},"ComponentBuilder"),import_v1010=__webpack_require__2(26538),import_v102=__webpack_require__2(26538),ButtonBuilder=__name(class extends ComponentBuilder{static#_=__name2(this,"ButtonBuilder");constructor(data){super({type:import_v102.ComponentType.Button,...data})}setStyle(style){return this.data.style=buttonStyleValidator.parse(style),this}setURL(url){return this.data.url=urlValidator.parse(url),this}setCustomId(customId){return this.data.custom_id=customIdValidator.parse(customId),this}setEmoji(emoji){return this.data.emoji=emojiValidator.parse(emoji),this}setDisabled(disabled=!0){return this.data.disabled=disabledValidator.parse(disabled),this}setLabel(label){return this.data.label=buttonLabelValidator.parse(label),this}toJSON(){return validateRequiredButtonParameters(this.data.style,this.data.label,this.data.emoji,this.data.custom_id,this.data.url),{...this.data}}},"ButtonBuilder"),import_v103=__webpack_require__2(26538),BaseSelectMenuBuilder=__name(class extends ComponentBuilder{static#_=__name2(this,"BaseSelectMenuBuilder");setPlaceholder(placeholder){return this.data.placeholder=placeholderValidator.parse(placeholder),this}setMinValues(minValues){return this.data.min_values=minMaxValidator.parse(minValues),this}setMaxValues(maxValues){return this.data.max_values=minMaxValidator.parse(maxValues),this}setCustomId(customId){return this.data.custom_id=customIdValidator.parse(customId),this}setDisabled(disabled=!0){return this.data.disabled=disabledValidator.parse(disabled),this}toJSON(){return customIdValidator.parse(this.data.custom_id),{...this.data}}},"BaseSelectMenuBuilder"),ChannelSelectMenuBuilder=__name(class extends BaseSelectMenuBuilder{static#_=__name2(this,"ChannelSelectMenuBuilder");constructor(data){super({...data,type:import_v103.ComponentType.ChannelSelect})}addChannelTypes(...types){const normalizedTypes=normalizeArray(types);return this.data.channel_types??=[],this.data.channel_types.push(...channelTypesValidator.parse(normalizedTypes)),this}setChannelTypes(...types){const normalizedTypes=normalizeArray(types);return this.data.channel_types??=[],this.data.channel_types.splice(0,this.data.channel_types.length,...channelTypesValidator.parse(normalizedTypes)),this}toJSON(){return customIdValidator.parse(this.data.custom_id),{...this.data}}},"ChannelSelectMenuBuilder"),import_v104=__webpack_require__2(26538),MentionableSelectMenuBuilder=__name(class extends BaseSelectMenuBuilder{static#_=__name2(this,"MentionableSelectMenuBuilder");constructor(data){super({...data,type:import_v104.ComponentType.MentionableSelect})}},"MentionableSelectMenuBuilder"),import_v105=__webpack_require__2(26538),RoleSelectMenuBuilder=__name(class extends BaseSelectMenuBuilder{static#_=__name2(this,"RoleSelectMenuBuilder");constructor(data){super({...data,type:import_v105.ComponentType.RoleSelect})}},"RoleSelectMenuBuilder"),import_v106=__webpack_require__2(26538),StringSelectMenuBuilder=__name(class extends BaseSelectMenuBuilder{static#_=__name2(this,"StringSelectMenuBuilder");options;constructor(data){const{options,...initData}=data??{};super({...initData,type:import_v106.ComponentType.StringSelect}),this.options=options?.map(option=>new StringSelectMenuOptionBuilder(option))??[]}addOptions(...options){const normalizedOptions=normalizeArray(options);return optionsLengthValidator.parse(this.options.length+normalizedOptions.length),this.options.push(...normalizedOptions.map(normalizedOption=>normalizedOption instanceof StringSelectMenuOptionBuilder?normalizedOption:new StringSelectMenuOptionBuilder(jsonOptionValidator.parse(normalizedOption)))),this}setOptions(...options){return this.spliceOptions(0,this.options.length,...options)}spliceOptions(index,deleteCount,...options){const normalizedOptions=normalizeArray(options),clone=[...this.options];return clone.splice(index,deleteCount,...normalizedOptions.map(normalizedOption=>normalizedOption instanceof StringSelectMenuOptionBuilder?normalizedOption:new StringSelectMenuOptionBuilder(jsonOptionValidator.parse(normalizedOption)))),optionsLengthValidator.parse(clone.length),this.options.splice(0,this.options.length,...clone),this}toJSON(){return validateRequiredSelectMenuParameters(this.options,this.data.custom_id),{...this.data,options:this.options.map(option=>option.toJSON())}}},"StringSelectMenuBuilder"),import_v107=__webpack_require__2(26538),UserSelectMenuBuilder=__name(class extends BaseSelectMenuBuilder{static#_=__name2(this,"UserSelectMenuBuilder");constructor(data){super({...data,type:import_v107.ComponentType.UserSelect})}},"UserSelectMenuBuilder"),import_util=__webpack_require__2(43985),import_v109=__webpack_require__2(26538),import_fast_deep_equal=__toESM(__webpack_require__2(21385)),Assertions_exports3={};__export(Assertions_exports3,{labelValidator:()=>labelValidator,maxLengthValidator:()=>maxLengthValidator,minLengthValidator:()=>minLengthValidator,placeholderValidator:()=>placeholderValidator2,requiredValidator:()=>requiredValidator,textInputStyleValidator:()=>textInputStyleValidator,validateRequiredParameters:()=>validateRequiredParameters,valueValidator:()=>valueValidator});var import_shapeshift3=__webpack_require__2(2409),import_v108=__webpack_require__2(26538),textInputStyleValidator=import_shapeshift3.s.nativeEnum(import_v108.TextInputStyle),minLengthValidator=import_shapeshift3.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled),maxLengthValidator=import_shapeshift3.s.number.int.greaterThanOrEqual(1).lessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled),requiredValidator=import_shapeshift3.s.boolean,valueValidator=import_shapeshift3.s.string.lengthLessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled),placeholderValidator2=import_shapeshift3.s.string.lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled),labelValidator=import_shapeshift3.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45).setValidationEnabled(isValidationEnabled);function validateRequiredParameters(customId,style,label){customIdValidator.parse(customId),textInputStyleValidator.parse(style),labelValidator.parse(label)}__name(validateRequiredParameters,"validateRequiredParameters"),__name2(validateRequiredParameters,"validateRequiredParameters");var TextInputBuilder=__name(class extends ComponentBuilder{static#_=__name2(this,"TextInputBuilder");constructor(data){super({type:import_v109.ComponentType.TextInput,...data})}setCustomId(customId){return this.data.custom_id=customIdValidator.parse(customId),this}setLabel(label){return this.data.label=labelValidator.parse(label),this}setStyle(style){return this.data.style=textInputStyleValidator.parse(style),this}setMinLength(minLength){return this.data.min_length=minLengthValidator.parse(minLength),this}setMaxLength(maxLength){return this.data.max_length=maxLengthValidator.parse(maxLength),this}setPlaceholder(placeholder){return this.data.placeholder=placeholderValidator2.parse(placeholder),this}setValue(value){return this.data.value=valueValidator.parse(value),this}setRequired(required=!0){return this.data.required=requiredValidator.parse(required),this}toJSON(){return validateRequiredParameters(this.data.custom_id,this.data.style,this.data.label),{...this.data}}equals(other){return(0,import_util.isJSONEncodable)(other)?(0,import_fast_deep_equal.default)(other.toJSON(),this.data):(0,import_fast_deep_equal.default)(other,this.data)}},"TextInputBuilder");function createComponentBuilder(data){if(data instanceof ComponentBuilder)return data;switch(data.type){case import_v1010.ComponentType.ActionRow:return new ActionRowBuilder(data);case import_v1010.ComponentType.Button:return new ButtonBuilder(data);case import_v1010.ComponentType.StringSelect:return new StringSelectMenuBuilder(data);case import_v1010.ComponentType.TextInput:return new TextInputBuilder(data);case import_v1010.ComponentType.UserSelect:return new UserSelectMenuBuilder(data);case import_v1010.ComponentType.RoleSelect:return new RoleSelectMenuBuilder(data);case import_v1010.ComponentType.MentionableSelect:return new MentionableSelectMenuBuilder(data);case import_v1010.ComponentType.ChannelSelect:return new ChannelSelectMenuBuilder(data);default:throw new Error(`Cannot properly serialize component type: ${data.type}`)}}__name(createComponentBuilder,"createComponentBuilder"),__name2(createComponentBuilder,"createComponentBuilder");var ActionRowBuilder=__name(class extends ComponentBuilder{static#_=__name2(this,"ActionRowBuilder");components;constructor({components,...data}={}){super({type:import_v1011.ComponentType.ActionRow,...data}),this.components=components?.map(component=>createComponentBuilder(component))??[]}addComponents(...components){return this.components.push(...normalizeArray(components)),this}setComponents(...components){return this.components.splice(0,this.components.length,...normalizeArray(components)),this}toJSON(){return{...this.data,components:this.components.map(component=>component.toJSON())}}},"ActionRowBuilder"),Assertions_exports4={};__export(Assertions_exports4,{componentsValidator:()=>componentsValidator,titleValidator:()=>titleValidator,validateRequiredParameters:()=>validateRequiredParameters2});var import_shapeshift4=__webpack_require__2(2409),titleValidator=import_shapeshift4.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45).setValidationEnabled(isValidationEnabled),componentsValidator=import_shapeshift4.s.instance(ActionRowBuilder).array.lengthGreaterThanOrEqual(1).setValidationEnabled(isValidationEnabled);function validateRequiredParameters2(customId,title,components){customIdValidator.parse(customId),titleValidator.parse(title),componentsValidator.parse(components)}__name(validateRequiredParameters2,"validateRequiredParameters2"),__name2(validateRequiredParameters2,"validateRequiredParameters");var ModalBuilder=__name(class{static#_=__name2(this,"ModalBuilder");data;components=[];constructor({components,...data}={}){this.data={...data},this.components=components?.map(component=>createComponentBuilder(component))??[]}setTitle(title){return this.data.title=titleValidator.parse(title),this}setCustomId(customId){return this.data.custom_id=customIdValidator.parse(customId),this}addComponents(...components){return this.components.push(...normalizeArray(components).map(component=>component instanceof ActionRowBuilder?component:new ActionRowBuilder(component))),this}setComponents(...components){return this.components.splice(0,this.components.length,...normalizeArray(components)),this}toJSON(){return validateRequiredParameters2(this.data.custom_id,this.data.title,this.components),{...this.data,components:this.components.map(component=>component.toJSON())}}},"ModalBuilder"),Assertions_exports5={};__export(Assertions_exports5,{assertReturnOfBuilder:()=>assertReturnOfBuilder,localizationMapPredicate:()=>localizationMapPredicate,validateChoicesLength:()=>validateChoicesLength,validateDMPermission:()=>validateDMPermission,validateDefaultMemberPermissions:()=>validateDefaultMemberPermissions,validateDefaultPermission:()=>validateDefaultPermission,validateDescription:()=>validateDescription,validateLocale:()=>validateLocale,validateLocalizationMap:()=>validateLocalizationMap,validateMaxOptionsLength:()=>validateMaxOptionsLength,validateNSFW:()=>validateNSFW,validateName:()=>validateName,validateRequired:()=>validateRequired,validateRequiredParameters:()=>validateRequiredParameters3});var import_shapeshift5=__webpack_require__2(2409),import_v1012=__webpack_require__2(26538),namePredicate=import_shapeshift5.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u).setValidationEnabled(isValidationEnabled);function validateName(name){namePredicate.parse(name)}__name(validateName,"validateName"),__name2(validateName,"validateName");var descriptionPredicate2=import_shapeshift5.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled),localePredicate=import_shapeshift5.s.nativeEnum(import_v1012.Locale);function validateDescription(description){descriptionPredicate2.parse(description)}__name(validateDescription,"validateDescription"),__name2(validateDescription,"validateDescription");var maxArrayLengthPredicate=import_shapeshift5.s.unknown.array.lengthLessThanOrEqual(25).setValidationEnabled(isValidationEnabled);function validateLocale(locale){return localePredicate.parse(locale)}function validateMaxOptionsLength(options){maxArrayLengthPredicate.parse(options)}function validateRequiredParameters3(name,description,options){validateName(name),validateDescription(description),validateMaxOptionsLength(options)}__name(validateLocale,"validateLocale"),__name2(validateLocale,"validateLocale"),__name(validateMaxOptionsLength,"validateMaxOptionsLength"),__name2(validateMaxOptionsLength,"validateMaxOptionsLength"),__name(validateRequiredParameters3,"validateRequiredParameters3"),__name2(validateRequiredParameters3,"validateRequiredParameters");var booleanPredicate=import_shapeshift5.s.boolean;function validateDefaultPermission(value){booleanPredicate.parse(value)}function validateRequired(required){booleanPredicate.parse(required)}__name(validateDefaultPermission,"validateDefaultPermission"),__name2(validateDefaultPermission,"validateDefaultPermission"),__name(validateRequired,"validateRequired"),__name2(validateRequired,"validateRequired");var choicesLengthPredicate=import_shapeshift5.s.number.lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);function validateChoicesLength(amountAdding,choices){choicesLengthPredicate.parse((choices?.length??0)+amountAdding)}function assertReturnOfBuilder(input,ExpectedInstanceOf){import_shapeshift5.s.instance(ExpectedInstanceOf).parse(input)}__name(validateChoicesLength,"validateChoicesLength"),__name2(validateChoicesLength,"validateChoicesLength"),__name(assertReturnOfBuilder,"assertReturnOfBuilder"),__name2(assertReturnOfBuilder,"assertReturnOfBuilder");var localizationMapPredicate=import_shapeshift5.s.object(Object.fromEntries(Object.values(import_v1012.Locale).map(locale=>[locale,import_shapeshift5.s.string.nullish]))).strict.nullish.setValidationEnabled(isValidationEnabled);function validateLocalizationMap(value){localizationMapPredicate.parse(value)}__name(validateLocalizationMap,"validateLocalizationMap"),__name2(validateLocalizationMap,"validateLocalizationMap");var dmPermissionPredicate=import_shapeshift5.s.boolean.nullish;function validateDMPermission(value){dmPermissionPredicate.parse(value)}__name(validateDMPermission,"validateDMPermission"),__name2(validateDMPermission,"validateDMPermission");var memberPermissionPredicate=import_shapeshift5.s.union(import_shapeshift5.s.bigint.transform(value=>value.toString()),import_shapeshift5.s.number.safeInt.transform(value=>value.toString()),import_shapeshift5.s.string.regex(/^\d+$/)).nullish;function validateDefaultMemberPermissions(permissions){return memberPermissionPredicate.parse(permissions)}function validateNSFW(value){booleanPredicate.parse(value)}__name(validateDefaultMemberPermissions,"validateDefaultMemberPermissions"),__name2(validateDefaultMemberPermissions,"validateDefaultMemberPermissions"),__name(validateNSFW,"validateNSFW"),__name2(validateNSFW,"validateNSFW");var import_ts_mixer6=__webpack_require__2(92688),import_v1024=__webpack_require__2(26538),import_ts_mixer5=__webpack_require__2(92688),SharedNameAndDescription=__name(class{static#_=__name2(this,"SharedNameAndDescription");name;name_localizations;description;description_localizations;setName(name){return validateName(name),Reflect.set(this,"name",name),this}setDescription(description){return validateDescription(description),Reflect.set(this,"description",description),this}setNameLocalization(locale,localizedName){this.name_localizations||Reflect.set(this,"name_localizations",{});const parsedLocale=validateLocale(locale);return null===localizedName?(this.name_localizations[parsedLocale]=null,this):(validateName(localizedName),this.name_localizations[parsedLocale]=localizedName,this)}setNameLocalizations(localizedNames){if(null===localizedNames)return Reflect.set(this,"name_localizations",null),this;Reflect.set(this,"name_localizations",{});for(const args2 of Object.entries(localizedNames))this.setNameLocalization(...args2);return this}setDescriptionLocalization(locale,localizedDescription){this.description_localizations||Reflect.set(this,"description_localizations",{});const parsedLocale=validateLocale(locale);return null===localizedDescription?(this.description_localizations[parsedLocale]=null,this):(validateDescription(localizedDescription),this.description_localizations[parsedLocale]=localizedDescription,this)}setDescriptionLocalizations(localizedDescriptions){if(null===localizedDescriptions)return Reflect.set(this,"description_localizations",null),this;Reflect.set(this,"description_localizations",{});for(const args2 of Object.entries(localizedDescriptions))this.setDescriptionLocalization(...args2);return this}},"SharedNameAndDescription"),import_v1013=__webpack_require__2(26538),ApplicationCommandOptionBase=__name(class extends SharedNameAndDescription{static#_=__name2(this,"ApplicationCommandOptionBase");required=!1;setRequired(required){return validateRequired(required),Reflect.set(this,"required",required),this}runRequiredValidations(){validateRequiredParameters3(this.name,this.description,[]),validateLocalizationMap(this.name_localizations),validateLocalizationMap(this.description_localizations),validateRequired(this.required)}},"ApplicationCommandOptionBase"),SlashCommandAttachmentOption=__name(class extends ApplicationCommandOptionBase{static#_=__name2(this,"SlashCommandAttachmentOption");type=import_v1013.ApplicationCommandOptionType.Attachment;toJSON(){return this.runRequiredValidations(),{...this}}},"SlashCommandAttachmentOption"),import_v1014=__webpack_require__2(26538),SlashCommandBooleanOption=__name(class extends ApplicationCommandOptionBase{static#_=__name2(this,"SlashCommandBooleanOption");type=import_v1014.ApplicationCommandOptionType.Boolean;toJSON(){return this.runRequiredValidations(),{...this}}},"SlashCommandBooleanOption"),import_v1016=__webpack_require__2(26538),import_ts_mixer=__webpack_require__2(92688),import_shapeshift6=__webpack_require__2(2409),import_v1015=__webpack_require__2(26538),allowedChannelTypes=[import_v1015.ChannelType.GuildText,import_v1015.ChannelType.GuildVoice,import_v1015.ChannelType.GuildCategory,import_v1015.ChannelType.GuildAnnouncement,import_v1015.ChannelType.AnnouncementThread,import_v1015.ChannelType.PublicThread,import_v1015.ChannelType.PrivateThread,import_v1015.ChannelType.GuildStageVoice,import_v1015.ChannelType.GuildForum],channelTypesPredicate=import_shapeshift6.s.array(import_shapeshift6.s.union(...allowedChannelTypes.map(type=>import_shapeshift6.s.literal(type)))),ApplicationCommandOptionChannelTypesMixin=__name(class{static#_=__name2(this,"ApplicationCommandOptionChannelTypesMixin");channel_types;addChannelTypes(...channelTypes){return void 0===this.channel_types&&Reflect.set(this,"channel_types",[]),this.channel_types.push(...channelTypesPredicate.parse(channelTypes)),this}},"ApplicationCommandOptionChannelTypesMixin"),SlashCommandChannelOption=__name(class extends ApplicationCommandOptionBase{type=import_v1016.ApplicationCommandOptionType.Channel;toJSON(){return this.runRequiredValidations(),{...this}}},"SlashCommandChannelOption");__name2(SlashCommandChannelOption,"SlashCommandChannelOption"),SlashCommandChannelOption=__decorateClass([(0,import_ts_mixer.mix)(ApplicationCommandOptionChannelTypesMixin)],SlashCommandChannelOption);var import_shapeshift8=__webpack_require__2(2409),import_v1018=__webpack_require__2(26538),import_ts_mixer2=__webpack_require__2(92688),ApplicationCommandNumericOptionMinMaxValueMixin=__name(class{static#_=__name2(this,"ApplicationCommandNumericOptionMinMaxValueMixin");max_value;min_value},"ApplicationCommandNumericOptionMinMaxValueMixin"),import_shapeshift7=__webpack_require__2(2409),import_v1017=__webpack_require__2(26538),stringPredicate=import_shapeshift7.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),numberPredicate=import_shapeshift7.s.number.greaterThan(Number.NEGATIVE_INFINITY).lessThan(Number.POSITIVE_INFINITY),choicesPredicate=import_shapeshift7.s.object({name:stringPredicate,name_localizations:localizationMapPredicate,value:import_shapeshift7.s.union(stringPredicate,numberPredicate)}).array,booleanPredicate2=import_shapeshift7.s.boolean,ApplicationCommandOptionWithChoicesAndAutocompleteMixin=__name(class{static#_=__name2(this,"ApplicationCommandOptionWithChoicesAndAutocompleteMixin");choices;autocomplete;type;addChoices(...choices){if(choices.length>0&&this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");choicesPredicate.parse(choices),void 0===this.choices&&Reflect.set(this,"choices",[]),validateChoicesLength(choices.length,this.choices);for(const{name,name_localizations,value}of choices)this.type===import_v1017.ApplicationCommandOptionType.String?stringPredicate.parse(value):numberPredicate.parse(value),this.choices.push({name,name_localizations,value});return this}setChoices(...choices){if(choices.length>0&&this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return choicesPredicate.parse(choices),Reflect.set(this,"choices",[]),this.addChoices(...choices),this}setAutocomplete(autocomplete){if(booleanPredicate2.parse(autocomplete),autocomplete&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return Reflect.set(this,"autocomplete",autocomplete),this}},"ApplicationCommandOptionWithChoicesAndAutocompleteMixin"),numberValidator=import_shapeshift8.s.number.int,SlashCommandIntegerOption=__name(class extends ApplicationCommandOptionBase{type=import_v1018.ApplicationCommandOptionType.Integer;setMaxValue(max){return numberValidator.parse(max),Reflect.set(this,"max_value",max),this}setMinValue(min){return numberValidator.parse(min),Reflect.set(this,"min_value",min),this}toJSON(){if(this.runRequiredValidations(),this.autocomplete&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return{...this}}},"SlashCommandIntegerOption");__name2(SlashCommandIntegerOption,"SlashCommandIntegerOption"),SlashCommandIntegerOption=__decorateClass([(0,import_ts_mixer2.mix)(ApplicationCommandNumericOptionMinMaxValueMixin,ApplicationCommandOptionWithChoicesAndAutocompleteMixin)],SlashCommandIntegerOption);var import_v1019=__webpack_require__2(26538),SlashCommandMentionableOption=__name(class extends ApplicationCommandOptionBase{static#_=__name2(this,"SlashCommandMentionableOption");type=import_v1019.ApplicationCommandOptionType.Mentionable;toJSON(){return this.runRequiredValidations(),{...this}}},"SlashCommandMentionableOption"),import_shapeshift9=__webpack_require__2(2409),import_v1020=__webpack_require__2(26538),import_ts_mixer3=__webpack_require__2(92688),numberValidator2=import_shapeshift9.s.number,SlashCommandNumberOption=__name(class extends ApplicationCommandOptionBase{type=import_v1020.ApplicationCommandOptionType.Number;setMaxValue(max){return numberValidator2.parse(max),Reflect.set(this,"max_value",max),this}setMinValue(min){return numberValidator2.parse(min),Reflect.set(this,"min_value",min),this}toJSON(){if(this.runRequiredValidations(),this.autocomplete&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return{...this}}},"SlashCommandNumberOption");__name2(SlashCommandNumberOption,"SlashCommandNumberOption"),SlashCommandNumberOption=__decorateClass([(0,import_ts_mixer3.mix)(ApplicationCommandNumericOptionMinMaxValueMixin,ApplicationCommandOptionWithChoicesAndAutocompleteMixin)],SlashCommandNumberOption);var import_v1021=__webpack_require__2(26538),SlashCommandRoleOption=__name(class extends ApplicationCommandOptionBase{static#_=__name2(this,"SlashCommandRoleOption");type=import_v1021.ApplicationCommandOptionType.Role;toJSON(){return this.runRequiredValidations(),{...this}}},"SlashCommandRoleOption"),import_shapeshift10=__webpack_require__2(2409),import_v1022=__webpack_require__2(26538),import_ts_mixer4=__webpack_require__2(92688),minLengthValidator2=import_shapeshift10.s.number.greaterThanOrEqual(0).lessThanOrEqual(6e3),maxLengthValidator2=import_shapeshift10.s.number.greaterThanOrEqual(1).lessThanOrEqual(6e3),SlashCommandStringOption=__name(class extends ApplicationCommandOptionBase{type=import_v1022.ApplicationCommandOptionType.String;max_length;min_length;setMaxLength(max){return maxLengthValidator2.parse(max),Reflect.set(this,"max_length",max),this}setMinLength(min){return minLengthValidator2.parse(min),Reflect.set(this,"min_length",min),this}toJSON(){if(this.runRequiredValidations(),this.autocomplete&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return{...this}}},"SlashCommandStringOption");__name2(SlashCommandStringOption,"SlashCommandStringOption"),SlashCommandStringOption=__decorateClass([(0,import_ts_mixer4.mix)(ApplicationCommandOptionWithChoicesAndAutocompleteMixin)],SlashCommandStringOption);var import_v1023=__webpack_require__2(26538),SlashCommandUserOption=__name(class extends ApplicationCommandOptionBase{static#_=__name2(this,"SlashCommandUserOption");type=import_v1023.ApplicationCommandOptionType.User;toJSON(){return this.runRequiredValidations(),{...this}}},"SlashCommandUserOption"),SharedSlashCommandOptions=__name(class{static#_=__name2(this,"SharedSlashCommandOptions");options;addBooleanOption(input){return this._sharedAddOptionMethod(input,SlashCommandBooleanOption)}addUserOption(input){return this._sharedAddOptionMethod(input,SlashCommandUserOption)}addChannelOption(input){return this._sharedAddOptionMethod(input,SlashCommandChannelOption)}addRoleOption(input){return this._sharedAddOptionMethod(input,SlashCommandRoleOption)}addAttachmentOption(input){return this._sharedAddOptionMethod(input,SlashCommandAttachmentOption)}addMentionableOption(input){return this._sharedAddOptionMethod(input,SlashCommandMentionableOption)}addStringOption(input){return this._sharedAddOptionMethod(input,SlashCommandStringOption)}addIntegerOption(input){return this._sharedAddOptionMethod(input,SlashCommandIntegerOption)}addNumberOption(input){return this._sharedAddOptionMethod(input,SlashCommandNumberOption)}_sharedAddOptionMethod(input,Instance){const{options}=this;validateMaxOptionsLength(options);const result="function"==typeof input?input(new Instance):input;return assertReturnOfBuilder(result,Instance),options.push(result),this}},"SharedSlashCommandOptions"),SlashCommandSubcommandGroupBuilder=__name(class{name=void 0;description=void 0;options=[];addSubcommand(input){const{options}=this;validateMaxOptionsLength(options);const result="function"==typeof input?input(new SlashCommandSubcommandBuilder):input;return assertReturnOfBuilder(result,SlashCommandSubcommandBuilder),options.push(result),this}toJSON(){return validateRequiredParameters3(this.name,this.description,this.options),{type:import_v1024.ApplicationCommandOptionType.SubcommandGroup,name:this.name,name_localizations:this.name_localizations,description:this.description,description_localizations:this.description_localizations,options:this.options.map(option=>option.toJSON())}}},"SlashCommandSubcommandGroupBuilder");__name2(SlashCommandSubcommandGroupBuilder,"SlashCommandSubcommandGroupBuilder"),SlashCommandSubcommandGroupBuilder=__decorateClass([(0,import_ts_mixer5.mix)(SharedNameAndDescription)],SlashCommandSubcommandGroupBuilder);var SlashCommandSubcommandBuilder=__name(class{name=void 0;description=void 0;options=[];toJSON(){return validateRequiredParameters3(this.name,this.description,this.options),{type:import_v1024.ApplicationCommandOptionType.Subcommand,name:this.name,name_localizations:this.name_localizations,description:this.description,description_localizations:this.description_localizations,options:this.options.map(option=>option.toJSON())}}},"SlashCommandSubcommandBuilder");__name2(SlashCommandSubcommandBuilder,"SlashCommandSubcommandBuilder"),SlashCommandSubcommandBuilder=__decorateClass([(0,import_ts_mixer5.mix)(SharedNameAndDescription,SharedSlashCommandOptions)],SlashCommandSubcommandBuilder);var SlashCommandBuilder=__name(class{name=void 0;name_localizations;description=void 0;description_localizations;options=[];default_permission=void 0;default_member_permissions=void 0;dm_permission=void 0;nsfw=void 0;setDefaultPermission(value){return validateDefaultPermission(value),Reflect.set(this,"default_permission",value),this}setDefaultMemberPermissions(permissions){const permissionValue=validateDefaultMemberPermissions(permissions);return Reflect.set(this,"default_member_permissions",permissionValue),this}setDMPermission(enabled){return validateDMPermission(enabled),Reflect.set(this,"dm_permission",enabled),this}setNSFW(nsfw=!0){return validateNSFW(nsfw),Reflect.set(this,"nsfw",nsfw),this}addSubcommandGroup(input){const{options}=this;validateMaxOptionsLength(options);const result="function"==typeof input?input(new SlashCommandSubcommandGroupBuilder):input;return assertReturnOfBuilder(result,SlashCommandSubcommandGroupBuilder),options.push(result),this}addSubcommand(input){const{options}=this;validateMaxOptionsLength(options);const result="function"==typeof input?input(new SlashCommandSubcommandBuilder):input;return assertReturnOfBuilder(result,SlashCommandSubcommandBuilder),options.push(result),this}toJSON(){return validateRequiredParameters3(this.name,this.description,this.options),validateLocalizationMap(this.name_localizations),validateLocalizationMap(this.description_localizations),{...this,options:this.options.map(option=>option.toJSON())}}},"SlashCommandBuilder");__name2(SlashCommandBuilder,"SlashCommandBuilder"),SlashCommandBuilder=__decorateClass([(0,import_ts_mixer6.mix)(SharedSlashCommandOptions,SharedNameAndDescription)],SlashCommandBuilder);var Assertions_exports6={};__export(Assertions_exports6,{validateDMPermission:()=>validateDMPermission2,validateDefaultMemberPermissions:()=>validateDefaultMemberPermissions2,validateDefaultPermission:()=>validateDefaultPermission2,validateName:()=>validateName2,validateRequiredParameters:()=>validateRequiredParameters4,validateType:()=>validateType});var import_shapeshift11=__webpack_require__2(2409),import_v1025=__webpack_require__2(26538),namePredicate2=import_shapeshift11.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/^( *[\p{P}\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}]+ *)+$/u).setValidationEnabled(isValidationEnabled),typePredicate=import_shapeshift11.s.union(import_shapeshift11.s.literal(import_v1025.ApplicationCommandType.User),import_shapeshift11.s.literal(import_v1025.ApplicationCommandType.Message)).setValidationEnabled(isValidationEnabled),booleanPredicate3=import_shapeshift11.s.boolean;function validateDefaultPermission2(value){booleanPredicate3.parse(value)}function validateName2(name){namePredicate2.parse(name)}function validateType(type){typePredicate.parse(type)}function validateRequiredParameters4(name,type){validateName2(name),validateType(type)}__name(validateDefaultPermission2,"validateDefaultPermission2"),__name2(validateDefaultPermission2,"validateDefaultPermission"),__name(validateName2,"validateName2"),__name2(validateName2,"validateName"),__name(validateType,"validateType"),__name2(validateType,"validateType"),__name(validateRequiredParameters4,"validateRequiredParameters4"),__name2(validateRequiredParameters4,"validateRequiredParameters");var dmPermissionPredicate2=import_shapeshift11.s.boolean.nullish;function validateDMPermission2(value){dmPermissionPredicate2.parse(value)}__name(validateDMPermission2,"validateDMPermission2"),__name2(validateDMPermission2,"validateDMPermission");var memberPermissionPredicate2=import_shapeshift11.s.union(import_shapeshift11.s.bigint.transform(value=>value.toString()),import_shapeshift11.s.number.safeInt.transform(value=>value.toString()),import_shapeshift11.s.string.regex(/^\d+$/)).nullish;function validateDefaultMemberPermissions2(permissions){return memberPermissionPredicate2.parse(permissions)}__name(validateDefaultMemberPermissions2,"validateDefaultMemberPermissions2"),__name2(validateDefaultMemberPermissions2,"validateDefaultMemberPermissions");var ContextMenuCommandBuilder=__name(class{static#_=__name2(this,"ContextMenuCommandBuilder");name=void 0;name_localizations;type=void 0;default_permission=void 0;default_member_permissions=void 0;dm_permission=void 0;setName(name){return validateName2(name),Reflect.set(this,"name",name),this}setType(type){return validateType(type),Reflect.set(this,"type",type),this}setDefaultPermission(value){return validateDefaultPermission2(value),Reflect.set(this,"default_permission",value),this}setDefaultMemberPermissions(permissions){const permissionValue=validateDefaultMemberPermissions2(permissions);return Reflect.set(this,"default_member_permissions",permissionValue),this}setDMPermission(enabled){return validateDMPermission2(enabled),Reflect.set(this,"dm_permission",enabled),this}setNameLocalization(locale,localizedName){this.name_localizations||Reflect.set(this,"name_localizations",{});const parsedLocale=validateLocale(locale);return null===localizedName?(this.name_localizations[parsedLocale]=null,this):(validateName2(localizedName),this.name_localizations[parsedLocale]=localizedName,this)}setNameLocalizations(localizedNames){if(null===localizedNames)return Reflect.set(this,"name_localizations",null),this;Reflect.set(this,"name_localizations",{});for(const args2 of Object.entries(localizedNames))this.setNameLocalization(...args2);return this}toJSON(){return validateRequiredParameters4(this.name,this.type),validateLocalizationMap(this.name_localizations),{...this}}},"ContextMenuCommandBuilder");function embedLength(data){return(data.title?.length??0)+(data.description?.length??0)+(data.fields?.reduce((prev,curr)=>prev+curr.name.length+curr.value.length,0)??0)+(data.footer?.text.length??0)+(data.author?.name.length??0)}__name(embedLength,"embedLength"),__name2(embedLength,"embedLength");var version="1.6.5"},9667:module2=>{"use strict";var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__defNormalProp=__name((obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__name2=__name((target,value)=>__defProp2(target,"name",{value,configurable:!0}),"__name"),__export=__name((target,all)=>{for(var name in all)__defProp2(target,name,{get:all[name],enumerable:!0})},"__export"),__copyProps=__name((to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp2(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},"__copyProps"),__toCommonJS=__name(mod=>__copyProps(__defProp2({},"__esModule",{value:!0}),mod),"__toCommonJS"),__publicField=__name((obj,key,value)=>(__defNormalProp(obj,"symbol"!=typeof key?key+"":key,value),value),"__publicField"),src_exports={};__export(src_exports,{Collection:()=>Collection,default:()=>src_default}),module2.exports=__toCommonJS(src_exports);var _Collection=__name(class extends Map{ensure(key,defaultValueGenerator){if(this.has(key))return this.get(key);const defaultValue=defaultValueGenerator(key,this);return this.set(key,defaultValue),defaultValue}hasAll(...keys){return keys.every(k=>super.has(k))}hasAny(...keys){return keys.some(k=>super.has(k))}first(amount){if(typeof amount>"u")return this.values().next().value;if(amount<0)return this.last(-1*amount);amount=Math.min(this.size,amount);const iter=this.values();return Array.from({length:amount},()=>iter.next().value)}firstKey(amount){if(typeof amount>"u")return this.keys().next().value;if(amount<0)return this.lastKey(-1*amount);amount=Math.min(this.size,amount);const iter=this.keys();return Array.from({length:amount},()=>iter.next().value)}last(amount){const arr=[...this.values()];return typeof amount>"u"?arr[arr.length-1]:amount<0?this.first(-1*amount):amount?arr.slice(-amount):[]}lastKey(amount){const arr=[...this.keys()];return typeof amount>"u"?arr[arr.length-1]:amount<0?this.firstKey(-1*amount):amount?arr.slice(-amount):[]}at(index){return index=Math.floor(index),[...this.values()].at(index)}keyAt(index){return index=Math.floor(index),[...this.keys()].at(index)}random(amount){const arr=[...this.values()];return typeof amount>"u"?arr[Math.floor(Math.random()*arr.length)]:arr.length&&amount?Array.from({length:Math.min(amount,arr.length)},()=>arr.splice(Math.floor(Math.random()*arr.length),1)[0]):[]}randomKey(amount){const arr=[...this.keys()];return typeof amount>"u"?arr[Math.floor(Math.random()*arr.length)]:arr.length&&amount?Array.from({length:Math.min(amount,arr.length)},()=>arr.splice(Math.floor(Math.random()*arr.length),1)[0]):[]}reverse(){const entries=[...this.entries()].reverse();this.clear();for(const[key,value]of entries)this.set(key,value);return this}find(fn2,thisArg){typeof thisArg<"u"&&(fn2=fn2.bind(thisArg));for(const[key,val]of this)if(fn2(val,key,this))return val}findKey(fn2,thisArg){typeof thisArg<"u"&&(fn2=fn2.bind(thisArg));for(const[key,val]of this)if(fn2(val,key,this))return key}sweep(fn2,thisArg){typeof thisArg<"u"&&(fn2=fn2.bind(thisArg));const previousSize=this.size;for(const[key,val]of this)fn2(val,key,this)&&this.delete(key);return previousSize-this.size}filter(fn2,thisArg){typeof thisArg<"u"&&(fn2=fn2.bind(thisArg));const results=new this.constructor[Symbol.species];for(const[key,val]of this)fn2(val,key,this)&&results.set(key,val);return results}partition(fn2,thisArg){typeof thisArg<"u"&&(fn2=fn2.bind(thisArg));const results=[new this.constructor[Symbol.species],new this.constructor[Symbol.species]];for(const[key,val]of this)fn2(val,key,this)?results[0].set(key,val):results[1].set(key,val);return results}flatMap(fn2,thisArg){const collections=this.map(fn2,thisArg);return(new this.constructor[Symbol.species]).concat(...collections)}map(fn2,thisArg){typeof thisArg<"u"&&(fn2=fn2.bind(thisArg));const iter=this.entries();return Array.from({length:this.size},()=>{const[key,value]=iter.next().value;return fn2(value,key,this)})}mapValues(fn2,thisArg){typeof thisArg<"u"&&(fn2=fn2.bind(thisArg));const coll=new this.constructor[Symbol.species];for(const[key,val]of this)coll.set(key,fn2(val,key,this));return coll}some(fn2,thisArg){typeof thisArg<"u"&&(fn2=fn2.bind(thisArg));for(const[key,val]of this)if(fn2(val,key,this))return!0;return!1}every(fn2,thisArg){typeof thisArg<"u"&&(fn2=fn2.bind(thisArg));for(const[key,val]of this)if(!fn2(val,key,this))return!1;return!0}reduce(fn2,initialValue){let accumulator;if(typeof initialValue<"u"){accumulator=initialValue;for(const[key,val]of this)accumulator=fn2(accumulator,val,key,this);return accumulator}let first=!0;for(const[key,val]of this)first?(accumulator=val,first=!1):accumulator=fn2(accumulator,val,key,this);if(first)throw new TypeError("Reduce of empty collection with no initial value");return accumulator}each(fn2,thisArg){return this.forEach(fn2,thisArg),this}tap(fn2,thisArg){return typeof thisArg<"u"&&(fn2=fn2.bind(thisArg)),fn2(this),this}clone(){return new this.constructor[Symbol.species](this)}concat(...collections){const newColl=this.clone();for(const coll of collections)for(const[key,val]of coll)newColl.set(key,val);return newColl}equals(collection){if(!collection)return!1;if(this===collection)return!0;if(this.size!==collection.size)return!1;for(const[key,value]of this)if(!collection.has(key)||value!==collection.get(key))return!1;return!0}sort(compareFunction=_Collection.defaultSort){const entries=[...this.entries()];entries.sort((a,b2)=>compareFunction(a[1],b2[1],a[0],b2[0])),super.clear();for(const[k,v]of entries)super.set(k,v);return this}intersect(other){const coll=new this.constructor[Symbol.species];for(const[k,v]of other)this.has(k)&&Object.is(v,this.get(k))&&coll.set(k,v);return coll}difference(other){const coll=new this.constructor[Symbol.species];for(const[k,v]of other)this.has(k)||coll.set(k,v);for(const[k,v]of this)other.has(k)||coll.set(k,v);return coll}merge(other,whenInSelf,whenInOther,whenInBoth){const coll=new this.constructor[Symbol.species],keys=new Set([...this.keys(),...other.keys()]);for(const k of keys){const hasInSelf=this.has(k),hasInOther=other.has(k);if(hasInSelf&&hasInOther){const r=whenInBoth(this.get(k),other.get(k),k);r.keep&&coll.set(k,r.value)}else if(hasInSelf){const r=whenInSelf(this.get(k),k);r.keep&&coll.set(k,r.value)}else if(hasInOther){const r=whenInOther(other.get(k),k);r.keep&&coll.set(k,r.value)}}return coll}sorted(compareFunction=_Collection.defaultSort){return new this.constructor[Symbol.species](this).sort((av,bv,ak,bk)=>compareFunction(av,bv,ak,bk))}toJSON(){return[...this.values()]}static defaultSort(firstValue,secondValue){return Number(firstValue>secondValue)||Number(firstValue===secondValue)-1}static combineEntries(entries,combine){const coll=new _Collection;for(const[k,v]of entries)coll.has(k)?coll.set(k,combine(coll.get(k),v,k)):coll.set(k,v);return coll}},"_Collection"),Collection=_Collection;__name2(Collection,"Collection"),__publicField(Collection,"default",_Collection);var src_default=Collection},5806:module2=>{"use strict";var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__name2=__name((target,value)=>__defProp2(target,"name",{value,configurable:!0}),"__name"),__export=__name((target,all)=>{for(var name in all)__defProp2(target,name,{get:all[name],enumerable:!0})},"__export"),__copyProps=__name((to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp2(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},"__copyProps"),__toCommonJS=__name(mod=>__copyProps(__defProp2({},"__esModule",{value:!0}),mod),"__toCommonJS"),src_exports={};function escapeMarkdown(text,options={}){const{codeBlock:codeBlock2=!0,inlineCode:inlineCode2=!0,bold:bold2=!0,italic:italic2=!0,underline=!0,strikethrough:strikethrough2=!0,spoiler:spoiler2=!0,codeBlockContent=!0,inlineCodeContent=!0,escape:escape2=!0,heading=!1,bulletedList=!1,numberedList=!1,maskedLink=!1}=options;if(!codeBlockContent)return text.split("```").map((subString,index,array)=>index%2&&index!==array.length-1?subString:escapeMarkdown(subString,{inlineCode:inlineCode2,bold:bold2,italic:italic2,underline,strikethrough:strikethrough2,spoiler:spoiler2,inlineCodeContent,escape:escape2,heading,bulletedList,numberedList,maskedLink})).join(codeBlock2?"\\`\\`\\`":"```");if(!inlineCodeContent)return text.split(new RegExp("(?<=^|[^`])`(?=[^`]|$)","g")).map((subString,index,array)=>index%2&&index!==array.length-1?subString:escapeMarkdown(subString,{codeBlock:codeBlock2,bold:bold2,italic:italic2,underline,strikethrough:strikethrough2,spoiler:spoiler2,escape:escape2,heading,bulletedList,numberedList,maskedLink})).join(inlineCode2?"\\`":"`");let res=text;return escape2&&(res=escapeEscape(res)),inlineCode2&&(res=escapeInlineCode(res)),codeBlock2&&(res=escapeCodeBlock(res)),italic2&&(res=escapeItalic(res)),bold2&&(res=escapeBold(res)),underline&&(res=escapeUnderline(res)),strikethrough2&&(res=escapeStrikethrough(res)),spoiler2&&(res=escapeSpoiler(res)),heading&&(res=escapeHeading(res)),bulletedList&&(res=escapeBulletedList(res)),numberedList&&(res=escapeNumberedList(res)),maskedLink&&(res=escapeMaskedLink(res)),res}function escapeCodeBlock(text){return text.replaceAll("```","\\`\\`\\`")}function escapeInlineCode(text){return text.replaceAll(new RegExp("(?<=^|[^`])``?(?=[^`]|$)","g"),match=>2===match.length?"\\`\\`":"\\`")}function escapeItalic(text){let idx=0;const newText=text.replaceAll(new RegExp("(?<=^|[^*])\\*([^*]|\\*\\*|$)","g"),(_,match)=>"**"===match?++idx%2?`\\*${match}`:`${match}\\*`:`\\*${match}`);return idx=0,newText.replaceAll(new RegExp("(?<=^|[^_])(?)([^_]|__|$)","g"),(_,match)=>"__"===match?++idx%2?`\\_${match}`:`${match}\\_`:`\\_${match}`)}function escapeBold(text){let idx=0;return text.replaceAll(/\*\*(\*)?/g,(_,match)=>match?++idx%2?`${match}\\*\\*`:`\\*\\*${match}`:"\\*\\*")}function escapeUnderline(text){let idx=0;return text.replaceAll(new RegExp("(?)","g"),(_,match)=>match?++idx%2?`${match}\\_\\_`:`\\_\\_${match}`:"\\_\\_")}function escapeStrikethrough(text){return text.replaceAll("~~","\\~\\~")}function escapeSpoiler(text){return text.replaceAll("||","\\|\\|")}function escapeEscape(text){return text.replaceAll("\\","\\\\")}function escapeHeading(text){return text.replaceAll(/^( {0,2})([*-] )?( *)(#{1,3} )/gm,"$1$2$3\\$4")}function escapeBulletedList(text){return text.replaceAll(/^( *)([*-])( +)/gm,"$1\\$2$3")}function escapeNumberedList(text){return text.replaceAll(/^( *\d+)\./gm,"$1\\.")}function escapeMaskedLink(text){return text.replaceAll(/\[.+]\(.+\)/gm,"\\$&")}function codeBlock(language,content){return void 0===content?`\`\`\`\n${language}\n\`\`\``:`\`\`\`${language}\n${content}\n\`\`\``}function inlineCode(content){return`\`${content}\``}function italic(content){return`_${content}_`}function bold(content){return`**${content}**`}function underscore(content){return`__${content}__`}function strikethrough(content){return`~~${content}~~`}function quote(content){return`> ${content}`}function blockQuote(content){return`>>> ${content}`}function hideLinkEmbed(url){return`<${url}>`}function hyperlink(content,url,title){return title?`[${content}](${url} "${title}")`:`[${content}](${url})`}function spoiler(content){return`||${content}||`}function userMention(userId){return`<@${userId}>`}function channelMention(channelId){return`<#${channelId}>`}function roleMention(roleId){return`<@&${roleId}>`}function chatInputApplicationCommandMention(commandName,subcommandGroupName,subcommandName,commandId){return void 0!==commandId?``:void 0!==subcommandName?``:``}function formatEmoji(emojiId,animated=!1){return`<${animated?"a":""}:_:${emojiId}>`}function channelLink(channelId,guildId){return`https://discord.com/channels/${guildId??"@me"}/${channelId}`}function messageLink(channelId,messageId,guildId){return`${void 0===guildId?channelLink(channelId):channelLink(channelId,guildId)}/${messageId}`}function time(timeOrSeconds,style){return"number"!=typeof timeOrSeconds&&(timeOrSeconds=Math.floor((timeOrSeconds?.getTime()??Date.now())/1e3)),"string"==typeof style?``:``}__export(src_exports,{Faces:()=>Faces,TimestampStyles:()=>TimestampStyles,blockQuote:()=>blockQuote,bold:()=>bold,channelLink:()=>channelLink,channelMention:()=>channelMention,chatInputApplicationCommandMention:()=>chatInputApplicationCommandMention,codeBlock:()=>codeBlock,escapeBold:()=>escapeBold,escapeBulletedList:()=>escapeBulletedList,escapeCodeBlock:()=>escapeCodeBlock,escapeEscape:()=>escapeEscape,escapeHeading:()=>escapeHeading,escapeInlineCode:()=>escapeInlineCode,escapeItalic:()=>escapeItalic,escapeMarkdown:()=>escapeMarkdown,escapeMaskedLink:()=>escapeMaskedLink,escapeNumberedList:()=>escapeNumberedList,escapeSpoiler:()=>escapeSpoiler,escapeStrikethrough:()=>escapeStrikethrough,escapeUnderline:()=>escapeUnderline,formatEmoji:()=>formatEmoji,hideLinkEmbed:()=>hideLinkEmbed,hyperlink:()=>hyperlink,inlineCode:()=>inlineCode,italic:()=>italic,messageLink:()=>messageLink,quote:()=>quote,roleMention:()=>roleMention,spoiler:()=>spoiler,strikethrough:()=>strikethrough,time:()=>time,underscore:()=>underscore,userMention:()=>userMention}),module2.exports=__toCommonJS(src_exports),__name(escapeMarkdown,"escapeMarkdown"),__name2(escapeMarkdown,"escapeMarkdown"),__name(escapeCodeBlock,"escapeCodeBlock"),__name2(escapeCodeBlock,"escapeCodeBlock"),__name(escapeInlineCode,"escapeInlineCode"),__name2(escapeInlineCode,"escapeInlineCode"),__name(escapeItalic,"escapeItalic"),__name2(escapeItalic,"escapeItalic"),__name(escapeBold,"escapeBold"),__name2(escapeBold,"escapeBold"),__name(escapeUnderline,"escapeUnderline"),__name2(escapeUnderline,"escapeUnderline"),__name(escapeStrikethrough,"escapeStrikethrough"),__name2(escapeStrikethrough,"escapeStrikethrough"),__name(escapeSpoiler,"escapeSpoiler"),__name2(escapeSpoiler,"escapeSpoiler"),__name(escapeEscape,"escapeEscape"),__name2(escapeEscape,"escapeEscape"),__name(escapeHeading,"escapeHeading"),__name2(escapeHeading,"escapeHeading"),__name(escapeBulletedList,"escapeBulletedList"),__name2(escapeBulletedList,"escapeBulletedList"),__name(escapeNumberedList,"escapeNumberedList"),__name2(escapeNumberedList,"escapeNumberedList"),__name(escapeMaskedLink,"escapeMaskedLink"),__name2(escapeMaskedLink,"escapeMaskedLink"),__name(codeBlock,"codeBlock"),__name2(codeBlock,"codeBlock"),__name(inlineCode,"inlineCode"),__name2(inlineCode,"inlineCode"),__name(italic,"italic"),__name2(italic,"italic"),__name(bold,"bold"),__name2(bold,"bold"),__name(underscore,"underscore"),__name2(underscore,"underscore"),__name(strikethrough,"strikethrough"),__name2(strikethrough,"strikethrough"),__name(quote,"quote"),__name2(quote,"quote"),__name(blockQuote,"blockQuote"),__name2(blockQuote,"blockQuote"),__name(hideLinkEmbed,"hideLinkEmbed"),__name2(hideLinkEmbed,"hideLinkEmbed"),__name(hyperlink,"hyperlink"),__name2(hyperlink,"hyperlink"),__name(spoiler,"spoiler"),__name2(spoiler,"spoiler"),__name(userMention,"userMention"),__name2(userMention,"userMention"),__name(channelMention,"channelMention"),__name2(channelMention,"channelMention"),__name(roleMention,"roleMention"),__name2(roleMention,"roleMention"),__name(chatInputApplicationCommandMention,"chatInputApplicationCommandMention"),__name2(chatInputApplicationCommandMention,"chatInputApplicationCommandMention"),__name(formatEmoji,"formatEmoji"),__name2(formatEmoji,"formatEmoji"),__name(channelLink,"channelLink"),__name2(channelLink,"channelLink"),__name(messageLink,"messageLink"),__name2(messageLink,"messageLink"),__name(time,"time"),__name2(time,"time");var TimestampStyles={ShortTime:"t",LongTime:"T",ShortDate:"d",LongDate:"D",ShortDateTime:"f",LongDateTime:"F",RelativeTime:"R"},Faces=(Faces2=>(Faces2.Shrug="\xaf_(\u30c4)_/\xaf",Faces2.Tableflip="(\u256f\xb0\u25a1\xb0)\u256f\ufe35 \u253b\u2501\u253b",Faces2.Unflip="\u252c\u2500\u252c\u30ce( \xba _ \xba\u30ce)",Faces2))(Faces||{})},62741:(module2,__unused_webpack_exports2,__webpack_require__2)=>{"use strict";var _asyncToGenerator=__webpack_require__2(17156).default,__create=Object.create,__defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__defNormalProp=__name((obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__name2=__name((target,value)=>__defProp2(target,"name",{value,configurable:!0}),"__name"),__commonJS=__name((cb,mod)=>__name(function(){return mod||(0,cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports},"__require"),"__commonJS"),__export=__name((target,all)=>{for(var name in all)__defProp2(target,name,{get:all[name],enumerable:!0})},"__export"),__copyProps=__name((to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp2(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},"__copyProps"),__toESM=__name((mod,isNodeMode,target)=>(target=null!=mod?__create(__getProtoOf(mod)):{},__copyProps(!isNodeMode&&mod&&mod.__esModule?target:__defProp2(target,"default",{value:mod,enumerable:!0}),mod)),"__toESM"),__toCommonJS=__name(mod=>__copyProps(__defProp2({},"__esModule",{value:!0}),mod),"__toCommonJS"),__publicField=__name((obj,key,value)=>(__defNormalProp(obj,"symbol"!=typeof key?key+"":key,value),value),"__publicField"),__accessCheck=__name((obj,member,msg)=>{if(!member.has(obj))throw TypeError("Cannot "+msg)},"__accessCheck"),__privateGet=__name((obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),"__privateGet"),__privateAdd=__name((obj,member,value)=>{if(member.has(obj))throw TypeError("Cannot add the same private member more than once");member instanceof WeakSet?member.add(obj):member.set(obj,value)},"__privateAdd"),__privateSet=__name((obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),"__privateSet"),require_package=__commonJS({"package.json"(exports2,module22){module22.exports={name:"@discordjs/rest",version:"0.4.0",description:"The REST API for discord.js",scripts:{build:"tsup && tsc --emitDeclarationOnly --incremental",test:"jest --pass-with-no-tests --collect-coverage",lint:"prettier --check . && eslint src __tests__ --ext mjs,js,ts",format:"prettier --write . && eslint src __tests__ --ext mjs,js,ts --fix",docs:"typedoc --json docs/typedoc-out.json src/index.ts && node scripts/docs.mjs",prepublishOnly:"yarn build && yarn lint && yarn test",changelog:"git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/rest/*'"},main:"./dist/index.js",module:"./dist/index.mjs",typings:"./dist/index.d.ts",exports:{import:"./dist/index.mjs",require:"./dist/index.js",types:"./dist/index.d.ts"},directories:{lib:"src",test:"__tests__"},files:["dist"],contributors:["Crawl ","Amish Shah ","SpaceEEC ","Vlad Frangu ","Antonio Roman "],license:"Apache-2.0",keywords:["discord","api","rest","discordapp","discordjs"],repository:{type:"git",url:"git+https://github.com/discordjs/discord.js.git"},bugs:{url:"https://github.com/discordjs/discord.js/issues"},homepage:"https://discord.js.org",dependencies:{"@discordjs/collection":"workspace:^","@sapphire/async-queue":"^1.3.1","@sapphire/snowflake":"^3.2.1","@types/node-fetch":"^2.6.1","discord-api-types":"^0.29.0","form-data":"^4.0.0","node-fetch":"^2.6.7",tslib:"^2.3.1"},devDependencies:{"@babel/core":"^7.17.9","@babel/plugin-proposal-decorators":"^7.17.9","@babel/preset-env":"^7.16.11","@babel/preset-typescript":"^7.16.7","@discordjs/ts-docgen":"^0.4.1","@types/jest":"^27.4.1","@typescript-eslint/eslint-plugin":"^5.19.0","@typescript-eslint/parser":"^5.19.0","babel-plugin-const-enum":"^1.2.0","babel-plugin-transform-typescript-metadata":"^0.3.2",eslint:"^8.13.0","eslint-config-marine":"^9.4.1","eslint-config-prettier":"^8.5.0","eslint-plugin-import":"^2.26.0",jest:"^27.5.1",nock:"^13.2.4",prettier:"^2.6.2",tsup:"^5.12.5",typedoc:"^0.22.15",typescript:"^4.6.3"},engines:{node:">=16.9.0"},publishConfig:{access:"public"}}}}),src_exports={};__export(src_exports,{ALLOWED_EXTENSIONS:()=>ALLOWED_EXTENSIONS,ALLOWED_SIZES:()=>ALLOWED_SIZES,ALLOWED_STICKER_EXTENSIONS:()=>ALLOWED_STICKER_EXTENSIONS,CDN:()=>CDN,DefaultRestOptions:()=>DefaultRestOptions,DefaultUserAgent:()=>DefaultUserAgent,DiscordAPIError:()=>DiscordAPIError,HTTPError:()=>HTTPError,REST:()=>REST,RESTEvents:()=>RESTEvents,RateLimitError:()=>RateLimitError,RequestManager:()=>RequestManager,RequestMethod:()=>RequestMethod,makeURLSearchParams:()=>makeURLSearchParams}),module2.exports=__toCommonJS(src_exports);var import_v10=__webpack_require__2(71622),Package=require_package(),DefaultUserAgent=`DiscordBot (${Package.homepage}, ${Package.version})`,DefaultRestOptions={agent:{},api:"https://discord.com/api",cdn:"https://cdn.discordapp.com",headers:{},invalidRequestWarningInterval:0,globalRequestsPerSecond:50,offset:50,rejectOnRateLimit:null,retries:3,timeout:15e3,userAgentAppendix:`Node.js ${process.version}`,version:import_v10.APIVersion,hashSweepInterval:144e5,hashLifetime:864e5,handlerSweepInterval:36e5},RESTEvents=(RESTEvents2=>(RESTEvents2.Debug="restDebug",RESTEvents2.InvalidRequestWarning="invalidRequestWarning",RESTEvents2.RateLimited="rateLimited",RESTEvents2.Request="request",RESTEvents2.Response="response",RESTEvents2.HashSweep="hashSweep",RESTEvents2.HandlerSweep="handlerSweep",RESTEvents2))(RESTEvents||{}),ALLOWED_EXTENSIONS=["webp","png","jpg","jpeg","gif"],ALLOWED_STICKER_EXTENSIONS=["png","json"],ALLOWED_SIZES=[16,32,64,128,256,512,1024,2048,4096],CDN=__name(class{constructor(base=DefaultRestOptions.cdn){this.base=base}appAsset(clientId,assetHash,options){return this.makeURL(`/app-assets/${clientId}/${assetHash}`,options)}appIcon(clientId,iconHash,options){return this.makeURL(`/app-icons/${clientId}/${iconHash}`,options)}avatar(id,avatarHash,options){return this.dynamicMakeURL(`/avatars/${id}/${avatarHash}`,avatarHash,options)}banner(id,bannerHash,options){return this.dynamicMakeURL(`/banners/${id}/${bannerHash}`,bannerHash,options)}channelIcon(channelId,iconHash,options){return this.makeURL(`/channel-icons/${channelId}/${iconHash}`,options)}defaultAvatar(discriminator){return this.makeURL(`/embed/avatars/${discriminator}`,{extension:"png"})}discoverySplash(guildId,splashHash,options){return this.makeURL(`/discovery-splashes/${guildId}/${splashHash}`,options)}emoji(emojiId,extension){return this.makeURL(`/emojis/${emojiId}`,{extension})}guildMemberAvatar(guildId,userId,avatarHash,options){return this.dynamicMakeURL(`/guilds/${guildId}/users/${userId}/avatars/${avatarHash}`,avatarHash,options)}icon(id,iconHash,options){return this.dynamicMakeURL(`/icons/${id}/${iconHash}`,iconHash,options)}roleIcon(roleId,roleIconHash,options){return this.makeURL(`/role-icons/${roleId}/${roleIconHash}`,options)}splash(guildId,splashHash,options){return this.makeURL(`/splashes/${guildId}/${splashHash}`,options)}sticker(stickerId,extension){return this.makeURL(`/stickers/${stickerId}`,{allowedExtensions:ALLOWED_STICKER_EXTENSIONS,extension:extension??"png"})}stickerPackBanner(bannerId,options){return this.makeURL(`/app-assets/710982414301790216/store/${bannerId}`,options)}teamIcon(teamId,iconHash,options){return this.makeURL(`/team-icons/${teamId}/${iconHash}`,options)}guildScheduledEventCover(scheduledEventId,coverHash,options){return this.makeURL(`/guild-events/${scheduledEventId}/${coverHash}`,options)}dynamicMakeURL(route,hash,{forceStatic=!1,...options}={}){return this.makeURL(route,!forceStatic&&hash.startsWith("a_")?{...options,extension:"gif"}:options)}makeURL(route,{allowedExtensions=ALLOWED_EXTENSIONS,extension="webp",size}={}){if(extension=String(extension).toLowerCase(),!allowedExtensions.includes(extension))throw new RangeError(`Invalid extension provided: ${extension}\nMust be one of: ${allowedExtensions.join(", ")}`);if(size&&!ALLOWED_SIZES.includes(size))throw new RangeError(`Invalid size provided: ${size}\nMust be one of: ${ALLOWED_SIZES.join(", ")}`);const url=new URL(`${this.base}${route}.${extension}`);return size&&url.searchParams.set("size",String(size)),url.toString()}},"CDN");function isErrorGroupWrapper(error){return Reflect.has(error,"_errors")}function isErrorResponse(error){return"string"==typeof Reflect.get(error,"message")}__name2(CDN,"CDN"),__name(isErrorGroupWrapper,"isErrorGroupWrapper"),__name2(isErrorGroupWrapper,"isErrorGroupWrapper"),__name(isErrorResponse,"isErrorResponse"),__name2(isErrorResponse,"isErrorResponse");var DiscordAPIError=__name(class extends Error{constructor(rawError,code2,status,method,url,bodyData){super(DiscordAPIError.getMessage(rawError)),this.rawError=rawError,this.code=code2,this.status=status,this.method=method,this.url=url,__publicField(this,"requestBody"),this.requestBody={files:bodyData.files,json:bodyData.body}}get name(){return`${DiscordAPIError.name}[${this.code}]`}static getMessage(error){let flattened="";return"code"in error?(error.errors&&(flattened=[...this.flattenDiscordError(error.errors)].join("\n")),error.message&&flattened?`${error.message}\n${flattened}`:error.message||flattened||"Unknown Error"):error.error_description??"No Description"}static*flattenDiscordError(obj,key=""){if(isErrorResponse(obj))return yield`${key.length?`${key}[${obj.code}]`:`${obj.code}`}: ${obj.message}`.trim();for(const[k,v]of Object.entries(obj)){const nextKey=k.startsWith("_")?key:key?Number.isNaN(Number(k))?`${key}.${k}`:`${key}[${k}]`:k;if("string"==typeof v)yield v;else if(isErrorGroupWrapper(v))for(const error of v._errors)yield*this.flattenDiscordError(error,nextKey);else yield*this.flattenDiscordError(v,nextKey)}}},"DiscordAPIError");__name2(DiscordAPIError,"DiscordAPIError");var HTTPError=__name(class extends Error{constructor(message2,name,status,method,url,bodyData){super(message2),this.name=name,this.status=status,this.method=method,this.url=url,__publicField(this,"requestBody"),this.requestBody={files:bodyData.files,json:bodyData.body}}},"HTTPError");__name2(HTTPError,"HTTPError");var RateLimitError=__name(class extends Error{constructor({timeToReset,limit,method,hash,url,route,majorParameter,global:global2}){super(),__publicField(this,"timeToReset"),__publicField(this,"limit"),__publicField(this,"method"),__publicField(this,"hash"),__publicField(this,"url"),__publicField(this,"route"),__publicField(this,"majorParameter"),__publicField(this,"global"),this.timeToReset=timeToReset,this.limit=limit,this.method=method,this.hash=hash,this.url=url,this.route=route,this.majorParameter=majorParameter,this.global=global2}get name(){return`${RateLimitError.name}[${this.route}]`}},"RateLimitError");__name2(RateLimitError,"RateLimitError");var import_node_events=__webpack_require__2(82361),import_node_http=__webpack_require__2(13685),import_node_https=__webpack_require__2(95687),import_collection=__toESM(__webpack_require__2(9667)),import_snowflake=__webpack_require__2(33534),import_form_data=__toESM(__webpack_require__2(81556)),import_promises=__webpack_require__2(68670),import_async_queue=__webpack_require__2(44904),import_node_fetch=__toESM(__webpack_require__2(84259));function serializeSearchParam(value){switch(typeof value){case"string":return value;case"number":case"bigint":case"boolean":return value.toString();case"object":return null===value?null:value instanceof Date?Number.isNaN(value.getTime())?null:value.toISOString():"function"==typeof value.toString&&value.toString!==Object.prototype.toString?value.toString():null;default:return null}}function makeURLSearchParams(options){const params=new URLSearchParams;if(!options)return params;for(const[key,value]of Object.entries(options)){const serialized=serializeSearchParam(value);null!==serialized&¶ms.append(key,serialized)}return params}function parseResponse(res){return res.headers.get("Content-Type")?.startsWith("application/json")?res.json():res.arrayBuffer()}function hasSublimit(bucketRoute,body,method){if("/channels/:id"===bucketRoute){if("object"!=typeof body||null===body||"patch"!==method)return!1;const castedBody=body;return["name","topic"].some(key=>Reflect.has(castedBody,key))}return!0}__name(serializeSearchParam,"serializeSearchParam"),__name2(serializeSearchParam,"serializeSearchParam"),__name(makeURLSearchParams,"makeURLSearchParams"),__name2(makeURLSearchParams,"makeURLSearchParams"),__name(parseResponse,"parseResponse"),__name2(parseResponse,"parseResponse"),__name(hasSublimit,"hasSublimit"),__name2(hasSublimit,"hasSublimit");var _asyncQueue,_sublimitedQueue,_sublimitPromise,_shiftSublimit,invalidCount=0,invalidCountResetTime=null,SequentialHandler=__name(class{constructor(manager,hash,majorParameter){this.manager=manager,this.hash=hash,this.majorParameter=majorParameter,__publicField(this,"id"),__publicField(this,"reset",-1),__publicField(this,"remaining",1),__publicField(this,"limit",1/0),__privateAdd(this,_asyncQueue,new import_async_queue.AsyncQueue),__privateAdd(this,_sublimitedQueue,null),__privateAdd(this,_sublimitPromise,null),__privateAdd(this,_shiftSublimit,!1),this.id=`${hash}:${majorParameter}`}get inactive(){return 0===__privateGet(this,_asyncQueue).remaining&&(null===__privateGet(this,_sublimitedQueue)||0===__privateGet(this,_sublimitedQueue).remaining)&&!this.limited}get globalLimited(){return this.manager.globalRemaining<=0&&Date.now()rateLimitData.route.startsWith(route.toLowerCase()))))throw new RateLimitError(rateLimitData)})()}queueRequest(routeId,url,options,requestData){var _this3=this;return _asyncToGenerator(function*(){let queue=__privateGet(_this3,_asyncQueue),queueType=0;if(__privateGet(_this3,_sublimitedQueue)&&hasSublimit(routeId.bucketRoute,requestData.body,options.method)&&(queue=__privateGet(_this3,_sublimitedQueue),queueType=1),yield queue.wait(),0===queueType)if(__privateGet(_this3,_sublimitedQueue)&&hasSublimit(routeId.bucketRoute,requestData.body,options.method)){queue=__privateGet(_this3,_sublimitedQueue);const wait=queue.wait();__privateGet(_this3,_asyncQueue).shift(),yield wait}else __privateGet(_this3,_sublimitPromise)&&(yield __privateGet(_this3,_sublimitPromise).promise);try{return yield _this3.runRequest(routeId,url,options,requestData)}finally{queue.shift(),__privateGet(_this3,_shiftSublimit)&&(__privateSet(_this3,_shiftSublimit,!1),__privateGet(_this3,_sublimitedQueue)?.shift()),0===__privateGet(_this3,_sublimitedQueue)?.remaining&&(__privateGet(_this3,_sublimitPromise)?.resolve(),__privateSet(_this3,_sublimitedQueue,null))}})()}runRequest(routeId,url,options,requestData,retries=0){var _this4=this;return _asyncToGenerator(function*(){for(;_this4.limited;){const isGlobal=_this4.globalLimited;let limit2,timeout2,delay;isGlobal?(limit2=_this4.manager.options.globalRequestsPerSecond,timeout2=_this4.manager.globalReset+_this4.manager.options.offset-Date.now(),_this4.manager.globalDelay||(_this4.manager.globalDelay=_this4.globalDelayFor(timeout2)),delay=_this4.manager.globalDelay):(limit2=_this4.limit,timeout2=_this4.timeToReset,delay=(0,import_promises.setTimeout)(timeout2));const rateLimitData={timeToReset:timeout2,limit:limit2,method:options.method??"get",hash:_this4.hash,url,route:routeId.bucketRoute,majorParameter:_this4.majorParameter,global:isGlobal};_this4.manager.emit("rateLimited",rateLimitData),yield _this4.onRateLimit(rateLimitData),isGlobal?_this4.debug(`Global rate limit hit, blocking all requests for ${timeout2}ms`):_this4.debug(`Waiting ${timeout2}ms for rate limit to pass`),yield delay}(!_this4.manager.globalReset||_this4.manager.globalResetcontroller.abort(),_this4.manager.options.timeout).unref();let res;try{res=yield(0,import_node_fetch.default)(url,{...options,signal:controller.signal})}catch(error){if(error instanceof Error&&"AbortError"===error.name&&retries!==_this4.manager.options.retries)return yield _this4.runRequest(routeId,url,options,requestData,++retries);throw error}finally{clearTimeout(timeout)}_this4.manager.listenerCount("response")&&_this4.manager.emit("response",{method,path:routeId.original,route:routeId.bucketRoute,options,data:requestData,retries},res.clone());let retryAfter=0;const limit=res.headers.get("X-RateLimit-Limit"),remaining=res.headers.get("X-RateLimit-Remaining"),reset=res.headers.get("X-RateLimit-Reset-After"),hash=res.headers.get("X-RateLimit-Bucket"),retry=res.headers.get("Retry-After");if(_this4.limit=limit?Number(limit):1/0,_this4.remaining=remaining?Number(remaining):1,_this4.reset=reset?1e3*Number(reset)+Date.now()+_this4.manager.options.offset:Date.now(),retry&&(retryAfter=1e3*Number(retry)+_this4.manager.options.offset),hash&&hash!==_this4.hash)_this4.debug(["Received bucket hash update",` Old Hash : ${_this4.hash}`,` New Hash : ${hash}`].join("\n")),_this4.manager.hashes.set(`${method}:${routeId.bucketRoute}`,{value:hash,lastAccess:Date.now()});else if(hash){const hashData=_this4.manager.hashes.get(`${method}:${routeId.bucketRoute}`);hashData&&(hashData.lastAccess=Date.now())}let sublimitTimeout=null;if(retryAfter>0&&(res.headers.get("X-RateLimit-Global")?(_this4.manager.globalRemaining=0,_this4.manager.globalReset=Date.now()+retryAfter):_this4.localLimited||(sublimitTimeout=retryAfter)),(401===res.status||403===res.status||429===res.status)&&((!invalidCountResetTime||invalidCountResetTime0&&invalidCount%_this4.manager.options.invalidRequestWarningInterval==0&&_this4.manager.emit("invalidRequestWarning",{count:invalidCount,remainingTime:invalidCountResetTime-Date.now()})),res.ok)return parseResponse(res);if(429===res.status){const isGlobal=_this4.globalLimited;let limit2,timeout2;if(isGlobal?(limit2=_this4.manager.options.globalRequestsPerSecond,timeout2=_this4.manager.globalReset+_this4.manager.options.offset-Date.now()):(limit2=_this4.limit,timeout2=_this4.timeToReset),yield _this4.onRateLimit({timeToReset:timeout2,limit:limit2,method,hash:_this4.hash,url,route:routeId.bucketRoute,majorParameter:_this4.majorParameter,global:isGlobal}),_this4.debug(["Encountered unexpected 429 rate limit",` Global : ${isGlobal.toString()}`,` Method : ${method}`,` URL : ${url}`,` Bucket : ${routeId.bucketRoute}`,` Major parameter: ${routeId.majorParameter}`,` Hash : ${_this4.hash}`,` Limit : ${limit2}`,` Retry After : ${retryAfter}ms`," Sublimit : "+(sublimitTimeout?`${sublimitTimeout}ms`:"None")].join("\n")),sublimitTimeout){const firstSublimit=!__privateGet(_this4,_sublimitedQueue);let resolve;firstSublimit&&(__privateSet(_this4,_sublimitedQueue,new import_async_queue.AsyncQueue),__privateGet(_this4,_sublimitedQueue).wait(),__privateGet(_this4,_asyncQueue).shift()),__privateGet(_this4,_sublimitPromise)?.resolve(),__privateSet(_this4,_sublimitPromise,null),yield(0,import_promises.setTimeout)(sublimitTimeout,void 0,{ref:!1});const promise=new Promise(res2=>resolve=res2);__privateSet(_this4,_sublimitPromise,{promise,resolve}),firstSublimit&&(yield __privateGet(_this4,_asyncQueue).wait(),__privateSet(_this4,_shiftSublimit,!0))}return _this4.runRequest(routeId,url,options,requestData,retries)}if(res.status>=500&&res.status<600){if(retries!==_this4.manager.options.retries)return _this4.runRequest(routeId,url,options,requestData,++retries);throw new HTTPError(res.statusText,res.constructor.name,res.status,method,url,requestData)}if(res.status>=400&&res.status<500){401===res.status&&requestData.auth&&_this4.manager.setToken(null);const data=yield parseResponse(res);throw new DiscordAPIError(data,"code"in data?data.code:data.error,res.status,method,url,requestData)}return null})()}},"SequentialHandler");__name2(SequentialHandler,"SequentialHandler"),_asyncQueue=new WeakMap,_sublimitedQueue=new WeakMap,_sublimitPromise=new WeakMap,_shiftSublimit=new WeakMap;var _token,RequestMethod=(RequestMethod2=>(RequestMethod2.Delete="delete",RequestMethod2.Get="get",RequestMethod2.Patch="patch",RequestMethod2.Post="post",RequestMethod2.Put="put",RequestMethod2))(RequestMethod||{}),_RequestManager=__name(class extends import_node_events.EventEmitter{constructor(options){super(),__publicField(this,"globalRemaining"),__publicField(this,"globalDelay",null),__publicField(this,"globalReset",-1),__publicField(this,"hashes",new import_collection.default),__publicField(this,"handlers",new import_collection.default),__privateAdd(this,_token,null),__publicField(this,"hashTimer"),__publicField(this,"handlerTimer"),__publicField(this,"agent",null),__publicField(this,"options"),this.options={...DefaultRestOptions,...options},this.options.offset=Math.max(0,this.options.offset),this.globalRemaining=this.options.globalRequestsPerSecond,this.setupSweepers()}setupSweepers(){const validateMaxInterval=__name2(interval=>{if(interval>144e5)throw new Error("Cannot set an interval greater than 4 hours")},"validateMaxInterval");0!==this.options.hashSweepInterval&&this.options.hashSweepInterval!==1/0&&(validateMaxInterval(this.options.hashSweepInterval),this.hashTimer=setInterval(()=>{const sweptHashes=new import_collection.default,currentDate=Date.now();this.hashes.sweep((v,k)=>{if(-1===v.lastAccess)return!1;const shouldSweep=Math.floor(currentDate-v.lastAccess)>this.options.hashLifetime;return shouldSweep&&sweptHashes.set(k,v),this.emit("restDebug",`Hash ${v.value} for ${k} swept due to lifetime being exceeded`),shouldSweep}),this.emit("hashSweep",sweptHashes)},this.options.hashSweepInterval).unref()),0!==this.options.handlerSweepInterval&&this.options.handlerSweepInterval!==1/0&&(validateMaxInterval(this.options.handlerSweepInterval),this.handlerTimer=setInterval(()=>{const sweptHandlers=new import_collection.default;this.handlers.sweep((v,k)=>{const{inactive}=v;return inactive&&sweptHandlers.set(k,v),this.emit("restDebug",`Handler ${v.id} for ${k} swept due to being inactive`),inactive}),this.emit("handlerSweep",sweptHandlers)},this.options.handlerSweepInterval).unref())}setToken(token){return __privateSet(this,_token,token),this}queueRequest(request){var _this5=this;return _asyncToGenerator(function*(){const routeId=_RequestManager.generateRouteData(request.fullRoute,request.method),hash=_this5.hashes.get(`${request.method}:${routeId.bucketRoute}`)??{value:`Global(${request.method}:${routeId.bucketRoute})`,lastAccess:-1},handler=_this5.handlers.get(`${hash.value}:${routeId.majorParameter}`)??_this5.createHandler(hash.value,routeId.majorParameter),{url,fetchOptions}=_this5.resolveRequest(request);return handler.queueRequest(routeId,url,fetchOptions,{body:request.body,files:request.files,auth:!1!==request.auth})})()}createHandler(hash,majorParameter){const queue=new SequentialHandler(this,hash,majorParameter);return this.handlers.set(queue.id,queue),queue}resolveRequest(request){const{options}=this;this.agent??=options.api.startsWith("https")?new import_node_https.Agent({...options.agent,keepAlive:!0}):new import_node_http.Agent({...options.agent,keepAlive:!0});let query="";if(request.query){const resolvedQuery=request.query.toString();""!==resolvedQuery&&(query=`?${resolvedQuery}`)}const headers={...this.options.headers,"User-Agent":`${DefaultUserAgent} ${options.userAgentAppendix}`.trim()};if(!1!==request.auth){if(!__privateGet(this,_token))throw new Error("Expected token to be set for this request, but none was present");headers.Authorization=`${request.authPrefix??"Bot"} ${__privateGet(this,_token)}`}request.reason?.length&&(headers["X-Audit-Log-Reason"]=encodeURIComponent(request.reason));const url=`${options.api}${!1===request.versioned?"":`/v${options.version}`}${request.fullRoute}${query}`;let finalBody,additionalHeaders={};if(request.files?.length){const formData=new import_form_data.default;for(const[index,file2]of request.files.entries())formData.append(file2.key??`files[${index}]`,file2.data,file2.name);if(null!=request.body)if(request.appendToFormData)for(const[key,value]of Object.entries(request.body))formData.append(key,value);else formData.append("payload_json",JSON.stringify(request.body));finalBody=formData,additionalHeaders=formData.getHeaders()}else null!=request.body&&(request.passThroughBody?finalBody=request.body:(finalBody=JSON.stringify(request.body),additionalHeaders={"Content-Type":"application/json"}));return{url,fetchOptions:{agent:this.agent,body:finalBody,headers:{...request.headers??{},...additionalHeaders,...headers},method:request.method}}}clearHashSweeper(){clearInterval(this.hashTimer)}clearHandlerSweeper(){clearInterval(this.handlerTimer)}static generateRouteData(endpoint,method){const majorId=/^\/(?:channels|guilds|webhooks)\/(\d{16,19})/.exec(endpoint)?.[1]??"global",baseRoute=endpoint.replace(/\d{16,19}/g,":id").replace(/\/reactions\/(.*)/,"/reactions/:reaction");let exceptions="";if("delete"===method&&"/channels/:id/messages/:id"===baseRoute){const id=/\d{16,19}$/.exec(endpoint)[0],timestamp=import_snowflake.DiscordSnowflake.timestampFrom(id);Date.now()-timestamp>12096e5&&(exceptions+="/Delete Old Message")}return{majorParameter:majorId,bucketRoute:baseRoute+exceptions,original:endpoint}}},"_RequestManager"),RequestManager=_RequestManager;__name2(RequestManager,"RequestManager"),_token=new WeakMap;var import_node_events2=__webpack_require__2(82361),REST=__name(class extends import_node_events2.EventEmitter{constructor(options={}){super(),__publicField(this,"cdn"),__publicField(this,"requestManager"),this.cdn=new CDN(options.cdn??DefaultRestOptions.cdn),this.requestManager=new RequestManager(options).on("restDebug",this.emit.bind(this,"restDebug")).on("rateLimited",this.emit.bind(this,"rateLimited")).on("invalidRequestWarning",this.emit.bind(this,"invalidRequestWarning")).on("hashSweep",this.emit.bind(this,"hashSweep")),this.on("newListener",(name,listener)=>{("request"===name||"response"===name)&&this.requestManager.on(name,listener)}),this.on("removeListener",(name,listener)=>{("request"===name||"response"===name)&&this.requestManager.off(name,listener)})}setToken(token){return this.requestManager.setToken(token),this}get(fullRoute,options={}){return this.request({...options,fullRoute,method:"get"})}delete(fullRoute,options={}){return this.request({...options,fullRoute,method:"delete"})}post(fullRoute,options={}){return this.request({...options,fullRoute,method:"post"})}put(fullRoute,options={}){return this.request({...options,fullRoute,method:"put"})}patch(fullRoute,options={}){return this.request({...options,fullRoute,method:"patch"})}request(options){return this.requestManager.queueRequest(options)}},"REST");__name2(REST,"REST")},92006:(__unused_webpack_module,exports2)=>{"use strict";Object.defineProperty(exports2,"__esModule",{value:!0})},79658:function(__unused_webpack_module,exports2,__webpack_require__2){"use strict";var GatewayOpcodes2,GatewayCloseCodes2,GatewayIntentBits2,GatewayDispatchEvents2,__createBinding=this&&this.__createBinding||(Object.create?function(o,m,k,k2){void 0===k2&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:function(){return m[k]}})}:function(o,m,k,k2){void 0===k2&&(k2=k),o[k2]=m[k]}),__exportStar=this&&this.__exportStar||function(m,exports3){for(var p2 in m)"default"!==p2&&!Object.prototype.hasOwnProperty.call(exports3,p2)&&__createBinding(exports3,m,p2)};Object.defineProperty(exports2,"__esModule",{value:!0}),exports2.GatewayDispatchEvents=exports2.GatewayIntentBits=exports2.GatewayCloseCodes=exports2.GatewayOpcodes=exports2.GatewayVersion=void 0,__exportStar(__webpack_require__2(92006),exports2),exports2.GatewayVersion="10",(GatewayOpcodes2=exports2.GatewayOpcodes||(exports2.GatewayOpcodes={}))[GatewayOpcodes2.Dispatch=0]="Dispatch",GatewayOpcodes2[GatewayOpcodes2.Heartbeat=1]="Heartbeat",GatewayOpcodes2[GatewayOpcodes2.Identify=2]="Identify",GatewayOpcodes2[GatewayOpcodes2.PresenceUpdate=3]="PresenceUpdate",GatewayOpcodes2[GatewayOpcodes2.VoiceStateUpdate=4]="VoiceStateUpdate",GatewayOpcodes2[GatewayOpcodes2.Resume=6]="Resume",GatewayOpcodes2[GatewayOpcodes2.Reconnect=7]="Reconnect",GatewayOpcodes2[GatewayOpcodes2.RequestGuildMembers=8]="RequestGuildMembers",GatewayOpcodes2[GatewayOpcodes2.InvalidSession=9]="InvalidSession",GatewayOpcodes2[GatewayOpcodes2.Hello=10]="Hello",GatewayOpcodes2[GatewayOpcodes2.HeartbeatAck=11]="HeartbeatAck",(GatewayCloseCodes2=exports2.GatewayCloseCodes||(exports2.GatewayCloseCodes={}))[GatewayCloseCodes2.UnknownError=4e3]="UnknownError",GatewayCloseCodes2[GatewayCloseCodes2.UnknownOpcode=4001]="UnknownOpcode",GatewayCloseCodes2[GatewayCloseCodes2.DecodeError=4002]="DecodeError",GatewayCloseCodes2[GatewayCloseCodes2.NotAuthenticated=4003]="NotAuthenticated",GatewayCloseCodes2[GatewayCloseCodes2.AuthenticationFailed=4004]="AuthenticationFailed",GatewayCloseCodes2[GatewayCloseCodes2.AlreadyAuthenticated=4005]="AlreadyAuthenticated",GatewayCloseCodes2[GatewayCloseCodes2.InvalidSeq=4007]="InvalidSeq",GatewayCloseCodes2[GatewayCloseCodes2.RateLimited=4008]="RateLimited",GatewayCloseCodes2[GatewayCloseCodes2.SessionTimedOut=4009]="SessionTimedOut",GatewayCloseCodes2[GatewayCloseCodes2.InvalidShard=4010]="InvalidShard",GatewayCloseCodes2[GatewayCloseCodes2.ShardingRequired=4011]="ShardingRequired",GatewayCloseCodes2[GatewayCloseCodes2.InvalidAPIVersion=4012]="InvalidAPIVersion",GatewayCloseCodes2[GatewayCloseCodes2.InvalidIntents=4013]="InvalidIntents",GatewayCloseCodes2[GatewayCloseCodes2.DisallowedIntents=4014]="DisallowedIntents",(GatewayIntentBits2=exports2.GatewayIntentBits||(exports2.GatewayIntentBits={}))[GatewayIntentBits2.Guilds=1]="Guilds",GatewayIntentBits2[GatewayIntentBits2.GuildMembers=2]="GuildMembers",GatewayIntentBits2[GatewayIntentBits2.GuildBans=4]="GuildBans",GatewayIntentBits2[GatewayIntentBits2.GuildEmojisAndStickers=8]="GuildEmojisAndStickers",GatewayIntentBits2[GatewayIntentBits2.GuildIntegrations=16]="GuildIntegrations",GatewayIntentBits2[GatewayIntentBits2.GuildWebhooks=32]="GuildWebhooks",GatewayIntentBits2[GatewayIntentBits2.GuildInvites=64]="GuildInvites",GatewayIntentBits2[GatewayIntentBits2.GuildVoiceStates=128]="GuildVoiceStates",GatewayIntentBits2[GatewayIntentBits2.GuildPresences=256]="GuildPresences",GatewayIntentBits2[GatewayIntentBits2.GuildMessages=512]="GuildMessages",GatewayIntentBits2[GatewayIntentBits2.GuildMessageReactions=1024]="GuildMessageReactions",GatewayIntentBits2[GatewayIntentBits2.GuildMessageTyping=2048]="GuildMessageTyping",GatewayIntentBits2[GatewayIntentBits2.DirectMessages=4096]="DirectMessages",GatewayIntentBits2[GatewayIntentBits2.DirectMessageReactions=8192]="DirectMessageReactions",GatewayIntentBits2[GatewayIntentBits2.DirectMessageTyping=16384]="DirectMessageTyping",GatewayIntentBits2[GatewayIntentBits2.MessageContent=32768]="MessageContent",GatewayIntentBits2[GatewayIntentBits2.GuildScheduledEvents=65536]="GuildScheduledEvents",(GatewayDispatchEvents2=exports2.GatewayDispatchEvents||(exports2.GatewayDispatchEvents={})).ChannelCreate="CHANNEL_CREATE",GatewayDispatchEvents2.ChannelDelete="CHANNEL_DELETE",GatewayDispatchEvents2.ChannelPinsUpdate="CHANNEL_PINS_UPDATE",GatewayDispatchEvents2.ChannelUpdate="CHANNEL_UPDATE",GatewayDispatchEvents2.GuildBanAdd="GUILD_BAN_ADD",GatewayDispatchEvents2.GuildBanRemove="GUILD_BAN_REMOVE",GatewayDispatchEvents2.GuildCreate="GUILD_CREATE",GatewayDispatchEvents2.GuildDelete="GUILD_DELETE",GatewayDispatchEvents2.GuildEmojisUpdate="GUILD_EMOJIS_UPDATE",GatewayDispatchEvents2.GuildIntegrationsUpdate="GUILD_INTEGRATIONS_UPDATE",GatewayDispatchEvents2.GuildMemberAdd="GUILD_MEMBER_ADD",GatewayDispatchEvents2.GuildMemberRemove="GUILD_MEMBER_REMOVE",GatewayDispatchEvents2.GuildMembersChunk="GUILD_MEMBERS_CHUNK",GatewayDispatchEvents2.GuildMemberUpdate="GUILD_MEMBER_UPDATE",GatewayDispatchEvents2.GuildRoleCreate="GUILD_ROLE_CREATE",GatewayDispatchEvents2.GuildRoleDelete="GUILD_ROLE_DELETE",GatewayDispatchEvents2.GuildRoleUpdate="GUILD_ROLE_UPDATE",GatewayDispatchEvents2.GuildStickersUpdate="GUILD_STICKERS_UPDATE",GatewayDispatchEvents2.GuildUpdate="GUILD_UPDATE",GatewayDispatchEvents2.IntegrationCreate="INTEGRATION_CREATE",GatewayDispatchEvents2.IntegrationDelete="INTEGRATION_DELETE",GatewayDispatchEvents2.IntegrationUpdate="INTEGRATION_UPDATE",GatewayDispatchEvents2.InteractionCreate="INTERACTION_CREATE",GatewayDispatchEvents2.InviteCreate="INVITE_CREATE",GatewayDispatchEvents2.InviteDelete="INVITE_DELETE",GatewayDispatchEvents2.MessageCreate="MESSAGE_CREATE",GatewayDispatchEvents2.MessageDelete="MESSAGE_DELETE",GatewayDispatchEvents2.MessageDeleteBulk="MESSAGE_DELETE_BULK",GatewayDispatchEvents2.MessageReactionAdd="MESSAGE_REACTION_ADD",GatewayDispatchEvents2.MessageReactionRemove="MESSAGE_REACTION_REMOVE",GatewayDispatchEvents2.MessageReactionRemoveAll="MESSAGE_REACTION_REMOVE_ALL",GatewayDispatchEvents2.MessageReactionRemoveEmoji="MESSAGE_REACTION_REMOVE_EMOJI",GatewayDispatchEvents2.MessageUpdate="MESSAGE_UPDATE",GatewayDispatchEvents2.PresenceUpdate="PRESENCE_UPDATE",GatewayDispatchEvents2.StageInstanceCreate="STAGE_INSTANCE_CREATE",GatewayDispatchEvents2.StageInstanceDelete="STAGE_INSTANCE_DELETE",GatewayDispatchEvents2.StageInstanceUpdate="STAGE_INSTANCE_UPDATE",GatewayDispatchEvents2.Ready="READY",GatewayDispatchEvents2.Resumed="RESUMED",GatewayDispatchEvents2.ThreadCreate="THREAD_CREATE",GatewayDispatchEvents2.ThreadDelete="THREAD_DELETE",GatewayDispatchEvents2.ThreadListSync="THREAD_LIST_SYNC",GatewayDispatchEvents2.ThreadMembersUpdate="THREAD_MEMBERS_UPDATE",GatewayDispatchEvents2.ThreadMemberUpdate="THREAD_MEMBER_UPDATE",GatewayDispatchEvents2.ThreadUpdate="THREAD_UPDATE",GatewayDispatchEvents2.TypingStart="TYPING_START",GatewayDispatchEvents2.UserUpdate="USER_UPDATE",GatewayDispatchEvents2.VoiceServerUpdate="VOICE_SERVER_UPDATE",GatewayDispatchEvents2.VoiceStateUpdate="VOICE_STATE_UPDATE",GatewayDispatchEvents2.WebhooksUpdate="WEBHOOKS_UPDATE",GatewayDispatchEvents2.GuildScheduledEventCreate="GUILD_SCHEDULED_EVENT_CREATE",GatewayDispatchEvents2.GuildScheduledEventUpdate="GUILD_SCHEDULED_EVENT_UPDATE",GatewayDispatchEvents2.GuildScheduledEventDelete="GUILD_SCHEDULED_EVENT_DELETE",GatewayDispatchEvents2.GuildScheduledEventUserAdd="GUILD_SCHEDULED_EVENT_USER_ADD",GatewayDispatchEvents2.GuildScheduledEventUserRemove="GUILD_SCHEDULED_EVENT_USER_REMOVE"},48583:(__unused_webpack_module,exports2)=>{"use strict";Object.defineProperty(exports2,"__esModule",{value:!0}),exports2.FormattingPatterns=void 0,exports2.FormattingPatterns={User:/<@(?\d{17,20})>/,UserWithNickname:/<@!(?\d{17,20})>/,UserWithOptionalNickname:/<@!?(?\d{17,20})>/,Channel:/<#(?\d{17,20})>/,Role:/<@&(?\d{17,20})>/,Emoji:/<(?a)?:(?\w{2,32}):(?\d{17,20})>/,AnimatedEmoji:/<(?a):(?\w{2,32}):(?\d{17,20})>/,StaticEmoji:/<:(?\w{2,32}):(?\d{17,20})>/,Timestamp:/-?\d{1,13})(:(?