diff --git a/dist/sw.js b/dist/sw.js index 52c5d770..56e7c6c4 100644 --- a/dist/sw.js +++ b/dist/sw.js @@ -6,7 +6,7 @@ * @author Feross Aboukhadijeh * @license MIT */ -var i=r(55),n=r(91),s=r(53);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t,e){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(i)return j(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return C(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return D(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function w(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function g(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=u.from(e,i)),u.isBuffer(e))return 0===e.length?-1:y(t,e,r,i,n);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,i,n){var s,a=1,o=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;a=2,o/=2,u/=2,r/=2}function h(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(n){var c=-1;for(s=r;so&&(r=o-u),s=r;s>=0;s--){for(var l=!0,d=0;dn&&(i=n):i=n;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var a=0;a>8,n=r%256,s.push(n),s.push(i);return s}(e,t.length-r),t,r,i)}function S(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function C(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:h>223?3:h>191?2:1;if(n+l<=r)switch(l){case 1:h<128&&(c=h);break;case 2:128==(192&(s=t[n+1]))&&(u=(31&h)<<6|63&s)>127&&(c=u);break;case 3:s=t[n+1],a=t[n+2],128==(192&s)&&128==(192&a)&&(u=(15&h)<<12|(63&s)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:s=t[n+1],a=t[n+2],o=t[n+3],128==(192&s)&&128==(192&a)&&128==(192&o)&&(u=(15&h)<<18|(63&s)<<12|(63&a)<<6|63&o)>65535&&u<1114112&&(c=u)}null===c?(c=65533,l=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|1023&c),i.push(c),n+=l}return function(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);var r="",i=0;for(;i0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},u.prototype.compare=function(t,e,r,i,n){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var s=(n>>>=0)-(i>>>=0),a=(r>>>=0)-(e>>>=0),o=Math.min(s,a),h=this.slice(i,n),c=t.slice(e,r),l=0;ln)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return E(this,t,e,r);case"base64":return x(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function k(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;ni)&&(r=i);for(var n="",s=e;sr)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,i,n,s){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function F(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,s=Math.min(t.length-r,2);n>>8*(i?n:1-n)}function B(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,s=Math.min(t.length-r,4);n>>8*(i?n:3-n)&255}function P(t,e,r,i,n,s){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(t,e,r,i,s){return s||P(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function U(t,e,r,i,s){return s||P(t,0,r,8),n.write(t,e,r,i,52,8),r+8}u.prototype.slice=function(t,e){var r,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(n*=256);)i+=this[t+--e]*n;return i},u.prototype.readUInt8=function(t,e){return e||I(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||I(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||I(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||I(t,e,this.length);for(var i=this[t],n=1,s=0;++s=(n*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||I(t,e,this.length);for(var i=e,n=1,s=this[t+--i];i>0&&(n*=256);)s+=this[t+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*e)),s},u.prototype.readInt8=function(t,e){return e||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||I(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||I(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||I(t,4,this.length),n.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||I(t,4,this.length),n.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||I(t,8,this.length),n.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||I(t,8,this.length),n.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||N(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,s=0;for(this[e]=255&t;++s=0&&(s*=256);)this[e+n]=t/s&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):B(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}var s=0,a=1,o=0;for(this[e]=255&t;++s>0)-o&255;return e+r},u.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}var s=r-1,a=1,o=0;for(this[e+s]=255&t;--s>=0&&(a*=256);)t<0&&0===o&&0!==this[e+s+1]&&(o=1),this[e+s]=(t/a>>0)-o&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):B(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,i){if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--n)t[n+e]=this[n+r];else if(s<1e3||!u.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=e;s55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(a+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function z(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}}).call(this,r(6))},function(t,e,r){t.exports=n;var i=r(36).EventEmitter;function n(){i.call(this)}r(9)(n,i),n.Readable=r(37),n.Writable=r(98),n.Duplex=r(99),n.Transform=r(100),n.PassThrough=r(101),n.Stream=n,n.prototype.pipe=function(t,e){var r=this;function n(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function s(){r.readable&&r.resume&&r.resume()}r.on("data",n),t.on("drain",s),t._isStdio||e&&!1===e.end||(r.on("end",o),r.on("close",u));var a=!1;function o(){a||(a=!0,t.end())}function u(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function h(t){if(c(),0===i.listenerCount(this,"error"))throw t}function c(){r.removeListener("data",n),t.removeListener("drain",s),r.removeListener("end",o),r.removeListener("close",u),r.removeListener("error",h),t.removeListener("error",h),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c)}return r.on("error",h),t.on("error",h),r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var i=r(1),n=r(0);const s=new TextDecoder("utf-8");class a{static fromResponse({url:t,response:e,date:r,noRW:n,isLive:s}){const o=e.body?new i.a(e.body.getReader(),!1):null,u=Number(e.headers.get("x-redirect-status")||e.status),h=e.statusText;let c=e.headers;const l=c.get("x-proxy-set-cookie");if(l){const t=[];l.split(",").forEach(e=>{const r=e.split(";",1)[0].trim();r.indexOf("=")>0&&t.push(r)}),t.length&&((c=new Headers(c)).set("x-wabac-preset-cookie",t.join(";")),console.log("cookies",t.join(";")))}return new a({payload:o,status:u,statusText:h,headers:c,url:t,date:r,noRW:n,isLive:s})}constructor({payload:t,status:e,statusText:r,headers:i,url:n,date:s,extraOpts:a=null,noRW:o=!1,isLive:u=!1}){this.reader=null,this.buffer=null,t&&t[Symbol.asyncIterator]?this.reader=t:this.buffer=t,this.status=e,this.statusText=r,this.headers=i,this.url=n,this.date=s,this.extraOpts=a,this.noRW=o,this.isLive=u}async getText(){const t=await this.getBuffer();return"string"==typeof t?t:s.decode(t)}async getBuffer(){return this.buffer?this.buffer:(this.buffer=await this.reader.readFully(),this.buffer)}async setContent(t){t instanceof i.b?(this.reader=t,this.buffer=null):t.getReader?(this.reader=new i.a(t.getReader()),this.buffer=null):(this.reader=null,this.buffer=t)}async*[Symbol.asyncIterator](){this.buffer?yield this.buffer:this.reader&&(yield*this.reader)}setRange(t){const e=t.match(/^bytes\=(\d+)\-(\d+)?$/);let r=0;if(this.buffer)r=this.buffer.length;else if(this.reader&&!(r=Number(this.headers.get("content-length"))))return;if(!e)return this.status=416,this.statusText="Range Not Satisfiable",this.headers.set("Content-Range",`*/${r}`),!1;const i=Number(e[1]),n=Number(e[2])||r-1;return this.buffer?this.buffer=this.buffer.slice(i,n+1):this.reader&&(0===i&&n===r-1||this.reader.setLimitSkip(n-i+1,i)),this.headers.set("Content-Range",`bytes ${i}-${n}/${r}`),this.headers.set("Content-Length",n-i+1),this.status=206,this.statusText="Partial Content",!0}makeResponse(){let t=null;Object(n.h)(this.status)||(t=this.buffer||!this.reader?this.buffer:this.reader.getReadableStream());const e=new Response(t,{status:this.status,statusText:this.statusText,headers:this.headers});return e.date=this.date,e}}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";const i=function(t,e){const r=e.exec(t);return!(null==r)};e.isExist=function(t){return void 0!==t},e.isEmptyObject=function(t){return 0===Object.keys(t).length},e.merge=function(t,e,r){if(e){const i=Object.keys(e),n=i.length;for(let s=0;s1)for(var r=1;rt.decode(e),e.utf8.checksUTF8=!0}else e.utf8=t=>t.toString("utf8"),e.utf8.checksUTF8=!1;e.parseCBORint=function(t,e){switch(t){case a.ONE:return e.readUInt8(0);case a.TWO:return e.readUInt16BE(0);case a.FOUR:return e.readUInt32BE(0);case a.EIGHT:const r=e.readUInt32BE(0),i=e.readUInt32BE(4);return r>2097151?new n(r).times(o).plus(i):r*o+i;default:throw new Error("Invalid additional info for int: "+t)}},e.writeHalf=function(e,r){const i=t.allocUnsafe(4);i.writeFloatBE(r,0);const n=i.readUInt32BE(0);if(0!=(8191&n))return!1;let s=n>>16&32768;const a=n>>23&255,o=8388607&n;if(a>=113&&a<=142)s+=(a-112<<10)+(o>>13);else{if(!(a>=103&&a<113))return!1;if(o&(1<<126-a)-1)return!1;s+=o+8388608>>126-a}return e.writeUInt16BE(s),!0},e.parseHalf=function(t){const e=128&t[0]?-1:1,r=(124&t[0])>>2,i=(3&t[0])<<8|t[1];return r?31===r?e*(i?NaN:Infinity):e*Math.pow(2,r-25)*(1024+i):5.960464477539063e-8*e*i},e.parseCBORfloat=function(t){switch(t.length){case 2:return e.parseHalf(t);case 4:return t.readFloatBE(0);case 8:return t.readDoubleBE(0);default:throw new Error("Invalid float size: "+t.length)}},e.hex=function(e){return t.from(e.replace(/^0x/,""),"hex")},e.bin=function(e){let r=0,i=(e=e.replace(/\s/g,"")).length%8||8;const n=[];for(;i<=e.length;)n.push(parseInt(e.slice(r,i),2)),r=i,i+=8;return t.from(n)},e.extend=function(t={},...e){const r=e.length;for(let i=0;it===e[r]))},e.bufferEqual=function(e,r){if(null==e&&null==r)return!0;if(null==e||null==r)return!1;if(!t.isBuffer(e)||!t.isBuffer(r)||e.length!==r.length)return!1;const i=e.length;let n,s,a=!0;for(n=s=0;s0||t===e?e:e-1}function y(t){for(var e,r,i=1,n=t.length,s=t[0]+"";ih^r?1:-1;for(o=(u=n.length)<(h=s.length)?u:h,a=0;as[a]^r?1:-1;return u==h?0:u>h^r?1:-1}function _(t,e,r,i){if(tr||t!==u(t))throw Error(h+(i||"Argument")+("number"==typeof t?tr?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function v(t){var e=t.c.length-1;return g(t.e/d)==e&&t.c[e]%2!=0}function E(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function x(t,e,r){var i,n;if(e<0){for(n=r+".";++e;n+=r);t=n+t}else if(++e>(i=t.length)){for(n=r,e-=i;--e;n+=r);t+=n}else eP?g.c=g.e=null:t.e=10;l/=10,h++);return void(h>P?g.c=g.e=null:(g.e=h,g.c=[t]))}w=String(t)}else{if(!a.test(w=String(t)))return n(g,w,p);g.s=45==w.charCodeAt(0)?(w=w.slice(1),-1):1}(h=w.indexOf("."))>-1&&(w=w.replace(".","")),(l=w.search(/e/i))>0?(h<0&&(h=l),h+=+w.slice(l+1),w=w.substring(0,l)):h<0&&(h=w.length)}else{if(_(e,2,j.length,"Base"),10==e)return X(g=new z(t),O+g.e+1,I);if(w=String(t),p="number"==typeof t){if(0*t!=0)return n(g,w,p,e);if(g.s=1/t<0?(w=w.slice(1),-1):1,z.DEBUG&&w.replace(/^0\.0*|\./,"").length>15)throw Error(c+t)}else g.s=45===w.charCodeAt(0)?(w=w.slice(1),-1):1;for(r=j.slice(0,e),h=l=0,m=w.length;lh){h=m;continue}}else if(!o&&(w==w.toUpperCase()&&(w=w.toLowerCase())||w==w.toLowerCase()&&(w=w.toUpperCase()))){o=!0,l=-1,h=0;continue}return n(g,String(t),p,e)}p=!1,(h=(w=i(w,e,10,g.s)).indexOf("."))>-1?w=w.replace(".",""):h=w.length}for(l=0;48===w.charCodeAt(l);l++);for(m=w.length;48===w.charCodeAt(--m););if(w=w.slice(l,++m)){if(m-=l,p&&z.DEBUG&&m>15&&(t>f||t!==u(t)))throw Error(c+g.s*t);if((h=h-l-1)>P)g.c=g.e=null;else if(h=F)?E(u,a):x(u,a,"0");else if(s=(t=X(new z(t),e,r)).e,o=(u=y(t.c)).length,1==i||2==i&&(e<=s||s<=N)){for(;oo){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=s-o)>0)for(s+1==o&&(u+=".");e--;u+="0");return t.s<0&&n?"-"+u:u}function G(t,e){for(var r,i=1,n=new z(t[0]);i=10;n/=10,i++);return(r=i+r*d-1)>P?t.c=t.e=null:r=10;h/=10,n++);if((s=e-n)<0)s+=d,a=e,m=(c=w[f=0])/g[n-a-1]%10|0;else if((f=o((s+1)/d))>=w.length){if(!i)break t;for(;w.length<=f;w.push(0));c=m=0,n=1,a=(s%=d)-d+1}else{for(c=h=w[f],n=1;h>=10;h/=10,n++);m=(a=(s%=d)-d+n)<0?0:c/g[n-a-1]%10|0}if(i=i||e<0||null!=w[f+1]||(a<0?c:c%g[n-a-1]),i=r<4?(m||i)&&(0==r||r==(t.s<0?3:2)):m>5||5==m&&(4==r||i||6==r&&(s>0?a>0?c/g[n-a]:0:w[f-1])%10&1||r==(t.s<0?8:7)),e<1||!w[0])return w.length=0,i?(e-=t.e+1,w[0]=g[(d-e%d)%d],t.e=-e||0):w[0]=t.e=0,t;if(0==s?(w.length=f,h=1,f--):(w.length=f+1,h=g[d-s],w[f]=a>0?u(c/g[n-a]%g[a])*h:0),i)for(;;){if(0==f){for(s=1,a=w[0];a>=10;a/=10,s++);for(a=w[0]+=h,h=1;a>=10;a/=10,h++);s!=h&&(t.e++,w[0]==l&&(w[0]=1));break}if(w[f]+=h,w[f]!=l)break;w[f--]=0,h=1}for(s=w.length;0===w[--s];w.pop());}t.e>P?t.c=t.e=null:t.e=F?E(e,r):x(e,r,"0"),t.s<0?"-"+e:e)}return z.clone=t,z.ROUND_UP=0,z.ROUND_DOWN=1,z.ROUND_CEIL=2,z.ROUND_FLOOR=3,z.ROUND_HALF_UP=4,z.ROUND_HALF_DOWN=5,z.ROUND_HALF_EVEN=6,z.ROUND_HALF_CEIL=7,z.ROUND_HALF_FLOOR=8,z.EUCLID=9,z.config=z.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(h+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(_(r=t[e],0,w,e),O=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(_(r=t[e],0,8,e),I=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(_(r[0],-w,0,e),_(r[1],0,w,e),N=r[0],F=r[1]):(_(r,-w,w,e),N=-(F=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)_(r[0],-w,-1,e),_(r[1],1,w,e),B=r[0],P=r[1];else{if(_(r,-w,w,e),!r)throw Error(h+e+" cannot be zero: "+r);B=-(P=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(h+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw L=!r,Error(h+"crypto unavailable");L=r}else L=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(_(r=t[e],0,9,e),U=r),t.hasOwnProperty(e="POW_PRECISION")&&(_(r=t[e],0,w,e),M=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(h+e+" not an object: "+r);W=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(h+e+" invalid: "+r);j=r}}return{DECIMAL_PLACES:O,ROUNDING_MODE:I,EXPONENTIAL_AT:[N,F],RANGE:[B,P],CRYPTO:L,MODULO_MODE:U,POW_PRECISION:M,FORMAT:W,ALPHABET:j}},z.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!z.DEBUG)return!0;var e,r,i=t.c,n=t.e,s=t.s;t:if("[object Array]"=={}.toString.call(i)){if((1===s||-1===s)&&n>=-w&&n<=w&&n===u(n)){if(0===i[0]){if(0===n&&1===i.length)return!0;break t}if((e=(n+1)%d)<1&&(e+=d),String(i[0]).length==e){for(e=0;e=l||r!==u(r))break t;if(0!==r)return!0}}}else if(null===i&&null===n&&(null===s||1===s||-1===s))return!0;throw Error(h+"Invalid BigNumber: "+t)},z.maximum=z.max=function(){return G(arguments,D.lt)},z.minimum=z.min=function(){return G(arguments,D.gt)},z.random=(s=9007199254740992*Math.random()&2097151?function(){return u(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,i,n,a,c=0,l=[],f=new z(R);if(null==t?t=O:_(t,0,w),n=o(t/d),L)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(n*=2));c>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[c]=r[0],e[c+1]=r[1]):(l.push(a%1e14),c+=2);c=n/2}else{if(!crypto.randomBytes)throw L=!1,Error(h+"crypto unavailable");for(e=crypto.randomBytes(n*=7);c=9e15?crypto.randomBytes(7).copy(e,c):(l.push(a%1e14),c+=7);c=n/7}if(!L)for(;c=10;a/=10,c++);cr-1&&(null==a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}return function(e,i,n,s,a){var o,u,h,c,l,d,f,p,m=e.indexOf("."),w=O,g=I;for(m>=0&&(c=M,M=0,e=e.replace(".",""),d=(p=new z(i)).pow(e.length-m),M=c,p.c=t(x(y(d.c),d.e,"0"),10,n,"0123456789"),p.e=p.c.length),h=c=(f=t(e,i,n,a?(o=j,"0123456789"):(o="0123456789",j))).length;0==f[--c];f.pop());if(!f[0])return o.charAt(0);if(m<0?--h:(d.c=f,d.e=h,d.s=s,f=(d=r(d,p,w,g,n)).c,l=d.r,h=d.e),m=f[u=h+w+1],c=n/2,l=l||u<0||null!=f[u+1],l=g<4?(null!=m||l)&&(0==g||g==(d.s<0?3:2)):m>c||m==c&&(4==g||l||6==g&&1&f[u-1]||g==(d.s<0?8:7)),u<1||!f[0])e=l?x(o.charAt(1),-w,o.charAt(0)):o.charAt(0);else{if(f.length=u,l)for(--n;++f[--u]>n;)f[u]=0,u||(++h,f=[1].concat(f));for(c=f.length;!f[--c];);for(m=0,e="";m<=c;e+=o.charAt(f[m++]));e=x(e,h,o.charAt(0))}return e}}(),r=function(){function t(t,e,r){var i,n,s,a,o=0,u=t.length,h=e%m,c=e/m|0;for(t=t.slice();u--;)o=((n=h*(s=t[u]%m)+(i=c*s+(a=t[u]/m|0)*h)%m*m+o)/r|0)+(i/m|0)+c*a,t[u]=n%r;return o&&(t=[o].concat(t)),t}function e(t,e,r,i){var n,s;if(r!=i)s=r>i?1:-1;else for(n=s=0;ne[n]?1:-1;break}return s}function r(t,e,r,i){for(var n=0;r--;)t[r]-=n,n=t[r]1;t.splice(0,1));}return function(i,n,s,a,o){var h,c,f,p,m,w,y,b,_,v,E,x,A,S,C,T,k,D=i.s==n.s?1:-1,R=i.c,O=n.c;if(!(R&&R[0]&&O&&O[0]))return new z(i.s&&n.s&&(R?!O||R[0]!=O[0]:O)?R&&0==R[0]||!O?0*D:D/0:NaN);for(_=(b=new z(D)).c=[],D=s+(c=i.e-n.e)+1,o||(o=l,c=g(i.e/d)-g(n.e/d),D=D/d|0),f=0;O[f]==(R[f]||0);f++);if(O[f]>(R[f]||0)&&c--,D<0)_.push(1),p=!0;else{for(S=R.length,T=O.length,f=0,D+=2,(m=u(o/(O[0]+1)))>1&&(O=t(O,m,o),R=t(R,m,o),T=O.length,S=R.length),A=T,E=(v=R.slice(0,T)).length;E=o/2&&C++;do{if(m=0,(h=e(O,v,T,E))<0){if(x=v[0],T!=E&&(x=x*o+(v[1]||0)),(m=u(x/C))>1)for(m>=o&&(m=o-1),y=(w=t(O,m,o)).length,E=v.length;1==e(w,v,y,E);)m--,r(w,T=10;D/=10,f++);X(b,s+(b.e=f+c*d-1)+1,a,p)}else b.e=c,b.r=+p;return b}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,S=/^([^.]+)\.$/,C=/^\.([^.]+)$/,T=/^-?(Infinity|NaN)$/,k=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(t,e,r,i){var n,s=r?e:e.replace(k,"");if(T.test(s))t.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(A,(function(t,e,r){return n="x"==(r=r.toLowerCase())?16:"b"==r?2:8,i&&i!=n?t:e})),i&&(n=i,s=s.replace(S,"$1").replace(C,"0.$1")),e!=s))return new z(s,n);if(z.DEBUG)throw Error(h+"Not a"+(i?" base "+i:"")+" number: "+e);t.s=null}t.c=t.e=null},D.absoluteValue=D.abs=function(){var t=new z(this);return t.s<0&&(t.s=1),t},D.comparedTo=function(t,e){return b(this,new z(t,e))},D.decimalPlaces=D.dp=function(t,e){var r,i,n,s=this;if(null!=t)return _(t,0,w),null==e?e=I:_(e,0,8),X(new z(s),t+s.e+1,e);if(!(r=s.c))return null;if(i=((n=r.length-1)-g(this.e/d))*d,n=r[n])for(;n%10==0;n/=10,i--);return i<0&&(i=0),i},D.dividedBy=D.div=function(t,e){return r(this,new z(t,e),O,I)},D.dividedToIntegerBy=D.idiv=function(t,e){return r(this,new z(t,e),0,1)},D.exponentiatedBy=D.pow=function(t,e){var r,i,n,s,a,c,l,f,p=this;if((t=new z(t)).c&&!t.isInteger())throw Error(h+"Exponent not an integer: "+K(t));if(null!=e&&(e=new z(e)),a=t.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!t.c||!t.c[0])return f=new z(Math.pow(+K(p),a?2-v(t):+K(t))),e?f.mod(e):f;if(c=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new z(NaN);(i=!c&&p.isInteger()&&e.isInteger())&&(p=p.mod(e))}else{if(t.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||a&&p.c[1]>=24e7:p.c[0]<8e13||a&&p.c[0]<=9999975e7)))return s=p.s<0&&v(t)?-0:0,p.e>-1&&(s=1/s),new z(c?1/s:s);M&&(s=o(M/d+2))}for(a?(r=new z(.5),c&&(t.s=1),l=v(t)):l=(n=Math.abs(+K(t)))%2,f=new z(R);;){if(l){if(!(f=f.times(p)).c)break;s?f.c.length>s&&(f.c.length=s):i&&(f=f.mod(e))}if(n){if(0===(n=u(n/2)))break;l=n%2}else if(X(t=t.times(r),t.e+1,1),t.e>14)l=v(t);else{if(0===(n=+K(t)))break;l=n%2}p=p.times(p),s?p.c&&p.c.length>s&&(p.c.length=s):i&&(p=p.mod(e))}return i?f:(c&&(f=R.div(f)),e?f.mod(e):s?X(f,M,I,void 0):f)},D.integerValue=function(t){var e=new z(this);return null==t?t=I:_(t,0,8),X(e,e.e+1,t)},D.isEqualTo=D.eq=function(t,e){return 0===b(this,new z(t,e))},D.isFinite=function(){return!!this.c},D.isGreaterThan=D.gt=function(t,e){return b(this,new z(t,e))>0},D.isGreaterThanOrEqualTo=D.gte=function(t,e){return 1===(e=b(this,new z(t,e)))||0===e},D.isInteger=function(){return!!this.c&&g(this.e/d)>this.c.length-2},D.isLessThan=D.lt=function(t,e){return b(this,new z(t,e))<0},D.isLessThanOrEqualTo=D.lte=function(t,e){return-1===(e=b(this,new z(t,e)))||0===e},D.isNaN=function(){return!this.s},D.isNegative=function(){return this.s<0},D.isPositive=function(){return this.s>0},D.isZero=function(){return!!this.c&&0==this.c[0]},D.minus=function(t,e){var r,i,n,s,a=this,o=a.s;if(e=(t=new z(t,e)).s,!o||!e)return new z(NaN);if(o!=e)return t.s=-e,a.plus(t);var u=a.e/d,h=t.e/d,c=a.c,f=t.c;if(!u||!h){if(!c||!f)return c?(t.s=-e,t):new z(f?a:NaN);if(!c[0]||!f[0])return f[0]?(t.s=-e,t):new z(c[0]?a:3==I?-0:0)}if(u=g(u),h=g(h),c=c.slice(),o=u-h){for((s=o<0)?(o=-o,n=c):(h=u,n=f),n.reverse(),e=o;e--;n.push(0));n.reverse()}else for(i=(s=(o=c.length)<(e=f.length))?o:e,o=e=0;e0)for(;e--;c[r++]=0);for(e=l-1;i>o;){if(c[--i]=0;){for(r=0,p=x[n]%_,w=x[n]/_|0,s=n+(a=u);s>n;)r=((h=p*(h=E[--a]%_)+(o=w*h+(c=E[a]/_|0)*p)%_*_+y[s]+r)/b|0)+(o/_|0)+w*c,y[s--]=h%b;y[s]=r}return r?++i:y.splice(0,1),q(t,y,i)},D.negated=function(){var t=new z(this);return t.s=-t.s||null,t},D.plus=function(t,e){var r,i=this,n=i.s;if(e=(t=new z(t,e)).s,!n||!e)return new z(NaN);if(n!=e)return t.s=-e,i.minus(t);var s=i.e/d,a=t.e/d,o=i.c,u=t.c;if(!s||!a){if(!o||!u)return new z(n/0);if(!o[0]||!u[0])return u[0]?t:new z(o[0]?i:0*n)}if(s=g(s),a=g(a),o=o.slice(),n=s-a){for(n>0?(a=s,r=u):(n=-n,r=o),r.reverse();n--;r.push(0));r.reverse()}for((n=o.length)-(e=u.length)<0&&(r=u,u=o,o=r,e=n),n=0;e;)n=(o[--e]=o[e]+u[e]+n)/l|0,o[e]=l===o[e]?0:o[e]%l;return n&&(o=[n].concat(o),++a),q(t,o,a)},D.precision=D.sd=function(t,e){var r,i,n,s=this;if(null!=t&&t!==!!t)return _(t,1,w),null==e?e=I:_(e,0,8),X(new z(s),t,e);if(!(r=s.c))return null;if(i=(n=r.length-1)*d+1,n=r[n]){for(;n%10==0;n/=10,i--);for(n=r[0];n>=10;n/=10,i++);}return t&&s.e+1>i&&(i=s.e+1),i},D.shiftedBy=function(t){return _(t,-f,f),this.times("1e"+t)},D.squareRoot=D.sqrt=function(){var t,e,i,n,s,a=this,o=a.c,u=a.s,h=a.e,c=O+4,l=new z("0.5");if(1!==u||!o||!o[0])return new z(!u||u<0&&(!o||o[0])?NaN:o?a:1/0);if(0==(u=Math.sqrt(+K(a)))||u==1/0?(((e=y(o)).length+h)%2==0&&(e+="0"),u=Math.sqrt(+e),h=g((h+1)/2)-(h<0||h%2),i=new z(e=u==1/0?"1e"+h:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+h)):i=new z(u+""),i.c[0])for((u=(h=i.e)+c)<3&&(u=0);;)if(s=i,i=l.times(s.plus(r(a,s,c,1))),y(s.c).slice(0,u)===(e=y(i.c)).slice(0,u)){if(i.e0&&m>0){for(s=m%o||o,l=p.substr(0,s);s0&&(l+=c+p.slice(s)),f&&(l="-"+l)}i=d?l+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):l}return(r.prefix||"")+i+(r.suffix||"")},D.toFraction=function(t){var e,i,n,s,a,o,u,c,l,f,m,w,g=this,b=g.c;if(null!=t&&(!(u=new z(t)).isInteger()&&(u.c||1!==u.s)||u.lt(R)))throw Error(h+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+K(u));if(!b)return new z(g);for(e=new z(R),l=i=new z(R),n=c=new z(R),w=y(b),a=e.e=w.length-g.e-1,e.c[0]=p[(o=a%d)<0?d+o:o],t=!t||u.comparedTo(e)>0?a>0?e:l:u,o=P,P=1/0,u=new z(w),c.c[0]=0;f=r(u,e,0,1),1!=(s=i.plus(f.times(n))).comparedTo(t);)i=n,n=s,l=c.plus(f.times(s=l)),c=s,e=u.minus(f.times(s=e)),u=s;return s=r(t.minus(i),n,0,1),c=c.plus(s.times(l)),i=i.plus(s.times(n)),c.s=l.s=g.s,m=r(l,n,a*=2,I).minus(g).abs().comparedTo(r(c,i,a,I).minus(g).abs())<1?[l,n]:[c,i],P=o,m},D.toNumber=function(){return+K(this)},D.toPrecision=function(t,e){return null!=t&&_(t,1,w),H(this,t,e,2)},D.toString=function(t){var e,r=this,n=r.s,s=r.e;return null===s?n?(e="Infinity",n<0&&(e="-"+e)):e="NaN":(null==t?e=s<=N||s>=F?E(y(r.c),s):x(y(r.c),s,"0"):10===t?e=x(y((r=X(new z(r),O+s+1,I)).c),r.e,"0"):(_(t,2,j.length,"Base"),e=i(x(y(r.c),s,"0"),10,t,n,!0)),n<0&&r.c[0]&&(e="-"+e)),e},D.valueOf=D.toJSON=function(){return K(this)},D._isBigNumber=!0,null!=e&&z.set(e),z}()).default=s.BigNumber=s,void 0===(i=function(){return s}.call(e,r,e,t))||(t.exports=i)}()},function(t,e,r){(function(t){function r(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===r(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===r(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===r(t)},e.isError=function(t){return"[object Error]"===r(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,r(3).Buffer)},function(t,e,r){"use strict";const i=e.NAMESPACES={HTML:"http://www.w3.org/1999/xhtml",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"};e.ATTRS={TYPE:"type",ACTION:"action",ENCODING:"encoding",PROMPT:"prompt",NAME:"name",COLOR:"color",FACE:"face",SIZE:"size"},e.DOCUMENT_MODE={NO_QUIRKS:"no-quirks",QUIRKS:"quirks",LIMITED_QUIRKS:"limited-quirks"};const n=e.TAG_NAMES={A:"a",ADDRESS:"address",ANNOTATION_XML:"annotation-xml",APPLET:"applet",AREA:"area",ARTICLE:"article",ASIDE:"aside",B:"b",BASE:"base",BASEFONT:"basefont",BGSOUND:"bgsound",BIG:"big",BLOCKQUOTE:"blockquote",BODY:"body",BR:"br",BUTTON:"button",CAPTION:"caption",CENTER:"center",CODE:"code",COL:"col",COLGROUP:"colgroup",DD:"dd",DESC:"desc",DETAILS:"details",DIALOG:"dialog",DIR:"dir",DIV:"div",DL:"dl",DT:"dt",EM:"em",EMBED:"embed",FIELDSET:"fieldset",FIGCAPTION:"figcaption",FIGURE:"figure",FONT:"font",FOOTER:"footer",FOREIGN_OBJECT:"foreignObject",FORM:"form",FRAME:"frame",FRAMESET:"frameset",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",HEAD:"head",HEADER:"header",HGROUP:"hgroup",HR:"hr",HTML:"html",I:"i",IMG:"img",IMAGE:"image",INPUT:"input",IFRAME:"iframe",KEYGEN:"keygen",LABEL:"label",LI:"li",LINK:"link",LISTING:"listing",MAIN:"main",MALIGNMARK:"malignmark",MARQUEE:"marquee",MATH:"math",MENU:"menu",META:"meta",MGLYPH:"mglyph",MI:"mi",MO:"mo",MN:"mn",MS:"ms",MTEXT:"mtext",NAV:"nav",NOBR:"nobr",NOFRAMES:"noframes",NOEMBED:"noembed",NOSCRIPT:"noscript",OBJECT:"object",OL:"ol",OPTGROUP:"optgroup",OPTION:"option",P:"p",PARAM:"param",PLAINTEXT:"plaintext",PRE:"pre",RB:"rb",RP:"rp",RT:"rt",RTC:"rtc",RUBY:"ruby",S:"s",SCRIPT:"script",SECTION:"section",SELECT:"select",SOURCE:"source",SMALL:"small",SPAN:"span",STRIKE:"strike",STRONG:"strong",STYLE:"style",SUB:"sub",SUMMARY:"summary",SUP:"sup",TABLE:"table",TBODY:"tbody",TEMPLATE:"template",TEXTAREA:"textarea",TFOOT:"tfoot",TD:"td",TH:"th",THEAD:"thead",TITLE:"title",TR:"tr",TRACK:"track",TT:"tt",U:"u",UL:"ul",SVG:"svg",VAR:"var",WBR:"wbr",XMP:"xmp"};e.SPECIAL_ELEMENTS={[i.HTML]:{[n.ADDRESS]:!0,[n.APPLET]:!0,[n.AREA]:!0,[n.ARTICLE]:!0,[n.ASIDE]:!0,[n.BASE]:!0,[n.BASEFONT]:!0,[n.BGSOUND]:!0,[n.BLOCKQUOTE]:!0,[n.BODY]:!0,[n.BR]:!0,[n.BUTTON]:!0,[n.CAPTION]:!0,[n.CENTER]:!0,[n.COL]:!0,[n.COLGROUP]:!0,[n.DD]:!0,[n.DETAILS]:!0,[n.DIR]:!0,[n.DIV]:!0,[n.DL]:!0,[n.DT]:!0,[n.EMBED]:!0,[n.FIELDSET]:!0,[n.FIGCAPTION]:!0,[n.FIGURE]:!0,[n.FOOTER]:!0,[n.FORM]:!0,[n.FRAME]:!0,[n.FRAMESET]:!0,[n.H1]:!0,[n.H2]:!0,[n.H3]:!0,[n.H4]:!0,[n.H5]:!0,[n.H6]:!0,[n.HEAD]:!0,[n.HEADER]:!0,[n.HGROUP]:!0,[n.HR]:!0,[n.HTML]:!0,[n.IFRAME]:!0,[n.IMG]:!0,[n.INPUT]:!0,[n.LI]:!0,[n.LINK]:!0,[n.LISTING]:!0,[n.MAIN]:!0,[n.MARQUEE]:!0,[n.MENU]:!0,[n.META]:!0,[n.NAV]:!0,[n.NOEMBED]:!0,[n.NOFRAMES]:!0,[n.NOSCRIPT]:!0,[n.OBJECT]:!0,[n.OL]:!0,[n.P]:!0,[n.PARAM]:!0,[n.PLAINTEXT]:!0,[n.PRE]:!0,[n.SCRIPT]:!0,[n.SECTION]:!0,[n.SELECT]:!0,[n.SOURCE]:!0,[n.STYLE]:!0,[n.SUMMARY]:!0,[n.TABLE]:!0,[n.TBODY]:!0,[n.TD]:!0,[n.TEMPLATE]:!0,[n.TEXTAREA]:!0,[n.TFOOT]:!0,[n.TH]:!0,[n.THEAD]:!0,[n.TITLE]:!0,[n.TR]:!0,[n.TRACK]:!0,[n.UL]:!0,[n.WBR]:!0,[n.XMP]:!0},[i.MATHML]:{[n.MI]:!0,[n.MO]:!0,[n.MN]:!0,[n.MS]:!0,[n.MTEXT]:!0,[n.ANNOTATION_XML]:!0},[i.SVG]:{[n.TITLE]:!0,[n.FOREIGN_OBJECT]:!0,[n.DESC]:!0}}},function(t,e,r){"use strict";function i(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.prototype.toString=function(t){var e=this.name+": ";return e+=this.reason||"(unknown reason)",!t&&this.mark&&(e+=" "+this.mark.toString()),e},t.exports=i},function(t,e,r){"use strict";var i=r(15);t.exports=new i({include:[r(75)],implicit:[r(152),r(153)],explicit:[r(154),r(155),r(156),r(157)]})},function(t,e,r){(function(t){var i=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},i=0;i=s)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}})),u=i[r];r=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),p(r)?i.showHidden=r:r&&e._extend(i,r),y(i.showHidden)&&(i.showHidden=!1),y(i.depth)&&(i.depth=2),y(i.colors)&&(i.colors=!1),y(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=u),c(i,t,i.depth)}function u(t,e){var r=o.styles[e];return r?"["+o.colors[r][0]+"m"+t+"["+o.colors[r][1]+"m":t}function h(t,e){return t}function c(t,r,i){if(t.customInspect&&r&&x(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,t);return g(n)||(n=c(t,n,i)),n}var s=function(t,e){if(y(e))return t.stylize("undefined","undefined");if(g(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(w(e))return t.stylize(""+e,"number");if(p(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(t,r);if(s)return s;var a=Object.keys(r),o=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(r)),E(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return l(r);if(0===a.length){if(x(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(b(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(v(r))return t.stylize(Date.prototype.toString.call(r),"date");if(E(r))return l(r)}var h,_="",A=!1,S=["{","}"];(f(r)&&(A=!0,S=["[","]"]),x(r))&&(_=" [Function"+(r.name?": "+r.name:"")+"]");return b(r)&&(_=" "+RegExp.prototype.toString.call(r)),v(r)&&(_=" "+Date.prototype.toUTCString.call(r)),E(r)&&(_=" "+l(r)),0!==a.length||A&&0!=r.length?i<0?b(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),h=A?function(t,e,r,i,n){for(var s=[],a=0,o=e.length;a=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(h,_,S)):S[0]+_+S[1]}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function d(t,e,r,i,n,s){var a,o,u;if((u=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]}).get?o=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(o=t.stylize("[Setter]","special")),k(i,n)||(a="["+n+"]"),o||(t.seen.indexOf(u.value)<0?(o=m(r)?c(t,u.value,null):c(t,u.value,r-1)).indexOf("\n")>-1&&(o=s?o.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+o.split("\n").map((function(t){return" "+t})).join("\n")):o=t.stylize("[Circular]","special")),y(a)){if(s&&n.match(/^\d+$/))return o;(a=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+o}function f(t){return Array.isArray(t)}function p(t){return"boolean"==typeof t}function m(t){return null===t}function w(t){return"number"==typeof t}function g(t){return"string"==typeof t}function y(t){return void 0===t}function b(t){return _(t)&&"[object RegExp]"===A(t)}function _(t){return"object"==typeof t&&null!==t}function v(t){return _(t)&&"[object Date]"===A(t)}function E(t){return _(t)&&("[object Error]"===A(t)||t instanceof Error)}function x(t){return"function"==typeof t}function A(t){return Object.prototype.toString.call(t)}function S(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(r){if(y(s)&&(s=t.env.NODE_DEBUG||""),r=r.toUpperCase(),!a[r])if(new RegExp("\\b"+r+"\\b","i").test(s)){var i=t.pid;a[r]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",r,i,t)}}else a[r]=function(){};return a[r]},e.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=f,e.isBoolean=p,e.isNull=m,e.isNullOrUndefined=function(t){return null==t},e.isNumber=w,e.isString=g,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=y,e.isRegExp=b,e.isObject=_,e.isDate=v,e.isError=E,e.isFunction=x,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(169);var C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(){var t=new Date,e=[S(t.getHours()),S(t.getMinutes()),S(t.getSeconds())].join(":");return[t.getDate(),C[t.getMonth()],e].join(" ")}function k(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",T(),e.format.apply(e,arguments))},e.inherits=r(9),e._extend=function(t,e){if(!e||!_(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t};var D="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function R(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(D&&t[D]){var e;if("function"!=typeof(e=t[D]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,D,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,i=new Promise((function(t,i){e=t,r=i})),n=[],s=0;s255||(0|t)!==t)throw new Error("value must be a small positive integer: "+t);this.value=t}toString(){return"simple("+this.value+")"}[i.inspect.custom](t,e){return"simple("+this.value+")"}inspect(t,e){return"simple("+this.value+")"}encodeCBOR(t){return t._pushInt(this.value,s.SIMPLE_FLOAT)}static isSimple(t){return t instanceof u}static decode(t,e=!0,r=!1){switch(t){case a.FALSE:return!1;case a.TRUE:return!0;case a.NULL:return e?null:o.NULL;case a.UNDEFINED:return e?void 0:o.UNDEFINED;case-1:if(!e||!r)throw new Error("Invalid BREAK");return o.BREAK;default:return new u(t)}}}t.exports=u},function(t,e,r){"use strict";(function(e){const i=r(4),n=r(22);class s extends i.Transform{constructor(t,r,i){let n,s;switch(null==i&&(i={}),typeof t){case"object":e.isBuffer(t)?(n=t,null!=r&&"object"==typeof r&&(i=r)):i=t;break;case"string":n=t,null!=r&&"object"==typeof r?i=r:s=r}null==i&&(i={}),null==n&&(n=i.input),null==s&&(s=i.inputEncoding),delete i.input,delete i.inputEncoding;const a=null==i.watchPipe||i.watchPipe;delete i.watchPipe;const o=!!i.readError;delete i.readError,super(i),this.readError=o,a&&this.on("pipe",t=>{const e=t._readableState.objectMode;if(this.length>0&&e!==this._readableState.objectMode)throw new Error("Do not switch objectMode in the middle of the stream");return this._readableState.objectMode=e,this._writableState.objectMode=e}),null!=n&&this.end(n,s)}static isNoFilter(t){return t instanceof this}static compare(t,e){if(!(t instanceof this))throw new TypeError("Arguments must be NoFilters");return t===e?0:t.compare(e)}static concat(t,r){if(!Array.isArray(t))throw new TypeError("list argument must be an Array of NoFilters");if(0===t.length||0===r)return e.alloc(0);null==r&&(r=t.reduce((t,e)=>{if(!(e instanceof s))throw new TypeError("list argument must be an Array of NoFilters");return t+e.length},0));let i=!0,n=!0;const a=t.map(t=>{if(!(t instanceof s))throw new TypeError("list argument must be an Array of NoFilters");const r=t.slice();return e.isBuffer(r)?n=!1:i=!1,r});if(i)return e.concat(a,r);if(n)return[].concat(...a).slice(0,r);throw new Error("Concatenating mixed object and byte streams not supported")}_transform(t,r,i){this._readableState.objectMode||e.isBuffer(t)||(t=e.from(t,r)),this.push(t),i()}_bufArray(){let t=this._readableState.buffer;if(!Array.isArray(t)){let e=t.head;for(t=[];null!=e;)t.push(e.data),e=e.next}return t}read(t){const e=super.read(t);if(null!=e){if(this.emit("read",e),this.readError&&e.length{this.on("finish",()=>{const i=this.read();null==t||e||(e=!0,t(null,i)),r(i)}),this.on("error",r=>{null==t||e||(e=!0,t(r)),i(r)})})}compare(t){if(!(t instanceof s))throw new TypeError("Arguments must be NoFilters");if(this===t)return 0;{const r=this.slice(),i=t.slice();if(e.isBuffer(r)&&e.isBuffer(i))return r.compare(i);throw new Error("Cannot compare streams in object mode")}}equals(t){return 0===this.compare(t)}slice(t,r){if(this._readableState.objectMode)return this._bufArray().slice(t,r);const i=this._bufArray();switch(i.length){case 0:return e.alloc(0);case 1:return i[0].slice(t,r);default:return e.concat(i).slice(t,r)}}get(t){return this.slice()[t]}toJSON(){const t=this.slice();return e.isBuffer(t)?t.toJSON():t}toString(t,r,i){const s=this.slice(r,i);if(!e.isBuffer(s))return JSON.stringify(s);if((!t||"utf8"===t)&&n.TextDecoder){return new n.TextDecoder("utf8",{fatal:!0,ignoreBOM:!0}).decode(s)}return s.toString(t,r,i)}inspect(t,e){return this[n.inspect.custom](t,e)}[n.inspect.custom](t,r){const i=this._bufArray().map(t=>e.isBuffer(t)?(null!=r?r.stylize:void 0)?r.stylize(t.toString("hex"),"string"):t.toString("hex"):n.inspect(t,r)).join(", ");return`${this.constructor.name} [${i}]`}get length(){return this._readableState.length}writeBigInt(t){let r=t.toString(16);if(t<0){const e=BigInt(Math.floor(r.length/2));r=(t=(BigInt(1)<=o.DIGIT_0&&t<=o.DIGIT_9}function zt(t){return t>=o.LATIN_CAPITAL_A&&t<=o.LATIN_CAPITAL_Z}function Ht(t){return t>=o.LATIN_SMALL_A&&t<=o.LATIN_SMALL_Z}function Gt(t){return Ht(t)||zt(t)}function qt(t){return Gt(t)||jt(t)}function Xt(t){return t>=o.LATIN_CAPITAL_A&&t<=o.LATIN_CAPITAL_F}function Kt(t){return t>=o.LATIN_SMALL_A&&t<=o.LATIN_SMALL_F}function Vt(t){return t+32}function Yt(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(t>>>10&1023|55296)+String.fromCharCode(56320|1023&t))}function Jt(t){return String.fromCharCode(Vt(t))}function Zt(t,e){const r=s[++t];let i=++t,n=i+r-1;for(;i<=n;){const t=i+n>>>1,a=s[t];if(ae))return s[t+r];n=t-1}}return-1}class Qt{constructor(){this.preprocessor=new i,this.tokenQueue=[],this.allowCDATA=!1,this.state=p,this.returnState="",this.charRefCode=-1,this.tempBuff=[],this.lastStartTagName="",this.consumedAfterSnapshot=-1,this.active=!1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr=null}_err(){}_errOnNextCodePoint(t){this._consume(),this._err(t),this._unconsume()}getNextToken(){for(;!this.tokenQueue.length&&this.active;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this[this.state](t)}return this.tokenQueue.shift()}write(t,e){this.active=!0,this.preprocessor.write(t,e)}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t)}_ensureHibernation(){if(this.preprocessor.endOfChunkHit){for(;this.consumedAfterSnapshot>0;this.consumedAfterSnapshot--)this.preprocessor.retreat();return this.active=!1,this.tokenQueue.push({type:Qt.HIBERNATION_TOKEN}),!0}return!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_unconsume(){this.consumedAfterSnapshot--,this.preprocessor.retreat()}_reconsumeInState(t){this.state=t,this._unconsume()}_consumeSequenceIfMatch(t,e,r){let i=0,n=!0;const s=t.length;let a=0,u=e,h=void 0;for(;a0&&(u=this._consume(),i++),u===o.EOF){n=!1;break}if(u!==(h=t[a])&&(r||u!==Vt(h))){n=!1;break}}if(!n)for(;i--;)this._unconsume();return n}_isTempBufferEqualToScriptString(){if(this.tempBuff.length!==u.SCRIPT_STRING.length)return!1;for(let t=0;t0&&this._err(a.endTagWithAttributes),t.selfClosing&&this._err(a.endTagWithTrailingSolidus)),this.tokenQueue.push(t)}_emitCurrentCharacterToken(){this.currentCharacterToken&&(this.tokenQueue.push(this.currentCharacterToken),this.currentCharacterToken=null)}_emitEOFToken(){this._createEOFToken(),this._emitCurrentToken()}_appendCharToCurrentCharacterToken(t,e){this.currentCharacterToken&&this.currentCharacterToken.type!==t&&this._emitCurrentCharacterToken(),this.currentCharacterToken?this.currentCharacterToken.chars+=e:this._createCharacterToken(t,e)}_emitCodePoint(t){let e=Qt.CHARACTER_TOKEN;Wt(t)?e=Qt.WHITESPACE_CHARACTER_TOKEN:t===o.NULL&&(e=Qt.NULL_CHARACTER_TOKEN),this._appendCharToCurrentCharacterToken(e,Yt(t))}_emitSeveralCodePoints(t){for(let e=0;e-1;){const t=s[i],n=t")):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.state=N,this._emitChars(n.REPLACEMENT_CHARACTER)):t===o.EOF?(this._err(a.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state=N,this._emitCodePoint(t))}[P](t){t===o.SOLIDUS?(this.tempBuff=[],this.state=L):Gt(t)?(this.tempBuff=[],this._emitChars("<"),this._reconsumeInState(M)):(this._emitChars("<"),this._reconsumeInState(N))}[L](t){Gt(t)?(this._createEndTagToken(),this._reconsumeInState(U)):(this._emitChars("")):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.state=W,this._emitChars(n.REPLACEMENT_CHARACTER)):t===o.EOF?(this._err(a.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state=W,this._emitCodePoint(t))}[H](t){t===o.SOLIDUS?(this.tempBuff=[],this.state=G,this._emitChars("/")):this._reconsumeInState(W)}[G](t){Wt(t)||t===o.SOLIDUS||t===o.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?N:W,this._emitCodePoint(t)):zt(t)?(this.tempBuff.push(Vt(t)),this._emitCodePoint(t)):Ht(t)?(this.tempBuff.push(t),this._emitCodePoint(t)):this._reconsumeInState(W)}[q](t){Wt(t)||(t===o.SOLIDUS||t===o.GREATER_THAN_SIGN||t===o.EOF?this._reconsumeInState(K):t===o.EQUALS_SIGN?(this._err(a.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=X):(this._createAttr(""),this._reconsumeInState(X)))}[X](t){Wt(t)||t===o.SOLIDUS||t===o.GREATER_THAN_SIGN||t===o.EOF?(this._leaveAttrName(K),this._unconsume()):t===o.EQUALS_SIGN?this._leaveAttrName(V):zt(t)?this.currentAttr.name+=Jt(t):t===o.QUOTATION_MARK||t===o.APOSTROPHE||t===o.LESS_THAN_SIGN?(this._err(a.unexpectedCharacterInAttributeName),this.currentAttr.name+=Yt(t)):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentAttr.name+=n.REPLACEMENT_CHARACTER):this.currentAttr.name+=Yt(t)}[K](t){Wt(t)||(t===o.SOLIDUS?this.state=$:t===o.EQUALS_SIGN?this.state=V:t===o.GREATER_THAN_SIGN?(this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInTag),this._emitEOFToken()):(this._createAttr(""),this._reconsumeInState(X)))}[V](t){Wt(t)||(t===o.QUOTATION_MARK?this.state=Y:t===o.APOSTROPHE?this.state=J:t===o.GREATER_THAN_SIGN?(this._err(a.missingAttributeValue),this.state=p,this._emitCurrentToken()):this._reconsumeInState(Z))}[Y](t){t===o.QUOTATION_MARK?this.state=Q:t===o.AMPERSAND?(this.returnState=Y,this.state=Ot):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentAttr.value+=n.REPLACEMENT_CHARACTER):t===o.EOF?(this._err(a.eofInTag),this._emitEOFToken()):this.currentAttr.value+=Yt(t)}[J](t){t===o.APOSTROPHE?this.state=Q:t===o.AMPERSAND?(this.returnState=J,this.state=Ot):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentAttr.value+=n.REPLACEMENT_CHARACTER):t===o.EOF?(this._err(a.eofInTag),this._emitEOFToken()):this.currentAttr.value+=Yt(t)}[Z](t){Wt(t)?this._leaveAttrValue(q):t===o.AMPERSAND?(this.returnState=Z,this.state=Ot):t===o.GREATER_THAN_SIGN?(this._leaveAttrValue(p),this._emitCurrentToken()):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentAttr.value+=n.REPLACEMENT_CHARACTER):t===o.QUOTATION_MARK||t===o.APOSTROPHE||t===o.LESS_THAN_SIGN||t===o.EQUALS_SIGN||t===o.GRAVE_ACCENT?(this._err(a.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=Yt(t)):t===o.EOF?(this._err(a.eofInTag),this._emitEOFToken()):this.currentAttr.value+=Yt(t)}[Q](t){Wt(t)?this._leaveAttrValue(q):t===o.SOLIDUS?this._leaveAttrValue($):t===o.GREATER_THAN_SIGN?(this._leaveAttrValue(p),this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInTag),this._emitEOFToken()):(this._err(a.missingWhitespaceBetweenAttributes),this._reconsumeInState(q))}[$](t){t===o.GREATER_THAN_SIGN?(this.currentToken.selfClosing=!0,this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInTag),this._emitEOFToken()):(this._err(a.unexpectedSolidusInTag),this._reconsumeInState(q))}[tt](t){t===o.GREATER_THAN_SIGN?(this.state=p,this._emitCurrentToken()):t===o.EOF?(this._emitCurrentToken(),this._emitEOFToken()):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentToken.data+=n.REPLACEMENT_CHARACTER):this.currentToken.data+=Yt(t)}[et](t){this._consumeSequenceIfMatch(u.DASH_DASH_STRING,t,!0)?(this._createCommentToken(),this.state=rt):this._consumeSequenceIfMatch(u.DOCTYPE_STRING,t,!1)?this.state=dt:this._consumeSequenceIfMatch(u.CDATA_START_STRING,t,!0)?this.allowCDATA?this.state=kt:(this._err(a.cdataInHtmlContent),this._createCommentToken(),this.currentToken.data="[CDATA[",this.state=tt):this._ensureHibernation()||(this._err(a.incorrectlyOpenedComment),this._createCommentToken(),this._reconsumeInState(tt))}[rt](t){t===o.HYPHEN_MINUS?this.state=it:t===o.GREATER_THAN_SIGN?(this._err(a.abruptClosingOfEmptyComment),this.state=p,this._emitCurrentToken()):this._reconsumeInState(nt)}[it](t){t===o.HYPHEN_MINUS?this.state=ct:t===o.GREATER_THAN_SIGN?(this._err(a.abruptClosingOfEmptyComment),this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState(nt))}[nt](t){t===o.HYPHEN_MINUS?this.state=ht:t===o.LESS_THAN_SIGN?(this.currentToken.data+="<",this.state=st):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentToken.data+=n.REPLACEMENT_CHARACTER):t===o.EOF?(this._err(a.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.data+=Yt(t)}[st](t){t===o.EXCLAMATION_MARK?(this.currentToken.data+="!",this.state=at):t===o.LESS_THAN_SIGN?this.currentToken.data+="!":this._reconsumeInState(nt)}[at](t){t===o.HYPHEN_MINUS?this.state=ot:this._reconsumeInState(nt)}[ot](t){t===o.HYPHEN_MINUS?this.state=ut:this._reconsumeInState(ht)}[ut](t){t!==o.GREATER_THAN_SIGN&&t!==o.EOF&&this._err(a.nestedComment),this._reconsumeInState(ct)}[ht](t){t===o.HYPHEN_MINUS?this.state=ct:t===o.EOF?(this._err(a.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState(nt))}[ct](t){t===o.GREATER_THAN_SIGN?(this.state=p,this._emitCurrentToken()):t===o.EXCLAMATION_MARK?this.state=lt:t===o.HYPHEN_MINUS?this.currentToken.data+="-":t===o.EOF?(this._err(a.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--",this._reconsumeInState(nt))}[lt](t){t===o.HYPHEN_MINUS?(this.currentToken.data+="--!",this.state=ht):t===o.GREATER_THAN_SIGN?(this._err(a.incorrectlyClosedComment),this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--!",this._reconsumeInState(nt))}[dt](t){Wt(t)?this.state=ft:t===o.GREATER_THAN_SIGN?this._reconsumeInState(ft):t===o.EOF?(this._err(a.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(a.missingWhitespaceBeforeDoctypeName),this._reconsumeInState(ft))}[ft](t){Wt(t)||(zt(t)?(this._createDoctypeToken(Jt(t)),this.state=pt):t===o.NULL?(this._err(a.unexpectedNullCharacter),this._createDoctypeToken(n.REPLACEMENT_CHARACTER),this.state=pt):t===o.GREATER_THAN_SIGN?(this._err(a.missingDoctypeName),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=p):t===o.EOF?(this._err(a.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._createDoctypeToken(Yt(t)),this.state=pt))}[pt](t){Wt(t)?this.state=mt:t===o.GREATER_THAN_SIGN?(this.state=p,this._emitCurrentToken()):zt(t)?this.currentToken.name+=Jt(t):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentToken.name+=n.REPLACEMENT_CHARACTER):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.name+=Yt(t)}[mt](t){Wt(t)||(t===o.GREATER_THAN_SIGN?(this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this._consumeSequenceIfMatch(u.PUBLIC_STRING,t,!1)?this.state=wt:this._consumeSequenceIfMatch(u.SYSTEM_STRING,t,!1)?this.state=Et:this._ensureHibernation()||(this._err(a.invalidCharacterSequenceAfterDoctypeName),this.currentToken.forceQuirks=!0,this._reconsumeInState(Tt)))}[wt](t){Wt(t)?this.state=gt:t===o.QUOTATION_MARK?(this._err(a.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state=yt):t===o.APOSTROPHE?(this._err(a.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state=bt):t===o.GREATER_THAN_SIGN?(this._err(a.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(a.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Tt))}[gt](t){Wt(t)||(t===o.QUOTATION_MARK?(this.currentToken.publicId="",this.state=yt):t===o.APOSTROPHE?(this.currentToken.publicId="",this.state=bt):t===o.GREATER_THAN_SIGN?(this._err(a.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(a.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Tt)))}[yt](t){t===o.QUOTATION_MARK?this.state=_t:t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentToken.publicId+=n.REPLACEMENT_CHARACTER):t===o.GREATER_THAN_SIGN?(this._err(a.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=p):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=Yt(t)}[bt](t){t===o.APOSTROPHE?this.state=_t:t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentToken.publicId+=n.REPLACEMENT_CHARACTER):t===o.GREATER_THAN_SIGN?(this._err(a.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=p):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=Yt(t)}[_t](t){Wt(t)?this.state=vt:t===o.GREATER_THAN_SIGN?(this.state=p,this._emitCurrentToken()):t===o.QUOTATION_MARK?(this._err(a.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state=At):t===o.APOSTROPHE?(this._err(a.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state=St):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(a.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Tt))}[vt](t){Wt(t)||(t===o.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=p):t===o.QUOTATION_MARK?(this.currentToken.systemId="",this.state=At):t===o.APOSTROPHE?(this.currentToken.systemId="",this.state=St):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(a.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Tt)))}[Et](t){Wt(t)?this.state=xt:t===o.QUOTATION_MARK?(this._err(a.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state=At):t===o.APOSTROPHE?(this._err(a.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state=St):t===o.GREATER_THAN_SIGN?(this._err(a.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(a.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Tt))}[xt](t){Wt(t)||(t===o.QUOTATION_MARK?(this.currentToken.systemId="",this.state=At):t===o.APOSTROPHE?(this.currentToken.systemId="",this.state=St):t===o.GREATER_THAN_SIGN?(this._err(a.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(a.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Tt)))}[At](t){t===o.QUOTATION_MARK?this.state=Ct:t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentToken.systemId+=n.REPLACEMENT_CHARACTER):t===o.GREATER_THAN_SIGN?(this._err(a.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=p):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=Yt(t)}[St](t){t===o.APOSTROPHE?this.state=Ct:t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentToken.systemId+=n.REPLACEMENT_CHARACTER):t===o.GREATER_THAN_SIGN?(this._err(a.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=p):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=Yt(t)}[Ct](t){Wt(t)||(t===o.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=p):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(a.unexpectedCharacterAfterDoctypeSystemIdentifier),this._reconsumeInState(Tt)))}[Tt](t){t===o.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=p):t===o.NULL?this._err(a.unexpectedNullCharacter):t===o.EOF&&(this._emitCurrentToken(),this._emitEOFToken())}[kt](t){t===o.RIGHT_SQUARE_BRACKET?this.state=Dt:t===o.EOF?(this._err(a.eofInCdata),this._emitEOFToken()):this._emitCodePoint(t)}[Dt](t){t===o.RIGHT_SQUARE_BRACKET?this.state=Rt:(this._emitChars("]"),this._reconsumeInState(kt))}[Rt](t){t===o.GREATER_THAN_SIGN?this.state=p:t===o.RIGHT_SQUARE_BRACKET?this._emitChars("]"):(this._emitChars("]]"),this._reconsumeInState(kt))}[Ot](t){this.tempBuff=[o.AMPERSAND],t===o.NUMBER_SIGN?(this.tempBuff.push(t),this.state=Ft):qt(t)?this._reconsumeInState(It):(this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}[It](t){const e=this._matchNamedCharacterReference(t);if(this._ensureHibernation())this.tempBuff=[o.AMPERSAND];else if(e){const t=this.tempBuff[this.tempBuff.length-1]===o.SEMICOLON;this._isCharacterReferenceAttributeQuirk(t)||(t||this._errOnNextCodePoint(a.missingSemicolonAfterCharacterReference),this.tempBuff=e),this._flushCodePointsConsumedAsCharacterReference(),this.state=this.returnState}else this._flushCodePointsConsumedAsCharacterReference(),this.state=Nt}[Nt](t){qt(t)?this._isCharacterReferenceInAttribute()?this.currentAttr.value+=Yt(t):this._emitCodePoint(t):(t===o.SEMICOLON&&this._err(a.unknownNamedCharacterReference),this._reconsumeInState(this.returnState))}[Ft](t){this.charRefCode=0,t===o.LATIN_SMALL_X||t===o.LATIN_CAPITAL_X?(this.tempBuff.push(t),this.state=Bt):this._reconsumeInState(Pt)}[Bt](t){!function(t){return jt(t)||Xt(t)||Kt(t)}(t)?(this._err(a.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)):this._reconsumeInState(Lt)}[Pt](t){jt(t)?this._reconsumeInState(Ut):(this._err(a.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}[Lt](t){Xt(t)?this.charRefCode=16*this.charRefCode+t-55:Kt(t)?this.charRefCode=16*this.charRefCode+t-87:jt(t)?this.charRefCode=16*this.charRefCode+t-48:t===o.SEMICOLON?this.state=Mt:(this._err(a.missingSemicolonAfterCharacterReference),this._reconsumeInState(Mt))}[Ut](t){jt(t)?this.charRefCode=10*this.charRefCode+t-48:t===o.SEMICOLON?this.state=Mt:(this._err(a.missingSemicolonAfterCharacterReference),this._reconsumeInState(Mt))}[Mt](){if(this.charRefCode===o.NULL)this._err(a.nullCharacterReference),this.charRefCode=o.REPLACEMENT_CHARACTER;else if(this.charRefCode>1114111)this._err(a.characterReferenceOutsideUnicodeRange),this.charRefCode=o.REPLACEMENT_CHARACTER;else if(n.isSurrogate(this.charRefCode))this._err(a.surrogateCharacterReference),this.charRefCode=o.REPLACEMENT_CHARACTER;else if(n.isUndefinedCodePoint(this.charRefCode))this._err(a.noncharacterCharacterReference);else if(n.isControlCodePoint(this.charRefCode)||this.charRefCode===o.CARRIAGE_RETURN){this._err(a.controlCharacterReference);const t=h[this.charRefCode];t&&(this.charRefCode=t)}this.tempBuff=[this.charRefCode],this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)}}Qt.CHARACTER_TOKEN="CHARACTER_TOKEN",Qt.NULL_CHARACTER_TOKEN="NULL_CHARACTER_TOKEN",Qt.WHITESPACE_CHARACTER_TOKEN="WHITESPACE_CHARACTER_TOKEN",Qt.START_TAG_TOKEN="START_TAG_TOKEN",Qt.END_TAG_TOKEN="END_TAG_TOKEN",Qt.COMMENT_TOKEN="COMMENT_TOKEN",Qt.DOCTYPE_TOKEN="DOCTYPE_TOKEN",Qt.EOF_TOKEN="EOF_TOKEN",Qt.HIBERNATION_TOKEN="HIBERNATION_TOKEN",Qt.MODE={DATA:p,RCDATA:m,RAWTEXT:w,SCRIPT_DATA:g,PLAINTEXT:y},Qt.getTokenAttr=function(t,e){for(let r=t.attrs.length-1;r>=0;r--)if(t.attrs[r].name===e)return t.attrs[r].value;return null},t.exports=Qt},function(t,e,r){"use strict";const i=r(7),n=r(7).buildOptions,s=r(136),a={OPENING:1,CLOSING:2,SELF:3,CDATA:4};let o="<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|(([\\w:\\-._]*:)?([\\w:\\-._]+))([^>]*)>|((\\/)(([\\w:\\-._]*:)?([\\w:\\-._]+))\\s*>))([^<]*)";!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const u={attributeNamePrefix:"@_",attrNodeName:!1,textNodeName:"#text",ignoreAttributes:!0,ignoreNameSpace:!1,allowBooleanAttributes:!1,parseNodeValue:!0,parseAttributeValue:!1,arrayMode:!1,trimValues:!0,cdataTagName:!1,cdataPositionChar:"\\c",localeRange:"",tagValueProcessor:function(t,e){return t},attrValueProcessor:function(t,e){return t},stopNodes:[]};e.defaultOptions=u;const h=["attributeNamePrefix","attrNodeName","textNodeName","ignoreAttributes","ignoreNameSpace","allowBooleanAttributes","parseNodeValue","parseAttributeValue","arrayMode","trimValues","cdataTagName","cdataPositionChar","localeRange","tagValueProcessor","attrValueProcessor","parseTrueNumberOnly","stopNodes"];e.props=h;function c(t,e,r){const i=t[7]||r;let n=t[14];return n&&(e.trimValues&&(n=n.trim()),n=f(n=e.tagValueProcessor(n,i),e.parseNodeValue,e.parseTrueNumberOnly)),n}function l(t){return"]]>"===t[4]?a.CDATA:"/"===t[10]?a.CLOSING:void 0!==t[8]&&"/"===t[8].substr(t[8].length-1)?a.SELF:a.OPENING}function d(t,e){if(e.ignoreNameSpace){const e=t.split(":"),r="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=r+e[1])}return t}function f(t,e,r){if(e&&"string"==typeof t){let e;return""===t.trim()||isNaN(t)?e="true"===t||"false"!==t&&t:(-1!==t.indexOf("0x")?e=Number.parseInt(t,16):-1!==t.indexOf(".")?(e=Number.parseFloat(t),t=t.replace(/0+$/,"")):e=Number.parseInt(t,10),r&&(e=String(e)===t?e:t)),e}return i.isExist(t)?t:""}const p=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])(.*?)\\3)?","g");function m(t,e){if(!e.ignoreAttributes&&"string"==typeof t){t=t.replace(/\r?\n/g," ");const r=i.getAllMatches(t,p),n=r.length,s={};for(let t=0;t/g,"");const r=new s("!xml");let d=r;o=o.replace(/\[\\w/g,"["+e.localeRange+"\\w");const f=new RegExp(o,"g");let p=f.exec(t),w=f.exec(t);for(;p;){const r=l(p);if(r===a.CLOSING)d.parent&&p[14]&&(d.parent.val=i.getValue(d.parent.val)+""+c(p,e,d.parent.tagname)),e.stopNodes.length&&e.stopNodes.includes(d.tagname)&&(d.child=[],null==d.attrsMap&&(d.attrsMap={}),d.val=t.substr(d.startIndex+1,p.index-d.startIndex-1)),d=d.parent;else if(r===a.CDATA)if(e.cdataTagName){const t=new s(e.cdataTagName,d,p[3]);t.attrsMap=m(p[8],e),d.addChild(t),d.val=i.getValue(d.val)+e.cdataPositionChar,p[14]&&(d.val+=c(p,e))}else d.val=(d.val||"")+(p[3]||"")+c(p,e);else if(r===a.SELF){d&&p[14]&&(d.val=i.getValue(d.val)+""+c(p,e));const t=new s(e.ignoreNameSpace?p[7]:p[5],d,"");p[8]&&p[8].length>0&&(p[8]=p[8].substr(0,p[8].length-1)),t.attrsMap=m(p[8],e),d.addChild(t)}else{const t=new s(e.ignoreNameSpace?p[7]:p[5],d,c(p,e));e.stopNodes.length&&e.stopNodes.includes(t.tagname)&&(t.startIndex=p.index+p[1].length),t.attrsMap=m(p[8],e),d.addChild(t),d=t}p=w,w=f.exec(t)}return r}},function(t,e,r){"use strict";var i=r(15);t.exports=i.DEFAULT=new i({include:[r(21)],explicit:[r(158),r(159),r(160)]})},function(t,e,r){"use strict";(function(e){const i=r(170),n=r(47),s=r(23),a=r(16),o=r(17).BigNumber,u=r(24),h=r(12),c=h.MT,l=h.NUMBYTES,d=(h.SIMPLE,h.SYMS),f=new o(-1),p=f.minus(new o(Number.MAX_SAFE_INTEGER.toString(16),16)),m=Symbol("count"),w=(Symbol("pending_key"),Symbol("major type")),g=Symbol("error"),y=Symbol("not found");function b(t,e,r){const i=[];return i[m]=r,i[d.PARENT]=t,i[w]=e,i}function _(t,e){const r=new u;return r[m]=-1,r[d.PARENT]=t,r[w]=e,r}function v(t){return a.bufferToBigInt(t)}function E(t){return BigInt("-1")-a.bufferToBigInt(t)}class x extends i{constructor(t){const e=(t=t||{}).tags;delete t.tags;const r=null!=t.max_depth?t.max_depth:-1;delete t.max_depth;const i=!!a.hasBigInt&&!!t.bigint;delete t.bigint,super(t),this.running=!0,this.max_depth=r,this.tags=e,i&&(null==this.tags&&(this.tags={}),this.tags[2]=v,this.tags[3]=E)}static nullcheck(t){switch(t){case d.NULL:return null;case d.UNDEFINED:return;case y:throw new Error("Value not found");default:return t}}static decodeFirstSync(t,e){let r,i={};switch(typeof(e=e||{encoding:"hex"})){case"string":r=e;break;case"object":r=(i=a.extend({},e)).encoding,delete i.encoding}const n=new x(i),s=new u(t,null!=r?r:a.guessEncoding(t)),o=n._parse();let h=o.next();for(;!h.done;){const t=s.read(h.value);if(null==t||t.length!==h.value)throw new Error("Insufficient data");h=o.next(t)}return x.nullcheck(h.value)}static decodeAllSync(t,e){let r,i={};switch(typeof(e=e||{encoding:"hex"})){case"string":r=e;break;case"object":r=(i=a.extend({},e)).encoding,delete i.encoding}const n=new x(i),s=new u(t,null!=r?r:a.guessEncoding(t)),o=[];for(;s.length>0;){const t=n._parse();let e=t.next();for(;!e.done;){const r=s.read(e.value);if(null==r||r.length!==e.value)throw new Error("Insufficient data");e=t.next(r)}o.push(x.nullcheck(e.value))}return o}static decodeFirst(t,e,r){let i={},n=!1,s="hex";switch(typeof e){case"function":r=e,s=a.guessEncoding(t);break;case"string":s=e;break;case"object":s=null!=(i=a.extend({},e)).encoding?i.encoding:a.guessEncoding(t),delete i.encoding,n=null!=i.required&&i.required,delete i.required}const o=new x(i);let u,h=y;return o.on("data",t=>{h=x.nullcheck(t),o.close()}),"function"==typeof r?(o.once("error",t=>{const e=h;return h=g,o.close(),r(t,e)}),o.once("end",()=>{switch(h){case y:return n?r(new Error("No CBOR found")):r(null,h);case g:return;default:return r(null,h)}})):u=new Promise((t,e)=>(o.once("error",t=>(h=g,o.close(),e(t))),o.once("end",()=>{switch(h){case y:return n?e(new Error("No CBOR found")):t(h);case g:return;default:return t(h)}}))),o.end(t,s),u}static decodeAll(t,e,r){let i={},n="hex";switch(typeof e){case"function":r=e,n=a.guessEncoding(t);break;case"string":n=e;break;case"object":n=null!=(i=a.extend({},e)).encoding?i.encoding:a.guessEncoding(t),delete i.encoding}const s=new x(i);let o;const u=[];return s.on("data",t=>u.push(x.nullcheck(t))),"function"==typeof r?(s.on("error",r),s.on("end",()=>r(null,u))):o=new Promise((t,e)=>{s.on("error",e),s.on("end",()=>t(u))}),s.end(t,n),o}close(){this.running=!1,this.__fresh=!0}*_parse(){let t=null,r=0,i=null;for(;;){if(this.max_depth>=0&&r>this.max_depth)throw new Error("Maximum depth "+this.max_depth+" exceeded");const h=(yield 1)[0];if(!this.running)throw new Error("Unexpected data: 0x"+h.toString(16));const g=h>>5,y=31&h,v=null!=t?t[w]:void 0,E=null!=t?t.length:void 0;switch(y){case l.ONE:this.emit("more-bytes",g,1,v,E),i=(yield 1)[0];break;case l.TWO:case l.FOUR:case l.EIGHT:const t=1<=48&&t[s]<=57||t[s]>=65&&t[s]<=70||t[s]>=97&&t[s]<=102;)s++;if(0===s)return t;if(13!=t[s]||10!=t[s+1])return t;s+=2;var n=parseInt(i.decode(t.subarray(e,s)),16);if(0==n)break;t.set(t.subarray(s,s+n),r),r+=n,13==t[s+=n]&&10==t[s+1]&&(s+=2),e=s}return t.subarray(0,r)}(t))}catch(t){console.log("Chunk-Encoding Ignored: "+t)}try{if("br"===e)0===(t=n()(t)).length&&(t=i);else if("gzip"===e||"gzip"===r){const e=new s.Inflate;e.push(t,!0),e.result&&!e.err&&(t=e.result)}}catch(t){console.log("Content-Encoding Ignored: "+t)}return t}},function(t,e,r){"use strict";var i={};(0,r(8).assign)(i,r(118),r(121),r(70)),t.exports=i},function(t,e,r){"use strict";let{Json2Csv:i}=r(163),{Csv2Json:n}=r(166),s=r(46);function a(t,e,r,i){return s.convert({data:e,callback:r,options:i,converter:t})}function o(t,e,r){return new Promise((i,n)=>a(t,e,(t,e)=>t?n(t):i(e),r))}function u(t,e,r,i,n){return console.warn("WARNING: "+e+" is deprecated and will be removed soon. Please use "+r+" instead."),o(t,i,n)}t.exports={json2csv:(t,e,r)=>a(i,t,e,r),csv2json:(t,e,r)=>a(n,t,e,r),json2csvAsync:(t,e)=>o(i,t,e),csv2jsonAsync:(t,e)=>o(n,t,e),json2csvPromisified:(t,e)=>u(i,"json2csvPromisified()","json2csvAsync()",t,e),csv2jsonPromisified:(t,e)=>u(n,"csv2jsonPromisified()","csv2jsonAsync()",t,e)}},function(t,e,r){"use strict";var i,n="object"==typeof Reflect?Reflect:null,s=n&&"function"==typeof n.apply?n.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var u=10;function h(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function c(t,e,r,i){var n,s,a,o;if("function"!=typeof r)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r);if(void 0===(s=t._events)?(s=t._events=Object.create(null),t._eventsCount=0):(void 0!==s.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),a=s[e]),void 0===a)a=s[e]=r,++t._eventsCount;else if("function"==typeof a?a=s[e]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),(n=h(t))>0&&a.length>n&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,o=u,console&&console.warn&&console.warn(o)}return t}function l(){for(var t=[],e=0;e0&&(a=e[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var u=n[t];if(void 0===u)return!1;if("function"==typeof u)s(u,this,e);else{var h=u.length,c=m(u,h);for(r=0;r=0;s--)if(r[s]===e||r[s].listener===e){a=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},o.prototype.listeners=function(t){return f(this,t,!0)},o.prototype.rawListeners=function(t){return f(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,r){(e=t.exports=r(52)).Stream=e,e.Readable=e,e.Writable=r(38),e.Duplex=r(10),e.Transform=r(59),e.PassThrough=r(97)},function(t,e,r){"use strict";(function(e,i,n){var s=r(26);function a(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=y;var o,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?i:s.nextTick;y.WritableState=g;var h=r(18);h.inherits=r(9);var c={deprecate:r(96)},l=r(54),d=r(27).Buffer,f=n.Uint8Array||function(){};var p,m=r(56);function w(){}function g(t,e){o=o||r(10),t=t||{};var i=e instanceof o;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,h=t.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(h||0===h)?h:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===t.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(s.nextTick(n,i),s.nextTick(A,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(n(i),t._writableState.errorEmitted=!0,t.emit("error",i),A(t,e))}(t,r,i,e,n);else{var a=E(r);a||r.corked||r.bufferProcessing||!r.bufferedRequest||v(t,r),i?u(_,t,r,a,n):_(t,r,a,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function y(t){if(o=o||r(10),!(p.call(y,this)||this instanceof o))return new y(t);this._writableState=new g(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),l.call(this)}function b(t,e,r,i,n,s,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function _(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),A(t,e)}function v(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),s=e.corkedRequestsFree;s.entry=r;for(var o=0,u=!0;r;)n[o]=r,r.isBuf||(u=!1),r=r.next,o+=1;n.allBuffers=u,b(t,e,!0,e.length,n,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new a(e),e.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,c=r.encoding,l=r.callback;if(b(t,e,!1,e.objectMode?1:h.length,h,c,l),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function E(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function x(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),A(t,e)}))}function A(t,e){var r=E(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,s.nextTick(x,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}h.inherits(y,l),g.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(g.prototype,"buffer",{get:c.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===y&&(t&&t._writableState instanceof g)}})):p=function(t){return t instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(t,e,r){var i,n=this._writableState,a=!1,o=!n.objectMode&&(i=t,d.isBuffer(i)||i instanceof f);return o&&!d.isBuffer(t)&&(t=function(t){return d.from(t)}(t)),"function"==typeof e&&(r=e,e=null),o?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=w),n.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),s.nextTick(e,r)}(this,r):(o||function(t,e,r,i){var n=!0,a=!1;return null===r?a=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),s.nextTick(i,a),n=!1),n}(this,n,t,r))&&(n.pendingcb++,a=function(t,e,r,i,n,s){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=d.from(e,r));return e}(e,i,n);i!==a&&(r=!0,n="buffer",i=a)}var o=e.objectMode?1:i.length;e.length+=o;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(t,e,r){var i=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(t,e,r){e.ending=!0,A(t,e),r&&(e.finished?s.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),y.prototype.destroy=m.destroy,y.prototype._undestroy=m.undestroy,y.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(13),r(57).setImmediate,r(6))},function(t,e,r){"use strict";const i=[65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];e.REPLACEMENT_CHARACTER="�",e.CODE_POINTS={EOF:-1,NULL:0,TABULATION:9,CARRIAGE_RETURN:13,LINE_FEED:10,FORM_FEED:12,SPACE:32,EXCLAMATION_MARK:33,QUOTATION_MARK:34,NUMBER_SIGN:35,AMPERSAND:38,APOSTROPHE:39,HYPHEN_MINUS:45,SOLIDUS:47,DIGIT_0:48,DIGIT_9:57,SEMICOLON:59,LESS_THAN_SIGN:60,EQUALS_SIGN:61,GREATER_THAN_SIGN:62,QUESTION_MARK:63,LATIN_CAPITAL_A:65,LATIN_CAPITAL_F:70,LATIN_CAPITAL_X:88,LATIN_CAPITAL_Z:90,RIGHT_SQUARE_BRACKET:93,GRAVE_ACCENT:96,LATIN_SMALL_A:97,LATIN_SMALL_F:102,LATIN_SMALL_X:120,LATIN_SMALL_Z:122,REPLACEMENT_CHARACTER:65533},e.CODE_POINT_SEQUENCES={DASH_DASH_STRING:[45,45],DOCTYPE_STRING:[68,79,67,84,89,80,69],CDATA_START_STRING:[91,67,68,65,84,65,91],SCRIPT_STRING:[115,99,114,105,112,116],PUBLIC_STRING:[80,85,66,76,73,67],SYSTEM_STRING:[83,89,83,84,69,77]},e.isSurrogate=function(t){return t>=55296&&t<=57343},e.isSurrogatePair=function(t){return t>=56320&&t<=57343},e.getSurrogatePairCodePoint=function(t,e){return 1024*(t-55296)+9216+e},e.isControlCodePoint=function(t){return 32!==t&&10!==t&&13!==t&&9!==t&&12!==t&&t>=1&&t<=31||t>=127&&t<=159},e.isUndefinedCodePoint=function(t){return t>=64976&&t<=65007||i.indexOf(t)>-1}},function(t,e,r){"use strict";class i{constructor(t){const e={},r=this._getOverriddenMethods(this,e);for(const i of Object.keys(r))"function"==typeof r[i]&&(e[i]=t[i],t[i]=r[i])}_getOverriddenMethods(){throw new Error("Not implemented")}}i.install=function(t,e,r){t.__mixins||(t.__mixins=[]);for(let r=0;r=0?e:void 0),remainingKeyPath:t.slice(e+1)}}t.exports={evaluatePath:function t(e,r){if(!e)return null;let{indexOfDot:n,currentKey:s,remainingKeyPath:a}=i(r);if(n>=0&&!e[r])return Array.isArray(e[s])?e[s].map(e=>t(e,a)):t(e[s],a);if(Array.isArray(e))return e.map(e=>t(e,r));return e[r]},setPath:function t(e,r,n){if(!e)throw new Error("No document was provided.");let{indexOfDot:s,currentKey:a,remainingKeyPath:o}=i(r);if(s>=0){if(!e[a]&&Array.isArray(e))return e.forEach(e=>t(e,r,n));e[a]||(e[a]={}),t(e[a],o,n)}else{if(Array.isArray(e))return e.forEach(e=>t(e,o,n));e[r]=n}return e}}},function(t){t.exports=JSON.parse('{"errors":{"callbackRequired":"A callback is required!","optionsRequired":"Options were not passed and are required.","json2csv":{"cannotCallOn":"Cannot call json2csv on ","dataCheckFailure":"Data provided was not an array of documents.","notSameSchema":"Not all documents have the same schema."},"csv2json":{"cannotCallOn":"Cannot call csv2json on ","dataCheckFailure":"CSV is not a string."}},"defaultOptions":{"delimiter":{"field":",","wrap":"\\"","eol":"\\n"},"excelBOM":false,"prependHeader":true,"trimHeaderFields":false,"trimFieldValues":false,"sortHeader":false,"parseCsvNumbers":false,"keys":null,"checkSchemaDifferences":false,"expandArrayObjects":false,"unwindArrays":false,"useLocaleFormat":false},"values":{"excelBOM":"\ufeff"}}')},function(t,e,r){"use strict";let i=r(44),n=r(45);const s=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/;function a(t){return JSON.parse(JSON.stringify(t))}function o(t){return c(t)||h(t)||""===t}function u(t){return"object"==typeof t}function h(t){return null===t}function c(t){return void 0===t}function l(t,e){return t.filter(t=>!e.includes(t))}t.exports={isStringRepresentation:function(t,e){const r=t[0],i=t.length-1,n=t[i];return r===e.delimiter.wrap&&n===e.delimiter.wrap},isDateRepresentation:function(t){return s.test(t)},computeSchemaDifferences:function(t,e){return l(t,e).concat(l(e,t))},deepCopy:a,convert:function(t){let{options:e,callback:r}=function(t,e){if(u(t)&&(r=t,"function"!=typeof r))return{options:t,callback:e};var r;return{options:e,callback:t}}(t.callback,t.options);i=e,(i={...n.defaultOptions,...i||{}}).delimiter={...n.defaultOptions.delimiter,...i.delimiter},e=i;var i;let s=new t.converter(e);(function(t){if(!t.callback)throw new Error(n.errors.callbackRequired);if(!t.data)return t.callback(new Error(t.errorMessages.cannotCallOn+t.data+".")),!1;if(!t.dataCheckFn(t.data))return t.callback(new Error(t.errorMessages.dataCheckFailure)),!1;return!0})({data:t.data,callback:r,errorMessages:s.validationMessages,dataCheckFn:s.validationFn})&&s.convert(t.data,r)},isEmptyField:o,removeEmptyFields:function(t){return t.filter(t=>!o(t))},getNCharacters:function(t,e,r){return t.substring(e,e+r)},unwind:function(t,e){const r=[];return t.forEach(t=>{!function(t,e,r){const n=i.evaluatePath(e,r);let s=a(e);Array.isArray(n)?n.forEach(n=>{s=a(e),t.push(i.setPath(s,r,n))}):t.push(s)}(r,t,e)}),r},isInvalid:function(t){return t===1/0||t===-1/0},isString:function(t){return"string"==typeof t},isNull:h,isError:function(t){return"[object Error]"===Object.prototype.toString.call(t)},isDate:function(t){return t instanceof Date},isUndefined:c,isObject:u,unique:function(t){return[...new Set(t)]},flatten:function(t){return[].concat(...t)}}},function(t,e,r){"use strict";const i=r(17).BigNumber,n=r(16),s=r(48),a=new i(-1),o=new i(10),u=new i(2);class h{constructor(t,e,r){if(this.tag=t,this.value=e,this.err=r,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(t){return t._pushTag(this.tag),t.pushAny(this.value)}convert(t){let e=null!=t?t[this.tag]:void 0;if("function"!=typeof e&&"function"!=typeof(e=h["_tag_"+this.tag]))return this;try{return e.call(h,this.value)}catch(t){return this.err=t,this}}static _tag_0(t){return new Date(t)}static _tag_1(t){return new Date(1e3*t)}static _tag_2(t){return n.bufferToBignumber(t)}static _tag_3(t){return a.minus(n.bufferToBignumber(t))}static _tag_4(t){return o.pow(t[0]).times(t[1])}static _tag_5(t){return u.pow(t[0]).times(t[1])}static _tag_32(t){return s.parse(t)}static _tag_35(t){return new RegExp(t)}}t.exports=h},function(t,e,r){"use strict";var i=r(171),n=r(173);function s(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=b,e.resolve=function(t,e){return b(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?b(t,!1,!0).resolveObject(e):e},e.format=function(t){n.isString(t)&&(t=b(t));return t instanceof s?t.format():s.prototype.format.call(t)},e.Url=s;var a=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,h=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(h),l=["%","/","?",";","#"].concat(c),d=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=r(174);function b(t,e,r){if(t&&n.isObject(t)&&t instanceof s)return t;var i=new s;return i.parse(t,e,r),i}s.prototype.parse=function(t,e,r){if(!n.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var s=t.indexOf("?"),o=-1!==s&&s127?N+="x":N+=I[F];if(!N.match(f)){var P=R.slice(0,T),L=R.slice(T+1),U=I.match(p);U&&(P.push(U[1]),L.unshift(U[2])),L.length&&(b="/"+L.join(".")+b),this.hostname=P.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),D||(this.hostname=i.toASCII(this.hostname));var M=this.port?":"+this.port:"",W=this.hostname||"";this.host=W+M,this.href+=this.host,D&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[E])for(T=0,O=c.length;T0)&&r.host.split("@"))&&(r.auth=D.shift(),r.host=r.hostname=D.shift());return r.search=t.search,r.query=t.query,n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!x.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var S=x.slice(-1)[0],C=(r.host||t.host||x.length>1)&&("."===S||".."===S)||""===S,T=0,k=x.length;k>=0;k--)"."===(S=x[k])?x.splice(k,1):".."===S?(x.splice(k,1),T++):T&&(x.splice(k,1),T--);if(!v&&!E)for(;T--;T)x.unshift("..");!v||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),C&&"/"!==x.join("/").substr(-1)&&x.push("");var D,R=""===x[0]||x[0]&&"/"===x[0].charAt(0);A&&(r.hostname=r.host=R?"":x.length?x.shift():"",(D=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=D.shift(),r.host=r.hostname=D.shift()));return(v=v||r.host&&x.length)&&!R&&x.unshift(""),x.length?r.pathname=x.join("/"):(r.pathname=null,r.path=null),n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},s.prototype.parseHost=function(){var t=this.host,e=o.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,r){"use strict";const{Transform:i}=r(4),n=r(28),s=r(104),a=r(40),o=r(61),u=r(106),h=r(107),c={sourceCodeLocationInfo:!1};const l={[n.START_TAG_TOKEN]:{eventName:"startTag",reshapeToken:t=>({tagName:t.tagName,attrs:t.attrs,selfClosing:t.selfClosing,sourceCodeLocation:t.location})},[n.END_TAG_TOKEN]:{eventName:"endTag",reshapeToken:t=>({tagName:t.tagName,sourceCodeLocation:t.location})},[n.COMMENT_TOKEN]:{eventName:"comment",reshapeToken:t=>({text:t.data,sourceCodeLocation:t.location})},[n.DOCTYPE_TOKEN]:{eventName:"doctype",reshapeToken:t=>({name:t.name,publicId:t.publicId,systemId:t.systemId,sourceCodeLocation:t.location})},[n.CHARACTER_TOKEN]:{eventName:"text",reshapeToken:t=>({text:t.chars,sourceCodeLocation:t.location})}};t.exports=class extends i{constructor(t){super({encoding:"utf8",decodeStrings:!1}),this.options=o(c,t),this.tokenizer=new n(t),this.locInfoMixin=null,this.options.sourceCodeLocationInfo&&(this.locInfoMixin=a.install(this.tokenizer,s)),this.parserFeedbackSimulator=new h(this.tokenizer),this.pendingText=null,this.lastChunkWritten=!1,this.stopped=!1,this.pipe(new u)}_transform(t,e,r){if("string"!=typeof t)throw new TypeError("Parser can work only with string streams.");r(null,this._transformChunk(t))}_final(t){this.lastChunkWritten=!0,t(null,this._transformChunk(""))}stop(){this.stopped=!0}_transformChunk(t){return this.stopped||(this.tokenizer.write(t,this.lastChunkWritten),this._runParsingLoop()),t}_runParsingLoop(){let t=null;do{if((t=this.parserFeedbackSimulator.getNextToken()).type===n.HIBERNATION_TOKEN)break;if(t.type===n.CHARACTER_TOKEN||t.type===n.WHITESPACE_CHARACTER_TOKEN||t.type===n.NULL_CHARACTER_TOKEN){if(null===this.pendingText)t.type=n.CHARACTER_TOKEN,this.pendingText=t;else if(this.pendingText.chars+=t.chars,this.options.sourceCodeLocationInfo){const{endLine:e,endCol:r,endOffset:i}=t.location;Object.assign(this.pendingText.location,{endLine:e,endCol:r,endOffset:i})}}else this._emitPendingText(),this._handleToken(t)}while(!this.stopped&&t.type!==n.EOF_TOKEN)}_handleToken(t){if(t.type===n.EOF_TOKEN)return!0;const{eventName:e,reshapeToken:r}=l[t.type];return 0!==this.listenerCount(e)&&(this._emitToken(e,r(t)),!0)}_emitToken(t,e){this.emit(t,e)}_emitPendingText(){null!==this.pendingText&&(this._handleToken(this.pendingText),this.pendingText=null)}}},function(t,e,r){"use strict";r.r(e);const i=(t,e)=>e.some(e=>t instanceof e);let n,s;const a=new WeakMap,o=new WeakMap,u=new WeakMap,h=new WeakMap,c=new WeakMap;let l={get(t,e,r){if(t instanceof IDBTransaction){if("done"===e)return o.get(t);if("objectStoreNames"===e)return t.objectStoreNames||u.get(t);if("store"===e)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return m(t[e])},set:(t,e,r)=>(t[e]=r,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function d(t){l=t(l)}function f(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(s||(s=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(w(this),e),m(a.get(this))}:function(...e){return m(t.apply(w(this),e))}:function(e,...r){const i=t.call(w(this),e,...r);return u.set(i,e.sort?e.sort():[e]),m(i)}}function p(t){return"function"==typeof t?f(t):(t instanceof IDBTransaction&&function(t){if(o.has(t))return;const e=new Promise((e,r)=>{const i=()=>{t.removeEventListener("complete",n),t.removeEventListener("error",s),t.removeEventListener("abort",s)},n=()=>{e(),i()},s=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",n),t.addEventListener("error",s),t.addEventListener("abort",s)});o.set(t,e)}(t),i(t,n||(n=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,l):t)}function m(t){if(t instanceof IDBRequest)return function(t){const e=new Promise((e,r)=>{const i=()=>{t.removeEventListener("success",n),t.removeEventListener("error",s)},n=()=>{e(m(t.result)),i()},s=()=>{r(t.error),i()};t.addEventListener("success",n),t.addEventListener("error",s)});return e.then(e=>{e instanceof IDBCursor&&a.set(e,t)}).catch(()=>{}),c.set(e,t),e}(t);if(h.has(t))return h.get(t);const e=p(t);return e!==t&&(h.set(t,e),c.set(e,t)),e}const w=t=>c.get(t);function g(t,e,{blocked:r,upgrade:i,blocking:n,terminated:s}={}){const a=indexedDB.open(t,e),o=m(a);return i&&a.addEventListener("upgradeneeded",t=>{i(m(a.result),t.oldVersion,t.newVersion,m(a.transaction))}),r&&a.addEventListener("blocked",()=>r()),s&&a.addEventListener("close",()=>s()),n&&o.then(t=>t.addEventListener("versionchange",n)).catch(()=>{}),o}function y(t,{blocked:e}={}){const r=indexedDB.deleteDatabase(t);return e&&r.addEventListener("blocked",()=>e()),m(r).then(()=>void 0)}const b=["get","getKey","getAll","getAllKeys","count"],_=["put","add","delete","clear"],v=new Map;function E(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(v.get(e))return v.get(e);const r=e.replace(/FromIndex$/,""),i=e!==r,n=_.includes(r);if(!(r in(i?IDBIndex:IDBObjectStore).prototype)||!n&&!b.includes(r))return;const s=async function(t,...e){const s=this.transaction(t,n?"readwrite":"readonly");let a=s.store;i&&(a=a.index(e.shift()));const o=a[r](...e);return n&&await s.done,o};return v.set(e,s),s}d(t=>({...t,get:(e,r,i)=>E(e,r)||t.get(e,r,i),has:(e,r)=>!!E(e,r)||t.has(e,r)}));const x=["continue","continuePrimaryKey","advance"],A={},S=new WeakMap,C=new WeakMap,T={get(t,e){if(!x.includes(e))return t[e];let r=A[e];return r||(r=A[e]=function(...t){S.set(this,C.get(this)[e](...t))}),r}};async function*k(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const r=new Proxy(e,T);for(C.set(r,e),c.set(r,w(e));e;)yield r,e=await(S.get(r)||e.continue()),S.delete(r)}function D(t,e){return e===Symbol.asyncIterator&&i(t,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===e&&i(t,[IDBIndex,IDBObjectStore])}d(t=>({...t,get:(e,r,i)=>D(e,r)?k:t.get(e,r,i),has:(e,r)=>D(e,r)||t.has(e,r)}));var R=r(0);const O=[{match:/[?&](_|cb|_ga|\w*cache\w*)=[\d.-]+(?=$|&)/i,replace:""},{match:/([?&])utm_[^=]+=[^&]+(?=&|$)/g,replace:""},{match:/[?&](callback=jsonp)[^&]+(?=&|$)/i,replace:""},{match:/[?&]((?:\w+)=jquery)[\d]+_[\d]+/i,replace:""},{match:/\/\/.*(?:gcs-vimeo|vod|vod-progressive)\.akamaized\.net.*(\/[\d]+)\/[\d]+(.mp4)/,replace:"//video.vimeo.net$1$2",split:".net",last:!0},{match:/\/\/.*(player.vimeo.com\/video\/[\d]+)\?.*/i,replace:"$1"},{match:/(\.(?:php|js|webm|mp4))\?.*/i,replace:"$1"},{match:/(www\.)?youtube(-nocookie)?\.com\/get_video_info/i,args:[["video_id","html5"]]},{match:/\/\/.*(googlevideo.com\/videoplayback)/i,replace:"server.$1",args:[["id","itag"],["id"]]},{match:/facebook\.com\/ajax\/pagelet\/generic.php\/photoviewerinitpagelet/i,args:[[{arg:"data",keys:["query_type","fbid","v","cursor","data"]}]]},{match:/facebook\.com\/videos\/vodcomments/i,args:[["eft_id"]]},{match:/facebook\.com\/ajax\.*/i,replaceQuery:/([?&][^_]\w+=[^&]+)/g},{match:/plus\.googleapis\.com\/u\/\/0\/_\/widget\/render\/comments/i,args:[["href","stream_id","substream_id"]]}];function I(t,e,r){if(!(r&&r.rule&&r.rule.replace&&r.rule.split))return function(t,e,r){try{t=new URL(t)}catch(t){return 0}let i=0,n=null;const s=new URLSearchParams(t.search);for(const t of e){let e="string"==typeof t?t:t.url;try{e=new URL(e)}catch(t){continue}const r=new URLSearchParams(e.search);let a=N(s,r);a+=N(r,s),(a/=2)>i&&(i=a,n=t)}return{score:i,result:n}}(t,e);const i=r.fuzzyUrl.endsWith("?")?r.fuzzyUrl.slice(0,-1):r.fuzzyUrl,n=r.rule.match,s=r.rule.replace;for(const t of e){if(i===("string"==typeof t?t:t.url).replace(n,s))return{score:1,result:t}}return{score:0,result:null}}function N(t,e){let r=1,i=1;for(const[n,s]of t){const t=e.get(n);let a;"_"===n[0]?(i+=1,r+=1,a=1):a=10,i+=a,t===s?r+=a:null===t?r-=1:t.length>s.length&&t.indexOf(",")>=0&&t.indexOf(s)>=0&&(r+=.8*a)}return r/i}const F=new class{constructor(t){this.rules=t||O}*fuzzyUrls(t,e=!1){const r=t;function i(t,i){if(!e)return t;const n=i.split||"?",s=r.indexOf(n);return[t,{prefix:s>0?r.slice(0,s+n.length):r,rule:i,fuzzyUrl:t}]}-1===t.indexOf("?")&&(t+="?");for(const e of this.rules){if(t.match(e.match))if(void 0===e.args&&void 0!==e.replace){const r=t.replace(e.match,e.replace);if(r!=t&&(yield i(r,e),t=r),e.last)break}else{if(void 0!==e.args){void 0!==e.replace&&(t=t.replace(e.match,e.replace));for(let r of e.args){const n=this.getQueryUrl(t,r);t!=n&&(yield i(n,e))}break}if(e.replaceQuery){const r=t.match(e.replaceQuery),n=this.getQueryUrl(t,r?r.join(""):"");n!=t&&(yield i(n,e));break}}}}getQueryUrl(t,e){try{t=new URL(t)}catch(t){return null}if("string"==typeof e)return t.search=e,t.toString();const r=new URLSearchParams(t.search),i=new URLSearchParams;for(const t of e)if("string"==typeof t){const e=r.get(t);e&&i.set(t,e)}else"object"==typeof t&&this.setQueryJsonArg(r,i,t);return t.search="?"+i.toString(),t.toString()}setQueryJsonArg(t,e,r){let i;try{i=t.get(r.arg),i=JSON.parse(i)}catch(t){return void console.log("JSON parse error: "+i)}let n={};for(const t of r.keys){const e=i[t];null!=e&&(n[t]=e)}e.set(r.arg,JSON.stringify(n))}};var B=r(86),P=r(5);class L{constructor(t,e={}){this.name=t,this.db=null;const{minDedupSize:r}=e;this.minDedupSize=Number.isInteger(r)?r:1024,this.version=1,this.useRefCounts=!0,this.allowRepeats=!0,this.repeatTracker=this.allowRepeats?new U:null,this.fuzzyPrefixSearch=!0,this.initing=this.init()}async init(){this.db=await g(this.name,this.version,{upgrade:(t,e,r,i)=>this._initDB(t,e,r,i),blocking:t=>{t&&null!==t.newVersion||this.close()}})}_initDB(t,e,r,i){if(!e){const e=t.createObjectStore("pages",{keyPath:"id"});e.createIndex("url","url"),e.createIndex("ts","ts");t.createObjectStore("pageLists",{keyPath:"id",autoIncrement:!0});t.createObjectStore("curatedPages",{keyPath:"id",autoIncrement:!0}).createIndex("listPages",["list","pos"]);const r=t.createObjectStore("resources",{keyPath:["url","ts"]});r.createIndex("pageId","pageId"),r.createIndex("mimeStatusUrl",["mime","status","url"]);t.createObjectStore("payload",{keyPath:"digest",unique:!0}),t.createObjectStore("digestRef",{keyPath:"digest",unique:!0})}}async clearAll(){const t=["pages","resources","payload","digestRef"];for(const e of t)await this.db.clear(e)}close(){this.db&&(this.db.close(),this.db=null)}async delete(){this.close(),await y(this.name,{blocked(t){console.log("Unable to delete: "+t)}})}async addPage(t,e){const r=t.url,i=t.title||t.url,n=t.id||this.newPageId();let s=t.ts;s||!t.date&&!t.datetime||(s=new Date(t.date||t.datetime).getTime());const a={...t,url:r,ts:s,title:i,id:n};return e?(e.store.put(a),a.id):await this.db.put("pages",a)}async addPages(t){const e=this.db.transaction("pages","readwrite");for(const e of t)this.addPage(e);try{await e.done}catch(t){console.warn("addPages tx",t.toString())}}async addCPageList(t){const e={};return e.title=t.title,e.desc=t.desc,e.slug=t.slug,await this.db.put("pageLists",e)}async addCuratedPageLists(t,e="pages",r="public"){for(const i of t){if(r&&!i[r])continue;const t=await this.addCPageList(i),n=this.db.transaction("curatedPages","readwrite");let s=0;const a=i[e]||[];for(const e of a){const r={};r.pos=s++,r.list=t;const i=typeof e.page;r.page="string"===i?e.page:"object"===i?e.page.id:e.page_id||e.pageId,r.desc=e.desc,n.store.put(r)}try{await n.done}catch(t){console.warn("addCuratedPageLists tx",t.toString())}}}async getAllCuratedByList(){const t=await this.db.getAll("pageLists"),e=this.db.transaction("curatedPages","readonly");for await(const r of e.store.index("listPages").iterate()){const e=t[r.value.list-1];e&&(e.show=!0,e.pages||(e.pages=[]),e.pages.push(r.value))}return t}newPageId(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}async getAllPages(){return await this.db.getAll("pages")}async getPages(t){const e=[];t.sort();for await(const r of this.matchAny("pages",null,t))e.push(r);return e}async dedupResource(t,e,r){const i=r.objectStore("digestRef"),n=!!t&&await i.get(t);let s=!0;if(n)++n.count,i.put(n),s=!1;else try{r.objectStore("payload").add({digest:t,payload:e});const n=1,s=e.length;i.put({digest:t,count:n,size:s})}catch(t){console.log(t)}return s}async addResources(t){const e=[],r=[];let i=this.db.transaction(["digestRef","payload"],"readwrite");for(const n of t)"warc/revisit"===n.mime?e.push(n):r.push(n),this.useRefCounts&&n.digest&&n.payload&&(await this.dedupResource(n.digest,n.payload,i),delete n.payload);try{await i.done}catch(t){console.log("Payload Bulk Add Failed: "+t)}const n=this.db.transaction("resources","readwrite");for(const t of e)n.store.put(t);for(const t of r)n.store.put(t),this._addUrlFuzzy(t,n);await n.done}async _addUrlFuzzy(t,e){if(t.status>=200&&t.status<300&&204!=t.status)for await(const r of F.fuzzyUrls(t.url)){if(r===t.url)continue;const i={url:r,ts:t.ts,origURL:t.url,origTS:t.ts,pageId:t.pageId,digest:t.digest};e.store.put(i)}}async addResource(t){let e=!1;if(t.payload&&t.payload.length>this.minDedupSize){t.digest||(t.digest=await Object(R.d)(t.payload,"sha-256"));const r=this.db.transaction(["digestRef","payload"],"readwrite");e=await this.dedupResource(t.digest,t.payload,r);try{await r.done}catch(t){console.log("Payload Add Failed: "+t)}delete t.payload}if("warc/revisit"===t.mime){try{await this.db.add("resources",t)}catch(e){console.log("Skip Duplicate revisit for: "+t.url)}return e}const r=this.db.transaction("resources","readwrite");r.store.put(t),this._addUrlFuzzy(t,r);try{await r.done}catch(e){console.log("Fuzzy Add Error for "+t.url),console.log(e)}return e}async getResource(t,e,r){const i=Object(R.l)(t.timestamp).getTime();let n=t.url,s=null;const a={skip:this.repeatTracker?this.repeatTracker.getSkipCount(r,n,t.request.method):0};if(n.startsWith("//")){let e=!1;(s=await this.lookupUrl("https:"+n,i,a))||((s=await this.lookupUrl("http:"+n,i,a))||t.request.referrer.indexOf("/http://",2)>0)&&(e=!0),n=(e?"http:":"https:")+n}else s=await this.lookupUrl(n,i,a);let o;if(!s)for await(const[t,e]of F.fuzzyUrls(n,!0)){if(s=await this.lookupUrl(t))break;o=e}if(!s&&o&&this.fuzzyPrefixSearch&&(s=await this.lookupQueryPrefix(n,o)),s&&s.origURL){const t=await this.lookupUrl(s.origURL,s.origTS||s.ts);t&&(n=t.url,s=t)}if(!s)return null;const u=s.status,h=s.statusText||Object(B.getStatusText)(u),c=Object(R.h)(u)?null:await this.loadPayload(s),l=Object(R.i)(s.respHeaders),d=new Date(s.ts),f=s.extraOpts||null;return new P.a({url:n,payload:c,status:u,statusText:h,headers:l,date:d,extraOpts:f})}async loadPayload(t){if(t.digest&&!t.payload){const e=await this.db.get("payload",t.digest);if(!e)return null;const{payload:r}=e;return r}return t.payload}async lookupUrl(t,e,r={}){const i=this.db.transaction("resources","readonly");if(e){const r=await i.store.get([t,e]);if(r)return r}let n=null,s=r.skip||0;for await(const r of i.store.iterate(this.getLookupRange(t))){if(n&&r.value.ts>e){if(0==s){return r.value.ts-ee?++a:n?(yield s.value,s=await s.continue()):s=await s.continue(r[a])}}async resourcesByUrlAndMime(t,e,r=1e3,i=!0,n="",s=""){const a=e?null:r,o=await this.db.getAll("resources",this.getLookupRange(t,i?"prefix":"exact",n,s),a);e=e.split(",");const u=[];for(const t of o)for(const i of e)if(!i||t.mime&&t.mime.startsWith(i)){if(u.push(this.resJson(t)),u.length===r)return u;break}return u}async resourcesByMime(t,e=100,r="",i=""){const n=[];(t=t.split(",")).sort();let s=[];for(const e of t)r&&e=1?a.put(r):(n+=r?r.size:0,a.delete(t),s.objectStore("payload").delete(t))}return await s.done,n}getLookupRange(t,e,r,i){let n,s,a;switch(e){case"prefix":s=t.slice(0,-1)+String.fromCharCode(t.charCodeAt(t.length-1)+1),n=[t],s=[s];break;case"host":const e=new URL(t).origin;n=[e+"/"],s=[e+"0"];break;case"exact":default:n=[t],s=[t+"!"]}return r?(n=[r,i||""],a=!0):a=!1,IDBKeyRange.bound(n,s,a,!0)}}class U{constructor(){this.repeats={}}getSkipCount(t,e,r){if("POST"!==r)return 0;t.replacesClientId&&delete this.repeats[t.replacesClientId];const i=t.resultingClientId||t.clientId;return i?(void 0===this.repeats[i]&&(this.repeats[i]={}),void 0===this.repeats[i][e]?this.repeats[i][e]=0:this.repeats[i][e]++,this.repeats[i][e]):0}}var M=r(1),W=r(49),j=r.n(W),z=r(4),H=r(33);const G=["script","style","header","footer","banner-div","noscript"];const q=1e3;class X{constructor(t,e=null,r=null){this.reader=t,this.abort=e,this.loadId=r,this.anyPages=!1,this.detectPages=!1,this._lastRecord=null,this.promises=[],this.metadata={},this.batch=[],this.count=0,this.pageMap={},this.pages=[],this.lists=[]}parseWarcInfo(t){if(!t.payload)return;const e=new TextDecoder("utf-8").decode(t.payload);for(const t of e.split("\n"))if(t.startsWith("json-metadata:"))try{const e=JSON.parse(t.slice("json-metadata:".length));if("collection"===e.type&&(this.metadata.desc=e.desc,this.metadata.title=e.title),e.pages&&e.pages.length){this.pages=this.pages.concat(e.pages);for(const t of e.pages)t.ts=Object(R.l)(t.timestamp).getTime(),this.pageMap[t.ts+"/"+t.url]={page:t};this.anyPages=!0}e.lists&&e.lists.length&&(this.lists=this.lists.concat(e.lists))}catch(t){console.log("Page Add Error",t.toString())}}addPage(t){this.promises.push(this.db.addPage(t))}addResource(t){this.batch.length>=q&&(this.promises.push(this.db.addResources(this.batch)),this.batch=[],console.log(`Read ${this.count+=q} records`)),this.batch.push(t)}index(t){if("warcinfo"!==t.warcType){if(this._lastRecord)return this._lastRecord.warcTargetURI!=t.warcTargetURI?(this.indexReqResponse(this._lastRecord,null),void(this._lastRecord=t)):void("request"===t.warcType&&"response"===this._lastRecord.warcType?(this.indexReqResponse(this._lastRecord,t),this._lastRecord=null):"response"===t.warcType&&"request"===this._lastRecord.warcType?(this.indexReqResponse(t,this._lastRecord),this._lastRecord=null):(this.indexReqResponse(this._lastRecord,null),this._lastRecord=t));this._lastRecord=t}else this.parseWarcInfo(t)}indexDone(){this._lastRecord&&(this.indexReqResponse(this._lastRecord),this._lastRecord=null)}shouldIndexMetadataRecord(t){const e=t.warcTargetURI;return!(!e||!e.startsWith("metadata://"))}parseRevisitRecord(t){const e=t.warcTargetURI.split("#")[0],r=(t.warcDate,new Date(t.warcDate).getTime()),i=t.warcRefersToTargetURI,n=new Date(t.warcRefersToDate).getTime();return i===e&&n===r?null:{url:e,ts:r,origURL:i,origTS:n,digest:t.warcPayloadDigest,pageId:null}}indexReqResponse(t,e){const r=this.parseRecords(t,e);r&&this.addResource(r)}parseRecords(t,e){switch(t.warcType){case"revisit":return this.parseRevisitRecord(t);case"resource":e=null;break;case"response":break;case"metadata":if(!this.shouldIndexMetadataRecord(t))return null;break;default:return null}const r=t.warcTargetURI.split("#")[0],i=t.warcDate;let n,s=200,a="OK",o=0,u="";if(t.httpHeaders){if(204===(s=Number(t.httpHeaders.statusCode)||200))return null;if(e&&"OPTIONS"===e.httpHeaders.method)return null;if(a=t.httpHeaders.statusText,u=((n=Object(R.i)(t.httpHeaders.headers)).get("content-type")||"").split(";")[0],o=parseInt(n.get("content-length")||0),206===s){const t=n.get("content-range"),e=`bytes 0-${o-1}/${o}`;if(t&&t!==e)return null}if(s>300&&s<400){const t=n.get("location");if(t&&new URL(t,r).href===r)return null}}else(n=new Headers).set("content-type",t.warcContentType),n.set("content-length",t.warcContentLength),u=t.warcContentType,o=t.warcContentLength;let h=null;if(e&&e.httpHeaders.headers)try{const t=new Headers(e.httpHeaders.headers).get("cookie");t&&n.set("x-wabac-preset-cookie",t),h=e.httpHeaders.headers.get("Referer")}catch(t){console.warn(t)}if(void 0===this.detectPages&&(this.detectPages=!this.anyPages),this.detectPages&&function(t,e,r){if(200!=e)return!1;if(!t.startsWith("http:")&&!t.startsWith("https:")&&!t.startsWith("blob:"))return!1;if(t.endsWith("/robots.txt"))return!1;const i=t.split("?",2);if(2===i.length&&i[1].length>i[0].length)return!1;if(i[0].substring(i[0].lastIndexOf("/")+1).startsWith("."))return!1;if(r&&"text/html"!==r)return!1;return!0}(r,s,u)){const t=r;this.addPage({url:r,date:i,title:t})}const c=new Date(i).getTime(),l=Object.fromEntries(n.entries()),d=t.warcPayloadDigest,f=t.payload,p={url:r,ts:c,status:s,mime:u,respHeaders:l,digest:d,payload:f,reader:f?null:t.reader,referrer:h};this.pageMap[c+"/"+r]&&f&&u.startsWith("text/")&&(this.pageMap[c+"/"+r].textPromise=async function(t,e,r,i){const n=new j.a,s=[];let a=null;n.on("text",(t,e)=>{if(a)return;const r=t.text.trim();r&&s.push(r)}),n.on("startTag",t=>{!t.selfClosing&&G.includes(t.tagName)&&(a=t.tagName)}),n.on("endTag",t=>{t.tagName===a&&(a=null)});const o=new z.PassThrough({encoding:"utf8"});(r||i)&&(e=await Object(H.a)(e,r,i)),o.push(e),o.push(null),o.pipe(n);const u=new Promise(t=>{n.on("end",()=>{t(s.join(" "))})});return await u}(0,f,n.get("content-encoding"),n.get("transfer-encoding")));const m=t.warcHeader("WARC-JSON-Metadata");if(m)try{p.extraOpts=JSON.parse(m)}catch(t){}const w=t.warcHeader("WARC-Page-ID");return w&&(p.pageId=w),p}filterRecord(t){return null}async load(t,e,r){this.db=t;const i=new M.d(this.reader);let n=0,s=0;try{for await(const t of i){if(!t.warcType){console.log("skip empty record");continue}if(self.interruptLoads&&this.loadId&&self.interruptLoads[this.loadId])throw e(Math.round(i.offset/r*95),"Loading Canceled",i.offset,r),self.interruptLoads[this.loadId](),this.abort&&this.abort.abort(),new R.b;(s=(new Date).getTime())-n>500&&(e(Math.round(i.offset/r*95),null,i.offset,r),n=s);const a=this.filterRecord(t);if("done"===a){this.abort&&this.abort.abort();break}if("skip"!==a){"skipContent"===a?await t.skipFully():await t.readFully(),this.index(t,i);try{await Promise.all(this.promises)}catch(t){console.warn(t.toString())}this.promises=[]}}}catch(t){if(t instanceof R.b)throw t;e(Math.round(i.offset/r*95),`Sorry there was an error downloading. Please try again (${t})`,i.offset,r),console.warn(t)}return this.indexDone(),e(95),await this.finishIndexing(),e(100),this.metadata}async finishIndexing(){if(this.batch.length>0&&this.promises.push(this.db.addResources(this.batch)),console.log(`Indexed ${this.count+=this.batch.length} records`),this.pages.length){for(const{page:t,textPromise:e}of Object.values(this.pageMap))if(e)try{t.text=await e}catch(t){console.warn("Error adding text: "+t.toString())}this.promises.push(this.db.addPages(this.pages))}this.lists.length&&this.promises.push(this.db.addCuratedPageLists(this.lists,"bookmarks","public"));try{await Promise.all(this.promises)}catch(t){console.warn(t)}this.promises=[]}}class K extends X{constructor(t){super(t),this.detectPages=!1}addPage(){}async load(){const t=await new M.d(this.reader).parse();if(!t)return null;const e=this.parseRecords(t,null);return e&&"revisit"!==t.warcType||await t.readFully(),e}}class V extends X{filterRecord(t){if("warcinfo"!=t.warcType)return"done"}}const Y="https://helper-proxy.webrecorder.workers.dev";function J(t,e,r,i,n){if(t.startsWith("blob:"))return new $(t,n,r);if(t.startsWith("http:")||t.startsWith("https:")||t.startsWith("file:"))return new Z(t,e,r);if(t.startsWith("googledrive:"))return new Q(t,e,r,i);throw new Error("Invalid URL: "+t)}class Z{constructor(t,e,r=null,i=!1){this.url=t,this.headers=e||{},this.length=r,this.canLoadOnDemand=i,this.isValid=!1}async doInitialFetch(t){const e=new Headers(this.headers);e.set("Range","bytes=0-"),this.isValid=!1;let r=null,i=null;if(t)try{200!==(i=await fetch(this.url,{headers:e,method:"HEAD"})).status&&206!=i.status||(this.canLoadOnDemand=206===i.status,this.isValid=!0)}catch(t){}if(!this.isValid){const t=(r=new AbortController).signal;i=await fetch(this.url,{headers:e,signal:t}),this.canLoadOnDemand=206===i.status,this.isValid=206===i.status||200===i.status}if(null===this.length&&(this.length=i.headers.get("Content-Length"),!this.length&&206===i.status)){let t=i.headers.get("Content-Range");t&&2===(t=t.split("/")).length&&(this.length=t[1])}if(null===this.length)try{const t=await fetch(`${Y}/c/${this.url}`),e=await t.json();e.size&&(this.length=e.size)}catch(t){console.log("Error fetching from helper: "+t.toString())}return this.length=Number(this.length||0),{response:i,abort:r}}async getLength(){if(null===this.length){const{response:t,abort:e}=await this.doInitialFetch(!0);e&&e.abort()}return this.length}async getRange(t,e,r=!1,i=null){const n=new Headers(this.headers);n.set("Range",`bytes=${t}-${t+e-1}`);const s={signal:i,headers:n};let a=null;try{a=await fetch(this.url,s)}catch(t){throw console.log(t),new RangeError(this.url)}if(206!=a.status)throw 401===a.status||403===a.status?new R.a(this.url,a.status):new RangeError(this.url,a.status);return r?a.body:new Uint8Array(await a.arrayBuffer())}}class Q{constructor(t,e,r,i){this.fileId=t.slice("googledrive://".length),this.apiUrl=`https://www.googleapis.com/drive/v3/files/${this.fileId}?alt=media`,this.canLoadOnDemand=!0,this.headers=e,i&&i.publicUrl?this.publicUrl=i.publicUrl:this.publicUrl=null,this.length=r,this.isValid=!1}async getLength(){return this.length}async doInitialFetch(t){let e=null,r=null;if(this.publicUrl){e=new Z(this.publicUrl,null,this.length);try{r=await e.doInitialFetch(t)}catch(t){}if(!e.isValid&&(r&&r.abort&&r.abort.abort(),await this.refreshPublicUrl())){e=new Z(this.publicUrl,null,this.length);try{r=await e.doInitialFetch(t)}catch(t){}!e.isValid&&r&&r.abort&&r.abort.abort()}}return e&&e.isValid||(this.publicUrl=null,e=new Z(this.apiUrl,this.headers,this.length),r=await e.doInitialFetch(t)),this.isValid=e.isValid,this.length||(this.length=e.length),r}async getRange(t,e,r=!1,i){let n=null;if(this.publicUrl){n=new Z(this.publicUrl,null,this.length);try{return await n.getRange(t,e,r,i)}catch(s){if(await this.refreshPublicUrl()){n=new Z(this.publicUrl,null,this.length);try{return await n.getRange(t,e,r,i)}catch(t){}}}this.publicUrl=null}return n=new Z(this.apiUrl,this.headers,this.length),await n.getRange(t,e,r,i)}async refreshPublicUrl(){try{const t=await fetch(`${Y}/g/${this.fileId}`),e=await t.json();if(e.url)return this.publicUrl=e.url,!0}catch(t){}return!1}}class ${constructor(t,e=null,r=null){this.url=t,this.blob=e,this.size=this.blob?this.blob.size:r,this.canLoadOnDemand=!1}get length(){return this.size}get isValid(){return!!this.blob}async doInitialFetch(t){if(!this.blob){const t=await fetch(this.url);this.blob=await t.blob()}const e=new Response;let r=null;return t||(r=this.blob.stream?this.blob.stream():await this.getReadableStream(this.blob)),{response:e,stream:r}}async getLength(){if(!this.blob&&!this.blob.size){let t=await fetch(this.url);this.blob=await t.blob(),this.size=this.blob.size}return this.size}async getRange(t,e,r=!1,i){if(!this.blob){const i=new Headers;i.set("Range",`bytes=${t}-${t+e-1}`);const n=await fetch(this.url,{headers:i});if(n.headers.get("content-range"))return r?n.body:new Uint8Array(await n.arrayBuffer());this.blob=await n.blob()}const n=this.blob.slice(t,t+e,"application/octet-stream");if(r)return n.stream?n.stream():await this.getReadableStream(n);try{const t=n.arrayBuffer?await n.arrayBuffer():await this.getArrayBuffer(n);return new Uint8Array(t)}catch(t){return console.log("error reading blob",t),null}}getArrayBuffer(t){return new Promise(e=>{let r=new FileReader;r.onloadend=()=>{e(r.result)},r.readAsArrayBuffer(t)})}async getReadableStream(t){const e=await this.getArrayBuffer(t);return new ReadableStream({start(t){t.enqueue(new Uint8Array(e)),t.close()}})}}class tt extends L{constructor(t,e=!1){super(t),this.noCache=e,this.useRefCounts=!1}async loadPayload(t,e=0){let r=await super.loadPayload(t);if(r&&t.respHeaders&&"warc/revisit"!==t.mime)return r;const i=await this.loadSource(t.source),n=await new K(i).load();if(!n)return console.log(`No WARC Record Loaded for: ${t.url}`),null;if(n.url!==t.url)return console.log(`Wrong url: expected ${t.url}, got ${n.url}`),null;if(n.ts!==t.ts){if(1e3*Math.floor(n.ts/1e3)!==t.ts)return console.log(`Wrong timestamp: expected ${t.ts}, got ${n.ts}`),null}if(n.digest!==t.digest&&console.log(`Wrong digest: expected ${t.digest}, got ${n.digest}`),n.origURL){const i=await this.lookupUrl(n.origURL,n.origTS,{noRevisits:!0});return i&&(r||(e<2?r=await this.loadPayload(i,e+1):console.warn("Avoiding revisit lookup loop for: "+JSON.stringify(n)),r))?(t.respHeaders=i.respHeaders,t.mime=i.mime,i.extraOpts&&(t.extraOpts=i.extraOpts),this.noCache||(delete t.payload,await this.db.put("resources",t)),r):null}const s=n.digest;if(!this.noCache&&n.reader&&s&&(n.reader=new it(this,n.reader,s,t.url)),!(r=n.payload)&&!n.reader)return null;try{r&&!this.noCache&&await this.commitPayload(s)}catch(e){console.warn(`Payload Update Error: ${t.url}`),console.warn(e)}if(!(t.respHeaders&&t.digest||(t.respHeaders=n.respHeaders,t.digest=s,n.extraOpts&&(t.extraOpts=n.extraOpts),this.noCache)))try{await this.db.put("resources",t)}catch(e){console.warn(`Resource Update Error: ${t.url}`),console.warn(e)}return r||n.reader}async commitPayload(t,e){if(!t)return;const r=this.db.transaction(["payload","digestRef"],"readwrite");try{if(r.objectStore("payload").put({payload:t,digest:e}),this.useRefCounts){const i=await r.objectStore("digestRef").get(e);i&&(i.size=t.length,r.objectStore("digestRef").put(i))}await r.done}catch(t){console.warn("Payload Commit Error: "+t)}}}class et extends tt{constructor(t,e,r=!1){super(t,r),this.loader=e}updateHeaders(t){this.loader.headers=t}async loadSource(t){const{start:e,length:r}=t;return await this.loader.getRange(e,r,!0)}}class rt extends tt{constructor(t,e,r,i=!1){super(t,i),this.remoteUrlPrefix=e,this.headers=r}updateHeaders(t){this.headers=t}async loadSource(t){const{start:e,length:r}=t,i=new Headers(this.headers),n=J(new URL(t.path,this.remoteUrlPrefix).href,i);return await n.getRange(e,r,!0)}}class it extends M.b{constructor(t,e,r,i=""){super(),this.db=t,this.reader=e,this.digest=r,this.url=i,this.chunks=[],this.size=0,this.fullbuff=null,this.commit=!0,this.alreadyRead=!1}setLimitSkip(t=-1,e=0){-1!=t&&e>0&&(this.commit=!1),this.reader.setLimitSkip(t,e)}async*[Symbol.asyncIterator](){if(!this.alreadyRead){for await(const t of this.reader)this.chunks.push(t),this.size+=t.byteLength,yield t;this.fullbuff=M.b.concatChunks(this.chunks,this.size),0!==this.reader.limit?console.warn(`Expected payload not consumed, ${this.reader.limit} bytes left`):this.commit&&await this.db.commitPayload(this.fullbuff,this.digest),this.chunks=[],this.alreadyRead=!0}}async readFully(){for await(const t of this);return this.fullbuff}}const nt=3e3;class st extends X{constructor(t,e,r){super(t,e,r),this.cdxindexer=null}filterRecord(t){switch(t.warcType){case"warcinfo":case"revisit":return null;case"request":return"skipContent";case"metadata":return this.shouldIndexMetadataRecord(t)?null:"skipContent"}const e=t.warcTargetURI,r=new Date(t.warcDate).getTime();if(this.pageMap[r+"/"+e])return t._isPage=!0,null}index(t,e){if(t._isPage)return super.index(t,e);if("warcinfo"===t.warcType)return void this.parseWarcInfo(t);this.cdxindexer||(this.cdxindexer=new M.c({},null));const r=this.cdxindexer.indexRecord(t,e,"");r&&this.addCdx(r)}addCdx(t){const{url:e,mime:r}=t,i=Number(t.status)||200,n=Object(R.l)(t.timestamp).getTime(),s={path:t.filename,start:Number(t.offset),length:Number(t.length)};let{digest:a}=t;a&&-1===a.indexOf(":")&&(a="sha1:"+a);const o={url:e,ts:n,status:i,digest:a,mime:r,loaded:!1,source:s};this.batch.length>=nt&&(this.promises.push(this.db.addResources(this.batch)),this.batch=[],console.log(`Read ${this.count+=nt} records`)),this.batch.push(o)}}class at extends st{async load(t){this.db=t;let e=this.reader;e.iterLines||(e=new M.a(this.reader));for await(const t of e.iterLines()){let e,r,i,n=t.trimEnd();if(!n.startsWith("{")){const t=n.indexOf(" {");if(t<0)continue;[r,i]=n.split(" ",2),n=n.slice(t)}try{e=JSON.parse(n)}catch(t){console.log("JSON Parser error on: "+n);continue}e.timestamp=i,e.url||(e.url=r),this.addCdx(e)}this.indexDone(),await this.finishIndexing()}}const ot=/(?:([\d]+)[^\/]*\/)?(http.*)/;class ut{constructor(t){this.replayPrefix=t.replayPrefix,this.idMod=void 0!==t.idMod?t.idMod:"id_",this.redirMod=void 0!==t.redirMod?t.redirMod:"mp_",this.redirectMode=this.idMod===this.redirMod?"follow":"manual"}async getAllPages(){return[]}getUrl(t,e){let r=this.replayPrefix;return(e||t.timestamp)&&(r+=t.timestamp+e+"/"),r+t.url}async getResource(t,e,r){let i=await fetch(this.getUrl(t,this.idMod),{credentials:"same-origin",redirect:this.redirectMode,mode:"cors"});if(i.status>=400&&!i.headers.get("memento-datetime"))return null;const n=await this.getRedirect(t,i,e);let s=null,a=!1;n?(i=Response.redirect(n.path,307),a=!0,s=n.timestamp):s=t.timestamp;const o=t.url,u=s?Object(R.l)(s):new Date;return P.a.fromResponse({url:o,response:i,date:u,noRW:a})}async getRedirect(t,e,r){if("opaqueredirect"===e.type)e=await fetch(this.getUrl(t,this.redirMod),{credentials:"same-origin",redirect:"follow",mode:"cors"});else if(!e.redirected)return null;const i=e.url.indexOf(this.replayPrefix)+this.replayPrefix.length,n=e.url.slice(i),s=n.match(ot);return s?{timestamp:s[1],path:r+s[1]+"mp_/"+s[2]}:{path:r+n}}}class ht{constructor(t,e=!1,r=!0){this.prefix=t||"",this.proxyPathOnly=e,this.isLive=r}async getAllPages(){return[]}async getResource(t,e,r){let i,n;if(this.isLive){i=new Headers(t.request.headers);let r=t.request.referrer;const s=r.indexOf("/http",e.length-1);s>0&&(r=r.slice(s+1),i.set("X-Proxy-Referer",r)),n=t.request.credentials}else i=new Headers,n="omit";let s,a=t.url;if(a.startsWith("//"))try{a=new URL(referrer).protocol+a}catch(t){a="https:"+a}if(this.proxyPathOnly){const t=new URL(a);s=this.prefix+t.pathname+t.search}else s=this.prefix+a;const o=await fetch(s,{method:t.request.method,body:t.request.body,headers:i,credentials:n,mode:"cors",redirect:"follow"});return P.a.fromResponse({url:a,response:o,date:new Date,noRW:!1,isLive:this.isLive})}}var ct=r(25),lt=r.n(ct),dt=r(35);class ft extends et{constructor(t,e,r=null,i=!1,n){super(t,e,i),this.zipreader=new wt(e),this.externalSources=[],this.fuzzyUrlRules=[],this.useSurt=!0,this.fullConfig=n,e.canLoadOnDemand=!0,r&&this.initConfig(r)}_initDB(t,e,r,i){if(super._initDB(t,e,r,i),!e){t.createObjectStore("ziplines",{keyPath:"prefix"}),t.createObjectStore("zipEntries",{keyPath:"filename"})}}async init(){await super.init(),await this.loadZipEntries()}async clearZipData(){const t=["zipEntries","ziplines"];for(const e of t)await this.db.clear(e)}async clearAll(){await super.clearAll(),await this.clearZipData()}updateHeaders(t){this.zipreader.loader.headers=t}async loadZipEntries(){const t=await this.db.getAll("zipEntries");if(!t.length)return;const e={};for(const r of t)e[r.filename]=r;this.zipreader.entries=e}async saveZipEntries(t){const e=this.db.transaction("zipEntries","readwrite");e.store.clear();for(const r of Object.values(t))e.store.put(r);await e.done,this.db.clear("ziplines")}async loadZipIndex(t){for await(const e of t.iterLines()){let t;if(e.indexOf("\t")>0){let[r,i,n,s]=e.split("\t");t={prefix:r,filename:i,offset:n=Number(n),length:s=Number(s),loaded:!1},this.useSurt=!0}else{const r=e.indexOf(" {");if(r<0){console.log("Invalid Index Line: "+e);continue}const i=e.slice(0,r),{offset:n,length:s,filename:a}=JSON.parse(e.slice(r));t={prefix:i,filename:a,offset:n,length:s,loaded:!1}}await this.db.put("ziplines",t)}}async load(t,e,r){if(t!==this)return void console.error("wrong db");const i=await t.zipreader.load(!0);await t.saveZipEntries(i);const n=[];let s;i["webarchive.yaml"]&&(s=await this.loadMetadata(i,await t.zipreader.loadFile("webarchive.yaml")));for(const r of Object.keys(i))if(r.endsWith(".cdx")||r.endsWith(".cdxj")){console.log("Loading CDX "+r);const e=await t.zipreader.loadFile(r);n.push(new at(e).load(t))}else if(r.endsWith(".idx"))this.loader.canLoadOnDemand&&(console.log("Loading IDX "+r),n.push(t.loadZipIndex(await t.zipreader.loadFile(r))));else if(r.endsWith(".warc.gz")||r.endsWith(".warc"))if(!s&&this.loader.canLoadOnDemand){const i=new AbortController,n=await t.zipreader.loadFile(r,{signal:i.signal,unzip:!0}),a=new V(n,i),o=t.zipreader.getCompressedSize(r);s=await a.load(t,e,o)}else if(!this.loader.canLoadOnDemand){const i=await t.zipreader.loadFile(r,{unzip:!0}),n=new X(i);n.detectPages=!1;const a=t.zipreader.getCompressedSize(r);s=await n.load(t,e,a)}return await Promise.all(n),s||{}}async loadPagesCSV(t){const e=(new TextDecoder).decode(await t.readFully()),r=await Object(dt.csv2jsonAsync)(e);r&&r.length&&await this.addPages(r)}initConfig(t){if(void 0!==t.decodeResponses&&(this.fullConfig.decode=t.decodeResponses),void 0!==t.useSurt&&(this.useSurt=t.useSurt),t.es)for(const[e,r]of t.es){const t=new ht(r,!0,!1);this.externalSources.push({prefix:e,external:t})}if(t.fuzzy)for(const[e,r]of t.fuzzy){const t=new RegExp(e);this.fuzzyUrlRules.push({match:t,replace:r})}}async loadMetadata(t,e){const r=(new TextDecoder).decode(await e.readFully()),i=lt.a.safeLoad(r);void 0!==i.config&&this.initConfig(i.config);const n={desc:i.desc,title:i.title},s=i.pages||[];s&&s.length?await this.addPages(s):t["pages.csv"]&&await this.loadPagesCSV(await this.zipreader.loadFile("pages.csv"));const a=i.pageLists||[];return a&&a.length&&await this.addCuratedPageLists(a,"pages","show"),n}async loadSource(t){let e,r=0,i=-1;if("string"==typeof t)e=t;else{if("object"!=typeof t)return null;r=t.start,i=t.length,e=t.path}return await this.zipreader.loadWARC(e,r,i)}getSurt(t){try{t=t.replace(/www\d*\./,"");const e=new URL(t);let r=e.hostname.split(".").reverse().join(",");return e.port&&(r+=":"+e.port),r+=")",(r+=e.pathname).toLowerCase()}catch(e){return t}}async loadFromZiplines(t,e){const r=e?Object(R.f)(new Date(e).toISOString()):"",i=this.useSurt?this.getSurt(t):t,n=this.db.transaction("ziplines","readonly"),s=[],a=IDBKeyRange.upperBound(i+" "+r,!0);for await(const t of n.store.iterate(a,"prev"))if(s.unshift(t.value),!t.value.prefix.split(" ")[0].startsWith(i))break;await n.done;const o=[];for(const t of s){if(t.loaded)continue;const e="indexes/"+t.filename,r={offset:t.offset,length:t.length,unzip:!0},i=await this.zipreader.loadFile(e,r);o.push(new at(i).load(this)),t.loaded=!0,await this.db.put("ziplines",t)}return await Promise.all(o),o.length>0}async getResource(t,e,r){if(this.externalSources.length)for(const{prefix:i,external:n}of this.externalSources)if(t.url.startsWith(i))try{return await n.getResource(t,e,r)}catch(t){console.warn("Upstream Error",t)}let i=await super.getResource(t,e,r);if(i)return i;if(this.fuzzyUrlRules.length)for(const{match:n,replace:s}of this.fuzzyUrlRules){const a=t.url.replace(n,s);if(a&&a!==t.url&&(t.url=a,i=await super.getResource(t,e,r)))return i}return null}async lookupUrl(t,e,r={}){try{let i=await super.lookupUrl(t,e,r);return!i||r.noRevisits&&"warc/revisit"===i.mime?(await this.loadFromZiplines(t,e)&&(i=await super.lookupUrl(t,e,r)),i):i}catch(t){return console.warn(t),null}}async resourcesByUrlAndMime(t,...e){let r=await super.resourcesByUrlAndMime(t,...e);return r.length>0?r:(await this.loadFromZiplines(t,"")&&(r=await super.resourcesByUrlAndMime(t,...e)),r)}}const pt=4294967295,mt=65535;class wt{constructor(t,e=null){this.loader=t,this.entries=e}async load(t=!1){if(!this.entries||t){const t=await this.loader.getLength(),e=mt+23,r=t-e,i=await this.loader.getRange(r,e);this.entries=this._loadEntries(i,r)}return this.entries}_loadEntries(t,e){const r=t.byteLength,i=new DataView(t.buffer),n=new TextDecoder("utf8"),s=new TextDecoder("ascii"),a={};let o=0,u=0,h=r;for(let e=r-22,n=Math.max(0,e-mt);e>=n;--e)if(80===t[e]&&75===t[e+1]&&5===t[e+2]&&6===t[e+3]){h=e,u=i.getUint32(e+16,!0),o=i.getUint16(e+8,!0);break}if(u===pt||o===mt){if(117853008!==i.getUint32(h-20,!0))return void console.warn("invalid zip64 EOCD locator");const t=this.getUint64(i,h-12,!0)-e;if(101075792!==i.getUint32(t,!0))return void console.warn("invalid zip64 EOCD record");o=this.getUint64(i,t+32,!0),u=this.getUint64(i,t+48,!0)}if(e&&(u-=e),u>=r||u<=0)for(u=-1,o=mt;++u=0&&u=8&&(o=this.getUint64(i,t,!0),t+=8,n-=8),r===pt&&n>=8&&(r=this.getUint64(i,t,!0),t+=8,n-=8),f===pt&&n>=8&&(f=this.getUint64(i,t,!0),t+=8,n-=8)),t+=n}}p.endsWith("/")||(a[p]={filename:p,deflate:d,uncompressedSize:o,compressedSize:r,localEntryOffset:f}),u+=46+h+c+l}return a}async loadWARC(t,e,r){if(null===this.entries&&await this.load(),this.entries["archive/"+t])t="archive/"+t;else if(this.entries["warcs/"+t])t="warcs/"+t;else for(const e of Object.keys(this.entries))if(e.endsWith("/"+t)){t=e;break}return await this.loadFile(t,{offset:e,length:r,unzip:!0})}getCompressedSize(t){if(null===this.entries)return-1;const e=this.entries[t];return e?e.compressedSize:-1}async loadFile(t,{offset:e=0,length:r=-1,signal:i=null,unzip:n=!1}={}){null===this.entries&&await this.load();const s=this.entries[t];if(!s)return null;if(void 0===s.offset){const t=await this.loader.getRange(s.localEntryOffset,30),e=new DataView(t.buffer),r=e.getUint16(26,!0),i=e.getUint16(28,!0);s.offset=30+r+i+s.localEntryOffset}r=r<0?s.compressedSize:Math.min(r,s.compressedSize-e),e+=s.offset;const a=await this.loader.getRange(e,r,!0,i);return n?s.deflate?new M.a(new M.a(a.getReader(),"deflate")):new M.a(a.getReader()):new M.a(a.getReader(),s.deflate?"deflate":null)}getUint64(t,e,r){const i=t.getUint32(e,r),n=t.getUint32(e+4,r),s=r?i+2**32*n:2**32*i+n;return Number.isSafeInteger(s)||console.warn(s,"exceeds MAX_SAFE_INTEGER. Precision may be lost"),s}}class gt{constructor(t){this.har=t,this.pageRefs={}}load(t){return this.db=t,"string"==typeof this.har&&(this.har=JSON.parse(this.har)),this.parseEntries(this.har),this.parsePages(this.har),Promise.resolve(!0)}parsePages(t){for(const e of t.log.pages){if(!e.pageTimings||!e.pageTimings.onLoad)continue;let t;t=e.title&&(e.title.startsWith("http:")||e.title.startsWith("https:"))?e.title:this.pageRefs[e.id];const r=e.title||t,i=e.startedDateTime;this.db.addPage({url:t,date:i,title:r})}}parseEntries(t){for(const e of t.log.entries){if(!e.response.content||!e.response.content.text)continue;let t=null;try{t=Uint8Array.from(atob(e.response.content.text),t=>t.charCodeAt(0))}catch(r){t=e.response.content.text}const r=new Date(e.startedDateTime).getTime();this.db.addResource({url:e.request.url,ts:r,status:e.response.status,respHeaders:e.response.headers,reqHeaders:e.request.headers,payload:t}),e.pageref&&!this.pageRefs[e.pageref]&&(this.pageRefs[e.pageref]=e.request.url)}}}var yt=r(87);r.d(e,"CollectionLoader",(function(){return _t})),r.d(e,"WorkerLoader",(function(){return vt}));const bt=25e6;self.interruptLoads={};class _t{constructor(){this.colldb=null,this._init_db=this._initDB()}async _initDB(){this.colldb=await g("collDB",1,{upgrade:(t,e,r,i)=>{t.createObjectStore("colls",{keyPath:"name"})}})}async loadAll(t){if(await this._init_db,t)for(const e of t.split(",")){const t=e.split(":");if(2===t.length){const e={dbname:t[1],sourceName:t[1],decode:!1},r={name:t[0],type:"archive",config:e};console.log("Adding Coll: "+JSON.stringify(r)),await this.colldb.put("colls",r)}}try{const t=(await this.listAll()).map(t=>this._initColl(t));await Promise.all(t)}catch(t){console.warn(t.toString())}return!0}async listAll(){return await this._init_db,await this.colldb.getAll("colls")}async loadColl(t){await this._init_db;const e=await this.colldb.get("colls",t);return e?await this._initColl(e):null}async deleteColl(t){await this._init_db;const e=await this.colldb.get("colls",t);if(!e)return!1;e.config.dbname&&await y(e.config.dbname,{blocked(t){console.log(`Unable to delete ${e.config.dbname}: ${t}`)}}),await this.colldb.delete("colls",t)}async updateAuth(t,e){await this._init_db;const r=await this.colldb.get("colls",t);return!!r&&(r.config.headers=e,await this.colldb.put("colls",r),!0)}async updateSize(t,e,r){await this._init_db;const i=await this.colldb.get("colls",t);if(!i)return!1;i.config.loadSize=(i.config.loadSize||0)+e,i.config.dedupSize=(i.config.dedupSize||0)+r,await this.colldb.put("colls",i)}async _initColl(t){let e=null;switch(t.type){case"archive":e=new L(t.config.dbname);break;case"remotewarc":if(t.config.singleFile){const r=J(t.config.loadUrl||t.config.sourceUrl,t.config.headers,t.config.size,t.config.extra);e=new et(t.config.dbname,r,t.config.noCache)}else e=new rt(t.config.dbname,t.config.remotePrefix,t.config.headers,t.config.noCache);break;case"remotesource":{const r=J(t.config.loadUrl,t.config.headers,t.config.size,t.config.extra);e=new et(t.config.dbname,r,t.config.noCache);break}case"remoteprefix":e=new rt(t.config.dbname,t.config.remotePrefix,t.config.headers,t.config.noCache);break;case"remotezip":const r=J(t.config.loadUrl||t.config.sourceUrl,t.config.headers,t.config.extra);e=new ft(t.config.dbname,r,t.config.extraConfig,t.config.noCache,t.config);break;case"remoteproxy":e=new ut(t.config);break;case"live":e=new ht(t.config.prefix,t.config.proxyPathOnly,t.config.isLive)}if(!e)return console.log("no store found: "+t.type),null;e.initing&&await e.initing;const r=t.name,i=t.config;return this._createCollection({name:r,store:e,config:i})}_createCollection(t){return t}}class vt extends _t{constructor(t){super(),this.registerListener(t)}async hasCollection(t){return await this._init_db,null!=await this.colldb.getKey("colls",t)}registerListener(t){t.addEventListener("message",t=>this._handleMessage(t))}async _handleMessage(t){await this._init_db;const e=t.source||self;switch(t.data.msg_type){case"addColl":{const r=t.data.name,i=(t,i,n,s)=>{e.postMessage({msg_type:"collProgress",name:r,percent:t,error:i,currentSize:n,totalSize:s})};let n;try{if(await this.hasCollection(r)?t.data.skipExisting?n=!0:(await this.deleteCollection(r),n=await this.addCollection(t.data,i)):n=await this.addCollection(t.data,i),!n)return}catch(t){return console.warn(t),void i(0,"An unexpected error occured: "+t.toString())}e.postMessage({msg_type:"collAdded",name:r});break}case"cancelLoad":{const e=t.data.name,r=new Promise(t=>self.interruptLoads[e]=t);await r,await this.deleteCollection(e),delete self.interruptLoads[e];break}case"removeColl":{const r=t.data.name;await this.hasCollection(r)&&(await this.deleteCollection(r),this.doListAll(e));break}case"listAll":this.doListAll(e)}}async doListAll(t){const e=[],r=await this.listAll();for(const t of r)e.push({name:t.name,prefix:t.name,pageList:[],sourceName:t.config.sourceName});t.postMessage({msg_type:"listAll",colls:e})}async addCollection(t,e){const r=t.name;let i=null,n={root:!1},s=null;if(t.file){const a=t.file;let o=null;if(a.sourceUrl){i="archive",n.dbname="db:"+r;let u=a.loadUrl||a.sourceUrl;u.match(/[\w]+:\/\//)||(u=new URL(u,self.location.href).href),n.decode=!0,n.onDemand=!1,n.loadUrl=u,n.sourceUrl=a.sourceUrl,n.sourceName=a.name||a.sourceUrl,n.sourceName=n.sourceName.slice(n.sourceName.lastIndexOf("/")+1),n.headers=a.headers,n.size="number"==typeof a.size?a.size:null,n.extra=a.extra,n.extraConfig=t.extraConfig,n.noCache=u.startsWith("file:")||a.noCache;const h=J(u,a.headers,a.size,n.extra,a.blob);let c=!1;(n.sourceName.endsWith(".wacz")||n.sourceName.endsWith(".zip"))&&(i="remotezip",o=s=new ft(n.dbname,h,n.extraConfig,n.noCache,n),c=!0);let{abort:l,response:d,stream:f}=await h.doInitialFetch(c);if(f=f||d.body,!h.isValid){const t=h.length<=1e3?await d.text():"";return e(0,`Sorry, this URL could not be loaded.\nMake sure this is a valid URL and you have access to this file.\nStatus: ${d.status} ${d.statusText}\nError Details:\n${t}`),l&&l.abort(),!1}if(!h.length)return e(0,"Sorry, this URL could not be loaded because the size of the file is not accessible.\nMake sure this is a valid URL and you have access to this file."),l&&l.abort(),!1;const p=h.length;if(n.sourceName.endsWith(".warc")||n.sourceName.endsWith(".warc.gz")?p0?("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===h.prototype||(e=function(t){return h.from(t)}(e)),i?a.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):v(t,a,e,!0):a.ended?t.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?v(t,a,e,!1):C(t,a)):v(t,a,e,!1))):i||(a.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=E?t=E:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function A(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?n.nextTick(S,t):S(t))}function S(t){f("emit readable"),t.emit("readable"),R(t)}function C(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(T,t,e))}function T(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var i;ts.length?s.length:t;if(a===s.length?n+=s:n+=s.slice(0,t),0===(t-=a)){a===s.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=s.slice(a));break}++i}return e.length-=i,n}(t,e):function(t,e){var r=h.allocUnsafe(t),i=e.head,n=1;i.data.copy(r),t-=i.data.length;for(;i=i.next;){var s=i.data,a=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,a),0===(t-=a)){a===s.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=s.slice(a));break}++n}return e.length-=n,r}(t,e);return i}(t,e.buffer,e.decoder),r);var r}function I(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,n.nextTick(N,e,t))}function N(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function F(t,e){for(var r=0,i=t.length;r=e.highWaterMark||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?I(this):A(this),null;if(0===(t=x(t,e))&&e.ended)return 0===e.length&&I(this),null;var i,n=e.needReadable;return f("need readable",n),(0===e.length||e.length-t0?O(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&I(this)),null!==i&&this.emit("data",i),i},b.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(t,e){var r=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=t;break;case 1:s.pipes=[s.pipes,t];break;default:s.pipes.push(t)}s.pipesCount+=1,f("pipe count=%d opts=%j",s.pipesCount,e);var u=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?c:b;function h(e,i){f("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,f("cleanup"),t.removeListener("close",g),t.removeListener("finish",y),t.removeListener("drain",l),t.removeListener("error",w),t.removeListener("unpipe",h),r.removeListener("end",c),r.removeListener("end",b),r.removeListener("data",m),d=!0,!s.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function c(){f("onend"),t.end()}s.endEmitted?n.nextTick(u):r.once("end",u),t.on("unpipe",h);var l=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,R(t))}}(r);t.on("drain",l);var d=!1;var p=!1;function m(e){f("ondata"),p=!1,!1!==t.write(e)||p||((1===s.pipesCount&&s.pipes===t||s.pipesCount>1&&-1!==F(s.pipes,t))&&!d&&(f("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function w(e){f("onerror",e),b(),t.removeListener("error",w),0===o(t,"error")&&t.emit("error",e)}function g(){t.removeListener("finish",y),b()}function y(){f("onfinish"),t.removeListener("close",g),b()}function b(){f("unpipe"),r.unpipe(t)}return r.on("data",m),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?a(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",w),t.once("close",g),t.once("finish",y),t.emit("pipe",r),s.flowing||(f("pipe resume"),r.resume()),t},b.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0?i-4:i,l=0;l>16&255,o[u++]=e>>8&255,o[u++]=255&e;2===a&&(e=n[t.charCodeAt(l)]<<2|n[t.charCodeAt(l+1)]>>4,o[u++]=255&e);1===a&&(e=n[t.charCodeAt(l)]<<10|n[t.charCodeAt(l+1)]<<4|n[t.charCodeAt(l+2)]>>2,o[u++]=e>>8&255,o[u++]=255&e);return o},e.fromByteArray=function(t){for(var e,r=t.length,n=r%3,s=[],a=0,o=r-n;ao?o:a+16383));1===n?(e=t[r-1],s.push(i[e>>2]+i[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],s.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"="));return s.join("")};for(var i=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,u=a.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var n,s,a=[],o=e;o>18&63]+i[s>>12&63]+i[s>>6&63]+i[63&s]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(t,e,r){"use strict";var i=r(26);function n(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var r=this,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return s||a?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||i.nextTick(n,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(i.nextTick(n,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,r){(function(t){var i=void 0!==t&&t||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function s(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new s(n.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new s(n.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(95),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(6))},function(t,e,r){"use strict";var i=r(27).Buffer,n=i.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(i.isEncoding===n||!n(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=h,e=4;break;case"utf8":this.fillLast=o,e=4;break;case"base64":this.text=c,this.end=l,e=3;break;default:return this.write=d,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function o(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function h(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function c(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function d(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.StringDecoder=s,s.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return n>0&&(t.lastNeed=n-1),n;if(--i=0)return n>0&&(t.lastNeed=n-2),n;if(--i=0)return n>0&&(2===n?n=0:t.lastNeed=n-3),n;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},s.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,r){"use strict";t.exports=a;var i=r(10),n=r(18);function s(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length(Object.keys(e).forEach(r=>{t[r]=e[r]}),t),Object.create(null))}},function(t,e,r){var i=r(63).BrotliInput,n=r(63).BrotliOutput,s=r(112),a=r(64),o=r(65).HuffmanCode,u=r(65).BrotliBuildHuffmanTable,h=r(115),c=r(116),l=r(117),d=8,f=16,p=256,m=704,w=26,g=6,y=2,b=8,_=255,v=1080,E=18,x=new Uint8Array([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),A=16,S=new Uint8Array([3,2,1,0,3,3,3,3,3,3,2,2,2,2,2,2]),C=new Int8Array([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),T=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 k(t){var e;return 0===t.readBits(1)?16:(e=t.readBits(3))>0?17+e:(e=t.readBits(3))>0?8+e:17}function D(t){if(t.readBits(1)){var e=t.readBits(3);return 0===e?1:t.readBits(e)+(1<1&&0===s)throw new Error("Invalid size byte");n.meta_block_length|=s<<8*i}}else for(i=0;i4&&0===a)throw new Error("Invalid size nibble");n.meta_block_length|=a<<4*i}return++n.meta_block_length,n.input_end||n.is_metadata||(n.is_uncompressed=t.readBits(1)),n}function I(t,e,r){var i;return r.fillBitWindow(),(i=t[e+=r.val_>>>r.bit_pos_&_].bits-b)>0&&(r.bit_pos_+=b,e+=t[e].value,e+=r.val_>>>r.bit_pos_&(1<>=1,++c;for(m=0;m0;++m){var v,A=x[m],S=0;i.fillBitWindow(),S+=i.val_>>>i.bit_pos_&15,i.bit_pos_+=_[S].bits,v=_[S].value,w[A]=v,0!==v&&(g-=32>>v,++y)}if(1!==y&&0!==g)throw new Error("[ReadHuffmanCode] invalid num_codes or space");!function(t,e,r,i){for(var n=0,s=d,a=0,h=0,c=32768,l=[],p=0;p<32;p++)l.push(new o(0,0));for(u(l,0,5,t,E);n0;){var m,w=0;if(i.readMoreInput(),i.fillBitWindow(),w+=i.val_>>>i.bit_pos_&31,i.bit_pos_+=l[w].bits,(m=255&l[w].value)>m);else{var g,y,b=m-14,_=0;if(m===f&&(_=s),h!==_&&(a=0,h=_),g=a,a>0&&(a-=2,a<<=b),n+(y=(a+=i.readBits(b)+3)-g)>e)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(var v=0;v>>5]),this.htrees=new Uint32Array(e)}function U(t,e){var r,i,n={num_htrees:null,context_map:null},s=0;e.readMoreInput();var a=n.num_htrees=D(e)+1,u=n.context_map=new Uint8Array(t);if(a<=1)return n;for(e.readBits(1)&&(s=e.readBits(4)+1),r=[],i=0;i=t)throw new Error("[DecodeContextMap] i >= context_map_size");u[i]=0,++i}else u[i]=h-s,++i}return e.readBits(1)&&function(t,e){var r,i=new Uint8Array(256);for(r=0;r<256;++r)i[r]=r;for(r=0;r=t&&(o-=t),i[r]=o,n[u+(1&s[h])]=o,++s[h]}function W(t,e,r,i,n,a){var o,u=n+1,h=r&n,c=a.pos_&s.IBUF_MASK;if(e<8||a.bit_pos_+(e<<3)0;)a.readMoreInput(),i[h++]=a.readBits(8),h===u&&(t.write(i,u),h=0);else{if(a.bit_end_pos_<32)throw new Error("[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32");for(;a.bit_pos_<32;)i[h]=a.val_>>>a.bit_pos_,a.bit_pos_+=8,++h,--e;if(c+(o=a.bit_end_pos_-a.bit_pos_>>3)>s.IBUF_MASK){for(var l=s.IBUF_MASK+1-c,d=0;d=u){t.write(i,u),h-=u;for(d=0;d=u;){if(o=u-h,a.input_.read(i,h,o)e.buffer.length){var yt=new Uint8Array(S+nt);yt.set(e.buffer),e.buffer=yt}if(C=gt.input_end,K=gt.is_uncompressed,gt.is_metadata)for(j(x);nt>0;--nt)x.readMoreInput(),x.readBits(8);else if(0!==nt)if(K)x.bit_pos_=x.bit_pos_+7&-8,W(e,nt,S,f,d,x),S+=nt;else{for(r=0;r<3;++r)ot[r]=D(x)+1,ot[r]>=2&&(N(ot[r]+2,_,r*v,x),N(w,E,r*v,x),st[r]=F(E,r*v,x),ht[r]=1);for(x.readMoreInput(),J=(1<<(V=x.readBits(2)))-1,Z=(Y=A+(x.readBits(4)<0;){var vt,Et,xt,At,St,Ct,Tt,kt,Dt,Rt,Ot,It;for(x.readMoreInput(),0===st[1]&&(M(ot[1],_,1,at,ut,ht,x),st[1]=F(E,v,x),it=G[1].htrees[at[1]]),--st[1],(Et=(vt=I(G[1].codes,it,x))>>6)>=2?(Et-=2,Tt=-1):Tt=0,xt=c.kInsertRangeLut[Et]+(vt>>3&7),At=c.kCopyRangeLut[Et]+(7&vt),St=c.kInsertLengthPrefixCode[xt].offset+x.readBits(c.kInsertLengthPrefixCode[xt].nbits),Ct=c.kCopyLengthPrefixCode[At].offset+x.readBits(c.kCopyLengthPrefixCode[At].nbits),z=f[S-1&d],H=f[S-2&d],Dt=0;Dt4?3:Ct-2))],(Tt=I(G[2].codes,G[2].htrees[pt],x))>=Y)It=(Tt-=Y)&J,Tt=Y+((Nt=(2+(1&(Tt>>=V))<<(Ot=1+(Tt>>1)))-4)+x.readBits(Ot)<(T=S=a.minDictionaryWordLength&&Ct<=a.maxDictionaryWordLength))throw new Error("Invalid backward reference. pos: "+S+" distance: "+kt+" len: "+Ct+" bytes left: "+nt);var Nt=a.offsetsByLength[Ct],Ft=kt-T-1,Bt=a.sizeBitsByLength[Ct],Pt=Ft>>Bt;if(Nt+=(Ft&(1<=b){e.write(f,u);for(var Ut=0;Ut0&&(R[3&P]=kt,++P),Ct>nt)throw new Error("Invalid backward reference. pos: "+S+" distance: "+kt+" len: "+Ct+" bytes left: "+nt);for(Dt=0;Dtthis.buffer.length&&(r=this.buffer.length-this.pos);for(var i=0;ithis.buffer.length)throw new Error("Output buffer is not large enough");return this.buffer.set(t.subarray(0,e),this.pos),this.pos+=e,e},e.BrotliOutput=i},function(t,e,r){var i=r(113);e.init=function(){e.dictionary=i.init()},e.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]),e.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]),e.minDictionaryWordLength=4,e.maxDictionaryWordLength=24},function(t,e){function r(t,e){this.bits=t,this.value=e}e.HuffmanCode=r;var i=15;function n(t,e){for(var r=1<>=1;return(t&r-1)+r}function s(t,e,i,n,s){do{t[e+(n-=i)]=new r(s.bits,s.value)}while(n>0)}function a(t,e,r){for(var n=1<0;--v[c])s(t,e+d,f,g,new r(255&c,65535&b[l++])),d=n(d,c);for(m=y-1,p=-1,c=o+1,f=2;c<=i;++c,f<<=1)for(;v[c]>0;--v[c])(d&m)!==p&&(e+=g,y+=g=1<<(w=a(v,c,o)),t[_+(p=d&m)]=new r(w+o&255,e-_-p&65535)),s(t,e+(d>>o),f,g,new r(c-o&255,65535&b[l++])),d=n(d,c);return y}},function(t,e,r){"use strict";t.exports=function(t,e,r,i){for(var n=65535&t|0,s=t>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{s=s+(n=n+e[i++]|0)|0}while(--a);n%=65521,s%=65521}return n|s<<16|0}},function(t,e,r){"use strict";var i=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();t.exports=function(t,e,r,n){var s=i,a=n+r;t^=-1;for(var o=n;o>>8^s[255&(t^e[o])];return-1^t}},function(t,e,r){"use strict";var i=r(8),n=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(t){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){s=!1}for(var a=new i.Buf8(256),o=0;o<256;o++)a[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;function u(t,e){if(e<65534&&(t.subarray&&s||!t.subarray&&n))return String.fromCharCode.apply(null,i.shrinkBuf(t,e));for(var r="",a=0;a>>6,e[a++]=128|63&r):r<65536?(e[a++]=224|r>>>12,e[a++]=128|r>>>6&63,e[a++]=128|63&r):(e[a++]=240|r>>>18,e[a++]=128|r>>>12&63,e[a++]=128|r>>>6&63,e[a++]=128|63&r);return e},e.buf2binstring=function(t){return u(t,t.length)},e.binstring2buf=function(t){for(var e=new i.Buf8(t.length),r=0,n=e.length;r4)h[i++]=65533,r+=s-1;else{for(n&=2===s?31:3===s?15:7;s>1&&r1?h[i++]=65533:n<65536?h[i++]=n:(n-=65536,h[i++]=55296|n>>10&1023,h[i++]=56320|1023&n)}return u(h,i)},e.utf8border=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;r>=0&&128==(192&t[r]);)r--;return r<0?e:0===r?e:r+a[t[r]]>e?r:e}},function(t,e,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(t,e,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(t,e,r){"use strict";t.exports=function(t,e,r,i){for(var n=65535&t|0,s=t>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{s=s+(n=n+e[i++]|0)|0}while(--a);n%=65521,s%=65521}return n|s<<16|0}},function(t,e,r){"use strict";var i=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();t.exports=function(t,e,r,n){var s=i,a=n+r;t^=-1;for(var o=n;o>>8^s[255&(t^e[o])];return-1^t}},function(t,e,r){"use strict";var i=r(11),n=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(t){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){s=!1}for(var a=new i.Buf8(256),o=0;o<256;o++)a[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;function u(t,e){if(e<65534&&(t.subarray&&s||!t.subarray&&n))return String.fromCharCode.apply(null,i.shrinkBuf(t,e));for(var r="",a=0;a>>6,e[a++]=128|63&r):r<65536?(e[a++]=224|r>>>12,e[a++]=128|r>>>6&63,e[a++]=128|63&r):(e[a++]=240|r>>>18,e[a++]=128|r>>>12&63,e[a++]=128|r>>>6&63,e[a++]=128|63&r);return e},e.buf2binstring=function(t){return u(t,t.length)},e.binstring2buf=function(t){for(var e=new i.Buf8(t.length),r=0,n=e.length;r4)h[i++]=65533,r+=s-1;else{for(n&=2===s?31:3===s?15:7;s>1&&r1?h[i++]=65533:n<65536?h[i++]=n:(n-=65536,h[i++]=55296|n>>10&1023,h[i++]=56320|1023&n)}return u(h,i)},e.utf8border=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;r>=0&&128==(192&t[r]);)r--;return r<0?e:0===r?e:r+a[t[r]]>e?r:e}},function(t,e,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(t,e,r){"use strict";var i=r(15);t.exports=new i({include:[r(76)]})},function(t,e,r){"use strict";var i=r(15);t.exports=new i({include:[r(43)],implicit:[r(148),r(149),r(150),r(151)]})},function(t,e,r){"use strict";e.Commented=r(168),e.Diagnose=r(177),e.Decoder=r(31),e.Encoder=r(78),e.Simple=r(23),e.Tagged=r(47),e.Map=r(178),e.comment=e.Commented.comment,e.decodeAll=e.Decoder.decodeAll,e.decodeFirst=e.Decoder.decodeFirst,e.decodeAllSync=e.Decoder.decodeAllSync,e.decodeFirstSync=e.Decoder.decodeFirstSync,e.diagnose=e.Diagnose.diagnose,e.encode=e.Encoder.encode,e.encodeCanonical=e.Encoder.encodeCanonical,e.encodeOne=e.Encoder.encodeOne,e.encodeAsync=e.Encoder.encodeAsync,e.decode=e.Decoder.decodeFirstSync,e.leveldb={decode:e.Decoder.decodeAllSync,encode:e.Encoder.encode,buffer:!0,name:"cbor"},e.hasBigInt=r(16).hasBigInt},function(t,e,r){"use strict";(function(e){const i=r(4),n=r(48),s=r(17).BigNumber,a=r(24),o=(r(47),r(23),r(16)),u=r(12),h=u.MT,c=u.NUMBYTES,l=u.SHIFT32,d=u.SYMS,f=u.TAG,p=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.TWO,m=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.FOUR,w=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.EIGHT,g=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.TRUE,y=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.FALSE,b=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.UNDEFINED,_=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.NULL,v=new s("0x20000000000000"),E=e.from("f97e00","hex"),x=e.from("f9fc00","hex"),A=e.from("f97c00","hex"),S=e.from("f98000","hex"),C=Symbol("CBOR_LOOP_DETECT");class T extends i.Transform{constructor(t){const r=Object.assign({},t,{readableObjectMode:!1,writableObjectMode:!0});super(r),this.canonical=r.canonical,this.encodeUndefined=r.encodeUndefined,this.disallowUndefinedKeys=!!r.disallowUndefinedKeys,this.dateType=null!=r.dateType?r.dateType.toLowerCase():"number","symbol"==typeof r.detectLoops?this.detectLoops=r.detectLoops:this.detectLoops=r.detectLoops?Symbol("CBOR_DETECT"):null,this.semanticTypes=[Array,this._pushArray,Date,this._pushDate,e,this._pushBuffer,Map,this._pushMap,a,this._pushNoFilter,RegExp,this._pushRegexp,Set,this._pushSet,s,this._pushBigNumber,ArrayBuffer,this._pushUint8Array,Uint8ClampedArray,this._pushUint8Array,Uint8Array,this._pushUint8Array,Uint16Array,this._pushArray,Uint32Array,this._pushArray,Int8Array,this._pushArray,Int16Array,this._pushArray,Int32Array,this._pushArray,Float32Array,this._pushFloat32Array,Float64Array,this._pushFloat64Array],n.Url&&this.semanticTypes.push(n.Url,this._pushUrl),n.URL&&this.semanticTypes.push(n.URL,this._pushURL);const i=r.genTypes||[];for(let t=0,e=i.length;t{i.pushAny(t);const r=n.read();i.pushAny(e);const s=n.read();return r.compare(s)});for(const[e,i]of r){if(t.disallowUndefinedKeys&&void 0===e)throw new Error("Invalid Map key: undefined");if(!t.pushAny(e)||!t.pushAny(i))return!1}}else for(const[r,i]of e){if(t.disallowUndefinedKeys&&void 0===r)throw new Error("Invalid Map key: undefined");if(!t.pushAny(r)||!t.pushAny(i))return!1}return!0}_pushUint8Array(t,r){return t._pushBuffer(t,e.from(r))}_pushFloat32Array(t,e){const r=e.length;if(!t._pushInt(r,h.ARRAY))return!1;for(let i=0;i{const r=i[t]||(i[t]=T.encode(t)),n=i[e]||(i[e]=T.encode(e));return r.compare(n)}),!this._pushInt(r.length,h.MAP))return!1;let n;for(let e=0,s=r.length;e{const s=[],a=new T(r);a.on("data",t=>s.push(t)),a.on("error",n),a.on("finish",()=>i(e.concat(s))),a.pushAny(t),a.end()})}}t.exports=T}).call(this,r(3).Buffer)},function(t,e,r){"use strict";const i=r(49),{escapeString:n}=r(109);t.exports=class extends i{constructor(){super({sourceCodeLocationInfo:!0}),this.posTracker=this.locInfoMixin.posTracker}_transformChunk(t){super._transformChunk(t)}_getRawHtml(t){const e=this.posTracker.droppedBufferSize,r=t.startOffset-e,i=t.endOffset-e;return this.tokenizer.preprocessor.html.slice(r,i)}_handleToken(t){super._handleToken(t)||this.emitRaw(this._getRawHtml(t.location)),this.parserFeedbackSimulator.skipNextNewLine=!1}_emitToken(t,e){this.emit(t,e,this._getRawHtml(e.sourceCodeLocation))}emitDoctype(t){let e=`",this.push(e)}emitStartTag(t){let e=`<${t.tagName}`;const r=t.attrs;for(let t=0;t":">",this.push(e)}emitEndTag(t){this.push(``)}emitText({text:t}){this.push(n(t,!1))}emitComment(t){this.push(`\x3c!--${t.text}--\x3e`)}emitRaw(t){this.push(t)}}},function(t,e,r){t.exports=r(62).BrotliDecompressBuffer},function(t,e,r){"use strict";var i=r(126),n=r(11),s=r(73),a=r(129),o=r(42),u=r(74),h=r(130),c=Object.prototype.toString;function l(t){if(!(this instanceof l))return new l(t);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var r=i.inflateInit2(this.strm,e.windowBits);if(r!==a.Z_OK)throw new Error(o[r]);if(this.header=new h,i.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=s.string2buf(e.dictionary):"[object ArrayBuffer]"===c.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=i.inflateSetDictionary(this.strm,e.dictionary))!==a.Z_OK))throw new Error(o[r])}function d(t,e){var r=new l(e);if(r.push(t,!0),r.err)throw r.msg||o[r.err];return r.result}l.prototype.push=function(t,e){var r,o,u,h,l,d=this.strm,f=this.options.chunkSize,p=this.options.dictionary,m=!1;if(this.ended)return!1;o=e===~~e?e:!0===e?a.Z_FINISH:a.Z_NO_FLUSH,"string"==typeof t?d.input=s.binstring2buf(t):"[object ArrayBuffer]"===c.call(t)?d.input=new Uint8Array(t):d.input=t,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new n.Buf8(f),d.next_out=0,d.avail_out=f),(r=i.inflate(d,a.Z_NO_FLUSH))===a.Z_NEED_DICT&&p&&(r=i.inflateSetDictionary(this.strm,p)),r===a.Z_BUF_ERROR&&!0===m&&(r=a.Z_OK,m=!1),r!==a.Z_STREAM_END&&r!==a.Z_OK)return this.onEnd(r),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&r!==a.Z_STREAM_END&&(0!==d.avail_in||o!==a.Z_FINISH&&o!==a.Z_SYNC_FLUSH)||("string"===this.options.to?(u=s.utf8border(d.output,d.next_out),h=d.next_out-u,l=s.buf2string(d.output,u),d.next_out=h,d.avail_out=f-h,h&&n.arraySet(d.output,d.output,u,h,0),this.onData(l)):this.onData(n.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(m=!0)}while((d.avail_in>0||0===d.avail_out)&&r!==a.Z_STREAM_END);return r===a.Z_STREAM_END&&(o=a.Z_FINISH),o===a.Z_FINISH?(r=i.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===a.Z_OK):o!==a.Z_SYNC_FLUSH||(this.onEnd(a.Z_OK),d.avail_out=0,!0)},l.prototype.onData=function(t){this.chunks.push(t)},l.prototype.onEnd=function(t){t===a.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=l,e.inflate=d,e.inflateRaw=function(t,e){return(e=e||{}).raw=!0,d(t,e)},e.ungzip=d},function(t,e,r){"use strict";!function(){var e,i,n,s=0,a=[];for(i=0;i<256;i++)a[i]=(i+256).toString(16).substr(1);function o(){var t,r=(t=16,(!e||s+t>u.BUFFER_SIZE)&&(s=0,e=u.randomBytes(u.BUFFER_SIZE)),e.slice(s,s+=t));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,r}function u(){var t=o();return a[t[0]]+a[t[1]]+a[t[2]]+a[t[3]]+"-"+a[t[4]]+a[t[5]]+"-"+a[t[6]]+a[t[7]]+"-"+a[t[8]]+a[t[9]]+"-"+a[t[10]]+a[t[11]]+a[t[12]]+a[t[13]]+a[t[14]]+a[t[15]]}u.BUFFER_SIZE=4096,u.bin=o,u.clearBuffer=function(){e=null,s=0},u.test=function(t){return"string"==typeof t&&/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(t)},"undefined"!=typeof crypto?n=crypto:"undefined"!=typeof window&&void 0!==window.msCrypto&&(n=window.msCrypto),n=n||r(131),t.exports=u,u.randomBytes=function(){if(n){if(n.randomBytes)return n.randomBytes;if(n.getRandomValues)return function(t){var e=new Uint8Array(t);return n.getRandomValues(e),e}}return function(t){var e,r=[];for(e=0;e=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(i)return j(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return C(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return D(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function w(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function g(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=u.from(e,i)),u.isBuffer(e))return 0===e.length?-1:y(t,e,r,i,n);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,i,n){var s,a=1,o=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;a=2,o/=2,u/=2,r/=2}function h(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(n){var c=-1;for(s=r;so&&(r=o-u),s=r;s>=0;s--){for(var l=!0,d=0;dn&&(i=n):i=n;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var a=0;a>8,n=r%256,s.push(n),s.push(i);return s}(e,t.length-r),t,r,i)}function S(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function C(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:h>223?3:h>191?2:1;if(n+l<=r)switch(l){case 1:h<128&&(c=h);break;case 2:128==(192&(s=t[n+1]))&&(u=(31&h)<<6|63&s)>127&&(c=u);break;case 3:s=t[n+1],a=t[n+2],128==(192&s)&&128==(192&a)&&(u=(15&h)<<12|(63&s)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:s=t[n+1],a=t[n+2],o=t[n+3],128==(192&s)&&128==(192&a)&&128==(192&o)&&(u=(15&h)<<18|(63&s)<<12|(63&a)<<6|63&o)>65535&&u<1114112&&(c=u)}null===c?(c=65533,l=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|1023&c),i.push(c),n+=l}return function(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);var r="",i=0;for(;i0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},u.prototype.compare=function(t,e,r,i,n){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var s=(n>>>=0)-(i>>>=0),a=(r>>>=0)-(e>>>=0),o=Math.min(s,a),h=this.slice(i,n),c=t.slice(e,r),l=0;ln)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return E(this,t,e,r);case"base64":return x(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function k(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;ni)&&(r=i);for(var n="",s=e;sr)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,i,n,s){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function F(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,s=Math.min(t.length-r,2);n>>8*(i?n:1-n)}function B(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,s=Math.min(t.length-r,4);n>>8*(i?n:3-n)&255}function P(t,e,r,i,n,s){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(t,e,r,i,s){return s||P(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function U(t,e,r,i,s){return s||P(t,0,r,8),n.write(t,e,r,i,52,8),r+8}u.prototype.slice=function(t,e){var r,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(n*=256);)i+=this[t+--e]*n;return i},u.prototype.readUInt8=function(t,e){return e||I(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||I(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||I(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||I(t,e,this.length);for(var i=this[t],n=1,s=0;++s=(n*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||I(t,e,this.length);for(var i=e,n=1,s=this[t+--i];i>0&&(n*=256);)s+=this[t+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*e)),s},u.prototype.readInt8=function(t,e){return e||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||I(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||I(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||I(t,4,this.length),n.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||I(t,4,this.length),n.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||I(t,8,this.length),n.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||I(t,8,this.length),n.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||N(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,s=0;for(this[e]=255&t;++s=0&&(s*=256);)this[e+n]=t/s&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):B(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}var s=0,a=1,o=0;for(this[e]=255&t;++s>0)-o&255;return e+r},u.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}var s=r-1,a=1,o=0;for(this[e+s]=255&t;--s>=0&&(a*=256);)t<0&&0===o&&0!==this[e+s+1]&&(o=1),this[e+s]=(t/a>>0)-o&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):B(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,i){if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--n)t[n+e]=this[n+r];else if(s<1e3||!u.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=e;s55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(a+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function z(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}}).call(this,r(6))},function(t,e,r){t.exports=n;var i=r(36).EventEmitter;function n(){i.call(this)}r(9)(n,i),n.Readable=r(37),n.Writable=r(98),n.Duplex=r(99),n.Transform=r(100),n.PassThrough=r(101),n.Stream=n,n.prototype.pipe=function(t,e){var r=this;function n(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function s(){r.readable&&r.resume&&r.resume()}r.on("data",n),t.on("drain",s),t._isStdio||e&&!1===e.end||(r.on("end",o),r.on("close",u));var a=!1;function o(){a||(a=!0,t.end())}function u(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function h(t){if(c(),0===i.listenerCount(this,"error"))throw t}function c(){r.removeListener("data",n),t.removeListener("drain",s),r.removeListener("end",o),r.removeListener("close",u),r.removeListener("error",h),t.removeListener("error",h),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c)}return r.on("error",h),t.on("error",h),r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var i=r(1),n=r(0);const s=new TextDecoder("utf-8");class a{static fromResponse({url:t,response:e,date:r,noRW:n,isLive:s}){const o=e.body?new i.a(e.body.getReader(),!1):null,u=Number(e.headers.get("x-redirect-status")||e.status),h=e.statusText;let c=e.headers;const l=c.get("x-proxy-set-cookie");if(l){const t=[];l.split(",").forEach(e=>{const r=e.split(";",1)[0].trim();r.indexOf("=")>0&&t.push(r)}),t.length&&((c=new Headers(c)).set("x-wabac-preset-cookie",t.join(";")),console.log("cookies",t.join(";")))}return new a({payload:o,status:u,statusText:h,headers:c,url:t,date:r,noRW:n,isLive:s})}constructor({payload:t,status:e,statusText:r,headers:i,url:n,date:s,extraOpts:a=null,noRW:o=!1,isLive:u=!1}){this.reader=null,this.buffer=null,t&&t[Symbol.asyncIterator]?this.reader=t:this.buffer=t,this.status=e,this.statusText=r,this.headers=i,this.url=n,this.date=s,this.extraOpts=a,this.noRW=o,this.isLive=u}async getText(){const t=await this.getBuffer();return"string"==typeof t?t:s.decode(t)}async getBuffer(){return this.buffer?this.buffer:(this.buffer=await this.reader.readFully(),this.buffer)}async setContent(t){t instanceof i.b?(this.reader=t,this.buffer=null):t.getReader?(this.reader=new i.a(t.getReader()),this.buffer=null):(this.reader=null,this.buffer=t)}async*[Symbol.asyncIterator](){this.buffer?yield this.buffer:this.reader&&(yield*this.reader)}setRange(t){const e=t.match(/^bytes\=(\d+)\-(\d+)?$/);let r=0;if(this.buffer)r=this.buffer.length;else if(this.reader&&!(r=Number(this.headers.get("content-length"))))return;if(!e)return this.status=416,this.statusText="Range Not Satisfiable",this.headers.set("Content-Range",`*/${r}`),!1;const i=Number(e[1]),n=Number(e[2])||r-1;return this.buffer?this.buffer=this.buffer.slice(i,n+1):this.reader&&(0===i&&n===r-1||this.reader.setLimitSkip(n-i+1,i)),this.headers.set("Content-Range",`bytes ${i}-${n}/${r}`),this.headers.set("Content-Length",n-i+1),this.status=206,this.statusText="Partial Content",!0}makeResponse(){let t=null;Object(n.h)(this.status)||(t=this.buffer||!this.reader?this.buffer:this.reader.getReadableStream());const e=new Response(t,{status:this.status,statusText:this.statusText,headers:this.headers});return e.date=this.date,e}}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";const i=function(t,e){const r=e.exec(t);return!(null==r)};e.isExist=function(t){return void 0!==t},e.isEmptyObject=function(t){return 0===Object.keys(t).length},e.merge=function(t,e,r){if(e){const i=Object.keys(e),n=i.length;for(let s=0;s1)for(var r=1;rt.decode(e),e.utf8.checksUTF8=!0}else e.utf8=t=>t.toString("utf8"),e.utf8.checksUTF8=!1;e.parseCBORint=function(t,e){switch(t){case a.ONE:return e.readUInt8(0);case a.TWO:return e.readUInt16BE(0);case a.FOUR:return e.readUInt32BE(0);case a.EIGHT:const r=e.readUInt32BE(0),i=e.readUInt32BE(4);return r>2097151?new n(r).times(o).plus(i):r*o+i;default:throw new Error("Invalid additional info for int: "+t)}},e.writeHalf=function(e,r){const i=t.allocUnsafe(4);i.writeFloatBE(r,0);const n=i.readUInt32BE(0);if(0!=(8191&n))return!1;let s=n>>16&32768;const a=n>>23&255,o=8388607&n;if(a>=113&&a<=142)s+=(a-112<<10)+(o>>13);else{if(!(a>=103&&a<113))return!1;if(o&(1<<126-a)-1)return!1;s+=o+8388608>>126-a}return e.writeUInt16BE(s),!0},e.parseHalf=function(t){const e=128&t[0]?-1:1,r=(124&t[0])>>2,i=(3&t[0])<<8|t[1];return r?31===r?e*(i?NaN:Infinity):e*Math.pow(2,r-25)*(1024+i):5.960464477539063e-8*e*i},e.parseCBORfloat=function(t){switch(t.length){case 2:return e.parseHalf(t);case 4:return t.readFloatBE(0);case 8:return t.readDoubleBE(0);default:throw new Error("Invalid float size: "+t.length)}},e.hex=function(e){return t.from(e.replace(/^0x/,""),"hex")},e.bin=function(e){let r=0,i=(e=e.replace(/\s/g,"")).length%8||8;const n=[];for(;i<=e.length;)n.push(parseInt(e.slice(r,i),2)),r=i,i+=8;return t.from(n)},e.extend=function(t={},...e){const r=e.length;for(let i=0;it===e[r]))},e.bufferEqual=function(e,r){if(null==e&&null==r)return!0;if(null==e||null==r)return!1;if(!t.isBuffer(e)||!t.isBuffer(r)||e.length!==r.length)return!1;const i=e.length;let n,s,a=!0;for(n=s=0;s0||t===e?e:e-1}function y(t){for(var e,r,i=1,n=t.length,s=t[0]+"";ih^r?1:-1;for(o=(u=n.length)<(h=s.length)?u:h,a=0;as[a]^r?1:-1;return u==h?0:u>h^r?1:-1}function _(t,e,r,i){if(tr||t!==u(t))throw Error(h+(i||"Argument")+("number"==typeof t?tr?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function v(t){var e=t.c.length-1;return g(t.e/d)==e&&t.c[e]%2!=0}function E(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function x(t,e,r){var i,n;if(e<0){for(n=r+".";++e;n+=r);t=n+t}else if(++e>(i=t.length)){for(n=r,e-=i;--e;n+=r);t+=n}else eP?g.c=g.e=null:t.e=10;l/=10,h++);return void(h>P?g.c=g.e=null:(g.e=h,g.c=[t]))}w=String(t)}else{if(!a.test(w=String(t)))return n(g,w,p);g.s=45==w.charCodeAt(0)?(w=w.slice(1),-1):1}(h=w.indexOf("."))>-1&&(w=w.replace(".","")),(l=w.search(/e/i))>0?(h<0&&(h=l),h+=+w.slice(l+1),w=w.substring(0,l)):h<0&&(h=w.length)}else{if(_(e,2,j.length,"Base"),10==e)return X(g=new z(t),O+g.e+1,I);if(w=String(t),p="number"==typeof t){if(0*t!=0)return n(g,w,p,e);if(g.s=1/t<0?(w=w.slice(1),-1):1,z.DEBUG&&w.replace(/^0\.0*|\./,"").length>15)throw Error(c+t)}else g.s=45===w.charCodeAt(0)?(w=w.slice(1),-1):1;for(r=j.slice(0,e),h=l=0,m=w.length;lh){h=m;continue}}else if(!o&&(w==w.toUpperCase()&&(w=w.toLowerCase())||w==w.toLowerCase()&&(w=w.toUpperCase()))){o=!0,l=-1,h=0;continue}return n(g,String(t),p,e)}p=!1,(h=(w=i(w,e,10,g.s)).indexOf("."))>-1?w=w.replace(".",""):h=w.length}for(l=0;48===w.charCodeAt(l);l++);for(m=w.length;48===w.charCodeAt(--m););if(w=w.slice(l,++m)){if(m-=l,p&&z.DEBUG&&m>15&&(t>f||t!==u(t)))throw Error(c+g.s*t);if((h=h-l-1)>P)g.c=g.e=null;else if(h=F)?E(u,a):x(u,a,"0");else if(s=(t=X(new z(t),e,r)).e,o=(u=y(t.c)).length,1==i||2==i&&(e<=s||s<=N)){for(;oo){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=s-o)>0)for(s+1==o&&(u+=".");e--;u+="0");return t.s<0&&n?"-"+u:u}function G(t,e){for(var r,i=1,n=new z(t[0]);i=10;n/=10,i++);return(r=i+r*d-1)>P?t.c=t.e=null:r=10;h/=10,n++);if((s=e-n)<0)s+=d,a=e,m=(c=w[f=0])/g[n-a-1]%10|0;else if((f=o((s+1)/d))>=w.length){if(!i)break t;for(;w.length<=f;w.push(0));c=m=0,n=1,a=(s%=d)-d+1}else{for(c=h=w[f],n=1;h>=10;h/=10,n++);m=(a=(s%=d)-d+n)<0?0:c/g[n-a-1]%10|0}if(i=i||e<0||null!=w[f+1]||(a<0?c:c%g[n-a-1]),i=r<4?(m||i)&&(0==r||r==(t.s<0?3:2)):m>5||5==m&&(4==r||i||6==r&&(s>0?a>0?c/g[n-a]:0:w[f-1])%10&1||r==(t.s<0?8:7)),e<1||!w[0])return w.length=0,i?(e-=t.e+1,w[0]=g[(d-e%d)%d],t.e=-e||0):w[0]=t.e=0,t;if(0==s?(w.length=f,h=1,f--):(w.length=f+1,h=g[d-s],w[f]=a>0?u(c/g[n-a]%g[a])*h:0),i)for(;;){if(0==f){for(s=1,a=w[0];a>=10;a/=10,s++);for(a=w[0]+=h,h=1;a>=10;a/=10,h++);s!=h&&(t.e++,w[0]==l&&(w[0]=1));break}if(w[f]+=h,w[f]!=l)break;w[f--]=0,h=1}for(s=w.length;0===w[--s];w.pop());}t.e>P?t.c=t.e=null:t.e=F?E(e,r):x(e,r,"0"),t.s<0?"-"+e:e)}return z.clone=t,z.ROUND_UP=0,z.ROUND_DOWN=1,z.ROUND_CEIL=2,z.ROUND_FLOOR=3,z.ROUND_HALF_UP=4,z.ROUND_HALF_DOWN=5,z.ROUND_HALF_EVEN=6,z.ROUND_HALF_CEIL=7,z.ROUND_HALF_FLOOR=8,z.EUCLID=9,z.config=z.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(h+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(_(r=t[e],0,w,e),O=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(_(r=t[e],0,8,e),I=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(_(r[0],-w,0,e),_(r[1],0,w,e),N=r[0],F=r[1]):(_(r,-w,w,e),N=-(F=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)_(r[0],-w,-1,e),_(r[1],1,w,e),B=r[0],P=r[1];else{if(_(r,-w,w,e),!r)throw Error(h+e+" cannot be zero: "+r);B=-(P=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(h+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw L=!r,Error(h+"crypto unavailable");L=r}else L=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(_(r=t[e],0,9,e),U=r),t.hasOwnProperty(e="POW_PRECISION")&&(_(r=t[e],0,w,e),M=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(h+e+" not an object: "+r);W=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(h+e+" invalid: "+r);j=r}}return{DECIMAL_PLACES:O,ROUNDING_MODE:I,EXPONENTIAL_AT:[N,F],RANGE:[B,P],CRYPTO:L,MODULO_MODE:U,POW_PRECISION:M,FORMAT:W,ALPHABET:j}},z.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!z.DEBUG)return!0;var e,r,i=t.c,n=t.e,s=t.s;t:if("[object Array]"=={}.toString.call(i)){if((1===s||-1===s)&&n>=-w&&n<=w&&n===u(n)){if(0===i[0]){if(0===n&&1===i.length)return!0;break t}if((e=(n+1)%d)<1&&(e+=d),String(i[0]).length==e){for(e=0;e=l||r!==u(r))break t;if(0!==r)return!0}}}else if(null===i&&null===n&&(null===s||1===s||-1===s))return!0;throw Error(h+"Invalid BigNumber: "+t)},z.maximum=z.max=function(){return G(arguments,D.lt)},z.minimum=z.min=function(){return G(arguments,D.gt)},z.random=(s=9007199254740992*Math.random()&2097151?function(){return u(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,i,n,a,c=0,l=[],f=new z(R);if(null==t?t=O:_(t,0,w),n=o(t/d),L)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(n*=2));c>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[c]=r[0],e[c+1]=r[1]):(l.push(a%1e14),c+=2);c=n/2}else{if(!crypto.randomBytes)throw L=!1,Error(h+"crypto unavailable");for(e=crypto.randomBytes(n*=7);c=9e15?crypto.randomBytes(7).copy(e,c):(l.push(a%1e14),c+=7);c=n/7}if(!L)for(;c=10;a/=10,c++);cr-1&&(null==a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}return function(e,i,n,s,a){var o,u,h,c,l,d,f,p,m=e.indexOf("."),w=O,g=I;for(m>=0&&(c=M,M=0,e=e.replace(".",""),d=(p=new z(i)).pow(e.length-m),M=c,p.c=t(x(y(d.c),d.e,"0"),10,n,"0123456789"),p.e=p.c.length),h=c=(f=t(e,i,n,a?(o=j,"0123456789"):(o="0123456789",j))).length;0==f[--c];f.pop());if(!f[0])return o.charAt(0);if(m<0?--h:(d.c=f,d.e=h,d.s=s,f=(d=r(d,p,w,g,n)).c,l=d.r,h=d.e),m=f[u=h+w+1],c=n/2,l=l||u<0||null!=f[u+1],l=g<4?(null!=m||l)&&(0==g||g==(d.s<0?3:2)):m>c||m==c&&(4==g||l||6==g&&1&f[u-1]||g==(d.s<0?8:7)),u<1||!f[0])e=l?x(o.charAt(1),-w,o.charAt(0)):o.charAt(0);else{if(f.length=u,l)for(--n;++f[--u]>n;)f[u]=0,u||(++h,f=[1].concat(f));for(c=f.length;!f[--c];);for(m=0,e="";m<=c;e+=o.charAt(f[m++]));e=x(e,h,o.charAt(0))}return e}}(),r=function(){function t(t,e,r){var i,n,s,a,o=0,u=t.length,h=e%m,c=e/m|0;for(t=t.slice();u--;)o=((n=h*(s=t[u]%m)+(i=c*s+(a=t[u]/m|0)*h)%m*m+o)/r|0)+(i/m|0)+c*a,t[u]=n%r;return o&&(t=[o].concat(t)),t}function e(t,e,r,i){var n,s;if(r!=i)s=r>i?1:-1;else for(n=s=0;ne[n]?1:-1;break}return s}function r(t,e,r,i){for(var n=0;r--;)t[r]-=n,n=t[r]1;t.splice(0,1));}return function(i,n,s,a,o){var h,c,f,p,m,w,y,b,_,v,E,x,A,S,C,T,k,D=i.s==n.s?1:-1,R=i.c,O=n.c;if(!(R&&R[0]&&O&&O[0]))return new z(i.s&&n.s&&(R?!O||R[0]!=O[0]:O)?R&&0==R[0]||!O?0*D:D/0:NaN);for(_=(b=new z(D)).c=[],D=s+(c=i.e-n.e)+1,o||(o=l,c=g(i.e/d)-g(n.e/d),D=D/d|0),f=0;O[f]==(R[f]||0);f++);if(O[f]>(R[f]||0)&&c--,D<0)_.push(1),p=!0;else{for(S=R.length,T=O.length,f=0,D+=2,(m=u(o/(O[0]+1)))>1&&(O=t(O,m,o),R=t(R,m,o),T=O.length,S=R.length),A=T,E=(v=R.slice(0,T)).length;E=o/2&&C++;do{if(m=0,(h=e(O,v,T,E))<0){if(x=v[0],T!=E&&(x=x*o+(v[1]||0)),(m=u(x/C))>1)for(m>=o&&(m=o-1),y=(w=t(O,m,o)).length,E=v.length;1==e(w,v,y,E);)m--,r(w,T=10;D/=10,f++);X(b,s+(b.e=f+c*d-1)+1,a,p)}else b.e=c,b.r=+p;return b}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,S=/^([^.]+)\.$/,C=/^\.([^.]+)$/,T=/^-?(Infinity|NaN)$/,k=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(t,e,r,i){var n,s=r?e:e.replace(k,"");if(T.test(s))t.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(A,(function(t,e,r){return n="x"==(r=r.toLowerCase())?16:"b"==r?2:8,i&&i!=n?t:e})),i&&(n=i,s=s.replace(S,"$1").replace(C,"0.$1")),e!=s))return new z(s,n);if(z.DEBUG)throw Error(h+"Not a"+(i?" base "+i:"")+" number: "+e);t.s=null}t.c=t.e=null},D.absoluteValue=D.abs=function(){var t=new z(this);return t.s<0&&(t.s=1),t},D.comparedTo=function(t,e){return b(this,new z(t,e))},D.decimalPlaces=D.dp=function(t,e){var r,i,n,s=this;if(null!=t)return _(t,0,w),null==e?e=I:_(e,0,8),X(new z(s),t+s.e+1,e);if(!(r=s.c))return null;if(i=((n=r.length-1)-g(this.e/d))*d,n=r[n])for(;n%10==0;n/=10,i--);return i<0&&(i=0),i},D.dividedBy=D.div=function(t,e){return r(this,new z(t,e),O,I)},D.dividedToIntegerBy=D.idiv=function(t,e){return r(this,new z(t,e),0,1)},D.exponentiatedBy=D.pow=function(t,e){var r,i,n,s,a,c,l,f,p=this;if((t=new z(t)).c&&!t.isInteger())throw Error(h+"Exponent not an integer: "+K(t));if(null!=e&&(e=new z(e)),a=t.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!t.c||!t.c[0])return f=new z(Math.pow(+K(p),a?2-v(t):+K(t))),e?f.mod(e):f;if(c=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new z(NaN);(i=!c&&p.isInteger()&&e.isInteger())&&(p=p.mod(e))}else{if(t.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||a&&p.c[1]>=24e7:p.c[0]<8e13||a&&p.c[0]<=9999975e7)))return s=p.s<0&&v(t)?-0:0,p.e>-1&&(s=1/s),new z(c?1/s:s);M&&(s=o(M/d+2))}for(a?(r=new z(.5),c&&(t.s=1),l=v(t)):l=(n=Math.abs(+K(t)))%2,f=new z(R);;){if(l){if(!(f=f.times(p)).c)break;s?f.c.length>s&&(f.c.length=s):i&&(f=f.mod(e))}if(n){if(0===(n=u(n/2)))break;l=n%2}else if(X(t=t.times(r),t.e+1,1),t.e>14)l=v(t);else{if(0===(n=+K(t)))break;l=n%2}p=p.times(p),s?p.c&&p.c.length>s&&(p.c.length=s):i&&(p=p.mod(e))}return i?f:(c&&(f=R.div(f)),e?f.mod(e):s?X(f,M,I,void 0):f)},D.integerValue=function(t){var e=new z(this);return null==t?t=I:_(t,0,8),X(e,e.e+1,t)},D.isEqualTo=D.eq=function(t,e){return 0===b(this,new z(t,e))},D.isFinite=function(){return!!this.c},D.isGreaterThan=D.gt=function(t,e){return b(this,new z(t,e))>0},D.isGreaterThanOrEqualTo=D.gte=function(t,e){return 1===(e=b(this,new z(t,e)))||0===e},D.isInteger=function(){return!!this.c&&g(this.e/d)>this.c.length-2},D.isLessThan=D.lt=function(t,e){return b(this,new z(t,e))<0},D.isLessThanOrEqualTo=D.lte=function(t,e){return-1===(e=b(this,new z(t,e)))||0===e},D.isNaN=function(){return!this.s},D.isNegative=function(){return this.s<0},D.isPositive=function(){return this.s>0},D.isZero=function(){return!!this.c&&0==this.c[0]},D.minus=function(t,e){var r,i,n,s,a=this,o=a.s;if(e=(t=new z(t,e)).s,!o||!e)return new z(NaN);if(o!=e)return t.s=-e,a.plus(t);var u=a.e/d,h=t.e/d,c=a.c,f=t.c;if(!u||!h){if(!c||!f)return c?(t.s=-e,t):new z(f?a:NaN);if(!c[0]||!f[0])return f[0]?(t.s=-e,t):new z(c[0]?a:3==I?-0:0)}if(u=g(u),h=g(h),c=c.slice(),o=u-h){for((s=o<0)?(o=-o,n=c):(h=u,n=f),n.reverse(),e=o;e--;n.push(0));n.reverse()}else for(i=(s=(o=c.length)<(e=f.length))?o:e,o=e=0;e0)for(;e--;c[r++]=0);for(e=l-1;i>o;){if(c[--i]=0;){for(r=0,p=x[n]%_,w=x[n]/_|0,s=n+(a=u);s>n;)r=((h=p*(h=E[--a]%_)+(o=w*h+(c=E[a]/_|0)*p)%_*_+y[s]+r)/b|0)+(o/_|0)+w*c,y[s--]=h%b;y[s]=r}return r?++i:y.splice(0,1),q(t,y,i)},D.negated=function(){var t=new z(this);return t.s=-t.s||null,t},D.plus=function(t,e){var r,i=this,n=i.s;if(e=(t=new z(t,e)).s,!n||!e)return new z(NaN);if(n!=e)return t.s=-e,i.minus(t);var s=i.e/d,a=t.e/d,o=i.c,u=t.c;if(!s||!a){if(!o||!u)return new z(n/0);if(!o[0]||!u[0])return u[0]?t:new z(o[0]?i:0*n)}if(s=g(s),a=g(a),o=o.slice(),n=s-a){for(n>0?(a=s,r=u):(n=-n,r=o),r.reverse();n--;r.push(0));r.reverse()}for((n=o.length)-(e=u.length)<0&&(r=u,u=o,o=r,e=n),n=0;e;)n=(o[--e]=o[e]+u[e]+n)/l|0,o[e]=l===o[e]?0:o[e]%l;return n&&(o=[n].concat(o),++a),q(t,o,a)},D.precision=D.sd=function(t,e){var r,i,n,s=this;if(null!=t&&t!==!!t)return _(t,1,w),null==e?e=I:_(e,0,8),X(new z(s),t,e);if(!(r=s.c))return null;if(i=(n=r.length-1)*d+1,n=r[n]){for(;n%10==0;n/=10,i--);for(n=r[0];n>=10;n/=10,i++);}return t&&s.e+1>i&&(i=s.e+1),i},D.shiftedBy=function(t){return _(t,-f,f),this.times("1e"+t)},D.squareRoot=D.sqrt=function(){var t,e,i,n,s,a=this,o=a.c,u=a.s,h=a.e,c=O+4,l=new z("0.5");if(1!==u||!o||!o[0])return new z(!u||u<0&&(!o||o[0])?NaN:o?a:1/0);if(0==(u=Math.sqrt(+K(a)))||u==1/0?(((e=y(o)).length+h)%2==0&&(e+="0"),u=Math.sqrt(+e),h=g((h+1)/2)-(h<0||h%2),i=new z(e=u==1/0?"1e"+h:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+h)):i=new z(u+""),i.c[0])for((u=(h=i.e)+c)<3&&(u=0);;)if(s=i,i=l.times(s.plus(r(a,s,c,1))),y(s.c).slice(0,u)===(e=y(i.c)).slice(0,u)){if(i.e0&&m>0){for(s=m%o||o,l=p.substr(0,s);s0&&(l+=c+p.slice(s)),f&&(l="-"+l)}i=d?l+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):l}return(r.prefix||"")+i+(r.suffix||"")},D.toFraction=function(t){var e,i,n,s,a,o,u,c,l,f,m,w,g=this,b=g.c;if(null!=t&&(!(u=new z(t)).isInteger()&&(u.c||1!==u.s)||u.lt(R)))throw Error(h+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+K(u));if(!b)return new z(g);for(e=new z(R),l=i=new z(R),n=c=new z(R),w=y(b),a=e.e=w.length-g.e-1,e.c[0]=p[(o=a%d)<0?d+o:o],t=!t||u.comparedTo(e)>0?a>0?e:l:u,o=P,P=1/0,u=new z(w),c.c[0]=0;f=r(u,e,0,1),1!=(s=i.plus(f.times(n))).comparedTo(t);)i=n,n=s,l=c.plus(f.times(s=l)),c=s,e=u.minus(f.times(s=e)),u=s;return s=r(t.minus(i),n,0,1),c=c.plus(s.times(l)),i=i.plus(s.times(n)),c.s=l.s=g.s,m=r(l,n,a*=2,I).minus(g).abs().comparedTo(r(c,i,a,I).minus(g).abs())<1?[l,n]:[c,i],P=o,m},D.toNumber=function(){return+K(this)},D.toPrecision=function(t,e){return null!=t&&_(t,1,w),H(this,t,e,2)},D.toString=function(t){var e,r=this,n=r.s,s=r.e;return null===s?n?(e="Infinity",n<0&&(e="-"+e)):e="NaN":(null==t?e=s<=N||s>=F?E(y(r.c),s):x(y(r.c),s,"0"):10===t?e=x(y((r=X(new z(r),O+s+1,I)).c),r.e,"0"):(_(t,2,j.length,"Base"),e=i(x(y(r.c),s,"0"),10,t,n,!0)),n<0&&r.c[0]&&(e="-"+e)),e},D.valueOf=D.toJSON=function(){return K(this)},D._isBigNumber=!0,null!=e&&z.set(e),z}()).default=s.BigNumber=s,void 0===(i=function(){return s}.call(e,r,e,t))||(t.exports=i)}()},function(t,e,r){(function(t){function r(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===r(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===r(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===r(t)},e.isError=function(t){return"[object Error]"===r(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,r(3).Buffer)},function(t,e,r){"use strict";const i=e.NAMESPACES={HTML:"http://www.w3.org/1999/xhtml",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"};e.ATTRS={TYPE:"type",ACTION:"action",ENCODING:"encoding",PROMPT:"prompt",NAME:"name",COLOR:"color",FACE:"face",SIZE:"size"},e.DOCUMENT_MODE={NO_QUIRKS:"no-quirks",QUIRKS:"quirks",LIMITED_QUIRKS:"limited-quirks"};const n=e.TAG_NAMES={A:"a",ADDRESS:"address",ANNOTATION_XML:"annotation-xml",APPLET:"applet",AREA:"area",ARTICLE:"article",ASIDE:"aside",B:"b",BASE:"base",BASEFONT:"basefont",BGSOUND:"bgsound",BIG:"big",BLOCKQUOTE:"blockquote",BODY:"body",BR:"br",BUTTON:"button",CAPTION:"caption",CENTER:"center",CODE:"code",COL:"col",COLGROUP:"colgroup",DD:"dd",DESC:"desc",DETAILS:"details",DIALOG:"dialog",DIR:"dir",DIV:"div",DL:"dl",DT:"dt",EM:"em",EMBED:"embed",FIELDSET:"fieldset",FIGCAPTION:"figcaption",FIGURE:"figure",FONT:"font",FOOTER:"footer",FOREIGN_OBJECT:"foreignObject",FORM:"form",FRAME:"frame",FRAMESET:"frameset",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",HEAD:"head",HEADER:"header",HGROUP:"hgroup",HR:"hr",HTML:"html",I:"i",IMG:"img",IMAGE:"image",INPUT:"input",IFRAME:"iframe",KEYGEN:"keygen",LABEL:"label",LI:"li",LINK:"link",LISTING:"listing",MAIN:"main",MALIGNMARK:"malignmark",MARQUEE:"marquee",MATH:"math",MENU:"menu",META:"meta",MGLYPH:"mglyph",MI:"mi",MO:"mo",MN:"mn",MS:"ms",MTEXT:"mtext",NAV:"nav",NOBR:"nobr",NOFRAMES:"noframes",NOEMBED:"noembed",NOSCRIPT:"noscript",OBJECT:"object",OL:"ol",OPTGROUP:"optgroup",OPTION:"option",P:"p",PARAM:"param",PLAINTEXT:"plaintext",PRE:"pre",RB:"rb",RP:"rp",RT:"rt",RTC:"rtc",RUBY:"ruby",S:"s",SCRIPT:"script",SECTION:"section",SELECT:"select",SOURCE:"source",SMALL:"small",SPAN:"span",STRIKE:"strike",STRONG:"strong",STYLE:"style",SUB:"sub",SUMMARY:"summary",SUP:"sup",TABLE:"table",TBODY:"tbody",TEMPLATE:"template",TEXTAREA:"textarea",TFOOT:"tfoot",TD:"td",TH:"th",THEAD:"thead",TITLE:"title",TR:"tr",TRACK:"track",TT:"tt",U:"u",UL:"ul",SVG:"svg",VAR:"var",WBR:"wbr",XMP:"xmp"};e.SPECIAL_ELEMENTS={[i.HTML]:{[n.ADDRESS]:!0,[n.APPLET]:!0,[n.AREA]:!0,[n.ARTICLE]:!0,[n.ASIDE]:!0,[n.BASE]:!0,[n.BASEFONT]:!0,[n.BGSOUND]:!0,[n.BLOCKQUOTE]:!0,[n.BODY]:!0,[n.BR]:!0,[n.BUTTON]:!0,[n.CAPTION]:!0,[n.CENTER]:!0,[n.COL]:!0,[n.COLGROUP]:!0,[n.DD]:!0,[n.DETAILS]:!0,[n.DIR]:!0,[n.DIV]:!0,[n.DL]:!0,[n.DT]:!0,[n.EMBED]:!0,[n.FIELDSET]:!0,[n.FIGCAPTION]:!0,[n.FIGURE]:!0,[n.FOOTER]:!0,[n.FORM]:!0,[n.FRAME]:!0,[n.FRAMESET]:!0,[n.H1]:!0,[n.H2]:!0,[n.H3]:!0,[n.H4]:!0,[n.H5]:!0,[n.H6]:!0,[n.HEAD]:!0,[n.HEADER]:!0,[n.HGROUP]:!0,[n.HR]:!0,[n.HTML]:!0,[n.IFRAME]:!0,[n.IMG]:!0,[n.INPUT]:!0,[n.LI]:!0,[n.LINK]:!0,[n.LISTING]:!0,[n.MAIN]:!0,[n.MARQUEE]:!0,[n.MENU]:!0,[n.META]:!0,[n.NAV]:!0,[n.NOEMBED]:!0,[n.NOFRAMES]:!0,[n.NOSCRIPT]:!0,[n.OBJECT]:!0,[n.OL]:!0,[n.P]:!0,[n.PARAM]:!0,[n.PLAINTEXT]:!0,[n.PRE]:!0,[n.SCRIPT]:!0,[n.SECTION]:!0,[n.SELECT]:!0,[n.SOURCE]:!0,[n.STYLE]:!0,[n.SUMMARY]:!0,[n.TABLE]:!0,[n.TBODY]:!0,[n.TD]:!0,[n.TEMPLATE]:!0,[n.TEXTAREA]:!0,[n.TFOOT]:!0,[n.TH]:!0,[n.THEAD]:!0,[n.TITLE]:!0,[n.TR]:!0,[n.TRACK]:!0,[n.UL]:!0,[n.WBR]:!0,[n.XMP]:!0},[i.MATHML]:{[n.MI]:!0,[n.MO]:!0,[n.MN]:!0,[n.MS]:!0,[n.MTEXT]:!0,[n.ANNOTATION_XML]:!0},[i.SVG]:{[n.TITLE]:!0,[n.FOREIGN_OBJECT]:!0,[n.DESC]:!0}}},function(t,e,r){"use strict";function i(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.prototype.toString=function(t){var e=this.name+": ";return e+=this.reason||"(unknown reason)",!t&&this.mark&&(e+=" "+this.mark.toString()),e},t.exports=i},function(t,e,r){"use strict";var i=r(15);t.exports=new i({include:[r(75)],implicit:[r(152),r(153)],explicit:[r(154),r(155),r(156),r(157)]})},function(t,e,r){(function(t){var i=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},i=0;i=s)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}})),u=i[r];r=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),p(r)?i.showHidden=r:r&&e._extend(i,r),y(i.showHidden)&&(i.showHidden=!1),y(i.depth)&&(i.depth=2),y(i.colors)&&(i.colors=!1),y(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=u),c(i,t,i.depth)}function u(t,e){var r=o.styles[e];return r?"["+o.colors[r][0]+"m"+t+"["+o.colors[r][1]+"m":t}function h(t,e){return t}function c(t,r,i){if(t.customInspect&&r&&x(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,t);return g(n)||(n=c(t,n,i)),n}var s=function(t,e){if(y(e))return t.stylize("undefined","undefined");if(g(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(w(e))return t.stylize(""+e,"number");if(p(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(t,r);if(s)return s;var a=Object.keys(r),o=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(r)),E(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return l(r);if(0===a.length){if(x(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(b(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(v(r))return t.stylize(Date.prototype.toString.call(r),"date");if(E(r))return l(r)}var h,_="",A=!1,S=["{","}"];(f(r)&&(A=!0,S=["[","]"]),x(r))&&(_=" [Function"+(r.name?": "+r.name:"")+"]");return b(r)&&(_=" "+RegExp.prototype.toString.call(r)),v(r)&&(_=" "+Date.prototype.toUTCString.call(r)),E(r)&&(_=" "+l(r)),0!==a.length||A&&0!=r.length?i<0?b(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),h=A?function(t,e,r,i,n){for(var s=[],a=0,o=e.length;a=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(h,_,S)):S[0]+_+S[1]}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function d(t,e,r,i,n,s){var a,o,u;if((u=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]}).get?o=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(o=t.stylize("[Setter]","special")),k(i,n)||(a="["+n+"]"),o||(t.seen.indexOf(u.value)<0?(o=m(r)?c(t,u.value,null):c(t,u.value,r-1)).indexOf("\n")>-1&&(o=s?o.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+o.split("\n").map((function(t){return" "+t})).join("\n")):o=t.stylize("[Circular]","special")),y(a)){if(s&&n.match(/^\d+$/))return o;(a=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+o}function f(t){return Array.isArray(t)}function p(t){return"boolean"==typeof t}function m(t){return null===t}function w(t){return"number"==typeof t}function g(t){return"string"==typeof t}function y(t){return void 0===t}function b(t){return _(t)&&"[object RegExp]"===A(t)}function _(t){return"object"==typeof t&&null!==t}function v(t){return _(t)&&"[object Date]"===A(t)}function E(t){return _(t)&&("[object Error]"===A(t)||t instanceof Error)}function x(t){return"function"==typeof t}function A(t){return Object.prototype.toString.call(t)}function S(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(r){if(y(s)&&(s=t.env.NODE_DEBUG||""),r=r.toUpperCase(),!a[r])if(new RegExp("\\b"+r+"\\b","i").test(s)){var i=t.pid;a[r]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",r,i,t)}}else a[r]=function(){};return a[r]},e.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=f,e.isBoolean=p,e.isNull=m,e.isNullOrUndefined=function(t){return null==t},e.isNumber=w,e.isString=g,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=y,e.isRegExp=b,e.isObject=_,e.isDate=v,e.isError=E,e.isFunction=x,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(169);var C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(){var t=new Date,e=[S(t.getHours()),S(t.getMinutes()),S(t.getSeconds())].join(":");return[t.getDate(),C[t.getMonth()],e].join(" ")}function k(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",T(),e.format.apply(e,arguments))},e.inherits=r(9),e._extend=function(t,e){if(!e||!_(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t};var D="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function R(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(D&&t[D]){var e;if("function"!=typeof(e=t[D]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,D,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,i=new Promise((function(t,i){e=t,r=i})),n=[],s=0;s255||(0|t)!==t)throw new Error("value must be a small positive integer: "+t);this.value=t}toString(){return"simple("+this.value+")"}[i.inspect.custom](t,e){return"simple("+this.value+")"}inspect(t,e){return"simple("+this.value+")"}encodeCBOR(t){return t._pushInt(this.value,s.SIMPLE_FLOAT)}static isSimple(t){return t instanceof u}static decode(t,e=!0,r=!1){switch(t){case a.FALSE:return!1;case a.TRUE:return!0;case a.NULL:return e?null:o.NULL;case a.UNDEFINED:return e?void 0:o.UNDEFINED;case-1:if(!e||!r)throw new Error("Invalid BREAK");return o.BREAK;default:return new u(t)}}}t.exports=u},function(t,e,r){"use strict";(function(e){const i=r(4),n=r(22);class s extends i.Transform{constructor(t,r,i){let n,s;switch(null==i&&(i={}),typeof t){case"object":e.isBuffer(t)?(n=t,null!=r&&"object"==typeof r&&(i=r)):i=t;break;case"string":n=t,null!=r&&"object"==typeof r?i=r:s=r}null==i&&(i={}),null==n&&(n=i.input),null==s&&(s=i.inputEncoding),delete i.input,delete i.inputEncoding;const a=null==i.watchPipe||i.watchPipe;delete i.watchPipe;const o=!!i.readError;delete i.readError,super(i),this.readError=o,a&&this.on("pipe",t=>{const e=t._readableState.objectMode;if(this.length>0&&e!==this._readableState.objectMode)throw new Error("Do not switch objectMode in the middle of the stream");return this._readableState.objectMode=e,this._writableState.objectMode=e}),null!=n&&this.end(n,s)}static isNoFilter(t){return t instanceof this}static compare(t,e){if(!(t instanceof this))throw new TypeError("Arguments must be NoFilters");return t===e?0:t.compare(e)}static concat(t,r){if(!Array.isArray(t))throw new TypeError("list argument must be an Array of NoFilters");if(0===t.length||0===r)return e.alloc(0);null==r&&(r=t.reduce((t,e)=>{if(!(e instanceof s))throw new TypeError("list argument must be an Array of NoFilters");return t+e.length},0));let i=!0,n=!0;const a=t.map(t=>{if(!(t instanceof s))throw new TypeError("list argument must be an Array of NoFilters");const r=t.slice();return e.isBuffer(r)?n=!1:i=!1,r});if(i)return e.concat(a,r);if(n)return[].concat(...a).slice(0,r);throw new Error("Concatenating mixed object and byte streams not supported")}_transform(t,r,i){this._readableState.objectMode||e.isBuffer(t)||(t=e.from(t,r)),this.push(t),i()}_bufArray(){let t=this._readableState.buffer;if(!Array.isArray(t)){let e=t.head;for(t=[];null!=e;)t.push(e.data),e=e.next}return t}read(t){const e=super.read(t);if(null!=e){if(this.emit("read",e),this.readError&&e.length{this.on("finish",()=>{const i=this.read();null==t||e||(e=!0,t(null,i)),r(i)}),this.on("error",r=>{null==t||e||(e=!0,t(r)),i(r)})})}compare(t){if(!(t instanceof s))throw new TypeError("Arguments must be NoFilters");if(this===t)return 0;{const r=this.slice(),i=t.slice();if(e.isBuffer(r)&&e.isBuffer(i))return r.compare(i);throw new Error("Cannot compare streams in object mode")}}equals(t){return 0===this.compare(t)}slice(t,r){if(this._readableState.objectMode)return this._bufArray().slice(t,r);const i=this._bufArray();switch(i.length){case 0:return e.alloc(0);case 1:return i[0].slice(t,r);default:return e.concat(i).slice(t,r)}}get(t){return this.slice()[t]}toJSON(){const t=this.slice();return e.isBuffer(t)?t.toJSON():t}toString(t,r,i){const s=this.slice(r,i);if(!e.isBuffer(s))return JSON.stringify(s);if((!t||"utf8"===t)&&n.TextDecoder){return new n.TextDecoder("utf8",{fatal:!0,ignoreBOM:!0}).decode(s)}return s.toString(t,r,i)}inspect(t,e){return this[n.inspect.custom](t,e)}[n.inspect.custom](t,r){const i=this._bufArray().map(t=>e.isBuffer(t)?(null!=r?r.stylize:void 0)?r.stylize(t.toString("hex"),"string"):t.toString("hex"):n.inspect(t,r)).join(", ");return`${this.constructor.name} [${i}]`}get length(){return this._readableState.length}writeBigInt(t){let r=t.toString(16);if(t<0){const e=BigInt(Math.floor(r.length/2));r=(t=(BigInt(1)<=o.DIGIT_0&&t<=o.DIGIT_9}function zt(t){return t>=o.LATIN_CAPITAL_A&&t<=o.LATIN_CAPITAL_Z}function Ht(t){return t>=o.LATIN_SMALL_A&&t<=o.LATIN_SMALL_Z}function Gt(t){return Ht(t)||zt(t)}function qt(t){return Gt(t)||jt(t)}function Xt(t){return t>=o.LATIN_CAPITAL_A&&t<=o.LATIN_CAPITAL_F}function Kt(t){return t>=o.LATIN_SMALL_A&&t<=o.LATIN_SMALL_F}function Vt(t){return t+32}function Yt(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(t>>>10&1023|55296)+String.fromCharCode(56320|1023&t))}function Jt(t){return String.fromCharCode(Vt(t))}function Zt(t,e){const r=s[++t];let i=++t,n=i+r-1;for(;i<=n;){const t=i+n>>>1,a=s[t];if(ae))return s[t+r];n=t-1}}return-1}class Qt{constructor(){this.preprocessor=new i,this.tokenQueue=[],this.allowCDATA=!1,this.state=p,this.returnState="",this.charRefCode=-1,this.tempBuff=[],this.lastStartTagName="",this.consumedAfterSnapshot=-1,this.active=!1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr=null}_err(){}_errOnNextCodePoint(t){this._consume(),this._err(t),this._unconsume()}getNextToken(){for(;!this.tokenQueue.length&&this.active;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this[this.state](t)}return this.tokenQueue.shift()}write(t,e){this.active=!0,this.preprocessor.write(t,e)}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t)}_ensureHibernation(){if(this.preprocessor.endOfChunkHit){for(;this.consumedAfterSnapshot>0;this.consumedAfterSnapshot--)this.preprocessor.retreat();return this.active=!1,this.tokenQueue.push({type:Qt.HIBERNATION_TOKEN}),!0}return!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_unconsume(){this.consumedAfterSnapshot--,this.preprocessor.retreat()}_reconsumeInState(t){this.state=t,this._unconsume()}_consumeSequenceIfMatch(t,e,r){let i=0,n=!0;const s=t.length;let a=0,u=e,h=void 0;for(;a0&&(u=this._consume(),i++),u===o.EOF){n=!1;break}if(u!==(h=t[a])&&(r||u!==Vt(h))){n=!1;break}}if(!n)for(;i--;)this._unconsume();return n}_isTempBufferEqualToScriptString(){if(this.tempBuff.length!==u.SCRIPT_STRING.length)return!1;for(let t=0;t0&&this._err(a.endTagWithAttributes),t.selfClosing&&this._err(a.endTagWithTrailingSolidus)),this.tokenQueue.push(t)}_emitCurrentCharacterToken(){this.currentCharacterToken&&(this.tokenQueue.push(this.currentCharacterToken),this.currentCharacterToken=null)}_emitEOFToken(){this._createEOFToken(),this._emitCurrentToken()}_appendCharToCurrentCharacterToken(t,e){this.currentCharacterToken&&this.currentCharacterToken.type!==t&&this._emitCurrentCharacterToken(),this.currentCharacterToken?this.currentCharacterToken.chars+=e:this._createCharacterToken(t,e)}_emitCodePoint(t){let e=Qt.CHARACTER_TOKEN;Wt(t)?e=Qt.WHITESPACE_CHARACTER_TOKEN:t===o.NULL&&(e=Qt.NULL_CHARACTER_TOKEN),this._appendCharToCurrentCharacterToken(e,Yt(t))}_emitSeveralCodePoints(t){for(let e=0;e-1;){const t=s[i],n=t")):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.state=N,this._emitChars(n.REPLACEMENT_CHARACTER)):t===o.EOF?(this._err(a.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state=N,this._emitCodePoint(t))}[P](t){t===o.SOLIDUS?(this.tempBuff=[],this.state=L):Gt(t)?(this.tempBuff=[],this._emitChars("<"),this._reconsumeInState(M)):(this._emitChars("<"),this._reconsumeInState(N))}[L](t){Gt(t)?(this._createEndTagToken(),this._reconsumeInState(U)):(this._emitChars("")):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.state=W,this._emitChars(n.REPLACEMENT_CHARACTER)):t===o.EOF?(this._err(a.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state=W,this._emitCodePoint(t))}[H](t){t===o.SOLIDUS?(this.tempBuff=[],this.state=G,this._emitChars("/")):this._reconsumeInState(W)}[G](t){Wt(t)||t===o.SOLIDUS||t===o.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?N:W,this._emitCodePoint(t)):zt(t)?(this.tempBuff.push(Vt(t)),this._emitCodePoint(t)):Ht(t)?(this.tempBuff.push(t),this._emitCodePoint(t)):this._reconsumeInState(W)}[q](t){Wt(t)||(t===o.SOLIDUS||t===o.GREATER_THAN_SIGN||t===o.EOF?this._reconsumeInState(K):t===o.EQUALS_SIGN?(this._err(a.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=X):(this._createAttr(""),this._reconsumeInState(X)))}[X](t){Wt(t)||t===o.SOLIDUS||t===o.GREATER_THAN_SIGN||t===o.EOF?(this._leaveAttrName(K),this._unconsume()):t===o.EQUALS_SIGN?this._leaveAttrName(V):zt(t)?this.currentAttr.name+=Jt(t):t===o.QUOTATION_MARK||t===o.APOSTROPHE||t===o.LESS_THAN_SIGN?(this._err(a.unexpectedCharacterInAttributeName),this.currentAttr.name+=Yt(t)):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentAttr.name+=n.REPLACEMENT_CHARACTER):this.currentAttr.name+=Yt(t)}[K](t){Wt(t)||(t===o.SOLIDUS?this.state=$:t===o.EQUALS_SIGN?this.state=V:t===o.GREATER_THAN_SIGN?(this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInTag),this._emitEOFToken()):(this._createAttr(""),this._reconsumeInState(X)))}[V](t){Wt(t)||(t===o.QUOTATION_MARK?this.state=Y:t===o.APOSTROPHE?this.state=J:t===o.GREATER_THAN_SIGN?(this._err(a.missingAttributeValue),this.state=p,this._emitCurrentToken()):this._reconsumeInState(Z))}[Y](t){t===o.QUOTATION_MARK?this.state=Q:t===o.AMPERSAND?(this.returnState=Y,this.state=Ot):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentAttr.value+=n.REPLACEMENT_CHARACTER):t===o.EOF?(this._err(a.eofInTag),this._emitEOFToken()):this.currentAttr.value+=Yt(t)}[J](t){t===o.APOSTROPHE?this.state=Q:t===o.AMPERSAND?(this.returnState=J,this.state=Ot):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentAttr.value+=n.REPLACEMENT_CHARACTER):t===o.EOF?(this._err(a.eofInTag),this._emitEOFToken()):this.currentAttr.value+=Yt(t)}[Z](t){Wt(t)?this._leaveAttrValue(q):t===o.AMPERSAND?(this.returnState=Z,this.state=Ot):t===o.GREATER_THAN_SIGN?(this._leaveAttrValue(p),this._emitCurrentToken()):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentAttr.value+=n.REPLACEMENT_CHARACTER):t===o.QUOTATION_MARK||t===o.APOSTROPHE||t===o.LESS_THAN_SIGN||t===o.EQUALS_SIGN||t===o.GRAVE_ACCENT?(this._err(a.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=Yt(t)):t===o.EOF?(this._err(a.eofInTag),this._emitEOFToken()):this.currentAttr.value+=Yt(t)}[Q](t){Wt(t)?this._leaveAttrValue(q):t===o.SOLIDUS?this._leaveAttrValue($):t===o.GREATER_THAN_SIGN?(this._leaveAttrValue(p),this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInTag),this._emitEOFToken()):(this._err(a.missingWhitespaceBetweenAttributes),this._reconsumeInState(q))}[$](t){t===o.GREATER_THAN_SIGN?(this.currentToken.selfClosing=!0,this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInTag),this._emitEOFToken()):(this._err(a.unexpectedSolidusInTag),this._reconsumeInState(q))}[tt](t){t===o.GREATER_THAN_SIGN?(this.state=p,this._emitCurrentToken()):t===o.EOF?(this._emitCurrentToken(),this._emitEOFToken()):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentToken.data+=n.REPLACEMENT_CHARACTER):this.currentToken.data+=Yt(t)}[et](t){this._consumeSequenceIfMatch(u.DASH_DASH_STRING,t,!0)?(this._createCommentToken(),this.state=rt):this._consumeSequenceIfMatch(u.DOCTYPE_STRING,t,!1)?this.state=dt:this._consumeSequenceIfMatch(u.CDATA_START_STRING,t,!0)?this.allowCDATA?this.state=kt:(this._err(a.cdataInHtmlContent),this._createCommentToken(),this.currentToken.data="[CDATA[",this.state=tt):this._ensureHibernation()||(this._err(a.incorrectlyOpenedComment),this._createCommentToken(),this._reconsumeInState(tt))}[rt](t){t===o.HYPHEN_MINUS?this.state=it:t===o.GREATER_THAN_SIGN?(this._err(a.abruptClosingOfEmptyComment),this.state=p,this._emitCurrentToken()):this._reconsumeInState(nt)}[it](t){t===o.HYPHEN_MINUS?this.state=ct:t===o.GREATER_THAN_SIGN?(this._err(a.abruptClosingOfEmptyComment),this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState(nt))}[nt](t){t===o.HYPHEN_MINUS?this.state=ht:t===o.LESS_THAN_SIGN?(this.currentToken.data+="<",this.state=st):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentToken.data+=n.REPLACEMENT_CHARACTER):t===o.EOF?(this._err(a.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.data+=Yt(t)}[st](t){t===o.EXCLAMATION_MARK?(this.currentToken.data+="!",this.state=at):t===o.LESS_THAN_SIGN?this.currentToken.data+="!":this._reconsumeInState(nt)}[at](t){t===o.HYPHEN_MINUS?this.state=ot:this._reconsumeInState(nt)}[ot](t){t===o.HYPHEN_MINUS?this.state=ut:this._reconsumeInState(ht)}[ut](t){t!==o.GREATER_THAN_SIGN&&t!==o.EOF&&this._err(a.nestedComment),this._reconsumeInState(ct)}[ht](t){t===o.HYPHEN_MINUS?this.state=ct:t===o.EOF?(this._err(a.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState(nt))}[ct](t){t===o.GREATER_THAN_SIGN?(this.state=p,this._emitCurrentToken()):t===o.EXCLAMATION_MARK?this.state=lt:t===o.HYPHEN_MINUS?this.currentToken.data+="-":t===o.EOF?(this._err(a.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--",this._reconsumeInState(nt))}[lt](t){t===o.HYPHEN_MINUS?(this.currentToken.data+="--!",this.state=ht):t===o.GREATER_THAN_SIGN?(this._err(a.incorrectlyClosedComment),this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--!",this._reconsumeInState(nt))}[dt](t){Wt(t)?this.state=ft:t===o.GREATER_THAN_SIGN?this._reconsumeInState(ft):t===o.EOF?(this._err(a.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(a.missingWhitespaceBeforeDoctypeName),this._reconsumeInState(ft))}[ft](t){Wt(t)||(zt(t)?(this._createDoctypeToken(Jt(t)),this.state=pt):t===o.NULL?(this._err(a.unexpectedNullCharacter),this._createDoctypeToken(n.REPLACEMENT_CHARACTER),this.state=pt):t===o.GREATER_THAN_SIGN?(this._err(a.missingDoctypeName),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=p):t===o.EOF?(this._err(a.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._createDoctypeToken(Yt(t)),this.state=pt))}[pt](t){Wt(t)?this.state=mt:t===o.GREATER_THAN_SIGN?(this.state=p,this._emitCurrentToken()):zt(t)?this.currentToken.name+=Jt(t):t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentToken.name+=n.REPLACEMENT_CHARACTER):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.name+=Yt(t)}[mt](t){Wt(t)||(t===o.GREATER_THAN_SIGN?(this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this._consumeSequenceIfMatch(u.PUBLIC_STRING,t,!1)?this.state=wt:this._consumeSequenceIfMatch(u.SYSTEM_STRING,t,!1)?this.state=Et:this._ensureHibernation()||(this._err(a.invalidCharacterSequenceAfterDoctypeName),this.currentToken.forceQuirks=!0,this._reconsumeInState(Tt)))}[wt](t){Wt(t)?this.state=gt:t===o.QUOTATION_MARK?(this._err(a.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state=yt):t===o.APOSTROPHE?(this._err(a.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state=bt):t===o.GREATER_THAN_SIGN?(this._err(a.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(a.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Tt))}[gt](t){Wt(t)||(t===o.QUOTATION_MARK?(this.currentToken.publicId="",this.state=yt):t===o.APOSTROPHE?(this.currentToken.publicId="",this.state=bt):t===o.GREATER_THAN_SIGN?(this._err(a.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(a.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Tt)))}[yt](t){t===o.QUOTATION_MARK?this.state=_t:t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentToken.publicId+=n.REPLACEMENT_CHARACTER):t===o.GREATER_THAN_SIGN?(this._err(a.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=p):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=Yt(t)}[bt](t){t===o.APOSTROPHE?this.state=_t:t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentToken.publicId+=n.REPLACEMENT_CHARACTER):t===o.GREATER_THAN_SIGN?(this._err(a.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=p):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=Yt(t)}[_t](t){Wt(t)?this.state=vt:t===o.GREATER_THAN_SIGN?(this.state=p,this._emitCurrentToken()):t===o.QUOTATION_MARK?(this._err(a.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state=At):t===o.APOSTROPHE?(this._err(a.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state=St):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(a.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Tt))}[vt](t){Wt(t)||(t===o.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=p):t===o.QUOTATION_MARK?(this.currentToken.systemId="",this.state=At):t===o.APOSTROPHE?(this.currentToken.systemId="",this.state=St):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(a.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Tt)))}[Et](t){Wt(t)?this.state=xt:t===o.QUOTATION_MARK?(this._err(a.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state=At):t===o.APOSTROPHE?(this._err(a.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state=St):t===o.GREATER_THAN_SIGN?(this._err(a.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(a.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Tt))}[xt](t){Wt(t)||(t===o.QUOTATION_MARK?(this.currentToken.systemId="",this.state=At):t===o.APOSTROPHE?(this.currentToken.systemId="",this.state=St):t===o.GREATER_THAN_SIGN?(this._err(a.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=p,this._emitCurrentToken()):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(a.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Tt)))}[At](t){t===o.QUOTATION_MARK?this.state=Ct:t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentToken.systemId+=n.REPLACEMENT_CHARACTER):t===o.GREATER_THAN_SIGN?(this._err(a.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=p):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=Yt(t)}[St](t){t===o.APOSTROPHE?this.state=Ct:t===o.NULL?(this._err(a.unexpectedNullCharacter),this.currentToken.systemId+=n.REPLACEMENT_CHARACTER):t===o.GREATER_THAN_SIGN?(this._err(a.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=p):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=Yt(t)}[Ct](t){Wt(t)||(t===o.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=p):t===o.EOF?(this._err(a.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(a.unexpectedCharacterAfterDoctypeSystemIdentifier),this._reconsumeInState(Tt)))}[Tt](t){t===o.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=p):t===o.NULL?this._err(a.unexpectedNullCharacter):t===o.EOF&&(this._emitCurrentToken(),this._emitEOFToken())}[kt](t){t===o.RIGHT_SQUARE_BRACKET?this.state=Dt:t===o.EOF?(this._err(a.eofInCdata),this._emitEOFToken()):this._emitCodePoint(t)}[Dt](t){t===o.RIGHT_SQUARE_BRACKET?this.state=Rt:(this._emitChars("]"),this._reconsumeInState(kt))}[Rt](t){t===o.GREATER_THAN_SIGN?this.state=p:t===o.RIGHT_SQUARE_BRACKET?this._emitChars("]"):(this._emitChars("]]"),this._reconsumeInState(kt))}[Ot](t){this.tempBuff=[o.AMPERSAND],t===o.NUMBER_SIGN?(this.tempBuff.push(t),this.state=Ft):qt(t)?this._reconsumeInState(It):(this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}[It](t){const e=this._matchNamedCharacterReference(t);if(this._ensureHibernation())this.tempBuff=[o.AMPERSAND];else if(e){const t=this.tempBuff[this.tempBuff.length-1]===o.SEMICOLON;this._isCharacterReferenceAttributeQuirk(t)||(t||this._errOnNextCodePoint(a.missingSemicolonAfterCharacterReference),this.tempBuff=e),this._flushCodePointsConsumedAsCharacterReference(),this.state=this.returnState}else this._flushCodePointsConsumedAsCharacterReference(),this.state=Nt}[Nt](t){qt(t)?this._isCharacterReferenceInAttribute()?this.currentAttr.value+=Yt(t):this._emitCodePoint(t):(t===o.SEMICOLON&&this._err(a.unknownNamedCharacterReference),this._reconsumeInState(this.returnState))}[Ft](t){this.charRefCode=0,t===o.LATIN_SMALL_X||t===o.LATIN_CAPITAL_X?(this.tempBuff.push(t),this.state=Bt):this._reconsumeInState(Pt)}[Bt](t){!function(t){return jt(t)||Xt(t)||Kt(t)}(t)?(this._err(a.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)):this._reconsumeInState(Lt)}[Pt](t){jt(t)?this._reconsumeInState(Ut):(this._err(a.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}[Lt](t){Xt(t)?this.charRefCode=16*this.charRefCode+t-55:Kt(t)?this.charRefCode=16*this.charRefCode+t-87:jt(t)?this.charRefCode=16*this.charRefCode+t-48:t===o.SEMICOLON?this.state=Mt:(this._err(a.missingSemicolonAfterCharacterReference),this._reconsumeInState(Mt))}[Ut](t){jt(t)?this.charRefCode=10*this.charRefCode+t-48:t===o.SEMICOLON?this.state=Mt:(this._err(a.missingSemicolonAfterCharacterReference),this._reconsumeInState(Mt))}[Mt](){if(this.charRefCode===o.NULL)this._err(a.nullCharacterReference),this.charRefCode=o.REPLACEMENT_CHARACTER;else if(this.charRefCode>1114111)this._err(a.characterReferenceOutsideUnicodeRange),this.charRefCode=o.REPLACEMENT_CHARACTER;else if(n.isSurrogate(this.charRefCode))this._err(a.surrogateCharacterReference),this.charRefCode=o.REPLACEMENT_CHARACTER;else if(n.isUndefinedCodePoint(this.charRefCode))this._err(a.noncharacterCharacterReference);else if(n.isControlCodePoint(this.charRefCode)||this.charRefCode===o.CARRIAGE_RETURN){this._err(a.controlCharacterReference);const t=h[this.charRefCode];t&&(this.charRefCode=t)}this.tempBuff=[this.charRefCode],this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)}}Qt.CHARACTER_TOKEN="CHARACTER_TOKEN",Qt.NULL_CHARACTER_TOKEN="NULL_CHARACTER_TOKEN",Qt.WHITESPACE_CHARACTER_TOKEN="WHITESPACE_CHARACTER_TOKEN",Qt.START_TAG_TOKEN="START_TAG_TOKEN",Qt.END_TAG_TOKEN="END_TAG_TOKEN",Qt.COMMENT_TOKEN="COMMENT_TOKEN",Qt.DOCTYPE_TOKEN="DOCTYPE_TOKEN",Qt.EOF_TOKEN="EOF_TOKEN",Qt.HIBERNATION_TOKEN="HIBERNATION_TOKEN",Qt.MODE={DATA:p,RCDATA:m,RAWTEXT:w,SCRIPT_DATA:g,PLAINTEXT:y},Qt.getTokenAttr=function(t,e){for(let r=t.attrs.length-1;r>=0;r--)if(t.attrs[r].name===e)return t.attrs[r].value;return null},t.exports=Qt},function(t,e,r){"use strict";const i=r(7),n=r(7).buildOptions,s=r(136),a={OPENING:1,CLOSING:2,SELF:3,CDATA:4};let o="<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|(([\\w:\\-._]*:)?([\\w:\\-._]+))([^>]*)>|((\\/)(([\\w:\\-._]*:)?([\\w:\\-._]+))\\s*>))([^<]*)";!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const u={attributeNamePrefix:"@_",attrNodeName:!1,textNodeName:"#text",ignoreAttributes:!0,ignoreNameSpace:!1,allowBooleanAttributes:!1,parseNodeValue:!0,parseAttributeValue:!1,arrayMode:!1,trimValues:!0,cdataTagName:!1,cdataPositionChar:"\\c",localeRange:"",tagValueProcessor:function(t,e){return t},attrValueProcessor:function(t,e){return t},stopNodes:[]};e.defaultOptions=u;const h=["attributeNamePrefix","attrNodeName","textNodeName","ignoreAttributes","ignoreNameSpace","allowBooleanAttributes","parseNodeValue","parseAttributeValue","arrayMode","trimValues","cdataTagName","cdataPositionChar","localeRange","tagValueProcessor","attrValueProcessor","parseTrueNumberOnly","stopNodes"];e.props=h;function c(t,e,r){const i=t[7]||r;let n=t[14];return n&&(e.trimValues&&(n=n.trim()),n=f(n=e.tagValueProcessor(n,i),e.parseNodeValue,e.parseTrueNumberOnly)),n}function l(t){return"]]>"===t[4]?a.CDATA:"/"===t[10]?a.CLOSING:void 0!==t[8]&&"/"===t[8].substr(t[8].length-1)?a.SELF:a.OPENING}function d(t,e){if(e.ignoreNameSpace){const e=t.split(":"),r="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=r+e[1])}return t}function f(t,e,r){if(e&&"string"==typeof t){let e;return""===t.trim()||isNaN(t)?e="true"===t||"false"!==t&&t:(-1!==t.indexOf("0x")?e=Number.parseInt(t,16):-1!==t.indexOf(".")?(e=Number.parseFloat(t),t=t.replace(/0+$/,"")):e=Number.parseInt(t,10),r&&(e=String(e)===t?e:t)),e}return i.isExist(t)?t:""}const p=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])(.*?)\\3)?","g");function m(t,e){if(!e.ignoreAttributes&&"string"==typeof t){t=t.replace(/\r?\n/g," ");const r=i.getAllMatches(t,p),n=r.length,s={};for(let t=0;t/g,"");const r=new s("!xml");let d=r;o=o.replace(/\[\\w/g,"["+e.localeRange+"\\w");const f=new RegExp(o,"g");let p=f.exec(t),w=f.exec(t);for(;p;){const r=l(p);if(r===a.CLOSING)d.parent&&p[14]&&(d.parent.val=i.getValue(d.parent.val)+""+c(p,e,d.parent.tagname)),e.stopNodes.length&&e.stopNodes.includes(d.tagname)&&(d.child=[],null==d.attrsMap&&(d.attrsMap={}),d.val=t.substr(d.startIndex+1,p.index-d.startIndex-1)),d=d.parent;else if(r===a.CDATA)if(e.cdataTagName){const t=new s(e.cdataTagName,d,p[3]);t.attrsMap=m(p[8],e),d.addChild(t),d.val=i.getValue(d.val)+e.cdataPositionChar,p[14]&&(d.val+=c(p,e))}else d.val=(d.val||"")+(p[3]||"")+c(p,e);else if(r===a.SELF){d&&p[14]&&(d.val=i.getValue(d.val)+""+c(p,e));const t=new s(e.ignoreNameSpace?p[7]:p[5],d,"");p[8]&&p[8].length>0&&(p[8]=p[8].substr(0,p[8].length-1)),t.attrsMap=m(p[8],e),d.addChild(t)}else{const t=new s(e.ignoreNameSpace?p[7]:p[5],d,c(p,e));e.stopNodes.length&&e.stopNodes.includes(t.tagname)&&(t.startIndex=p.index+p[1].length),t.attrsMap=m(p[8],e),d.addChild(t),d=t}p=w,w=f.exec(t)}return r}},function(t,e,r){"use strict";var i=r(15);t.exports=i.DEFAULT=new i({include:[r(21)],explicit:[r(158),r(159),r(160)]})},function(t,e,r){"use strict";(function(e){const i=r(170),n=r(47),s=r(23),a=r(16),o=r(17).BigNumber,u=r(24),h=r(12),c=h.MT,l=h.NUMBYTES,d=(h.SIMPLE,h.SYMS),f=new o(-1),p=f.minus(new o(Number.MAX_SAFE_INTEGER.toString(16),16)),m=Symbol("count"),w=(Symbol("pending_key"),Symbol("major type")),g=Symbol("error"),y=Symbol("not found");function b(t,e,r){const i=[];return i[m]=r,i[d.PARENT]=t,i[w]=e,i}function _(t,e){const r=new u;return r[m]=-1,r[d.PARENT]=t,r[w]=e,r}function v(t){return a.bufferToBigInt(t)}function E(t){return BigInt("-1")-a.bufferToBigInt(t)}class x extends i{constructor(t){const e=(t=t||{}).tags;delete t.tags;const r=null!=t.max_depth?t.max_depth:-1;delete t.max_depth;const i=!!a.hasBigInt&&!!t.bigint;delete t.bigint,super(t),this.running=!0,this.max_depth=r,this.tags=e,i&&(null==this.tags&&(this.tags={}),this.tags[2]=v,this.tags[3]=E)}static nullcheck(t){switch(t){case d.NULL:return null;case d.UNDEFINED:return;case y:throw new Error("Value not found");default:return t}}static decodeFirstSync(t,e){let r,i={};switch(typeof(e=e||{encoding:"hex"})){case"string":r=e;break;case"object":r=(i=a.extend({},e)).encoding,delete i.encoding}const n=new x(i),s=new u(t,null!=r?r:a.guessEncoding(t)),o=n._parse();let h=o.next();for(;!h.done;){const t=s.read(h.value);if(null==t||t.length!==h.value)throw new Error("Insufficient data");h=o.next(t)}return x.nullcheck(h.value)}static decodeAllSync(t,e){let r,i={};switch(typeof(e=e||{encoding:"hex"})){case"string":r=e;break;case"object":r=(i=a.extend({},e)).encoding,delete i.encoding}const n=new x(i),s=new u(t,null!=r?r:a.guessEncoding(t)),o=[];for(;s.length>0;){const t=n._parse();let e=t.next();for(;!e.done;){const r=s.read(e.value);if(null==r||r.length!==e.value)throw new Error("Insufficient data");e=t.next(r)}o.push(x.nullcheck(e.value))}return o}static decodeFirst(t,e,r){let i={},n=!1,s="hex";switch(typeof e){case"function":r=e,s=a.guessEncoding(t);break;case"string":s=e;break;case"object":s=null!=(i=a.extend({},e)).encoding?i.encoding:a.guessEncoding(t),delete i.encoding,n=null!=i.required&&i.required,delete i.required}const o=new x(i);let u,h=y;return o.on("data",t=>{h=x.nullcheck(t),o.close()}),"function"==typeof r?(o.once("error",t=>{const e=h;return h=g,o.close(),r(t,e)}),o.once("end",()=>{switch(h){case y:return n?r(new Error("No CBOR found")):r(null,h);case g:return;default:return r(null,h)}})):u=new Promise((t,e)=>(o.once("error",t=>(h=g,o.close(),e(t))),o.once("end",()=>{switch(h){case y:return n?e(new Error("No CBOR found")):t(h);case g:return;default:return t(h)}}))),o.end(t,s),u}static decodeAll(t,e,r){let i={},n="hex";switch(typeof e){case"function":r=e,n=a.guessEncoding(t);break;case"string":n=e;break;case"object":n=null!=(i=a.extend({},e)).encoding?i.encoding:a.guessEncoding(t),delete i.encoding}const s=new x(i);let o;const u=[];return s.on("data",t=>u.push(x.nullcheck(t))),"function"==typeof r?(s.on("error",r),s.on("end",()=>r(null,u))):o=new Promise((t,e)=>{s.on("error",e),s.on("end",()=>t(u))}),s.end(t,n),o}close(){this.running=!1,this.__fresh=!0}*_parse(){let t=null,r=0,i=null;for(;;){if(this.max_depth>=0&&r>this.max_depth)throw new Error("Maximum depth "+this.max_depth+" exceeded");const h=(yield 1)[0];if(!this.running)throw new Error("Unexpected data: 0x"+h.toString(16));const g=h>>5,y=31&h,v=null!=t?t[w]:void 0,E=null!=t?t.length:void 0;switch(y){case l.ONE:this.emit("more-bytes",g,1,v,E),i=(yield 1)[0];break;case l.TWO:case l.FOUR:case l.EIGHT:const t=1<=48&&t[s]<=57||t[s]>=65&&t[s]<=70||t[s]>=97&&t[s]<=102;)s++;if(0===s)return t;if(13!=t[s]||10!=t[s+1])return t;s+=2;var n=parseInt(i.decode(t.subarray(e,s)),16);if(0==n)break;t.set(t.subarray(s,s+n),r),r+=n,13==t[s+=n]&&10==t[s+1]&&(s+=2),e=s}return t.subarray(0,r)}(t))}catch(t){console.log("Chunk-Encoding Ignored: "+t)}try{if("br"===e)0===(t=n()(t)).length&&(t=i);else if("gzip"===e||"gzip"===r){const e=new s.Inflate;e.push(t,!0),e.result&&!e.err&&(t=e.result)}}catch(t){console.log("Content-Encoding Ignored: "+t)}return t}},function(t,e,r){"use strict";var i={};(0,r(8).assign)(i,r(118),r(121),r(70)),t.exports=i},function(t,e,r){"use strict";let{Json2Csv:i}=r(163),{Csv2Json:n}=r(166),s=r(46);function a(t,e,r,i){return s.convert({data:e,callback:r,options:i,converter:t})}function o(t,e,r){return new Promise((i,n)=>a(t,e,(t,e)=>t?n(t):i(e),r))}function u(t,e,r,i,n){return console.warn("WARNING: "+e+" is deprecated and will be removed soon. Please use "+r+" instead."),o(t,i,n)}t.exports={json2csv:(t,e,r)=>a(i,t,e,r),csv2json:(t,e,r)=>a(n,t,e,r),json2csvAsync:(t,e)=>o(i,t,e),csv2jsonAsync:(t,e)=>o(n,t,e),json2csvPromisified:(t,e)=>u(i,"json2csvPromisified()","json2csvAsync()",t,e),csv2jsonPromisified:(t,e)=>u(n,"csv2jsonPromisified()","csv2jsonAsync()",t,e)}},function(t,e,r){"use strict";var i,n="object"==typeof Reflect?Reflect:null,s=n&&"function"==typeof n.apply?n.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var u=10;function h(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function c(t,e,r,i){var n,s,a,o;if("function"!=typeof r)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r);if(void 0===(s=t._events)?(s=t._events=Object.create(null),t._eventsCount=0):(void 0!==s.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),a=s[e]),void 0===a)a=s[e]=r,++t._eventsCount;else if("function"==typeof a?a=s[e]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),(n=h(t))>0&&a.length>n&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,o=u,console&&console.warn&&console.warn(o)}return t}function l(){for(var t=[],e=0;e0&&(a=e[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var u=n[t];if(void 0===u)return!1;if("function"==typeof u)s(u,this,e);else{var h=u.length,c=m(u,h);for(r=0;r=0;s--)if(r[s]===e||r[s].listener===e){a=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},o.prototype.listeners=function(t){return f(this,t,!0)},o.prototype.rawListeners=function(t){return f(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,r){(e=t.exports=r(52)).Stream=e,e.Readable=e,e.Writable=r(38),e.Duplex=r(10),e.Transform=r(59),e.PassThrough=r(97)},function(t,e,r){"use strict";(function(e,i,n){var s=r(26);function a(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=y;var o,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?i:s.nextTick;y.WritableState=g;var h=r(18);h.inherits=r(9);var c={deprecate:r(96)},l=r(54),d=r(27).Buffer,f=n.Uint8Array||function(){};var p,m=r(56);function w(){}function g(t,e){o=o||r(10),t=t||{};var i=e instanceof o;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,h=t.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(h||0===h)?h:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===t.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(s.nextTick(n,i),s.nextTick(A,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(n(i),t._writableState.errorEmitted=!0,t.emit("error",i),A(t,e))}(t,r,i,e,n);else{var a=E(r);a||r.corked||r.bufferProcessing||!r.bufferedRequest||v(t,r),i?u(_,t,r,a,n):_(t,r,a,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function y(t){if(o=o||r(10),!(p.call(y,this)||this instanceof o))return new y(t);this._writableState=new g(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),l.call(this)}function b(t,e,r,i,n,s,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function _(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),A(t,e)}function v(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),s=e.corkedRequestsFree;s.entry=r;for(var o=0,u=!0;r;)n[o]=r,r.isBuf||(u=!1),r=r.next,o+=1;n.allBuffers=u,b(t,e,!0,e.length,n,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new a(e),e.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,c=r.encoding,l=r.callback;if(b(t,e,!1,e.objectMode?1:h.length,h,c,l),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function E(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function x(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),A(t,e)}))}function A(t,e){var r=E(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,s.nextTick(x,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}h.inherits(y,l),g.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(g.prototype,"buffer",{get:c.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===y&&(t&&t._writableState instanceof g)}})):p=function(t){return t instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(t,e,r){var i,n=this._writableState,a=!1,o=!n.objectMode&&(i=t,d.isBuffer(i)||i instanceof f);return o&&!d.isBuffer(t)&&(t=function(t){return d.from(t)}(t)),"function"==typeof e&&(r=e,e=null),o?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=w),n.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),s.nextTick(e,r)}(this,r):(o||function(t,e,r,i){var n=!0,a=!1;return null===r?a=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),s.nextTick(i,a),n=!1),n}(this,n,t,r))&&(n.pendingcb++,a=function(t,e,r,i,n,s){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=d.from(e,r));return e}(e,i,n);i!==a&&(r=!0,n="buffer",i=a)}var o=e.objectMode?1:i.length;e.length+=o;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(t,e,r){var i=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(t,e,r){e.ending=!0,A(t,e),r&&(e.finished?s.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),y.prototype.destroy=m.destroy,y.prototype._undestroy=m.undestroy,y.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(13),r(57).setImmediate,r(6))},function(t,e,r){"use strict";const i=[65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];e.REPLACEMENT_CHARACTER="�",e.CODE_POINTS={EOF:-1,NULL:0,TABULATION:9,CARRIAGE_RETURN:13,LINE_FEED:10,FORM_FEED:12,SPACE:32,EXCLAMATION_MARK:33,QUOTATION_MARK:34,NUMBER_SIGN:35,AMPERSAND:38,APOSTROPHE:39,HYPHEN_MINUS:45,SOLIDUS:47,DIGIT_0:48,DIGIT_9:57,SEMICOLON:59,LESS_THAN_SIGN:60,EQUALS_SIGN:61,GREATER_THAN_SIGN:62,QUESTION_MARK:63,LATIN_CAPITAL_A:65,LATIN_CAPITAL_F:70,LATIN_CAPITAL_X:88,LATIN_CAPITAL_Z:90,RIGHT_SQUARE_BRACKET:93,GRAVE_ACCENT:96,LATIN_SMALL_A:97,LATIN_SMALL_F:102,LATIN_SMALL_X:120,LATIN_SMALL_Z:122,REPLACEMENT_CHARACTER:65533},e.CODE_POINT_SEQUENCES={DASH_DASH_STRING:[45,45],DOCTYPE_STRING:[68,79,67,84,89,80,69],CDATA_START_STRING:[91,67,68,65,84,65,91],SCRIPT_STRING:[115,99,114,105,112,116],PUBLIC_STRING:[80,85,66,76,73,67],SYSTEM_STRING:[83,89,83,84,69,77]},e.isSurrogate=function(t){return t>=55296&&t<=57343},e.isSurrogatePair=function(t){return t>=56320&&t<=57343},e.getSurrogatePairCodePoint=function(t,e){return 1024*(t-55296)+9216+e},e.isControlCodePoint=function(t){return 32!==t&&10!==t&&13!==t&&9!==t&&12!==t&&t>=1&&t<=31||t>=127&&t<=159},e.isUndefinedCodePoint=function(t){return t>=64976&&t<=65007||i.indexOf(t)>-1}},function(t,e,r){"use strict";class i{constructor(t){const e={},r=this._getOverriddenMethods(this,e);for(const i of Object.keys(r))"function"==typeof r[i]&&(e[i]=t[i],t[i]=r[i])}_getOverriddenMethods(){throw new Error("Not implemented")}}i.install=function(t,e,r){t.__mixins||(t.__mixins=[]);for(let r=0;r=0?e:void 0),remainingKeyPath:t.slice(e+1)}}t.exports={evaluatePath:function t(e,r){if(!e)return null;let{indexOfDot:n,currentKey:s,remainingKeyPath:a}=i(r);if(n>=0&&!e[r])return Array.isArray(e[s])?e[s].map(e=>t(e,a)):t(e[s],a);if(Array.isArray(e))return e.map(e=>t(e,r));return e[r]},setPath:function t(e,r,n){if(!e)throw new Error("No document was provided.");let{indexOfDot:s,currentKey:a,remainingKeyPath:o}=i(r);if(s>=0){if(!e[a]&&Array.isArray(e))return e.forEach(e=>t(e,r,n));e[a]||(e[a]={}),t(e[a],o,n)}else{if(Array.isArray(e))return e.forEach(e=>t(e,o,n));e[r]=n}return e}}},function(t){t.exports=JSON.parse('{"errors":{"callbackRequired":"A callback is required!","optionsRequired":"Options were not passed and are required.","json2csv":{"cannotCallOn":"Cannot call json2csv on ","dataCheckFailure":"Data provided was not an array of documents.","notSameSchema":"Not all documents have the same schema."},"csv2json":{"cannotCallOn":"Cannot call csv2json on ","dataCheckFailure":"CSV is not a string."}},"defaultOptions":{"delimiter":{"field":",","wrap":"\\"","eol":"\\n"},"excelBOM":false,"prependHeader":true,"trimHeaderFields":false,"trimFieldValues":false,"sortHeader":false,"parseCsvNumbers":false,"keys":null,"checkSchemaDifferences":false,"expandArrayObjects":false,"unwindArrays":false,"useLocaleFormat":false},"values":{"excelBOM":"\ufeff"}}')},function(t,e,r){"use strict";let i=r(44),n=r(45);const s=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/;function a(t){return JSON.parse(JSON.stringify(t))}function o(t){return c(t)||h(t)||""===t}function u(t){return"object"==typeof t}function h(t){return null===t}function c(t){return void 0===t}function l(t,e){return t.filter(t=>!e.includes(t))}t.exports={isStringRepresentation:function(t,e){const r=t[0],i=t.length-1,n=t[i];return r===e.delimiter.wrap&&n===e.delimiter.wrap},isDateRepresentation:function(t){return s.test(t)},computeSchemaDifferences:function(t,e){return l(t,e).concat(l(e,t))},deepCopy:a,convert:function(t){let{options:e,callback:r}=function(t,e){if(u(t)&&(r=t,"function"!=typeof r))return{options:t,callback:e};var r;return{options:e,callback:t}}(t.callback,t.options);i=e,(i={...n.defaultOptions,...i||{}}).delimiter={...n.defaultOptions.delimiter,...i.delimiter},e=i;var i;let s=new t.converter(e);(function(t){if(!t.callback)throw new Error(n.errors.callbackRequired);if(!t.data)return t.callback(new Error(t.errorMessages.cannotCallOn+t.data+".")),!1;if(!t.dataCheckFn(t.data))return t.callback(new Error(t.errorMessages.dataCheckFailure)),!1;return!0})({data:t.data,callback:r,errorMessages:s.validationMessages,dataCheckFn:s.validationFn})&&s.convert(t.data,r)},isEmptyField:o,removeEmptyFields:function(t){return t.filter(t=>!o(t))},getNCharacters:function(t,e,r){return t.substring(e,e+r)},unwind:function(t,e){const r=[];return t.forEach(t=>{!function(t,e,r){const n=i.evaluatePath(e,r);let s=a(e);Array.isArray(n)?n.forEach(n=>{s=a(e),t.push(i.setPath(s,r,n))}):t.push(s)}(r,t,e)}),r},isInvalid:function(t){return t===1/0||t===-1/0},isString:function(t){return"string"==typeof t},isNull:h,isError:function(t){return"[object Error]"===Object.prototype.toString.call(t)},isDate:function(t){return t instanceof Date},isUndefined:c,isObject:u,unique:function(t){return[...new Set(t)]},flatten:function(t){return[].concat(...t)}}},function(t,e,r){"use strict";const i=r(17).BigNumber,n=r(16),s=r(48),a=new i(-1),o=new i(10),u=new i(2);class h{constructor(t,e,r){if(this.tag=t,this.value=e,this.err=r,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(t){return t._pushTag(this.tag),t.pushAny(this.value)}convert(t){let e=null!=t?t[this.tag]:void 0;if("function"!=typeof e&&"function"!=typeof(e=h["_tag_"+this.tag]))return this;try{return e.call(h,this.value)}catch(t){return this.err=t,this}}static _tag_0(t){return new Date(t)}static _tag_1(t){return new Date(1e3*t)}static _tag_2(t){return n.bufferToBignumber(t)}static _tag_3(t){return a.minus(n.bufferToBignumber(t))}static _tag_4(t){return o.pow(t[0]).times(t[1])}static _tag_5(t){return u.pow(t[0]).times(t[1])}static _tag_32(t){return s.parse(t)}static _tag_35(t){return new RegExp(t)}}t.exports=h},function(t,e,r){"use strict";var i=r(171),n=r(173);function s(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=b,e.resolve=function(t,e){return b(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?b(t,!1,!0).resolveObject(e):e},e.format=function(t){n.isString(t)&&(t=b(t));return t instanceof s?t.format():s.prototype.format.call(t)},e.Url=s;var a=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,h=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(h),l=["%","/","?",";","#"].concat(c),d=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=r(174);function b(t,e,r){if(t&&n.isObject(t)&&t instanceof s)return t;var i=new s;return i.parse(t,e,r),i}s.prototype.parse=function(t,e,r){if(!n.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var s=t.indexOf("?"),o=-1!==s&&s127?N+="x":N+=I[F];if(!N.match(f)){var P=R.slice(0,T),L=R.slice(T+1),U=I.match(p);U&&(P.push(U[1]),L.unshift(U[2])),L.length&&(b="/"+L.join(".")+b),this.hostname=P.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),D||(this.hostname=i.toASCII(this.hostname));var M=this.port?":"+this.port:"",W=this.hostname||"";this.host=W+M,this.href+=this.host,D&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[E])for(T=0,O=c.length;T0)&&r.host.split("@"))&&(r.auth=D.shift(),r.host=r.hostname=D.shift());return r.search=t.search,r.query=t.query,n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!x.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var S=x.slice(-1)[0],C=(r.host||t.host||x.length>1)&&("."===S||".."===S)||""===S,T=0,k=x.length;k>=0;k--)"."===(S=x[k])?x.splice(k,1):".."===S?(x.splice(k,1),T++):T&&(x.splice(k,1),T--);if(!v&&!E)for(;T--;T)x.unshift("..");!v||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),C&&"/"!==x.join("/").substr(-1)&&x.push("");var D,R=""===x[0]||x[0]&&"/"===x[0].charAt(0);A&&(r.hostname=r.host=R?"":x.length?x.shift():"",(D=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=D.shift(),r.host=r.hostname=D.shift()));return(v=v||r.host&&x.length)&&!R&&x.unshift(""),x.length?r.pathname=x.join("/"):(r.pathname=null,r.path=null),n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},s.prototype.parseHost=function(){var t=this.host,e=o.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,r){"use strict";const{Transform:i}=r(4),n=r(28),s=r(104),a=r(40),o=r(61),u=r(106),h=r(107),c={sourceCodeLocationInfo:!1};const l={[n.START_TAG_TOKEN]:{eventName:"startTag",reshapeToken:t=>({tagName:t.tagName,attrs:t.attrs,selfClosing:t.selfClosing,sourceCodeLocation:t.location})},[n.END_TAG_TOKEN]:{eventName:"endTag",reshapeToken:t=>({tagName:t.tagName,sourceCodeLocation:t.location})},[n.COMMENT_TOKEN]:{eventName:"comment",reshapeToken:t=>({text:t.data,sourceCodeLocation:t.location})},[n.DOCTYPE_TOKEN]:{eventName:"doctype",reshapeToken:t=>({name:t.name,publicId:t.publicId,systemId:t.systemId,sourceCodeLocation:t.location})},[n.CHARACTER_TOKEN]:{eventName:"text",reshapeToken:t=>({text:t.chars,sourceCodeLocation:t.location})}};t.exports=class extends i{constructor(t){super({encoding:"utf8",decodeStrings:!1}),this.options=o(c,t),this.tokenizer=new n(t),this.locInfoMixin=null,this.options.sourceCodeLocationInfo&&(this.locInfoMixin=a.install(this.tokenizer,s)),this.parserFeedbackSimulator=new h(this.tokenizer),this.pendingText=null,this.lastChunkWritten=!1,this.stopped=!1,this.pipe(new u)}_transform(t,e,r){if("string"!=typeof t)throw new TypeError("Parser can work only with string streams.");r(null,this._transformChunk(t))}_final(t){this.lastChunkWritten=!0,t(null,this._transformChunk(""))}stop(){this.stopped=!0}_transformChunk(t){return this.stopped||(this.tokenizer.write(t,this.lastChunkWritten),this._runParsingLoop()),t}_runParsingLoop(){let t=null;do{if((t=this.parserFeedbackSimulator.getNextToken()).type===n.HIBERNATION_TOKEN)break;if(t.type===n.CHARACTER_TOKEN||t.type===n.WHITESPACE_CHARACTER_TOKEN||t.type===n.NULL_CHARACTER_TOKEN){if(null===this.pendingText)t.type=n.CHARACTER_TOKEN,this.pendingText=t;else if(this.pendingText.chars+=t.chars,this.options.sourceCodeLocationInfo){const{endLine:e,endCol:r,endOffset:i}=t.location;Object.assign(this.pendingText.location,{endLine:e,endCol:r,endOffset:i})}}else this._emitPendingText(),this._handleToken(t)}while(!this.stopped&&t.type!==n.EOF_TOKEN)}_handleToken(t){if(t.type===n.EOF_TOKEN)return!0;const{eventName:e,reshapeToken:r}=l[t.type];return 0!==this.listenerCount(e)&&(this._emitToken(e,r(t)),!0)}_emitToken(t,e){this.emit(t,e)}_emitPendingText(){null!==this.pendingText&&(this._handleToken(this.pendingText),this.pendingText=null)}}},function(t,e,r){"use strict";r.r(e);const i=(t,e)=>e.some(e=>t instanceof e);let n,s;const a=new WeakMap,o=new WeakMap,u=new WeakMap,h=new WeakMap,c=new WeakMap;let l={get(t,e,r){if(t instanceof IDBTransaction){if("done"===e)return o.get(t);if("objectStoreNames"===e)return t.objectStoreNames||u.get(t);if("store"===e)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return m(t[e])},set:(t,e,r)=>(t[e]=r,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function d(t){l=t(l)}function f(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(s||(s=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(w(this),e),m(a.get(this))}:function(...e){return m(t.apply(w(this),e))}:function(e,...r){const i=t.call(w(this),e,...r);return u.set(i,e.sort?e.sort():[e]),m(i)}}function p(t){return"function"==typeof t?f(t):(t instanceof IDBTransaction&&function(t){if(o.has(t))return;const e=new Promise((e,r)=>{const i=()=>{t.removeEventListener("complete",n),t.removeEventListener("error",s),t.removeEventListener("abort",s)},n=()=>{e(),i()},s=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",n),t.addEventListener("error",s),t.addEventListener("abort",s)});o.set(t,e)}(t),i(t,n||(n=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,l):t)}function m(t){if(t instanceof IDBRequest)return function(t){const e=new Promise((e,r)=>{const i=()=>{t.removeEventListener("success",n),t.removeEventListener("error",s)},n=()=>{e(m(t.result)),i()},s=()=>{r(t.error),i()};t.addEventListener("success",n),t.addEventListener("error",s)});return e.then(e=>{e instanceof IDBCursor&&a.set(e,t)}).catch(()=>{}),c.set(e,t),e}(t);if(h.has(t))return h.get(t);const e=p(t);return e!==t&&(h.set(t,e),c.set(e,t)),e}const w=t=>c.get(t);function g(t,e,{blocked:r,upgrade:i,blocking:n,terminated:s}={}){const a=indexedDB.open(t,e),o=m(a);return i&&a.addEventListener("upgradeneeded",t=>{i(m(a.result),t.oldVersion,t.newVersion,m(a.transaction))}),r&&a.addEventListener("blocked",()=>r()),s&&a.addEventListener("close",()=>s()),n&&o.then(t=>t.addEventListener("versionchange",n)).catch(()=>{}),o}function y(t,{blocked:e}={}){const r=indexedDB.deleteDatabase(t);return e&&r.addEventListener("blocked",()=>e()),m(r).then(()=>void 0)}const b=["get","getKey","getAll","getAllKeys","count"],_=["put","add","delete","clear"],v=new Map;function E(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(v.get(e))return v.get(e);const r=e.replace(/FromIndex$/,""),i=e!==r,n=_.includes(r);if(!(r in(i?IDBIndex:IDBObjectStore).prototype)||!n&&!b.includes(r))return;const s=async function(t,...e){const s=this.transaction(t,n?"readwrite":"readonly");let a=s.store;i&&(a=a.index(e.shift()));const o=a[r](...e);return n&&await s.done,o};return v.set(e,s),s}d(t=>({...t,get:(e,r,i)=>E(e,r)||t.get(e,r,i),has:(e,r)=>!!E(e,r)||t.has(e,r)}));const x=["continue","continuePrimaryKey","advance"],A={},S=new WeakMap,C=new WeakMap,T={get(t,e){if(!x.includes(e))return t[e];let r=A[e];return r||(r=A[e]=function(...t){S.set(this,C.get(this)[e](...t))}),r}};async function*k(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const r=new Proxy(e,T);for(C.set(r,e),c.set(r,w(e));e;)yield r,e=await(S.get(r)||e.continue()),S.delete(r)}function D(t,e){return e===Symbol.asyncIterator&&i(t,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===e&&i(t,[IDBIndex,IDBObjectStore])}d(t=>({...t,get:(e,r,i)=>D(e,r)?k:t.get(e,r,i),has:(e,r)=>D(e,r)||t.has(e,r)}));var R=r(0);const O=[{match:/[?&](_|cb|_ga|\w*cache\w*)=[\d.-]+(?=$|&)/i,replace:""},{match:/([?&])utm_[^=]+=[^&]+(?=&|$)/g,replace:""},{match:/[?&](callback=jsonp)[^&]+(?=&|$)/i,replace:""},{match:/[?&]((?:\w+)=jquery)[\d]+_[\d]+/i,replace:""},{match:/\/\/.*(?:gcs-vimeo|vod|vod-progressive)\.akamaized\.net.*(\/[\d]+)\/[\d]+(.mp4)/,replace:"//video.vimeo.net$1$2",split:".net",last:!0},{match:/\/\/.*(player.vimeo.com\/video\/[\d]+)\?.*/i,replace:"$1"},{match:/(\.(?:php|js|webm|mp4|gif|jpg|png|css))\?.*/i,replace:"$1"},{match:/(www\.)?youtube(-nocookie)?\.com\/get_video_info/i,args:[["video_id","html5"]]},{match:/\/\/.*(googlevideo.com\/videoplayback)/i,replace:"server.$1",args:[["id","itag"],["id"]]},{match:/facebook\.com\/ajax\/pagelet\/generic.php\/photoviewerinitpagelet/i,args:[[{arg:"data",keys:["query_type","fbid","v","cursor","data"]}]]},{match:/facebook\.com\/videos\/vodcomments/i,args:[["eft_id"]]},{match:/facebook\.com\/ajax\.*/i,replaceQuery:/([?&][^_]\w+=[^&]+)/g},{match:/plus\.googleapis\.com\/u\/\/0\/_\/widget\/render\/comments/i,args:[["href","stream_id","substream_id"]]}];function I(t,e,r){if(!(r&&r.rule&&r.rule.replace&&r.rule.split))return function(t,e,r){try{t=new URL(t)}catch(t){return 0}let i=0,n=null;const s=new URLSearchParams(t.search);for(const t of e){let e="string"==typeof t?t:t.url;try{e=new URL(e)}catch(t){continue}const r=new URLSearchParams(e.search);let a=N(s,r);a+=N(r,s),(a/=2)>i&&(i=a,n=t)}return{score:i,result:n}}(t,e);const i=r.fuzzyUrl.endsWith("?")?r.fuzzyUrl.slice(0,-1):r.fuzzyUrl,n=r.rule.match,s=r.rule.replace;for(const t of e){if(i===("string"==typeof t?t:t.url).replace(n,s))return{score:1,result:t}}return{score:0,result:null}}function N(t,e){let r=1,i=1;for(const[n,s]of t){const t=e.get(n);let a;"_"===n[0]?(i+=1,r+=1,a=1):a=10,i+=a,t===s?r+=a:null===t?r-=1:t.length>s.length&&t.indexOf(",")>=0&&t.indexOf(s)>=0&&(r+=.8*a)}return r/i}const F=new class{constructor(t){this.rules=t||O}*fuzzyUrls(t,e=!1){const r=t;function i(t,i){if(!e)return t;const n=i.split||"?",s=r.indexOf(n);return[t,{prefix:s>0?r.slice(0,s+n.length):r,rule:i,fuzzyUrl:t}]}-1===t.indexOf("?")&&(t+="?");for(const e of this.rules){if(t.match(e.match))if(void 0===e.args&&void 0!==e.replace){const r=t.replace(e.match,e.replace);if(r!=t&&(yield i(r,e),t=r),e.last)break}else{if(void 0!==e.args){void 0!==e.replace&&(t=t.replace(e.match,e.replace));for(let r of e.args){const n=this.getQueryUrl(t,r);t!=n&&(yield i(n,e))}break}if(e.replaceQuery){const r=t.match(e.replaceQuery),n=this.getQueryUrl(t,r?r.join(""):"");n!=t&&(yield i(n,e));break}}}}getQueryUrl(t,e){try{t=new URL(t)}catch(t){return null}if("string"==typeof e)return t.search=e,t.toString();const r=new URLSearchParams(t.search),i=new URLSearchParams;for(const t of e)if("string"==typeof t){const e=r.get(t);e&&i.set(t,e)}else"object"==typeof t&&this.setQueryJsonArg(r,i,t);return t.search="?"+i.toString(),t.toString()}setQueryJsonArg(t,e,r){let i;try{i=t.get(r.arg),i=JSON.parse(i)}catch(t){return void console.log("JSON parse error: "+i)}let n={};for(const t of r.keys){const e=i[t];null!=e&&(n[t]=e)}e.set(r.arg,JSON.stringify(n))}};var B=r(86),P=r(5);class L{constructor(t,e={}){this.name=t,this.db=null;const{minDedupSize:r}=e;this.minDedupSize=Number.isInteger(r)?r:1024,this.version=1,this.useRefCounts=!0,this.allowRepeats=!0,this.repeatTracker=this.allowRepeats?new U:null,this.fuzzyPrefixSearch=!0,this.initing=this.init()}async init(){this.db=await g(this.name,this.version,{upgrade:(t,e,r,i)=>this._initDB(t,e,r,i),blocking:t=>{t&&null!==t.newVersion||this.close()}})}_initDB(t,e,r,i){if(!e){const e=t.createObjectStore("pages",{keyPath:"id"});e.createIndex("url","url"),e.createIndex("ts","ts");t.createObjectStore("pageLists",{keyPath:"id",autoIncrement:!0});t.createObjectStore("curatedPages",{keyPath:"id",autoIncrement:!0}).createIndex("listPages",["list","pos"]);const r=t.createObjectStore("resources",{keyPath:["url","ts"]});r.createIndex("pageId","pageId"),r.createIndex("mimeStatusUrl",["mime","status","url"]);t.createObjectStore("payload",{keyPath:"digest",unique:!0}),t.createObjectStore("digestRef",{keyPath:"digest",unique:!0})}}async clearAll(){const t=["pages","resources","payload","digestRef"];for(const e of t)await this.db.clear(e)}close(){this.db&&(this.db.close(),this.db=null)}async delete(){this.close(),await y(this.name,{blocked(t){console.log("Unable to delete: "+t)}})}async addPage(t,e){const r=t.url,i=t.title||t.url,n=t.id||this.newPageId();let s=t.ts;s||!t.date&&!t.datetime||(s=new Date(t.date||t.datetime).getTime());const a={...t,url:r,ts:s,title:i,id:n};return e?(e.store.put(a),a.id):await this.db.put("pages",a)}async addPages(t){const e=this.db.transaction("pages","readwrite");for(const e of t)this.addPage(e);try{await e.done}catch(t){console.warn("addPages tx",t.toString())}}async addCPageList(t){const e={};return e.title=t.title,e.desc=t.desc,e.slug=t.slug,await this.db.put("pageLists",e)}async addCuratedPageLists(t,e="pages",r="public"){for(const i of t){if(r&&!i[r])continue;const t=await this.addCPageList(i),n=this.db.transaction("curatedPages","readwrite");let s=0;const a=i[e]||[];for(const e of a){const r={};r.pos=s++,r.list=t;const i=typeof e.page;r.page="string"===i?e.page:"object"===i?e.page.id:e.page_id||e.pageId,r.desc=e.desc,n.store.put(r)}try{await n.done}catch(t){console.warn("addCuratedPageLists tx",t.toString())}}}async getAllCuratedByList(){const t=await this.db.getAll("pageLists"),e=this.db.transaction("curatedPages","readonly");for await(const r of e.store.index("listPages").iterate()){const e=t[r.value.list-1];e&&(e.show=!0,e.pages||(e.pages=[]),e.pages.push(r.value))}return t}newPageId(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}async getAllPages(){return await this.db.getAll("pages")}async getPages(t){const e=[];t.sort();for await(const r of this.matchAny("pages",null,t))e.push(r);return e}async dedupResource(t,e,r){const i=r.objectStore("digestRef"),n=!!t&&await i.get(t);let s=!0;if(n)++n.count,i.put(n),s=!1;else try{r.objectStore("payload").add({digest:t,payload:e});const n=1,s=e.length;i.put({digest:t,count:n,size:s})}catch(t){console.log(t)}return s}async addResources(t){const e=[],r=[];let i=this.db.transaction(["digestRef","payload"],"readwrite");for(const n of t)"warc/revisit"===n.mime?e.push(n):r.push(n),this.useRefCounts&&n.digest&&n.payload&&(await this.dedupResource(n.digest,n.payload,i),delete n.payload);try{await i.done}catch(t){console.log("Payload Bulk Add Failed: "+t)}const n=this.db.transaction("resources","readwrite");for(const t of e)n.store.put(t);for(const t of r)n.store.put(t),this._addUrlFuzzy(t,n);await n.done}async _addUrlFuzzy(t,e){if(t.status>=200&&t.status<300&&204!=t.status)for await(const r of F.fuzzyUrls(t.url)){if(r===t.url)continue;const i={url:r,ts:t.ts,origURL:t.url,origTS:t.ts,pageId:t.pageId,digest:t.digest};e.store.put(i)}}async addResource(t){let e=!1;if(t.payload&&t.payload.length>this.minDedupSize){t.digest||(t.digest=await Object(R.d)(t.payload,"sha-256"));const r=this.db.transaction(["digestRef","payload"],"readwrite");e=await this.dedupResource(t.digest,t.payload,r);try{await r.done}catch(t){console.log("Payload Add Failed: "+t)}delete t.payload}if("warc/revisit"===t.mime){try{await this.db.add("resources",t)}catch(e){console.log("Skip Duplicate revisit for: "+t.url)}return e}const r=this.db.transaction("resources","readwrite");r.store.put(t),this._addUrlFuzzy(t,r);try{await r.done}catch(e){console.log("Fuzzy Add Error for "+t.url),console.log(e)}return e}async getResource(t,e,r){const i=Object(R.l)(t.timestamp).getTime();let n=t.url,s=null;const a={skip:this.repeatTracker?this.repeatTracker.getSkipCount(r,n,t.request.method):0};if(n.startsWith("//")){let e=!1;(s=await this.lookupUrl("https:"+n,i,a))||((s=await this.lookupUrl("http:"+n,i,a))||t.request.referrer.indexOf("/http://",2)>0)&&(e=!0),n=(e?"http:":"https:")+n}else s=await this.lookupUrl(n,i,a);let o;if(!s)for await(const[t,e]of F.fuzzyUrls(n,!0)){if(s=await this.lookupUrl(t))break;o=e}if(!s&&o&&this.fuzzyPrefixSearch&&(s=await this.lookupQueryPrefix(n,o)),s&&s.origURL){const t=await this.lookupUrl(s.origURL,s.origTS||s.ts);t&&(n=t.url,s=t)}if(!s)return null;const u=s.status,h=s.statusText||Object(B.getStatusText)(u),c=Object(R.h)(u)?null:await this.loadPayload(s),l=Object(R.i)(s.respHeaders),d=new Date(s.ts),f=s.extraOpts||null;return new P.a({url:n,payload:c,status:u,statusText:h,headers:l,date:d,extraOpts:f})}async loadPayload(t){if(t.digest&&!t.payload){const e=await this.db.get("payload",t.digest);if(!e)return null;const{payload:r}=e;return r}return t.payload}async lookupUrl(t,e,r={}){const i=this.db.transaction("resources","readonly");if(e){const r=await i.store.get([t,e]);if(r)return r}let n=null,s=r.skip||0;for await(const r of i.store.iterate(this.getLookupRange(t))){if(n&&r.value.ts>e){if(0==s){return r.value.ts-ee?++a:n?(yield s.value,s=await s.continue()):s=await s.continue(r[a])}}async resourcesByUrlAndMime(t,e,r=1e3,i=!0,n="",s=""){const a=e?null:r,o=await this.db.getAll("resources",this.getLookupRange(t,i?"prefix":"exact",n,s),a);e=e.split(",");const u=[];for(const t of o)for(const i of e)if(!i||t.mime&&t.mime.startsWith(i)){if(u.push(this.resJson(t)),u.length===r)return u;break}return u}async resourcesByMime(t,e=100,r="",i=""){const n=[];(t=t.split(",")).sort();let s=[];for(const e of t)r&&e=1?a.put(r):(n+=r?r.size:0,a.delete(t),s.objectStore("payload").delete(t))}return await s.done,n}getLookupRange(t,e,r,i){let n,s,a;switch(e){case"prefix":s=t.slice(0,-1)+String.fromCharCode(t.charCodeAt(t.length-1)+1),n=[t],s=[s];break;case"host":const e=new URL(t).origin;n=[e+"/"],s=[e+"0"];break;case"exact":default:n=[t],s=[t+"!"]}return r?(n=[r,i||""],a=!0):a=!1,IDBKeyRange.bound(n,s,a,!0)}}class U{constructor(){this.repeats={}}getSkipCount(t,e,r){if("POST"!==r)return 0;t.replacesClientId&&delete this.repeats[t.replacesClientId];const i=t.resultingClientId||t.clientId;return i?(void 0===this.repeats[i]&&(this.repeats[i]={}),void 0===this.repeats[i][e]?this.repeats[i][e]=0:this.repeats[i][e]++,this.repeats[i][e]):0}}var M=r(1),W=r(49),j=r.n(W),z=r(4),H=r(33);const G=["script","style","header","footer","banner-div","noscript"];const q=1e3;class X{constructor(t,e=null,r=null){this.reader=t,this.abort=e,this.loadId=r,this.anyPages=!1,this.detectPages=!1,this._lastRecord=null,this.promises=[],this.metadata={},this.batch=[],this.count=0,this.pageMap={},this.pages=[],this.lists=[]}parseWarcInfo(t){if(!t.payload)return;const e=new TextDecoder("utf-8").decode(t.payload);for(const t of e.split("\n"))if(t.startsWith("json-metadata:"))try{const e=JSON.parse(t.slice("json-metadata:".length));if("collection"===e.type&&(this.metadata.desc=e.desc,this.metadata.title=e.title),e.pages&&e.pages.length){this.pages=this.pages.concat(e.pages);for(const t of e.pages)t.ts=Object(R.l)(t.timestamp).getTime(),this.pageMap[t.ts+"/"+t.url]={page:t};this.anyPages=!0}e.lists&&e.lists.length&&(this.lists=this.lists.concat(e.lists))}catch(t){console.log("Page Add Error",t.toString())}}addPage(t){this.promises.push(this.db.addPage(t))}addResource(t){this.batch.length>=q&&(this.promises.push(this.db.addResources(this.batch)),this.batch=[],console.log(`Read ${this.count+=q} records`)),this.batch.push(t)}index(t){if("warcinfo"!==t.warcType){if(this._lastRecord)return this._lastRecord.warcTargetURI!=t.warcTargetURI?(this.indexReqResponse(this._lastRecord,null),void(this._lastRecord=t)):void("request"===t.warcType&&"response"===this._lastRecord.warcType?(this.indexReqResponse(this._lastRecord,t),this._lastRecord=null):"response"===t.warcType&&"request"===this._lastRecord.warcType?(this.indexReqResponse(t,this._lastRecord),this._lastRecord=null):(this.indexReqResponse(this._lastRecord,null),this._lastRecord=t));this._lastRecord=t}else this.parseWarcInfo(t)}indexDone(){this._lastRecord&&(this.indexReqResponse(this._lastRecord),this._lastRecord=null)}shouldIndexMetadataRecord(t){const e=t.warcTargetURI;return!(!e||!e.startsWith("metadata://"))}parseRevisitRecord(t){const e=t.warcTargetURI.split("#")[0],r=(t.warcDate,new Date(t.warcDate).getTime()),i=t.warcRefersToTargetURI,n=new Date(t.warcRefersToDate).getTime();return i===e&&n===r?null:{url:e,ts:r,origURL:i,origTS:n,digest:t.warcPayloadDigest,pageId:null}}indexReqResponse(t,e){const r=this.parseRecords(t,e);r&&this.addResource(r)}parseRecords(t,e){switch(t.warcType){case"revisit":return this.parseRevisitRecord(t);case"resource":e=null;break;case"response":break;case"metadata":if(!this.shouldIndexMetadataRecord(t))return null;break;default:return null}const r=t.warcTargetURI.split("#")[0],i=t.warcDate;let n,s=200,a="OK",o=0,u="";if(t.httpHeaders){if(204===(s=Number(t.httpHeaders.statusCode)||200))return null;if(e&&"OPTIONS"===e.httpHeaders.method)return null;if(a=t.httpHeaders.statusText,u=((n=Object(R.i)(t.httpHeaders.headers)).get("content-type")||"").split(";")[0],o=parseInt(n.get("content-length")||0),206===s){const t=n.get("content-range"),e=`bytes 0-${o-1}/${o}`;if(t&&t!==e)return null}if(s>300&&s<400){const t=n.get("location");if(t&&new URL(t,r).href===r)return null}}else(n=new Headers).set("content-type",t.warcContentType),n.set("content-length",t.warcContentLength),u=t.warcContentType,o=t.warcContentLength;let h=null;if(e&&e.httpHeaders.headers)try{const t=new Headers(e.httpHeaders.headers).get("cookie");t&&n.set("x-wabac-preset-cookie",t),h=e.httpHeaders.headers.get("Referer")}catch(t){console.warn(t)}if(void 0===this.detectPages&&(this.detectPages=!this.anyPages),this.detectPages&&function(t,e,r){if(200!=e)return!1;if(!t.startsWith("http:")&&!t.startsWith("https:")&&!t.startsWith("blob:"))return!1;if(t.endsWith("/robots.txt"))return!1;const i=t.split("?",2);if(2===i.length&&i[1].length>i[0].length)return!1;if(i[0].substring(i[0].lastIndexOf("/")+1).startsWith("."))return!1;if(r&&"text/html"!==r)return!1;return!0}(r,s,u)){const t=r;this.addPage({url:r,date:i,title:t})}const c=new Date(i).getTime(),l=Object.fromEntries(n.entries()),d=t.warcPayloadDigest,f=t.payload,p={url:r,ts:c,status:s,mime:u,respHeaders:l,digest:d,payload:f,reader:f?null:t.reader,referrer:h};this.pageMap[c+"/"+r]&&f&&u.startsWith("text/")&&(this.pageMap[c+"/"+r].textPromise=async function(t,e,r,i){const n=new j.a,s=[];let a=null;n.on("text",(t,e)=>{if(a)return;const r=t.text.trim();r&&s.push(r)}),n.on("startTag",t=>{!t.selfClosing&&G.includes(t.tagName)&&(a=t.tagName)}),n.on("endTag",t=>{t.tagName===a&&(a=null)});const o=new z.PassThrough({encoding:"utf8"});(r||i)&&(e=await Object(H.a)(e,r,i)),o.push(e),o.push(null),o.pipe(n);const u=new Promise(t=>{n.on("end",()=>{t(s.join(" "))})});return await u}(0,f,n.get("content-encoding"),n.get("transfer-encoding")));const m=t.warcHeader("WARC-JSON-Metadata");if(m)try{p.extraOpts=JSON.parse(m)}catch(t){}const w=t.warcHeader("WARC-Page-ID");return w&&(p.pageId=w),p}filterRecord(t){return null}async load(t,e,r){this.db=t;const i=new M.d(this.reader);let n=0,s=0;try{for await(const t of i){if(!t.warcType){console.log("skip empty record");continue}if(self.interruptLoads&&this.loadId&&self.interruptLoads[this.loadId])throw e(Math.round(i.offset/r*95),"Loading Canceled",i.offset,r),self.interruptLoads[this.loadId](),this.abort&&this.abort.abort(),new R.b;(s=(new Date).getTime())-n>500&&(e(Math.round(i.offset/r*95),null,i.offset,r),n=s);const a=this.filterRecord(t);if("done"===a){this.abort&&this.abort.abort();break}if("skip"!==a){"skipContent"===a?await t.skipFully():await t.readFully(),this.index(t,i);try{await Promise.all(this.promises)}catch(t){console.warn(t.toString())}this.promises=[]}}}catch(t){if(t instanceof R.b)throw t;e(Math.round(i.offset/r*95),`Sorry there was an error downloading. Please try again (${t})`,i.offset,r),console.warn(t)}return this.indexDone(),e(95),await this.finishIndexing(),e(100),this.metadata}async finishIndexing(){if(this.batch.length>0&&this.promises.push(this.db.addResources(this.batch)),console.log(`Indexed ${this.count+=this.batch.length} records`),this.pages.length){for(const{page:t,textPromise:e}of Object.values(this.pageMap))if(e)try{t.text=await e}catch(t){console.warn("Error adding text: "+t.toString())}this.promises.push(this.db.addPages(this.pages))}this.lists.length&&this.promises.push(this.db.addCuratedPageLists(this.lists,"bookmarks","public"));try{await Promise.all(this.promises)}catch(t){console.warn(t)}this.promises=[]}}class K extends X{constructor(t){super(t),this.detectPages=!1}addPage(){}async load(){const t=await new M.d(this.reader).parse();if(!t)return null;const e=this.parseRecords(t,null);return e&&"revisit"!==t.warcType||await t.readFully(),e}}class V extends X{filterRecord(t){if("warcinfo"!=t.warcType)return"done"}}const Y="https://helper-proxy.webrecorder.workers.dev";function J(t,e,r,i,n){if(t.startsWith("blob:"))return new $(t,n,r);if(t.startsWith("http:")||t.startsWith("https:")||t.startsWith("file:"))return new Z(t,e,r);if(t.startsWith("googledrive:"))return new Q(t,e,r,i);throw new Error("Invalid URL: "+t)}class Z{constructor(t,e,r=null,i=!1){this.url=t,this.headers=e||{},this.length=r,this.canLoadOnDemand=i,this.isValid=!1}async doInitialFetch(t){const e=new Headers(this.headers);e.set("Range","bytes=0-"),this.isValid=!1;let r=null,i=null;if(t)try{200!==(i=await fetch(this.url,{headers:e,method:"HEAD"})).status&&206!=i.status||(this.canLoadOnDemand=206===i.status||"bytes"===i.headers.get("Accept-Ranges"),this.isValid=!0)}catch(t){}if(!this.isValid){const t=(r=new AbortController).signal;i=await fetch(this.url,{headers:e,signal:t}),this.canLoadOnDemand=206===i.status||"bytes"===i.headers.get("Accept-Ranges"),this.isValid=206===i.status||200===i.status}if(null===this.length&&(this.length=i.headers.get("Content-Length"),!this.length&&206===i.status)){let t=i.headers.get("Content-Range");t&&2===(t=t.split("/")).length&&(this.length=t[1])}if(null===this.length)try{const t=await fetch(`${Y}/c/${this.url}`),e=await t.json();e.size&&(this.length=e.size)}catch(t){console.log("Error fetching from helper: "+t.toString())}return this.length=Number(this.length||0),{response:i,abort:r}}async getLength(){if(null===this.length){const{response:t,abort:e}=await this.doInitialFetch(!0);e&&e.abort()}return this.length}async getRange(t,e,r=!1,i=null){const n=new Headers(this.headers);n.set("Range",`bytes=${t}-${t+e-1}`);const s={signal:i,headers:n};let a=null;try{a=await fetch(this.url,s)}catch(t){throw console.log(t),new RangeError(this.url)}if(206!=a.status)throw 401===a.status||403===a.status?new R.a(this.url,a.status):new RangeError(this.url,a.status);return r?a.body:new Uint8Array(await a.arrayBuffer())}}class Q{constructor(t,e,r,i){this.fileId=t.slice("googledrive://".length),this.apiUrl=`https://www.googleapis.com/drive/v3/files/${this.fileId}?alt=media`,this.canLoadOnDemand=!0,this.headers=e,i&&i.publicUrl?this.publicUrl=i.publicUrl:this.publicUrl=null,this.length=r,this.isValid=!1}async getLength(){return this.length}async doInitialFetch(t){let e=null,r=null;if(this.publicUrl){e=new Z(this.publicUrl,null,this.length);try{r=await e.doInitialFetch(t)}catch(t){}if(!e.isValid&&(r&&r.abort&&r.abort.abort(),await this.refreshPublicUrl())){e=new Z(this.publicUrl,null,this.length);try{r=await e.doInitialFetch(t)}catch(t){}!e.isValid&&r&&r.abort&&r.abort.abort()}}return e&&e.isValid||(this.publicUrl=null,e=new Z(this.apiUrl,this.headers,this.length),r=await e.doInitialFetch(t)),this.isValid=e.isValid,this.length||(this.length=e.length),r}async getRange(t,e,r=!1,i){let n=null;if(this.publicUrl){n=new Z(this.publicUrl,null,this.length);try{return await n.getRange(t,e,r,i)}catch(s){if(await this.refreshPublicUrl()){n=new Z(this.publicUrl,null,this.length);try{return await n.getRange(t,e,r,i)}catch(t){}}}this.publicUrl=null}return n=new Z(this.apiUrl,this.headers,this.length),await n.getRange(t,e,r,i)}async refreshPublicUrl(){try{const t=await fetch(`${Y}/g/${this.fileId}`),e=await t.json();if(e.url)return this.publicUrl=e.url,!0}catch(t){}return!1}}class ${constructor(t,e=null,r=null){this.url=t,this.blob=e,this.size=this.blob?this.blob.size:r,this.canLoadOnDemand=!1}get length(){return this.size}get isValid(){return!!this.blob}async doInitialFetch(t){if(!this.blob){const t=await fetch(this.url);this.blob=await t.blob()}const e=new Response;let r=null;return t||(r=this.blob.stream?this.blob.stream():await this.getReadableStream(this.blob)),{response:e,stream:r}}async getLength(){if(!this.blob&&!this.blob.size){let t=await fetch(this.url);this.blob=await t.blob(),this.size=this.blob.size}return this.size}async getRange(t,e,r=!1,i){if(!this.blob){const i=new Headers;i.set("Range",`bytes=${t}-${t+e-1}`);const n=await fetch(this.url,{headers:i});if(n.headers.get("content-range"))return r?n.body:new Uint8Array(await n.arrayBuffer());this.blob=await n.blob()}const n=this.blob.slice(t,t+e,"application/octet-stream");if(r)return n.stream?n.stream():await this.getReadableStream(n);try{const t=n.arrayBuffer?await n.arrayBuffer():await this.getArrayBuffer(n);return new Uint8Array(t)}catch(t){return console.log("error reading blob",t),null}}getArrayBuffer(t){return new Promise(e=>{let r=new FileReader;r.onloadend=()=>{e(r.result)},r.readAsArrayBuffer(t)})}async getReadableStream(t){const e=await this.getArrayBuffer(t);return new ReadableStream({start(t){t.enqueue(new Uint8Array(e)),t.close()}})}}class tt extends L{constructor(t,e=!1){super(t),this.noCache=e,this.useRefCounts=!1}async loadPayload(t,e=0){let r=await super.loadPayload(t);if(r&&t.respHeaders&&"warc/revisit"!==t.mime)return r;const i=await this.loadSource(t.source),n=await new K(i).load();if(!n)return console.log(`No WARC Record Loaded for: ${t.url}`),null;if(n.url!==t.url)return console.log(`Wrong url: expected ${t.url}, got ${n.url}`),null;if(n.ts!==t.ts){if(1e3*Math.floor(n.ts/1e3)!==t.ts)return console.log(`Wrong timestamp: expected ${t.ts}, got ${n.ts}`),null}if(n.digest!==t.digest&&console.log(`Wrong digest: expected ${t.digest}, got ${n.digest}`),n.origURL){const i=await this.lookupUrl(n.origURL,n.origTS,{noRevisits:!0});return i&&(r||(e<2?r=await this.loadPayload(i,e+1):console.warn("Avoiding revisit lookup loop for: "+JSON.stringify(n)),r))?(t.respHeaders=i.respHeaders,t.mime=i.mime,i.extraOpts&&(t.extraOpts=i.extraOpts),this.noCache||(delete t.payload,await this.db.put("resources",t)),r):null}const s=n.digest;if(!this.noCache&&n.reader&&s&&(n.reader=new it(this,n.reader,s,t.url)),!(r=n.payload)&&!n.reader)return null;try{r&&!this.noCache&&await this.commitPayload(s)}catch(e){console.warn(`Payload Update Error: ${t.url}`),console.warn(e)}if(!(t.respHeaders&&t.digest||(t.respHeaders=n.respHeaders,t.digest=s,n.extraOpts&&(t.extraOpts=n.extraOpts),this.noCache)))try{await this.db.put("resources",t)}catch(e){console.warn(`Resource Update Error: ${t.url}`),console.warn(e)}return r||n.reader}async commitPayload(t,e){if(!t)return;const r=this.db.transaction(["payload","digestRef"],"readwrite");try{if(r.objectStore("payload").put({payload:t,digest:e}),this.useRefCounts){const i=await r.objectStore("digestRef").get(e);i&&(i.size=t.length,r.objectStore("digestRef").put(i))}await r.done}catch(t){console.warn("Payload Commit Error: "+t)}}}class et extends tt{constructor(t,e,r=!1){super(t,r),this.loader=e}updateHeaders(t){this.loader.headers=t}async loadSource(t){const{start:e,length:r}=t;return await this.loader.getRange(e,r,!0)}}class rt extends tt{constructor(t,e,r,i=!1){super(t,i),this.remoteUrlPrefix=e,this.headers=r}updateHeaders(t){this.headers=t}async loadSource(t){const{start:e,length:r}=t,i=new Headers(this.headers),n=J(new URL(t.path,this.remoteUrlPrefix).href,i);return await n.getRange(e,r,!0)}}class it extends M.b{constructor(t,e,r,i=""){super(),this.db=t,this.reader=e,this.digest=r,this.url=i,this.chunks=[],this.size=0,this.fullbuff=null,this.commit=!0,this.alreadyRead=!1}setLimitSkip(t=-1,e=0){-1!=t&&e>0&&(this.commit=!1),this.reader.setLimitSkip(t,e)}async*[Symbol.asyncIterator](){if(!this.alreadyRead){for await(const t of this.reader)this.chunks.push(t),this.size+=t.byteLength,yield t;this.fullbuff=M.b.concatChunks(this.chunks,this.size),0!==this.reader.limit?console.warn(`Expected payload not consumed, ${this.reader.limit} bytes left`):this.commit&&await this.db.commitPayload(this.fullbuff,this.digest),this.chunks=[],this.alreadyRead=!0}}async readFully(){for await(const t of this);return this.fullbuff}}const nt=3e3;class st extends X{constructor(t,e,r){super(t,e,r),this.cdxindexer=null}filterRecord(t){switch(t.warcType){case"warcinfo":case"revisit":return null;case"request":return"skipContent";case"metadata":return this.shouldIndexMetadataRecord(t)?null:"skipContent"}const e=t.warcTargetURI,r=new Date(t.warcDate).getTime();if(this.pageMap[r+"/"+e])return t._isPage=!0,null}index(t,e){if(t._isPage)return super.index(t,e);if("warcinfo"===t.warcType)return void this.parseWarcInfo(t);this.cdxindexer||(this.cdxindexer=new M.c({},null));const r=this.cdxindexer.indexRecord(t,e,"");r&&this.addCdx(r)}addCdx(t){const{url:e,mime:r}=t,i=Number(t.status)||200,n=Object(R.l)(t.timestamp).getTime(),s={path:t.filename,start:Number(t.offset),length:Number(t.length)};let{digest:a}=t;a&&-1===a.indexOf(":")&&(a="sha1:"+a);const o={url:e,ts:n,status:i,digest:a,mime:r,loaded:!1,source:s};this.batch.length>=nt&&(this.promises.push(this.db.addResources(this.batch)),this.batch=[],console.log(`Read ${this.count+=nt} records`)),this.batch.push(o)}}class at extends st{async load(t){this.db=t;let e=this.reader;e.iterLines||(e=new M.a(this.reader));for await(const t of e.iterLines()){let e,r,i,n=t.trimEnd();if(!n.startsWith("{")){const t=n.indexOf(" {");if(t<0)continue;[r,i]=n.split(" ",2),n=n.slice(t)}try{e=JSON.parse(n)}catch(t){console.log("JSON Parser error on: "+n);continue}e.timestamp=i,e.url||(e.url=r),this.addCdx(e)}this.indexDone(),await this.finishIndexing()}}const ot=/(?:([\d]+)[^\/]*\/)?(http.*)/;class ut{constructor(t){this.replayPrefix=t.replayPrefix,this.idMod=void 0!==t.idMod?t.idMod:"id_",this.redirMod=void 0!==t.redirMod?t.redirMod:"mp_",this.redirectMode=this.idMod===this.redirMod?"follow":"manual"}async getAllPages(){return[]}getUrl(t,e){let r=this.replayPrefix;return(e||t.timestamp)&&(r+=t.timestamp+e+"/"),r+t.url}async getResource(t,e,r){let i=await fetch(this.getUrl(t,this.idMod),{credentials:"same-origin",redirect:this.redirectMode,mode:"cors"});if(i.status>=400&&!i.headers.get("memento-datetime"))return null;const n=await this.getRedirect(t,i,e);let s=null,a=!1;n?(i=Response.redirect(n.path,307),a=!0,s=n.timestamp):s=t.timestamp;const o=t.url,u=s?Object(R.l)(s):new Date;return P.a.fromResponse({url:o,response:i,date:u,noRW:a})}async getRedirect(t,e,r){if("opaqueredirect"===e.type)e=await fetch(this.getUrl(t,this.redirMod),{credentials:"same-origin",redirect:"follow",mode:"cors"});else if(!e.redirected)return null;const i=e.url.indexOf(this.replayPrefix)+this.replayPrefix.length,n=e.url.slice(i),s=n.match(ot);return s?{timestamp:s[1],path:r+s[1]+"mp_/"+s[2]}:{path:r+n}}}class ht{constructor(t,e=!1,r=!0){this.prefix=t||"",this.proxyPathOnly=e,this.isLive=r}async getAllPages(){return[]}async getResource(t,e,r){let i,n;if(this.isLive){i=new Headers(t.request.headers);let r=t.request.referrer;const s=r.indexOf("/http",e.length-1);s>0&&(r=r.slice(s+1),i.set("X-Proxy-Referer",r)),n=t.request.credentials}else i=new Headers,n="omit";let s,a=t.url;if(a.startsWith("//"))try{a=new URL(referrer).protocol+a}catch(t){a="https:"+a}if(this.proxyPathOnly){const t=new URL(a);s=this.prefix+t.pathname+t.search}else s=this.prefix+a;const o=await fetch(s,{method:t.request.method,body:t.request.body,headers:i,credentials:n,mode:"cors",redirect:"follow"});return P.a.fromResponse({url:a,response:o,date:new Date,noRW:!1,isLive:this.isLive})}}var ct=r(25),lt=r.n(ct),dt=r(35);class ft extends et{constructor(t,e,r=null,i=!1,n){super(t,e,i),this.zipreader=new wt(e),this.externalSources=[],this.fuzzyUrlRules=[],this.useSurt=!0,this.fullConfig=n,e.canLoadOnDemand=!0,r&&this.initConfig(r)}_initDB(t,e,r,i){if(super._initDB(t,e,r,i),!e){t.createObjectStore("ziplines",{keyPath:"prefix"}),t.createObjectStore("zipEntries",{keyPath:"filename"})}}async init(){await super.init(),await this.loadZipEntries()}async clearZipData(){const t=["zipEntries","ziplines"];for(const e of t)await this.db.clear(e)}async clearAll(){await super.clearAll(),await this.clearZipData()}updateHeaders(t){this.zipreader.loader.headers=t}async loadZipEntries(){const t=await this.db.getAll("zipEntries");if(!t.length)return;const e={};for(const r of t)e[r.filename]=r;this.zipreader.entries=e}async saveZipEntries(t){const e=this.db.transaction("zipEntries","readwrite");e.store.clear();for(const r of Object.values(t))e.store.put(r);await e.done,this.db.clear("ziplines")}async loadZipIndex(t){for await(const e of t.iterLines()){let t;if(e.indexOf("\t")>0){let[r,i,n,s]=e.split("\t");t={prefix:r,filename:i,offset:n=Number(n),length:s=Number(s),loaded:!1},this.useSurt=!0}else{const r=e.indexOf(" {");if(r<0){console.log("Invalid Index Line: "+e);continue}const i=e.slice(0,r),{offset:n,length:s,filename:a}=JSON.parse(e.slice(r));t={prefix:i,filename:a,offset:n,length:s,loaded:!1}}await this.db.put("ziplines",t)}}async load(t,e,r){if(t!==this)return void console.error("wrong db");const i=await t.zipreader.load(!0);await t.saveZipEntries(i);const n=[];let s;i["webarchive.yaml"]&&(s=await this.loadMetadata(i,await t.zipreader.loadFile("webarchive.yaml")));for(const r of Object.keys(i))if(r.endsWith(".cdx")||r.endsWith(".cdxj")){console.log("Loading CDX "+r);const e=await t.zipreader.loadFile(r);n.push(new at(e).load(t))}else if(r.endsWith(".idx"))this.loader.canLoadOnDemand&&(console.log("Loading IDX "+r),n.push(t.loadZipIndex(await t.zipreader.loadFile(r))));else if(r.endsWith(".warc.gz")||r.endsWith(".warc"))if(!s&&this.loader.canLoadOnDemand){const i=new AbortController,n=await t.zipreader.loadFile(r,{signal:i.signal,unzip:!0}),a=new V(n,i),o=t.zipreader.getCompressedSize(r);s=await a.load(t,e,o)}else if(!this.loader.canLoadOnDemand){const i=await t.zipreader.loadFile(r,{unzip:!0}),n=new X(i);n.detectPages=!1;const a=t.zipreader.getCompressedSize(r);s=await n.load(t,e,a)}return await Promise.all(n),s||{}}async loadPagesCSV(t){const e=(new TextDecoder).decode(await t.readFully()),r=await Object(dt.csv2jsonAsync)(e);r&&r.length&&await this.addPages(r)}initConfig(t){if(void 0!==t.decodeResponses&&(this.fullConfig.decode=t.decodeResponses),void 0!==t.useSurt&&(this.useSurt=t.useSurt),t.es)for(const[e,r]of t.es){const t=new ht(r,!0,!1);this.externalSources.push({prefix:e,external:t})}if(t.fuzzy)for(const[e,r]of t.fuzzy){const t=new RegExp(e);this.fuzzyUrlRules.push({match:t,replace:r})}}async loadMetadata(t,e){const r=(new TextDecoder).decode(await e.readFully()),i=lt.a.safeLoad(r);void 0!==i.config&&this.initConfig(i.config);const n={desc:i.desc,title:i.title},s=i.pages||[];s&&s.length?await this.addPages(s):t["pages.csv"]&&await this.loadPagesCSV(await this.zipreader.loadFile("pages.csv"));const a=i.pageLists||[];return a&&a.length&&await this.addCuratedPageLists(a,"pages","show"),n}async loadSource(t){let e,r=0,i=-1;if("string"==typeof t)e=t;else{if("object"!=typeof t)return null;r=t.start,i=t.length,e=t.path}return await this.zipreader.loadWARC(e,r,i)}getSurt(t){try{t=t.replace(/www\d*\./,"");const e=new URL(t);let r=e.hostname.split(".").reverse().join(",");return e.port&&(r+=":"+e.port),r+=")",(r+=e.pathname).toLowerCase()}catch(e){return t}}async loadFromZiplines(t,e){const r=e?Object(R.f)(new Date(e).toISOString()):"",i=this.useSurt?this.getSurt(t):t,n=this.db.transaction("ziplines","readonly"),s=[],a=IDBKeyRange.upperBound(i+" "+r,!0);for await(const t of n.store.iterate(a,"prev"))if(s.unshift(t.value),!t.value.prefix.split(" ")[0].startsWith(i))break;await n.done;const o=[];for(const t of s){if(t.loaded)continue;const e="indexes/"+t.filename,r={offset:t.offset,length:t.length,unzip:!0},i=await this.zipreader.loadFile(e,r);o.push(new at(i).load(this)),t.loaded=!0,await this.db.put("ziplines",t)}return await Promise.all(o),o.length>0}async getResource(t,e,r){if(this.externalSources.length)for(const{prefix:i,external:n}of this.externalSources)if(t.url.startsWith(i))try{return await n.getResource(t,e,r)}catch(t){console.warn("Upstream Error",t)}let i=await super.getResource(t,e,r);if(i)return i;if(this.fuzzyUrlRules.length)for(const{match:n,replace:s}of this.fuzzyUrlRules){const a=t.url.replace(n,s);if(a&&a!==t.url&&(t.url=a,i=await super.getResource(t,e,r)))return i}return null}async lookupUrl(t,e,r={}){try{let i=await super.lookupUrl(t,e,r);return!i||r.noRevisits&&"warc/revisit"===i.mime?(await this.loadFromZiplines(t,e)&&(i=await super.lookupUrl(t,e,r)),i):i}catch(t){return console.warn(t),null}}async resourcesByUrlAndMime(t,...e){let r=await super.resourcesByUrlAndMime(t,...e);return r.length>0?r:(await this.loadFromZiplines(t,"")&&(r=await super.resourcesByUrlAndMime(t,...e)),r)}}const pt=4294967295,mt=65535;class wt{constructor(t,e=null){this.loader=t,this.entries=e}async load(t=!1){if(!this.entries||t){const t=await this.loader.getLength(),e=mt+23,r=t-e,i=await this.loader.getRange(r,e);this.entries=this._loadEntries(i,r)}return this.entries}_loadEntries(t,e){const r=t.byteLength,i=new DataView(t.buffer),n=new TextDecoder("utf8"),s=new TextDecoder("ascii"),a={};let o=0,u=0,h=r;for(let e=r-22,n=Math.max(0,e-mt);e>=n;--e)if(80===t[e]&&75===t[e+1]&&5===t[e+2]&&6===t[e+3]){h=e,u=i.getUint32(e+16,!0),o=i.getUint16(e+8,!0);break}if(u===pt||o===mt){if(117853008!==i.getUint32(h-20,!0))return void console.warn("invalid zip64 EOCD locator");const t=this.getUint64(i,h-12,!0)-e;if(101075792!==i.getUint32(t,!0))return void console.warn("invalid zip64 EOCD record");o=this.getUint64(i,t+32,!0),u=this.getUint64(i,t+48,!0)}if(e&&(u-=e),u>=r||u<=0)for(u=-1,o=mt;++u=0&&u=8&&(o=this.getUint64(i,t,!0),t+=8,n-=8),r===pt&&n>=8&&(r=this.getUint64(i,t,!0),t+=8,n-=8),f===pt&&n>=8&&(f=this.getUint64(i,t,!0),t+=8,n-=8)),t+=n}}p.endsWith("/")||(a[p]={filename:p,deflate:d,uncompressedSize:o,compressedSize:r,localEntryOffset:f}),u+=46+h+c+l}return a}async loadWARC(t,e,r){if(null===this.entries&&await this.load(),this.entries["archive/"+t])t="archive/"+t;else if(this.entries["warcs/"+t])t="warcs/"+t;else for(const e of Object.keys(this.entries))if(e.endsWith("/"+t)){t=e;break}return await this.loadFile(t,{offset:e,length:r,unzip:!0})}getCompressedSize(t){if(null===this.entries)return-1;const e=this.entries[t];return e?e.compressedSize:-1}async loadFile(t,{offset:e=0,length:r=-1,signal:i=null,unzip:n=!1}={}){null===this.entries&&await this.load();const s=this.entries[t];if(!s)return null;if(void 0===s.offset){const t=await this.loader.getRange(s.localEntryOffset,30),e=new DataView(t.buffer),r=e.getUint16(26,!0),i=e.getUint16(28,!0);s.offset=30+r+i+s.localEntryOffset}r=r<0?s.compressedSize:Math.min(r,s.compressedSize-e),e+=s.offset;const a=await this.loader.getRange(e,r,!0,i);return n?s.deflate?new M.a(new M.a(a.getReader(),"deflate")):new M.a(a.getReader()):new M.a(a.getReader(),s.deflate?"deflate":null)}getUint64(t,e,r){const i=t.getUint32(e,r),n=t.getUint32(e+4,r),s=r?i+2**32*n:2**32*i+n;return Number.isSafeInteger(s)||console.warn(s,"exceeds MAX_SAFE_INTEGER. Precision may be lost"),s}}class gt{constructor(t){this.har=t,this.pageRefs={}}load(t){return this.db=t,"string"==typeof this.har&&(this.har=JSON.parse(this.har)),this.parseEntries(this.har),this.parsePages(this.har),Promise.resolve(!0)}parsePages(t){for(const e of t.log.pages){if(!e.pageTimings||!e.pageTimings.onLoad)continue;let t;t=e.title&&(e.title.startsWith("http:")||e.title.startsWith("https:"))?e.title:this.pageRefs[e.id];const r=e.title||t,i=e.startedDateTime;this.db.addPage({url:t,date:i,title:r})}}parseEntries(t){for(const e of t.log.entries){if(!e.response.content||!e.response.content.text)continue;let t=null;try{t=Uint8Array.from(atob(e.response.content.text),t=>t.charCodeAt(0))}catch(r){t=e.response.content.text}const r=new Date(e.startedDateTime).getTime();this.db.addResource({url:e.request.url,ts:r,status:e.response.status,respHeaders:e.response.headers,reqHeaders:e.request.headers,payload:t}),e.pageref&&!this.pageRefs[e.pageref]&&(this.pageRefs[e.pageref]=e.request.url)}}}var yt=r(87);r.d(e,"CollectionLoader",(function(){return _t})),r.d(e,"WorkerLoader",(function(){return vt}));const bt=25e6;self.interruptLoads={};class _t{constructor(){this.colldb=null,this._init_db=this._initDB()}async _initDB(){this.colldb=await g("collDB",1,{upgrade:(t,e,r,i)=>{t.createObjectStore("colls",{keyPath:"name"})}})}async loadAll(t){if(await this._init_db,t)for(const e of t.split(",")){const t=e.split(":");if(2===t.length){const e={dbname:t[1],sourceName:t[1],decode:!1},r={name:t[0],type:"archive",config:e};console.log("Adding Coll: "+JSON.stringify(r)),await this.colldb.put("colls",r)}}try{const t=(await this.listAll()).map(t=>this._initColl(t));await Promise.all(t)}catch(t){console.warn(t.toString())}return!0}async listAll(){return await this._init_db,await this.colldb.getAll("colls")}async loadColl(t){await this._init_db;const e=await this.colldb.get("colls",t);return e?await this._initColl(e):null}async deleteColl(t){await this._init_db;const e=await this.colldb.get("colls",t);if(!e)return!1;e.config.dbname&&await y(e.config.dbname,{blocked(t){console.log(`Unable to delete ${e.config.dbname}: ${t}`)}}),await this.colldb.delete("colls",t)}async updateAuth(t,e){await this._init_db;const r=await this.colldb.get("colls",t);return!!r&&(r.config.headers=e,await this.colldb.put("colls",r),!0)}async updateSize(t,e,r){await this._init_db;const i=await this.colldb.get("colls",t);if(!i)return!1;i.config.loadSize=(i.config.loadSize||0)+e,i.config.dedupSize=(i.config.dedupSize||0)+r,await this.colldb.put("colls",i)}async _initColl(t){let e=null;switch(t.type){case"archive":e=new L(t.config.dbname);break;case"remotewarc":if(t.config.singleFile){const r=J(t.config.loadUrl||t.config.sourceUrl,t.config.headers,t.config.size,t.config.extra);e=new et(t.config.dbname,r,t.config.noCache)}else e=new rt(t.config.dbname,t.config.remotePrefix,t.config.headers,t.config.noCache);break;case"remotesource":{const r=J(t.config.loadUrl,t.config.headers,t.config.size,t.config.extra);e=new et(t.config.dbname,r,t.config.noCache);break}case"remoteprefix":e=new rt(t.config.dbname,t.config.remotePrefix,t.config.headers,t.config.noCache);break;case"remotezip":const r=J(t.config.loadUrl||t.config.sourceUrl,t.config.headers,t.config.extra);e=new ft(t.config.dbname,r,t.config.extraConfig,t.config.noCache,t.config);break;case"remoteproxy":e=new ut(t.config);break;case"live":e=new ht(t.config.prefix,t.config.proxyPathOnly,t.config.isLive)}if(!e)return console.log("no store found: "+t.type),null;e.initing&&await e.initing;const r=t.name,i=t.config;return this._createCollection({name:r,store:e,config:i})}_createCollection(t){return t}}class vt extends _t{constructor(t){super(),this.registerListener(t)}async hasCollection(t){return await this._init_db,null!=await this.colldb.getKey("colls",t)}registerListener(t){t.addEventListener("message",t=>this._handleMessage(t))}async _handleMessage(t){await this._init_db;const e=t.source||self;switch(t.data.msg_type){case"addColl":{const r=t.data.name,i=(t,i,n,s)=>{e.postMessage({msg_type:"collProgress",name:r,percent:t,error:i,currentSize:n,totalSize:s})};let n;try{if(await this.hasCollection(r)?t.data.skipExisting?n=!0:(await this.deleteCollection(r),n=await this.addCollection(t.data,i)):n=await this.addCollection(t.data,i),!n)return}catch(t){return console.warn(t),void i(0,"An unexpected error occured: "+t.toString())}e.postMessage({msg_type:"collAdded",name:r});break}case"cancelLoad":{const e=t.data.name,r=new Promise(t=>self.interruptLoads[e]=t);await r,await this.deleteCollection(e),delete self.interruptLoads[e];break}case"removeColl":{const r=t.data.name;await this.hasCollection(r)&&(await this.deleteCollection(r),this.doListAll(e));break}case"listAll":this.doListAll(e)}}async doListAll(t){const e=[],r=await this.listAll();for(const t of r)e.push({name:t.name,prefix:t.name,pageList:[],sourceName:t.config.sourceName});t.postMessage({msg_type:"listAll",colls:e})}async addCollection(t,e){const r=t.name;let i=null,n={root:!1},s=null;if(t.file){const a=t.file;let o=null;if(a.sourceUrl){i="archive",n.dbname="db:"+r;let u=a.loadUrl||a.sourceUrl;u.match(/[\w]+:\/\//)||(u=new URL(u,self.location.href).href),n.decode=!0,n.onDemand=!1,n.loadUrl=u,n.sourceUrl=a.sourceUrl,n.sourceName=a.name||a.sourceUrl,n.sourceName=n.sourceName.slice(n.sourceName.lastIndexOf("/")+1),n.headers=a.headers,n.size="number"==typeof a.size?a.size:null,n.extra=a.extra,n.extraConfig=t.extraConfig,n.noCache=u.startsWith("file:")||a.noCache;const h=J(u,a.headers,a.size,n.extra,a.blob);let c=!1;(n.sourceName.endsWith(".wacz")||n.sourceName.endsWith(".zip"))&&(i="remotezip",o=s=new ft(n.dbname,h,n.extraConfig,n.noCache,n),c=!0);let{abort:l,response:d,stream:f}=await h.doInitialFetch(c);if(f=f||d.body,!h.isValid){const t=h.length<=1e3?await d.text():"";return e(0,`Sorry, this URL could not be loaded.\nMake sure this is a valid URL and you have access to this file.\nStatus: ${d.status} ${d.statusText}\nError Details:\n${t}`),l&&l.abort(),!1}if(!h.length)return e(0,"Sorry, this URL could not be loaded because the size of the file is not accessible.\nMake sure this is a valid URL and you have access to this file."),l&&l.abort(),!1;const p=h.length;if(n.sourceName.endsWith(".warc")||n.sourceName.endsWith(".warc.gz")?p0?("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===h.prototype||(e=function(t){return h.from(t)}(e)),i?a.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):v(t,a,e,!0):a.ended?t.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?v(t,a,e,!1):C(t,a)):v(t,a,e,!1))):i||(a.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=E?t=E:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function A(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?n.nextTick(S,t):S(t))}function S(t){f("emit readable"),t.emit("readable"),R(t)}function C(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(T,t,e))}function T(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var i;ts.length?s.length:t;if(a===s.length?n+=s:n+=s.slice(0,t),0===(t-=a)){a===s.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=s.slice(a));break}++i}return e.length-=i,n}(t,e):function(t,e){var r=h.allocUnsafe(t),i=e.head,n=1;i.data.copy(r),t-=i.data.length;for(;i=i.next;){var s=i.data,a=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,a),0===(t-=a)){a===s.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=s.slice(a));break}++n}return e.length-=n,r}(t,e);return i}(t,e.buffer,e.decoder),r);var r}function I(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,n.nextTick(N,e,t))}function N(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function F(t,e){for(var r=0,i=t.length;r=e.highWaterMark||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?I(this):A(this),null;if(0===(t=x(t,e))&&e.ended)return 0===e.length&&I(this),null;var i,n=e.needReadable;return f("need readable",n),(0===e.length||e.length-t0?O(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&I(this)),null!==i&&this.emit("data",i),i},b.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(t,e){var r=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=t;break;case 1:s.pipes=[s.pipes,t];break;default:s.pipes.push(t)}s.pipesCount+=1,f("pipe count=%d opts=%j",s.pipesCount,e);var u=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?c:b;function h(e,i){f("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,f("cleanup"),t.removeListener("close",g),t.removeListener("finish",y),t.removeListener("drain",l),t.removeListener("error",w),t.removeListener("unpipe",h),r.removeListener("end",c),r.removeListener("end",b),r.removeListener("data",m),d=!0,!s.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function c(){f("onend"),t.end()}s.endEmitted?n.nextTick(u):r.once("end",u),t.on("unpipe",h);var l=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,R(t))}}(r);t.on("drain",l);var d=!1;var p=!1;function m(e){f("ondata"),p=!1,!1!==t.write(e)||p||((1===s.pipesCount&&s.pipes===t||s.pipesCount>1&&-1!==F(s.pipes,t))&&!d&&(f("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function w(e){f("onerror",e),b(),t.removeListener("error",w),0===o(t,"error")&&t.emit("error",e)}function g(){t.removeListener("finish",y),b()}function y(){f("onfinish"),t.removeListener("close",g),b()}function b(){f("unpipe"),r.unpipe(t)}return r.on("data",m),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?a(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",w),t.once("close",g),t.once("finish",y),t.emit("pipe",r),s.flowing||(f("pipe resume"),r.resume()),t},b.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0?i-4:i,l=0;l>16&255,o[u++]=e>>8&255,o[u++]=255&e;2===a&&(e=n[t.charCodeAt(l)]<<2|n[t.charCodeAt(l+1)]>>4,o[u++]=255&e);1===a&&(e=n[t.charCodeAt(l)]<<10|n[t.charCodeAt(l+1)]<<4|n[t.charCodeAt(l+2)]>>2,o[u++]=e>>8&255,o[u++]=255&e);return o},e.fromByteArray=function(t){for(var e,r=t.length,n=r%3,s=[],a=0,o=r-n;ao?o:a+16383));1===n?(e=t[r-1],s.push(i[e>>2]+i[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],s.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"="));return s.join("")};for(var i=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,u=a.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var n,s,a=[],o=e;o>18&63]+i[s>>12&63]+i[s>>6&63]+i[63&s]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(t,e,r){"use strict";var i=r(26);function n(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var r=this,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return s||a?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||i.nextTick(n,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(i.nextTick(n,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,r){(function(t){var i=void 0!==t&&t||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function s(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new s(n.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new s(n.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(95),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(6))},function(t,e,r){"use strict";var i=r(27).Buffer,n=i.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(i.isEncoding===n||!n(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=h,e=4;break;case"utf8":this.fillLast=o,e=4;break;case"base64":this.text=c,this.end=l,e=3;break;default:return this.write=d,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function o(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function h(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function c(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function d(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.StringDecoder=s,s.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return n>0&&(t.lastNeed=n-1),n;if(--i=0)return n>0&&(t.lastNeed=n-2),n;if(--i=0)return n>0&&(2===n?n=0:t.lastNeed=n-3),n;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},s.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,r){"use strict";t.exports=a;var i=r(10),n=r(18);function s(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length(Object.keys(e).forEach(r=>{t[r]=e[r]}),t),Object.create(null))}},function(t,e,r){var i=r(63).BrotliInput,n=r(63).BrotliOutput,s=r(112),a=r(64),o=r(65).HuffmanCode,u=r(65).BrotliBuildHuffmanTable,h=r(115),c=r(116),l=r(117),d=8,f=16,p=256,m=704,w=26,g=6,y=2,b=8,_=255,v=1080,E=18,x=new Uint8Array([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),A=16,S=new Uint8Array([3,2,1,0,3,3,3,3,3,3,2,2,2,2,2,2]),C=new Int8Array([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),T=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 k(t){var e;return 0===t.readBits(1)?16:(e=t.readBits(3))>0?17+e:(e=t.readBits(3))>0?8+e:17}function D(t){if(t.readBits(1)){var e=t.readBits(3);return 0===e?1:t.readBits(e)+(1<1&&0===s)throw new Error("Invalid size byte");n.meta_block_length|=s<<8*i}}else for(i=0;i4&&0===a)throw new Error("Invalid size nibble");n.meta_block_length|=a<<4*i}return++n.meta_block_length,n.input_end||n.is_metadata||(n.is_uncompressed=t.readBits(1)),n}function I(t,e,r){var i;return r.fillBitWindow(),(i=t[e+=r.val_>>>r.bit_pos_&_].bits-b)>0&&(r.bit_pos_+=b,e+=t[e].value,e+=r.val_>>>r.bit_pos_&(1<>=1,++c;for(m=0;m0;++m){var v,A=x[m],S=0;i.fillBitWindow(),S+=i.val_>>>i.bit_pos_&15,i.bit_pos_+=_[S].bits,v=_[S].value,w[A]=v,0!==v&&(g-=32>>v,++y)}if(1!==y&&0!==g)throw new Error("[ReadHuffmanCode] invalid num_codes or space");!function(t,e,r,i){for(var n=0,s=d,a=0,h=0,c=32768,l=[],p=0;p<32;p++)l.push(new o(0,0));for(u(l,0,5,t,E);n0;){var m,w=0;if(i.readMoreInput(),i.fillBitWindow(),w+=i.val_>>>i.bit_pos_&31,i.bit_pos_+=l[w].bits,(m=255&l[w].value)>m);else{var g,y,b=m-14,_=0;if(m===f&&(_=s),h!==_&&(a=0,h=_),g=a,a>0&&(a-=2,a<<=b),n+(y=(a+=i.readBits(b)+3)-g)>e)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(var v=0;v>>5]),this.htrees=new Uint32Array(e)}function U(t,e){var r,i,n={num_htrees:null,context_map:null},s=0;e.readMoreInput();var a=n.num_htrees=D(e)+1,u=n.context_map=new Uint8Array(t);if(a<=1)return n;for(e.readBits(1)&&(s=e.readBits(4)+1),r=[],i=0;i=t)throw new Error("[DecodeContextMap] i >= context_map_size");u[i]=0,++i}else u[i]=h-s,++i}return e.readBits(1)&&function(t,e){var r,i=new Uint8Array(256);for(r=0;r<256;++r)i[r]=r;for(r=0;r=t&&(o-=t),i[r]=o,n[u+(1&s[h])]=o,++s[h]}function W(t,e,r,i,n,a){var o,u=n+1,h=r&n,c=a.pos_&s.IBUF_MASK;if(e<8||a.bit_pos_+(e<<3)0;)a.readMoreInput(),i[h++]=a.readBits(8),h===u&&(t.write(i,u),h=0);else{if(a.bit_end_pos_<32)throw new Error("[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32");for(;a.bit_pos_<32;)i[h]=a.val_>>>a.bit_pos_,a.bit_pos_+=8,++h,--e;if(c+(o=a.bit_end_pos_-a.bit_pos_>>3)>s.IBUF_MASK){for(var l=s.IBUF_MASK+1-c,d=0;d=u){t.write(i,u),h-=u;for(d=0;d=u;){if(o=u-h,a.input_.read(i,h,o)e.buffer.length){var yt=new Uint8Array(S+nt);yt.set(e.buffer),e.buffer=yt}if(C=gt.input_end,K=gt.is_uncompressed,gt.is_metadata)for(j(x);nt>0;--nt)x.readMoreInput(),x.readBits(8);else if(0!==nt)if(K)x.bit_pos_=x.bit_pos_+7&-8,W(e,nt,S,f,d,x),S+=nt;else{for(r=0;r<3;++r)ot[r]=D(x)+1,ot[r]>=2&&(N(ot[r]+2,_,r*v,x),N(w,E,r*v,x),st[r]=F(E,r*v,x),ht[r]=1);for(x.readMoreInput(),J=(1<<(V=x.readBits(2)))-1,Z=(Y=A+(x.readBits(4)<0;){var vt,Et,xt,At,St,Ct,Tt,kt,Dt,Rt,Ot,It;for(x.readMoreInput(),0===st[1]&&(M(ot[1],_,1,at,ut,ht,x),st[1]=F(E,v,x),it=G[1].htrees[at[1]]),--st[1],(Et=(vt=I(G[1].codes,it,x))>>6)>=2?(Et-=2,Tt=-1):Tt=0,xt=c.kInsertRangeLut[Et]+(vt>>3&7),At=c.kCopyRangeLut[Et]+(7&vt),St=c.kInsertLengthPrefixCode[xt].offset+x.readBits(c.kInsertLengthPrefixCode[xt].nbits),Ct=c.kCopyLengthPrefixCode[At].offset+x.readBits(c.kCopyLengthPrefixCode[At].nbits),z=f[S-1&d],H=f[S-2&d],Dt=0;Dt4?3:Ct-2))],(Tt=I(G[2].codes,G[2].htrees[pt],x))>=Y)It=(Tt-=Y)&J,Tt=Y+((Nt=(2+(1&(Tt>>=V))<<(Ot=1+(Tt>>1)))-4)+x.readBits(Ot)<(T=S=a.minDictionaryWordLength&&Ct<=a.maxDictionaryWordLength))throw new Error("Invalid backward reference. pos: "+S+" distance: "+kt+" len: "+Ct+" bytes left: "+nt);var Nt=a.offsetsByLength[Ct],Ft=kt-T-1,Bt=a.sizeBitsByLength[Ct],Pt=Ft>>Bt;if(Nt+=(Ft&(1<=b){e.write(f,u);for(var Ut=0;Ut0&&(R[3&P]=kt,++P),Ct>nt)throw new Error("Invalid backward reference. pos: "+S+" distance: "+kt+" len: "+Ct+" bytes left: "+nt);for(Dt=0;Dtthis.buffer.length&&(r=this.buffer.length-this.pos);for(var i=0;ithis.buffer.length)throw new Error("Output buffer is not large enough");return this.buffer.set(t.subarray(0,e),this.pos),this.pos+=e,e},e.BrotliOutput=i},function(t,e,r){var i=r(113);e.init=function(){e.dictionary=i.init()},e.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]),e.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]),e.minDictionaryWordLength=4,e.maxDictionaryWordLength=24},function(t,e){function r(t,e){this.bits=t,this.value=e}e.HuffmanCode=r;var i=15;function n(t,e){for(var r=1<>=1;return(t&r-1)+r}function s(t,e,i,n,s){do{t[e+(n-=i)]=new r(s.bits,s.value)}while(n>0)}function a(t,e,r){for(var n=1<0;--v[c])s(t,e+d,f,g,new r(255&c,65535&b[l++])),d=n(d,c);for(m=y-1,p=-1,c=o+1,f=2;c<=i;++c,f<<=1)for(;v[c]>0;--v[c])(d&m)!==p&&(e+=g,y+=g=1<<(w=a(v,c,o)),t[_+(p=d&m)]=new r(w+o&255,e-_-p&65535)),s(t,e+(d>>o),f,g,new r(c-o&255,65535&b[l++])),d=n(d,c);return y}},function(t,e,r){"use strict";t.exports=function(t,e,r,i){for(var n=65535&t|0,s=t>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{s=s+(n=n+e[i++]|0)|0}while(--a);n%=65521,s%=65521}return n|s<<16|0}},function(t,e,r){"use strict";var i=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();t.exports=function(t,e,r,n){var s=i,a=n+r;t^=-1;for(var o=n;o>>8^s[255&(t^e[o])];return-1^t}},function(t,e,r){"use strict";var i=r(8),n=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(t){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){s=!1}for(var a=new i.Buf8(256),o=0;o<256;o++)a[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;function u(t,e){if(e<65534&&(t.subarray&&s||!t.subarray&&n))return String.fromCharCode.apply(null,i.shrinkBuf(t,e));for(var r="",a=0;a>>6,e[a++]=128|63&r):r<65536?(e[a++]=224|r>>>12,e[a++]=128|r>>>6&63,e[a++]=128|63&r):(e[a++]=240|r>>>18,e[a++]=128|r>>>12&63,e[a++]=128|r>>>6&63,e[a++]=128|63&r);return e},e.buf2binstring=function(t){return u(t,t.length)},e.binstring2buf=function(t){for(var e=new i.Buf8(t.length),r=0,n=e.length;r4)h[i++]=65533,r+=s-1;else{for(n&=2===s?31:3===s?15:7;s>1&&r1?h[i++]=65533:n<65536?h[i++]=n:(n-=65536,h[i++]=55296|n>>10&1023,h[i++]=56320|1023&n)}return u(h,i)},e.utf8border=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;r>=0&&128==(192&t[r]);)r--;return r<0?e:0===r?e:r+a[t[r]]>e?r:e}},function(t,e,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(t,e,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(t,e,r){"use strict";t.exports=function(t,e,r,i){for(var n=65535&t|0,s=t>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{s=s+(n=n+e[i++]|0)|0}while(--a);n%=65521,s%=65521}return n|s<<16|0}},function(t,e,r){"use strict";var i=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();t.exports=function(t,e,r,n){var s=i,a=n+r;t^=-1;for(var o=n;o>>8^s[255&(t^e[o])];return-1^t}},function(t,e,r){"use strict";var i=r(11),n=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(t){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){s=!1}for(var a=new i.Buf8(256),o=0;o<256;o++)a[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;function u(t,e){if(e<65534&&(t.subarray&&s||!t.subarray&&n))return String.fromCharCode.apply(null,i.shrinkBuf(t,e));for(var r="",a=0;a>>6,e[a++]=128|63&r):r<65536?(e[a++]=224|r>>>12,e[a++]=128|r>>>6&63,e[a++]=128|63&r):(e[a++]=240|r>>>18,e[a++]=128|r>>>12&63,e[a++]=128|r>>>6&63,e[a++]=128|63&r);return e},e.buf2binstring=function(t){return u(t,t.length)},e.binstring2buf=function(t){for(var e=new i.Buf8(t.length),r=0,n=e.length;r4)h[i++]=65533,r+=s-1;else{for(n&=2===s?31:3===s?15:7;s>1&&r1?h[i++]=65533:n<65536?h[i++]=n:(n-=65536,h[i++]=55296|n>>10&1023,h[i++]=56320|1023&n)}return u(h,i)},e.utf8border=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;r>=0&&128==(192&t[r]);)r--;return r<0?e:0===r?e:r+a[t[r]]>e?r:e}},function(t,e,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(t,e,r){"use strict";var i=r(15);t.exports=new i({include:[r(76)]})},function(t,e,r){"use strict";var i=r(15);t.exports=new i({include:[r(43)],implicit:[r(148),r(149),r(150),r(151)]})},function(t,e,r){"use strict";e.Commented=r(168),e.Diagnose=r(177),e.Decoder=r(31),e.Encoder=r(78),e.Simple=r(23),e.Tagged=r(47),e.Map=r(178),e.comment=e.Commented.comment,e.decodeAll=e.Decoder.decodeAll,e.decodeFirst=e.Decoder.decodeFirst,e.decodeAllSync=e.Decoder.decodeAllSync,e.decodeFirstSync=e.Decoder.decodeFirstSync,e.diagnose=e.Diagnose.diagnose,e.encode=e.Encoder.encode,e.encodeCanonical=e.Encoder.encodeCanonical,e.encodeOne=e.Encoder.encodeOne,e.encodeAsync=e.Encoder.encodeAsync,e.decode=e.Decoder.decodeFirstSync,e.leveldb={decode:e.Decoder.decodeAllSync,encode:e.Encoder.encode,buffer:!0,name:"cbor"},e.hasBigInt=r(16).hasBigInt},function(t,e,r){"use strict";(function(e){const i=r(4),n=r(48),s=r(17).BigNumber,a=r(24),o=(r(47),r(23),r(16)),u=r(12),h=u.MT,c=u.NUMBYTES,l=u.SHIFT32,d=u.SYMS,f=u.TAG,p=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.TWO,m=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.FOUR,w=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.EIGHT,g=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.TRUE,y=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.FALSE,b=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.UNDEFINED,_=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.NULL,v=new s("0x20000000000000"),E=e.from("f97e00","hex"),x=e.from("f9fc00","hex"),A=e.from("f97c00","hex"),S=e.from("f98000","hex"),C=Symbol("CBOR_LOOP_DETECT");class T extends i.Transform{constructor(t){const r=Object.assign({},t,{readableObjectMode:!1,writableObjectMode:!0});super(r),this.canonical=r.canonical,this.encodeUndefined=r.encodeUndefined,this.disallowUndefinedKeys=!!r.disallowUndefinedKeys,this.dateType=null!=r.dateType?r.dateType.toLowerCase():"number","symbol"==typeof r.detectLoops?this.detectLoops=r.detectLoops:this.detectLoops=r.detectLoops?Symbol("CBOR_DETECT"):null,this.semanticTypes=[Array,this._pushArray,Date,this._pushDate,e,this._pushBuffer,Map,this._pushMap,a,this._pushNoFilter,RegExp,this._pushRegexp,Set,this._pushSet,s,this._pushBigNumber,ArrayBuffer,this._pushUint8Array,Uint8ClampedArray,this._pushUint8Array,Uint8Array,this._pushUint8Array,Uint16Array,this._pushArray,Uint32Array,this._pushArray,Int8Array,this._pushArray,Int16Array,this._pushArray,Int32Array,this._pushArray,Float32Array,this._pushFloat32Array,Float64Array,this._pushFloat64Array],n.Url&&this.semanticTypes.push(n.Url,this._pushUrl),n.URL&&this.semanticTypes.push(n.URL,this._pushURL);const i=r.genTypes||[];for(let t=0,e=i.length;t{i.pushAny(t);const r=n.read();i.pushAny(e);const s=n.read();return r.compare(s)});for(const[e,i]of r){if(t.disallowUndefinedKeys&&void 0===e)throw new Error("Invalid Map key: undefined");if(!t.pushAny(e)||!t.pushAny(i))return!1}}else for(const[r,i]of e){if(t.disallowUndefinedKeys&&void 0===r)throw new Error("Invalid Map key: undefined");if(!t.pushAny(r)||!t.pushAny(i))return!1}return!0}_pushUint8Array(t,r){return t._pushBuffer(t,e.from(r))}_pushFloat32Array(t,e){const r=e.length;if(!t._pushInt(r,h.ARRAY))return!1;for(let i=0;i{const r=i[t]||(i[t]=T.encode(t)),n=i[e]||(i[e]=T.encode(e));return r.compare(n)}),!this._pushInt(r.length,h.MAP))return!1;let n;for(let e=0,s=r.length;e{const s=[],a=new T(r);a.on("data",t=>s.push(t)),a.on("error",n),a.on("finish",()=>i(e.concat(s))),a.pushAny(t),a.end()})}}t.exports=T}).call(this,r(3).Buffer)},function(t,e,r){"use strict";const i=r(49),{escapeString:n}=r(109);t.exports=class extends i{constructor(){super({sourceCodeLocationInfo:!0}),this.posTracker=this.locInfoMixin.posTracker}_transformChunk(t){super._transformChunk(t)}_getRawHtml(t){const e=this.posTracker.droppedBufferSize,r=t.startOffset-e,i=t.endOffset-e;return this.tokenizer.preprocessor.html.slice(r,i)}_handleToken(t){super._handleToken(t)||this.emitRaw(this._getRawHtml(t.location)),this.parserFeedbackSimulator.skipNextNewLine=!1}_emitToken(t,e){this.emit(t,e,this._getRawHtml(e.sourceCodeLocation))}emitDoctype(t){let e=`",this.push(e)}emitStartTag(t){let e=`<${t.tagName}`;const r=t.attrs;for(let t=0;t":">",this.push(e)}emitEndTag(t){this.push(``)}emitText({text:t}){this.push(n(t,!1))}emitComment(t){this.push(`\x3c!--${t.text}--\x3e`)}emitRaw(t){this.push(t)}}},function(t,e,r){t.exports=r(62).BrotliDecompressBuffer},function(t,e,r){"use strict";var i=r(126),n=r(11),s=r(73),a=r(129),o=r(42),u=r(74),h=r(130),c=Object.prototype.toString;function l(t){if(!(this instanceof l))return new l(t);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var r=i.inflateInit2(this.strm,e.windowBits);if(r!==a.Z_OK)throw new Error(o[r]);if(this.header=new h,i.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=s.string2buf(e.dictionary):"[object ArrayBuffer]"===c.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=i.inflateSetDictionary(this.strm,e.dictionary))!==a.Z_OK))throw new Error(o[r])}function d(t,e){var r=new l(e);if(r.push(t,!0),r.err)throw r.msg||o[r.err];return r.result}l.prototype.push=function(t,e){var r,o,u,h,l,d=this.strm,f=this.options.chunkSize,p=this.options.dictionary,m=!1;if(this.ended)return!1;o=e===~~e?e:!0===e?a.Z_FINISH:a.Z_NO_FLUSH,"string"==typeof t?d.input=s.binstring2buf(t):"[object ArrayBuffer]"===c.call(t)?d.input=new Uint8Array(t):d.input=t,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new n.Buf8(f),d.next_out=0,d.avail_out=f),(r=i.inflate(d,a.Z_NO_FLUSH))===a.Z_NEED_DICT&&p&&(r=i.inflateSetDictionary(this.strm,p)),r===a.Z_BUF_ERROR&&!0===m&&(r=a.Z_OK,m=!1),r!==a.Z_STREAM_END&&r!==a.Z_OK)return this.onEnd(r),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&r!==a.Z_STREAM_END&&(0!==d.avail_in||o!==a.Z_FINISH&&o!==a.Z_SYNC_FLUSH)||("string"===this.options.to?(u=s.utf8border(d.output,d.next_out),h=d.next_out-u,l=s.buf2string(d.output,u),d.next_out=h,d.avail_out=f-h,h&&n.arraySet(d.output,d.output,u,h,0),this.onData(l)):this.onData(n.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(m=!0)}while((d.avail_in>0||0===d.avail_out)&&r!==a.Z_STREAM_END);return r===a.Z_STREAM_END&&(o=a.Z_FINISH),o===a.Z_FINISH?(r=i.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===a.Z_OK):o!==a.Z_SYNC_FLUSH||(this.onEnd(a.Z_OK),d.avail_out=0,!0)},l.prototype.onData=function(t){this.chunks.push(t)},l.prototype.onEnd=function(t){t===a.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=l,e.inflate=d,e.inflateRaw=function(t,e){return(e=e||{}).raw=!0,d(t,e)},e.ungzip=d},function(t,e,r){"use strict";!function(){var e,i,n,s=0,a=[];for(i=0;i<256;i++)a[i]=(i+256).toString(16).substr(1);function o(){var t,r=(t=16,(!e||s+t>u.BUFFER_SIZE)&&(s=0,e=u.randomBytes(u.BUFFER_SIZE)),e.slice(s,s+=t));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,r}function u(){var t=o();return a[t[0]]+a[t[1]]+a[t[2]]+a[t[3]]+"-"+a[t[4]]+a[t[5]]+"-"+a[t[6]]+a[t[7]]+"-"+a[t[8]]+a[t[9]]+"-"+a[t[10]]+a[t[11]]+a[t[12]]+a[t[13]]+a[t[14]]+a[t[15]]}u.BUFFER_SIZE=4096,u.bin=o,u.clearBuffer=function(){e=null,s=0},u.test=function(t){return"string"==typeof t&&/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(t)},"undefined"!=typeof crypto?n=crypto:"undefined"!=typeof window&&void 0!==window.msCrypto&&(n=window.msCrypto),n=n||r(131),t.exports=u,u.randomBytes=function(){if(n){if(n.randomBytes)return n.randomBytes;if(n.getRandomValues)return function(t){var e=new Uint8Array(t);return n.getRandomValues(e),e}}return function(t){var e,r=[];for(e=0;e