UNPKG

pdfmake

Version:

Client/server side PDF printing in pure JavaScript

2 lines 1.05 MB
/*! pdfmake v0.3.3, @license MIT, @link http://pdfmake.org */ !function webpackUniversalModuleDefinition(t,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var n=r();for(var i in n)("object"==typeof exports?exports:t)[i]=n[i]}}(Object("undefined"!=typeof self?self:this),()=>(()=>{var t={78(t){"use strict";t.exports=Function.prototype.call},182(t,r,n){"use strict";function ownKeys(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);r&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function _objectSpread(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(n),!0).forEach(function(r){_defineProperty(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _defineProperty(t,r,n){return(r=_toPropertyKey(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function _defineProperties(t,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,_toPropertyKey(i.key),i)}}function _toPropertyKey(t){var r=function _toPrimitive(t,r){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,r||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:String(r)}var i=n(783).Buffer,a=n(3779).inspect,o=a&&a.custom||"inspect";function copyBuffer(t,r,n){i.prototype.copy.call(t,r,n)}t.exports=function(){function BufferList(){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,BufferList),this.head=null,this.tail=null,this.length=0}return function _createClass(t,r,n){return r&&_defineProperties(t.prototype,r),n&&_defineProperties(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(BufferList,[{key:"push",value:function push(t){var r={data:t,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}},{key:"unshift",value:function unshift(t){var r={data:t,next:this.head};0===this.length&&(this.tail=r),this.head=r,++this.length}},{key:"shift",value:function shift(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function clear(){this.head=this.tail=null,this.length=0}},{key:"join",value:function join(t){if(0===this.length)return"";for(var r=this.head,n=""+r.data;r=r.next;)n+=t+r.data;return n}},{key:"concat",value:function concat(t){if(0===this.length)return i.alloc(0);for(var r=i.allocUnsafe(t>>>0),n=this.head,a=0;n;)copyBuffer(n.data,r,a),a+=n.data.length,n=n.next;return r}},{key:"consume",value:function consume(t,r){var n;return t<this.head.data.length?(n=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):n=t===this.head.data.length?this.shift():r?this._getString(t):this._getBuffer(t),n}},{key:"first",value:function first(){return this.head.data}},{key:"_getString",value:function _getString(t){var r=this.head,n=1,i=r.data;for(t-=i.length;r=r.next;){var a=r.data,o=t>a.length?a.length:t;if(o===a.length?i+=a:i+=a.slice(0,t),0===(t-=o)){o===a.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=a.slice(o));break}++n}return this.length-=n,i}},{key:"_getBuffer",value:function _getBuffer(t){var r=i.allocUnsafe(t),n=this.head,a=1;for(n.data.copy(r),t-=n.data.length;n=n.next;){var o=n.data,s=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,s),0===(t-=s)){s===o.length?(++a,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(s));break}++a}return this.length-=a,r}},{key:o,value:function value(t,r){return a(this,_objectSpread(_objectSpread({},r),{},{depth:0,customInspect:!1}))}}]),BufferList}()},290(t,r,n){"use strict";var i=n(8993),a=n(8681),o=n(3598),s=TypeError;t.exports=function(t,r){var n,l;if("string"===r&&a(n=t.toString)&&!o(l=i(n,t)))return l;if(a(n=t.valueOf)&&!o(l=i(n,t)))return l;if("string"!==r&&a(n=t.toString)&&!o(l=i(n,t)))return l;throw new s("Can't convert object to primitive value")}},299(t){"use strict";t.exports=function(t){try{return!!t()}catch(t){return!0}}},321(t,r,n){"use strict";var i;t.exports=(i=n(6861),function(t){var r=i,n=r.lib,a=n.WordArray,o=n.Hasher,s=r.algo,l=[],u=[];!function(){function isPrime(r){for(var n=t.sqrt(r),i=2;i<=n;i++)if(!(r%i))return!1;return!0}function getFractionalBits(t){return 4294967296*(t-(0|t))|0}for(var r=2,n=0;n<64;)isPrime(r)&&(n<8&&(l[n]=getFractionalBits(t.pow(r,.5))),u[n]=getFractionalBits(t.pow(r,1/3)),n++),r++}();var h=[],p=s.SHA256=o.extend({_doReset:function(){this._hash=new a.init(l.slice(0))},_doProcessBlock:function(t,r){for(var n=this._hash.words,i=n[0],a=n[1],o=n[2],s=n[3],l=n[4],p=n[5],g=n[6],m=n[7],y=0;y<64;y++){if(y<16)h[y]=0|t[r+y];else{var w=h[y-15],v=(w<<25|w>>>7)^(w<<14|w>>>18)^w>>>3,x=h[y-2],_=(x<<15|x>>>17)^(x<<13|x>>>19)^x>>>10;h[y]=v+h[y-7]+_+h[y-16]}var S=i&a^i&o^a&o,A=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),C=m+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&p^~l&g)+u[y]+h[y];m=g,g=p,p=l,l=s+C|0,s=o,o=a,a=i,i=C+(A+S)|0}n[0]=n[0]+i|0,n[1]=n[1]+a|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+l|0,n[5]=n[5]+p|0,n[6]=n[6]+g|0,n[7]=n[7]+m|0},_doFinalize:function(){var r=this._data,n=r.words,i=8*this._nDataBytes,a=8*r.sigBytes;return n[a>>>5]|=128<<24-a%32,n[14+(a+64>>>9<<4)]=t.floor(i/4294967296),n[15+(a+64>>>9<<4)]=i,r.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});r.SHA256=o._createHelper(p),r.HmacSHA256=o._createHmacHelper(p)}(Math),i.SHA256)},336(t,r,n){"use strict";var i=n(783).Buffer;const a=n(2416),o=n(6729);t.exports=class PNG{static decode(t,r){return a.readFile(t,function(t,n){return new PNG(n).decode(t=>r(t))})}static load(t){const r=a.readFileSync(t);return new PNG(r)}constructor(t){let r;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.text={};;){const t=this.readUInt32();let u="";for(r=0;r<4;r++)u+=String.fromCharCode(this.data[this.pos++]);switch(u){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"PLTE":this.palette=this.read(t);break;case"IDAT":for(r=0;r<t;r++)this.imgData.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:this.transparency.indexed=this.read(t);var n=255-this.transparency.indexed.length;if(n>0)for(r=0;r<n;r++)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(t)[0];break;case 2:this.transparency.rgb=this.read(t)}break;case"tEXt":var a=this.read(t),o=a.indexOf(0),s=String.fromCharCode.apply(String,a.slice(0,o));this.text[s]=String.fromCharCode.apply(String,a.slice(o+1));break;case"IEND":switch(this.colorType){case 0:case 3:case 4:this.colors=1;break;case 2:case 6:this.colors=3}this.hasAlphaChannel=[4,6].includes(this.colorType);var l=this.colors+(this.hasAlphaChannel?1:0);switch(this.pixelBitlength=this.bits*l,this.colors){case 1:this.colorSpace="DeviceGray";break;case 3:this.colorSpace="DeviceRGB"}return void(this.imgData=new i(this.imgData));default:this.pos+=t}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}read(t){const r=new Array(t);for(let n=0;n<t;n++)r[n]=this.data[this.pos++];return r}readUInt32(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]}readUInt16(){return this.data[this.pos++]<<8|this.data[this.pos++]}decodePixels(t){return o.inflate(this.imgData,(r,n)=>{if(r)throw r;const{width:a,height:o}=this,s=this.pixelBitlength/8,l=new i(a*o*s),{length:u}=n;let h=0;function pass(t,r,p,g,m){void 0===m&&(m=!1);const y=Math.ceil((a-t)/p),w=Math.ceil((o-r)/g),v=s*y,x=m?l:new i(v*w);let _=0,S=0;for(;_<w&&h<u;){var A,C,P,k,T;switch(n[h++]){case 0:for(P=0;P<v;P++)x[S++]=n[h++];break;case 1:for(P=0;P<v;P++)A=n[h++],k=P<s?0:x[S-s],x[S++]=(A+k)%256;break;case 2:for(P=0;P<v;P++)A=n[h++],C=(P-P%s)/s,T=_&&x[(_-1)*v+C*s+P%s],x[S++]=(T+A)%256;break;case 3:for(P=0;P<v;P++)A=n[h++],C=(P-P%s)/s,k=P<s?0:x[S-s],T=_&&x[(_-1)*v+C*s+P%s],x[S++]=(A+Math.floor((k+T)/2))%256;break;case 4:for(P=0;P<v;P++){var B,I;A=n[h++],C=(P-P%s)/s,k=P<s?0:x[S-s],0===_?T=I=0:(T=x[(_-1)*v+C*s+P%s],I=C&&x[(_-1)*v+(C-1)*s+P%s]);const t=k+T-I,r=Math.abs(t-k),i=Math.abs(t-T),a=Math.abs(t-I);B=r<=i&&r<=a?k:i<=a?T:I,x[S++]=(A+B)%256}break;default:throw new Error(`Invalid filter algorithm: ${n[h-1]}`)}if(!m){let n=((r+_*g)*a+t)*s,i=_*v;for(P=0;P<y;P++){for(let t=0;t<s;t++)l[n++]=x[i++];n+=(p-1)*s}}_++}}return 1===this.interlaceMethod?(pass(0,0,8,8),pass(4,0,8,8),pass(0,4,4,8),pass(2,0,4,4),pass(0,2,2,4),pass(1,0,2,2),pass(0,1,1,2)):pass(0,0,1,1,!0),t(l)})}decodePalette(){const{palette:t}=this,{length:r}=t,n=this.transparency.indexed||[],a=new i(n.length+r);let o=0,s=0;for(let i=0;i<r;i+=3){var l;a[o++]=t[i],a[o++]=t[i+1],a[o++]=t[i+2],a[o++]=null!=(l=n[s++])?l:255}return a}copyToImageData(t,r){let n,i,{colors:a}=this,o=null,s=this.hasAlphaChannel;this.palette.length&&(o=this._decodedPalette||(this._decodedPalette=this.decodePalette()),a=4,s=!0);const l=t.data||t,{length:u}=l,h=o||r;let p=n=0;if(1===a)for(;p<u;){i=o?4*r[p/4]:n;const t=h[i++];l[p++]=t,l[p++]=t,l[p++]=t,l[p++]=s?h[i++]:255,n=i}else for(;p<u;)i=o?4*r[p/4]:n,l[p++]=h[i++],l[p++]=h[i++],l[p++]=h[i++],l[p++]=s?h[i++]:255,n=i}decode(t){const r=new i(this.width*this.height*4);return this.decodePixels(n=>(this.copyToImageData(r,n),t(r)))}}},378(t){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},443(t,r,n){"use strict";var i=n(4494),a=n(3598),o=n(5034),s=n(7222);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,r=!1,n={};try{(t=i(Object.prototype,"__proto__","set"))(n,[]),r=n instanceof Array}catch(t){}return function setPrototypeOf(n,i){return o(n),s(i),a(n)?(r?t(n,i):n.__proto__=i,n):n}}():void 0)},453(t){"use strict";t.exports=function equal(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,i,a;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(i=n;0!==i--;)if(!equal(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(a=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=n;0!==i--;)if(!Object.prototype.hasOwnProperty.call(r,a[i]))return!1;for(i=n;0!==i--;){var o=a[i];if(!equal(t[o],r[o]))return!1}return!0}return t!=t&&r!=r}},477(){},517(t,r,n){"use strict";var i,a,o,s,l,u,h,p;t.exports=(p=n(6861),n(3144),n(8692),a=(i=p).x64,o=a.Word,s=a.WordArray,l=i.algo,u=l.SHA512,h=l.SHA384=u.extend({_doReset:function(){this._hash=new s.init([new o.init(3418070365,3238371032),new o.init(1654270250,914150663),new o.init(2438529370,812702999),new o.init(355462360,4144912697),new o.init(1731405415,4290775857),new o.init(2394180231,1750603025),new o.init(3675008525,1694076839),new o.init(1203062813,3204075428)])},_doFinalize:function(){var t=u._doFinalize.call(this);return t.sigBytes-=16,t}}),i.SHA384=u._createHelper(h),i.HmacSHA384=u._createHmacHelper(h),p.SHA384)},614(t,r,n){var i=n(4543);r.init=function(){r.dictionary=i.init()},r.offsetsByLength=new Uint32Array([0,0,0,0,0,4096,9216,21504,35840,44032,53248,63488,74752,87040,93696,100864,104704,106752,108928,113536,115968,118528,119872,121280,122016]),r.sizeBitsByLength=new Uint8Array([0,0,0,0,10,10,11,11,10,10,10,10,10,9,9,8,7,7,8,7,7,6,6,5,5]),r.minDictionaryWordLength=4,r.maxDictionaryWordLength=24},644(t,r,n){"use strict";var i=n(2740),a=Math.floor,sort=function(t,r){var n=t.length;if(n<8)for(var o,s,l=1;l<n;){for(s=l,o=t[l];s&&r(t[s-1],o)>0;)t[s]=t[--s];s!==l++&&(t[s]=o)}else for(var u=a(n/2),h=sort(i(t,0,u),r),p=sort(i(t,u),r),g=h.length,m=p.length,y=0,w=0;y<g||w<m;)t[y+w]=y<g&&w<m?r(h[y],p[w])<=0?h[y++]:p[w++]:y<g?h[y++]:p[w++];return t};t.exports=sort},713(t){"use strict";t.exports=Number.isNaN||function isNaN(t){return t!=t}},716(t){"use strict";t.exports=Math.abs},783(t,r,n){"use strict";n(8376),n(6401),n(2017);const i=n(2504),a=n(9029),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=Buffer,r.SlowBuffer=function SlowBuffer(t){+t!=t&&(t=0);return Buffer.alloc(+t)},r.INSPECT_MAX_BYTES=50;const s=2147483647;function createBuffer(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const r=new Uint8Array(t);return Object.setPrototypeOf(r,Buffer.prototype),r}function Buffer(t,r,n){if("number"==typeof t){if("string"==typeof r)throw new TypeError('The "string" argument must be of type string. Received type number');return allocUnsafe(t)}return from(t,r,n)}function from(t,r,n){if("string"==typeof t)return function fromString(t,r){"string"==typeof r&&""!==r||(r="utf8");if(!Buffer.isEncoding(r))throw new TypeError("Unknown encoding: "+r);const n=0|byteLength(t,r);let i=createBuffer(n);const a=i.write(t,r);a!==n&&(i=i.slice(0,a));return i}(t,r);if(ArrayBuffer.isView(t))return function fromArrayView(t){if(isInstance(t,Uint8Array)){const r=new Uint8Array(t);return fromArrayBuffer(r.buffer,r.byteOffset,r.byteLength)}return fromArrayLike(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(isInstance(t,ArrayBuffer)||t&&isInstance(t.buffer,ArrayBuffer))return fromArrayBuffer(t,r,n);if("undefined"!=typeof SharedArrayBuffer&&(isInstance(t,SharedArrayBuffer)||t&&isInstance(t.buffer,SharedArrayBuffer)))return fromArrayBuffer(t,r,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return Buffer.from(i,r,n);const a=function fromObject(t){if(Buffer.isBuffer(t)){const r=0|checked(t.length),n=createBuffer(r);return 0===n.length||t.copy(n,0,0,r),n}if(void 0!==t.length)return"number"!=typeof t.length||numberIsNaN(t.length)?createBuffer(0):fromArrayLike(t);if("Buffer"===t.type&&Array.isArray(t.data))return fromArrayLike(t.data)}(t);if(a)return a;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return Buffer.from(t[Symbol.toPrimitive]("string"),r,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function assertSize(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function allocUnsafe(t){return assertSize(t),createBuffer(t<0?0:0|checked(t))}function fromArrayLike(t){const r=t.length<0?0:0|checked(t.length),n=createBuffer(r);for(let i=0;i<r;i+=1)n[i]=255&t[i];return n}function fromArrayBuffer(t,r,n){if(r<0||t.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<r+(n||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),Object.setPrototypeOf(i,Buffer.prototype),i}function checked(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function byteLength(t,r){if(Buffer.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||isInstance(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;let a=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return utf8ToBytes(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return base64ToBytes(t).length;default:if(a)return i?-1:utf8ToBytes(t).length;r=(""+r).toLowerCase(),a=!0}}function slowToString(t,r,n){let i=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return hexSlice(this,r,n);case"utf8":case"utf-8":return utf8Slice(this,r,n);case"ascii":return asciiSlice(this,r,n);case"latin1":case"binary":return latin1Slice(this,r,n);case"base64":return base64Slice(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,r,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function swap(t,r,n){const i=t[r];t[r]=t[n],t[n]=i}function bidirectionalIndexOf(t,r,n,i,a){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),numberIsNaN(n=+n)&&(n=a?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(a)return-1;n=t.length-1}else if(n<0){if(!a)return-1;n=0}if("string"==typeof r&&(r=Buffer.from(r,i)),Buffer.isBuffer(r))return 0===r.length?-1:arrayIndexOf(t,r,n,i,a);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):arrayIndexOf(t,[r],n,i,a);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(t,r,n,i,a){let o,s=1,l=t.length,u=r.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||r.length<2)return-1;s=2,l/=2,u/=2,n/=2}function read(t,r){return 1===s?t[r]:t.readUInt16BE(r*s)}if(a){let i=-1;for(o=n;o<l;o++)if(read(t,o)===read(r,-1===i?0:o-i)){if(-1===i&&(i=o),o-i+1===u)return i*s}else-1!==i&&(o-=o-i),i=-1}else for(n+u>l&&(n=l-u),o=n;o>=0;o--){let n=!0;for(let i=0;i<u;i++)if(read(t,o+i)!==read(r,i)){n=!1;break}if(n)return o}return-1}function hexWrite(t,r,n,i){n=Number(n)||0;const a=t.length-n;i?(i=Number(i))>a&&(i=a):i=a;const o=r.length;let s;for(i>o/2&&(i=o/2),s=0;s<i;++s){const i=parseInt(r.substr(2*s,2),16);if(numberIsNaN(i))return s;t[n+s]=i}return s}function utf8Write(t,r,n,i){return blitBuffer(utf8ToBytes(r,t.length-n),t,n,i)}function asciiWrite(t,r,n,i){return blitBuffer(function asciiToBytes(t){const r=[];for(let n=0;n<t.length;++n)r.push(255&t.charCodeAt(n));return r}(r),t,n,i)}function base64Write(t,r,n,i){return blitBuffer(base64ToBytes(r),t,n,i)}function ucs2Write(t,r,n,i){return blitBuffer(function utf16leToBytes(t,r){let n,i,a;const o=[];for(let s=0;s<t.length&&!((r-=2)<0);++s)n=t.charCodeAt(s),i=n>>8,a=n%256,o.push(a),o.push(i);return o}(r,t.length-n),t,n,i)}function base64Slice(t,r,n){return 0===r&&n===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(r,n))}function utf8Slice(t,r,n){n=Math.min(t.length,n);const i=[];let a=r;for(;a<n;){const r=t[a];let o=null,s=r>239?4:r>223?3:r>191?2:1;if(a+s<=n){let n,i,l,u;switch(s){case 1:r<128&&(o=r);break;case 2:n=t[a+1],128==(192&n)&&(u=(31&r)<<6|63&n,u>127&&(o=u));break;case 3:n=t[a+1],i=t[a+2],128==(192&n)&&128==(192&i)&&(u=(15&r)<<12|(63&n)<<6|63&i,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[a+1],i=t[a+2],l=t[a+3],128==(192&n)&&128==(192&i)&&128==(192&l)&&(u=(15&r)<<18|(63&n)<<12|(63&i)<<6|63&l,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|1023&o),i.push(o),a+=s}return function decodeCodePointsArray(t){const r=t.length;if(r<=l)return String.fromCharCode.apply(String,t);let n="",i=0;for(;i<r;)n+=String.fromCharCode.apply(String,t.slice(i,i+=l));return n}(i)}r.kMaxLength=s,Buffer.TYPED_ARRAY_SUPPORT=function typedArraySupport(){try{const t=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(t,r),42===t.foo()}catch(t){return!1}}(),!Buffer.TYPED_ARRAY_SUPPORT&&"undefined"!=typeof console&&console.error,Object.defineProperty(Buffer.prototype,"parent",{enumerable:!0,get:function(){if(Buffer.isBuffer(this))return this.buffer}}),Object.defineProperty(Buffer.prototype,"offset",{enumerable:!0,get:function(){if(Buffer.isBuffer(this))return this.byteOffset}}),Buffer.poolSize=8192,Buffer.from=function(t,r,n){return from(t,r,n)},Object.setPrototypeOf(Buffer.prototype,Uint8Array.prototype),Object.setPrototypeOf(Buffer,Uint8Array),Buffer.alloc=function(t,r,n){return function alloc(t,r,n){return assertSize(t),t<=0?createBuffer(t):void 0!==r?"string"==typeof n?createBuffer(t).fill(r,n):createBuffer(t).fill(r):createBuffer(t)}(t,r,n)},Buffer.allocUnsafe=function(t){return allocUnsafe(t)},Buffer.allocUnsafeSlow=function(t){return allocUnsafe(t)},Buffer.isBuffer=function isBuffer(t){return null!=t&&!0===t._isBuffer&&t!==Buffer.prototype},Buffer.compare=function compare(t,r){if(isInstance(t,Uint8Array)&&(t=Buffer.from(t,t.offset,t.byteLength)),isInstance(r,Uint8Array)&&(r=Buffer.from(r,r.offset,r.byteLength)),!Buffer.isBuffer(t)||!Buffer.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let n=t.length,i=r.length;for(let a=0,o=Math.min(n,i);a<o;++a)if(t[a]!==r[a]){n=t[a],i=r[a];break}return n<i?-1:i<n?1:0},Buffer.isEncoding=function isEncoding(t){switch(String(t).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}},Buffer.concat=function concat(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Buffer.alloc(0);let n;if(void 0===r)for(r=0,n=0;n<t.length;++n)r+=t[n].length;const i=Buffer.allocUnsafe(r);let a=0;for(n=0;n<t.length;++n){let r=t[n];if(isInstance(r,Uint8Array))a+r.length>i.length?(Buffer.isBuffer(r)||(r=Buffer.from(r)),r.copy(i,a)):Uint8Array.prototype.set.call(i,r,a);else{if(!Buffer.isBuffer(r))throw new TypeError('"list" argument must be an Array of Buffers');r.copy(i,a)}a+=r.length}return i},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function swap16(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<t;r+=2)swap(this,r,r+1);return this},Buffer.prototype.swap32=function swap32(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)swap(this,r,r+3),swap(this,r+1,r+2);return this},Buffer.prototype.swap64=function swap64(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)swap(this,r,r+7),swap(this,r+1,r+6),swap(this,r+2,r+5),swap(this,r+3,r+4);return this},Buffer.prototype.toString=function toString(){const t=this.length;return 0===t?"":0===arguments.length?utf8Slice(this,0,t):slowToString.apply(this,arguments)},Buffer.prototype.toLocaleString=Buffer.prototype.toString,Buffer.prototype.equals=function equals(t){if(!Buffer.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Buffer.compare(this,t)},Buffer.prototype.inspect=function inspect(){let t="";const n=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},o&&(Buffer.prototype[o]=Buffer.prototype.inspect),Buffer.prototype.compare=function compare(t,r,n,i,a){if(isInstance(t,Uint8Array)&&(t=Buffer.from(t,t.offset,t.byteLength)),!Buffer.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===a&&(a=this.length),r<0||n>t.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&r>=n)return 0;if(i>=a)return-1;if(r>=n)return 1;if(this===t)return 0;let o=(a>>>=0)-(i>>>=0),s=(n>>>=0)-(r>>>=0);const l=Math.min(o,s),u=this.slice(i,a),h=t.slice(r,n);for(let t=0;t<l;++t)if(u[t]!==h[t]){o=u[t],s=h[t];break}return o<s?-1:s<o?1:0},Buffer.prototype.includes=function includes(t,r,n){return-1!==this.indexOf(t,r,n)},Buffer.prototype.indexOf=function indexOf(t,r,n){return bidirectionalIndexOf(this,t,r,n,!0)},Buffer.prototype.lastIndexOf=function lastIndexOf(t,r,n){return bidirectionalIndexOf(this,t,r,n,!1)},Buffer.prototype.write=function write(t,r,n,i){if(void 0===r)i="utf8",n=this.length,r=0;else if(void 0===n&&"string"==typeof r)i=r,n=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r>>>=0,isFinite(n)?(n>>>=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}const a=this.length-r;if((void 0===n||n>a)&&(n=a),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return hexWrite(this,t,r,n);case"utf8":case"utf-8":return utf8Write(this,t,r,n);case"ascii":case"latin1":case"binary":return asciiWrite(this,t,r,n);case"base64":return base64Write(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,t,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const l=4096;function asciiSlice(t,r,n){let i="";n=Math.min(t.length,n);for(let a=r;a<n;++a)i+=String.fromCharCode(127&t[a]);return i}function latin1Slice(t,r,n){let i="";n=Math.min(t.length,n);for(let a=r;a<n;++a)i+=String.fromCharCode(t[a]);return i}function hexSlice(t,r,n){const i=t.length;(!r||r<0)&&(r=0),(!n||n<0||n>i)&&(n=i);let a="";for(let i=r;i<n;++i)a+=p[t[i]];return a}function utf16leSlice(t,r,n){const i=t.slice(r,n);let a="";for(let t=0;t<i.length-1;t+=2)a+=String.fromCharCode(i[t]+256*i[t+1]);return a}function checkOffset(t,r,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>n)throw new RangeError("Trying to access beyond buffer length")}function checkInt(t,r,n,i,a,o){if(!Buffer.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>a||r<o)throw new RangeError('"value" argument is out of bounds');if(n+i>t.length)throw new RangeError("Index out of range")}function wrtBigUInt64LE(t,r,n,i,a){checkIntBI(r,i,a,t,n,7);let o=Number(r&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(r>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function wrtBigUInt64BE(t,r,n,i,a){checkIntBI(r,i,a,t,n,7);let o=Number(r&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(r>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function checkIEEE754(t,r,n,i,a,o){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function writeFloat(t,r,n,i,o){return r=+r,n>>>=0,o||checkIEEE754(t,0,n,4),a.write(t,r,n,i,23,4),n+4}function writeDouble(t,r,n,i,o){return r=+r,n>>>=0,o||checkIEEE754(t,0,n,8),a.write(t,r,n,i,52,8),n+8}Buffer.prototype.slice=function slice(t,r){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t);const i=this.subarray(t,r);return Object.setPrototypeOf(i,Buffer.prototype),i},Buffer.prototype.readUintLE=Buffer.prototype.readUIntLE=function readUIntLE(t,r,n){t>>>=0,r>>>=0,n||checkOffset(t,r,this.length);let i=this[t],a=1,o=0;for(;++o<r&&(a*=256);)i+=this[t+o]*a;return i},Buffer.prototype.readUintBE=Buffer.prototype.readUIntBE=function readUIntBE(t,r,n){t>>>=0,r>>>=0,n||checkOffset(t,r,this.length);let i=this[t+--r],a=1;for(;r>0&&(a*=256);)i+=this[t+--r]*a;return i},Buffer.prototype.readUint8=Buffer.prototype.readUInt8=function readUInt8(t,r){return t>>>=0,r||checkOffset(t,1,this.length),this[t]},Buffer.prototype.readUint16LE=Buffer.prototype.readUInt16LE=function readUInt16LE(t,r){return t>>>=0,r||checkOffset(t,2,this.length),this[t]|this[t+1]<<8},Buffer.prototype.readUint16BE=Buffer.prototype.readUInt16BE=function readUInt16BE(t,r){return t>>>=0,r||checkOffset(t,2,this.length),this[t]<<8|this[t+1]},Buffer.prototype.readUint32LE=Buffer.prototype.readUInt32LE=function readUInt32LE(t,r){return t>>>=0,r||checkOffset(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Buffer.prototype.readUint32BE=Buffer.prototype.readUInt32BE=function readUInt32BE(t,r){return t>>>=0,r||checkOffset(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Buffer.prototype.readBigUInt64LE=defineBigIntMethod(function readBigUInt64LE(t){validateNumber(t>>>=0,"offset");const r=this[t],n=this[t+7];void 0!==r&&void 0!==n||boundsError(t,this.length-8);const i=r+256*this[++t]+65536*this[++t]+this[++t]*2**24,a=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(i)+(BigInt(a)<<BigInt(32))}),Buffer.prototype.readBigUInt64BE=defineBigIntMethod(function readBigUInt64BE(t){validateNumber(t>>>=0,"offset");const r=this[t],n=this[t+7];void 0!==r&&void 0!==n||boundsError(t,this.length-8);const i=r*2**24+65536*this[++t]+256*this[++t]+this[++t],a=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(i)<<BigInt(32))+BigInt(a)}),Buffer.prototype.readIntLE=function readIntLE(t,r,n){t>>>=0,r>>>=0,n||checkOffset(t,r,this.length);let i=this[t],a=1,o=0;for(;++o<r&&(a*=256);)i+=this[t+o]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*r)),i},Buffer.prototype.readIntBE=function readIntBE(t,r,n){t>>>=0,r>>>=0,n||checkOffset(t,r,this.length);let i=r,a=1,o=this[t+--i];for(;i>0&&(a*=256);)o+=this[t+--i]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*r)),o},Buffer.prototype.readInt8=function readInt8(t,r){return t>>>=0,r||checkOffset(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Buffer.prototype.readInt16LE=function readInt16LE(t,r){t>>>=0,r||checkOffset(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},Buffer.prototype.readInt16BE=function readInt16BE(t,r){t>>>=0,r||checkOffset(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},Buffer.prototype.readInt32LE=function readInt32LE(t,r){return t>>>=0,r||checkOffset(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Buffer.prototype.readInt32BE=function readInt32BE(t,r){return t>>>=0,r||checkOffset(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Buffer.prototype.readBigInt64LE=defineBigIntMethod(function readBigInt64LE(t){validateNumber(t>>>=0,"offset");const r=this[t],n=this[t+7];void 0!==r&&void 0!==n||boundsError(t,this.length-8);const i=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+256*this[++t]+65536*this[++t]+this[++t]*2**24)}),Buffer.prototype.readBigInt64BE=defineBigIntMethod(function readBigInt64BE(t){validateNumber(t>>>=0,"offset");const r=this[t],n=this[t+7];void 0!==r&&void 0!==n||boundsError(t,this.length-8);const i=(r<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)}),Buffer.prototype.readFloatLE=function readFloatLE(t,r){return t>>>=0,r||checkOffset(t,4,this.length),a.read(this,t,!0,23,4)},Buffer.prototype.readFloatBE=function readFloatBE(t,r){return t>>>=0,r||checkOffset(t,4,this.length),a.read(this,t,!1,23,4)},Buffer.prototype.readDoubleLE=function readDoubleLE(t,r){return t>>>=0,r||checkOffset(t,8,this.length),a.read(this,t,!0,52,8)},Buffer.prototype.readDoubleBE=function readDoubleBE(t,r){return t>>>=0,r||checkOffset(t,8,this.length),a.read(this,t,!1,52,8)},Buffer.prototype.writeUintLE=Buffer.prototype.writeUIntLE=function writeUIntLE(t,r,n,i){if(t=+t,r>>>=0,n>>>=0,!i){checkInt(this,t,r,n,Math.pow(2,8*n)-1,0)}let a=1,o=0;for(this[r]=255&t;++o<n&&(a*=256);)this[r+o]=t/a&255;return r+n},Buffer.prototype.writeUintBE=Buffer.prototype.writeUIntBE=function writeUIntBE(t,r,n,i){if(t=+t,r>>>=0,n>>>=0,!i){checkInt(this,t,r,n,Math.pow(2,8*n)-1,0)}let a=n-1,o=1;for(this[r+a]=255&t;--a>=0&&(o*=256);)this[r+a]=t/o&255;return r+n},Buffer.prototype.writeUint8=Buffer.prototype.writeUInt8=function writeUInt8(t,r,n){return t=+t,r>>>=0,n||checkInt(this,t,r,1,255,0),this[r]=255&t,r+1},Buffer.prototype.writeUint16LE=Buffer.prototype.writeUInt16LE=function writeUInt16LE(t,r,n){return t=+t,r>>>=0,n||checkInt(this,t,r,2,65535,0),this[r]=255&t,this[r+1]=t>>>8,r+2},Buffer.prototype.writeUint16BE=Buffer.prototype.writeUInt16BE=function writeUInt16BE(t,r,n){return t=+t,r>>>=0,n||checkInt(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=255&t,r+2},Buffer.prototype.writeUint32LE=Buffer.prototype.writeUInt32LE=function writeUInt32LE(t,r,n){return t=+t,r>>>=0,n||checkInt(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t,r+4},Buffer.prototype.writeUint32BE=Buffer.prototype.writeUInt32BE=function writeUInt32BE(t,r,n){return t=+t,r>>>=0,n||checkInt(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t,r+4},Buffer.prototype.writeBigUInt64LE=defineBigIntMethod(function writeBigUInt64LE(t,r){return void 0===r&&(r=0),wrtBigUInt64LE(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))}),Buffer.prototype.writeBigUInt64BE=defineBigIntMethod(function writeBigUInt64BE(t,r){return void 0===r&&(r=0),wrtBigUInt64BE(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))}),Buffer.prototype.writeIntLE=function writeIntLE(t,r,n,i){if(t=+t,r>>>=0,!i){const i=Math.pow(2,8*n-1);checkInt(this,t,r,n,i-1,-i)}let a=0,o=1,s=0;for(this[r]=255&t;++a<n&&(o*=256);)t<0&&0===s&&0!==this[r+a-1]&&(s=1),this[r+a]=(t/o|0)-s&255;return r+n},Buffer.prototype.writeIntBE=function writeIntBE(t,r,n,i){if(t=+t,r>>>=0,!i){const i=Math.pow(2,8*n-1);checkInt(this,t,r,n,i-1,-i)}let a=n-1,o=1,s=0;for(this[r+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[r+a+1]&&(s=1),this[r+a]=(t/o|0)-s&255;return r+n},Buffer.prototype.writeInt8=function writeInt8(t,r,n){return t=+t,r>>>=0,n||checkInt(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=255&t,r+1},Buffer.prototype.writeInt16LE=function writeInt16LE(t,r,n){return t=+t,r>>>=0,n||checkInt(this,t,r,2,32767,-32768),this[r]=255&t,this[r+1]=t>>>8,r+2},Buffer.prototype.writeInt16BE=function writeInt16BE(t,r,n){return t=+t,r>>>=0,n||checkInt(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=255&t,r+2},Buffer.prototype.writeInt32LE=function writeInt32LE(t,r,n){return t=+t,r>>>=0,n||checkInt(this,t,r,4,2147483647,-2147483648),this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},Buffer.prototype.writeInt32BE=function writeInt32BE(t,r,n){return t=+t,r>>>=0,n||checkInt(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t,r+4},Buffer.prototype.writeBigInt64LE=defineBigIntMethod(function writeBigInt64LE(t,r){return void 0===r&&(r=0),wrtBigUInt64LE(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),Buffer.prototype.writeBigInt64BE=defineBigIntMethod(function writeBigInt64BE(t,r){return void 0===r&&(r=0),wrtBigUInt64BE(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),Buffer.prototype.writeFloatLE=function writeFloatLE(t,r,n){return writeFloat(this,t,r,!0,n)},Buffer.prototype.writeFloatBE=function writeFloatBE(t,r,n){return writeFloat(this,t,r,!1,n)},Buffer.prototype.writeDoubleLE=function writeDoubleLE(t,r,n){return writeDouble(this,t,r,!0,n)},Buffer.prototype.writeDoubleBE=function writeDoubleBE(t,r,n){return writeDouble(this,t,r,!1,n)},Buffer.prototype.copy=function copy(t,r,n,i){if(!Buffer.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r<i-n&&(i=t.length-r+n);const a=i-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),r),a},Buffer.prototype.fill=function fill(t,r,n,i){if("string"==typeof t){if("string"==typeof r?(i=r,r=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!Buffer.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){const r=t.charCodeAt(0);("utf8"===i&&r<128||"latin1"===i)&&(t=r)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;let a;if(r>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(a=r;a<n;++a)this[a]=t;else{const o=Buffer.isBuffer(t)?t:Buffer.from(t,i),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(a=0;a<n-r;++a)this[a+r]=o[a%s]}return this};const u={};function E(t,r,n){u[t]=class NodeError extends n{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function addNumericalSeparator(t){let r="",n=t.length;const i="-"===t[0]?1:0;for(;n>=i+4;n-=3)r=`_${t.slice(n-3,n)}${r}`;return`${t.slice(0,n)}${r}`}function checkIntBI(t,r,n,i,a,o){if(t>n||t<r){const i="bigint"==typeof r?"n":"";let a;throw a=o>3?0===r||r===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(o+1)}${i}`:`>= -(2${i} ** ${8*(o+1)-1}${i}) and < 2 ** ${8*(o+1)-1}${i}`:`>= ${r}${i} and <= ${n}${i}`,new u.ERR_OUT_OF_RANGE("value",a,t)}!function checkBounds(t,r,n){validateNumber(r,"offset"),void 0!==t[r]&&void 0!==t[r+n]||boundsError(r,t.length-(n+1))}(i,a,o)}function validateNumber(t,r){if("number"!=typeof t)throw new u.ERR_INVALID_ARG_TYPE(r,"number",t)}function boundsError(t,r,n){if(Math.floor(t)!==t)throw validateNumber(t,n),new u.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(r<0)throw new u.ERR_BUFFER_OUT_OF_BOUNDS;throw new u.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${r}`,t)}E("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),E("ERR_INVALID_ARG_TYPE",function(t,r){return`The "${t}" argument must be of type number. Received type ${typeof r}`},TypeError),E("ERR_OUT_OF_RANGE",function(t,r,n){let i=`The value of "${t}" is out of range.`,a=n;return Number.isInteger(n)&&Math.abs(n)>2**32?a=addNumericalSeparator(String(n)):"bigint"==typeof n&&(a=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(a=addNumericalSeparator(a)),a+="n"),i+=` It must be ${r}. Received ${a}`,i},RangeError);const h=/[^+/0-9A-Za-z-_]/g;function utf8ToBytes(t,r){let n;r=r||1/0;const i=t.length;let a=null;const o=[];for(let s=0;s<i;++s){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!a){if(n>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(r-=3)>-1&&o.push(239,191,189);continue}a=n;continue}if(n<56320){(r-=3)>-1&&o.push(239,191,189),a=n;continue}n=65536+(a-55296<<10|n-56320)}else a&&(r-=3)>-1&&o.push(239,191,189);if(a=null,n<128){if((r-=1)<0)break;o.push(n)}else if(n<2048){if((r-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((r-=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((r-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function base64ToBytes(t){return i.toByteArray(function base64clean(t){if((t=(t=t.split("=")[0]).trim().replace(h,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function blitBuffer(t,r,n,i){let a;for(a=0;a<i&&!(a+n>=r.length||a>=t.length);++a)r[a+n]=t[a];return a}function isInstance(t,r){return t instanceof r||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===r.name}function numberIsNaN(t){return t!=t}const p=function(){const t="0123456789abcdef",r=new Array(256);for(let n=0;n<16;++n){const i=16*n;for(let a=0;a<16;++a)r[i+a]=t[n]+t[a]}return r}();function defineBigIntMethod(t){return"undefined"==typeof BigInt?BufferBigIntNotDefined:t}function BufferBigIntNotDefined(){throw new Error("BigInt not supported")}},821(t,r,n){"use strict";var i=n(884),a="undefined"==typeof globalThis?n.g:globalThis;t.exports=function availableTypedArrays(){for(var t=[],r=0;r<i.length;r++)"function"==typeof a[i[r]]&&(t[t.length]=i[r]);return t}},884(t){"use strict";t.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},890(t,r,n){"use strict";var i=n(6341),a=n(8468),o=n(5888),s=n(3793),l=o.data,u=o.normalize,h="USE_FUNCTION_CONSTRUCTOR",p="AsyncIteratorPrototype",setAggressivenessLevel=function(t,r){if(a(t))for(var n=0;n<t.length;n++)l[u(t[n])]=r};t.exports=function(t){"object"==typeof t&&(setAggressivenessLevel(t.useNative,o.NATIVE),setAggressivenessLevel(t.usePolyfill,o.POLYFILL),setAggressivenessLevel(t.useFeatureDetection,null),i(t,h)&&(s[h]=!!t[h]),i(t,p)&&(s[p]=t[p]))}},980(t,r,n){var i=n(8197).z,a=n(8197).y,o=n(4097),s=n(614),l=n(1561).z,u=n(1561).u,h=n(7043),p=n(2210),g=n(7984),m=1080,y=new Uint8Array([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),w=new Uint8Array([3,2,1,0,3,3,3,3,3,3,2,2,2,2,2,2]),v=new Int8Array([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),x=new Uint16Array([256,402,436,468,500,534,566,598,630,662,694,726,758,790,822,854,886,920,952,984,1016,1048,1080]);function DecodeWindowBits(t){var r;return 0===t.readBits(1)?16:(r=t.readBits(3))>0?17+r:(r=t.readBits(3))>0?8+r:17}function DecodeVarLenUint8(t){if(t.readBits(1)){var r=t.readBits(3);return 0===r?1:t.readBits(r)+(1<<r)}return 0}function MetaBlockLength(){this.meta_block_length=0,this.input_end=0,this.is_uncompressed=0,this.is_metadata=!1}function DecodeMetaBlockLength(t){var r,n,i,a=new MetaBlockLength;if(a.input_end=t.readBits(1),a.input_end&&t.readBits(1))return a;if(7===(r=t.readBits(2)+4)){if(a.is_metadata=!0,0!==t.readBits(1))throw new Error("Invalid reserved bit");if(0===(n=t.readBits(2)))return a;for(i=0;i<n;i++){var o=t.readBits(8);if(i+1===n&&n>1&&0===o)throw new Error("Invalid size byte");a.meta_block_length|=o<<8*i}}else for(i=0;i<r;++i){var s=t.readBits(4);if(i+1===r&&r>4&&0===s)throw new Error("Invalid size nibble");a.meta_block_length|=s<<4*i}return++a.meta_block_length,a.input_end||a.is_metadata||(a.is_uncompressed=t.readBits(1)),a}function ReadSymbol(t,r,n){var i;return n.fillBitWindow(),(i=t[r+=n.val_>>>n.bit_pos_&255].bits-8)>0&&(n.bit_pos_+=8,r+=t[r].value,r+=n.val_>>>n.bit_pos_&(1<<i)-1),n.bit_pos_+=t[r].bits,t[r].value}function ReadHuffmanCode(t,r,n,i){var a,o,s=new Uint8Array(t);if(i.readMoreInput(),1===(o=i.readBits(2))){for(var h=t-1,p=0,g=new Int32Array(4),m=i.readBits(2)+1;h;)h>>=1,++p;for(w=0;w<m;++w)g[w]=i.readBits(p)%t,s[g[w]]=2;switch(s[g[0]]=1,m){case 1:break;case 3:if(g[0]===g[1]||g[0]===g[2]||g[1]===g[2])throw new Error("[ReadHuffmanCode] invalid symbols");break;case 2:if(g[0]===g[1])throw new Error("[ReadHuffmanCode] invalid symbols");s[g[1]]=1;break;case 4:if(g[0]===g[1]||g[0]===g[2]||g[0]===g[3]||g[1]===g[2]||g[1]===g[3]||g[2]===g[3])throw new Error("[ReadHuffmanCode] invalid symbols");i.readBits(1)?(s[g[2]]=3,s[g[3]]=3):s[g[0]]=2}}else{var w,v=new Uint8Array(18),x=32,_=0,S=[new l(2,0),new l(2,4),new l(2,3),new l(3,2),new l(2,0),new l(2,4),new l(2,3),new l(4,1),new l(2,0),new l(2,4),new l(2,3),new l(3,2),new l(2,0),new l(2,4),new l(2,3),new l(4,5)];for(w=o;w<18&&x>0;++w){var A,C=y[w],P=0;i.fillBitWindow(),P+=i.val_>>>i.bit_pos_&15,i.bit_pos_+=S[P].bits,A=S[P].value,v[C]=A,0!==A&&(x-=32>>A,++_)}if(1!==_&&0!==x)throw new Error("[ReadHuffmanCode] invalid num_codes or space");!function ReadHuffmanCodeLengths(t,r,n,i){for(var a=0,o=8,s=0,h=0,p=32768,g=[],m=0;m<32;m++)g.push(new l(0,0));for(u(g,0,5,t,18);a<r&&p>0;){var y,w=0;if(i.readMoreInput(),i.fillBitWindow(),w+=i.val_>>>i.bit_pos_&31,i.bit_pos_+=g[w].bits,(y=255&g[w].value)<16)s=0,n[a++]=y,0!==y&&(o=y,p-=32768>>y);else{var v,x,_=y-14,S=0;if(16===y&&(S=o),h!==S&&(s=0,h=S),v=s,s>0&&(s-=2,s<<=_),a+(x=(s+=i.readBits(_)+3)-v)>r)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(var A=0;A<x;A++)n[a+A]=h;a+=x,0!==h&&(p-=x<<15-h)}}if(0!==p)throw new Error("[ReadHuffmanCodeLengths] space = "+p);for(;a<r;a++)n[a]=0}(v,t,s,i)}if(0===(a=u(r,n,8,s,t)))throw new Error("[ReadHuffmanCode] BuildHuffmanTable failed: ");return a}function ReadBlockLength(t,r,n){var i,a;return i=ReadSymbol(t,r,n),a=p.kBlockLengthPrefixCode[i].nbits,p.kBlockLengthPrefixCode[i].offset+n.readBits(a)}function TranslateShortCodes(t,r,n){var i;return t<16?(n+=w[t],i=r[n&=3]+v[t]):i=t-16+1,i}function MoveToFront(t,r){for(var n=t[r],i=r;i;--i)t[i]=t[i-1];t[0]=n}function HuffmanTreeGroup(t,r){this.alphabet_size=t,this.num_htrees=r,this.codes=new Array(r+r*x[t+31>>>5]),this.htrees=new Uint32Array(r)}function DecodeContextMap(t,r){var n,i,a={num_htrees:null,context_map:null},o=0;r.readMoreInput();var s=a.num_htrees=DecodeVarLenUint8(r)+1,u=a.context_map=new Uint8Array(t);if(s<=1)return a;for(r.readBits(1)&&(o=r.readBits(4)+1),n=[],i=0;i<m;i++)n[i]=new l(0,0);for(ReadHuffmanCode(s+o,n,0,r),i=0;i<t;){var h;if(r.readMoreInput(),0===(h=ReadSymbol(n,0,r)))u[i]=0,++i;else if(h<=o)for(var p=1+(1<<h)+r.readBits(h);--p;){if(i>=t)throw new Error("[DecodeContextMap] i >= context_map_size");u[i]=0,++i}else u[i]=h-o,++i}return r.readBits(1)&&function InverseMoveToFrontTransform(t,r){var n,i=new Uint8Array(256);for(n=0;n<256;++n)i[n]=n;for(n=0;n<r;++n){var a=t[n];t[n]=i[a],a&&MoveToFront(i,a)}}(u,t),a}function DecodeBlockType(t,r,n,i,a,o,s){var l,u=2*n,h=n,p=ReadSymbol(r,n*m,s);(l=0===p?a[u+(1&o[h])]:1===p?a[u+(o[h]-1&1)]+1:p-2)>=t&&(l-=t),i[n]=l,a[u+(1&o[h])]=l,++o[h]}function CopyUncompressedBlockToOutput(t,r,n,i,a,s){var l,u=a+1,h=n&a,p=s.pos_&o.IBUF_MASK;if(r<8||s.bit_pos_+(r<<3)<s.bit_end_pos_)for(;r-- >0;)s.readMoreInput(),i[h++]=s.readBits(8),h===u&&(t.write(i,u),h=0);else{if(s.bit_end_pos_<32)throw new Error("[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32");for(;s.bit_pos_<32;)i[h]=s.val_>>>s.bit_pos_,s.bit_pos_+=8,++h,--r;if(p+(l=s.bit_end_pos_-s.bit_pos_>>3)>o.IBUF_MASK){for(var g=o.IBUF_MASK+1-p,m=0;m<g;m++)i[h+m]=s.buf_[p+m];l-=g,h+=g,r-=g,p=0}for(m=0;m<l;m++)i[h+m]=s.buf_[p+m];if(r-=l,(h+=l)>=u){t.write(i,u),h-=u;for(m=0;m<h;m++)i[m]=i[u+m]}for(;h+r>=u;){if(l=u-h,s.input_.read(i,h,l)<l)throw new Error("[CopyUncompressedBlockToOutput] not enough bytes");t.write(i,u),r-=l,h=0}if(s.input_.read(i,h,r)<r)throw new Error("[CopyUncompressedBlockToOutput] not enough bytes");s.reset()}}function JumpToByteBoundary(t){var r=t.bit_pos_+7&-8;return 0==t.readBits(r-t.bit_pos_)}function BrotliDecompressedSize(t){var r=new i(t),n=new o(r);return DecodeWindowBits(n),DecodeMetaBlockLength(n).meta_block_length}function BrotliDecompress(t,r){var n,i,a,u,y,w,v,x,_,S,A=0,C=0,P=0,k=[16,15,11,4],T=0,B=0,I=0,O=[new HuffmanTreeGroup(0,0),new HuffmanTreeGroup(0,0),new HuffmanTreeGroup(0,0)],R=128+o.READ_SIZE;a=(1<<(i=DecodeWindowBits(S=new o(t))))-16,y=(u=1<<i)-1,w=new Uint8Array(u+R+s.maxDictionaryWordLength),v=u,x=[],_=[];for(var D=0;D<3240;D++)x[D]=new l(0,0),_[D]=new l(0,0);for(;!C;){var L,M,N,$,z,W,U,j,V,G,H,q=0,X=[1<<28,1<<28,1<<28],Z=[0],Y=[1,1,1],K=[0,1,0,1,0,1],J=[0],Q=null,ee=null,te=0,re=null,ne=0,ie=0,ae=0;for(n=0;n<3;++n)O[n].codes=null,O[n].htrees=null;S.readMoreInput();var oe=DecodeMetaBlockLength(S);if(A+(q=oe.meta_block_length)>r.buffer.length){var se=new Uint8Array(A+q);se.set(r.buffer),r.buffer=se}if(C=oe.input_end,L=oe.is_uncompressed,oe.is_metadata)for(JumpToByteBoundary(S);q>0;--q)S.readMoreInput(),S.readBits(8);else if(0!==q)if(L)S.bit_pos_=S.bit_pos_+7&-8,CopyUncompressedBlockToOutput(r,q,A,w,y,S),A+=q;else{for(n=0;n<3;++n)Y[n]=DecodeVarLenUint8(S)+1,Y[n]>=2&&(ReadHuffmanCode(Y[n]+2,x,n*m,S),ReadHuffmanCode(26,_,n*m,S),X[n]=ReadBlockLength(_,n*m,S),J[n]=1);for(S.readMoreInput(),$=(1<<(M=S.readBits(2)))-1,z=(N=16+(S.readBits(4)<<M))+(48<<M),Q=new Uint8Array(Y[0]),n=0;n<Y[0];++n)S.readMoreInput(),Q[n]=S.readBits(2)<<1;var le=DecodeContextMap(Y[0]<<6,S);U=le.num_htrees,W=le.context_map;var ce=DecodeContextMap(Y[2]<<2,S);for(V=ce.num_htrees,j=ce.context_map,O[0]=new HuffmanTreeGroup(256,U),O[1]=new HuffmanTreeGroup(704,Y[1]),O[2]=new HuffmanTreeGroup(z,V),n=0;n<3;++n)O[n].decode(S);for(ee=0,re=0,G=Q[Z[0]],ie=h.lookupOffsets[G],ae=h.lookupOffsets[G+1],H=O[1].htrees[0];q>0;){var ue,he,fe,de,pe,ge,be,me,ye,we,ve,xe;for(S.readMoreInput(),0===X[1]&&(DecodeBlockType(Y[1],x,1,Z,K,J,S),X[1]=ReadBlockLength(_,m,S),H=O[1].htrees[Z[1]]),--X[1],(he=(ue=ReadSymbol(O[1].codes,H,S))>>6)>=2?(he-=2,be=-1):be=0,fe=p.kInsertRangeLut[he]+(ue>>3&7),de=p.kCopyRangeLut[he]+(7&ue),pe=p.kInsertLengthPrefixCode[fe].offset+S.readBits(p.kInsertLengthPrefixCode[fe].nbits),ge=p.kCopyLengthPrefixCode[de].offset+S.readBits(p.kCopyLengthPrefixCode[de].nbits),B=w[A-1&y],I=w[A-2&y],ye=0;ye<pe;++ye)S.readMoreInput(),0===X[0]&&(DecodeBlockType(Y[0],x,0,Z,K,J,S),X[0]=ReadBlockLength(_,0,S),ee=Z[0]<<6,G=Q[Z[0]],ie=h.lookupOffsets[G],ae=h.lookupOffs