ebml
Version:
1 lines • 131 kB
JavaScript
var EBML=function(e){"use strict";var t="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o=!1;function a(){o=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,i=e.length;t<i;++t)n[t]=e[t],r[e.charCodeAt(t)]=t;r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63}function s(e,t,r){for(var i,o,a=[],s=t;s<r;s+=3)i=(e[s]<<16)+(e[s+1]<<8)+e[s+2],a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}function l(e){var t;o||a();for(var r=e.length,i=r%3,l="",u=[],c=0,h=r-i;c<h;c+=16383)u.push(s(e,c,c+16383>h?h:c+16383));return 1===i?(t=e[r-1],l+=n[t>>2],l+=n[t<<4&63],l+="=="):2===i&&(t=(e[r-2]<<8)+e[r-1],l+=n[t>>10],l+=n[t>>4&63],l+=n[t<<2&63],l+="="),u.push(l),u.join("")}function u(e,t,n,r,i){var o,a,s=8*i-r-1,l=(1<<s)-1,u=l>>1,c=-7,h=n?i-1:0,f=n?-1:1,p=e[t+h];for(h+=f,o=p&(1<<-c)-1,p>>=-c,c+=s;c>0;o=256*o+e[t+h],h+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+h],h+=f,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),o-=u}return(p?-1:1)*a*Math.pow(2,o-r)}function c(e,t,n,r,i,o){var a,s,l,u=8*o-i-1,c=(1<<u)-1,h=c>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+h>=1?f/l:f*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(t*l-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[n+p]=255&s,p+=d,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;e[n+p]=255&a,p+=d,a/=256,u-=8);e[n+p-d]|=128*m}var h={}.toString,f=Array.isArray||function(e){return"[object Array]"==h.call(e)};function p(){return m.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function d(e,t){if(p()<t)throw new RangeError("Invalid typed array length");return m.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=m.prototype:(null===e&&(e=new m(t)),e.length=t),e}function m(e,t,n){if(!(m.TYPED_ARRAY_SUPPORT||this instanceof m))return new m(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return y(this,e)}return g(this,e,t,n)}function g(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);m.TYPED_ARRAY_SUPPORT?(e=t).__proto__=m.prototype:e=b(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!m.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|T(t,n),i=(e=d(e,r)).write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(k(t)){var n=0|w(t.length);return 0===(e=d(e,n)).length?e:(t.copy(e,0,0,n),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?d(e,0):b(e,t);if("Buffer"===t.type&&f(t.data))return b(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function v(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function y(e,t){if(v(t),e=d(e,t<0?0:0|w(t)),!m.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function b(e,t){var n=t.length<0?0:0|w(t.length);e=d(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function w(e){if(e>=p())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+p().toString(16)+" bytes");return 0|e}function k(e){return!(null==e||!e._isBuffer)}function T(e,t){if(k(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return X(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return K(e).length;default:if(r)return X(e).length;t=(""+t).toLowerCase(),r=!0}}function S(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function E(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=m.from(t,r)),k(t))return 0===t.length?-1:C(e,t,n,r,i);if("number"==typeof t)return t&=255,m.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):C(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function C(e,t,n,r,i){var o,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=n;o<s;o++)if(u(e,o)===u(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===l)return c*a}else-1!==c&&(o-=o-c),c=-1}else for(n+l>s&&(n=s-l),o=n;o>=0;o--){for(var h=!0,f=0;f<l;f++)if(u(e,o+f)!==u(t,f)){h=!1;break}if(h)return o}return-1}function _(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[n+a]=s}return a}function A(e,t,n,r){return J(X(t,e.length-n),e,n,r)}function D(e,t,n,r){return J(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function R(e,t,n,r){return D(e,t,n,r)}function I(e,t,n,r){return J(K(t),e,n,r)}function x(e,t,n,r){return J(function(e,t){for(var n,r,i,o=[],a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function P(e,t,n){return 0===t&&n===e.length?l(e):l(e.slice(t,n))}function L(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,a,s,l,u=e[i],c=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=n)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(l=(15&u)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=h}return function(e){var t=e.length;if(t<=M)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=M));return n}(r)}m.TYPED_ARRAY_SUPPORT=void 0===t.TYPED_ARRAY_SUPPORT||t.TYPED_ARRAY_SUPPORT,m.poolSize=8192,m._augment=function(e){return e.__proto__=m.prototype,e},m.from=function(e,t,n){return g(null,e,t,n)},m.TYPED_ARRAY_SUPPORT&&(m.prototype.__proto__=Uint8Array.prototype,m.__proto__=Uint8Array),m.alloc=function(e,t,n){return function(e,t,n,r){return v(t),t<=0?d(e,t):void 0!==n?"string"==typeof r?d(e,t).fill(n,r):d(e,t).fill(n):d(e,t)}(null,e,t,n)},m.allocUnsafe=function(e){return y(null,e)},m.allocUnsafeSlow=function(e){return y(null,e)},m.isBuffer=$,m.compare=function(e,t){if(!k(e)||!k(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},m.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}},m.concat=function(e,t){if(!f(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return m.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=m.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!k(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},m.byteLength=T,m.prototype._isBuffer=!0,m.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)S(this,t,t+1);return this},m.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)S(this,t,t+3),S(this,t+1,t+2);return this},m.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)S(this,t,t+7),S(this,t+1,t+6),S(this,t+2,t+5),S(this,t+3,t+4);return this},m.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?L(this,0,e):function(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return U(this,t,n);case"utf8":case"utf-8":return L(this,t,n);case"ascii":return B(this,t,n);case"latin1":case"binary":return O(this,t,n);case"base64":return P(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},m.prototype.equals=function(e){if(!k(e))throw new TypeError("Argument must be a Buffer");return this===e||0===m.compare(this,e)},m.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},m.prototype.compare=function(e,t,n,r,i){if(!k(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),l=this.slice(r,i),u=e.slice(t,n),c=0;c<s;++c)if(l[c]!==u[c]){o=l[c],a=u[c];break}return o<a?-1:a<o?1:0},m.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},m.prototype.indexOf=function(e,t,n){return E(this,e,t,n,!0)},m.prototype.lastIndexOf=function(e,t,n){return E(this,e,t,n,!1)},m.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return _(this,e,t,n);case"utf8":case"utf-8":return A(this,e,t,n);case"ascii":return D(this,e,t,n);case"latin1":case"binary":return R(this,e,t,n);case"base64":return I(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},m.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var M=4096;function B(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function O(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function U(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=G(e[o]);return i}function j(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function F(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,i,o){if(!k(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function z(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function V(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function q(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Y(e,t,n,r,i){return i||q(e,0,n,4),c(e,t,n,r,23,4),n+4}function W(e,t,n,r,i){return i||q(e,0,n,8),c(e,t,n,r,52,8),n+8}m.prototype.slice=function(e,t){var n,r=this.length;if((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),m.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=m.prototype;else{var i=t-e;n=new m(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},m.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||F(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},m.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||F(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},m.prototype.readUInt8=function(e,t){return t||F(e,1,this.length),this[e]},m.prototype.readUInt16LE=function(e,t){return t||F(e,2,this.length),this[e]|this[e+1]<<8},m.prototype.readUInt16BE=function(e,t){return t||F(e,2,this.length),this[e]<<8|this[e+1]},m.prototype.readUInt32LE=function(e,t){return t||F(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},m.prototype.readUInt32BE=function(e,t){return t||F(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},m.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||F(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},m.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||F(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},m.prototype.readInt8=function(e,t){return t||F(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},m.prototype.readInt16LE=function(e,t){t||F(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},m.prototype.readInt16BE=function(e,t){t||F(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},m.prototype.readInt32LE=function(e,t){return t||F(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},m.prototype.readInt32BE=function(e,t){return t||F(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},m.prototype.readFloatLE=function(e,t){return t||F(e,4,this.length),u(this,e,!0,23,4)},m.prototype.readFloatBE=function(e,t){return t||F(e,4,this.length),u(this,e,!1,23,4)},m.prototype.readDoubleLE=function(e,t){return t||F(e,8,this.length),u(this,e,!0,52,8)},m.prototype.readDoubleBE=function(e,t){return t||F(e,8,this.length),u(this,e,!1,52,8)},m.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||N(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},m.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||N(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},m.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),m.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},m.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),m.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):z(this,e,t,!0),t+2},m.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),m.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):z(this,e,t,!1),t+2},m.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),m.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):V(this,e,t,!0),t+4},m.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),m.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):V(this,e,t,!1),t+4},m.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<n&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},m.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},m.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),m.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},m.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),m.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):z(this,e,t,!0),t+2},m.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),m.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):z(this,e,t,!1),t+2},m.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),m.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):V(this,e,t,!0),t+4},m.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),m.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):V(this,e,t,!1),t+4},m.prototype.writeFloatLE=function(e,t,n){return Y(this,e,t,!0,n)},m.prototype.writeFloatBE=function(e,t,n){return Y(this,e,t,!1,n)},m.prototype.writeDoubleLE=function(e,t,n){return W(this,e,t,!0,n)},m.prototype.writeDoubleBE=function(e,t,n){return W(this,e,t,!1,n)},m.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!m.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},m.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!m.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var a=k(e)?e:X(new m(e,r).toString()),s=a.length;for(o=0;o<n-t;++o)this[o+t]=a[o%s]}return this};var H=/[^+\/0-9A-Za-z-_]/g;function G(e){return e<16?"0"+e.toString(16):e.toString(16)}function X(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],a=0;a<r;++a){if((n=e.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function K(e){return function(e){var t,n,s,l,u,c;o||a();var h=e.length;if(h%4>0)throw new Error("Invalid string. Length must be a multiple of 4");u="="===e[h-2]?2:"="===e[h-1]?1:0,c=new i(3*h/4-u),s=u>0?h-4:h;var f=0;for(t=0,n=0;t<s;t+=4,n+=3)l=r[e.charCodeAt(t)]<<18|r[e.charCodeAt(t+1)]<<12|r[e.charCodeAt(t+2)]<<6|r[e.charCodeAt(t+3)],c[f++]=l>>16&255,c[f++]=l>>8&255,c[f++]=255&l;return 2===u?(l=r[e.charCodeAt(t)]<<2|r[e.charCodeAt(t+1)]>>4,c[f++]=255&l):1===u&&(l=r[e.charCodeAt(t)]<<10|r[e.charCodeAt(t+1)]<<4|r[e.charCodeAt(t+2)]>>2,c[f++]=l>>8&255,c[f++]=255&l),c}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(H,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function J(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function $(e){return null!=e&&(!!e._isBuffer||Z(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Z(e.slice(0,0))}(e))}function Z(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function Q(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ee(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function te(e,t,n){return t&&ee(e.prototype,t),n&&ee(e,n),e}function ne(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ne(e,t,n[t])})}return e}function ie(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ae(e,t)}function oe(e){return(oe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ae(e,t){return(ae=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function se(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function le(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ue(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?le(e):t}function ce(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function he(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var fe=function(e){return"object"==typeof e?null!==e:"function"==typeof e},pe=function(e){if(!fe(e))throw TypeError(e+" is not an object!");return e},de=function(e){try{return!!e()}catch(e){return!0}},me=!de(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a});function ge(e,t){return e(t={exports:{}},t.exports),t.exports}var ve=ge(function(e){var t=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)}),ye=ve.document,be=fe(ye)&&fe(ye.createElement),we=function(e){return be?ye.createElement(e):{}},ke=!me&&!de(function(){return 7!=Object.defineProperty(we("div"),"a",{get:function(){return 7}}).a}),Te=function(e,t){if(!fe(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!fe(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!fe(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!fe(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},Se=Object.defineProperty,Ee={f:me?Object.defineProperty:function(e,t,n){if(pe(e),t=Te(t,!0),pe(n),ke)try{return Se(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},Ce=Ee.f,_e=Function.prototype,Ae=/^\s*function ([^ (]*)/;"name"in _e||me&&Ce(_e,"name",{configurable:!0,get:function(){try{return(""+this).match(Ae)[1]}catch(e){return""}}});var De=ge(function(e){var t=e.exports={version:"2.5.7"};"number"==typeof __e&&(__e=t)}),Re=(De.version,function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}),Ie=me?function(e,t,n){return Ee.f(e,t,Re(1,n))}:function(e,t,n){return e[t]=n,e},xe={}.hasOwnProperty,Pe=function(e,t){return xe.call(e,t)},Le=0,Me=Math.random(),Be=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++Le+Me).toString(36))},Oe=ge(function(e){var t=Be("src"),n=Function.toString,r=(""+n).split("toString");De.inspectSource=function(e){return n.call(e)},(e.exports=function(e,n,i,o){var a="function"==typeof i;a&&(Pe(i,"name")||Ie(i,"name",n)),e[n]!==i&&(a&&(Pe(i,t)||Ie(i,t,e[n]?""+e[n]:r.join(String(n)))),e===ve?e[n]=i:o?e[n]?e[n]=i:Ie(e,n,i):(delete e[n],Ie(e,n,i)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[t]||n.call(this)})}),Ue=function(e,t,n){if(function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!")}(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},je=function(e,t,n){var r,i,o,a,s=e&je.F,l=e&je.G,u=e&je.S,c=e&je.P,h=e&je.B,f=l?ve:u?ve[t]||(ve[t]={}):(ve[t]||{}).prototype,p=l?De:De[t]||(De[t]={}),d=p.prototype||(p.prototype={});for(r in l&&(n=t),n)o=((i=!s&&f&&void 0!==f[r])?f:n)[r],a=h&&i?Ue(o,ve):c&&"function"==typeof o?Ue(Function.call,o):o,f&&Oe(f,r,o,e&je.U),p[r]!=o&&Ie(p,r,a),c&&d[r]!=o&&(d[r]=o)};ve.core=De,je.F=1,je.G=2,je.S=4,je.P=8,je.B=16,je.W=32,je.U=64,je.R=128;var Fe=je,Ne=Math.ceil,ze=Math.floor,Ve=function(e){return isNaN(e=+e)?0:(e>0?ze:Ne)(e)},qe=Math.min,Ye=function(e){return e>0?qe(Ve(e),9007199254740991):0},We=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},He=function(e,t,n,r){var i=String(We(e)),o=i.length,a=void 0===n?" ":String(n),s=Ye(t);if(s<=o||""==a)return i;var l=s-o,u=function(e){var t=String(We(this)),n="",r=Ve(e);if(r<0||r==1/0)throw RangeError("Count can't be negative");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n}.call(a,Math.ceil(l/a.length));return u.length>l&&(u=u.slice(0,l)),r?u+i:i+u},Ge=ve.navigator,Xe=Ge&&Ge.userAgent||"";Fe(Fe.P+Fe.F*/Version\/10\.\d+(\.\d+)? Safari\//.test(Xe),"String",{padStart:function(e){return He(this,e,arguments.length>1?arguments[1]:void 0,!0)}});var Ke,Je={}.toString,$e=function(e){return Je.call(e).slice(8,-1)},Ze={f:{}.propertyIsEnumerable},Qe=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==$e(e)?e.split(""):Object(e)},et=function(e){return Qe(We(e))},tt=Object.getOwnPropertyDescriptor,nt={f:me?tt:function(e,t){if(e=et(e),t=Te(t,!0),ke)try{return tt(e,t)}catch(e){}if(Pe(e,t))return Re(!Ze.f.call(e,t),e[t])}},rt=function(e,t){if(pe(e),!fe(t)&&null!==t)throw TypeError(t+": can't set as prototype!")},it={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,n){try{(n=Ue(Function.call,nt.f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,r){return rt(e,r),t?e.__proto__=r:n(e,r),e}}({},!1):void 0),check:rt}.set,ot=function(e,t,n){var r,i=t.constructor;return i!==n&&"function"==typeof i&&(r=i.prototype)!==n.prototype&&fe(r)&&it&&it(e,r),e},at=Math.max,st=Math.min,lt=ge(function(e){var t=ve["__core-js_shared__"]||(ve["__core-js_shared__"]={});(e.exports=function(e,n){return t[e]||(t[e]=void 0!==n?n:{})})("versions",[]).push({version:De.version,mode:"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})}),ut=lt("keys"),ct=function(e){return ut[e]||(ut[e]=Be(e))},ht=(Ke=!1,function(e,t,n){var r,i=et(e),o=Ye(i.length),a=function(e,t){return(e=Ve(e))<0?at(e+t,0):st(e,t)}(n,o);if(Ke&&t!=t){for(;o>a;)if((r=i[a++])!=r)return!0}else for(;o>a;a++)if((Ke||a in i)&&i[a]===t)return Ke||a||0;return!Ke&&-1}),ft=ct("IE_PROTO"),pt=function(e,t){var n,r=et(e),i=0,o=[];for(n in r)n!=ft&&Pe(r,n)&&o.push(n);for(;t.length>i;)Pe(r,n=t[i++])&&(~ht(o,n)||o.push(n));return o},dt="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),mt=dt.concat("length","prototype"),gt={f:Object.getOwnPropertyNames||function(e){return pt(e,mt)}},vt="\t\n\v\f\r \u2028\u2029\ufeff",yt="["+vt+"]",bt=RegExp("^"+yt+yt+"*"),wt=RegExp(yt+yt+"*$"),kt=function(e,t,n){var r={},i=de(function(){return!!vt[e]()||"
"!="
"[e]()}),o=r[e]=i?t(Tt):vt[e];n&&(r[n]=o),Fe(Fe.P+Fe.F*i,"String",r)},Tt=kt.trim=function(e,t){return e=String(We(e)),1&t&&(e=e.replace(bt,"")),2&t&&(e=e.replace(wt,"")),e},St=kt,Et=Object.keys||function(e){return pt(e,dt)},Ct=me?Object.defineProperties:function(e,t){pe(e);for(var n,r=Et(t),i=r.length,o=0;i>o;)Ee.f(e,n=r[o++],t[n]);return e},_t=ve.document,At=_t&&_t.documentElement,Dt=ct("IE_PROTO"),Rt=function(){},It=function(){var e,t=we("iframe"),n=dt.length;for(t.style.display="none",At.appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),It=e.F;n--;)delete It.prototype[dt[n]];return It()},xt=Object.create||function(e,t){var n;return null!==e?(Rt.prototype=pe(e),n=new Rt,Rt.prototype=null,n[Dt]=e):n=It(),void 0===t?n:Ct(n,t)},Pt=gt.f,Lt=nt.f,Mt=Ee.f,Bt=St.trim,Ot=ve.Number,Ut=Ot,jt=Ot.prototype,Ft="Number"==$e(xt(jt)),Nt="trim"in String.prototype,zt=function(e){var t=Te(e,!1);if("string"==typeof t&&t.length>2){var n,r,i,o=(t=Nt?t.trim():Bt(t,3)).charCodeAt(0);if(43===o||45===o){if(88===(n=t.charCodeAt(2))||120===n)return NaN}else if(48===o){switch(t.charCodeAt(1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+t}for(var a,s=t.slice(2),l=0,u=s.length;l<u;l++)if((a=s.charCodeAt(l))<48||a>i)return NaN;return parseInt(s,r)}}return+t};if(!Ot(" 0o1")||!Ot("0b1")||Ot("+0x1")){Ot=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof Ot&&(Ft?de(function(){jt.valueOf.call(n)}):"Number"!=$e(n))?ot(new Ut(zt(t)),n,Ot):zt(t)};for(var Vt,qt=me?Pt(Ut):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),Yt=0;qt.length>Yt;Yt++)Pe(Ut,Vt=qt[Yt])&&!Pe(Ot,Vt)&&Mt(Ot,Vt,Lt(Ut,Vt));Ot.prototype=jt,jt.constructor=Ot,Oe(ve,"Number",Ot)}var Wt=function(){var e=pe(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t};me&&"g"!=/./g.flags&&Ee.f(RegExp.prototype,"flags",{configurable:!0,get:Wt});var Ht=/./.toString,Gt=function(e){Oe(RegExp.prototype,"toString",e,!0)};de(function(){return"/a/b"!=Ht.call({source:"a",flags:"b"})})?Gt(function(){var e=pe(this);return"/".concat(e.source,"/","flags"in e?e.flags:!me&&e instanceof RegExp?Wt.call(e):void 0)}):"toString"!=Ht.name&&Gt(function(){return Ht.call(this)});var Xt=function(e){return Object(We(e))},Kt=function(e,t,n,r){try{return r?t(pe(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&pe(i.call(e)),t}},Jt={},$t=ge(function(e){var t=lt("wks"),n=ve.Symbol,r="function"==typeof n;(e.exports=function(e){return t[e]||(t[e]=r&&n[e]||(r?n:Be)("Symbol."+e))}).store=t}),Zt=$t("iterator"),Qt=Array.prototype,en=function(e){return void 0!==e&&(Jt.Array===e||Qt[Zt]===e)},tn=function(e,t,n){t in e?Ee.f(e,t,Re(0,n)):e[t]=n},nn=$t("toStringTag"),rn="Arguments"==$e(function(){return arguments}()),on=$t("iterator"),an=De.getIteratorMethod=function(e){if(null!=e)return e[on]||e["@@iterator"]||Jt[function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),nn))?n:rn?$e(t):"Object"==(r=$e(t))&&"function"==typeof t.callee?"Arguments":r}(e)]},sn=$t("iterator"),ln=!1;try{[7][sn]().return=function(){ln=!0}}catch(e){}var un=function(e,t){if(!t&&!ln)return!1;var n=!1;try{var r=[7],i=r[sn]();i.next=function(){return{done:n=!0}},r[sn]=function(){return i},e(r)}catch(e){}return n};Fe(Fe.S+Fe.F*!un(function(e){}),"Array",{from:function(e){var t,n,r,i,o=Xt(e),a="function"==typeof this?this:Array,s=arguments.length,l=s>1?arguments[1]:void 0,u=void 0!==l,c=0,h=an(o);if(u&&(l=Ue(l,s>2?arguments[2]:void 0,2)),null==h||a==Array&&en(h))for(n=new a(t=Ye(o.length));t>c;c++)tn(n,c,u?l(o[c],c):o[c]);else for(i=h.call(o),n=new a;!(r=i.next()).done;c++)tn(n,c,u?Kt(i,l,[r.value,c],!0):r.value);return n.length=c,n}}),Fe(Fe.S,"Math",{log2:function(e){return Math.log(e)/Math.LN2}});var cn=function(){function e(){Q(this,e)}return te(e,null,[{key:"readVint",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=8-Math.floor(Math.log2(t[n]));if(r>8){var i=e.readHexString(t,n,n+r);throw new Error("Unrepresentable length: ".concat(r," ").concat(i))}if(n+r>t.length)return null;for(var o=t[n]&(1<<8-r)-1,a=1;a<r;a+=1){if(7===a&&o>=Math.pow(2,8)&&t[n+7]>0)return{length:r,value:-1};o*=Math.pow(2,8),o+=t[n+a]}return{length:r,value:o}}},{key:"writeVint",value:function(e){if(e<0||e>Math.pow(2,53))throw new Error("Unrepresentable value: ".concat(e));var t=1;for(t=1;t<=8&&!(e<Math.pow(2,7*t)-1);t+=1);for(var n=m.alloc(t),r=e,i=1;i<=t;i+=1){var o=255&r;n[t-i]=o,r-=o,r/=Math.pow(2,8)}return n[0]|=1<<8-t,n}},{key:"concatenate",value:function(e,t){return e&&0!==e.byteLength?t&&0!==t.byteLength?m.from(he(e).concat(he(t))):e:t}},{key:"readHexString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.byteLength;return Array.from(e.slice(t,n)).map(function(e){return Number(e).toString(16)}).reduce(function(e,t){return"".concat(e).concat(t.padStart(2,"0"))},"")}},{key:"readUtf8",value:function(e){try{return m.from(e).toString("utf8")}catch(e){return null}}},{key:"readUnsigned",value:function(t){var n=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 1:return n.getUint8(0);case 2:return n.getUint16(0);case 4:return n.getUint32(0)}return t.byteLength<=6?t.reduce(function(e,t){return 256*e+t},0):e.readHexString(t,0,t.byteLength)}},{key:"readSigned",value:function(e){var 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}}},{key:"readFloat",value:function(e){var 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}}},{key:"readDataFromTag",value:function(t,n){var r,i=t.type,o=t.name,a=t.track,s=t.discardable||!1,l=t.keyframe||!1,u=null;switch(i){case"u":r=e.readUnsigned(n);break;case"f":r=e.readFloat(n);break;case"i":r=e.readSigned(n);break;case"s":r=String.fromCharCode.apply(String,he(n));break;case"8":r=e.readUtf8(n)}if("SimpleBlock"===o||"Block"===o){var c=0,h=e.readVint(n,c),f=h.length;c+=f,a=h.value,r=e.readSigned(n.subarray(c,c+2)),c+=2,"SimpleBlock"===o&&(l=Boolean(128&n[f+2]),s=Boolean(1&n[f+2])),c+=1,u=n.subarray(c)}return re({},t,{data:n,discardable:s,keyframe:l,payload:u,track:a,value:r})}}]),e}(),hn=$t("unscopables"),fn=Array.prototype;null==fn[hn]&&Ie(fn,hn,{});var pn=function(e){fn[hn][e]=!0},dn=function(e,t){return{value:t,done:!!e}},mn=Ee.f,gn=$t("toStringTag"),vn=function(e,t,n){e&&!Pe(e=n?e:e.prototype,gn)&&mn(e,gn,{configurable:!0,value:t})},yn={};Ie(yn,$t("iterator"),function(){return this});var bn=function(e,t,n){e.prototype=xt(yn,{next:Re(1,n)}),vn(e,t+" Iterator")},wn=ct("IE_PROTO"),kn=Object.prototype,Tn=Object.getPrototypeOf||function(e){return e=Xt(e),Pe(e,wn)?e[wn]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?kn:null},Sn=$t("iterator"),En=!([].keys&&"next"in[].keys()),Cn=function(){return this},_n=function(e,t,n,r,i,o,a){bn(n,t,r);var s,l,u,c=function(e){if(!En&&e in d)return d[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},h=t+" Iterator",f="values"==i,p=!1,d=e.prototype,m=d[Sn]||d["@@iterator"]||i&&d[i],g=m||c(i),v=i?f?c("entries"):g:void 0,y="Array"==t&&d.entries||m;if(y&&(u=Tn(y.call(new e)))!==Object.prototype&&u.next&&(vn(u,h,!0),"function"!=typeof u[Sn]&&Ie(u,Sn,Cn)),f&&m&&"values"!==m.name&&(p=!0,g=function(){return m.call(this)}),(En||p||!d[Sn])&&Ie(d,Sn,g),Jt[t]=g,Jt[h]=Cn,i)if(s={values:f?g:c("values"),keys:o?g:c("keys"),entries:v},a)for(l in s)l in d||Oe(d,l,s[l]);else Fe(Fe.P+Fe.F*(En||p),t,s);return s},An=_n(Array,"Array",function(e,t){this._t=et(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,dn(1)):dn(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])},"values");Jt.Arguments=Jt.Array,pn("keys"),pn("values"),pn("entries");for(var Dn=$t("iterator"),Rn=$t("toStringTag"),In=Jt.Array,xn={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},Pn=Et(xn),Ln=0;Ln<Pn.length;Ln++){var Mn,Bn=Pn[Ln],On=xn[Bn],Un=ve[Bn],jn=Un&&Un.prototype;if(jn&&(jn[Dn]||Ie(jn,Dn,In),jn[Rn]||Ie(jn,Rn,Bn),Jt[Bn]=In,On))for(Mn in An)jn[Mn]||Oe(jn,Mn,An[Mn],!0)}var Fn=function(e,t,n){for(var r in t)Oe(e,r,t[r],n);return e},Nn=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e},zn=ge(function(e){var t={},n={},r=e.exports=function(e,r,i,o,a){var s,l,u,c,h=a?function(){return e}:an(e),f=Ue(i,o,r?2:1),p=0;if("function"!=typeof h)throw TypeError(e+" is not iterable!");if(en(h)){for(s=Ye(e.length);s>p;p++)if((c=r?f(pe(l=e[p])[0],l[1]):f(e[p]))===t||c===n)return c}else for(u=h.call(e);!(l=u.next()).done;)if((c=Kt(u,f,l.value,r))===t||c===n)return c};r.BREAK=t,r.RETURN=n}),Vn=$t("species"),qn=ge(function(e){var t=Be("meta"),n=Ee.f,r=0,i=Object.isExtensible||function(){return!0},o=!de(function(){return i(Object.preventExtensions({}))}),a=function(e){n(e,t,{value:{i:"O"+ ++r,w:{}}})},s=e.exports={KEY:t,NEED:!1,fastKey:function(e,n){if(!fe(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Pe(e,t)){if(!i(e))return"F";if(!n)return"E";a(e)}return e[t].i},getWeak:function(e,n){if(!Pe(e,t)){if(!i(e))return!0;if(!n)return!1;a(e)}return e[t].w},onFreeze:function(e){return o&&s.NEED&&i(e)&&!Pe(e,t)&&a(e),e}}}),Yn=(qn.KEY,qn.NEED,qn.fastKey,qn.getWeak,qn.onFreeze,function(e,t){if(!fe(e)||e._t!==t)throw TypeError("Incompatible receiver, "+t+" required!");return e}),Wn=Ee.f,Hn=qn.fastKey,Gn=me?"_s":"size",Xn=function(e,t){var n,r=Hn(t);if("F"!==r)return e._i[r];for(n=e._f;n;n=n.n)if(n.k==t)return n},Kn={getConstructor:function(e,t,n,r){var i=e(function(e,o){Nn(e,i,t,"_i"),e._t=t,e._i=xt(null),e._f=void 0,e._l=void 0,e[Gn]=0,null!=o&&zn(o,n,e[r],e)});return Fn(i.prototype,{clear:function(){for(var e=Yn(this,t),n=e._i,r=e._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete n[r.i];e._f=e._l=void 0,e[Gn]=0},delete:function(e){var n=Yn(this,t),r=Xn(n,e);if(r){var i=r.n,o=r.p;delete n._i[r.i],r.r=!0,o&&(o.n=i),i&&(i.p=o),n._f==r&&(n._f=i),n._l==r&&(n._l=o),n[Gn]--}return!!r},forEach:function(e){Yn(this,t);for(var n,r=Ue(e,arguments.length>1?arguments[1]:void 0,3);n=n?n.n:this._f;)for(r(n.v,n.k,this);n&&n.r;)n=n.p},has:function(e){return!!Xn(Yn(this,t),e)}}),me&&Wn(i.prototype,"size",{get:function(){return Yn(this,t)[Gn]}}),i},def:function(e,t,n){var r,i,o=Xn(e,t);return o?o.v=n:(e._l=o={i:i=Hn(t,!0),k:t,v:n,p:r=e._l,n:void 0,r:!1},e._f||(e._f=o),r&&(r.n=o),e[Gn]++,"F"!==i&&(e._i[i]=o)),e},getEntry:Xn,setStrong:function(e,t,n){_n(e,t,function(e,n){this._t=Yn(e,t),this._k=n,this._l=void 0},function(){for(var e=this._k,t=this._l;t&&t.r;)t=t.p;return this._t&&(this._l=t=t?t.n:this._t._f)?dn(0,"keys"==e?t.k:"values"==e?t.v:[t.k,t.v]):(this._t=void 0,dn(1))},n?"entries":"values",!n,!0),function(e){var t=ve[e];me&&t&&!t[Vn]&&Ee.f(t,Vn,{configurable:!0,get:function(){return this}})}(t)}},Jn=(function(e,t,n,r,i,o){var a=ve[e],s=a,l=i?"set":"add",u=s&&s.prototype,c={},h=function(e){var t=u[e];Oe(u,e,"delete"==e?function(e){return!(o&&!fe(e))&&t.call(this,0===e?0:e)}:"has"==e?function(e){return!(o&&!fe(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return o&&!fe(e)?void 0:t.call(this,0===e?0:e)}:"add"==e?function(e){return t.call(this,0===e?0:e),this}:function(e,n){return t.call(this,0===e?0:e,n),this})};if("function"==typeof s&&(o||u.forEach&&!de(function(){(new s).entries().next()}))){var f=new s,p=f[l](o?{}:-0,1)!=f,d=de(function(){f.has(1)}),m=un(function(e){new s(e)}),g=!o&&de(function(){for(var e=new s,t=5;t--;)e[l](t,t);return!e.has(-0)});m||((s=t(function(t,n){Nn(t,s,e);var r=ot(new a,t,s);return null!=n&&zn(n,i,r[l],r),r})).prototype=u,u.constructor=s),(d||g)&&(h("delete"),h("has"),i&&h("get")),(g||p)&&h(l),o&&u.clear&&delete u.clear}else s=r.getConstructor(t,e,i,l),Fn(s.prototype,n),qn.NEED=!0;vn(s,e),c[e]=s,Fe(Fe.G+Fe.W+Fe.F*(s!=a),c),o||r.setStrong(s,e,i)}("Map",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{get:function(e){var t=Kn.getEntry(Yn(this,"Map"),e);return t&&t.v},set:function(e,t){return Kn.def(Yn(this,"Map"),0===e?0:e,t)}},Kn,!0),new Map([[128,{name:"ChapterDisplay",level:4,type:"m",multiple:!0,minver:1,webm:!0,description:"Contains all possible strings to use for the chapter display."}],[131,{name:"TrackType",level:3,type:"u",multiple:!1,mandatory:!0,minver:1,range:"1-254",description:"A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control).",webm:!1}],[133,{name:"ChapString",cppname:"ChapterString",level:5,type:"8",multiple:!1,mandatory:!0,minver:1,webm:!0,description:"Contains the string to use as the chapter atom."}],[134,{name:"CodecID",level:3,type:"s",mandatory:!0,minver:1,description:"An ID corresponding to the codec, see the codec page for more info.",multiple:!1,webm:!1}],[136,{name:"FlagDefault",cppname:"TrackFlagDefault",level:3,type:"u",mandatory:!0,minver:1,default:1,range:"0-1",description:"Set if that track (audio, video or subs) SHOULD be active if no language found matches the user preference. (1 bit)",multiple:!1,webm:!1}],[137,{name:"ChapterTrackNumber",level:5,type:"u",mandatory:!0,multiple:!0,minver:1,webm:!1,range:"not 0",description:"UID of the Track to apply this chapter too. In the absense of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absense of this element indicates that the Chapter should be applied to any currently used Tracks."}],[145,{name:"ChapterTimeStart",level:4,type:"u",mandatory:!0,minver:1,webm:!0,description:"Timestamp of the start of Chapter (not scaled).",multiple:!1}],[146,{name:"ChapterTimeEnd",level:4,type:"u",minver:1,webm:!1,description:"Timestamp of the end of Chapter (timestamp excluded, not scaled).",multiple:!1}],[150,{name:"CueRefTime",level:5,type:"u",mandatory:!0,minver:2,webm:!1,description:"Timestamp of the referenced Block.",multiple:!1}],[151,{name:"CueRefCluster",level:5,type:"u",mandatory:!0,webm:!1,description:"The Position of the Cluster containing the referenced Block.",minver:0,multiple:!1}],[152,{name:"ChapterFlagHidden",level:4,type:"u",mandatory:!0,minver:1,webm:!1,default:0,range:"0-1",description:"If a chapter is hidden (1), it should not be available to the user interface (but still to Control Tracks; see flag notes). (1 bit)",multiple:!1}],[16980,{name:"ContentCompAlgo",level:6,type:"u",mandatory:!0,minver:1,webm:!1,default:0,br:["","","",""],del:["1 - bzlib,","2 - lzo1x"],description:"The compression algorithm used. Algorithms that have been specified so far are: 0 - zlib, 3 - Header Stripping",multiple:!1}],[16981,{name:"ContentCompSettings",level:6,type:"b",minver:1,webm:!1,description:"Settings that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the bytes that were removed from the beggining of each frames of the track.",multiple:!1}],[17026,{name:"DocType",level:1,type:"s",mandatory:!0,default:"matroska",minver:1,description:"A string that describes the type of document that follows this EBML header. 'matroska' in our case or 'webm' for webm files.",multiple:!1,webm:!1}],[17029,{name:"DocTypeReadVersion",level:1,type:"u",mandatory:!0,default:1,minver:1,description:"The minimum DocType version an interpreter has to support to read this file.",multiple:!1,webm:!1}],[17030,{name:"EBMLVersion",level:1,type:"u",mandatory:!0,default:1,minver:1,description:"The version of EBML parser used to create the file.",multiple:!1,webm:!1}],[17031,{name:"DocTypeVersion",level:1,type:"u",mandatory:!0,default:1,minver:1,description:"The version of DocType interpreter used to create the file.",multiple:!1,webm:!1}],[17476,{name:"SegmentFamily",level:2,type:"b",multiple:!0,minver:1,webm:!1,bytesize:16,description:"A randomly generated unique ID that all segments related to each other must use (128 bits)."}],[17505,{name:"DateUTC",level:2,type:"d",minver:1,description:"Date of the origin of timestamp (value 0), i.e. production date.",multiple:!1,webm:!1}],[17540,{name:"TagDefault",level:4,type:"u",mandatory:!0,minver:1,webm:!1,default:1,range:"0-1",description:"Indication to know if this is the default/original language to use for the given tag. (1 bit)",multiple:!1}],[17541,{name:"TagBinary",level:4,type:"b",minver:1,webm:!1,description:"The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString.",multiple:!1}],[17543,{name:"TagString",level:4,type:"8",minver:1,webm:!1,description:"The value of the Tag.",multiple:!1}],[17545,{name:"Duration",level:2,type:"f",minver:1,range:"> 0",description:"Duration of the segment (based on TimecodeScale).",multiple:!1,webm:!1}],[17816,{name:"ChapterFlagEnabled",level:4,type:"u",mandatory:!0,minver:1,webm:!1,default:1,range:"0-1",description:"Specify wether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie should skip all the content between the TimeStart and TimeEnd of this chapter (see flag notes). (1 bit)",multiple:!1}],[18016,{name:"FileMimeType",level:3,type:"s",mandatory:!0,minver:1,webm:!1,description:"MIME type of the file.",multiple:!1}],[18017,{name:"FileUsedStartTime",level:3,type:"u",divx:!0,description:"DivX font extension",multiple:!1}],[18018,{name:"FileUsedEndTime",level:3,type:"u",divx:!0,multiple:!1,description:"DivX font extension"}],[18037,{name:"FileReferral",level:3,type:"b",webm:!1,description:"A binary value that a track/codec can refer to when the attachment is needed.",multiple:!1}],[20529,{name:"ContentEncodingOrder",level:5,type:"u",mandatory:!0,minver:1,webm:!1,default:0,multiple:!1,description:"Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder elements in the segment."}],[20530,{name:"ContentEncodingScope",level:5,type:"u",mandatory:!0,minver:1,webm:!1,default:1,range:"not 0",br:["","",""],description:"A bit field that describes which elements have been modified in this way. Values (big endian) can be OR'ed. Possible values: 1 - all frame contents, 2 - the track's private data, 4 - the next ContentEncoding (next ContentEncodingOrder. Either the data inside ContentCompression and/or ContentEncryption)",multiple:!1}],[20531,{name:"ContentEncodingType",level:5,type:"u",mandatory:!0,minver:1,webm:!1,default:0,br:["",""],description:"A value describing what kind of transformation has been done. Possible values: 0 - compression, 1 - encryption",multiple:!1}],[20532,{name:"ContentCompression",level:5,type:"m",minver:1,webm:!1,description:"Settings describing the compression used. Must be present if the value of ContentEncodingType is 0 and absent otherwise. Each block must be decompressable even if no previous block is available in order not to prevent seeking.",multiple:!1}],[20533,{name:"ContentEncryption",level:5,type:"m",minver:1,webm:!1,description:"Settings describing the encryption used. Must be present if t