import{c as he,a as xt}from"./overlayscrollbars-CiKU261J.js";import{I as yt,m as Rt,B as kt,H as At,P as vt,W as Tt,C as Bt,n as Lt}from"./index-Bku7SJna.js";import{m as Ct,n as Ut,r as Mt}from"./vuetify-Ce4WN_Dg.js";import"./echarts-DzoUeqWp.js";var gt={exports:{}},ge={exports:{}},Ve;function qe(){if(Ve)return ge.exports;Ve=1;var F=typeof Reflect=="object"?Reflect:null,x=F&&typeof F.apply=="function"?F.apply:function(y,R,V){return Function.prototype.apply.call(y,R,V)},A;F&&typeof F.ownKeys=="function"?A=F.ownKeys:Object.getOwnPropertySymbols?A=function(y){return Object.getOwnPropertyNames(y).concat(Object.getOwnPropertySymbols(y))}:A=function(y){return Object.getOwnPropertyNames(y)};function I(g){console&&console.warn&&console.warn(g)}var D=Number.isNaN||function(y){return y!==y};function v(){v.init.call(this)}ge.exports=v,ge.exports.once=p,v.EventEmitter=v,v.prototype._events=void 0,v.prototype._eventsCount=0,v.prototype._maxListeners=void 0;var b=10;function s(g){if(typeof g!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof g)}Object.defineProperty(v,"defaultMaxListeners",{enumerable:!0,get:function(){return b},set:function(g){if(typeof g!="number"||g<0||D(g))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+g+".");b=g}}),v.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},v.prototype.setMaxListeners=function(y){if(typeof y!="number"||y<0||D(y))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+y+".");return this._maxListeners=y,this};function E(g){return g._maxListeners===void 0?v.defaultMaxListeners:g._maxListeners}v.prototype.getMaxListeners=function(){return E(this)},v.prototype.emit=function(y){for(var R=[],V=1;V0&&(J=R[0]),J instanceof Error)throw J;var te=new Error("Unhandled error."+(J?" ("+J.message+")":""));throw te.context=J,te}var ne=z[y];if(ne===void 0)return!1;if(typeof ne=="function")x(ne,this,R);else for(var ie=ne.length,ae=L(ne,ie),V=0;V0&&J.length>H&&!J.warned){J.warned=!0;var te=new Error("Possible EventEmitter memory leak detected. "+J.length+" "+String(y)+" listeners added. Use emitter.setMaxListeners() to increase limit");te.name="MaxListenersExceededWarning",te.emitter=g,te.type=y,te.count=J.length,I(te)}return g}v.prototype.addListener=function(y,R){return U(this,y,R,!1)},v.prototype.on=v.prototype.addListener,v.prototype.prependListener=function(y,R){return U(this,y,R,!0)};function W(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function O(g,y,R){var V={fired:!1,wrapFn:void 0,target:g,type:y,listener:R},H=W.bind(V);return H.listener=R,V.wrapFn=H,H}v.prototype.once=function(y,R){return s(R),this.on(y,O(this,y,R)),this},v.prototype.prependOnceListener=function(y,R){return s(R),this.prependListener(y,O(this,y,R)),this},v.prototype.removeListener=function(y,R){var V,H,z,J,te;if(s(R),H=this._events,H===void 0)return this;if(V=H[y],V===void 0)return this;if(V===R||V.listener===R)--this._eventsCount===0?this._events=Object.create(null):(delete H[y],H.removeListener&&this.emit("removeListener",y,V.listener||R));else if(typeof V!="function"){for(z=-1,J=V.length-1;J>=0;J--)if(V[J]===R||V[J].listener===R){te=V[J].listener,z=J;break}if(z<0)return this;z===0?V.shift():j(V,z),V.length===1&&(H[y]=V[0]),H.removeListener!==void 0&&this.emit("removeListener",y,te||R)}return this},v.prototype.off=v.prototype.removeListener,v.prototype.removeAllListeners=function(y){var R,V,H;if(V=this._events,V===void 0)return this;if(V.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):V[y]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete V[y]),this;if(arguments.length===0){var z=Object.keys(V),J;for(H=0;H=0;H--)this.removeListener(y,R[H]);return this};function N(g,y,R){var V=g._events;if(V===void 0)return[];var H=V[y];return H===void 0?[]:typeof H=="function"?R?[H.listener||H]:[H]:R?P(H):L(H,H.length)}v.prototype.listeners=function(y){return N(this,y,!0)},v.prototype.rawListeners=function(y){return N(this,y,!1)},v.listenerCount=function(g,y){return typeof g.listenerCount=="function"?g.listenerCount(y):M.call(g,y)},v.prototype.listenerCount=M;function M(g){var y=this._events;if(y!==void 0){var R=y[g];if(typeof R=="function")return 1;if(R!==void 0)return R.length}return 0}v.prototype.eventNames=function(){return this._eventsCount>0?A(this._events):[]};function L(g,y){for(var R=new Array(y),V=0;V0)throw new Error("Invalid string. Length must be a multiple of 4");var j=M.indexOf("=");j===-1&&(j=L);var P=j===L?0:4-j%4;return[j,P]}function s(M){var L=b(M),j=L[0],P=L[1];return(j+P)*3/4-P}function E(M,L,j){return(L+j)*3/4-j}function U(M){var L,j=b(M),P=j[0],p=j[1],_=new A(E(M,P,p)),C=0,g=p>0?P-4:P,y;for(y=0;y>16&255,_[C++]=L>>8&255,_[C++]=L&255;return p===2&&(L=x[M.charCodeAt(y)]<<2|x[M.charCodeAt(y+1)]>>4,_[C++]=L&255),p===1&&(L=x[M.charCodeAt(y)]<<10|x[M.charCodeAt(y+1)]<<4|x[M.charCodeAt(y+2)]>>2,_[C++]=L>>8&255,_[C++]=L&255),_}function W(M){return F[M>>18&63]+F[M>>12&63]+F[M>>6&63]+F[M&63]}function O(M,L,j){for(var P,p=[],_=L;_g?g:C+_));return P===1?(L=M[j-1],p.push(F[L>>2]+F[L<<4&63]+"==")):P===2&&(L=(M[j-2]<<8)+M[j-1],p.push(F[L>>10]+F[L>>4&63]+F[L<<2&63]+"=")),p.join("")}return ve}var we={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */var Je;function Ft(){return Je||(Je=1,we.read=function(F,x,A,I,D){var v,b,s=D*8-I-1,E=(1<>1,W=-7,O=A?D-1:0,N=A?-1:1,M=F[x+O];for(O+=N,v=M&(1<<-W)-1,M>>=-W,W+=s;W>0;v=v*256+F[x+O],O+=N,W-=8);for(b=v&(1<<-W)-1,v>>=-W,W+=I;W>0;b=b*256+F[x+O],O+=N,W-=8);if(v===0)v=1-U;else{if(v===E)return b?NaN:(M?-1:1)*(1/0);b=b+Math.pow(2,I),v=v-U}return(M?-1:1)*b*Math.pow(2,v-I)},we.write=function(F,x,A,I,D,v){var b,s,E,U=v*8-D-1,W=(1<>1,N=D===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=I?0:v-1,L=I?1:-1,j=x<0||x===0&&1/x<0?1:0;for(x=Math.abs(x),isNaN(x)||x===1/0?(s=isNaN(x)?1:0,b=W):(b=Math.floor(Math.log(x)/Math.LN2),x*(E=Math.pow(2,-b))<1&&(b--,E*=2),b+O>=1?x+=N/E:x+=N*Math.pow(2,1-O),x*E>=2&&(b++,E/=2),b+O>=W?(s=0,b=W):b+O>=1?(s=(x*E-1)*Math.pow(2,D),b=b+O):(s=x*Math.pow(2,O-1)*Math.pow(2,D),b=0));D>=8;F[A+M]=s&255,M+=L,s/=256,D-=8);for(b=b<0;F[A+M]=b&255,M+=L,b/=256,U-=8);F[A+M-L]|=j*128}),we}/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */var $e;function Ee(){return $e||($e=1,function(F){var x=Dt(),A=Ft(),I=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;F.Buffer=s,F.SlowBuffer=_,F.INSPECT_MAX_BYTES=50;var D=2147483647;F.kMaxLength=D,s.TYPED_ARRAY_SUPPORT=v(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function v(){try{var r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function b(r){if(r>D)throw new RangeError('The value "'+r+'" is invalid for option "size"');var e=new Uint8Array(r);return Object.setPrototypeOf(e,s.prototype),e}function s(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return O(r)}return E(r,e,t)}s.poolSize=8192;function E(r,e,t){if(typeof r=="string")return N(r,e);if(ArrayBuffer.isView(r))return L(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(T(r,ArrayBuffer)||r&&T(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(T(r,SharedArrayBuffer)||r&&T(r.buffer,SharedArrayBuffer)))return j(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var f=r.valueOf&&r.valueOf();if(f!=null&&f!==r)return s.from(f,e,t);var m=P(r);if(m)return m;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return s.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}s.from=function(r,e,t){return E(r,e,t)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function U(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function W(r,e,t){return U(r),r<=0?b(r):e!==void 0?typeof t=="string"?b(r).fill(e,t):b(r).fill(e):b(r)}s.alloc=function(r,e,t){return W(r,e,t)};function O(r){return U(r),b(r<0?0:p(r)|0)}s.allocUnsafe=function(r){return O(r)},s.allocUnsafeSlow=function(r){return O(r)};function N(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var t=C(r,e)|0,f=b(t),m=f.write(r,e);return m!==t&&(f=f.slice(0,m)),f}function M(r){for(var e=r.length<0?0:p(r.length)|0,t=b(e),f=0;f=D)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+D.toString(16)+" bytes");return r|0}function _(r){return+r!=r&&(r=0),s.alloc(+r)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(T(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),T(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var f=e.length,m=t.length,k=0,q=Math.min(f,m);km.length?s.from(q).copy(m,k):Uint8Array.prototype.set.call(m,q,k);else if(s.isBuffer(q))q.copy(m,k);else throw new TypeError('"list" argument must be an Array of Buffers');k+=q.length}return m};function C(r,e){if(s.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||T(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);var t=r.length,f=arguments.length>2&&arguments[2]===!0;if(!f&&t===0)return 0;for(var m=!1;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return S(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return i(r).length;default:if(m)return f?-1:S(r).length;e=(""+e).toLowerCase(),m=!0}}s.byteLength=C;function g(r,e,t){var f=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return l(this,e,t);case"utf8":case"utf-8":return ae(this,e,t);case"ascii":return oe(this,e,t);case"latin1":case"binary":return fe(this,e,t);case"base64":return ie(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n(this,e,t);default:if(f)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),f=!0}}s.prototype._isBuffer=!0;function y(r,e,t){var f=r[e];r[e]=r[t],r[t]=f}s.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tt&&(e+=" ... "),""},I&&(s.prototype[I]=s.prototype.inspect),s.prototype.compare=function(e,t,f,m,k){if(T(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),f===void 0&&(f=e?e.length:0),m===void 0&&(m=0),k===void 0&&(k=this.length),t<0||f>e.length||m<0||k>this.length)throw new RangeError("out of range index");if(m>=k&&t>=f)return 0;if(m>=k)return-1;if(t>=f)return 1;if(t>>>=0,f>>>=0,m>>>=0,k>>>=0,this===e)return 0;for(var q=k-m,$=f-t,X=Math.min(q,$),ee=this.slice(m,k),re=e.slice(t,f),Q=0;Q2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,Y(t)&&(t=m?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(m)return-1;t=r.length-1}else if(t<0)if(m)t=0;else return-1;if(typeof e=="string"&&(e=s.from(e,f)),s.isBuffer(e))return e.length===0?-1:V(r,e,t,f,m);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?m?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):V(r,[e],t,f,m);throw new TypeError("val must be string, number or Buffer")}function V(r,e,t,f,m){var k=1,q=r.length,$=e.length;if(f!==void 0&&(f=String(f).toLowerCase(),f==="ucs2"||f==="ucs-2"||f==="utf16le"||f==="utf-16le")){if(r.length<2||e.length<2)return-1;k=2,q/=2,$/=2,t/=2}function X(He,Ge){return k===1?He[Ge]:He.readUInt16BE(Ge*k)}var ee;if(m){var re=-1;for(ee=t;eeq&&(t=q-$),ee=t;ee>=0;ee--){for(var Q=!0,se=0;se<$;se++)if(X(r,ee+se)!==X(e,se)){Q=!1;break}if(Q)return ee}return-1}s.prototype.includes=function(e,t,f){return this.indexOf(e,t,f)!==-1},s.prototype.indexOf=function(e,t,f){return R(this,e,t,f,!0)},s.prototype.lastIndexOf=function(e,t,f){return R(this,e,t,f,!1)};function H(r,e,t,f){t=Number(t)||0;var m=r.length-t;f?(f=Number(f),f>m&&(f=m)):f=m;var k=e.length;f>k/2&&(f=k/2);for(var q=0;q>>0,isFinite(f)?(f=f>>>0,m===void 0&&(m="utf8")):(m=f,f=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var k=this.length-t;if((f===void 0||f>k)&&(f=k),e.length>0&&(f<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");m||(m="utf8");for(var q=!1;;)switch(m){case"hex":return H(this,e,t,f);case"utf8":case"utf-8":return z(this,e,t,f);case"ascii":case"latin1":case"binary":return J(this,e,t,f);case"base64":return te(this,e,t,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ne(this,e,t,f);default:if(q)throw new TypeError("Unknown encoding: "+m);m=(""+m).toLowerCase(),q=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ie(r,e,t){return e===0&&t===r.length?x.fromByteArray(r):x.fromByteArray(r.slice(e,t))}function ae(r,e,t){t=Math.min(r.length,t);for(var f=[],m=e;m239?4:k>223?3:k>191?2:1;if(m+$<=t){var X,ee,re,Q;switch($){case 1:k<128&&(q=k);break;case 2:X=r[m+1],(X&192)===128&&(Q=(k&31)<<6|X&63,Q>127&&(q=Q));break;case 3:X=r[m+1],ee=r[m+2],(X&192)===128&&(ee&192)===128&&(Q=(k&15)<<12|(X&63)<<6|ee&63,Q>2047&&(Q<55296||Q>57343)&&(q=Q));break;case 4:X=r[m+1],ee=r[m+2],re=r[m+3],(X&192)===128&&(ee&192)===128&&(re&192)===128&&(Q=(k&15)<<18|(X&63)<<12|(ee&63)<<6|re&63,Q>65535&&Q<1114112&&(q=Q))}}q===null?(q=65533,$=1):q>65535&&(q-=65536,f.push(q>>>10&1023|55296),q=56320|q&1023),f.push(q),m+=$}return le(f)}var ue=4096;function le(r){var e=r.length;if(e<=ue)return String.fromCharCode.apply(String,r);for(var t="",f=0;ff)&&(t=f);for(var m="",k=e;kf&&(e=f),t<0?(t+=f,t<0&&(t=0)):t>f&&(t=f),tt)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,f){e=e>>>0,t=t>>>0,f||h(e,t,this.length);for(var m=this[e],k=1,q=0;++q>>0,t=t>>>0,f||h(e,t,this.length);for(var m=this[e+--t],k=1;t>0&&(k*=256);)m+=this[e+--t]*k;return m},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e=e>>>0,t||h(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||h(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||h(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||h(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||h(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,f){e=e>>>0,t=t>>>0,f||h(e,t,this.length);for(var m=this[e],k=1,q=0;++q=k&&(m-=Math.pow(2,8*t)),m},s.prototype.readIntBE=function(e,t,f){e=e>>>0,t=t>>>0,f||h(e,t,this.length);for(var m=t,k=1,q=this[e+--m];m>0&&(k*=256);)q+=this[e+--m]*k;return k*=128,q>=k&&(q-=Math.pow(2,8*t)),q},s.prototype.readInt8=function(e,t){return e=e>>>0,t||h(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e=e>>>0,t||h(e,2,this.length);var f=this[e]|this[e+1]<<8;return f&32768?f|4294901760:f},s.prototype.readInt16BE=function(e,t){e=e>>>0,t||h(e,2,this.length);var f=this[e+1]|this[e]<<8;return f&32768?f|4294901760:f},s.prototype.readInt32LE=function(e,t){return e=e>>>0,t||h(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e=e>>>0,t||h(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e=e>>>0,t||h(e,4,this.length),A.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e=e>>>0,t||h(e,4,this.length),A.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||h(e,8,this.length),A.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||h(e,8,this.length),A.read(this,e,!1,52,8)};function u(r,e,t,f,m,k){if(!s.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>m||er.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,f,m){if(e=+e,t=t>>>0,f=f>>>0,!m){var k=Math.pow(2,8*f)-1;u(this,e,t,f,k,0)}var q=1,$=0;for(this[t]=e&255;++$>>0,f=f>>>0,!m){var k=Math.pow(2,8*f)-1;u(this,e,t,f,k,0)}var q=f-1,$=1;for(this[t+q]=e&255;--q>=0&&($*=256);)this[t+q]=e/$&255;return t+f},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,f){return e=+e,t=t>>>0,f||u(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,f){return e=+e,t=t>>>0,f||u(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,f){return e=+e,t=t>>>0,f||u(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,f){return e=+e,t=t>>>0,f||u(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,f){return e=+e,t=t>>>0,f||u(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeIntLE=function(e,t,f,m){if(e=+e,t=t>>>0,!m){var k=Math.pow(2,8*f-1);u(this,e,t,f,k-1,-k)}var q=0,$=1,X=0;for(this[t]=e&255;++q>0)-X&255;return t+f},s.prototype.writeIntBE=function(e,t,f,m){if(e=+e,t=t>>>0,!m){var k=Math.pow(2,8*f-1);u(this,e,t,f,k-1,-k)}var q=f-1,$=1,X=0;for(this[t+q]=e&255;--q>=0&&($*=256);)e<0&&X===0&&this[t+q+1]!==0&&(X=1),this[t+q]=(e/$>>0)-X&255;return t+f},s.prototype.writeInt8=function(e,t,f){return e=+e,t=t>>>0,f||u(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,f){return e=+e,t=t>>>0,f||u(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,f){return e=+e,t=t>>>0,f||u(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,f){return e=+e,t=t>>>0,f||u(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,f){return e=+e,t=t>>>0,f||u(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]=e&255,t+4};function d(r,e,t,f,m,k){if(t+f>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function w(r,e,t,f,m){return e=+e,t=t>>>0,m||d(r,e,t,4),A.write(r,e,t,f,23,4),t+4}s.prototype.writeFloatLE=function(e,t,f){return w(this,e,t,!0,f)},s.prototype.writeFloatBE=function(e,t,f){return w(this,e,t,!1,f)};function B(r,e,t,f,m){return e=+e,t=t>>>0,m||d(r,e,t,8),A.write(r,e,t,f,52,8),t+8}s.prototype.writeDoubleLE=function(e,t,f){return B(this,e,t,!0,f)},s.prototype.writeDoubleBE=function(e,t,f){return B(this,e,t,!1,f)},s.prototype.copy=function(e,t,f,m){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(f||(f=0),!m&&m!==0&&(m=this.length),t>=e.length&&(t=e.length),t||(t=0),m>0&&m=this.length)throw new RangeError("Index out of range");if(m<0)throw new RangeError("sourceEnd out of bounds");m>this.length&&(m=this.length),e.length-t>>0,f=f===void 0?this.length:f>>>0,e||(e=0);var q;if(typeof e=="number")for(q=t;q55295&&t<57344){if(!m){if(t>56319){(e-=3)>-1&&k.push(239,191,189);continue}else if(q+1===f){(e-=3)>-1&&k.push(239,191,189);continue}m=t;continue}if(t<56320){(e-=3)>-1&&k.push(239,191,189),m=t;continue}t=(m-55296<<10|t-56320)+65536}else m&&(e-=3)>-1&&k.push(239,191,189);if(m=null,t<128){if((e-=1)<0)break;k.push(t)}else if(t<2048){if((e-=2)<0)break;k.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;k.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;k.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return k}function G(r){for(var e=[],t=0;t>8,m=t%256,k.push(m),k.push(f);return k}function i(r){return x.toByteArray(a(r))}function o(r,e,t,f){for(var m=0;m=e.length||m>=r.length);++m)e[m+t]=r[m];return m}function T(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function Y(r){return r!==r}var Z=function(){for(var r="0123456789abcdef",e=new Array(256),t=0;t<16;++t)for(var f=t*16,m=0;m<16;++m)e[f+m]=r[t]+r[m];return e}()}(xe)),xe}var Re,Ze;function Ot(){if(Ze)return Re;Ze=1;function F(L,j){var P=Object.keys(L);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(L);j&&(p=p.filter(function(_){return Object.getOwnPropertyDescriptor(L,_).enumerable})),P.push.apply(P,p)}return P}function x(L){for(var j=1;j0?this.tail.next=p:this.head=p,this.tail=p,++this.length}},{key:"unshift",value:function(P){var p={data:P,next:this.head};this.length===0&&(this.tail=p),this.head=p,++this.length}},{key:"shift",value:function(){if(this.length!==0){var P=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,P}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(P){if(this.length===0)return"";for(var p=this.head,_=""+p.data;p=p.next;)_+=P+p.data;return _}},{key:"concat",value:function(P){if(this.length===0)return U.alloc(0);for(var p=U.allocUnsafe(P>>>0),_=this.head,C=0;_;)M(_.data,p,C),C+=_.data.length,_=_.next;return p}},{key:"consume",value:function(P,p){var _;return Pg.length?g.length:P;if(y===g.length?C+=g:C+=g.slice(0,P),P-=y,P===0){y===g.length?(++_,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p,p.data=g.slice(y));break}++_}return this.length-=_,C}},{key:"_getBuffer",value:function(P){var p=U.allocUnsafe(P),_=this.head,C=1;for(_.data.copy(p),P-=_.data.length;_=_.next;){var g=_.data,y=P>g.length?g.length:P;if(g.copy(p,p.length-P,0,y),P-=y,P===0){y===g.length?(++C,_.next?this.head=_.next:this.head=this.tail=null):(this.head=_,_.data=g.slice(y));break}++C}return this.length-=C,p}},{key:N,value:function(P,p){return O(this,x(x({},p),{},{depth:0,customInspect:!1}))}}]),L}(),Re}var ke,Xe;function wt(){if(Xe)return ke;Xe=1;function F(b,s){var E=this,U=this._readableState&&this._readableState.destroyed,W=this._writableState&&this._writableState.destroyed;return U||W?(s?s(b):b&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(D,this,b)):process.nextTick(D,this,b)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(b||null,function(O){!s&&O?E._writableState?E._writableState.errorEmitted?process.nextTick(A,E):(E._writableState.errorEmitted=!0,process.nextTick(x,E,O)):process.nextTick(x,E,O):s?(process.nextTick(A,E),s(O)):process.nextTick(A,E)}),this)}function x(b,s){D(b,s),A(b)}function A(b){b._writableState&&!b._writableState.emitClose||b._readableState&&!b._readableState.emitClose||b.emit("close")}function I(){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)}function D(b,s){b.emit("error",s)}function v(b,s){var E=b._readableState,U=b._writableState;E&&E.autoDestroy||U&&U.autoDestroy?b.destroy(s):b.emit("error",s)}return ke={destroy:F,undestroy:I,errorOrDestroy:v},ke}var Ae={},Qe;function ye(){if(Qe)return Ae;Qe=1;function F(s,E){s.prototype=Object.create(E.prototype),s.prototype.constructor=s,s.__proto__=E}var x={};function A(s,E,U){U||(U=Error);function W(N,M,L){return typeof E=="string"?E:E(N,M,L)}var O=function(N){F(M,N);function M(L,j,P){return N.call(this,W(L,j,P))||this}return M}(U);O.prototype.name=U.name,O.prototype.code=s,x[s]=O}function I(s,E){if(Array.isArray(s)){var U=s.length;return s=s.map(function(W){return String(W)}),U>2?"one of ".concat(E," ").concat(s.slice(0,U-1).join(", "),", or ")+s[U-1]:U===2?"one of ".concat(E," ").concat(s[0]," or ").concat(s[1]):"of ".concat(E," ").concat(s[0])}else return"of ".concat(E," ").concat(String(s))}function D(s,E,U){return s.substr(0,E.length)===E}function v(s,E,U){return(U===void 0||U>s.length)&&(U=s.length),s.substring(U-E.length,U)===E}function b(s,E,U){return typeof U!="number"&&(U=0),U+E.length>s.length?!1:s.indexOf(E,U)!==-1}return A("ERR_INVALID_OPT_VALUE",function(s,E){return'The value "'+E+'" is invalid for option "'+s+'"'},TypeError),A("ERR_INVALID_ARG_TYPE",function(s,E,U){var W;typeof E=="string"&&D(E,"not ")?(W="must not be",E=E.replace(/^not /,"")):W="must be";var O;if(v(s," argument"))O="The ".concat(s," ").concat(W," ").concat(I(E,"type"));else{var N=b(s,".")?"property":"argument";O='The "'.concat(s,'" ').concat(N," ").concat(W," ").concat(I(E,"type"))}return O+=". Received type ".concat(typeof U),O},TypeError),A("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),A("ERR_METHOD_NOT_IMPLEMENTED",function(s){return"The "+s+" method is not implemented"}),A("ERR_STREAM_PREMATURE_CLOSE","Premature close"),A("ERR_STREAM_DESTROYED",function(s){return"Cannot call "+s+" after a stream was destroyed"}),A("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),A("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),A("ERR_STREAM_WRITE_AFTER_END","write after end"),A("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),A("ERR_UNKNOWN_ENCODING",function(s){return"Unknown encoding: "+s},TypeError),A("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Ae.codes=x,Ae}var Te,et;function bt(){if(et)return Te;et=1;var F=ye().codes.ERR_INVALID_OPT_VALUE;function x(I,D,v){return I.highWaterMark!=null?I.highWaterMark:D?I[v]:null}function A(I,D,v,b){var s=x(D,b,v);if(s!=null){if(!(isFinite(s)&&Math.floor(s)===s)||s<0){var E=b?v:"highWaterMark";throw new F(E,s)}return Math.floor(s)}return I.objectMode?16:16*1024}return Te={getHighWaterMark:A},Te}var Be,tt;function It(){if(tt)return Be;tt=1,Be=F;function F(A,I){if(x("noDeprecation"))return A;var D=!1;function v(){if(!D){if(x("throwDeprecation"))throw new Error(I);x("traceDeprecation")?console.trace(I):console.warn(I),D=!0}return A.apply(this,arguments)}return v}function x(A){try{if(!he.localStorage)return!1}catch{return!1}var I=he.localStorage[A];return I==null?!1:String(I).toLowerCase()==="true"}return Be}var Le,rt;function Et(){if(rt)return Le;rt=1,Le=H;function F(c){var a=this;this.next=null,this.entry=null,this.finish=function(){B(a,c)}}var x;H.WritableState=R;var A={deprecate:It()},I=mt(),D=Ee().Buffer,v=(typeof he<"u"?he:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function b(c){return D.from(c)}function s(c){return D.isBuffer(c)||c instanceof v}var E=wt(),U=bt(),W=U.getHighWaterMark,O=ye().codes,N=O.ERR_INVALID_ARG_TYPE,M=O.ERR_METHOD_NOT_IMPLEMENTED,L=O.ERR_MULTIPLE_CALLBACK,j=O.ERR_STREAM_CANNOT_PIPE,P=O.ERR_STREAM_DESTROYED,p=O.ERR_STREAM_NULL_VALUES,_=O.ERR_STREAM_WRITE_AFTER_END,C=O.ERR_UNKNOWN_ENCODING,g=E.errorOrDestroy;pe()(H,I);function y(){}function R(c,a,S){x=x||ce(),c=c||{},typeof S!="boolean"&&(S=a instanceof x),this.objectMode=!!c.objectMode,S&&(this.objectMode=this.objectMode||!!c.writableObjectMode),this.highWaterMark=W(this,c,"writableHighWaterMark",S),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var G=c.decodeStrings===!1;this.decodeStrings=!G,this.defaultEncoding=c.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(K){le(a,K)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=c.emitClose!==!1,this.autoDestroy=!!c.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new F(this)}R.prototype.getBuffer=function(){for(var a=this.bufferedRequest,S=[];a;)S.push(a),a=a.next;return S},function(){try{Object.defineProperty(R.prototype,"buffer",{get:A.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var V;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(V=Function.prototype[Symbol.hasInstance],Object.defineProperty(H,Symbol.hasInstance,{value:function(a){return V.call(this,a)?!0:this!==H?!1:a&&a._writableState instanceof R}})):V=function(a){return a instanceof this};function H(c){x=x||ce();var a=this instanceof x;if(!a&&!V.call(H,this))return new H(c);this._writableState=new R(c,this,a),this.writable=!0,c&&(typeof c.write=="function"&&(this._write=c.write),typeof c.writev=="function"&&(this._writev=c.writev),typeof c.destroy=="function"&&(this._destroy=c.destroy),typeof c.final=="function"&&(this._final=c.final)),I.call(this)}H.prototype.pipe=function(){g(this,new j)};function z(c,a){var S=new _;g(c,S),process.nextTick(a,S)}function J(c,a,S,G){var K;return S===null?K=new p:typeof S!="string"&&!a.objectMode&&(K=new N("chunk",["string","Buffer"],S)),K?(g(c,K),process.nextTick(G,K),!1):!0}H.prototype.write=function(c,a,S){var G=this._writableState,K=!1,i=!G.objectMode&&s(c);return i&&!D.isBuffer(c)&&(c=b(c)),typeof a=="function"&&(S=a,a=null),i?a="buffer":a||(a=G.defaultEncoding),typeof S!="function"&&(S=y),G.ending?z(this,S):(i||J(this,G,c,S))&&(G.pendingcb++,K=ne(this,G,i,c,a,S)),K},H.prototype.cork=function(){this._writableState.corked++},H.prototype.uncork=function(){var c=this._writableState;c.corked&&(c.corked--,!c.writing&&!c.corked&&!c.bufferProcessing&&c.bufferedRequest&&l(this,c))},H.prototype.setDefaultEncoding=function(a){if(typeof a=="string"&&(a=a.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((a+"").toLowerCase())>-1))throw new C(a);return this._writableState.defaultEncoding=a,this},Object.defineProperty(H.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function te(c,a,S){return!c.objectMode&&c.decodeStrings!==!1&&typeof a=="string"&&(a=D.from(a,S)),a}Object.defineProperty(H.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function ne(c,a,S,G,K,i){if(!S){var o=te(a,G,K);G!==o&&(S=!0,K="buffer",G=o)}var T=a.objectMode?1:G.length;a.length+=T;var Y=a.length */var it;function Pt(){return it||(it=1,function(F,x){var A=Ee(),I=A.Buffer;function D(b,s){for(var E in b)s[E]=b[E]}I.from&&I.alloc&&I.allocUnsafe&&I.allocUnsafeSlow?F.exports=A:(D(A,x),x.Buffer=v);function v(b,s,E){return I(b,s,E)}v.prototype=Object.create(I.prototype),D(I,v),v.from=function(b,s,E){if(typeof b=="number")throw new TypeError("Argument must not be a number");return I(b,s,E)},v.alloc=function(b,s,E){if(typeof b!="number")throw new TypeError("Argument must be a number");var U=I(b);return s!==void 0?typeof E=="string"?U.fill(s,E):U.fill(s):U.fill(0),U},v.allocUnsafe=function(b){if(typeof b!="number")throw new TypeError("Argument must be a number");return I(b)},v.allocUnsafeSlow=function(b){if(typeof b!="number")throw new TypeError("Argument must be a number");return A.SlowBuffer(b)}}(be,be.exports)),be.exports}var at;function ot(){if(at)return Ue;at=1;var F=Pt().Buffer,x=F.isEncoding||function(p){switch(p=""+p,p&&p.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 A(p){if(!p)return"utf8";for(var _;;)switch(p){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 p;default:if(_)return;p=(""+p).toLowerCase(),_=!0}}function I(p){var _=A(p);if(typeof _!="string"&&(F.isEncoding===x||!x(p)))throw new Error("Unknown encoding: "+p);return _||p}Ue.StringDecoder=D;function D(p){this.encoding=I(p);var _;switch(this.encoding){case"utf16le":this.text=O,this.end=N,_=4;break;case"utf8":this.fillLast=E,_=4;break;case"base64":this.text=M,this.end=L,_=3;break;default:this.write=j,this.end=P;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=F.allocUnsafe(_)}D.prototype.write=function(p){if(p.length===0)return"";var _,C;if(this.lastNeed){if(_=this.fillLast(p),_===void 0)return"";C=this.lastNeed,this.lastNeed=0}else C=0;return C>5===6?2:p>>4===14?3:p>>3===30?4:p>>6===2?-1:-2}function b(p,_,C){var g=_.length-1;if(g=0?(y>0&&(p.lastNeed=y-1),y):--g=0?(y>0&&(p.lastNeed=y-2),y):--g=0?(y>0&&(y===2?y=0:p.lastNeed=y-3),y):0))}function s(p,_,C){if((_[0]&192)!==128)return p.lastNeed=0,"�";if(p.lastNeed>1&&_.length>1){if((_[1]&192)!==128)return p.lastNeed=1,"�";if(p.lastNeed>2&&_.length>2&&(_[2]&192)!==128)return p.lastNeed=2,"�"}}function E(p){var _=this.lastTotal-this.lastNeed,C=s(this,p);if(C!==void 0)return C;if(this.lastNeed<=p.length)return p.copy(this.lastChar,_,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);p.copy(this.lastChar,_,0,p.length),this.lastNeed-=p.length}function U(p,_){var C=b(this,p,_);if(!this.lastNeed)return p.toString("utf8",_);this.lastTotal=C;var g=p.length-(C-this.lastNeed);return p.copy(this.lastChar,0,g),p.toString("utf8",_,g)}function W(p){var _=p&&p.length?this.write(p):"";return this.lastNeed?_+"�":_}function O(p,_){if((p.length-_)%2===0){var C=p.toString("utf16le",_);if(C){var g=C.charCodeAt(C.length-1);if(g>=55296&&g<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=p[p.length-2],this.lastChar[1]=p[p.length-1],C.slice(0,-1)}return C}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=p[p.length-1],p.toString("utf16le",_,p.length-1)}function N(p){var _=p&&p.length?this.write(p):"";if(this.lastNeed){var C=this.lastTotal-this.lastNeed;return _+this.lastChar.toString("utf16le",0,C)}return _}function M(p,_){var C=(p.length-_)%3;return C===0?p.toString("base64",_):(this.lastNeed=3-C,this.lastTotal=3,C===1?this.lastChar[0]=p[p.length-1]:(this.lastChar[0]=p[p.length-2],this.lastChar[1]=p[p.length-1]),p.toString("base64",_,p.length-C))}function L(p){var _=p&&p.length?this.write(p):"";return this.lastNeed?_+this.lastChar.toString("base64",0,3-this.lastNeed):_}function j(p){return p.toString(this.encoding)}function P(p){return p&&p.length?this.write(p):""}return Ue}var Me,st;function We(){if(st)return Me;st=1;var F=ye().codes.ERR_STREAM_PREMATURE_CLOSE;function x(v){var b=!1;return function(){if(!b){b=!0;for(var s=arguments.length,E=new Array(s),U=0;U0)if(typeof o!="string"&&!r.objectMode&&Object.getPrototypeOf(o)!==I.prototype&&(o=v(o)),Y)r.endEmitted?y(i,new p):te(i,r,o,!0);else if(r.ended)y(i,new j);else{if(r.destroyed)return!1;r.reading=!1,r.decoder&&!T?(o=r.decoder.write(o),r.objectMode||o.length!==0?te(i,r,o,!1):l(i,r)):te(i,r,o,!1)}else Y||(r.reading=!1,l(i,r))}return!r.ended&&(r.length=ie?i=ie:(i--,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i++),i}function ue(i,o){return i<=0||o.length===0&&o.ended?0:o.objectMode?1:i!==i?o.flowing&&o.length?o.buffer.head.data.length:o.length:(i>o.highWaterMark&&(o.highWaterMark=ae(i)),i<=o.length?i:o.ended?o.length:(o.needReadable=!0,0))}z.prototype.read=function(i){E("read",i),i=parseInt(i,10);var o=this._readableState,T=i;if(i!==0&&(o.emittedReadable=!1),i===0&&o.needReadable&&((o.highWaterMark!==0?o.length>=o.highWaterMark:o.length>0)||o.ended))return E("read: emitReadable",o.length,o.ended),o.length===0&&o.ended?S(this):oe(this),null;if(i=ue(i,o),i===0&&o.ended)return o.length===0&&S(this),null;var Y=o.needReadable;E("need readable",Y),(o.length===0||o.length-i0?Z=a(i,o):Z=null,Z===null?(o.needReadable=o.length<=o.highWaterMark,i=0):(o.length-=i,o.awaitDrain=0),o.length===0&&(o.ended||(o.needReadable=!0),T!==i&&o.ended&&S(this)),Z!==null&&this.emit("data",Z),Z};function le(i,o){if(E("onEofChunk"),!o.ended){if(o.decoder){var T=o.decoder.end();T&&T.length&&(o.buffer.push(T),o.length+=o.objectMode?1:T.length)}o.ended=!0,o.sync?oe(i):(o.needReadable=!1,o.emittedReadable||(o.emittedReadable=!0,fe(i)))}}function oe(i){var o=i._readableState;E("emitReadable",o.needReadable,o.emittedReadable),o.needReadable=!1,o.emittedReadable||(E("emitReadable",o.flowing),o.emittedReadable=!0,process.nextTick(fe,i))}function fe(i){var o=i._readableState;E("emitReadable_",o.destroyed,o.length,o.ended),!o.destroyed&&(o.length||o.ended)&&(i.emit("readable"),o.emittedReadable=!1),o.needReadable=!o.flowing&&!o.ended&&o.length<=o.highWaterMark,c(i)}function l(i,o){o.readingMore||(o.readingMore=!0,process.nextTick(n,i,o))}function n(i,o){for(;!o.reading&&!o.ended&&(o.length1&&K(Y.pipes,i)!==-1)&&!m&&(E("false write response, pause",Y.awaitDrain),Y.awaitDrain++),T.pause())}function $(Q){E("onerror",Q),re(),i.removeListener("error",$),x(i,"error")===0&&y(i,Q)}V(i,"error",$);function X(){i.removeListener("finish",ee),re()}i.once("close",X);function ee(){E("onfinish"),i.removeListener("close",X),re()}i.once("finish",ee);function re(){E("unpipe"),T.unpipe(i)}return i.emit("pipe",T),Y.flowing||(E("pipe resume"),T.resume()),i};function h(i){return function(){var T=i._readableState;E("pipeOnDrain",T.awaitDrain),T.awaitDrain&&T.awaitDrain--,T.awaitDrain===0&&x(i,"data")&&(T.flowing=!0,c(i))}}z.prototype.unpipe=function(i){var o=this._readableState,T={hasUnpiped:!1};if(o.pipesCount===0)return this;if(o.pipesCount===1)return i&&i!==o.pipes?this:(i||(i=o.pipes),o.pipes=null,o.pipesCount=0,o.flowing=!1,i&&i.emit("unpipe",this,T),this);if(!i){var Y=o.pipes,Z=o.pipesCount;o.pipes=null,o.pipesCount=0,o.flowing=!1;for(var r=0;r0,Y.flowing!==!1&&this.resume()):i==="readable"&&!Y.endEmitted&&!Y.readableListening&&(Y.readableListening=Y.needReadable=!0,Y.flowing=!1,Y.emittedReadable=!1,E("on readable",Y.length,Y.reading),Y.length?oe(this):Y.reading||process.nextTick(d,this)),T},z.prototype.addListener=z.prototype.on,z.prototype.removeListener=function(i,o){var T=A.prototype.removeListener.call(this,i,o);return i==="readable"&&process.nextTick(u,this),T},z.prototype.removeAllListeners=function(i){var o=A.prototype.removeAllListeners.apply(this,arguments);return(i==="readable"||i===void 0)&&process.nextTick(u,this),o};function u(i){var o=i._readableState;o.readableListening=i.listenerCount("readable")>0,o.resumeScheduled&&!o.paused?o.flowing=!0:i.listenerCount("data")>0&&i.resume()}function d(i){E("readable nexttick read 0"),i.read(0)}z.prototype.resume=function(){var i=this._readableState;return i.flowing||(E("resume"),i.flowing=!i.readableListening,w(this,i)),i.paused=!1,this};function w(i,o){o.resumeScheduled||(o.resumeScheduled=!0,process.nextTick(B,i,o))}function B(i,o){E("resume",o.reading),o.reading||i.read(0),o.resumeScheduled=!1,i.emit("resume"),c(i),o.flowing&&!o.reading&&i.read(0)}z.prototype.pause=function(){return E("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(E("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function c(i){var o=i._readableState;for(E("flow",o.flowing);o.flowing&&i.read()!==null;);}z.prototype.wrap=function(i){var o=this,T=this._readableState,Y=!1;i.on("end",function(){if(E("wrapped end"),T.decoder&&!T.ended){var e=T.decoder.end();e&&e.length&&o.push(e)}o.push(null)}),i.on("data",function(e){if(E("wrapped data"),T.decoder&&(e=T.decoder.write(e)),!(T.objectMode&&e==null)&&!(!T.objectMode&&(!e||!e.length))){var t=o.push(e);t||(Y=!0,i.pause())}});for(var Z in i)this[Z]===void 0&&typeof i[Z]=="function"&&(this[Z]=function(t){return function(){return i[t].apply(i,arguments)}}(Z));for(var r=0;r=o.length?(o.decoder?T=o.buffer.join(""):o.buffer.length===1?T=o.buffer.first():T=o.buffer.concat(o.length),o.buffer.clear()):T=o.buffer.consume(i,o.decoder),T}function S(i){var o=i._readableState;E("endReadable",o.endEmitted),o.endEmitted||(o.ended=!0,process.nextTick(G,o,i))}function G(i,o){if(E("endReadableNT",i.endEmitted,i.length),!i.endEmitted&&i.length===0&&(i.endEmitted=!0,o.readable=!1,o.emit("end"),i.autoDestroy)){var T=o._writableState;(!T||T.autoDestroy&&T.finished)&&o.destroy()}}typeof Symbol=="function"&&(z.from=function(i,o){return g===void 0&&(g=jt()),g(z,i,o)});function K(i,o){for(var T=0,Y=i.length;T0;return s(_,g,y,function(R){P||(P=R),R&&p.forEach(E),!g&&(p.forEach(E),j(P))})});return M.reduce(U)}return Ne=O,Ne}var je,pt;function Ht(){if(pt)return je;pt=1,je=A;var F=qe().EventEmitter,x=pe();x(A,F),A.Readable=_t(),A.Writable=Et(),A.Duplex=ce(),A.Transform=St(),A.PassThrough=qt(),A.finished=We(),A.pipeline=Wt(),A.Stream=A;function A(){F.call(this)}return A.prototype.pipe=function(I,D){var v=this;function b(M){I.writable&&I.write(M)===!1&&v.pause&&v.pause()}v.on("data",b);function s(){v.readable&&v.resume&&v.resume()}I.on("drain",s),!I._isStdio&&(!D||D.end!==!1)&&(v.on("end",U),v.on("close",W));var E=!1;function U(){E||(E=!0,I.end())}function W(){E||(E=!0,typeof I.destroy=="function"&&I.destroy())}function O(M){if(N(),F.listenerCount(this,"error")===0)throw M}v.on("error",O),I.on("error",O);function N(){v.removeListener("data",b),I.removeListener("drain",s),v.removeListener("end",U),v.removeListener("close",W),v.removeListener("error",O),I.removeListener("error",O),v.removeListener("end",N),v.removeListener("close",N),I.removeListener("close",N)}return v.on("end",N),v.on("close",N),I.on("close",N),I.emit("pipe",v),I},je}(function(F,x){(function(A,I){F.exports=I(Ht())})(he,function(A){function I(l){return I=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},I(l)}function D(l,n){if(!(l instanceof n))throw new TypeError("Cannot call a class as a function")}function v(l,n){for(var h=0;h"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var h,u=U(l);if(n){var d=U(this).constructor;h=Reflect.construct(u,arguments,d)}else h=u.apply(this,arguments);return N(this,h)}}function L(l,n){return function(h){if(Array.isArray(h))return h}(l)||function(h,u){var d=h==null?null:typeof Symbol<"u"&&h[Symbol.iterator]||h["@@iterator"];if(d!=null){var w,B,c=[],a=!0,S=!1;try{for(d=d.call(h);!(a=(w=d.next()).done)&&(c.push(w.value),!u||c.length!==u);a=!0);}catch(G){S=!0,B=G}finally{try{a||d.return==null||d.return()}finally{if(S)throw B}}return c}}(l,n)||j(l,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(l,n){if(l){if(typeof l=="string")return P(l,n);var h=Object.prototype.toString.call(l).slice(8,-1);return h==="Object"&&l.constructor&&(h=l.constructor.name),h==="Map"||h==="Set"?Array.from(l):h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h)?P(l,n):void 0}}function P(l,n){(n==null||n>l.length)&&(n=l.length);for(var h=0,u=new Array(n);h=l.length?{done:!0}:{done:!1,value:l[u++]}},e:function(a){throw a},f:d}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var w,B=!0,c=!1;return{s:function(){h=h.call(l)},n:function(){var a=h.next();return B=a.done,a},e:function(a){c=!0,w=a},f:function(){try{B||h.return==null||h.return()}finally{if(c)throw w}}}}var _,C;function g(l){if(_){for(var n=arguments.length,h=new Array(n>1?n-1:0),u=1;u1?n-1:0),u=1;u>5,this.ntype=31&this.payload[0],this.isvcl=this.ntype==1||this.ntype==5,this.stype="",this.isfmb=!1}return b(l,[{key:"toString",value:function(){return"".concat(l.type(this),": NRI: ").concat(this.getNri())}},{key:"getNri",value:function(){return this.nri}},{key:"type",value:function(){return this.ntype}},{key:"isKeyframe",value:function(){return this.ntype===l.IDR}},{key:"getPayload",value:function(){return this.payload}},{key:"getPayloadSize",value:function(){return this.payload.byteLength}},{key:"getSize",value:function(){return 4+this.getPayloadSize()}},{key:"getData",value:function(){var n=new Uint8Array(this.getSize());return new DataView(n.buffer).setUint32(0,this.getSize()-4),n.set(this.getPayload(),4),n}}],[{key:"NDR",get:function(){return 1}},{key:"IDR",get:function(){return 5}},{key:"SEI",get:function(){return 6}},{key:"SPS",get:function(){return 7}},{key:"PPS",get:function(){return 8}},{key:"AUD",get:function(){return 9}},{key:"TYPES",get:function(){var n;return s(n={},l.IDR,"IDR"),s(n,l.SEI,"SEI"),s(n,l.SPS,"SPS"),s(n,l.PPS,"PPS"),s(n,l.NDR,"NDR"),s(n,l.AUD,"AUD"),n}},{key:"type",value:function(n){return n.ntype in l.TYPES?l.TYPES[n.ntype]:"UNKNOWN"}}]),l}();function V(l,n){var h=new Uint8Array((0|l.byteLength)+(0|n.byteLength));return h.set(l,0),h.set(n,0|l.byteLength),h}var H=function(){function l(n){D(this,l),this.data=n,this.index=0,this.bitLength=8*n.byteLength}return b(l,[{key:"setData",value:function(n){this.data=n,this.index=0,this.bitLength=8*n.byteLength}},{key:"bitsAvailable",get:function(){return this.bitLength-this.index}},{key:"skipBits",value:function(n){if(this.bitsAvailable1&&arguments[1]!==void 0)||arguments[1],u=this.getBits(n,this.index,h);return u}},{key:"getBits",value:function(n,h){var u=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];if(this.bitsAvailable>>d,B=8-d;if(B>=n)return u&&(this.index+=n),w>>B-n;u&&(this.index+=B);var c=n-B;return w<>>1:-1*(n>>>1)}},{key:"readBoolean",value:function(){return this.readBits(1)===1}},{key:"readUByte",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this.readBits(8*n)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}}]),l}(),z=function(){function l(n){D(this,l),this.remuxer=n,this.track=n.mp4track}return b(l,[{key:"parseSPS",value:function(n){var h=l.readSPS(new Uint8Array(n));this.track.fps=h.fps,this.track.width=h.width,this.track.height=h.height,this.track.sps=[new Uint8Array(n)],this.track.codec="avc1.";for(var u=new DataView(n.buffer,n.byteOffset+1,4),d=0;d<3;++d){var w=u.getUint8(d).toString(16);w.length<2&&(w="0"+w),this.track.codec+=w}}},{key:"parsePPS",value:function(n){this.track.pps=[new Uint8Array(n)]}},{key:"parseNAL",value:function(n){if(!n)return!1;var h=!1;switch(n.type()){case R.IDR:case R.NDR:h=!0;break;case R.PPS:this.track.pps||(this.parsePPS(n.getPayload()),!this.remuxer.readyToDecode&&this.track.pps&&this.track.sps&&(this.remuxer.readyToDecode=!0)),h=!0;break;case R.SPS:this.track.sps||(this.parseSPS(n.getPayload()),!this.remuxer.readyToDecode&&this.track.pps&&this.track.sps&&(this.remuxer.readyToDecode=!0)),h=!0;break;case R.AUD:g("AUD - ignoing");break;case R.SEI:g("SEI - ignoing")}return h}}],[{key:"extractNALu",value:function(n){for(var h,u,d=0,w=n.byteLength,B=0,c=[],a=0;d0&&k[1]>0&&(o=k[0]/k[1])}if(a.readBoolean()&&a.skipBits(1),a.readBoolean()&&(a.skipBits(4),a.readBoolean()&&a.skipBits(24)),a.readBoolean()&&(a.skipUEG(),a.skipUEG()),a.readBoolean()){var q=a.readUInt(),$=a.readUInt();a.readBoolean()&&(T=$/(2*q))}}return{fps:T>0?T:void 0,width:Math.ceil((16*(d+1)-2*S-2*G)*o),height:(2-B)*(w+1)*16-(B?2:4)*(K+i)}}},{key:"parseHeader",value:function(n){var h=new H(n.getPayload());h.readUByte(),n.isfmb=h.readUEG()===0,n.stype=h.readUEG()}}]),l}(),J=function(){function l(n){D(this,l),this.remuxer=n,this.track=n.mp4track}return b(l,[{key:"extractAAC",value:function(n){var h,u,d=0,w=n.byteLength,B=[];if(!l.isAACPattern(n))return y("Invalid ADTS audio format"),B;for(h=l.getHeaderLength(n),this.aacHeader||(this.aacHeader=n.subarray(0,h));d>>6),h=(60&w[2])>>>2,u=(1&w[2])<<2,u|=(192&w[3])>>>6,d[0]=n<<3,d[0]|=(14&h)>>1,d[1]|=(1&h)<<7,d[1]|=u<<3,this.track.codec="mp4a.40."+n,this.track.channelCount=u,this.track.config=d,this.remuxer.readyToDecode=!0)}}],[{key:"samplingRateMap",get:function(){return[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]}},{key:"getHeaderLength",value:function(n){return 1&n[1]?7:9}},{key:"getFrameLength",value:function(n){return(3&n[3])<<11|n[4]<<3|(224&n[5])>>>5}},{key:"isAACPattern",value:function(n){return n[0]===255&&(240&n[1])==240&&(6&n[1])==0}}]),l}(),te=function(){function l(n){D(this,l),this.listener={},this.type=""|n}return b(l,[{key:"on",value:function(n,h){return this.listener[n]||(this.listener[n]=[]),this.listener[n].push(h),!0}},{key:"off",value:function(n,h){if(this.listener[n]){var u=this.listener[n].indexOf(h);return u>-1&&this.listener[n].splice(u,1),!0}return!1}},{key:"offAll",value:function(){this.listener={}}},{key:"dispatch",value:function(n,h){return!!this.listener[n]&&(this.listener[n].map(function(u){u.apply(null,[h])}),!0)}}]),l}(),ne=function(){function l(){D(this,l)}return b(l,null,[{key:"init",value:function(){var n;for(n in l.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},l.types)l.types.hasOwnProperty(n)&&(l.types[n]=[n.charCodeAt(0),n.charCodeAt(1),n.charCodeAt(2),n.charCodeAt(3)]);var h=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),u=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);l.HDLR_TYPES={video:h,audio:u};var d=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),w=new Uint8Array([0,0,0,0,0,0,0,0]);l.STTS=l.STSC=l.STCO=w,l.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),l.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),l.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),l.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var B=new Uint8Array([105,115,111,109]),c=new Uint8Array([97,118,99,49]),a=new Uint8Array([0,0,0,1]);l.FTYP=l.box(l.types.ftyp,B,a,B,c),l.DINF=l.box(l.types.dinf,l.box(l.types.dref,d))}},{key:"box",value:function(n){for(var h=arguments.length,u=new Array(h>1?h-1:0),d=1;d>24&255,w[1]=B>>16&255,w[2]=B>>8&255,w[3]=255&B,w.set(n,4),c=0,B=8;c>24&255,n>>16&255,n>>8&255,255&n,h>>24,h>>16&255,h>>8&255,255&h,85,196,0,0]))}},{key:"mdia",value:function(n){return l.box(l.types.mdia,l.mdhd(n.timescale,n.duration),l.hdlr(n.type),l.minf(n))}},{key:"mfhd",value:function(n){return l.box(l.types.mfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n]))}},{key:"minf",value:function(n){return n.type==="audio"?l.box(l.types.minf,l.box(l.types.smhd,l.SMHD),l.DINF,l.stbl(n)):l.box(l.types.minf,l.box(l.types.vmhd,l.VMHD),l.DINF,l.stbl(n))}},{key:"moof",value:function(n,h,u){return l.box(l.types.moof,l.mfhd(n),l.traf(u,h))}},{key:"moov",value:function(n,h,u){for(var d=n.length,w=[];d--;)w[d]=l.trak(n[d]);return l.box.apply(null,[l.types.moov,l.mvhd(u,h)].concat(w).concat(l.mvex(n)))}},{key:"mvex",value:function(n){for(var h=n.length,u=[];h--;)u[h]=l.trex(n[h]);return l.box.apply(null,[l.types.mvex].concat(u))}},{key:"mvhd",value:function(n,h){var u=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,n>>24&255,n>>16&255,n>>8&255,255&n,h>>24&255,h>>16&255,h>>8&255,255&h,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return l.box(l.types.mvhd,u)}},{key:"sdtp",value:function(n){var h,u,d=n.samples||[],w=new Uint8Array(4+d.length);for(u=0;u>>8&255),w.push(255&d),w=w.concat(Array.prototype.slice.call(u));for(h=0;h>>8&255),B.push(255&d),B=B.concat(Array.prototype.slice.call(u));var c=l.box(l.types.avcC,new Uint8Array([1,w[3],w[4],w[5],255,224|n.sps.length].concat(w).concat([n.pps.length]).concat(B))),a=n.width,S=n.height;return l.box(l.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,a>>8&255,255&a,S>>8&255,255&S,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,98,105,110,101,108,112,114,111,46,114,117,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),c,l.box(l.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value:function(n){var h=n.config.byteLength,u=new Uint8Array(26+h+3);return u.set([0,0,0,0,3,23+h,0,1,0,4,15+h,64,21,0,0,0,0,0,0,0,0,0,0,0,5,h]),u.set(n.config,26),u.set([6,1,2],26+h),u}},{key:"mp4a",value:function(n){var h=n.audiosamplerate;return l.box(l.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n.channelCount,0,16,0,0,0,0,h>>8&255,255&h,0,0]),l.box(l.types.esds,l.esds(n)))}},{key:"stsd",value:function(n){return n.type==="audio"?l.box(l.types.stsd,l.STSD,l.mp4a(n)):l.box(l.types.stsd,l.STSD,l.avc1(n))}},{key:"tkhd",value:function(n){var h=n.id,u=n.duration,d=n.width,w=n.height,B=n.volume;return l.box(l.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,h>>24&255,h>>16&255,h>>8&255,255&h,0,0,0,0,u>>24,u>>16&255,u>>8&255,255&u,0,0,0,0,0,0,0,0,0,0,0,0,B>>0&255,B%1*10>>0&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,d>>8&255,255&d,0,0,w>>8&255,255&w,0,0]))}},{key:"traf",value:function(n,h){var u=l.sdtp(n),d=n.id;return l.box(l.types.traf,l.box(l.types.tfhd,new Uint8Array([0,0,0,0,d>>24,d>>16&255,d>>8&255,255&d])),l.box(l.types.tfdt,new Uint8Array([0,0,0,0,h>>24,h>>16&255,h>>8&255,255&h])),l.trun(n,u.length+16+16+8+16+8+8),u)}},{key:"trak",value:function(n){return n.duration=n.duration||4294967295,l.box(l.types.trak,l.tkhd(n),l.mdia(n))}},{key:"trex",value:function(n){var h=n.id;return l.box(l.types.trex,new Uint8Array([0,0,0,0,h>>24,h>>16&255,h>>8&255,255&h,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(n,h){var u,d,w,B,c,a,S=n.samples||[],G=S.length,K=12+16*G,i=new Uint8Array(K);for(h+=8+K,i.set([0,0,15,1,G>>>24&255,G>>>16&255,G>>>8&255,255&G,h>>>24&255,h>>>16&255,h>>>8&255,255&h],0),u=0;u>>24&255,w>>>16&255,w>>>8&255,255&w,B>>>24&255,B>>>16&255,B>>>8&255,255&B,c.isLeading<<2|c.dependsOn,c.isDependedOn<<6|c.hasRedundancy<<4|c.paddingValue<<1|c.isNonSync,61440&c.degradPrio,15&c.degradPrio,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12+16*u);return l.box(l.types.trun,i)}},{key:"initSegment",value:function(n,h,u){l.types||l.init();var d,w=l.moov(n,h,u);return(d=new Uint8Array(l.FTYP.byteLength+w.byteLength)).set(l.FTYP),d.set(w,l.FTYP.byteLength),d}}]),l}(),ie=1,ae=function(){function l(){D(this,l)}return b(l,[{key:"flush",value:function(){this.mp4track.len=0,this.mp4track.samples=[]}},{key:"isReady",value:function(){return!(!this.readyToDecode||!this.samples.length)||null}}],[{key:"getTrackID",value:function(){return ie++}}]),l}(),ue=function(l){E(h,l);var n=M(h);function h(u){var d;return D(this,h),(d=n.call(this)).readyToDecode=!1,d.nextDts=0,d.dts=0,d.mp4track={id:ae.getTrackID(),type:"audio",channelCount:0,len:0,fragmented:!0,timescale:u,duration:u,samples:[],config:"",codec:""},d.samples=[],d.aac=new J(O(d)),d}return b(h,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.mp4track.codec="",this.mp4track.channelCount="",this.mp4track.config="",this.mp4track.timescale=this.timescale,this.nextDts=0,this.dts=0}},{key:"remux",value:function(u){if(u.length>0)for(var d=0;d0&&this.readyToDecode&&(this.mp4track.len+=S,this.samples.push({units:a,size:S,keyFrame:c.keyFrame,duration:c.duration,compositionTimeOffset:c.compositionTimeOffset}))}}catch(i){w.e(i)}finally{w.f()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var u,d,w=new Uint8Array(this.mp4track.len),B=0,c=this.mp4track.samples;for(this.dts=this.nextDts;this.samples.length;){var a=this.samples.shift(),S=a.units;if((d=a.duration)<=0)g("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(d)),this.mp4track.len-=a.size;else{this.nextDts+=d,u={size:a.size,duration:d,cts:a.compositionTimeOffset||0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,isNonSync:a.keyFrame?0:1,dependsOn:a.keyFrame?2:1}};var G,K=p(S);try{for(K.s();!(G=K.n()).done;){var i=G.value;w.set(i.getData(),B),B+=i.getSize()}}catch(o){K.e(o)}finally{K.f()}c.push(u)}}return c.length?new Uint8Array(w.buffer,0,this.mp4track.len):null}}]),h}(ae),oe=function(l){E(h,l);var n=M(h);function h(u){var d;return D(this,h),(d=n.call(this,"remuxer")).initialized=!1,d.trackTypes=[],d.tracks={},d.seq=1,d.env=u,d.timescale=1e3,d.mediaDuration=0,d.aacParser=null,d}return b(h,[{key:"addTrack",value:function(u){if(u!=="video"&&u!=="both"||(this.tracks.video=new le(this.timescale),this.trackTypes.push("video")),u==="audio"||u==="both"){var d=new ue(this.timescale);this.aacParser=d.getAacParser(),this.tracks.audio=d,this.trackTypes.push("audio")}}},{key:"reset",value:function(){var u,d=p(this.trackTypes);try{for(d.s();!(u=d.n()).done;){var w=u.value;this.tracks[w].resetTrack()}}catch(B){d.e(B)}finally{d.f()}this.initialized=!1}},{key:"destroy",value:function(){this.tracks={},this.offAll()}},{key:"flush",value:function(){if(this.initialized){var u,d=p(this.trackTypes);try{for(d.s();!(u=d.n()).done;){var w=u.value,B=this.tracks[w],c=B.getPayload();if(c&&c.byteLength){var a={type:w,payload:V(ne.moof(this.seq,B.dts,B.mp4track),ne.mdat(c)),dts:B.dts};w==="video"&&(a.fps=B.mp4track.fps),this.dispatch("buffer",a);var S=(G=B.dts/this.timescale,K=void 0,i=void 0,o=void 0,T=void 0,T="",K=Math.floor(G),(i=parseInt(K/3600,10)%24)>0&&(T+=(i<10?"0"+i:i)+":"),T+=((o=parseInt(K/60,10)%60)<10?"0"+o:o)+":"+((K=K<0?0:K%60)<10?"0"+K:K));g("put segment (".concat(w,"): dts: ").concat(B.dts," frames: ").concat(B.mp4track.samples.length," second: ").concat(S)),B.flush(),this.seq++}}}catch(Y){d.e(Y)}finally{d.f()}}else this.isReady()&&(this.dispatch("ready"),this.initSegment(),this.initialized=!0,this.flush());var G,K,i,o,T}},{key:"initSegment",value:function(){var u,d=[],w=p(this.trackTypes);try{for(w.s();!(u=w.n()).done;){var B=u.value,c=this.tracks[B];if(this.env=="browser"){var a={type:B,payload:ne.initSegment([c.mp4track],this.mediaDuration,this.timescale)};this.dispatch("buffer",a)}else d.push(c.mp4track)}}catch(G){w.e(G)}finally{w.f()}if(this.env=="node"){var S={type:"all",payload:ne.initSegment(d,this.mediaDuration,this.timescale)};this.dispatch("buffer",S)}g("Initial segment generated.")}},{key:"isReady",value:function(){var u,d=p(this.trackTypes);try{for(d.s();!(u=d.n()).done;){var w=u.value;if(!this.tracks[w].readyToDecode||!this.tracks[w].samples.length)return!1}}catch(B){d.e(B)}finally{d.f()}return!0}},{key:"remux",value:function(u){var d,w=p(this.trackTypes);try{for(w.s();!(d=w.n()).done;){var B=d.value,c=u[B];B==="audio"&&this.tracks.video&&!this.tracks.video.readyToDecode||c.length>0&&this.tracks[B].remux(c)}}catch(a){w.e(a)}finally{w.f()}this.flush()}}]),h}(te),fe=function(l){E(h,l);var n=M(h);function h(u,d){var w;return D(this,h),(w=n.call(this,"buffer")).type=d,w.queue=new Uint8Array,w.cleaning=!1,w.pendingCleaning=0,w.cleanOffset=30,w.cleanRanges=[],w.sourceBuffer=u,w.sourceBuffer.addEventListener("updateend",function(){w.pendingCleaning>0&&(w.initCleanup(w.pendingCleaning),w.pendingCleaning=0),w.cleaning=!1,w.cleanRanges.length&&w.doCleanup()}),w.sourceBuffer.addEventListener("error",function(){w.dispatch("error",{type:w.type,name:"buffer",error:"buffer error"})}),w}return b(h,[{key:"destroy",value:function(){this.queue=null,this.sourceBuffer=null,this.offAll()}},{key:"doCleanup",value:function(){if(this.cleanRanges.length){var u=this.cleanRanges.shift();g("".concat(this.type," remove range [").concat(u[0]," - ").concat(u[1],")")),this.cleaning=!0,this.sourceBuffer.remove(u[0],u[1])}else this.cleaning=!1}},{key:"initCleanup",value:function(u){try{if(this.sourceBuffer.updating)return void(this.pendingCleaning=u);if(this.sourceBuffer.buffered&&this.sourceBuffer.buffered.length&&!this.cleaning){for(var d=0;dthis.cleanOffset&&w<(B=u-this.cleanOffset)&&this.cleanRanges.push([w,B])}this.doCleanup()}}catch(c){y("Error occured while cleaning ".concat(this.type," buffer - ").concat(c.name,": ").concat(c.message))}}},{key:"doAppend",value:function(){if(this.queue.length&&this.sourceBuffer&&!this.sourceBuffer.updating)try{this.sourceBuffer.appendBuffer(this.queue),this.queue=new Uint8Array}catch(d){var u="unexpectedError";d.name==="QuotaExceededError"?(g("".concat(this.type," buffer quota full")),u="QuotaExceeded"):(y("Error occured while appending ".concat(this.type," buffer - ").concat(d.name,": ").concat(d.message)),u="InvalidStateError"),this.dispatch("error",{type:this.type,name:u,error:"buffer error"})}}},{key:"feed",value:function(u){this.queue=V(this.queue,u)}}]),h}(te);return function(l){E(h,l);var n=M(h);function h(u){var d;return D(this,h),(d=n.call(this,"jmuxer")).isReset=!1,d.options=Object.assign({},{node:"",mode:"both",flushingTime:500,maxDelay:500,clearBuffer:!0,fps:30,readFpsFromTrack:!1,debug:!1,onReady:function(){},onError:function(){},onMissingVideoFrames:function(){},onMissingAudioFrames:function(){}},u),d.env=(typeof process>"u"?"undefined":I(process))==="object"&&typeof window>"u"?"node":"browser",d.options.debug&&(_=console.log,C=console.error),d.options.fps||(d.options.fps=30),d.frameDuration=1e3/d.options.fps|0,d.remuxController=new oe(d.env),d.remuxController.addTrack(d.options.mode),d.initData(),d.remuxController.on("buffer",d.onBuffer.bind(O(d))),d.env=="browser"&&(d.remuxController.on("ready",d.createBuffer.bind(O(d))),d.initBrowser()),d}return b(h,[{key:"initData",value:function(){this.lastCleaningTime=Date.now(),this.kfPosition=[],this.kfCounter=0,this.pendingUnits={},this.remainingData=new Uint8Array,this.startInterval()}},{key:"initBrowser",value:function(){typeof this.options.node=="string"&&this.options.node==""&&y("no video element were found to render, provide a valid video element"),this.node=typeof this.options.node=="string"?document.getElementById(this.options.node):this.options.node,this.mseReady=!1,this.setupMSE()}},{key:"createStream",value:function(){var u=this.feed.bind(this),d=this.destroy.bind(this);return this.stream=new A.Duplex({writableObjectMode:!0,read:function(w){},write:function(w,B,c){u(w),c()},final:function(w){d(),w()}}),this.stream}},{key:"setupMSE",value:function(){if(window.MediaSource=window.MediaSource||window.WebKitMediaSource,!window.MediaSource)throw"Oops! Browser does not support media source extension.";this.isMSESupported=!!window.MediaSource,this.mediaSource=new MediaSource,this.url=URL.createObjectURL(this.mediaSource),this.node.src=this.url,this.mseEnded=!1,this.mediaSource.addEventListener("sourceopen",this.onMSEOpen.bind(this)),this.mediaSource.addEventListener("sourceclose",this.onMSEClose.bind(this)),this.mediaSource.addEventListener("webkitsourceopen",this.onMSEOpen.bind(this)),this.mediaSource.addEventListener("webkitsourceclose",this.onMSEClose.bind(this))}},{key:"endMSE",value:function(){if(!this.mseEnded)try{this.mseEnded=!0,this.mediaSource.endOfStream()}catch{y("mediasource is not available to end")}}},{key:"feed",value:function(u){var d,w,B,c=!1,a={video:[],audio:[]};if(u&&this.remuxController){if(B=u.duration?parseInt(u.duration):0,u.video){u.video=V(this.remainingData,u.video);var S=L(z.extractNALu(u.video),2);if(d=S[0],w=S[1],this.remainingData=w||new Uint8Array,!(d.length>0))return y("Failed to extract any NAL units from video data:",w),void(typeof this.options.onMissingVideoFrames=="function"&&this.options.onMissingVideoFrames.call(null,u));a.video=this.getVideoFrames(d,B,u.compositionTimeOffset),c=!0}if(u.audio){if(!((d=this.remuxController.aacParser.extractAAC(u.audio)).length>0))return y("Failed to extract audio data from:",u.audio),void(typeof this.options.onMissingAudioFrames=="function"&&this.options.onMissingAudioFrames.call(null,u));a.audio=this.getAudioFrames(d,B),c=!0}c?this.remuxController.remux(a):y("Input object must have video and/or audio property. Make sure it is a valid typed array")}}},{key:"getVideoFrames",value:function(u,d,w){var B,c=this,a=[],S=[],G=0,K=!1,i=!1;this.pendingUnits.units&&(a=this.pendingUnits.units,i=this.pendingUnits.vcl,K=this.pendingUnits.keyFrame,this.pendingUnits={});var o,T=p(u);try{for(T.s();!(o=T.n()).done;){var Y=o.value,Z=new R(Y);Z.type()!==R.IDR&&Z.type()!==R.NDR||z.parseHeader(Z),a.length&&i&&(Z.isfmb||!Z.isvcl)&&(S.push({units:a,keyFrame:K}),a=[],K=!1,i=!1),a.push(Z),K=K||Z.isKeyframe(),i=i||Z.isvcl}}catch(e){T.e(e)}finally{T.f()}if(a.length)if(d)if(i)S.push({units:a,keyFrame:K});else{var r=S.length-1;r>=0&&(S[r].units=S[r].units.concat(a))}else this.pendingUnits={units:a,keyFrame:K,vcl:i};return B=d?d/S.length|0:this.frameDuration,G=d?d-B*S.length:0,S.map(function(e){e.duration=B,e.compositionTimeOffset=w,G>0&&(e.duration++,G--),c.kfCounter++,e.keyFrame&&c.options.clearBuffer&&c.kfPosition.push(c.kfCounter*B/1e3)}),g("jmuxer: No. of frames of the last chunk: ".concat(S.length)),S}},{key:"getAudioFrames",value:function(u,d){var w,B,c=[],a=0,S=p(u);try{for(S.s();!(B=S.n()).done;){var G=B.value;c.push({units:G})}}catch(K){S.e(K)}finally{S.f()}return w=d?d/c.length|0:this.frameDuration,a=d?d-w*c.length:0,c.map(function(K){K.duration=w,a>0&&(K.duration++,a--)}),c}},{key:"destroy",value:function(){if(this.stopInterval(),this.stream&&(this.remuxController.flush(),this.stream.push(null),this.stream=null),this.remuxController&&(this.remuxController.destroy(),this.remuxController=null),this.bufferControllers){for(var u in this.bufferControllers)this.bufferControllers[u].destroy();this.bufferControllers=null,this.endMSE()}this.node=!1,this.mseReady=!1,this.videoStarted=!1,this.mediaSource=null}},{key:"reset",value:function(){if(this.stopInterval(),this.isReset=!0,this.node.pause(),this.remuxController&&this.remuxController.reset(),this.bufferControllers){for(var u in this.bufferControllers)this.bufferControllers[u].destroy();this.bufferControllers=null,this.endMSE()}this.initData(),this.env=="browser"&&this.initBrowser(),g("JMuxer was reset")}},{key:"createBuffer",value:function(){if(this.mseReady&&this.remuxController&&this.remuxController.isReady()&&!this.bufferControllers)for(var u in this.bufferControllers={},this.remuxController.tracks){var d=this.remuxController.tracks[u];if(!h.isSupported("".concat(u,'/mp4; codecs="').concat(d.mp4track.codec,'"')))return y("Browser does not support codec"),!1;var w=this.mediaSource.addSourceBuffer("".concat(u,'/mp4; codecs="').concat(d.mp4track.codec,'"'));this.bufferControllers[u]=new fe(w,u),this.bufferControllers[u].on("error",this.onBufferError.bind(this))}}},{key:"startInterval",value:function(){var u=this;this.interval=setInterval(function(){u.options.flushingTime?u.applyAndClearBuffer():u.bufferControllers&&u.cancelDelay()},this.options.flushingTime||1e3)}},{key:"stopInterval",value:function(){this.interval&&clearInterval(this.interval)}},{key:"cancelDelay",value:function(){if(this.node.buffered&&this.node.buffered.length>0&&!this.node.seeking){var u=this.node.buffered.end(0);u-this.node.currentTime>this.options.maxDelay/1e3&&(console.log("delay"),this.node.currentTime=u-.001)}}},{key:"releaseBuffer",value:function(){for(var u in this.bufferControllers)this.bufferControllers[u].doAppend()}},{key:"applyAndClearBuffer",value:function(){this.bufferControllers&&(this.releaseBuffer(),this.clearBuffer())}},{key:"getSafeClearOffsetOfBuffer",value:function(u){for(var d,w=this.options.mode==="audio"&&u||0,B=0;B=u);B++)d=this.kfPosition[B];return d&&(this.kfPosition=this.kfPosition.filter(function(c){return c=d})),w}},{key:"clearBuffer",value:function(){if(this.options.clearBuffer&&Date.now()-this.lastCleaningTime>1e4){for(var u in this.bufferControllers){var d=this.getSafeClearOffsetOfBuffer(this.node.currentTime);this.bufferControllers[u].initCleanup(d)}this.lastCleaningTime=Date.now()}}},{key:"onBuffer",value:function(u){this.options.readFpsFromTrack&&u.fps!==void 0&&this.options.fps!=u.fps&&(this.options.fps=u.fps,this.frameDuration=Math.ceil(1e3/u.fps),g("JMuxer changed FPS to ".concat(u.fps," from track data"))),this.env=="browser"?this.bufferControllers&&this.bufferControllers[u.type]&&this.bufferControllers[u.type].feed(u.payload):this.stream&&this.stream.push(u.payload),this.options.flushingTime===0&&this.applyAndClearBuffer()}},{key:"onMSEOpen",value:function(){this.mseReady=!0,URL.revokeObjectURL(this.url),typeof this.options.onReady=="function"&&this.options.onReady.call(null,this.isReset)}},{key:"onMSEClose",value:function(){this.mseReady=!1,this.videoStarted=!1}},{key:"onBufferError",value:function(u){if(u.name=="QuotaExceeded")return g("JMuxer cleaning ".concat(u.type," buffer due to QuotaExceeded error")),void this.bufferControllers[u.type].initCleanup(this.node.currentTime);u.name=="InvalidStateError"?(g("JMuxer is reseting due to InvalidStateError"),this.reset()):this.endMSE(),typeof this.options.onError=="function"&&this.options.onError.call(null,u)}}],[{key:"isSupported",value:function(u){return window.MediaSource&&window.MediaSource.isTypeSupported(u)}}]),h}(te)})})(gt);var Gt=gt.exports;const Vt=xt(Gt);var Yt=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,_e=(F,x,A,I)=>{for(var D=I>1?void 0:I?zt(x,A):x,v=F.length-1,b;v>=0;v--)(b=F[v])&&(D=(I?b(x,A,D):b(D))||D);return I&&D&&Yt(x,A,D),D};let de=class extends Rt(kt,At){constructor(){super(...arguments),this.jmuxer=null,this.status="connecting"}get url(){var F;return this.convertUrl((F=this.camSettings)==null?void 0:F.stream_url,this.printerUrl)}get webcamStyle(){var F,x,A;return{transform:this.generateTransform((F=this.camSettings.flip_horizontal)!=null?F:!1,(x=this.camSettings.flip_vertical)!=null?x:!1,(A=this.camSettings.rotation)!=null?A:0)}}mounted(){this.play()}play(){var I;if(this.status="connecting",(I=this.jmuxer)==null||I.destroy(),!this.url.startsWith("ws://")&&!this.url.startsWith("wss://")){console.error("jmuxer error: only websocket streams supported (ws://.. or wss://..)"),this.status="error";return}const F=this.$refs.video,x=this.camSettings.target_fps||10;this.jmuxer=new Vt({node:F,mode:"video",flushingTime:0,fps:x,onReady:D=>{this.status="connected",console.log("jmuxer ready:",D)},onError:D=>{this.status="error",console.log("jmuxer error:",D)}});const A=new WebSocket(this.url);A.binaryType="arraybuffer",A.addEventListener("message",D=>{var v;(v=this.jmuxer)==null||v.feed({video:new Uint8Array(D.data)})}),A.addEventListener("error",D=>{this.status="error",console.log("jmuxer ws error:",D)})}beforeUnmount(){var F;(F=this.jmuxer)==null||F.destroy()}onCamSettingsChanged(){this.play()}};_e([vt({required:!0})],de.prototype,"camSettings",2);_e([vt({default:null})],de.prototype,"printerUrl",2);_e([Tt("camSettings",{deep:!0})],de.prototype,"onCamSettingsChanged",1);de=_e([Bt],de);var Kt=function(){var x=this,A=x._self._c;return x._self._setupProxy,A("div",[A("video",{ref:"video",staticClass:"webcamImage",style:x.webcamStyle,attrs:{autoplay:""}}),x.status!=="connected"?A(Ct,[A(Ut,{staticClass:"_webcam_jmuxer_output text-center d-flex flex-column justify-center align-center"},[x.status==="connecting"?A(Mt,{staticClass:"mb-3",attrs:{indeterminate:"",color:"primary"}}):x._e(),A("span",{staticClass:"mt-3"},[x._v(x._s(x.status))])],1)],1):x._e()],1)},Jt=[],$t=Lt(de,Kt,Jt,!1,null,"90b79f69");const tr=$t.exports;export{tr as default};