miru/app/js/matroska-subtitles.min.js
2020-11-07 20:19:12 +01:00

2 lines
No EOL
103 KiB
JavaScript
Raw Blame History

/*! For license information please see matroska-subtitles.min.js.LICENSE.txt */
var MatroskaSubtitles;MatroskaSubtitles=(()=>{var e={742:(e,t)=>{"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,a=l(e),o=a[0],s=a[1],c=new i(function(e,t,r){return 3*(t+r)/4-r}(0,o,s)),u=0,f=s>0?o-4:o;for(r=0;r<f;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=255&t;return 2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[u++]=255&t),1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t),c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],o=16383,s=0,l=n-i;s<l;s+=o)a.push(c(e,s,s+o>l?l:s+o));return 1===i?(t=e[n-1],a.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],a.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),a.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=a.length;o<s;++o)r[o]=a[o],n[a.charCodeAt(o)]=o;function l(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,n){for(var i,a,o=[],s=t;s<n;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(r[(a=i)>>18&63]+r[a>>12&63]+r[a>>6&63]+r[63&a]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},764:(e,t,r)=>{"use strict";const n=r(742),i=r(645),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l,t.SlowBuffer=function(e){return+e!=e&&(e=0),l.alloc(+e)},t.INSPECT_MAX_BYTES=50;const o=2147483647;function s(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return f(e)}return c(e,t,r)}function c(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|p(e,t);let n=s(r);const i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return l.from(n,t,r);const i=function(e){if(l.isBuffer(e)){const t=0|g(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||J(e.length)?s(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function f(e){return u(e),s(e<0?0:0|g(e))}function h(e){const t=e.length<0?0:0|g(e.length),r=s(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function d(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,l.prototype),n}function g(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function p(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(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);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(e).length;default:if(i)return n?-1:z(e).length;t=(""+t).toLowerCase(),i=!0}}function b(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return D(this,t,r);case"utf8":case"utf-8":return _(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return B(this,t,r);case"base64":return C(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:T(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):T(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function T(e,t,r,n,i){let a,o=1,s=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,l/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){let n=-1;for(a=r;a<s;a++)if(c(e,a)===c(t,-1===n?0:a-n)){if(-1===n&&(n=a),a-n+1===l)return n*o}else-1!==n&&(a-=a-n),n=-1}else for(r+l>s&&(r=s-l),a=r;a>=0;a--){let r=!0;for(let n=0;n<l;n++)if(c(e,a+n)!==c(t,n)){r=!1;break}if(r)return a}return-1}function E(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const a=t.length;let o;for(n>a/2&&(n=a/2),o=0;o<n;++o){const n=parseInt(t.substr(2*o,2),16);if(J(n))return o;e[r+o]=n}return o}function w(e,t,r,n){return K(z(t,e.length-r),e,r,n)}function v(e,t,r,n){return K(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function S(e,t,r,n){return K(G(t),e,r,n)}function I(e,t,r,n){return K(function(e,t){let r,n,i;const a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)r=e.charCodeAt(o),n=r>>8,i=r%256,a.push(i),a.push(n);return a}(t,e.length-r),e,r,n)}function C(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function _(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=r){let r,n,s,l;switch(o){case 1:t<128&&(a=t);break;case 2:r=e[i+1],128==(192&r)&&(l=(31&t)<<6|63&r,l>127&&(a=l));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(l=(15&t)<<12|(63&r)<<6|63&n,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:r=e[i+1],n=e[i+2],s=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(l=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&s,l>65535&&l<1114112&&(a=l))}}null===a?(a=65533,o=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=o}return function(e){const t=e.length;if(t<=k)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=k));return r}(n)}t.kMaxLength=o,l.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,r){return c(e,t,r)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,r){return function(e,t,r){return u(e),e<=0?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)}(e,t,r)},l.allocUnsafe=function(e){return f(e)},l.allocUnsafeSlow=function(e){return f(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(Y(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=l.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if(Y(t,Uint8Array))i+t.length>n.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!l.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},l.byteLength=p,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)m(this,t,t+1);return this},l.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},l.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},l.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?_(this,0,e):b.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},a&&(l.prototype[a]=l.prototype.inspect),l.prototype.compare=function(e,t,r,n,i){if(Y(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.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===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0);const s=Math.min(a,o),c=this.slice(n,i),u=e.slice(t,r);for(let e=0;e<s;++e)if(c[e]!==u[e]){a=c[e],o=u[e];break}return a<o?-1:o<a?1:0},l.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},l.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},l.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)},l.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return v(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function R(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function B(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function D(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=X[e[n]];return i}function A(e,t,r){const n=e.slice(t,r);let i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}function L(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,a){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function P(e,t,r,n,i){H(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,r}function U(e,t,r,n,i){H(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r+7]=a,a>>=8,e[r+6]=a,a>>=8,e[r+5]=a,a>>=8,e[r+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=o,o>>=8,e[r+2]=o,o>>=8,e[r+1]=o,o>>=8,e[r]=o,r+8}function O(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function x(e,t,r,n,a){return t=+t,r>>>=0,a||O(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function F(e,t,r,n,a){return t=+t,r>>>=0,a||O(e,0,r,8),i.write(e,t,r,n,52,8),r+8}l.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,l.prototype),n},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=this[e],i=1,a=0;for(;++a<t&&(i*=256);)n+=this[e+a]*i;return n},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=Z((function(e){W(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||q(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),l.prototype.readBigUInt64BE=Z((function(e){W(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||q(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=this[e],i=1,a=0;for(;++a<t&&(i*=256);)n+=this[e+a]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=t,i=1,a=this[e+--n];for(;n>0&&(i*=256);)a+=this[e+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*t)),a},l.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=Z((function(e){W(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||q(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),l.prototype.readBigInt64BE=Z((function(e){W(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||q(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),i.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(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},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(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},l.prototype.writeBigUInt64LE=Z((function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeBigUInt64BE=Z((function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=0,a=1,o=0;for(this[t]=255&e;++i<r&&(a*=256);)e<0&&0===o&&0!==this[t+i-1]&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=r-1,a=1,o=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(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},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(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},l.prototype.writeBigInt64LE=Z((function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeBigInt64BE=Z((function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeFloatLE=function(e,t,r){return x(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return x(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},l.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{const a=l.isBuffer(e)?e:l.from(e,n),o=a.length;if(0===o)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=a[i%o]}return this};const N={};function j(e,t,r){N[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function V(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function H(e,t,r,n,i,a){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let i;throw i=a>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(a+1)}${n}`:`>= -(2${n} ** ${8*(a+1)-1}${n}) and < 2 ** ${8*(a+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new N.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){W(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||q(t,e.length-(r+1))}(n,i,a)}function W(e,t){if("number"!=typeof e)throw new N.ERR_INVALID_ARG_TYPE(t,"number",e)}function q(e,t,r){if(Math.floor(e)!==e)throw W(e,r),new N.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new N.ERR_BUFFER_OUT_OF_BOUNDS;throw new N.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}j("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?e+" is outside of buffer bounds":"Attempt to access memory outside buffer bounds"}),RangeError),j("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),j("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=V(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const $=/[^+/0-9A-Za-z-_]/g;function z(e,t){let r;t=t||1/0;const n=e.length;let i=null;const a=[];for(let o=0;o<n;++o){if(r=e.charCodeAt(o),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function G(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace($,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function K(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const X=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function Z(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},510:(e,t,r)=>{"use strict";var n=r(764).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(830),a=r(103),o=r(984),s=r(471),l=r(451);t.EbmlStreamDecoderOptions=class{constructor(){this.bufferTagIds=[]}};class c extends i.Transform{constructor(e={}){super(Object.assign({},e,{readableObjectMode:!0})),this._currentBufferOffset=0,this._tagStack=[],this._buffer=n.alloc(0),this._bufferTagIds=[],this._bufferTagIds=e.bufferTagIds||[]}get buffer(){return this._buffer}_transform(e,t,r){for(this._buffer=n.concat([this._buffer,n.from(e)]);this.parseTags(););r()}parseTags(){const e=this.readTagHeader(this._buffer);if(!e)return!1;if(e.type===o.EbmlElementType.Master&&!this._bufferTagIds.some((t=>t===e.id)))return this._tagStack.push(e),this.emitTag(e,s.EbmlTagPosition.Start),this.advanceBuffer(e.tagHeaderLength),!0;{if(this._buffer.length<e.tagHeaderLength+e.size)return!1;const t=this._buffer.slice(e.tagHeaderLength,e.tagHeaderLength+e.size);for(this.emitTag(e,s.EbmlTagPosition.Content,t),this.advanceBuffer(e.tagHeaderLength+e.size);this._tagStack.length>0;){const e=this._tagStack[this._tagStack.length-1];if(this._currentBufferOffset<e.absoluteStart+e.tagHeaderLength+e.size)break;this.emitTag(e,s.EbmlTagPosition.End),this._tagStack.pop()}}return!0}advanceBuffer(e){this._currentBufferOffset+=e,this._buffer=this._buffer.slice(e)}readTagHeader(e,t=0){if(0==e.length)return null;const r=a.Tools.readVint(e,t);if(null==r)return null;const n=a.Tools.readVint(e,t+r.length);if(null==n)return null;const i=a.Tools.readHexString(e,t,t+r.length),o=Number.parseInt(i,16);let s=l.EbmlTagFactory.create(o);return s.size=n.value,Object.assign(s,{absoluteStart:this._currentBufferOffset+t,tagHeaderLength:r.length+n.length})}emitTag(e,t,r){let n=l.EbmlTagFactory.create(e.id);n.size=e.size,n.position=t,t===s.EbmlTagPosition.Content&&n.parseContent(r),this.push(n)}}t.EbmlStreamDecoder=c},875:(e,t,r)=>{"use strict";var n=r(764).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(830),a=r(471),o=r(90);class s extends i.Transform{constructor(e={}){super(Object.assign({},e,{writableObjectMode:!0})),this.dataBuffer=n.alloc(0),this.mCorked=!1,this.openTags=[]}_transform(e,t,r){if(e){if(!e.id)throw new Error("No id found for "+JSON.stringify(e));switch(e.position){case a.EbmlTagPosition.Start:this.startTag(e);break;case a.EbmlTagPosition.Content:this.writeTag(e);break;case a.EbmlTagPosition.End:this.endTag(e)}}r()}bufferAndFlush(e){this.dataBuffer=n.concat([this.dataBuffer,e]),this._flush((()=>{}))}_flush(e){let t=null;this.dataBuffer.length>0&&!this.mCorked&&(t=n.from(this.dataBuffer),this.dataBuffer=n.alloc(0),this.push(t)),e()}_bufferAndFlush(e){this.bufferAndFlush(e)}flush(){this._flush((()=>{}))}get buffer(){return this.dataBuffer}set buffer(e){this.dataBuffer=e}get stack(){return this.openTags}cork(){this.mCorked=!0}uncork(){this.mCorked=!1,this._flush((()=>{}))}writeTag(e){this.openTags.length>0?this.openTags[this.openTags.length-1].Children.push(e):this.bufferAndFlush(e.encode())}startTag(e){this.openTags.length>0&&this.openTags[this.openTags.length-1].Children.push(e),this.openTags.push(e)}endTag(e){const t=this.openTags.pop();if(e.id!==t.id)throw`Logic error - closing tag "${o.EbmlTagId[e.id]}" is not expected tag "${o.EbmlTagId[t.id]}"`;this.openTags.length<1&&this.bufferAndFlush(t.encode())}}t.EbmlStreamEncoder=s},277:(e,t,r)=>{"use strict";r(103).Tools;var n=r(510);t.LE=n.EbmlStreamDecoder,r(875).EbmlStreamEncoder,r(16).Block,r(563).BlockLacing,r(42).EbmlDataTag,r(984).EbmlElementType,r(785).EbmlMasterTag,r(819).EbmlTag,r(451).EbmlTagFactory;var i=r(90);t.Av=i.EbmlTagId,r(471).EbmlTagPosition,r(212).SimpleBlock},819:(e,t,r)=>{"use strict";var n=r(764).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(90),a=r(103);t.EbmlTag=class{constructor(e,t,r){this.id=e,this.type=t,this.position=r}getTagDeclaration(){let e=this.id.toString(16);return e.length%2!=0&&(e="0"+e),n.from(e,"hex")}encode(){let e=null,t=this.encodeContent();if(-1===this.size)e=n.from("01ffffffffffffff","hex");else{let r=void 0;[i.EbmlTagId.Segment,i.EbmlTagId.Cluster].some((e=>e===this.id))&&(r=8),e=a.Tools.writeVint(t.length,r)}return n.concat([this.getTagDeclaration(),e,t])}}},451:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(90),i=r(785),a=r(42),o=r(16),s=r(212),l=r(984);t.EbmlTagFactory=class{static create(e,t){if(void 0!==n.EbmlTagId[e]){let r;switch(e){case n.EbmlTagId.Block:return new o.Block;case n.EbmlTagId.SimpleBlock:return new s.SimpleBlock;case n.EbmlTagId.ChapterDisplay:case n.EbmlTagId.ContentCompression:case n.EbmlTagId.ContentEncryption:case n.EbmlTagId.SilentTracks:case n.EbmlTagId.ContentEncoding:case n.EbmlTagId.TrackTranslate:case n.EbmlTagId.ChapProcessCommand:case n.EbmlTagId.ChapterTranslate:case n.EbmlTagId.ChapProcess:case n.EbmlTagId.Tag:case n.EbmlTagId.Segment:case n.EbmlTagId.SimpleTag:case n.EbmlTagId.Targets:case n.EbmlTagId.Tags:case n.EbmlTagId.ChapterTrack:case n.EbmlTagId.ChapterAtom:case n.EbmlTagId.EditionEntry:case n.EbmlTagId.Chapters:case n.EbmlTagId.AttachedFile:case n.EbmlTagId.Attachments:case n.EbmlTagId.CueReference:case n.EbmlTagId.CueTrackPositions:case n.EbmlTagId.CuePoint:case n.EbmlTagId.Cues:case n.EbmlTagId.ContentEncAESSettings:case n.EbmlTagId.ContentEncodings:case n.EbmlTagId.TrackJoinBlocks:case n.EbmlTagId.TrackPlane:case n.EbmlTagId.TrackCombinePlanes:case n.EbmlTagId.TrackOperation:case n.EbmlTagId.Audio:case n.EbmlTagId.Video:case n.EbmlTagId.TrackEntry:case n.EbmlTagId.Tracks:case n.EbmlTagId.ReferenceFrame:case n.EbmlTagId.TimeSlice:case n.EbmlTagId.Slices:case n.EbmlTagId.BlockMore:case n.EbmlTagId.BlockAdditions:case n.EbmlTagId.BlockGroup:case n.EbmlTagId.Cluster:case n.EbmlTagId.Info:case n.EbmlTagId.Seek:case n.EbmlTagId.SeekHead:case n.EbmlTagId.SignatureElementList:case n.EbmlTagId.SignatureElements:case n.EbmlTagId.SignatureSlot:case n.EbmlTagId.EBML:r=l.EbmlElementType.Master;break;case n.EbmlTagId.TrackType:case n.EbmlTagId.FlagDefault:case n.EbmlTagId.ChapterTrackNumber:case n.EbmlTagId.ChapterTimeStart:case n.EbmlTagId.ChapterTimeEnd:case n.EbmlTagId.CueRefTime:case n.EbmlTagId.CueRefCluster:case n.EbmlTagId.ChapterFlagHidden:case n.EbmlTagId.ContentCompAlgo:case n.EbmlTagId.DocTypeReadVersion:case n.EbmlTagId.EBMLVersion:case n.EbmlTagId.DocTypeVersion:case n.EbmlTagId.TagDefault:case n.EbmlTagId.ChapterFlagEnabled:case n.EbmlTagId.FileUsedStartTime:case n.EbmlTagId.FileUsedEndTime:case n.EbmlTagId.ContentEncodingOrder:case n.EbmlTagId.ContentEncodingScope:case n.EbmlTagId.ContentEncodingType:case n.EbmlTagId.CueBlockNumber:case n.EbmlTagId.BitDepth:case n.EbmlTagId.ChapProcessTime:case n.EbmlTagId.ChapProcessCodecID:case n.EbmlTagId.AttachmentLink:case n.EbmlTagId.TagAttachmentUID:case n.EbmlTagId.TagChapterUID:case n.EbmlTagId.TagEditionUID:case n.EbmlTagId.TagTrackUID:case n.EbmlTagId.TargetTypeValue:case n.EbmlTagId.ChapterPhysicalEquiv:case n.EbmlTagId.ChapterSegmentEditionUID:case n.EbmlTagId.ChapterUID:case n.EbmlTagId.EditionFlagOrdered:case n.EbmlTagId.EditionFlagDefault:case n.EbmlTagId.EditionFlagHidden:case n.EbmlTagId.EditionUID:case n.EbmlTagId.FileUID:case n.EbmlTagId.CueRefCodecState:case n.EbmlTagId.CueRefNumber:case n.EbmlTagId.CueCodecState:case n.EbmlTagId.CueDuration:case n.EbmlTagId.CueRelativePosition:case n.EbmlTagId.CueClusterPosition:case n.EbmlTagId.CueTrack:case n.EbmlTagId.CueTime:case n.EbmlTagId.AESSettingsCipherMode:case n.EbmlTagId.ContentSigHashAlgo:case n.EbmlTagId.ContentSigAlgo:case n.EbmlTagId.ContentEncAlgo:case n.EbmlTagId.TrickMasterTrackUID:case n.EbmlTagId.TrickTrackFlag:case n.EbmlTagId.TrickTrackUID:case n.EbmlTagId.TrackJoinUID:case n.EbmlTagId.TrackPlaneType:case n.EbmlTagId.TrackPlaneUID:case n.EbmlTagId.Channels:case n.EbmlTagId.AspectRatioType:case n.EbmlTagId.DisplayUnit:case n.EbmlTagId.DisplayHeight:case n.EbmlTagId.DisplayWidth:case n.EbmlTagId.PixelCropRight:case n.EbmlTagId.PixelCropLeft:case n.EbmlTagId.PixelCropTop:case n.EbmlTagId.PixelCropBottom:case n.EbmlTagId.PixelHeight:case n.EbmlTagId.PixelWidth:case n.EbmlTagId.OldStereoMode:case n.EbmlTagId.AlphaMode:case n.EbmlTagId.StereoMode:case n.EbmlTagId.FlagInterlaced:case n.EbmlTagId.TrackTranslateCodec:case n.EbmlTagId.TrackTranslateEditionUID:case n.EbmlTagId.SeekPreRoll:case n.EbmlTagId.CodecDelay:case n.EbmlTagId.TrackOverlay:case n.EbmlTagId.CodecDecodeAll:case n.EbmlTagId.MaxBlockAdditionID:case n.EbmlTagId.DefaultDecodedFieldDuration:case n.EbmlTagId.DefaultDuration:case n.EbmlTagId.MaxCache:case n.EbmlTagId.MinCache:case n.EbmlTagId.FlagLacing:case n.EbmlTagId.FlagForced:case n.EbmlTagId.FlagEnabled:case n.EbmlTagId.TrackUID:case n.EbmlTagId.TrackNumber:case n.EbmlTagId.ReferenceTimeCode:case n.EbmlTagId.ReferenceOffset:case n.EbmlTagId.SliceDuration:case n.EbmlTagId.Delay:case n.EbmlTagId.BlockAdditionID:case n.EbmlTagId.FrameNumber:case n.EbmlTagId.LaceNumber:case n.EbmlTagId.ReferencePriority:case n.EbmlTagId.BlockDuration:case n.EbmlTagId.BlockAddID:case n.EbmlTagId.PrevSize:case n.EbmlTagId.Position:case n.EbmlTagId.SilentTrackNumber:case n.EbmlTagId.Timecode:case n.EbmlTagId.TimecodeScaleDenominator:case n.EbmlTagId.TimecodeScale:case n.EbmlTagId.ChapterTranslateCodec:case n.EbmlTagId.ChapterTranslateEditionUID:case n.EbmlTagId.SeekPosition:case n.EbmlTagId.SignatureHash:case n.EbmlTagId.SignatureAlgo:case n.EbmlTagId.EBMLMaxSizeLength:case n.EbmlTagId.EBMLMaxIDLength:case n.EbmlTagId.EBMLReadVersion:r=l.EbmlElementType.UnsignedInt;break;case n.EbmlTagId.TrackOffset:case n.EbmlTagId.DiscardPadding:case n.EbmlTagId.ReferenceVirtual:case n.EbmlTagId.ReferenceBlock:r=l.EbmlElementType.Integer;break;case n.EbmlTagId.CodecID:case n.EbmlTagId.DocType:case n.EbmlTagId.FileMimeType:case n.EbmlTagId.TagLanguage:case n.EbmlTagId.TargetType:case n.EbmlTagId.ChapCountry:case n.EbmlTagId.ChapLanguage:case n.EbmlTagId.CodecDownloadURL:case n.EbmlTagId.CodecInfoURL:case n.EbmlTagId.Language:r=l.EbmlElementType.String;break;case n.EbmlTagId.ChapString:case n.EbmlTagId.TagString:case n.EbmlTagId.ChapterStringUID:case n.EbmlTagId.WritingApp:case n.EbmlTagId.SegmentFilename:case n.EbmlTagId.CodecName:case n.EbmlTagId.TagName:case n.EbmlTagId.FileName:case n.EbmlTagId.FileDescription:case n.EbmlTagId.CodecSettings:case n.EbmlTagId.Name:case n.EbmlTagId.MuxingApp:case n.EbmlTagId.Title:case n.EbmlTagId.NextFilename:case n.EbmlTagId.PrevFilename:r=l.EbmlElementType.UTF8;break;case n.EbmlTagId.ContentCompSettings:case n.EbmlTagId.SegmentFamily:case n.EbmlTagId.TagBinary:case n.EbmlTagId.FileReferral:case n.EbmlTagId.SignedElement:case n.EbmlTagId.ChapProcessData:case n.EbmlTagId.ChapProcessPrivate:case n.EbmlTagId.ChapterSegmentUID:case n.EbmlTagId.FileData:case n.EbmlTagId.ContentSigKeyID:case n.EbmlTagId.ContentSignature:case n.EbmlTagId.ContentEncKeyID:case n.EbmlTagId.TrickMasterTrackSegmentUID:case n.EbmlTagId.TrickTrackSegmentUID:case n.EbmlTagId.ChannelPositions:case n.EbmlTagId.ColourSpace:case n.EbmlTagId.TrackTranslateTrackID:case n.EbmlTagId.CodecPrivate:case n.EbmlTagId.EncryptedBlock:case n.EbmlTagId.CodecState:case n.EbmlTagId.BlockAdditional:case n.EbmlTagId.BlockVirtual:case n.EbmlTagId.ChapterTranslateID:case n.EbmlTagId.NextUID:case n.EbmlTagId.PrevUID:case n.EbmlTagId.SegmentUID:case n.EbmlTagId.SeekID:case n.EbmlTagId.Signature:case n.EbmlTagId.SignaturePublicKey:case n.EbmlTagId.CRC32:case n.EbmlTagId.Void:r=l.EbmlElementType.Binary;break;case n.EbmlTagId.Duration:case n.EbmlTagId.OutputSamplingFrequency:case n.EbmlTagId.SamplingFrequency:case n.EbmlTagId.FrameRate:case n.EbmlTagId.GammaValue:case n.EbmlTagId.TrackTimecodeScale:r=l.EbmlElementType.Float;break;case n.EbmlTagId.DateUTC:r=l.EbmlElementType.Date}if(void 0===t)t=r;else if(t!==r)throw new Error(`Trying to create tag of well-known type "${n.EbmlTagId[e]}" using content type "${t}" (which is incorrect). Either pass the correct type or ignore the type parameter to EbmlTag.create()`)}switch(t){case l.EbmlElementType.Master:return new i.EbmlMasterTag(e);case l.EbmlElementType.UTF8:case l.EbmlElementType.Binary:case l.EbmlElementType.Date:case l.EbmlElementType.Float:case l.EbmlElementType.Integer:case l.EbmlElementType.String:case l.EbmlElementType.UnsignedInt:default:return new a.EbmlDataTag(e,t)}}}},563:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),(r=t.BlockLacing||(t.BlockLacing={}))[r.None=0]="None",r[r.Xiph=1]="Xiph",r[r.EBML=2]="EBML",r[r.FixedSize=3]="FixedSize"},984:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),(r=t.EbmlElementType||(t.EbmlElementType={})).Master="m",r.UnsignedInt="u",r.Integer="i",r.String="s",r.UTF8="8",r.Binary="b",r.Float="f",r.Date="d"},90:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),(r=t.EbmlTagId||(t.EbmlTagId={}))[r.ChapterDisplay=128]="ChapterDisplay",r[r.TrackType=131]="TrackType",r[r.ChapString=133]="ChapString",r[r.CodecID=134]="CodecID",r[r.FlagDefault=136]="FlagDefault",r[r.ChapterTrackNumber=137]="ChapterTrackNumber",r[r.ChapterTimeStart=145]="ChapterTimeStart",r[r.ChapterTimeEnd=146]="ChapterTimeEnd",r[r.CueRefTime=150]="CueRefTime",r[r.CueRefCluster=151]="CueRefCluster",r[r.ChapterFlagHidden=152]="ChapterFlagHidden",r[r.ContentCompAlgo=16980]="ContentCompAlgo",r[r.ContentCompSettings=16981]="ContentCompSettings",r[r.DocType=17026]="DocType",r[r.DocTypeReadVersion=17029]="DocTypeReadVersion",r[r.EBMLVersion=17030]="EBMLVersion",r[r.DocTypeVersion=17031]="DocTypeVersion",r[r.SegmentFamily=17476]="SegmentFamily",r[r.DateUTC=17505]="DateUTC",r[r.TagDefault=17540]="TagDefault",r[r.TagBinary=17541]="TagBinary",r[r.TagString=17543]="TagString",r[r.Duration=17545]="Duration",r[r.ChapterFlagEnabled=17816]="ChapterFlagEnabled",r[r.FileMimeType=18016]="FileMimeType",r[r.FileUsedStartTime=18017]="FileUsedStartTime",r[r.FileUsedEndTime=18018]="FileUsedEndTime",r[r.FileReferral=18037]="FileReferral",r[r.ContentEncodingOrder=20529]="ContentEncodingOrder",r[r.ContentEncodingScope=20530]="ContentEncodingScope",r[r.ContentEncodingType=20531]="ContentEncodingType",r[r.ContentCompression=20532]="ContentCompression",r[r.ContentEncryption=20533]="ContentEncryption",r[r.CueBlockNumber=21368]="CueBlockNumber",r[r.ChapterStringUID=22100]="ChapterStringUID",r[r.WritingApp=22337]="WritingApp",r[r.SilentTracks=22612]="SilentTracks",r[r.ContentEncoding=25152]="ContentEncoding",r[r.BitDepth=25188]="BitDepth",r[r.SignedElement=25906]="SignedElement",r[r.TrackTranslate=26148]="TrackTranslate",r[r.ChapProcessCommand=26897]="ChapProcessCommand",r[r.ChapProcessTime=26914]="ChapProcessTime",r[r.ChapterTranslate=26916]="ChapterTranslate",r[r.ChapProcessData=26931]="ChapProcessData",r[r.ChapProcess=26948]="ChapProcess",r[r.ChapProcessCodecID=26965]="ChapProcessCodecID",r[r.Tag=29555]="Tag",r[r.SegmentFilename=29572]="SegmentFilename",r[r.AttachmentLink=29766]="AttachmentLink",r[r.CodecName=2459272]="CodecName",r[r.Segment=408125543]="Segment",r[r.TagLanguage=17530]="TagLanguage",r[r.TagName=17827]="TagName",r[r.SimpleTag=26568]="SimpleTag",r[r.TagAttachmentUID=25542]="TagAttachmentUID",r[r.TagChapterUID=25540]="TagChapterUID",r[r.TagEditionUID=25545]="TagEditionUID",r[r.TagTrackUID=25541]="TagTrackUID",r[r.TargetType=25546]="TargetType",r[r.TargetTypeValue=26826]="TargetTypeValue",r[r.Targets=25536]="Targets",r[r.Tags=307544935]="Tags",r[r.ChapProcessPrivate=17677]="ChapProcessPrivate",r[r.ChapCountry=17278]="ChapCountry",r[r.ChapLanguage=17276]="ChapLanguage",r[r.ChapterTrack=143]="ChapterTrack",r[r.ChapterPhysicalEquiv=25539]="ChapterPhysicalEquiv",r[r.ChapterSegmentEditionUID=28348]="ChapterSegmentEditionUID",r[r.ChapterSegmentUID=28263]="ChapterSegmentUID",r[r.ChapterUID=29636]="ChapterUID",r[r.ChapterAtom=182]="ChapterAtom",r[r.EditionFlagOrdered=17885]="EditionFlagOrdered",r[r.EditionFlagDefault=17883]="EditionFlagDefault",r[r.EditionFlagHidden=17853]="EditionFlagHidden",r[r.EditionUID=17852]="EditionUID",r[r.EditionEntry=17849]="EditionEntry",r[r.Chapters=272869232]="Chapters",r[r.FileUID=18094]="FileUID",r[r.FileData=18012]="FileData",r[r.FileName=18030]="FileName",r[r.FileDescription=18046]="FileDescription",r[r.AttachedFile=24999]="AttachedFile",r[r.Attachments=423732329]="Attachments",r[r.CueRefCodecState=235]="CueRefCodecState",r[r.CueRefNumber=21343]="CueRefNumber",r[r.CueReference=219]="CueReference",r[r.CueCodecState=234]="CueCodecState",r[r.CueDuration=178]="CueDuration",r[r.CueRelativePosition=240]="CueRelativePosition",r[r.CueClusterPosition=241]="CueClusterPosition",r[r.CueTrack=247]="CueTrack",r[r.CueTrackPositions=183]="CueTrackPositions",r[r.CueTime=179]="CueTime",r[r.CuePoint=187]="CuePoint",r[r.Cues=475249515]="Cues",r[r.AESSettingsCipherMode=18408]="AESSettingsCipherMode",r[r.ContentEncAESSettings=18407]="ContentEncAESSettings",r[r.ContentSigHashAlgo=18406]="ContentSigHashAlgo",r[r.ContentSigAlgo=18405]="ContentSigAlgo",r[r.ContentSigKeyID=18404]="ContentSigKeyID",r[r.ContentSignature=18403]="ContentSignature",r[r.ContentEncKeyID=18402]="ContentEncKeyID",r[r.ContentEncAlgo=18401]="ContentEncAlgo",r[r.ContentEncodings=28032]="ContentEncodings",r[r.TrickMasterTrackSegmentUID=196]="TrickMasterTrackSegmentUID",r[r.TrickMasterTrackUID=199]="TrickMasterTrackUID",r[r.TrickTrackFlag=198]="TrickTrackFlag",r[r.TrickTrackSegmentUID=193]="TrickTrackSegmentUID",r[r.TrickTrackUID=192]="TrickTrackUID",r[r.TrackJoinUID=237]="TrackJoinUID",r[r.TrackJoinBlocks=233]="TrackJoinBlocks",r[r.TrackPlaneType=230]="TrackPlaneType",r[r.TrackPlaneUID=229]="TrackPlaneUID",r[r.TrackPlane=228]="TrackPlane",r[r.TrackCombinePlanes=227]="TrackCombinePlanes",r[r.TrackOperation=226]="TrackOperation",r[r.ChannelPositions=32123]="ChannelPositions",r[r.Channels=159]="Channels",r[r.OutputSamplingFrequency=30901]="OutputSamplingFrequency",r[r.SamplingFrequency=181]="SamplingFrequency",r[r.Audio=225]="Audio",r[r.FrameRate=2327523]="FrameRate",r[r.GammaValue=3126563]="GammaValue",r[r.ColourSpace=3061028]="ColourSpace",r[r.AspectRatioType=21683]="AspectRatioType",r[r.DisplayUnit=21682]="DisplayUnit",r[r.DisplayHeight=21690]="DisplayHeight",r[r.DisplayWidth=21680]="DisplayWidth",r[r.PixelCropRight=21725]="PixelCropRight",r[r.PixelCropLeft=21708]="PixelCropLeft",r[r.PixelCropTop=21691]="PixelCropTop",r[r.PixelCropBottom=21674]="PixelCropBottom",r[r.PixelHeight=186]="PixelHeight",r[r.PixelWidth=176]="PixelWidth",r[r.OldStereoMode=21433]="OldStereoMode",r[r.AlphaMode=21440]="AlphaMode",r[r.StereoMode=21432]="StereoMode",r[r.FlagInterlaced=154]="FlagInterlaced",r[r.Video=224]="Video",r[r.TrackTranslateTrackID=26277]="TrackTranslateTrackID",r[r.TrackTranslateCodec=26303]="TrackTranslateCodec",r[r.TrackTranslateEditionUID=26364]="TrackTranslateEditionUID",r[r.SeekPreRoll=22203]="SeekPreRoll",r[r.CodecDelay=22186]="CodecDelay",r[r.TrackOverlay=28587]="TrackOverlay",r[r.CodecDecodeAll=170]="CodecDecodeAll",r[r.CodecDownloadURL=2536e3]="CodecDownloadURL",r[r.CodecInfoURL=3883072]="CodecInfoURL",r[r.CodecSettings=3839639]="CodecSettings",r[r.CodecPrivate=25506]="CodecPrivate",r[r.Language=2274716]="Language",r[r.Name=21358]="Name",r[r.MaxBlockAdditionID=21998]="MaxBlockAdditionID",r[r.TrackOffset=21375]="TrackOffset",r[r.TrackTimecodeScale=2306383]="TrackTimecodeScale",r[r.DefaultDecodedFieldDuration=2313850]="DefaultDecodedFieldDuration",r[r.DefaultDuration=2352003]="DefaultDuration",r[r.MaxCache=28152]="MaxCache",r[r.MinCache=28135]="MinCache",r[r.FlagLacing=156]="FlagLacing",r[r.FlagForced=21930]="FlagForced",r[r.FlagEnabled=185]="FlagEnabled",r[r.TrackUID=29637]="TrackUID",r[r.TrackNumber=215]="TrackNumber",r[r.TrackEntry=174]="TrackEntry",r[r.Tracks=374648427]="Tracks",r[r.EncryptedBlock=175]="EncryptedBlock",r[r.ReferenceTimeCode=202]="ReferenceTimeCode",r[r.ReferenceOffset=201]="ReferenceOffset",r[r.ReferenceFrame=200]="ReferenceFrame",r[r.SliceDuration=207]="SliceDuration",r[r.Delay=206]="Delay",r[r.BlockAdditionID=203]="BlockAdditionID",r[r.FrameNumber=205]="FrameNumber",r[r.LaceNumber=204]="LaceNumber",r[r.TimeSlice=232]="TimeSlice",r[r.Slices=142]="Slices",r[r.DiscardPadding=30114]="DiscardPadding",r[r.CodecState=164]="CodecState",r[r.ReferenceVirtual=253]="ReferenceVirtual",r[r.ReferenceBlock=251]="ReferenceBlock",r[r.ReferencePriority=250]="ReferencePriority",r[r.BlockDuration=155]="BlockDuration",r[r.BlockAdditional=165]="BlockAdditional",r[r.BlockAddID=238]="BlockAddID",r[r.BlockMore=166]="BlockMore",r[r.BlockAdditions=30113]="BlockAdditions",r[r.BlockVirtual=162]="BlockVirtual",r[r.Block=161]="Block",r[r.BlockGroup=160]="BlockGroup",r[r.SimpleBlock=163]="SimpleBlock",r[r.PrevSize=171]="PrevSize",r[r.Position=167]="Position",r[r.SilentTrackNumber=22743]="SilentTrackNumber",r[r.Timecode=231]="Timecode",r[r.Cluster=524531317]="Cluster",r[r.MuxingApp=19840]="MuxingApp",r[r.Title=31657]="Title",r[r.TimecodeScaleDenominator=2807730]="TimecodeScaleDenominator",r[r.TimecodeScale=2807729]="TimecodeScale",r[r.ChapterTranslateID=27045]="ChapterTranslateID",r[r.ChapterTranslateCodec=27071]="ChapterTranslateCodec",r[r.ChapterTranslateEditionUID=27132]="ChapterTranslateEditionUID",r[r.NextFilename=4096955]="NextFilename",r[r.NextUID=4110627]="NextUID",r[r.PrevFilename=3965867]="PrevFilename",r[r.PrevUID=3979555]="PrevUID",r[r.SegmentUID=29604]="SegmentUID",r[r.Info=357149030]="Info",r[r.SeekPosition=21420]="SeekPosition",r[r.SeekID=21419]="SeekID",r[r.Seek=19899]="Seek",r[r.SeekHead=290298740]="SeekHead",r[r.SignatureElementList=32379]="SignatureElementList",r[r.SignatureElements=32347]="SignatureElements",r[r.Signature=32437]="Signature",r[r.SignaturePublicKey=32421]="SignaturePublicKey",r[r.SignatureHash=32410]="SignatureHash",r[r.SignatureAlgo=32394]="SignatureAlgo",r[r.SignatureSlot=458458727]="SignatureSlot",r[r.CRC32=191]="CRC32",r[r.Void=236]="Void",r[r.EBMLMaxSizeLength=17139]="EBMLMaxSizeLength",r[r.EBMLMaxIDLength=17138]="EBMLMaxIDLength",r[r.EBMLReadVersion=17143]="EBMLReadVersion",r[r.EBML=440786851]="EBML"},471:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),(r=t.EbmlTagPosition||(t.EbmlTagPosition={}))[r.Start=0]="Start",r[r.Content=1]="Content",r[r.End=2]="End"},16:(e,t,r)=>{"use strict";var n=r(764).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(42),a=r(563),o=r(103),s=r(90),l=r(984);class c extends i.EbmlDataTag{constructor(e){super(e||s.EbmlTagId.Block,l.EbmlElementType.Binary)}writeTrackBuffer(){return o.Tools.writeVint(this.track)}writeValueBuffer(){let e=n.alloc(2);return e.writeInt16BE(this.value,0),e}writeFlagsBuffer(){let e=0;switch(this.invisible&&(e|=16),this.lacing){case a.BlockLacing.None:break;case a.BlockLacing.Xiph:e|=4;break;case a.BlockLacing.EBML:e|=8;break;case a.BlockLacing.FixedSize:e|=12}return n.of(e)}encodeContent(){return n.concat([this.writeTrackBuffer(),this.writeValueBuffer(),this.writeFlagsBuffer(),this.payload])}parseContent(e){const t=o.Tools.readVint(e);this.track=t.value,this.value=o.Tools.readSigned(e.subarray(t.length,t.length+2));let r=e[t.length+2];switch(this.invisible=Boolean(16&r),12&r){case 0:this.lacing=a.BlockLacing.None;break;case 4:this.lacing=a.BlockLacing.Xiph;break;case 8:this.lacing=a.BlockLacing.EBML;break;case 12:this.lacing=a.BlockLacing.FixedSize}this.payload=e.slice(t.length+3)}}t.Block=c},42:(e,t,r)=>{"use strict";var n=r(764).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(819),a=r(984),o=r(103),s=r(471);class l extends i.EbmlTag{constructor(e,t){super(e,t,s.EbmlTagPosition.Content)}parseContent(e){switch(this.type){case a.EbmlElementType.UnsignedInt:this.data=o.Tools.readUnsigned(e);break;case a.EbmlElementType.Float:this.data=o.Tools.readFloat(e);break;case a.EbmlElementType.Integer:this.data=o.Tools.readSigned(e);break;case a.EbmlElementType.String:this.data=String.fromCharCode(...e);break;case a.EbmlElementType.UTF8:this.data=o.Tools.readUtf8(e);break;default:this.data=e}}encodeContent(){switch(this.type){case a.EbmlElementType.UnsignedInt:return o.Tools.writeUnsigned(this.data);case a.EbmlElementType.Float:return o.Tools.writeFloat(this.data);case a.EbmlElementType.Integer:return o.Tools.writeSigned(this.data);case a.EbmlElementType.String:return n.from(this.data,"ascii");case a.EbmlElementType.UTF8:return n.from(this.data,"utf8");case a.EbmlElementType.Binary:default:return this.data}}}t.EbmlDataTag=l},785:(e,t,r)=>{"use strict";var n=r(764).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(819),a=r(984),o=r(471),s=r(103),l=r(451);class c extends i.EbmlTag{constructor(e,t=o.EbmlTagPosition.Content){super(e,a.EbmlElementType.Master,t),this._children=[]}get Children(){return this._children}set Children(e){this._children=e}encodeContent(){return n.concat(this._children.map((e=>e.encode())))}parseContent(e){for(;e.length>0;){const t=s.Tools.readVint(e),r=s.Tools.readVint(e,t.length),n=s.Tools.readHexString(e,0,t.length),i=Number.parseInt(n,16);let a=l.EbmlTagFactory.create(i);a.size=r.value;let o=t.length+r.length+r.value;a.parseContent(e.slice(t.length+r.length,o)),this._children.push(a),e=e.slice(o)}}}t.EbmlMasterTag=c},212:(e,t,r)=>{"use strict";var n=r(764).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(103),a=r(16),o=r(90);class s extends a.Block{constructor(){super(o.EbmlTagId.SimpleBlock)}encodeContent(){let e=this.writeFlagsBuffer();return this.keyframe&&(e[0]|=128),this.discardable&&(e[0]|=1),n.concat([this.writeTrackBuffer(),this.writeValueBuffer(),e,this.payload])}parseContent(e){super.parseContent(e);let t=e[i.Tools.readVint(e).length+2];this.keyframe=Boolean(128&t),this.discardable=Boolean(1&t)}}t.SimpleBlock=s},103:(e,t,r)=>{"use strict";var n=r(764).Buffer;Object.defineProperty(t,"__esModule",{value:!0});class i{static readVint(e,t=0){const r=8-Math.floor(Math.log2(e[t]));if(r>8){const n=i.readHexString(e,t,t+r);throw new Error(`Unrepresentable length: ${r} ${n}`)}if(isNaN(r)||t+r>e.length)return null;if(8===r&&e[t+1]>=32&&e.subarray(t+2,t+8).some((e=>e>0)))return{length:8,value:-1};let n=e[t]&(1<<8-r)-1;for(let i=1;i<r;i+=1)n*=Math.pow(2,8),n+=e[t+i];return n===Math.pow(2,7*r)-1&&(n=-1),{length:r,value:n}}static writeVint(e,t){if(e<0||e>Math.pow(2,53))throw new Error("Unrepresentable value: "+e);let r=t;if(!r)for(r=1;r<=8&&!(e<Math.pow(2,7*r)-1);r+=1);const i=n.alloc(r);let a=e;for(let e=1;e<=r;e+=1){const t=255&a;i[r-e]=t,a-=t,a/=Math.pow(2,8)}return i[0]|=1<<8-r,i}static padStart(e){return 0==e.length?"00":1==e.length?"0"+e:e}static readHexString(e,t=0,r=e.byteLength){return Array.from(e.subarray(t,r)).map((e=>Number(e).toString(16))).reduce(((e,t)=>`${e}${this.padStart(t)}`),"")}static readUtf8(e){try{return n.from(e).toString("utf8")}catch(e){return null}}static readUnsigned(e){const t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 1:return t.getUint8(0);case 2:return t.getUint16(0);case 4:return t.getUint32(0)}if(e.byteLength<=6)return e.reduce(((e,t)=>256*e+t),0);var r=i.readHexString(e,0,e.byteLength),n=parseInt(r,16);return n<=Math.pow(256,6)?n:r}static writeUnsigned(e){if("string"==typeof e)return n.from(e,"hex");{var t=n.alloc(6);t.fill(0),t.writeUIntBE(e,0,6);let r=t.findIndex((e=>0!==e));return-1===r&&(r=t.length-1),t.slice(r)}}static readSigned(e){const t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 1:return t.getInt8(0);case 2:return t.getInt16(0);case 4:return t.getInt32(0);default:return NaN}}static writeSigned(e){var t=n.alloc(8);return t.writeInt32BE(e,0),t}static readFloat(e){const t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return t.getFloat32(0);case 8:return t.getFloat64(0);default:return NaN}}static writeFloat(e){let t=n.alloc(8);return t.writeFloatBE(e,0)<=4&&(t=t.slice(0,4)),t}}t.Tools=i},187:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=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 i=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(r,n){function i(){void 0!==a&&e.removeListener("error",a),r([].slice.call(arguments))}var a;"error"!==t&&(a=function(r){e.removeListener(t,i),n(r)},e.once("error",a)),e.once(t,i)}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function c(e,t,r,n){var i,a,o,c;if(s(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),o=a[t]),void 0===o)o=a[t]=r,++e._eventsCount;else if("function"==typeof o?o=a[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(i=l(e))>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,c=u,console&&console.warn&&console.warn(c)}return e}function u(){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,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=u.bind(n);return i.listener=r,n.wrapFn=i,i}function h(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):g(i,i.length)}function d(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function g(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,a=this._events;if(void 0!==a)i=i&&void 0===a.error;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var l=a[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else{var c=l.length,u=g(l,c);for(r=0;r<c;++r)n(u[r],this,t)}return!0},a.prototype.addListener=function(e,t){return c(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return c(this,e,t,!0)},a.prototype.once=function(e,t){return s(t),this.on(e,f(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,f(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,i,a,o;if(s(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){o=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(i=a[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return h(this,e,!0)},a.prototype.rawListeners=function(e){return h(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},a.prototype.listenerCount=d,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},645:(e,t)=>{t.read=function(e,t,r,n,i){var a,o,s=8*i-n-1,l=(1<<s)-1,c=l>>1,u=-7,f=r?i-1:0,h=r?-1:1,d=e[t+f];for(f+=h,a=d&(1<<-u)-1,d>>=-u,u+=s;u>0;a=256*a+e[t+f],f+=h,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=n;u>0;o=256*o+e[t+f],f+=h,u-=8);if(0===a)a=1-c;else{if(a===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),a-=c}return(d?-1:1)*o*Math.pow(2,a-n)},t.write=function(e,t,r,n,i,a){var o,s,l,c=8*a-i-1,u=(1<<c)-1,f=u>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,g=n?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+f>=1?h/l:h*Math.pow(2,1-f))*l>=2&&(o++,l/=2),o+f>=u?(s=0,o=u):o+f>=1?(s=(t*l-1)*Math.pow(2,i),o+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[r+d]=255&s,d+=g,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;e[r+d]=255&o,d+=g,o/=256,c-=8);e[r+d-g]|=128*p}},717:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},155:e=>{var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var s,l=[],c=!1,u=-1;function f(){c&&s&&(c=!1,s.length?l=s.concat(l):u=-1,l.length&&h())}function h(){if(!c){var e=o(f);c=!0;for(var t=l.length;t;){for(s=l,l=[];++u<t;)s&&s[u].run();u=-1,t=l.length}s=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function g(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new d(e,t)),1!==l.length||c||o(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=g,n.addListener=g,n.once=g,n.off=g,n.removeListener=g,n.removeAllListeners=g,n.emit=g,n.prependListener=g,n.prependOnceListener=g,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},281:e=>{"use strict";var t={};function r(e,r,n){n||(n=Error);var i=function(e){var t,n;function i(t,n,i){return e.call(this,function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(t,n,i))||this}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i}(n);i.prototype.name=n.name,i.prototype.code=e,t[e]=i}function n(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"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,r){var i,a,o,s,l;if("string"==typeof t&&(a="not ",t.substr(0,a.length)===a)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))o="The ".concat(e," ").concat(i," ").concat(n(t,"type"));else{var c=("number"!=typeof l&&(l=0),l+".".length>(s=e).length||-1===s.indexOf(".",l)?"argument":"property");o='The "'.concat(e,'" ').concat(c," ").concat(i," ").concat(n(t,"type"))}return o+". Received type ".concat(typeof r)}),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"),e.exports.q=t},753:(e,t,r)=>{"use strict";var n=r(155),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=u;var a=r(481),o=r(229);r(717)(u,a);for(var s=i(o.prototype),l=0;l<s.length;l++){var c=s[l];u.prototype[c]||(u.prototype[c]=o.prototype[c])}function u(e){if(!(this instanceof u))return new u(e);a.call(this,e),o.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",f)))}function f(){this._writableState.ended||n.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(u.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(u.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},725:(e,t,r)=>{"use strict";e.exports=i;var n=r(605);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r(717)(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},481:(e,t,r)=>{"use strict";var n,i=r(155);e.exports=C,C.ReadableState=I,r(187).EventEmitter;var a,o=function(e,t){return e.listeners(t).length},s=r(503),l=r(764).Buffer,c=r.g.Uint8Array||function(){},u=r(758);a=u&&u.debuglog?u.debuglog("stream"):function(){};var f,h,d,g=r(327),p=r(195),b=r(457).getHighWaterMark,m=r(281).q,y=m.ERR_INVALID_ARG_TYPE,T=m.ERR_STREAM_PUSH_AFTER_EOF,E=m.ERR_METHOD_NOT_IMPLEMENTED,w=m.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(717)(C,s);var v=p.errorOrDestroy,S=["error","close","destroy","pause","resume"];function I(e,t,i){n=n||r(753),e=e||{},"boolean"!=typeof i&&(i=t instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=b(this,e,"readableHighWaterMark",i),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(f||(f=r(553).s),this.decoder=new f(e.encoding),this.encoding=e.encoding)}function C(e){if(n=n||r(753),!(this instanceof C))return new C(e);var t=this instanceof n;this._readableState=new I(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function _(e,t,r,n,i){a("readableAddChunk",t);var o,s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(a("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?D(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,A(e)))}}(e,s);else if(i||(o=function(e,t){var r,n;return n=t,l.isBuffer(n)||n instanceof c||"string"==typeof t||void 0===t||e.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],t)),r}(s,t)),o)v(e,o);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=function(e){return l.from(e)}(t)),n)s.endEmitted?v(e,new w):k(e,s,t,!0);else if(s.ended)v(e,new T);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?k(e,s,t,!1):L(e,s)):k(e,s,t,!1)}else n||(s.reading=!1,L(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function k(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&D(e)),L(e,t)}Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),C.prototype.destroy=p.destroy,C.prototype._undestroy=p.undestroy,C.prototype._destroy=function(e,t){t(e)},C.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=l.from(e,t),t=""),r=!0),_(this,e,t,!1,r)},C.prototype.unshift=function(e){return _(this,e,null,!0,!1)},C.prototype.isPaused=function(){return!1===this._readableState.flowing},C.prototype.setEncoding=function(e){f||(f=r(553).s);var t=new f(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var R=1073741824;function B(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=R?e=R:(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 D(e){var t=e._readableState;a("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(a("emitReadable",t.flowing),t.emittedReadable=!0,i.nextTick(A,e))}function A(e){var t=e._readableState;a("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,x(e)}function L(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(M,e,t))}function M(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(a("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function P(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function U(e){a("readable nexttick read 0"),e.read(0)}function O(e,t){a("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),x(e),t.flowing&&!t.reading&&e.read(0)}function x(e){var t=e._readableState;for(a("flow",t.flowing);t.flowing&&null!==e.read(););}function F(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function N(e){var t=e._readableState;a("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,i.nextTick(j,t,e))}function j(e,t){if(a("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function V(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}C.prototype.read=function(e){a("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return a("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?N(this):D(this),null;if(0===(e=B(e,t))&&t.ended)return 0===t.length&&N(this),null;var n,i=t.needReadable;return a("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&a("length less than watermark",i=!0),t.ended||t.reading?a("reading or ended",i=!1):i&&(a("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=B(r,t))),null===(n=e>0?F(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),r!==e&&t.ended&&N(this)),null!==n&&this.emit("data",n),n},C.prototype._read=function(e){v(this,new E("_read()"))},C.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,a("pipe count=%d opts=%j",n.pipesCount,t);var s=t&&!1===t.end||e===i.stdout||e===i.stderr?p:l;function l(){a("onend"),e.end()}n.endEmitted?i.nextTick(s):r.once("end",s),e.on("unpipe",(function t(i,o){a("onunpipe"),i===r&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,a("cleanup"),e.removeListener("close",d),e.removeListener("finish",g),e.removeListener("drain",c),e.removeListener("error",h),e.removeListener("unpipe",t),r.removeListener("end",l),r.removeListener("end",p),r.removeListener("data",f),u=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}));var c=function(e){return function(){var t=e._readableState;a("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,x(e))}}(r);e.on("drain",c);var u=!1;function f(t){a("ondata");var i=e.write(t);a("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==V(n.pipes,e))&&!u&&(a("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function h(t){a("onerror",t),p(),e.removeListener("error",h),0===o(e,"error")&&v(e,t)}function d(){e.removeListener("finish",g),p()}function g(){a("onfinish"),e.removeListener("close",d),p()}function p(){a("unpipe"),r.unpipe(e)}return r.on("data",f),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events.error?Array.isArray(e._events.error)?e._events.error.unshift(r):e._events.error=[r,e._events.error]:e.on(t,r)}(e,"error",h),e.once("close",d),e.once("finish",g),e.emit("pipe",r),n.flowing||(a("pipe resume"),r.resume()),e},C.prototype.unpipe=function(e){var t=this._readableState,r={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,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<i;a++)n[a].emit("unpipe",this,{hasUnpiped:!1});return this}var o=V(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},C.prototype.on=function(e,t){var r=s.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,a("on readable",n.length,n.reading),n.length?D(this):n.reading||i.nextTick(U,this))),r},C.prototype.addListener=C.prototype.on,C.prototype.removeListener=function(e,t){var r=s.prototype.removeListener.call(this,e,t);return"readable"===e&&i.nextTick(P,this),r},C.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||i.nextTick(P,this),t},C.prototype.resume=function(){var e=this._readableState;return e.flowing||(a("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(O,e,t))}(this,e)),e.paused=!1,this},C.prototype.pause=function(){return a("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(a("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},C.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(a("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){a("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<S.length;o++)e.on(S[o],this.emit.bind(this,S[o]));return this._read=function(t){a("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(C.prototype[Symbol.asyncIterator]=function(){return void 0===h&&(h=r(850)),h(this)}),Object.defineProperty(C.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(C.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(C.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),C._fromList=F,Object.defineProperty(C.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(C.from=function(e,t){return void 0===d&&(d=r(167)),d(C,e,t)})},605:(e,t,r)=>{"use strict";e.exports=u;var n=r(281).q,i=n.ERR_METHOD_NOT_IMPLEMENTED,a=n.ERR_MULTIPLE_CALLBACK,o=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,l=r(753);function c(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new a);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function u(e){if(!(this instanceof u))return new u(e);l.call(this,e),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",f)}function f(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?h(this,null,null):this._flush((function(t,r){h(e,t,r)}))}function h(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new s;if(e._transformState.transforming)throw new o;return e.push(null)}r(717)(u,l),u.prototype.push=function(e,t){return this._transformState.needTransform=!1,l.prototype.push.call(this,e,t)},u.prototype._transform=function(e,t,r){r(new i("_transform()"))},u.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},u.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},u.prototype._destroy=function(e,t){l.prototype._destroy.call(this,e,(function(e){t(e)}))}},229:(e,t,r)=>{"use strict";var n,i=r(155);function a(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(undefined),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=C,C.WritableState=I;var o,s={deprecate:r(927)},l=r(503),c=r(764).Buffer,u=r.g.Uint8Array||function(){},f=r(195),h=r(457).getHighWaterMark,d=r(281).q,g=d.ERR_INVALID_ARG_TYPE,p=d.ERR_METHOD_NOT_IMPLEMENTED,b=d.ERR_MULTIPLE_CALLBACK,m=d.ERR_STREAM_CANNOT_PIPE,y=d.ERR_STREAM_DESTROYED,T=d.ERR_STREAM_NULL_VALUES,E=d.ERR_STREAM_WRITE_AFTER_END,w=d.ERR_UNKNOWN_ENCODING,v=f.errorOrDestroy;function S(){}function I(e,t,o){n=n||r(753),e=e||{},"boolean"!=typeof o&&(o=t instanceof n),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=h(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,a=r.writecb;if("function"!=typeof a)throw new b;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,a){--t.pendingcb,r?(i.nextTick(a,n),i.nextTick(A,e,t),e._writableState.errorEmitted=!0,v(e,n)):(a(n),e._writableState.errorEmitted=!0,v(e,n),A(e,t))}(e,r,n,t,a);else{var o=B(r)||e.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||R(e,r),n?i.nextTick(k,e,r,o,a):k(e,r,o,a)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function C(e){var t=this instanceof(n=n||r(753));if(!t&&!o.call(C,this))return new C(e);this._writableState=new I(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),l.call(this)}function _(e,t,r,n,i,a,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new y("write")):r?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function k(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),A(e,t)}function R(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var s=0,l=!0;r;)i[s]=r,r.isBuf||(l=!1),r=r.next,s+=1;i.allBuffers=l,_(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new a(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,u=r.encoding,f=r.callback;if(_(e,t,!1,t.objectMode?1:c.length,c,u,f),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function B(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function D(e,t){e._final((function(r){t.pendingcb--,r&&v(e,r),t.prefinished=!0,e.emit("prefinish"),A(e,t)}))}function A(e,t){var r=B(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,i.nextTick(D,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}r(717)(C,l),I.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(I.prototype,"buffer",{get:s.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(o=Function.prototype[Symbol.hasInstance],Object.defineProperty(C,Symbol.hasInstance,{value:function(e){return!!o.call(this,e)||this===C&&e&&e._writableState instanceof I}})):o=function(e){return e instanceof this},C.prototype.pipe=function(){v(this,new m)},C.prototype.write=function(e,t,r){var n,a=this._writableState,o=!1,s=!a.objectMode&&(n=e,c.isBuffer(n)||n instanceof u);return s&&!c.isBuffer(e)&&(e=function(e){return c.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=S),a.ending?function(e,t){var r=new E;v(e,r),i.nextTick(t,r)}(this,r):(s||function(e,t,r,n){var a;return null===r?a=new T:"string"==typeof r||t.objectMode||(a=new g("chunk",["string","Buffer"],r)),!a||(v(e,a),i.nextTick(n,a),!1)}(this,a,e,r))&&(a.pendingcb++,o=function(e,t,r,n,i,a){if(!r){var o=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=c.from(t,r)),t}(t,n,i);n!==o&&(r=!0,i="buffer",n=o)}var s=t.objectMode?1:n.length;t.length+=s;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:a,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else _(e,t,!1,s,n,i,a);return l}(this,a,s,e,t,r)),o},C.prototype.cork=function(){this._writableState.corked++},C.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||R(this,e))},C.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new w(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(C.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(C.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),C.prototype._write=function(e,t,r){r(new p("_write()"))},C.prototype._writev=null,C.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,r){t.ending=!0,A(e,t),r&&(t.finished?i.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(C.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),C.prototype.destroy=f.destroy,C.prototype._undestroy=f.undestroy,C.prototype._destroy=function(e,t){t(e)}},850:(e,t,r)=>{"use strict";var n,i=r(155);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=r(610),s=Symbol("lastResolve"),l=Symbol("lastReject"),c=Symbol("error"),u=Symbol("ended"),f=Symbol("lastPromise"),h=Symbol("handlePromise"),d=Symbol("stream");function g(e,t){return{value:e,done:t}}function p(e){var t=e[s];if(null!==t){var r=e[d].read();null!==r&&(e[f]=null,e[s]=null,e[l]=null,t(g(r,!1)))}}function b(e){i.nextTick(p,e)}var m=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((a(n={get stream(){return this[d]},next:function(){var e=this,t=this[c];if(null!==t)return Promise.reject(t);if(this[u])return Promise.resolve(g(void 0,!0));if(this[d].destroyed)return new Promise((function(t,r){i.nextTick((function(){e[c]?r(e[c]):t(g(void 0,!0))}))}));var r,n=this[f];if(n)r=new Promise(function(e,t){return function(r,n){e.then((function(){t[u]?r(g(void 0,!0)):t[h](r,n)}),n)}}(n,this));else{var a=this[d].read();if(null!==a)return Promise.resolve(g(a,!1));r=new Promise(this[h])}return this[f]=r,r}},Symbol.asyncIterator,(function(){return this})),a(n,"return",(function(){var e=this;return new Promise((function(t,r){e[d].destroy(null,(function(e){e?r(e):t(g(void 0,!0))}))}))})),n),m);e.exports=function(e){var t,r=Object.create(y,(a(t={},d,{value:e,writable:!0}),a(t,s,{value:null,writable:!0}),a(t,l,{value:null,writable:!0}),a(t,c,{value:null,writable:!0}),a(t,u,{value:e._readableState.endEmitted,writable:!0}),a(t,h,{value:function(e,t){var n=r[d].read();n?(r[f]=null,r[s]=null,r[l]=null,e(g(n,!1))):(r[s]=e,r[l]=t)},writable:!0}),t));return r[f]=null,o(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[l];return null!==t&&(r[f]=null,r[s]=null,r[l]=null,t(e)),void(r[c]=e)}var n=r[s];null!==n&&(r[f]=null,r[s]=null,r[l]=null,n(g(void 0,!0))),r[u]=!0})),e.on("readable",b.bind(null,r)),r}},327:(e,t,r)=>{"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var o=r(764).Buffer,s=r(758).inspect,l=s&&s.custom||"inspect";e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r;return t=e,(r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?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,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,r,n,i=o.allocUnsafe(e>>>0),a=this.head,s=0;a;)t=a.data,r=i,n=s,o.prototype.copy.call(t,r,n),s+=a.data.length,a=a.next;return i}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,a=e>i.length?i.length:e;if(a===i.length?n+=i:n+=i.slice(0,e),0==(e-=a)){a===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(a));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,a=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,a),0==(e-=a)){a===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(a));break}++n}return this.length-=n,t}},{key:l,value:function(e,t){return s(this,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},t,{depth:0,customInspect:!1}))}}])&&a(t.prototype,r),e}()},195:(e,t,r)=>{"use strict";var n=r(155);function i(e,t){o(e,t),a(e)}function a(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function o(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,s=this._readableState&&this._readableState.destroyed,l=this._writableState&&this._writableState.destroyed;return s||l?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(o,this,e)):n.nextTick(o,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?n.nextTick(a,r):(r._writableState.errorEmitted=!0,n.nextTick(i,r,e)):n.nextTick(i,r,e):t?(n.nextTick(a,r),t(e)):n.nextTick(a,r)})),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 r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}},610:(e,t,r)=>{"use strict";var n=r(281).q.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,r,a){if("function"==typeof r)return e(t,null,r);r||(r={}),a=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(a||i);var o=r.readable||!1!==r.readable&&t.readable,s=r.writable||!1!==r.writable&&t.writable,l=function(){t.writable||u()},c=t._writableState&&t._writableState.finished,u=function(){s=!1,c=!0,o||a.call(t)},f=t._readableState&&t._readableState.endEmitted,h=function(){o=!1,f=!0,s||a.call(t)},d=function(e){a.call(t,e)},g=function(){var e;return o&&!f?(t._readableState&&t._readableState.ended||(e=new n),a.call(t,e)):s&&!c?(t._writableState&&t._writableState.ended||(e=new n),a.call(t,e)):void 0},p=function(){t.req.on("finish",u)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",u),t.on("abort",g),t.req?p():t.on("request",p)):s&&!t._writableState&&(t.on("end",l),t.on("close",l)),t.on("end",h),t.on("finish",u),!1!==r.error&&t.on("error",d),t.on("close",g),function(){t.removeListener("complete",u),t.removeListener("abort",g),t.removeListener("request",p),t.req&&t.req.removeListener("finish",u),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",u),t.removeListener("end",h),t.removeListener("error",d),t.removeListener("close",g)}}},167:e=>{e.exports=function(){throw new Error("Readable.from is not available in the browser")}},946:(e,t,r)=>{"use strict";var n,i=r(281).q,a=i.ERR_MISSING_ARGS,o=i.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function l(e,t,i,a){a=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(a);var s=!1;e.on("close",(function(){s=!0})),void 0===n&&(n=r(610)),n(e,{readable:t,writable:i},(function(e){if(e)return a(e);s=!0,a()}));var l=!1;return function(t){if(!s&&!l)return l=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void a(t||new o("pipe"))}}function c(e){e()}function u(e,t){return e.pipe(t)}function f(e){return e.length?"function"!=typeof e[e.length-1]?s:e.pop():s}e.exports=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n,i=f(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new a("streams");var o=t.map((function(e,r){var a=r<t.length-1;return l(e,a,r>0,(function(e){n||(n=e),e&&o.forEach(c),a||(o.forEach(c),i(n))}))}));return t.reduce(u)}},457:(e,t,r)=>{"use strict";var n=r(281).q.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,i){var a=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=a){if(!isFinite(a)||Math.floor(a)!==a||a<0)throw new n(i?r:"highWaterMark",a);return Math.floor(a)}return e.objectMode?16:16384}}},503:(e,t,r)=>{e.exports=r(187).EventEmitter},473:(e,t,r)=>{(t=e.exports=r(481)).Stream=t,t.Readable=t,t.Writable=r(229),t.Duplex=r(753),t.Transform=r(605),t.PassThrough=r(725),t.finished=r(610),t.pipeline=r(946)},509:(e,t,r)=>{var n=r(764),i=n.Buffer;function a(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(a(n,t),t.Buffer=o),o.prototype=Object.create(i.prototype),a(i,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},830:(e,t,r)=>{e.exports=i;var n=r(187).EventEmitter;function i(){n.call(this)}r(717)(i,n),i.Readable=r(481),i.Writable=r(229),i.Duplex=r(753),i.Transform=r(605),i.PassThrough=r(725),i.finished=r(610),i.pipeline=r(946),i.Stream=i,i.prototype.pipe=function(e,t){var r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function a(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",a),e._isStdio||t&&!1===t.end||(r.on("end",s),r.on("close",l));var o=!1;function s(){o||(o=!0,e.end())}function l(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function c(e){if(u(),0===n.listenerCount(this,"error"))throw e}function u(){r.removeListener("data",i),e.removeListener("drain",a),r.removeListener("end",s),r.removeListener("close",l),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",u),r.removeListener("close",u),e.removeListener("close",u)}return r.on("error",c),e.on("error",c),r.on("end",u),r.on("close",u),e.on("close",u),e.emit("pipe",r),e}},553:(e,t,r)=>{"use strict";var n=r(509).Buffer,i=n.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 a(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&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=c,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=u,this.end=f,t=3;break;default:return this.write=h,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function o(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,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"<22>";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"<22>";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"<22>"}}(this,e);return void 0!==r?r: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 l(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function u(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?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-r))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.s=a,a.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},a.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"<22>":t},a.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=o(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=o(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=o(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},a.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}},927:(e,t,r)=>{function n(e){try{if(!r.g.localStorage)return!1}catch(e){return!1}var t=r.g.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}e.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}},96:(e,t,r)=>{"use strict";r.r(t),r.d(t,{SubtitleParser:()=>c,SubtitleStream:()=>u});var n=r(277),i=r(473);const a=new Set(["ssa","ass"]),o=["readOrder","layer","style","name","marginL","marginR","marginV","effect","text"];function s(e,t){const r=e.Children.find((e=>e.id===t));return r?r.data:void 0}class l extends i.Transform{constructor(){super(),this.subtitleTracks=new Map,this.timecodeScale=1,this._currentClusterTimecode=null,this.decoder=new n.LE({bufferTagIds:[n.Av.TimecodeScale,n.Av.Tracks,n.Av.BlockGroup,n.Av.AttachedFile]}),this.decoder.on("data",this.parseEbmlSubtitles.bind(this))}parseEbmlSubtitles(e){if(e.id===n.Av.TimecodeScale&&(this.timecodeScale=e.data/1e6),e.id===n.Av.Timecode&&(this._currentClusterTimecode=e.data),e.id===n.Av.Tracks){for(const t of e.Children){if(17!==s(t,n.Av.TrackType))continue;const e=s(t,n.Av.CodecID)||"";if(e.startsWith("S_TEXT")){const r={number:s(t,n.Av.TrackNumber),language:s(t,n.Av.Language),type:e.substring(7).toLowerCase()},i=s(t,n.Av.Name);i&&(r.name=i);const o=s(t,n.Av.CodecPrivate);o&&a.has(r.type)&&(r.header=o),this.subtitleTracks.set(r.number,r)}}this.emit("tracks",Array.from(this.subtitleTracks.values()))}if(e.id===n.Av.BlockGroup){const t=e.Children.find((e=>e.id===n.Av.Block));if(this.subtitleTracks.has(t.track)){const r=s(e,n.Av.BlockDuration),i=this.subtitleTracks.get(t.track).type,l={text:t.payload.toString("utf8"),time:(t.value+this._currentClusterTimecode)*this.timecodeScale,duration:r*this.timecodeScale};if(a.has(i)){const e=l.text.split(",");for(let t="ssa"===i?2:1;t<8;t++)l[o[t]]=e[t];l.text=e.slice(8).join(",")}this.emit("subtitle",l,t.track)}}e.id===n.Av.AttachedFile&&this.emit("file",{filename:s(e,n.Av.FileName),mimetype:s(e,n.Av.FileMimeType),data:s(e,n.Av.FileData)})}}class c extends l{constructor(){super(),this.decoder.on("data",(e=>{e.id===n.Av.Tracks&&0===this.subtitleTracks.size&&this.end()}))}_write(e,t,r){this.decoder.write(e),r(null,e)}}class u extends l{constructor(e){super(),e instanceof u&&(e.once("drain",(()=>e.end())),this.subtitleTracks=e.subtitleTracks,this.timecodeScale=e.timecodeScale,this.unstable=!0)}_transform(e,t,r){if(this.unstable){for(let t=0;t<e.length-12;t++)if(31===e[t]&&67===e[t+1]&&182===e[t+2]&&117===e[t+3]&&231===e[t+4+(8-Math.floor(Math.log2(e[t+4])))]){this.unstable=!1,this.decoder.write(e.slice(t));break}}else this.decoder.write(e);r(null,e)}}},758:()=>{}},t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}return r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(96)})();