!function e(t,n,i){function r(a,s){if(!n[a]){if(!t[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[a]={exports:{}};t[a][0].call(u.exports,(function(e){return r(t[a][1][e]||e)}),u,u.exports,e,t,n,i)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a0&&l(a.width)/e.offsetWidth||1,c=e.offsetHeight>0&&l(a.height)/e.offsetHeight||1);var u=(r(e)?i(e):window).visualViewport,d=!p()&&n,f=(a.left+(d&&u?u.offsetLeft:0))/s,h=(a.top+(d&&u?u.offsetTop:0))/c,m=a.width/s,b=a.height/c;return{width:m,height:b,top:h,right:f+m,bottom:h+b,left:f,x:f,y:h}}function f(e){var t=i(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function h(e){return e?(e.nodeName||"").toLowerCase():null}function m(e){return((r(e)?e.ownerDocument:e.document)||window.document).documentElement}function b(e){return d(m(e)).left+f(e).scrollLeft}function v(e){return i(e).getComputedStyle(e)}function g(e){var t=v(e),n=t.overflow,i=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+i)}function y(e,t,n){void 0===n&&(n=!1);var r,a,s=o(t),c=o(t)&&function(e){var t=e.getBoundingClientRect(),n=l(t.width)/e.offsetWidth||1,i=l(t.height)/e.offsetHeight||1;return 1!==n||1!==i}(t),u=m(t),p=d(e,c,n),v={scrollLeft:0,scrollTop:0},y={x:0,y:0};return(s||!s&&!n)&&(("body"!==h(t)||g(u))&&(v=(r=t)!==i(r)&&o(r)?{scrollLeft:(a=r).scrollLeft,scrollTop:a.scrollTop}:f(r)),o(t)?((y=d(t,!0)).x+=t.clientLeft,y.y+=t.clientTop):u&&(y.x=b(u))),{x:p.left+v.scrollLeft-y.x,y:p.top+v.scrollTop-y.y,width:p.width,height:p.height}}function x(e){var t=d(e),n=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:i}}function _(e){return"html"===h(e)?e:e.assignedSlot||e.parentNode||(a(e)?e.host:null)||m(e)}function w(e){return["html","body","#document"].indexOf(h(e))>=0?e.ownerDocument.body:o(e)&&g(e)?e:w(_(e))}function k(e,t){var n;void 0===t&&(t=[]);var r=w(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),a=i(r),s=o?[a].concat(a.visualViewport||[],g(r)?r:[]):r,c=t.concat(s);return o?c:c.concat(k(_(s)))}function S(e){return["table","td","th"].indexOf(h(e))>=0}function E(e){return o(e)&&"fixed"!==v(e).position?e.offsetParent:null}function M(e){for(var t=i(e),n=E(e);n&&S(n)&&"static"===v(n).position;)n=E(n);return n&&("html"===h(n)||"body"===h(n)&&"static"===v(n).position)?t:n||function(e){var t=/firefox/i.test(u());if(/Trident/i.test(u())&&o(e)&&"fixed"===v(e).position)return null;var n=_(e);for(a(n)&&(n=n.host);o(n)&&["html","body"].indexOf(h(n))<0;){var i=v(n);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return n;n=n.parentNode}return null}(e)||t}var A="top",j="bottom",I="right",T="left",C="auto",B=[A,j,I,T],R="start",O="end",P="clippingParents",L="viewport",U="popper",q="reference",N=B.reduce((function(e,t){return e.concat([t+"-"+R,t+"-"+O])}),[]),D=[].concat(B,[C]).reduce((function(e,t){return e.concat([t,t+"-"+R,t+"-"+O])}),[]),z=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function H(e){var t=new Map,n=new Set,i=[];function r(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var i=t.get(e);i&&r(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||r(e)})),i}function F(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&a(n)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function W(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function V(e,t,n){return t===L?W(function(e,t){var n=i(e),r=m(e),o=n.visualViewport,a=r.clientWidth,s=r.clientHeight,c=0,l=0;if(o){a=o.width,s=o.height;var u=p();(u||!u&&"fixed"===t)&&(c=o.offsetLeft,l=o.offsetTop)}return{width:a,height:s,x:c+b(e),y:l}}(e,n)):r(t)?function(e,t){var n=d(e,!1,"fixed"===t);return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}(t,n):W(function(e){var t,n=m(e),i=f(e),r=null==(t=e.ownerDocument)?void 0:t.body,o=s(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),a=s(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),c=-i.scrollLeft+b(e),l=-i.scrollTop;return"rtl"===v(r||n).direction&&(c+=s(n.clientWidth,r?r.clientWidth:0)-o),{width:o,height:a,x:c,y:l}}(m(e)))}function K(e,t,n,i){var a="clippingParents"===t?function(e){var t=k(_(e)),n=["absolute","fixed"].indexOf(v(e).position)>=0&&o(e)?M(e):e;return r(n)?t.filter((function(e){return r(e)&&F(e,n)&&"body"!==h(e)})):[]}(e):[].concat(t),l=[].concat(a,[n]),u=l[0],p=l.reduce((function(t,n){var r=V(e,n,i);return t.top=s(r.top,t.top),t.right=c(r.right,t.right),t.bottom=c(r.bottom,t.bottom),t.left=s(r.left,t.left),t}),V(e,u,i));return p.width=p.right-p.left,p.height=p.bottom-p.top,p.x=p.left,p.y=p.top,p}function $(e){return e.split("-")[0]}function G(e){return e.split("-")[1]}function X(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Y(e){var t,n=e.reference,i=e.element,r=e.placement,o=r?$(r):null,a=r?G(r):null,s=n.x+n.width/2-i.width/2,c=n.y+n.height/2-i.height/2;switch(o){case A:t={x:s,y:n.y-i.height};break;case j:t={x:s,y:n.y+n.height};break;case I:t={x:n.x+n.width,y:c};break;case T:t={x:n.x-i.width,y:c};break;default:t={x:n.x,y:n.y}}var l=o?X(o):null;if(null!=l){var u="y"===l?"height":"width";switch(a){case R:t[l]=t[l]-(n[u]/2-i[u]/2);break;case O:t[l]=t[l]+(n[u]/2-i[u]/2)}}return t}function J(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function Z(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function Q(e,t){void 0===t&&(t={});var n=t,i=n.placement,o=void 0===i?e.placement:i,a=n.strategy,s=void 0===a?e.strategy:a,c=n.boundary,l=void 0===c?P:c,u=n.rootBoundary,p=void 0===u?L:u,f=n.elementContext,h=void 0===f?U:f,b=n.altBoundary,v=void 0!==b&&b,g=n.padding,y=void 0===g?0:g,x=J("number"!=typeof y?y:Z(y,B)),_=h===U?q:U,w=e.rects.popper,k=e.elements[v?_:h],S=K(r(k)?k:k.contextElement||m(e.elements.popper),l,p,s),E=d(e.elements.reference),M=Y({reference:E,element:w,strategy:"absolute",placement:o}),T=W(Object.assign({},w,M)),C=h===U?T:E,R={top:S.top-C.top+x.top,bottom:C.bottom-S.bottom+x.bottom,left:S.left-C.left+x.left,right:C.right-S.right+x.right},O=e.modifiersData.offset;if(h===U&&O){var N=O[o];Object.keys(R).forEach((function(e){var t=[I,j].indexOf(e)>=0?1:-1,n=[A,j].indexOf(e)>=0?"y":"x";R[e]+=N[n]*t}))}return R}var ee={placement:"bottom",modifiers:[],strategy:"absolute"};function te(){for(var e=arguments.length,t=new Array(e),n=0;n=0?-1:1,o="function"==typeof n?n(Object.assign({},t,{placement:e})):n,a=o[0],s=o[1];return a=a||0,s=(s||0)*r,[T,I].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(n,t.rects,o),e}),{}),s=a[t.placement],c=s.x,l=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=l),t.modifiersData[i]=a}},pe={left:"right",right:"left",bottom:"top",top:"bottom"};function de(e){return e.replace(/left|right|bottom|top/g,(function(e){return pe[e]}))}var fe={start:"end",end:"start"};function he(e){return e.replace(/start|end/g,(function(e){return fe[e]}))}function me(e,t){void 0===t&&(t={});var n=t,i=n.placement,r=n.boundary,o=n.rootBoundary,a=n.padding,s=n.flipVariations,c=n.allowedAutoPlacements,l=void 0===c?D:c,u=G(i),p=u?s?N:N.filter((function(e){return G(e)===u})):B,d=p.filter((function(e){return l.indexOf(e)>=0}));0===d.length&&(d=p);var f=d.reduce((function(t,n){return t[n]=Q(e,{placement:n,boundary:r,rootBoundary:o,padding:a})[$(n)],t}),{});return Object.keys(f).sort((function(e,t){return f[e]-f[t]}))}var be={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var r=n.mainAxis,o=void 0===r||r,a=n.altAxis,s=void 0===a||a,c=n.fallbackPlacements,l=n.padding,u=n.boundary,p=n.rootBoundary,d=n.altBoundary,f=n.flipVariations,h=void 0===f||f,m=n.allowedAutoPlacements,b=t.options.placement,v=$(b),g=c||(v===b||!h?[de(b)]:function(e){if($(e)===C)return[];var t=de(e);return[he(e),t,he(t)]}(b)),y=[b].concat(g).reduce((function(e,n){return e.concat($(n)===C?me(t,{placement:n,boundary:u,rootBoundary:p,padding:l,flipVariations:h,allowedAutoPlacements:m}):n)}),[]),x=t.rects.reference,_=t.rects.popper,w=new Map,k=!0,S=y[0],E=0;E=0,L=P?"width":"height",U=Q(t,{placement:M,boundary:u,rootBoundary:p,altBoundary:d,padding:l}),q=P?O?I:T:O?j:A;x[L]>_[L]&&(q=de(q));var N=de(q),D=[];if(o&&D.push(U[B]<=0),s&&D.push(U[q]<=0,U[N]<=0),D.every((function(e){return e}))){S=M,k=!1;break}w.set(M,D)}if(k)for(var z=function(e){var t=y.find((function(t){var n=w.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return S=t,"break"},H=h?3:1;H>0;H--){if("break"===z(H))break}t.placement!==S&&(t.modifiersData[i]._skip=!0,t.placement=S,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function ve(e,t,n){return s(e,c(t,n))}var ge={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,i=e.name,r=n.mainAxis,o=void 0===r||r,a=n.altAxis,l=void 0!==a&&a,u=n.boundary,p=n.rootBoundary,d=n.altBoundary,f=n.padding,h=n.tether,m=void 0===h||h,b=n.tetherOffset,v=void 0===b?0:b,g=Q(t,{boundary:u,rootBoundary:p,padding:f,altBoundary:d}),y=$(t.placement),_=G(t.placement),w=!_,k=X(y),S="x"===k?"y":"x",E=t.modifiersData.popperOffsets,C=t.rects.reference,B=t.rects.popper,O="function"==typeof v?v(Object.assign({},t.rects,{placement:t.placement})):v,P="number"==typeof O?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),L=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,U={x:0,y:0};if(E){if(o){var q,N="y"===k?A:T,D="y"===k?j:I,z="y"===k?"height":"width",H=E[k],F=H+g[N],W=H-g[D],V=m?-B[z]/2:0,K=_===R?C[z]:B[z],Y=_===R?-B[z]:-C[z],J=t.elements.arrow,Z=m&&J?x(J):{width:0,height:0},ee=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},te=ee[N],ne=ee[D],ie=ve(0,C[z],Z[z]),re=w?C[z]/2-V-ie-te-P.mainAxis:K-ie-te-P.mainAxis,oe=w?-C[z]/2+V+ie+ne+P.mainAxis:Y+ie+ne+P.mainAxis,ae=t.elements.arrow&&M(t.elements.arrow),se=ae?"y"===k?ae.clientTop||0:ae.clientLeft||0:0,ce=null!=(q=null==L?void 0:L[k])?q:0,le=H+oe-ce,ue=ve(m?c(F,H+re-ce-se):F,H,m?s(W,le):W);E[k]=ue,U[k]=ue-H}if(l){var pe,de="x"===k?A:T,fe="x"===k?j:I,he=E[S],me="y"===S?"height":"width",be=he+g[de],ge=he-g[fe],ye=-1!==[A,T].indexOf(y),xe=null!=(pe=null==L?void 0:L[S])?pe:0,_e=ye?be:he-C[me]-B[me]-xe+P.altAxis,we=ye?he+C[me]+B[me]-xe-P.altAxis:ge,ke=m&&ye?function(e,t,n){var i=ve(e,t,n);return i>n?n:i}(_e,he,we):ve(m?_e:be,he,m?we:ge);E[S]=ke,U[S]=ke-he}t.modifiersData[i]=U}},requiresIfExists:["offset"]};var ye={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,i=e.name,r=e.options,o=n.elements.arrow,a=n.modifiersData.popperOffsets,s=$(n.placement),c=X(s),l=[T,I].indexOf(s)>=0?"height":"width";if(o&&a){var u=function(e,t){return J("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:Z(e,B))}(r.padding,n),p=x(o),d="y"===c?A:T,f="y"===c?j:I,h=n.rects.reference[l]+n.rects.reference[c]-a[c]-n.rects.popper[l],m=a[c]-n.rects.reference[c],b=M(o),v=b?"y"===c?b.clientHeight||0:b.clientWidth||0:0,g=h/2-m/2,y=u[d],_=v-p[l]-u[f],w=v/2-p[l]/2+g,k=ve(y,w,_),S=c;n.modifiersData[i]=((t={})[S]=k,t.centerOffset=k-w,t)}},effect:function(e){var t=e.state,n=e.options.element,i=void 0===n?"[data-popper-arrow]":n;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&F(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function xe(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function _e(e){return[A,I,j,T].some((function(t){return e[t]>=0}))}var we={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,i=t.rects.reference,r=t.rects.popper,o=t.modifiersData.preventOverflow,a=Q(t,{elementContext:"reference"}),s=Q(t,{altBoundary:!0}),c=xe(a,i),l=xe(s,r,o),u=_e(c),p=_e(l);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:l,isReferenceHidden:u,hasPopperEscaped:p},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":p})}},ke=ne({defaultModifiers:[re,oe,ce,le]}),Se=[re,oe,ce,le,ue,be,ge,ye,we],Ee=ne({defaultModifiers:Se});n.applyStyles=le,n.arrow=ye,n.computeStyles=ce,n.createPopper=Ee,n.createPopperLite=ke,n.defaultModifiers=Se,n.detectOverflow=Q,n.eventListeners=re,n.flip=be,n.hide=we,n.offset=ue,n.popperGenerator=ne,n.popperOffsets=oe,n.preventOverflow=ge},{}],2:[function(e,t,n){const i=/^\[?([^\]]+)]?:(\d+)$/;let r=new Map;t.exports=function(e){if(1e5===r.size&&r.clear(),!r.has(e)){const t=i.exec(e);if(!t)throw new Error(`invalid addr: ${e}`);r.set(e,[t[1],Number(t[2])])}return r.get(e)}},{}],3:[function(e,t,n){"use strict";const i=n;i.bignum=e("bn.js"),i.define=e("./asn1/api").define,i.base=e("./asn1/base"),i.constants=e("./asn1/constants"),i.decoders=e("./asn1/decoders"),i.encoders=e("./asn1/encoders")},{"./asn1/api":4,"./asn1/base":6,"./asn1/constants":10,"./asn1/decoders":12,"./asn1/encoders":15,"bn.js":17}],4:[function(e,t,n){"use strict";const i=e("./encoders"),r=e("./decoders"),o=e("inherits");function a(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}n.define=function(e,t){return new a(e,t)},a.prototype._createNamed=function(e){const t=this.name;function n(e){this._initNamed(e,t)}return o(n,e),n.prototype._initNamed=function(t,n){e.call(this,t,n)},new n(this)},a.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(r[e])),this.decoders[e]},a.prototype.decode=function(e,t,n){return this._getDecoder(t).decode(e,n)},a.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(i[e])),this.encoders[e]},a.prototype.encode=function(e,t,n){return this._getEncoder(t).encode(e,n)}},{"./decoders":12,"./encoders":15,inherits:229}],5:[function(e,t,n){"use strict";const i=e("inherits"),r=e("../base/reporter").Reporter,o=e("safer-buffer").Buffer;function a(e,t){r.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function s(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return s.isEncoderBuffer(e)||(e=new s(e,t)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}i(a,r),n.DecoderBuffer=a,a.isDecoderBuffer=function(e){if(e instanceof a)return!0;return"object"==typeof e&&o.isBuffer(e.base)&&"DecoderBuffer"===e.constructor.name&&"number"==typeof e.offset&&"number"==typeof e.length&&"function"==typeof e.save&&"function"==typeof e.restore&&"function"==typeof e.isEmpty&&"function"==typeof e.readUInt8&&"function"==typeof e.skip&&"function"==typeof e.raw},a.prototype.save=function(){return{offset:this.offset,reporter:r.prototype.save.call(this)}},a.prototype.restore=function(e){const t=new a(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,r.prototype.restore.call(this,e.reporter),t},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},a.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");const n=new a(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n},a.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},n.EncoderBuffer=s,s.isEncoderBuffer=function(e){if(e instanceof s)return!0;return"object"==typeof e&&"EncoderBuffer"===e.constructor.name&&"number"==typeof e.length&&"function"==typeof e.join},s.prototype.join=function(e,t){return e||(e=o.alloc(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(n){n.join(e,t),t+=n.length})):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):o.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e}},{"../base/reporter":8,inherits:229,"safer-buffer":357}],6:[function(e,t,n){"use strict";const i=n;i.Reporter=e("./reporter").Reporter,i.DecoderBuffer=e("./buffer").DecoderBuffer,i.EncoderBuffer=e("./buffer").EncoderBuffer,i.Node=e("./node")},{"./buffer":5,"./node":7,"./reporter":8}],7:[function(e,t,n){"use strict";const i=e("../base/reporter").Reporter,r=e("../base/buffer").EncoderBuffer,o=e("../base/buffer").DecoderBuffer,a=e("minimalistic-assert"),s=["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"],c=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function l(e,t,n){const i={};this._baseState=i,i.name=n,i.enc=e,i.parent=t||null,i.children=null,i.tag=null,i.args=null,i.reverseArgs=null,i.choice=null,i.optional=!1,i.any=!1,i.obj=!1,i.use=null,i.useDecoder=null,i.key=null,i.default=null,i.explicit=null,i.implicit=null,i.contains=null,i.parent||(i.children=[],this._wrap())}t.exports=l;const u=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];l.prototype.clone=function(){const e=this._baseState,t={};u.forEach((function(n){t[n]=e[n]}));const n=new this.constructor(t.parent);return n._baseState=t,n},l.prototype._wrap=function(){const e=this._baseState;c.forEach((function(t){this[t]=function(){const n=new this.constructor(this);return e.children.push(n),n[t].apply(n,arguments)}}),this)},l.prototype._init=function(e){const t=this._baseState;a(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),a.equal(t.children.length,1,"Root node can have only one child")},l.prototype._useArgs=function(e){const t=this._baseState,n=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==n.length&&(a(null===t.children),t.children=n,n.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(a(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach((function(n){n==(0|n)&&(n|=0);const i=e[n];t[i]=n})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){l.prototype[e]=function(){const t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),s.forEach((function(e){l.prototype[e]=function(){const t=this._baseState,n=Array.prototype.slice.call(arguments);return a(null===t.tag),t.tag=e,this._useArgs(n),this}})),l.prototype.use=function(e){a(e);const t=this._baseState;return a(null===t.use),t.use=e,this},l.prototype.optional=function(){return this._baseState.optional=!0,this},l.prototype.def=function(e){const t=this._baseState;return a(null===t.default),t.default=e,t.optional=!0,this},l.prototype.explicit=function(e){const t=this._baseState;return a(null===t.explicit&&null===t.implicit),t.explicit=e,this},l.prototype.implicit=function(e){const t=this._baseState;return a(null===t.explicit&&null===t.implicit),t.implicit=e,this},l.prototype.obj=function(){const e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},l.prototype.key=function(e){const t=this._baseState;return a(null===t.key),t.key=e,this},l.prototype.any=function(){return this._baseState.any=!0,this},l.prototype.choice=function(e){const t=this._baseState;return a(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},l.prototype.contains=function(e){const t=this._baseState;return a(null===t.use),t.contains=e,this},l.prototype._decode=function(e,t){const n=this._baseState;if(null===n.parent)return e.wrapResult(n.children[0]._decode(e,t));let i,r=n.default,a=!0,s=null;if(null!==n.key&&(s=e.enterKey(n.key)),n.optional){let i=null;if(null!==n.explicit?i=n.explicit:null!==n.implicit?i=n.implicit:null!==n.tag&&(i=n.tag),null!==i||n.any){if(a=this._peekTag(e,i,n.any),e.isError(a))return a}else{const i=e.save();try{null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),a=!0}catch(e){a=!1}e.restore(i)}}if(n.obj&&a&&(i=e.enterObject()),a){if(null!==n.explicit){const t=this._decodeTag(e,n.explicit);if(e.isError(t))return t;e=t}const i=e.offset;if(null===n.use&&null===n.choice){let t;n.any&&(t=e.save());const i=this._decodeTag(e,null!==n.implicit?n.implicit:n.tag,n.any);if(e.isError(i))return i;n.any?r=e.raw(t):e=i}if(t&&t.track&&null!==n.tag&&t.track(e.path(),i,e.length,"tagged"),t&&t.track&&null!==n.tag&&t.track(e.path(),e.offset,e.length,"content"),n.any||(r=null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t)),e.isError(r))return r;if(n.any||null!==n.choice||null===n.children||n.children.forEach((function(n){n._decode(e,t)})),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){const i=new o(r);r=this._getUse(n.contains,e._reporterState.obj)._decode(i,t)}}return n.obj&&a&&(r=e.leaveObject(i)),null===n.key||null===r&&!0!==a?null!==s&&e.exitKey(s):e.leaveKey(s,n.key,r),r},l.prototype._decodeGeneric=function(e,t,n){const i=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,i.args[0],n):/str$/.test(e)?this._decodeStr(t,e,n):"objid"===e&&i.args?this._decodeObjid(t,i.args[0],i.args[1],n):"objid"===e?this._decodeObjid(t,null,null,n):"gentime"===e||"utctime"===e?this._decodeTime(t,e,n):"null_"===e?this._decodeNull(t,n):"bool"===e?this._decodeBool(t,n):"objDesc"===e?this._decodeStr(t,e,n):"int"===e||"enum"===e?this._decodeInt(t,i.args&&i.args[0],n):null!==i.use?this._getUse(i.use,t._reporterState.obj)._decode(t,n):t.error("unknown tag: "+e)},l.prototype._getUse=function(e,t){const n=this._baseState;return n.useDecoder=this._use(e,t),a(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},l.prototype._decodeChoice=function(e,t){const n=this._baseState;let i=null,r=!1;return Object.keys(n.choice).some((function(o){const a=e.save(),s=n.choice[o];try{const n=s._decode(e,t);if(e.isError(n))return!1;i={type:o,value:n},r=!0}catch(t){return e.restore(a),!1}return!0}),this),r?i:e.error("Choice not matched")},l.prototype._createEncoderBuffer=function(e){return new r(e,this.reporter)},l.prototype._encode=function(e,t,n){const i=this._baseState;if(null!==i.default&&i.default===e)return;const r=this._encodeValue(e,t,n);return void 0===r||this._skipDefault(r,t,n)?void 0:r},l.prototype._encodeValue=function(e,t,n){const r=this._baseState;if(null===r.parent)return r.children[0]._encode(e,t||new i);let o=null;if(this.reporter=t,r.optional&&void 0===e){if(null===r.default)return;e=r.default}let a=null,s=!1;if(r.any)o=this._createEncoderBuffer(e);else if(r.choice)o=this._encodeChoice(e,t);else if(r.contains)a=this._getUse(r.contains,n)._encode(e,t),s=!0;else if(r.children)a=r.children.map((function(n){if("null_"===n._baseState.tag)return n._encode(null,t,e);if(null===n._baseState.key)return t.error("Child should have a key");const i=t.enterKey(n._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");const r=n._encode(e[n._baseState.key],t,e);return t.leaveKey(i),r}),this).filter((function(e){return e})),a=this._createEncoderBuffer(a);else if("seqof"===r.tag||"setof"===r.tag){if(!r.args||1!==r.args.length)return t.error("Too many args for : "+r.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");const n=this.clone();n._baseState.implicit=null,a=this._createEncoderBuffer(e.map((function(n){const i=this._baseState;return this._getUse(i.args[0],e)._encode(n,t)}),n))}else null!==r.use?o=this._getUse(r.use,n)._encode(e,t):(a=this._encodePrimitive(r.tag,e),s=!0);if(!r.any&&null===r.choice){const e=null!==r.implicit?r.implicit:r.tag,n=null===r.implicit?"universal":"context";null===e?null===r.use&&t.error("Tag could be omitted only for .use()"):null===r.use&&(o=this._encodeComposite(e,s,n,a))}return null!==r.explicit&&(o=this._encodeComposite(r.explicit,!1,"context",o)),o},l.prototype._encodeChoice=function(e,t){const n=this._baseState,i=n.choice[e.type];return i||a(!1,e.type+" not found in "+JSON.stringify(Object.keys(n.choice))),i._encode(e.value,t)},l.prototype._encodePrimitive=function(e,t){const n=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&n.args)return this._encodeObjid(t,n.reverseArgs[0],n.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,n.args&&n.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},l.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},l.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)}},{"../base/buffer":5,"../base/reporter":8,"minimalistic-assert":268}],8:[function(e,t,n){"use strict";const i=e("inherits");function r(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function o(e,t){this.path=e,this.rethrow(t)}n.Reporter=r,r.prototype.isError=function(e){return e instanceof o},r.prototype.save=function(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},r.prototype.restore=function(e){const t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},r.prototype.enterKey=function(e){return this._reporterState.path.push(e)},r.prototype.exitKey=function(e){const t=this._reporterState;t.path=t.path.slice(0,e-1)},r.prototype.leaveKey=function(e,t,n){const i=this._reporterState;this.exitKey(e),null!==i.obj&&(i.obj[t]=n)},r.prototype.path=function(){return this._reporterState.path.join("/")},r.prototype.enterObject=function(){const e=this._reporterState,t=e.obj;return e.obj={},t},r.prototype.leaveObject=function(e){const t=this._reporterState,n=t.obj;return t.obj=e,n},r.prototype.error=function(e){let t;const n=this._reporterState,i=e instanceof o;if(t=i?e:new o(n.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!n.options.partial)throw t;return i||n.errors.push(t),t},r.prototype.wrapResult=function(e){const t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},i(o,Error),o.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},{inherits:229}],9:[function(e,t,n){"use strict";function i(e){const t={};return Object.keys(e).forEach((function(n){(0|n)==n&&(n|=0);const i=e[n];t[i]=n})),t}n.tagClass={0:"universal",1:"application",2:"context",3:"private"},n.tagClassByName=i(n.tagClass),n.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"},n.tagByName=i(n.tag)},{}],10:[function(e,t,n){"use strict";const i=n;i._reverse=function(e){const t={};return Object.keys(e).forEach((function(n){(0|n)==n&&(n|=0);const i=e[n];t[i]=n})),t},i.der=e("./der")},{"./der":9}],11:[function(e,t,n){"use strict";const i=e("inherits"),r=e("bn.js"),o=e("../base/buffer").DecoderBuffer,a=e("../base/node"),s=e("../constants/der");function c(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new l,this.tree._init(e.body)}function l(e){a.call(this,"der",e)}function u(e,t){let n=e.readUInt8(t);if(e.isError(n))return n;const i=s.tagClass[n>>6],r=0==(32&n);if(31==(31&n)){let i=n;for(n=0;128==(128&i);){if(i=e.readUInt8(t),e.isError(i))return i;n<<=7,n|=127&i}}else n&=31;return{cls:i,primitive:r,tag:n,tagStr:s.tag[n]}}function p(e,t,n){let i=e.readUInt8(n);if(e.isError(i))return i;if(!t&&128===i)return null;if(0==(128&i))return i;const r=127&i;if(r>4)return e.error("length octect is too long");i=0;for(let t=0;t=31)return i.error("Multi-octet tag encoding unsupported");t||(r|=32);return r|=a.tagClassByName[n||"universal"]<<6,r}(e,t,n,this.reporter);if(i.length<128){const e=r.alloc(2);return e[0]=o,e[1]=i.length,this._createEncoderBuffer([e,i])}let s=1;for(let e=i.length;e>=256;e>>=8)s++;const c=r.alloc(2+s);c[0]=o,c[1]=128|s;for(let e=1+s,t=i.length;t>0;e--,t>>=8)c[e]=255&t;return this._createEncoderBuffer([c,i])},c.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){const t=r.alloc(2*e.length);for(let n=0;n=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let i=0;for(let t=0;t=128;n>>=7)i++}const o=r.alloc(i);let a=o.length-1;for(let t=e.length-1;t>=0;t--){let n=e[t];for(o[a--]=127&n;(n>>=7)>0;)o[a--]=128|127&n}return this._createEncoderBuffer(o)},c.prototype._encodeTime=function(e,t){let n;const i=new Date(e);return"gentime"===t?n=[l(i.getUTCFullYear()),l(i.getUTCMonth()+1),l(i.getUTCDate()),l(i.getUTCHours()),l(i.getUTCMinutes()),l(i.getUTCSeconds()),"Z"].join(""):"utctime"===t?n=[l(i.getUTCFullYear()%100),l(i.getUTCMonth()+1),l(i.getUTCDate()),l(i.getUTCHours()),l(i.getUTCMinutes()),l(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(n,"octstr")},c.prototype._encodeNull=function(){return this._createEncoderBuffer("")},c.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!r.isBuffer(e)){const t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=r.from(t)}if(r.isBuffer(e)){let t=e.length;0===e.length&&t++;const n=r.alloc(t);return e.copy(n),0===e.length&&(n[0]=0),this._createEncoderBuffer(n)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let n=1;for(let t=e;t>=256;t>>=8)n++;const i=new Array(n);for(let t=i.length-1;t>=0;t--)i[t]=255&e,e>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(r.from(i))},c.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},c.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},c.prototype._skipDefault=function(e,t,n){const i=this._baseState;let r;if(null===i.default)return!1;const o=e.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,t,n).join()),o.length!==i.defaultBuffer.length)return!1;for(r=0;r=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function c(e,t,n){var i=s(e,n);return n-1>=t&&(i|=s(e,n-1)<<4),i}function l(e,t,n,i){for(var r=0,o=Math.min(e.length,n),a=t;a=49?s-49+10:s>=17?s-17+10:s}return r}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var r=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(r++,this.negative=1),r=0;r-=3)a=e[r]|e[r-1]<<8|e[r-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(r=0,o=0;r>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i=t;i-=2)r=c(e,t,i)<=18?(o-=18,a+=1,this.words[a]|=r>>>26):o+=8;else for(i=(e.length-t)%2==0?t+1:t;i=18?(o-=18,a+=1,this.words[a]|=r>>>26):o+=8;this.strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var i=0,r=1;r<=67108863;r*=t)i++;i--,r=r/t|0;for(var o=e.length-n,a=o%i,s=Math.min(o,o-a)+n,c=0,u=n;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var u=["","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"],p=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,n){n.negative=t.negative^e.negative;var i=e.length+t.length|0;n.length=i,i=i-1|0;var r=0|e.words[0],o=0|t.words[0],a=r*o,s=67108863&a,c=a/67108864|0;n.words[0]=s;for(var l=1;l>>26,p=67108863&c,d=Math.min(l,t.length-1),f=Math.max(0,l-e.length+1);f<=d;f++){var h=l-f|0;u+=(a=(r=0|e.words[h])*(o=0|t.words[f])+p)/67108864|0,p=67108863&a}n.words[l]=0|p,c=0|u}return 0!==c?n.words[l]=0|c:n.length--,n.strip()}o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var r=0,o=0,a=0;a>>24-r&16777215)||a!==this.length-1?u[6-c.length]+c+n:c+n,(r+=2)>=26&&(r-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var l=p[e],f=d[e];n="";var h=this.clone();for(h.negative=0;!h.isZero();){var m=h.modn(f).toString(e);n=(h=h.idivn(f)).isZero()?m+n:u[l-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return i(void 0!==a),this.toArrayLike(a,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,n){var r=this.byteLength(),o=n||Math.max(1,r);i(r<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,l=new e(o),u=this.clone();if(c){for(s=0;!u.isZero();s++)a=u.andln(255),u.iushrn(8),l[s]=a;for(;s=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var i=0;ie.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var r=0;r0&&(this.words[r]=~this.words[r]&67108863>>26-n),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var n=e/26|0,r=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,i=e):(n=e,i=this);for(var r=0,o=0;o>>26;for(;0!==r&&o>>26;if(this.length=n.length,0!==r)this.words[this.length]=r,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,i,r=this.cmp(e);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;r>0?(n=this,i=e):(n=e,i=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,f=0|a[1],h=8191&f,m=f>>>13,b=0|a[2],v=8191&b,g=b>>>13,y=0|a[3],x=8191&y,_=y>>>13,w=0|a[4],k=8191&w,S=w>>>13,E=0|a[5],M=8191&E,A=E>>>13,j=0|a[6],I=8191&j,T=j>>>13,C=0|a[7],B=8191&C,R=C>>>13,O=0|a[8],P=8191&O,L=O>>>13,U=0|a[9],q=8191&U,N=U>>>13,D=0|s[0],z=8191&D,H=D>>>13,F=0|s[1],W=8191&F,V=F>>>13,K=0|s[2],$=8191&K,G=K>>>13,X=0|s[3],Y=8191&X,J=X>>>13,Z=0|s[4],Q=8191&Z,ee=Z>>>13,te=0|s[5],ne=8191&te,ie=te>>>13,re=0|s[6],oe=8191&re,ae=re>>>13,se=0|s[7],ce=8191&se,le=se>>>13,ue=0|s[8],pe=8191&ue,de=ue>>>13,fe=0|s[9],he=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var be=(l+(i=Math.imul(p,z))|0)+((8191&(r=(r=Math.imul(p,H))+Math.imul(d,z)|0))<<13)|0;l=((o=Math.imul(d,H))+(r>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(h,z),r=(r=Math.imul(h,H))+Math.imul(m,z)|0,o=Math.imul(m,H);var ve=(l+(i=i+Math.imul(p,W)|0)|0)+((8191&(r=(r=r+Math.imul(p,V)|0)+Math.imul(d,W)|0))<<13)|0;l=((o=o+Math.imul(d,V)|0)+(r>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(v,z),r=(r=Math.imul(v,H))+Math.imul(g,z)|0,o=Math.imul(g,H),i=i+Math.imul(h,W)|0,r=(r=r+Math.imul(h,V)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,V)|0;var ge=(l+(i=i+Math.imul(p,$)|0)|0)+((8191&(r=(r=r+Math.imul(p,G)|0)+Math.imul(d,$)|0))<<13)|0;l=((o=o+Math.imul(d,G)|0)+(r>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(x,z),r=(r=Math.imul(x,H))+Math.imul(_,z)|0,o=Math.imul(_,H),i=i+Math.imul(v,W)|0,r=(r=r+Math.imul(v,V)|0)+Math.imul(g,W)|0,o=o+Math.imul(g,V)|0,i=i+Math.imul(h,$)|0,r=(r=r+Math.imul(h,G)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,G)|0;var ye=(l+(i=i+Math.imul(p,Y)|0)|0)+((8191&(r=(r=r+Math.imul(p,J)|0)+Math.imul(d,Y)|0))<<13)|0;l=((o=o+Math.imul(d,J)|0)+(r>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(k,z),r=(r=Math.imul(k,H))+Math.imul(S,z)|0,o=Math.imul(S,H),i=i+Math.imul(x,W)|0,r=(r=r+Math.imul(x,V)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,V)|0,i=i+Math.imul(v,$)|0,r=(r=r+Math.imul(v,G)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,G)|0,i=i+Math.imul(h,Y)|0,r=(r=r+Math.imul(h,J)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,J)|0;var xe=(l+(i=i+Math.imul(p,Q)|0)|0)+((8191&(r=(r=r+Math.imul(p,ee)|0)+Math.imul(d,Q)|0))<<13)|0;l=((o=o+Math.imul(d,ee)|0)+(r>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(M,z),r=(r=Math.imul(M,H))+Math.imul(A,z)|0,o=Math.imul(A,H),i=i+Math.imul(k,W)|0,r=(r=r+Math.imul(k,V)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,V)|0,i=i+Math.imul(x,$)|0,r=(r=r+Math.imul(x,G)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,G)|0,i=i+Math.imul(v,Y)|0,r=(r=r+Math.imul(v,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(h,Q)|0,r=(r=r+Math.imul(h,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var _e=(l+(i=i+Math.imul(p,ne)|0)|0)+((8191&(r=(r=r+Math.imul(p,ie)|0)+Math.imul(d,ne)|0))<<13)|0;l=((o=o+Math.imul(d,ie)|0)+(r>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(I,z),r=(r=Math.imul(I,H))+Math.imul(T,z)|0,o=Math.imul(T,H),i=i+Math.imul(M,W)|0,r=(r=r+Math.imul(M,V)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(k,$)|0,r=(r=r+Math.imul(k,G)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,G)|0,i=i+Math.imul(x,Y)|0,r=(r=r+Math.imul(x,J)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,J)|0,i=i+Math.imul(v,Q)|0,r=(r=r+Math.imul(v,ee)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,ee)|0,i=i+Math.imul(h,ne)|0,r=(r=r+Math.imul(h,ie)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,ie)|0;var we=(l+(i=i+Math.imul(p,oe)|0)|0)+((8191&(r=(r=r+Math.imul(p,ae)|0)+Math.imul(d,oe)|0))<<13)|0;l=((o=o+Math.imul(d,ae)|0)+(r>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(B,z),r=(r=Math.imul(B,H))+Math.imul(R,z)|0,o=Math.imul(R,H),i=i+Math.imul(I,W)|0,r=(r=r+Math.imul(I,V)|0)+Math.imul(T,W)|0,o=o+Math.imul(T,V)|0,i=i+Math.imul(M,$)|0,r=(r=r+Math.imul(M,G)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,G)|0,i=i+Math.imul(k,Y)|0,r=(r=r+Math.imul(k,J)|0)+Math.imul(S,Y)|0,o=o+Math.imul(S,J)|0,i=i+Math.imul(x,Q)|0,r=(r=r+Math.imul(x,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,i=i+Math.imul(v,ne)|0,r=(r=r+Math.imul(v,ie)|0)+Math.imul(g,ne)|0,o=o+Math.imul(g,ie)|0,i=i+Math.imul(h,oe)|0,r=(r=r+Math.imul(h,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var ke=(l+(i=i+Math.imul(p,ce)|0)|0)+((8191&(r=(r=r+Math.imul(p,le)|0)+Math.imul(d,ce)|0))<<13)|0;l=((o=o+Math.imul(d,le)|0)+(r>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(P,z),r=(r=Math.imul(P,H))+Math.imul(L,z)|0,o=Math.imul(L,H),i=i+Math.imul(B,W)|0,r=(r=r+Math.imul(B,V)|0)+Math.imul(R,W)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(I,$)|0,r=(r=r+Math.imul(I,G)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,G)|0,i=i+Math.imul(M,Y)|0,r=(r=r+Math.imul(M,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(k,Q)|0,r=(r=r+Math.imul(k,ee)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,ee)|0,i=i+Math.imul(x,ne)|0,r=(r=r+Math.imul(x,ie)|0)+Math.imul(_,ne)|0,o=o+Math.imul(_,ie)|0,i=i+Math.imul(v,oe)|0,r=(r=r+Math.imul(v,ae)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,ae)|0,i=i+Math.imul(h,ce)|0,r=(r=r+Math.imul(h,le)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,le)|0;var Se=(l+(i=i+Math.imul(p,pe)|0)|0)+((8191&(r=(r=r+Math.imul(p,de)|0)+Math.imul(d,pe)|0))<<13)|0;l=((o=o+Math.imul(d,de)|0)+(r>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(q,z),r=(r=Math.imul(q,H))+Math.imul(N,z)|0,o=Math.imul(N,H),i=i+Math.imul(P,W)|0,r=(r=r+Math.imul(P,V)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,V)|0,i=i+Math.imul(B,$)|0,r=(r=r+Math.imul(B,G)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,G)|0,i=i+Math.imul(I,Y)|0,r=(r=r+Math.imul(I,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(M,Q)|0,r=(r=r+Math.imul(M,ee)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,ee)|0,i=i+Math.imul(k,ne)|0,r=(r=r+Math.imul(k,ie)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,ie)|0,i=i+Math.imul(x,oe)|0,r=(r=r+Math.imul(x,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,i=i+Math.imul(v,ce)|0,r=(r=r+Math.imul(v,le)|0)+Math.imul(g,ce)|0,o=o+Math.imul(g,le)|0,i=i+Math.imul(h,pe)|0,r=(r=r+Math.imul(h,de)|0)+Math.imul(m,pe)|0,o=o+Math.imul(m,de)|0;var Ee=(l+(i=i+Math.imul(p,he)|0)|0)+((8191&(r=(r=r+Math.imul(p,me)|0)+Math.imul(d,he)|0))<<13)|0;l=((o=o+Math.imul(d,me)|0)+(r>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(q,W),r=(r=Math.imul(q,V))+Math.imul(N,W)|0,o=Math.imul(N,V),i=i+Math.imul(P,$)|0,r=(r=r+Math.imul(P,G)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,G)|0,i=i+Math.imul(B,Y)|0,r=(r=r+Math.imul(B,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,i=i+Math.imul(I,Q)|0,r=(r=r+Math.imul(I,ee)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,ee)|0,i=i+Math.imul(M,ne)|0,r=(r=r+Math.imul(M,ie)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,ie)|0,i=i+Math.imul(k,oe)|0,r=(r=r+Math.imul(k,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,i=i+Math.imul(x,ce)|0,r=(r=r+Math.imul(x,le)|0)+Math.imul(_,ce)|0,o=o+Math.imul(_,le)|0,i=i+Math.imul(v,pe)|0,r=(r=r+Math.imul(v,de)|0)+Math.imul(g,pe)|0,o=o+Math.imul(g,de)|0;var Me=(l+(i=i+Math.imul(h,he)|0)|0)+((8191&(r=(r=r+Math.imul(h,me)|0)+Math.imul(m,he)|0))<<13)|0;l=((o=o+Math.imul(m,me)|0)+(r>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(q,$),r=(r=Math.imul(q,G))+Math.imul(N,$)|0,o=Math.imul(N,G),i=i+Math.imul(P,Y)|0,r=(r=r+Math.imul(P,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,i=i+Math.imul(B,Q)|0,r=(r=r+Math.imul(B,ee)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,ee)|0,i=i+Math.imul(I,ne)|0,r=(r=r+Math.imul(I,ie)|0)+Math.imul(T,ne)|0,o=o+Math.imul(T,ie)|0,i=i+Math.imul(M,oe)|0,r=(r=r+Math.imul(M,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,i=i+Math.imul(k,ce)|0,r=(r=r+Math.imul(k,le)|0)+Math.imul(S,ce)|0,o=o+Math.imul(S,le)|0,i=i+Math.imul(x,pe)|0,r=(r=r+Math.imul(x,de)|0)+Math.imul(_,pe)|0,o=o+Math.imul(_,de)|0;var Ae=(l+(i=i+Math.imul(v,he)|0)|0)+((8191&(r=(r=r+Math.imul(v,me)|0)+Math.imul(g,he)|0))<<13)|0;l=((o=o+Math.imul(g,me)|0)+(r>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(q,Y),r=(r=Math.imul(q,J))+Math.imul(N,Y)|0,o=Math.imul(N,J),i=i+Math.imul(P,Q)|0,r=(r=r+Math.imul(P,ee)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,ee)|0,i=i+Math.imul(B,ne)|0,r=(r=r+Math.imul(B,ie)|0)+Math.imul(R,ne)|0,o=o+Math.imul(R,ie)|0,i=i+Math.imul(I,oe)|0,r=(r=r+Math.imul(I,ae)|0)+Math.imul(T,oe)|0,o=o+Math.imul(T,ae)|0,i=i+Math.imul(M,ce)|0,r=(r=r+Math.imul(M,le)|0)+Math.imul(A,ce)|0,o=o+Math.imul(A,le)|0,i=i+Math.imul(k,pe)|0,r=(r=r+Math.imul(k,de)|0)+Math.imul(S,pe)|0,o=o+Math.imul(S,de)|0;var je=(l+(i=i+Math.imul(x,he)|0)|0)+((8191&(r=(r=r+Math.imul(x,me)|0)+Math.imul(_,he)|0))<<13)|0;l=((o=o+Math.imul(_,me)|0)+(r>>>13)|0)+(je>>>26)|0,je&=67108863,i=Math.imul(q,Q),r=(r=Math.imul(q,ee))+Math.imul(N,Q)|0,o=Math.imul(N,ee),i=i+Math.imul(P,ne)|0,r=(r=r+Math.imul(P,ie)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,ie)|0,i=i+Math.imul(B,oe)|0,r=(r=r+Math.imul(B,ae)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,ae)|0,i=i+Math.imul(I,ce)|0,r=(r=r+Math.imul(I,le)|0)+Math.imul(T,ce)|0,o=o+Math.imul(T,le)|0,i=i+Math.imul(M,pe)|0,r=(r=r+Math.imul(M,de)|0)+Math.imul(A,pe)|0,o=o+Math.imul(A,de)|0;var Ie=(l+(i=i+Math.imul(k,he)|0)|0)+((8191&(r=(r=r+Math.imul(k,me)|0)+Math.imul(S,he)|0))<<13)|0;l=((o=o+Math.imul(S,me)|0)+(r>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(q,ne),r=(r=Math.imul(q,ie))+Math.imul(N,ne)|0,o=Math.imul(N,ie),i=i+Math.imul(P,oe)|0,r=(r=r+Math.imul(P,ae)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,ae)|0,i=i+Math.imul(B,ce)|0,r=(r=r+Math.imul(B,le)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,le)|0,i=i+Math.imul(I,pe)|0,r=(r=r+Math.imul(I,de)|0)+Math.imul(T,pe)|0,o=o+Math.imul(T,de)|0;var Te=(l+(i=i+Math.imul(M,he)|0)|0)+((8191&(r=(r=r+Math.imul(M,me)|0)+Math.imul(A,he)|0))<<13)|0;l=((o=o+Math.imul(A,me)|0)+(r>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(q,oe),r=(r=Math.imul(q,ae))+Math.imul(N,oe)|0,o=Math.imul(N,ae),i=i+Math.imul(P,ce)|0,r=(r=r+Math.imul(P,le)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,le)|0,i=i+Math.imul(B,pe)|0,r=(r=r+Math.imul(B,de)|0)+Math.imul(R,pe)|0,o=o+Math.imul(R,de)|0;var Ce=(l+(i=i+Math.imul(I,he)|0)|0)+((8191&(r=(r=r+Math.imul(I,me)|0)+Math.imul(T,he)|0))<<13)|0;l=((o=o+Math.imul(T,me)|0)+(r>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,i=Math.imul(q,ce),r=(r=Math.imul(q,le))+Math.imul(N,ce)|0,o=Math.imul(N,le),i=i+Math.imul(P,pe)|0,r=(r=r+Math.imul(P,de)|0)+Math.imul(L,pe)|0,o=o+Math.imul(L,de)|0;var Be=(l+(i=i+Math.imul(B,he)|0)|0)+((8191&(r=(r=r+Math.imul(B,me)|0)+Math.imul(R,he)|0))<<13)|0;l=((o=o+Math.imul(R,me)|0)+(r>>>13)|0)+(Be>>>26)|0,Be&=67108863,i=Math.imul(q,pe),r=(r=Math.imul(q,de))+Math.imul(N,pe)|0,o=Math.imul(N,de);var Re=(l+(i=i+Math.imul(P,he)|0)|0)+((8191&(r=(r=r+Math.imul(P,me)|0)+Math.imul(L,he)|0))<<13)|0;l=((o=o+Math.imul(L,me)|0)+(r>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Oe=(l+(i=Math.imul(q,he))|0)+((8191&(r=(r=Math.imul(q,me))+Math.imul(N,he)|0))<<13)|0;return l=((o=Math.imul(N,me))+(r>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,c[0]=be,c[1]=ve,c[2]=ge,c[3]=ye,c[4]=xe,c[5]=_e,c[6]=we,c[7]=ke,c[8]=Se,c[9]=Ee,c[10]=Me,c[11]=Ae,c[12]=je,c[13]=Ie,c[14]=Te,c[15]=Ce,c[16]=Be,c[17]=Re,c[18]=Oe,0!==l&&(c[19]=l,n.length++),n};function m(e,t,n){return(new b).mulp(e,t,n)}function b(e,t){this.x=e,this.y=t}Math.imul||(h=f),o.prototype.mulTo=function(e,t){var n,i=this.length+e.length;return n=10===this.length&&10===e.length?h(this,e,t):i<63?f(this,e,t):i<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var i=0,r=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,i=a,a=r}return 0!==i?n.words[o]=i:n.length--,n.strip()}(this,e,t):m(this,e,t),n},b.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,i=0;i>=1;return i},b.prototype.permute=function(e,t,n,i,r,o){for(var a=0;a>>=1)r++;return 1<>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*t;a>=26,t+=r/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>r}return t}(e);if(0===t.length)return new o(1);for(var n=this,i=0;i=0);var t,n=e%26,r=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==r){for(t=this.length-1;t>=0;t--)this.words[t+r]=this.words[t];for(t=0;t=0),r=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,l=0;l=0&&(0!==u||l>=r);l--){var p=0|this.words[l];this.words[l]=u<<26-o|p>>>o,u=p&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,n){return i(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,r=1<=0);var t=e%26,n=(e-t)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var r=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[r+n]=67108863&o}for(;r>26,this.words[r+n]=67108863&o;if(0===s)return this.strip();for(i(-1===s),s=0,r=0;r>26,this.words[r]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),i=this.clone(),r=e,a=0|r.words[r.length-1];0!==(n=26-this._countBits(a))&&(r=r.ushln(n),i.iushln(n),a=0|r.words[r.length-1]);var s,c=i.length-r.length;if("mod"!==t){(s=new o(null)).length=c+1,s.words=new Array(s.length);for(var l=0;l=0;p--){var d=67108864*(0|i.words[r.length+p])+(0|i.words[r.length+p-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(r,d,p);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(r,1,p),i.isZero()||(i.negative^=1);s&&(s.words[p]=d)}return s&&s.strip(),i.strip(),"div"!==t&&0!==n&&i.iushrn(n),{div:s||null,mod:i}},o.prototype.divmod=function(e,t,n){return i(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(r=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:r,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(r=s.div.neg()),{div:r,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var r,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),r=e.andln(1),o=n.cmp(i);return o<0||1===r&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){i(e<=67108863);for(var t=(1<<26)%e,n=0,r=this.length-1;r>=0;r--)n=(t*n+(0|this.words[r]))%e;return n},o.prototype.idivn=function(e){i(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var r=(0|this.words[n])+67108864*t;this.words[n]=r/e|0,t=r%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var r=new o(1),a=new o(0),s=new o(0),c=new o(1),l=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++l;for(var u=n.clone(),p=t.clone();!t.isZero();){for(var d=0,f=1;0==(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(r.isOdd()||a.isOdd())&&(r.iadd(u),a.isub(p)),r.iushrn(1),a.iushrn(1);for(var h=0,m=1;0==(n.words[0]&m)&&h<26;++h,m<<=1);if(h>0)for(n.iushrn(h);h-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(u),c.isub(p)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),r.isub(s),a.isub(c)):(n.isub(t),s.isub(r),c.isub(a))}return{a:s,b:c,gcd:n.iushln(l)}},o.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var r,a=new o(1),s=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var l=0,u=1;0==(t.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(t.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var p=0,d=1;0==(n.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(n.iushrn(p);p-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.isub(t),s.isub(a))}return(r=0===t.cmpn(1)?a:s).cmpn(0)<0&&r.iadd(e),r},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var i=0;t.isEven()&&n.isEven();i++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var r=t.cmp(n);if(r<0){var o=t;t=n,n=o}else if(0===r||0===n.cmpn(1))break;t.isub(n)}return n.iushln(i)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,n=(e-t)/26,r=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),i(e<=67108863,"Number is too big");var r=0|this.words[0];t=r===e?0:re.length)return 1;if(this.length=0;n--){var i=0|this.words[n],r=0|e.words[n];if(i!==r){ir&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new k(e)},o.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function x(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function S(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},r(y,g),y.prototype.split=function(e,t){for(var n=4194303,i=Math.min(e.length,9),r=0;r>>22,o=a}o>>>=22,e.words[r-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=r,t=i}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new x;else if("p192"===e)t=new _;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new w}return v[e]=t,t},k.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){i(0==(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},k.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var r=this.m.subn(1),a=0;!r.isZero()&&0===r.andln(1);)a++,r.iushrn(1);i(!r.isZero());var s=new o(1).toRed(this),c=s.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new o(2*u*u).toRed(this);0!==this.pow(u,l).cmp(c);)u.redIAdd(c);for(var p=this.pow(u,r),d=this.pow(e,r.addn(1).iushrn(1)),f=this.pow(e,r),h=a;0!==f.cmp(s);){for(var m=f,b=0;0!==m.cmp(s);b++)m=m.redSqr();i(b=0;i--){for(var l=t.words[i],u=c-1;u>=0;u--){var p=l>>u&1;r!==n[0]&&(r=this.sqr(r)),0!==p||0!==a?(a<<=1,a|=p,(4===++s||0===i&&0===u)&&(r=this.mul(r,n[a]),s=0,a=0)):s=0}c=26}return r},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new S(e)},r(S,k),S.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},S.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},S.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),i=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),r=n.isub(i).iushrn(this.shift),o=r;return r.cmp(this.m)>=0?o=r.isub(this.m):r.cmpn(0)<0&&(o=r.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),i=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),r=n.isub(i).iushrn(this.shift),a=r;return r.cmp(this.m)>=0?a=r.isub(this.m):r.cmpn(0)<0&&(a=r.iadd(this.m)),a._forceRed(this)},S.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:67}],18:[function(e,t,n){"use strict";n.byteLength=function(e){var t=c(e),n=t[0],i=t[1];return 3*(n+i)/4-i},n.toByteArray=function(e){var t,n,i=c(e),a=i[0],s=i[1],l=new o(function(e,t,n){return 3*(t+n)/4-n}(0,a,s)),u=0,p=s>0?a-4:a;for(n=0;n>16&255,l[u++]=t>>8&255,l[u++]=255&t;2===s&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,l[u++]=255&t);1===s&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t);return l},n.fromByteArray=function(e){for(var t,n=e.length,r=n%3,o=[],a=16383,s=0,c=n-r;sc?c:s+a));1===r?(t=e[n-1],o.push(i[t>>2]+i[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],o.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return o.join("")};for(var i=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)i[s]=a[s],r[a.charCodeAt(s)]=s;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var r,o,a=[],s=t;s>18&63]+i[o>>12&63]+i[o>>6&63]+i[63&o]);return a.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},{}],19:[function(e,t,n){(function(e){(function(){function n(e,t,n){let i=0,r=1;for(let o=t;o=48)i=10*i+(n-48);else if(o!==t||43!==n){if(o!==t||45!==n){if(46===n)break;throw new Error("not a number: buffer["+o+"] = "+n)}r=-1}}return i*r}function i(t,n,r,o){return null==t||0===t.length?null:("number"!=typeof n&&null==o&&(o=n,n=void 0),"number"!=typeof r&&null==o&&(o=r,r=void 0),i.position=0,i.encoding=o||null,i.data=e.isBuffer(t)?t.slice(n,r):e.from(t),i.bytes=i.data.length,i.next())}i.bytes=0,i.position=0,i.data=null,i.encoding=null,i.next=function(){switch(i.data[i.position]){case 100:return i.dictionary();case 108:return i.list();case 105:return i.integer();default:return i.buffer()}},i.find=function(e){let t=i.position;const n=i.data.length,r=i.data;for(;t{const r=t.split("-").map((e=>parseInt(e)));return e.concat(((e,t=e)=>Array.from({length:t-e+1},((t,n)=>n+e)))(...r))}),[])}t.exports=i,t.exports.parse=i,t.exports.compose=function(e){return e.reduce(((e,t,n,i)=>(0!==n&&t===i[n-1]+1||e.push([]),e[e.length-1].push(t),e)),[]).map((e=>e.length>1?`${e[0]}-${e[e.length-1]}`:`${e[0]}`))}},{}],25:[function(e,t,n){t.exports=function(e,t,n,i,r){var o,a;if(void 0===i)i=0;else if((i|=0)<0||i>=e.length)throw new RangeError("invalid lower bound");if(void 0===r)r=e.length-1;else if((r|=0)=e.length)throw new RangeError("invalid upper bound");for(;i<=r;)if((a=+n(e[o=i+(r-i>>>1)],t,o,e))<0)i=o+1;else{if(!(a>0))return o;r=o-1}return~i}},{}],26:[function(e,t,n){"use strict";function i(e){var t=e>>3;return e%8!=0&&t++,t}Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function e(e,t){void 0===e&&(e=0);var n=null==t?void 0:t.grow;this.grow=n&&isFinite(n)&&i(n)||n||0,this.buffer="number"==typeof e?new Uint8Array(i(e)):e}return e.prototype.get=function(e){var t=e>>3;return t>e%8)},e.prototype.set=function(e,t){void 0===t&&(t=!0);var n=e>>3;if(t){if(this.buffer.length>e%8}else n>e%8))},e.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=8*this.buffer.length);for(var i=t,r=i>>3,o=128>>i%8,a=this.buffer[r];i>1},e}();n.default=r},{}],27:[function(e,t,n){(function(n){(function(){ /*! bittorrent-protocol. MIT License. WebTorrent LLC */ const i=e("unordered-array-remove"),r=e("bencode"),o=e("bitfield").default,a=e("crypto"),s=e("debug")("bittorrent-protocol"),c=e("randombytes"),l=e("simple-sha1"),u=e("speedometer"),p=e("readable-stream"),d=e("rc4"),f=n.from("BitTorrent protocol"),h=n.from([0,0,0,0]),m=n.from([0,0,0,1,0]),b=n.from([0,0,0,1,1]),v=n.from([0,0,0,1,2]),g=n.from([0,0,0,1,3]),y=[0,0,0,0,0,0,0,0],x=[0,0,0,3,9,0,0],_=n.from([0,0,0,1,14]),w=n.from([0,0,0,1,15]),k=n.from([0,0,0,0,0,0,0,0]),S=n.from([0,0,1,2]),E=n.from([0,0,0,2]);function M(e,t){for(let n=e.length;n--;)e[n]^=t[n];return e}class A{constructor(e,t,n,i){this.piece=e,this.offset=t,this.length=n,this.callback=i}}class j{constructor(){this.buffer=new Uint8Array}get(e){return!0}set(e){}}class I extends p.Duplex{constructor(e=null,t=0,n=!1){super(),this._debugId=c(4).toString("hex"),this._debug("new wire"),this.peerId=null,this.peerIdBuffer=null,this.type=e,this.amChoking=!0,this.amInterested=!1,this.peerChoking=!0,this.peerInterested=!1,this.peerPieces=new o(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=u(),this.downloadSpeed=u(),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=n,n?(this._dh=a.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===t?this._parsePe2():this._parseHandshake(null)}setKeepAlive(e){this._debug("setKeepAlive %s",e),clearInterval(this._keepAliveInterval),!1!==e&&(this._keepAliveInterval=setInterval((()=>{this.keepAlive()}),55e3))}setTimeout(e,t){this._debug("setTimeout ms=%d unref=%s",e,t),this._timeoutMs=e,this._timeoutUnref=!!t,this._resetTimeout(!0)}destroy(){if(!this.destroyed)return this.destroyed=!0,this._debug("destroy"),this.emit("close"),this.end(),this}end(...e){return this._debug("end"),this._onUninterested(),this._onChoke(),super.end(...e)}use(e){const t=e.prototype.name;if(!t)throw new Error('Extension class requires a "name" property on the prototype');this._debug("use extension.name=%s",t);const n=this._nextExt,i=new e(this);function r(){}"function"!=typeof i.onHandshake&&(i.onHandshake=r),"function"!=typeof i.onExtendedHandshake&&(i.onExtendedHandshake=r),"function"!=typeof i.onMessage&&(i.onMessage=r),this.extendedMapping[n]=t,this._ext[t]=i,this[t]=i,this._nextExt+=1}keepAlive(){this._debug("keep-alive"),this._push(h)}sendPe1(){if(this._peEnabled){const e=Math.floor(513*Math.random()),t=c(e);this._push(n.concat([n.from(this._myPubKey,"hex"),t]))}}sendPe2(){const e=Math.floor(513*Math.random()),t=c(e);this._push(n.concat([n.from(this._myPubKey,"hex"),t]))}sendPe3(e){this.setEncrypt(this._sharedSecret,e);const t=n.from(l.sync(n.from(this._utfToHex("req1")+this._sharedSecret,"hex")),"hex"),i=M(n.from(l.sync(n.from(this._utfToHex("req2")+e,"hex")),"hex"),n.from(l.sync(n.from(this._utfToHex("req3")+this._sharedSecret,"hex")),"hex")),r=c(2).readUInt16BE(0)%512,o=c(r);let a=n.alloc(14+r+2);k.copy(a),S.copy(a,8),a.writeInt16BE(r,12),o.copy(a,14),a.writeInt16BE(0,14+r),a=this._encryptHandshake(a),this._push(n.concat([t,i,a]))}sendPe4(e){this.setEncrypt(this._sharedSecret,e);const t=c(2).readUInt16BE(0)%512,i=c(t);let r=n.alloc(14+t);k.copy(r),E.copy(r,8),r.writeInt16BE(t,12),i.copy(r,14),r=this._encryptHandshake(r),this._push(r),this._cryptoHandshakeDone=!0,this._debug("completed crypto handshake")}handshake(e,t,i){let r,o;if("string"==typeof e?(e=e.toLowerCase(),r=n.from(e,"hex")):(r=e,e=r.toString("hex")),"string"==typeof t?o=n.from(t,"hex"):(o=t,t=o.toString("hex")),this._infoHash=r,20!==r.length||20!==o.length)throw new Error("infoHash and peerId MUST have length 20");this._debug("handshake i=%s p=%s exts=%o",e,t,i);const a=n.from(y);this.extensions={extended:!0,dht:!(!i||!i.dht),fast:!(!i||!i.fast)},a[5]|=16,this.extensions.dht&&(a[7]|=1),this.extensions.fast&&(a[7]|=4),this.extensions.fast&&this.peerExtensions.fast&&(this._debug("fast extension is enabled"),this.hasFast=!0),this._push(n.concat([f,a,r,o])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()}_sendExtendedHandshake(){const e=Object.assign({},this.extendedHandshake);e.m={};for(const t in this.extendedMapping){const n=this.extendedMapping[t];e.m[n]=Number(t)}this.extended(0,r.encode(e)),this._extendedHandshakeSent=!0}choke(){if(!this.amChoking)if(this.amChoking=!0,this._debug("choke"),this._push(m),this.hasFast){let e=0;for(;this.peerRequests.length>e;){const t=this.peerRequests[e];this.allowedFastSet.includes(t.piece)?++e:this.reject(t.piece,t.offset,t.length)}}else for(;this.peerRequests.length;)this.peerRequests.pop()}unchoke(){this.amChoking&&(this.amChoking=!1,this._debug("unchoke"),this._push(b))}interested(){this.amInterested||(this.amInterested=!0,this._debug("interested"),this._push(v))}uninterested(){this.amInterested&&(this.amInterested=!1,this._debug("uninterested"),this._push(g))}have(e){this._debug("have %d",e),this._message(4,[e],null)}bitfield(e){this._debug("bitfield"),n.isBuffer(e)||(e=e.buffer),this._message(5,[],e)}request(e,t,n,i){return i||(i=()=>{}),this._finished?i(new Error("wire is closed")):!this.peerChoking||this.hasFast&&this.peerAllowedFastSet.includes(e)?(this._debug("request index=%d offset=%d length=%d",e,t,n),this.requests.push(new A(e,t,n,i)),this._timeout||this._resetTimeout(!0),void this._message(6,[e,t,n],null)):i(new Error("peer is choking"))}piece(e,t,n){this._debug("piece index=%d offset=%d",e,t),this._message(7,[e,t],n),this.uploaded+=n.length,this.uploadSpeed(n.length),this.emit("upload",n.length)}cancel(e,t,n){this._debug("cancel index=%d offset=%d length=%d",e,t,n),this._callback(this._pull(this.requests,e,t,n),new Error("request was cancelled"),null),this._message(8,[e,t,n],null)}port(e){this._debug("port %d",e);const t=n.from(x);t.writeUInt16BE(e,5),this._push(t)}suggest(e){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("suggest %d",e),this._message(13,[e],null)}haveAll(){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("have-all"),this._push(_)}haveNone(){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("have-none"),this._push(w)}reject(e,t,n){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("reject index=%d offset=%d length=%d",e,t,n),this._pull(this.peerRequests,e,t,n),this._message(16,[e,t,n],null)}allowedFast(e){if(!this.hasFast)throw Error("fast extension is disabled");this._debug("allowed-fast %d",e),this.allowedFastSet.includes(e)||this.allowedFastSet.push(e),this._message(17,[e],null)}extended(e,t){if(this._debug("extended ext=%s",e),"string"==typeof e&&this.peerExtendedMapping[e]&&(e=this.peerExtendedMapping[e]),"number"!=typeof e)throw new Error(`Unrecognized extension: ${e}`);{const i=n.from([e]),o=n.isBuffer(t)?t:r.encode(t);this._message(20,[],n.concat([i,o]))}}setEncrypt(e,t){let i,r,o,a,s,c;switch(this.type){case"tcpIncoming":i=l.sync(n.from(this._utfToHex("keyB")+e+t,"hex")),r=l.sync(n.from(this._utfToHex("keyA")+e+t,"hex")),o=n.from(i,"hex"),a=[];for(const e of o.values())a.push(e);s=n.from(r,"hex"),c=[];for(const e of s.values())c.push(e);this._encryptGenerator=new d(a),this._decryptGenerator=new d(c);break;case"tcpOutgoing":i=l.sync(n.from(this._utfToHex("keyA")+e+t,"hex")),r=l.sync(n.from(this._utfToHex("keyB")+e+t,"hex")),o=n.from(i,"hex"),a=[];for(const e of o.values())a.push(e);s=n.from(r,"hex"),c=[];for(const e of s.values())c.push(e);this._encryptGenerator=new d(a),this._decryptGenerator=new d(c);break;default:return!1}for(let e=0;e<1024;e++)this._encryptGenerator.randomByte(),this._decryptGenerator.randomByte();return this._setGenerators=!0,!0}_read(){}_message(e,t,i){const r=i?i.length:0,o=n.allocUnsafe(5+4*t.length);o.writeUInt32BE(o.length+r-4,0),o[4]=e;for(let e=0;e{if(r===this._pull(this.peerRequests,e,t,n))return i?(this._debug("error satisfying request index=%d offset=%d length=%d (%s)",e,t,n,i.message),void(this.hasFast&&this.reject(e,t,n))):void this.piece(e,t,o)},r=new A(e,t,n,i);this.peerRequests.push(r),this.emit("request",e,t,n,i)}_onPiece(e,t,n){this._debug("got piece index=%d offset=%d",e,t),this._callback(this._pull(this.requests,e,t,n.length),null,n),this.downloaded+=n.length,this.downloadSpeed(n.length),this.emit("download",n.length),this.emit("piece",e,t,n)}_onCancel(e,t,n){this._debug("got cancel index=%d offset=%d length=%d",e,t,n),this._pull(this.peerRequests,e,t,n),this.emit("cancel",e,t,n)}_onPort(e){this._debug("got port %d",e),this.emit("port",e)}_onSuggest(e){if(!this.hasFast)return this._debug("Error: got suggest whereas fast extension is disabled"),void this.destroy();this._debug("got suggest %d",e),this.emit("suggest",e)}_onHaveAll(){if(!this.hasFast)return this._debug("Error: got have-all whereas fast extension is disabled"),void this.destroy();this._debug("got have-all"),this.peerPieces=new j,this.emit("have-all")}_onHaveNone(){if(!this.hasFast)return this._debug("Error: got have-none whereas fast extension is disabled"),void this.destroy();this._debug("got have-none"),this.emit("have-none")}_onReject(e,t,n){if(!this.hasFast)return this._debug("Error: got reject whereas fast extension is disabled"),void this.destroy();this._debug("got reject index=%d offset=%d length=%d",e,t,n),this._callback(this._pull(this.requests,e,t,n),new Error("request was rejected"),null),this.emit("reject",e,t,n)}_onAllowedFast(e){if(!this.hasFast)return this._debug("Error: got allowed-fast whereas fast extension is disabled"),void this.destroy();this._debug("got allowed-fast %d",e),this.peerAllowedFastSet.includes(e)||this.peerAllowedFastSet.push(e),this.peerAllowedFastSet.length>100&&this.peerAllowedFastSet.shift(),this.emit("allowed-fast",e)}_onExtended(e,t){if(0===e){let e;try{e=r.decode(t)}catch(e){this._debug("ignoring invalid extended handshake: %s",e.message||e)}if(!e)return;if(this.peerExtendedHandshake=e,"object"==typeof e.m)for(const t in e.m)this.peerExtendedMapping[t]=Number(e.m[t].toString());for(const e in this._ext)this.peerExtendedMapping[e]&&this._ext[e].onExtendedHandshake(this.peerExtendedHandshake);this._debug("got extended handshake"),this.emit("extended","handshake",this.peerExtendedHandshake)}else this.extendedMapping[e]&&(e=this.extendedMapping[e],this._ext[e]&&this._ext[e].onMessage(t)),this._debug("got extended message ext=%s",e),this.emit("extended",e,t)}_onTimeout(){this._debug("request timed out"),this._callback(this.requests.shift(),new Error("request has timed out"),null),this.emit("timeout")}_write(e,t,i){if(2===this._encryptionMethod&&this._cryptoHandshakeDone&&(e=this._decrypt(e)),this._bufferSize+=e.length,this._buffer.push(e),this._buffer.length>1&&(this._buffer=[n.concat(this._buffer,this._bufferSize)]),this._cryptoSyncPattern){const t=this._buffer[0].indexOf(this._cryptoSyncPattern);if(-1!==t)this._buffer[0]=this._buffer[0].slice(t+this._cryptoSyncPattern.length),this._bufferSize-=t+this._cryptoSyncPattern.length,this._cryptoSyncPattern=null;else if(this._bufferSize+e.length>this._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(n.from([]));else{const e=this._buffer[0];this._bufferSize-=this._parserSize,this._buffer=this._bufferSize?[e.slice(this._parserSize)]:[],this._parser(e.slice(0,this._parserSize))}i(null)}_callback(e,t,n){e&&(this._resetTimeout(!this.peerChoking&&!this._finished),e.callback(t,n))}_resetTimeout(e){if(!e||!this._timeoutMs||!this.requests.length)return clearTimeout(this._timeout),this._timeout=null,void(this._timeoutExpiresAt=null);const t=Date.now()+this._timeoutMs;if(this._timeout){if(t-this._timeoutExpiresAt<.05*this._timeoutMs)return;clearTimeout(this._timeout)}this._timeoutExpiresAt=t,this._timeout=setTimeout((()=>this._onTimeout()),this._timeoutMs),this._timeoutUnref&&this._timeout.unref&&this._timeout.unref()}_parse(e,t){this._parserSize=e,this._parser=t}_parseUntil(e,t){this._cryptoSyncPattern=e,this._waitMaxBytes=t}_onMessageLength(e){const t=e.readUInt32BE(0);t>0?this._parse(t,this._onMessage):(this._onKeepAlive(),this._parse(4,this._onMessageLength))}_onMessage(e){switch(this._parse(4,this._onMessageLength),e[0]){case 0:return this._onChoke();case 1:return this._onUnchoke();case 2:return this._onInterested();case 3:return this._onUninterested();case 4:return this._onHave(e.readUInt32BE(1));case 5:return this._onBitField(e.slice(1));case 6:return this._onRequest(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 7:return this._onPiece(e.readUInt32BE(1),e.readUInt32BE(5),e.slice(9));case 8:return this._onCancel(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 9:return this._onPort(e.readUInt16BE(1));case 13:return this._onSuggest(e.readUInt32BE(1));case 14:return this._onHaveAll();case 15:return this._onHaveNone();case 16:return this._onReject(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 17:return this._onAllowedFast(e.readUInt32BE(1));case 20:return this._onExtended(e.readUInt8(1),e.slice(2));default:return this._debug("got unknown message"),this.emit("unknownmessage",e)}}_determineHandshakeType(){this._parse(1,(e=>{const t=e.readUInt8(0);19===t?this._parse(t+48,this._onHandshakeBuffer):this._parsePe1(e)}))}_parsePe1(e){this._parse(95,(t=>{this._onPe1(n.concat([e,t])),this._parsePe3()}))}_parsePe2(){this._parse(96,(e=>{for(this._onPe2(e);!this._setGenerators;);this._parsePe4()}))}_parsePe3(){const e=n.from(l.sync(n.from(this._utfToHex("req1")+this._sharedSecret,"hex")),"hex");this._parseUntil(e,512),this._parse(20,(e=>{for(this._onPe3(e);!this._setGenerators;);this._parsePe3Encrypted()}))}_parsePe3Encrypted(){this._parse(14,(e=>{const t=this._decryptHandshake(e.slice(0,8)),n=this._decryptHandshake(e.slice(8,12)),i=this._decryptHandshake(e.slice(12,14)).readUInt16BE(0);this._parse(i,(e=>{e=this._decryptHandshake(e),this._parse(2,(i=>{const r=this._decryptHandshake(i).readUInt16BE(0);this._parse(r,(i=>{i=this._decryptHandshake(i),this._onPe3Encrypted(t,n,e,i);const o=r?i.readUInt8(0):null,a=r?i.slice(1,20):null;19===o&&"BitTorrent protocol"===a.toString()?this._onHandshakeBuffer(i.slice(1)):this._parseHandshake()}))}))}))}))}_parsePe4(){const e=this._decryptHandshake(k);this._parseUntil(e,512),this._parse(6,(e=>{const t=this._decryptHandshake(e.slice(0,4)),n=this._decryptHandshake(e.slice(4,6)).readUInt16BE(0);this._parse(n,(e=>{this._decryptHandshake(e),this._onPe4(t),this._parseHandshake(null)}))}))}_parseHandshake(){this._parse(1,(e=>{const t=e.readUInt8(0);if(19!==t)return this._debug("Error: wire not speaking BitTorrent protocol (%s)",t.toString()),void this.end();this._parse(t+48,this._onHandshakeBuffer)}))}_onHandshakeBuffer(e){const t=e.slice(0,19);if("BitTorrent protocol"!==t.toString())return this._debug("Error: wire not speaking BitTorrent protocol (%s)",t.toString()),void this.end();e=e.slice(19),this._onHandshake(e.slice(8,28),e.slice(28,48),{dht:!!(1&e[7]),fast:!!(4&e[7]),extended:!!(16&e[5])}),this._parse(4,this._onMessageLength)}_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(...e){e[0]=`[${this._debugId}] ${e[0]}`,s(...e)}_pull(e,t,n,r){for(let o=0;o2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}r("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(e,t,n){var i,r,a,s;if("string"==typeof t&&(r="not ",t.substr(!a||a<0?0:+a,r.length)===r)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))s="The ".concat(e," ").concat(i," ").concat(o(t,"type"));else{var c=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(c," ").concat(i," ").concat(o(t,"type"))}return s+=". Received type ".concat(typeof n)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},{}],29:[function(e,t,n){(function(n){(function(){"use strict";var i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=l;var r=e("./_stream_readable"),o=e("./_stream_writable");e("inherits")(l,r);for(var a=i(o.prototype),s=0;s0)if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===s.prototype||(t=function(e){return s.from(e)}(t)),i)a.endEmitted?w(e,new _):A(e,a,t,!0);else if(a.ended)w(e,new y);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||0!==t.length?A(e,a,t,!1):B(e,a)):A(e,a,t,!1)}else i||(a.reading=!1,B(e,a));return!a.ended&&(a.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=j?e=j:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function T(e){var t=e._readableState;l("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(l("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(C,e))}function C(e){var t=e._readableState;l("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,U(e)}function B(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(R,e,t))}function R(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function P(e){l("readable nexttick read 0"),e.read(0)}function L(e,t){l("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),U(e),t.flowing&&!t.reading&&e.read(0)}function U(e){var t=e._readableState;for(l("flow",t.flowing);t.flowing&&null!==e.read(););}function q(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function N(e){var t=e._readableState;l("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(D,t,e))}function D(e,t){if(l("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function z(e,t){for(var n=0,i=e.length;n=t.highWaterMark:t.length>0)||t.ended))return l("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?N(this):T(this),null;if(0===(e=I(e,t))&&t.ended)return 0===t.length&&N(this),null;var i,r=t.needReadable;return l("need readable",r),(0===t.length||t.length-e0?q(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&N(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){w(this,new x("_read()"))},E.prototype.pipe=function(e,t){var i=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,l("pipe count=%d opts=%j",r.pipesCount,t);var a=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?c:b;function s(t,n){l("onunpipe"),t===i&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,l("cleanup"),e.removeListener("close",h),e.removeListener("finish",m),e.removeListener("drain",u),e.removeListener("error",f),e.removeListener("unpipe",s),i.removeListener("end",c),i.removeListener("end",b),i.removeListener("data",d),p=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||u())}function c(){l("onend"),e.end()}r.endEmitted?n.nextTick(a):i.once("end",a),e.on("unpipe",s);var u=function(e){return function(){var t=e._readableState;l("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,U(e))}}(i);e.on("drain",u);var p=!1;function d(t){l("ondata");var n=e.write(t);l("dest.write",n),!1===n&&((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==z(r.pipes,e))&&!p&&(l("false write response, pause",r.awaitDrain),r.awaitDrain++),i.pause())}function f(t){l("onerror",t),b(),e.removeListener("error",f),0===o(e,"error")&&w(e,t)}function h(){e.removeListener("finish",m),b()}function m(){l("onfinish"),e.removeListener("close",h),b()}function b(){l("unpipe"),i.unpipe(e)}return i.on("data",d),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",f),e.once("close",h),e.once("finish",m),e.emit("pipe",i),r.flowing||(l("pipe resume"),i.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var i=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==r.flowing&&this.resume()):"readable"===e&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,l("on readable",r.length,r.reading),r.length?T(this):r.reading||n.nextTick(P,this))),i},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(e,t){var i=a.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(O,this),i},E.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(O,this),t},E.prototype.resume=function(){var e=this._readableState;return e.flowing||(l("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(L,e,t))}(this,e)),e.paused=!1,this},E.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},E.prototype.wrap=function(e){var t=this,n=this._readableState,i=!1;for(var r in e.on("end",(function(){if(l("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(r){(l("wrapped data"),n.decoder&&(r=n.decoder.write(r)),n.objectMode&&null==r)||(n.objectMode||r&&r.length)&&(t.push(r)||(i=!0,e.pause()))})),e)void 0===this[r]&&"function"==typeof e[r]&&(this[r]=function(t){return function(){return e[t].apply(e,arguments)}}(r));for(var o=0;o-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(E.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(E.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),E.prototype._write=function(e,t,n){n(new m("_write()"))},E.prototype._writev=null,E.prototype.end=function(e,t,i){var r=this._writableState;return"function"==typeof e?(i=e,e=null,t=null):"function"==typeof t&&(i=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,i){t.ending=!0,C(e,t),i&&(t.finished?n.nextTick(i):e.once("finish",i));t.ended=!0,e.writable=!1}(this,r,i),this},Object.defineProperty(E.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),E.prototype.destroy=p.destroy,E.prototype._undestroy=p.undestroy,E.prototype._destroy=function(e,t){t(e)}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":28,"./_stream_duplex":29,"./internal/streams/destroy":36,"./internal/streams/state":40,"./internal/streams/stream":41,_process:309,buffer:110,inherits:229,"util-deprecate":459}],34:[function(e,t,n){(function(n){(function(){"use strict";var i;function r(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o=e("./end-of-stream"),a=Symbol("lastResolve"),s=Symbol("lastReject"),c=Symbol("error"),l=Symbol("ended"),u=Symbol("lastPromise"),p=Symbol("handlePromise"),d=Symbol("stream");function f(e,t){return{value:e,done:t}}function h(e){var t=e[a];if(null!==t){var n=e[d].read();null!==n&&(e[u]=null,e[a]=null,e[s]=null,t(f(n,!1)))}}function m(e){n.nextTick(h,e)}var b=Object.getPrototypeOf((function(){})),v=Object.setPrototypeOf((r(i={get stream(){return this[d]},next:function(){var e=this,t=this[c];if(null!==t)return Promise.reject(t);if(this[l])return Promise.resolve(f(void 0,!0));if(this[d].destroyed)return new Promise((function(t,i){n.nextTick((function(){e[c]?i(e[c]):t(f(void 0,!0))}))}));var i,r=this[u];if(r)i=new Promise(function(e,t){return function(n,i){e.then((function(){t[l]?n(f(void 0,!0)):t[p](n,i)}),i)}}(r,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(f(o,!1));i=new Promise(this[p])}return this[u]=i,i}},Symbol.asyncIterator,(function(){return this})),r(i,"return",(function(){var e=this;return new Promise((function(t,n){e[d].destroy(null,(function(e){e?n(e):t(f(void 0,!0))}))}))})),i),b);t.exports=function(e){var t,n=Object.create(v,(r(t={},d,{value:e,writable:!0}),r(t,a,{value:null,writable:!0}),r(t,s,{value:null,writable:!0}),r(t,c,{value:null,writable:!0}),r(t,l,{value:e._readableState.endEmitted,writable:!0}),r(t,p,{value:function(e,t){var i=n[d].read();i?(n[u]=null,n[a]=null,n[s]=null,e(f(i,!1))):(n[a]=e,n[s]=t)},writable:!0}),t));return n[u]=null,o(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[s];return null!==t&&(n[u]=null,n[a]=null,n[s]=null,t(e)),void(n[c]=e)}var i=n[a];null!==i&&(n[u]=null,n[a]=null,n[s]=null,i(f(void 0,!0))),n[l]=!0})),e.on("readable",m.bind(null,n)),n}}).call(this)}).call(this,e("_process"))},{"./end-of-stream":37,_process:309}],35:[function(e,t,n){"use strict";function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return c.alloc(0);for(var t,n,i,r=c.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,n=r,i=a,c.prototype.copy.call(t,n,i),a+=o.data.length,o=o.next;return r}},{key:"consume",value:function(e,t){var n;return er.length?r.length:e;if(o===r.length?i+=r:i+=r.slice(0,e),0==(e-=o)){o===r.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=r.slice(o));break}++n}return this.length-=n,i}},{key:"_getBuffer",value:function(e){var t=c.allocUnsafe(e),n=this.head,i=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var r=n.data,o=e>r.length?r.length:e;if(r.copy(t,t.length-e,0,o),0==(e-=o)){o===r.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=r.slice(o));break}++i}return this.length-=i,t}},{key:u,value:function(e,t){return l(this,r(r({},t),{},{depth:0,customInspect:!1}))}}])&&a(t.prototype,n),i&&a(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}()},{buffer:110,util:67}],36:[function(e,t,n){(function(e){(function(){"use strict";function n(e,t){r(e,t),i(e)}function i(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function r(e,t){e.emit("error",t)}t.exports={destroy:function(t,o){var a=this,s=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return s||c?(o?o(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(r,this,t)):e.nextTick(r,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!o&&t?a._writableState?a._writableState.errorEmitted?e.nextTick(i,a):(a._writableState.errorEmitted=!0,e.nextTick(n,a,t)):e.nextTick(n,a,t):o?(e.nextTick(i,a),o(t)):e.nextTick(i,a)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,i=e._writableState;n&&n.autoDestroy||i&&i.autoDestroy?e.destroy(t):e.emit("error",t)}}}).call(this)}).call(this,e("_process"))},{_process:309}],37:[function(e,t,n){"use strict";var i=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function r(){}t.exports=function e(t,n,o){if("function"==typeof n)return e(t,null,n);n||(n={}),o=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,i=new Array(n),r=0;r0,(function(e){u||(u=e),e&&d.forEach(c),o||(d.forEach(c),p(u))}))}));return n.reduce(l)}},{"../../../errors":28,"./end-of-stream":37}],40:[function(e,t,n){"use strict";var i=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,n,r){var o=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,r,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new i(r?n:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},{"../../../errors":28}],41:[function(e,t,n){t.exports=e("events").EventEmitter},{events:181}],42:[function(e,t,n){(n=t.exports=e("./lib/_stream_readable.js")).Stream=n,n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),n.PassThrough=e("./lib/_stream_passthrough.js"),n.finished=e("./lib/internal/streams/end-of-stream.js"),n.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":29,"./lib/_stream_passthrough.js":30,"./lib/_stream_readable.js":31,"./lib/_stream_transform.js":32,"./lib/_stream_writable.js":33,"./lib/internal/streams/end-of-stream.js":37,"./lib/internal/streams/pipeline.js":39}],43:[function(e,t,n){(function(n,i){(function(){const r=e("debug")("bittorrent-tracker:client"),o=e("events"),a=e("once"),s=e("run-parallel"),c=e("simple-peer"),l=e("queue-microtask"),u=e("./lib/common"),p=e("./lib/client/http-tracker"),d=e("./lib/client/udp-tracker"),f=e("./lib/client/websocket-tracker");class h extends o{constructor(e={}){if(super(),!e.peerId)throw new Error("Option `peerId` is required");if(!e.infoHash)throw new Error("Option `infoHash` is required");if(!e.announce)throw new Error("Option `announce` is required");if(!n.browser&&!e.port)throw new Error("Option `port` is required");this.peerId="string"==typeof e.peerId?e.peerId:e.peerId.toString("hex"),this._peerIdBuffer=i.from(this.peerId,"hex"),this._peerIdBinary=this._peerIdBuffer.toString("binary"),this.infoHash="string"==typeof e.infoHash?e.infoHash.toLowerCase():e.infoHash.toString("hex"),this._infoHashBuffer=i.from(this.infoHash,"hex"),this._infoHashBinary=this._infoHashBuffer.toString("binary"),r("new client %s",this.infoHash),this.destroyed=!1,this._port=e.port,this._getAnnounceOpts=e.getAnnounceOpts,this._rtcConfig=e.rtcConfig,this._userAgent=e.userAgent,this._proxyOpts=e.proxyOpts,this._wrtc="function"==typeof e.wrtc?e.wrtc():e.wrtc;let t="string"==typeof e.announce?[e.announce]:null==e.announce?[]:e.announce;t=t.map((e=>("/"===(e=e.toString())[e.length-1]&&(e=e.substring(0,e.length-1)),e))),t=Array.from(new Set(t));const o=!1!==this._wrtc&&(!!this._wrtc||c.WEBRTC_SUPPORT),a=e=>{l((()=>{this.emit("warning",e)}))};this._trackers=t.map((e=>{let t;try{t=u.parseUrl(e)}catch(t){return a(new Error(`Invalid tracker URL: ${e}`)),null}const n=t.port;if(n<0||n>65535)return a(new Error(`Invalid tracker port: ${e}`)),null;const i=t.protocol;return"http:"!==i&&"https:"!==i||"function"!=typeof p?"udp:"===i&&"function"==typeof d?new d(this,e):"ws:"!==i&&"wss:"!==i||!o||"ws:"===i&&"undefined"!=typeof window&&"https:"===window.location.protocol?(a(new Error(`Unsupported tracker protocol: ${e}`)),null):new f(this,e):new p(this,e)})).filter(Boolean)}start(e){(e=this._defaultAnnounceOpts(e)).event="started",r("send `start` %o",e),this._announce(e),this._trackers.forEach((e=>{e.setInterval()}))}stop(e){(e=this._defaultAnnounceOpts(e)).event="stopped",r("send `stop` %o",e),this._announce(e)}complete(e){e||(e={}),(e=this._defaultAnnounceOpts(e)).event="completed",r("send `complete` %o",e),this._announce(e)}update(e){(e=this._defaultAnnounceOpts(e)).event&&delete e.event,r("send `update` %o",e),this._announce(e)}_announce(e){this._trackers.forEach((t=>{t.announce(e)}))}scrape(e){r("send `scrape`"),e||(e={}),this._trackers.forEach((t=>{t.scrape(e)}))}setInterval(e){r("setInterval %d",e),this._trackers.forEach((t=>{t.setInterval(e)}))}destroy(e){if(this.destroyed)return;this.destroyed=!0,r("destroy");const t=this._trackers.map((e=>t=>{e.destroy(t)}));s(t,e),this._trackers=[],this._getAnnounceOpts=null}_defaultAnnounceOpts(e={}){return null==e.numwant&&(e.numwant=u.DEFAULT_ANNOUNCE_PEERS),null==e.uploaded&&(e.uploaded=0),null==e.downloaded&&(e.downloaded=0),this._getAnnounceOpts&&(e=Object.assign({},e,this._getAnnounceOpts())),e}}h.scrape=(e,t)=>{if(t=a(t),!e.infoHash)throw new Error("Option `infoHash` is required");if(!e.announce)throw new Error("Option `announce` is required");const n=Object.assign({},e,{infoHash:Array.isArray(e.infoHash)?e.infoHash[0]:e.infoHash,peerId:i.from("01234567890123456789"),port:6881}),r=new h(n);r.once("error",t),r.once("warning",t);let o=Array.isArray(e.infoHash)?e.infoHash.length:1;const s={};return r.on("scrape",(e=>{if(o-=1,s[e.infoHash]=e,0===o){r.destroy();const e=Object.keys(s);1===e.length?t(null,s[e[0]]):t(null,s)}})),e.infoHash=Array.isArray(e.infoHash)?e.infoHash.map((e=>i.from(e,"hex"))):i.from(e.infoHash,"hex"),r.scrape({infoHash:e.infoHash}),r},t.exports=h}).call(this)}).call(this,e("_process"),e("buffer").Buffer)},{"./lib/client/http-tracker":67,"./lib/client/udp-tracker":67,"./lib/client/websocket-tracker":45,"./lib/common":46,_process:309,buffer:110,debug:148,events:181,once:294,"queue-microtask":327,"run-parallel":354,"simple-peer":370}],44:[function(e,t,n){const i=e("events");t.exports=class extends i{constructor(e,t){super(),this.client=e,this.announceUrl=t,this.interval=null,this.destroyed=!1}setInterval(e){null==e&&(e=this.DEFAULT_ANNOUNCE_INTERVAL),clearInterval(this.interval),e&&(this.interval=setInterval((()=>{this.announce(this.client._defaultAnnounceOpts())}),e),this.interval.unref&&this.interval.unref())}}},{events:181}],45:[function(e,t,n){const i=e("clone"),r=e("debug")("bittorrent-tracker:websocket-tracker"),o=e("simple-peer"),a=e("randombytes"),s=e("simple-websocket"),c=e("socks"),l=e("../common"),u=e("./tracker"),p={};class d extends u{constructor(e,t){super(e,t),r("new websocket tracker %s",t),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 t=Object.assign({},e,{action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary});if(this._trackerId&&(t.trackerid=this._trackerId),"stopped"===e.event||"completed"===e.event)this._send(t);else{const n=Math.min(e.numwant,5);this._generateOffers(n,(e=>{t.numwant=n,t.offers=e,this._send(t)}))}}scrape(e){if(this.destroyed||this.reconnecting)return;if(!this.socket.connected)return void this.socket.once("connect",(()=>{this.scrape(e)}));const t={action:"scrape",info_hash:Array.isArray(e.infoHash)&&e.infoHash.length>0?e.infoHash.map((e=>e.toString("binary"))):e.infoHash&&e.infoHash.toString("binary")||this.client._infoHashBinary};this._send(t)}destroy(e=f){if(this.destroyed)return e(null);this.destroyed=!0,clearInterval(this.interval),clearTimeout(this.reconnectTimer);for(const e in this.peers){const t=this.peers[e];clearTimeout(t.trackerTimeout),t.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,p[this.announceUrl]&&(p[this.announceUrl].consumers-=1),p[this.announceUrl].consumers>0)return e();let t,n=p[this.announceUrl];if(delete p[this.announceUrl],n.on("error",f),n.once("close",e),!this.expectingResponse)return i();function i(){t&&(clearTimeout(t),t=null),n.removeListener("data",i),n.destroy(),n=null}t=setTimeout(i,l.DESTROY_TIMEOUT),n.once("data",i)}_openSocket(){if(this.destroyed=!1,this.peers||(this.peers={}),this._onSocketConnectBound=()=>{this._onSocketConnect()},this._onSocketErrorBound=e=>{this._onSocketError(e)},this._onSocketDataBound=e=>{this._onSocketData(e)},this._onSocketCloseBound=()=>{this._onSocketClose()},this.socket=p[this.announceUrl],this.socket)p[this.announceUrl].consumers+=1,this.socket.connected&&this._onSocketConnectBound();else{const e=new URL(this.announceUrl);let t;this.client._proxyOpts&&(t="wss:"===e.protocol?this.client._proxyOpts.httpsAgent:this.client._proxyOpts.httpAgent,!t&&this.client._proxyOpts.socksProxy&&(t=new c.Agent(i(this.client._proxyOpts.socksProxy),"wss:"===e.protocol))),this.socket=p[this.announceUrl]=new s({url:this.announceUrl,agent:t}),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(e){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 r("ignoring websocket data from %s for %s (looking for %s: reused socket)",this.announceUrl,l.binaryToHex(e.info_hash),this.client.infoHash);if(e.peer_id&&e.peer_id===this.client._peerIdBinary)return;r("received %s from %s for %s",JSON.stringify(e),this.announceUrl,this.client.infoHash);const t=e["failure reason"];if(t)return this.client.emit("warning",new Error(t));const n=e["warning message"];n&&this.client.emit("warning",new Error(n));const i=e.interval||e["min interval"];i&&this.setInterval(1e3*i);const o=e["tracker id"];if(o&&(this._trackerId=o),null!=e.complete){const t=Object.assign({},e,{announce:this.announceUrl,infoHash:l.binaryToHex(e.info_hash)});this.client.emit("update",t)}let a;if(e.offer&&e.peer_id&&(r("creating peer (from remote offer)"),a=this._createPeer(),a.id=l.binaryToHex(e.peer_id),a.once("signal",(t=>{const n={action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary,to_peer_id:e.peer_id,answer:t,offer_id:e.offer_id};this._trackerId&&(n.trackerid=this._trackerId),this._send(n)})),this.client.emit("peer",a),a.signal(e.offer)),e.answer&&e.peer_id){const t=l.binaryToHex(e.offer_id);a=this.peers[t],a?(a.id=l.binaryToHex(e.peer_id),this.client.emit("peer",a),a.signal(e.answer),clearTimeout(a.trackerTimeout),a.trackerTimeout=null,delete this.peers[t]):r(`got unexpected answer: ${JSON.stringify(e.answer)}`)}}_onScrapeResponse(e){e=e.files||{};const t=Object.keys(e);0!==t.length?t.forEach((t=>{const n=Object.assign(e[t],{announce:this.announceUrl,infoHash:l.binaryToHex(t)});this.client.emit("scrape",n)})):this.client.emit("warning",new Error("invalid scrape response"))}_onSocketClose(){this.destroyed||(this.destroy(),this._startReconnectTimer())}_onSocketError(e){this.destroyed||(this.destroy(),this.client.emit("warning",e),this._startReconnectTimer())}_startReconnectTimer(){const e=Math.floor(3e5*Math.random())+Math.min(1e4*Math.pow(2,this.retries),36e5);this.reconnecting=!0,clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout((()=>{this.retries++,this._openSocket()}),e),this.reconnectTimer.unref&&this.reconnectTimer.unref(),r("reconnecting socket in %s ms",e)}_send(e){if(this.destroyed)return;this.expectingResponse=!0;const t=JSON.stringify(e);r("send %s",t),this.socket.send(t)}_generateOffers(e,t){const n=this,i=[];r("generating %s offers",e);for(let t=0;t{i.push({offer:t,offer_id:l.hexToBinary(e)}),s()})),t.trackerTimeout=setTimeout((()=>{r("tracker timeout: destroying peer"),t.trackerTimeout=null,delete n.peers[e],t.destroy()}),5e4),t.trackerTimeout.unref&&t.trackerTimeout.unref()}function s(){i.length===e&&(r("generated %s offers",e),t(i))}s()}_createPeer(e){const t=this;e=Object.assign({trickle:!1,config:t.client._rtcConfig,wrtc:t.client._wrtc},e);const n=new o(e);return n.once("error",i),n.once("connect",(function e(){n.removeListener("error",i),n.removeListener("connect",e)})),n;function i(e){t.client.emit("warning",new Error(`Connection error: ${e.message}`)),n.destroy()}}}function f(){}d.prototype.DEFAULT_ANNOUNCE_INTERVAL=3e4,d._socketPool=p,t.exports=d},{"../common":46,"./tracker":44,clone:138,debug:148,randombytes:330,"simple-peer":370,"simple-websocket":388,socks:67}],46:[function(e,t,n){(function(t){(function(){n.DEFAULT_ANNOUNCE_PEERS=50,n.MAX_ANNOUNCE_PEERS=82,n.binaryToHex=e=>("string"!=typeof e&&(e=String(e)),t.from(e,"binary").toString("hex")),n.hexToBinary=e=>("string"!=typeof e&&(e=String(e)),t.from(e,"hex").toString("binary")),n.parseUrl=e=>{const t=new URL(e.replace(/^udp:/,"http:"));return e.match(/^udp:/)&&Object.defineProperties(t,{href:{value:t.href.replace(/^http/,"udp")},protocol:{value:t.protocol.replace(/^http/,"udp")},origin:{value:t.origin.replace(/^http/,"udp")}}),t};const i=e("./common-node");Object.assign(n,i)}).call(this)}).call(this,e("buffer").Buffer)},{"./common-node":67,buffer:110}],47:[function(e,t,n){(function(e){(function(){ /*! blob-to-buffer. MIT License. Feross Aboukhadijeh */ t.exports=function(t,n){if("undefined"==typeof Blob||!(t instanceof Blob))throw new Error("first argument must be a Blob");if("function"!=typeof n)throw new Error("second argument must be a function");const i=new FileReader;i.addEventListener("loadend",(function t(r){i.removeEventListener("loadend",t,!1),r.error?n(r.error):n(null,e.from(i.result))}),!1),i.readAsArrayBuffer(t)}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:110}],48:[function(e,t,n){function i(e,t){if("string"==typeof e[0])return e.join("");if("number"==typeof e[0])return new Uint8Array(e);const n=new Uint8Array(t);let i=0;for(let t=0,r=e.length;t=t){const e=i(a,s);let n=0;for(;s>=t;)yield e.slice(n,n+t),s-=t,n+=t;a=[e.slice(n,e.length)]}s&&(yield i(a,o?t:s))}},{}],49:[function(e,t,n){(function(n){(function(){const{Transform:i}=e("readable-stream");t.exports=class extends i{constructor(e,t={}){super(t),"object"==typeof e&&(e=(t=e).size),this.size=e||512;const{nopad:n,zeroPadding:i=!0}=t;this._zeroPadding=!n&&!!i,this._buffered=[],this._bufferedBytes=0}_transform(e,t,i){for(this._bufferedBytes+=e.length,this._buffered.push(e);this._bufferedBytes>=this.size;){this._bufferedBytes-=this.size;const e=[];let t=0;for(;t=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void i(!1,"Invalid character in "+e)}function c(e,t,n){var i=s(e,n);return n-1>=t&&(i|=s(e,n-1)<<4),i}function l(e,t,n,r){for(var o=0,a=0,s=Math.min(e.length,n),c=t;c=49?l-49+10:l>=17?l-17+10:l,i(l>=0&&a0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var r=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(r++,this.negative=1),r=0;r-=3)a=e[r]|e[r-1]<<8|e[r-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(r=0,o=0;r>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i=t;i-=2)r=c(e,t,i)<=18?(o-=18,a+=1,this.words[a]|=r>>>26):o+=8;else for(i=(e.length-t)%2==0?t+1:t;i=18?(o-=18,a+=1,this.words[a]|=r>>>26):o+=8;this._strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var i=0,r=1;r<=67108863;r*=t)i++;i--,r=r/t|0;for(var o=e.length-n,a=o%i,s=Math.min(o,o-a)+n,c=0,u=n;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch(e){o.prototype.inspect=p}else o.prototype.inspect=p;function p(){return(this.red?""}var d=["","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"],f=[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],h=[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];o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var r=0,o=0,a=0;a>>24-r&16777215,(r+=2)>=26&&(r-=26,a--),n=0!==o||a!==this.length-1?d[6-c.length]+c+n:c+n}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var l=f[e],u=h[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(u).toString(e);n=(p=p.idivn(u)).isZero()?m+n:d[l-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function m(e,t,n){n.negative=t.negative^e.negative;var i=e.length+t.length|0;n.length=i,i=i-1|0;var r=0|e.words[0],o=0|t.words[0],a=r*o,s=67108863&a,c=a/67108864|0;n.words[0]=s;for(var l=1;l>>26,p=67108863&c,d=Math.min(l,t.length-1),f=Math.max(0,l-e.length+1);f<=d;f++){var h=l-f|0;u+=(a=(r=0|e.words[h])*(o=0|t.words[f])+p)/67108864|0,p=67108863&a}n.words[l]=0|p,c=0|u}return 0!==c?n.words[l]=0|c:n.length--,n._strip()}o.prototype.toArrayLike=function(e,t,n){this._strip();var r=this.byteLength(),o=n||Math.max(1,r);i(r<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,r),a},o.prototype._toArrayLikeLE=function(e,t){for(var n=0,i=0,r=0,o=0;r>8&255),n>16&255),6===o?(n>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(n=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(n>=0)for(e[n--]=i;n>=0;)e[n--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var i=0;ie.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var r=0;r0&&(this.words[r]=~this.words[r]&67108863>>26-n),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var n=e/26|0,r=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,i=e):(n=e,i=this);for(var r=0,o=0;o>>26;for(;0!==r&&o>>26;if(this.length=n.length,0!==r)this.words[this.length]=r,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,i,r=this.cmp(e);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;r>0?(n=this,i=e):(n=e,i=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,f=0|a[1],h=8191&f,m=f>>>13,b=0|a[2],v=8191&b,g=b>>>13,y=0|a[3],x=8191&y,_=y>>>13,w=0|a[4],k=8191&w,S=w>>>13,E=0|a[5],M=8191&E,A=E>>>13,j=0|a[6],I=8191&j,T=j>>>13,C=0|a[7],B=8191&C,R=C>>>13,O=0|a[8],P=8191&O,L=O>>>13,U=0|a[9],q=8191&U,N=U>>>13,D=0|s[0],z=8191&D,H=D>>>13,F=0|s[1],W=8191&F,V=F>>>13,K=0|s[2],$=8191&K,G=K>>>13,X=0|s[3],Y=8191&X,J=X>>>13,Z=0|s[4],Q=8191&Z,ee=Z>>>13,te=0|s[5],ne=8191&te,ie=te>>>13,re=0|s[6],oe=8191&re,ae=re>>>13,se=0|s[7],ce=8191&se,le=se>>>13,ue=0|s[8],pe=8191&ue,de=ue>>>13,fe=0|s[9],he=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var be=(l+(i=Math.imul(p,z))|0)+((8191&(r=(r=Math.imul(p,H))+Math.imul(d,z)|0))<<13)|0;l=((o=Math.imul(d,H))+(r>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(h,z),r=(r=Math.imul(h,H))+Math.imul(m,z)|0,o=Math.imul(m,H);var ve=(l+(i=i+Math.imul(p,W)|0)|0)+((8191&(r=(r=r+Math.imul(p,V)|0)+Math.imul(d,W)|0))<<13)|0;l=((o=o+Math.imul(d,V)|0)+(r>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(v,z),r=(r=Math.imul(v,H))+Math.imul(g,z)|0,o=Math.imul(g,H),i=i+Math.imul(h,W)|0,r=(r=r+Math.imul(h,V)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,V)|0;var ge=(l+(i=i+Math.imul(p,$)|0)|0)+((8191&(r=(r=r+Math.imul(p,G)|0)+Math.imul(d,$)|0))<<13)|0;l=((o=o+Math.imul(d,G)|0)+(r>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(x,z),r=(r=Math.imul(x,H))+Math.imul(_,z)|0,o=Math.imul(_,H),i=i+Math.imul(v,W)|0,r=(r=r+Math.imul(v,V)|0)+Math.imul(g,W)|0,o=o+Math.imul(g,V)|0,i=i+Math.imul(h,$)|0,r=(r=r+Math.imul(h,G)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,G)|0;var ye=(l+(i=i+Math.imul(p,Y)|0)|0)+((8191&(r=(r=r+Math.imul(p,J)|0)+Math.imul(d,Y)|0))<<13)|0;l=((o=o+Math.imul(d,J)|0)+(r>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(k,z),r=(r=Math.imul(k,H))+Math.imul(S,z)|0,o=Math.imul(S,H),i=i+Math.imul(x,W)|0,r=(r=r+Math.imul(x,V)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,V)|0,i=i+Math.imul(v,$)|0,r=(r=r+Math.imul(v,G)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,G)|0,i=i+Math.imul(h,Y)|0,r=(r=r+Math.imul(h,J)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,J)|0;var xe=(l+(i=i+Math.imul(p,Q)|0)|0)+((8191&(r=(r=r+Math.imul(p,ee)|0)+Math.imul(d,Q)|0))<<13)|0;l=((o=o+Math.imul(d,ee)|0)+(r>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(M,z),r=(r=Math.imul(M,H))+Math.imul(A,z)|0,o=Math.imul(A,H),i=i+Math.imul(k,W)|0,r=(r=r+Math.imul(k,V)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,V)|0,i=i+Math.imul(x,$)|0,r=(r=r+Math.imul(x,G)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,G)|0,i=i+Math.imul(v,Y)|0,r=(r=r+Math.imul(v,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,i=i+Math.imul(h,Q)|0,r=(r=r+Math.imul(h,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var _e=(l+(i=i+Math.imul(p,ne)|0)|0)+((8191&(r=(r=r+Math.imul(p,ie)|0)+Math.imul(d,ne)|0))<<13)|0;l=((o=o+Math.imul(d,ie)|0)+(r>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(I,z),r=(r=Math.imul(I,H))+Math.imul(T,z)|0,o=Math.imul(T,H),i=i+Math.imul(M,W)|0,r=(r=r+Math.imul(M,V)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(k,$)|0,r=(r=r+Math.imul(k,G)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,G)|0,i=i+Math.imul(x,Y)|0,r=(r=r+Math.imul(x,J)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,J)|0,i=i+Math.imul(v,Q)|0,r=(r=r+Math.imul(v,ee)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,ee)|0,i=i+Math.imul(h,ne)|0,r=(r=r+Math.imul(h,ie)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,ie)|0;var we=(l+(i=i+Math.imul(p,oe)|0)|0)+((8191&(r=(r=r+Math.imul(p,ae)|0)+Math.imul(d,oe)|0))<<13)|0;l=((o=o+Math.imul(d,ae)|0)+(r>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(B,z),r=(r=Math.imul(B,H))+Math.imul(R,z)|0,o=Math.imul(R,H),i=i+Math.imul(I,W)|0,r=(r=r+Math.imul(I,V)|0)+Math.imul(T,W)|0,o=o+Math.imul(T,V)|0,i=i+Math.imul(M,$)|0,r=(r=r+Math.imul(M,G)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,G)|0,i=i+Math.imul(k,Y)|0,r=(r=r+Math.imul(k,J)|0)+Math.imul(S,Y)|0,o=o+Math.imul(S,J)|0,i=i+Math.imul(x,Q)|0,r=(r=r+Math.imul(x,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,i=i+Math.imul(v,ne)|0,r=(r=r+Math.imul(v,ie)|0)+Math.imul(g,ne)|0,o=o+Math.imul(g,ie)|0,i=i+Math.imul(h,oe)|0,r=(r=r+Math.imul(h,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var ke=(l+(i=i+Math.imul(p,ce)|0)|0)+((8191&(r=(r=r+Math.imul(p,le)|0)+Math.imul(d,ce)|0))<<13)|0;l=((o=o+Math.imul(d,le)|0)+(r>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(P,z),r=(r=Math.imul(P,H))+Math.imul(L,z)|0,o=Math.imul(L,H),i=i+Math.imul(B,W)|0,r=(r=r+Math.imul(B,V)|0)+Math.imul(R,W)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(I,$)|0,r=(r=r+Math.imul(I,G)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,G)|0,i=i+Math.imul(M,Y)|0,r=(r=r+Math.imul(M,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,i=i+Math.imul(k,Q)|0,r=(r=r+Math.imul(k,ee)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,ee)|0,i=i+Math.imul(x,ne)|0,r=(r=r+Math.imul(x,ie)|0)+Math.imul(_,ne)|0,o=o+Math.imul(_,ie)|0,i=i+Math.imul(v,oe)|0,r=(r=r+Math.imul(v,ae)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,ae)|0,i=i+Math.imul(h,ce)|0,r=(r=r+Math.imul(h,le)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,le)|0;var Se=(l+(i=i+Math.imul(p,pe)|0)|0)+((8191&(r=(r=r+Math.imul(p,de)|0)+Math.imul(d,pe)|0))<<13)|0;l=((o=o+Math.imul(d,de)|0)+(r>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(q,z),r=(r=Math.imul(q,H))+Math.imul(N,z)|0,o=Math.imul(N,H),i=i+Math.imul(P,W)|0,r=(r=r+Math.imul(P,V)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,V)|0,i=i+Math.imul(B,$)|0,r=(r=r+Math.imul(B,G)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,G)|0,i=i+Math.imul(I,Y)|0,r=(r=r+Math.imul(I,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(M,Q)|0,r=(r=r+Math.imul(M,ee)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,ee)|0,i=i+Math.imul(k,ne)|0,r=(r=r+Math.imul(k,ie)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,ie)|0,i=i+Math.imul(x,oe)|0,r=(r=r+Math.imul(x,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,i=i+Math.imul(v,ce)|0,r=(r=r+Math.imul(v,le)|0)+Math.imul(g,ce)|0,o=o+Math.imul(g,le)|0,i=i+Math.imul(h,pe)|0,r=(r=r+Math.imul(h,de)|0)+Math.imul(m,pe)|0,o=o+Math.imul(m,de)|0;var Ee=(l+(i=i+Math.imul(p,he)|0)|0)+((8191&(r=(r=r+Math.imul(p,me)|0)+Math.imul(d,he)|0))<<13)|0;l=((o=o+Math.imul(d,me)|0)+(r>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(q,W),r=(r=Math.imul(q,V))+Math.imul(N,W)|0,o=Math.imul(N,V),i=i+Math.imul(P,$)|0,r=(r=r+Math.imul(P,G)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,G)|0,i=i+Math.imul(B,Y)|0,r=(r=r+Math.imul(B,J)|0)+Math.imul(R,Y)|0,o=o+Math.imul(R,J)|0,i=i+Math.imul(I,Q)|0,r=(r=r+Math.imul(I,ee)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,ee)|0,i=i+Math.imul(M,ne)|0,r=(r=r+Math.imul(M,ie)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,ie)|0,i=i+Math.imul(k,oe)|0,r=(r=r+Math.imul(k,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,i=i+Math.imul(x,ce)|0,r=(r=r+Math.imul(x,le)|0)+Math.imul(_,ce)|0,o=o+Math.imul(_,le)|0,i=i+Math.imul(v,pe)|0,r=(r=r+Math.imul(v,de)|0)+Math.imul(g,pe)|0,o=o+Math.imul(g,de)|0;var Me=(l+(i=i+Math.imul(h,he)|0)|0)+((8191&(r=(r=r+Math.imul(h,me)|0)+Math.imul(m,he)|0))<<13)|0;l=((o=o+Math.imul(m,me)|0)+(r>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(q,$),r=(r=Math.imul(q,G))+Math.imul(N,$)|0,o=Math.imul(N,G),i=i+Math.imul(P,Y)|0,r=(r=r+Math.imul(P,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,i=i+Math.imul(B,Q)|0,r=(r=r+Math.imul(B,ee)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,ee)|0,i=i+Math.imul(I,ne)|0,r=(r=r+Math.imul(I,ie)|0)+Math.imul(T,ne)|0,o=o+Math.imul(T,ie)|0,i=i+Math.imul(M,oe)|0,r=(r=r+Math.imul(M,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,i=i+Math.imul(k,ce)|0,r=(r=r+Math.imul(k,le)|0)+Math.imul(S,ce)|0,o=o+Math.imul(S,le)|0,i=i+Math.imul(x,pe)|0,r=(r=r+Math.imul(x,de)|0)+Math.imul(_,pe)|0,o=o+Math.imul(_,de)|0;var Ae=(l+(i=i+Math.imul(v,he)|0)|0)+((8191&(r=(r=r+Math.imul(v,me)|0)+Math.imul(g,he)|0))<<13)|0;l=((o=o+Math.imul(g,me)|0)+(r>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(q,Y),r=(r=Math.imul(q,J))+Math.imul(N,Y)|0,o=Math.imul(N,J),i=i+Math.imul(P,Q)|0,r=(r=r+Math.imul(P,ee)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,ee)|0,i=i+Math.imul(B,ne)|0,r=(r=r+Math.imul(B,ie)|0)+Math.imul(R,ne)|0,o=o+Math.imul(R,ie)|0,i=i+Math.imul(I,oe)|0,r=(r=r+Math.imul(I,ae)|0)+Math.imul(T,oe)|0,o=o+Math.imul(T,ae)|0,i=i+Math.imul(M,ce)|0,r=(r=r+Math.imul(M,le)|0)+Math.imul(A,ce)|0,o=o+Math.imul(A,le)|0,i=i+Math.imul(k,pe)|0,r=(r=r+Math.imul(k,de)|0)+Math.imul(S,pe)|0,o=o+Math.imul(S,de)|0;var je=(l+(i=i+Math.imul(x,he)|0)|0)+((8191&(r=(r=r+Math.imul(x,me)|0)+Math.imul(_,he)|0))<<13)|0;l=((o=o+Math.imul(_,me)|0)+(r>>>13)|0)+(je>>>26)|0,je&=67108863,i=Math.imul(q,Q),r=(r=Math.imul(q,ee))+Math.imul(N,Q)|0,o=Math.imul(N,ee),i=i+Math.imul(P,ne)|0,r=(r=r+Math.imul(P,ie)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,ie)|0,i=i+Math.imul(B,oe)|0,r=(r=r+Math.imul(B,ae)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,ae)|0,i=i+Math.imul(I,ce)|0,r=(r=r+Math.imul(I,le)|0)+Math.imul(T,ce)|0,o=o+Math.imul(T,le)|0,i=i+Math.imul(M,pe)|0,r=(r=r+Math.imul(M,de)|0)+Math.imul(A,pe)|0,o=o+Math.imul(A,de)|0;var Ie=(l+(i=i+Math.imul(k,he)|0)|0)+((8191&(r=(r=r+Math.imul(k,me)|0)+Math.imul(S,he)|0))<<13)|0;l=((o=o+Math.imul(S,me)|0)+(r>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(q,ne),r=(r=Math.imul(q,ie))+Math.imul(N,ne)|0,o=Math.imul(N,ie),i=i+Math.imul(P,oe)|0,r=(r=r+Math.imul(P,ae)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,ae)|0,i=i+Math.imul(B,ce)|0,r=(r=r+Math.imul(B,le)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,le)|0,i=i+Math.imul(I,pe)|0,r=(r=r+Math.imul(I,de)|0)+Math.imul(T,pe)|0,o=o+Math.imul(T,de)|0;var Te=(l+(i=i+Math.imul(M,he)|0)|0)+((8191&(r=(r=r+Math.imul(M,me)|0)+Math.imul(A,he)|0))<<13)|0;l=((o=o+Math.imul(A,me)|0)+(r>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(q,oe),r=(r=Math.imul(q,ae))+Math.imul(N,oe)|0,o=Math.imul(N,ae),i=i+Math.imul(P,ce)|0,r=(r=r+Math.imul(P,le)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,le)|0,i=i+Math.imul(B,pe)|0,r=(r=r+Math.imul(B,de)|0)+Math.imul(R,pe)|0,o=o+Math.imul(R,de)|0;var Ce=(l+(i=i+Math.imul(I,he)|0)|0)+((8191&(r=(r=r+Math.imul(I,me)|0)+Math.imul(T,he)|0))<<13)|0;l=((o=o+Math.imul(T,me)|0)+(r>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,i=Math.imul(q,ce),r=(r=Math.imul(q,le))+Math.imul(N,ce)|0,o=Math.imul(N,le),i=i+Math.imul(P,pe)|0,r=(r=r+Math.imul(P,de)|0)+Math.imul(L,pe)|0,o=o+Math.imul(L,de)|0;var Be=(l+(i=i+Math.imul(B,he)|0)|0)+((8191&(r=(r=r+Math.imul(B,me)|0)+Math.imul(R,he)|0))<<13)|0;l=((o=o+Math.imul(R,me)|0)+(r>>>13)|0)+(Be>>>26)|0,Be&=67108863,i=Math.imul(q,pe),r=(r=Math.imul(q,de))+Math.imul(N,pe)|0,o=Math.imul(N,de);var Re=(l+(i=i+Math.imul(P,he)|0)|0)+((8191&(r=(r=r+Math.imul(P,me)|0)+Math.imul(L,he)|0))<<13)|0;l=((o=o+Math.imul(L,me)|0)+(r>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Oe=(l+(i=Math.imul(q,he))|0)+((8191&(r=(r=Math.imul(q,me))+Math.imul(N,he)|0))<<13)|0;return l=((o=Math.imul(N,me))+(r>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,c[0]=be,c[1]=ve,c[2]=ge,c[3]=ye,c[4]=xe,c[5]=_e,c[6]=we,c[7]=ke,c[8]=Se,c[9]=Ee,c[10]=Me,c[11]=Ae,c[12]=je,c[13]=Ie,c[14]=Te,c[15]=Ce,c[16]=Be,c[17]=Re,c[18]=Oe,0!==l&&(c[19]=l,n.length++),n};function v(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var i=0,r=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,i=a,a=r}return 0!==i?n.words[o]=i:n.length--,n._strip()}function g(e,t,n){return v(e,t,n)}function y(e,t){this.x=e,this.y=t}Math.imul||(b=m),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?b(this,e,t):n<63?m(this,e,t):n<1024?v(this,e,t):g(this,e,t)},y.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,i=0;i>=1;return i},y.prototype.permute=function(e,t,n,i,r,o){for(var a=0;a>>=1)r++;return 1<>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*t;a>=26,n+=o/67108864|0,n+=a>>>26,this.words[r]=67108863&a}return 0!==n&&(this.words[r]=n,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>r&1}return t}(e);if(0===t.length)return new o(1);for(var n=this,i=0;i=0);var t,n=e%26,r=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==r){for(t=this.length-1;t>=0;t--)this.words[t+r]=this.words[t];for(t=0;t=0),r=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,l=0;l=0&&(0!==u||l>=r);l--){var p=0|this.words[l];this.words[l]=u<<26-o|p>>>o,u=p&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,n){return i(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,r=1<=0);var t=e%26,n=(e-t)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var r=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[r+n]=67108863&o}for(;r>26,this.words[r+n]=67108863&o;if(0===s)return this._strip();for(i(-1===s),s=0,r=0;r>26,this.words[r]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),i=this.clone(),r=e,a=0|r.words[r.length-1];0!==(n=26-this._countBits(a))&&(r=r.ushln(n),i.iushln(n),a=0|r.words[r.length-1]);var s,c=i.length-r.length;if("mod"!==t){(s=new o(null)).length=c+1,s.words=new Array(s.length);for(var l=0;l=0;p--){var d=67108864*(0|i.words[r.length+p])+(0|i.words[r.length+p-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(r,d,p);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(r,1,p),i.isZero()||(i.negative^=1);s&&(s.words[p]=d)}return s&&s._strip(),i._strip(),"div"!==t&&0!==n&&i.iushrn(n),{div:s||null,mod:i}},o.prototype.divmod=function(e,t,n){return i(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(r=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:r,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(r=s.div.neg()),{div:r,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var r,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),r=e.andln(1),o=n.cmp(i);return o<0||1===r&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var n=(1<<26)%e,r=0,o=this.length-1;o>=0;o--)r=(n*r+(0|this.words[o]))%e;return t?-r:r},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var n=0,r=this.length-1;r>=0;r--){var o=(0|this.words[r])+67108864*n;this.words[r]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var r=new o(1),a=new o(0),s=new o(0),c=new o(1),l=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++l;for(var u=n.clone(),p=t.clone();!t.isZero();){for(var d=0,f=1;0==(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(r.isOdd()||a.isOdd())&&(r.iadd(u),a.isub(p)),r.iushrn(1),a.iushrn(1);for(var h=0,m=1;0==(n.words[0]&m)&&h<26;++h,m<<=1);if(h>0)for(n.iushrn(h);h-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(u),c.isub(p)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),r.isub(s),a.isub(c)):(n.isub(t),s.isub(r),c.isub(a))}return{a:s,b:c,gcd:n.iushln(l)}},o.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var r,a=new o(1),s=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var l=0,u=1;0==(t.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(t.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var p=0,d=1;0==(n.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(n.iushrn(p);p-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.isub(t),s.isub(a))}return(r=0===t.cmpn(1)?a:s).cmpn(0)<0&&r.iadd(e),r},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var i=0;t.isEven()&&n.isEven();i++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var r=t.cmp(n);if(r<0){var o=t;t=n,n=o}else if(0===r||0===n.cmpn(1))break;t.isub(n)}return n.iushln(i)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,n=(e-t)/26,r=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),i(e<=67108863,"Number is too big");var r=0|this.words[0];t=r===e?0:re.length)return 1;if(this.length=0;n--){var i=0|this.words[n],r=0|e.words[n];if(i!==r){ir&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new M(e)},o.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var x={k256:null,p224:null,p192:null,p25519:null};function _(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){M.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}_.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},_.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},_.prototype.split=function(e,t){e.iushrn(this.n,0,t)},_.prototype.imulK=function(e){return e.imul(this.k)},r(w,_),w.prototype.split=function(e,t){for(var n=4194303,i=Math.min(e.length,9),r=0;r>>22,o=a}o>>>=22,e.words[r-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=r,t=i}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(x[e])return x[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new k;else if("p192"===e)t=new S;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return x[e]=t,t},M.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},M.prototype._verify2=function(e,t){i(0==(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},M.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},M.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},M.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},M.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},M.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},M.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},M.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},M.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},M.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},M.prototype.isqr=function(e){return this.imul(e,e.clone())},M.prototype.sqr=function(e){return this.mul(e,e)},M.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var r=this.m.subn(1),a=0;!r.isZero()&&0===r.andln(1);)a++,r.iushrn(1);i(!r.isZero());var s=new o(1).toRed(this),c=s.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new o(2*u*u).toRed(this);0!==this.pow(u,l).cmp(c);)u.redIAdd(c);for(var p=this.pow(u,r),d=this.pow(e,r.addn(1).iushrn(1)),f=this.pow(e,r),h=a;0!==f.cmp(s);){for(var m=f,b=0;0!==m.cmp(s);b++)m=m.redSqr();i(b=0;i--){for(var l=t.words[i],u=c-1;u>=0;u--){var p=l>>u&1;r!==n[0]&&(r=this.sqr(r)),0!==p||0!==a?(a<<=1,a|=p,(4===++s||0===i&&0===u)&&(r=this.mul(r,n[a]),s=0,a=0)):s=0}c=26}return r},M.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},M.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new A(e)},r(A,M),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),i=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),r=n.isub(i).iushrn(this.shift),o=r;return r.cmp(this.m)>=0?o=r.isub(this.m):r.cmpn(0)<0&&(o=r.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),i=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),r=n.isub(i).iushrn(this.shift),a=r;return r.cmp(this.m)>=0?a=r.isub(this.m):r.cmpn(0)<0&&(a=r.iadd(this.m)),a._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:67}],66:[function(e,t,n){var i;function r(e){this.rand=e}if(t.exports=function(e){return i||(i=new r(null)),i.generate(e)},t.exports.Rand=r,r.prototype.generate=function(e){return this._rand(e)},r.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n>>24]^u[h>>>16&255]^p[m>>>8&255]^d[255&b]^t[v++],a=l[h>>>24]^u[m>>>16&255]^p[b>>>8&255]^d[255&f]^t[v++],s=l[m>>>24]^u[b>>>16&255]^p[f>>>8&255]^d[255&h]^t[v++],c=l[b>>>24]^u[f>>>16&255]^p[h>>>8&255]^d[255&m]^t[v++],f=o,h=a,m=s,b=c;return o=(i[f>>>24]<<24|i[h>>>16&255]<<16|i[m>>>8&255]<<8|i[255&b])^t[v++],a=(i[h>>>24]<<24|i[m>>>16&255]<<16|i[b>>>8&255]<<8|i[255&f])^t[v++],s=(i[m>>>24]<<24|i[b>>>16&255]<<16|i[f>>>8&255]<<8|i[255&h])^t[v++],c=(i[b>>>24]<<24|i[f>>>16&255]<<16|i[h>>>8&255]<<8|i[255&m])^t[v++],[o>>>=0,a>>>=0,s>>>=0,c>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],c=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var n=[],i=[],r=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,c=0;c<256;++c){var l=s^s<<1^s<<2^s<<3^s<<4;l=l>>>8^255&l^99,n[a]=l,i[l]=a;var u=e[a],p=e[u],d=e[p],f=257*e[l]^16843008*l;r[0][a]=f<<24|f>>>8,r[1][a]=f<<16|f>>>16,r[2][a]=f<<8|f>>>24,r[3][a]=f,f=16843009*d^65537*p^257*u^16843008*a,o[0][l]=f<<24|f>>>8,o[1][l]=f<<16|f>>>16,o[2][l]=f<<8|f>>>24,o[3][l]=f,0===a?a=s=1:(a=u^e[e[e[d^u]]],s^=e[e[s]])}return{SBOX:n,INV_SBOX:i,SUB_MIX:r,INV_SUB_MIX:o}}();function l(e){this._key=r(e),this._reset()}l.blockSize=16,l.keySize=32,l.prototype.blockSize=l.blockSize,l.prototype.keySize=l.keySize,l.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,i=4*(n+1),r=[],o=0;o>>24,a=c.SBOX[a>>>24]<<24|c.SBOX[a>>>16&255]<<16|c.SBOX[a>>>8&255]<<8|c.SBOX[255&a],a^=s[o/t|0]<<24):t>6&&o%t==4&&(a=c.SBOX[a>>>24]<<24|c.SBOX[a>>>16&255]<<16|c.SBOX[a>>>8&255]<<8|c.SBOX[255&a]),r[o]=r[o-t]^a}for(var l=[],u=0;u>>24]]^c.INV_SUB_MIX[1][c.SBOX[d>>>16&255]]^c.INV_SUB_MIX[2][c.SBOX[d>>>8&255]]^c.INV_SUB_MIX[3][c.SBOX[255&d]]}this._nRounds=n,this._keySchedule=r,this._invKeySchedule=l},l.prototype.encryptBlockRaw=function(e){return a(e=r(e),this._keySchedule,c.SUB_MIX,c.SBOX,this._nRounds)},l.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),n=i.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n},l.prototype.decryptBlock=function(e){var t=(e=r(e))[1];e[1]=e[3],e[3]=t;var n=a(e,this._invKeySchedule,c.INV_SUB_MIX,c.INV_SBOX,this._nRounds),o=i.allocUnsafe(16);return o.writeUInt32BE(n[0],0),o.writeUInt32BE(n[3],4),o.writeUInt32BE(n[2],8),o.writeUInt32BE(n[1],12),o},l.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=l},{"safe-buffer":356}],69:[function(e,t,n){var i=e("./aes"),r=e("safe-buffer").Buffer,o=e("cipher-base"),a=e("inherits"),s=e("./ghash"),c=e("buffer-xor"),l=e("./incr32");function u(e,t,n,a){o.call(this);var c=r.alloc(4,0);this._cipher=new i.AES(t);var u=this._cipher.encryptBlock(c);this._ghash=new s(u),n=function(e,t,n){if(12===t.length)return e._finID=r.concat([t,r.from([0,0,0,1])]),r.concat([t,r.from([0,0,0,2])]);var i=new s(n),o=t.length,a=o%16;i.update(t),a&&(a=16-a,i.update(r.alloc(a,0))),i.update(r.alloc(8,0));var c=8*o,u=r.alloc(8);u.writeUIntBE(c,0,8),i.update(u),e._finID=i.state;var p=r.from(e._finID);return l(p),p}(this,n,u),this._prev=r.from(n),this._cache=r.allocUnsafe(0),this._secCache=r.allocUnsafe(0),this._decrypt=a,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}a(u,o),u.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=r.alloc(t,0),this._ghash.update(t))}this._called=!0;var n=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(n),this._len+=e.length,n},u.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=c(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var n=0;e.length!==t.length&&n++;for(var i=Math.min(e.length,t.length),r=0;r16)throw new Error("unable to decrypt data");var n=-1;for(;++n16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},p.prototype.flush=function(){if(this.cache.length)return this.cache},n.createDecipher=function(e,t){var n=o[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var i=l(t,!1,n.key,n.iv);return d(e,i.key,i.iv)},n.createDecipheriv=d},{"./aes":68,"./authCipher":69,"./modes":81,"./streamCipher":84,"cipher-base":136,evp_bytestokey:182,inherits:229,"safe-buffer":356}],72:[function(e,t,n){var i=e("./modes"),r=e("./authCipher"),o=e("safe-buffer").Buffer,a=e("./streamCipher"),s=e("cipher-base"),c=e("./aes"),l=e("evp_bytestokey");function u(e,t,n){s.call(this),this._cache=new d,this._cipher=new c.AES(t),this._prev=o.from(n),this._mode=e,this._autopadding=!0}e("inherits")(u,s),u.prototype._update=function(e){var t,n;this._cache.add(e);for(var i=[];t=this._cache.get();)n=this._mode.encrypt(this,t),i.push(n);return o.concat(i)};var p=o.alloc(16,16);function d(){this.cache=o.allocUnsafe(0)}function f(e,t,n){var s=i[e.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=o.from(t)),t.length!==s.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof n&&(n=o.from(n)),"GCM"!==s.mode&&n.length!==s.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===s.type?new a(s.module,t,n):"auth"===s.type?new r(s.module,t,n):new u(s.module,t,n)}u.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(p))throw this._cipher.scrub(),new Error("data not multiple of block length")},u.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},d.prototype.add=function(e){this.cache=o.concat([this.cache,e])},d.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},d.prototype.flush=function(){for(var e=16-this.cache.length,t=o.allocUnsafe(e),n=-1;++n>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function a(e){this.h=e,this.state=i.alloc(16,0),this.cache=i.allocUnsafe(0)}a.prototype.ghash=function(e){for(var t=-1;++t0;t--)i[t]=i[t]>>>1|(1&i[t-1])<<31;i[0]=i[0]>>>1,n&&(i[0]=i[0]^225<<24)}this.state=o(r)},a.prototype.update=function(e){var t;for(this.cache=i.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},a.prototype.final=function(e,t){return this.cache.length&&this.ghash(i.concat([this.cache,r],16)),this.ghash(o([0,e,0,t])),this.state},t.exports=a},{"safe-buffer":356}],74:[function(e,t,n){t.exports=function(e){for(var t,n=e.length;n--;){if(255!==(t=e.readUInt8(n))){t++,e.writeUInt8(t,n);break}e.writeUInt8(0,n)}}},{}],75:[function(e,t,n){var i=e("buffer-xor");n.encrypt=function(e,t){var n=i(t,e._prev);return e._prev=e._cipher.encryptBlock(n),e._prev},n.decrypt=function(e,t){var n=e._prev;e._prev=t;var r=e._cipher.decryptBlock(t);return i(r,n)}},{"buffer-xor":114}],76:[function(e,t,n){var i=e("safe-buffer").Buffer,r=e("buffer-xor");function o(e,t,n){var o=t.length,a=r(t,e._cache);return e._cache=e._cache.slice(o),e._prev=i.concat([e._prev,n?t:a]),a}n.encrypt=function(e,t,n){for(var r,a=i.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=i.allocUnsafe(0)),!(e._cache.length<=t.length)){a=i.concat([a,o(e,t,n)]);break}r=e._cache.length,a=i.concat([a,o(e,t.slice(0,r),n)]),t=t.slice(r)}return a}},{"buffer-xor":114,"safe-buffer":356}],77:[function(e,t,n){var i=e("safe-buffer").Buffer;function r(e,t,n){for(var i,r,a=-1,s=0;++a<8;)i=t&1<<7-a?128:0,s+=(128&(r=e._cipher.encryptBlock(e._prev)[0]^i))>>a%8,e._prev=o(e._prev,n?i:r);return s}function o(e,t){var n=e.length,r=-1,o=i.allocUnsafe(e.length);for(e=i.concat([e,i.from([t])]);++r>7;return o}n.encrypt=function(e,t,n){for(var o=t.length,a=i.allocUnsafe(o),s=-1;++s=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function a(e,t){var r=function(e){var t=o(e);return{blinder:t.toRed(i.mont(e.modulus)).redPow(new i(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}(t),a=t.modulus.byteLength(),s=new i(e).mul(r.blinder).umod(t.modulus),c=s.toRed(i.mont(t.prime1)),l=s.toRed(i.mont(t.prime2)),u=t.coefficient,p=t.prime1,d=t.prime2,f=c.redPow(t.exponent1).fromRed(),h=l.redPow(t.exponent2).fromRed(),m=f.isub(h).imul(u).umod(p).imul(d);return h.iadd(m).imul(r.unblinder).umod(t.modulus).toArrayLike(n,"be",a)}a.getr=o,t.exports=a}).call(this)}).call(this,e("buffer").Buffer)},{"bn.js":65,buffer:110,randombytes:330}],89:[function(e,t,n){"use strict";t.exports=e("./browser/algorithms.json")},{"./browser/algorithms.json":90}],90:[function(e,t,n){t.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},{}],91:[function(e,t,n){t.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},{}],92:[function(e,t,n){"use strict";var i=e("safe-buffer").Buffer,r=e("create-hash"),o=e("readable-stream"),a=e("inherits"),s=e("./sign"),c=e("./verify"),l=e("./algorithms.json");function u(e){o.Writable.call(this);var t=l[e];if(!t)throw new Error("Unknown message digest");this._hashType=t.hash,this._hash=r(t.hash),this._tag=t.id,this._signType=t.sign}function p(e){o.Writable.call(this);var t=l[e];if(!t)throw new Error("Unknown message digest");this._hash=r(t.hash),this._tag=t.id,this._signType=t.sign}function d(e){return new u(e)}function f(e){return new p(e)}Object.keys(l).forEach((function(e){l[e].id=i.from(l[e].id,"hex"),l[e.toLowerCase()]=l[e]})),a(u,o.Writable),u.prototype._write=function(e,t,n){this._hash.update(e),n()},u.prototype.update=function(e,t){return this._hash.update("string"==typeof e?i.from(e,t):e),this},u.prototype.sign=function(e,t){this.end();var n=this._hash.digest(),i=s(n,e,this._hashType,this._signType,this._tag);return t?i.toString(t):i},a(p,o.Writable),p.prototype._write=function(e,t,n){this._hash.update(e),n()},p.prototype.update=function(e,t){return this._hash.update("string"==typeof e?i.from(e,t):e),this},p.prototype.verify=function(e,t,n){var r="string"==typeof t?i.from(t,n):t;this.end();var o=this._hash.digest();return c(r,o,e,this._signType,this._tag)},t.exports={Sign:d,Verify:f,createSign:d,createVerify:f}},{"./algorithms.json":90,"./sign":93,"./verify":94,"create-hash":142,inherits:229,"readable-stream":109,"safe-buffer":356}],93:[function(e,t,n){"use strict";var i=e("safe-buffer").Buffer,r=e("create-hmac"),o=e("browserify-rsa"),a=e("elliptic").ec,s=e("bn.js"),c=e("parse-asn1"),l=e("./curves.json");function u(e,t,n,o){if((e=i.from(e.toArray())).length0&&n.ishrn(i),n}function d(e,t,n){var o,a;do{for(o=i.alloc(0);8*o.length=0)throw new Error("invalid sig")}t.exports=function(e,t,n,l,u){var p=a(n);if("ec"===p.type){if("ecdsa"!==l&&"ecdsa/rsa"!==l)throw new Error("wrong public key type");return function(e,t,n){var i=s[n.data.algorithm.curve.join(".")];if(!i)throw new Error("unknown curve "+n.data.algorithm.curve.join("."));var r=new o(i),a=n.data.subjectPrivateKey.data;return r.verify(t,e,a)}(e,t,p)}if("dsa"===p.type){if("dsa"!==l)throw new Error("wrong public key type");return function(e,t,n){var i=n.data.p,o=n.data.q,s=n.data.g,l=n.data.pub_key,u=a.signature.decode(e,"der"),p=u.s,d=u.r;c(p,o),c(d,o);var f=r.mont(i),h=p.invm(o),m=s.toRed(f).redPow(new r(t).mul(h).mod(o)).fromRed().mul(l.toRed(f).redPow(d.mul(h).mod(o)).fromRed()).mod(i).mod(o);return 0===m.cmp(d)}(e,t,p)}if("rsa"!==l&&"ecdsa/rsa"!==l)throw new Error("wrong public key type");t=i.concat([u,t]);for(var d=p.modulus.byteLength(),f=[1],h=0;t.length+f.length+2 * @license MIT */ "use strict";var t=e("base64-js"),i=e("ieee754");n.Buffer=a,n.SlowBuffer=function(e){+e!=e&&(e=0);return a.alloc(+e)},n.INSPECT_MAX_BYTES=50;var r=2147483647;function o(e){if(e>r)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=a.prototype,t}function a(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return s(e,t,n)}function s(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|d(e,t),i=o(n),r=i.write(e,t);r!==n&&(i=i.slice(0,r));return i}(e,t);if(ArrayBuffer.isView(e))return u(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(D(e,ArrayBuffer)||e&&D(e.buffer,ArrayBuffer))return function(e,t,n){if(t<0||e.byteLength=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function d(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||D(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(e).length;default:if(r)return i?-1:U(e).length;t=(""+t).toLowerCase(),r=!0}}function f(e,t,n){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return j(this,t,n);case"utf8":case"utf-8":return S(this,t,n);case"ascii":return M(this,t,n);case"latin1":case"binary":return A(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function h(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function m(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),z(n=+n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=a.from(t,i)),a.isBuffer(t))return 0===t.length?-1:b(e,t,n,i,r);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,i,r){var o,a=1,s=e.length,c=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(r){var u=-1;for(o=n;os&&(n=s-c),o=n;o>=0;o--){for(var p=!0,d=0;dr&&(i=r):i=r;var o=t.length;i>o/2&&(i=o/2);for(var a=0;a>8,r=n%256,o.push(r),o.push(i);return o}(t,e.length-n),e,n,i)}function k(e,n,i){return 0===n&&i===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,i))}function S(e,t,n){n=Math.min(e.length,n);for(var i=[],r=t;r239?4:l>223?3:l>191?2:1;if(r+p<=n)switch(p){case 1:l<128&&(u=l);break;case 2:128==(192&(o=e[r+1]))&&(c=(31&l)<<6|63&o)>127&&(u=c);break;case 3:o=e[r+1],a=e[r+2],128==(192&o)&&128==(192&a)&&(c=(15&l)<<12|(63&o)<<6|63&a)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:o=e[r+1],a=e[r+2],s=e[r+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(c=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&c<1114112&&(u=c)}null===u?(u=65533,p=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|1023&u),i.push(u),r+=p}return function(e){var t=e.length;if(t<=E)return String.fromCharCode.apply(String,e);var n="",i=0;for(;it&&(e+=" ... "),""},a.prototype.compare=function(e,t,n,i,r){if(D(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),t<0||n>e.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&t>=n)return 0;if(i>=r)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(r>>>=0)-(i>>>=0),s=(n>>>=0)-(t>>>=0),c=Math.min(o,s),l=this.slice(i,r),u=e.slice(t,n),p=0;p>>=0,isFinite(n)?(n>>>=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var r=this.length-t;if((void 0===n||n>r)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return g(this,e,t,n);case"ascii":return y(this,e,t,n);case"latin1":case"binary":return x(this,e,t,n);case"base64":return _(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var E=4096;function M(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;ri)&&(n=i);for(var r="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function C(e,t,n,i,r,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||te.length)throw new RangeError("Index out of range")}function B(e,t,n,i,r,o){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function R(e,t,n,r,o){return t=+t,n>>>=0,o||B(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function O(e,t,n,r,o){return t=+t,n>>>=0,o||B(e,0,n,8),i.write(e,t,n,r,52,8),n+8}a.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||T(e,t,this.length);for(var i=this[e],r=1,o=0;++o>>=0,t>>>=0,n||T(e,t,this.length);for(var i=this[e+--t],r=1;t>0&&(r*=256);)i+=this[e+--t]*r;return i},a.prototype.readUInt8=function(e,t){return e>>>=0,t||T(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||T(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||T(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||T(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||T(e,t,this.length);for(var i=this[e],r=1,o=0;++o=(r*=128)&&(i-=Math.pow(2,8*t)),i},a.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||T(e,t,this.length);for(var i=t,r=1,o=this[e+--i];i>0&&(r*=256);)o+=this[e+--i]*r;return o>=(r*=128)&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return e>>>=0,t||T(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||T(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(e,t){e>>>=0,t||T(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||T(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||T(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||T(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||T(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,n,i){(e=+e,t>>>=0,n>>>=0,i)||C(this,e,t,n,Math.pow(2,8*n)-1,0);var r=1,o=0;for(this[t]=255&e;++o>>=0,n>>>=0,i)||C(this,e,t,n,Math.pow(2,8*n)-1,0);var r=n-1,o=1;for(this[t+r]=255&e;--r>=0&&(o*=256);)this[t+r]=e/o&255;return t+n},a.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t>>>=0,!i){var r=Math.pow(2,8*n-1);C(this,e,t,n,r-1,-r)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},a.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t>>>=0,!i){var r=Math.pow(2,8*n-1);C(this,e,t,n,r-1,-r)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,n){return R(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return R(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return O(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return O(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,i){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,i),t);return r},a.prototype.fill=function(e,t,n,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!a.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){var r=e.charCodeAt(0);("utf8"===i&&r<128||"latin1"===i)&&(e=r)}}else"number"==typeof e&&(e&=255);if(t<0||this.length>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===i){(t-=3)>-1&&o.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&o.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function q(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function N(e,t,n,i){for(var r=0;r=t.length||r>=e.length);++r)t[r+n]=e[r];return r}function D(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function z(e){return e!=e}}).call(this)}).call(this,e("buffer").Buffer)},{"base64-js":18,buffer:110,ieee754:227}],111:[function(e,t,n){(function(e){(function(){t.exports=function(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative');return e.allocUnsafe?e.allocUnsafe(t):new e(t)}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:110}],112:[function(e,t,n){(function(n){(function(){var i=e("buffer-fill"),r=e("buffer-alloc-unsafe");t.exports=function(e,t,o){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative');if(n.alloc)return n.alloc(e,t,o);var a=r(e);return 0===e?a:void 0===t?i(a,0):("string"!=typeof o&&(o=void 0),i(a,t,o))}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:110,"buffer-alloc-unsafe":111,"buffer-fill":113}],113:[function(e,t,n){(function(e){(function(){var n=function(){try{if(!e.isEncoding("latin1"))return!1;var t=e.alloc?e.alloc(4):new e(4);return t.fill("ab","ucs2"),"61006200"===t.toString("hex")}catch(e){return!1}}();function i(e,t,n,i){if(n<0||i>e.length)throw new RangeError("Out of range index");return n>>>=0,(i=void 0===i?e.length:i>>>0)>n&&e.fill(t,n,i),e}t.exports=function(t,r,o,a,s){if(n)return t.fill(r,o,a,s);if("number"==typeof r)return i(t,r,o,a);if("string"==typeof r){if("string"==typeof o?(s=o,o=0,a=t.length):"string"==typeof a&&(s=a,a=t.length),void 0!==s&&"string"!=typeof s)throw new TypeError("encoding must be a string");if("latin1"===s&&(s="binary"),"string"==typeof s&&!e.isEncoding(s))throw new TypeError("Unknown encoding: "+s);if(""===r)return i(t,0,o,a);if(function(e){return 1===e.length&&e.charCodeAt(0)<256}(r))return i(t,r.charCodeAt(0),o,a);r=new e(r,s)}return e.isBuffer(r)?function(e,t,n,i){if(n<0||i>e.length)throw new RangeError("Out of range index");if(i<=n)return e;n>>>=0,i=void 0===i?e.length:i>>>0;for(var r=n,o=t.length;r<=i-o;)t.copy(e,r),r+=o;return r!==i&&t.copy(e,r,0,i-r),e}(t,r,o,a):i(t,0,o,a)}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:110}],114:[function(e,t,n){(function(e){(function(){t.exports=function(t,n){for(var i=Math.min(t.length,n.length),r=new e(i),o=0;o=o.pb?"PB":n>=o.tb?"TB":n>=o.gb?"GB":n>=o.mb?"MB":n>=o.kb?"KB":"B");var p=(e/o[u.toLowerCase()]).toFixed(c);return l||(p=p.replace(r,"$1")),a&&(p=p.split(".").map((function(e,t){return 0===t?e.replace(i,a):e})).join(".")),p+s+u}function c(e){if("number"==typeof e&&!isNaN(e))return e;if("string"!=typeof e)return null;var t,n=a.exec(e),i="b";return n?(t=parseFloat(n[1]),i=n[4].toLowerCase()):(t=parseInt(e,10),i="b"),isNaN(t)?null:Math.floor(o[i]*t)}},{}],117:[function(e,t,n){ /*! cache-chunk-store. MIT License. Feross Aboukhadijeh */ const i=e("lru"),r=e("queue-microtask");t.exports=class{constructor(e,t){if(this.store=e,this.chunkLength=e.chunkLength,this.inProgressGets=new Map,!this.store||!this.store.get||!this.store.put)throw new Error("First argument must be abstract-chunk-store compliant");this.cache=new i(t)}put(e,t,n=(()=>{})){if(!this.cache)return r((()=>n(new Error("CacheStore closed"))));this.cache.remove(e),this.store.put(e,t,n)}get(e,t,n=(()=>{})){if("function"==typeof t)return this.get(e,null,t);if(!this.cache)return r((()=>n(new Error("CacheStore closed"))));t||(t={});let i=this.cache.get(e);if(i){const e=t.offset||0,o=t.length||i.length-e;return 0===e&&o===i.length||(i=i.slice(e,o+e)),r((()=>n(null,i)))}let o=this.inProgressGets.get(e);const a=!!o;o||(o=[],this.inProgressGets.set(e,o)),o.push({opts:t,cb:n}),a||this.store.get(e,((t,n)=>{t||null==this.cache||this.cache.set(e,n);const i=this.inProgressGets.get(e);this.inProgressGets.delete(e);for(const{opts:e,cb:r}of i)if(t)r(t);else{const t=e.offset||0,i=e.length||n.length-t;let o=n;0===t&&i===n.length||(o=n.slice(t,i+t)),r(null,o)}}))}close(e=(()=>{})){if(!this.cache)return r((()=>e(new Error("CacheStore closed"))));this.cache=null,this.store.close(e)}destroy(e=(()=>{})){if(!this.cache)return r((()=>e(new Error("CacheStore closed"))));this.cache=null,this.store.destroy(e)}}},{lru:238,"queue-microtask":327}],118:[function(e,t,n){"use strict";var i=e("get-intrinsic"),r=e("./"),o=r(i("String.prototype.indexOf"));t.exports=function(e,t){var n=i(e,!!t);return"function"==typeof n&&o(e,".prototype.")>-1?r(n):n}},{"./":119,"get-intrinsic":190}],119:[function(e,t,n){"use strict";var i=e("function-bind"),r=e("get-intrinsic"),o=e("set-function-length"),a=r("%TypeError%"),s=r("%Function.prototype.apply%"),c=r("%Function.prototype.call%"),l=r("%Reflect.apply%",!0)||i.call(c,s),u=r("%Object.defineProperty%",!0),p=r("%Math.max%");if(u)try{u({},"a",{value:1})}catch(e){u=null}t.exports=function(e){if("function"!=typeof e)throw new a("a function is required");var t=l(i,c,arguments);return o(t,1+p(0,e.length-(arguments.length-1)),!0)};var d=function(){return l(i,s,arguments)};u?u(t.exports,"apply",{value:d}):t.exports.apply=d},{"function-bind":188,"get-intrinsic":190,"set-function-length":358}],120:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28}],121:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{"./_stream_readable":123,"./_stream_writable":125,_process:309,dup:29,inherits:229}],122:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{"./_stream_transform":124,dup:30,inherits:229}],123:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{"../errors":120,"./_stream_duplex":121,"./internal/streams/async_iterator":126,"./internal/streams/buffer_list":127,"./internal/streams/destroy":128,"./internal/streams/from":130,"./internal/streams/state":132,"./internal/streams/stream":133,_process:309,buffer:110,dup:31,events:181,inherits:229,"string_decoder/":447,util:67}],124:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{"../errors":120,"./_stream_duplex":121,dup:32,inherits:229}],125:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"../errors":120,"./_stream_duplex":121,"./internal/streams/destroy":128,"./internal/streams/state":132,"./internal/streams/stream":133,_process:309,buffer:110,dup:33,inherits:229,"util-deprecate":459}],126:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"./end-of-stream":129,_process:309,dup:34}],127:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{buffer:110,dup:35,util:67}],128:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{_process:309,dup:36}],129:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{"../../../errors":120,dup:37}],130:[function(e,t,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],131:[function(e,t,n){arguments[4][39][0].apply(n,arguments)},{"../../../errors":120,"./end-of-stream":129,dup:39}],132:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{"../../../errors":120,dup:40}],133:[function(e,t,n){arguments[4][41][0].apply(n,arguments)},{dup:41,events:181}],134:[function(e,t,n){arguments[4][42][0].apply(n,arguments)},{"./lib/_stream_duplex.js":121,"./lib/_stream_passthrough.js":122,"./lib/_stream_readable.js":123,"./lib/_stream_transform.js":124,"./lib/_stream_writable.js":125,"./lib/internal/streams/end-of-stream.js":129,"./lib/internal/streams/pipeline.js":131,dup:42}],135:[function(e,t,n){const i=e("block-stream2"),r=e("readable-stream");class o extends r.Writable{constructor(e,t,n={}){if(super(n),!e||!e.put||!e.get)throw new Error("First argument must be an abstract-chunk-store compliant store");if(!(t=Number(t)))throw new Error("Second argument must be a chunk length");const r=void 0!==n.zeroPadding&&n.zeroPadding;this._blockstream=new i(t,{...n,zeroPadding:r}),this._outstandingPuts=0,this._storeMaxOutstandingPuts=n.storeMaxOutstandingPuts||16;let o=0;this._blockstream.on("data",(t=>{this.destroyed||(this._outstandingPuts+=1,this._outstandingPuts>=this._storeMaxOutstandingPuts&&this._blockstream.pause(),e.put(o,t,(e=>{if(e)return this.destroy(e);this._outstandingPuts-=1,this._outstandingPuts{this.destroy(e)}))}_write(e,t,n){this._blockstream.write(e,t,n)}_final(e){this._blockstream.end(),this._blockstream.once("end",(()=>{0===this._outstandingPuts?e(null):this._finalCb=e}))}destroy(e){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e),this.emit("close"))}}t.exports=o},{"block-stream2":49,"readable-stream":134}],136:[function(e,t,n){var i=e("safe-buffer").Buffer,r=e("stream").Transform,o=e("string_decoder").StringDecoder;function a(e){r.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}e("inherits")(a,r),a.prototype.update=function(e,t,n){"string"==typeof e&&(e=i.from(e,t));var r=this._update(e);return this.hashMode?this:(n&&(r=this._toString(r,n)),r)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(e,t,n){var i;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){i=e}finally{n(i)}},a.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},a.prototype._finalOrDigest=function(e){var t=this.__final()||i.alloc(0);return e&&(t=this._toString(t,e,!0)),t},a.prototype._toString=function(e,t,n){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var i=this._decoder.write(e);return n&&(i+=this._decoder.end()),i},t.exports=a},{inherits:229,"safe-buffer":356,stream:409,string_decoder:447}],137:[function(e,t,n){ /*! * clipboard.js v2.0.11 * https://clipboardjs.com/ * * Licensed MIT © Zeno Rocha */ var i,r;i=this,r=function(){return function(){var e={686:function(e,t,n){"use strict";n.d(t,{default:function(){return w}});var i=n(279),r=n.n(i),o=n(370),a=n.n(o),s=n(817),c=n.n(s);function l(e){try{return document.execCommand(e)}catch(e){return!1}}var u=function(e){var t=c()(e);return l("cut"),t},p=function(e,t){var n=function(e){var t="rtl"===document.documentElement.getAttribute("dir"),n=document.createElement("textarea");n.style.fontSize="12pt",n.style.border="0",n.style.padding="0",n.style.margin="0",n.style.position="absolute",n.style[t?"right":"left"]="-9999px";var i=window.pageYOffset||document.documentElement.scrollTop;return n.style.top="".concat(i,"px"),n.setAttribute("readonly",""),n.value=e,n}(e);t.container.appendChild(n);var i=c()(n);return l("copy"),n.remove(),i},d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{container:document.body},n="";return"string"==typeof e?n=p(e,t):e instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(null==e?void 0:e.type)?n=p(e.value,t):(n=c()(e),l("copy")),n};function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}var h=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.action,n=void 0===t?"copy":t,i=e.container,r=e.target,o=e.text;if("copy"!==n&&"cut"!==n)throw new Error('Invalid "action" value, use either "copy" or "cut"');if(void 0!==r){if(!r||"object"!==f(r)||1!==r.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===n&&r.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===n&&(r.hasAttribute("readonly")||r.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes')}return o?d(o,{container:i}):r?"cut"===n?u(r):d(r,{container:i}):void 0};function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function b(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText,this.container="object"===m(e.container)?e.container:document.body}},{key:"listenClick",value:function(e){var t=this;this.listener=a()(e,"click",(function(e){return t.onClick(e)}))}},{key:"onClick",value:function(e){var t=e.delegateTarget||e.currentTarget,n=this.action(t)||"copy",i=h({action:n,container:this.container,target:this.target(t),text:this.text(t)});this.emit(i?"success":"error",{action:n,text:i,trigger:t,clearSelection:function(){t&&t.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(e){return x("action",e)}},{key:"defaultTarget",value:function(e){var t=x("target",e);if(t)return document.querySelector(t)}},{key:"defaultText",value:function(e){return x("text",e)}},{key:"destroy",value:function(){this.listener.destroy()}}],i=[{key:"copy",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{container:document.body};return d(e,t)}},{key:"cut",value:function(e){return u(e)}},{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],t="string"==typeof e?[e]:e,n=!!document.queryCommandSupported;return t.forEach((function(e){n=n&&!!document.queryCommandSupported(e)})),n}}],n&&b(t.prototype,n),i&&b(t,i),o}(r()),w=_},828:function(e){if("undefined"!=typeof Element&&!Element.prototype.matches){var t=Element.prototype;t.matches=t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector}e.exports=function(e,t){for(;e&&9!==e.nodeType;){if("function"==typeof e.matches&&e.matches(t))return e;e=e.parentNode}}},438:function(e,t,n){var i=n(828);function r(e,t,n,i,r){var a=o.apply(this,arguments);return e.addEventListener(n,a,r),{destroy:function(){e.removeEventListener(n,a,r)}}}function o(e,t,n,r){return function(n){n.delegateTarget=i(n.target,t),n.delegateTarget&&r.call(e,n)}}e.exports=function(e,t,n,i,o){return"function"==typeof e.addEventListener?r.apply(null,arguments):"function"==typeof n?r.bind(null,document).apply(null,arguments):("string"==typeof e&&(e=document.querySelectorAll(e)),Array.prototype.map.call(e,(function(e){return r(e,t,n,i,o)})))}},879:function(e,t){t.node=function(e){return void 0!==e&&e instanceof HTMLElement&&1===e.nodeType},t.nodeList=function(e){var n=Object.prototype.toString.call(e);return void 0!==e&&("[object NodeList]"===n||"[object HTMLCollection]"===n)&&"length"in e&&(0===e.length||t.node(e[0]))},t.string=function(e){return"string"==typeof e||e instanceof String},t.fn=function(e){return"[object Function]"===Object.prototype.toString.call(e)}},370:function(e,t,n){var i=n(879),r=n(438);e.exports=function(e,t,n){if(!e&&!t&&!n)throw new Error("Missing required arguments");if(!i.string(t))throw new TypeError("Second argument must be a String");if(!i.fn(n))throw new TypeError("Third argument must be a Function");if(i.node(e))return function(e,t,n){return e.addEventListener(t,n),{destroy:function(){e.removeEventListener(t,n)}}}(e,t,n);if(i.nodeList(e))return function(e,t,n){return Array.prototype.forEach.call(e,(function(e){e.addEventListener(t,n)})),{destroy:function(){Array.prototype.forEach.call(e,(function(e){e.removeEventListener(t,n)}))}}}(e,t,n);if(i.string(e))return function(e,t,n){return r(document.body,e,t,n)}(e,t,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}},817:function(e){e.exports=function(e){var t;if("SELECT"===e.nodeName)e.focus(),t=e.value;else if("INPUT"===e.nodeName||"TEXTAREA"===e.nodeName){var n=e.hasAttribute("readonly");n||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),n||e.removeAttribute("readonly"),t=e.value}else{e.hasAttribute("contenteditable")&&e.focus();var i=window.getSelection(),r=document.createRange();r.selectNodeContents(e),i.removeAllRanges(),i.addRange(r),t=i.toString()}return t}},279:function(e){function t(){}t.prototype={on:function(e,t,n){var i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var i=this;function r(){i.off(e,r),t.apply(n,arguments)}return r._=t,this.on(e,r,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),i=0,r=n.length;in)?t=("rmd160"===e?new c:l(e)).update(t).digest():t.lengths?t=e(t):t.length */ const i=e("bencode"),r=e("block-iterator"),o=e("piece-length"),a=e("path"),s=e("is-file"),c=e("junk"),l=e("join-async-iterator"),u=e("run-parallel"),p=e("queue-microtask"),d=e("simple-sha1");e("fast-readable-async-iterator");const f=e("./get-files");const h=Symbol("itemPath");function m(e,t,i){var r;if(r=e,"undefined"!=typeof FileList&&r instanceof FileList&&(e=Array.from(e)),Array.isArray(e)||(e=[e]),0===e.length)throw new Error("invalid input type");e.forEach((e=>{if(null==e)throw new Error(`invalid input type: ${e}`)})),1!==(e=e.map((e=>y(e)&&"string"==typeof e.path&&"function"==typeof f?e.path:e))).length||"string"==typeof e[0]||e[0].name||(e[0].name=t.name);let o=null;e.forEach(((t,n)=>{if("string"==typeof t)return;let i=t.fullPath||t.name;i||(i=`Unknown File ${n+1}`,t.unknownName=!0),t[h]=i.split("/"),t[h][0]||t[h].shift(),t[h].length<2?o=null:0===n&&e.length>1?o=t[h][0]:t[h][0]!==o&&(o=null)}));(void 0===t.filterJunkFiles||t.filterJunkFiles)&&(e=e.filter((e=>"string"==typeof e||!v(e[h])))),o&&e.forEach((e=>{const t=(n.isBuffer(e)||x(e))&&!e[h];"string"==typeof e||t||e[h].shift()})),!t.name&&o&&(t.name=o),t.name||e.some((e=>"string"==typeof e?(t.name=a.basename(e),!0):!e.unknownName&&(t.name=e[h][e[h].length-1],!0))),t.name||(t.name=`Unnamed Torrent ${Date.now()}`);const c=e.reduce(((e,t)=>e+Number("string"==typeof t)),0);let l=1===e.length;if(1===e.length&&"string"==typeof e[0]){if("function"!=typeof f)throw new Error("filesystem paths do not work in the browser");s(e[0],((e,t)=>{if(e)return i(e);l=t,d()}))}else p(d);function d(){u(e.map((e=>t=>{const i={};if(y(e))i.getStream=e.stream(),i.length=e.size;else if(n.isBuffer(e))i.getStream=[e],i.length=e.length;else{if(!x(e)){if("string"==typeof e){if("function"!=typeof f)throw new Error("filesystem paths do not work in the browser");return void f(e,c>1||l,t)}throw new Error("invalid input type")}i.getStream=async function*(e,t){for await(const n of e)t.length+=n.length,yield n}(e,i),i.length=0}i.path=e[h],t(null,i)})),((e,t)=>{if(e)return i(e);t=t.flat(),i(null,t,l)}))}}const b=5;function v(e){const t=e[e.length-1];return"."===t[0]&&c.is(t)}function g(e,t){return e+t.length}function y(e){return"undefined"!=typeof Blob&&e instanceof Blob}function x(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}t.exports=function(e,a,s){"function"==typeof a&&([a,s]=[s,a]),m(e,a=a?Object.assign({},a):{},((e,c,u)=>{if(e)return s(e);a.singleFileTorrent=u,function(e,a,s){let c=a.announceList;c||("string"==typeof a.announce?c=[[a.announce]]:Array.isArray(a.announce)&&(c=a.announce.map((e=>[e]))));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((e=>[e])))));void 0===a.announce&&void 0===a.announceList&&(c=c.concat(t.exports.announceList));"string"==typeof a.urlList&&(a.urlList=[a.urlList]);const u={info:{name:a.name},"creation date":Math.ceil((Number(a.creationDate)||Date.now())/1e3),encoding:"UTF-8"};0!==c.length&&(u.announce=c[0][0],u["announce-list"]=c);void 0!==a.comment&&(u.comment=a.comment);void 0!==a.createdBy&&(u["created by"]=a.createdBy);void 0!==a.private&&(u.info.private=Number(a.private));void 0!==a.info&&Object.assign(u.info,a.info);void 0!==a.sslCert&&(u.info["ssl-cert"]=a.sslCert);void 0!==a.urlList&&(u["url-list"]=a.urlList);const p=e.reduce(g,0),f=a.pieceLength||o(p);u.info["piece length"]=f,async function(e,t,i,o,a){const s=[];let c=0,u=0;const p=e.map((e=>e.getStream)),f=o.onProgress;let h=0,m=0,v=!1;const g=r(l(p),t,{zeroPadding:!1});try{for await(const e of g)await new Promise((t=>{c+=e.length;const r=m;++m,++h{s[r]=o,--h,u+=e.length,f&&f(u,i),t(),v&&0===h&&a(null,n.from(s.join(""),"hex"),c)}))}));if(0===h)return a(null,n.from(s.join(""),"hex"),c);v=!0}catch(e){a(e)}}(e,f,p,a,((t,n,r)=>{if(t)return s(t);u.info.pieces=n,e.forEach((e=>{delete e.getStream})),a.singleFileTorrent?u.info.length=r:u.info.files=e,s(null,i.encode(u))}))}(c,a,s)}))},t.exports.parseInput=function(e,t,n){"function"==typeof t&&([t,n]=[n,t]),m(e,t=t?Object.assign({},t):{},n)},t.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"]],t.exports.isJunkPath=v}).call(this)}).call(this,e("buffer").Buffer)},{"./get-files":67,bencode:22,"block-iterator":48,buffer:110,"fast-readable-async-iterator":186,"is-file":67,"join-async-iterator":232,junk:233,path:301,"piece-length":308,"queue-microtask":327,"run-parallel":354,"simple-sha1":386}],147:[function(e,t,n){"use strict";n.randomBytes=n.rng=n.pseudoRandomBytes=n.prng=e("randombytes"),n.createHash=n.Hash=e("create-hash"),n.createHmac=n.Hmac=e("create-hmac");var i=e("browserify-sign/algos"),r=Object.keys(i),o=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(r);n.getHashes=function(){return o};var a=e("pbkdf2");n.pbkdf2=a.pbkdf2,n.pbkdf2Sync=a.pbkdf2Sync;var s=e("browserify-cipher");n.Cipher=s.Cipher,n.createCipher=s.createCipher,n.Cipheriv=s.Cipheriv,n.createCipheriv=s.createCipheriv,n.Decipher=s.Decipher,n.createDecipher=s.createDecipher,n.Decipheriv=s.Decipheriv,n.createDecipheriv=s.createDecipheriv,n.getCiphers=s.getCiphers,n.listCiphers=s.listCiphers;var c=e("diffie-hellman");n.DiffieHellmanGroup=c.DiffieHellmanGroup,n.createDiffieHellmanGroup=c.createDiffieHellmanGroup,n.getDiffieHellman=c.getDiffieHellman,n.createDiffieHellman=c.createDiffieHellman,n.DiffieHellman=c.DiffieHellman;var l=e("browserify-sign");n.createSign=l.createSign,n.Sign=l.Sign,n.createVerify=l.createVerify,n.Verify=l.Verify,n.createECDH=e("create-ecdh");var u=e("public-encrypt");n.publicEncrypt=u.publicEncrypt,n.privateEncrypt=u.privateEncrypt,n.publicDecrypt=u.publicDecrypt,n.privateDecrypt=u.privateDecrypt;var p=e("randomfill");n.randomFill=p.randomFill,n.randomFillSync=p.randomFillSync,n.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},n.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":85,"browserify-sign":92,"browserify-sign/algos":89,"create-ecdh":140,"create-hash":142,"create-hmac":144,"diffie-hellman":157,pbkdf2:302,"public-encrypt":310,randombytes:330,randomfill:331}],148:[function(e,t,n){(function(i){(function(){n.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let i=0,r=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(i++,"%c"===e&&(r=i))})),e.splice(r,0,n)},n.save=function(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}},n.load=function(){let e;try{e=n.storage.getItem("debug")}catch(e){}!e&&void 0!==i&&"env"in i&&(e=i.env.DEBUG);return e},n.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},n.storage=function(){try{return localStorage}catch(e){}}(),n.destroy=(()=>{let e=!1;return()=>{e||(e=!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`."))}})(),n.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"],n.log=console.debug||console.log||(()=>{}),t.exports=e("./common")(n);const{formatters:r}=t.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this)}).call(this,e("_process"))},{"./common":149,_process:309}],149:[function(e,t,n){t.exports=function(t){function n(e){let t,r,o,a=null;function s(...e){if(!s.enabled)return;const i=s,r=Number(new Date),o=r-(t||r);i.diff=o,i.prev=t,i.curr=r,t=r,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((t,r)=>{if("%%"===t)return"%";a++;const o=n.formatters[r];if("function"==typeof o){const n=e[a];t=o.call(i,n),e.splice(a,1),a--}return t})),n.formatArgs.call(i,e);(i.log||n.log).apply(i,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=i,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(r!==n.namespaces&&(r=n.namespaces,o=n.enabled(e)),o),set:e=>{a=e}}),"function"==typeof n.init&&n.init(s),s}function i(e,t){const i=n(this.namespace+(void 0===t?":":t)+e);return i.log=this.log,i}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names.map(r),...n.skips.map(r).map((e=>"-"+e))].join(",");return n.enable(""),e},n.enable=function(e){let t;n.save(e),n.namespaces=e,n.names=[],n.skips=[];const i=("string"==typeof e?e:"").split(/[\s,]+/),r=i.length;for(t=0;t{n[e]=t[e]})),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new s("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new s("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new s("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new s("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,r=arguments.length>4?arguments[4]:null,l=arguments.length>5?arguments[5]:null,u=arguments.length>6&&arguments[6],p=!!c&&c(e,t);if(o)o(e,t,{configurable:null===l&&p?p.configurable:!l,enumerable:null===i&&p?p.enumerable:!i,value:n,writable:null===r&&p?p.writable:!r});else{if(!u&&(i||r||l))throw new a("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=n}}},{"get-intrinsic":190,gopd:191,"has-property-descriptors":192}],151:[function(e,t,n){"use strict";n.utils=e("./des/utils"),n.Cipher=e("./des/cipher"),n.DES=e("./des/des"),n.CBC=e("./des/cbc"),n.EDE=e("./des/ede")},{"./des/cbc":152,"./des/cipher":153,"./des/des":154,"./des/ede":155,"./des/utils":156}],152:[function(e,t,n){"use strict";var i=e("minimalistic-assert"),r=e("inherits"),o={};function a(e){i.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;t0;i--)t+=this._buffer(e,t),n+=this._flushBuffer(r,n);return t+=this._buffer(e,t),r},r.prototype.final=function(e){var t,n;return e&&(t=this.update(e)),n="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(n):n},r.prototype._pad=function(e,t){if(0===t)return!1;for(;t>>1];n=o.r28shl(n,s),r=o.r28shl(r,s),o.pc2(n,r,e.keys,a)}},c.prototype._update=function(e,t,n,i){var r=this._desState,a=o.readUInt32BE(e,t),s=o.readUInt32BE(e,t+4);o.ip(a,s,r.tmp,0),a=r.tmp[0],s=r.tmp[1],"encrypt"===this.type?this._encrypt(r,a,s,r.tmp,0):this._decrypt(r,a,s,r.tmp,0),a=r.tmp[0],s=r.tmp[1],o.writeUInt32BE(n,a,i),o.writeUInt32BE(n,s,i+4)},c.prototype._pad=function(e,t){if(!1===this.padding)return!1;for(var n=e.length-t,i=t;i>>0,a=d}o.rip(s,a,i,r)},c.prototype._decrypt=function(e,t,n,i,r){for(var a=n,s=t,c=e.keys.length-2;c>=0;c-=2){var l=e.keys[c],u=e.keys[c+1];o.expand(a,e.tmp,0),l^=e.tmp[0],u^=e.tmp[1];var p=o.substitute(l,u),d=a;a=(s^o.permute(p))>>>0,s=d}o.rip(a,s,i,r)}},{"./cipher":153,"./utils":156,inherits:229,"minimalistic-assert":268}],155:[function(e,t,n){"use strict";var i=e("minimalistic-assert"),r=e("inherits"),o=e("./cipher"),a=e("./des");function s(e,t){i.equal(t.length,24,"Invalid key length");var n=t.slice(0,8),r=t.slice(8,16),o=t.slice(16,24);this.ciphers="encrypt"===e?[a.create({type:"encrypt",key:n}),a.create({type:"decrypt",key:r}),a.create({type:"encrypt",key:o})]:[a.create({type:"decrypt",key:o}),a.create({type:"encrypt",key:r}),a.create({type:"decrypt",key:n})]}function c(e){o.call(this,e);var t=new s(this.type,this.options.key);this._edeState=t}r(c,o),t.exports=c,c.create=function(e){return new c(e)},c.prototype._update=function(e,t,n,i){var r=this._edeState;r.ciphers[0]._update(e,t,n,i),r.ciphers[1]._update(n,i,n,i),r.ciphers[2]._update(n,i,n,i)},c.prototype._pad=a.prototype._pad,c.prototype._unpad=a.prototype._unpad},{"./cipher":153,"./des":154,inherits:229,"minimalistic-assert":268}],156:[function(e,t,n){"use strict";n.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},n.writeUInt32BE=function(e,t,n){e[0+n]=t>>>24,e[1+n]=t>>>16&255,e[2+n]=t>>>8&255,e[3+n]=255&t},n.ip=function(e,t,n,i){for(var r=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)r<<=1,r|=t>>>s+a&1;for(s=0;s<=24;s+=8)r<<=1,r|=e>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1}n[i+0]=r>>>0,n[i+1]=o>>>0},n.rip=function(e,t,n,i){for(var r=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)r<<=1,r|=t>>>s+a&1,r<<=1,r|=e>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=t>>>s+a&1,o<<=1,o|=e>>>s+a&1;n[i+0]=r>>>0,n[i+1]=o>>>0},n.pc1=function(e,t,n,i){for(var r=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)r<<=1,r|=t>>s+a&1;for(s=0;s<=24;s+=8)r<<=1,r|=e>>s+a&1}for(s=0;s<=24;s+=8)r<<=1,r|=t>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;n[i+0]=r>>>0,n[i+1]=o>>>0},n.r28shl=function(e,t){return e<>>28-t};var i=[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];n.pc2=function(e,t,n,r){for(var o=0,a=0,s=i.length>>>1,c=0;c>>i[c]&1;for(c=s;c>>i[c]&1;n[r+0]=o>>>0,n[r+1]=a>>>0},n.expand=function(e,t,n){var i=0,r=0;i=(1&e)<<5|e>>>27;for(var o=23;o>=15;o-=4)i<<=6,i|=e>>>o&63;for(o=11;o>=3;o-=4)r|=e>>>o&63,r<<=6;r|=(31&e)<<1|e>>>31,t[n+0]=i>>>0,t[n+1]=r>>>0};var r=[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];n.substitute=function(e,t){for(var n=0,i=0;i<4;i++){n<<=4,n|=r[64*i+(e>>>18-6*i&63)]}for(i=0;i<4;i++){n<<=4,n|=r[256+64*i+(t>>>18-6*i&63)]}return n>>>0};var o=[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];n.permute=function(e){for(var t=0,n=0;n>>o[n]&1;return t>>>0},n.padSplit=function(e,t,n){for(var i=e.toString(2);i.lengthe;)n.ishrn(1);if(n.isEven()&&n.iadd(s),n.testn(1)||n.iadd(c),t.cmp(c)){if(!t.cmp(l))for(;n.mod(u).cmp(p);)n.iadd(f)}else for(;n.mod(o).cmp(d);)n.iadd(f);if(b(h=n.shrn(1))&&b(n)&&v(h)&&v(n)&&a.test(h)&&a.test(n))return n}}},{"bn.js":161,"miller-rabin":259,randombytes:330}],160:[function(e,t,n){t.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"}}},{}],161:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{buffer:67,dup:17}],162:[function(e,t,n){"use strict";var i=n;i.version=e("../package.json").version,i.utils=e("./elliptic/utils"),i.rand=e("brorand"),i.curve=e("./elliptic/curve"),i.curves=e("./elliptic/curves"),i.ec=e("./elliptic/ec"),i.eddsa=e("./elliptic/eddsa")},{"../package.json":178,"./elliptic/curve":165,"./elliptic/curves":168,"./elliptic/ec":169,"./elliptic/eddsa":172,"./elliptic/utils":176,brorand:66}],163:[function(e,t,n){"use strict";var i=e("bn.js"),r=e("../utils"),o=r.getNAF,a=r.getJSF,s=r.assert;function c(e,t){this.type=e,this.p=new i(t.p,16),this.red=t.prime?i.red(t.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=t.n&&new i(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function l(e,t){this.curve=e,this.type=t,this.precomputed=null}t.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){s(e.precomputed);var n=e._getDoubles(),i=o(t,1,this._bitLength),r=(1<=a;u--)c=(c<<1)+i[u];l.push(c)}for(var p=this.jpoint(null,null,null),d=this.jpoint(null,null,null),f=r;f>0;f--){for(a=0;a=0;l--){for(var u=0;l>=0&&0===a[l];l--)u++;if(l>=0&&u++,c=c.dblp(u),l<0)break;var p=a[l];s(0!==p),c="affine"===e.type?p>0?c.mixedAdd(r[p-1>>1]):c.mixedAdd(r[-p-1>>1].neg()):p>0?c.add(r[p-1>>1]):c.add(r[-p-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,n,i,r){var s,c,l,u=this._wnafT1,p=this._wnafT2,d=this._wnafT3,f=0;for(s=0;s=1;s-=2){var m=s-1,b=s;if(1===u[m]&&1===u[b]){var v=[t[m],null,null,t[b]];0===t[m].y.cmp(t[b].y)?(v[1]=t[m].add(t[b]),v[2]=t[m].toJ().mixedAdd(t[b].neg())):0===t[m].y.cmp(t[b].y.redNeg())?(v[1]=t[m].toJ().mixedAdd(t[b]),v[2]=t[m].add(t[b].neg())):(v[1]=t[m].toJ().mixedAdd(t[b]),v[2]=t[m].toJ().mixedAdd(t[b].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=a(n[m],n[b]);for(f=Math.max(y[0].length,f),d[m]=new Array(f),d[b]=new Array(f),c=0;c=0;s--){for(var S=0;s>=0;){var E=!0;for(c=0;c=0&&S++,w=w.dblp(S),s<0)break;for(c=0;c0?l=p[c][M-1>>1]:M<0&&(l=p[c][-M-1>>1].neg()),w="affine"===l.type?w.mixedAdd(l):w.add(l))}}for(s=0;s=Math.ceil((e.bitLength()+1)/t.step)},l.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,r=0;r":""},l.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},l.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),r=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=i.redAdd(t),a=o.redSub(n),s=i.redSub(t),c=r.redMul(a),l=o.redMul(s),u=r.redMul(s),p=a.redMul(o);return this.curve.point(c,l,p,u)},l.prototype._projDbl=function(){var e,t,n,i,r,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var l=(i=this.curve._mulA(s)).redAdd(c);this.zOne?(e=a.redSub(s).redSub(c).redMul(l.redSub(this.curve.two)),t=l.redMul(i.redSub(c)),n=l.redSqr().redSub(l).redSub(l)):(r=this.z.redSqr(),o=l.redSub(r).redISub(r),e=a.redSub(s).redISub(c).redMul(o),t=l.redMul(i.redSub(c)),n=l.redMul(o))}else i=s.redAdd(c),r=this.curve._mulC(this.z).redSqr(),o=i.redSub(r).redSub(r),e=this.curve._mulC(a.redISub(i)).redMul(o),t=this.curve._mulC(i).redMul(s.redISub(c)),n=i.redMul(o);return this.curve.point(e,t,n)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},l.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),r=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),a=r.redSub(i),s=r.redAdd(i),c=n.redAdd(t),l=o.redMul(a),u=s.redMul(c),p=o.redMul(c),d=a.redMul(s);return this.curve.point(l,u,d,p)},l.prototype._projAdd=function(e){var t,n,i=this.z.redMul(e.z),r=i.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),c=r.redSub(s),l=r.redAdd(s),u=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),p=i.redMul(c).redMul(u);return this.curve.twisted?(t=i.redMul(l).redMul(a.redSub(this.curve._mulA(o))),n=c.redMul(l)):(t=i.redMul(l).redMul(a.redSub(o)),n=this.curve._mulC(c).redMul(l)),this.curve.point(p,t,n)},l.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},l.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},l.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},l.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},l.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},l.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},l.prototype.getX=function(){return this.normalize(),this.x.fromRed()},l.prototype.getY=function(){return this.normalize(),this.y.fromRed()},l.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},l.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(i),0===this.x.cmp(t))return!0}},l.prototype.toP=l.prototype.normalize,l.prototype.mixedAdd=l.prototype.add},{"../utils":176,"./base":163,"bn.js":177,inherits:229}],165:[function(e,t,n){"use strict";var i=n;i.base=e("./base"),i.short=e("./short"),i.mont=e("./mont"),i.edwards=e("./edwards")},{"./base":163,"./edwards":164,"./mont":166,"./short":167}],166:[function(e,t,n){"use strict";var i=e("bn.js"),r=e("inherits"),o=e("./base"),a=e("../utils");function s(e){o.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,n){o.BasePoint.call(this,e,"projective"),null===t&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}r(s,o),t.exports=s,s.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),i=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===i.redSqrt().redSqr().cmp(i)},r(c,o.BasePoint),s.prototype.decodePoint=function(e,t){return this.point(a.toArray(e,t),1)},s.prototype.point=function(e,t){return new c(this,e,t)},s.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),i=e.redMul(t),r=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(i,r)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),r=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),a=r.redMul(i),s=t.z.redMul(o.redAdd(a).redSqr()),c=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,c)},c.prototype.mul=function(e){for(var t=e.clone(),n=this,i=this.curve.point(null,null),r=[];0!==t.cmpn(0);t.iushrn(1))r.push(t.andln(1));for(var o=r.length-1;o>=0;o--)0===r[o]?(n=n.diffAdd(i,this),i=i.dbl()):(i=n.diffAdd(i,this),n=n.dbl());return i},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../utils":176,"./base":163,"bn.js":177,inherits:229}],167:[function(e,t,n){"use strict";var i=e("../utils"),r=e("bn.js"),o=e("inherits"),a=e("./base"),s=i.assert;function c(e){a.call(this,"short",e),this.a=new r(e.a,16).toRed(this.red),this.b=new r(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function l(e,t,n,i){a.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new r(t,16),this.y=new r(n,16),i&&(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 u(e,t,n,i){a.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new r(0)):(this.x=new r(t,16),this.y=new r(n,16),this.z=new r(i,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}o(c,a),t.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new r(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=(t=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(e.lambda)n=new r(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?n=o[0]:(n=o[1],s(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map((function(e){return{a:new r(e.a,16),b:new r(e.b,16)}})):this._getEndoBasis(n)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:r.mont(e),n=new r(2).toRed(t).redInvm(),i=n.redNeg(),o=new r(3).toRed(t).redNeg().redSqrt().redMul(n);return[i.redAdd(o).fromRed(),i.redSub(o).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,n,i,o,a,s,c,l,u,p=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,f=this.n.clone(),h=new r(1),m=new r(0),b=new r(0),v=new r(1),g=0;0!==d.cmpn(0);){var y=f.div(d);l=f.sub(y.mul(d)),u=b.sub(y.mul(h));var x=v.sub(y.mul(m));if(!i&&l.cmp(p)<0)t=c.neg(),n=h,i=l.neg(),o=u;else if(i&&2==++g)break;c=l,f=d,d=l,b=h,h=u,v=m,m=x}a=l.neg(),s=u;var _=i.sqr().add(o.sqr());return a.sqr().add(s.sqr()).cmp(_)>=0&&(a=t,s=n),i.negative&&(i=i.neg(),o=o.neg()),a.negative&&(a=a.neg(),s=s.neg()),[{a:i,b:o},{a:a,b:s}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],i=t[1],r=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=r.mul(n.a),s=o.mul(i.a),c=r.mul(n.b),l=o.mul(i.b);return{k1:e.sub(a).sub(s),k2:c.add(l).neg()}},c.prototype.pointFromX=function(e,t){(e=new r(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(0!==i.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var o=i.fromRed().isOdd();return(t&&!o||!t&&o)&&(i=i.redNeg()),this.point(e,i)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,i=this.a.redMul(t),r=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return 0===n.redSqr().redISub(r).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,n){for(var i=this._endoWnafT1,r=this._endoWnafT2,o=0;o":""},l.prototype.isInfinity=function(){return this.inf},l.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},l.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),r=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(i),o=r.redSqr().redISub(this.x.redAdd(this.x)),a=r.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},l.prototype.getX=function(){return this.x.fromRed()},l.prototype.getY=function(){return this.y.fromRed()},l.prototype.mul=function(e){return e=new r(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},l.prototype.mulAdd=function(e,t,n){var i=[this,t],r=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,r):this.curve._wnafMulAdd(1,i,r,2)},l.prototype.jmulAdd=function(e,t,n){var i=[this,t],r=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,r,!0):this.curve._wnafMulAdd(1,i,r,2,!0)},l.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},l.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return t},l.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(u,a.BasePoint),c.prototype.jpoint=function(e,t,n){return new u(this,e,t,n)},u.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(n,i)},u.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},u.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(t),r=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),s=i.redSub(r),c=o.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=s.redSqr(),u=l.redMul(s),p=i.redMul(l),d=c.redSqr().redIAdd(u).redISub(p).redISub(p),f=c.redMul(p.redISub(d)).redISub(o.redMul(u)),h=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(d,f,h)},u.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,i=e.x.redMul(t),r=this.y,o=e.y.redMul(t).redMul(this.z),a=n.redSub(i),s=r.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),l=c.redMul(a),u=n.redMul(c),p=s.redSqr().redIAdd(l).redISub(u).redISub(u),d=s.redMul(u.redISub(p)).redISub(r.redMul(l)),f=this.z.redMul(a);return this.curve.jpoint(p,d,f)},u.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t=0)return!1;if(n.redIAdd(r),0===this.x.cmp(n))return!0}},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../utils":176,"./base":163,"bn.js":177,inherits:229}],168:[function(e,t,n){"use strict";var i,r=n,o=e("hash.js"),a=e("./curve"),s=e("./utils").assert;function c(e){"short"===e.type?this.curve=new a.short(e):"edwards"===e.type?this.curve=new a.edwards(e):this.curve=new a.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function l(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var n=new c(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=c,l("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:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),l("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:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),l("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:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),l("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:o.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"]}),l("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:o.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"]}),l("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),l("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:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=e("./precomputed/secp256k1")}catch(e){i=void 0}l("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:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",i]})},{"./curve":165,"./precomputed/secp256k1":175,"./utils":176,"hash.js":212}],169:[function(e,t,n){"use strict";var i=e("bn.js"),r=e("hmac-drbg"),o=e("../utils"),a=e("../curves"),s=e("brorand"),c=o.assert,l=e("./key"),u=e("./signature");function p(e){if(!(this instanceof p))return new p(e);"string"==typeof e&&(c(Object.prototype.hasOwnProperty.call(a,e),"Unknown curve "+e),e=a[e]),e instanceof a.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}t.exports=p,p.prototype.keyPair=function(e){return new l(this,e)},p.prototype.keyFromPrivate=function(e,t){return l.fromPrivate(this,e,t)},p.prototype.keyFromPublic=function(e,t){return l.fromPublic(this,e,t)},p.prototype.genKeyPair=function(e){e||(e={});for(var t=new r({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||s(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),o=this.n.sub(new i(2));;){var a=new i(t.generate(n));if(!(a.cmp(o)>0))return a.iaddn(1),this.keyFromPrivate(a)}},p.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},p.prototype.sign=function(e,t,n,o){"object"==typeof n&&(o=n,n=null),o||(o={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new i(e,16));for(var a=this.n.byteLength(),s=t.getPrivate().toArray("be",a),c=e.toArray("be",a),l=new r({hash:this.hash,entropy:s,nonce:c,pers:o.pers,persEnc:o.persEnc||"utf8"}),p=this.n.sub(new i(1)),d=0;;d++){var f=o.k?o.k(d):new i(l.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(p)>=0)){var h=this.g.mul(f);if(!h.isInfinity()){var m=h.getX(),b=m.umod(this.n);if(0!==b.cmpn(0)){var v=f.invm(this.n).mul(b.mul(t.getPrivate()).iadd(e));if(0!==(v=v.umod(this.n)).cmpn(0)){var g=(h.getY().isOdd()?1:0)|(0!==m.cmp(b)?2:0);return o.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),g^=1),new u({r:b,s:v,recoveryParam:g})}}}}}},p.prototype.verify=function(e,t,n,r){e=this._truncateToN(new i(e,16)),n=this.keyFromPublic(n,r);var o=(t=new u(t,"hex")).r,a=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,c=a.invm(this.n),l=c.mul(e).umod(this.n),p=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(l,n.getPublic(),p)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(l,n.getPublic(),p)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},p.prototype.recoverPubKey=function(e,t,n,r){c((3&n)===n,"The recovery param is more than two bits"),t=new u(t,r);var o=this.n,a=new i(e),s=t.r,l=t.s,p=1&n,d=n>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");s=d?this.curve.pointFromX(s.add(this.curve.n),p):this.curve.pointFromX(s,p);var f=t.r.invm(o),h=o.sub(a).mul(f).umod(o),m=l.mul(f).umod(o);return this.g.mulAdd(h,s,m)},p.prototype.getKeyRecoveryParam=function(e,t,n,i){if(null!==(t=new u(t,i)).recoveryParam)return t.recoveryParam;for(var r=0;r<4;r++){var o;try{o=this.recoverPubKey(e,t,r)}catch(e){continue}if(o.eq(n))return r}throw new Error("Unable to find valid recovery factor")}},{"../curves":168,"../utils":176,"./key":170,"./signature":171,"bn.js":177,brorand:66,"hmac-drbg":225}],170:[function(e,t,n){"use strict";var i=e("bn.js"),r=e("../utils").assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}t.exports=o,o.fromPublic=function(e,t,n){return t instanceof o?t:new o(e,{pub:t,pubEnc:n})},o.fromPrivate=function(e,t,n){return t instanceof o?t:new o(e,{priv:t,privEnc:n})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new i(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?r(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||r(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.validate()||r(e.validate(),"public point not validated"),e.mul(this.priv).getX()},o.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},{"../utils":176,"bn.js":177}],171:[function(e,t,n){"use strict";var i=e("bn.js"),r=e("../utils"),o=r.assert;function a(e,t){if(e instanceof a)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new i(e.r,16),this.s=new i(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function s(){this.place=0}function c(e,t){var n=e[t.place++];if(!(128&n))return n;var i=15&n;if(0===i||i>4)return!1;for(var r=0,o=0,a=t.place;o>>=0;return!(r<=127)&&(t.place=a,r)}function l(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}t.exports=a,a.prototype._importDER=function(e,t){e=r.toArray(e,t);var n=new s;if(48!==e[n.place++])return!1;var o=c(e,n);if(!1===o)return!1;if(o+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var a=c(e,n);if(!1===a)return!1;var l=e.slice(n.place,a+n.place);if(n.place+=a,2!==e[n.place++])return!1;var u=c(e,n);if(!1===u)return!1;if(e.length!==u+n.place)return!1;var p=e.slice(n.place,u+n.place);if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}if(0===p[0]){if(!(128&p[1]))return!1;p=p.slice(1)}return this.r=new i(l),this.s=new i(p),this.recoveryParam=null,!0},a.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=l(t),n=l(n);!(n[0]||128&n[1]);)n=n.slice(1);var i=[2];u(i,t.length),(i=i.concat(t)).push(2),u(i,n.length);var o=i.concat(n),a=[48];return u(a,o.length),a=a.concat(o),r.encode(a,e)}},{"../utils":176,"bn.js":177}],172:[function(e,t,n){"use strict";var i=e("hash.js"),r=e("../curves"),o=e("../utils"),a=o.assert,s=o.parseBytes,c=e("./key"),l=e("./signature");function u(e){if(a("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof u))return new u(e);e=r[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=i.sha512}t.exports=u,u.prototype.sign=function(e,t){e=s(e);var n=this.keyFromSecret(t),i=this.hashInt(n.messagePrefix(),e),r=this.g.mul(i),o=this.encodePoint(r),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),c=i.add(a).umod(this.curve.n);return this.makeSignature({R:r,S:c,Rencoded:o})},u.prototype.verify=function(e,t,n){e=s(e),t=this.makeSignature(t);var i=this.keyFromPublic(n),r=this.hashInt(t.Rencoded(),i.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(i.pub().mul(r)).eq(o)},u.prototype.hashInt=function(){for(var e=this.hash(),t=0;t(r>>1)-1?(r>>1)-c:c,o.isubn(s)):s=0,i[a]=s,o.iushrn(1)}return i},i.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var i,r=0,o=0;e.cmpn(-r)>0||t.cmpn(-o)>0;){var a,s,c=e.andln(3)+r&3,l=t.andln(3)+o&3;3===c&&(c=-1),3===l&&(l=-1),a=0==(1&c)?0:3!==(i=e.andln(7)+r&7)&&5!==i||2!==l?c:-c,n[0].push(a),s=0==(1&l)?0:3!==(i=t.andln(7)+o&7)&&5!==i||2!==c?l:-l,n[1].push(s),2*r===a+1&&(r=1-r),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},i.cachedProperty=function(e,t,n){var i="_"+t;e.prototype[t]=function(){return void 0!==this[i]?this[i]:this[i]=n.call(this)}},i.parseBytes=function(e){return"string"==typeof e?i.toArray(e,"hex"):e},i.intFromLE=function(e){return new r(e,"hex","le")}},{"bn.js":177,"minimalistic-assert":268,"minimalistic-crypto-utils":269}],177:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{buffer:67,dup:17}],178:[function(e,t,n){t.exports={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny ",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"}}},{}],179:[function(e,t,n){(function(n){(function(){var i=e("once"),r=function(){},o=function(e,t,a){if("function"==typeof t)return o(e,null,t);t||(t={}),a=i(a||r);var s=e._writableState,c=e._readableState,l=t.readable||!1!==t.readable&&e.readable,u=t.writable||!1!==t.writable&&e.writable,p=!1,d=function(){e.writable||f()},f=function(){u=!1,l||a.call(e)},h=function(){l=!1,u||a.call(e)},m=function(t){a.call(e,t?new Error("exited with error code: "+t):null)},b=function(t){a.call(e,t)},v=function(){n.nextTick(g)},g=function(){if(!p)return(!l||c&&c.ended&&!c.destroyed)&&(!u||s&&s.ended&&!s.destroyed)?void 0:a.call(e,new Error("premature close"))},y=function(){e.req.on("finish",f)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?u&&!s&&(e.on("end",d),e.on("close",d)):(e.on("complete",f),e.on("abort",v),e.req?y():e.on("request",y)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",m),e.on("end",h),e.on("finish",f),!1!==t.error&&e.on("error",b),e.on("close",v),function(){p=!0,e.removeListener("complete",f),e.removeListener("abort",v),e.removeListener("request",y),e.req&&e.req.removeListener("finish",f),e.removeListener("end",d),e.removeListener("close",d),e.removeListener("finish",f),e.removeListener("exit",m),e.removeListener("end",h),e.removeListener("error",b),e.removeListener("close",v)}};t.exports=o}).call(this)}).call(this,e("_process"))},{_process:309,once:294}],180:[function(e,t,n){"use strict";function i(e,t){for(const n in t)Object.defineProperty(e,n,{value:t[n],enumerable:!0,configurable:!0});return e}t.exports=function(e,t,n){if(!e||"string"==typeof e)throw new TypeError("Please pass an Error to err-code");n||(n={}),"object"==typeof t&&(n=t,t=""),t&&(n.code=t);try{return i(e,n)}catch(t){n.message=e.message,n.stack=e.stack;const r=function(){};r.prototype=Object.create(Object.getPrototypeOf(e));return i(new r,n)}}},{}],181:[function(e,t,n){"use strict";var i,r="object"==typeof Reflect?Reflect:null,o=r&&"function"==typeof r.apply?r.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};i=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(e,t){return new Promise((function(n,i){function r(n){e.removeListener(t,o),i(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}v(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&v(e,"error",t,n)}(e,r,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function p(e,t,n,i){var r,o,a,s;if(l(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),(r=u(e))>0&&a.length>r&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,s=c,console&&console.warn&&console.warn(s)}return e}function d(){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 f(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=d.bind(i);return r.listener=n,i.wrapFn=r,r}function h(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var c=r[e];if(void 0===c)return!1;if("function"==typeof c)o(c,this,t);else{var l=c.length,u=b(c,l);for(n=0;n=0;o--)if(n[o]===t||n[o].listener===t){a=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},{}],182:[function(e,t,n){var i=e("safe-buffer").Buffer,r=e("md5.js");t.exports=function(e,t,n,o){if(i.isBuffer(e)||(e=i.from(e,"binary")),t&&(i.isBuffer(t)||(t=i.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var a=n/8,s=i.alloc(a),c=i.alloc(o||0),l=i.alloc(0);a>0||o>0;){var u=new r;u.update(l),u.update(e),t&&u.update(t),l=u.digest();var p=0;if(a>0){var d=s.length-a;p=Math.min(a,l.length),l.copy(s,d,0,p),a-=p}if(p0){var f=c.length-o,h=Math.min(o,l.length-p);l.copy(c,f,p,p+h),o-=h}}return l.fill(0),{key:s,iv:c}}},{"md5.js":241,"safe-buffer":356}],183:[function(e,t,n){const{Readable:i,Writable:r}=e("streamx");e("fast-readable-async-iterator");t.exports={BlobWriteStream:class extends r{constructor(e,t={}){super(Object.assign({decodeStrings:!1},t)),this.chunks=[];const n=t.mimeType;this.once("close",(()=>{const t=null!=n?new Blob(this.chunks,{type:n}):new Blob(this.chunks);e(t),this.emit("blob",t)}))}_write(e,t){this.chunks.push(e),t()}},BlobReadStream:function(e,t={}){return i.from(e.stream(),t)}}},{"fast-readable-async-iterator":186,streamx:446}],184:[function(e,t,n){t.exports=class{constructor(e){if(!(e>0)||0!=(e-1&e))throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}clear(){this.top=this.btm=0,this.next=null,this.buffer.fill(void 0)}push(e){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}peek(){return this.buffer[this.btm]}isEmpty(){return void 0===this.buffer[this.btm]}}},{}],185:[function(e,t,n){const i=e("./fixed-size");t.exports=class{constructor(e){this.hwm=e||16,this.head=new i(this.hwm),this.tail=this.head,this.length=0}clear(){this.head=this.tail,this.head.clear(),this.length=0}push(e){if(this.length++,!this.head.push(e)){const t=this.head;this.head=t.next=new i(2*this.head.buffer.length),this.head.push(e)}}shift(){0!==this.length&&this.length--;const e=this.tail.shift();if(void 0===e&&this.tail.next){const e=this.tail.next;return this.tail.next=null,this.tail=e,this.tail.shift()}return e}peek(){const e=this.tail.peek();return void 0===e&&this.tail.next?this.tail.next.peek():e}isEmpty(){return 0===this.length}}},{"./fixed-size":184}],186:[function(e,t,n){"undefined"==typeof ReadableStream||ReadableStream.prototype[Symbol.asyncIterator]||(ReadableStream.prototype[Symbol.asyncIterator]=function(){const e=this.getReader();let t=e.read();return{next(){const n=t;return t=e.read(),n},return(){t.then((()=>e.releaseLock()))},throw(e){throw this.return(),e},[Symbol.asyncIterator](){return this}}})},{}],187:[function(e,t,n){"use strict";var i=Object.prototype.toString,r=Math.max,o=function(e,t){for(var n=[],i=0;i1&&"boolean"!=typeof t)throw new a('"allowMissing" argument must be a boolean');if(null===M(/^%?[^%]*%?$/,e))throw new r("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=function(e){var t=E(e,0,1),n=E(e,-1);if("%"===t&&"%"!==n)throw new r("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==t)throw new r("invalid intrinsic syntax, expected opening `%`");var i=[];return S(e,A,(function(e,t,n,r){i[i.length]=n?S(r,j,"$1"):t||e})),i}(e),i=n.length>0?n[0]:"",o=I("%"+i+"%",t),s=o.name,l=o.value,u=!1,p=o.alias;p&&(i=p[0],k(n,w([0,1],p)));for(var d=1,f=!0;d=n.length){var g=c(l,h);l=(f=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:l[h]}else f=_(l,h),l=l[h];f&&!u&&(b[s]=l)}}return l}},{"function-bind":188,"has-proto":193,"has-symbols":194,hasown:224}],191:[function(e,t,n){"use strict";var i=e("get-intrinsic")("%Object.getOwnPropertyDescriptor%",!0);if(i)try{i([],"length")}catch(e){i=null}t.exports=i},{"get-intrinsic":190}],192:[function(e,t,n){"use strict";var i=e("get-intrinsic")("%Object.defineProperty%",!0),r=function(){if(i)try{return i({},"a",{value:1}),!0}catch(e){return!1}return!1};r.hasArrayLengthDefineBug=function(){if(!r())return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},t.exports=r},{"get-intrinsic":190}],193:[function(e,t,n){"use strict";var i={foo:{}},r=Object;t.exports=function(){return{__proto__:i}.foo===i.foo&&!({__proto__:null}instanceof r)}},{}],194:[function(e,t,n){"use strict";var i="undefined"!=typeof Symbol&&Symbol,r=e("./shams");t.exports=function(){return"function"==typeof i&&("function"==typeof Symbol&&("symbol"==typeof i("foo")&&("symbol"==typeof Symbol("bar")&&r())))}},{"./shams":195}],195:[function(e,t,n){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var i=Object.getOwnPropertySymbols(e);if(1!==i.length||i[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},{}],196:[function(e,t,n){"use strict";var i=e("safe-buffer").Buffer,r=e("readable-stream").Transform;function o(e){r.call(this),this._block=i.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}e("inherits")(o,r),o.prototype._transform=function(e,t,n){var i=null;try{this.update(e,t)}catch(e){i=e}n(i)},o.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},o.prototype.update=function(e,t){if(function(e,t){if(!i.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");i.isBuffer(e)||(e=i.from(e,t));for(var n=this._block,r=0;this._blockOffset+e.length-r>=this._blockSize;){for(var o=this._blockOffset;o0;++a)this._length[a]+=s,(s=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*s);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},{inherits:229,"readable-stream":211,"safe-buffer":356}],197:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28}],198:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{"./_stream_readable":200,"./_stream_writable":202,_process:309,dup:29,inherits:229}],199:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{"./_stream_transform":201,dup:30,inherits:229}],200:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{"../errors":197,"./_stream_duplex":198,"./internal/streams/async_iterator":203,"./internal/streams/buffer_list":204,"./internal/streams/destroy":205,"./internal/streams/from":207,"./internal/streams/state":209,"./internal/streams/stream":210,_process:309,buffer:110,dup:31,events:181,inherits:229,"string_decoder/":447,util:67}],201:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{"../errors":197,"./_stream_duplex":198,dup:32,inherits:229}],202:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"../errors":197,"./_stream_duplex":198,"./internal/streams/destroy":205,"./internal/streams/state":209,"./internal/streams/stream":210,_process:309,buffer:110,dup:33,inherits:229,"util-deprecate":459}],203:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"./end-of-stream":206,_process:309,dup:34}],204:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{buffer:110,dup:35,util:67}],205:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{_process:309,dup:36}],206:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{"../../../errors":197,dup:37}],207:[function(e,t,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],208:[function(e,t,n){arguments[4][39][0].apply(n,arguments)},{"../../../errors":197,"./end-of-stream":206,dup:39}],209:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{"../../../errors":197,dup:40}],210:[function(e,t,n){arguments[4][41][0].apply(n,arguments)},{dup:41,events:181}],211:[function(e,t,n){arguments[4][42][0].apply(n,arguments)},{"./lib/_stream_duplex.js":198,"./lib/_stream_passthrough.js":199,"./lib/_stream_readable.js":200,"./lib/_stream_transform.js":201,"./lib/_stream_writable.js":202,"./lib/internal/streams/end-of-stream.js":206,"./lib/internal/streams/pipeline.js":208,dup:42}],212:[function(e,t,n){var i=n;i.utils=e("./hash/utils"),i.common=e("./hash/common"),i.sha=e("./hash/sha"),i.ripemd=e("./hash/ripemd"),i.hmac=e("./hash/hmac"),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},{"./hash/common":213,"./hash/hmac":214,"./hash/ripemd":215,"./hash/sha":216,"./hash/utils":223}],213:[function(e,t,n){"use strict";var i=e("./utils"),r=e("minimalistic-assert");function o(){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}n.BlockHash=o,o.prototype.update=function(e,t){if(e=i.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-n,this.endian);for(var r=0;r>>24&255,i[r++]=e>>>16&255,i[r++]=e>>>8&255,i[r++]=255&e}else for(i[r++]=255&e,i[r++]=e>>>8&255,i[r++]=e>>>16&255,i[r++]=e>>>24&255,i[r++]=0,i[r++]=0,i[r++]=0,i[r++]=0,o=8;othis.blockSize&&(e=(new this.Hash).update(e).digest()),r(e.length<=this.blockSize);for(var t=e.length;t>>3},n.g1_256=function(e){return i(e,17)^i(e,19)^e>>>10}},{"../utils":223}],223:[function(e,t,n){"use strict";var i=e("minimalistic-assert"),r=e("inherits");function o(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function a(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function s(e){return 1===e.length?"0"+e:e}function c(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}n.inherits=r,n.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),r=0;r>6|192,n[i++]=63&a|128):o(e,r)?(a=65536+((1023&a)<<10)+(1023&e.charCodeAt(++r)),n[i++]=a>>18|240,n[i++]=a>>12&63|128,n[i++]=a>>6&63|128,n[i++]=63&a|128):(n[i++]=a>>12|224,n[i++]=a>>6&63|128,n[i++]=63&a|128)}else for(r=0;r>>0}return a},n.split32=function(e,t){for(var n=new Array(4*e.length),i=0,r=0;i>>24,n[r+1]=o>>>16&255,n[r+2]=o>>>8&255,n[r+3]=255&o):(n[r+3]=o>>>24,n[r+2]=o>>>16&255,n[r+1]=o>>>8&255,n[r]=255&o)}return n},n.rotr32=function(e,t){return e>>>t|e<<32-t},n.rotl32=function(e,t){return e<>>32-t},n.sum32=function(e,t){return e+t>>>0},n.sum32_3=function(e,t,n){return e+t+n>>>0},n.sum32_4=function(e,t,n,i){return e+t+n+i>>>0},n.sum32_5=function(e,t,n,i,r){return e+t+n+i+r>>>0},n.sum64=function(e,t,n,i){var r=e[t],o=i+e[t+1]>>>0,a=(o>>0,e[t+1]=o},n.sum64_hi=function(e,t,n,i){return(t+i>>>0>>0},n.sum64_lo=function(e,t,n,i){return t+i>>>0},n.sum64_4_hi=function(e,t,n,i,r,o,a,s){var c=0,l=t;return c+=(l=l+i>>>0)>>0)>>0)>>0},n.sum64_4_lo=function(e,t,n,i,r,o,a,s){return t+i+o+s>>>0},n.sum64_5_hi=function(e,t,n,i,r,o,a,s,c,l){var u=0,p=t;return u+=(p=p+i>>>0)>>0)>>0)>>0)>>0},n.sum64_5_lo=function(e,t,n,i,r,o,a,s,c,l){return t+i+o+s+l>>>0},n.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},n.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},n.shr64_hi=function(e,t,n){return e>>>n},n.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0}},{inherits:229,"minimalistic-assert":268}],224:[function(e,t,n){"use strict";var i=Function.prototype.call,r=Object.prototype.hasOwnProperty,o=e("function-bind");t.exports=o.call(i,r)},{"function-bind":188}],225:[function(e,t,n){"use strict";var i=e("hash.js"),r=e("minimalistic-crypto-utils"),o=e("minimalistic-assert");function a(e){if(!(this instanceof a))return new a(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=r.toArray(e.entropy,e.entropyEnc||"hex"),n=r.toArray(e.nonce,e.nonceEnc||"hex"),i=r.toArray(e.pers,e.persEnc||"hex");o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,i)}t.exports=a,a.prototype._init=function(e,t,n){var i=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var r=0;r=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},a.prototype.generate=function(e,t,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(i=n,n=t,t=null),n&&(n=r.toArray(n,i||"hex"),this._update(n));for(var o=[];o.length */ n.read=function(e,t,n,i,r){var o,a,s=8*r-i-1,c=(1<>1,u=-7,p=n?r-1:0,d=n?-1:1,f=e[t+p];for(p+=d,o=f&(1<<-u)-1,f>>=-u,u+=s;u>0;o=256*o+e[t+p],p+=d,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=i;u>0;a=256*a+e[t+p],p+=d,u-=8);if(0===o)o=1-l;else{if(o===c)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,i),o-=l}return(f?-1:1)*a*Math.pow(2,o-i)},n.write=function(e,t,n,i,r,o){var a,s,c,l=8*o-r-1,u=(1<>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:o-1,h=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+p>=1?d/c:d*Math.pow(2,1-p))*c>=2&&(a++,c/=2),a+p>=u?(s=0,a=u):a+p>=1?(s=(t*c-1)*Math.pow(2,r),a+=p):(s=t*Math.pow(2,p-1)*Math.pow(2,r),a=0));r>=8;e[n+f]=255&s,f+=h,s/=256,r-=8);for(a=a<0;e[n+f]=255&a,f+=h,a/=256,l-=8);e[n+f-h]|=128*m}},{}],228:[function(e,t,n){ /*! immediate-chunk-store. MIT License. Feross Aboukhadijeh */ const i=e("queue-microtask");t.exports=class{constructor(e){if(this.store=e,this.chunkLength=e.chunkLength,!this.store||!this.store.get||!this.store.put)throw new Error("First argument must be abstract-chunk-store compliant");this.mem=[]}put(e,t,n=(()=>{})){this.mem[e]=t,this.store.put(e,t,(t=>{this.mem[e]=null,n(t)}))}get(e,t,n=(()=>{})){if("function"==typeof t)return this.get(e,null,t);let r=this.mem[e];if(!r)return this.store.get(e,t,n);t||(t={});const o=t.offset||0,a=t.length||r.length-o;0===o&&a===r.length||(r=r.slice(o,a+o)),i((()=>n(null,r)))}close(e=(()=>{})){this.store.close(e)}destroy(e=(()=>{})){this.store.destroy(e)}}},{"queue-microtask":327}],229:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},{}],230:[function(e,t,n){t.exports=function(e){for(var t=0,n=e.length;t127)return!1;return!0}},{}],231:[function(e,t,n){function i(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)} /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh * @license MIT */ t.exports=function(e){return null!=e&&(i(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&i(e.slice(0,0))}(e)||!!e._isBuffer)}},{}],232:[function(e,t,n){t.exports=async function*(e){for(let t of e)"function"==typeof t&&(t=t()),yield*t}},{}],233:[function(e,t,n){"use strict";n.re=()=>{throw new Error("`junk.re` was renamed to `junk.regex`")},n.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("|")),n.is=e=>n.regex.test(e),n.not=e=>!n.is(e),n.default=t.exports},{}],234:[function(e,t,n){n.RateLimiter=e("./lib/rateLimiter"),n.TokenBucket=e("./lib/tokenBucket")},{"./lib/rateLimiter":236,"./lib/tokenBucket":237}],235:[function(e,t,n){(function(e){(function(){t.exports=function(){if(void 0!==e&&e.hrtime){var t=e.hrtime(),n=t[0],i=t[1];return 1e3*n+Math.floor(i/1e6)}return(new Date).getTime()}}).call(this)}).call(this,e("_process"))},{_process:309}],236:[function(e,t,n){(function(n){(function(){var i=e("./tokenBucket"),r=e("./clock"),o=function(e,t,n){this.tokenBucket=new i(e,e,t,null),this.tokenBucket.content=e,this.curIntervalStart=r(),this.tokensThisInterval=0,this.fireImmediately=n};o.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(e,t){if(e>this.tokenBucket.bucketSize)return n.nextTick(t.bind(null,"Requested tokens "+e+" exceeds maximum tokens per interval "+this.tokenBucket.bucketSize,null)),!1;var i=this,o=r();if((o=this.tokenBucket.interval)&&(this.curIntervalStart=o,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval){if(this.fireImmediately)n.nextTick(t.bind(null,null,-1));else{var a=Math.ceil(this.curIntervalStart+this.tokenBucket.interval-o);setTimeout((function(){i.tokenBucket.removeTokens(e,s)}),a)}return!1}return this.tokenBucket.removeTokens(e,s);function s(n,r){if(n)return t(n,null);i.tokensThisInterval+=e,t(null,r)}},tryRemoveTokens:function(e){if(e>this.tokenBucket.bucketSize)return!1;var t=r();if((t=this.tokenBucket.interval)&&(this.curIntervalStart=t,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var n=this.tokenBucket.tryRemoveTokens(e);return n&&(this.tokensThisInterval+=e),n},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}},t.exports=o}).call(this)}).call(this,e("_process"))},{"./clock":235,"./tokenBucket":237,_process:309}],237:[function(e,t,n){(function(e){(function(){var n=function(e,t,n,i){if(this.bucketSize=e,this.tokensPerInterval=t,"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=i,this.content=0,this.lastDrip=+new Date};n.prototype={bucketSize:1,tokensPerInterval:1,interval:1e3,parentBucket:null,content:0,lastDrip:0,removeTokens:function(t,n){var i=this;return this.bucketSize?t>this.bucketSize?(e.nextTick(n.bind(null,"Requested tokens "+t+" exceeds bucket size "+this.bucketSize,null)),!1):(this.drip(),t>this.content?r():this.parentBucket?this.parentBucket.removeTokens(t,(function(e,o){return e?n(e,null):t>i.content?r():(i.content-=t,void n(null,Math.min(o,i.content)))})):(this.content-=t,e.nextTick(n.bind(null,null,this.content)),!0)):(e.nextTick(n.bind(null,null,t,Number.POSITIVE_INFINITY)),!0);function r(){var e=Math.ceil((t-i.content)*(i.interval/i.tokensPerInterval));return setTimeout((function(){i.removeTokens(t,n)}),e),!1}},tryRemoveTokens:function(e){return!this.bucketSize||!(e>this.bucketSize)&&(this.drip(),!(e>this.content)&&(!(this.parentBucket&&!this.parentBucket.tryRemoveTokens(e))&&(this.content-=e,!0)))},drip:function(){if(this.tokensPerInterval){var e=+new Date,t=Math.max(e-this.lastDrip,0);this.lastDrip=e;var n=t*(this.tokensPerInterval/this.interval);this.content=Math.min(this.content+n,this.bucketSize)}else this.content=this.bucketSize}},t.exports=n}).call(this)}).call(this,e("_process"))},{_process:309}],238:[function(e,t,n){var i=e("events"),r=e("inherits");function o(e){if(!(this instanceof o))return new o(e);"number"==typeof e&&(e={max:e}),e||(e={}),i.EventEmitter.call(this),this.cache={},this.head=this.tail=null,this.length=0,this.max=e.max||1e3,this.maxAge=e.maxAge||0}t.exports=o,r(o,i.EventEmitter),Object.defineProperty(o.prototype,"keys",{get:function(){return Object.keys(this.cache)}}),o.prototype.clear=function(){this.cache={},this.head=this.tail=null,this.length=0},o.prototype.remove=function(e){if("string"!=typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){var t=this.cache[e];return delete this.cache[e],this._unlink(e,t.prev,t.next),t.value}},o.prototype._unlink=function(e,t,n){this.length--,0===this.length?this.head=this.tail=null:this.head===e?(this.head=t,this.cache[this.head].next=null):this.tail===e?(this.tail=n,this.cache[this.tail].prev=null):(this.cache[t].next=n,this.cache[n].prev=t)},o.prototype.peek=function(e){if(this.cache.hasOwnProperty(e)){var t=this.cache[e];if(this._checkAge(e,t))return t.value}},o.prototype.set=function(e,t){var n;if("string"!=typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){if((n=this.cache[e]).value=t,this.maxAge&&(n.modified=Date.now()),e===this.head)return t;this._unlink(e,n.prev,n.next)}else n={value:t,modified:0,next:null,prev:null},this.maxAge&&(n.modified=Date.now()),this.cache[e]=n,this.length===this.max&&this.evict();return this.length++,n.next=null,n.prev=this.head,this.head&&(this.cache[this.head].next=e),this.head=e,this.tail||(this.tail=e),t},o.prototype._checkAge=function(e,t){return!(this.maxAge&&Date.now()-t.modified>this.maxAge)||(this.remove(e),this.emit("evict",{key:e,value:t.value}),!1)},o.prototype.get=function(e){if("string"!=typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){var t=this.cache[e];if(this._checkAge(e,t))return this.head!==e&&(e===this.tail?(this.tail=t.next,this.cache[this.tail].prev=null):this.cache[t.prev].next=t.next,this.cache[t.next].prev=t.prev,this.cache[this.head].next=e,t.prev=this.head,t.next=null,this.head=e),t.value}},o.prototype.evict=function(){if(this.tail){var e=this.tail,t=this.remove(this.tail);this.emit("evict",{key:e,value:t})}}},{events:181,inherits:229}],239:[function(e,t,n){(function(n){(function(){ /*! lt_donthave. MIT License. WebTorrent LLC */ const i=e("unordered-array-remove"),{EventEmitter:r}=e("events"),o=e("debug")("lt_donthave");t.exports=()=>{class e extends r{constructor(e){super(),this._peerSupports=!1,this._wire=e}onExtendedHandshake(){this._peerSupports=!0}onMessage(e){let t;try{t=e.readUInt32BE()}catch(e){return}this._wire.peerPieces.get(t)&&(o("got donthave %d",t),this._wire.peerPieces.set(t,!1),this.emit("donthave",t),this._failRequests(t))}donthave(e){if(!this._peerSupports)return;o("donthave %d",e);const t=n.alloc(4);t.writeUInt32BE(e),this._wire.extended("lt_donthave",t)}_failRequests(e){const t=this._wire.requests;for(let n=0;n */ t.exports=o,t.exports.decode=o,t.exports.encode=function(e){e=Object.assign({},e);let t=new Set;e.xt&&"string"==typeof e.xt&&t.add(e.xt);e.xt&&Array.isArray(e.xt)&&(t=new Set(e.xt));e.infoHashBuffer&&t.add(`urn:btih:${e.infoHashBuffer.toString("hex")}`);e.infoHash&&t.add(`urn:btih:${e.infoHash}`);e.infoHashV2Buffer&&t.add(e.xt=`urn:btmh:1220${e.infoHashV2Buffer.toString("hex")}`);e.infoHashV2&&t.add(`urn:btmh:1220${e.infoHashV2}`);const n=Array.from(t);1===n.length&&(e.xt=n[0]);n.length>1&&(e.xt=n);e.publicKeyBuffer&&(e.xs=`urn:btpk:${e.publicKeyBuffer.toString("hex")}`);e.publicKey&&(e.xs=`urn:btpk:${e.publicKey}`);e.name&&(e.dn=e.name);e.keywords&&(e.kt=e.keywords);e.announce&&(e.tr=e.announce);e.urlList&&(e.ws=e.urlList,delete e.as);e.peerAddresses&&(e["x.pe"]=e.peerAddresses);let i="magnet:?";return Object.keys(e).filter((e=>2===e.length||"x.pe"===e)).forEach(((t,n)=>{const o=Array.isArray(e[t])?e[t]:[e[t]];o.forEach(((e,r)=>{(n>0||r>0)&&("kt"!==t&&"so"!==t||0===r)&&(i+="&"),"dn"===t&&(e=encodeURIComponent(e).replace(/%20/g,"+")),"tr"!==t&&"as"!==t&&"ws"!==t||(e=encodeURIComponent(e)),"xs"!==t||e.startsWith("urn:btpk:")||(e=encodeURIComponent(e)),"kt"===t&&(e=encodeURIComponent(e)),"so"!==t&&(i+="kt"===t&&r>0?`+${e}`:`${t}=${e}`)})),"so"===t&&(i+=`${t}=${r.compose(o)}`)})),i};const i=e("thirty-two"),r=e("bep53-range");function o(e){const t={},o=e.split("magnet:?")[1];let a;if((o&&o.length>=0?o.split("&"):[]).forEach((e=>{const n=e.split("=");if(2!==n.length)return;const i=n[0];let o=n[1];"dn"===i&&(o=decodeURIComponent(o).replace(/\+/g," ")),"tr"!==i&&"xs"!==i&&"as"!==i&&"ws"!==i||(o=decodeURIComponent(o)),"kt"===i&&(o=decodeURIComponent(o).split("+")),"ix"===i&&(o=Number(o)),"so"===i&&(o=r.parse(decodeURIComponent(o).split(","))),t[i]?(Array.isArray(t[i])||(t[i]=[t[i]]),t[i].push(o)):t[i]=o})),t.xt){(Array.isArray(t.xt)?t.xt:[t.xt]).forEach((e=>{if(a=e.match(/^urn:btih:(.{40})/))t.infoHash=a[1].toLowerCase();else if(a=e.match(/^urn:btih:(.{32})/)){const e=i.decode(a[1]);t.infoHash=n.from(e,"binary").toString("hex")}else(a=e.match(/^urn:btmh:1220(.{64})/))&&(t.infoHashV2=a[1].toLowerCase())}))}if(t.xs){(Array.isArray(t.xs)?t.xs:[t.xs]).forEach((e=>{(a=e.match(/^urn:btpk:(.{64})/))&&(t.publicKey=a[1].toLowerCase())}))}return t.infoHash&&(t.infoHashBuffer=n.from(t.infoHash,"hex")),t.infoHashV2&&(t.infoHashV2Buffer=n.from(t.infoHashV2,"hex")),t.publicKey&&(t.publicKeyBuffer=n.from(t.publicKey,"hex")),t.dn&&(t.name=t.dn),t.kt&&(t.keywords=t.kt),t.announce=[],("string"==typeof t.tr||Array.isArray(t.tr))&&(t.announce=t.announce.concat(t.tr)),t.urlList=[],("string"==typeof t.as||Array.isArray(t.as))&&(t.urlList=t.urlList.concat(t.as)),("string"==typeof t.ws||Array.isArray(t.ws))&&(t.urlList=t.urlList.concat(t.ws)),t.peerAddresses=[],("string"==typeof t["x.pe"]||Array.isArray(t["x.pe"]))&&(t.peerAddresses=t.peerAddresses.concat(t["x.pe"])),t.announce=Array.from(new Set(t.announce)),t.urlList=Array.from(new Set(t.urlList)),t.peerAddresses=Array.from(new Set(t.peerAddresses)),t}}).call(this)}).call(this,e("buffer").Buffer)},{"bep53-range":24,buffer:110,"thirty-two":448}],241:[function(e,t,n){"use strict";var i=e("inherits"),r=e("hash-base"),o=e("safe-buffer").Buffer,a=new Array(16);function s(){r.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function c(e,t){return e<>>32-t}function l(e,t,n,i,r,o,a){return c(e+(t&n|~t&i)+r+o|0,a)+t|0}function u(e,t,n,i,r,o,a){return c(e+(t&i|n&~i)+r+o|0,a)+t|0}function p(e,t,n,i,r,o,a){return c(e+(t^n^i)+r+o|0,a)+t|0}function d(e,t,n,i,r,o,a){return c(e+(n^(t|~i))+r+o|0,a)+t|0}i(s,r),s.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,i=this._b,r=this._c,o=this._d;n=l(n,i,r,o,e[0],3614090360,7),o=l(o,n,i,r,e[1],3905402710,12),r=l(r,o,n,i,e[2],606105819,17),i=l(i,r,o,n,e[3],3250441966,22),n=l(n,i,r,o,e[4],4118548399,7),o=l(o,n,i,r,e[5],1200080426,12),r=l(r,o,n,i,e[6],2821735955,17),i=l(i,r,o,n,e[7],4249261313,22),n=l(n,i,r,o,e[8],1770035416,7),o=l(o,n,i,r,e[9],2336552879,12),r=l(r,o,n,i,e[10],4294925233,17),i=l(i,r,o,n,e[11],2304563134,22),n=l(n,i,r,o,e[12],1804603682,7),o=l(o,n,i,r,e[13],4254626195,12),r=l(r,o,n,i,e[14],2792965006,17),n=u(n,i=l(i,r,o,n,e[15],1236535329,22),r,o,e[1],4129170786,5),o=u(o,n,i,r,e[6],3225465664,9),r=u(r,o,n,i,e[11],643717713,14),i=u(i,r,o,n,e[0],3921069994,20),n=u(n,i,r,o,e[5],3593408605,5),o=u(o,n,i,r,e[10],38016083,9),r=u(r,o,n,i,e[15],3634488961,14),i=u(i,r,o,n,e[4],3889429448,20),n=u(n,i,r,o,e[9],568446438,5),o=u(o,n,i,r,e[14],3275163606,9),r=u(r,o,n,i,e[3],4107603335,14),i=u(i,r,o,n,e[8],1163531501,20),n=u(n,i,r,o,e[13],2850285829,5),o=u(o,n,i,r,e[2],4243563512,9),r=u(r,o,n,i,e[7],1735328473,14),n=p(n,i=u(i,r,o,n,e[12],2368359562,20),r,o,e[5],4294588738,4),o=p(o,n,i,r,e[8],2272392833,11),r=p(r,o,n,i,e[11],1839030562,16),i=p(i,r,o,n,e[14],4259657740,23),n=p(n,i,r,o,e[1],2763975236,4),o=p(o,n,i,r,e[4],1272893353,11),r=p(r,o,n,i,e[7],4139469664,16),i=p(i,r,o,n,e[10],3200236656,23),n=p(n,i,r,o,e[13],681279174,4),o=p(o,n,i,r,e[0],3936430074,11),r=p(r,o,n,i,e[3],3572445317,16),i=p(i,r,o,n,e[6],76029189,23),n=p(n,i,r,o,e[9],3654602809,4),o=p(o,n,i,r,e[12],3873151461,11),r=p(r,o,n,i,e[15],530742520,16),n=d(n,i=p(i,r,o,n,e[2],3299628645,23),r,o,e[0],4096336452,6),o=d(o,n,i,r,e[7],1126891415,10),r=d(r,o,n,i,e[14],2878612391,15),i=d(i,r,o,n,e[5],4237533241,21),n=d(n,i,r,o,e[12],1700485571,6),o=d(o,n,i,r,e[3],2399980690,10),r=d(r,o,n,i,e[10],4293915773,15),i=d(i,r,o,n,e[1],2240044497,21),n=d(n,i,r,o,e[8],1873313359,6),o=d(o,n,i,r,e[15],4264355552,10),r=d(r,o,n,i,e[6],2734768916,15),i=d(i,r,o,n,e[13],1309151649,21),n=d(n,i,r,o,e[4],4149444226,6),o=d(o,n,i,r,e[11],3174756917,10),r=d(r,o,n,i,e[2],718787259,15),i=d(i,r,o,n,e[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+i|0,this._c=this._c+r|0,this._d=this._d+o|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},t.exports=s},{"hash-base":196,inherits:229,"safe-buffer":356}],242:[function(e,t,n){ /*! mediasource. MIT License. Feross Aboukhadijeh */ t.exports=c;var i=e("inherits"),r=e("readable-stream"),o=e("to-arraybuffer"),a="undefined"!=typeof window&&window.MediaSource,s=60;function c(e,t){var n=this;if(!(n instanceof c))return new c(e,t);if(!a)throw new Error("web browser lacks MediaSource support");t||(t={}),n._debug=t.debug,n._bufferDuration=t.bufferDuration||s,n._elem=e,n._mediaSource=new a,n._streams=[],n.detailedError=null,n._errorHandler=function(){n._elem.removeEventListener("error",n._errorHandler),n._streams.slice().forEach((function(e){e.destroy(n._elem.error)}))},n._elem.addEventListener("error",n._errorHandler),n._elem.src=window.URL.createObjectURL(n._mediaSource)}function l(e,t){var n=this;if(r.Writable.call(n),n._wrapper=e,n._elem=e._elem,n._mediaSource=e._mediaSource,n._allStreams=e._streams,n._allStreams.push(n),n._bufferDuration=e._bufferDuration,n._sourceBuffer=null,n._debugBuffers=[],n._openHandler=function(){n._onSourceOpen()},n._flowHandler=function(){n._flow()},n._errorHandler=function(e){n.destroyed||n.emit("error",e)},"string"==typeof t)n._type=t,"open"===n._mediaSource.readyState?n._createSourceBuffer():n._mediaSource.addEventListener("sourceopen",n._openHandler);else if(null===t._sourceBuffer)t.destroy(),n._type=t._type,n._mediaSource.addEventListener("sourceopen",n._openHandler);else{if(!t._sourceBuffer)throw new Error("The argument to MediaElementWrapper.createWriteStream must be a string or a previous stream returned from that function");t.destroy(),n._type=t._type,n._sourceBuffer=t._sourceBuffer,n._debugBuffers=t._debugBuffers,n._sourceBuffer.addEventListener("updateend",n._flowHandler),n._sourceBuffer.addEventListener("error",n._errorHandler)}n._elem.addEventListener("timeupdate",n._flowHandler),n.on("error",(function(e){n._wrapper.error(e)})),n.on("finish",(function(){if(!n.destroyed&&(n._finished=!0,n._allStreams.every((function(e){return e._finished})))){n._wrapper._dumpDebugData();try{n._mediaSource.endOfStream()}catch(e){}}}))}c.prototype.createWriteStream=function(e){return new l(this,e)},c.prototype.error=function(e){var t=this;t.detailedError||(t.detailedError=e),t._dumpDebugData();try{t._mediaSource.endOfStream("decode")}catch(e){}try{window.URL.revokeObjectURL(t._elem.src)}catch(e){}},c.prototype._dumpDebugData=function(){var e=this;e._debug&&(e._debug=!1,e._streams.forEach((function(e,t){var n,i,r;n=e._debugBuffers,i="mediasource-stream-"+t,(r=document.createElement("a")).href=window.URL.createObjectURL(new window.Blob(n)),r.download=i,r.click()})))},i(l,r.Writable),l.prototype._onSourceOpen=function(){var e=this;e.destroyed||(e._mediaSource.removeEventListener("sourceopen",e._openHandler),e._createSourceBuffer())},l.prototype.destroy=function(e){var t=this;t.destroyed||(t.destroyed=!0,t._allStreams.splice(t._allStreams.indexOf(t),1),t._mediaSource.removeEventListener("sourceopen",t._openHandler),t._elem.removeEventListener("timeupdate",t._flowHandler),t._sourceBuffer&&(t._sourceBuffer.removeEventListener("updateend",t._flowHandler),t._sourceBuffer.removeEventListener("error",t._errorHandler),"open"===t._mediaSource.readyState&&t._sourceBuffer.abort()),e&&t.emit("error",e),t.emit("close"))},l.prototype._createSourceBuffer=function(){var e=this;if(!e.destroyed)if(a.isTypeSupported(e._type)){if(e._sourceBuffer=e._mediaSource.addSourceBuffer(e._type),e._sourceBuffer.addEventListener("updateend",e._flowHandler),e._sourceBuffer.addEventListener("error",e._errorHandler),e._cb){var t=e._cb;e._cb=null,t()}}else e.destroy(new Error("The provided type is not supported"))},l.prototype._write=function(e,t,n){var i=this;if(!i.destroyed)if(i._sourceBuffer){if(i._sourceBuffer.updating)return n(new Error("Cannot append buffer while source buffer updating"));var r=o(e);i._wrapper._debug&&i._debugBuffers.push(r);try{i._sourceBuffer.appendBuffer(r)}catch(e){return void i.destroy(e)}i._cb=n}else i._cb=function(r){if(r)return n(r);i._write(e,t,n)}},l.prototype._flow=function(){var e=this;if(!e.destroyed&&e._sourceBuffer&&!e._sourceBuffer.updating&&!("open"===e._mediaSource.readyState&&e._getBufferDuration()>e._bufferDuration)&&e._cb){var t=e._cb;e._cb=null,t()}};l.prototype._getBufferDuration=function(){for(var e=this._sourceBuffer.buffered,t=this._elem.currentTime,n=-1,i=0;it)break;(n>=0||t<=o)&&(n=o)}var a=n-t;return a<0&&(a=0),a}},{inherits:229,"readable-stream":257,"to-arraybuffer":452}],243:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28}],244:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{"./_stream_readable":246,"./_stream_writable":248,_process:309,dup:29,inherits:229}],245:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{"./_stream_transform":247,dup:30,inherits:229}],246:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{"../errors":243,"./_stream_duplex":244,"./internal/streams/async_iterator":249,"./internal/streams/buffer_list":250,"./internal/streams/destroy":251,"./internal/streams/from":253,"./internal/streams/state":255,"./internal/streams/stream":256,_process:309,buffer:110,dup:31,events:181,inherits:229,"string_decoder/":447,util:67}],247:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{"../errors":243,"./_stream_duplex":244,dup:32,inherits:229}],248:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"../errors":243,"./_stream_duplex":244,"./internal/streams/destroy":251,"./internal/streams/state":255,"./internal/streams/stream":256,_process:309,buffer:110,dup:33,inherits:229,"util-deprecate":459}],249:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"./end-of-stream":252,_process:309,dup:34}],250:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{buffer:110,dup:35,util:67}],251:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{_process:309,dup:36}],252:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{"../../../errors":243,dup:37}],253:[function(e,t,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],254:[function(e,t,n){arguments[4][39][0].apply(n,arguments)},{"../../../errors":243,"./end-of-stream":252,dup:39}],255:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{"../../../errors":243,dup:40}],256:[function(e,t,n){arguments[4][41][0].apply(n,arguments)},{dup:41,events:181}],257:[function(e,t,n){arguments[4][42][0].apply(n,arguments)},{"./lib/_stream_duplex.js":244,"./lib/_stream_passthrough.js":245,"./lib/_stream_readable.js":246,"./lib/_stream_transform.js":247,"./lib/_stream_writable.js":248,"./lib/internal/streams/end-of-stream.js":252,"./lib/internal/streams/pipeline.js":254,dup:42}],258:[function(e,t,n){t.exports=r;const i=e("queue-microtask");function r(e,t){if(!(this instanceof r))return new r(e,t);if(t||(t={}),this.chunkLength=Number(e),!this.chunkLength)throw new Error("First argument must be a chunk length");this.chunks=[],this.closed=!1,this.length=Number(t.length)||1/0,this.length!==1/0&&(this.lastChunkLength=this.length%this.chunkLength||this.chunkLength,this.lastChunkIndex=Math.ceil(this.length/this.chunkLength)-1)}r.prototype.put=function(e,t,n=(()=>{})){if(this.closed)return i((()=>n(new Error("Storage is closed"))));const r=e===this.lastChunkIndex;return r&&t.length!==this.lastChunkLength?i((()=>n(new Error("Last chunk length must be "+this.lastChunkLength)))):r||t.length===this.chunkLength?(this.chunks[e]=t,void i((()=>n(null)))):i((()=>n(new Error("Chunk length must be "+this.chunkLength))))},r.prototype.get=function(e,t,n=(()=>{})){if("function"==typeof t)return this.get(e,null,t);if(this.closed)return i((()=>n(new Error("Storage is closed"))));let r=this.chunks[e];if(!r){const e=new Error("Chunk not found");return e.notFound=!0,i((()=>n(e)))}t||(t={});const o=t.offset||0,a=t.length||r.length-o;0===o&&a===r.length||(r=r.slice(o,a+o)),i((()=>n(null,r)))},r.prototype.close=r.prototype.destroy=function(e=(()=>{})){if(this.closed)return i((()=>e(new Error("Storage is closed"))));this.closed=!0,this.chunks=null,i((()=>e(null)))}},{"queue-microtask":327}],259:[function(e,t,n){var i=e("bn.js"),r=e("brorand");function o(e){this.rand=e||new r.Rand}t.exports=o,o.create=function(e){return new o(e)},o.prototype._randbelow=function(e){var t=e.bitLength(),n=Math.ceil(t/8);do{var r=new i(this.rand.generate(n))}while(r.cmp(e)>=0);return r},o.prototype._randrange=function(e,t){var n=t.sub(e);return e.add(this._randbelow(n))},o.prototype.test=function(e,t,n){var r=e.bitLength(),o=i.mont(e),a=new i(1).toRed(o);t||(t=Math.max(1,r/48|0));for(var s=e.subn(1),c=0;!s.testn(c);c++);for(var l=e.shrn(c),u=s.toRed(o);t>0;t--){var p=this._randrange(new i(2),s);n&&n(p);var d=p.toRed(o).redPow(l);if(0!==d.cmp(a)&&0!==d.cmp(u)){for(var f=1;f0;t--){var u=this._randrange(new i(2),a),p=e.gcd(u);if(0!==p.cmpn(1))return p;var d=u.toRed(r).redPow(c);if(0!==d.cmp(o)&&0!==d.cmp(l)){for(var f=1;fu||l===u&&"application/"===r[c].substr(0,12)))continue}r[c]=e}}}))},{"mime-db":262,path:301}],264:[function(e,t,n){"use strict";function i(){this._types=Object.create(null),this._extensions=Object.create(null);for(let e=0;e>8,a=255&r;o?n.push(o,a):n.push(a)}return n},i.zero2=r,i.toHex=o,i.encode=function(e,t){return"hex"===t?o(e):e}},{}],270:[function(e,t,n){(function(t){(function(){var i=e("./index"),r=e("./descriptor"),o=e("uint64be"),a=20828448e5;n.fullBoxes={};function s(e,t,n){for(var i=t;i=8;){var c=i.decode(e,s,r);a.children.push(c),a[c.type]=c,s+=c.length}return a},n.VisualSampleEntry.encodingLength=function(e){var t=78;return(e.children||[]).forEach((function(e){t+=i.encodingLength(e)})),t},n.avcC={},n.avcC.encode=function(e,i,r){i=i?i.slice(r):t.alloc(e.buffer.length),e.buffer.copy(i),n.avcC.encode.bytes=e.buffer.length},n.avcC.decode=function(e,n,i){return{mimeCodec:(e=e.slice(n,i)).toString("hex",1,4),buffer:t.from(e)}},n.avcC.encodingLength=function(e){return e.buffer.length},n.mp4a=n.AudioSampleEntry={},n.AudioSampleEntry.encode=function(e,r,o){s(r=r?r.slice(o):t.alloc(n.AudioSampleEntry.encodingLength(e)),0,6),r.writeUInt16BE(e.dataReferenceIndex||0,6),s(r,8,16),r.writeUInt16BE(e.channelCount||2,16),r.writeUInt16BE(e.sampleSize||16,18),s(r,20,24),r.writeUInt32BE(e.sampleRate||0,24);var a=28;(e.children||[]).forEach((function(e){i.encode(e,r,a),a+=i.encode.bytes})),n.AudioSampleEntry.encode.bytes=a},n.AudioSampleEntry.decode=function(e,t,n){for(var r=n-t,o={dataReferenceIndex:(e=e.slice(t,n)).readUInt16BE(6),channelCount:e.readUInt16BE(16),sampleSize:e.readUInt16BE(18),sampleRate:e.readUInt32BE(24),children:[]},a=28;r-a>=8;){var s=i.decode(e,a,r);o.children.push(s),o[s.type]=s,a+=s.length}return o},n.AudioSampleEntry.encodingLength=function(e){var t=28;return(e.children||[]).forEach((function(e){t+=i.encodingLength(e)})),t},n.esds={},n.esds.encode=function(e,i,r){i=i?i.slice(r):t.alloc(e.buffer.length),e.buffer.copy(i,0),n.esds.encode.bytes=e.buffer.length},n.esds.decode=function(e,n,i){e=e.slice(n,i);var o=r.Descriptor.decode(e,0,e.length),a=("ESDescriptor"===o.tagName?o:{}).DecoderConfigDescriptor||{},s=a.oti||0,c=a.DecoderSpecificInfo,l=c?(248&c.buffer.readUInt8(0))>>3:0,u=null;return s&&(u=s.toString(16),l&&(u+="."+l)),{mimeCodec:u,buffer:t.from(e.slice(0))}},n.esds.encodingLength=function(e){return e.buffer.length},n.stsz={},n.stsz.encode=function(e,i,r){var o=e.entries||[];(i=i?i.slice(r):t.alloc(n.stsz.encodingLength(e))).writeUInt32BE(0,0),i.writeUInt32BE(o.length,4);for(var a=0;ao&&(l=1),t.writeUInt32BE(l,n),t.write(e.type,n+4,4,"ascii");var u=n+8;if(1===l&&(i.encode(e.length,t,u),u+=8),r.fullBoxes[c]&&(t.writeUInt32BE(e.flags||0,u),t.writeUInt8(e.version||0,u),u+=4),s[c])s[c].forEach((function(n){if(5===n.length){var i=e[n]||[];n=n.substr(0,4),i.forEach((function(e){a._encode(e,t,u),u+=a.encode.bytes}))}else e[n]&&(a._encode(e[n],t,u),u+=a.encode.bytes)})),e.otherBoxes&&e.otherBoxes.forEach((function(e){a._encode(e,t,u),u+=a.encode.bytes}));else if(r[c]){var p=r[c].encode;p(e,t,u),u+=p.bytes}else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+c+"') or `buffer` must be set");e.buffer.copy(t,u),u+=e.buffer.length}return a.encode.bytes=u-n,t},a.readHeaders=function(e,t,n){if(t=t||0,(n=n||e.length)-t<8)return 8;var o,a,s=e.readUInt32BE(t),c=e.toString("ascii",t+4,t+8),l=t+8;if(1===s){if(n-t<16)return 16;s=i.decode(e,l),l+=8}return r.fullBoxes[c]&&(o=e.readUInt8(l),a=16777215&e.readUInt32BE(l),l+=4),{length:s,headersLen:l-t,contentLen:s-(l-t),type:c,version:o,flags:a}},a.decode=function(e,t,n){t=t||0,n=n||e.length;var i=a.readHeaders(e,t,n);if(!i||i.length>n-t)throw new Error("Data too short");return a.decodeWithoutHeaders(i,e,t+i.headersLen,t+i.length)},a.decodeWithoutHeaders=function(e,n,i,o){i=i||0,o=o||n.length;var c=e.type,l={};if(s[c]){l.otherBoxes=[];for(var u=s[c],p=i;o-p>=8;){var d=a.decode(n,p,o);if(p+=d.length,u.indexOf(d.type)>=0)l[d.type]=d;else if(u.indexOf(d.type+"s")>=0){var f=d.type+"s";(l[f]=l[f]||[]).push(d)}else l.otherBoxes.push(d)}}else if(r[c]){l=(0,r[c].decode)(n,i,o)}else l.buffer=t.from(n.slice(i,o));return l.length=e.length,l.contentLen=e.contentLen,l.type=e.type,l.version=e.version,l.flags=e.flags,l},a.encodingLength=function(e){var t=e.type,n=8;if(r.fullBoxes[t]&&(n+=4),s[t])s[t].forEach((function(t){if(5===t.length){var i=e[t]||[];t=t.substr(0,4),i.forEach((function(e){e.type=t,n+=a.encodingLength(e)}))}else if(e[t]){var r=e[t];r.type=t,n+=a.encodingLength(r)}})),e.otherBoxes&&e.otherBoxes.forEach((function(e){n+=a.encodingLength(e)}));else if(r[t])n+=r[t].encodingLength(e);else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+t+"') or `buffer` must be set");n+=e.buffer.length}return n>o&&(n+=8),e.length=n,n}}).call(this)}).call(this,e("buffer").Buffer)},{"./boxes":270,buffer:110,uint64be:455}],273:[function(e,t,n){(function(n){(function(){var i=e("readable-stream"),r=e("next-event"),o=e("mp4-box-encoding"),a=n.alloc(0);class s extends i.Writable{constructor(e){super(e),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(e){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e),this.emit("close"))}_write(e,t,n){if(!this.destroyed){for(var i=!this._str||!this._str._writableState.needDrain;e.length&&!this.destroyed;){if(!this._missing&&!this._ignoreEmpty)return this._writeBuffer=e,void(this._writeCb=n);var r=e.length{this._pending--,this._kick()})),this._cb=t,this._str}_readBox(){const e=(t,i)=>{this._buffer(t,(t=>{i=i?n.concat([i,t]):t;var r=o.readHeaders(i);"number"==typeof r?e(r-i.length,i):(this._pending++,this._headers=r,this.emit("box",r))}))};e(8)}stream(){if(!this._headers)throw new Error("this function can only be called once after 'box' is emitted");var e=this._headers;return this._headers=null,this._stream(e.contentLen,(()=>{this._pending--,this._kick()}))}decode(e){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._buffer(t.contentLen,(n=>{var i=o.decodeWithoutHeaders(t,n);e(i),this._pending--,this._kick()}))}ignore(){if(!this._headers)throw new Error("this function can only be called once after 'box' is emitted");var e=this._headers;this._headers=null,this._missing=e.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 e=this._writeCb,t=this._writeBuffer;this._writeBuffer=null,this._writeCb=null,this._write(t,null,e)}}}class c extends i.PassThrough{constructor(e){super(),this._parent=e,this.destroyed=!1}destroy(e){this.destroyed||(this.destroyed=!0,this._parent.destroy(e),e&&this.emit("error",e),this.emit("close"))}}t.exports=s}).call(this)}).call(this,e("buffer").Buffer)},{buffer:110,"mp4-box-encoding":272,"next-event":292,"readable-stream":290}],274:[function(e,t,n){(function(n){(function(){var i=e("readable-stream"),r=e("mp4-box-encoding"),o=e("queue-microtask");function a(){}class s extends i.Readable{constructor(e){super(e),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(e,t){this.mediaData(e,t)}mediaData(e,t){var n=new c(this);return this.box({type:"mdat",contentLength:e,encodeBufferLen:8,stream:n},t),n}box(e,t){if(t||(t=a),this.destroyed)return t(new Error("Encoder is destroyed"));var i;if(e.encodeBufferLen&&(i=n.alloc(e.encodeBufferLen)),e.stream)e.buffer=null,i=r.encode(e,i),this.push(i),this._stream=e.stream,this._stream.on("readable",this._onreadable),this._stream.on("end",this._onend),this._stream.on("end",t),this._forward();else{if(i=r.encode(e,i),this.push(i))return o(t);this._drain=t}}destroy(e){if(!this.destroyed){if(this.destroyed=!0,this._stream&&this._stream.destroy&&this._stream.destroy(),this._stream=null,this._drain){var t=this._drain;this._drain=null,t(e)}e&&this.emit("error",e),this.emit("close")}}finalize(){this._finalized=!0,this._stream||this._drain||this.push(null)}_forward(){if(this._stream)for(;!this.destroyed;){var e=this._stream.read();if(!e)return void(this._want=!!this._stream);if(!this.push(e))return}}_read(){if(!this._reading&&!this.destroyed){if(this._reading=!0,this._stream&&this._forward(),this._drain){var e=this._drain;this._drain=null,e()}this._reading=!1,this._finalized&&this.push(null)}}}class c extends i.PassThrough{constructor(e){super(),this._parent=e,this.destroyed=!1}destroy(e){this.destroyed||(this.destroyed=!0,this._parent.destroy(e),e&&this.emit("error",e),this.emit("close"))}}t.exports=s}).call(this)}).call(this,e("buffer").Buffer)},{buffer:110,"mp4-box-encoding":272,"queue-microtask":327,"readable-stream":290}],275:[function(e,t,n){const i=e("./decode"),r=e("./encode");n.decode=e=>new i(e),n.encode=e=>new r(e)},{"./decode":273,"./encode":274}],276:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28}],277:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{"./_stream_readable":279,"./_stream_writable":281,_process:309,dup:29,inherits:229}],278:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{"./_stream_transform":280,dup:30,inherits:229}],279:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{"../errors":276,"./_stream_duplex":277,"./internal/streams/async_iterator":282,"./internal/streams/buffer_list":283,"./internal/streams/destroy":284,"./internal/streams/from":286,"./internal/streams/state":288,"./internal/streams/stream":289,_process:309,buffer:110,dup:31,events:181,inherits:229,"string_decoder/":447,util:67}],280:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{"../errors":276,"./_stream_duplex":277,dup:32,inherits:229}],281:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"../errors":276,"./_stream_duplex":277,"./internal/streams/destroy":284,"./internal/streams/state":288,"./internal/streams/stream":289,_process:309,buffer:110,dup:33,inherits:229,"util-deprecate":459}],282:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"./end-of-stream":285,_process:309,dup:34}],283:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{buffer:110,dup:35,util:67}],284:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{_process:309,dup:36}],285:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{"../../../errors":276,dup:37}],286:[function(e,t,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],287:[function(e,t,n){arguments[4][39][0].apply(n,arguments)},{"../../../errors":276,"./end-of-stream":285,dup:39}],288:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{"../../../errors":276,dup:40}],289:[function(e,t,n){arguments[4][41][0].apply(n,arguments)},{dup:41,events:181}],290:[function(e,t,n){arguments[4][42][0].apply(n,arguments)},{"./lib/_stream_duplex.js":277,"./lib/_stream_passthrough.js":278,"./lib/_stream_readable.js":279,"./lib/_stream_transform.js":280,"./lib/_stream_writable.js":281,"./lib/internal/streams/end-of-stream.js":285,"./lib/internal/streams/pipeline.js":287,dup:42}],291:[function(e,t,n){var i=1e3,r=60*i,o=60*r,a=24*o,s=7*a,c=365.25*a;function l(e,t,n,i){var r=t>=1.5*n;return Math.round(e/n)+" "+i+(r?"s":"")}t.exports=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*c;case"weeks":case"week":case"w":return n*s;case"days":case"day":case"d":return n*a;case"hours":case"hour":case"hrs":case"hr":case"h":return n*o;case"minutes":case"minute":case"mins":case"min":case"m":return n*r;case"seconds":case"second":case"secs":case"sec":case"s":return n*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===n&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=a)return l(e,t,a,"day");if(t>=o)return l(e,t,o,"hour");if(t>=r)return l(e,t,r,"minute");if(t>=i)return l(e,t,i,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=a)return Math.round(e/a)+"d";if(t>=o)return Math.round(e/o)+"h";if(t>=r)return Math.round(e/r)+"m";if(t>=i)return Math.round(e/i)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],292:[function(e,t,n){t.exports=function(e,t){var n=null;return e.on(t,(function(e){if(n){var t=n;n=null,t(e)}})),function(e){n=e}}},{}],293:[function(e,t,n){(function(n){(function(){var i="function"==typeof Map&&Map.prototype,r=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,o=i&&r&&"function"==typeof r.get?r.get:null,a=i&&Map.prototype.forEach,s="function"==typeof Set&&Set.prototype,c=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,l=s&&c&&"function"==typeof c.get?c.get:null,u=s&&Set.prototype.forEach,p="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,d="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,f="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,h=Boolean.prototype.valueOf,m=Object.prototype.toString,b=Function.prototype.toString,v=String.prototype.match,g=String.prototype.slice,y=String.prototype.replace,x=String.prototype.toUpperCase,_=String.prototype.toLowerCase,w=RegExp.prototype.test,k=Array.prototype.concat,S=Array.prototype.join,E=Array.prototype.slice,M=Math.floor,A="function"==typeof BigInt?BigInt.prototype.valueOf:null,j=Object.getOwnPropertySymbols,I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,T="function"==typeof Symbol&&"object"==typeof Symbol.iterator,C="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===T||"symbol")?Symbol.toStringTag:null,B=Object.prototype.propertyIsEnumerable,R=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function O(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||w.call(/e/,t))return t;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var i=e<0?-M(-e):M(e);if(i!==e){var r=String(i),o=g.call(t,r.length+1);return y.call(r,n,"$&_")+"."+y.call(y.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return y.call(t,n,"$&_")}var P=e("./util.inspect"),L=P.custom,U=H(L)?L:null;function q(e,t,n){var i="double"===(n.quoteStyle||t)?'"':"'";return i+e+i}function N(e){return y.call(String(e),/"/g,""")}function D(e){return!("[object Array]"!==V(e)||C&&"object"==typeof e&&C in e)}function z(e){return!("[object RegExp]"!==V(e)||C&&"object"==typeof e&&C in e)}function H(e){if(T)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!I)return!1;try{return I.call(e),!0}catch(e){}return!1}t.exports=function e(t,i,r,s){var c=i||{};if(W(c,"quoteStyle")&&"single"!==c.quoteStyle&&"double"!==c.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(W(c,"maxStringLength")&&("number"==typeof c.maxStringLength?c.maxStringLength<0&&c.maxStringLength!==1/0:null!==c.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var m=!W(c,"customInspect")||c.customInspect;if("boolean"!=typeof m&&"symbol"!==m)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(W(c,"indent")&&null!==c.indent&&"\t"!==c.indent&&!(parseInt(c.indent,10)===c.indent&&c.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(W(c,"numericSeparator")&&"boolean"!=typeof c.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var x=c.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return $(t,c);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var w=String(t);return x?O(t,w):w}if("bigint"==typeof t){var M=String(t)+"n";return x?O(t,M):M}var j=void 0===c.depth?5:c.depth;if(void 0===r&&(r=0),r>=j&&j>0&&"object"==typeof t)return D(t)?"[Array]":"[Object]";var L=function(e,t){var n;if("\t"===e.indent)n="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;n=S.call(Array(e.indent+1)," ")}return{base:n,prev:S.call(Array(t+1),n)}}(c,r);if(void 0===s)s=[];else if(K(s,t)>=0)return"[Circular]";function F(t,n,i){if(n&&(s=E.call(s)).push(n),i){var o={depth:c.depth};return W(c,"quoteStyle")&&(o.quoteStyle=c.quoteStyle),e(t,o,r+1,s)}return e(t,c,r+1,s)}if("function"==typeof t&&!z(t)){var G=function(e){if(e.name)return e.name;var t=v.call(b.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(t),ee=Q(t,F);return"[Function"+(G?": "+G:" (anonymous)")+"]"+(ee.length>0?" { "+S.call(ee,", ")+" }":"")}if(H(t)){var te=T?y.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):I.call(t);return"object"!=typeof t||T?te:X(te)}if(function(e){if(!e||"object"!=typeof e)return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute}(t)){for(var ne="<"+_.call(String(t.nodeName)),ie=t.attributes||[],re=0;re"}if(D(t)){if(0===t.length)return"[]";var oe=Q(t,F);return L&&!function(e){for(var t=0;t=0)return!1;return!0}(oe)?"["+Z(oe,L)+"]":"[ "+S.call(oe,", ")+" ]"}if(function(e){return!("[object Error]"!==V(e)||C&&"object"==typeof e&&C in e)}(t)){var ae=Q(t,F);return"cause"in Error.prototype||!("cause"in t)||B.call(t,"cause")?0===ae.length?"["+String(t)+"]":"{ ["+String(t)+"] "+S.call(ae,", ")+" }":"{ ["+String(t)+"] "+S.call(k.call("[cause]: "+F(t.cause),ae),", ")+" }"}if("object"==typeof t&&m){if(U&&"function"==typeof t[U]&&P)return P(t,{depth:j-r});if("symbol"!==m&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!o||!e||"object"!=typeof e)return!1;try{o.call(e);try{l.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var se=[];return a&&a.call(t,(function(e,n){se.push(F(n,t,!0)+" => "+F(e,t))})),J("Map",o.call(t),se,L)}if(function(e){if(!l||!e||"object"!=typeof e)return!1;try{l.call(e);try{o.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var ce=[];return u&&u.call(t,(function(e){ce.push(F(e,t))})),J("Set",l.call(t),ce,L)}if(function(e){if(!p||!e||"object"!=typeof e)return!1;try{p.call(e,p);try{d.call(e,d)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return Y("WeakMap");if(function(e){if(!d||!e||"object"!=typeof e)return!1;try{d.call(e,d);try{p.call(e,p)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return Y("WeakSet");if(function(e){if(!f||!e||"object"!=typeof e)return!1;try{return f.call(e),!0}catch(e){}return!1}(t))return Y("WeakRef");if(function(e){return!("[object Number]"!==V(e)||C&&"object"==typeof e&&C in e)}(t))return X(F(Number(t)));if(function(e){if(!e||"object"!=typeof e||!A)return!1;try{return A.call(e),!0}catch(e){}return!1}(t))return X(F(A.call(t)));if(function(e){return!("[object Boolean]"!==V(e)||C&&"object"==typeof e&&C in e)}(t))return X(h.call(t));if(function(e){return!("[object String]"!==V(e)||C&&"object"==typeof e&&C in e)}(t))return X(F(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if(t===n)return"{ [object globalThis] }";if(!function(e){return!("[object Date]"!==V(e)||C&&"object"==typeof e&&C in e)}(t)&&!z(t)){var le=Q(t,F),ue=R?R(t)===Object.prototype:t instanceof Object||t.constructor===Object,pe=t instanceof Object?"":"null prototype",de=!ue&&C&&Object(t)===t&&C in t?g.call(V(t),8,-1):pe?"Object":"",fe=(ue||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(de||pe?"["+S.call(k.call([],de||[],pe||[]),": ")+"] ":"");return 0===le.length?fe+"{}":L?fe+"{"+Z(le,L)+"}":fe+"{ "+S.call(le,", ")+" }"}return String(t)};var F=Object.prototype.hasOwnProperty||function(e){return e in this};function W(e,t){return F.call(e,t)}function V(e){return m.call(e)}function K(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,i=e.length;nt.maxStringLength){var n=e.length-t.maxStringLength,i="... "+n+" more character"+(n>1?"s":"");return $(g.call(e,0,t.maxStringLength),t)+i}return q(y.call(y.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,G),"single",t)}function G(e){var t=e.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return n?"\\"+n:"\\x"+(t<16?"0":"")+x.call(t.toString(16))}function X(e){return"Object("+e+")"}function Y(e){return e+" { ? }"}function J(e,t,n,i){return e+" ("+t+") {"+(i?Z(n,i):S.call(n,", "))+"}"}function Z(e,t){if(0===e.length)return"";var n="\n"+t.prev+t.base;return n+S.call(e,","+n)+"\n"+t.prev}function Q(e,t){var n=D(e),i=[];if(n){i.length=e.length;for(var r=0;r */ const i=e("bencode"),r=e("blob-to-buffer"),o=e("fs"),a=e("simple-get"),s=e("magnet-uri"),c=e("path"),l=e("simple-sha1"),u=e("queue-microtask");function p(e){if("string"==typeof e&&/^(stream-)?magnet:/.test(e)){const t=s(e);if(!t.infoHash)throw new Error("Invalid torrent identifier");return t}if("string"==typeof e&&(/^[a-f0-9]{40}$/i.test(e)||/^[a-z2-7]{32}$/i.test(e)))return s(`magnet:?xt=urn:btih:${e}`);if(n.isBuffer(e)&&20===e.length)return s(`magnet:?xt=urn:btih:${e.toString("hex")}`);if(n.isBuffer(e))return function(e){n.isBuffer(e)&&(e=i.decode(e));f(e.info,"info"),f(e.info["name.utf-8"]||e.info.name,"info.name"),f(e.info["piece length"],"info['piece length']"),f(e.info.pieces,"info.pieces"),e.info.files?e.info.files.forEach((e=>{f("number"==typeof e.length,"info.files[0].length"),f(e["path.utf-8"]||e.path,"info.files[0].path")})):f("number"==typeof e.info.length,"info.length");const t={info:e.info,infoBuffer:i.encode(e.info),name:(e.info["name.utf-8"]||e.info.name).toString(),announce:[]};t.infoHash=l.sync(t.infoBuffer),t.infoHashBuffer=n.from(t.infoHash,"hex"),void 0!==e.info.private&&(t.private=!!e.info.private);e["creation date"]&&(t.created=new Date(1e3*e["creation date"]));e["created by"]&&(t.createdBy=e["created by"].toString());n.isBuffer(e.comment)&&(t.comment=e.comment.toString());Array.isArray(e["announce-list"])&&e["announce-list"].length>0?e["announce-list"].forEach((e=>{e.forEach((e=>{t.announce.push(e.toString())}))})):e.announce&&t.announce.push(e.announce.toString());n.isBuffer(e["url-list"])&&(e["url-list"]=e["url-list"].length>0?[e["url-list"]]:[]);t.urlList=(e["url-list"]||[]).map((e=>e.toString())),t.announce=Array.from(new Set(t.announce)),t.urlList=Array.from(new Set(t.urlList));const r=e.info.files||[e.info];t.files=r.map(((e,n)=>{const i=[].concat(t.name,e["path.utf-8"]||e.path||[]).map((e=>e.toString()));return{path:c.join.apply(null,[c.sep].concat(i)).slice(1),name:i[i.length-1],length:e.length,offset:r.slice(0,n).reduce(d,0)}})),t.length=r.reduce(d,0);const o=t.files[t.files.length-1];return t.pieceLength=e.info["piece length"],t.lastPieceLength=(o.offset+o.length)%t.pieceLength||t.pieceLength,t.pieces=function(e){const t=[];for(let n=0;n{i(null,s)})):(c=t,"undefined"!=typeof Blob&&c instanceof Blob?r(t,((e,t)=>{if(e)return i(new Error(`Error converting Blob: ${e.message}`));l(t)})):"function"==typeof a&&/^https?:/.test(t)?(n=Object.assign({url:t,timeout:3e4,headers:{"user-agent":"WebTorrent (https://webtorrent.io)"}},n),a.concat(n,((e,t,n)=>{if(e)return i(new Error(`Error downloading torrent: ${e.message}`));l(n)}))):"function"==typeof o.readFile&&"string"==typeof t?o.readFile(t,((e,t)=>{if(e)return i(new Error("Invalid torrent identifier"));l(t)})):u((()=>{i(new Error("Invalid torrent identifier"))})));var c;function l(e){try{s=p(e)}catch(e){return i(e)}s&&s.infoHash?i(null,s):i(new Error("Invalid torrent identifier"))}},t.exports.toMagnetURI=s.encode,t.exports.toTorrentFile=function(e){const t={info:e.info};t["announce-list"]=(e.announce||[]).map((e=>(t.announce||(t.announce=e),[e=n.from(e,"utf8")]))),t["url-list"]=e.urlList||[],void 0!==e.private&&(t.private=Number(e.private));e.created&&(t["creation date"]=e.created.getTime()/1e3|0);e.createdBy&&(t["created by"]=e.createdBy);e.comment&&(t.comment=e.comment);return i.encode(t)},n.alloc(0)}).call(this)}).call(this,e("buffer").Buffer)},{bencode:22,"blob-to-buffer":47,buffer:110,fs:67,"magnet-uri":240,path:301,"queue-microtask":327,"simple-get":369,"simple-sha1":386}],301:[function(e,t,n){(function(e){(function(){"use strict";function n(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function i(e,t){for(var n,i="",r=0,o=-1,a=0,s=0;s<=e.length;++s){if(s2){var c=i.lastIndexOf("/");if(c!==i.length-1){-1===c?(i="",r=0):r=(i=i.slice(0,c)).length-1-i.lastIndexOf("/"),o=s,a=0;continue}}else if(2===i.length||1===i.length){i="",r=0,o=s,a=0;continue}t&&(i.length>0?i+="/..":i="..",r=2)}else i.length>0?i+="/"+e.slice(o+1,s):i=e.slice(o+1,s),r=s-o-1;o=s,a=0}else 46===n&&-1!==a?++a:a=-1}return i}var r={resolve:function(){for(var t,r="",o=!1,a=arguments.length-1;a>=-1&&!o;a--){var s;a>=0?s=arguments[a]:(void 0===t&&(t=e.cwd()),s=t),n(s),0!==s.length&&(r=s+"/"+r,o=47===s.charCodeAt(0))}return r=i(r,!o),o?r.length>0?"/"+r:"/":r.length>0?r:"."},normalize:function(e){if(n(e),0===e.length)return".";var t=47===e.charCodeAt(0),r=47===e.charCodeAt(e.length-1);return 0!==(e=i(e,!t)).length||t||(e="."),e.length>0&&r&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return n(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t0&&(void 0===e?e=i:e+="/"+i)}return void 0===e?".":r.normalize(e)},relative:function(e,t){if(n(e),n(t),e===t)return"";if((e=r.resolve(e))===(t=r.resolve(t)))return"";for(var i=1;il){if(47===t.charCodeAt(s+p))return t.slice(s+p+1);if(0===p)return t.slice(s+p)}else a>l&&(47===e.charCodeAt(i+p)?u=p:0===p&&(u=0));break}var d=e.charCodeAt(i+p);if(d!==t.charCodeAt(s+p))break;47===d&&(u=p)}var f="";for(p=i+u+1;p<=o;++p)p!==o&&47!==e.charCodeAt(p)||(0===f.length?f+="..":f+="/..");return f.length>0?f+t.slice(s+u):(s+=u,47===t.charCodeAt(s)&&++s,t.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(n(e),0===e.length)return".";for(var t=e.charCodeAt(0),i=47===t,r=-1,o=!0,a=e.length-1;a>=1;--a)if(47===(t=e.charCodeAt(a))){if(!o){r=a;break}}else o=!1;return-1===r?i?"/":".":i&&1===r?"//":e.slice(0,r)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');n(e);var i,r=0,o=-1,a=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var s=t.length-1,c=-1;for(i=e.length-1;i>=0;--i){var l=e.charCodeAt(i);if(47===l){if(!a){r=i+1;break}}else-1===c&&(a=!1,c=i+1),s>=0&&(l===t.charCodeAt(s)?-1==--s&&(o=i):(s=-1,o=c))}return r===o?o=c:-1===o&&(o=e.length),e.slice(r,o)}for(i=e.length-1;i>=0;--i)if(47===e.charCodeAt(i)){if(!a){r=i+1;break}}else-1===o&&(a=!1,o=i+1);return-1===o?"":e.slice(r,o)},extname:function(e){n(e);for(var t=-1,i=0,r=-1,o=!0,a=0,s=e.length-1;s>=0;--s){var c=e.charCodeAt(s);if(47!==c)-1===r&&(o=!1,r=s+1),46===c?-1===t?t=s:1!==a&&(a=1):-1!==t&&(a=-1);else if(!o){i=s+1;break}}return-1===t||-1===r||0===a||1===a&&t===r-1&&t===i+1?"":e.slice(t,r)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var n=t.dir||t.root,i=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+i:n+e+i:i}("/",e)},parse:function(e){n(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var i,r=e.charCodeAt(0),o=47===r;o?(t.root="/",i=1):i=0;for(var a=-1,s=0,c=-1,l=!0,u=e.length-1,p=0;u>=i;--u)if(47!==(r=e.charCodeAt(u)))-1===c&&(l=!1,c=u+1),46===r?-1===a?a=u:1!==p&&(p=1):-1!==a&&(p=-1);else if(!l){s=u+1;break}return-1===a||-1===c||0===p||1===p&&a===c-1&&a===s+1?-1!==c&&(t.base=t.name=0===s&&o?e.slice(1,c):e.slice(s,c)):(0===s&&o?(t.name=e.slice(1,a),t.base=e.slice(1,c)):(t.name=e.slice(s,a),t.base=e.slice(s,c)),t.ext=e.slice(a,c)),s>0?t.dir=e.slice(0,s-1):o&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};r.posix=r,t.exports=r}).call(this)}).call(this,e("_process"))},{_process:309}],302:[function(e,t,n){n.pbkdf2=e("./lib/async"),n.pbkdf2Sync=e("./lib/sync")},{"./lib/async":303,"./lib/sync":306}],303:[function(e,t,n){(function(n){(function(){var i,r,o=e("safe-buffer").Buffer,a=e("./precondition"),s=e("./default-encoding"),c=e("./sync"),l=e("./to-buffer"),u=n.crypto&&n.crypto.subtle,p={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"},d=[];function f(){return r||(r=n.process&&n.process.nextTick?n.process.nextTick:n.queueMicrotask?n.queueMicrotask:n.setImmediate?n.setImmediate:n.setTimeout)}function h(e,t,n,i,r){return u.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then((function(e){return u.deriveBits({name:"PBKDF2",salt:t,iterations:n,hash:{name:r}},e,i<<3)})).then((function(e){return o.from(e)}))}t.exports=function(e,t,r,m,b,v){"function"==typeof b&&(v=b,b=void 0);var g=p[(b=b||"sha1").toLowerCase()];if(g&&"function"==typeof n.Promise){if(a(r,m),e=l(e,s,"Password"),t=l(t,s,"Salt"),"function"!=typeof v)throw new Error("No callback provided to pbkdf2");!function(e,t){e.then((function(e){f()((function(){t(null,e)}))}),(function(e){f()((function(){t(e)}))}))}(function(e){if(n.process&&!n.process.browser)return Promise.resolve(!1);if(!u||!u.importKey||!u.deriveBits)return Promise.resolve(!1);if(void 0!==d[e])return d[e];var t=h(i=i||o.alloc(8),i,10,128,e).then((function(){return!0})).catch((function(){return!1}));return d[e]=t,t}(g).then((function(n){return n?h(e,t,r,m,g):c(e,t,r,m,b)})),v)}else f()((function(){var n;try{n=c(e,t,r,m,b)}catch(e){return v(e)}v(null,n)}))}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./default-encoding":304,"./precondition":305,"./sync":306,"./to-buffer":307,"safe-buffer":356}],304:[function(e,t,n){(function(e,n){(function(){var i;if(n.process&&n.process.browser)i="utf-8";else if(n.process&&n.process.version){i=parseInt(e.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else i="utf-8";t.exports=i}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:309}],305:[function(e,t,n){var i=Math.pow(2,30)-1;t.exports=function(e,t){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if("number"!=typeof t)throw new TypeError("Key length not a number");if(t<0||t>i||t!=t)throw new TypeError("Bad key length")}},{}],306:[function(e,t,n){var i=e("create-hash/md5"),r=e("ripemd160"),o=e("sha.js"),a=e("safe-buffer").Buffer,s=e("./precondition"),c=e("./default-encoding"),l=e("./to-buffer"),u=a.alloc(128),p={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function d(e,t,n){var s=function(e){function t(t){return o(e).update(t).digest()}function n(e){return(new r).update(e).digest()}return"rmd160"===e||"ripemd160"===e?n:"md5"===e?i:t}(e),c="sha512"===e||"sha384"===e?128:64;t.length>c?t=s(t):t.length1)for(var n=1;nh||new a(t).cmp(f.modulus)>=0)throw new Error("decryption error");d=n?l(new a(t),f):s(t,f);var m=u.alloc(h-d.length);if(d=u.concat([m,d],h),4===p)return function(e,t){var n=e.modulus.byteLength(),i=c("sha1").update(u.alloc(0)).digest(),a=i.length;if(0!==t[0])throw new Error("decryption error");var s=t.slice(1,a+1),l=t.slice(a+1),p=o(s,r(l,a)),d=o(l,r(p,n-a-1));if(function(e,t){e=u.from(e),t=u.from(t);var n=0,i=e.length;e.length!==t.length&&(n++,i=Math.min(e.length,t.length));var r=-1;for(;++r=t.length){o++;break}var a=t.slice(2,r-1);("0002"!==i.toString("hex")&&!n||"0001"!==i.toString("hex")&&n)&&o++;a.length<8&&o++;if(o)throw new Error("decryption error");return t.slice(r)}(0,d,n);if(3===p)return d;throw new Error("unknown padding")}},{"./mgf":311,"./withPublic":315,"./xor":316,"bn.js":312,"browserify-rsa":88,"create-hash":142,"parse-asn1":299,"safe-buffer":356}],314:[function(e,t,n){var i=e("parse-asn1"),r=e("randombytes"),o=e("create-hash"),a=e("./mgf"),s=e("./xor"),c=e("bn.js"),l=e("./withPublic"),u=e("browserify-rsa"),p=e("safe-buffer").Buffer;t.exports=function(e,t,n){var d;d=e.padding?e.padding:n?1:4;var f,h=i(e);if(4===d)f=function(e,t){var n=e.modulus.byteLength(),i=t.length,l=o("sha1").update(p.alloc(0)).digest(),u=l.length,d=2*u;if(i>n-d-2)throw new Error("message too long");var f=p.alloc(n-i-d-2),h=n-u-1,m=r(u),b=s(p.concat([l,f,p.alloc(1,1),t],h),a(m,h)),v=s(m,a(b,u));return new c(p.concat([p.alloc(1),v,b],n))}(h,t);else if(1===d)f=function(e,t,n){var i,o=t.length,a=e.modulus.byteLength();if(o>a-11)throw new Error("message too long");i=n?p.alloc(a-o-3,255):function(e){var t,n=p.allocUnsafe(e),i=0,o=r(2*e),a=0;for(;i=0)throw new Error("data too long for modulus")}return n?u(f,h):l(f,h)}},{"./mgf":311,"./withPublic":315,"./xor":316,"bn.js":312,"browserify-rsa":88,"create-hash":142,"parse-asn1":299,randombytes:330,"safe-buffer":356}],315:[function(e,t,n){var i=e("bn.js"),r=e("safe-buffer").Buffer;t.exports=function(e,t){return r.from(e.toRed(i.mont(t.modulus)).redPow(new i(t.publicExponent)).fromRed().toArray())}},{"bn.js":312,"safe-buffer":356}],316:[function(e,t,n){t.exports=function(e,t){for(var n=e.length,i=-1;++i0,(function(t){e||(e=t),t&&i.forEach(u),a||(i.forEach(u),n(e))}))}));return t.reduce(p)}}).call(this)}).call(this,e("_process"))},{_process:309,"end-of-stream":179,fs:67,once:294}],318:[function(e,t,n){(function(e){(function(){!function(i){var r="object"==typeof n&&n&&!n.nodeType&&n,o="object"==typeof t&&t&&!t.nodeType&&t,a="object"==typeof e&&e;a.global!==a&&a.window!==a&&a.self!==a||(i=a);var s,c,l=2147483647,u=36,p=1,d=26,f=38,h=700,m=72,b=128,v="-",g=/^xn--/,y=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},w=u-p,k=Math.floor,S=String.fromCharCode;function E(e){throw new RangeError(_[e])}function M(e,t){for(var n=e.length,i=[];n--;)i[n]=t(e[n]);return i}function A(e,t){var n=e.split("@"),i="";return n.length>1&&(i=n[0]+"@",e=n[1]),i+M((e=e.replace(x,".")).split("."),t).join(".")}function j(e){for(var t,n,i=[],r=0,o=e.length;r=55296&&t<=56319&&r65535&&(t+=S((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=S(e)})).join("")}function T(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function C(e,t,n){var i=0;for(e=n?k(e/h):e>>1,e+=k(e/t);e>w*d>>1;i+=u)e=k(e/w);return k(i+(w+1)*e/(e+f))}function B(e){var t,n,i,r,o,a,s,c,f,h,g,y=[],x=e.length,_=0,w=b,S=m;for((n=e.lastIndexOf(v))<0&&(n=0),i=0;i=128&&E("not-basic"),y.push(e.charCodeAt(i));for(r=n>0?n+1:0;r=x&&E("invalid-input"),((c=(g=e.charCodeAt(r++))-48<10?g-22:g-65<26?g-65:g-97<26?g-97:u)>=u||c>k((l-_)/a))&&E("overflow"),_+=c*a,!(c<(f=s<=S?p:s>=S+d?d:s-S));s+=u)a>k(l/(h=u-f))&&E("overflow"),a*=h;S=C(_-o,t=y.length+1,0==o),k(_/t)>l-w&&E("overflow"),w+=k(_/t),_%=t,y.splice(_++,0,w)}return I(y)}function R(e){var t,n,i,r,o,a,s,c,f,h,g,y,x,_,w,M=[];for(y=(e=j(e)).length,t=b,n=0,o=m,a=0;a=t&&gk((l-n)/(x=i+1))&&E("overflow"),n+=(s-t)*x,t=s,a=0;al&&E("overflow"),g==t){for(c=n,f=u;!(c<(h=f<=o?p:f>=o+d?d:f-o));f+=u)w=c-h,_=u-h,M.push(S(T(h+w%_,0))),c=k(w/_);M.push(S(T(c,0))),o=C(n,x,i==r),n=0,++i}++n,++t}return M.join("")}if(s={version:"1.4.1",ucs2:{decode:j,encode:I},decode:B,encode:R,toASCII:function(e){return A(e,(function(e){return y.test(e)?"xn--"+R(e):e}))},toUnicode:function(e){return A(e,(function(e){return g.test(e)?B(e.slice(4).toLowerCase()):e}))}},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",(function(){return s}));else if(r&&o)if(t.exports==r)o.exports=s;else for(c in s)s.hasOwnProperty(c)&&(r[c]=s[c]);else i.punycode=s}(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],319:[function(e,t,n){"use strict";var i=String.prototype.replace,r=/%20/g,o="RFC1738",a="RFC3986";t.exports={default:a,formatters:{RFC1738:function(e){return i.call(e,r,"+")},RFC3986:function(e){return String(e)}},RFC1738:o,RFC3986:a}},{}],320:[function(e,t,n){"use strict";var i=e("./stringify"),r=e("./parse"),o=e("./formats");t.exports={formats:o,parse:r,stringify:i}},{"./formats":319,"./parse":321,"./stringify":322}],321:[function(e,t,n){"use strict";var i=e("./utils"),r=Object.prototype.hasOwnProperty,o=Array.isArray,a={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:i.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},s=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},c=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},l=function(e,t,n,i){if(e){var o=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/g,s=n.depth>0&&/(\[[^[\]]*])/.exec(o),l=s?o.slice(0,s.index):o,u=[];if(l){if(!n.plainObjects&&r.call(Object.prototype,l)&&!n.allowPrototypes)return;u.push(l)}for(var p=0;n.depth>0&&null!==(s=a.exec(o))&&p=0;--o){var a,s=e[o];if("[]"===s&&n.parseArrays)a=[].concat(r);else{a=n.plainObjects?Object.create(null):{};var l="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,u=parseInt(l,10);n.parseArrays||""!==l?!isNaN(u)&&s!==l&&String(u)===l&&u>=0&&n.parseArrays&&u<=n.arrayLimit?(a=[])[u]=r:"__proto__"!==l&&(a[l]=r):a={0:r}}r=a}return r}(u,t,n,i)}};t.exports=function(e,t){var n=function(e){if(!e)return a;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?a.charset:e.charset;return{allowDots:void 0===e.allowDots?a.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:a.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:a.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:a.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:a.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:a.comma,decoder:"function"==typeof e.decoder?e.decoder:a.decoder,delimiter:"string"==typeof e.delimiter||i.isRegExp(e.delimiter)?e.delimiter:a.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:a.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:a.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:a.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:a.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:a.strictNullHandling}}(t);if(""===e||null==e)return n.plainObjects?Object.create(null):{};for(var u="string"==typeof e?function(e,t){var n,l={__proto__:null},u=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,p=t.parameterLimit===1/0?void 0:t.parameterLimit,d=u.split(t.delimiter,p),f=-1,h=t.charset;if(t.charsetSentinel)for(n=0;n-1&&(b=o(b)?[b]:b),r.call(l,m)?l[m]=i.combine(l[m],b):l[m]=b}return l}(e,n):e,p=n.plainObjects?Object.create(null):{},d=Object.keys(u),f=0;f0?S.join(",")||null:void 0}];else if(c(d))I=d;else{var C=Object.keys(S);I=m?C.sort(m):C}for(var B=a&&c(S)&&1===S.length?n+"[]":n,R=0;R0?_+x:""}},{"./formats":319,"./utils":323,"side-channel":367}],323:[function(e,t,n){"use strict";var i=e("./formats"),r=Object.prototype.hasOwnProperty,o=Array.isArray,a=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),s=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},i=0;i1;){var t=e.pop(),n=t.obj[t.prop];if(o(n)){for(var i=[],r=0;r=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||o===i.RFC1738&&(40===u||41===u)?c+=s.charAt(l):u<128?c+=a[u]:u<2048?c+=a[192|u>>6]+a[128|63&u]:u<55296||u>=57344?c+=a[224|u>>12]+a[128|u>>6&63]+a[128|63&u]:(l+=1,u=65536+((1023&u)<<10|1023&s.charCodeAt(l)),c+=a[240|u>>18]+a[128|u>>12&63]+a[128|u>>6&63]+a[128|63&u])}return c},isBuffer:function(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(o(e)){for(var n=[],i=0;i0&&l>c&&(l=c);for(var u=0;u=0?(p=m.substr(0,b),d=m.substr(b+1)):(p=m,d=""),f=decodeURIComponent(p),h=decodeURIComponent(d),i(a,f)?r(a[f])?a[f].push(h):a[f]=[a[f],h]:a[f]=h}return a};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],325:[function(e,t,n){"use strict";var i=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,n,s){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(a(e),(function(a){var s=encodeURIComponent(i(a))+n;return r(e[a])?o(e[a],(function(e){return s+encodeURIComponent(i(e))})).join(t):s+encodeURIComponent(i(e[a]))})).join(t):s?encodeURIComponent(i(s))+n+encodeURIComponent(i(e)):""};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],i=0;i */ let n;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:e):e=>(n||(n=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],328:[function(e,t,n){t.exports="function"==typeof queueMicrotask?queueMicrotask:e=>Promise.resolve().then(e)},{}],329:[function(e,t,n){t.exports=function(e){var t=0;return function(){if(t===e.length)return null;var n=e.length-t,i=Math.random()*n|0,r=e[t+i],o=e[t];return e[t]=r,e[t+i]=o,t++,r}}},{}],330:[function(e,t,n){(function(n,i){(function(){"use strict";var r=65536,o=4294967295;var a=e("safe-buffer").Buffer,s=i.crypto||i.msCrypto;s&&s.getRandomValues?t.exports=function(e,t){if(e>o)throw new RangeError("requested too many random bytes");var i=a.allocUnsafe(e);if(e>0)if(e>r)for(var c=0;cu||e<0)throw new TypeError("offset must be a uint32");if(e>c||e>t)throw new RangeError("offset out of range")}function d(e,t,n){if("number"!=typeof e||e!=e)throw new TypeError("size must be a number");if(e>u||e<0)throw new TypeError("size must be a uint32");if(e+t>n||e>c)throw new RangeError("buffer too small")}function f(e,n,i,r){if(t.browser){var o=e.buffer,s=new Uint8Array(o,n,i);return l.getRandomValues(s),r?void t.nextTick((function(){r(null,e)})):e}if(!r)return a(i).copy(e,n),e;a(i,(function(t,i){if(t)return r(t);i.copy(e,n),r(null,e)}))}l&&l.getRandomValues||!t.browser?(n.randomFill=function(e,t,n,r){if(!(s.isBuffer(e)||e instanceof i.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof t)r=t,t=0,n=e.length;else if("function"==typeof n)r=n,n=e.length-t;else if("function"!=typeof r)throw new TypeError('"cb" argument must be a function');return p(t,e.length),d(n,t,e.length),f(e,t,n,r)},n.randomFillSync=function(e,t,n){void 0===t&&(t=0);if(!(s.isBuffer(e)||e instanceof i.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');p(t,e.length),void 0===n&&(n=e.length-t);return d(n,t,e.length),f(e,t,n)}):(n.randomFill=r,n.randomFillSync=r)}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:309,randombytes:330,"safe-buffer":356}],332:[function(e,t,n){ /*! * range-parser * Copyright(c) 2012-2014 TJ Holowaychuk * Copyright(c) 2015-2016 Douglas Christopher Wilson * MIT Licensed */ "use strict";function i(e,t){return{start:e.start,end:e.end,index:t}}function r(e){return{start:e.start,end:e.end}}function o(e,t){return e.index-t.index}function a(e,t){return e.start-t.start}t.exports=function(e,t,n){if("string"!=typeof t)throw new TypeError("argument str must be a string");var s=t.indexOf("=");if(-1===s)return-2;var c=t.slice(s+1).split(","),l=[];l.type=t.slice(0,s);for(var u=0;ue-1&&(f=e-1),isNaN(d)||isNaN(f)||d>f||d<0||l.push({start:d,end:f})}if(l.length<1)return-1;return n&&n.combine?function(e){for(var t=e.map(i).sort(a),n=0,s=1;sl.end+1?t[++n]=c:c.end>l.end&&(l.end=c.end,l.index=Math.min(l.index,c.index))}t.length=n+1;var u=t.sort(o).map(r);return u.type=e.type,u}(l):l}},{}],333:[function(e,t,n){const{Writable:i,PassThrough:r}=e("readable-stream");t.exports=class extends i{constructor(e,t={}){super(t),this.destroyed=!1,this._queue=[],this._position=e||0,this._cb=null,this._buffer=null,this._out=null}_write(e,t,n){let i=!0;for(;;){if(this.destroyed)return;if(0===this._queue.length)return this._buffer=e,void(this._cb=n);this._buffer=null;var r=this._queue[0];const t=Math.max(r.start-this._position,0),o=r.end-this._position;if(t>=e.length)return this._position+=e.length,n(null);let a;if(o>e.length){this._position+=e.length,a=0===t?e:e.slice(t),i=r.stream.write(a)&&i;break}this._position+=o,a=0===t&&o===e.length?e:e.slice(t,o),i=r.stream.write(a)&&i,r.last&&r.stream.end(),e=e.slice(o),this._queue.shift()}i?n(null):r.stream.once("drain",n.bind(null,null))}slice(e){if(this.destroyed)return null;Array.isArray(e)||(e=[e]);const t=new r;return e.forEach(((n,i)=>{this._queue.push({start:n.start,end:n.end,stream:t,last:i===e.length-1})})),this._buffer&&this._write(this._buffer,null,this._cb),t}destroy(e){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e))}}},{"readable-stream":348}],334:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28}],335:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{"./_stream_readable":337,"./_stream_writable":339,_process:309,dup:29,inherits:229}],336:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{"./_stream_transform":338,dup:30,inherits:229}],337:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{"../errors":334,"./_stream_duplex":335,"./internal/streams/async_iterator":340,"./internal/streams/buffer_list":341,"./internal/streams/destroy":342,"./internal/streams/from":344,"./internal/streams/state":346,"./internal/streams/stream":347,_process:309,buffer:110,dup:31,events:181,inherits:229,"string_decoder/":447,util:67}],338:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{"../errors":334,"./_stream_duplex":335,dup:32,inherits:229}],339:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"../errors":334,"./_stream_duplex":335,"./internal/streams/destroy":342,"./internal/streams/state":346,"./internal/streams/stream":347,_process:309,buffer:110,dup:33,inherits:229,"util-deprecate":459}],340:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"./end-of-stream":343,_process:309,dup:34}],341:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{buffer:110,dup:35,util:67}],342:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{_process:309,dup:36}],343:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{"../../../errors":334,dup:37}],344:[function(e,t,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],345:[function(e,t,n){arguments[4][39][0].apply(n,arguments)},{"../../../errors":334,"./end-of-stream":343,dup:39}],346:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{"../../../errors":334,dup:40}],347:[function(e,t,n){arguments[4][41][0].apply(n,arguments)},{dup:41,events:181}],348:[function(e,t,n){arguments[4][42][0].apply(n,arguments)},{"./lib/_stream_duplex.js":335,"./lib/_stream_passthrough.js":336,"./lib/_stream_readable.js":337,"./lib/_stream_transform.js":338,"./lib/_stream_writable.js":339,"./lib/internal/streams/end-of-stream.js":343,"./lib/internal/streams/pipeline.js":345,dup:42}],349:[function(e,t,n){"use strict";function i(e){return parseInt(e,10)===e}function r(e){function t(t){if(void 0===t){t=new Array(e);for(var n=0;n */ n.render=function(e,t,n,i){"function"==typeof n&&(i=n,n={});n||(n={});i||(i=()=>{});x(e),_(n),"string"==typeof t&&(t=document.querySelector(t));g(e,(i=>{if(t.nodeName!==i.toUpperCase()){const n=a.extname(e.name).toLowerCase();throw new Error(`Cannot render "${n}" inside a "${t.nodeName.toLowerCase()}" element, expected "${i}"`)}return"video"!==i&&"audio"!==i||w(t,n),t}),n,i)},n.append=function(e,t,n,i){"function"==typeof n&&(i=n,n={});n||(n={});i||(i=()=>{});x(e),_(n),"string"==typeof t&&(t=document.querySelector(t));if(t&&("VIDEO"===t.nodeName||"AUDIO"===t.nodeName))throw new Error("Invalid video/audio node argument. Argument must be root element that video/audio tag will be appended to.");function r(e){const n=document.createElement(e);return t.appendChild(n),n}g(e,(function(e){return"video"===e||"audio"===e?function(e){const i=r(e);return w(i,n),t.appendChild(i),i}(e):r(e)}),n,(function(e,t){e&&t&&t.remove(),i(e,t)}))},n.mime=e("./lib/mime.json");const i=e("debug")("render-media"),r=e("is-ascii"),o=e("mediasource"),a=e("path"),s=e("stream-to-blob-url"),c=e("videostream"),l=[".m4a",".m4b",".m4p",".m4v",".mp4"],u=[".m4v",".mkv",".mp4",".webm"],p=[].concat(u,[".m4a",".m4b",".m4p",".mp3"]),d=[".mov",".ogv"],f=[".aac",".oga",".ogg",".wav",".flac"],h=[".bmp",".gif",".jpeg",".jpg",".png",".svg"],m=[".css",".html",".js",".md",".pdf",".srt",".txt"],b=2e8,v="undefined"!=typeof window&&window.MediaSource;function g(e,t,n,s){const b=a.extname(e.name).toLowerCase();let g,x=0;function _(){return!("number"==typeof e.length&&e.length>n.maxBlobLength)||(i("File length too large for Blob URL approach: %d (max: %d)",e.length,n.maxBlobLength),M(new Error(`File length too large for Blob URL approach: ${e.length} (max: ${n.maxBlobLength})`)),!1)}function w(n){_()&&(g=t(n),y(e,((e,t)=>{if(e)return M(e);g.addEventListener("error",M),g.addEventListener("loadstart",k),g.addEventListener("loadedmetadata",S),g.src=t})))}function k(){if(g.removeEventListener("loadstart",k),n.autoplay){const e=g.play();void 0!==e&&e.catch(M)}}function S(){g.removeEventListener("loadedmetadata",S),s(null,g)}function E(){y(e,((e,n)=>{if(e)return M(e);".pdf"!==b?(g=t("iframe"),g.sandbox="allow-forms allow-scripts",g.src=n):(g=t("object"),g.setAttribute("typemustmatch",!0),g.setAttribute("type","application/pdf"),g.setAttribute("data",n)),s(null,g)}))}function M(t){t.message=`Error rendering file "${e.name}": ${t.message}`,i(t.message),s(t)}p.includes(b)?function(){const n=u.includes(b)?"video":"audio";v?l.includes(b)?r():s():p();function r(){i(`Use \`videostream\` package for ${e.name}`),h(),g.addEventListener("error",d),g.addEventListener("loadstart",k),g.addEventListener("loadedmetadata",S),new c(e,g)}function s(){i(`Use MediaSource API for ${e.name}`),h(),g.addEventListener("error",f),g.addEventListener("loadstart",k),g.addEventListener("loadedmetadata",S);const t=new o(g).createWriteStream(function(e){const t=a.extname(e).toLowerCase();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"'}[t]}(e.name));e.createReadStream().pipe(t),x&&(g.currentTime=x)}function p(){i(`Use Blob URL for ${e.name}`),h(),g.addEventListener("error",M),g.addEventListener("loadstart",k),g.addEventListener("loadedmetadata",S),y(e,((e,t)=>{if(e)return M(e);g.src=t,x&&(g.currentTime=x)}))}function d(e){i("videostream error: fallback to MediaSource API: %o",e.message||e),g.removeEventListener("error",d),g.removeEventListener("loadedmetadata",S),s()}function f(e){i("MediaSource API error: fallback to Blob URL: %o",e.message||e),_()&&(g.removeEventListener("error",f),g.removeEventListener("loadedmetadata",S),p())}function h(){g||(g=t(n),g.addEventListener("progress",(()=>{x=g.currentTime})))}}():d.includes(b)?w("video"):f.includes(b)?w("audio"):h.includes(b)?(g=t("img"),y(e,((t,n)=>{if(t)return M(t);g.src=n,g.alt=e.name,s(null,g)}))):m.includes(b)?E():function(){i('Unknown file extension "%s" - will attempt to render into iframe',b);let t="";function n(){r(t)?(i('File extension "%s" appears ascii, so will render.',b),E()):(i('File extension "%s" appears non-ascii, will not render.',b),s(new Error(`Unsupported file type "${b}": Cannot append to DOM`)))}e.createReadStream({start:0,end:1e3}).setEncoding("utf8").on("data",(e=>{t+=e})).on("end",n).on("error",s)}()}function y(e,t){const i=a.extname(e.name).toLowerCase();s(e.createReadStream(),n.mime[i]).then((e=>t(null,e)),(e=>t(e)))}function x(e){if(null==e)throw new Error("file cannot be null or undefined");if("string"!=typeof e.name)throw new Error("missing or invalid file.name property");if("function"!=typeof e.createReadStream)throw new Error("missing or invalid file.createReadStream property")}function _(e){null==e.autoplay&&(e.autoplay=!1),null==e.muted&&(e.muted=!1),null==e.controls&&(e.controls=!0),null==e.maxBlobLength&&(e.maxBlobLength=b)}function w(e,t){e.autoplay=!!t.autoplay,e.muted=!!t.muted,e.controls=!!t.controls}},{"./lib/mime.json":351,debug:148,"is-ascii":230,mediasource:242,path:301,"stream-to-blob-url":443,videostream:461}],351:[function(e,t,n){t.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"}},{}],352:[function(e,t,n){"use strict";var i=e("buffer").Buffer,r=e("inherits"),o=e("hash-base"),a=new Array(16),s=[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],c=[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],u=[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],p=[0,1518500249,1859775393,2400959708,2840853838],d=[1352829926,1548603684,1836072691,2053994217,0];function f(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function h(e,t){return e<>>32-t}function m(e,t,n,i,r,o,a,s){return h(e+(t^n^i)+o+a|0,s)+r|0}function b(e,t,n,i,r,o,a,s){return h(e+(t&n|~t&i)+o+a|0,s)+r|0}function v(e,t,n,i,r,o,a,s){return h(e+((t|~n)^i)+o+a|0,s)+r|0}function g(e,t,n,i,r,o,a,s){return h(e+(t&i|n&~i)+o+a|0,s)+r|0}function y(e,t,n,i,r,o,a,s){return h(e+(t^(n|~i))+o+a|0,s)+r|0}r(f,o),f.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var n=0|this._a,i=0|this._b,r=0|this._c,o=0|this._d,f=0|this._e,x=0|this._a,_=0|this._b,w=0|this._c,k=0|this._d,S=0|this._e,E=0;E<80;E+=1){var M,A;E<16?(M=m(n,i,r,o,f,e[s[E]],p[0],l[E]),A=y(x,_,w,k,S,e[c[E]],d[0],u[E])):E<32?(M=b(n,i,r,o,f,e[s[E]],p[1],l[E]),A=g(x,_,w,k,S,e[c[E]],d[1],u[E])):E<48?(M=v(n,i,r,o,f,e[s[E]],p[2],l[E]),A=v(x,_,w,k,S,e[c[E]],d[2],u[E])):E<64?(M=g(n,i,r,o,f,e[s[E]],p[3],l[E]),A=b(x,_,w,k,S,e[c[E]],d[3],u[E])):(M=y(n,i,r,o,f,e[s[E]],p[4],l[E]),A=m(x,_,w,k,S,e[c[E]],d[4],u[E])),n=f,f=o,o=h(r,10),r=i,i=M,x=S,S=k,k=h(w,10),w=_,_=A}var j=this._b+r+k|0;this._b=this._c+o+S|0,this._c=this._d+f+x|0,this._d=this._e+n+_|0,this._e=this._a+i+w|0,this._a=j},f.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=i.alloc?i.alloc(20):new i(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},t.exports=f},{buffer:110,"hash-base":196,inherits:229}],353:[function(e,t,n){ /*! run-parallel-limit. MIT License. Feross Aboukhadijeh */ t.exports=function(e,t,n){if("number"!=typeof t)throw new Error("second argument must be a Number");let r,o,a,s,c,l,u=!0;Array.isArray(e)?(r=[],a=o=e.length):(s=Object.keys(e),r={},a=o=s.length);function p(e){function t(){n&&n(e,r),n=null}u?i(t):t()}function d(t,n,i){if(r[t]=i,n&&(c=!0),0==--a||n)p(n);else if(!c&&l */ t.exports=function(e,t){let n,r,o,a=!0;Array.isArray(e)?(n=[],r=e.length):(o=Object.keys(e),n={},r=o.length);function s(e){function r(){t&&t(e,n),t=null}a?i(r):r()}function c(e,t,i){n[e]=i,(0==--r||t)&&s(t)}r?o?o.forEach((function(t){e[t]((function(e,n){c(t,e,n)}))})):e.forEach((function(e,t){e((function(e,n){c(t,e,n)}))})):s(null);a=!1};const i=e("queue-microtask")},{"queue-microtask":327}],355:[function(e,t,n){var i,r;i="undefined"!=typeof self?self:this,r=function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){var i=n(5),r=n(1),o=r.toHex,a=r.ceilHeapSize,s=n(6),c=function(e){for(e+=9;e%64>0;e+=1);return e},l=function(e,t){var n=new Int32Array(e,t+320,5),i=new Int32Array(5),r=new DataView(i.buffer);return r.setInt32(0,n[0],!1),r.setInt32(4,n[1],!1),r.setInt32(8,n[2],!1),r.setInt32(12,n[3],!1),r.setInt32(16,n[4],!1),i},u=function(){function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(t=t||65536)%64>0)throw new Error("Chunk size must be a multiple of 128 bit");this._offset=0,this._maxChunkLen=t,this._padMaxChunkLen=c(t),this._heap=new ArrayBuffer(a(this._padMaxChunkLen+320+20)),this._h32=new Int32Array(this._heap),this._h8=new Int8Array(this._heap),this._core=new i({Int32Array:Int32Array},{},this._heap)}return e.prototype._initState=function(e,t){this._offset=0;var n=new Int32Array(e,t+320,5);n[0]=1732584193,n[1]=-271733879,n[2]=-1732584194,n[3]=271733878,n[4]=-1009589776},e.prototype._padChunk=function(e,t){var n=c(e),i=new Int32Array(this._heap,0,n>>2);return function(e,t){var n=new Uint8Array(e.buffer),i=t%4,r=t-i;switch(i){case 0:n[r+3]=0;case 1:n[r+2]=0;case 2:n[r+1]=0;case 3:n[r+0]=0}for(var o=1+(t>>2);o>2]|=128<<24-(t%4<<3),e[14+(2+(t>>2)&-16)]=n/(1<<29)|0,e[15+(2+(t>>2)&-16)]=n<<3}(i,e,t),n},e.prototype._write=function(e,t,n,i){s(e,this._h8,this._h32,t,n,i||0)},e.prototype._coreCall=function(e,t,n,i,r){var o=n;this._write(e,t,n),r&&(o=this._padChunk(n,i)),this._core.hash(o,this._padMaxChunkLen)},e.prototype.rawDigest=function(e){var t=e.byteLength||e.length||e.size||0;this._initState(this._heap,this._padMaxChunkLen);var n=0,i=this._maxChunkLen;for(n=0;t>n+i;n+=i)this._coreCall(e,n,i,t,!1);return this._coreCall(e,n,t-n,t,!0),l(this._heap,this._padMaxChunkLen)},e.prototype.digest=function(e){return o(this.rawDigest(e).buffer)},e.prototype.digestFromString=function(e){return this.digest(e)},e.prototype.digestFromBuffer=function(e){return this.digest(e)},e.prototype.digestFromArrayBuffer=function(e){return this.digest(e)},e.prototype.resetState=function(){return this._initState(this._heap,this._padMaxChunkLen),this},e.prototype.append=function(e){var t=0,n=e.byteLength||e.length||e.size||0,i=this._offset%this._maxChunkLen,r=void 0;for(this._offset+=n;t0}),!1)}e.exports=function(e,t){t=t||{};var r={main:n.m},o=t.all?{main:Object.keys(r)}:function(e,t){for(var n={main:[t]},i={main:[]},r={main:{}};c(n);)for(var o=Object.keys(n),a=0;a>2]|0;s=i[t+324>>2]|0;l=i[t+328>>2]|0;p=i[t+332>>2]|0;f=i[t+336>>2]|0;for(n=0;(n|0)<(e|0);n=n+64|0){a=o;c=s;u=l;d=p;h=f;for(r=0;(r|0)<64;r=r+4|0){b=i[n+r>>2]|0;m=((o<<5|o>>>27)+(s&l|~s&p)|0)+((b+f|0)+1518500249|0)|0;f=p;p=l;l=s<<30|s>>>2;s=o;o=m;i[e+r>>2]=b}for(r=e+64|0;(r|0)<(e+80|0);r=r+4|0){b=(i[r-12>>2]^i[r-32>>2]^i[r-56>>2]^i[r-64>>2])<<1|(i[r-12>>2]^i[r-32>>2]^i[r-56>>2]^i[r-64>>2])>>>31;m=((o<<5|o>>>27)+(s&l|~s&p)|0)+((b+f|0)+1518500249|0)|0;f=p;p=l;l=s<<30|s>>>2;s=o;o=m;i[r>>2]=b}for(r=e+80|0;(r|0)<(e+160|0);r=r+4|0){b=(i[r-12>>2]^i[r-32>>2]^i[r-56>>2]^i[r-64>>2])<<1|(i[r-12>>2]^i[r-32>>2]^i[r-56>>2]^i[r-64>>2])>>>31;m=((o<<5|o>>>27)+(s^l^p)|0)+((b+f|0)+1859775393|0)|0;f=p;p=l;l=s<<30|s>>>2;s=o;o=m;i[r>>2]=b}for(r=e+160|0;(r|0)<(e+240|0);r=r+4|0){b=(i[r-12>>2]^i[r-32>>2]^i[r-56>>2]^i[r-64>>2])<<1|(i[r-12>>2]^i[r-32>>2]^i[r-56>>2]^i[r-64>>2])>>>31;m=((o<<5|o>>>27)+(s&l|s&p|l&p)|0)+((b+f|0)-1894007588|0)|0;f=p;p=l;l=s<<30|s>>>2;s=o;o=m;i[r>>2]=b}for(r=e+240|0;(r|0)<(e+320|0);r=r+4|0){b=(i[r-12>>2]^i[r-32>>2]^i[r-56>>2]^i[r-64>>2])<<1|(i[r-12>>2]^i[r-32>>2]^i[r-56>>2]^i[r-64>>2])>>>31;m=((o<<5|o>>>27)+(s^l^p)|0)+((b+f|0)-899497514|0)|0;f=p;p=l;l=s<<30|s>>>2;s=o;o=m;i[r>>2]=b}o=o+a|0;s=s+c|0;l=l+u|0;p=p+d|0;f=f+h|0}i[t+320>>2]=o;i[t+324>>2]=s;i[t+328>>2]=l;i[t+332>>2]=p;i[t+336>>2]=f}return{hash:r}}},function(e,t){var n=this,i=void 0;"undefined"!=typeof self&&void 0!==self.FileReaderSync&&(i=new self.FileReaderSync);var r=function(e,t,n,i,r,o){var a=void 0,s=o%4,c=(r+s)%4,l=r-c;switch(s){case 0:t[o]=e[i+3];case 1:t[o+1-(s<<1)|0]=e[i+2];case 2:t[o+2-(s<<1)|0]=e[i+1];case 3:t[o+3-(s<<1)|0]=e[i]}if(!(r>2|0]=e[i+a]<<24|e[i+a+1]<<16|e[i+a+2]<<8|e[i+a+3];switch(c){case 3:t[o+l+1|0]=e[i+l+2];case 2:t[o+l+2|0]=e[i+l+1];case 1:t[o+l+3|0]=e[i+l]}}};e.exports=function(e,t,o,a,s,c){if("string"==typeof e)return function(e,t,n,i,r,o){var a=void 0,s=o%4,c=(r+s)%4,l=r-c;switch(s){case 0:t[o]=e.charCodeAt(i+3);case 1:t[o+1-(s<<1)|0]=e.charCodeAt(i+2);case 2:t[o+2-(s<<1)|0]=e.charCodeAt(i+1);case 3:t[o+3-(s<<1)|0]=e.charCodeAt(i)}if(!(r>2]=e.charCodeAt(i+a)<<24|e.charCodeAt(i+a+1)<<16|e.charCodeAt(i+a+2)<<8|e.charCodeAt(i+a+3);switch(c){case 3:t[o+l+1|0]=e.charCodeAt(i+l+2);case 2:t[o+l+2|0]=e.charCodeAt(i+l+1);case 1:t[o+l+3|0]=e.charCodeAt(i+l)}}}(e,t,o,a,s,c);if(e instanceof Array)return r(e,t,o,a,s,c);if(n&&n.Buffer&&n.Buffer.isBuffer(e))return r(e,t,o,a,s,c);if(e instanceof ArrayBuffer)return r(new Uint8Array(e),t,o,a,s,c);if(e.buffer instanceof ArrayBuffer)return r(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),t,o,a,s,c);if(e instanceof Blob)return function(e,t,n,r,o,a){var s=void 0,c=a%4,l=(o+c)%4,u=o-l,p=new Uint8Array(i.readAsArrayBuffer(e.slice(r,r+o)));switch(c){case 0:t[a]=p[3];case 1:t[a+1-(c<<1)|0]=p[2];case 2:t[a+2-(c<<1)|0]=p[1];case 3:t[a+3-(c<<1)|0]=p[0]}if(!(o>2|0]=p[s]<<24|p[s+1]<<16|p[s+2]<<8|p[s+3];switch(l){case 3:t[a+u+1|0]=p[u+2];case 2:t[a+u+2|0]=p[u+1];case 1:t[a+u+3|0]=p[u]}}}(e,t,o,a,s,c);throw new Error("Unsupported data type.")}},function(e,t,n){var i=function(){function e(e,t){for(var n=0;n */ var i=e("buffer"),r=i.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=i:(o(i,n),n.Buffer=a),a.prototype=Object.create(r.prototype),o(r,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},{buffer:110}],357:[function(e,t,n){(function(n){(function(){"use strict";var i,r=e("buffer"),o=r.Buffer,a={};for(i in r)r.hasOwnProperty(i)&&"SlowBuffer"!==i&&"Buffer"!==i&&(a[i]=r[i]);var s=a.Buffer={};for(i in o)o.hasOwnProperty(i)&&"allocUnsafe"!==i&&"allocUnsafeSlow"!==i&&(s[i]=o[i]);if(a.Buffer.prototype=o.prototype,s.from&&s.from!==Uint8Array.from||(s.from=function(e,t,n){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return o(e,t,n)}),s.alloc||(s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var i=o(e);return t&&0!==t.length?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i}),!a.kStringMaxLength)try{a.kStringMaxLength=n.binding("buffer").kStringMaxLength}catch(e){}a.constants||(a.constants={MAX_LENGTH:a.kMaxLength},a.kStringMaxLength&&(a.constants.MAX_STRING_LENGTH=a.kStringMaxLength)),t.exports=a}).call(this)}).call(this,e("_process"))},{_process:309,buffer:110}],358:[function(e,t,n){"use strict";var i=e("get-intrinsic"),r=e("define-data-property"),o=e("has-property-descriptors")(),a=e("gopd"),s=i("%TypeError%"),c=i("%Math.floor%");t.exports=function(e,t){if("function"!=typeof e)throw new s("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||c(t)!==t)throw new s("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,l=!0;if("length"in e&&a){var u=a(e,"length");u&&!u.configurable&&(i=!1),u&&!u.writable&&(l=!1)}return(i||l||!n)&&(o?r(e,"length",t,!0,!0):r(e,"length",t)),e}},{"define-data-property":150,"get-intrinsic":190,gopd:191,"has-property-descriptors":192}],359:[function(e,t,n){var i=e("safe-buffer").Buffer;function r(e,t){this._block=i.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}r.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=i.from(e,t));for(var n=this._block,r=this._blockSize,o=e.length,a=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var i=(4294967295&n)>>>0,r=(n-i)/4294967296;this._block.writeUInt32BE(r,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},r.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=r},{"safe-buffer":356}],360:[function(e,t,n){(n=t.exports=function(e){e=e.toLowerCase();var t=n[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t}).sha=e("./sha"),n.sha1=e("./sha1"),n.sha224=e("./sha224"),n.sha256=e("./sha256"),n.sha384=e("./sha384"),n.sha512=e("./sha512")},{"./sha":361,"./sha1":362,"./sha224":363,"./sha256":364,"./sha384":365,"./sha512":366}],361:[function(e,t,n){var i=e("inherits"),r=e("./hash"),o=e("safe-buffer").Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function c(){this.init(),this._w=s,r.call(this,64,56)}function l(e){return e<<30|e>>>2}function u(e,t,n,i){return 0===e?t&n|~t&i:2===e?t&n|t&i|n&i:t^n^i}i(c,r),c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},c.prototype._update=function(e){for(var t,n=this._w,i=0|this._a,r=0|this._b,o=0|this._c,s=0|this._d,c=0|this._e,p=0;p<16;++p)n[p]=e.readInt32BE(4*p);for(;p<80;++p)n[p]=n[p-3]^n[p-8]^n[p-14]^n[p-16];for(var d=0;d<80;++d){var f=~~(d/20),h=0|((t=i)<<5|t>>>27)+u(f,r,o,s)+c+n[d]+a[f];c=s,s=o,o=l(r),r=i,i=h}this._a=i+this._a|0,this._b=r+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=c+this._e|0},c.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=c},{"./hash":359,inherits:229,"safe-buffer":356}],362:[function(e,t,n){var i=e("inherits"),r=e("./hash"),o=e("safe-buffer").Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function c(){this.init(),this._w=s,r.call(this,64,56)}function l(e){return e<<5|e>>>27}function u(e){return e<<30|e>>>2}function p(e,t,n,i){return 0===e?t&n|~t&i:2===e?t&n|t&i|n&i:t^n^i}i(c,r),c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},c.prototype._update=function(e){for(var t,n=this._w,i=0|this._a,r=0|this._b,o=0|this._c,s=0|this._d,c=0|this._e,d=0;d<16;++d)n[d]=e.readInt32BE(4*d);for(;d<80;++d)n[d]=(t=n[d-3]^n[d-8]^n[d-14]^n[d-16])<<1|t>>>31;for(var f=0;f<80;++f){var h=~~(f/20),m=l(i)+p(h,r,o,s)+c+n[f]+a[h]|0;c=s,s=o,o=u(r),r=i,i=m}this._a=i+this._a|0,this._b=r+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=c+this._e|0},c.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=c},{"./hash":359,inherits:229,"safe-buffer":356}],363:[function(e,t,n){var i=e("inherits"),r=e("./sha256"),o=e("./hash"),a=e("safe-buffer").Buffer,s=new Array(64);function c(){this.init(),this._w=s,o.call(this,64,56)}i(c,r),c.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},c.prototype._hash=function(){var e=a.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},t.exports=c},{"./hash":359,"./sha256":364,inherits:229,"safe-buffer":356}],364:[function(e,t,n){var i=e("inherits"),r=e("./hash"),o=e("safe-buffer").Buffer,a=[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],s=new Array(64);function c(){this.init(),this._w=s,r.call(this,64,56)}function l(e,t,n){return n^e&(t^n)}function u(e,t,n){return e&t|n&(e|t)}function p(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function d(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function f(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}i(c,r),c.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},c.prototype._update=function(e){for(var t,n=this._w,i=0|this._a,r=0|this._b,o=0|this._c,s=0|this._d,c=0|this._e,h=0|this._f,m=0|this._g,b=0|this._h,v=0;v<16;++v)n[v]=e.readInt32BE(4*v);for(;v<64;++v)n[v]=0|(((t=n[v-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+n[v-7]+f(n[v-15])+n[v-16];for(var g=0;g<64;++g){var y=b+d(c)+l(c,h,m)+a[g]+n[g]|0,x=p(i)+u(i,r,o)|0;b=m,m=h,h=c,c=s+y|0,s=o,o=r,r=i,i=y+x|0}this._a=i+this._a|0,this._b=r+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=c+this._e|0,this._f=h+this._f|0,this._g=m+this._g|0,this._h=b+this._h|0},c.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},t.exports=c},{"./hash":359,inherits:229,"safe-buffer":356}],365:[function(e,t,n){var i=e("inherits"),r=e("./sha512"),o=e("./hash"),a=e("safe-buffer").Buffer,s=new Array(160);function c(){this.init(),this._w=s,o.call(this,128,112)}i(c,r),c.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},c.prototype._hash=function(){var e=a.allocUnsafe(48);function t(t,n,i){e.writeInt32BE(t,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},t.exports=c},{"./hash":359,"./sha512":366,inherits:229,"safe-buffer":356}],366:[function(e,t,n){var i=e("inherits"),r=e("./hash"),o=e("safe-buffer").Buffer,a=[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],s=new Array(160);function c(){this.init(),this._w=s,r.call(this,128,112)}function l(e,t,n){return n^e&(t^n)}function u(e,t,n){return e&t|n&(e|t)}function p(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function d(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function f(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function h(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function m(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function b(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function v(e,t){return e>>>0>>0?1:0}i(c,r),c.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},c.prototype._update=function(e){for(var t=this._w,n=0|this._ah,i=0|this._bh,r=0|this._ch,o=0|this._dh,s=0|this._eh,c=0|this._fh,g=0|this._gh,y=0|this._hh,x=0|this._al,_=0|this._bl,w=0|this._cl,k=0|this._dl,S=0|this._el,E=0|this._fl,M=0|this._gl,A=0|this._hl,j=0;j<32;j+=2)t[j]=e.readInt32BE(4*j),t[j+1]=e.readInt32BE(4*j+4);for(;j<160;j+=2){var I=t[j-30],T=t[j-30+1],C=f(I,T),B=h(T,I),R=m(I=t[j-4],T=t[j-4+1]),O=b(T,I),P=t[j-14],L=t[j-14+1],U=t[j-32],q=t[j-32+1],N=B+L|0,D=C+P+v(N,B)|0;D=(D=D+R+v(N=N+O|0,O)|0)+U+v(N=N+q|0,q)|0,t[j]=D,t[j+1]=N}for(var z=0;z<160;z+=2){D=t[z],N=t[z+1];var H=u(n,i,r),F=u(x,_,w),W=p(n,x),V=p(x,n),K=d(s,S),$=d(S,s),G=a[z],X=a[z+1],Y=l(s,c,g),J=l(S,E,M),Z=A+$|0,Q=y+K+v(Z,A)|0;Q=(Q=(Q=Q+Y+v(Z=Z+J|0,J)|0)+G+v(Z=Z+X|0,X)|0)+D+v(Z=Z+N|0,N)|0;var ee=V+F|0,te=W+H+v(ee,V)|0;y=g,A=M,g=c,M=E,c=s,E=S,s=o+Q+v(S=k+Z|0,k)|0,o=r,k=w,r=i,w=_,i=n,_=x,n=Q+te+v(x=Z+ee|0,Z)|0}this._al=this._al+x|0,this._bl=this._bl+_|0,this._cl=this._cl+w|0,this._dl=this._dl+k|0,this._el=this._el+S|0,this._fl=this._fl+E|0,this._gl=this._gl+M|0,this._hl=this._hl+A|0,this._ah=this._ah+n+v(this._al,x)|0,this._bh=this._bh+i+v(this._bl,_)|0,this._ch=this._ch+r+v(this._cl,w)|0,this._dh=this._dh+o+v(this._dl,k)|0,this._eh=this._eh+s+v(this._el,S)|0,this._fh=this._fh+c+v(this._fl,E)|0,this._gh=this._gh+g+v(this._gl,M)|0,this._hh=this._hh+y+v(this._hl,A)|0},c.prototype._hash=function(){var e=o.allocUnsafe(64);function t(t,n,i){e.writeInt32BE(t,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},t.exports=c},{"./hash":359,inherits:229,"safe-buffer":356}],367:[function(e,t,n){"use strict";var i=e("get-intrinsic"),r=e("call-bind/callBound"),o=e("object-inspect"),a=i("%TypeError%"),s=i("%WeakMap%",!0),c=i("%Map%",!0),l=r("WeakMap.prototype.get",!0),u=r("WeakMap.prototype.set",!0),p=r("WeakMap.prototype.has",!0),d=r("Map.prototype.get",!0),f=r("Map.prototype.set",!0),h=r("Map.prototype.has",!0),m=function(e,t){for(var n,i=e;null!==(n=i.next);i=n)if(n.key===t)return i.next=n.next,n.next=e.next,e.next=n,n};t.exports=function(){var e,t,n,i={assert:function(e){if(!i.has(e))throw new a("Side channel does not contain "+o(e))},get:function(i){if(s&&i&&("object"==typeof i||"function"==typeof i)){if(e)return l(e,i)}else if(c){if(t)return d(t,i)}else if(n)return function(e,t){var n=m(e,t);return n&&n.value}(n,i)},has:function(i){if(s&&i&&("object"==typeof i||"function"==typeof i)){if(e)return p(e,i)}else if(c){if(t)return h(t,i)}else if(n)return function(e,t){return!!m(e,t)}(n,i);return!1},set:function(i,r){s&&i&&("object"==typeof i||"function"==typeof i)?(e||(e=new s),u(e,i,r)):c?(t||(t=new c),f(t,i,r)):(n||(n={key:{},next:null}),function(e,t,n){var i=m(e,t);i?i.value=n:e.next={key:t,next:e.next,value:n}}(n,i,r))}};return i}},{"call-bind/callBound":118,"get-intrinsic":190,"object-inspect":293}],368:[function(e,t,n){(function(e){(function(){ /*! simple-concat. MIT License. Feross Aboukhadijeh */ t.exports=function(t,n){var i=[];t.on("data",(function(e){i.push(e)})),t.once("end",(function(){n&&n(null,e.concat(i)),n=null})),t.once("error",(function(e){n&&n(e),n=null}))}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:110}],369:[function(e,t,n){(function(n){(function(){ /*! simple-get. MIT License. Feross Aboukhadijeh */ t.exports=p;const i=e("simple-concat"),r=e("decompress-response"),o=e("http"),a=e("https"),s=e("once"),c=e("querystring"),l=e("url"),u=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;function p(e,t){if(e=Object.assign({maxRedirects:10},"string"==typeof e?{url:e}:e),t=s(t),e.url){const{hostname:t,port:n,protocol:i,auth:r,path:o}=l.parse(e.url);delete e.url,t||n||i||r?Object.assign(e,{hostname:t,port:n,protocol:i,auth:r,path:o}):e.path=o}const i={"accept-encoding":"gzip, deflate"};let d;e.headers&&Object.keys(e.headers).forEach((t=>i[t.toLowerCase()]=e.headers[t])),e.headers=i,e.body?d=e.json&&!u(e.body)?JSON.stringify(e.body):e.body:e.form&&(d="string"==typeof e.form?e.form:c.stringify(e.form),e.headers["content-type"]="application/x-www-form-urlencoded"),d&&(e.method||(e.method="POST"),u(d)||(e.headers["content-length"]=n.byteLength(d)),e.json&&!e.form&&(e.headers["content-type"]="application/json")),delete e.body,delete e.form,e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const f=e.hostname,h=("https:"===e.protocol?a:o).request(e,(n=>{if(!1!==e.followRedirects&&n.statusCode>=300&&n.statusCode<400&&n.headers.location){e.url=n.headers.location,delete e.headers.host,n.resume();const i=l.parse(e.url).hostname;return null!==i&&i!==f&&(delete e.headers.cookie,delete e.headers.authorization),"POST"===e.method&&[301,302].includes(n.statusCode)&&(e.method="GET",delete e.headers["content-length"],delete e.headers["content-type"]),0==e.maxRedirects--?t(new Error("too many redirects")):p(e,t)}const i="function"==typeof r&&"HEAD"!==e.method;t(null,i?r(n):n)}));return h.on("timeout",(()=>{h.abort(),t(new Error("Request timed out"))})),h.on("error",t),u(d)?d.on("error",t).pipe(h):h.end(d),h}p.concat=(e,t)=>p(e,((n,r)=>{if(n)return t(n);i(r,((n,i)=>{if(n)return t(n);if(e.json)try{i=JSON.parse(i.toString())}catch(n){return t(n,r,i)}t(null,r,i)}))})),["get","post","put","patch","head","delete"].forEach((e=>{p[e]=(t,n)=>("string"==typeof t&&(t={url:t}),p(Object.assign({method:e.toUpperCase()},t),n))}))}).call(this)}).call(this,e("buffer").Buffer)},{buffer:110,"decompress-response":67,http:424,https:226,once:294,querystring:326,"simple-concat":368,url:457}],370:[function(e,t,n){ /*! simple-peer. MIT License. Feross Aboukhadijeh */ const i=e("debug")("simple-peer"),r=e("get-browser-rtc"),o=e("randombytes"),a=e("readable-stream"),s=e("queue-microtask"),c=e("err-code"),{Buffer:l}=e("buffer"),u=65536;function p(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}class d extends a.Duplex{constructor(e){if(super(e=Object.assign({allowHalfOpen:!1},e)),this._id=o(4).toString("hex").slice(0,7),this._debug("new peer %o",e),this.channelName=e.initiator?e.channelName||o(20).toString("hex"):null,this.initiator=e.initiator||!1,this.channelConfig=e.channelConfig||d.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},d.config,e.config),this.offerOptions=e.offerOptions||{},this.answerOptions=e.answerOptions||{},this.sdpTransform=e.sdpTransform||(e=>e),this.streams=e.streams||(e.stream?[e.stream]:[]),this.trickle=void 0===e.trickle||e.trickle,this.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,this.iceCompleteTimeout=e.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=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:r(),!this._wrtc)throw"undefined"==typeof window?c(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):c(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(e){return void this.destroy(c(e,"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=e=>{this._onIceCandidate(e)},"object"==typeof this._pc.peerIdentity&&this._pc.peerIdentity.catch((e=>{this.destroy(c(e,"ERR_PC_PEER_IDENTITY"))})),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=e=>{this._setupData(e)},this.streams&&this.streams.forEach((e=>{this.addStream(e)})),this._pc.ontrack=e=>{this._onTrack(e)},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(e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}this._debug("signal()"),e.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),e.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(e.candidate):this._pendingCandidates.push(e.candidate)),e.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(e)).then((()=>{this.destroyed||(this._pendingCandidates.forEach((e=>{this._addIceCandidate(e)})),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())})).catch((e=>{this.destroy(c(e,"ERR_SET_REMOTE_DESCRIPTION"))})),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||this.destroy(c(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(e){const t=new this._wrtc.RTCIceCandidate(e);this._pc.addIceCandidate(t).catch((e=>{var n;!t.address||t.address.endsWith(".local")?(n="Ignoring unsupported ICE candidate.",console.warn(n)):this.destroy(c(e,"ERR_ADD_ICE_CANDIDATE"))}))}send(e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(e)}}addTransceiver(e,t){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(e){this.destroy(c(e,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:e,init:t}})}}addStream(e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),e.getTracks().forEach((t=>{this.addTrack(t,e)}))}}addTrack(e,t){if(this.destroying)return;if(this.destroyed)throw c(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");const n=this._senderMap.get(e)||new Map;let i=n.get(t);if(i)throw i.removed?c(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):c(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED");i=this._pc.addTrack(e,t),n.set(t,i),this._senderMap.set(e,n),this._needsNegotiation()}replaceTrack(e,t,n){if(this.destroying)return;if(this.destroyed)throw c(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");const i=this._senderMap.get(e),r=i?i.get(n):null;if(!r)throw c(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");t&&this._senderMap.set(t,i),null!=r.replaceTrack?r.replaceTrack(t):this.destroy(c(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}removeTrack(e,t){if(this.destroying)return;if(this.destroyed)throw c(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");const n=this._senderMap.get(e),i=n?n.get(t):null;if(!i)throw c(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{i.removed=!0,this._pc.removeTrack(i)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?this._sendersAwaitingStable.push(i):this.destroy(c(e,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),e.getTracks().forEach((t=>{this.removeTrack(t,e)}))}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,s((()=>{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 c(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(e){this._destroy(e,(()=>{}))}_destroy(e,t){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",e&&(e.message||e)),s((()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",e&&(e.message||e)),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(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}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,e&&this.emit("error",e),this.emit("close"),t()})))}_setupData(e){if(!e.channel)return this.destroy(c(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=e.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=u),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 t=e.error instanceof Error?e.error:new Error(`Datachannel error: ${e.message} ${e.filename}:${e.lineno}:${e.colno}`);this.destroy(c(t,"ERR_DATA_CHANNEL"))};let t=!1;this._closingInterval=setInterval((()=>{this._channel&&"closing"===this._channel.readyState?(t&&this._onChannelClose(),t=!0):t=!1}),5e3)}_read(){}_write(e,t,n){if(this.destroyed)return n(c(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(e)}catch(e){return this.destroy(c(e,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>u?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n}_onFinish(){if(this.destroyed)return;const e=()=>{setTimeout((()=>this.destroy()),1e3)};this._connected?e():this.once("connect",e)}_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((e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=p(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(this.destroyed)return;const t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp})};this._pc.setLocalDescription(e).then((()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))})).catch((e=>{this.destroy(c(e,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((e=>{this.destroy(c(e,"ERR_CREATE_OFFER"))}))}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach((e=>{e.mid||!e.sender.track||e.requested||(e.requested=!0,this.addTransceiver(e.sender.track.kind))}))}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then((e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=p(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(this.destroyed)return;const t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp}),this.initiator||this._requestMissingTransceivers()};this._pc.setLocalDescription(e).then((()=>{this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))})).catch((e=>{this.destroy(c(e,"ERR_SET_LOCAL_DESCRIPTION"))}))})).catch((e=>{this.destroy(c(e,"ERR_CREATE_ANSWER"))}))}_onConnectionStateChange(){this.destroyed||"failed"===this._pc.connectionState&&this.destroy(c(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const e=this._pc.iceConnectionState,t=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",e,t),this.emit("iceStateChange",e,t),"connected"!==e&&"completed"!==e||(this._pcReady=!0,this._maybeReady()),"failed"===e&&this.destroy(c(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===e&&this.destroy(c(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(e){const t=e=>("[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach((t=>{Object.assign(e,t)})),e);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then((n=>{const i=[];n.forEach((e=>{i.push(t(e))})),e(null,i)}),(t=>e(t))):this._pc.getStats.length>0?this._pc.getStats((n=>{if(this.destroyed)return;const i=[];n.result().forEach((e=>{const n={};e.names().forEach((t=>{n[t]=e.stat(t)})),n.id=e.id,n.type=e.type,n.timestamp=e.timestamp,i.push(t(n))})),e(null,i)}),(t=>e(t))):e(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 e=()=>{this.destroyed||this.getStats(((t,n)=>{if(this.destroyed)return;t&&(n=[]);const i={},r={},o={};let a=!1;n.forEach((e=>{"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(i[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(r[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(o[e.id]=e)}));const s=e=>{a=!0;let t=r[e.localCandidateId];t&&(t.ip||t.address)?(this.localAddress=t.ip||t.address,this.localPort=Number(t.port)):t&&t.ipAddress?(this.localAddress=t.ipAddress,this.localPort=Number(t.portNumber)):"string"==typeof e.googLocalAddress&&(t=e.googLocalAddress.split(":"),this.localAddress=t[0],this.localPort=Number(t[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let n=i[e.remoteCandidateId];n&&(n.ip||n.address)?(this.remoteAddress=n.ip||n.address,this.remotePort=Number(n.port)):n&&n.ipAddress?(this.remoteAddress=n.ipAddress,this.remotePort=Number(n.portNumber)):"string"==typeof e.googRemoteAddress&&(n=e.googRemoteAddress.split(":"),this.remoteAddress=n[0],this.remotePort=Number(n[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(n.forEach((e=>{"transport"===e.type&&e.selectedCandidatePairId&&s(o[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&s(e)})),a||Object.keys(o).length&&!Object.keys(r).length){if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(t){return this.destroy(c(t,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const e=this._cb;this._cb=null,e(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(e,100)}))};e()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>u||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||("stable"===this._pc.signalingState&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach((e=>{this._pc.removeTrack(e),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(e){this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(e){if(this.destroyed)return;let t=e.data;t instanceof ArrayBuffer&&(t=l.from(t)),this.push(t)}_onChannelBufferedAmountLow(){if(this.destroyed||!this._cb)return;this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const e=this._cb;this._cb=null,e(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(e){this.destroyed||e.streams.forEach((t=>{this._debug("on track"),this.emit("track",e.track,t),this._remoteTracks.push({track:e.track,stream:t}),this._remoteStreams.some((e=>e.id===t.id))||(this._remoteStreams.push(t),s((()=>{this._debug("on stream"),this.emit("stream",t)})))}))}_debug(){const e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],i.apply(null,e)}}d.WEBRTC_SUPPORT=!!r(),d.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},d.channelConfig={},t.exports=d},{buffer:110,debug:148,"err-code":180,"get-browser-rtc":189,"queue-microtask":327,randombytes:330,"readable-stream":385}],371:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28}],372:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{"./_stream_readable":374,"./_stream_writable":376,_process:309,dup:29,inherits:229}],373:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{"./_stream_transform":375,dup:30,inherits:229}],374:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{"../errors":371,"./_stream_duplex":372,"./internal/streams/async_iterator":377,"./internal/streams/buffer_list":378,"./internal/streams/destroy":379,"./internal/streams/from":381,"./internal/streams/state":383,"./internal/streams/stream":384,_process:309,buffer:110,dup:31,events:181,inherits:229,"string_decoder/":447,util:67}],375:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{"../errors":371,"./_stream_duplex":372,dup:32,inherits:229}],376:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"../errors":371,"./_stream_duplex":372,"./internal/streams/destroy":379,"./internal/streams/state":383,"./internal/streams/stream":384,_process:309,buffer:110,dup:33,inherits:229,"util-deprecate":459}],377:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"./end-of-stream":380,_process:309,dup:34}],378:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{buffer:110,dup:35,util:67}],379:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{_process:309,dup:36}],380:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{"../../../errors":371,dup:37}],381:[function(e,t,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],382:[function(e,t,n){arguments[4][39][0].apply(n,arguments)},{"../../../errors":371,"./end-of-stream":380,dup:39}],383:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{"../../../errors":371,dup:40}],384:[function(e,t,n){arguments[4][41][0].apply(n,arguments)},{dup:41,events:181}],385:[function(e,t,n){arguments[4][42][0].apply(n,arguments)},{"./lib/_stream_duplex.js":372,"./lib/_stream_passthrough.js":373,"./lib/_stream_readable.js":374,"./lib/_stream_transform.js":375,"./lib/_stream_writable.js":376,"./lib/internal/streams/end-of-stream.js":380,"./lib/internal/streams/pipeline.js":382,dup:42}],386:[function(e,t,n){const i=e("rusha"),r=e("./rusha-worker-sha1"),o=new i,a="undefined"!=typeof window?window:self,s=a.crypto||a.msCrypto||{};let c=s.subtle||s.webkitSubtle;function l(e){return o.digest(e)}try{c.digest({name:"sha-1"},new Uint8Array).catch((function(){c=!1}))}catch(e){c=!1}t.exports=function(e,t){c?("string"==typeof e&&(e=function(e){const t=e.length,n=new Uint8Array(t);for(let i=0;i>>4).toString(16)),n.push((15&t).toString(16))}return n.join("")}(new Uint8Array(e)))}),(function(){t(l(e))}))):"undefined"!=typeof window?r(e,(function(n,i){t(n?l(e):i)})):queueMicrotask((()=>t(l(e))))},t.exports.sync=l},{"./rusha-worker-sha1":387,rusha:355}],387:[function(e,t,n){const i=e("rusha");let r,o,a;t.exports=function(e,t){r||(r=i.createWorker(),o=1,a={},r.onmessage=function(e){const t=e.data.id,n=a[t];delete a[t],null!=e.data.error?n(new Error("Rusha worker error: "+e.data.error)):n(null,e.data.hash)}),a[o]=t,r.postMessage({id:o,data:e}),o+=1}},{rusha:355}],388:[function(e,t,n){(function(n){(function(){ /*! simple-websocket. MIT License. Feross Aboukhadijeh */ const i=e("debug")("simple-websocket"),r=e("randombytes"),o=e("readable-stream"),a=e("queue-microtask"),s=e("ws"),c="function"!=typeof s?WebSocket:s;class l extends o.Duplex{constructor(e={}){if("string"==typeof e&&(e={url:e}),super(e=Object.assign({allowHalfOpen:!1},e)),null==e.url&&null==e.socket)throw new Error("Missing required `url` or `socket` option");if(null!=e.url&&null!=e.socket)throw new Error("Must specify either `url` or `socket` option, not both");if(this._id=r(4).toString("hex").slice(0,7),this._debug("new websocket: %o",e),this.connected=!1,this.destroyed=!1,this._chunk=null,this._cb=null,this._interval=null,e.socket)this.url=e.socket.url,this._ws=e.socket,this.connected=e.socket.readyState===c.OPEN;else{this.url=e.url;try{this._ws="function"==typeof s?new c(e.url,null,{...e,encoding:void 0}):new c(e.url)}catch(e){return void a((()=>this.destroy(e)))}}this._ws.binaryType="arraybuffer",e.socket&&this.connected?a((()=>this._handleOpen())):this._ws.onopen=()=>this._handleOpen(),this._ws.onmessage=e=>this._handleMessage(e),this._ws.onclose=()=>this._handleClose(),this._ws.onerror=e=>this._handleError(e),this._handleFinishBound=()=>this._handleFinish(),this.once("finish",this._handleFinishBound)}send(e){this._ws.send(e)}destroy(e){this._destroy(e,(()=>{}))}_destroy(e,t){if(!this.destroyed){if(this._debug("destroy (error: %s)",e&&(e.message||e)),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 t=this._ws,n=()=>{t.onclose=null};if(t.readyState===c.CLOSED)n();else try{t.onclose=n,t.close()}catch(e){n()}t.onopen=null,t.onmessage=null,t.onerror=()=>{}}this._ws=null,e&&this.emit("error",e),this.emit("close"),t()}}_read(){}_write(e,t,n){if(this.destroyed)return n(new Error("cannot write after socket is destroyed"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(e)}"function"!=typeof s&&this._ws.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._ws.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n}_handleOpen(){if(!this.connected&&!this.destroyed){if(this.connected=!0,this._chunk){try{this.send(this._chunk)}catch(e){return this.destroy(e)}this._chunk=null,this._debug('sent chunk from "write before connect"');const e=this._cb;this._cb=null,e(null)}"function"!=typeof s&&(this._interval=setInterval((()=>this._onInterval()),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}}_handleMessage(e){if(this.destroyed)return;let t=e.data;t instanceof ArrayBuffer&&(t=n.from(t)),this.push(t)}_handleClose(){this.destroyed||(this._debug("on close"),this.destroy())}_handleError(e){this.destroy(new Error(`Error connecting to ${this.url}`))}_handleFinish(){if(this.destroyed)return;const e=()=>{setTimeout((()=>this.destroy()),1e3)};this.connected?e():this.once("connect",e)}_onInterval(){if(!this._cb||!this._ws||this._ws.bufferedAmount>65536)return;this._debug("ending backpressure: bufferedAmount %d",this._ws.bufferedAmount);const e=this._cb;this._cb=null,e(null)}_debug(){const e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],i.apply(null,e)}}l.WEBSOCKET_SUPPORT=!!c,t.exports=l}).call(this)}).call(this,e("buffer").Buffer)},{buffer:110,debug:148,"queue-microtask":327,randombytes:330,"readable-stream":403,ws:67}],389:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28}],390:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{"./_stream_readable":392,"./_stream_writable":394,_process:309,dup:29,inherits:229}],391:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{"./_stream_transform":393,dup:30,inherits:229}],392:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{"../errors":389,"./_stream_duplex":390,"./internal/streams/async_iterator":395,"./internal/streams/buffer_list":396,"./internal/streams/destroy":397,"./internal/streams/from":399,"./internal/streams/state":401,"./internal/streams/stream":402,_process:309,buffer:110,dup:31,events:181,inherits:229,"string_decoder/":447,util:67}],393:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{"../errors":389,"./_stream_duplex":390,dup:32,inherits:229}],394:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"../errors":389,"./_stream_duplex":390,"./internal/streams/destroy":397,"./internal/streams/state":401,"./internal/streams/stream":402,_process:309,buffer:110,dup:33,inherits:229,"util-deprecate":459}],395:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"./end-of-stream":398,_process:309,dup:34}],396:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{buffer:110,dup:35,util:67}],397:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{_process:309,dup:36}],398:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{"../../../errors":389,dup:37}],399:[function(e,t,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],400:[function(e,t,n){arguments[4][39][0].apply(n,arguments)},{"../../../errors":389,"./end-of-stream":398,dup:39}],401:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{"../../../errors":389,dup:40}],402:[function(e,t,n){arguments[4][41][0].apply(n,arguments)},{dup:41,events:181}],403:[function(e,t,n){arguments[4][42][0].apply(n,arguments)},{"./lib/_stream_duplex.js":390,"./lib/_stream_passthrough.js":391,"./lib/_stream_readable.js":392,"./lib/_stream_transform.js":393,"./lib/_stream_writable.js":394,"./lib/internal/streams/end-of-stream.js":398,"./lib/internal/streams/pipeline.js":400,dup:42}],404:[function(e,t,n){const i=e("./lib/throttle"),r=e("./lib/throttle-group");t.exports={Throttle:i,ThrottleGroup:r}},{"./lib/throttle":406,"./lib/throttle-group":405}],405:[function(e,t,n){const{TokenBucket:i}=e("limiter"),r=e("./throttle");t.exports=class{constructor(e={}){if("object"!=typeof e)throw new Error("Options must be an object");this.throttles=[],this.setEnabled(e.enabled),this.setRate(e.rate,e.chunksize)}getEnabled(){return this._enabled}getRate(){return this.bucket.tokensPerInterval}getChunksize(){return this.chunksize}setEnabled(e=!0){if("boolean"!=typeof e)throw new Error("Enabled must be a boolean");this._enabled=e;for(const t of this.throttles)t.setEnabled(e)}setRate(e,t=null){if(!Number.isInteger(e)||e<0)throw new Error("Rate must be an integer bigger than zero");if(e=parseInt(e),t&&("number"!=typeof t||t<=0))throw new Error("Chunksize must be bigger than zero");if(t=t||Math.max(parseInt(e/10),1),t=parseInt(t),e>0&&t>e)throw new Error("Chunk size must be smaller than rate");this.bucket||(this.bucket=new i(e,e,"second",null)),this.bucket.bucketSize=e,this.bucket.tokensPerInterval=e,this.chunksize=t}setChunksize(e){if(!Number.isInteger(e)||e<=0)throw new Error("Chunk size must be an integer bigger than zero");const t=this.getRate();if(e=parseInt(e),t>0&&e>t)throw new Error("Chunk size must be smaller than rate");this.chunksize=e}throttle(e={}){if("object"!=typeof e)throw new Error("Options must be an object");return new r({...e,group:this})}destroy(){for(const e of this.throttles)e.destroy();this.throttles=[]}_addThrottle(e){if(!(e instanceof r))throw new Error("Throttle must be an instance of Throttle");this.throttles.push(e)}_removeThrottle(e){const t=this.throttles.indexOf(e);t>-1&&this.throttles.splice(t,1)}}},{"./throttle":406,limiter:234}],406:[function(e,t,n){const{EventEmitter:i}=e("events"),{Transform:r}=e("streamx"),{wait:o}=e("./utils");t.exports=class extends r{constructor(e={}){if(super(),"object"!=typeof e)throw new Error("Options must be an object");const t=Object.assign({},e);if(t.group&&!(t.group instanceof a))throw new Error("Group must be an instanece of ThrottleGroup");t.group||(t.group=new a(t)),this._setEnabled(t.enabled||t.group.enabled),this._group=t.group,this._emitter=new i,this._destroyed=!1,this._group._addThrottle(this)}getEnabled(){return this._enabled}getGroup(){return this._group}_setEnabled(e=!0){if("boolean"!=typeof e)throw new Error("Enabled must be a boolean");this._enabled=e}setEnabled(e){this._setEnabled(e),this._enabled?this._emitter.emit("enabled"):this._emitter.emit("disabled")}_transform(e,t){this._processChunk(e,t)}async _waitForTokens(e){return new Promise(((t,n)=>{let i=!1;const r=this;function o(e){if(r._emitter.removeListener("disabled",o),r._emitter.removeListener("destroyed",o),!i){if(i=!0,e)return n(e);t()}}this._emitter.once("disabled",o),this._emitter.once("destroyed",o),this._group.bucket.removeTokens(e,o)}))}_areBothEnabled(){return this._enabled&&this._group.getEnabled()}async _processChunk(e,t){if(!this._areBothEnabled())return t(null,e);let n=0,i=this._group.getChunksize(),r=e.slice(n,n+i);for(;r.length>0;){if(this._areBothEnabled())try{for(;0===this._group.getRate()&&!this._destroyed&&this._areBothEnabled();)if(await o(1e3),this._destroyed)return;if(this._areBothEnabled()&&!this._group.bucket.tryRemoveTokens(r.length)&&(await this._waitForTokens(r.length),this._destroyed))return}catch(e){return t(e)}this.push(r),n+=i,i=this._areBothEnabled()?this._group.getChunksize():e.length-n,r=e.slice(n,n+i)}return t()}destroy(...e){this._group._removeThrottle(this),this._destroyed=!0,this._emitter.emit("destroyed"),super.destroy(...e)}};const a=e("./throttle-group")},{"./throttle-group":405,"./utils":407,events:181,streamx:446}],407:[function(e,t,n){t.exports={wait:function(e){return new Promise((t=>setTimeout(t,e)))}}},{}],408:[function(e,t,n){var i,r=1,o=65535,a=function(){r=r+1&o};t.exports=function(e){i||(i=setInterval(a,250)).unref&&i.unref();var t=4*(e||5),n=[0],s=1,c=r-1&o;return function(e){var i=r-c&o;for(i>t&&(i=t),c=r;i--;)s===t&&(s=0),n[s]=n[0===s?t-1:s-1],s++;e&&(n[s-1]+=e);var a=n[s-1],l=n.lengtht._pos){var a=o.substr(t._pos);if("x-user-defined"===t._charset){for(var s=r.alloc(a.length),l=0;lt._pos&&(t.push(r.from(new Uint8Array(u.result.slice(t._pos)))),t._pos=u.result.byteLength)},u.onload=function(){e(!0),t.push(null)},u.readAsArrayBuffer(o)}t._xhr.readyState===c.DONE&&"ms-stream"!==t._mode&&(e(!0),t.push(null))}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"./capability":425,_process:309,buffer:110,inherits:229,"readable-stream":442}],428:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28}],429:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{"./_stream_readable":431,"./_stream_writable":433,_process:309,dup:29,inherits:229}],430:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{"./_stream_transform":432,dup:30,inherits:229}],431:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{"../errors":428,"./_stream_duplex":429,"./internal/streams/async_iterator":434,"./internal/streams/buffer_list":435,"./internal/streams/destroy":436,"./internal/streams/from":438,"./internal/streams/state":440,"./internal/streams/stream":441,_process:309,buffer:110,dup:31,events:181,inherits:229,"string_decoder/":447,util:67}],432:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{"../errors":428,"./_stream_duplex":429,dup:32,inherits:229}],433:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"../errors":428,"./_stream_duplex":429,"./internal/streams/destroy":436,"./internal/streams/state":440,"./internal/streams/stream":441,_process:309,buffer:110,dup:33,inherits:229,"util-deprecate":459}],434:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"./end-of-stream":437,_process:309,dup:34}],435:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{buffer:110,dup:35,util:67}],436:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{_process:309,dup:36}],437:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{"../../../errors":428,dup:37}],438:[function(e,t,n){arguments[4][38][0].apply(n,arguments)},{dup:38}],439:[function(e,t,n){arguments[4][39][0].apply(n,arguments)},{"../../../errors":428,"./end-of-stream":437,dup:39}],440:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{"../../../errors":428,dup:40}],441:[function(e,t,n){arguments[4][41][0].apply(n,arguments)},{dup:41,events:181}],442:[function(e,t,n){arguments[4][42][0].apply(n,arguments)},{"./lib/_stream_duplex.js":429,"./lib/_stream_passthrough.js":430,"./lib/_stream_readable.js":431,"./lib/_stream_transform.js":432,"./lib/_stream_writable.js":433,"./lib/internal/streams/end-of-stream.js":437,"./lib/internal/streams/pipeline.js":439,dup:42}],443:[function(e,t,n){ /*! stream-to-blob-url. MIT License. Feross Aboukhadijeh */ t.exports=async function(e,t){const n=await i(e,t);return URL.createObjectURL(n)};const i=e("stream-to-blob")},{"stream-to-blob":444}],444:[function(e,t,n){ /*! stream-to-blob. MIT License. Feross Aboukhadijeh */ t.exports=function(e,t){if(null!=t&&"string"!=typeof t)throw new Error("Invalid mimetype, expected string.");return new Promise(((n,i)=>{const r=[];e.on("data",(e=>r.push(e))).once("end",(()=>{const e=null!=t?new Blob(r,{type:t}):new Blob(r);n(e)})).once("error",i)}))}},{}],445:[function(e,t,n){(function(n){(function(){ /*! stream-with-known-length-to-buffer. MIT License. Feross Aboukhadijeh */ var i=e("once");t.exports=function(e,t,r){r=i(r);var o=n.alloc(t),a=0;e.on("data",(function(e){e.copy(o,a),a+=e.length})).on("end",(function(){r(null,o)})).on("error",r)}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:110,once:294}],446:[function(e,t,n){const{EventEmitter:i}=e("events"),r=new Error("Stream was destroyed"),o=new Error("Premature close"),a=e("queue-tick"),s=e("fast-fifo"),c=134217727,l=1^c,u=64,p=128,d=256,f=1024,h=2048,m=4096,b=8192,v=16384,g=32768,y=768^c,x=134184959,_=1<<17,w=2<<17,k=4<<17,S=8<<17,E=16<<17,M=32<<17,A=64<<17,j=128<<17,I=256<<17,T=512<<17,C=100532223,B=133693439,R=117440511,O=131088,P=134086639,L=4210688,U=14,q=15,N=4210702,D=16809984,z=16809999,H=1179648,F=1179663,W=Symbol.asyncIterator||Symbol("asyncIterator");class V{constructor(e,{highWaterMark:t=16384,map:n=null,mapWritable:i,byteLength:r,byteLengthWritable:o}={}){this.stream=e,this.queue=new s,this.highWaterMark=t,this.buffered=0,this.error=null,this.pipeline=null,this.drains=null,this.byteLength=o||r||fe,this.map=i||n,this.afterWrite=Z.bind(this),this.afterUpdateNextTick=te.bind(this)}get ended(){return 0!=(this.stream._duplexState&M)}push(e){return null!==this.map&&(e=this.map(e)),this.buffered+=this.byteLength(e),this.queue.push(e),this.buffered0;)t.push(this.shift());for(let e=0;e0;)i.drains.shift().resolve(!1);null!==i.pipeline&&i.pipeline.done(t,e)}}function Z(e){const t=this.stream;e&&t.destroy(e),t._duplexState&=C,null!==this.drains&&function(e){for(let t=0;t=e._readableState.highWaterMark}static isPaused(e){return 0==(e._duplexState&d)}[W](){const e=this;let t=null,n=null,i=null;return this.on("error",(e=>{t=e})),this.on("readable",(function(){null!==n&&o(e.read())})),this.on("close",(function(){null!==n&&o(null)})),{[W](){return this},next:()=>new Promise((function(t,r){n=t,i=r;const a=e.read();null!==a?o(a):0!=(8&e._duplexState)&&o(null)})),return:()=>a(null),throw:e=>a(e)};function o(o){null!==i&&(t?i(t):null===o&&0==(e._duplexState&v)?i(r):n({value:o,done:null===o}),i=n=null)}function a(t){return e.destroy(t),new Promise(((n,i)=>{if(8&e._duplexState)return n({value:void 0,done:!0});e.once("close",(function(){t?i(t):n({value:void 0,done:!0})}))}))}}}class ae extends re{constructor(e){super(e),this._duplexState|=16385,this._writableState=new V(this,e),e&&(e.writev&&(this._writev=e.writev),e.write&&(this._write=e.write),e.final&&(this._final=e.final),e.eagerOpen&&this._writableState.updateNextTick())}_writev(e,t){t(null)}_write(e,t){this._writableState.autoBatch(e,t)}_final(e){e(null)}static isBackpressured(e){return 0!=(73400334&e._duplexState)}static drained(e){if(e.destroyed)return Promise.resolve(!1);const t=e._writableState;var n;const i=((n=e)._writev!==ae.prototype._writev&&n._writev!==se.prototype._writev?Math.min(1,t.queue.length):t.queue.length)+(e._duplexState&I?1:0);return 0===i?Promise.resolve(!0):(null===t.drains&&(t.drains=[]),new Promise((e=>{t.drains.push({writes:i,resolve:e})})))}write(e){return this._writableState.updateNextTick(),this._writableState.push(e)}end(e){return this._writableState.updateNextTick(),this._writableState.end(e),this}}class se extends oe{constructor(e){super(e),this._duplexState=1,this._writableState=new V(this,e),e&&(e.writev&&(this._writev=e.writev),e.write&&(this._write=e.write),e.final&&(this._final=e.final))}_writev(e,t){t(null)}_write(e,t){this._writableState.autoBatch(e,t)}_final(e){e(null)}write(e){return this._writableState.updateNextTick(),this._writableState.push(e)}end(e){return this._writableState.updateNextTick(),this._writableState.end(e),this}}class ce extends se{constructor(e){super(e),this._transformState=new $(this),e&&(e.transform&&(this._transform=e.transform),e.flush&&(this._flush=e.flush))}_write(e,t){this._readableState.buffered>=this._readableState.highWaterMark?this._transformState.data=e:this._transform(e,this._transformState.afterTransform)}_read(e){if(null!==this._transformState.data){const t=this._transformState.data;this._transformState.data=null,e(null),this._transform(t,this._transformState.afterTransform)}else e(null)}destroy(e){super.destroy(e),null!==this._transformState.data&&(this._transformState.data=null,this._transformState.afterTransform())}_transform(e,t){t(null,e)}_flush(e){e(null)}_final(e){this._transformState.afterFinal=e,this._flush(le.bind(this))}}function le(e,t){const n=this._transformState.afterFinal;if(e)return n(e);null!=t&&this.push(t),this.push(null),n(null)}function ue(e,...t){const n=Array.isArray(e)?[...e,...t]:[e,...t],i=n.length&&"function"==typeof n[n.length-1]?n.pop():null;if(n.length<2)throw new Error("Pipeline requires at least 2 streams");let r=n[0],a=null,s=null;for(let e=1;e1,l),r.pipe(a)),r=a;if(i){let e=!1;const t=de(a)||!(!a._writableState||!a._writableState.autoDestroy);a.on("error",(e=>{null===s&&(s=e)})),a.on("finish",(()=>{e=!0,t||i(s)})),t&&a.on("close",(()=>i(s||(e?null:o))))}return a;function c(e,t,n,i){e.on("error",i),e.on("close",(function(){if(t&&e._readableState&&!e._readableState.ended)return i(o);if(n&&e._writableState&&!e._writableState.ended)return i(o)}))}function l(e){if(e&&!s){s=e;for(const t of n)t.destroy(e)}}}function pe(e){return!!e._readableState||!!e._writableState}function de(e){return"number"==typeof e._duplexState&&pe(e)}function fe(e){return function(e){return"object"==typeof e&&null!==e&&"number"==typeof e.byteLength}(e)?e.byteLength:1024}function he(){}function me(){this.destroy(new Error("Stream aborted."))}t.exports={pipeline:ue,pipelinePromise:function(...e){return new Promise(((t,n)=>ue(...e,(e=>{if(e)return n(e);t()}))))},isStream:pe,isStreamx:de,getStreamError:function(e){const t=e._readableState&&e._readableState.error||e._writableState&&e._writableState.error;return t===r?null:t},Stream:re,Writable:ae,Readable:oe,Duplex:se,Transform:ce,PassThrough:class extends ce{}}},{events:181,"fast-fifo":185,"queue-tick":328}],447:[function(e,t,n){"use strict";var i=e("safe-buffer").Buffer,r=i.isEncoding||function(e){switch((e=""+e)&&e.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}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(i.isEncoding===r||!r(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=l,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=u,this.end=p,t=3;break;default:return this.write=d,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function u(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function d(e){return e.toString(this.encoding)}function f(e){return e&&e.length?this.write(e):""}n.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return r>0&&(e.lastNeed=r-1),r;if(--i=0)return r>0&&(e.lastNeed=r-2),r;if(--i=0)return r>0&&(2===r?r=0:e.lastNeed=r-3),r;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":356}],448:[function(e,t,n){var i=e("./thirty-two");n.encode=i.encode,n.decode=i.decode},{"./thirty-two":449}],449:[function(e,t,n){(function(e){(function(){"use strict";var t=[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];n.encode=function(t){e.isBuffer(t)||(t=new e(t));for(var n,i,r=0,o=0,a=0,s=0,c=new e(8*(n=t,i=Math.floor(n.length/5),n.length%5==0?i:i+1));r3?(s=(s=l&255>>a)<<(a=(a+5)%8)|(r+1>8-a,r++):(s=l>>8-(a+5)&31,0===(a=(a+5)%8)&&r++),c[o]="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".charCodeAt(s),o++}for(r=o;r>>(r=(r+5)%8),s[a]=i,a++,i=255&o<<8-r)}return s.slice(0,a)}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:110}],450:[function(e,t,n){function i(e){return(+Date.now()-e)/100&65535}t.exports=function(e){const t=+Date.now(),n=10*(e||5),r=[0];let o=1,a=i(t)-1&65535;return function(e){const s=i(t);let c=s-a&65535;for(c>n&&(c=n),a=s;c--;)o===n&&(o=0),r[o]=r[0===o?n-1:o-1],o++;e&&(r[o-1]+=e);const l=r[o-1],u=r.length-1}function d(e,t){return"function"==typeof e?e.apply(void 0,t):e}function f(e,t){return 0===t?e:function(i){clearTimeout(n),n=setTimeout((function(){e(i)}),t)};var n}function h(e,t){var n=Object.assign({},e);return t.forEach((function(e){delete n[e]})),n}function m(e){return[].concat(e)}function b(e,t){-1===e.indexOf(t)&&e.push(t)}function v(e){return e.split("-")[0]}function g(e){return[].slice.call(e)}function y(e){return Object.keys(e).reduce((function(t,n){return void 0!==e[n]&&(t[n]=e[n]),t}),{})}function x(){return document.createElement("div")}function _(e){return["Element","Fragment"].some((function(t){return p(e,t)}))}function w(e){return p(e,"MouseEvent")}function k(e){return!(!e||!e._tippy||e._tippy.reference!==e)}function S(e){return _(e)?[e]:function(e){return p(e,"NodeList")}(e)?g(e):Array.isArray(e)?e:g(document.querySelectorAll(e))}function E(e,t){e.forEach((function(e){e&&(e.style.transitionDuration=t+"ms")}))}function M(e,t){e.forEach((function(e){e&&e.setAttribute("data-state",t)}))}function A(e){var t,n=m(e)[0];return null!=n&&null!=(t=n.ownerDocument)&&t.body?n.ownerDocument:document}function j(e,t,n){var i=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(t){e[i](t,n)}))}function I(e,t){for(var n=t;n;){var i;if(e.contains(n))return!0;n=null==n.getRootNode||null==(i=n.getRootNode())?void 0:i.host}return!1}var T={isTouch:!1},C=0;function B(){T.isTouch||(T.isTouch=!0,window.performance&&document.addEventListener("mousemove",R))}function R(){var e=performance.now();e-C<20&&(T.isTouch=!1,document.removeEventListener("mousemove",R)),C=e}function O(){var e=document.activeElement;if(k(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}var P,L=!!("undefined"!=typeof window&&"undefined"!=typeof document)&&!!window.msCrypto;function U(e){return[e+"() was called on a"+("destroy"===e?"n already-":" ")+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function q(e){return e.replace(/[ \t]{2,}/g," ").replace(/^[ \t]*/gm,"").trim()}function N(e){return q("\n %ctippy.js\n\n %c"+q(e)+"\n\n %c👷‍ This is a development-only message. It will be removed in production.\n ")}function D(e){return[N(e),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}function z(e,t){var n;e&&!P.has(t)&&(P.add(t),(n=console).warn.apply(n,D(t)))}function H(e,t){var n;e&&!P.has(t)&&(P.add(t),(n=console).error.apply(n,D(t)))}"production"!==t.env.NODE_ENV&&(P=new Set);var F={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},W=Object.assign({appendTo:l,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},F,{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),V=Object.keys(W);function K(e){var t=(e.plugins||[]).reduce((function(t,n){var i,r=n.name,o=n.defaultValue;r&&(t[r]=void 0!==e[r]?e[r]:null!=(i=W[r])?i:o);return t}),{});return Object.assign({},e,t)}function $(e,t){var n=Object.assign({},t,{content:d(t.content,[e])},t.ignoreAttributes?{}:function(e,t){return(t?Object.keys(K(Object.assign({},W,{plugins:t}))):V).reduce((function(t,n){var i=(e.getAttribute("data-tippy-"+n)||"").trim();if(!i)return t;if("content"===n)t[n]=i;else try{t[n]=JSON.parse(i)}catch(e){t[n]=i}return t}),{})}(e,t.plugins));return n.aria=Object.assign({},W.aria,n.aria),n.aria={expanded:"auto"===n.aria.expanded?t.interactive:n.aria.expanded,content:"auto"===n.aria.content?t.interactive?null:"describedby":n.aria.content},n}function G(e,t){void 0===e&&(e={}),void 0===t&&(t=[]),Object.keys(e).forEach((function(e){var n,i,r=h(W,Object.keys(F)),o=(n=r,i=e,!{}.hasOwnProperty.call(n,i));o&&(o=0===t.filter((function(t){return t.name===e})).length),z(o,["`"+e+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.","\n\n","All props: https://atomiks.github.io/tippyjs/v6/all-props/\n","Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))}))}var X=function(){return"innerHTML"};function Y(e,t){e[X()]=t}function J(e){var t=x();return!0===e?t.className=a:(t.className=s,_(e)?t.appendChild(e):Y(t,e)),t}function Z(e,t){_(t.content)?(Y(e,""),e.appendChild(t.content)):"function"!=typeof t.content&&(t.allowHTML?Y(e,t.content):e.textContent=t.content)}function Q(e){var t=e.firstElementChild,n=g(t.children);return{box:t,content:n.find((function(e){return e.classList.contains(r)})),arrow:n.find((function(e){return e.classList.contains(a)||e.classList.contains(s)})),backdrop:n.find((function(e){return e.classList.contains(o)}))}}function ee(e){var t=x(),n=x();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var i=x();function o(n,i){var r=Q(t),o=r.box,a=r.content,s=r.arrow;i.theme?o.setAttribute("data-theme",i.theme):o.removeAttribute("data-theme"),"string"==typeof i.animation?o.setAttribute("data-animation",i.animation):o.removeAttribute("data-animation"),i.inertia?o.setAttribute("data-inertia",""):o.removeAttribute("data-inertia"),o.style.maxWidth="number"==typeof i.maxWidth?i.maxWidth+"px":i.maxWidth,i.role?o.setAttribute("role",i.role):o.removeAttribute("role"),n.content===i.content&&n.allowHTML===i.allowHTML||Z(a,e.props),i.arrow?s?n.arrow!==i.arrow&&(o.removeChild(s),o.appendChild(J(i.arrow))):o.appendChild(J(i.arrow)):s&&o.removeChild(s)}return i.className=r,i.setAttribute("data-state","hidden"),Z(i,e.props),t.appendChild(n),n.appendChild(i),o(e.props,e.props),{popper:t,onUpdate:o}}ee.$$tippy=!0;var te=1,ne=[],ie=[];function re(e,n){var r,o,a,s,p,h,_,k,S=$(e,Object.assign({},W,K(y(n)))),C=!1,B=!1,R=!1,O=!1,P=[],q=f(Se,S.interactiveDebounce),N=te++,D=(k=S.plugins).filter((function(e,t){return k.indexOf(e)===t})),F={id:N,reference:e,popper:x(),popperInstance:null,props:S,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:D,clearDelayTimeouts:function(){clearTimeout(r),clearTimeout(o),cancelAnimationFrame(a)},setProps:function(n){"production"!==t.env.NODE_ENV&&z(F.state.isDestroyed,U("setProps"));if(F.state.isDestroyed)return;ue("onBeforeUpdate",[F,n]),we();var i=F.props,r=$(e,Object.assign({},i,y(n),{ignoreAttributes:!0}));F.props=r,_e(),i.interactiveDebounce!==r.interactiveDebounce&&(fe(),q=f(Se,r.interactiveDebounce));i.triggerTarget&&!r.triggerTarget?m(i.triggerTarget).forEach((function(e){e.removeAttribute("aria-expanded")})):r.triggerTarget&&e.removeAttribute("aria-expanded");de(),le(),X&&X(i,r);F.popperInstance&&(je(),Te().forEach((function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)})));ue("onAfterUpdate",[F,n])},setContent:function(e){F.setProps({content:e})},show:function(){"production"!==t.env.NODE_ENV&&z(F.state.isDestroyed,U("show"));var e=F.state.isVisible,n=F.state.isDestroyed,i=!F.state.isEnabled,r=T.isTouch&&!F.props.touch,o=u(F.props.duration,0,W.duration);if(e||n||i||r)return;if(oe().hasAttribute("disabled"))return;if(ue("onShow",[F],!1),!1===F.props.onShow(F))return;F.state.isVisible=!0,re()&&(G.style.visibility="visible");le(),ve(),F.state.isMounted||(G.style.transition="none");if(re()){var a=se();E([a.box,a.content],0)}h=function(){var e;if(F.state.isVisible&&!O){if(O=!0,G.offsetHeight,G.style.transition=F.props.moveTransition,re()&&F.props.animation){var t=se(),n=t.box,i=t.content;E([n,i],o),M([n,i],"visible")}pe(),de(),b(ie,F),null==(e=F.popperInstance)||e.forceUpdate(),ue("onMount",[F]),F.props.animation&&re()&&function(e,t){ye(e,t)}(o,(function(){F.state.isShown=!0,ue("onShown",[F])}))}},function(){var e,n=F.props.appendTo,i=oe();e=F.props.interactive&&n===l||"parent"===n?i.parentNode:d(n,[i]);e.contains(G)||e.appendChild(G);F.state.isMounted=!0,je(),"production"!==t.env.NODE_ENV&&z(F.props.interactive&&n===W.appendTo&&i.nextElementSibling!==G,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.","\n\n","Using a wrapper
or tag around the reference element","solves this by creating a new parentNode context.","\n\n","Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.","\n\n","See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}()},hide:function(){"production"!==t.env.NODE_ENV&&z(F.state.isDestroyed,U("hide"));var e=!F.state.isVisible,n=F.state.isDestroyed,i=!F.state.isEnabled,r=u(F.props.duration,1,W.duration);if(e||n||i)return;if(ue("onHide",[F],!1),!1===F.props.onHide(F))return;F.state.isVisible=!1,F.state.isShown=!1,O=!1,C=!1,re()&&(G.style.visibility="hidden");if(fe(),ge(),le(!0),re()){var o=se(),a=o.box,s=o.content;F.props.animation&&(E([a,s],r),M([a,s],"hidden"))}pe(),de(),F.props.animation?re()&&function(e,t){ye(e,(function(){!F.state.isVisible&&G.parentNode&&G.parentNode.contains(G)&&t()}))}(r,F.unmount):F.unmount()},hideWithInteractivity:function(e){"production"!==t.env.NODE_ENV&&z(F.state.isDestroyed,U("hideWithInteractivity"));ae().addEventListener("mousemove",q),b(ne,q),q(e)},enable:function(){F.state.isEnabled=!0},disable:function(){F.hide(),F.state.isEnabled=!1},unmount:function(){"production"!==t.env.NODE_ENV&&z(F.state.isDestroyed,U("unmount"));F.state.isVisible&&F.hide();if(!F.state.isMounted)return;Ie(),Te().forEach((function(e){e._tippy.unmount()})),G.parentNode&&G.parentNode.removeChild(G);ie=ie.filter((function(e){return e!==F})),F.state.isMounted=!1,ue("onHidden",[F])},destroy:function(){"production"!==t.env.NODE_ENV&&z(F.state.isDestroyed,U("destroy"));if(F.state.isDestroyed)return;F.clearDelayTimeouts(),F.unmount(),we(),delete e._tippy,F.state.isDestroyed=!0,ue("onDestroy",[F])}};if(!S.render)return"production"!==t.env.NODE_ENV&&H(!0,"render() function has not been supplied."),F;var V=S.render(F),G=V.popper,X=V.onUpdate;G.setAttribute("data-tippy-root",""),G.id="tippy-"+F.id,F.popper=G,e._tippy=F,G._tippy=F;var Y=D.map((function(e){return e.fn(F)})),J=e.hasAttribute("aria-expanded");return _e(),de(),le(),ue("onCreate",[F]),S.showOnCreate&&Ce(),G.addEventListener("mouseenter",(function(){F.props.interactive&&F.state.isVisible&&F.clearDelayTimeouts()})),G.addEventListener("mouseleave",(function(){F.props.interactive&&F.props.trigger.indexOf("mouseenter")>=0&&ae().addEventListener("mousemove",q)})),F;function Z(){var e=F.props.touch;return Array.isArray(e)?e:[e,0]}function ee(){return"hold"===Z()[0]}function re(){var e;return!(null==(e=F.props.render)||!e.$$tippy)}function oe(){return _||e}function ae(){var e=oe().parentNode;return e?A(e):document}function se(){return Q(G)}function ce(e){return F.state.isMounted&&!F.state.isVisible||T.isTouch||s&&"focus"===s.type?0:u(F.props.delay,e?0:1,W.delay)}function le(e){void 0===e&&(e=!1),G.style.pointerEvents=F.props.interactive&&!e?"":"none",G.style.zIndex=""+F.props.zIndex}function ue(e,t,n){var i;(void 0===n&&(n=!0),Y.forEach((function(n){n[e]&&n[e].apply(n,t)})),n)&&(i=F.props)[e].apply(i,t)}function pe(){var t=F.props.aria;if(t.content){var n="aria-"+t.content,i=G.id;m(F.props.triggerTarget||e).forEach((function(e){var t=e.getAttribute(n);if(F.state.isVisible)e.setAttribute(n,t?t+" "+i:i);else{var r=t&&t.replace(i,"").trim();r?e.setAttribute(n,r):e.removeAttribute(n)}}))}}function de(){!J&&F.props.aria.expanded&&m(F.props.triggerTarget||e).forEach((function(e){F.props.interactive?e.setAttribute("aria-expanded",F.state.isVisible&&e===oe()?"true":"false"):e.removeAttribute("aria-expanded")}))}function fe(){ae().removeEventListener("mousemove",q),ne=ne.filter((function(e){return e!==q}))}function he(t){if(!T.isTouch||!R&&"mousedown"!==t.type){var n=t.composedPath&&t.composedPath()[0]||t.target;if(!F.props.interactive||!I(G,n)){if(m(F.props.triggerTarget||e).some((function(e){return I(e,n)}))){if(T.isTouch)return;if(F.state.isVisible&&F.props.trigger.indexOf("click")>=0)return}else ue("onClickOutside",[F,t]);!0===F.props.hideOnClick&&(F.clearDelayTimeouts(),F.hide(),B=!0,setTimeout((function(){B=!1})),F.state.isMounted||ge())}}}function me(){R=!0}function be(){R=!1}function ve(){var e=ae();e.addEventListener("mousedown",he,!0),e.addEventListener("touchend",he,c),e.addEventListener("touchstart",be,c),e.addEventListener("touchmove",me,c)}function ge(){var e=ae();e.removeEventListener("mousedown",he,!0),e.removeEventListener("touchend",he,c),e.removeEventListener("touchstart",be,c),e.removeEventListener("touchmove",me,c)}function ye(e,t){var n=se().box;function i(e){e.target===n&&(j(n,"remove",i),t())}if(0===e)return t();j(n,"remove",p),j(n,"add",i),p=i}function xe(t,n,i){void 0===i&&(i=!1),m(F.props.triggerTarget||e).forEach((function(e){e.addEventListener(t,n,i),P.push({node:e,eventType:t,handler:n,options:i})}))}function _e(){var e;ee()&&(xe("touchstart",ke,{passive:!0}),xe("touchend",Ee,{passive:!0})),(e=F.props.trigger,e.split(/\s+/).filter(Boolean)).forEach((function(e){if("manual"!==e)switch(xe(e,ke),e){case"mouseenter":xe("mouseleave",Ee);break;case"focus":xe(L?"focusout":"blur",Me);break;case"focusin":xe("focusout",Me)}}))}function we(){P.forEach((function(e){var t=e.node,n=e.eventType,i=e.handler,r=e.options;t.removeEventListener(n,i,r)})),P=[]}function ke(e){var t,n=!1;if(F.state.isEnabled&&!Ae(e)&&!B){var i="focus"===(null==(t=s)?void 0:t.type);s=e,_=e.currentTarget,de(),!F.state.isVisible&&w(e)&&ne.forEach((function(t){return t(e)})),"click"===e.type&&(F.props.trigger.indexOf("mouseenter")<0||C)&&!1!==F.props.hideOnClick&&F.state.isVisible?n=!0:Ce(e),"click"===e.type&&(C=!n),n&&!i&&Be(e)}}function Se(e){var t=e.target,n=oe().contains(t)||G.contains(t);if("mousemove"!==e.type||!n){var i=Te().concat(G).map((function(e){var t,n=null==(t=e._tippy.popperInstance)?void 0:t.state;return n?{popperRect:e.getBoundingClientRect(),popperState:n,props:S}:null})).filter(Boolean);(function(e,t){var n=t.clientX,i=t.clientY;return e.every((function(e){var t=e.popperRect,r=e.popperState,o=e.props.interactiveBorder,a=v(r.placement),s=r.modifiersData.offset;if(!s)return!0;var c="bottom"===a?s.top.y:0,l="top"===a?s.bottom.y:0,u="right"===a?s.left.x:0,p="left"===a?s.right.x:0,d=t.top-i+c>o,f=i-t.bottom-l>o,h=t.left-n+u>o,m=n-t.right-p>o;return d||f||h||m}))})(i,e)&&(fe(),Be(e))}}function Ee(e){Ae(e)||F.props.trigger.indexOf("click")>=0&&C||(F.props.interactive?F.hideWithInteractivity(e):Be(e))}function Me(e){F.props.trigger.indexOf("focusin")<0&&e.target!==oe()||F.props.interactive&&e.relatedTarget&&G.contains(e.relatedTarget)||Be(e)}function Ae(e){return!!T.isTouch&&ee()!==e.type.indexOf("touch")>=0}function je(){Ie();var t=F.props,n=t.popperOptions,r=t.placement,o=t.offset,a=t.getReferenceClientRect,s=t.moveTransition,c=re()?Q(G).arrow:null,l=a?{getBoundingClientRect:a,contextElement:a.contextElement||oe()}:e,u={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var t=e.state;if(re()){var n=se().box;["placement","reference-hidden","escaped"].forEach((function(e){"placement"===e?n.setAttribute("data-placement",t.placement):t.attributes.popper["data-popper-"+e]?n.setAttribute("data-"+e,""):n.removeAttribute("data-"+e)})),t.attributes.popper={}}}},p=[{name:"offset",options:{offset:o}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!s}},u];re()&&c&&p.push({name:"arrow",options:{element:c,padding:3}}),p.push.apply(p,(null==n?void 0:n.modifiers)||[]),F.popperInstance=i.createPopper(l,G,Object.assign({},n,{placement:r,onFirstUpdate:h,modifiers:p}))}function Ie(){F.popperInstance&&(F.popperInstance.destroy(),F.popperInstance=null)}function Te(){return g(G.querySelectorAll("[data-tippy-root]"))}function Ce(e){F.clearDelayTimeouts(),e&&ue("onTrigger",[F,e]),ve();var t=ce(!0),n=Z(),i=n[0],o=n[1];T.isTouch&&"hold"===i&&o&&(t=o),t?r=setTimeout((function(){F.show()}),t):F.show()}function Be(e){if(F.clearDelayTimeouts(),ue("onUntrigger",[F,e]),F.state.isVisible){if(!(F.props.trigger.indexOf("mouseenter")>=0&&F.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(e.type)>=0&&C)){var t=ce(!1);t?o=setTimeout((function(){F.state.isVisible&&F.hide()}),t):a=requestAnimationFrame((function(){F.hide()}))}}else ge()}}function oe(e,n){void 0===n&&(n={});var i=W.plugins.concat(n.plugins||[]);"production"!==t.env.NODE_ENV&&(!function(e){var t=!e,n="[object Object]"===Object.prototype.toString.call(e)&&!e.addEventListener;H(t,["tippy() was passed","`"+String(e)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),H(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}(e),G(n,i)),document.addEventListener("touchstart",B,c),window.addEventListener("blur",O);var r=Object.assign({},n,{plugins:i}),o=S(e);if("production"!==t.env.NODE_ENV){var a=_(r.content),s=o.length>1;z(a&&s,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.","\n\n","Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.","\n\n","1) content: element.innerHTML\n","2) content: () => element.cloneNode(true)"].join(" "))}var l=o.reduce((function(e,t){var n=t&&re(t,r);return n&&e.push(n),e}),[]);return _(e)?l[0]:l}oe.defaultProps=W,oe.setDefaultProps=function(e){"production"!==t.env.NODE_ENV&&G(e,[]),Object.keys(e).forEach((function(t){W[t]=e[t]}))},oe.currentInput=T;var ae=Object.assign({},i.applyStyles,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),se={mouseover:"mouseenter",focusin:"focus",click:"click"};var ce={name:"animateFill",defaultValue:!1,fn:function(e){var n;if(null==(n=e.props.render)||!n.$$tippy)return"production"!==t.env.NODE_ENV&&H(e.props.animateFill,"The `animateFill` plugin requires the default render function."),{};var i=Q(e.popper),r=i.box,a=i.content,s=e.props.animateFill?function(){var e=x();return e.className=o,M([e],"hidden"),e}():null;return{onCreate:function(){s&&(r.insertBefore(s,r.firstElementChild),r.setAttribute("data-animatefill",""),r.style.overflow="hidden",e.setProps({arrow:!1,animation:"shift-away"}))},onMount:function(){if(s){var e=r.style.transitionDuration,t=Number(e.replace("ms",""));a.style.transitionDelay=Math.round(t/10)+"ms",s.style.transitionDuration=e,M([s],"visible")}},onShow:function(){s&&(s.style.transitionDuration="0ms")},onHide:function(){s&&M([s],"hidden")}}}};var le={clientX:0,clientY:0},ue=[];function pe(e){var t=e.clientX,n=e.clientY;le={clientX:t,clientY:n}}var de={name:"followCursor",defaultValue:!1,fn:function(e){var t=e.reference,n=A(e.props.triggerTarget||t),i=!1,r=!1,o=!0,a=e.props;function s(){return"initial"===e.props.followCursor&&e.state.isVisible}function c(){n.addEventListener("mousemove",p)}function l(){n.removeEventListener("mousemove",p)}function u(){i=!0,e.setProps({getReferenceClientRect:null}),i=!1}function p(n){var i=!n.target||t.contains(n.target),r=e.props.followCursor,o=n.clientX,a=n.clientY,s=t.getBoundingClientRect(),c=o-s.left,l=a-s.top;!i&&e.props.interactive||e.setProps({getReferenceClientRect:function(){var e=t.getBoundingClientRect(),n=o,i=a;"initial"===r&&(n=e.left+c,i=e.top+l);var s="horizontal"===r?e.top:i,u="vertical"===r?e.right:n,p="horizontal"===r?e.bottom:i,d="vertical"===r?e.left:n;return{width:u-d,height:p-s,top:s,right:u,bottom:p,left:d}}})}function d(){e.props.followCursor&&(ue.push({instance:e,doc:n}),function(e){e.addEventListener("mousemove",pe)}(n))}function f(){0===(ue=ue.filter((function(t){return t.instance!==e}))).filter((function(e){return e.doc===n})).length&&function(e){e.removeEventListener("mousemove",pe)}(n)}return{onCreate:d,onDestroy:f,onBeforeUpdate:function(){a=e.props},onAfterUpdate:function(t,n){var o=n.followCursor;i||void 0!==o&&a.followCursor!==o&&(f(),o?(d(),!e.state.isMounted||r||s()||c()):(l(),u()))},onMount:function(){e.props.followCursor&&!r&&(o&&(p(le),o=!1),s()||c())},onTrigger:function(e,t){w(t)&&(le={clientX:t.clientX,clientY:t.clientY}),r="focus"===t.type},onHidden:function(){e.props.followCursor&&(u(),l(),o=!0)}}}};var fe={name:"inlinePositioning",defaultValue:!1,fn:function(e){var t,n=e.reference;var i=-1,r=!1,o=[],a={name:"tippyInlinePositioning",enabled:!0,phase:"afterWrite",fn:function(r){var a=r.state;e.props.inlinePositioning&&(-1!==o.indexOf(a.placement)&&(o=[]),t!==a.placement&&-1===o.indexOf(a.placement)&&(o.push(a.placement),e.setProps({getReferenceClientRect:function(){return function(e){return function(e,t,n,i){if(n.length<2||null===e)return t;if(2===n.length&&i>=0&&n[0].left>n[1].right)return n[i]||t;switch(e){case"top":case"bottom":var r=n[0],o=n[n.length-1],a="top"===e,s=r.top,c=o.bottom,l=a?r.left:o.left,u=a?r.right:o.right;return{top:s,bottom:c,left:l,right:u,width:u-l,height:c-s};case"left":case"right":var p=Math.min.apply(Math,n.map((function(e){return e.left}))),d=Math.max.apply(Math,n.map((function(e){return e.right}))),f=n.filter((function(t){return"left"===e?t.left===p:t.right===d})),h=f[0].top,m=f[f.length-1].bottom;return{top:h,bottom:m,left:p,right:d,width:d-p,height:m-h};default:return t}}(v(e),n.getBoundingClientRect(),g(n.getClientRects()),i)}(a.placement)}})),t=a.placement)}};function s(){var t;r||(t=function(e,t){var n;return{popperOptions:Object.assign({},e.popperOptions,{modifiers:[].concat(((null==(n=e.popperOptions)?void 0:n.modifiers)||[]).filter((function(e){return e.name!==t.name})),[t])})}}(e.props,a),r=!0,e.setProps(t),r=!1)}return{onCreate:s,onAfterUpdate:s,onTrigger:function(t,n){if(w(n)){var r=g(e.reference.getClientRects()),o=r.find((function(e){return e.left-2<=n.clientX&&e.right+2>=n.clientX&&e.top-2<=n.clientY&&e.bottom+2>=n.clientY})),a=r.indexOf(o);i=a>-1?a:i}},onHidden:function(){i=-1}}}};var he={name:"sticky",defaultValue:!1,fn:function(e){var t=e.reference,n=e.popper;function i(t){return!0===e.props.sticky||e.props.sticky===t}var r=null,o=null;function a(){var s=i("reference")?(e.popperInstance?e.popperInstance.state.elements.reference:t).getBoundingClientRect():null,c=i("popper")?n.getBoundingClientRect():null;(s&&me(r,s)||c&&me(o,c))&&e.popperInstance&&e.popperInstance.update(),r=s,o=c,e.state.isMounted&&requestAnimationFrame(a)}return{onMount:function(){e.props.sticky&&a()}}}};function me(e,t){return!e||!t||(e.top!==t.top||e.right!==t.right||e.bottom!==t.bottom||e.left!==t.left)}oe.setDefaultProps({render:ee}),n.animateFill=ce,n.createSingleton=function(e,n){var i;void 0===n&&(n={}),"production"!==t.env.NODE_ENV&&H(!Array.isArray(e),["The first argument passed to createSingleton() must be an array of","tippy instances. The passed value was",String(e)].join(" "));var r,o=e,a=[],s=[],c=n.overrides,l=[],u=!1;function p(){s=o.map((function(e){return m(e.props.triggerTarget||e.reference)})).reduce((function(e,t){return e.concat(t)}),[])}function d(){a=o.map((function(e){return e.reference}))}function f(e){o.forEach((function(t){e?t.enable():t.disable()}))}function b(e){return o.map((function(t){var n=t.setProps;return t.setProps=function(i){n(i),t.reference===r&&e.setProps(i)},function(){t.setProps=n}}))}function v(e,t){var n=s.indexOf(t);if(t!==r){r=t;var i=(c||[]).concat("content").reduce((function(e,t){return e[t]=o[n].props[t],e}),{});e.setProps(Object.assign({},i,{getReferenceClientRect:"function"==typeof i.getReferenceClientRect?i.getReferenceClientRect:function(){var e;return null==(e=a[n])?void 0:e.getBoundingClientRect()}}))}}f(!1),d(),p();var g={fn:function(){return{onDestroy:function(){f(!0)},onHidden:function(){r=null},onClickOutside:function(e){e.props.showOnCreate&&!u&&(u=!0,r=null)},onShow:function(e){e.props.showOnCreate&&!u&&(u=!0,v(e,a[0]))},onTrigger:function(e,t){v(e,t.currentTarget)}}}},y=oe(x(),Object.assign({},h(n,["overrides"]),{plugins:[g].concat(n.plugins||[]),triggerTarget:s,popperOptions:Object.assign({},n.popperOptions,{modifiers:[].concat((null==(i=n.popperOptions)?void 0:i.modifiers)||[],[ae])})})),_=y.show;y.show=function(e){if(_(),!r&&null==e)return v(y,a[0]);if(!r||null!=e){if("number"==typeof e)return a[e]&&v(y,a[e]);if(o.indexOf(e)>=0){var t=e.reference;return v(y,t)}return a.indexOf(e)>=0?v(y,e):void 0}},y.showNext=function(){var e=a[0];if(!r)return y.show(0);var t=a.indexOf(r);y.show(a[t+1]||e)},y.showPrevious=function(){var e=a[a.length-1];if(!r)return y.show(e);var t=a.indexOf(r),n=a[t-1]||e;y.show(n)};var w=y.setProps;return y.setProps=function(e){c=e.overrides||c,w(e)},y.setInstances=function(e){f(!0),l.forEach((function(e){return e()})),o=e,f(!1),d(),p(),l=b(y),y.setProps({triggerTarget:s})},l=b(y),y},n.default=oe,n.delegate=function(e,n){"production"!==t.env.NODE_ENV&&H(!(n&&n.target),["You must specity a `target` prop indicating a CSS selector string matching","the target elements that should receive a tippy."].join(" "));var i=[],r=[],o=!1,a=n.target,s=h(n,["target"]),l=Object.assign({},s,{trigger:"manual",touch:!1}),u=Object.assign({touch:W.touch},s,{showOnCreate:!0}),p=oe(e,l);function d(e){if(e.target&&!o){var t=e.target.closest(a);if(t){var i=t.getAttribute("data-tippy-trigger")||n.trigger||W.trigger;if(!t._tippy&&!("touchstart"===e.type&&"boolean"==typeof u.touch||"touchstart"!==e.type&&i.indexOf(se[e.type])<0)){var s=oe(t,u);s&&(r=r.concat(s))}}}}function f(e,t,n,r){void 0===r&&(r=!1),e.addEventListener(t,n,r),i.push({node:e,eventType:t,handler:n,options:r})}return m(p).forEach((function(e){var t=e.destroy,n=e.enable,a=e.disable;e.destroy=function(e){void 0===e&&(e=!0),e&&r.forEach((function(e){e.destroy()})),r=[],i.forEach((function(e){var t=e.node,n=e.eventType,i=e.handler,r=e.options;t.removeEventListener(n,i,r)})),i=[],t()},e.enable=function(){n(),r.forEach((function(e){return e.enable()})),o=!1},e.disable=function(){a(),r.forEach((function(e){return e.disable()})),o=!0},function(e){var t=e.reference;f(t,"touchstart",d,c),f(t,"mouseover",d),f(t,"focusin",d),f(t,"click",d)}(e)})),p},n.followCursor=de,n.hideAll=function(e){var t=void 0===e?{}:e,n=t.exclude,i=t.duration;ie.forEach((function(e){var t=!1;if(n&&(t=k(n)?e.reference===n:e.popper===n.popper),!t){var r=e.props.duration;e.setProps({duration:i}),e.hide(),e.state.isDestroyed||e.setProps({duration:r})}}))},n.inlinePositioning=fe,n.roundArrow='',n.sticky=he}).call(this)}).call(this,e("_process"))},{"@popperjs/core":1,_process:309}],452:[function(e,t,n){var i=e("buffer").Buffer;t.exports=function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(i.isBuffer(e)){for(var t=new Uint8Array(e.length),n=e.length,r=0;r */ const i=e("debug")("torrent-discovery"),r=e("bittorrent-dht/client"),o=e("events").EventEmitter,a=e("run-parallel"),s=e("bittorrent-tracker/client"),c=e("bittorrent-lsd");t.exports=class extends o{constructor(e){if(super(),!e.peerId)throw new Error("Option `peerId` is required");if(!e.infoHash)throw new Error("Option `infoHash` is required");if(!n.browser&&!e.port)throw new Error("Option `port` is required");this.peerId="string"==typeof e.peerId?e.peerId:e.peerId.toString("hex"),this.infoHash="string"==typeof e.infoHash?e.infoHash.toLowerCase():e.infoHash.toString("hex"),this._port=e.port,this._userAgent=e.userAgent,this.destroyed=!1,this._announce=e.announce||[],this._intervalMs=e.intervalMs||9e5,this._trackerOpts=null,this._dhtAnnouncing=!1,this._dhtTimeout=!1,this._internalDHT=!1,this._onWarning=e=>{this.emit("warning",e)},this._onError=e=>{this.emit("error",e)},this._onDHTPeer=(e,t)=>{t.toString("hex")===this.infoHash&&this.emit("peer",`${e.host}:${e.port}`,"dht")},this._onTrackerPeer=e=>{this.emit("peer",e,"tracker")},this._onTrackerAnnounce=()=>{this.emit("trackerAnnounce")},this._onLSDPeer=(e,t)=>{this.emit("peer",e,"lsd")};const t=(e,t)=>{const n=new r(t);return n.on("warning",this._onWarning),n.on("error",this._onError),n.listen(e),this._internalDHT=!0,n};!1===e.tracker?this.tracker=null:e.tracker&&"object"==typeof e.tracker?(this._trackerOpts=Object.assign({},e.tracker),this.tracker=this._createTracker()):this.tracker=this._createTracker(),!1===e.dht||"function"!=typeof r?this.dht=null:e.dht&&"function"==typeof e.dht.addNode?this.dht=e.dht:e.dht&&"object"==typeof e.dht?this.dht=t(e.dhtPort,e.dht):this.dht=t(e.dhtPort),this.dht&&(this.dht.on("peer",this._onDHTPeer),this._dhtAnnounce()),!1===e.lsd||"function"!=typeof c?this.lsd=null:this.lsd=this._createLSD()}updatePort(e){e!==this._port&&(this._port=e,this.dht&&this._dhtAnnounce(),this.tracker&&(this.tracker.stop(),this.tracker.destroy((()=>{this.tracker=this._createTracker()}))))}complete(e){this.tracker&&this.tracker.complete(e)}destroy(e){if(this.destroyed)return;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((e=>{this.tracker.destroy(e)}))),this.dht&&this.dht.removeListener("peer",this._onDHTPeer),this._internalDHT&&(this.dht.removeListener("warning",this._onWarning),this.dht.removeListener("error",this._onError),t.push((e=>{this.dht.destroy(e)}))),this.lsd&&(this.lsd.removeListener("warning",this._onWarning),this.lsd.removeListener("error",this._onError),this.lsd.removeListener("peer",this._onLSDPeer),t.push((e=>{this.lsd.destroy(e)}))),a(t,e),this.dht=null,this.tracker=null,this.lsd=null,this._announce=null}_createTracker(){const e=Object.assign({},this._trackerOpts,{infoHash:this.infoHash,announce:this._announce,peerId:this.peerId,port:this._port,userAgent:this._userAgent}),t=new s(e);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||(i("dht announce"),this._dhtAnnouncing=!0,clearTimeout(this._dhtTimeout),this.dht.announce(this.infoHash,this._port,(e=>{this._dhtAnnouncing=!1,i("dht announce complete"),e&&this.emit("warning",e),this.emit("dhtAnnounce"),this.destroyed||(this._dhtTimeout=setTimeout((()=>{this._dhtAnnounce()}),this._intervalMs+Math.floor(Math.random()*this._intervalMs/5)),this._dhtTimeout.unref&&this._dhtTimeout.unref())})))}_createLSD(){const e=Object.assign({},{infoHash:this.infoHash,peerId:this.peerId,port:this._port}),t=new c(e);return t.on("warning",this._onWarning),t.on("error",this._onError),t.on("peer",this._onLSDPeer),t.start(),t}}}).call(this)}).call(this,e("_process"))},{_process:309,"bittorrent-dht/client":67,"bittorrent-lsd":67,"bittorrent-tracker/client":43,debug:148,events:181,"run-parallel":354}],454:[function(e,t,n){(function(e){(function(){ /*! torrent-piece. MIT License. WebTorrent LLC */ const n=16384;class i{constructor(e){this.length=e,this.missing=e,this.sources=null,this._chunks=Math.ceil(e/n),this._remainder=e%n||n,this._buffered=0,this._buffer=null,this._cancellations=null,this._reservations=0,this._flushed=!1}chunkLength(e){return e===this._chunks-1?this._remainder:n}chunkLengthRemaining(e){return this.length-e*n}chunkOffset(e){return e*n}reserve(){return this.init()?this._cancellations.length?this._cancellations.pop():this._reservations=e.length||t<0)return;var n=e.pop();if(t",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),u=["%","/","?",";","#"].concat(l),p=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,h={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=e("qs");function g(e,t,n){if(e&&"object"==typeof e&&e instanceof r)return e;var i=new r;return i.parse(e,t,n),i}r.prototype.parse=function(e,t,n){if("string"!=typeof e)throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var r=e.indexOf("?"),a=-1!==r&&r127?B+="x":B+=C[R];if(!B.match(d)){var P=I.slice(0,M),L=I.slice(M+1),U=C.match(f);U&&(P.push(U[1]),L.unshift(U[2])),L.length&&(g="/"+L.join(".")+g),this.hostname=P.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),j||(this.hostname=i.toASCII(this.hostname));var q=this.port?":"+this.port:"",N=this.hostname||"";this.host=N+q,this.href+=this.host,j&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==g[0]&&(g="/"+g))}if(!h[_])for(M=0,T=l.length;M0)&&n.host.split("@"))&&(n.auth=j.shift(),n.hostname=j.shift(),n.host=n.hostname);return n.search=e.search,n.query=e.query,null===n.pathname&&null===n.search||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!w.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var S=w.slice(-1)[0],E=(n.host||e.host||w.length>1)&&("."===S||".."===S)||""===S,M=0,A=w.length;A>=0;A--)"."===(S=w[A])?w.splice(A,1):".."===S?(w.splice(A,1),M++):M&&(w.splice(A,1),M--);if(!x&&!_)for(;M--;M)w.unshift("..");!x||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),E&&"/"!==w.join("/").substr(-1)&&w.push("");var j,I=""===w[0]||w[0]&&"/"===w[0].charAt(0);k&&(n.hostname=I?"":w.length?w.shift():"",n.host=n.hostname,(j=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=j.shift(),n.hostname=j.shift(),n.host=n.hostname));return(x=x||n.host&&w.length)&&!I&&w.unshift(""),w.length>0?n.pathname=w.join("/"):(n.pathname=null,n.path=null),null===n.pathname&&null===n.search||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)},n.parse=g,n.resolve=function(e,t){return g(e,!1,!0).resolve(t)},n.resolveObject=function(e,t){return e?g(e,!1,!0).resolveObject(t):t},n.format=function(e){return"string"==typeof e&&(e=g(e)),e instanceof r?e.format():r.prototype.format.call(e)},n.Url=r},{punycode:318,qs:320}],458:[function(e,t,n){(function(n){(function(){ /*! ut_metadata. MIT License. WebTorrent LLC */ const{EventEmitter:i}=e("events"),r=e("bencode"),o=e("bitfield").default,a=e("debug")("ut_metadata"),s=e("simple-sha1"),c=16384;t.exports=e=>{class t extends i{constructor(t){super(),this._wire=t,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new o(0,{grow:1e3}),n.isBuffer(e)&&this.setMetadata(e)}onHandshake(e,t,n){this._infoHash=e}onExtendedHandshake(e){return e.m&&e.m.ut_metadata?e.metadata_size?"number"!=typeof e.metadata_size||1e7this._metadataSize&&(n=this._metadataSize);const i=this.metadata.slice(t,n);this._data(e,i,this._metadataSize)}_onData(e,t,n){t.length>c||!this._fetching||(t.copy(this.metadata,e*c),this._bitfield.set(e),this._checkDone())}_onReject(e){this._remainingRejects>0&&this._fetching?(this._request(e),this._remainingRejects-=1):this.emit("warning",new Error('Peer sent "reject" too much'))}_requestPieces(){if(this._fetching){this.metadata=n.alloc(this._metadataSize);for(let e=0;e0?this._requestPieces():this.emit("warning",new Error("Peer sent invalid metadata"))}}return t.prototype.name="ut_metadata",t}}).call(this)}).call(this,e("buffer").Buffer)},{bencode:22,bitfield:26,buffer:110,debug:148,events:181,"simple-sha1":386}],459:[function(e,t,n){(function(e){(function(){function n(t){try{if(!e.localStorage)return!1}catch(e){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(e,t){if(n("noDeprecation"))return e;var i=!1;return function(){if(!i){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],460:[function(e,t,n){(function(n){(function(){const i=e("binary-search"),r=e("events"),o=e("mp4-stream"),a=e("mp4-box-encoding"),s=e("range-slice-stream");class c{constructor(e,t){this._entries=e,this._countName=t||"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]}}const l=1;t.exports=class extends r{constructor(e){super(),this._tracks=[],this._file=e,this._decoder=null,this._findMoov(0)}_findMoov(e){this._decoder&&this._decoder.destroy();let t=0;this._decoder=o.decode();const n=this._file.createReadStream({start:e});n.pipe(this._decoder);const i=r=>{"moov"===r.type?(this._decoder.removeListener("box",i),this._decoder.decode((e=>{n.destroy();try{this._processMoov(e)}catch(e){e.message=`Cannot parse mp4 file: ${e.message}`,this.emit("error",e)}}))):r.length<4096?(t+=r.length,this._decoder.ignore()):(this._decoder.removeListener("box",i),t+=r.length,n.destroy(),this._decoder.destroy(),this._findMoov(e+t))};this._decoder.on("box",i)}_processMoov(e){const t=e.traks;this._tracks=[],this._hasVideo=!1,this._hasAudio=!1;for(let n=0;n=o.stsz.entries.length)break;if(f++,m+=e,f>=i.samplesPerChunk){f=0,m=0,h++;const e=o.stsc.entries[b+1];e&&h+1>=e.firstChunk&&b++}v+=t,g.inc(),y&&y.inc(),r&&x++}r.mdia.mdhd.duration=0,r.tkhd.duration=0;const _=i.sampleDescriptionId,w={type:"moov",mvhd:e.mvhd,traks:[{tkhd:r.tkhd,mdia:{mdhd:r.mdia.mdhd,hdlr:r.mdia.hdlr,elng:r.mdia.elng,minf:{vmhd:r.mdia.minf.vmhd,smhd:r.mdia.minf.smhd,dinf:r.mdia.minf.dinf,stbl:{stsd:o.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:e.mvhd.duration},trexs:[{trackId:r.tkhd.trackId,defaultSampleDescriptionIndex:_,defaultSampleDuration:0,defaultSampleSize:0,defaultSampleFlags:0}]}};this._tracks.push({fragmentSequence:1,trackId:r.tkhd.trackId,timeScale:r.mdia.mdhd.timeScale,samples:p,currSample:null,currTime:null,moov:w,mime:u})}if(0===this._tracks.length)return void this.emit("error",new Error("no playable tracks"));e.mvhd.duration=0,this._ftyp={type:"ftyp",brand:"iso5",brandVersion:0,compatibleBrands:["iso5"]};const r=a.encode(this._ftyp),o=this._tracks.map((e=>{const t=a.encode(e.moov);return{mime:e.mime,init:n.concat([r,t])}}));this.emit("ready",o)}seek(e){if(!this._tracks)throw new Error("Not ready yet; wait for 'ready' event");this._fileStream&&(this._fileStream.destroy(),this._fileStream=null);let t=-1;if(this._tracks.map(((n,i)=>{n.outStream&&n.outStream.destroy(),n.inStream&&(n.inStream.destroy(),n.inStream=null);const r=n.outStream=o.encode(),a=this._generateFragment(i,e);if(!a)return r.finalize();(-1===t||a.ranges[0].start{r.destroyed||r.box(e.moof,(t=>{if(t)return this.emit("error",t);if(r.destroyed)return;n.inStream.slice(e.ranges).pipe(r.mediaData(e.length,(e=>{if(e)return this.emit("error",e);if(r.destroyed)return;const t=this._generateFragment(i);if(!t)return r.finalize();s(t)})))}))};s(a)})),t>=0){const e=this._fileStream=this._file.createReadStream({start:t});this._tracks.forEach((n=>{n.inStream=new s(t,{highWaterMark:1e7}),e.pipe(n.inStream)}))}return this._tracks.map((e=>e.outStream))}_findSampleBefore(e,t){const n=this._tracks[e],r=Math.floor(n.timeScale*t);let o=i(n.samples,r,((e,t)=>e.dts+e.presentationOffset-t));for(-1===o?o=0:o<0&&(o=-o-2);!n.samples[o].sync;)o--;return o}_generateFragment(e,t){const n=this._tracks[e];let i;if(i=void 0!==t?this._findSampleBefore(e,t):n.currSample,i>=n.samples.length)return null;const r=n.samples[i].dts;let o=0;const a=[];for(var s=i;s=n.timeScale*l)break;o+=e.size;const t=a.length-1;t<0||a[t].end!==e.offset?a.push({start:e.offset,end:e.offset+e.size}):a[t].end+=e.size}return n.currSample=s,{moof:this._generateMoof(e,i,s),ranges:a,length:o}}_generateMoof(e,t,n){const i=this._tracks[e],r=[];let o=0;for(let e=t;e{this.detailedError=this._elemWrapper.detailedError,this.destroy()},this._onWaiting=()=>{this._waitingFired=!0,this._muxer?this._tracks&&this._pump():this._createMuxer()},t.autoplay&&(t.preload="auto"),t.addEventListener("waiting",this._onWaiting),t.addEventListener("error",this._onError)}a.prototype={_createMuxer(){this._muxer=new o(this._file),this._muxer.on("ready",(e=>{this._tracks=e.map((e=>{const t=this._elemWrapper.createWriteStream(e.mime);t.on("error",(e=>{this._elemWrapper.error(e)}));const n={muxed:null,mediaSource:t,initFlushed:!1,onInitFlushed:null};return t.write(e.init,(e=>{n.initFlushed=!0,n.onInitFlushed&&n.onInitFlushed(e)})),n})),(this._waitingFired||"auto"===this._elem.preload)&&this._pump()})),this._muxer.on("error",(e=>{this._elemWrapper.error(e)}))},_pump(){const e=this._muxer.seek(this._elem.currentTime,!this._tracks);this._tracks.forEach(((t,n)=>{const i=()=>{t.muxed&&(t.muxed.destroy(),t.mediaSource=this._elemWrapper.createWriteStream(t.mediaSource),t.mediaSource.on("error",(e=>{this._elemWrapper.error(e)}))),t.muxed=e[n],r(t.muxed,t.mediaSource)};t.initFlushed?i():t.onInitFlushed=e=>{e?this._elemWrapper.error(e):i()}}))},destroy(){this.destroyed||(this.destroyed=!0,this._elem.removeEventListener("waiting",this._onWaiting),this._elem.removeEventListener("error",this._onError),this._tracks&&this._tracks.forEach((e=>{e.muxed&&e.muxed.destroy()})),this._elem.src="")}},t.exports=a},{"./mp4-remuxer":460,mediasource:242,pump:317}],462:[function(e,t,n){(function(n){(function(){ /*! webtorrent. MIT License. WebTorrent LLC */ const i=e("events"),r=e("path"),o=e("simple-concat"),a=e("create-torrent"),s=e("debug"),c=e("bittorrent-dht/client"),l=e("load-ip-set"),u=e("run-parallel"),p=e("parse-torrent"),d=e("simple-peer"),f=e("queue-microtask"),h=e("randombytes"),m=e("simple-sha1"),b=e("throughput"),{ThrottleGroup:v}=e("speed-limiter"),g=e("./lib/conn-pool.js"),y=e("./lib/torrent.js"),{version:x}=e("./package.json"),_=s("webtorrent"),w=x.replace(/\d*./g,(e=>("0"+e%100).slice(-2))).slice(0,4),k=`-WW${w}-`;class S extends i{constructor(t={}){super(),"string"==typeof t.peerId?this.peerId=t.peerId:n.isBuffer(t.peerId)?this.peerId=t.peerId.toString("hex"):this.peerId=n.from(k+h(9).toString("base64")).toString("hex"),this.peerIdBuffer=n.from(this.peerId,"hex"),"string"==typeof t.nodeId?this.nodeId=t.nodeId:n.isBuffer(t.nodeId)?this.nodeId=t.nodeId.toString("hex"):this.nodeId=h(20).toString("hex"),this.nodeIdBuffer=n.from(this.nodeId,"hex"),this._debugId=this.peerId.toString("hex").substring(0,7),this.destroyed=!1,this.listening=!1,this.torrentPort=t.torrentPort||0,this.dhtPort=t.dhtPort||0,this.tracker=void 0!==t.tracker?t.tracker:{},this.lsd=!1!==t.lsd,this.torrents=[],this.maxConns=Number(t.maxConns)||55,this.utp=S.UTP_SUPPORT&&!1!==t.utp,this._downloadLimit=Math.max("number"==typeof t.downloadLimit?t.downloadLimit:-1,-1),this._uploadLimit=Math.max("number"==typeof t.uploadLimit?t.uploadLimit:-1,-1),this.serviceWorker=null,this.workerKeepAliveInterval=null,this.workerPortCount=0,!0===t.secure&&e("./lib/peer").enableSecure(),this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.throttleGroups={down:new v({rate:Math.max(this._downloadLimit,0),enabled:this._downloadLimit>=0}),up:new v({rate:Math.max(this._uploadLimit,0),enabled:this._uploadLimit>=0})},this.tracker&&("object"!=typeof this.tracker&&(this.tracker={}),globalThis.WRTC&&!this.tracker.wrtc&&(this.tracker.wrtc=globalThis.WRTC)),"function"==typeof g?this._connPool=new g(this):f((()=>{this._onListening()})),this._downloadSpeed=b(),this._uploadSpeed=b(),!1!==t.dht&&"function"==typeof c?(this.dht=new c(Object.assign({},{nodeId:this.nodeId},t.dht)),this.dht.once("error",(e=>{this._destroy(e)})),this.dht.once("listening",(()=>{const e=this.dht.address();e&&(this.dhtPort=e.port)})),this.dht.setMaxListeners(0),this.dht.listen(this.dhtPort)):this.dht=!1,this.enableWebSeeds=!1!==t.webSeeds;const i=()=>{this.destroyed||(this.ready=!0,this.emit("ready"))};"function"==typeof l&&null!=t.blocklist?l(t.blocklist,{headers:{"user-agent":`WebTorrent/${x} (https://webtorrent.io)`}},((e,t)=>{if(e)return console.error(`Failed to load blocklist: ${e.message}`);this.blocked=t,i()})):f(i)}loadWorker(e,t=(()=>{})){if(!(e instanceof ServiceWorker))throw new Error("Invalid worker registration");if("activated"!==e.state)throw new Error("Worker isn't activated");this.serviceWorker=e,navigator.serviceWorker.addEventListener("message",(e=>{const{data:t}=e;if(!t.type||"webtorrent"===!t.type||!t.url)return null;let[n,...i]=t.url.slice(t.url.indexOf(t.scope+"webtorrent/")+11+t.scope.length).split("/");if(i=decodeURI(i.join("/")),!n||!i)return null;const[r]=e.ports,o=this.get(n)&&this.get(n).files.find((e=>e.path===i));if(!o)return null;const[a,s,c]=o._serve(t),l=s&&s[Symbol.asyncIterator](),u=()=>{r.onmessage=null,s&&s.destroy(),c&&c.destroy(),this.workerPortCount--,this.workerPortCount||(clearInterval(this.workerKeepAliveInterval),this.workerKeepAliveInterval=null)};r.onmessage=async e=>{if(e.data){let e;try{e=(await l.next()).value}catch(e){}r.postMessage(e),e||u(),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 u()},this.workerPortCount++,r.postMessage(a)})),fetch(`${this.serviceWorker.scriptURL.slice(0,this.serviceWorker.scriptURL.lastIndexOf("/")+1).slice(window.location.origin.length)}webtorrent/cancel/`).then((e=>{e.body.cancel()})),t(null,this.serviceWorker)}get downloadSpeed(){return this._downloadSpeed()}get uploadSpeed(){return this._uploadSpeed()}get progress(){const e=this.torrents.filter((e=>1!==e.progress));return e.reduce(((e,t)=>e+t.downloaded),0)/(e.reduce(((e,t)=>e+(t.length||0)),0)||1)}get ratio(){return this.torrents.reduce(((e,t)=>e+t.uploaded),0)/(this.torrents.reduce(((e,t)=>e+t.received),0)||1)}get(e){if(e instanceof y){if(this.torrents.includes(e))return e}else{let t;try{t=p(e)}catch(e){}if(!t)return null;if(!t.infoHash)throw new Error("Invalid torrent identifier");for(const e of this.torrents)if(e.infoHash===t.infoHash)return e}return null}add(e,t={},n=(()=>{})){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,n]=[{},t]);const i=()=>{if(!this.destroyed)for(const e of this.torrents)if(e.infoHash===o.infoHash&&e!==o)return o._destroy(new Error(`Cannot add duplicate torrent ${o.infoHash}`)),void n(e)},r=()=>{this.destroyed||(n(o),this.emit("torrent",o))};this._debug("add"),t=t?Object.assign({},t):{};const o=new y(e,this,t);return this.torrents.push(o),o.once("_infoHash",i),o.once("ready",r),o.once("close",(function e(){o.removeListener("_infoHash",i),o.removeListener("ready",r),o.removeListener("close",e)})),o}seed(e,t,n){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,n]=[{},t]),this._debug("seed"),(t=t?Object.assign({},t):{}).skipVerify=!0;const i="string"==typeof e;i&&(t.path=r.dirname(e)),t.createdBy||(t.createdBy=`WebTorrent/${w}`);const s=e=>{this._debug("on seed"),"function"==typeof n&&n(e),e.emit("seed"),this.emit("seed",e)},c=this.add(null,t,(e=>{const n=[n=>{if(i||t.preloadedStore)return n();e.load(l,n)}];this.dht&&n.push((t=>{e.once("dhtAnnounce",t)})),u(n,(t=>{if(!this.destroyed)return t?e._destroy(t):void s(e)}))}));let l;var p;return p=e,"undefined"!=typeof FileList&&p instanceof FileList?e=Array.from(e):Array.isArray(e)||(e=[e]),u(e.map((e=>n=>{!t.preloadedStore&&function(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}(e)?o(e,((t,i)=>{if(t)return n(t);i.name=e.name,n(null,i)})):n(null,e)})),((e,i)=>{if(!this.destroyed)return e?c._destroy(e):void a.parseInput(i,t,((e,r)=>{if(!this.destroyed){if(e)return c._destroy(e);l=r.map((e=>e.getStream)),a(i,t,((e,t)=>{if(this.destroyed)return;if(e)return c._destroy(e);const i=this.get(t);i?(console.warn("A torrent with the same id is already being seeded"),c._destroy(),"function"==typeof n&&n(i)):c._onTorrentId(t)}))}}))})),c}remove(e,t,n){if("function"==typeof t)return this.remove(e,null,t);this._debug("remove");if(!this.get(e))throw new Error(`No torrent with id ${e}`);this._remove(e,t,n)}_remove(e,t,n){if("function"==typeof t)return this._remove(e,null,t);const i=this.get(e);i&&(this.torrents.splice(this.torrents.indexOf(i),1),i.destroy(t,n),this.dht&&this.dht._tables.remove(i.infoHash))}address(){return this.listening?this._connPool?this._connPool.tcpServer.address():{address:"0.0.0.0",family:"IPv4",port:0}:null}throttleDownload(e){return e=Number(e),!(isNaN(e)||!isFinite(e)||e<-1)&&(this._downloadLimit=e,this._downloadLimit<0?this.throttleGroups.down.setEnabled(!1):(this.throttleGroups.down.setEnabled(!0),void this.throttleGroups.down.setRate(this._downloadLimit)))}throttleUpload(e){return e=Number(e),!(isNaN(e)||!isFinite(e)||e<-1)&&(this._uploadLimit=e,this._uploadLimit<0?this.throttleGroups.up.setEnabled(!1):(this.throttleGroups.up.setEnabled(!0),void this.throttleGroups.up.setRate(this._uploadLimit)))}destroy(e){if(this.destroyed)throw new Error("client already destroyed");this._destroy(null,e)}_destroy(e,t){this._debug("client destroy"),this.destroyed=!0;const n=this.torrents.map((e=>t=>{e.destroy(t)}));this._connPool&&n.push((e=>{this._connPool.destroy(e)})),this.dht&&n.push((e=>{this.dht.destroy(e)})),u(n,t),e&&this.emit("error",e),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 e=this._connPool.tcpServer.address();e&&(this.torrentPort=e.port)}this.emit("listening")}_debug(){const e=[].slice.call(arguments);e[0]=`[${this._debugId}] ${e[0]}`,_(...e)}_getByHash(e){for(const t of this.torrents)if(t.infoHashHash||(t.infoHashHash=m.sync(n.from("72657132"+t.infoHash,"hex"))),e===t.infoHashHash)return t;return null}}S.WEBRTC_SUPPORT=d.WEBRTC_SUPPORT,S.UTP_SUPPORT=g.UTP_SUPPORT,S.VERSION=x,t.exports=S}).call(this)}).call(this,e("buffer").Buffer)},{"./lib/conn-pool.js":67,"./lib/peer":465,"./lib/torrent.js":467,"./package.json":469,"bittorrent-dht/client":67,buffer:110,"create-torrent":146,debug:148,events:181,"load-ip-set":67,"parse-torrent":300,path:301,"queue-microtask":327,randombytes:330,"run-parallel":354,"simple-concat":368,"simple-peer":370,"simple-sha1":386,"speed-limiter":404,throughput:450}],463:[function(e,t,n){const{Readable:i}=e("streamx"),r=e("debug")("webtorrent:file-stream");t.exports=class extends i{constructor(e,t){super(t??{}),this._torrent=e._torrent;const n=t&&t.start||0,i=t&&t.end&&t.end{this._notify()}))}_read(e){this._reading||(this._reading=!0,this._notify(e))}_notify(e=(()=>{})){if(!this._reading||0===this._missing)return e();if(!this._torrent.bitfield.get(this._piece))return e(),this._torrent.critical(this._piece,this._piece+this._criticalLength);if(this._notifying)return e();if(this._notifying=!0,this._torrent.destroyed)return this.destroy(new Error("Torrent removed"));const t=this._piece,n={};t===this._torrent.pieces.length-1&&(n.length=this._torrent.lastPieceLength),this._torrent.store.get(t,n,((n,i)=>{if(this._notifying=!1,!this.destroyed){if(r("read %s (length %s) (err %s)",t,i&&i.length,n&&n.message),n)return this.destroy(n);this._offset&&(i=i.slice(this._offset),this._offset=0),this._missing{const o=r===e.length-1?i:n;return t.get(r)?o:o-e[r].missing};let s=0;for(let t=r;t<=o;t+=1){const c=a(t);if(s+=c,t===r){const e=this.offset%n;s-=Math.min(e,c)}if(t===o){const t=(o===e.length-1?i:n)-(this.offset+this.length)%n;s-=Math.min(t,c)}}return s}get progress(){return this.length?this.downloaded/this.length:0}select(e){0!==this.length&&this._torrent.select(this._startPiece,this._endPiece,e)}deselect(){0!==this.length&&this._torrent.deselect(this._startPiece,this._endPiece,!1)}createReadStream(e){if(0===this.length){const e=new r;return l((()=>{e.end()})),e}const t=new f(this,e);return this._fileStreams.add(t),t.once("close",(()=>{this._fileStreams.delete(t)})),t}getBuffer(e){c(this.createReadStream(),this.length,e)}getBlob(e){if("undefined"==typeof window)throw new Error("browser-only method");const t=new s((t=>{e(null,t)}),{mimeType:this._getMimeType()});this.createReadStream().pipe(t)}getBlobURL(e){this.getBlob(((t,n)=>{e(null,URL.createObjectURL(n))}))}appendTo(e,t,n){if("undefined"==typeof window)throw new Error("browser-only method");a.append(this,e,t,n)}renderTo(e,t,n){if("undefined"==typeof window)throw new Error("browser-only method");a.render(this,e,t,n)}_serve(e){const t={status:200,headers:{"Accept-Ranges":"bytes","Content-Type":p.getType(this.name),"Cache-Control":"no-cache, no-store, must-revalidate, max-age=0",Expires:"0"},body:"HEAD"===e.method?"":"STREAM"};"document"===e.destination&&(t.headers["Content-Type"]="application/octet-stream",t.headers["Content-Disposition"]="attachment",t.body="DOWNLOAD");let n=u(this.length,e.headers.range||"");n.constructor===Array?(t.status=206,n=n[0],t.headers["Content-Range"]=`bytes ${n.start}-${n.end}/${this.length}`,t.headers["Content-Length"]=""+(n.end-n.start+1)):t.headers["Content-Length"]=this.length;const i="GET"===e.method&&this.createReadStream(n);let r=null;return i&&this.emit("stream",{stream:i,req:e,file:this},(e=>{r=e,d(e,(()=>{e&&e.destroy(),i.destroy()}))})),[t,r||i,r&&i]}getStreamURL(e=(()=>{})){if("undefined"==typeof window)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");e(null,`${this._serviceWorker.scriptURL.slice(0,this._serviceWorker.scriptURL.lastIndexOf("/")+1).slice(window.location.origin.length)}webtorrent/${this._torrent.infoHash}/${encodeURI(this.path)}`)}streamTo(e,t=(()=>{})){if("undefined"==typeof window)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 n=this._serviceWorker.scriptURL.slice(0,this._serviceWorker.scriptURL.lastIndexOf("/")+1).slice(window.location.origin.length);e.src=`${n}webtorrent/${this._torrent.infoHash}/${encodeURI(this.path)}`,t(null,e)}_getMimeType(){return a.mime[o.extname(this.name).toLowerCase()]}_destroy(){this._destroyed=!0,this._torrent=null;for(const e of this._fileStreams)e.destroy();this._fileStreams.clear()}}},{"./file-stream.js":463,"end-of-stream":179,events:181,"fast-blob-stream":183,mime:265,path:301,"queue-microtask":327,"range-parser":332,"render-media":350,"stream-with-known-length-to-buffer":445,streamx:446}],465:[function(e,t,n){const i=e("events"),{Transform:r}=e("stream"),o=e("unordered-array-remove"),a=e("debug"),s=e("bittorrent-protocol"),c=a("webtorrent:peer");let l=!1;n.enableSecure=()=>{l=!0},n.createWebRTCPeer=(e,t,n)=>{const i=new d(e.id,"webrtc");if(i.conn=e,i.swarm=t,i.throttleGroups=n,i.conn.connected)i.onConnect();else{const e=()=>{i.conn.removeListener("connect",t),i.conn.removeListener("error",n)},t=()=>{e(),i.onConnect()},n=t=>{e(),i.destroy(t)};i.conn.once("connect",t),i.conn.once("error",n),i.startConnectTimeout()}return i},n.createTCPIncomingPeer=(e,t)=>u(e,"tcpIncoming",t),n.createUTPIncomingPeer=(e,t)=>u(e,"utpIncoming",t),n.createTCPOutgoingPeer=(e,t,n)=>p(e,t,"tcpOutgoing",n),n.createUTPOutgoingPeer=(e,t,n)=>p(e,t,"utpOutgoing",n);const u=(e,t,n)=>{const i=`${e.remoteAddress}:${e.remotePort}`,r=new d(i,t);return r.conn=e,r.addr=i,r.throttleGroups=n,r.onConnect(),r},p=(e,t,n,i)=>{const r=new d(e,n);return r.addr=e,r.swarm=t,r.throttleGroups=i,r};n.createWebSeedPeer=(e,t,n,i)=>{const r=new d(t,"webSeed");return r.swarm=n,r.conn=e,r.throttleGroups=i,r.onConnect(),r};class d extends i{constructor(e,t){super(),this.id=e,this.type=t,c("new %s Peer %s",t,e),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)return;this.connected=!0,c("Peer %s connected",this.id),clearTimeout(this.connectTimeout);const e=this.conn;e.once("end",(()=>{this.destroy()})),e.once("close",(()=>{this.destroy()})),e.once("finish",(()=>{this.destroy()})),e.once("error",(e=>{this.destroy(e)}));const t=this.wire=new s(this.type,this.retries,l);t.once("end",(()=>{this.destroy()})),t.once("close",(()=>{this.destroy()})),t.once("finish",(()=>{this.destroy()})),t.once("error",(e=>{this.destroy(e)})),t.once("pe1",(()=>{this.onPe1()})),t.once("pe2",(()=>{this.onPe2()})),t.once("pe3",(()=>{this.onPe3()})),t.once("pe4",(()=>{this.onPe4()})),t.once("handshake",((e,t)=>{this.onHandshake(e,t)})),this.startHandshakeTimeout(),this.setThrottlePipes(),this.swarm&&("tcpOutgoing"===this.type?l&&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(e){this.swarm&&(this.swarm.infoHashHash!==e&&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 e=this;this.conn.pipe(this.throttleGroups.down.throttle()).pipe(new r({transform(t,n,i){e.emit("download",t.length),e.destroyed||i(null,t)}})).pipe(this.wire).pipe(this.throttleGroups.up.throttle()).pipe(new r({transform(t,n,i){e.emit("upload",t.length),e.destroyed||i(null,t)}})).pipe(this.conn)}onHandshake(e,t){if(!this.swarm)return;if(this.destroyed)return;if(this.swarm.destroyed)return this.destroy(new Error("swarm already destroyed"));if(e!==this.swarm.infoHash)return this.destroy(new Error("unexpected handshake info hash for this swarm"));if(t===this.swarm.peerId)return this.destroy(new Error("refusing to connect to ourselves"));c("Peer %s got handshake %s",this.id,e),clearTimeout(this.handshakeTimeout),this.retries=0;let n=this.addr;!n&&this.conn.remoteAddress&&this.conn.remotePort&&(n=`${this.conn.remoteAddress}:${this.conn.remotePort}`),this.swarm._onWire(this.wire,n),this.swarm&&!this.swarm.destroyed&&(this.sentHandshake||this.handshake())}handshake(){const e={dht:!this.swarm.private&&!!this.swarm.client.dht,fast:!0};this.wire.handshake(this.swarm.infoHash,this.swarm.client.peerId,e),this.sentHandshake=!0}startConnectTimeout(){clearTimeout(this.connectTimeout);const e={webrtc:25e3,tcpOutgoing:5e3,utpOutgoing:5e3};this.connectTimeout=setTimeout((()=>{this.destroy(new Error("connect timeout"))}),e[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(e){if(this.destroyed)return;this.destroyed=!0,this.connected=!1,c("destroy %s %s (error: %s)",this.type,this.id,e&&(e.message||e)),clearTimeout(this.connectTimeout),clearTimeout(this.handshakeTimeout);const t=this.swarm,n=this.conn,i=this.wire;this.swarm=null,this.conn=null,this.wire=null,t&&i&&o(t.wires,t.wires.indexOf(i)),n&&(n.on("error",(()=>{})),n.destroy()),i&&i.destroy(),t&&t.removePeer(this.id)}}},{"bittorrent-protocol":27,debug:148,events:181,stream:409,"unordered-array-remove":456}],466:[function(e,t,n){t.exports=class{constructor(e){this._torrent=e,this._numPieces=e.pieces.length,this._pieces=new Array(this._numPieces),this._onWire=e=>{this.recalculate(),this._initWire(e)},this._onWireHave=e=>{this._pieces[e]+=1},this._onWireBitfield=()=>{this.recalculate()},this._torrent.wires.forEach((e=>{this._initWire(e)})),this._torrent.on("wire",this._onWire),this.recalculate()}getRarestPiece(e){let t=[],n=1/0;for(let i=0;i{this._cleanupWireEvents(e)})),this._torrent=null,this._pieces=null,this._onWire=null,this._onWireHave=null,this._onWireBitfield=null}_initWire(e){e._onClose=()=>{this._cleanupWireEvents(e);for(let t=0;t0&&(n=Math.min(n,t))}return n}function G(){}t.exports=class extends r{constructor(e,t,n){super(),this._debugId="unknown infohash",this.client=t,this.announce=n.announce,this.urlList=n.urlList,this.path=n.path||K,this.addUID=n.addUID||!1,this.skipVerify=!!n.skipVerify,this._store=n.store||b,this._preloadedStore=n.preloadedStore||null,this._storeCacheSlots=void 0!==n.storeCacheSlots?n.storeCacheSlots:20,this._destroyStoreOnDestroy=n.destroyStoreOnDestroy||!1,this._getAnnounceOpts=n.getAnnounceOpts,"boolean"==typeof n.private&&(this.private=n.private),this.strategy=n.strategy||"sequential",this.maxWebConns=n.maxWebConns||4,this._rechokeNumSlots=!1===n.uploads||0===n.uploads?0:+n.uploads||10,this._rechokeOptimisticWire=null,this._rechokeOptimisticTime=0,this._rechokeIntervalId=null,this.ready=!1,this.destroyed=!1,this.paused=n.paused||!1,this.done=!1,this.metadata=null,this.store=null,this.storeOpts=n.storeOpts,this.files=[],this.pieces=[],this._amInterested=!1,this._selections=[],this._critical=[],this.wires=[],this._queue=[],this._peers={},this._peersLength=0,this.received=0,this.uploaded=0,this._downloadSpeed=T(),this._uploadSpeed=T(),this._servers=[],this._xsRequests=[],this._fileModtimes=n.fileModtimes,null!==e&&this._onTorrentId(e),this._debug("new torrent")}get timeRemaining(){return this.done?0:0===this.downloadSpeed?1/0:(this.length-this.downloaded)/this.downloadSpeed*1e3}get downloaded(){if(!this.bitfield)return 0;let e=0;for(let t=0,n=this.pieces.length;t{this.destroyed||this._onParsedTorrent(t)}))):S.remote(e,((e,t)=>{if(!this.destroyed)return e?this._destroy(e):void this._onParsedTorrent(t)}))}_onParsedTorrent(e){if(!this.destroyed){if(this._processParsedTorrent(e),!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(e){this._debugId=e.infoHash.toString("hex").substring(0,7),void 0!==this.private&&(e.private=this.private),this.announce&&(e.announce=e.announce.concat(this.announce)),this.client.tracker&&i.WEBTORRENT_ANNOUNCE&&!e.private&&(e.announce=e.announce.concat(i.WEBTORRENT_ANNOUNCE)),this.urlList&&(e.urlList=e.urlList.concat(this.urlList)),e.announce=Array.from(new Set(e.announce)),e.urlList=Array.from(new Set(e.urlList)),Object.assign(this,e),this.magnetURI=S.toMagnetURI(e),this.torrentFile=S.toTorrentFile(e)}_onListening(){this.destroyed||(this.info?this._onMetadata(this):(this.xs&&this._getMetadataFromServer(),this._startDiscovery()))}_startDiscovery(){if(this.discovery||this.destroyed)return;let e=this.client.tracker;e&&(e=Object.assign({},this.client.tracker,{getAnnounceOpts:()=>{if(this.destroyed)return;const e={uploaded:this.uploaded,downloaded:this.downloaded,left:Math.max(this.length-this.downloaded,0)};return this.client.tracker.getAnnounceOpts&&Object.assign(e,this.client.tracker.getAnnounceOpts()),this._getAnnounceOpts&&Object.assign(e,this._getAnnounceOpts()),e}})),this.peerAddresses&&this.peerAddresses.forEach((e=>this.addPeer(e))),this.discovery=new m({infoHash:this.infoHash,announce:this.announce,peerId:this.client.peerId,dht:!this.private&&this.client.dht,tracker:e,port:this.client.torrentPort,userAgent:V,lsd:this.client.lsd}),this.discovery.on("error",(e=>{this._destroy(e)})),this.discovery.on("peer",((e,t)=>{this._debug("peer %s discovered via %s",e,t),"string"==typeof e&&this.done||this.addPeer(e)})),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",(e=>{this.emit("warning",e)}))}_getMetadataFromServer(){const e=this,t=(Array.isArray(this.xs)?this.xs:[this.xs]).map((t=>n=>{!function(t,n){if(0!==t.indexOf("http://")&&0!==t.indexOf("https://"))return e.emit("warning",new Error(`skipping non-http xs param: ${t}`)),n(null);const i={url:t,method:"GET",headers:{"user-agent":V}};let r;try{r=v.concat(i,o)}catch(i){return e.emit("warning",new Error(`skipping invalid url xs param: ${t}`)),n(null)}function o(i,r,o){if(e.destroyed)return n(null);if(e.metadata)return n(null);if(i)return e.emit("warning",new Error(`http error from xs param: ${t}`)),n(null);if(200!==r.statusCode)return e.emit("warning",new Error(`non-200 status code ${r.statusCode} from xs param: ${t}`)),n(null);let a;try{a=S(o)}catch(i){}return a?a.infoHash!==e.infoHash?(e.emit("warning",new Error(`got torrent file with incorrect info hash from xs param: ${t}`)),n(null)):(e._onMetadata(a),void n(null)):(e.emit("warning",new Error(`got invalid torrent file from xs param: ${t}`)),n(null))}e._xsRequests.push(r)}(t,n)}));w(t)}_onMetadata(e){if(this.metadata||this.destroyed)return;let t;if(this._debug("got metadata"),this._xsRequests.forEach((e=>{e.abort()})),this._xsRequests=[],e&&e.infoHash)t=e;else try{t=S(e)}catch(e){return this._destroy(e)}this._processParsedTorrent(t),this.metadata=this.torrentFile,this.client.enableWebSeeds&&this.urlList.forEach((e=>{this.addWebSeed(e)})),this._rarityMap=new L(this),this.files=this.files.map((e=>new O(this,e)));let n=this._preloadedStore;if(n||(n=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})),this._storeCacheSlots>0&&!(n instanceof x)&&(n=new p(n,{max:this._storeCacheSlots})),this.store=new g(n),this.so?this.files.forEach(((e,t)=>{this.so.includes(t)?this.files[t].select():this.files[t].deselect()})):0!==this.pieces.length&&this.select(0,this.pieces.length-1,!1),this._hashes=this.pieces,this.pieces=this.pieces.map(((e,t)=>{const n=t===this.pieces.length-1?this.lastPieceLength:this.pieceLength;return new E(n)})),this._reservations=this.pieces.map((()=>[])),this.bitfield=new u(this.pieces.length),this.emit("metadata"),!this.destroyed)if(this.skipVerify)this._markAllVerified(),this._onStore();else{const e=e=>{if(e)return this._destroy(e);this._debug("done verifying"),this._onStore()};this._debug("verifying existing torrent data"),this._fileModtimes&&this._store===b?this.getFileModtimes(((t,n)=>{if(t)return this._destroy(t);this.files.map(((e,t)=>n[t]===this._fileModtimes[t])).every((e=>e))?(this._markAllVerified(),this._onStore()):this._verifyPieces(e)})):this._verifyPieces(e)}}getFileModtimes(e){const t=[];k(this.files.map(((e,n)=>i=>{const r=this.addUID?c.join(this.name+" - "+this.infoHash.slice(0,8)):c.join(this.path,e.path);o.stat(r,((e,r)=>{if(e&&"ENOENT"!==e.code)return i(e);t[n]=r&&r.mtime.getTime(),i(null)}))})),F,(n=>{this._debug("done getting file modtimes"),e(n,t)}))}_verifyPieces(e){k(this.pieces.map(((e,t)=>e=>{if(this.destroyed)return e(new Error("torrent is destroyed"));const n={};t===this.pieces.length-1&&(n.length=this.lastPieceLength),this.store.get(t,n,((n,i)=>this.destroyed?e(new Error("torrent is destroyed")):n?A((()=>e(null))):void I(i,(n=>{if(this.destroyed)return e(new Error("torrent is destroyed"));n===this._hashes[t]?(this._debug("piece verified %s",t),this._markVerified(t)):this._debug("piece invalid %s",t),e(null)}))))})),F,e)}rescanFiles(e){if(this.destroyed)throw new Error("torrent is destroyed");e||(e=G),this._verifyPieces((t=>{if(t)return this._destroy(t),e(t);this._checkDone(),e(null)}))}_markAllVerified(){for(let e=0;ee))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((e=>{e.ut_metadata&&e.ut_metadata.setMetadata(this.metadata),this._onWireWithMetadata(e)})))}destroy(e,t){if("function"==typeof e)return this.destroy(null,e);this._destroy(null,e,t)}_destroy(e,t,n){if("function"==typeof t)return this._destroy(e,null,t);if(this.destroyed)return;this.destroyed=!0,this._debug("destroy"),this.client._remove(this),clearInterval(this._rechokeIntervalId),this._xsRequests.forEach((e=>{e.abort()})),this._rarityMap&&this._rarityMap.destroy();for(const e in this._peers)this.removePeer(e);this.files.forEach((e=>{e instanceof O&&e._destroy()}));const i=this._servers.map((e=>t=>{e.destroy(t)}));if(this.discovery&&i.push((e=>{this.discovery.destroy(e)})),this.store){let e=this._destroyStoreOnDestroy;t&&void 0!==t.destroyStore&&(e=t.destroyStore),i.push((t=>{e?this.store.destroy(t):this.store.close(t)}))}w(i,n),e&&(0===this.listenerCount("error")?this.client.emit("error",e):this.emit("error",e)),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(e){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 t;if(this.client.blocked){if("string"==typeof e){let n;try{n=l(e)}catch(t){return this._debug("ignoring peer: invalid %s",e),this.emit("invalidPeer",e),!1}t=n[0]}else"string"==typeof e.remoteAddress&&(t=e.remoteAddress);if(t&&this.client.blocked.contains(t))return this._debug("ignoring peer: blocked %s",e),"string"!=typeof e&&e.destroy(),this.emit("blockedPeer",e),!1}const n=this.client.utp&&this._isIPv4(t)?"utp":"tcp",i=!!this._addPeer(e,n);return i?this.emit("peer",e):this.emit("invalidPeer",e),i}_addPeer(e,t){if(this.destroyed)return"string"!=typeof e&&e.destroy(),null;if("string"==typeof e&&!this._validAddr(e))return this._debug("ignoring peer: invalid %s",e),null;const n=e&&e.id||e;if(this._peers[n])return this._debug("ignoring peer: duplicate (%s)",n),"string"!=typeof e&&e.destroy(),null;if(this.paused)return this._debug("ignoring peer: torrent is paused"),"string"!=typeof e&&e.destroy(),null;let i;return this._debug("add peer %s",n),i="string"==typeof e?"utp"===t?P.createUTPOutgoingPeer(e,this,this.client.throttleGroups):P.createTCPOutgoingPeer(e,this,this.client.throttleGroups):P.createWebRTCPeer(e,this,this.client.throttleGroups),this._registerPeer(i),"string"==typeof e&&(this._queue.push(i),this._drain()),i}addWebSeed(e){if(this.destroyed)throw new Error("torrent is destroyed");let t,n;if("string"==typeof e){if(t=e,!/^https?:\/\/.+/.test(t))return this.emit("warning",new Error(`ignoring invalid web seed: ${t}`)),void this.emit("invalidPeer",t);if(this._peers[t])return this.emit("warning",new Error(`ignoring duplicate web seed: ${t}`)),void this.emit("invalidPeer",t);n=new N(t,this)}else{if(!e||"string"!=typeof e.connId)return void this.emit("warning",new Error("addWebSeed must be passed a string or connection object with id property"));if(n=e,t=n.connId,this._peers[t])return this.emit("warning",new Error(`ignoring duplicate web seed: ${t}`)),void this.emit("invalidPeer",t)}this._debug("add web seed %s",t);const i=P.createWebSeedPeer(n,t,this,this.client.throttleGroups);this._registerPeer(i),this.emit("peer",t)}_addIncomingPeer(e){return this.destroyed?e.destroy(new Error("torrent is destroyed")):this.paused?e.destroy(new Error("torrent is paused")):(this._debug("add incoming peer %s",e.id),void this._registerPeer(e))}_registerPeer(e){e.on("download",(e=>{this.destroyed||(this.received+=e,this._downloadSpeed(e),this.client._downloadSpeed(e),this.emit("download",e),this.destroyed||this.client.emit("download",e))})),e.on("upload",(e=>{this.destroyed||(this.uploaded+=e,this._uploadSpeed(e),this.client._uploadSpeed(e),this.emit("upload",e),this.destroyed||this.client.emit("upload",e))})),this._peers[e.id]=e,this._peersLength+=1}removePeer(e){const t=e?.id||e;e&&!e.id&&(e=this._peers?.[t]),e&&(e.destroy(),this.destroyed||(this._debug("removePeer %s",t),delete this._peers[t],this._peersLength-=1,this._drain()))}select(e,t,n,i){if(this.destroyed)throw new Error("torrent is destroyed");if(e<0||tt.priority-e.priority)),this._updateSelections()}deselect(e,t,n){if(this.destroyed)throw new Error("torrent is destroyed");n=Number(n)||0,this._debug("deselect %s-%s (priority %s)",e,t,n);for(let i=0;i{if(!this.destroyed&&!this.client.dht.destroyed){if(!e.remoteAddress)return this._debug("ignoring PORT from peer with no address");if(0===n||n>65536)return this._debug("ignoring invalid PORT from peer");this._debug("port: %s (from %s)",n,t),this.client.dht.addNode({host:e.remoteAddress,port:n})}})),e.on("timeout",(()=>{this._debug("wire timeout (%s)",t),e.destroy()})),"webSeed"!==e.type&&e.setTimeout(3e4,!0),e.setKeepAlive(!0),e.use(C(this.metadata)),e.ut_metadata.on("warning",(e=>{this._debug("ut_metadata warning: %s",e.message)})),this.metadata||(e.ut_metadata.on("metadata",(e=>{this._debug("got metadata via ut_metadata"),this._onMetadata(e)})),e.ut_metadata.fetch()),"function"!=typeof B||this.private||(e.use(B()),e.ut_pex.on("peer",(e=>{this.done||(this._debug("ut_pex: got peer: %s (from %s)",e,t),this.addPeer(e))})),e.ut_pex.on("dropped",(e=>{const n=this._peers[e];n&&!n.connected&&(this._debug("ut_pex: dropped peer: %s (from %s)",e,t),this.removePeer(e))})),e.once("close",(()=>{e.ut_pex.reset()}))),e.use(y()),this.emit("wire",e,t),this.ready&&A((()=>{this._onWireWithMetadata(e)}))}_onWireWithMetadata(e){let t=null;const n=()=>{this.destroyed||e.destroyed||(this._numQueued>2*(this._numConns-this.numPeers)&&e.amInterested?e.destroy():(t=setTimeout(n,z),t.unref&&t.unref()))};let i;const r=()=>{if(e.peerPieces.buffer.length===this.bitfield.buffer.length){for(i=0;i{r(),this._update(),this._updateWireInterest(e)})),e.on("have",(()=>{r(),this._update(),this._updateWireInterest(e)})),e.lt_donthave.on("donthave",(()=>{r(),this._update(),this._updateWireInterest(e)})),e.on("have-all",(()=>{e.isSeeder=!0,e.choke(),this._update(),this._updateWireInterest(e)})),e.on("have-none",(()=>{e.isSeeder=!1,this._update(),this._updateWireInterest(e)})),e.on("allowed-fast",(e=>{this._update()})),e.once("interested",(()=>{e.unchoke()})),e.once("close",(()=>{clearTimeout(t)})),e.on("choke",(()=>{clearTimeout(t),t=setTimeout(n,z),t.unref&&t.unref()})),e.on("unchoke",(()=>{clearTimeout(t),this._update()})),e.on("request",((t,n,i,r)=>{if(i>131072)return e.destroy();this.pieces[t]||this.store.get(t,{offset:n,length:i},r)})),e.hasFast&&this._hasAllPieces()?e.haveAll():e.hasFast&&this._hasNoPieces()?e.haveNone():e.bitfield(this.bitfield),this._updateWireInterest(e),e.peerExtensions.dht&&this.client.dht&&this.client.dht.listening&&e.port(this.client.dht.address().port),"webSeed"!==e.type&&(t=setTimeout(n,z),t.unref&&t.unref()),e.isSeeder=!1,r()}_updateSelections(){this.ready&&!this.destroyed&&(A((()=>{this._gcSelections()})),this._updateInterest(),this._update())}_gcSelections(){for(let e=0;ethis._updateWireInterest(e))),e!==this._amInterested&&(this._amInterested?this.emit("interested"):this.emit("uninterested"))}_updateWireInterest(e){let t=!1;for(let n=0;n{t._updateWire(e)}),{timeout:250}):t._updateWire(e)}_updateWire(e){if(e.destroyed)return!1;const t=this,n=$(e,.5);if(e.requests.length>=n)return;const i=$(e,1);if(e.peerChoking)e.hasFast&&e.peerAllowedFastSet.length>0&&!this._hasMorePieces(e.peerAllowedFastSet.length-1)&&function(){if(e.requests.length>=i)return!1;for(const n of e.peerAllowedFastSet){if(e.peerPieces.get(n)&&!t.bitfield.get(n))for(;t._request(e,n,!1)&&e.requests.length=i.from+i.offset;--o)if(e.peerPieces.get(o)&&t._request(e,o,!1))return}}();a(!1)||a(!0)}function r(t,n,i,r){return o=>o>=t&&o<=n&&!(o in i)&&e.peerPieces.get(o)&&(!r||r(o))}function o(e){let n=e;for(let i=e;i=i)return!0;const a=function(){const n=e.downloadSpeed()||1;if(n>H)return()=>!0;const i=Math.max(1,e.requests.length)*E.BLOCK_LENGTH/n;let r=10,o=0;return e=>{if(!r||t.bitfield.get(e))return!0;let a=t.pieces[e].missing;for(;o0))return r--,!1}return!0}}();for(let s=0;s({wire:e,random:Math.random()}))).sort(((e,t)=>{const n=e.wire,i=t.wire;return n.downloadSpeed()!==i.downloadSpeed()?n.downloadSpeed()-i.downloadSpeed():n.uploadSpeed()!==i.uploadSpeed()?n.uploadSpeed()-i.uploadSpeed():n.amChoking!==i.amChoking?n.amChoking?-1:1:e.random-t.random})).map((e=>e.wire));this._rechokeOptimisticTime<=0?this._rechokeOptimisticWire=null:this._rechokeOptimisticTime-=1;let t=0;for(;e.length>0&&t0){const t=e.filter((e=>e.peerInterested));if(t.length>0){const e=t[(n=t.length,Math.random()*n|0)];e.unchoke(),this._rechokeOptimisticWire=e,this._rechokeOptimisticTime=2}}var n;e.filter((e=>e!==this._rechokeOptimisticWire)).forEach((e=>e.choke()))}_hotswap(e,t){const n=e.downloadSpeed();if(n=H||(2*s>n||s>a||(r=t,a=s))}if(!r)return!1;for(o=0;o=a)return!1;const s=i.pieces[t];let c=o?s.reserveRemaining():s.reserve();if(-1===c&&n&&i._hotswap(e,t)&&(c=o?s.reserveRemaining():s.reserve()),-1===c)return!1;let l=i._reservations[t];l||(l=i._reservations[t]=[]);let u=l.indexOf(null);-1===u&&(u=l.length),l[u]=e;const p=s.chunkOffset(c),d=o?s.chunkLengthRemaining(c):s.chunkLength(c);function f(){A((()=>{i._update()}))}return e.request(t,p,d,(function n(r,a){if(i.destroyed)return;if(!i.ready)return i.once("ready",(()=>{n(r,a)}));if(l[u]===e&&(l[u]=null),s!==i.pieces[t])return f();if(r)return i._debug("error getting piece %s (offset: %s length: %s) from %s: %s",t,p,d,`${e.remoteAddress}:${e.remotePort}`,r.message),o?s.cancelRemaining(c):s.cancel(c),void f();if(i._debug("got piece %s (offset: %s length: %s) from %s",t,p,d,`${e.remoteAddress}:${e.remotePort}`),!s.set(c,a,e))return f();const h=s.flush();I(h,(e=>{i.destroyed||(e===i._hashes[t]?(i._debug("piece verified %s",t),i.store.put(t,h,(e=>{e?i._destroy(e):(i.pieces[t]=null,i._markVerified(t),i.wires.forEach((e=>{e.have(t)})),i._checkDone()&&!i.destroyed&&i.discovery.complete(),f())}))):(i.pieces[t]=new E(s.length),i.emit("warning",new Error(`Piece ${t} failed verification`)),f()))}))})),!0}_checkDone(){if(this.destroyed)return;this.files.forEach((e=>{if(!e.done){for(let t=e._startPiece;t<=e._endPiece;++t)if(!this.bitfield.get(t))return;e.done=!0,e.emit("done"),this._debug(`file done: ${e.name}`)}}));let e=!0;for(const t of this._selections){for(let n=t.from;n<=t.to;n++)if(!this.bitfield.get(n)){e=!1;break}if(!e)break}return!this.done&&e?(this.done=!0,this._debug(`torrent done: ${this.infoHash}`),this.emit("done")):this.done=!1,this._gcSelections(),e}load(e,t){if(this.destroyed)throw new Error("torrent is destroyed");if(!this.ready)return this.once("ready",(()=>{this.load(e,t)}));Array.isArray(e)||(e=[e]),t||(t=G);const n=R.from(_(e)),i=new d(this.store,this.pieceLength);M(n,i,(e=>{if(e)return t(e);this._markAllVerified(),this._checkDone(),t(null)}))}createServer(e){if("function"!=typeof U)throw new Error("node.js-only method");if(this.destroyed)throw new Error("torrent is destroyed");const t=new U(this,e);return this._servers.push(t),t}pause(){this.destroyed||(this._debug("pause"),this.paused=!0)}resume(){this.destroyed||(this._debug("resume"),this.paused=!1,this._drain())}_debug(){const e=[].slice.call(arguments);e[0]=`[${this.client?this.client._debugId:"No Client"}] [${this._debugId}] ${e[0]}`,D(...e)}_drain(){if(this._debug("_drain numConns %s maxConns %s",this._numConns,this.client.maxConns),"function"!=typeof a.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 e=this._queue.shift();if(!e)return;this._debug("%s connect attempt to %s",e.type,e.addr);const t=l(e.addr),n={host:t[0],port:t[1]};this.client.utp&&"utpOutgoing"===e.type?e.conn=q.connect(n.port,n.host):e.conn=a.connect(n);const i=e.conn;i.once("connect",(()=>{this.destroyed||e.onConnect()})),i.once("error",(t=>{e.destroy(t)})),e.startConnectTimeout(),i.on("close",(()=>{if(this.destroyed)return;if(e.retries>=W.length){if(this.client.utp){const t=this._addPeer(e.addr,"tcp");t&&(t.retries=0)}else this._debug("conn %s closed: will not re-add (max %s attempts)",e.addr,W.length);return}const t=W[e.retries];this._debug("conn %s closed: will re-add to queue in %sms (attempt %s)",e.addr,t,e.retries+1);const n=setTimeout((()=>{if(this.destroyed)return;const t=l(e.addr)[0],n=this.client.utp&&this._isIPv4(t)?"utp":"tcp",i=this._addPeer(e.addr,n);i&&(i.retries=e.retries+1)}),t);n.unref&&n.unref()}))}_validAddr(e){let t;try{t=l(e)}catch(e){return!1}const n=t[0],i=t[1];return i>0&&i<65535&&!("127.0.0.1"===n&&i===this.client.torrentPort)}_isIPv4(e){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(e)}}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../package.json":469,"./file.js":464,"./peer.js":465,"./rarity-map.js":466,"./server.js":67,"./utp.js":67,"./webconn.js":468,_process:309,"addr-to-ip-port":2,bitfield:26,"cache-chunk-store":117,"chunk-store-stream/write":135,cpus:139,debug:148,events:181,fs:67,"fs-chunk-store":258,"immediate-chunk-store":228,"join-async-iterator":232,lt_donthave:239,"memory-chunk-store":258,net:67,os:67,"parse-torrent":300,path:301,pump:317,"queue-microtask":327,"random-iterate":329,"run-parallel":354,"run-parallel-limit":353,"simple-get":369,"simple-sha1":386,streamx:446,throughput:450,"torrent-discovery":453,"torrent-piece":454,ut_metadata:458,ut_pex:67}],468:[function(e,t,n){(function(n){(function(){const{default:i}=e("bitfield"),r=e("debug"),o=e("simple-get"),a=e("lt_donthave"),s=e("simple-sha1"),c=e("bittorrent-protocol"),l=r("webtorrent:webconn"),u=e("../package.json").version;t.exports=class extends c{constructor(e,t){super(),this.url=e,this.connId=e,this.webPeerId=s.sync(e),this._torrent=t,this._init()}_init(){this.setKeepAlive(!0),this.use(a()),this.once("handshake",((e,t)=>{if(this.destroyed)return;this.handshake(e,this.webPeerId);const n=this._torrent.pieces.length,r=new i(n);for(let e=0;e<=n;e++)r.set(e,!0);this.bitfield(r)})),this.once("interested",(()=>{l("interested"),this.unchoke()})),this.on("uninterested",(()=>{l("uninterested")})),this.on("choke",(()=>{l("choke")})),this.on("unchoke",(()=>{l("unchoke")})),this.on("bitfield",(()=>{l("bitfield")})),this.lt_donthave.on("donthave",(()=>{l("donthave")})),this.on("request",((e,t,n,i)=>{l("request pieceIndex=%d offset=%d length=%d",e,t,n),this.httpRequest(e,t,n,((t,n)=>{if(t){this.lt_donthave.donthave(e);const t=setTimeout((()=>{this.destroyed||this.have(e)}),1e4);t.unref&&t.unref()}i(t,n)}))}))}httpRequest(e,t,i,r){const a=e*this._torrent.pieceLength+t,s=a+i-1,c=this._torrent.files;let p;if(c.length<=1)p=[{url:this.url,start:a,end:s}];else{const e=c.filter((e=>e.offset<=s&&e.offset+e.length>a));if(e.length<1)return r(new Error("Could not find file corresponding to web seed range request"));p=e.map((e=>{const t=e.offset+e.length-1;return{url:this.url+("/"===this.url[this.url.length-1]?"":"/")+e.path.replace(this._torrent.path,""),fileOffsetInRange:Math.max(e.offset-a,0),start:Math.max(a-e.offset,0),end:Math.min(t,s-e.offset)}}))}let d,f=0,h=!1;p.length>1&&(d=n.alloc(i)),p.forEach((n=>{const a=n.url,s=n.start,c=n.end;l("Requesting url=%s pieceIndex=%d offset=%d length=%d start=%d end=%d",a,e,t,i,s,c);const m={url:a,method:"GET",headers:{"user-agent":`WebTorrent/${u} (https://webtorrent.io)`,range:`bytes=${s}-${c}`},timeout:6e4};function b(e,t){if(e.statusCode<200||e.statusCode>=300){if(h)return;return h=!0,r(new Error(`Unexpected HTTP status code ${e.statusCode}`))}l("Got data of length %d",t.length),1===p.length?r(null,t):(t.copy(d,n.fileOffsetInRange),++f===p.length&&r(null,d))}o.concat(m,((e,t,n)=>{if(!h)return e?"undefined"==typeof window||a.startsWith(`${window.location.origin}/`)?(h=!0,r(e)):o.head(a,((t,n)=>{if(!h){if(t)return h=!0,r(t);if(n.statusCode<200||n.statusCode>=300)return h=!0,r(new Error(`Unexpected HTTP status code ${n.statusCode}`));if(n.url===a)return h=!0,r(e);m.url=n.url,o.concat(m,((e,t,n)=>{if(!h)return e?(h=!0,r(e)):void b(t,n)}))}})):void b(t,n)}))}))}destroy(){super.destroy(),this._torrent=null}}}).call(this)}).call(this,e("buffer").Buffer)},{"../package.json":469,bitfield:26,"bittorrent-protocol":27,buffer:110,debug:148,lt_donthave:239,"simple-get":369,"simple-sha1":386}],469:[function(e,t,n){t.exports={version:"1.9.7"}},{}],470:[function(e,t,n){t.exports=function e(t,n){if(t&&n)return e(t)(n);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){i[e]=t[e]})),i;function i(){for(var e=new Array(arguments.length),n=0;n1080?(N.setProps({placement:"right"}),D.setProps({placement:"right"}),z.setProps({placement:"right"}),H.setProps({placement:"right"})):(N.setProps({placement:"top"}),D.setProps({placement:"top"}),z.setProps({placement:"top"}),H.setProps({placement:"top"}))}function K(e){Z();try{console.info("Attempting parse"),l=i(e),G(),l.xs&&(console.info("Magnet includes xs, attempting remote parse"),$(l.xs))}catch(t){console.warn(t),"magnet"==c?(console.info("Attempting remote parse"),$(e)):(W.error("Problem parsing input. Is this a .torrent file?"),console.error("Problem parsing input"))}}function $(e){i.remote(e,(function(e,t){if(e)return W.error("Problem remotely fetching that file or parsing result"),console.warn(e),void Z();c="remote-torrent-file",m.innerHTML='',b.setContent("Currently loaded information sourced from remotely fetched Torrent file"),l=t,G()}))}function G(){if(console.log(l),w.value=l.infoHash,v.value=l.name?l.name:"",l.created?(y.value=l.created.toISOString().slice(0,19),y.type="datetime-local"):y.type="text",x.value=l.createdBy?" by "+l.createdBy:"",_.value=l.comment?l.comment:"",T.value=l.pieces?l.pieces.length.toLocaleString()+" "+r.format(l.pieceLength,{decimalPlaces:1,unitSeparator:" "})+" pieces (last piece "+r.format(l.lastPieceLength,{decimalPlaces:1,unitSeparator:" "})+")":"",M.innerHTML="",l.announce&&l.announce.length)for(let e=0;e',i.addEventListener("click",te),t.appendChild(i),M.appendChild(t)}if(A.innerHTML="",l.urlList&&l.urlList.length)for(let e=0;e',i.addEventListener("click",te),t.appendChild(i),A.appendChild(t)}if(C.innerHTML="",l.files&&l.files.length){if(B.style.display="none",l.files.length<100)for(let e of l.files){let t=Y(o.lookup(e.name));C.appendChild(X(t,e.name,e.length))}else{for(let e=0;e<100;e++){let t=Y(o.lookup(l.files[e].name));C.appendChild(X(t,l.files[e].name,l.files[e].length))}C.appendChild(X("","...and another "+(l.files.length-100)+" more files",""))}C.appendChild(X("folder-tree","",l.length)),R.href=i.toMagnetURI(l),H.setContent("Download Torrent file"),q.addEventListener("click",oe),q.disabled=!1}else F.torrents.length>0?(B.style.display="none",C.innerHTML=''):(B.style.display="block",C.innerHTML=''),H.setContent("Files metadata is required to generate a Torrent file. Try fetching files list from WebTorrent."),q.removeEventListener("click",oe),q.disabled=!0;P.setAttribute("data-clipboard-text",window.location.origin+"#"+i.toMagnetURI(l)),L.setAttribute("data-clipboard-text",i.toMagnetURI(l)),u.style.display="none",h.style.display="flex",window.location.hash=i.toMagnetURI(l),l.name?document.title="Torrent Parts | "+l.name:document.title="Torrent Parts | Inspect and edit what's in your Torrent file or Magnet link",b.enable()}function X(e,t,n){let i=document.createElement("tr"),o=document.createElement("td");e&&(o.innerHTML=''),i.appendChild(o);let a=document.createElement("td");a.innerHTML=t,i.appendChild(a);let s=document.createElement("td");return s.innerHTML=r.format(n,{decimalPlaces:1,unitSeparator:" "}),i.appendChild(s),i}function Y(e){if(!e)return"file";switch(!0){case e.includes("msword"):case e.includes("wordprocessingml"):case e.includes("opendocument.text"):case e.includes("abiword"):return"file-word";case e.includes("ms-excel"):case e.includes("spreadsheet"):case e.includes("powerpoint"):case e.includes("presentation"):return"file-powerpoint";case e.includes("7z-"):case e.includes("iso9660"):case e.includes("zip"):case e.includes("octet-stream"):return"file-archive";case e.includes("csv"):return"file-csv";case e.includes("pdf"):return"file-pdf";case e.includes("font"):return"file-contract";case e.includes("text"):case e.includes("subrip"):case e.includes("vtt"):return"file-alt";case e.includes("audio"):return"file-audio";case e.includes("image"):return"file-image";case e.includes("video"):return"file-video";default:return"file"}}function J(e){this.dataset.group?l[this.dataset.group][this.dataset.index]=this.value?this.value:"":l[this.id]=this.value?this.value:"",window.location.hash=i.toMagnetURI(l),ie()}function Z(){document.getElementById("magnet").value="",document.getElementById("torrent").value="",u.style.display="flex",h.style.display="none",v.value="",y.value="",x.value="",_.value="",w.value="",M.innerHTML="",A.innerHTML="",F.torrents.forEach((e=>e.destroy())),B.style.display="block",C.innerHTML="",window.location.hash="",P.setAttribute("data-clipboard-text",""),L.setAttribute("data-clipboard-text",""),document.title="Torrent Parts | Inspect and edit what's in your Torrent file or Magnet link",b.disable()}async function Q(){k.className="disabled",k.innerHTML="Adding...";try{let e=await fetch("https://newtrackon.com/api/stable"),t=await e.text();l.announce=l.announce.concat(t.split("\n\n")),l.announce.push("http://bt1.archive.org:6969/announce"),l.announce.push("http://bt2.archive.org:6969/announce"),l.announce=l.announce.filter(((e,t)=>e&&l.announce.indexOf(e)===t)),W.success("Added known working trackers from newTrackon"),ie()}catch(e){W.error("Problem fetching trackers from newTrackon"),console.warn(e)}k.className="",k.innerHTML="Add Known Working Trackers",G()}function ee(){l[this.dataset.type].unshift(""),G()}function te(){l[this.parentElement.className].splice(this.parentElement.dataset.index,1),G()}function ne(e){l[e]=[],ie(),G()}function ie(){l.created=new Date,l.createdBy="Torrent Parts ",l.created?(y.value=l.created.toISOString().slice(0,19),y.type="datetime-local"):y.type="text",x.value=l.createdBy?" by "+l.createdBy:""}function re(){console.info("Attempting fetching files from Webtorrent..."),B.style.display="none",l.announce.push("wss://tracker.webtorrent.io"),l.announce.push("wss://tracker.openwebtorrent.com"),l.announce.push("wss://tracker.btorrent.xyz"),l.announce.push("wss://tracker.fastcast.nz"),l.announce=l.announce.filter(((e,t)=>e&&l.announce.indexOf(e)===t)),F.add(i.toMagnetURI(l),(e=>{l.info=Object.assign({},e.info),l.files=e.files,l.infoBuffer=e.infoBuffer,l.length=e.length,l.lastPieceLength=e.lastPieceLength,ie(),G(),W.success("Fetched file details from Webtorrent peers"),e.destroy()})),G()}function oe(){let e=i.toTorrentFile(l);if(null!==e&&navigator.msSaveBlob)return navigator.msSaveBlob(new Blob([e],{type:"application/x-bittorrent"}),l.name+".torrent");let t=document.createElement("a");t.style.display="none";let n=window.URL.createObjectURL(new Blob([e],{type:"application/x-bittorrent"}));t.setAttribute("href",n),t.setAttribute("download",l.name+".torrent"),document.body.appendChild(t),t.click(),window.URL.revokeObjectURL(n),t.remove()}window.addEventListener("resize",V),V(),document.addEventListener("DOMContentLoaded",(function(){document.getElementById("magnet").addEventListener("keyup",(function(e){e.preventDefault(),"Enter"===e.key&&(c="magnet",m.innerHTML='',b.setContent("Currently loaded information sourced from Magnet URL"),K(magnet.value))})),document.getElementById("torrent").addEventListener("change",(function(e){e.preventDefault(),e.target.files[0].arrayBuffer().then((function(e){c="torrent-file",m.innerHTML='',b.setContent("Currently loaded information sourced from Torrent file"),K(t.from(e))}))})),document.addEventListener("dragover",(function(e){e.preventDefault()})),document.addEventListener("drop",(function(e){e.preventDefault(),e.dataTransfer.items[0].getAsFile().arrayBuffer().then((function(e){c="torrent-file",m.innerHTML='',b.setContent("Currently loaded information sourced from Torrent file"),K(t.from(e))}))})),p.addEventListener("click",(function(e){e.preventDefault(),W.success("Parsing Ubuntu 22.04 Magnet URL"),c="magnet",m.innerHTML='',b.setContent("Currently loaded information sourced from Magnet URL"),K("magnet:?xt=urn:btih:2c6b6858d61da9543d4231a71db4b1c9264b0685&dn=ubuntu-22.04-desktop-amd64.iso&tr=https%3A%2F%2Ftorrent.ubuntu.com%2Fannounce&tr=https%3A%2F%2Fipv6.torrent.ubuntu.com%2Fannounce")})),d.addEventListener("click",(async function(e){e.preventDefault(),W.success("Fetching and Parsing “The WIRED CD” Torrent File..."),c="remote-torrent-file",m.innerHTML='',b.setContent("Currently loaded information sourced from remotely fetched Torrent file"),$("https://webtorrent.io/torrents/wired-cd.torrent")})),f.addEventListener("click",(async function(e){e.preventDefault(),W.success("Parsing Jack Johnson Archive.org Torrent File");let n=await fetch("/ext/jj2008-06-14.mk4_archive.torrent"),i=await n.arrayBuffer();c="torrent-file",m.innerHTML='',b.setContent("Currently loaded information sourced from Torrent file"),K(t.from(i))}));let e=new n("#copyURL");e.on("success",(function(e){W.success("Copied site URL to clipboard!"),console.info(e)})),e.on("failure",(function(e){W.error("Problem copying to clipboard"),console.warn(e)}));let i=new n("#copyMagnet");i.on("success",(function(e){W.success("Copied Magnet URL to clipboard!")})),i.on("failure",(function(e){W.error("Problem copying to clipboard"),console.warn(e)})),v.addEventListener("input",J),v.addEventListener("change",J),v.addEventListener("reset",J),v.addEventListener("paste",J),g.addEventListener("click",Z),_.addEventListener("input",J),_.addEventListener("change",J),_.addEventListener("reset",J),_.addEventListener("paste",J),k.addEventListener("click",Q),S.addEventListener("click",ee),E.addEventListener("click",(()=>ne("announce"))),j.addEventListener("click",ee),I.addEventListener("click",(()=>ne("urlList"))),B.addEventListener("click",re),s("[data-tippy-content]",{theme:"torrent-parts",animation:"shift-away-subtle"}),b.disable(),window.location.hash&&(c="shared-url",m.innerHTML='',b.setContent("Currently loaded information sourced from shared torrent.parts link"),K(window.location.hash.split("#")[1]))}))}).call(this)}).call(this,e("buffer").Buffer)},{buffer:110,bytes:116,clipboard:137,"mime-types":263,"parse-torrent":300,"tippy.js":451,webtorrent:462}]},{},[472]);