n3 2.2.6 → 2.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
- var bl=Object.create;var Or=Object.defineProperty;var gl=Object.getOwnPropertyDescriptor;var yl=Object.getOwnPropertyNames;var wl=Object.getPrototypeOf,ml=Object.prototype.hasOwnProperty;var S=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},xl=(t,e)=>{for(var r in e)Or(t,r,{get:e[r],enumerable:!0})},El=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of yl(e))!ml.call(t,n)&&n!==r&&Or(t,n,{get:()=>e[n],enumerable:!(i=gl(e,n))||i.enumerable});return t};var zt=(t,e,r)=>(r=t!=null?bl(wl(t)):{},El(e||!t||!t.__esModule?Or(r,"default",{value:t,enumerable:!0}):r,t));var yn=S(Kt=>{"use strict";Kt.byteLength=Il;Kt.toByteArray=Tl;Kt.fromByteArray=vl;var Y=[],V=[],Sl=typeof Uint8Array<"u"?Uint8Array:Array,Mr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Le=0,bn=Mr.length;Le<bn;++Le)Y[Le]=Mr[Le],V[Mr.charCodeAt(Le)]=Le;var Le,bn;V[45]=62;V[95]=63;function gn(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function Il(t){var e=gn(t),r=e[0],i=e[1];return(r+i)*3/4-i}function Rl(t,e,r){return(e+r)*3/4-r}function Tl(t){var e,r=gn(t),i=r[0],n=r[1],s=new Sl(Rl(t,i,n)),o=0,a=n>0?i-4:i,l;for(l=0;l<a;l+=4)e=V[t.charCodeAt(l)]<<18|V[t.charCodeAt(l+1)]<<12|V[t.charCodeAt(l+2)]<<6|V[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return n===2&&(e=V[t.charCodeAt(l)]<<2|V[t.charCodeAt(l+1)]>>4,s[o++]=e&255),n===1&&(e=V[t.charCodeAt(l)]<<10|V[t.charCodeAt(l+1)]<<4|V[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function Al(t){return Y[t>>18&63]+Y[t>>12&63]+Y[t>>6&63]+Y[t&63]}function Nl(t,e,r){for(var i,n=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),n.push(Al(i));return n.join("")}function vl(t){for(var e,r=t.length,i=r%3,n=[],s=16383,o=0,a=r-i;o<a;o+=s)n.push(Nl(t,o,o+s>a?a:o+s));return i===1?(e=t[r-1],n.push(Y[e>>2]+Y[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(Y[e>>10]+Y[e>>4&63]+Y[e<<2&63]+"=")),n.join("")}});var wn=S(Dr=>{Dr.read=function(t,e,r,i,n){var s,o,a=n*8-i-1,l=(1<<a)-1,u=l>>1,f=-7,c=r?n-1:0,_=r?-1:1,h=t[e+c];for(c+=_,s=h&(1<<-f)-1,h>>=-f,f+=a;f>0;s=s*256+t[e+c],c+=_,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=i;f>0;o=o*256+t[e+c],c+=_,f-=8);if(s===0)s=1-u;else{if(s===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-u}return(h?-1:1)*o*Math.pow(2,s-i)};Dr.write=function(t,e,r,i,n,s){var o,a,l,u=s*8-n-1,f=(1<<u)-1,c=f>>1,_=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,b=i?1:-1,p=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+c>=1?e+=_/l:e+=_*Math.pow(2,1-c),e*l>=2&&(o++,l/=2),o+c>=f?(a=0,o=f):o+c>=1?(a=(e*l-1)*Math.pow(2,n),o=o+c):(a=e*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;t[r+h]=a&255,h+=b,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;t[r+h]=o&255,h+=b,o/=256,u-=8);t[r+h-b]|=p*128}});var X=S(tt=>{"use strict";var $r=yn(),Ze=wn(),mn=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;tt.Buffer=d;tt.SlowBuffer=Cl;tt.INSPECT_MAX_BYTES=50;var Yt=2147483647;tt.kMaxLength=Yt;d.TYPED_ARRAY_SUPPORT=jl();!d.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function jl(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}});Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function fe(t){if(t>Yt)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,d.prototype),e}function d(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Wr(t)}return In(t,e,r)}d.poolSize=8192;function In(t,e,r){if(typeof t=="string")return Ll(t,e);if(ArrayBuffer.isView(t))return Bl(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(J(t,ArrayBuffer)||t&&J(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(J(t,SharedArrayBuffer)||t&&J(t.buffer,SharedArrayBuffer)))return qr(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return d.from(i,e,r);let n=Fl(t);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return d.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}d.from=function(t,e,r){return In(t,e,r)};Object.setPrototypeOf(d.prototype,Uint8Array.prototype);Object.setPrototypeOf(d,Uint8Array);function Rn(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function Pl(t,e,r){return Rn(t),t<=0?fe(t):e!==void 0?typeof r=="string"?fe(t).fill(e,r):fe(t).fill(e):fe(t)}d.alloc=function(t,e,r){return Pl(t,e,r)};function Wr(t){return Rn(t),fe(t<0?0:Gr(t)|0)}d.allocUnsafe=function(t){return Wr(t)};d.allocUnsafeSlow=function(t){return Wr(t)};function Ll(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!d.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Tn(t,e)|0,i=fe(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function kr(t){let e=t.length<0?0:Gr(t.length)|0,r=fe(e);for(let i=0;i<e;i+=1)r[i]=t[i]&255;return r}function Bl(t){if(J(t,Uint8Array)){let e=new Uint8Array(t);return qr(e.buffer,e.byteOffset,e.byteLength)}return kr(t)}function qr(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return e===void 0&&r===void 0?i=new Uint8Array(t):r===void 0?i=new Uint8Array(t,e):i=new Uint8Array(t,e,r),Object.setPrototypeOf(i,d.prototype),i}function Fl(t){if(d.isBuffer(t)){let e=Gr(t.length)|0,r=fe(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||Qr(t.length)?fe(0):kr(t);if(t.type==="Buffer"&&Array.isArray(t.data))return kr(t.data)}function Gr(t){if(t>=Yt)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Yt.toString(16)+" bytes");return t|0}function Cl(t){return+t!=t&&(t=0),d.alloc(+t)}d.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==d.prototype};d.compare=function(e,r){if(J(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),J(r,Uint8Array)&&(r=d.from(r,r.offset,r.byteLength)),!d.isBuffer(e)||!d.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let i=e.length,n=r.length;for(let s=0,o=Math.min(i,n);s<o;++s)if(e[s]!==r[s]){i=e[s],n=r[s];break}return i<n?-1:n<i?1:0};d.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};d.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return d.alloc(0);let i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;let n=d.allocUnsafe(r),s=0;for(i=0;i<e.length;++i){let o=e[i];if(J(o,Uint8Array))s+o.length>n.length?(d.isBuffer(o)||(o=d.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(d.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function Tn(t,e){if(d.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||J(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Ur(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Cn(t).length;default:if(n)return i?-1:Ur(t).length;e=(""+e).toLowerCase(),n=!0}}d.byteLength=Tn;function Ol(t,e,r){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Ql(this,e,r);case"utf8":case"utf-8":return Nn(this,e,r);case"ascii":return Gl(this,e,r);case"latin1":case"binary":return Vl(this,e,r);case"base64":return Ul(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Hl(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}d.prototype._isBuffer=!0;function Be(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}d.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)Be(this,r,r+1);return this};d.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)Be(this,r,r+3),Be(this,r+1,r+2);return this};d.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)Be(this,r,r+7),Be(this,r+1,r+6),Be(this,r+2,r+5),Be(this,r+3,r+4);return this};d.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Nn(this,0,e):Ol.apply(this,arguments)};d.prototype.toLocaleString=d.prototype.toString;d.prototype.equals=function(e){if(!d.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:d.compare(this,e)===0};d.prototype.inspect=function(){let e="",r=tt.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};mn&&(d.prototype[mn]=d.prototype.inspect);d.prototype.compare=function(e,r,i,n,s){if(J(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),r<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&r>=i)return 0;if(n>=s)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;let o=s-n,a=i-r,l=Math.min(o,a),u=this.slice(n,s),f=e.slice(r,i);for(let c=0;c<l;++c)if(u[c]!==f[c]){o=u[c],a=f[c];break}return o<a?-1:a<o?1:0};function An(t,e,r,i,n){if(t.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Qr(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)r=0;else return-1;if(typeof e=="string"&&(e=d.from(e,i)),d.isBuffer(e))return e.length===0?-1:xn(t,e,r,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):xn(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function xn(t,e,r,i,n){let s=1,o=t.length,a=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function l(f,c){return s===1?f[c]:f.readUInt16BE(c*s)}let u;if(n){let f=-1;for(u=r;u<o;u++)if(l(t,u)===l(e,f===-1?0:u-f)){if(f===-1&&(f=u),u-f+1===a)return f*s}else f!==-1&&(u-=u-f),f=-1}else for(r+a>o&&(r=o-a),u=r;u>=0;u--){let f=!0;for(let c=0;c<a;c++)if(l(t,u+c)!==l(e,c)){f=!1;break}if(f)return u}return-1}d.prototype.includes=function(e,r,i){return this.indexOf(e,r,i)!==-1};d.prototype.indexOf=function(e,r,i){return An(this,e,r,i,!0)};d.prototype.lastIndexOf=function(e,r,i){return An(this,e,r,i,!1)};function Ml(t,e,r,i){r=Number(r)||0;let n=t.length-r;i?(i=Number(i),i>n&&(i=n)):i=n;let s=e.length;i>s/2&&(i=s/2);let o;for(o=0;o<i;++o){let a=parseInt(e.substr(o*2,2),16);if(Qr(a))return o;t[r+o]=a}return o}function Dl(t,e,r,i){return Jt(Ur(e,t.length-r),t,r,i)}function $l(t,e,r,i){return Jt(Jl(e),t,r,i)}function kl(t,e,r,i){return Jt(Cn(e),t,r,i)}function ql(t,e,r,i){return Jt(Xl(e,t.length-r),t,r,i)}d.prototype.write=function(e,r,i,n){if(r===void 0)n="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")n=r,i=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return Ml(this,e,r,i);case"utf8":case"utf-8":return Dl(this,e,r,i);case"ascii":case"latin1":case"binary":return $l(this,e,r,i);case"base64":return kl(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ql(this,e,r,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ul(t,e,r){return e===0&&r===t.length?$r.fromByteArray(t):$r.fromByteArray(t.slice(e,r))}function Nn(t,e,r){r=Math.min(t.length,r);let i=[],n=e;for(;n<r;){let s=t[n],o=null,a=s>239?4:s>223?3:s>191?2:1;if(n+a<=r){let l,u,f,c;switch(a){case 1:s<128&&(o=s);break;case 2:l=t[n+1],(l&192)===128&&(c=(s&31)<<6|l&63,c>127&&(o=c));break;case 3:l=t[n+1],u=t[n+2],(l&192)===128&&(u&192)===128&&(c=(s&15)<<12|(l&63)<<6|u&63,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:l=t[n+1],u=t[n+2],f=t[n+3],(l&192)===128&&(u&192)===128&&(f&192)===128&&(c=(s&15)<<18|(l&63)<<12|(u&63)<<6|f&63,c>65535&&c<1114112&&(o=c))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=a}return Wl(i)}var En=4096;function Wl(t){let e=t.length;if(e<=En)return String.fromCharCode.apply(String,t);let r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=En));return r}function Gl(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]&127);return i}function Vl(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function Ql(t,e,r){let i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);let n="";for(let s=e;s<r;++s)n+=Zl[t[s]];return n}function Hl(t,e,r){let i=t.slice(e,r),n="";for(let s=0;s<i.length-1;s+=2)n+=String.fromCharCode(i[s]+i[s+1]*256);return n}d.prototype.slice=function(e,r){let i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);let n=this.subarray(e,r);return Object.setPrototypeOf(n,d.prototype),n};function C(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||C(e,r,this.length);let n=this[e],s=1,o=0;for(;++o<r&&(s*=256);)n+=this[e+o]*s;return n};d.prototype.readUintBE=d.prototype.readUIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||C(e,r,this.length);let n=this[e+--r],s=1;for(;r>0&&(s*=256);)n+=this[e+--r]*s;return n};d.prototype.readUint8=d.prototype.readUInt8=function(e,r){return e=e>>>0,r||C(e,1,this.length),this[e]};d.prototype.readUint16LE=d.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||C(e,2,this.length),this[e]|this[e+1]<<8};d.prototype.readUint16BE=d.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||C(e,2,this.length),this[e]<<8|this[e+1]};d.prototype.readUint32LE=d.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};d.prototype.readUint32BE=d.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||C(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};d.prototype.readBigUInt64LE=xe(function(e){e=e>>>0,et(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&xt(e,this.length-8);let n=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(s)<<BigInt(32))});d.prototype.readBigUInt64BE=xe(function(e){e=e>>>0,et(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&xt(e,this.length-8);let n=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(s)});d.prototype.readIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||C(e,r,this.length);let n=this[e],s=1,o=0;for(;++o<r&&(s*=256);)n+=this[e+o]*s;return s*=128,n>=s&&(n-=Math.pow(2,8*r)),n};d.prototype.readIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||C(e,r,this.length);let n=r,s=1,o=this[e+--n];for(;n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};d.prototype.readInt8=function(e,r){return e=e>>>0,r||C(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};d.prototype.readInt16LE=function(e,r){e=e>>>0,r||C(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};d.prototype.readInt16BE=function(e,r){e=e>>>0,r||C(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};d.prototype.readInt32LE=function(e,r){return e=e>>>0,r||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};d.prototype.readInt32BE=function(e,r){return e=e>>>0,r||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};d.prototype.readBigInt64LE=xe(function(e){e=e>>>0,et(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&xt(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});d.prototype.readBigInt64BE=xe(function(e){e=e>>>0,et(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&xt(e,this.length-8);let n=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i)});d.prototype.readFloatLE=function(e,r){return e=e>>>0,r||C(e,4,this.length),Ze.read(this,e,!0,23,4)};d.prototype.readFloatBE=function(e,r){return e=e>>>0,r||C(e,4,this.length),Ze.read(this,e,!1,23,4)};d.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||C(e,8,this.length),Ze.read(this,e,!0,52,8)};d.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||C(e,8,this.length),Ze.read(this,e,!1,52,8)};function q(t,e,r,i,n,s){if(!d.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;q(this,e,r,i,a,0)}let s=1,o=0;for(this[r]=e&255;++o<i&&(s*=256);)this[r+o]=e/s&255;return r+i};d.prototype.writeUintBE=d.prototype.writeUIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;q(this,e,r,i,a,0)}let s=i-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+i};d.prototype.writeUint8=d.prototype.writeUInt8=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,1,255,0),this[r]=e&255,r+1};d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function vn(t,e,r,i,n){Fn(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,r}function jn(t,e,r,i,n){Fn(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}d.prototype.writeBigUInt64LE=xe(function(e,r=0){return vn(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});d.prototype.writeBigUInt64BE=xe(function(e,r=0){return jn(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});d.prototype.writeIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);q(this,e,r,i,l-1,-l)}let s=0,o=1,a=0;for(this[r]=e&255;++s<i&&(o*=256);)e<0&&a===0&&this[r+s-1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+i};d.prototype.writeIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);q(this,e,r,i,l-1,-l)}let s=i-1,o=1,a=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+i};d.prototype.writeInt8=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};d.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};d.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};d.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};d.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};d.prototype.writeBigInt64LE=xe(function(e,r=0){return vn(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});d.prototype.writeBigInt64BE=xe(function(e,r=0){return jn(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Pn(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 Ln(t,e,r,i,n){return e=+e,r=r>>>0,n||Pn(t,e,r,4,34028234663852886e22,-34028234663852886e22),Ze.write(t,e,r,i,23,4),r+4}d.prototype.writeFloatLE=function(e,r,i){return Ln(this,e,r,!0,i)};d.prototype.writeFloatBE=function(e,r,i){return Ln(this,e,r,!1,i)};function Bn(t,e,r,i,n){return e=+e,r=r>>>0,n||Pn(t,e,r,8,17976931348623157e292,-17976931348623157e292),Ze.write(t,e,r,i,52,8),r+8}d.prototype.writeDoubleLE=function(e,r,i){return Bn(this,e,r,!0,i)};d.prototype.writeDoubleBE=function(e,r,i){return Bn(this,e,r,!1,i)};d.prototype.copy=function(e,r,i,n){if(!d.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);let s=n-i;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,n):Uint8Array.prototype.set.call(e,this.subarray(i,n),r),s};d.prototype.fill=function(e,r,i,n){if(typeof e=="string"){if(typeof r=="string"?(n=r,r=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!d.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(e.length===1){let o=e.charCodeAt(0);(n==="utf8"&&o<128||n==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s<i;++s)this[s]=e;else{let o=d.isBuffer(e)?e:d.from(e,n),a=o.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<i-r;++s)this[s+r]=o[s%a]}return this};var Xe={};function Vr(t,e,r){Xe[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}Vr("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Vr("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);Vr("ERR_OUT_OF_RANGE",function(t,e,r){let i=`The value of "${t}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=Sn(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=Sn(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function Sn(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function zl(t,e,r){et(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&xt(e,t.length-(r+1))}function Fn(t,e,r,i,n,s){if(t>r||t<e){let o=typeof e=="bigint"?"n":"",a;throw s>3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${r}${o}`,new Xe.ERR_OUT_OF_RANGE("value",a,t)}zl(i,n,s)}function et(t,e){if(typeof t!="number")throw new Xe.ERR_INVALID_ARG_TYPE(e,"number",t)}function xt(t,e,r){throw Math.floor(t)!==t?(et(t,r),new Xe.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Xe.ERR_BUFFER_OUT_OF_BOUNDS:new Xe.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Kl=/[^+/0-9A-Za-z-_]/g;function Yl(t){if(t=t.split("=")[0],t=t.trim().replace(Kl,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Ur(t,e){e=e||1/0;let r,i=t.length,n=null,s=[];for(let o=0;o<i;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+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=(n-55296<<10|r-56320)+65536}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,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function Jl(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Xl(t,e){let r,i,n,s=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),i=r>>8,n=r%256,s.push(n),s.push(i);return s}function Cn(t){return $r.toByteArray(Yl(t))}function Jt(t,e,r,i){let n;for(n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function J(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Qr(t){return t!==t}var Zl=(function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let i=r*16;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e})();function xe(t){return typeof BigInt>"u"?eu:t}function eu(){throw new Error("BigInt not supported")}});var N=S((g_,Zn)=>{"use strict";var Jr=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let i=0;i<e.length;i++)r+=` ${e[i].stack}
2
- `;super(r),this.name="AggregateError",this.errors=e}};Zn.exports={AggregateError:Jr,ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Boolean,Uint8Array}});var Xr=S((y_,es)=>{"use strict";es.exports={format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,i]){let n=e.shift();return i==="f"?n.toFixed(6):i==="j"?JSON.stringify(n):i==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}}}});var M=S((w_,is)=>{"use strict";var{format:wu,inspect:er}=Xr(),{AggregateError:mu}=N(),xu=globalThis.AggregateError||mu,Eu=Symbol("kIsNodeError"),Su=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Iu=/^([A-Z][a-z0-9]*)+$/,Ru="__node_internal_",tr={};function $e(t,e){if(!t)throw new tr.ERR_INTERNAL_ASSERTION(e)}function ts(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function Tu(t,e,r){if(typeof e=="function")return $e(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let i=(e.match(/%[dfijoOs]/g)||[]).length;return $e(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:wu(e,...r)}function O(t,e,r){r||(r=Error);class i extends r{constructor(...s){super(Tu(t,e,s))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=t,i.prototype[Eu]=!0,tr[t]=i}function rs(t){let e=Ru+t.name;return Object.defineProperty(t,"name",{value:e}),t}function Au(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new xu([e,t],e.message);return r.code=e.code,r}return t||e}var Zr=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new tr.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};O("ERR_ASSERTION","%s",Error);O("ERR_INVALID_ARG_TYPE",(t,e,r)=>{$e(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let i="The ";t.endsWith(" argument")?i+=`${t} `:i+=`"${t}" ${t.includes(".")?"property":"argument"} `,i+="must be ";let n=[],s=[],o=[];for(let l of e)$e(typeof l=="string","All expected entries have to be of type string"),Su.includes(l)?n.push(l.toLowerCase()):Iu.test(l)?s.push(l):($e(l!=="object",'The value "object" should be written as "Object"'),o.push(l));if(s.length>0){let l=n.indexOf("object");l!==-1&&(n.splice(n,l,1),s.push("Object"))}if(n.length>0){switch(n.length){case 1:i+=`of type ${n[0]}`;break;case 2:i+=`one of type ${n[0]} or ${n[1]}`;break;default:{let l=n.pop();i+=`one of type ${n.join(", ")}, or ${l}`}}(s.length>0||o.length>0)&&(i+=" or ")}if(s.length>0){switch(s.length){case 1:i+=`an instance of ${s[0]}`;break;case 2:i+=`an instance of ${s[0]} or ${s[1]}`;break;default:{let l=s.pop();i+=`an instance of ${s.join(", ")}, or ${l}`}}o.length>0&&(i+=" or ")}switch(o.length){case 0:break;case 1:o[0].toLowerCase()!==o[0]&&(i+="an "),i+=`${o[0]}`;break;case 2:i+=`one of ${o[0]} or ${o[1]}`;break;default:{let l=o.pop();i+=`one of ${o.join(", ")}, or ${l}`}}if(r==null)i+=`. Received ${r}`;else if(typeof r=="function"&&r.name)i+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)i+=`. Received an instance of ${r.constructor.name}`;else{let l=er(r,{depth:-1});i+=`. Received ${l}`}}else{let l=er(r,{colors:!1});l.length>25&&(l=`${l.slice(0,25)}...`),i+=`. Received type ${typeof r} (${l})`}return i},TypeError);O("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let i=er(e);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${i}`},TypeError);O("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var i;let n=r!=null&&(i=r.constructor)!==null&&i!==void 0&&i.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${n}.`},TypeError);O("ERR_MISSING_ARGS",(...t)=>{$e(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(i=>`"${i}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let i=t.pop();e+=`The ${t.join(", ")}, and ${i} arguments`}break}return`${e} must be specified`},TypeError);O("ERR_OUT_OF_RANGE",(t,e,r)=>{$e(e,'Missing "range" argument');let i;if(Number.isInteger(r)&&Math.abs(r)>2**32)i=ts(String(r));else if(typeof r=="bigint"){i=String(r);let n=BigInt(2)**BigInt(32);(r>n||r<-n)&&(i=ts(i)),i+="n"}else i=er(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${i}`},RangeError);O("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);O("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);O("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);O("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);O("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);O("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);O("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);O("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);O("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);O("ERR_STREAM_WRITE_AFTER_END","write after end",Error);O("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);is.exports={AbortError:Zr,aggregateTwoErrors:rs(Au),hideStackFrames:rs,codes:tr}});var ot=S((m_,rr)=>{"use strict";var{AbortController:ns,AbortSignal:Nu}=typeof self<"u"?self:typeof window<"u"?window:void 0;rr.exports=ns;rr.exports.AbortSignal=Nu;rr.exports.default=ns});var vt=S((x_,ei)=>{"use strict";var at=typeof Reflect=="object"?Reflect:null,ss=at&&typeof at.apply=="function"?at.apply:function(e,r,i){return Function.prototype.apply.call(e,r,i)},ir;at&&typeof at.ownKeys=="function"?ir=at.ownKeys:Object.getOwnPropertySymbols?ir=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ir=function(e){return Object.getOwnPropertyNames(e)};function vu(t){console&&console.warn&&console.warn(t)}var as=Number.isNaN||function(e){return e!==e};function I(){I.init.call(this)}ei.exports=I;ei.exports.once=Bu;I.EventEmitter=I;I.prototype._events=void 0;I.prototype._eventsCount=0;I.prototype._maxListeners=void 0;var os=10;function nr(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(I,"defaultMaxListeners",{enumerable:!0,get:function(){return os},set:function(t){if(typeof t!="number"||t<0||as(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");os=t}});I.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};I.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||as(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function ls(t){return t._maxListeners===void 0?I.defaultMaxListeners:t._maxListeners}I.prototype.getMaxListeners=function(){return ls(this)};I.prototype.emit=function(e){for(var r=[],i=1;i<arguments.length;i++)r.push(arguments[i]);var n=e==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")ss(l,this,r);else for(var u=l.length,f=hs(l,u),i=0;i<u;++i)ss(f[i],this,r);return!0};function us(t,e,r,i){var n,s,o;if(nr(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),n=ls(t),n>0&&o.length>n&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,vu(a)}return t}I.prototype.addListener=function(e,r){return us(this,e,r,!1)};I.prototype.on=I.prototype.addListener;I.prototype.prependListener=function(e,r){return us(this,e,r,!0)};function ju(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function fs(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=ju.bind(i);return n.listener=r,i.wrapFn=n,n}I.prototype.once=function(e,r){return nr(r),this.on(e,fs(this,e,r)),this};I.prototype.prependOnceListener=function(e,r){return nr(r),this.prependListener(e,fs(this,e,r)),this};I.prototype.removeListener=function(e,r){var i,n,s,o,a;if(nr(r),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===r||i.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||r));else if(typeof i!="function"){for(s=-1,o=i.length-1;o>=0;o--)if(i[o]===r||i[o].listener===r){a=i[o].listener,s=o;break}if(s<0)return this;s===0?i.shift():Pu(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};I.prototype.off=I.prototype.removeListener;I.prototype.removeAllListeners=function(e){var r,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),o;for(n=0;n<s.length;++n)o=s[n],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=i[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(n=r.length-1;n>=0;n--)this.removeListener(e,r[n]);return this};function cs(t,e,r){var i=t._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?r?[n.listener||n]:[n]:r?Lu(n):hs(n,n.length)}I.prototype.listeners=function(e){return cs(this,e,!0)};I.prototype.rawListeners=function(e){return cs(this,e,!1)};I.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ds.call(t,e)};I.prototype.listenerCount=ds;function ds(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}I.prototype.eventNames=function(){return this._eventsCount>0?ir(this._events):[]};function hs(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function Pu(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Lu(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Bu(t,e){return new Promise(function(r,i){function n(o){t.removeListener(e,s),i(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",n),r([].slice.call(arguments))}ps(t,e,s,{once:!0}),e!=="error"&&Fu(t,n,{once:!0})})}function Fu(t,e,r){typeof t.on=="function"&&ps(t,"error",e,r)}function ps(t,e,r,i){if(typeof t.on=="function")i.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function n(s){i.once&&t.removeEventListener(e,n),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var $=S((E_,ri)=>{"use strict";var Cu=X(),{format:Ou,inspect:Mu}=Xr(),{codes:{ERR_INVALID_ARG_TYPE:ti}}=M(),{kResistStopPropagation:Du,AggregateError:$u,SymbolDispose:ku}=N(),qu=globalThis.AbortSignal||ot().AbortSignal,Uu=globalThis.AbortController||ot().AbortController,Wu=Object.getPrototypeOf(async function(){}).constructor,_s=globalThis.Blob||Cu.Blob,Gu=typeof _s<"u"?function(e){return e instanceof _s}:function(e){return!1},bs=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ti(e,"AbortSignal",t)},Vu=(t,e)=>{if(typeof t!="function")throw new ti(e,"Function",t)};ri.exports={AggregateError:$u,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((i,n)=>{t=i,e=n}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((i,...n)=>i?r(i):e(...n))})},debuglog(){return function(){}},format:Ou,inspect:Mu,types:{isAsyncFunction(t){return t instanceof Wu},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Gu,deprecate(t,e){return t},addAbortListener:vt().addAbortListener||function(e,r){if(e===void 0)throw new ti("signal","AbortSignal",e);bs(e,"signal"),Vu(r,"listener");let i;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Du]:!0}),i=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[ku](){var n;(n=i)===null||n===void 0||n()}}},AbortSignalAny:qu.any||function(e){if(e.length===1)return e[0];let r=new Uu,i=()=>r.abort();return e.forEach(n=>{bs(n,"signals"),n.addEventListener("abort",i,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",i))},{once:!0}),r.signal}};ri.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var ut=S((S_,Ts)=>{"use strict";var{ArrayIsArray:ni,ArrayPrototypeIncludes:ms,ArrayPrototypeJoin:xs,ArrayPrototypeMap:Qu,NumberIsInteger:si,NumberIsNaN:Hu,NumberMAX_SAFE_INTEGER:zu,NumberMIN_SAFE_INTEGER:Ku,NumberParseInt:Yu,ObjectPrototypeHasOwnProperty:Ju,RegExpPrototypeExec:Es,String:Xu,StringPrototypeToUpperCase:Zu,StringPrototypeTrim:ef}=N(),{hideStackFrames:Q,codes:{ERR_SOCKET_BAD_PORT:tf,ERR_INVALID_ARG_TYPE:D,ERR_INVALID_ARG_VALUE:lt,ERR_OUT_OF_RANGE:ke,ERR_UNKNOWN_SIGNAL:gs}}=M(),{normalizeEncoding:rf}=$(),{isAsyncFunction:nf,isArrayBufferView:sf}=$().types,ys={};function of(t){return t===(t|0)}function af(t){return t===t>>>0}var lf=/^[0-7]+$/,uf="must be a 32-bit unsigned integer or an octal string";function ff(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(Es(lf,t)===null)throw new lt(e,t,uf);t=Yu(t,8)}return Ss(t,e),t}var cf=Q((t,e,r=Ku,i=zu)=>{if(typeof t!="number")throw new D(e,"number",t);if(!si(t))throw new ke(e,"an integer",t);if(t<r||t>i)throw new ke(e,`>= ${r} && <= ${i}`,t)}),df=Q((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!="number")throw new D(e,"number",t);if(!si(t))throw new ke(e,"an integer",t);if(t<r||t>i)throw new ke(e,`>= ${r} && <= ${i}`,t)}),Ss=Q((t,e,r=!1)=>{if(typeof t!="number")throw new D(e,"number",t);if(!si(t))throw new ke(e,"an integer",t);let i=r?1:0,n=4294967295;if(t<i||t>n)throw new ke(e,`>= ${i} && <= ${n}`,t)});function oi(t,e){if(typeof t!="string")throw new D(e,"string",t)}function hf(t,e,r=void 0,i){if(typeof t!="number")throw new D(e,"number",t);if(r!=null&&t<r||i!=null&&t>i||(r!=null||i!=null)&&Hu(t))throw new ke(e,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,t)}var pf=Q((t,e,r)=>{if(!ms(r,t)){let n="must be one of: "+xs(Qu(r,s=>typeof s=="string"?`'${s}'`:Xu(s)),", ");throw new lt(e,t,n)}});function Is(t,e){if(typeof t!="boolean")throw new D(e,"boolean",t)}function ii(t,e,r){return t==null||!Ju(t,e)?r:t[e]}var _f=Q((t,e,r=null)=>{let i=ii(r,"allowArray",!1),n=ii(r,"allowFunction",!1);if(!ii(r,"nullable",!1)&&t===null||!i&&ni(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new D(e,"Object",t)}),bf=Q((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new D(e,"a dictionary",t)}),sr=Q((t,e,r=0)=>{if(!ni(t))throw new D(e,"Array",t);if(t.length<r){let i=`must be longer than ${r}`;throw new lt(e,t,i)}});function gf(t,e){sr(t,e);for(let r=0;r<t.length;r++)oi(t[r],`${e}[${r}]`)}function yf(t,e){sr(t,e);for(let r=0;r<t.length;r++)Is(t[r],`${e}[${r}]`)}function wf(t,e){sr(t,e);for(let r=0;r<t.length;r++){let i=t[r],n=`${e}[${r}]`;if(i==null)throw new D(n,"AbortSignal",i);Rs(i,n)}}function mf(t,e="signal"){if(oi(t,e),ys[t]===void 0)throw ys[Zu(t)]!==void 0?new gs(t+" (signals must use all capital letters)"):new gs(t)}var xf=Q((t,e="buffer")=>{if(!sf(t))throw new D(e,["Buffer","TypedArray","DataView"],t)});function Ef(t,e){let r=rf(e),i=t.length;if(r==="hex"&&i%2!==0)throw new lt("encoding",e,`is invalid for data of length ${i}`)}function Sf(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&ef(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new tf(e,t,r);return t|0}var Rs=Q((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new D(e,"AbortSignal",t)}),If=Q((t,e)=>{if(typeof t!="function")throw new D(e,"Function",t)}),Rf=Q((t,e)=>{if(typeof t!="function"||nf(t))throw new D(e,"Function",t)}),Tf=Q((t,e)=>{if(t!==void 0)throw new D(e,"undefined",t)});function Af(t,e,r){if(!ms(r,t))throw new D(e,`('${xs(r,"|")}')`,t)}var Nf=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function ws(t,e){if(typeof t>"u"||!Es(Nf,t))throw new lt(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function vf(t){if(typeof t=="string")return ws(t,"hints"),t;if(ni(t)){let e=t.length,r="";if(e===0)return r;for(let i=0;i<e;i++){let n=t[i];ws(n,"hints"),r+=n,i!==e-1&&(r+=", ")}return r}throw new lt("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Ts.exports={isInt32:of,isUint32:af,parseFileMode:ff,validateArray:sr,validateStringArray:gf,validateBooleanArray:yf,validateAbortSignalArray:wf,validateBoolean:Is,validateBuffer:xf,validateDictionary:bf,validateEncoding:Ef,validateFunction:If,validateInt32:df,validateInteger:cf,validateNumber:hf,validateObject:_f,validateOneOf:pf,validatePlainFunction:Rf,validatePort:Sf,validateSignalName:mf,validateString:oi,validateUint32:Ss,validateUndefined:Tf,validateUnion:Af,validateAbortSignal:Rs,validateLinkHeaderValue:vf}});var Re=S((I_,js)=>{var j=js.exports={},ee,te;function ai(){throw new Error("setTimeout has not been defined")}function li(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ee=setTimeout:ee=ai}catch{ee=ai}try{typeof clearTimeout=="function"?te=clearTimeout:te=li}catch{te=li}})();function As(t){if(ee===setTimeout)return setTimeout(t,0);if((ee===ai||!ee)&&setTimeout)return ee=setTimeout,setTimeout(t,0);try{return ee(t,0)}catch{try{return ee.call(null,t,0)}catch{return ee.call(this,t,0)}}}function jf(t){if(te===clearTimeout)return clearTimeout(t);if((te===li||!te)&&clearTimeout)return te=clearTimeout,clearTimeout(t);try{return te(t)}catch{try{return te.call(null,t)}catch{return te.call(this,t)}}}var pe=[],ft=!1,qe,or=-1;function Pf(){!ft||!qe||(ft=!1,qe.length?pe=qe.concat(pe):or=-1,pe.length&&Ns())}function Ns(){if(!ft){var t=As(Pf);ft=!0;for(var e=pe.length;e;){for(qe=pe,pe=[];++or<e;)qe&&qe[or].run();or=-1,e=pe.length}qe=null,ft=!1,jf(t)}}j.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];pe.push(new vs(t,e)),pe.length===1&&!ft&&As(Ns)};function vs(t,e){this.fun=t,this.array=e}vs.prototype.run=function(){this.fun.apply(null,this.array)};j.title="browser";j.browser=!0;j.env={};j.argv=[];j.version="";j.versions={};function _e(){}j.on=_e;j.addListener=_e;j.once=_e;j.off=_e;j.removeListener=_e;j.removeAllListeners=_e;j.emit=_e;j.prependListener=_e;j.prependOnceListener=_e;j.listeners=function(t){return[]};j.binding=function(t){throw new Error("process.binding is not supported")};j.cwd=function(){return"/"};j.chdir=function(t){throw new Error("process.chdir is not supported")};j.umask=function(){return 0}});var ie=S((R_,Vs)=>{"use strict";var{SymbolAsyncIterator:Ps,SymbolIterator:Ls,SymbolFor:Ue}=N(),Bs=Ue("nodejs.stream.destroyed"),Fs=Ue("nodejs.stream.errored"),ui=Ue("nodejs.stream.readable"),fi=Ue("nodejs.stream.writable"),Cs=Ue("nodejs.stream.disturbed"),Lf=Ue("nodejs.webstream.isClosedPromise"),Bf=Ue("nodejs.webstream.controllerErrorFunction");function ar(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function lr(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function Ff(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function re(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Os(t){return!!(t&&!re(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Ms(t){return!!(t&&!re(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Ds(t){return!!(t&&!re(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function Cf(t){return Os(t)||Ms(t)||Ds(t)}function Of(t,e){return t==null?!1:e===!0?typeof t[Ps]=="function":e===!1?typeof t[Ls]=="function":typeof t[Ps]=="function"||typeof t[Ls]=="function"}function ur(t){if(!re(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[Bs]||i!=null&&i.destroyed)}function $s(t){if(!lr(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Mf(t,e){if(!lr(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function Df(t){if(!ar(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function ks(t,e){if(!ar(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function qs(t){return t&&t[ui]!=null?t[ui]:typeof t?.readable!="boolean"?null:ur(t)?!1:ar(t)&&t.readable&&!ks(t)}function Us(t){return t&&t[fi]!=null?t[fi]:typeof t?.writable!="boolean"?null:ur(t)?!1:lr(t)&&t.writable&&!$s(t)}function $f(t,e){return re(t)?ur(t)?!0:!(e?.readable!==!1&&qs(t)||e?.writable!==!1&&Us(t)):null}function kf(t){var e,r;return re(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function qf(t){var e,r;return re(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function Uf(t){if(!re(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&Ws(t)?t._closed:null}function Ws(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Gs(t){return typeof t._sent100=="boolean"&&Ws(t)}function Wf(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function Gf(t){if(!re(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&Gs(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}function Vf(t){var e;return!!(t&&((e=t[Cs])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function Qf(t){var e,r,i,n,s,o,a,l,u,f;return!!(t&&((e=(r=(i=(n=(s=(o=t[Fs])!==null&&o!==void 0?o:t.readableErrored)!==null&&s!==void 0?s:t.writableErrored)!==null&&n!==void 0?n:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&i!==void 0?i:(l=t._writableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&r!==void 0?r:(u=t._readableState)===null||u===void 0?void 0:u.errored)!==null&&e!==void 0?e:!((f=t._writableState)===null||f===void 0)&&f.errored))}Vs.exports={isDestroyed:ur,kIsDestroyed:Bs,isDisturbed:Vf,kIsDisturbed:Cs,isErrored:Qf,kIsErrored:Fs,isReadable:qs,kIsReadable:ui,kIsClosedPromise:Lf,kControllerErrorFunction:Bf,kIsWritable:fi,isClosed:Uf,isDuplexNodeStream:Ff,isFinished:$f,isIterable:Of,isReadableNodeStream:ar,isReadableStream:Os,isReadableEnded:Df,isReadableFinished:ks,isReadableErrored:qf,isNodeStream:re,isWebStream:Cf,isWritable:Us,isWritableNodeStream:lr,isWritableStream:Ms,isWritableEnded:$s,isWritableFinished:Mf,isWritableErrored:kf,isServerRequest:Wf,isServerResponse:Gs,willEmitClose:Gf,isTransformStream:Ds}});var be=S((T_,_i)=>{"use strict";var Te=Re(),{AbortError:eo,codes:Hf}=M(),{ERR_INVALID_ARG_TYPE:zf,ERR_STREAM_PREMATURE_CLOSE:Qs}=Hf,{kEmptyObject:di,once:hi}=$(),{validateAbortSignal:Kf,validateFunction:Yf,validateObject:Jf,validateBoolean:Xf}=ut(),{Promise:Zf,PromisePrototypeThen:ec,SymbolDispose:to}=N(),{isClosed:tc,isReadable:Hs,isReadableNodeStream:ci,isReadableStream:rc,isReadableFinished:zs,isReadableErrored:Ks,isWritable:Ys,isWritableNodeStream:Js,isWritableStream:ic,isWritableFinished:Xs,isWritableErrored:Zs,isNodeStream:nc,willEmitClose:sc,kIsClosedPromise:oc}=ie(),ct;function ac(t){return t.setHeader&&typeof t.abort=="function"}var pi=()=>{};function ro(t,e,r){var i,n;if(arguments.length===2?(r=e,e=di):e==null?e=di:Jf(e,"options"),Yf(r,"callback"),Kf(e.signal,"options.signal"),r=hi(r),rc(t)||ic(t))return lc(t,e,r);if(!nc(t))throw new zf("stream",["ReadableStream","WritableStream","Stream"],t);let s=(i=e.readable)!==null&&i!==void 0?i:ci(t),o=(n=e.writable)!==null&&n!==void 0?n:Js(t),a=t._writableState,l=t._readableState,u=()=>{t.writable||_()},f=sc(t)&&ci(t)===s&&Js(t)===o,c=Xs(t,!1),_=()=>{c=!0,t.destroyed&&(f=!1),!(f&&(!t.readable||s))&&(!s||h)&&r.call(t)},h=zs(t,!1),b=()=>{h=!0,t.destroyed&&(f=!1),!(f&&(!t.writable||o))&&(!o||c)&&r.call(t)},p=L=>{r.call(t,L)},y=tc(t),g=()=>{y=!0;let L=Zs(t)||Ks(t);if(L&&typeof L!="boolean")return r.call(t,L);if(s&&!h&&ci(t,!0)&&!zs(t,!1))return r.call(t,new Qs);if(o&&!c&&!Xs(t,!1))return r.call(t,new Qs);r.call(t)},E=()=>{y=!0;let L=Zs(t)||Ks(t);if(L&&typeof L!="boolean")return r.call(t,L);r.call(t)},A=()=>{t.req.on("finish",_)};ac(t)?(t.on("complete",_),f||t.on("abort",g),t.req?A():t.on("request",A)):o&&!a&&(t.on("end",u),t.on("close",u)),!f&&typeof t.aborted=="boolean"&&t.on("aborted",g),t.on("end",b),t.on("finish",_),e.error!==!1&&t.on("error",p),t.on("close",g),y?Te.nextTick(g):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?f||Te.nextTick(E):(!s&&(!f||Hs(t))&&(c||Ys(t)===!1)||!o&&(!f||Ys(t))&&(h||Hs(t)===!1)||l&&t.req&&t.aborted)&&Te.nextTick(E);let w=()=>{r=pi,t.removeListener("aborted",g),t.removeListener("complete",_),t.removeListener("abort",g),t.removeListener("request",A),t.req&&t.req.removeListener("finish",_),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",_),t.removeListener("end",b),t.removeListener("error",p),t.removeListener("close",g)};if(e.signal&&!y){let L=()=>{let Pe=r;w(),Pe.call(t,new eo(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Te.nextTick(L);else{ct=ct||$().addAbortListener;let Pe=ct(e.signal,L),G=r;r=hi((...Je)=>{Pe[to](),G.apply(t,Je)})}}return w}function lc(t,e,r){let i=!1,n=pi;if(e.signal)if(n=()=>{i=!0,r.call(t,new eo(void 0,{cause:e.signal.reason}))},e.signal.aborted)Te.nextTick(n);else{ct=ct||$().addAbortListener;let o=ct(e.signal,n),a=r;r=hi((...l)=>{o[to](),a.apply(t,l)})}let s=(...o)=>{i||Te.nextTick(()=>r.apply(t,o))};return ec(t[oc].promise,s,s),pi}function uc(t,e){var r;let i=!1;return e===null&&(e=di),(r=e)!==null&&r!==void 0&&r.cleanup&&(Xf(e.cleanup,"cleanup"),i=e.cleanup),new Zf((n,s)=>{let o=ro(t,e,a=>{i&&o(),a?s(a):n()})})}_i.exports=ro;_i.exports.finished=uc});var We=S((A_,fo)=>{"use strict";var ne=Re(),{aggregateTwoErrors:fc,codes:{ERR_MULTIPLE_CALLBACK:cc},AbortError:dc}=M(),{Symbol:so}=N(),{kIsDestroyed:hc,isDestroyed:pc,isFinished:_c,isServerRequest:bc}=ie(),oo=so("kDestroy"),bi=so("kConstruct");function ao(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function gc(t,e){let r=this._readableState,i=this._writableState,n=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(ao(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?io(this,t,e):this.once(oo,function(s){io(this,fc(s,t),e)}),this)}function io(t,e,r){let i=!1;function n(s){if(i)return;i=!0;let o=t._readableState,a=t._writableState;ao(s,a,o),a&&(a.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?ne.nextTick(yc,t,s):ne.nextTick(lo,t)}try{t._destroy(e||null,n)}catch(s){n(s)}}function yc(t,e){gi(t,e),lo(t)}function lo(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}function gi(t,e){let r=t._readableState,i=t._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function wc(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function yi(t,e,r){let i=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),i&&!i.errored&&(i.errored=e),r?ne.nextTick(gi,t,e):gi(t,e))}function mc(t,e){if(typeof t._construct!="function")return;let r=t._readableState,i=t._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),t.once(bi,e),!(t.listenerCount(bi)>1)&&ne.nextTick(xc,t)}function xc(t){let e=!1;function r(i){if(e){yi(t,i??new cc);return}e=!0;let n=t._readableState,s=t._writableState,o=s||n;n&&(n.constructed=!0),s&&(s.constructed=!0),o.destroyed?t.emit(oo,i):i?yi(t,i,!0):ne.nextTick(Ec,t)}try{t._construct(i=>{ne.nextTick(r,i)})}catch(i){ne.nextTick(r,i)}}function Ec(t){t.emit(bi)}function no(t){return t?.setHeader&&typeof t.abort=="function"}function uo(t){t.emit("close")}function Sc(t,e){t.emit("error",e),ne.nextTick(uo,t)}function Ic(t,e){!t||pc(t)||(!e&&!_c(t)&&(e=new dc),bc(t)?(t.socket=null,t.destroy(e)):no(t)?t.abort():no(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?ne.nextTick(Sc,t,e):ne.nextTick(uo,t),t.destroyed||(t[hc]=!0))}fo.exports={construct:mc,destroyer:Ic,destroy:gc,undestroy:wc,errorOrDestroy:yi}});var dr=S((N_,ho)=>{"use strict";var{ArrayIsArray:Rc,ObjectSetPrototypeOf:co}=N(),{EventEmitter:fr}=vt();function cr(t){fr.call(this,t)}co(cr.prototype,fr.prototype);co(cr,fr);cr.prototype.pipe=function(t,e){let r=this;function i(f){t.writable&&t.write(f)===!1&&r.pause&&r.pause()}r.on("data",i);function n(){r.readable&&r.resume&&r.resume()}t.on("drain",n),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",o),r.on("close",a));let s=!1;function o(){s||(s=!0,t.end())}function a(){s||(s=!0,typeof t.destroy=="function"&&t.destroy())}function l(f){u(),fr.listenerCount(this,"error")===0&&this.emit("error",f)}wi(r,"error",l),wi(t,"error",l);function u(){r.removeListener("data",i),t.removeListener("drain",n),r.removeListener("end",o),r.removeListener("close",a),r.removeListener("error",l),t.removeListener("error",l),r.removeListener("end",u),r.removeListener("close",u),t.removeListener("close",u)}return r.on("end",u),r.on("close",u),t.on("close",u),t.emit("pipe",r),t};function wi(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Rc(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}ho.exports={Stream:cr,prependListener:wi}});var jt=S((v_,hr)=>{"use strict";var{SymbolDispose:Tc}=N(),{AbortError:po,codes:Ac}=M(),{isNodeStream:_o,isWebStream:Nc,kControllerErrorFunction:vc}=ie(),jc=be(),{ERR_INVALID_ARG_TYPE:bo}=Ac,mi,Pc=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new bo(e,"AbortSignal",t)};hr.exports.addAbortSignal=function(e,r){if(Pc(e,"signal"),!_o(r)&&!Nc(r))throw new bo("stream",["ReadableStream","WritableStream","Stream"],r);return hr.exports.addAbortSignalNoValidate(e,r)};hr.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=_o(e)?()=>{e.destroy(new po(void 0,{cause:t.reason}))}:()=>{e[vc](new po(void 0,{cause:t.reason}))};if(t.aborted)r();else{mi=mi||$().addAbortListener;let i=mi(t,r);jc(e,i[Tc])}return e}});var wo=S((P_,yo)=>{"use strict";var{StringPrototypeSlice:go,SymbolIterator:Lc,TypedArrayPrototypeSet:pr,Uint8Array:Bc}=N(),{Buffer:xi}=X(),{inspect:Fc}=$();yo.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let r=this.head,i=""+r.data;for(;(r=r.next)!==null;)i+=e+r.data;return i}concat(e){if(this.length===0)return xi.alloc(0);let r=xi.allocUnsafe(e>>>0),i=this.head,n=0;for(;i;)pr(r,i.data,n),n+=i.data.length,i=i.next;return r}consume(e,r){let i=this.head.data;if(e<i.length){let n=i.slice(0,e);return this.head.data=i.slice(e),n}return e===i.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[Lc](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",i=this.head,n=0;do{let s=i.data;if(e>s.length)r+=s,e-=s.length;else{e===s.length?(r+=s,++n,i.next?this.head=i.next:this.head=this.tail=null):(r+=go(s,0,e),this.head=i,i.data=go(s,e));break}++n}while((i=i.next)!==null);return this.length-=n,r}_getBuffer(e){let r=xi.allocUnsafe(e),i=e,n=this.head,s=0;do{let o=n.data;if(e>o.length)pr(r,o,i-e),e-=o.length;else{e===o.length?(pr(r,o,i-e),++s,n.next?this.head=n.next:this.head=this.tail=null):(pr(r,new Bc(o.buffer,o.byteOffset,e),i-e),this.head=n,n.data=o.slice(e));break}++s}while((n=n.next)!==null);return this.length-=s,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return Fc(this,{...r,depth:0,customInspect:!1})}}});var Pt=S((L_,So)=>{"use strict";var{MathFloor:Cc,NumberIsInteger:Oc}=N(),{validateInteger:Mc}=ut(),{ERR_INVALID_ARG_VALUE:Dc}=M().codes,mo=16*1024,xo=16;function $c(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Eo(t){return t?xo:mo}function kc(t,e){Mc(e,"value",0),t?xo=e:mo=e}function qc(t,e,r,i){let n=$c(e,i,r);if(n!=null){if(!Oc(n)||n<0){let s=i?`options.${r}`:"options.highWaterMark";throw new Dc(s,n)}return Cc(n)}return Eo(t.objectMode)}So.exports={getHighWaterMark:qc,getDefaultHighWaterMark:Eo,setDefaultHighWaterMark:kc}});var To=S((Ei,Ro)=>{var _r=X(),se=_r.Buffer;function Io(t,e){for(var r in t)e[r]=t[r]}se.from&&se.alloc&&se.allocUnsafe&&se.allocUnsafeSlow?Ro.exports=_r:(Io(_r,Ei),Ei.Buffer=Ge);function Ge(t,e,r){return se(t,e,r)}Ge.prototype=Object.create(se.prototype);Io(se,Ge);Ge.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return se(t,e,r)};Ge.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=se(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};Ge.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return se(t)};Ge.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return _r.SlowBuffer(t)}});var vo=S(No=>{"use strict";var Ii=To().Buffer,Ao=Ii.isEncoding||function(t){switch(t=""+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 Uc(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}}function Wc(t){var e=Uc(t);if(typeof e!="string"&&(Ii.isEncoding===Ao||!Ao(t)))throw new Error("Unknown encoding: "+t);return e||t}No.StringDecoder=Lt;function Lt(t){this.encoding=Wc(t);var e;switch(this.encoding){case"utf16le":this.text=Kc,this.end=Yc,e=4;break;case"utf8":this.fillLast=Qc,e=4;break;case"base64":this.text=Jc,this.end=Xc,e=3;break;default:this.write=Zc,this.end=ed;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Ii.allocUnsafe(e)}Lt.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};Lt.prototype.end=zc;Lt.prototype.text=Hc;Lt.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 Si(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Gc(t,e,r){var i=e.length-1;if(i<r)return 0;var n=Si(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=Si(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=Si(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}function Vc(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function Qc(t){var e=this.lastTotal-this.lastNeed,r=Vc(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function Hc(t,e){var r=Gc(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)}function zc(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Kc(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 Yc(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 Jc(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?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 Xc(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Zc(t){return t.toString(this.encoding)}function ed(t){return t&&t.length?this.write(t):""}});var Ri=S((F_,Bo)=>{"use strict";var jo=Re(),{PromisePrototypeThen:td,SymbolAsyncIterator:Po,SymbolIterator:Lo}=N(),{Buffer:rd}=X(),{ERR_INVALID_ARG_TYPE:id,ERR_STREAM_NULL_VALUES:nd}=M().codes;function sd(t,e,r){let i;if(typeof e=="string"||e instanceof rd)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let n;if(e&&e[Po])n=!0,i=e[Po]();else if(e&&e[Lo])n=!1,i=e[Lo]();else throw new id("iterable",["Iterable"],e);let s=new t({objectMode:!0,highWaterMark:1,...r}),o=!1;s._read=function(){o||(o=!0,l())},s._destroy=function(u,f){td(a(u),()=>jo.nextTick(f,u),c=>jo.nextTick(f,c||u))};async function a(u){let f=u!=null,c=typeof i.throw=="function";if(f&&c){let{value:_,done:h}=await i.throw(u);if(await _,h)return}if(typeof i.return=="function"){let{value:_}=await i.return();await _}}async function l(){for(;;){try{let{value:u,done:f}=n?await i.next():i.next();if(f)s.push(null);else{let c=u&&typeof u.then=="function"?await u:u;if(c===null)throw o=!1,new nd;if(s.push(c))continue;o=!1}}catch(u){s.destroy(u)}break}}return s}Bo.exports=sd});var Ft=S((C_,Jo)=>{"use strict";var z=Re(),{ArrayPrototypeIndexOf:od,NumberIsInteger:ad,NumberIsNaN:ld,NumberParseInt:ud,ObjectDefineProperties:Bi,ObjectKeys:fd,ObjectSetPrototypeOf:Oo,Promise:Mo,SafeSet:cd,SymbolAsyncDispose:dd,SymbolAsyncIterator:hd,Symbol:pd}=N();Jo.exports=m;m.ReadableState=wr;var{EventEmitter:_d}=vt(),{Stream:Ae,prependListener:bd}=dr(),{Buffer:Ti}=X(),{addAbortSignal:gd}=jt(),Do=be(),x=$().debuglog("stream",t=>{x=t}),yd=wo(),pt=We(),{getHighWaterMark:wd,getDefaultHighWaterMark:md}=Pt(),{aggregateTwoErrors:Fo,codes:{ERR_INVALID_ARG_TYPE:xd,ERR_METHOD_NOT_IMPLEMENTED:Ed,ERR_OUT_OF_RANGE:Sd,ERR_STREAM_PUSH_AFTER_EOF:Id,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:Rd},AbortError:Td}=M(),{validateObject:Ad}=ut(),Ve=pd("kPaused"),{StringDecoder:$o}=vo(),Nd=Ri();Oo(m.prototype,Ae.prototype);Oo(m,Ae);var Ai=()=>{},{errorOrDestroy:dt}=pt,ht=1,vd=2,ko=4,Bt=8,qo=16,br=32,gr=64,Uo=128,jd=256,Pd=512,Ld=1024,Pi=2048,Li=4096,Bd=8192,Fd=16384,Cd=32768,Wo=65536,Od=1<<17,Md=1<<18;function B(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}Bi(wr.prototype,{objectMode:B(ht),ended:B(vd),endEmitted:B(ko),reading:B(Bt),constructed:B(qo),sync:B(br),needReadable:B(gr),emittedReadable:B(Uo),readableListening:B(jd),resumeScheduled:B(Pd),errorEmitted:B(Ld),emitClose:B(Pi),autoDestroy:B(Li),destroyed:B(Bd),closed:B(Fd),closeEmitted:B(Cd),multiAwaitDrain:B(Wo),readingMore:B(Od),dataEmitted:B(Md)});function wr(t,e,r){typeof r!="boolean"&&(r=e instanceof oe()),this.state=Pi|Li|qo|br,t&&t.objectMode&&(this.state|=ht),r&&t&&t.readableObjectMode&&(this.state|=ht),this.highWaterMark=t?wd(this,t,"readableHighWaterMark",r):md(!1),this.buffer=new yd,this.length=0,this.pipes=[],this.flowing=null,this[Ve]=null,t&&t.emitClose===!1&&(this.state&=~Pi),t&&t.autoDestroy===!1&&(this.state&=~Li),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new $o(t.encoding),this.encoding=t.encoding)}function m(t){if(!(this instanceof m))return new m(t);let e=this instanceof oe();this._readableState=new wr(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&gd(t.signal,this)),Ae.call(this,t),pt.construct(this,()=>{this._readableState.needReadable&&yr(this,this._readableState)})}m.prototype.destroy=pt.destroy;m.prototype._undestroy=pt.undestroy;m.prototype._destroy=function(t,e){e(t)};m.prototype[_d.captureRejectionSymbol]=function(t){this.destroy(t)};m.prototype[dd]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new Td,this.destroy(t)),new Mo((e,r)=>Do(this,i=>i&&i!==t?r(i):e(null)))};m.prototype.push=function(t,e){return Go(this,t,e,!1)};m.prototype.unshift=function(t,e){return Go(this,t,e,!0)};function Go(t,e,r,i){x("readableAddChunk",e);let n=t._readableState,s;if((n.state&ht)===0&&(typeof e=="string"?(r=r||n.defaultEncoding,n.encoding!==r&&(i&&n.encoding?e=Ti.from(e,r).toString(n.encoding):(e=Ti.from(e,r),r=""))):e instanceof Ti?r="":Ae._isUint8Array(e)?(e=Ae._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new xd("chunk",["string","Buffer","Uint8Array"],e))),s)dt(t,s);else if(e===null)n.state&=~Bt,kd(t,n);else if((n.state&ht)!==0||e&&e.length>0)if(i)if((n.state&ko)!==0)dt(t,new Rd);else{if(n.destroyed||n.errored)return!1;Ni(t,n,e,!0)}else if(n.ended)dt(t,new Id);else{if(n.destroyed||n.errored)return!1;n.state&=~Bt,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?Ni(t,n,e,!1):yr(t,n)):Ni(t,n,e,!1)}else i||(n.state&=~Bt,yr(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}function Ni(t,e,r,i){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&Wo)!==0?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),(e.state&gr)!==0&&mr(t)),yr(t,e)}m.prototype.isPaused=function(){let t=this._readableState;return t[Ve]===!0||t.flowing===!1};m.prototype.setEncoding=function(t){let e=new $o(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,i="";for(let n of r)i+=e.write(n);return r.clear(),i!==""&&r.push(i),this._readableState.length=i.length,this};var Dd=1073741824;function $d(t){if(t>Dd)throw new Sd("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Co(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&ht)!==0?1:ld(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}m.prototype.read=function(t){x("read",t),t===void 0?t=NaN:ad(t)||(t=ud(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=$d(t)),t!==0&&(e.state&=~Uo),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return x("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?vi(this):mr(this),null;if(t=Co(t,e),t===0&&e.ended)return e.length===0&&vi(this),null;let i=(e.state&gr)!==0;if(x("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,x("length less than watermark",i)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)i=!1,x("reading, ended or constructing",i);else if(i){x("do read"),e.state|=Bt|br,e.length===0&&(e.state|=gr);try{this._read(e.highWaterMark)}catch(s){dt(this,s)}e.state&=~br,e.reading||(t=Co(r,e))}let n;return t>0?n=Ko(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&vi(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function kd(t,e){if(x("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?mr(t):(e.needReadable=!1,e.emittedReadable=!0,Vo(t))}}function mr(t){let e=t._readableState;x("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(x("emitReadable",e.flowing),e.emittedReadable=!0,z.nextTick(Vo,t))}function Vo(t){let e=t._readableState;x("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Ho(t)}function yr(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,z.nextTick(qd,t,e))}function qd(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(x("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}m.prototype._read=function(t){throw new Ed("_read()")};m.prototype.pipe=function(t,e){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new cd(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(t),x("pipe count=%d opts=%j",i.pipes.length,e);let s=(!e||e.end!==!1)&&t!==z.stdout&&t!==z.stderr?a:y;i.endEmitted?z.nextTick(s):r.once("end",s),t.on("unpipe",o);function o(g,E){x("onunpipe"),g===r&&E&&E.hasUnpiped===!1&&(E.hasUnpiped=!0,f())}function a(){x("onend"),t.end()}let l,u=!1;function f(){x("cleanup"),t.removeListener("close",b),t.removeListener("finish",p),l&&t.removeListener("drain",l),t.removeListener("error",h),t.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",y),r.removeListener("data",_),u=!0,l&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&l()}function c(){u||(i.pipes.length===1&&i.pipes[0]===t?(x("false write response, pause",0),i.awaitDrainWriters=t,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(t)&&(x("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),r.pause()),l||(l=Ud(r,t),t.on("drain",l))}r.on("data",_);function _(g){x("ondata");let E=t.write(g);x("dest.write",E),E===!1&&c()}function h(g){if(x("onerror",g),y(),t.removeListener("error",h),t.listenerCount("error")===0){let E=t._writableState||t._readableState;E&&!E.errorEmitted?dt(t,g):t.emit("error",g)}}bd(t,"error",h);function b(){t.removeListener("finish",p),y()}t.once("close",b);function p(){x("onfinish"),t.removeListener("close",b),y()}t.once("finish",p);function y(){x("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?c():i.flowing||(x("pipe resume"),r.resume()),t};function Ud(t,e){return function(){let i=t._readableState;i.awaitDrainWriters===e?(x("pipeOnDrain",1),i.awaitDrainWriters=null):i.multiAwaitDrain&&(x("pipeOnDrain",i.awaitDrainWriters.size),i.awaitDrainWriters.delete(e)),(!i.awaitDrainWriters||i.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}m.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let s=0;s<n.length;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}let i=od(e.pipes,t);return i===-1?this:(e.pipes.splice(i,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};m.prototype.on=function(t,e){let r=Ae.prototype.on.call(this,t,e),i=this._readableState;return t==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,x("on readable",i.length,i.reading),i.length?mr(this):i.reading||z.nextTick(Wd,this)),r};m.prototype.addListener=m.prototype.on;m.prototype.removeListener=function(t,e){let r=Ae.prototype.removeListener.call(this,t,e);return t==="readable"&&z.nextTick(Qo,this),r};m.prototype.off=m.prototype.removeListener;m.prototype.removeAllListeners=function(t){let e=Ae.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&z.nextTick(Qo,this),e};function Qo(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[Ve]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function Wd(t){x("readable nexttick read 0"),t.read(0)}m.prototype.resume=function(){let t=this._readableState;return t.flowing||(x("resume"),t.flowing=!t.readableListening,Gd(this,t)),t[Ve]=!1,this};function Gd(t,e){e.resumeScheduled||(e.resumeScheduled=!0,z.nextTick(Vd,t,e))}function Vd(t,e){x("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Ho(t),e.flowing&&!e.reading&&t.read(0)}m.prototype.pause=function(){return x("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(x("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[Ve]=!0,this};function Ho(t){let e=t._readableState;for(x("flow",e.flowing);e.flowing&&t.read()!==null;);}m.prototype.wrap=function(t){let e=!1;t.on("data",i=>{!this.push(i)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",i=>{dt(this,i)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=fd(t);for(let i=1;i<r.length;i++){let n=r[i];this[n]===void 0&&typeof t[n]=="function"&&(this[n]=t[n].bind(t))}return this};m.prototype[hd]=function(){return zo(this)};m.prototype.iterator=function(t){return t!==void 0&&Ad(t,"options"),zo(this,t)};function zo(t,e){typeof t.read!="function"&&(t=m.wrap(t,{objectMode:!0}));let r=Qd(t,e);return r.stream=t,r}async function*Qd(t,e){let r=Ai;function i(o){this===t?(r(),r=Ai):r=o}t.on("readable",i);let n,s=Do(t,{writable:!1},o=>{n=o?Fo(n,o):null,r(),r=Ai});try{for(;;){let o=t.destroyed?null:t.read();if(o!==null)yield o;else{if(n)throw n;if(n===null)return;await new Mo(i)}}}catch(o){throw n=Fo(n,o),n}finally{(n||e?.destroyOnReturn!==!1)&&(n===void 0||t._readableState.autoDestroy)?pt.destroyer(t,null):(t.off("readable",i),s())}}Bi(m.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});Bi(wr.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Ve]!==!1},set(t){this[Ve]=!!t}}});m._fromList=Ko;function Ko(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function vi(t){let e=t._readableState;x("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,z.nextTick(Hd,e,t))}function Hd(t,e){if(x("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)z.nextTick(zd,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function zd(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}m.from=function(t,e){return Nd(m,t,e)};var ji;function Yo(){return ji===void 0&&(ji={}),ji}m.fromWeb=function(t,e){return Yo().newStreamReadableFromReadableStream(t,e)};m.toWeb=function(t,e){return Yo().newReadableStreamFromStreamReadable(t,e)};m.wrap=function(t,e){var r,i;return new m({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(n,s){pt.destroyer(t,n),s(n)}}).wrap(t)}});var Rr=S((O_,ua)=>{"use strict";var Qe=Re(),{ArrayPrototypeSlice:ea,Error:Kd,FunctionPrototypeSymbolHasInstance:ta,ObjectDefineProperty:ra,ObjectDefineProperties:Yd,ObjectSetPrototypeOf:ia,StringPrototypeToLowerCase:Jd,Symbol:Xd,SymbolHasInstance:Zd}=N();ua.exports=v;v.WritableState=Mt;var{EventEmitter:eh}=vt(),Ct=dr().Stream,{Buffer:xr}=X(),Ir=We(),{addAbortSignal:th}=jt(),{getHighWaterMark:rh,getDefaultHighWaterMark:ih}=Pt(),{ERR_INVALID_ARG_TYPE:nh,ERR_METHOD_NOT_IMPLEMENTED:sh,ERR_MULTIPLE_CALLBACK:na,ERR_STREAM_CANNOT_PIPE:oh,ERR_STREAM_DESTROYED:Ot,ERR_STREAM_ALREADY_FINISHED:ah,ERR_STREAM_NULL_VALUES:lh,ERR_STREAM_WRITE_AFTER_END:uh,ERR_UNKNOWN_ENCODING:sa}=M().codes,{errorOrDestroy:_t}=Ir;ia(v.prototype,Ct.prototype);ia(v,Ct);function Oi(){}var bt=Xd("kOnFinished");function Mt(t,e,r){typeof r!="boolean"&&(r=e instanceof oe()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?rh(this,t,"writableHighWaterMark",r):ih(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let i=!!(t&&t.decodeStrings===!1);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=ch.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Sr(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[bt]=[]}function Sr(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Mt.prototype.getBuffer=function(){return ea(this.buffered,this.bufferedIndex)};ra(Mt.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function v(t){let e=this instanceof oe();if(!e&&!ta(v,this))return new v(t);this._writableState=new Mt(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&th(t.signal,this)),Ct.call(this,t),Ir.construct(this,()=>{let r=this._writableState;r.writing||Di(this,r),$i(this,r)})}ra(v,Zd,{__proto__:null,value:function(t){return ta(this,t)?!0:this!==v?!1:t&&t._writableState instanceof Mt}});v.prototype.pipe=function(){_t(this,new oh)};function oa(t,e,r,i){let n=t._writableState;if(typeof r=="function")i=r,r=n.defaultEncoding;else{if(!r)r=n.defaultEncoding;else if(r!=="buffer"&&!xr.isEncoding(r))throw new sa(r);typeof i!="function"&&(i=Oi)}if(e===null)throw new lh;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=xr.from(e,r),r="buffer");else if(e instanceof xr)r="buffer";else if(Ct._isUint8Array(e))e=Ct._uint8ArrayToBuffer(e),r="buffer";else throw new nh("chunk",["string","Buffer","Uint8Array"],e);let s;return n.ending?s=new uh:n.destroyed&&(s=new Ot("write")),s?(Qe.nextTick(i,s),_t(t,s,!0),s):(n.pendingcb++,fh(t,n,e,r,i))}v.prototype.write=function(t,e,r){return oa(this,t,e,r)===!0};v.prototype.cork=function(){this._writableState.corked++};v.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Di(this,t))};v.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=Jd(e)),!xr.isEncoding(e))throw new sa(e);return this._writableState.defaultEncoding=e,this};function fh(t,e,r,i,n){let s=e.objectMode?1:r.length;e.length+=s;let o=e.length<e.highWaterMark;return o||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:i,callback:n}),e.allBuffers&&i!=="buffer"&&(e.allBuffers=!1),e.allNoop&&n!==Oi&&(e.allNoop=!1)):(e.writelen=s,e.writecb=n,e.writing=!0,e.sync=!0,t._write(r,i,e.onwrite),e.sync=!1),o&&!e.errored&&!e.destroyed}function Xo(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Ot("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function Zo(t,e,r,i){--e.pendingcb,i(r),Mi(e),_t(t,r)}function ch(t,e){let r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function"){_t(t,new na);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),i?Qe.nextTick(Zo,t,r,e,n):Zo(t,r,e,n)):(r.buffered.length>r.bufferedIndex&&Di(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},Qe.nextTick(dh,r.afterWriteTickInfo)):aa(t,r,1,n))}function dh({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,aa(t,e,r,i)}function aa(t,e,r,i){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,i();e.destroyed&&Mi(e),$i(t,e)}function Mi(t){if(t.writing)return;for(let n=t.bufferedIndex;n<t.buffered.length;++n){var e;let{chunk:s,callback:o}=t.buffered[n],a=t.objectMode?1:s.length;t.length-=a,o((e=t.errored)!==null&&e!==void 0?e:new Ot("write"))}let r=t[bt].splice(0);for(let n=0;n<r.length;n++){var i;r[n]((i=t.errored)!==null&&i!==void 0?i:new Ot("end"))}Sr(t)}function Di(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:i,objectMode:n}=e,s=r.length-i;if(!s)return;let o=i;if(e.bufferProcessing=!0,s>1&&t._writev){e.pendingcb-=s-1;let a=e.allNoop?Oi:u=>{for(let f=o;f<r.length;++f)r[f].callback(u)},l=e.allNoop&&o===0?r:ea(r,o);l.allBuffers=e.allBuffers,Xo(t,e,!0,e.length,l,"",a),Sr(e)}else{do{let{chunk:a,encoding:l,callback:u}=r[o];r[o++]=null;let f=n?1:a.length;Xo(t,e,!1,f,a,l,u)}while(o<r.length&&!e.writing);o===r.length?Sr(e):o>256?(r.splice(0,o),e.bufferedIndex=0):e.bufferedIndex=o}e.bufferProcessing=!1}v.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new sh("_write()")};v.prototype._writev=null;v.prototype.end=function(t,e,r){let i=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let n;if(t!=null){let s=oa(this,t,e);s instanceof Kd&&(n=s)}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,$i(this,i,!0),i.ended=!0):i.finished?n=new ah("end"):i.destroyed&&(n=new Ot("end"))),typeof r=="function"&&(n||i.finished?Qe.nextTick(r,n):i[bt].push(r)),this};function Er(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function hh(t,e){let r=!1;function i(n){if(r){_t(t,n??na());return}if(r=!0,e.pendingcb--,n){let s=e[bt].splice(0);for(let o=0;o<s.length;o++)s[o](n);_t(t,n,e.sync)}else Er(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,Qe.nextTick(Ci,t,e))}e.sync=!0,e.pendingcb++;try{t._final(i)}catch(n){i(n)}e.sync=!1}function ph(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,hh(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function $i(t,e,r){Er(e)&&(ph(t,e),e.pendingcb===0&&(r?(e.pendingcb++,Qe.nextTick((i,n)=>{Er(n)?Ci(i,n):n.pendingcb--},t,e)):Er(e)&&(e.pendingcb++,Ci(t,e))))}function Ci(t,e){e.pendingcb--,e.finished=!0;let r=e[bt].splice(0);for(let i=0;i<r.length;i++)r[i]();if(t.emit("finish"),e.autoDestroy){let i=t._readableState;(!i||i.autoDestroy&&(i.endEmitted||i.readable===!1))&&t.destroy()}}Yd(v.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var _h=Ir.destroy;v.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[bt].length)&&Qe.nextTick(Mi,r),_h.call(this,t,e),this};v.prototype._undestroy=Ir.undestroy;v.prototype._destroy=function(t,e){e(t)};v.prototype[eh.captureRejectionSymbol]=function(t){this.destroy(t)};var Fi;function la(){return Fi===void 0&&(Fi={}),Fi}v.fromWeb=function(t,e){return la().newStreamWritableFromWritableStream(t,e)};v.toWeb=function(t){return la().newWritableStreamFromStreamWritable(t)}});var Ia=S((M_,Sa)=>{var ki=Re(),bh=X(),{isReadable:gh,isWritable:yh,isIterable:fa,isNodeStream:wh,isReadableNodeStream:ca,isWritableNodeStream:da,isDuplexNodeStream:mh,isReadableStream:ha,isWritableStream:pa}=ie(),_a=be(),{AbortError:xa,codes:{ERR_INVALID_ARG_TYPE:xh,ERR_INVALID_RETURN_VALUE:ba}}=M(),{destroyer:yt}=We(),Eh=oe(),Ea=Ft(),Sh=Rr(),{createDeferredPromise:ga}=$(),ya=Ri(),wa=globalThis.Blob||bh.Blob,Ih=typeof wa<"u"?function(e){return e instanceof wa}:function(e){return!1},Rh=globalThis.AbortController||ot().AbortController,{FunctionPrototypeCall:ma}=N(),Ne=class extends Eh{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};Sa.exports=function t(e,r){if(mh(e))return e;if(ca(e))return gt({readable:e});if(da(e))return gt({writable:e});if(wh(e))return gt({writable:!1,readable:!1});if(ha(e))return gt({readable:Ea.fromWeb(e)});if(pa(e))return gt({writable:Sh.fromWeb(e)});if(typeof e=="function"){let{value:n,write:s,final:o,destroy:a}=Th(e);if(fa(n))return ya(Ne,n,{objectMode:!0,write:s,final:o,destroy:a});let l=n?.then;if(typeof l=="function"){let u,f=ma(l,n,c=>{if(c!=null)throw new ba("nully","body",c)},c=>{yt(u,c)});return u=new Ne({objectMode:!0,readable:!1,write:s,final(c){o(async()=>{try{await f,ki.nextTick(c,null)}catch(_){ki.nextTick(c,_)}})},destroy:a})}throw new ba("Iterable, AsyncIterable or AsyncFunction",r,n)}if(Ih(e))return t(e.arrayBuffer());if(fa(e))return ya(Ne,e,{objectMode:!0,writable:!1});if(ha(e?.readable)&&pa(e?.writable))return Ne.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let n=e!=null&&e.readable?ca(e?.readable)?e?.readable:t(e.readable):void 0,s=e!=null&&e.writable?da(e?.writable)?e?.writable:t(e.writable):void 0;return gt({readable:n,writable:s})}let i=e?.then;if(typeof i=="function"){let n;return ma(i,e,s=>{s!=null&&n.push(s),n.push(null)},s=>{yt(n,s)}),n=new Ne({objectMode:!0,writable:!1,read(){}})}throw new xh(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function Th(t){let{promise:e,resolve:r}=ga(),i=new Rh,n=i.signal;return{value:t((async function*(){for(;;){let o=e;e=null;let{chunk:a,done:l,cb:u}=await o;if(ki.nextTick(u),l)return;if(n.aborted)throw new xa(void 0,{cause:n.reason});({promise:e,resolve:r}=ga()),yield a}})(),{signal:n}),write(o,a,l){let u=r;r=null,u({chunk:o,done:!1,cb:l})},final(o){let a=r;r=null,a({done:!0,cb:o})},destroy(o,a){i.abort(),a(o)}}}function gt(t){let e=t.readable&&typeof t.readable.read!="function"?Ea.wrap(t.readable):t.readable,r=t.writable,i=!!gh(e),n=!!yh(r),s,o,a,l,u;function f(c){let _=l;l=null,_?_(c):c&&u.destroy(c)}return u=new Ne({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(_a(r,c=>{n=!1,c&&yt(e,c),f(c)}),u._write=function(c,_,h){r.write(c,_)?h():s=h},u._final=function(c){r.end(),o=c},r.on("drain",function(){if(s){let c=s;s=null,c()}}),r.on("finish",function(){if(o){let c=o;o=null,c()}})),i&&(_a(e,c=>{i=!1,c&&yt(e,c),f(c)}),e.on("readable",function(){if(a){let c=a;a=null,c()}}),e.on("end",function(){u.push(null)}),u._read=function(){for(;;){let c=e.read();if(c===null){a=u._read;return}if(!u.push(c))return}}),u._destroy=function(c,_){!c&&l!==null&&(c=new xa),a=null,s=null,o=null,l===null?_(c):(l=_,yt(r,c),yt(e,c))},u}});var oe=S((D_,Aa)=>{"use strict";var{ObjectDefineProperties:Ah,ObjectGetOwnPropertyDescriptor:ge,ObjectKeys:Nh,ObjectSetPrototypeOf:Ra}=N();Aa.exports=K;var Wi=Ft(),H=Rr();Ra(K.prototype,Wi.prototype);Ra(K,Wi);{let t=Nh(H.prototype);for(let e=0;e<t.length;e++){let r=t[e];K.prototype[r]||(K.prototype[r]=H.prototype[r])}}function K(t){if(!(this instanceof K))return new K(t);Wi.call(this,t),H.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}Ah(K.prototype,{writable:{__proto__:null,...ge(H.prototype,"writable")},writableHighWaterMark:{__proto__:null,...ge(H.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...ge(H.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...ge(H.prototype,"writableBuffer")},writableLength:{__proto__:null,...ge(H.prototype,"writableLength")},writableFinished:{__proto__:null,...ge(H.prototype,"writableFinished")},writableCorked:{__proto__:null,...ge(H.prototype,"writableCorked")},writableEnded:{__proto__:null,...ge(H.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...ge(H.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var qi;function Ta(){return qi===void 0&&(qi={}),qi}K.fromWeb=function(t,e){return Ta().newStreamDuplexFromReadableWritablePair(t,e)};K.toWeb=function(t){return Ta().newReadableWritablePairFromDuplex(t)};var Ui;K.from=function(t){return Ui||(Ui=Ia()),Ui(t,"body")}});var Qi=S(($_,va)=>{"use strict";var{ObjectSetPrototypeOf:Na,Symbol:vh}=N();va.exports=ye;var{ERR_METHOD_NOT_IMPLEMENTED:jh}=M().codes,Vi=oe(),{getHighWaterMark:Ph}=Pt();Na(ye.prototype,Vi.prototype);Na(ye,Vi);var Dt=vh("kCallback");function ye(t){if(!(this instanceof ye))return new ye(t);let e=t?Ph(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),Vi.call(this,t),this._readableState.sync=!1,this[Dt]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",Lh)}function Gi(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function Lh(){this._final!==Gi&&Gi.call(this)}ye.prototype._final=Gi;ye.prototype._transform=function(t,e,r){throw new jh("_transform()")};ye.prototype._write=function(t,e,r){let i=this._readableState,n=this._writableState,s=i.length;this._transform(t,e,(o,a)=>{if(o){r(o);return}a!=null&&this.push(a),n.ended||s===i.length||i.length<i.highWaterMark?r():this[Dt]=r})};ye.prototype._read=function(){if(this[Dt]){let t=this[Dt];this[Dt]=null,t()}}});var zi=S((k_,Pa)=>{"use strict";var{ObjectSetPrototypeOf:ja}=N();Pa.exports=wt;var Hi=Qi();ja(wt.prototype,Hi.prototype);ja(wt,Hi);function wt(t){if(!(this instanceof wt))return new wt(t);Hi.call(this,t)}wt.prototype._transform=function(t,e,r){r(null,t)}});var vr=S((q_,Oa)=>{var $t=Re(),{ArrayIsArray:Bh,Promise:Fh,SymbolAsyncIterator:Ch,SymbolDispose:Oh}=N(),Nr=be(),{once:Mh}=$(),Dh=We(),La=oe(),{aggregateTwoErrors:$h,codes:{ERR_INVALID_ARG_TYPE:nn,ERR_INVALID_RETURN_VALUE:Ki,ERR_MISSING_ARGS:kh,ERR_STREAM_DESTROYED:qh,ERR_STREAM_PREMATURE_CLOSE:Uh},AbortError:Wh}=M(),{validateFunction:Gh,validateAbortSignal:Vh}=ut(),{isIterable:He,isReadable:Yi,isReadableNodeStream:Ar,isNodeStream:Ba,isTransformStream:mt,isWebStream:Qh,isReadableStream:Ji,isReadableFinished:Hh}=ie(),zh=globalThis.AbortController||ot().AbortController,Xi,Zi,en;function Fa(t,e,r){let i=!1;t.on("close",()=>{i=!0});let n=Nr(t,{readable:e,writable:r},s=>{i=!s});return{destroy:s=>{i||(i=!0,Dh.destroyer(t,s||new qh("pipe")))},cleanup:n}}function Kh(t){return Gh(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function tn(t){if(He(t))return t;if(Ar(t))return Yh(t);throw new nn("val",["Readable","Iterable","AsyncIterable"],t)}async function*Yh(t){Zi||(Zi=Ft()),yield*Zi.prototype[Ch].call(t)}async function Tr(t,e,r,{end:i}){let n,s=null,o=u=>{if(u&&(n=u),s){let f=s;s=null,f()}},a=()=>new Fh((u,f)=>{n?f(n):s=()=>{n?f(n):u()}});e.on("drain",o);let l=Nr(e,{readable:!1},o);try{e.writableNeedDrain&&await a();for await(let u of t)e.write(u)||await a();i&&(e.end(),await a()),r()}catch(u){r(n!==u?$h(n,u):u)}finally{l(),e.off("drain",o)}}async function rn(t,e,r,{end:i}){mt(e)&&(e=e.writable);let n=e.getWriter();try{for await(let s of t)await n.ready,n.write(s).catch(()=>{});await n.ready,i&&await n.close(),r()}catch(s){try{await n.abort(s),r(s)}catch(o){r(o)}}}function Jh(...t){return Ca(t,Mh(Kh(t)))}function Ca(t,e,r){if(t.length===1&&Bh(t[0])&&(t=t[0]),t.length<2)throw new kh("streams");let i=new zh,n=i.signal,s=r?.signal,o=[];Vh(s,"options.signal");function a(){b(new Wh)}en=en||$().addAbortListener;let l;s&&(l=en(s,a));let u,f,c=[],_=0;function h(A){b(A,--_===0)}function b(A,w){var L;if(A&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=A),!(!u&&!w)){for(;c.length;)c.shift()(u);(L=l)===null||L===void 0||L[Oh](),i.abort(),w&&(u||o.forEach(Pe=>Pe()),$t.nextTick(e,u,f))}}let p;for(let A=0;A<t.length;A++){let w=t[A],L=A<t.length-1,Pe=A>0,G=L||r?.end!==!1,Je=A===t.length-1;if(Ba(w)){let k=function(ue){ue&&ue.name!=="AbortError"&&ue.code!=="ERR_STREAM_PREMATURE_CLOSE"&&h(ue)};var E=k;if(G){let{destroy:ue,cleanup:Cr}=Fa(w,L,Pe);c.push(ue),Yi(w)&&Je&&o.push(Cr)}w.on("error",k),Yi(w)&&Je&&o.push(()=>{w.removeListener("error",k)})}if(A===0)if(typeof w=="function"){if(p=w({signal:n}),!He(p))throw new Ki("Iterable, AsyncIterable or Stream","source",p)}else He(w)||Ar(w)||mt(w)?p=w:p=La.from(w);else if(typeof w=="function"){if(mt(p)){var y;p=tn((y=p)===null||y===void 0?void 0:y.readable)}else p=tn(p);if(p=w(p,{signal:n}),L){if(!He(p,!0))throw new Ki("AsyncIterable",`transform[${A-1}]`,p)}else{var g;Xi||(Xi=zi());let k=new Xi({objectMode:!0}),ue=(g=p)===null||g===void 0?void 0:g.then;if(typeof ue=="function")_++,ue.call(p,me=>{f=me,me!=null&&k.write(me),G&&k.end(),$t.nextTick(h)},me=>{k.destroy(me),$t.nextTick(h,me)});else if(He(p,!0))_++,Tr(p,k,h,{end:G});else if(Ji(p)||mt(p)){let me=p.readable||p;_++,Tr(me,k,h,{end:G})}else throw new Ki("AsyncIterable or Promise","destination",p);p=k;let{destroy:Cr,cleanup:_l}=Fa(p,!1,!0);c.push(Cr),Je&&o.push(_l)}}else if(Ba(w)){if(Ar(p)){_+=2;let k=Xh(p,w,h,{end:G});Yi(w)&&Je&&o.push(k)}else if(mt(p)||Ji(p)){let k=p.readable||p;_++,Tr(k,w,h,{end:G})}else if(He(p))_++,Tr(p,w,h,{end:G});else throw new nn("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],p);p=w}else if(Qh(w)){if(Ar(p))_++,rn(tn(p),w,h,{end:G});else if(Ji(p)||He(p))_++,rn(p,w,h,{end:G});else if(mt(p))_++,rn(p.readable,w,h,{end:G});else throw new nn("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],p);p=w}else p=La.from(w)}return(n!=null&&n.aborted||s!=null&&s.aborted)&&$t.nextTick(a),p}function Xh(t,e,r,{end:i}){let n=!1;if(e.on("close",()=>{n||r(new Uh)}),t.pipe(e,{end:!1}),i){let o=function(){n=!0,e.end()};var s=o;Hh(t)?$t.nextTick(o):t.once("end",o)}else r();return Nr(t,{readable:!0,writable:!1},o=>{let a=t._readableState;o&&o.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted?t.once("end",r).once("error",r):r(o)}),Nr(e,{readable:!1,writable:!0},r)}Oa.exports={pipelineImpl:Ca,pipeline:Jh}});var on=S((U_,Ua)=>{"use strict";var{pipeline:Zh}=vr(),jr=oe(),{destroyer:ep}=We(),{isNodeStream:Pr,isReadable:Ma,isWritable:Da,isWebStream:sn,isTransformStream:ze,isWritableStream:$a,isReadableStream:ka}=ie(),{AbortError:tp,codes:{ERR_INVALID_ARG_VALUE:qa,ERR_MISSING_ARGS:rp}}=M(),ip=be();Ua.exports=function(...e){if(e.length===0)throw new rp("streams");if(e.length===1)return jr.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=jr.from(e[0])),typeof e[e.length-1]=="function"){let h=e.length-1;e[h]=jr.from(e[h])}for(let h=0;h<e.length;++h)if(!(!Pr(e[h])&&!sn(e[h]))){if(h<e.length-1&&!(Ma(e[h])||ka(e[h])||ze(e[h])))throw new qa(`streams[${h}]`,r[h],"must be readable");if(h>0&&!(Da(e[h])||$a(e[h])||ze(e[h])))throw new qa(`streams[${h}]`,r[h],"must be writable")}let i,n,s,o,a;function l(h){let b=o;o=null,b?b(h):h?a.destroy(h):!_&&!c&&a.destroy()}let u=e[0],f=Zh(e,l),c=!!(Da(u)||$a(u)||ze(u)),_=!!(Ma(f)||ka(f)||ze(f));if(a=new jr({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(f!=null&&f.readableObjectMode),writable:c,readable:_}),c){if(Pr(u))a._write=function(b,p,y){u.write(b,p)?y():i=y},a._final=function(b){u.end(),n=b},u.on("drain",function(){if(i){let b=i;i=null,b()}});else if(sn(u)){let p=(ze(u)?u.writable:u).getWriter();a._write=async function(y,g,E){try{await p.ready,p.write(y).catch(()=>{}),E()}catch(A){E(A)}},a._final=async function(y){try{await p.ready,p.close().catch(()=>{}),n=y}catch(g){y(g)}}}let h=ze(f)?f.readable:f;ip(h,()=>{if(n){let b=n;n=null,b()}})}if(_){if(Pr(f))f.on("readable",function(){if(s){let h=s;s=null,h()}}),f.on("end",function(){a.push(null)}),a._read=function(){for(;;){let h=f.read();if(h===null){s=a._read;return}if(!a.push(h))return}};else if(sn(f)){let b=(ze(f)?f.readable:f).getReader();a._read=async function(){for(;;)try{let{value:p,done:y}=await b.read();if(!a.push(p))return;if(y){a.push(null);return}}catch{return}}}}return a._destroy=function(h,b){!h&&o!==null&&(h=new tp),s=null,i=null,n=null,o===null?b(h):(o=b,Pr(f)&&ep(f,h))},a}});var Xa=S((W_,un)=>{"use strict";var np=globalThis.AbortController||ot().AbortController,{codes:{ERR_INVALID_ARG_VALUE:sp,ERR_INVALID_ARG_TYPE:kt,ERR_MISSING_ARGS:op,ERR_OUT_OF_RANGE:ap},AbortError:ae}=M(),{validateAbortSignal:Ke,validateInteger:Wa,validateObject:Ye}=ut(),lp=N().Symbol("kWeak"),up=N().Symbol("kResistStopPropagation"),{finished:fp}=be(),cp=on(),{addAbortSignalNoValidate:dp}=jt(),{isWritable:hp,isNodeStream:pp}=ie(),{deprecate:_p}=$(),{ArrayPrototypePush:bp,Boolean:gp,MathFloor:Ga,Number:yp,NumberIsNaN:wp,Promise:Va,PromiseReject:Qa,PromiseResolve:mp,PromisePrototypeThen:Ha,Symbol:Ka}=N(),Lr=Ka("kEmpty"),za=Ka("kEof");function xp(t,e){if(e!=null&&Ye(e,"options"),e?.signal!=null&&Ke(e.signal,"options.signal"),pp(t)&&!hp(t))throw new sp("stream",t,"must be writable");let r=cp(this,t);return e!=null&&e.signal&&dp(e.signal,r),r}function Br(t,e){if(typeof t!="function")throw new kt("fn",["Function","AsyncFunction"],t);e!=null&&Ye(e,"options"),e?.signal!=null&&Ke(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Ga(e.concurrency));let i=r-1;return e?.highWaterMark!=null&&(i=Ga(e.highWaterMark)),Wa(r,"options.concurrency",1),Wa(i,"options.highWaterMark",0),i+=r,async function*(){let s=$().AbortSignalAny([e?.signal].filter(gp)),o=this,a=[],l={signal:s},u,f,c=!1,_=0;function h(){c=!0,b()}function b(){_-=1,p()}function p(){f&&!c&&_<r&&a.length<i&&(f(),f=null)}async function y(){try{for await(let g of o){if(c)return;if(s.aborted)throw new ae;try{if(g=t(g,l),g===Lr)continue;g=mp(g)}catch(E){g=Qa(E)}_+=1,Ha(g,b,h),a.push(g),u&&(u(),u=null),!c&&(a.length>=i||_>=r)&&await new Va(E=>{f=E})}a.push(za)}catch(g){let E=Qa(g);Ha(E,b,h),a.push(E)}finally{c=!0,u&&(u(),u=null)}}y();try{for(;;){for(;a.length>0;){let g=await a[0];if(g===za)return;if(s.aborted)throw new ae;g!==Lr&&(yield g),a.shift(),p()}await new Va(g=>{u=g})}}finally{c=!0,f&&(f(),f=null)}}.call(this)}function Ep(t=void 0){return t!=null&&Ye(t,"options"),t?.signal!=null&&Ke(t.signal,"options.signal"),async function*(){let r=0;for await(let n of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new ae({cause:t.signal.reason});yield[r++,n]}}.call(this)}async function Ya(t,e=void 0){for await(let r of ln.call(this,t,e))return!0;return!1}async function Sp(t,e=void 0){if(typeof t!="function")throw new kt("fn",["Function","AsyncFunction"],t);return!await Ya.call(this,async(...r)=>!await t(...r),e)}async function Ip(t,e){for await(let r of ln.call(this,t,e))return r}async function Rp(t,e){if(typeof t!="function")throw new kt("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n),Lr}for await(let i of Br.call(this,r,e));}function ln(t,e){if(typeof t!="function")throw new kt("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n)?i:Lr}return Br.call(this,r,e)}var an=class extends op{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function Tp(t,e,r){var i;if(typeof t!="function")throw new kt("reducer",["Function","AsyncFunction"],t);r!=null&&Ye(r,"options"),r?.signal!=null&&Ke(r.signal,"options.signal");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let u=new ae(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await fp(this.destroy(u)),u}let s=new np,o=s.signal;if(r!=null&&r.signal){let u={once:!0,[lp]:this,[up]:!0};r.signal.addEventListener("abort",()=>s.abort(),u)}let a=!1;try{for await(let u of this){var l;if(a=!0,r!=null&&(l=r.signal)!==null&&l!==void 0&&l.aborted)throw new ae;n?e=await t(e,u,{signal:o}):(e=u,n=!0)}if(!a&&!n)throw new an}finally{s.abort()}return e}async function Ap(t){t!=null&&Ye(t,"options"),t?.signal!=null&&Ke(t.signal,"options.signal");let e=[];for await(let i of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new ae(void 0,{cause:t.signal.reason});bp(e,i)}return e}function Np(t,e){let r=Br.call(this,t,e);return async function*(){for await(let n of r)yield*n}.call(this)}function Ja(t){if(t=yp(t),wp(t))return 0;if(t<0)throw new ap("number",">= 0",t);return t}function vp(t,e=void 0){return e!=null&&Ye(e,"options"),e?.signal!=null&&Ke(e.signal,"options.signal"),t=Ja(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new ae;for await(let s of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new ae;t--<=0&&(yield s)}}.call(this)}function jp(t,e=void 0){return e!=null&&Ye(e,"options"),e?.signal!=null&&Ke(e.signal,"options.signal"),t=Ja(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new ae;for await(let s of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new ae;if(t-- >0&&(yield s),t<=0)return}}.call(this)}un.exports.streamReturningOperators={asIndexedPairs:_p(Ep,"readable.asIndexedPairs will be removed in a future version."),drop:vp,filter:ln,flatMap:Np,map:Br,take:jp,compose:xp};un.exports.promiseReturningOperators={every:Sp,forEach:Rp,reduce:Tp,toArray:Ap,some:Ya,find:Ip}});var fn=S((G_,Za)=>{"use strict";var{ArrayPrototypePop:Pp,Promise:Lp}=N(),{isIterable:Bp,isNodeStream:Fp,isWebStream:Cp}=ie(),{pipelineImpl:Op}=vr(),{finished:Mp}=be();cn();function Dp(...t){return new Lp((e,r)=>{let i,n,s=t[t.length-1];if(s&&typeof s=="object"&&!Fp(s)&&!Bp(s)&&!Cp(s)){let o=Pp(t);i=o.signal,n=o.end}Op(t,(o,a)=>{o?r(o):e(a)},{signal:i,end:n})})}Za.exports={finished:Mp,pipeline:Dp}});var cn=S((V_,ll)=>{"use strict";var{Buffer:$p}=X(),{ObjectDefineProperty:we,ObjectKeys:rl,ReflectApply:il}=N(),{promisify:{custom:nl}}=$(),{streamReturningOperators:el,promiseReturningOperators:tl}=Xa(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:sl}}=M(),kp=on(),{setDefaultHighWaterMark:qp,getDefaultHighWaterMark:Up}=Pt(),{pipeline:ol}=vr(),{destroyer:Wp}=We(),al=be(),dn=fn(),qt=ie(),T=ll.exports=dr().Stream;T.isDestroyed=qt.isDestroyed;T.isDisturbed=qt.isDisturbed;T.isErrored=qt.isErrored;T.isReadable=qt.isReadable;T.isWritable=qt.isWritable;T.Readable=Ft();for(let t of rl(el)){let r=function(...i){if(new.target)throw sl();return T.Readable.from(il(e,this,i))},e=el[t];we(r,"name",{__proto__:null,value:e.name}),we(r,"length",{__proto__:null,value:e.length}),we(T.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of rl(tl)){let r=function(...i){if(new.target)throw sl();return il(e,this,i)},e=tl[t];we(r,"name",{__proto__:null,value:e.name}),we(r,"length",{__proto__:null,value:e.length}),we(T.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}T.Writable=Rr();T.Duplex=oe();T.Transform=Qi();T.PassThrough=zi();T.pipeline=ol;var{addAbortSignal:Gp}=jt();T.addAbortSignal=Gp;T.finished=al;T.destroy=Wp;T.compose=kp;T.setDefaultHighWaterMark=qp;T.getDefaultHighWaterMark=Up;we(T,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return dn}});we(ol,nl,{__proto__:null,enumerable:!0,get(){return dn.pipeline}});we(al,nl,{__proto__:null,enumerable:!0,get(){return dn.finished}});T.Stream=T;T._isUint8Array=function(e){return e instanceof Uint8Array};T._uint8ArrayToBuffer=function(e){return $p.from(e.buffer,e.byteOffset,e.byteLength)}});var Fr=S((Q_,P)=>{"use strict";var F=cn(),Vp=fn(),Qp=F.Readable.destroy;P.exports=F.Readable;P.exports._uint8ArrayToBuffer=F._uint8ArrayToBuffer;P.exports._isUint8Array=F._isUint8Array;P.exports.isDisturbed=F.isDisturbed;P.exports.isErrored=F.isErrored;P.exports.isReadable=F.isReadable;P.exports.Readable=F.Readable;P.exports.Writable=F.Writable;P.exports.Duplex=F.Duplex;P.exports.Transform=F.Transform;P.exports.PassThrough=F.PassThrough;P.exports.addAbortSignal=F.addAbortSignal;P.exports.finished=F.finished;P.exports.destroy=F.destroy;P.exports.destroy=Qp;P.exports.pipeline=F.pipeline;P.exports.compose=F.compose;Object.defineProperty(F,"promises",{configurable:!0,enumerable:!0,get(){return Vp}});P.exports.Stream=F.Stream;P.exports.default=P.exports});var Dn=zt(X());var Fe="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Et="http://www.w3.org/2001/XMLSchema#",Xt="http://www.w3.org/2000/10/swap/",R={xsd:{decimal:`${Et}decimal`,boolean:`${Et}boolean`,double:`${Et}double`,integer:`${Et}integer`,string:`${Et}string`},rdf:{type:`${Fe}type`,nil:`${Fe}nil`,first:`${Fe}first`,rest:`${Fe}rest`,langString:`${Fe}langString`,dirLangString:`${Fe}dirLangString`,reifies:`${Fe}reifies`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${Xt}reify#forSome`,forAll:`${Xt}reify#forAll`},log:{implies:`${Xt}log#implies`,isImpliedBy:`${Xt}log#isImpliedBy`}};var{xsd:Zt}=R,tu=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,On={"\\":"\\","'":"'",'"':'"',n:`
3
- `,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},ru=/[\x00-\x20<>\\"\{\}\|\^\`]/;function Mn(t){return t<=1114111&&(t<55296||t>57343)}var iu={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_dircode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},nu=/$0^/,Ce=class{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9])/i,this._dircode=/^--(?:(ltr)|(rtl))/,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._atKeyword=/^@[a-z]+(?=[\s#<:])/i,this._keyword=/^(?:PREFIX|BASE|VERSION|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e=e||{},this._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(let r in this)!(r in iu)&&this[r]instanceof RegExp&&(this[r]=nu)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,r){let i=this._input,n=i.length;for(;;){let a,l;for(;a=this._newline.exec(i);)this.comments&&(l=this._comment.exec(a[0]))&&s("comment",l[1],"",this._line,a[0].length),i=i.substr(a[0].length,i.length),n=i.length,this._line++;if(!a&&(a=this._whitespace.exec(i))&&(i=i.substr(a[0].length,i.length)),this._endOfFile.test(i))return r&&(this.comments&&(l=this._comment.exec(i))&&s("comment",l[1],"",this._line,i.length),i=null,s("eof","","",this._line,0)),this._input=i;let u=this._line,f=i[0],c="",_="",h="",b=null,p=0,y=!1;switch(f){case"^":if(i.length<3)break;if(i[1]==="^"){if(this._previousMarker="^^",i=i.substr(2),i[0]!=="<"){y=!0;break}}else{this._n3Mode&&(p=1,c="^");break}case"<":if(b=this._unescapedIri.exec(i))c="IRI",_=b[1];else if(b=this._iri.exec(i)){if(_=this._unescape(b[1]),_===null||ru.test(_))return o(this);c="IRI"}else i.length>2&&i[1]==="<"&&i[2]==="("?(c="<<(",p=3):!this._lineMode&&i.length>(r?1:2)&&i[1]==="<"?(c="<<",p=2):this._n3Mode&&i.length>1&&i[1]==="="&&(p=2,this._isImpliedBy?(c="abbreviation",_="<"):(c="inverse",_=">"));break;case">":i.length>1&&i[1]===">"&&(c=">>",p=2);break;case"_":((b=this._blank.exec(i))||r&&(b=this._blank.exec(`${i} `)))&&(c="blank",h="_",_=b[1]);break;case'"':if(b=this._simpleQuotedString.exec(i))_=b[1];else if({value:_,matchLength:p}=this._parseLiteral(i),_===null)return o(this);(b!==null||p!==0)&&(c="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(b=this._simpleApostropheString.exec(i))_=b[1];else if({value:_,matchLength:p}=this._parseLiteral(i),_===null)return o(this);(b!==null||p!==0)&&(c="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(b=this._variable.exec(i))&&(c="var",_=b[0]);break;case"@":this._previousMarker==="literal"&&(b=this._langcode.exec(i))&&b[1]!=="version"?!r&&i[b[0].length]==="-"&&i[b[0].length+1]!=="-"?b=null:(c="langcode",_=b[1]):(b=this._atKeyword.exec(i))&&(c=b[0]);break;case".":if(i.length===1?r:i[1]<"0"||i[1]>"9"){c=".",p=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":if(i[1]==="-"){this._previousMarker==="langcode"&&(b=this._dircode.exec(i))&&(c="dircode",p=2,_=b[1]||b[2],p=_.length+2);break}(b=this._number.exec(i)||r&&(b=this._number.exec(`${i} `)))&&(c="literal",_=b[0],h=typeof b[1]=="string"?Zt.double:typeof b[2]=="string"?Zt.decimal:Zt.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":case"V":case"v":(b=this._keyword.exec(i))?c=b[0].toUpperCase():y=!0;break;case"f":case"t":(b=this._boolean.exec(i))?(c="literal",_=b[0],h=Zt.boolean):y=!0;break;case"a":(b=this._shortPredicates.exec(i))?(c="abbreviation",_="a"):y=!0;break;case"=":this._n3Mode&&i.length>1&&(c="abbreviation",i[1]!==">"?(p=1,_="="):(p=2,_=">"));break;case"!":if(!this._n3Mode)break;case")":if(!r&&(i.length===1||i.length===2&&i[1]===">"))break;if(i.length>2&&i[1]===">"&&i[2]===">"){c=")>>",p=3;break}case",":case";":case"[":case"]":case"(":case"}":case"~":this._lineMode||(p=1,c=f);break;case"{":!this._lineMode&&i.length>=2&&(i[1]==="|"?(c="{|",p=2):(c=f,p=1));break;case"|":i.length>=2&&i[1]==="}"&&(c="|}",p=2);break;default:y=!0}if(y&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(b=this._prefix.exec(i))?(c="prefix",_=b[1]||""):((b=this._prefixed.exec(i))||r&&(b=this._prefixed.exec(`${i} `)))&&(c="prefixed",h=b[1]||"",_=this._unescape(b[2]))),this._previousMarker==="^^")switch(c){case"prefixed":c="type";break;case"IRI":c="typeIRI";break;default:c=""}if(!c)return r||!/^'''|^"""/.test(i)&&/\n|\r/.test(i)?o(this):this._input=i;let g=p||b[0].length,E=s(c,_,h,u,g);this.previousToken=E,this._previousMarker=c,i=i.substr(g,i.length)}function s(a,l,u,f,c){let _=i?n-i.length:n,h=_+c,b={type:a,value:l,prefix:u,line:f,start:_,end:h};return e(null,b),b}function o(a){e(a._syntaxError(/^\S*/.exec(i)[0]))}}_unescape(e){let r=!1,i=e.replace(tu,(n,s,o,a)=>{if(typeof s=="string"){let l=Number.parseInt(s,16);return Mn(l)?String.fromCharCode(l):(r=!0,"")}if(typeof o=="string"){let l=Number.parseInt(o,16);return Mn(l)?l<=65535?String.fromCharCode(Number.parseInt(o,16)):String.fromCharCode(55296+((l-=65536)>>10),56320+(l&1023)):(r=!0,"")}return a in On?On[a]:(r=!0,"")});return r?null:i}_parseLiteral(e){if(e.length>=3){let r=e.match(/^(?:"""|"|'''|'|)/)[0],i=r.length,n=Math.max(this._literalClosingPos,i);for(;(n=e.indexOf(r,n))>0;){let s=0;for(;e[n-s-1]==="\\";)s++;if(s%2===0){let o=e.substring(i,n),a=o.split(/\r\n|\r|\n/).length-1,l=n+i;if(i===1&&a!==0||i===3&&this._lineMode)break;return this._line+=a,{value:this._unescape(o),matchLength:l}}n++}this._literalClosingPos=e.length-i+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;let r=new Error(`Unexpected "${e}" on line ${this._line}.`);return r.context={token:void 0,line:this._line,previousToken:this.previousToken},r}_readStartingBom(e){return e.startsWith("\uFEFF")?e.substr(1):e}tokenize(e,r){if(this._line=1,typeof e=="string")if(this._input=this._readStartingBom(e),typeof r=="function")queueMicrotask(()=>this._tokenizeToEnd(r,!0));else{let i=[],n;if(this._tokenizeToEnd((s,o)=>s?n=s:i.push(o),!0),n)throw n;return i}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",i=>{this._input!==null&&i.length!==0&&(this._pendingBuffer&&(i=Dn.Buffer.concat([this._pendingBuffer,i]),this._pendingBuffer=null),i[i.length-1]&128?this._pendingBuffer=i:(typeof this._input>"u"?this._input=this._readStartingBom(typeof i=="string"?i:i.toString()):this._input+=i,this._tokenizeToEnd(r,!1)))}),e.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(r,!0)}),e.on("error",r)}};var{rdf:$n,xsd:Oe}=R,it,su=0;var Hr={namedNode:kn,blankNode:qn,variable:Wn,literal:Un,defaultGraph:ou,quad:zr,triple:zr,fromTerm:St,fromQuad:Gn},W=Hr,U=class t{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof t?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}},rt=class extends U{constructor(e){super(e)}get termType(){return"NamedNode"}},ce=class t extends U{constructor(e){super(e)}get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){let e=this.id,r=e.lastIndexOf('"')+1,i=e.lastIndexOf("--");return r<e.length&&e[r++]==="@"?(i>r?e.substr(0,i):e).substr(r).toLowerCase():""}get direction(){let e=this.id,r=e.lastIndexOf('"'),i=e.lastIndexOf("--");return i>r&&i+2<e.length?e.substr(i+2).toLowerCase():""}get datatype(){return new rt(this.datatypeString)}get datatypeString(){let e=this.id,r=e.lastIndexOf('"')+1,i=r<e.length?e[r]:"";return i==="^"?e.substr(r+2):i!=="@"?Oe.string:e.indexOf("--",r)>0?$n.dirLangString:$n.langString}equals(e){return e instanceof t?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&(this.direction===e.direction||this.direction===""&&!e.direction)&&this.datatype.value===e.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,direction:this.direction,datatype:{termType:"NamedNode",value:this.datatypeString}}}},It=class extends U{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},Rt=class extends U{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},Tt=class extends U{constructor(){return super(""),it||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};it=new Tt;function Ee(t,e,r){if(e=e||Hr,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===Hr)return new ce(t);if(t[t.length-1]==='"')return e.literal(t.substr(1,t.length-2));let i=t.lastIndexOf('"',t.length-1),n;if(t[i+1]==="@"){n=t.substr(i+2);let s=n.lastIndexOf("--");s>0&&s<n.length&&(n={language:n.substr(0,s),direction:n.substr(s+2)})}else n=e.namedNode(t.substr(i+3));return e.literal(t.substr(1,i-1),n);case"[":t=JSON.parse(t);break;default:if(!r||!Array.isArray(t))return e.namedNode(t)}return e.quad(Ee(t[0],e,!0),Ee(t[1],e,!0),Ee(t[2],e,!0),t[3]&&Ee(t[3],e,!0))}function de(t,e){if(typeof t=="string")return t;if(t instanceof U&&t.termType!=="Quad")return t.id;if(!t)return it.id;switch(t.termType){case"NamedNode":return t.value;case"BlankNode":return`_:${t.value}`;case"Variable":return`?${t.value}`;case"DefaultGraph":return"";case"Literal":return`"${t.value}"${t.language?`@${t.language}${t.direction?`--${t.direction}`:""}`:t.datatype&&t.datatype.value!==Oe.string?`^^${t.datatype.value}`:""}`;case"Quad":let r=[de(t.subject,!0),de(t.predicate,!0),de(t.object,!0)];return t.graph&&t.graph.termType!=="DefaultGraph"&&r.push(de(t.graph,!0)),e?r:JSON.stringify(r);default:throw new Error(`Unexpected termType: ${t.termType}`)}}var Se=class extends U{constructor(e,r,i,n){super(""),this._subject=e,this._predicate=r,this._object=i,this._graph=n||it}get termType(){return"Quad"}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}get graph(){return this._graph}toJSON(){return{termType:this.termType,subject:this._subject.toJSON(),predicate:this._predicate.toJSON(),object:this._object.toJSON(),graph:this._graph.toJSON()}}equals(e){return!!e&&this._subject.equals(e.subject)&&this._predicate.equals(e.predicate)&&this._object.equals(e.object)&&this._graph.equals(e.graph)}};function kn(t){return new rt(t)}function qn(t){return new It(t||`n3-${su++}`)}function Un(t,e){if(typeof e=="string")return new ce(`"${t}"@${e.toLowerCase()}`);if(e!==void 0&&!("termType"in e))return new ce(`"${t}"@${e.language.toLowerCase()}${e.direction?`--${e.direction.toLowerCase()}`:""}`);let r=e?e.value:"";return r===""&&(typeof t=="boolean"?r=Oe.boolean:typeof t=="number"&&(Number.isFinite(t)?r=Number.isInteger(t)?Oe.integer:Oe.double:(r=Oe.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),r===""||r===Oe.string?new ce(`"${t}"`):new ce(`"${t}"^^${r}`)}function Wn(t){return new Rt(t)}function ou(){return it}function zr(t,e,r,i){return new Se(t,e,r,i)}function St(t){if(t instanceof U)return t;switch(t.termType){case"NamedNode":return kn(t.value);case"BlankNode":return qn(t.value);case"Variable":return Wn(t.value);case"DefaultGraph":return it;case"Literal":return Un(t.value,t.language||t.datatype);case"Quad":return Gn(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function Gn(t){if(t instanceof Se)return t;if(t.termType!=="Quad")throw new Error(`Unexpected termType: ${t.termType}`);return zr(St(t.subject),St(t.predicate),St(t.object),St(t.graph))}var Vn=0,he=class t{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Qn(this,e.factory);let r=typeof e.format=="string"?e.format.match(/\w*$/)[0].toLowerCase():"",i=/turtle/.test(r),n=/trig/.test(r),s=/triple/.test(r),o=/quad/.test(r),a=this._n3Mode=/n3/.test(r),l=s||o;(this._supportsNamedGraphs=!(i||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(i||n||s||a),this._isImpliedBy=e.isImpliedBy,l&&(this._resolveRelativeIRI=u=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new Ce({lineMode:l,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers,this._parseUnsupportedVersions=!!e.parseUnsupportedVersions,this._version=e.version}static _resetBlankNodePrefix(){Vn=0}_setBase(e){if(!e)this._base="",this._basePath="";else{let r=e.indexOf("#");r>=0&&(e=e.substr(0,r)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}}_saveContext(e,r,i,n,s){let o=this._n3Mode;this._contextStack.push({type:e,subject:i,predicate:n,object:s,graph:r,inverse:o?this._inversePredicate:!1,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(e,r){let i=this._contextStack.pop();if(!i||i.type!==e)return this._error(`Unexpected ${r.type}`,r);this._subject=i.subject,this._predicate=i.predicate,this._object=i.object,this._graph=i.graph,this._n3Mode&&(this._inversePredicate=i.inverse,this._prefixes._=i.blankPrefix,this._quantified=i.quantified)}_readBeforeTopContext(e){return this._version&&!this._isValidVersion(this._version)?this._error(`Detected unsupported version as media type parameter: "${this._version}"`,e):this._readInTopContext(e)}_readInTopContext(e){switch(e.type){case"eof":return this._graph!==null?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"VERSION":this._sparqlStyle=!0;case"@version":return this._readVersion;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,r){let i;switch(e.type){case"IRI":case"typeIRI":let n=this._resolveIRI(e.value);if(n===null)return this._error("Invalid IRI",e);i=this._factory.namedNode(n);break;case"type":case"prefixed":let s=this._prefixes[e.prefix];if(s===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);i=this._factory.namedNode(s+e.value);break;case"blank":i=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case"var":i=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!r&&this._n3Mode&&i.id in this._quantified&&(i=this._quantified[i.id]),i}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":let r=this._contextStack;return(r.length&&r[r.length-1]).type==="<<"?this._error("Unexpected list in reified triple",e):(this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._factory.blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(e.prefix.length===0)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"<<(":return this._n3Mode?(this._saveContext("<<(",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Disallowed triple term as subject",e);case"<<":return this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject;default:if((this._subject=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){let r=e.type;switch(r){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":case"|}":return this._predicate===null?this._error(`Unexpected ${r}`,e):(this._subject=null,r==="]"?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return this._predicate!==null?this._readPredicate:this._error("Expected predicate but got ;",e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(e.prefix.length===0)return this._literalValue=e.value,this._completePredicateLiteral;this._predicate=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if((this._predicate=this._readEntity(e))===void 0)return}return this._validAnnotation=!0,this._readObject}_readObject(e){switch(e.type){case"literal":if(e.prefix.length===0)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.blankNode()),this._readBlankNodeHead;case"(":let r=this._contextStack;return(r.length&&r[r.length-1]).type==="<<"?this._error("Unexpected list in reified triple",e):(this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<(":return this._saveContext("<<(",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject;case"<<":return this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject;default:if((this._object=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return e.type==="{"?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return e.type!=="{"?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){if(e.type==="]")return this._subject=null,this._readBlankNodeTail(e);{let r=this._contextStack;return(r.length>1&&r[r.length-2]).type==="<<"?this._error("Unexpected compound blank node expression in reified triple",e):(this._predicate=null,this._readPredicate(e))}}_readBlankNodeTail(e){if(e.type!=="]")return this._readBlankNodePunctuation(e);this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph);let r=this._predicate===null;return this._restoreContext("blank",e),this._object!==null?this._getContextEndReader():this._predicate!==null?this._readObject:r?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let r=null,i=null,n=this._readListItem,s=this._subject,o=this._contextStack,a=o[o.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this._subject=r=this._factory.blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),o.length!==0&&o[o.length-1].type==="list"&&this._emit(this._subject,this._predicate,this._object,this._graph),this._predicate===null){if(n=this._readPredicate,this._subject===this.RDF_NIL)return n}else if(n=this._getContextEndReader(),this._object===this.RDF_NIL)return n;i=this.RDF_NIL;break;case"literal":e.prefix.length===0?(this._literalValue=e.value,n=this._readListItemDataTypeOrLang):(r=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<(":this._saveContext("<<(",this._graph,null,null,null),this._graph=null,n=this._readSubject;break;case"<<":this._saveContext("<<",this._graph,null,null,null),this._graph=null,n=this._readSubject;break;default:if((r=this._readEntity(e))===void 0)return}if(i===null&&(this._subject=i=this._factory.blankNode()),(e.type==="<<"||e.type==="<<(")&&(o[o.length-1].subject=this._subject),s===null?a.predicate===null?a.subject=i:a.object=i:this._emit(s,this.RDF_REST,i,this._graph),r!==null){if(this._n3Mode&&(e.type==="IRI"||e.type==="prefixed"))return this._saveContext("item",this._graph,i,this.RDF_FIRST,r),this._subject=r,this._predicate=null,this._getPathReader(this._readListItem);this._emit(i,this.RDF_FIRST,r,this._graph)}return n}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e,r){let i=this._factory.literal(this._literalValue),n;switch(e.type){case"type":case"typeIRI":let s=this._readEntity(e);if(s===void 0)return;if(s.value===R.rdf.langString||s.value===R.rdf.dirLangString)return this._error("Detected illegal (directional) languaged-tagged string with explicit datatype",e);i=this._factory.literal(this._literalValue,s),e=null;break;case"langcode":if(e.value.split("-").some(o=>o.length>8))return this._error("Detected language tag with subtag longer than 8 characters",e);i=this._factory.literal(this._literalValue,e.value),this._literalLanguage=e.value,e=null,n=this._readDirCode.bind(this,r);break}return{token:e,literal:i,readCb:n}}_readDirCode(e,r,i){if(i.type==="dircode"){let n=this._factory.literal(this._literalValue,{language:this._literalLanguage,direction:i.value});e==="subject"?this._subject=n:e==="predicate"?this._predicate=n:this._object=n,this._literalLanguage=void 0,i=null}return e==="subject"?i===null?this._readPredicateOrNamedGraph:this._readPredicateOrNamedGraph(i):e==="predicate"?i===null?this._readObject:this._readObject(i):this._completeObjectLiteralPost(i,r)}_completeTermLiteral(e,r){let i=this._completeLiteral(e,r);if(!i)return;let n;return r==="subject"?(this._subject=i.literal,n=this._readPredicateOrNamedGraph):(this._predicate=i.literal,this._validAnnotation=!0,n=this._readObject),i.readCb?i.readCb.bind(this,!1):i.token===null?n:n.call(this,i.token)}_completeSubjectLiteral(e){return this._completeTermLiteral(e,"subject")}_completePredicateLiteral(e){return this._completeTermLiteral(e,"predicate")}_completeObjectLiteral(e,r){let i=this._completeLiteral(e,"object");if(i)return this._object=i.literal,i.readCb?i.readCb.bind(this,r):this._completeObjectLiteralPost(i.token,r)}_completeObjectLiteralPost(e,r){return r&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),e===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(e))}_readFormulaTail(e){return e.type!=="}"?this._readPunctuation(e):(this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),this._object===null?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let r,i=this._graph,n=!1,s=this._subject,o=this._inversePredicate;switch(e.type){case"}":if(this._graph===null)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,this._tripleTerm=null,r=this._contextStack.length?this._readSubject:this._readInTopContext,o&&(this._inversePredicate=!1);break;case";":r=this._readPredicate;break;case",":r=this._readObject;break;case"~":s!==null&&(this._tripleTerm=null),r=this._readReifierInAnnotation,n=!0;break;case"{|":s!==null&&(this._tripleTerm=null),this._subject=this._readTripleTerm(),this._validAnnotation=!1,n=!0,r=this._readPredicate;break;case"|}":if(!this._annotation)return this._error("Unexpected annotation syntax closing",e);if(!this._validAnnotation)return this._error("Annotation block can not be empty",e);this._subject=null,this._annotation=!1,r=this._getContextEndReader();break;default:if(this._supportsQuads&&this._graph===null&&(i=this._readEntity(e))!==void 0){r=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(s!==null&&(!n||n&&!this._annotation)){let a=this._predicate,l=this._object;o?this._emit(l,a,s,i):this._emit(s,a,l,i)}return n&&(this._annotation=!0),r}_readBlankNodePunctuation(e){let r;switch(e.type){case";":r=this._readPredicate;break;case",":r=this._readObject;break;case"~":case"{|":case"|}":return this._readPunctuation(e);default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._subject===null?this._error("Expected ] to follow annotation",e):(this._emit(this._subject,this._predicate,this._object,this._graph),r)}_readQuadPunctuation(e){return e.type!=="."?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return e.type!=="prefix"?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if(e.type!=="IRI")return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);let r=this._readEntity(e);return this._prefixes[this._prefix]=r.value,this._prefixCallback(this._prefix,r),this._readDeclarationPunctuation}_readBaseIRI(e){let r=e.type==="IRI"&&this._resolveIRI(e.value);return r?(this._setBase(r),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",e)}_isValidVersion(e){return this._parseUnsupportedVersions||t.SUPPORTED_VERSIONS.includes(e)}_readVersion(e){return e.type!=="literal"?this._error("Expected literal to follow version declaration",e):e.end-e.start!==e.value.length+2?this._error("Version declarations must use single quotes",e):(this._versionCallback(e.value),this._isValidVersion(e.value)?this._readDeclarationPunctuation:this._error(`Detected unsupported version: "${e.value}"`,e))}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return e.type!=="]"?this._error("Invalid graph label",e):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):e.type!=="."?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let r;switch(e.type){case"IRI":case"prefixed":if((r=this._readEntity(e,!0))!==void 0)break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(this._subject===null?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,r,this.QUANTIFIERS_GRAPH)):this._quantified[r.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return e.type===","?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:let r=this._contextStack,i=r.length&&r[r.length-1];if(i&&i.type==="item"){let n=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,n,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let r,i,n=this._factory.blankNode();if((i=this._readEntity(e))!==void 0)return this._predicate===null?(r=this._subject,this._subject=n):(r=this._object,this._object=n),this._emit(r,i,n,this._graph),this._readPath}_readBackwardPath(e){let r=this._factory.blankNode(),i,n;if((i=this._readEntity(e))!==void 0)return this._predicate===null?(n=this._subject,this._subject=r):(n=this._object,this._object=r),this._emit(r,i,n,this._graph),this._readPath}_readTripleTermTail(e){if(e.type!==")>>")return this._error(`Expected )>> but got ${e.type}`,e);let r=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);this._restoreContext("<<(",e);let i=this._contextStack,n=i.length&&i[i.length-1];return n&&n.type==="list"?(this._emit(this._subject,this.RDF_FIRST,r,this._graph),this._getContextEndReader()):this._subject===null?(this._subject=r,this._readPredicate):(this._object=r,this._getContextEndReader())}_readReifiedTripleTailOrReifier(e){return e.type==="~"?this._readReifier:this._readReifiedTripleTail(e)}_readReifiedTripleTail(e){if(e.type!==">>")return this._error(`Expected >> but got ${e.type}`,e);this._tripleTerm=null;let r=this._readTripleTerm();this._restoreContext("<<",e);let i=this._contextStack,n=i.length&&i[i.length-1];return n&&n.type==="list"?(this._emit(this._subject,this.RDF_FIRST,r,this._graph),this._getContextEndReader()):this._subject===null?(this._subject=r,this._readPredicateOrReifierTripleEnd):(this._object=r,this._getContextEndReader())}_readPredicateOrReifierTripleEnd(e){return e.type==="."?(this._subject=null,this._readPunctuation(e)):this._readPredicate(e)}_readReifier(e){return this._reifier=this._readEntity(e),this._readReifiedTripleTail}_readReifierInAnnotation(e){return e.type==="IRI"||e.type==="typeIRI"||e.type==="type"||e.type==="prefixed"||e.type==="blank"||e.type==="var"?(this._reifier=this._readEntity(e),this._readAnnotationBlockOrPunctuation):(this._readTripleTerm(),this._subject=null,this._getContextEndReader().call(this,e))}_readAnnotationBlockOrPunctuation(e){if(e.type==="{|")return this._readPunctuation(e);switch(this._readTripleTerm(),this._annotation=!1,this._tripleTerm=null,e.type){case";":return this._readPredicate;case",":return this._readObject;default:return this._subject=null,this._getContextEndReader().call(this,e)}}_readTripleTerm(){let e=this._contextStack,r=e.length&&e[e.length-1],i=r?r.graph:void 0,n=this._reifier||this._factory.blankNode();return this._reifier=null,this._tripleTerm=this._tripleTerm||this._factory.quad(this._subject,this._predicate,this._object),this._emit(n,this.RDF_REIFIES,this._tripleTerm,i||this._graph||this.DEFAULTGRAPH),n}_getContextEndReader(){let e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<(":return this._readTripleTermTail;case"<<":return this._readReifiedTripleTailOrReifier}}_emit(e,r,i,n){this._callback(null,this._factory.quad(e,r,i,n||this.DEFAULTGRAPH))}_error(e,r){let i=new Error(`${e} on line ${r.line}.`);i.context={token:r,line:r.line,previousToken:this._lexer.previousToken},this._callback(i),this._callback=At}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return(e[1]==="/"?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;let r=e.length,i="",n=-1,s=-1,o=0,a="/";for(;n<r;){switch(a){case":":if(s<0&&e[++n]==="/"&&e[++n]==="/")for(;(s=n+1)<r&&e[s]!=="/";)n=s;break;case"?":case"#":n=r;break;case"/":if(e[n+1]===".")switch(a=e[++n+1],a){case"/":i+=e.substring(o,n-1),o=n+1;break;case void 0:case"?":case"#":return i+e.substring(o,n)+e.substr(n+1);case".":if(a=e[++n+1],a===void 0||a==="/"||a==="?"||a==="#"){if(i+=e.substring(o,n-2),(o=i.lastIndexOf("/"))>=s&&(i=i.substr(0,o)),a!=="/")return`${i}/${e.substr(n+1)}`;o=n+1}}}a=e[++n]}return i+e.substring(o)}parse(e,r,i,n){let s,o,a,l;if(r&&(r.onQuad||r.onPrefix||r.onComment||r.onVersion)?(s=r.onQuad,o=r.onPrefix,a=r.onComment,l=r.onVersion):(s=r,o=i,l=n),this._readCallback=this._readBeforeTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Vn++}_`,this._prefixCallback=o||At,this._versionCallback=l||At,this._inversePredicate=!1,this._quantified=Object.create(null),!s){let f=[],c;if(this._callback=(_,h)=>{_?c=_:h&&f.push(h)},this._lexer.tokenize(e).every(_=>this._readCallback=this._readCallback(_)),c)throw c;return f}let u=(f,c)=>{f!==null?(this._callback(f),this._callback=At):this._readCallback&&(this._readCallback=this._readCallback(c))};a&&(this._lexer.comments=!0,u=(f,c)=>{f!==null?(this._callback(f),this._callback=At):this._readCallback&&(c.type==="comment"?a(c.value):this._readCallback=this._readCallback(c))}),this._callback=s,this._lexer.tokenize(e,u)}};function At(){}function Qn(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(R.rdf.first),t.RDF_REST=e.namedNode(R.rdf.rest),t.RDF_NIL=e.namedNode(R.rdf.nil),t.RDF_REIFIES=e.namedNode(R.rdf.reifies),t.N3_FORALL=e.namedNode(R.r.forAll),t.N3_FORSOME=e.namedNode(R.r.forSome),t.ABBREVIATIONS={a:e.namedNode(R.rdf.type),"=":e.namedNode(R.owl.sameAs),">":e.namedNode(R.log.implies),"<":e.namedNode(R.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}he.SUPPORTED_VERSIONS=["1.2","1.2-basic","1.1"];Qn(he.prototype,W);var Kr={};xl(Kr,{inDefaultGraph:()=>du,isBlankNode:()=>lu,isDefaultGraph:()=>Ie,isLiteral:()=>uu,isNamedNode:()=>au,isQuad:()=>cu,isVariable:()=>fu,prefix:()=>hu,prefixes:()=>Hn});function au(t){return!!t&&t.termType==="NamedNode"}function lu(t){return!!t&&t.termType==="BlankNode"}function uu(t){return!!t&&t.termType==="Literal"}function fu(t){return!!t&&t.termType==="Variable"}function cu(t){return!!t&&t.termType==="Quad"}function Ie(t){return!!t&&t.termType==="DefaultGraph"}function du(t){return Ie(t.graph)}function hu(t,e){return Hn({"":t.value||t},e)("")}function Hn(t,e){let r=Object.create(null);for(let n in t)i(n,t[n]);e=e||W;function i(n,s){if(typeof s=="string"){let o=Object.create(null);r[n]=a=>o[a]||(o[a]=e.namedNode(s+a))}else if(!(n in r))throw new Error(`Unknown prefix: ${n}`);return r[n]}return i}function nt(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}var pu=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,_u=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,zn="./",bu="../",Yr="?",Kn="#",Me=class t{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!pu.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!t.supports(this.base))return this._baseMatcher=/.^/;let e=/^[^:]*:\/*/.exec(this.base)[0],r=["^",nt(e)],i=[],n=[],s=/[^/?#]*([/?#])/y,o,a=0,l=0,u=s.lastIndex=e.length;for(;!a&&!l&&(o=s.exec(this.base));)o[1]===Kn?l=s.lastIndex-1:(r.push(nt(o[0]),"(?:"),i.push(")?"),o[1]!==Yr?n.push(u=s.lastIndex):(a=u=s.lastIndex,l=this.base.indexOf(Kn,a),this._pathReplacements[a]=Yr));for(let f=0;f<n.length;f++)this._pathReplacements[n[f]]=bu.repeat(n.length-f-1);return this._pathReplacements[n[n.length-1]]=zn,this._baseLength=l>0?l:this.base.length,r.push(nt(this.base.substring(u,this._baseLength)),a?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...r,...i].join(""))}toRelative(e){let r=this._getBaseMatcher().exec(e);if(!r)return e;let i=r[0].length;if(i===this._baseLength&&i===e.length)return"";let n=this._pathReplacements[i];if(n){let s=e.substring(i);return n!==Yr&&!_u.test(s)?e:n===zn&&/^[^?#]/.test(s)?s:n+s}return e.substring(i-1)}};var Nt=W.defaultGraph(),{rdf:gu,xsd:st}=R,Yn=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,Jn=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,yu={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"},De=class extends U{equals(e){return e===this}},Z=class{constructor(e,r){if(this._prefixRegex=/$0^/,this._hasPrefixes=!1,e&&typeof e.write!="function"&&(r=e,e=null),r=r||{},this._lists=r.lists,e)this._outputStream=e,this._endStream=r.end===void 0?!0:!!r.end;else{let i="";this._outputStream={write(n,s,o){i+=n,o&&o()},end:n=>{n&&n(null,i)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(r.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Nt,this._prefixIRIs=Object.create(null),r.prefixes&&this.addPrefixes(r.prefixes),r.baseIRI&&(this._baseIri=new Me(r.baseIRI)))}get _inDefaultGraph(){return Nt.equals(this._graph)}_write(e,r){this._outputStream.write(e,"utf8",r)}_writeQuad(e,r,i,n,s){try{(!n.equals(this._graph)||n.termType!==this._graph.termType)&&(this._write((this._subject===null?"":this._inDefaultGraph?`.
1
+ var bl=Object.create;var Or=Object.defineProperty;var gl=Object.getOwnPropertyDescriptor;var yl=Object.getOwnPropertyNames;var wl=Object.getPrototypeOf,ml=Object.prototype.hasOwnProperty;var S=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},xl=(t,e)=>{for(var r in e)Or(t,r,{get:e[r],enumerable:!0})},El=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of yl(e))!ml.call(t,n)&&n!==r&&Or(t,n,{get:()=>e[n],enumerable:!(i=gl(e,n))||i.enumerable});return t};var zt=(t,e,r)=>(r=t!=null?bl(wl(t)):{},El(e||!t||!t.__esModule?Or(r,"default",{value:t,enumerable:!0}):r,t));var yn=S(Kt=>{"use strict";Kt.byteLength=Il;Kt.toByteArray=Tl;Kt.fromByteArray=vl;var Y=[],V=[],Sl=typeof Uint8Array<"u"?Uint8Array:Array,Mr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Le=0,bn=Mr.length;Le<bn;++Le)Y[Le]=Mr[Le],V[Mr.charCodeAt(Le)]=Le;var Le,bn;V[45]=62;V[95]=63;function gn(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function Il(t){var e=gn(t),r=e[0],i=e[1];return(r+i)*3/4-i}function Rl(t,e,r){return(e+r)*3/4-r}function Tl(t){var e,r=gn(t),i=r[0],n=r[1],s=new Sl(Rl(t,i,n)),o=0,a=n>0?i-4:i,l;for(l=0;l<a;l+=4)e=V[t.charCodeAt(l)]<<18|V[t.charCodeAt(l+1)]<<12|V[t.charCodeAt(l+2)]<<6|V[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return n===2&&(e=V[t.charCodeAt(l)]<<2|V[t.charCodeAt(l+1)]>>4,s[o++]=e&255),n===1&&(e=V[t.charCodeAt(l)]<<10|V[t.charCodeAt(l+1)]<<4|V[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function Al(t){return Y[t>>18&63]+Y[t>>12&63]+Y[t>>6&63]+Y[t&63]}function Nl(t,e,r){for(var i,n=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),n.push(Al(i));return n.join("")}function vl(t){for(var e,r=t.length,i=r%3,n=[],s=16383,o=0,a=r-i;o<a;o+=s)n.push(Nl(t,o,o+s>a?a:o+s));return i===1?(e=t[r-1],n.push(Y[e>>2]+Y[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(Y[e>>10]+Y[e>>4&63]+Y[e<<2&63]+"=")),n.join("")}});var wn=S(Dr=>{Dr.read=function(t,e,r,i,n){var s,o,a=n*8-i-1,l=(1<<a)-1,u=l>>1,f=-7,c=r?n-1:0,_=r?-1:1,h=t[e+c];for(c+=_,s=h&(1<<-f)-1,h>>=-f,f+=a;f>0;s=s*256+t[e+c],c+=_,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=i;f>0;o=o*256+t[e+c],c+=_,f-=8);if(s===0)s=1-u;else{if(s===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-u}return(h?-1:1)*o*Math.pow(2,s-i)};Dr.write=function(t,e,r,i,n,s){var o,a,l,u=s*8-n-1,f=(1<<u)-1,c=f>>1,_=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,b=i?1:-1,p=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+c>=1?e+=_/l:e+=_*Math.pow(2,1-c),e*l>=2&&(o++,l/=2),o+c>=f?(a=0,o=f):o+c>=1?(a=(e*l-1)*Math.pow(2,n),o=o+c):(a=e*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;t[r+h]=a&255,h+=b,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;t[r+h]=o&255,h+=b,o/=256,u-=8);t[r+h-b]|=p*128}});var X=S(tt=>{"use strict";var $r=yn(),Ze=wn(),mn=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;tt.Buffer=d;tt.SlowBuffer=Cl;tt.INSPECT_MAX_BYTES=50;var Yt=2147483647;tt.kMaxLength=Yt;d.TYPED_ARRAY_SUPPORT=jl();!d.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function jl(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}});Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function fe(t){if(t>Yt)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,d.prototype),e}function d(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Wr(t)}return In(t,e,r)}d.poolSize=8192;function In(t,e,r){if(typeof t=="string")return Ll(t,e);if(ArrayBuffer.isView(t))return Bl(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(J(t,ArrayBuffer)||t&&J(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(J(t,SharedArrayBuffer)||t&&J(t.buffer,SharedArrayBuffer)))return qr(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return d.from(i,e,r);let n=Fl(t);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return d.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}d.from=function(t,e,r){return In(t,e,r)};Object.setPrototypeOf(d.prototype,Uint8Array.prototype);Object.setPrototypeOf(d,Uint8Array);function Rn(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function Pl(t,e,r){return Rn(t),t<=0?fe(t):e!==void 0?typeof r=="string"?fe(t).fill(e,r):fe(t).fill(e):fe(t)}d.alloc=function(t,e,r){return Pl(t,e,r)};function Wr(t){return Rn(t),fe(t<0?0:Gr(t)|0)}d.allocUnsafe=function(t){return Wr(t)};d.allocUnsafeSlow=function(t){return Wr(t)};function Ll(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!d.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Tn(t,e)|0,i=fe(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function kr(t){let e=t.length<0?0:Gr(t.length)|0,r=fe(e);for(let i=0;i<e;i+=1)r[i]=t[i]&255;return r}function Bl(t){if(J(t,Uint8Array)){let e=new Uint8Array(t);return qr(e.buffer,e.byteOffset,e.byteLength)}return kr(t)}function qr(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return e===void 0&&r===void 0?i=new Uint8Array(t):r===void 0?i=new Uint8Array(t,e):i=new Uint8Array(t,e,r),Object.setPrototypeOf(i,d.prototype),i}function Fl(t){if(d.isBuffer(t)){let e=Gr(t.length)|0,r=fe(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||Hr(t.length)?fe(0):kr(t);if(t.type==="Buffer"&&Array.isArray(t.data))return kr(t.data)}function Gr(t){if(t>=Yt)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Yt.toString(16)+" bytes");return t|0}function Cl(t){return+t!=t&&(t=0),d.alloc(+t)}d.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==d.prototype};d.compare=function(e,r){if(J(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),J(r,Uint8Array)&&(r=d.from(r,r.offset,r.byteLength)),!d.isBuffer(e)||!d.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let i=e.length,n=r.length;for(let s=0,o=Math.min(i,n);s<o;++s)if(e[s]!==r[s]){i=e[s],n=r[s];break}return i<n?-1:n<i?1:0};d.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};d.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return d.alloc(0);let i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;let n=d.allocUnsafe(r),s=0;for(i=0;i<e.length;++i){let o=e[i];if(J(o,Uint8Array))s+o.length>n.length?(d.isBuffer(o)||(o=d.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(d.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function Tn(t,e){if(d.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||J(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Ur(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Cn(t).length;default:if(n)return i?-1:Ur(t).length;e=(""+e).toLowerCase(),n=!0}}d.byteLength=Tn;function Ol(t,e,r){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Hl(this,e,r);case"utf8":case"utf-8":return Nn(this,e,r);case"ascii":return Gl(this,e,r);case"latin1":case"binary":return Vl(this,e,r);case"base64":return Ul(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ql(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}d.prototype._isBuffer=!0;function Be(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}d.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)Be(this,r,r+1);return this};d.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)Be(this,r,r+3),Be(this,r+1,r+2);return this};d.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)Be(this,r,r+7),Be(this,r+1,r+6),Be(this,r+2,r+5),Be(this,r+3,r+4);return this};d.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Nn(this,0,e):Ol.apply(this,arguments)};d.prototype.toLocaleString=d.prototype.toString;d.prototype.equals=function(e){if(!d.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:d.compare(this,e)===0};d.prototype.inspect=function(){let e="",r=tt.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};mn&&(d.prototype[mn]=d.prototype.inspect);d.prototype.compare=function(e,r,i,n,s){if(J(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),r<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&r>=i)return 0;if(n>=s)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;let o=s-n,a=i-r,l=Math.min(o,a),u=this.slice(n,s),f=e.slice(r,i);for(let c=0;c<l;++c)if(u[c]!==f[c]){o=u[c],a=f[c];break}return o<a?-1:a<o?1:0};function An(t,e,r,i,n){if(t.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Hr(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)r=0;else return-1;if(typeof e=="string"&&(e=d.from(e,i)),d.isBuffer(e))return e.length===0?-1:xn(t,e,r,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):xn(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function xn(t,e,r,i,n){let s=1,o=t.length,a=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function l(f,c){return s===1?f[c]:f.readUInt16BE(c*s)}let u;if(n){let f=-1;for(u=r;u<o;u++)if(l(t,u)===l(e,f===-1?0:u-f)){if(f===-1&&(f=u),u-f+1===a)return f*s}else f!==-1&&(u-=u-f),f=-1}else for(r+a>o&&(r=o-a),u=r;u>=0;u--){let f=!0;for(let c=0;c<a;c++)if(l(t,u+c)!==l(e,c)){f=!1;break}if(f)return u}return-1}d.prototype.includes=function(e,r,i){return this.indexOf(e,r,i)!==-1};d.prototype.indexOf=function(e,r,i){return An(this,e,r,i,!0)};d.prototype.lastIndexOf=function(e,r,i){return An(this,e,r,i,!1)};function Ml(t,e,r,i){r=Number(r)||0;let n=t.length-r;i?(i=Number(i),i>n&&(i=n)):i=n;let s=e.length;i>s/2&&(i=s/2);let o;for(o=0;o<i;++o){let a=parseInt(e.substr(o*2,2),16);if(Hr(a))return o;t[r+o]=a}return o}function Dl(t,e,r,i){return Jt(Ur(e,t.length-r),t,r,i)}function $l(t,e,r,i){return Jt(Jl(e),t,r,i)}function kl(t,e,r,i){return Jt(Cn(e),t,r,i)}function ql(t,e,r,i){return Jt(Xl(e,t.length-r),t,r,i)}d.prototype.write=function(e,r,i,n){if(r===void 0)n="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")n=r,i=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return Ml(this,e,r,i);case"utf8":case"utf-8":return Dl(this,e,r,i);case"ascii":case"latin1":case"binary":return $l(this,e,r,i);case"base64":return kl(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ql(this,e,r,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ul(t,e,r){return e===0&&r===t.length?$r.fromByteArray(t):$r.fromByteArray(t.slice(e,r))}function Nn(t,e,r){r=Math.min(t.length,r);let i=[],n=e;for(;n<r;){let s=t[n],o=null,a=s>239?4:s>223?3:s>191?2:1;if(n+a<=r){let l,u,f,c;switch(a){case 1:s<128&&(o=s);break;case 2:l=t[n+1],(l&192)===128&&(c=(s&31)<<6|l&63,c>127&&(o=c));break;case 3:l=t[n+1],u=t[n+2],(l&192)===128&&(u&192)===128&&(c=(s&15)<<12|(l&63)<<6|u&63,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:l=t[n+1],u=t[n+2],f=t[n+3],(l&192)===128&&(u&192)===128&&(f&192)===128&&(c=(s&15)<<18|(l&63)<<12|(u&63)<<6|f&63,c>65535&&c<1114112&&(o=c))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=a}return Wl(i)}var En=4096;function Wl(t){let e=t.length;if(e<=En)return String.fromCharCode.apply(String,t);let r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=En));return r}function Gl(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]&127);return i}function Vl(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function Hl(t,e,r){let i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);let n="";for(let s=e;s<r;++s)n+=Zl[t[s]];return n}function Ql(t,e,r){let i=t.slice(e,r),n="";for(let s=0;s<i.length-1;s+=2)n+=String.fromCharCode(i[s]+i[s+1]*256);return n}d.prototype.slice=function(e,r){let i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);let n=this.subarray(e,r);return Object.setPrototypeOf(n,d.prototype),n};function C(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||C(e,r,this.length);let n=this[e],s=1,o=0;for(;++o<r&&(s*=256);)n+=this[e+o]*s;return n};d.prototype.readUintBE=d.prototype.readUIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||C(e,r,this.length);let n=this[e+--r],s=1;for(;r>0&&(s*=256);)n+=this[e+--r]*s;return n};d.prototype.readUint8=d.prototype.readUInt8=function(e,r){return e=e>>>0,r||C(e,1,this.length),this[e]};d.prototype.readUint16LE=d.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||C(e,2,this.length),this[e]|this[e+1]<<8};d.prototype.readUint16BE=d.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||C(e,2,this.length),this[e]<<8|this[e+1]};d.prototype.readUint32LE=d.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};d.prototype.readUint32BE=d.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||C(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};d.prototype.readBigUInt64LE=Ee(function(e){e=e>>>0,et(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&xt(e,this.length-8);let n=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(s)<<BigInt(32))});d.prototype.readBigUInt64BE=Ee(function(e){e=e>>>0,et(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&xt(e,this.length-8);let n=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(s)});d.prototype.readIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||C(e,r,this.length);let n=this[e],s=1,o=0;for(;++o<r&&(s*=256);)n+=this[e+o]*s;return s*=128,n>=s&&(n-=Math.pow(2,8*r)),n};d.prototype.readIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||C(e,r,this.length);let n=r,s=1,o=this[e+--n];for(;n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};d.prototype.readInt8=function(e,r){return e=e>>>0,r||C(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};d.prototype.readInt16LE=function(e,r){e=e>>>0,r||C(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};d.prototype.readInt16BE=function(e,r){e=e>>>0,r||C(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};d.prototype.readInt32LE=function(e,r){return e=e>>>0,r||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};d.prototype.readInt32BE=function(e,r){return e=e>>>0,r||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};d.prototype.readBigInt64LE=Ee(function(e){e=e>>>0,et(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&xt(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});d.prototype.readBigInt64BE=Ee(function(e){e=e>>>0,et(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&xt(e,this.length-8);let n=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i)});d.prototype.readFloatLE=function(e,r){return e=e>>>0,r||C(e,4,this.length),Ze.read(this,e,!0,23,4)};d.prototype.readFloatBE=function(e,r){return e=e>>>0,r||C(e,4,this.length),Ze.read(this,e,!1,23,4)};d.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||C(e,8,this.length),Ze.read(this,e,!0,52,8)};d.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||C(e,8,this.length),Ze.read(this,e,!1,52,8)};function q(t,e,r,i,n,s){if(!d.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;q(this,e,r,i,a,0)}let s=1,o=0;for(this[r]=e&255;++o<i&&(s*=256);)this[r+o]=e/s&255;return r+i};d.prototype.writeUintBE=d.prototype.writeUIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;q(this,e,r,i,a,0)}let s=i-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+i};d.prototype.writeUint8=d.prototype.writeUInt8=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,1,255,0),this[r]=e&255,r+1};d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function vn(t,e,r,i,n){Fn(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,r}function jn(t,e,r,i,n){Fn(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}d.prototype.writeBigUInt64LE=Ee(function(e,r=0){return vn(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});d.prototype.writeBigUInt64BE=Ee(function(e,r=0){return jn(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});d.prototype.writeIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);q(this,e,r,i,l-1,-l)}let s=0,o=1,a=0;for(this[r]=e&255;++s<i&&(o*=256);)e<0&&a===0&&this[r+s-1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+i};d.prototype.writeIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);q(this,e,r,i,l-1,-l)}let s=i-1,o=1,a=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+i};d.prototype.writeInt8=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};d.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};d.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};d.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};d.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||q(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};d.prototype.writeBigInt64LE=Ee(function(e,r=0){return vn(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});d.prototype.writeBigInt64BE=Ee(function(e,r=0){return jn(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Pn(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 Ln(t,e,r,i,n){return e=+e,r=r>>>0,n||Pn(t,e,r,4,34028234663852886e22,-34028234663852886e22),Ze.write(t,e,r,i,23,4),r+4}d.prototype.writeFloatLE=function(e,r,i){return Ln(this,e,r,!0,i)};d.prototype.writeFloatBE=function(e,r,i){return Ln(this,e,r,!1,i)};function Bn(t,e,r,i,n){return e=+e,r=r>>>0,n||Pn(t,e,r,8,17976931348623157e292,-17976931348623157e292),Ze.write(t,e,r,i,52,8),r+8}d.prototype.writeDoubleLE=function(e,r,i){return Bn(this,e,r,!0,i)};d.prototype.writeDoubleBE=function(e,r,i){return Bn(this,e,r,!1,i)};d.prototype.copy=function(e,r,i,n){if(!d.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);let s=n-i;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,n):Uint8Array.prototype.set.call(e,this.subarray(i,n),r),s};d.prototype.fill=function(e,r,i,n){if(typeof e=="string"){if(typeof r=="string"?(n=r,r=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!d.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(e.length===1){let o=e.charCodeAt(0);(n==="utf8"&&o<128||n==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s<i;++s)this[s]=e;else{let o=d.isBuffer(e)?e:d.from(e,n),a=o.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<i-r;++s)this[s+r]=o[s%a]}return this};var Xe={};function Vr(t,e,r){Xe[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}Vr("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Vr("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);Vr("ERR_OUT_OF_RANGE",function(t,e,r){let i=`The value of "${t}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=Sn(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=Sn(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function Sn(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function zl(t,e,r){et(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&xt(e,t.length-(r+1))}function Fn(t,e,r,i,n,s){if(t>r||t<e){let o=typeof e=="bigint"?"n":"",a;throw s>3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${r}${o}`,new Xe.ERR_OUT_OF_RANGE("value",a,t)}zl(i,n,s)}function et(t,e){if(typeof t!="number")throw new Xe.ERR_INVALID_ARG_TYPE(e,"number",t)}function xt(t,e,r){throw Math.floor(t)!==t?(et(t,r),new Xe.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Xe.ERR_BUFFER_OUT_OF_BOUNDS:new Xe.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Kl=/[^+/0-9A-Za-z-_]/g;function Yl(t){if(t=t.split("=")[0],t=t.trim().replace(Kl,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Ur(t,e){e=e||1/0;let r,i=t.length,n=null,s=[];for(let o=0;o<i;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+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=(n-55296<<10|r-56320)+65536}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,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function Jl(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Xl(t,e){let r,i,n,s=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),i=r>>8,n=r%256,s.push(n),s.push(i);return s}function Cn(t){return $r.toByteArray(Yl(t))}function Jt(t,e,r,i){let n;for(n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function J(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Hr(t){return t!==t}var Zl=(function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let i=r*16;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e})();function Ee(t){return typeof BigInt>"u"?eu:t}function eu(){throw new Error("BigInt not supported")}});var N=S((y_,Zn)=>{"use strict";var Jr=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let i=0;i<e.length;i++)r+=` ${e[i].stack}
2
+ `;super(r),this.name="AggregateError",this.errors=e}};Zn.exports={AggregateError:Jr,ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Boolean,Uint8Array}});var Xr=S((w_,es)=>{"use strict";es.exports={format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,i]){let n=e.shift();return i==="f"?n.toFixed(6):i==="j"?JSON.stringify(n):i==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}}}});var M=S((m_,is)=>{"use strict";var{format:wu,inspect:er}=Xr(),{AggregateError:mu}=N(),xu=globalThis.AggregateError||mu,Eu=Symbol("kIsNodeError"),Su=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Iu=/^([A-Z][a-z0-9]*)+$/,Ru="__node_internal_",tr={};function $e(t,e){if(!t)throw new tr.ERR_INTERNAL_ASSERTION(e)}function ts(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function Tu(t,e,r){if(typeof e=="function")return $e(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let i=(e.match(/%[dfijoOs]/g)||[]).length;return $e(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:wu(e,...r)}function O(t,e,r){r||(r=Error);class i extends r{constructor(...s){super(Tu(t,e,s))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=t,i.prototype[Eu]=!0,tr[t]=i}function rs(t){let e=Ru+t.name;return Object.defineProperty(t,"name",{value:e}),t}function Au(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new xu([e,t],e.message);return r.code=e.code,r}return t||e}var Zr=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new tr.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};O("ERR_ASSERTION","%s",Error);O("ERR_INVALID_ARG_TYPE",(t,e,r)=>{$e(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let i="The ";t.endsWith(" argument")?i+=`${t} `:i+=`"${t}" ${t.includes(".")?"property":"argument"} `,i+="must be ";let n=[],s=[],o=[];for(let l of e)$e(typeof l=="string","All expected entries have to be of type string"),Su.includes(l)?n.push(l.toLowerCase()):Iu.test(l)?s.push(l):($e(l!=="object",'The value "object" should be written as "Object"'),o.push(l));if(s.length>0){let l=n.indexOf("object");l!==-1&&(n.splice(n,l,1),s.push("Object"))}if(n.length>0){switch(n.length){case 1:i+=`of type ${n[0]}`;break;case 2:i+=`one of type ${n[0]} or ${n[1]}`;break;default:{let l=n.pop();i+=`one of type ${n.join(", ")}, or ${l}`}}(s.length>0||o.length>0)&&(i+=" or ")}if(s.length>0){switch(s.length){case 1:i+=`an instance of ${s[0]}`;break;case 2:i+=`an instance of ${s[0]} or ${s[1]}`;break;default:{let l=s.pop();i+=`an instance of ${s.join(", ")}, or ${l}`}}o.length>0&&(i+=" or ")}switch(o.length){case 0:break;case 1:o[0].toLowerCase()!==o[0]&&(i+="an "),i+=`${o[0]}`;break;case 2:i+=`one of ${o[0]} or ${o[1]}`;break;default:{let l=o.pop();i+=`one of ${o.join(", ")}, or ${l}`}}if(r==null)i+=`. Received ${r}`;else if(typeof r=="function"&&r.name)i+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)i+=`. Received an instance of ${r.constructor.name}`;else{let l=er(r,{depth:-1});i+=`. Received ${l}`}}else{let l=er(r,{colors:!1});l.length>25&&(l=`${l.slice(0,25)}...`),i+=`. Received type ${typeof r} (${l})`}return i},TypeError);O("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let i=er(e);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${i}`},TypeError);O("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var i;let n=r!=null&&(i=r.constructor)!==null&&i!==void 0&&i.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${n}.`},TypeError);O("ERR_MISSING_ARGS",(...t)=>{$e(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(i=>`"${i}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let i=t.pop();e+=`The ${t.join(", ")}, and ${i} arguments`}break}return`${e} must be specified`},TypeError);O("ERR_OUT_OF_RANGE",(t,e,r)=>{$e(e,'Missing "range" argument');let i;if(Number.isInteger(r)&&Math.abs(r)>2**32)i=ts(String(r));else if(typeof r=="bigint"){i=String(r);let n=BigInt(2)**BigInt(32);(r>n||r<-n)&&(i=ts(i)),i+="n"}else i=er(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${i}`},RangeError);O("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);O("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);O("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);O("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);O("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);O("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);O("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);O("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);O("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);O("ERR_STREAM_WRITE_AFTER_END","write after end",Error);O("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);is.exports={AbortError:Zr,aggregateTwoErrors:rs(Au),hideStackFrames:rs,codes:tr}});var ot=S((x_,rr)=>{"use strict";var{AbortController:ns,AbortSignal:Nu}=typeof self<"u"?self:typeof window<"u"?window:void 0;rr.exports=ns;rr.exports.AbortSignal=Nu;rr.exports.default=ns});var vt=S((E_,ei)=>{"use strict";var at=typeof Reflect=="object"?Reflect:null,ss=at&&typeof at.apply=="function"?at.apply:function(e,r,i){return Function.prototype.apply.call(e,r,i)},ir;at&&typeof at.ownKeys=="function"?ir=at.ownKeys:Object.getOwnPropertySymbols?ir=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ir=function(e){return Object.getOwnPropertyNames(e)};function vu(t){console&&console.warn&&console.warn(t)}var as=Number.isNaN||function(e){return e!==e};function I(){I.init.call(this)}ei.exports=I;ei.exports.once=Bu;I.EventEmitter=I;I.prototype._events=void 0;I.prototype._eventsCount=0;I.prototype._maxListeners=void 0;var os=10;function nr(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(I,"defaultMaxListeners",{enumerable:!0,get:function(){return os},set:function(t){if(typeof t!="number"||t<0||as(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");os=t}});I.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};I.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||as(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function ls(t){return t._maxListeners===void 0?I.defaultMaxListeners:t._maxListeners}I.prototype.getMaxListeners=function(){return ls(this)};I.prototype.emit=function(e){for(var r=[],i=1;i<arguments.length;i++)r.push(arguments[i]);var n=e==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")ss(l,this,r);else for(var u=l.length,f=hs(l,u),i=0;i<u;++i)ss(f[i],this,r);return!0};function us(t,e,r,i){var n,s,o;if(nr(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),n=ls(t),n>0&&o.length>n&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,vu(a)}return t}I.prototype.addListener=function(e,r){return us(this,e,r,!1)};I.prototype.on=I.prototype.addListener;I.prototype.prependListener=function(e,r){return us(this,e,r,!0)};function ju(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function fs(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=ju.bind(i);return n.listener=r,i.wrapFn=n,n}I.prototype.once=function(e,r){return nr(r),this.on(e,fs(this,e,r)),this};I.prototype.prependOnceListener=function(e,r){return nr(r),this.prependListener(e,fs(this,e,r)),this};I.prototype.removeListener=function(e,r){var i,n,s,o,a;if(nr(r),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===r||i.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||r));else if(typeof i!="function"){for(s=-1,o=i.length-1;o>=0;o--)if(i[o]===r||i[o].listener===r){a=i[o].listener,s=o;break}if(s<0)return this;s===0?i.shift():Pu(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};I.prototype.off=I.prototype.removeListener;I.prototype.removeAllListeners=function(e){var r,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),o;for(n=0;n<s.length;++n)o=s[n],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=i[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(n=r.length-1;n>=0;n--)this.removeListener(e,r[n]);return this};function cs(t,e,r){var i=t._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?r?[n.listener||n]:[n]:r?Lu(n):hs(n,n.length)}I.prototype.listeners=function(e){return cs(this,e,!0)};I.prototype.rawListeners=function(e){return cs(this,e,!1)};I.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ds.call(t,e)};I.prototype.listenerCount=ds;function ds(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}I.prototype.eventNames=function(){return this._eventsCount>0?ir(this._events):[]};function hs(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function Pu(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Lu(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Bu(t,e){return new Promise(function(r,i){function n(o){t.removeListener(e,s),i(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",n),r([].slice.call(arguments))}ps(t,e,s,{once:!0}),e!=="error"&&Fu(t,n,{once:!0})})}function Fu(t,e,r){typeof t.on=="function"&&ps(t,"error",e,r)}function ps(t,e,r,i){if(typeof t.on=="function")i.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function n(s){i.once&&t.removeEventListener(e,n),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var $=S((S_,ri)=>{"use strict";var Cu=X(),{format:Ou,inspect:Mu}=Xr(),{codes:{ERR_INVALID_ARG_TYPE:ti}}=M(),{kResistStopPropagation:Du,AggregateError:$u,SymbolDispose:ku}=N(),qu=globalThis.AbortSignal||ot().AbortSignal,Uu=globalThis.AbortController||ot().AbortController,Wu=Object.getPrototypeOf(async function(){}).constructor,_s=globalThis.Blob||Cu.Blob,Gu=typeof _s<"u"?function(e){return e instanceof _s}:function(e){return!1},bs=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ti(e,"AbortSignal",t)},Vu=(t,e)=>{if(typeof t!="function")throw new ti(e,"Function",t)};ri.exports={AggregateError:$u,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((i,n)=>{t=i,e=n}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((i,...n)=>i?r(i):e(...n))})},debuglog(){return function(){}},format:Ou,inspect:Mu,types:{isAsyncFunction(t){return t instanceof Wu},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Gu,deprecate(t,e){return t},addAbortListener:vt().addAbortListener||function(e,r){if(e===void 0)throw new ti("signal","AbortSignal",e);bs(e,"signal"),Vu(r,"listener");let i;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Du]:!0}),i=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[ku](){var n;(n=i)===null||n===void 0||n()}}},AbortSignalAny:qu.any||function(e){if(e.length===1)return e[0];let r=new Uu,i=()=>r.abort();return e.forEach(n=>{bs(n,"signals"),n.addEventListener("abort",i,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",i))},{once:!0}),r.signal}};ri.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var ut=S((I_,Ts)=>{"use strict";var{ArrayIsArray:ni,ArrayPrototypeIncludes:ms,ArrayPrototypeJoin:xs,ArrayPrototypeMap:Hu,NumberIsInteger:si,NumberIsNaN:Qu,NumberMAX_SAFE_INTEGER:zu,NumberMIN_SAFE_INTEGER:Ku,NumberParseInt:Yu,ObjectPrototypeHasOwnProperty:Ju,RegExpPrototypeExec:Es,String:Xu,StringPrototypeToUpperCase:Zu,StringPrototypeTrim:ef}=N(),{hideStackFrames:H,codes:{ERR_SOCKET_BAD_PORT:tf,ERR_INVALID_ARG_TYPE:D,ERR_INVALID_ARG_VALUE:lt,ERR_OUT_OF_RANGE:ke,ERR_UNKNOWN_SIGNAL:gs}}=M(),{normalizeEncoding:rf}=$(),{isAsyncFunction:nf,isArrayBufferView:sf}=$().types,ys={};function of(t){return t===(t|0)}function af(t){return t===t>>>0}var lf=/^[0-7]+$/,uf="must be a 32-bit unsigned integer or an octal string";function ff(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(Es(lf,t)===null)throw new lt(e,t,uf);t=Yu(t,8)}return Ss(t,e),t}var cf=H((t,e,r=Ku,i=zu)=>{if(typeof t!="number")throw new D(e,"number",t);if(!si(t))throw new ke(e,"an integer",t);if(t<r||t>i)throw new ke(e,`>= ${r} && <= ${i}`,t)}),df=H((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!="number")throw new D(e,"number",t);if(!si(t))throw new ke(e,"an integer",t);if(t<r||t>i)throw new ke(e,`>= ${r} && <= ${i}`,t)}),Ss=H((t,e,r=!1)=>{if(typeof t!="number")throw new D(e,"number",t);if(!si(t))throw new ke(e,"an integer",t);let i=r?1:0,n=4294967295;if(t<i||t>n)throw new ke(e,`>= ${i} && <= ${n}`,t)});function oi(t,e){if(typeof t!="string")throw new D(e,"string",t)}function hf(t,e,r=void 0,i){if(typeof t!="number")throw new D(e,"number",t);if(r!=null&&t<r||i!=null&&t>i||(r!=null||i!=null)&&Qu(t))throw new ke(e,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,t)}var pf=H((t,e,r)=>{if(!ms(r,t)){let n="must be one of: "+xs(Hu(r,s=>typeof s=="string"?`'${s}'`:Xu(s)),", ");throw new lt(e,t,n)}});function Is(t,e){if(typeof t!="boolean")throw new D(e,"boolean",t)}function ii(t,e,r){return t==null||!Ju(t,e)?r:t[e]}var _f=H((t,e,r=null)=>{let i=ii(r,"allowArray",!1),n=ii(r,"allowFunction",!1);if(!ii(r,"nullable",!1)&&t===null||!i&&ni(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new D(e,"Object",t)}),bf=H((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new D(e,"a dictionary",t)}),sr=H((t,e,r=0)=>{if(!ni(t))throw new D(e,"Array",t);if(t.length<r){let i=`must be longer than ${r}`;throw new lt(e,t,i)}});function gf(t,e){sr(t,e);for(let r=0;r<t.length;r++)oi(t[r],`${e}[${r}]`)}function yf(t,e){sr(t,e);for(let r=0;r<t.length;r++)Is(t[r],`${e}[${r}]`)}function wf(t,e){sr(t,e);for(let r=0;r<t.length;r++){let i=t[r],n=`${e}[${r}]`;if(i==null)throw new D(n,"AbortSignal",i);Rs(i,n)}}function mf(t,e="signal"){if(oi(t,e),ys[t]===void 0)throw ys[Zu(t)]!==void 0?new gs(t+" (signals must use all capital letters)"):new gs(t)}var xf=H((t,e="buffer")=>{if(!sf(t))throw new D(e,["Buffer","TypedArray","DataView"],t)});function Ef(t,e){let r=rf(e),i=t.length;if(r==="hex"&&i%2!==0)throw new lt("encoding",e,`is invalid for data of length ${i}`)}function Sf(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&ef(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new tf(e,t,r);return t|0}var Rs=H((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new D(e,"AbortSignal",t)}),If=H((t,e)=>{if(typeof t!="function")throw new D(e,"Function",t)}),Rf=H((t,e)=>{if(typeof t!="function"||nf(t))throw new D(e,"Function",t)}),Tf=H((t,e)=>{if(t!==void 0)throw new D(e,"undefined",t)});function Af(t,e,r){if(!ms(r,t))throw new D(e,`('${xs(r,"|")}')`,t)}var Nf=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function ws(t,e){if(typeof t>"u"||!Es(Nf,t))throw new lt(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function vf(t){if(typeof t=="string")return ws(t,"hints"),t;if(ni(t)){let e=t.length,r="";if(e===0)return r;for(let i=0;i<e;i++){let n=t[i];ws(n,"hints"),r+=n,i!==e-1&&(r+=", ")}return r}throw new lt("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Ts.exports={isInt32:of,isUint32:af,parseFileMode:ff,validateArray:sr,validateStringArray:gf,validateBooleanArray:yf,validateAbortSignalArray:wf,validateBoolean:Is,validateBuffer:xf,validateDictionary:bf,validateEncoding:Ef,validateFunction:If,validateInt32:df,validateInteger:cf,validateNumber:hf,validateObject:_f,validateOneOf:pf,validatePlainFunction:Rf,validatePort:Sf,validateSignalName:mf,validateString:oi,validateUint32:Ss,validateUndefined:Tf,validateUnion:Af,validateAbortSignal:Rs,validateLinkHeaderValue:vf}});var Re=S((R_,js)=>{var j=js.exports={},ee,te;function ai(){throw new Error("setTimeout has not been defined")}function li(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ee=setTimeout:ee=ai}catch{ee=ai}try{typeof clearTimeout=="function"?te=clearTimeout:te=li}catch{te=li}})();function As(t){if(ee===setTimeout)return setTimeout(t,0);if((ee===ai||!ee)&&setTimeout)return ee=setTimeout,setTimeout(t,0);try{return ee(t,0)}catch{try{return ee.call(null,t,0)}catch{return ee.call(this,t,0)}}}function jf(t){if(te===clearTimeout)return clearTimeout(t);if((te===li||!te)&&clearTimeout)return te=clearTimeout,clearTimeout(t);try{return te(t)}catch{try{return te.call(null,t)}catch{return te.call(this,t)}}}var _e=[],ft=!1,qe,or=-1;function Pf(){!ft||!qe||(ft=!1,qe.length?_e=qe.concat(_e):or=-1,_e.length&&Ns())}function Ns(){if(!ft){var t=As(Pf);ft=!0;for(var e=_e.length;e;){for(qe=_e,_e=[];++or<e;)qe&&qe[or].run();or=-1,e=_e.length}qe=null,ft=!1,jf(t)}}j.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];_e.push(new vs(t,e)),_e.length===1&&!ft&&As(Ns)};function vs(t,e){this.fun=t,this.array=e}vs.prototype.run=function(){this.fun.apply(null,this.array)};j.title="browser";j.browser=!0;j.env={};j.argv=[];j.version="";j.versions={};function be(){}j.on=be;j.addListener=be;j.once=be;j.off=be;j.removeListener=be;j.removeAllListeners=be;j.emit=be;j.prependListener=be;j.prependOnceListener=be;j.listeners=function(t){return[]};j.binding=function(t){throw new Error("process.binding is not supported")};j.cwd=function(){return"/"};j.chdir=function(t){throw new Error("process.chdir is not supported")};j.umask=function(){return 0}});var ie=S((T_,Vs)=>{"use strict";var{SymbolAsyncIterator:Ps,SymbolIterator:Ls,SymbolFor:Ue}=N(),Bs=Ue("nodejs.stream.destroyed"),Fs=Ue("nodejs.stream.errored"),ui=Ue("nodejs.stream.readable"),fi=Ue("nodejs.stream.writable"),Cs=Ue("nodejs.stream.disturbed"),Lf=Ue("nodejs.webstream.isClosedPromise"),Bf=Ue("nodejs.webstream.controllerErrorFunction");function ar(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function lr(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function Ff(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function re(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Os(t){return!!(t&&!re(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Ms(t){return!!(t&&!re(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Ds(t){return!!(t&&!re(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function Cf(t){return Os(t)||Ms(t)||Ds(t)}function Of(t,e){return t==null?!1:e===!0?typeof t[Ps]=="function":e===!1?typeof t[Ls]=="function":typeof t[Ps]=="function"||typeof t[Ls]=="function"}function ur(t){if(!re(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[Bs]||i!=null&&i.destroyed)}function $s(t){if(!lr(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Mf(t,e){if(!lr(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function Df(t){if(!ar(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function ks(t,e){if(!ar(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function qs(t){return t&&t[ui]!=null?t[ui]:typeof t?.readable!="boolean"?null:ur(t)?!1:ar(t)&&t.readable&&!ks(t)}function Us(t){return t&&t[fi]!=null?t[fi]:typeof t?.writable!="boolean"?null:ur(t)?!1:lr(t)&&t.writable&&!$s(t)}function $f(t,e){return re(t)?ur(t)?!0:!(e?.readable!==!1&&qs(t)||e?.writable!==!1&&Us(t)):null}function kf(t){var e,r;return re(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function qf(t){var e,r;return re(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function Uf(t){if(!re(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&Ws(t)?t._closed:null}function Ws(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Gs(t){return typeof t._sent100=="boolean"&&Ws(t)}function Wf(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function Gf(t){if(!re(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&Gs(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}function Vf(t){var e;return!!(t&&((e=t[Cs])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function Hf(t){var e,r,i,n,s,o,a,l,u,f;return!!(t&&((e=(r=(i=(n=(s=(o=t[Fs])!==null&&o!==void 0?o:t.readableErrored)!==null&&s!==void 0?s:t.writableErrored)!==null&&n!==void 0?n:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&i!==void 0?i:(l=t._writableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&r!==void 0?r:(u=t._readableState)===null||u===void 0?void 0:u.errored)!==null&&e!==void 0?e:!((f=t._writableState)===null||f===void 0)&&f.errored))}Vs.exports={isDestroyed:ur,kIsDestroyed:Bs,isDisturbed:Vf,kIsDisturbed:Cs,isErrored:Hf,kIsErrored:Fs,isReadable:qs,kIsReadable:ui,kIsClosedPromise:Lf,kControllerErrorFunction:Bf,kIsWritable:fi,isClosed:Uf,isDuplexNodeStream:Ff,isFinished:$f,isIterable:Of,isReadableNodeStream:ar,isReadableStream:Os,isReadableEnded:Df,isReadableFinished:ks,isReadableErrored:qf,isNodeStream:re,isWebStream:Cf,isWritable:Us,isWritableNodeStream:lr,isWritableStream:Ms,isWritableEnded:$s,isWritableFinished:Mf,isWritableErrored:kf,isServerRequest:Wf,isServerResponse:Gs,willEmitClose:Gf,isTransformStream:Ds}});var ge=S((A_,_i)=>{"use strict";var Te=Re(),{AbortError:eo,codes:Qf}=M(),{ERR_INVALID_ARG_TYPE:zf,ERR_STREAM_PREMATURE_CLOSE:Hs}=Qf,{kEmptyObject:di,once:hi}=$(),{validateAbortSignal:Kf,validateFunction:Yf,validateObject:Jf,validateBoolean:Xf}=ut(),{Promise:Zf,PromisePrototypeThen:ec,SymbolDispose:to}=N(),{isClosed:tc,isReadable:Qs,isReadableNodeStream:ci,isReadableStream:rc,isReadableFinished:zs,isReadableErrored:Ks,isWritable:Ys,isWritableNodeStream:Js,isWritableStream:ic,isWritableFinished:Xs,isWritableErrored:Zs,isNodeStream:nc,willEmitClose:sc,kIsClosedPromise:oc}=ie(),ct;function ac(t){return t.setHeader&&typeof t.abort=="function"}var pi=()=>{};function ro(t,e,r){var i,n;if(arguments.length===2?(r=e,e=di):e==null?e=di:Jf(e,"options"),Yf(r,"callback"),Kf(e.signal,"options.signal"),r=hi(r),rc(t)||ic(t))return lc(t,e,r);if(!nc(t))throw new zf("stream",["ReadableStream","WritableStream","Stream"],t);let s=(i=e.readable)!==null&&i!==void 0?i:ci(t),o=(n=e.writable)!==null&&n!==void 0?n:Js(t),a=t._writableState,l=t._readableState,u=()=>{t.writable||_()},f=sc(t)&&ci(t)===s&&Js(t)===o,c=Xs(t,!1),_=()=>{c=!0,t.destroyed&&(f=!1),!(f&&(!t.readable||s))&&(!s||h)&&r.call(t)},h=zs(t,!1),b=()=>{h=!0,t.destroyed&&(f=!1),!(f&&(!t.writable||o))&&(!o||c)&&r.call(t)},p=L=>{r.call(t,L)},y=tc(t),g=()=>{y=!0;let L=Zs(t)||Ks(t);if(L&&typeof L!="boolean")return r.call(t,L);if(s&&!h&&ci(t,!0)&&!zs(t,!1))return r.call(t,new Hs);if(o&&!c&&!Xs(t,!1))return r.call(t,new Hs);r.call(t)},E=()=>{y=!0;let L=Zs(t)||Ks(t);if(L&&typeof L!="boolean")return r.call(t,L);r.call(t)},A=()=>{t.req.on("finish",_)};ac(t)?(t.on("complete",_),f||t.on("abort",g),t.req?A():t.on("request",A)):o&&!a&&(t.on("end",u),t.on("close",u)),!f&&typeof t.aborted=="boolean"&&t.on("aborted",g),t.on("end",b),t.on("finish",_),e.error!==!1&&t.on("error",p),t.on("close",g),y?Te.nextTick(g):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?f||Te.nextTick(E):(!s&&(!f||Qs(t))&&(c||Ys(t)===!1)||!o&&(!f||Ys(t))&&(h||Qs(t)===!1)||l&&t.req&&t.aborted)&&Te.nextTick(E);let w=()=>{r=pi,t.removeListener("aborted",g),t.removeListener("complete",_),t.removeListener("abort",g),t.removeListener("request",A),t.req&&t.req.removeListener("finish",_),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",_),t.removeListener("end",b),t.removeListener("error",p),t.removeListener("close",g)};if(e.signal&&!y){let L=()=>{let Pe=r;w(),Pe.call(t,new eo(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Te.nextTick(L);else{ct=ct||$().addAbortListener;let Pe=ct(e.signal,L),G=r;r=hi((...Je)=>{Pe[to](),G.apply(t,Je)})}}return w}function lc(t,e,r){let i=!1,n=pi;if(e.signal)if(n=()=>{i=!0,r.call(t,new eo(void 0,{cause:e.signal.reason}))},e.signal.aborted)Te.nextTick(n);else{ct=ct||$().addAbortListener;let o=ct(e.signal,n),a=r;r=hi((...l)=>{o[to](),a.apply(t,l)})}let s=(...o)=>{i||Te.nextTick(()=>r.apply(t,o))};return ec(t[oc].promise,s,s),pi}function uc(t,e){var r;let i=!1;return e===null&&(e=di),(r=e)!==null&&r!==void 0&&r.cleanup&&(Xf(e.cleanup,"cleanup"),i=e.cleanup),new Zf((n,s)=>{let o=ro(t,e,a=>{i&&o(),a?s(a):n()})})}_i.exports=ro;_i.exports.finished=uc});var We=S((N_,fo)=>{"use strict";var ne=Re(),{aggregateTwoErrors:fc,codes:{ERR_MULTIPLE_CALLBACK:cc},AbortError:dc}=M(),{Symbol:so}=N(),{kIsDestroyed:hc,isDestroyed:pc,isFinished:_c,isServerRequest:bc}=ie(),oo=so("kDestroy"),bi=so("kConstruct");function ao(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function gc(t,e){let r=this._readableState,i=this._writableState,n=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(ao(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?io(this,t,e):this.once(oo,function(s){io(this,fc(s,t),e)}),this)}function io(t,e,r){let i=!1;function n(s){if(i)return;i=!0;let o=t._readableState,a=t._writableState;ao(s,a,o),a&&(a.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?ne.nextTick(yc,t,s):ne.nextTick(lo,t)}try{t._destroy(e||null,n)}catch(s){n(s)}}function yc(t,e){gi(t,e),lo(t)}function lo(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}function gi(t,e){let r=t._readableState,i=t._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function wc(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function yi(t,e,r){let i=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),i&&!i.errored&&(i.errored=e),r?ne.nextTick(gi,t,e):gi(t,e))}function mc(t,e){if(typeof t._construct!="function")return;let r=t._readableState,i=t._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),t.once(bi,e),!(t.listenerCount(bi)>1)&&ne.nextTick(xc,t)}function xc(t){let e=!1;function r(i){if(e){yi(t,i??new cc);return}e=!0;let n=t._readableState,s=t._writableState,o=s||n;n&&(n.constructed=!0),s&&(s.constructed=!0),o.destroyed?t.emit(oo,i):i?yi(t,i,!0):ne.nextTick(Ec,t)}try{t._construct(i=>{ne.nextTick(r,i)})}catch(i){ne.nextTick(r,i)}}function Ec(t){t.emit(bi)}function no(t){return t?.setHeader&&typeof t.abort=="function"}function uo(t){t.emit("close")}function Sc(t,e){t.emit("error",e),ne.nextTick(uo,t)}function Ic(t,e){!t||pc(t)||(!e&&!_c(t)&&(e=new dc),bc(t)?(t.socket=null,t.destroy(e)):no(t)?t.abort():no(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?ne.nextTick(Sc,t,e):ne.nextTick(uo,t),t.destroyed||(t[hc]=!0))}fo.exports={construct:mc,destroyer:Ic,destroy:gc,undestroy:wc,errorOrDestroy:yi}});var dr=S((v_,ho)=>{"use strict";var{ArrayIsArray:Rc,ObjectSetPrototypeOf:co}=N(),{EventEmitter:fr}=vt();function cr(t){fr.call(this,t)}co(cr.prototype,fr.prototype);co(cr,fr);cr.prototype.pipe=function(t,e){let r=this;function i(f){t.writable&&t.write(f)===!1&&r.pause&&r.pause()}r.on("data",i);function n(){r.readable&&r.resume&&r.resume()}t.on("drain",n),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",o),r.on("close",a));let s=!1;function o(){s||(s=!0,t.end())}function a(){s||(s=!0,typeof t.destroy=="function"&&t.destroy())}function l(f){u(),fr.listenerCount(this,"error")===0&&this.emit("error",f)}wi(r,"error",l),wi(t,"error",l);function u(){r.removeListener("data",i),t.removeListener("drain",n),r.removeListener("end",o),r.removeListener("close",a),r.removeListener("error",l),t.removeListener("error",l),r.removeListener("end",u),r.removeListener("close",u),t.removeListener("close",u)}return r.on("end",u),r.on("close",u),t.on("close",u),t.emit("pipe",r),t};function wi(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Rc(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}ho.exports={Stream:cr,prependListener:wi}});var jt=S((j_,hr)=>{"use strict";var{SymbolDispose:Tc}=N(),{AbortError:po,codes:Ac}=M(),{isNodeStream:_o,isWebStream:Nc,kControllerErrorFunction:vc}=ie(),jc=ge(),{ERR_INVALID_ARG_TYPE:bo}=Ac,mi,Pc=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new bo(e,"AbortSignal",t)};hr.exports.addAbortSignal=function(e,r){if(Pc(e,"signal"),!_o(r)&&!Nc(r))throw new bo("stream",["ReadableStream","WritableStream","Stream"],r);return hr.exports.addAbortSignalNoValidate(e,r)};hr.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=_o(e)?()=>{e.destroy(new po(void 0,{cause:t.reason}))}:()=>{e[vc](new po(void 0,{cause:t.reason}))};if(t.aborted)r();else{mi=mi||$().addAbortListener;let i=mi(t,r);jc(e,i[Tc])}return e}});var wo=S((L_,yo)=>{"use strict";var{StringPrototypeSlice:go,SymbolIterator:Lc,TypedArrayPrototypeSet:pr,Uint8Array:Bc}=N(),{Buffer:xi}=X(),{inspect:Fc}=$();yo.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let r=this.head,i=""+r.data;for(;(r=r.next)!==null;)i+=e+r.data;return i}concat(e){if(this.length===0)return xi.alloc(0);let r=xi.allocUnsafe(e>>>0),i=this.head,n=0;for(;i;)pr(r,i.data,n),n+=i.data.length,i=i.next;return r}consume(e,r){let i=this.head.data;if(e<i.length){let n=i.slice(0,e);return this.head.data=i.slice(e),n}return e===i.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[Lc](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",i=this.head,n=0;do{let s=i.data;if(e>s.length)r+=s,e-=s.length;else{e===s.length?(r+=s,++n,i.next?this.head=i.next:this.head=this.tail=null):(r+=go(s,0,e),this.head=i,i.data=go(s,e));break}++n}while((i=i.next)!==null);return this.length-=n,r}_getBuffer(e){let r=xi.allocUnsafe(e),i=e,n=this.head,s=0;do{let o=n.data;if(e>o.length)pr(r,o,i-e),e-=o.length;else{e===o.length?(pr(r,o,i-e),++s,n.next?this.head=n.next:this.head=this.tail=null):(pr(r,new Bc(o.buffer,o.byteOffset,e),i-e),this.head=n,n.data=o.slice(e));break}++s}while((n=n.next)!==null);return this.length-=s,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return Fc(this,{...r,depth:0,customInspect:!1})}}});var Pt=S((B_,So)=>{"use strict";var{MathFloor:Cc,NumberIsInteger:Oc}=N(),{validateInteger:Mc}=ut(),{ERR_INVALID_ARG_VALUE:Dc}=M().codes,mo=16*1024,xo=16;function $c(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Eo(t){return t?xo:mo}function kc(t,e){Mc(e,"value",0),t?xo=e:mo=e}function qc(t,e,r,i){let n=$c(e,i,r);if(n!=null){if(!Oc(n)||n<0){let s=i?`options.${r}`:"options.highWaterMark";throw new Dc(s,n)}return Cc(n)}return Eo(t.objectMode)}So.exports={getHighWaterMark:qc,getDefaultHighWaterMark:Eo,setDefaultHighWaterMark:kc}});var To=S((Ei,Ro)=>{var _r=X(),se=_r.Buffer;function Io(t,e){for(var r in t)e[r]=t[r]}se.from&&se.alloc&&se.allocUnsafe&&se.allocUnsafeSlow?Ro.exports=_r:(Io(_r,Ei),Ei.Buffer=Ge);function Ge(t,e,r){return se(t,e,r)}Ge.prototype=Object.create(se.prototype);Io(se,Ge);Ge.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return se(t,e,r)};Ge.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=se(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};Ge.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return se(t)};Ge.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return _r.SlowBuffer(t)}});var vo=S(No=>{"use strict";var Ii=To().Buffer,Ao=Ii.isEncoding||function(t){switch(t=""+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 Uc(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}}function Wc(t){var e=Uc(t);if(typeof e!="string"&&(Ii.isEncoding===Ao||!Ao(t)))throw new Error("Unknown encoding: "+t);return e||t}No.StringDecoder=Lt;function Lt(t){this.encoding=Wc(t);var e;switch(this.encoding){case"utf16le":this.text=Kc,this.end=Yc,e=4;break;case"utf8":this.fillLast=Hc,e=4;break;case"base64":this.text=Jc,this.end=Xc,e=3;break;default:this.write=Zc,this.end=ed;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Ii.allocUnsafe(e)}Lt.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};Lt.prototype.end=zc;Lt.prototype.text=Qc;Lt.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 Si(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Gc(t,e,r){var i=e.length-1;if(i<r)return 0;var n=Si(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=Si(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=Si(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}function Vc(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function Hc(t){var e=this.lastTotal-this.lastNeed,r=Vc(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function Qc(t,e){var r=Gc(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)}function zc(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Kc(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 Yc(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 Jc(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?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 Xc(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Zc(t){return t.toString(this.encoding)}function ed(t){return t&&t.length?this.write(t):""}});var Ri=S((C_,Bo)=>{"use strict";var jo=Re(),{PromisePrototypeThen:td,SymbolAsyncIterator:Po,SymbolIterator:Lo}=N(),{Buffer:rd}=X(),{ERR_INVALID_ARG_TYPE:id,ERR_STREAM_NULL_VALUES:nd}=M().codes;function sd(t,e,r){let i;if(typeof e=="string"||e instanceof rd)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let n;if(e&&e[Po])n=!0,i=e[Po]();else if(e&&e[Lo])n=!1,i=e[Lo]();else throw new id("iterable",["Iterable"],e);let s=new t({objectMode:!0,highWaterMark:1,...r}),o=!1;s._read=function(){o||(o=!0,l())},s._destroy=function(u,f){td(a(u),()=>jo.nextTick(f,u),c=>jo.nextTick(f,c||u))};async function a(u){let f=u!=null,c=typeof i.throw=="function";if(f&&c){let{value:_,done:h}=await i.throw(u);if(await _,h)return}if(typeof i.return=="function"){let{value:_}=await i.return();await _}}async function l(){for(;;){try{let{value:u,done:f}=n?await i.next():i.next();if(f)s.push(null);else{let c=u&&typeof u.then=="function"?await u:u;if(c===null)throw o=!1,new nd;if(s.push(c))continue;o=!1}}catch(u){s.destroy(u)}break}}return s}Bo.exports=sd});var Ft=S((O_,Jo)=>{"use strict";var z=Re(),{ArrayPrototypeIndexOf:od,NumberIsInteger:ad,NumberIsNaN:ld,NumberParseInt:ud,ObjectDefineProperties:Bi,ObjectKeys:fd,ObjectSetPrototypeOf:Oo,Promise:Mo,SafeSet:cd,SymbolAsyncDispose:dd,SymbolAsyncIterator:hd,Symbol:pd}=N();Jo.exports=m;m.ReadableState=wr;var{EventEmitter:_d}=vt(),{Stream:Ae,prependListener:bd}=dr(),{Buffer:Ti}=X(),{addAbortSignal:gd}=jt(),Do=ge(),x=$().debuglog("stream",t=>{x=t}),yd=wo(),pt=We(),{getHighWaterMark:wd,getDefaultHighWaterMark:md}=Pt(),{aggregateTwoErrors:Fo,codes:{ERR_INVALID_ARG_TYPE:xd,ERR_METHOD_NOT_IMPLEMENTED:Ed,ERR_OUT_OF_RANGE:Sd,ERR_STREAM_PUSH_AFTER_EOF:Id,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:Rd},AbortError:Td}=M(),{validateObject:Ad}=ut(),Ve=pd("kPaused"),{StringDecoder:$o}=vo(),Nd=Ri();Oo(m.prototype,Ae.prototype);Oo(m,Ae);var Ai=()=>{},{errorOrDestroy:dt}=pt,ht=1,vd=2,ko=4,Bt=8,qo=16,br=32,gr=64,Uo=128,jd=256,Pd=512,Ld=1024,Pi=2048,Li=4096,Bd=8192,Fd=16384,Cd=32768,Wo=65536,Od=1<<17,Md=1<<18;function B(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}Bi(wr.prototype,{objectMode:B(ht),ended:B(vd),endEmitted:B(ko),reading:B(Bt),constructed:B(qo),sync:B(br),needReadable:B(gr),emittedReadable:B(Uo),readableListening:B(jd),resumeScheduled:B(Pd),errorEmitted:B(Ld),emitClose:B(Pi),autoDestroy:B(Li),destroyed:B(Bd),closed:B(Fd),closeEmitted:B(Cd),multiAwaitDrain:B(Wo),readingMore:B(Od),dataEmitted:B(Md)});function wr(t,e,r){typeof r!="boolean"&&(r=e instanceof oe()),this.state=Pi|Li|qo|br,t&&t.objectMode&&(this.state|=ht),r&&t&&t.readableObjectMode&&(this.state|=ht),this.highWaterMark=t?wd(this,t,"readableHighWaterMark",r):md(!1),this.buffer=new yd,this.length=0,this.pipes=[],this.flowing=null,this[Ve]=null,t&&t.emitClose===!1&&(this.state&=~Pi),t&&t.autoDestroy===!1&&(this.state&=~Li),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new $o(t.encoding),this.encoding=t.encoding)}function m(t){if(!(this instanceof m))return new m(t);let e=this instanceof oe();this._readableState=new wr(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&gd(t.signal,this)),Ae.call(this,t),pt.construct(this,()=>{this._readableState.needReadable&&yr(this,this._readableState)})}m.prototype.destroy=pt.destroy;m.prototype._undestroy=pt.undestroy;m.prototype._destroy=function(t,e){e(t)};m.prototype[_d.captureRejectionSymbol]=function(t){this.destroy(t)};m.prototype[dd]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new Td,this.destroy(t)),new Mo((e,r)=>Do(this,i=>i&&i!==t?r(i):e(null)))};m.prototype.push=function(t,e){return Go(this,t,e,!1)};m.prototype.unshift=function(t,e){return Go(this,t,e,!0)};function Go(t,e,r,i){x("readableAddChunk",e);let n=t._readableState,s;if((n.state&ht)===0&&(typeof e=="string"?(r=r||n.defaultEncoding,n.encoding!==r&&(i&&n.encoding?e=Ti.from(e,r).toString(n.encoding):(e=Ti.from(e,r),r=""))):e instanceof Ti?r="":Ae._isUint8Array(e)?(e=Ae._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new xd("chunk",["string","Buffer","Uint8Array"],e))),s)dt(t,s);else if(e===null)n.state&=~Bt,kd(t,n);else if((n.state&ht)!==0||e&&e.length>0)if(i)if((n.state&ko)!==0)dt(t,new Rd);else{if(n.destroyed||n.errored)return!1;Ni(t,n,e,!0)}else if(n.ended)dt(t,new Id);else{if(n.destroyed||n.errored)return!1;n.state&=~Bt,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?Ni(t,n,e,!1):yr(t,n)):Ni(t,n,e,!1)}else i||(n.state&=~Bt,yr(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}function Ni(t,e,r,i){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&Wo)!==0?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),(e.state&gr)!==0&&mr(t)),yr(t,e)}m.prototype.isPaused=function(){let t=this._readableState;return t[Ve]===!0||t.flowing===!1};m.prototype.setEncoding=function(t){let e=new $o(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,i="";for(let n of r)i+=e.write(n);return r.clear(),i!==""&&r.push(i),this._readableState.length=i.length,this};var Dd=1073741824;function $d(t){if(t>Dd)throw new Sd("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Co(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&ht)!==0?1:ld(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}m.prototype.read=function(t){x("read",t),t===void 0?t=NaN:ad(t)||(t=ud(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=$d(t)),t!==0&&(e.state&=~Uo),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return x("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?vi(this):mr(this),null;if(t=Co(t,e),t===0&&e.ended)return e.length===0&&vi(this),null;let i=(e.state&gr)!==0;if(x("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,x("length less than watermark",i)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)i=!1,x("reading, ended or constructing",i);else if(i){x("do read"),e.state|=Bt|br,e.length===0&&(e.state|=gr);try{this._read(e.highWaterMark)}catch(s){dt(this,s)}e.state&=~br,e.reading||(t=Co(r,e))}let n;return t>0?n=Ko(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&vi(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function kd(t,e){if(x("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?mr(t):(e.needReadable=!1,e.emittedReadable=!0,Vo(t))}}function mr(t){let e=t._readableState;x("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(x("emitReadable",e.flowing),e.emittedReadable=!0,z.nextTick(Vo,t))}function Vo(t){let e=t._readableState;x("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Qo(t)}function yr(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,z.nextTick(qd,t,e))}function qd(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(x("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}m.prototype._read=function(t){throw new Ed("_read()")};m.prototype.pipe=function(t,e){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new cd(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(t),x("pipe count=%d opts=%j",i.pipes.length,e);let s=(!e||e.end!==!1)&&t!==z.stdout&&t!==z.stderr?a:y;i.endEmitted?z.nextTick(s):r.once("end",s),t.on("unpipe",o);function o(g,E){x("onunpipe"),g===r&&E&&E.hasUnpiped===!1&&(E.hasUnpiped=!0,f())}function a(){x("onend"),t.end()}let l,u=!1;function f(){x("cleanup"),t.removeListener("close",b),t.removeListener("finish",p),l&&t.removeListener("drain",l),t.removeListener("error",h),t.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",y),r.removeListener("data",_),u=!0,l&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&l()}function c(){u||(i.pipes.length===1&&i.pipes[0]===t?(x("false write response, pause",0),i.awaitDrainWriters=t,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(t)&&(x("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),r.pause()),l||(l=Ud(r,t),t.on("drain",l))}r.on("data",_);function _(g){x("ondata");let E=t.write(g);x("dest.write",E),E===!1&&c()}function h(g){if(x("onerror",g),y(),t.removeListener("error",h),t.listenerCount("error")===0){let E=t._writableState||t._readableState;E&&!E.errorEmitted?dt(t,g):t.emit("error",g)}}bd(t,"error",h);function b(){t.removeListener("finish",p),y()}t.once("close",b);function p(){x("onfinish"),t.removeListener("close",b),y()}t.once("finish",p);function y(){x("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?c():i.flowing||(x("pipe resume"),r.resume()),t};function Ud(t,e){return function(){let i=t._readableState;i.awaitDrainWriters===e?(x("pipeOnDrain",1),i.awaitDrainWriters=null):i.multiAwaitDrain&&(x("pipeOnDrain",i.awaitDrainWriters.size),i.awaitDrainWriters.delete(e)),(!i.awaitDrainWriters||i.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}m.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let s=0;s<n.length;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}let i=od(e.pipes,t);return i===-1?this:(e.pipes.splice(i,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};m.prototype.on=function(t,e){let r=Ae.prototype.on.call(this,t,e),i=this._readableState;return t==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,x("on readable",i.length,i.reading),i.length?mr(this):i.reading||z.nextTick(Wd,this)),r};m.prototype.addListener=m.prototype.on;m.prototype.removeListener=function(t,e){let r=Ae.prototype.removeListener.call(this,t,e);return t==="readable"&&z.nextTick(Ho,this),r};m.prototype.off=m.prototype.removeListener;m.prototype.removeAllListeners=function(t){let e=Ae.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&z.nextTick(Ho,this),e};function Ho(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[Ve]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function Wd(t){x("readable nexttick read 0"),t.read(0)}m.prototype.resume=function(){let t=this._readableState;return t.flowing||(x("resume"),t.flowing=!t.readableListening,Gd(this,t)),t[Ve]=!1,this};function Gd(t,e){e.resumeScheduled||(e.resumeScheduled=!0,z.nextTick(Vd,t,e))}function Vd(t,e){x("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Qo(t),e.flowing&&!e.reading&&t.read(0)}m.prototype.pause=function(){return x("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(x("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[Ve]=!0,this};function Qo(t){let e=t._readableState;for(x("flow",e.flowing);e.flowing&&t.read()!==null;);}m.prototype.wrap=function(t){let e=!1;t.on("data",i=>{!this.push(i)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",i=>{dt(this,i)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=fd(t);for(let i=1;i<r.length;i++){let n=r[i];this[n]===void 0&&typeof t[n]=="function"&&(this[n]=t[n].bind(t))}return this};m.prototype[hd]=function(){return zo(this)};m.prototype.iterator=function(t){return t!==void 0&&Ad(t,"options"),zo(this,t)};function zo(t,e){typeof t.read!="function"&&(t=m.wrap(t,{objectMode:!0}));let r=Hd(t,e);return r.stream=t,r}async function*Hd(t,e){let r=Ai;function i(o){this===t?(r(),r=Ai):r=o}t.on("readable",i);let n,s=Do(t,{writable:!1},o=>{n=o?Fo(n,o):null,r(),r=Ai});try{for(;;){let o=t.destroyed?null:t.read();if(o!==null)yield o;else{if(n)throw n;if(n===null)return;await new Mo(i)}}}catch(o){throw n=Fo(n,o),n}finally{(n||e?.destroyOnReturn!==!1)&&(n===void 0||t._readableState.autoDestroy)?pt.destroyer(t,null):(t.off("readable",i),s())}}Bi(m.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});Bi(wr.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Ve]!==!1},set(t){this[Ve]=!!t}}});m._fromList=Ko;function Ko(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function vi(t){let e=t._readableState;x("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,z.nextTick(Qd,e,t))}function Qd(t,e){if(x("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)z.nextTick(zd,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function zd(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}m.from=function(t,e){return Nd(m,t,e)};var ji;function Yo(){return ji===void 0&&(ji={}),ji}m.fromWeb=function(t,e){return Yo().newStreamReadableFromReadableStream(t,e)};m.toWeb=function(t,e){return Yo().newReadableStreamFromStreamReadable(t,e)};m.wrap=function(t,e){var r,i;return new m({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(n,s){pt.destroyer(t,n),s(n)}}).wrap(t)}});var Rr=S((M_,ua)=>{"use strict";var He=Re(),{ArrayPrototypeSlice:ea,Error:Kd,FunctionPrototypeSymbolHasInstance:ta,ObjectDefineProperty:ra,ObjectDefineProperties:Yd,ObjectSetPrototypeOf:ia,StringPrototypeToLowerCase:Jd,Symbol:Xd,SymbolHasInstance:Zd}=N();ua.exports=v;v.WritableState=Mt;var{EventEmitter:eh}=vt(),Ct=dr().Stream,{Buffer:xr}=X(),Ir=We(),{addAbortSignal:th}=jt(),{getHighWaterMark:rh,getDefaultHighWaterMark:ih}=Pt(),{ERR_INVALID_ARG_TYPE:nh,ERR_METHOD_NOT_IMPLEMENTED:sh,ERR_MULTIPLE_CALLBACK:na,ERR_STREAM_CANNOT_PIPE:oh,ERR_STREAM_DESTROYED:Ot,ERR_STREAM_ALREADY_FINISHED:ah,ERR_STREAM_NULL_VALUES:lh,ERR_STREAM_WRITE_AFTER_END:uh,ERR_UNKNOWN_ENCODING:sa}=M().codes,{errorOrDestroy:_t}=Ir;ia(v.prototype,Ct.prototype);ia(v,Ct);function Oi(){}var bt=Xd("kOnFinished");function Mt(t,e,r){typeof r!="boolean"&&(r=e instanceof oe()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?rh(this,t,"writableHighWaterMark",r):ih(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let i=!!(t&&t.decodeStrings===!1);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=ch.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Sr(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[bt]=[]}function Sr(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Mt.prototype.getBuffer=function(){return ea(this.buffered,this.bufferedIndex)};ra(Mt.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function v(t){let e=this instanceof oe();if(!e&&!ta(v,this))return new v(t);this._writableState=new Mt(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&th(t.signal,this)),Ct.call(this,t),Ir.construct(this,()=>{let r=this._writableState;r.writing||Di(this,r),$i(this,r)})}ra(v,Zd,{__proto__:null,value:function(t){return ta(this,t)?!0:this!==v?!1:t&&t._writableState instanceof Mt}});v.prototype.pipe=function(){_t(this,new oh)};function oa(t,e,r,i){let n=t._writableState;if(typeof r=="function")i=r,r=n.defaultEncoding;else{if(!r)r=n.defaultEncoding;else if(r!=="buffer"&&!xr.isEncoding(r))throw new sa(r);typeof i!="function"&&(i=Oi)}if(e===null)throw new lh;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=xr.from(e,r),r="buffer");else if(e instanceof xr)r="buffer";else if(Ct._isUint8Array(e))e=Ct._uint8ArrayToBuffer(e),r="buffer";else throw new nh("chunk",["string","Buffer","Uint8Array"],e);let s;return n.ending?s=new uh:n.destroyed&&(s=new Ot("write")),s?(He.nextTick(i,s),_t(t,s,!0),s):(n.pendingcb++,fh(t,n,e,r,i))}v.prototype.write=function(t,e,r){return oa(this,t,e,r)===!0};v.prototype.cork=function(){this._writableState.corked++};v.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Di(this,t))};v.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=Jd(e)),!xr.isEncoding(e))throw new sa(e);return this._writableState.defaultEncoding=e,this};function fh(t,e,r,i,n){let s=e.objectMode?1:r.length;e.length+=s;let o=e.length<e.highWaterMark;return o||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:i,callback:n}),e.allBuffers&&i!=="buffer"&&(e.allBuffers=!1),e.allNoop&&n!==Oi&&(e.allNoop=!1)):(e.writelen=s,e.writecb=n,e.writing=!0,e.sync=!0,t._write(r,i,e.onwrite),e.sync=!1),o&&!e.errored&&!e.destroyed}function Xo(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Ot("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function Zo(t,e,r,i){--e.pendingcb,i(r),Mi(e),_t(t,r)}function ch(t,e){let r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function"){_t(t,new na);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),i?He.nextTick(Zo,t,r,e,n):Zo(t,r,e,n)):(r.buffered.length>r.bufferedIndex&&Di(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},He.nextTick(dh,r.afterWriteTickInfo)):aa(t,r,1,n))}function dh({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,aa(t,e,r,i)}function aa(t,e,r,i){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,i();e.destroyed&&Mi(e),$i(t,e)}function Mi(t){if(t.writing)return;for(let n=t.bufferedIndex;n<t.buffered.length;++n){var e;let{chunk:s,callback:o}=t.buffered[n],a=t.objectMode?1:s.length;t.length-=a,o((e=t.errored)!==null&&e!==void 0?e:new Ot("write"))}let r=t[bt].splice(0);for(let n=0;n<r.length;n++){var i;r[n]((i=t.errored)!==null&&i!==void 0?i:new Ot("end"))}Sr(t)}function Di(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:i,objectMode:n}=e,s=r.length-i;if(!s)return;let o=i;if(e.bufferProcessing=!0,s>1&&t._writev){e.pendingcb-=s-1;let a=e.allNoop?Oi:u=>{for(let f=o;f<r.length;++f)r[f].callback(u)},l=e.allNoop&&o===0?r:ea(r,o);l.allBuffers=e.allBuffers,Xo(t,e,!0,e.length,l,"",a),Sr(e)}else{do{let{chunk:a,encoding:l,callback:u}=r[o];r[o++]=null;let f=n?1:a.length;Xo(t,e,!1,f,a,l,u)}while(o<r.length&&!e.writing);o===r.length?Sr(e):o>256?(r.splice(0,o),e.bufferedIndex=0):e.bufferedIndex=o}e.bufferProcessing=!1}v.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new sh("_write()")};v.prototype._writev=null;v.prototype.end=function(t,e,r){let i=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let n;if(t!=null){let s=oa(this,t,e);s instanceof Kd&&(n=s)}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,$i(this,i,!0),i.ended=!0):i.finished?n=new ah("end"):i.destroyed&&(n=new Ot("end"))),typeof r=="function"&&(n||i.finished?He.nextTick(r,n):i[bt].push(r)),this};function Er(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function hh(t,e){let r=!1;function i(n){if(r){_t(t,n??na());return}if(r=!0,e.pendingcb--,n){let s=e[bt].splice(0);for(let o=0;o<s.length;o++)s[o](n);_t(t,n,e.sync)}else Er(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,He.nextTick(Ci,t,e))}e.sync=!0,e.pendingcb++;try{t._final(i)}catch(n){i(n)}e.sync=!1}function ph(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,hh(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function $i(t,e,r){Er(e)&&(ph(t,e),e.pendingcb===0&&(r?(e.pendingcb++,He.nextTick((i,n)=>{Er(n)?Ci(i,n):n.pendingcb--},t,e)):Er(e)&&(e.pendingcb++,Ci(t,e))))}function Ci(t,e){e.pendingcb--,e.finished=!0;let r=e[bt].splice(0);for(let i=0;i<r.length;i++)r[i]();if(t.emit("finish"),e.autoDestroy){let i=t._readableState;(!i||i.autoDestroy&&(i.endEmitted||i.readable===!1))&&t.destroy()}}Yd(v.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var _h=Ir.destroy;v.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[bt].length)&&He.nextTick(Mi,r),_h.call(this,t,e),this};v.prototype._undestroy=Ir.undestroy;v.prototype._destroy=function(t,e){e(t)};v.prototype[eh.captureRejectionSymbol]=function(t){this.destroy(t)};var Fi;function la(){return Fi===void 0&&(Fi={}),Fi}v.fromWeb=function(t,e){return la().newStreamWritableFromWritableStream(t,e)};v.toWeb=function(t){return la().newWritableStreamFromStreamWritable(t)}});var Ia=S((D_,Sa)=>{var ki=Re(),bh=X(),{isReadable:gh,isWritable:yh,isIterable:fa,isNodeStream:wh,isReadableNodeStream:ca,isWritableNodeStream:da,isDuplexNodeStream:mh,isReadableStream:ha,isWritableStream:pa}=ie(),_a=ge(),{AbortError:xa,codes:{ERR_INVALID_ARG_TYPE:xh,ERR_INVALID_RETURN_VALUE:ba}}=M(),{destroyer:yt}=We(),Eh=oe(),Ea=Ft(),Sh=Rr(),{createDeferredPromise:ga}=$(),ya=Ri(),wa=globalThis.Blob||bh.Blob,Ih=typeof wa<"u"?function(e){return e instanceof wa}:function(e){return!1},Rh=globalThis.AbortController||ot().AbortController,{FunctionPrototypeCall:ma}=N(),Ne=class extends Eh{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};Sa.exports=function t(e,r){if(mh(e))return e;if(ca(e))return gt({readable:e});if(da(e))return gt({writable:e});if(wh(e))return gt({writable:!1,readable:!1});if(ha(e))return gt({readable:Ea.fromWeb(e)});if(pa(e))return gt({writable:Sh.fromWeb(e)});if(typeof e=="function"){let{value:n,write:s,final:o,destroy:a}=Th(e);if(fa(n))return ya(Ne,n,{objectMode:!0,write:s,final:o,destroy:a});let l=n?.then;if(typeof l=="function"){let u,f=ma(l,n,c=>{if(c!=null)throw new ba("nully","body",c)},c=>{yt(u,c)});return u=new Ne({objectMode:!0,readable:!1,write:s,final(c){o(async()=>{try{await f,ki.nextTick(c,null)}catch(_){ki.nextTick(c,_)}})},destroy:a})}throw new ba("Iterable, AsyncIterable or AsyncFunction",r,n)}if(Ih(e))return t(e.arrayBuffer());if(fa(e))return ya(Ne,e,{objectMode:!0,writable:!1});if(ha(e?.readable)&&pa(e?.writable))return Ne.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let n=e!=null&&e.readable?ca(e?.readable)?e?.readable:t(e.readable):void 0,s=e!=null&&e.writable?da(e?.writable)?e?.writable:t(e.writable):void 0;return gt({readable:n,writable:s})}let i=e?.then;if(typeof i=="function"){let n;return ma(i,e,s=>{s!=null&&n.push(s),n.push(null)},s=>{yt(n,s)}),n=new Ne({objectMode:!0,writable:!1,read(){}})}throw new xh(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function Th(t){let{promise:e,resolve:r}=ga(),i=new Rh,n=i.signal;return{value:t((async function*(){for(;;){let o=e;e=null;let{chunk:a,done:l,cb:u}=await o;if(ki.nextTick(u),l)return;if(n.aborted)throw new xa(void 0,{cause:n.reason});({promise:e,resolve:r}=ga()),yield a}})(),{signal:n}),write(o,a,l){let u=r;r=null,u({chunk:o,done:!1,cb:l})},final(o){let a=r;r=null,a({done:!0,cb:o})},destroy(o,a){i.abort(),a(o)}}}function gt(t){let e=t.readable&&typeof t.readable.read!="function"?Ea.wrap(t.readable):t.readable,r=t.writable,i=!!gh(e),n=!!yh(r),s,o,a,l,u;function f(c){let _=l;l=null,_?_(c):c&&u.destroy(c)}return u=new Ne({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(_a(r,c=>{n=!1,c&&yt(e,c),f(c)}),u._write=function(c,_,h){r.write(c,_)?h():s=h},u._final=function(c){r.end(),o=c},r.on("drain",function(){if(s){let c=s;s=null,c()}}),r.on("finish",function(){if(o){let c=o;o=null,c()}})),i&&(_a(e,c=>{i=!1,c&&yt(e,c),f(c)}),e.on("readable",function(){if(a){let c=a;a=null,c()}}),e.on("end",function(){u.push(null)}),u._read=function(){for(;;){let c=e.read();if(c===null){a=u._read;return}if(!u.push(c))return}}),u._destroy=function(c,_){!c&&l!==null&&(c=new xa),a=null,s=null,o=null,l===null?_(c):(l=_,yt(r,c),yt(e,c))},u}});var oe=S(($_,Aa)=>{"use strict";var{ObjectDefineProperties:Ah,ObjectGetOwnPropertyDescriptor:ye,ObjectKeys:Nh,ObjectSetPrototypeOf:Ra}=N();Aa.exports=K;var Wi=Ft(),Q=Rr();Ra(K.prototype,Wi.prototype);Ra(K,Wi);{let t=Nh(Q.prototype);for(let e=0;e<t.length;e++){let r=t[e];K.prototype[r]||(K.prototype[r]=Q.prototype[r])}}function K(t){if(!(this instanceof K))return new K(t);Wi.call(this,t),Q.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}Ah(K.prototype,{writable:{__proto__:null,...ye(Q.prototype,"writable")},writableHighWaterMark:{__proto__:null,...ye(Q.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...ye(Q.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...ye(Q.prototype,"writableBuffer")},writableLength:{__proto__:null,...ye(Q.prototype,"writableLength")},writableFinished:{__proto__:null,...ye(Q.prototype,"writableFinished")},writableCorked:{__proto__:null,...ye(Q.prototype,"writableCorked")},writableEnded:{__proto__:null,...ye(Q.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...ye(Q.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var qi;function Ta(){return qi===void 0&&(qi={}),qi}K.fromWeb=function(t,e){return Ta().newStreamDuplexFromReadableWritablePair(t,e)};K.toWeb=function(t){return Ta().newReadableWritablePairFromDuplex(t)};var Ui;K.from=function(t){return Ui||(Ui=Ia()),Ui(t,"body")}});var Hi=S((k_,va)=>{"use strict";var{ObjectSetPrototypeOf:Na,Symbol:vh}=N();va.exports=we;var{ERR_METHOD_NOT_IMPLEMENTED:jh}=M().codes,Vi=oe(),{getHighWaterMark:Ph}=Pt();Na(we.prototype,Vi.prototype);Na(we,Vi);var Dt=vh("kCallback");function we(t){if(!(this instanceof we))return new we(t);let e=t?Ph(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),Vi.call(this,t),this._readableState.sync=!1,this[Dt]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",Lh)}function Gi(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function Lh(){this._final!==Gi&&Gi.call(this)}we.prototype._final=Gi;we.prototype._transform=function(t,e,r){throw new jh("_transform()")};we.prototype._write=function(t,e,r){let i=this._readableState,n=this._writableState,s=i.length;this._transform(t,e,(o,a)=>{if(o){r(o);return}a!=null&&this.push(a),n.ended||s===i.length||i.length<i.highWaterMark?r():this[Dt]=r})};we.prototype._read=function(){if(this[Dt]){let t=this[Dt];this[Dt]=null,t()}}});var zi=S((q_,Pa)=>{"use strict";var{ObjectSetPrototypeOf:ja}=N();Pa.exports=wt;var Qi=Hi();ja(wt.prototype,Qi.prototype);ja(wt,Qi);function wt(t){if(!(this instanceof wt))return new wt(t);Qi.call(this,t)}wt.prototype._transform=function(t,e,r){r(null,t)}});var vr=S((U_,Oa)=>{var $t=Re(),{ArrayIsArray:Bh,Promise:Fh,SymbolAsyncIterator:Ch,SymbolDispose:Oh}=N(),Nr=ge(),{once:Mh}=$(),Dh=We(),La=oe(),{aggregateTwoErrors:$h,codes:{ERR_INVALID_ARG_TYPE:nn,ERR_INVALID_RETURN_VALUE:Ki,ERR_MISSING_ARGS:kh,ERR_STREAM_DESTROYED:qh,ERR_STREAM_PREMATURE_CLOSE:Uh},AbortError:Wh}=M(),{validateFunction:Gh,validateAbortSignal:Vh}=ut(),{isIterable:Qe,isReadable:Yi,isReadableNodeStream:Ar,isNodeStream:Ba,isTransformStream:mt,isWebStream:Hh,isReadableStream:Ji,isReadableFinished:Qh}=ie(),zh=globalThis.AbortController||ot().AbortController,Xi,Zi,en;function Fa(t,e,r){let i=!1;t.on("close",()=>{i=!0});let n=Nr(t,{readable:e,writable:r},s=>{i=!s});return{destroy:s=>{i||(i=!0,Dh.destroyer(t,s||new qh("pipe")))},cleanup:n}}function Kh(t){return Gh(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function tn(t){if(Qe(t))return t;if(Ar(t))return Yh(t);throw new nn("val",["Readable","Iterable","AsyncIterable"],t)}async function*Yh(t){Zi||(Zi=Ft()),yield*Zi.prototype[Ch].call(t)}async function Tr(t,e,r,{end:i}){let n,s=null,o=u=>{if(u&&(n=u),s){let f=s;s=null,f()}},a=()=>new Fh((u,f)=>{n?f(n):s=()=>{n?f(n):u()}});e.on("drain",o);let l=Nr(e,{readable:!1},o);try{e.writableNeedDrain&&await a();for await(let u of t)e.write(u)||await a();i&&(e.end(),await a()),r()}catch(u){r(n!==u?$h(n,u):u)}finally{l(),e.off("drain",o)}}async function rn(t,e,r,{end:i}){mt(e)&&(e=e.writable);let n=e.getWriter();try{for await(let s of t)await n.ready,n.write(s).catch(()=>{});await n.ready,i&&await n.close(),r()}catch(s){try{await n.abort(s),r(s)}catch(o){r(o)}}}function Jh(...t){return Ca(t,Mh(Kh(t)))}function Ca(t,e,r){if(t.length===1&&Bh(t[0])&&(t=t[0]),t.length<2)throw new kh("streams");let i=new zh,n=i.signal,s=r?.signal,o=[];Vh(s,"options.signal");function a(){b(new Wh)}en=en||$().addAbortListener;let l;s&&(l=en(s,a));let u,f,c=[],_=0;function h(A){b(A,--_===0)}function b(A,w){var L;if(A&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=A),!(!u&&!w)){for(;c.length;)c.shift()(u);(L=l)===null||L===void 0||L[Oh](),i.abort(),w&&(u||o.forEach(Pe=>Pe()),$t.nextTick(e,u,f))}}let p;for(let A=0;A<t.length;A++){let w=t[A],L=A<t.length-1,Pe=A>0,G=L||r?.end!==!1,Je=A===t.length-1;if(Ba(w)){let k=function(ue){ue&&ue.name!=="AbortError"&&ue.code!=="ERR_STREAM_PREMATURE_CLOSE"&&h(ue)};var E=k;if(G){let{destroy:ue,cleanup:Cr}=Fa(w,L,Pe);c.push(ue),Yi(w)&&Je&&o.push(Cr)}w.on("error",k),Yi(w)&&Je&&o.push(()=>{w.removeListener("error",k)})}if(A===0)if(typeof w=="function"){if(p=w({signal:n}),!Qe(p))throw new Ki("Iterable, AsyncIterable or Stream","source",p)}else Qe(w)||Ar(w)||mt(w)?p=w:p=La.from(w);else if(typeof w=="function"){if(mt(p)){var y;p=tn((y=p)===null||y===void 0?void 0:y.readable)}else p=tn(p);if(p=w(p,{signal:n}),L){if(!Qe(p,!0))throw new Ki("AsyncIterable",`transform[${A-1}]`,p)}else{var g;Xi||(Xi=zi());let k=new Xi({objectMode:!0}),ue=(g=p)===null||g===void 0?void 0:g.then;if(typeof ue=="function")_++,ue.call(p,xe=>{f=xe,xe!=null&&k.write(xe),G&&k.end(),$t.nextTick(h)},xe=>{k.destroy(xe),$t.nextTick(h,xe)});else if(Qe(p,!0))_++,Tr(p,k,h,{end:G});else if(Ji(p)||mt(p)){let xe=p.readable||p;_++,Tr(xe,k,h,{end:G})}else throw new Ki("AsyncIterable or Promise","destination",p);p=k;let{destroy:Cr,cleanup:_l}=Fa(p,!1,!0);c.push(Cr),Je&&o.push(_l)}}else if(Ba(w)){if(Ar(p)){_+=2;let k=Xh(p,w,h,{end:G});Yi(w)&&Je&&o.push(k)}else if(mt(p)||Ji(p)){let k=p.readable||p;_++,Tr(k,w,h,{end:G})}else if(Qe(p))_++,Tr(p,w,h,{end:G});else throw new nn("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],p);p=w}else if(Hh(w)){if(Ar(p))_++,rn(tn(p),w,h,{end:G});else if(Ji(p)||Qe(p))_++,rn(p,w,h,{end:G});else if(mt(p))_++,rn(p.readable,w,h,{end:G});else throw new nn("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],p);p=w}else p=La.from(w)}return(n!=null&&n.aborted||s!=null&&s.aborted)&&$t.nextTick(a),p}function Xh(t,e,r,{end:i}){let n=!1;if(e.on("close",()=>{n||r(new Uh)}),t.pipe(e,{end:!1}),i){let o=function(){n=!0,e.end()};var s=o;Qh(t)?$t.nextTick(o):t.once("end",o)}else r();return Nr(t,{readable:!0,writable:!1},o=>{let a=t._readableState;o&&o.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted?t.once("end",r).once("error",r):r(o)}),Nr(e,{readable:!1,writable:!0},r)}Oa.exports={pipelineImpl:Ca,pipeline:Jh}});var on=S((W_,Ua)=>{"use strict";var{pipeline:Zh}=vr(),jr=oe(),{destroyer:ep}=We(),{isNodeStream:Pr,isReadable:Ma,isWritable:Da,isWebStream:sn,isTransformStream:ze,isWritableStream:$a,isReadableStream:ka}=ie(),{AbortError:tp,codes:{ERR_INVALID_ARG_VALUE:qa,ERR_MISSING_ARGS:rp}}=M(),ip=ge();Ua.exports=function(...e){if(e.length===0)throw new rp("streams");if(e.length===1)return jr.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=jr.from(e[0])),typeof e[e.length-1]=="function"){let h=e.length-1;e[h]=jr.from(e[h])}for(let h=0;h<e.length;++h)if(!(!Pr(e[h])&&!sn(e[h]))){if(h<e.length-1&&!(Ma(e[h])||ka(e[h])||ze(e[h])))throw new qa(`streams[${h}]`,r[h],"must be readable");if(h>0&&!(Da(e[h])||$a(e[h])||ze(e[h])))throw new qa(`streams[${h}]`,r[h],"must be writable")}let i,n,s,o,a;function l(h){let b=o;o=null,b?b(h):h?a.destroy(h):!_&&!c&&a.destroy()}let u=e[0],f=Zh(e,l),c=!!(Da(u)||$a(u)||ze(u)),_=!!(Ma(f)||ka(f)||ze(f));if(a=new jr({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(f!=null&&f.readableObjectMode),writable:c,readable:_}),c){if(Pr(u))a._write=function(b,p,y){u.write(b,p)?y():i=y},a._final=function(b){u.end(),n=b},u.on("drain",function(){if(i){let b=i;i=null,b()}});else if(sn(u)){let p=(ze(u)?u.writable:u).getWriter();a._write=async function(y,g,E){try{await p.ready,p.write(y).catch(()=>{}),E()}catch(A){E(A)}},a._final=async function(y){try{await p.ready,p.close().catch(()=>{}),n=y}catch(g){y(g)}}}let h=ze(f)?f.readable:f;ip(h,()=>{if(n){let b=n;n=null,b()}})}if(_){if(Pr(f))f.on("readable",function(){if(s){let h=s;s=null,h()}}),f.on("end",function(){a.push(null)}),a._read=function(){for(;;){let h=f.read();if(h===null){s=a._read;return}if(!a.push(h))return}};else if(sn(f)){let b=(ze(f)?f.readable:f).getReader();a._read=async function(){for(;;)try{let{value:p,done:y}=await b.read();if(!a.push(p))return;if(y){a.push(null);return}}catch{return}}}}return a._destroy=function(h,b){!h&&o!==null&&(h=new tp),s=null,i=null,n=null,o===null?b(h):(o=b,Pr(f)&&ep(f,h))},a}});var Xa=S((G_,un)=>{"use strict";var np=globalThis.AbortController||ot().AbortController,{codes:{ERR_INVALID_ARG_VALUE:sp,ERR_INVALID_ARG_TYPE:kt,ERR_MISSING_ARGS:op,ERR_OUT_OF_RANGE:ap},AbortError:ae}=M(),{validateAbortSignal:Ke,validateInteger:Wa,validateObject:Ye}=ut(),lp=N().Symbol("kWeak"),up=N().Symbol("kResistStopPropagation"),{finished:fp}=ge(),cp=on(),{addAbortSignalNoValidate:dp}=jt(),{isWritable:hp,isNodeStream:pp}=ie(),{deprecate:_p}=$(),{ArrayPrototypePush:bp,Boolean:gp,MathFloor:Ga,Number:yp,NumberIsNaN:wp,Promise:Va,PromiseReject:Ha,PromiseResolve:mp,PromisePrototypeThen:Qa,Symbol:Ka}=N(),Lr=Ka("kEmpty"),za=Ka("kEof");function xp(t,e){if(e!=null&&Ye(e,"options"),e?.signal!=null&&Ke(e.signal,"options.signal"),pp(t)&&!hp(t))throw new sp("stream",t,"must be writable");let r=cp(this,t);return e!=null&&e.signal&&dp(e.signal,r),r}function Br(t,e){if(typeof t!="function")throw new kt("fn",["Function","AsyncFunction"],t);e!=null&&Ye(e,"options"),e?.signal!=null&&Ke(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Ga(e.concurrency));let i=r-1;return e?.highWaterMark!=null&&(i=Ga(e.highWaterMark)),Wa(r,"options.concurrency",1),Wa(i,"options.highWaterMark",0),i+=r,async function*(){let s=$().AbortSignalAny([e?.signal].filter(gp)),o=this,a=[],l={signal:s},u,f,c=!1,_=0;function h(){c=!0,b()}function b(){_-=1,p()}function p(){f&&!c&&_<r&&a.length<i&&(f(),f=null)}async function y(){try{for await(let g of o){if(c)return;if(s.aborted)throw new ae;try{if(g=t(g,l),g===Lr)continue;g=mp(g)}catch(E){g=Ha(E)}_+=1,Qa(g,b,h),a.push(g),u&&(u(),u=null),!c&&(a.length>=i||_>=r)&&await new Va(E=>{f=E})}a.push(za)}catch(g){let E=Ha(g);Qa(E,b,h),a.push(E)}finally{c=!0,u&&(u(),u=null)}}y();try{for(;;){for(;a.length>0;){let g=await a[0];if(g===za)return;if(s.aborted)throw new ae;g!==Lr&&(yield g),a.shift(),p()}await new Va(g=>{u=g})}}finally{c=!0,f&&(f(),f=null)}}.call(this)}function Ep(t=void 0){return t!=null&&Ye(t,"options"),t?.signal!=null&&Ke(t.signal,"options.signal"),async function*(){let r=0;for await(let n of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new ae({cause:t.signal.reason});yield[r++,n]}}.call(this)}async function Ya(t,e=void 0){for await(let r of ln.call(this,t,e))return!0;return!1}async function Sp(t,e=void 0){if(typeof t!="function")throw new kt("fn",["Function","AsyncFunction"],t);return!await Ya.call(this,async(...r)=>!await t(...r),e)}async function Ip(t,e){for await(let r of ln.call(this,t,e))return r}async function Rp(t,e){if(typeof t!="function")throw new kt("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n),Lr}for await(let i of Br.call(this,r,e));}function ln(t,e){if(typeof t!="function")throw new kt("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n)?i:Lr}return Br.call(this,r,e)}var an=class extends op{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function Tp(t,e,r){var i;if(typeof t!="function")throw new kt("reducer",["Function","AsyncFunction"],t);r!=null&&Ye(r,"options"),r?.signal!=null&&Ke(r.signal,"options.signal");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let u=new ae(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await fp(this.destroy(u)),u}let s=new np,o=s.signal;if(r!=null&&r.signal){let u={once:!0,[lp]:this,[up]:!0};r.signal.addEventListener("abort",()=>s.abort(),u)}let a=!1;try{for await(let u of this){var l;if(a=!0,r!=null&&(l=r.signal)!==null&&l!==void 0&&l.aborted)throw new ae;n?e=await t(e,u,{signal:o}):(e=u,n=!0)}if(!a&&!n)throw new an}finally{s.abort()}return e}async function Ap(t){t!=null&&Ye(t,"options"),t?.signal!=null&&Ke(t.signal,"options.signal");let e=[];for await(let i of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new ae(void 0,{cause:t.signal.reason});bp(e,i)}return e}function Np(t,e){let r=Br.call(this,t,e);return async function*(){for await(let n of r)yield*n}.call(this)}function Ja(t){if(t=yp(t),wp(t))return 0;if(t<0)throw new ap("number",">= 0",t);return t}function vp(t,e=void 0){return e!=null&&Ye(e,"options"),e?.signal!=null&&Ke(e.signal,"options.signal"),t=Ja(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new ae;for await(let s of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new ae;t--<=0&&(yield s)}}.call(this)}function jp(t,e=void 0){return e!=null&&Ye(e,"options"),e?.signal!=null&&Ke(e.signal,"options.signal"),t=Ja(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new ae;for await(let s of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new ae;if(t-- >0&&(yield s),t<=0)return}}.call(this)}un.exports.streamReturningOperators={asIndexedPairs:_p(Ep,"readable.asIndexedPairs will be removed in a future version."),drop:vp,filter:ln,flatMap:Np,map:Br,take:jp,compose:xp};un.exports.promiseReturningOperators={every:Sp,forEach:Rp,reduce:Tp,toArray:Ap,some:Ya,find:Ip}});var fn=S((V_,Za)=>{"use strict";var{ArrayPrototypePop:Pp,Promise:Lp}=N(),{isIterable:Bp,isNodeStream:Fp,isWebStream:Cp}=ie(),{pipelineImpl:Op}=vr(),{finished:Mp}=ge();cn();function Dp(...t){return new Lp((e,r)=>{let i,n,s=t[t.length-1];if(s&&typeof s=="object"&&!Fp(s)&&!Bp(s)&&!Cp(s)){let o=Pp(t);i=o.signal,n=o.end}Op(t,(o,a)=>{o?r(o):e(a)},{signal:i,end:n})})}Za.exports={finished:Mp,pipeline:Dp}});var cn=S((H_,ll)=>{"use strict";var{Buffer:$p}=X(),{ObjectDefineProperty:me,ObjectKeys:rl,ReflectApply:il}=N(),{promisify:{custom:nl}}=$(),{streamReturningOperators:el,promiseReturningOperators:tl}=Xa(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:sl}}=M(),kp=on(),{setDefaultHighWaterMark:qp,getDefaultHighWaterMark:Up}=Pt(),{pipeline:ol}=vr(),{destroyer:Wp}=We(),al=ge(),dn=fn(),qt=ie(),T=ll.exports=dr().Stream;T.isDestroyed=qt.isDestroyed;T.isDisturbed=qt.isDisturbed;T.isErrored=qt.isErrored;T.isReadable=qt.isReadable;T.isWritable=qt.isWritable;T.Readable=Ft();for(let t of rl(el)){let r=function(...i){if(new.target)throw sl();return T.Readable.from(il(e,this,i))},e=el[t];me(r,"name",{__proto__:null,value:e.name}),me(r,"length",{__proto__:null,value:e.length}),me(T.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of rl(tl)){let r=function(...i){if(new.target)throw sl();return il(e,this,i)},e=tl[t];me(r,"name",{__proto__:null,value:e.name}),me(r,"length",{__proto__:null,value:e.length}),me(T.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}T.Writable=Rr();T.Duplex=oe();T.Transform=Hi();T.PassThrough=zi();T.pipeline=ol;var{addAbortSignal:Gp}=jt();T.addAbortSignal=Gp;T.finished=al;T.destroy=Wp;T.compose=kp;T.setDefaultHighWaterMark=qp;T.getDefaultHighWaterMark=Up;me(T,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return dn}});me(ol,nl,{__proto__:null,enumerable:!0,get(){return dn.pipeline}});me(al,nl,{__proto__:null,enumerable:!0,get(){return dn.finished}});T.Stream=T;T._isUint8Array=function(e){return e instanceof Uint8Array};T._uint8ArrayToBuffer=function(e){return $p.from(e.buffer,e.byteOffset,e.byteLength)}});var Fr=S((Q_,P)=>{"use strict";var F=cn(),Vp=fn(),Hp=F.Readable.destroy;P.exports=F.Readable;P.exports._uint8ArrayToBuffer=F._uint8ArrayToBuffer;P.exports._isUint8Array=F._isUint8Array;P.exports.isDisturbed=F.isDisturbed;P.exports.isErrored=F.isErrored;P.exports.isReadable=F.isReadable;P.exports.Readable=F.Readable;P.exports.Writable=F.Writable;P.exports.Duplex=F.Duplex;P.exports.Transform=F.Transform;P.exports.PassThrough=F.PassThrough;P.exports.addAbortSignal=F.addAbortSignal;P.exports.finished=F.finished;P.exports.destroy=F.destroy;P.exports.destroy=Hp;P.exports.pipeline=F.pipeline;P.exports.compose=F.compose;Object.defineProperty(F,"promises",{configurable:!0,enumerable:!0,get(){return Vp}});P.exports.Stream=F.Stream;P.exports.default=P.exports});var Dn=zt(X());var Fe="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Et="http://www.w3.org/2001/XMLSchema#",Xt="http://www.w3.org/2000/10/swap/",R={xsd:{decimal:`${Et}decimal`,boolean:`${Et}boolean`,double:`${Et}double`,integer:`${Et}integer`,string:`${Et}string`},rdf:{type:`${Fe}type`,nil:`${Fe}nil`,first:`${Fe}first`,rest:`${Fe}rest`,langString:`${Fe}langString`,dirLangString:`${Fe}dirLangString`,reifies:`${Fe}reifies`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${Xt}reify#forSome`,forAll:`${Xt}reify#forAll`},log:{implies:`${Xt}log#implies`,isImpliedBy:`${Xt}log#isImpliedBy`}};var{xsd:Zt}=R,tu=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,On={"\\":"\\","'":"'",'"':'"',n:`
3
+ `,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},ru=/[\x00-\x20<>\\"\{\}\|\^\`]/;function Mn(t){return t<=1114111&&(t<55296||t>57343)}var iu={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_dircode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},nu=/$0^/,Ce=class{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9])/i,this._dircode=/^--(?:(ltr)|(rtl))/,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:!\^\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:!\^\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._atKeyword=/^@[a-z]+(?=[\s#<:])/i,this._keyword=/^(?:PREFIX|BASE|VERSION|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e=e||{},this._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(let r in this)!(r in iu)&&this[r]instanceof RegExp&&(this[r]=nu)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,r){let i=this._input,n=i.length;for(;;){let a,l;for(;a=this._newline.exec(i);)this.comments&&(l=this._comment.exec(a[0]))&&s("comment",l[1],"",this._line,a[0].length),i=i.substr(a[0].length,i.length),n=i.length,this._line++;if(!a&&(a=this._whitespace.exec(i))&&(i=i.substr(a[0].length,i.length)),this._endOfFile.test(i))return r&&(this.comments&&(l=this._comment.exec(i))&&s("comment",l[1],"",this._line,i.length),i=null,s("eof","","",this._line,0)),this._input=i;let u=this._line,f=i[0],c="",_="",h="",b=null,p=0,y=!1;switch(f){case"^":if(i.length<3)break;if(i[1]==="^"){if(this._previousMarker="^^",i=i.substr(2),i[0]!=="<"){y=!0;break}}else{this._n3Mode&&(p=1,c="^");break}case"<":if(b=this._unescapedIri.exec(i))c="IRI",_=b[1];else if(b=this._iri.exec(i)){if(_=this._unescape(b[1]),_===null||ru.test(_))return o(this);c="IRI"}else i.length>2&&i[1]==="<"&&i[2]==="("?(c="<<(",p=3):!this._lineMode&&i.length>(r?1:2)&&i[1]==="<"?(c="<<",p=2):this._n3Mode&&i.length>1&&i[1]==="="&&(p=2,this._isImpliedBy?(c="abbreviation",_="<"):(c="inverse",_=">"));break;case">":i.length>1&&i[1]===">"&&(c=">>",p=2);break;case"_":((b=this._blank.exec(i))||r&&(b=this._blank.exec(`${i} `)))&&(c="blank",h="_",_=b[1]);break;case'"':if(b=this._simpleQuotedString.exec(i))_=b[1];else if({value:_,matchLength:p}=this._parseLiteral(i),_===null)return o(this);(b!==null||p!==0)&&(c="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(b=this._simpleApostropheString.exec(i))_=b[1];else if({value:_,matchLength:p}=this._parseLiteral(i),_===null)return o(this);(b!==null||p!==0)&&(c="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(b=this._variable.exec(i))&&(c="var",_=b[0]);break;case"@":this._previousMarker==="literal"&&(b=this._langcode.exec(i))&&b[1]!=="version"?!r&&i[b[0].length]==="-"&&i[b[0].length+1]!=="-"?b=null:(c="langcode",_=b[1]):(b=this._atKeyword.exec(i))&&(c=b[0]);break;case".":if(i.length===1?r:i[1]<"0"||i[1]>"9"){c=".",p=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":if(i[1]==="-"){this._previousMarker==="langcode"&&(b=this._dircode.exec(i))&&(c="dircode",p=2,_=b[1]||b[2],p=_.length+2);break}(b=this._number.exec(i)||r&&(b=this._number.exec(`${i} `)))&&(c="literal",_=b[0],h=typeof b[1]=="string"?Zt.double:typeof b[2]=="string"?Zt.decimal:Zt.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":case"V":case"v":(b=this._keyword.exec(i))?c=b[0].toUpperCase():y=!0;break;case"f":case"t":(b=this._boolean.exec(i))?(c="literal",_=b[0],h=Zt.boolean):y=!0;break;case"a":(b=this._shortPredicates.exec(i))?(c="abbreviation",_="a"):y=!0;break;case"=":this._n3Mode&&i.length>1&&(c="abbreviation",i[1]!==">"?(p=1,_="="):(p=2,_=">"));break;case"!":if(!this._n3Mode)break;case")":if(!r&&(i.length===1||i.length===2&&i[1]===">"))break;if(i.length>2&&i[1]===">"&&i[2]===">"){c=")>>",p=3;break}case",":case";":case"[":case"]":case"(":case"}":case"~":this._lineMode||(p=1,c=f);break;case"{":!this._lineMode&&i.length>=2&&(i[1]==="|"?(c="{|",p=2):(c=f,p=1));break;case"|":i.length>=2&&i[1]==="}"&&(c="|}",p=2);break;default:y=!0}if(y&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(b=this._prefix.exec(i))?(c="prefix",_=b[1]||""):((b=this._prefixed.exec(i))||r&&(b=this._prefixed.exec(`${i} `)))&&(c="prefixed",h=b[1]||"",_=this._unescape(b[2]))),this._previousMarker==="^^")switch(c){case"prefixed":c="type";break;case"IRI":c="typeIRI";break;default:c=""}if(!c)return r||!/^'''|^"""/.test(i)&&/\n|\r/.test(i)?o(this):this._input=i;let g=p||b[0].length,E=s(c,_,h,u,g);this.previousToken=E,this._previousMarker=c,i=i.substr(g,i.length)}function s(a,l,u,f,c){let _=i?n-i.length:n,h=_+c,b={type:a,value:l,prefix:u,line:f,start:_,end:h};return e(null,b),b}function o(a){e(a._syntaxError(/^\S*/.exec(i)[0]))}}_unescape(e){let r=!1,i=e.replace(tu,(n,s,o,a)=>{if(typeof s=="string"){let l=Number.parseInt(s,16);return Mn(l)?String.fromCharCode(l):(r=!0,"")}if(typeof o=="string"){let l=Number.parseInt(o,16);return Mn(l)?l<=65535?String.fromCharCode(Number.parseInt(o,16)):String.fromCharCode(55296+((l-=65536)>>10),56320+(l&1023)):(r=!0,"")}return a in On?On[a]:(r=!0,"")});return r?null:i}_parseLiteral(e){if(e.length>=3){let r=e.match(/^(?:"""|"|'''|'|)/)[0],i=r.length,n=Math.max(this._literalClosingPos,i);for(;(n=e.indexOf(r,n))>0;){let s=0;for(;e[n-s-1]==="\\";)s++;if(s%2===0){let o=e.substring(i,n),a=o.split(/\r\n|\r|\n/).length-1,l=n+i;if(i===1&&a!==0||i===3&&this._lineMode)break;return this._line+=a,{value:this._unescape(o),matchLength:l}}n++}this._literalClosingPos=e.length-i+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;let r=new Error(`Unexpected "${e}" on line ${this._line}.`);return r.context={token:void 0,line:this._line,previousToken:this.previousToken},r}_readStartingBom(e){return e.startsWith("\uFEFF")?e.substr(1):e}tokenize(e,r){if(this._line=1,typeof e=="string")if(this._input=this._readStartingBom(e),typeof r=="function")queueMicrotask(()=>this._tokenizeToEnd(r,!0));else{let i=[],n;if(this._tokenizeToEnd((s,o)=>s?n=s:i.push(o),!0),n)throw n;return i}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",i=>{this._input!==null&&i.length!==0&&(this._pendingBuffer&&(i=Dn.Buffer.concat([this._pendingBuffer,i]),this._pendingBuffer=null),i[i.length-1]&128?this._pendingBuffer=i:(typeof this._input>"u"?this._input=this._readStartingBom(typeof i=="string"?i:i.toString()):this._input+=i,this._tokenizeToEnd(r,!1)))}),e.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(r,!0)}),e.on("error",r)}};var{rdf:$n,xsd:Oe}=R,it,su=0;var Qr={namedNode:kn,blankNode:qn,variable:Wn,literal:Un,defaultGraph:ou,quad:zr,triple:zr,fromTerm:St,fromQuad:Gn},W=Qr,U=class t{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof t?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}},rt=class extends U{constructor(e){super(e)}get termType(){return"NamedNode"}},ce=class t extends U{constructor(e){super(e)}get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){let e=this.id,r=e.lastIndexOf('"')+1,i=e.lastIndexOf("--");return r<e.length&&e[r++]==="@"?(i>r?e.substr(0,i):e).substr(r).toLowerCase():""}get direction(){let e=this.id,r=e.lastIndexOf('"'),i=e.lastIndexOf("--");return i>r&&i+2<e.length?e.substr(i+2).toLowerCase():""}get datatype(){return new rt(this.datatypeString)}get datatypeString(){let e=this.id,r=e.lastIndexOf('"')+1,i=r<e.length?e[r]:"";return i==="^"?e.substr(r+2):i!=="@"?Oe.string:e.indexOf("--",r)>0?$n.dirLangString:$n.langString}equals(e){return e instanceof t?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&(this.direction===e.direction||this.direction===""&&!e.direction)&&this.datatype.value===e.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,direction:this.direction,datatype:{termType:"NamedNode",value:this.datatypeString}}}},It=class extends U{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},Rt=class extends U{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},Tt=class extends U{constructor(){return super(""),it||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};it=new Tt;function Se(t,e,r){if(e=e||Qr,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===Qr)return new ce(t);if(t[t.length-1]==='"')return e.literal(t.substr(1,t.length-2));let i=t.lastIndexOf('"',t.length-1),n;if(t[i+1]==="@"){n=t.substr(i+2);let s=n.lastIndexOf("--");s>0&&s<n.length&&(n={language:n.substr(0,s),direction:n.substr(s+2)})}else n=e.namedNode(t.substr(i+3));return e.literal(t.substr(1,i-1),n);case"[":t=JSON.parse(t);break;default:if(!r||!Array.isArray(t))return e.namedNode(t)}return e.quad(Se(t[0],e,!0),Se(t[1],e,!0),Se(t[2],e,!0),t[3]&&Se(t[3],e,!0))}function de(t,e){if(typeof t=="string")return t;if(t instanceof U&&t.termType!=="Quad")return t.id;if(!t)return it.id;switch(t.termType){case"NamedNode":return t.value;case"BlankNode":return`_:${t.value}`;case"Variable":return`?${t.value}`;case"DefaultGraph":return"";case"Literal":return`"${t.value}"${t.language?`@${t.language}${t.direction?`--${t.direction}`:""}`:t.datatype&&t.datatype.value!==Oe.string?`^^${t.datatype.value}`:""}`;case"Quad":let r=[de(t.subject,!0),de(t.predicate,!0),de(t.object,!0)];return t.graph&&t.graph.termType!=="DefaultGraph"&&r.push(de(t.graph,!0)),e?r:JSON.stringify(r);default:throw new Error(`Unexpected termType: ${t.termType}`)}}var Ie=class extends U{constructor(e,r,i,n){super(""),this._subject=e,this._predicate=r,this._object=i,this._graph=n||it}get termType(){return"Quad"}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}get graph(){return this._graph}toJSON(){return{termType:this.termType,subject:this._subject.toJSON(),predicate:this._predicate.toJSON(),object:this._object.toJSON(),graph:this._graph.toJSON()}}equals(e){return!!e&&this._subject.equals(e.subject)&&this._predicate.equals(e.predicate)&&this._object.equals(e.object)&&this._graph.equals(e.graph)}};function kn(t){return new rt(t)}function qn(t){return new It(t||`n3-${su++}`)}function Un(t,e){if(typeof e=="string")return new ce(`"${t}"@${e.toLowerCase()}`);if(e!==void 0&&!("termType"in e))return new ce(`"${t}"@${e.language.toLowerCase()}${e.direction?`--${e.direction.toLowerCase()}`:""}`);let r=e?e.value:"";return r===""&&(typeof t=="boolean"?r=Oe.boolean:typeof t=="number"&&(Number.isFinite(t)?r=Number.isInteger(t)?Oe.integer:Oe.double:(r=Oe.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),r===""||r===Oe.string?new ce(`"${t}"`):new ce(`"${t}"^^${r}`)}function Wn(t){return new Rt(t)}function ou(){return it}function zr(t,e,r,i){return new Ie(t,e,r,i)}function St(t){if(t instanceof U)return t;switch(t.termType){case"NamedNode":return kn(t.value);case"BlankNode":return qn(t.value);case"Variable":return Wn(t.value);case"DefaultGraph":return it;case"Literal":return Un(t.value,t.language||t.datatype);case"Quad":return Gn(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function Gn(t){if(t instanceof Ie)return t;if(t.termType!=="Quad")throw new Error(`Unexpected termType: ${t.termType}`);return zr(St(t.subject),St(t.predicate),St(t.object),St(t.graph))}var Vn=0,he=class t{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Hn(this,e.factory);let r=typeof e.format=="string"?e.format.match(/\w*$/)[0].toLowerCase():"",i=/turtle/.test(r),n=/trig/.test(r),s=/triple/.test(r),o=/quad/.test(r),a=this._n3Mode=/n3/.test(r),l=s||o;(this._supportsNamedGraphs=!(i||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(i||n||s||a),this._isImpliedBy=e.isImpliedBy,l&&(this._resolveRelativeIRI=u=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new Ce({lineMode:l,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers,this._parseUnsupportedVersions=!!e.parseUnsupportedVersions,this._version=e.version}static _resetBlankNodePrefix(){Vn=0}_setBase(e){if(!e)this._base="",this._basePath="";else{let r=e.indexOf("#");r>=0&&(e=e.substr(0,r)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}}_saveContext(e,r,i,n,s){let o=this._n3Mode;this._contextStack.push({type:e,subject:i,predicate:n,object:s,graph:r,inverse:o?this._inversePredicate:!1,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(e,r){let i=this._contextStack.pop();if(!i||i.type!==e)return this._error(`Unexpected ${r.type}`,r);this._subject=i.subject,this._predicate=i.predicate,this._object=i.object,this._graph=i.graph,this._n3Mode&&(this._inversePredicate=i.inverse,this._prefixes._=i.blankPrefix,this._quantified=i.quantified)}_readBeforeTopContext(e){return this._version&&!this._isValidVersion(this._version)?this._error(`Detected unsupported version as media type parameter: "${this._version}"`,e):this._readInTopContext(e)}_readInTopContext(e){switch(e.type){case"eof":return this._graph!==null?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"VERSION":this._sparqlStyle=!0;case"@version":return this._readVersion;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,r){let i;switch(e.type){case"IRI":case"typeIRI":let n=this._resolveIRI(e.value);if(n===null)return this._error("Invalid IRI",e);i=this._factory.namedNode(n);break;case"type":case"prefixed":let s=this._prefixes[e.prefix];if(s===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);i=this._factory.namedNode(s+e.value);break;case"blank":i=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case"var":i=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!r&&this._n3Mode&&i.id in this._quantified&&(i=this._quantified[i.id]),i}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":let r=this._contextStack;return(r.length&&r[r.length-1]).type==="<<"?this._error("Unexpected list in reified triple",e):(this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._factory.blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":return this._n3Mode?e.prefix.length===0?(this._literalValue=e.value,this._completeSubjectLiteral):(this._subject=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),this._getPathReader(this._readPredicateOrNamedGraph)):this._error("Unexpected literal",e);case"<<(":return this._n3Mode?(this._saveContext("<<(",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Disallowed triple term as subject",e);case"<<":return this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject;default:if((this._subject=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){let r=e.type;switch(r){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":case"|}":return this._predicate===null&&!this._n3Mode?this._error(`Unexpected ${r}`,e):(this._subject=null,r==="]"?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return this._predicate!==null?this._readPredicate:this._error("Expected predicate but got ;",e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(e.prefix.length===0)return this._literalValue=e.value,this._completePredicateLiteral;this._predicate=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if((this._predicate=this._readEntity(e))===void 0)return}return this._validAnnotation=!0,this._readObject}_readObject(e){switch(e.type){case"literal":if(e.prefix.length===0)return this._literalValue=e.value,this._readDataTypeOrLang;if(this._object=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),this._n3Mode)return this._getPathReader(this._getContextEndReader());break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.blankNode()),this._readBlankNodeHead;case"(":let r=this._contextStack;return(r.length&&r[r.length-1]).type==="<<"?this._error("Unexpected list in reified triple",e):(this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<(":return this._saveContext("<<(",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject;case"<<":return this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject;default:if((this._object=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return e.type==="{"?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return e.type!=="{"?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){if(e.type==="]")return this._subject=null,this._readBlankNodeTail(e);{let r=this._contextStack;return(r.length>1&&r[r.length-2]).type==="<<"?this._error("Unexpected compound blank node expression in reified triple",e):(this._predicate=null,this._readPredicate(e))}}_readBlankNodeTail(e){if(e.type!=="]")return this._readBlankNodePunctuation(e);this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph);let r=this._predicate===null;return this._restoreContext("blank",e),this._object!==null?this._getContextEndReader():this._predicate!==null?this._readObject:r?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let r=null,i=null,n=this._readListItem,s=this._subject,o=this._contextStack,a=o[o.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this._subject=r=this._factory.blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),o.length!==0&&o[o.length-1].type==="list"){if(this._n3Mode)return s!==null&&this._emit(s,this.RDF_REST,this.RDF_NIL,this._graph),this._saveContext("item",this._graph,this._subject,this._predicate,this._object),this._subject=this._object,this._predicate=null,this._getPathReader(this._readListItem);this._emit(this._subject,this._predicate,this._object,this._graph)}if(this._predicate===null){if(n=this._n3Mode?this._getPathReader(this._readPredicate):this._readPredicate,this._subject===this.RDF_NIL)return n}else if(n=this._getContextEndReader(),this._n3Mode&&(n=this._getPathReader(n)),this._object===this.RDF_NIL)return n;i=this.RDF_NIL;break;case"literal":e.prefix.length===0?(this._literalValue=e.value,n=this._readListItemDataTypeOrLang):(r=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<(":this._saveContext("<<(",this._graph,null,null,null),this._graph=null,n=this._readSubject;break;case"<<":this._saveContext("<<",this._graph,null,null,null),this._graph=null,n=this._readSubject;break;default:if((r=this._readEntity(e))===void 0)return}if(i===null&&(this._subject=i=this._factory.blankNode()),(e.type==="<<"||e.type==="<<(")&&(o[o.length-1].subject=this._subject),s===null?a.predicate===null?a.subject=i:a.object=i:this._emit(s,this.RDF_REST,i,this._graph),r!==null){if(this._n3Mode&&(e.type==="IRI"||e.type==="prefixed"||e.type==="var"||e.type==="blank"||e.type==="literal"))return this._saveContext("item",this._graph,i,this.RDF_FIRST,r),this._subject=r,this._predicate=null,this._getPathReader(this._readListItem);this._emit(i,this.RDF_FIRST,r,this._graph)}return n}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e,r){let i=this._factory.literal(this._literalValue),n;switch(e.type){case"type":case"typeIRI":let s=this._readEntity(e);if(s===void 0)return;if(s.value===R.rdf.langString||s.value===R.rdf.dirLangString)return this._error("Detected illegal (directional) languaged-tagged string with explicit datatype",e);i=this._factory.literal(this._literalValue,s),e=null;break;case"langcode":if(e.value.split("-").some(o=>o.length>8))return this._error("Detected language tag with subtag longer than 8 characters",e);i=this._factory.literal(this._literalValue,e.value),this._literalLanguage=e.value,e=null,n=this._readDirCode.bind(this,r);break}return{token:e,literal:i,readCb:n}}_readDirCode(e,r,i){if(i.type==="dircode"){let n=this._factory.literal(this._literalValue,{language:this._literalLanguage,direction:i.value});e==="subject"?this._subject=n:e==="predicate"?this._predicate=n:this._object=n,this._literalLanguage=void 0,i=null}return e==="subject"?this._getPathEndReader(i,this._readPredicateOrNamedGraph)||this._readPredicateOrNamedGraph(i):e==="predicate"?i===null?this._readObject:this._readObject(i):this._completeObjectLiteralPost(i,r)}_completeTermLiteral(e,r){let i=this._completeLiteral(e,r);if(!i)return;let n;if(r==="subject"?(this._subject=i.literal,n=this._readPredicateOrNamedGraph):(this._predicate=i.literal,this._validAnnotation=!0,n=this._readObject),i.readCb)return i.readCb.bind(this,!1);if(r==="subject"){let s=this._getPathEndReader(i.token,n);if(s)return s}return i.token===null?n:n.call(this,i.token)}_completeSubjectLiteral(e){return this._completeTermLiteral(e,"subject")}_completePredicateLiteral(e){return this._completeTermLiteral(e,"predicate")}_completeObjectLiteral(e,r){let i=this._completeLiteral(e,"object");if(i)return this._object=i.literal,i.readCb?i.readCb.bind(this,r):this._completeObjectLiteralPost(i.token,r)}_completeObjectLiteralPost(e,r){return this._n3Mode&&(e===null||e.type==="!"||e.type==="^")?r?(this._saveContext("item",this._graph,this._subject,this.RDF_FIRST,this._object),this._subject=this._object,this._predicate=null,this._getPathEndReader(e,this._readListItem)):this._getPathEndReader(e,this._getContextEndReader()):(r&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),e===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(e)))}_readFormulaTail(e){return e.type!=="}"?this._readPunctuation(e):(this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),this._object===null?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let r,i=this._graph,n=!1,s=this._subject,o=this._inversePredicate;switch(e.type){case"}":if(this._graph===null)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,this._tripleTerm=null,r=this._contextStack.length?this._readSubject:this._readInTopContext,o&&(this._inversePredicate=!1);break;case";":r=this._readPredicate;break;case",":r=this._readObject;break;case"~":s!==null&&(this._tripleTerm=null),r=this._readReifierInAnnotation,n=!0;break;case"{|":s!==null&&(this._tripleTerm=null),this._subject=this._readTripleTerm(),this._validAnnotation=!1,n=!0,r=this._readPredicate;break;case"|}":if(!this._annotation)return this._error("Unexpected annotation syntax closing",e);if(!this._validAnnotation)return this._error("Annotation block can not be empty",e);this._subject=null,this._annotation=!1,r=this._getContextEndReader();break;default:if(this._supportsQuads&&this._graph===null&&(i=this._readEntity(e))!==void 0){r=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(s!==null&&(!n||n&&!this._annotation)){let a=this._predicate,l=this._object;o?this._emit(l,a,s,i):this._emit(s,a,l,i)}return n&&(this._annotation=!0),r}_readBlankNodePunctuation(e){let r;switch(e.type){case";":r=this._readPredicate;break;case",":r=this._readObject;break;case"~":case"{|":case"|}":return this._readPunctuation(e);default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._subject===null?this._error("Expected ] to follow annotation",e):(this._emit(this._subject,this._predicate,this._object,this._graph),r)}_readQuadPunctuation(e){return e.type!=="."?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return e.type!=="prefix"?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if(e.type!=="IRI")return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);let r=this._readEntity(e);return this._prefixes[this._prefix]=r.value,this._prefixCallback(this._prefix,r),this._readDeclarationPunctuation}_readBaseIRI(e){let r=e.type==="IRI"&&this._resolveIRI(e.value);return r?(this._setBase(r),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",e)}_isValidVersion(e){return this._parseUnsupportedVersions||t.SUPPORTED_VERSIONS.includes(e)}_readVersion(e){return e.type!=="literal"?this._error("Expected literal to follow version declaration",e):e.end-e.start!==e.value.length+2?this._error("Version declarations must use single quotes",e):(this._versionCallback(e.value),this._isValidVersion(e.value)?this._readDeclarationPunctuation:this._error(`Detected unsupported version: "${e.value}"`,e))}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return e.type!=="]"?this._error("Invalid graph label",e):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):e.type!=="."?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let r;switch(e.type){case"IRI":case"prefixed":if((r=this._readEntity(e,!0))!==void 0)break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(this._subject===null?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,r,this.QUANTIFIERS_GRAPH)):this._quantified[r.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return e.type===","?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_getPathEndReader(e,r){if(e!==null&&e.type!=="!"&&e.type!=="^")return null;let i=this._getPathReader(r);return e===null?i:i.call(this,e)}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:let r=this._contextStack,i=r.length&&r[r.length-1];if(i&&i.type==="item"){let n=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,n,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let r,i,n=this._factory.blankNode();if((i=this._readEntity(e))!==void 0)return this._predicate===null?(r=this._subject,this._subject=n):(r=this._object,this._object=n),this._emit(r,i,n,this._graph),this._readPath}_readBackwardPath(e){let r=this._factory.blankNode(),i,n;if((i=this._readEntity(e))!==void 0)return this._predicate===null?(n=this._subject,this._subject=r):(n=this._object,this._object=r),this._emit(r,i,n,this._graph),this._readPath}_readTripleTermTail(e){if(e.type!==")>>")return this._error(`Expected )>> but got ${e.type}`,e);let r=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);this._restoreContext("<<(",e);let i=this._contextStack,n=i.length&&i[i.length-1];return n&&n.type==="list"?(this._emit(this._subject,this.RDF_FIRST,r,this._graph),this._getContextEndReader()):this._subject===null?(this._subject=r,this._readPredicate):(this._object=r,this._getContextEndReader())}_readReifiedTripleTailOrReifier(e){return e.type==="~"?this._readReifier:this._readReifiedTripleTail(e)}_readReifiedTripleTail(e){if(e.type!==">>")return this._error(`Expected >> but got ${e.type}`,e);this._tripleTerm=null;let r=this._readTripleTerm();this._restoreContext("<<",e);let i=this._contextStack,n=i.length&&i[i.length-1];return n&&n.type==="list"?(this._emit(this._subject,this.RDF_FIRST,r,this._graph),this._getContextEndReader()):this._subject===null?(this._subject=r,this._readPredicateOrReifierTripleEnd):(this._object=r,this._getContextEndReader())}_readPredicateOrReifierTripleEnd(e){return e.type==="."?(this._subject=null,this._readPunctuation(e)):this._readPredicate(e)}_readReifier(e){return this._reifier=this._readEntity(e),this._readReifiedTripleTail}_readReifierInAnnotation(e){return e.type==="IRI"||e.type==="typeIRI"||e.type==="type"||e.type==="prefixed"||e.type==="blank"||e.type==="var"?(this._reifier=this._readEntity(e),this._readAnnotationBlockOrPunctuation):(this._readTripleTerm(),this._subject=null,this._getContextEndReader().call(this,e))}_readAnnotationBlockOrPunctuation(e){if(e.type==="{|")return this._readPunctuation(e);switch(this._readTripleTerm(),this._annotation=!1,this._tripleTerm=null,e.type){case";":return this._readPredicate;case",":return this._readObject;default:return this._subject=null,this._getContextEndReader().call(this,e)}}_readTripleTerm(){let e=this._contextStack,r=e.length&&e[e.length-1],i=r?r.graph:void 0,n=this._reifier||this._factory.blankNode();return this._reifier=null,this._tripleTerm=this._tripleTerm||this._factory.quad(this._subject,this._predicate,this._object),this._emit(n,this.RDF_REIFIES,this._tripleTerm,i||this._graph||this.DEFAULTGRAPH),n}_getContextEndReader(){let e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<(":return this._readTripleTermTail;case"<<":return this._readReifiedTripleTailOrReifier}}_emit(e,r,i,n){this._callback(null,this._factory.quad(e,r,i,n||this.DEFAULTGRAPH))}_error(e,r){let i=` on line ${r.line}.`;e.length+i.length>200&&(e=`${e.slice(0,199-i.length)}\u2026`);let n=new Error(`${e}${i}`);n.context={token:r,line:r.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=At}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return(e[1]==="/"?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;let r=e.length,i="",n=-1,s=-1,o=0,a="/";for(;n<r;){switch(a){case":":if(s<0&&e[++n]==="/"&&e[++n]==="/")for(;(s=n+1)<r&&e[s]!=="/";)n=s;break;case"?":case"#":n=r;break;case"/":if(e[n+1]===".")switch(a=e[++n+1],a){case"/":i+=e.substring(o,n-1),o=n+1;break;case void 0:case"?":case"#":return i+e.substring(o,n)+e.substr(n+1);case".":if(a=e[++n+1],a===void 0||a==="/"||a==="?"||a==="#"){if(i+=e.substring(o,n-2),(o=i.lastIndexOf("/"))>=s&&(i=i.substr(0,o)),a!=="/")return`${i}/${e.substr(n+1)}`;o=n+1}}}a=e[++n]}return i+e.substring(o)}parse(e,r,i,n){let s,o,a,l;if(r&&(r.onQuad||r.onPrefix||r.onComment||r.onVersion)?(s=r.onQuad,o=r.onPrefix,a=r.onComment,l=r.onVersion):(s=r,o=i,l=n),this._readCallback=this._readBeforeTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Vn++}_`,this._prefixCallback=o||At,this._versionCallback=l||At,this._inversePredicate=!1,this._quantified=Object.create(null),!s){let f=[],c;if(this._callback=(_,h)=>{_?c=_:h&&f.push(h)},this._lexer.tokenize(e).every(_=>this._readCallback=this._readCallback(_)),c)throw c;return f}let u=(f,c)=>{f!==null?(this._callback(f),this._callback=At):this._readCallback&&(this._readCallback=this._readCallback(c))};a&&(this._lexer.comments=!0,u=(f,c)=>{f!==null?(this._callback(f),this._callback=At):this._readCallback&&(c.type==="comment"?a(c.value):this._readCallback=this._readCallback(c))}),this._callback=s,this._lexer.tokenize(e,u)}};function At(){}function Hn(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(R.rdf.first),t.RDF_REST=e.namedNode(R.rdf.rest),t.RDF_NIL=e.namedNode(R.rdf.nil),t.RDF_REIFIES=e.namedNode(R.rdf.reifies),t.N3_FORALL=e.namedNode(R.r.forAll),t.N3_FORSOME=e.namedNode(R.r.forSome),t.ABBREVIATIONS={a:e.namedNode(R.rdf.type),"=":e.namedNode(R.owl.sameAs),">":e.namedNode(R.log.implies),"<":e.namedNode(R.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}he.SUPPORTED_VERSIONS=["1.2","1.2-basic","1.1"];Hn(he.prototype,W);var Kr={};xl(Kr,{inDefaultGraph:()=>du,isBlankNode:()=>lu,isDefaultGraph:()=>pe,isLiteral:()=>uu,isNamedNode:()=>au,isQuad:()=>cu,isVariable:()=>fu,prefix:()=>hu,prefixes:()=>Qn});function au(t){return!!t&&t.termType==="NamedNode"}function lu(t){return!!t&&t.termType==="BlankNode"}function uu(t){return!!t&&t.termType==="Literal"}function fu(t){return!!t&&t.termType==="Variable"}function cu(t){return!!t&&t.termType==="Quad"}function pe(t){return!!t&&t.termType==="DefaultGraph"}function du(t){return pe(t.graph)}function hu(t,e){return Qn({"":t.value||t},e)("")}function Qn(t,e){let r=Object.create(null);for(let n in t)i(n,t[n]);e=e||W;function i(n,s){if(typeof s=="string"){let o=Object.create(null);r[n]=a=>o[a]||(o[a]=e.namedNode(s+a))}else if(!(n in r))throw new Error(`Unknown prefix: ${n}`);return r[n]}return i}function nt(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}var pu=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,_u=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,zn="./",bu="../",Yr="?",Kn="#",Me=class t{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!pu.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!t.supports(this.base))return this._baseMatcher=/.^/;let e=/^[^:]*:\/*/.exec(this.base)[0],r=["^",nt(e)],i=[],n=[],s=/[^/?#]*([/?#])/y,o,a=0,l=0,u=s.lastIndex=e.length;for(;!a&&!l&&(o=s.exec(this.base));)o[1]===Kn?l=s.lastIndex-1:(r.push(nt(o[0]),"(?:"),i.push(")?"),o[1]!==Yr?n.push(u=s.lastIndex):(a=u=s.lastIndex,l=this.base.indexOf(Kn,a),this._pathReplacements[a]=Yr));for(let f=0;f<n.length;f++)this._pathReplacements[n[f]]=bu.repeat(n.length-f-1);return this._pathReplacements[n[n.length-1]]=zn,this._baseLength=l>0?l:this.base.length,r.push(nt(this.base.substring(u,this._baseLength)),a?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...r,...i].join(""))}toRelative(e){let r=this._getBaseMatcher().exec(e);if(!r)return e;let i=r[0].length;if(i===this._baseLength&&i===e.length)return"";let n=this._pathReplacements[i];if(n){let s=e.substring(i);return n!==Yr&&!_u.test(s)?e:n===zn&&/^[^?#]/.test(s)?s:n+s}return e.substring(i-1)}};var Nt=W.defaultGraph(),{rdf:gu,xsd:st}=R,Yn=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,Jn=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,yu={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"},De=class extends U{equals(e){return e===this}},Z=class{constructor(e,r){if(this._prefixRegex=/$0^/,this._hasPrefixes=!1,e&&typeof e.write!="function"&&(r=e,e=null),r=r||{},this._lists=r.lists,e)this._outputStream=e,this._endStream=r.end===void 0?!0:!!r.end;else{let i="";this._outputStream={write(n,s,o){i+=n,o&&o()},end:n=>{n&&n(null,i)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(r.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Nt,this._prefixIRIs=Object.create(null),r.prefixes&&this.addPrefixes(r.prefixes),r.baseIRI&&(this._baseIri=new Me(r.baseIRI)))}get _inDefaultGraph(){return Nt.equals(this._graph)}_write(e,r){this._outputStream.write(e,"utf8",r)}_writeQuad(e,r,i,n,s){try{(!n.equals(this._graph)||n.termType!==this._graph.termType)&&(this._write((this._subject===null?"":this._inDefaultGraph?`.
4
4
  `:`
5
5
  }
6
6
  `)+(Nt.equals(n)?"":`${this._encodeIriOrBlank(n)} {
7
7
  `)),this._graph=n,this._subject=null),e.equals(this._subject)?r.equals(this._predicate)?this._write(`, ${this._encodeObject(i)}`,s):this._write(`;
8
8
  ${this._encodePredicate(this._predicate=r)} ${this._encodeObject(i)}`,s):this._write(`${(this._subject===null?"":`.
9
- `)+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=r)} ${this._encodeObject(i)}`,s)}catch(o){s&&s(o)}}_writeQuadLine(e,r,i,n,s){delete this._prefixMatch,this._write(this.quadToString(e,r,i,n),s)}quadToString(e,r,i,n){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(r)} ${this._encodeObject(i)}${n&&!Ie(n)?` ${this._encodeIriOrBlank(n)} .
9
+ `)+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=r)} ${this._encodeObject(i)}`,s)}catch(o){s&&s(o)}}_writeQuadLine(e,r,i,n,s){delete this._prefixMatch,this._write(this.quadToString(e,r,i,n),s)}quadToString(e,r,i,n){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(r)} ${this._encodeObject(i)}${n&&!pe(n)?` ${this._encodeIriOrBlank(n)} .
10
10
  `:` .
11
- `}`}quadsToString(e){let r="";for(let i of e)r+=this.quadToString(i.subject,i.predicate,i.object,i.graph);return r}_encodeSubject(e){return e.termType==="Quad"?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if(e.termType!=="NamedNode")return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),e.termType==="Variable"?`?${e.value}`:"id"in e?e.id:`_:${e.value}`;let r=e.value;this._baseIri&&(r=this._baseIri.toRelative(r)),Yn.test(r)&&(r=r.replace(Jn,Xn));let i=this._hasPrefixes?this._prefixRegex.exec(r):null;return i?i[1]?this._prefixIRIs[i[1]]+i[2]:r:`<${r}>`}_encodeLiteral(e){let r=e.value;Yn.test(r)&&(r=r.replace(Jn,Xn));let i=e.direction?`--${e.direction}`:"";if(e.language)return`"${r}"@${e.language}${i}`;if(this._lineMode){if(e.datatype.value===st.string)return`"${r}"`}else switch(e.datatype.value){case st.string:return`"${r}"`;case st.boolean:if(r==="true"||r==="false")return r;break;case st.integer:if(/^[+-]?\d+$/.test(r))return r;break;case st.decimal:if(/^[+-]?\d*\.\d+$/.test(r))return r;break;case st.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(r))return r;break}return`"${r}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===gu.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:r,object:i,graph:n}){return`<<(${this._encodeSubject(e)} ${this._encodePredicate(r)} ${this._encodeObject(i)}${Ie(n)?"":` ${this._encodeIriOrBlank(n)}`})>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,r,i,n,s){i===void 0?this._writeQuad(e.subject,e.predicate,e.object,e.graph,r):typeof n=="function"?this._writeQuad(e,r,i,Nt,n):this._writeQuad(e,r,i,n||Nt,s)}addQuads(e){for(let r=0;r<e.length;r++)this.addQuad(e[r])}addPrefix(e,r,i){let n={};n[e]=r,this.addPrefixes(n,i)}addPrefixes(e,r){if(!this._prefixIRIs)return r&&r();let i=!1;for(let n in e){let s=e[n];typeof s!="string"&&(s=s.value),i=!0,this._subject!==null&&(this._write(this._inDefaultGraph?`.
11
+ `}`}quadsToString(e){let r="";for(let i of e)r+=this.quadToString(i.subject,i.predicate,i.object,i.graph);return r}_encodeSubject(e){return e.termType==="Quad"?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if(e.termType!=="NamedNode")return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),e.termType==="Variable"?`?${e.value}`:"id"in e?e.id:`_:${e.value}`;let r=e.value;this._baseIri&&(r=this._baseIri.toRelative(r)),Yn.test(r)&&(r=r.replace(Jn,Xn));let i=this._hasPrefixes?this._prefixRegex.exec(r):null;return i?i[1]?this._prefixIRIs[i[1]]+i[2]:r:`<${r}>`}_encodeLiteral(e){let r=e.value;Yn.test(r)&&(r=r.replace(Jn,Xn));let i=e.direction?`--${e.direction}`:"";if(e.language)return`"${r}"@${e.language}${i}`;if(this._lineMode){if(e.datatype.value===st.string)return`"${r}"`}else switch(e.datatype.value){case st.string:return`"${r}"`;case st.boolean:if(r==="true"||r==="false")return r;break;case st.integer:if(/^[+-]?\d+$/.test(r))return r;break;case st.decimal:if(/^[+-]?\d*\.\d+$/.test(r))return r;break;case st.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(r))return r;break}return`"${r}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===gu.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:r,object:i,graph:n}){return`<<(${this._encodeSubject(e)} ${this._encodePredicate(r)} ${this._encodeObject(i)}${pe(n)?"":` ${this._encodeIriOrBlank(n)}`})>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,r,i,n,s){i===void 0?this._writeQuad(e.subject,e.predicate,e.object,e.graph,r):typeof n=="function"?this._writeQuad(e,r,i,Nt,n):this._writeQuad(e,r,i,n||Nt,s)}addQuads(e){for(let r=0;r<e.length;r++)this.addQuad(e[r])}addPrefix(e,r,i){let n={};n[e]=r,this.addPrefixes(n,i)}addPrefixes(e,r){if(!this._prefixIRIs)return r&&r();let i=!1;for(let n in e){let s=e[n];typeof s!="string"&&(s=s.value),i=!0,this._subject!==null&&(this._write(this._inDefaultGraph?`.
12
12
  `:`
13
13
  }
14
14
  `),this._subject=null,this._graph=""),this._prefixIRIs[s]=n+=":",this._write(`@prefix ${n} <${s}>.
@@ -19,7 +19,7 @@ var bl=Object.create;var Or=Object.defineProperty;var gl=Object.getOwnPropertyDe
19
19
  ]`)}}list(e){let r=e&&e.length||0,i=new Array(r);for(let n=0;n<r;n++)i[n]=this._encodeObject(e[n]);return new De(`(${i.join(" ")})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
20
20
  `:`
21
21
  }
22
- `),this._subject=null),this._write=this._blockedWrite;let r=e&&((i,n)=>{r=null,e(i,n)});if(this._endStream)try{return this._outputStream.end(r)}catch{}r&&r()}};function Xn(t){let e=yu[t];return e===void 0&&(t.length===1?(e=t.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=((t.charCodeAt(0)-55296)*1024+t.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}var pn=zt(Fr());var hn=Symbol("iter");function Ut(t,e,r=4){if(r===0)return Object.assign(t,e);for(let i in e)t[i]=Ut(t[i]||Object.create(null),e[i],r-1);return t}function ul(t,e,r=4){let i=!1;for(let n in t)if(n in e){let s=r===0?null:ul(t[n],e[n],r-1);if(s!==!1)i=i||Object.create(null),i[n]=s;else if(r===3)return!1}return i}function fl(t,e,r=4){let i=!1;for(let n in t)if(!(n in e))i=i||Object.create(null),i[n]=r===0?null:Ut({},t[n],r-1);else if(r!==0){let s=fl(t[n],e[n],r-1);if(s!==!1)i=i||Object.create(null),i[n]=s;else if(r===3)return!1}return i}var Wt=class{constructor(e={}){this._id=1,this._ids=Object.create(null),this._ids[""]=1,this._entities=Object.create(null),this._entities[1]="",this._blankNodeIndex=0,this._factory=e.factory||W}_termFromId(e){if(e[0]==="."){let r=this._entities,i=e.split(".");return this._factory.quad(this._termFromId(r[i[1]]),this._termFromId(r[i[2]]),this._termFromId(r[i[3]]),i[4]&&this._termFromId(r[i[4]]))}return Ee(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){let r=this._termToNumericId(e.subject),i=this._termToNumericId(e.predicate),n=this._termToNumericId(e.object),s;return r&&i&&n&&(Ie(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${r}.${i}.${n}.${s}`:`.${r}.${i}.${n}`]}return this._ids[de(e)]}_termToNewNumericId(e){let r=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${Ie(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:de(e);return this._ids[r]||(this._ids[this._entities[++this._id]=r]=this._id)}createBlankNode(e){let r,i;if(e)for(r=e=`_:${e}`,i=1;this._ids[r];)r=e+i++;else do r=`_:b${this._blankNodeIndex++}`;while(this._ids[r]);return this._ids[r]=++this._id,this._entities[this._id]=r,this._factory.blankNode(r.substr(2))}},je=class t{constructor(e,r){this._size=0,this._graphs=Object.create(null),!r&&e&&!e[0]&&typeof e.match!="function"&&(r=e,e=null),r=r||{},this._factory=r.factory||W,this._entityIndex=r.entityIndex||new Wt({factory:this._factory}),this._entities=this._entityIndex._entities,this._termFromId=this._entityIndex._termFromId.bind(this._entityIndex),this._termToNumericId=this._entityIndex._termToNumericId.bind(this._entityIndex),this._termToNewNumericId=this._entityIndex._termToNewNumericId.bind(this._entityIndex),e&&this.addAll(e)}get size(){let e=this._size;if(e!==null)return e;e=0;let r=this._graphs,i,n;for(let s in r)for(let o in i=r[s].subjects)for(let a in n=i[o])e+=Object.keys(n[a]).length;return this._size=e}_addToIndex(e,r,i,n){let s=e[r]||(e[r]={}),o=s[i]||(s[i]={}),a=n in o;return a||(o[n]=null),!a}_removeFromIndex(e,r,i,n){let s=e[r],o=s[i];delete o[n];for(let a in o)return;delete s[i];for(let a in s)return;delete e[r]}*_findInIndex(e,r,i,n,s,o,a,l){let u,f,c,_=this._entities,h=this._termFromId(_[l]),b={subject:null,predicate:null,object:null};r&&((u=e,e={})[r]=u[r]);for(let p in e)if(f=e[p]){b[s]=this._termFromId(_[p]),i&&((u=f,f={})[i]=u[i]);for(let y in f)if(c=f[y]){b[o]=this._termFromId(_[y]);let g=n?n in c?[n]:[]:Object.keys(c);for(let E=0;E<g.length;E++)b[a]=this._termFromId(_[g[E]]),yield this._factory.quad(b.subject,b.predicate,b.object,h)}}}_loop(e,r){for(let i in e)r(i)}_loopByKey0(e,r,i){let n,s;if(n=e[r])for(s in n)i(s)}_loopByKey1(e,r,i){let n,s;for(n in e)s=e[n],s[r]&&i(n)}_loopBy2Keys(e,r,i,n){let s,o,a;if((s=e[r])&&(o=s[i]))for(a in o)n(a)}_loopByKey0Deep(e,r,i){let n,s,o,a;if(n=e[r])for(o in n){s=n[o];for(a in s)i(a)}}_countInIndex(e,r,i,n){let s=0,o,a,l;r&&((o=e,e={})[r]=o[r]);for(let u in e)if(a=e[u]){i&&((o=a,a={})[i]=o[i]);for(let f in a)(l=a[f])&&(n?n in l&&s++:s+=Object.keys(l).length)}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){let r=Object.create(null);return i=>{i in r||(r[i]=!0,e(this._termFromId(this._entities[i],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,r,i,n){r||(n=e.graph,i=e.object,r=e.predicate,e=e.subject),n=n?this._termToNewNumericId(n):1;let s=this._graphs[n];return s||(s=this._graphs[n]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),e=this._termToNewNumericId(e),r=this._termToNewNumericId(r),i=this._termToNewNumericId(i),this._addToIndex(s.subjects,e,r,i)?(this._addToIndex(s.predicates,r,i,e),this._addToIndex(s.objects,i,e,r),this._size=null,!0):!1}addQuads(e){for(let r=0;r<e.length;r++)this.addQuad(e[r])}delete(e){return this.removeQuad(e),this}has(e,r,i,n){return e&&e.subject&&({subject:e,predicate:r,object:i,graph:n}=e),!this.readQuads(e,r,i,n).next().done}import(e){return e.on("data",r=>{this.addQuad(r)}),e}removeQuad(e,r,i,n){r||({subject:e,predicate:r,object:i,graph:n}=e),n=n?this._termToNumericId(n):1;let s=this._graphs,o,a,l;if(!(e=e&&this._termToNumericId(e))||!(r=r&&this._termToNumericId(r))||!(i=i&&this._termToNumericId(i))||!(o=s[n])||!(a=o.subjects[e])||!(l=a[r])||!(i in l))return!1;this._removeFromIndex(o.subjects,e,r,i),this._removeFromIndex(o.predicates,r,i,e),this._removeFromIndex(o.objects,i,e,r),this._size!==null&&this._size--;for(e in o.subjects)return!0;return delete s[n],!0}removeQuads(e){for(let r=0;r<e.length;r++)this.removeQuad(e[r])}remove(e){return e.on("data",r=>{this.removeQuad(r)}),e}removeMatches(e,r,i,n){let s=new pn.Readable({objectMode:!0}),o=this.readQuads(e,r,i,n);return s._read=a=>{for(;--a>=0;){let{done:l,value:u}=o.next();if(l){s.push(null);return}s.push(u)}},this.remove(s)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,r,i,n){return[...this.readQuads(e,r,i,n)]}*readQuads(e,r,i,n){let s=this._getGraphs(n),o,a,l,u;if(!(e&&!(a=this._termToNumericId(e))||r&&!(l=this._termToNumericId(r))||i&&!(u=this._termToNumericId(i))))for(let f in s)(o=s[f])&&(a?u?yield*this._findInIndex(o.objects,u,a,l,"object","subject","predicate",f):yield*this._findInIndex(o.subjects,a,l,null,"subject","predicate","object",f):l?yield*this._findInIndex(o.predicates,l,u,null,"predicate","object","subject",f):u?yield*this._findInIndex(o.objects,u,null,null,"object","subject","predicate",f):yield*this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",f))}match(e,r,i,n){return new ve(this,e,r,i,n,{entityIndex:this._entityIndex})}countQuads(e,r,i,n){let s=this._getGraphs(n),o=0,a,l,u,f;if(e&&!(l=this._termToNumericId(e))||r&&!(u=this._termToNumericId(r))||i&&!(f=this._termToNumericId(i)))return 0;for(let c in s)(a=s[c])&&(e?i?o+=this._countInIndex(a.objects,f,l,u):o+=this._countInIndex(a.subjects,l,u,f):r?o+=this._countInIndex(a.predicates,u,f,l):o+=this._countInIndex(a.objects,f,l,u));return o}forEach(e,r,i,n,s){this.some(o=>(e(o,this),!1),r,i,n,s)}every(e,r,i,n,s){return!this.some(o=>!e(o,this),r,i,n,s)}some(e,r,i,n,s){for(let o of this.readQuads(r,i,n,s))if(e(o,this))return!0;return!1}getSubjects(e,r,i){let n=[];return this.forSubjects(s=>{n.push(s)},e,r,i),n}forSubjects(e,r,i,n){let s=this._getGraphs(n),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||i&&!(l=this._termToNumericId(i))))for(n in s)(o=s[n])&&(a?l?this._loopBy2Keys(o.predicates,a,l,e):this._loopByKey1(o.subjects,a,e):l?this._loopByKey0(o.objects,l,e):this._loop(o.subjects,e))}getPredicates(e,r,i){let n=[];return this.forPredicates(s=>{n.push(s)},e,r,i),n}forPredicates(e,r,i,n){let s=this._getGraphs(n),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||i&&!(l=this._termToNumericId(i))))for(n in s)(o=s[n])&&(a?l?this._loopBy2Keys(o.objects,l,a,e):this._loopByKey0(o.subjects,a,e):l?this._loopByKey1(o.predicates,l,e):this._loop(o.predicates,e))}getObjects(e,r,i){let n=[];return this.forObjects(s=>{n.push(s)},e,r,i),n}forObjects(e,r,i,n){let s=this._getGraphs(n),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||i&&!(l=this._termToNumericId(i))))for(n in s)(o=s[n])&&(a?l?this._loopBy2Keys(o.subjects,a,l,e):this._loopByKey0Deep(o.subjects,a,e):l?this._loopByKey0(o.predicates,l,e):this._loop(o.objects,e))}getGraphs(e,r,i){let n=[];return this.forGraphs(s=>{n.push(s)},e,r,i),n}forGraphs(e,r,i,n){for(let s in this._graphs)this.some(o=>(e(o.graph),!0),r,i,n,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:r=!1}={}){let i=Object.create(null),n=r?(()=>!0):((a,l)=>{throw new Error(`${a.value} ${l}`)}),s=this.getQuads(null,R.rdf.rest,R.rdf.nil,null),o=e?[...s]:[];return s.forEach(a=>{let l=[],u=!1,f,c,_=a.graph,h=a.subject;for(;h&&!u;){let b=this.getQuads(null,null,h,null),p=this.getQuads(h,null,null,null),y,g=null,E=null,A=null;for(let w=0;w<p.length&&!u;w++)y=p[w],y.graph.equals(_)?f?u=n(h,"has non-list arcs out"):y.predicate.value===R.rdf.first?g?u=n(h,"has multiple rdf:first arcs"):o.push(g=y):y.predicate.value===R.rdf.rest?E?u=n(h,"has multiple rdf:rest arcs"):o.push(E=y):b.length?u=n(h,"can't be subject and object"):(f=y,c="subject"):u=n(h,"not confined to single graph");for(let w=0;w<b.length&&!u;++w)y=b[w],f?u=n(h,"can't have coreferences"):y.predicate.value===R.rdf.rest?A?u=n(h,"has incoming rdf:rest arcs"):A=y:(f=y,c="object");g?l.unshift(g.object):u=n(h,"has no list head"),h=A&&A.subject}u?e=!1:f&&(i[f[c].value]=l)}),e&&this.removeQuads(o),i}addAll(e){if(e instanceof ve&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof t&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=Ut(this._graphs,e._graphs),this._size=null);else for(let r of e)this.add(r);return this}contains(e){if(e instanceof ve&&(e=e.filtered),e===this)return!0;if(!(e instanceof t)||this._entityIndex!==e._entityIndex)return e.every(u=>this.has(u));let r=this._graphs,i=e._graphs,n,s,o,a,l;for(let u in i){if(!(n=r[u]))return!1;n=n.subjects;for(let f in s=i[u].subjects){if(!(o=n[f]))return!1;for(let c in a=s[f]){if(!(l=o[c]))return!1;for(let _ in a[c])if(!(_ in l))return!1}}}return!0}deleteMatches(e,r,i,n){for(let s of this.match(e,r,i,n))this.removeQuad(s);return this}difference(e){if(e&&e instanceof ve&&(e=e.filtered),e===this)return new t({entityIndex:this._entityIndex});if(e instanceof t&&e._entityIndex===this._entityIndex){let r=new t({entityIndex:this._entityIndex}),i=fl(this._graphs,e._graphs);return i&&(r._graphs=i,r._size=null),r}return this.filter(r=>!e.has(r))}equals(e){return e instanceof ve&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){let r=new t({entityIndex:this._entityIndex});for(let i of this)e(i,this)&&r.add(i);return r}intersection(e){if(e instanceof ve&&(e=e.filtered),e===this){let r=new t({entityIndex:this._entityIndex});return r._graphs=Ut(Object.create(null),this._graphs),r._size=this._size,r}else if(e instanceof t&&this._entityIndex===e._entityIndex){let r=new t({entityIndex:this._entityIndex}),i=ul(e._graphs,this._graphs);return i&&(r._graphs=i,r._size=null),r}return this.filter(r=>e.has(r))}map(e){let r=new t({entityIndex:this._entityIndex});for(let i of this)r.add(e(i,this));return r}reduce(e,r){let i=this.readQuads(),n=r===void 0?i.next().value:r;for(let s of i)n=e(n,s,this);return n}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new Z().quadsToString(this)}union(e){let r=new t({entityIndex:this._entityIndex});return r._graphs=Ut(Object.create(null),this._graphs),r._size=this._size,r.addAll(e),r}*[Symbol.iterator](){yield*this.readQuads()}};function le(t,e,r=0){let i=e[r];if(i&&!(i in t))return!1;let n=!1;for(let s in i?{[i]:t[i]}:t){let o=r===2?null:le(t[s],e,r+1);o!==!1&&(n=n||Object.create(null),n[s]=o)}return n}var ve=class t extends pn.Readable{constructor(e,r,i,n,s,o){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:r,predicate:i,object:n,graph:s,options:o})}get filtered(){if(!this._filtered){let{n3Store:e,graph:r,object:i,predicate:n,subject:s}=this,o=this._filtered=new je({factory:e._factory,entityIndex:this.options.entityIndex}),a,l,u;if(s&&!(a=o._termToNumericId(s))||n&&!(l=o._termToNumericId(n))||i&&!(u=o._termToNumericId(i)))return o;let f=e._getGraphs(r);for(let c in f){let _,h,b,p;(p=f[c])&&(!a&&l?(h=le(p.predicates,[l,u,a]))&&(_=le(p.subjects,[a,l,u]),b=le(p.objects,[u,a,l])):u?(b=le(p.objects,[u,a,l]))&&(_=le(p.subjects,[a,l,u]),h=le(p.predicates,[l,u,a])):(_=le(p.subjects,[a,l,u]))&&(h=le(p.predicates,[l,u,a]),b=le(p.objects,[u,a,l])),_&&(o._graphs[c]={subjects:_,predicates:h,objects:b}))}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[hn]&&(this[hn]=this[Symbol.iterator]());let r=this[hn];for(;--e>=0;){let{done:i,value:n}=r.next();if(i){this.push(null);return}this.push(n)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,r,i,n){return this.filtered.deleteMatches(e,r,i,n)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,r,i,n,s){return this.filtered.every(e,r,i,n,s)}filter(e){return this.filtered.filter(e)}forEach(e,r,i,n,s){return this.filtered.forEach(e,r,i,n,s)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,r,i,n,s){return this.filtered.some(e,r,i,n,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(e)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,r){return this.filtered.reduce(e,r)}toString(){return new Z().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,r,i,n){return new t(this.filtered,e,r,i,n,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}};var Gt=class{dataset(e){return new je(e)}};function dl(t){let e=[];for(let{subject:r,object:i}of t.match(null,W.namedNode("http://www.w3.org/2000/10/swap/log#implies"),null,W.defaultGraph())){let n=[...t.match(null,null,null,r)],s=[...t.match(null,null,null,i)];e.push({premise:n,conclusion:s})}return e}var Vt=class{constructor(e,r={}){this._store=e,this._maxDerivations=r.maxDerivations===void 0?1/0:r.maxDerivations,this._maxPremiseDepth=r.maxPremiseDepth===void 0?1/0:r.maxPremiseDepth}_add(e,r,i,n,s){if(this._store._addToIndex(n.subjects,e,r,i)){if(this._store._addToIndex(n.predicates,r,i,e),this._store._addToIndex(n.objects,i,e,r),++this._derivations>this._maxDerivations)throw new Error(`Reasoning exceeded the maximum of ${this._maxDerivations} derivations`);s()}}_evaluatePremise(e,r,i,n=0){let s,o,a,l,u,[f,c,_]=e.premise[n].value,h=r[e.premise[n].content],b=!(a=f.value);for(a in b?h:{[a]:h[a]})if(l=h[a]){b&&(f.value=Number(a)),s=!(a=c.value);for(a in s?l:{[a]:l[a]})if(u=l[a]){s&&(c.value=Number(a)),o=!(a=_.value);for(a in o?u:{[a]:u[a]})o&&(_.value=Number(a)),n===e.premise.length-1?e.conclusion.forEach(p=>{this._add(p.subject.value,p.predicate.value,p.object.value,r,()=>{i(p)})}):this._evaluatePremise(e,r,i,n+1);o&&(_.value=null)}s&&(c.value=null)}b&&(f.value=null)}_evaluateRules(e,r,i){for(let n=0;n<e.length;n++)this._evaluatePremise(e[n],r,i)}_reasonGraphNaive(e,r){let i=[];function n(a){a.next&&a.next.forEach(l=>{i.push([a.subject.value,a.predicate.value,a.object.value,l])})}let s=a=>{a.forEach(l=>{this._add(l.subject.value,l.predicate.value,l.object.value,r,()=>{n(l)})})};this._evaluateRules(e,r,n);let o;for(;(o=i.pop())!==void 0;){let[a,l,u,f]=o,c=f.basePremise.subject.value;c||(f.basePremise.subject.value=a);let _=f.basePremise.predicate.value;_||(f.basePremise.predicate.value=l);let h=f.basePremise.object.value;h||(f.basePremise.object.value=u),f.premise.length===0?s(f.conclusion):this._evaluatePremise(f,r,n),c||(f.basePremise.subject.value=null),_||(f.basePremise.predicate.value=null),h||(f.basePremise.object.value=null)}}_createRule({premise:e,conclusion:r}){let i={},n=o=>o.termType==="Variable"?i[o.value]=i[o.value]||{}:{value:this._store._termToNewNumericId(o)},s=o=>({subject:n(o.subject),predicate:n(o.predicate),object:n(o.object)});return{premise:e.map(o=>s(o)),conclusion:r.map(o=>s(o)),variables:Object.values(i)}}reason(e){this._derivations=0,Array.isArray(e)||(e=dl(e)),e=e.map(i=>this._createRule(i));for(let i of e)if(i.premise.length>this._maxPremiseDepth)throw new Error(`Reasoning rule exceeds the maximum premise depth of ${this._maxPremiseDepth}`);for(let i of e)for(let n of e)for(let s=0;s<n.premise.length;s++){let o=n.premise[s];for(let a of i.conclusion){if(_n(o.subject,a.subject)&&_n(o.predicate,a.predicate)&&_n(o.object,a.object)){let l=new Set,u=[];o.subject.value=o.subject.value||1,o.object.value=o.object.value||1,o.predicate.value=o.predicate.value||1;for(let f=0;f<n.premise.length;f++)f!==s&&u.push(cl(n.premise[f],l));(a.next=a.next||[]).push({premise:u,conclusion:n.conclusion,basePremise:o})}n.variables.forEach(l=>{l.value=null})}}for(let i of e){let n=new Set;i.premise=i.premise.map(s=>cl(s,n))}let r=this._store._getGraphs();try{for(let i in r)this._reasonGraphNaive(e,r[i])}finally{this._store._size=null}}};function cl({subject:t,predicate:e,object:r},i){let n=t.value||i.has(t)||(i.add(t),!1),s=e.value||i.has(e)||(i.add(e),!1),o=r.value||i.has(r)||(i.add(r),!1);return!n&&s?{content:"predicates",value:[e,r,t]}:o?{content:"objects",value:[r,t,e]}:{content:"subjects",value:[t,e,r]}}function _n(t,e){return t.value===null&&(t.value=e.value),t.value===e.value}var hl=zt(Fr());var Qt=class extends hl.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;let r=new he(e),i,n,s={onQuad:(o,a)=>{o&&this.emit("error",o)||a&&this.push(a)},onPrefix:(o,a)=>{this.emit("prefix",o,a)}};e&&e.comments&&(s.onComment=o=>{this.emit("comment",o)}),r.parse({on:(o,a)=>{switch(o){case"data":i=a;break;case"end":n=a;break}}},s),this._transform=(o,a,l)=>{i(o),l()},this._flush=o=>{n(),o()}}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this.emit("error",r)}),this}};var pl=zt(Fr());var Ht=class extends pl.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0});let r=this._writer=new Z({write:(i,n,s)=>{this.push(i),s&&s()},end:i=>{this.push(null),i&&i()}},e);this._transform=(i,n,s)=>{r.addQuad(i,s)},this._flush=i=>{r.end(i)}}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this.emit("error",r)}),e.on("prefix",(r,i)=>{this._writer.addPrefix(r,i)}),this}};var bb={Lexer:Ce,Parser:he,Writer:Z,Store:je,StoreFactory:Gt,EntityIndex:Wt,StreamParser:Qt,StreamWriter:Ht,Util:Kr,Reasoner:Vt,BaseIRI:Me,DataFactory:W,Term:U,NamedNode:rt,Literal:ce,BlankNode:It,Variable:Rt,DefaultGraph:Tt,Quad:Se,Triple:Se,termFromId:Ee,termToId:de};export{Me as BaseIRI,It as BlankNode,W as DataFactory,Tt as DefaultGraph,Wt as EntityIndex,Ce as Lexer,ce as Literal,rt as NamedNode,he as Parser,Se as Quad,Vt as Reasoner,je as Store,Gt as StoreFactory,Qt as StreamParser,Ht as StreamWriter,U as Term,Se as Triple,Kr as Util,Rt as Variable,Z as Writer,bb as default,dl as getRulesFromDataset,Ee as termFromId,de as termToId};
22
+ `),this._subject=null),this._write=this._blockedWrite;let r=e&&((i,n)=>{r=null,e(i,n)});if(this._endStream)try{return this._outputStream.end(r)}catch{}r&&r()}};function Xn(t){let e=yu[t];return e===void 0&&(t.length===1?(e=t.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=((t.charCodeAt(0)-55296)*1024+t.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}var pn=zt(Fr());var hn=Symbol("iter");function Qp(t,e,r,i){let n=t&&t[e],s=n&&n[r];return!!s&&i in s}function Ut(t,e,r=4){if(r===0)return Object.assign(t,e);for(let i in e)t[i]=Ut(t[i]||Object.create(null),e[i],r-1);return t}function ul(t,e,r=4){let i=!1;for(let n in t)if(n in e){let s=r===0?null:ul(t[n],e[n],r-1);if(s!==!1)i=i||Object.create(null),i[n]=s;else if(r===3)return!1}return i}function fl(t,e,r=4){let i=!1;for(let n in t)if(!(n in e))i=i||Object.create(null),i[n]=r===0?null:Ut({},t[n],r-1);else if(r!==0){let s=fl(t[n],e[n],r-1);if(s!==!1)i=i||Object.create(null),i[n]=s;else if(r===3)return!1}return i}var Wt=class{constructor(e={}){this._id=1,this._ids=Object.create(null),this._ids[""]=1,this._entities=Object.create(null),this._entities[1]="",this._blankNodeIndex=0,this._factory=e.factory||W}_termFromId(e){if(e[0]==="."){let r=this._entities,i=e.split(".");return this._factory.quad(this._termFromId(r[i[1]]),this._termFromId(r[i[2]]),this._termFromId(r[i[3]]),i[4]&&this._termFromId(r[i[4]]))}return Se(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){let r=this._termToNumericId(e.subject),i=this._termToNumericId(e.predicate),n=this._termToNumericId(e.object),s;return r&&i&&n&&(pe(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${r}.${i}.${n}.${s}`:`.${r}.${i}.${n}`]}return this._ids[de(e)]}_termToNewNumericId(e){let r=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${pe(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:de(e);return this._ids[r]||(this._ids[this._entities[++this._id]=r]=this._id)}createBlankNode(e){let r,i;if(e)for(r=e=`_:${e}`,i=1;this._ids[r];)r=e+i++;else do r=`_:b${this._blankNodeIndex++}`;while(this._ids[r]);return this._ids[r]=++this._id,this._entities[this._id]=r,this._factory.blankNode(r.substr(2))}},je=class t{constructor(e,r){this._size=0,this._graphs=Object.create(null),!r&&e&&!e[0]&&typeof e.match!="function"&&(r=e,e=null),r=r||{},this._factory=r.factory||W,this._entityIndex=r.entityIndex||new Wt({factory:this._factory}),this._entities=this._entityIndex._entities,this._termFromId=this._entityIndex._termFromId.bind(this._entityIndex),this._termToNumericId=this._entityIndex._termToNumericId.bind(this._entityIndex),this._termToNewNumericId=this._entityIndex._termToNewNumericId.bind(this._entityIndex),e&&this.addAll(e)}get size(){let e=this._size;if(e!==null)return e;e=0;let r=this._graphs,i,n;for(let s in r)for(let o in i=r[s].subjects)for(let a in n=i[o])e+=Object.keys(n[a]).length;return this._size=e}_addToIndex(e,r,i,n){let s=e[r]||(e[r]={}),o=s[i]||(s[i]={}),a=n in o;return a||(o[n]=null),!a}_removeFromIndex(e,r,i,n){let s=e[r],o=s[i];delete o[n];for(let a in o)return;delete s[i];for(let a in s)return;delete e[r]}*_findInIndex(e,r,i,n,s,o,a,l){let u,f,c,_=this._entities,h=this._termFromId(_[l]),b={subject:null,predicate:null,object:null};r&&((u=e,e={})[r]=u[r]);for(let p in e)if(f=e[p]){b[s]=this._termFromId(_[p]),i&&((u=f,f={})[i]=u[i]);for(let y in f)if(c=f[y]){b[o]=this._termFromId(_[y]);let g=n?n in c?[n]:[]:Object.keys(c);for(let E=0;E<g.length;E++)b[a]=this._termFromId(_[g[E]]),yield this._factory.quad(b.subject,b.predicate,b.object,h)}}}_loop(e,r){for(let i in e)r(i)}_loopByKey0(e,r,i){let n,s;if(n=e[r])for(s in n)i(s)}_loopByKey1(e,r,i){let n,s;for(n in e)s=e[n],s[r]&&i(n)}_loopBy2Keys(e,r,i,n){let s,o,a;if((s=e[r])&&(o=s[i]))for(a in o)n(a)}_loopByKey0Deep(e,r,i){let n,s,o,a;if(n=e[r])for(o in n){s=n[o];for(a in s)i(a)}}_countInIndex(e,r,i,n){let s=0,o,a,l;r&&((o=e,e={})[r]=o[r]);for(let u in e)if(a=e[u]){i&&((o=a,a={})[i]=o[i]);for(let f in a)(l=a[f])&&(n?n in l&&s++:s+=Object.keys(l).length)}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){let r=Object.create(null);return i=>{i in r||(r[i]=!0,e(this._termFromId(this._entities[i],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,r,i,n){r||(n=e.graph,i=e.object,r=e.predicate,e=e.subject),n=n?this._termToNewNumericId(n):1;let s=this._graphs[n];return s||(s=this._graphs[n]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),e=this._termToNewNumericId(e),r=this._termToNewNumericId(r),i=this._termToNewNumericId(i),this._addToIndex(s.subjects,e,r,i)?(this._addToIndex(s.predicates,r,i,e),this._addToIndex(s.objects,i,e,r),this._size=null,!0):!1}addQuads(e){for(let r=0;r<e.length;r++)this.addQuad(e[r])}delete(e){return this.removeQuad(e),this}has(e,r,i,n){if(e&&e.subject&&({subject:e,predicate:r,object:i,graph:n}=e),e&&r&&i&&n!==void 0&&n!==null){let s=this._termToNumericId(e),o=this._termToNumericId(r),a=this._termToNumericId(i),l=n===""||pe(n)?1:this._termToNumericId(n),u=l&&this._graphs[l];return!!s&&!!o&&!!a&&!!u&&Qp(u.subjects,s,o,a)}return!this.readQuads(e,r,i,n).next().done}import(e){return e.on("data",r=>{this.addQuad(r)}),e}removeQuad(e,r,i,n){r||({subject:e,predicate:r,object:i,graph:n}=e),n=n?this._termToNumericId(n):1;let s=this._graphs,o,a,l;if(!(e=e&&this._termToNumericId(e))||!(r=r&&this._termToNumericId(r))||!(i=i&&this._termToNumericId(i))||!(o=s[n])||!(a=o.subjects[e])||!(l=a[r])||!(i in l))return!1;this._removeFromIndex(o.subjects,e,r,i),this._removeFromIndex(o.predicates,r,i,e),this._removeFromIndex(o.objects,i,e,r),this._size!==null&&this._size--;for(e in o.subjects)return!0;return delete s[n],!0}removeQuads(e){for(let r=0;r<e.length;r++)this.removeQuad(e[r])}remove(e){return e.on("data",r=>{this.removeQuad(r)}),e}removeMatches(e,r,i,n){let s=new pn.Readable({objectMode:!0}),o=this.readQuads(e,r,i,n);return s._read=a=>{for(;--a>=0;){let{done:l,value:u}=o.next();if(l){s.push(null);return}s.push(u)}},this.remove(s)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,r,i,n){return[...this.readQuads(e,r,i,n)]}*readQuads(e,r,i,n){let s=this._getGraphs(n),o,a,l,u;if(!(e&&!(a=this._termToNumericId(e))||r&&!(l=this._termToNumericId(r))||i&&!(u=this._termToNumericId(i))))for(let f in s)(o=s[f])&&(a?u?yield*this._findInIndex(o.objects,u,a,l,"object","subject","predicate",f):yield*this._findInIndex(o.subjects,a,l,null,"subject","predicate","object",f):l?yield*this._findInIndex(o.predicates,l,u,null,"predicate","object","subject",f):u?yield*this._findInIndex(o.objects,u,null,null,"object","subject","predicate",f):yield*this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",f))}match(e,r,i,n){return new ve(this,e,r,i,n,{entityIndex:this._entityIndex})}countQuads(e,r,i,n){let s=this._getGraphs(n),o=0,a,l,u,f;if(e&&!(l=this._termToNumericId(e))||r&&!(u=this._termToNumericId(r))||i&&!(f=this._termToNumericId(i)))return 0;for(let c in s)(a=s[c])&&(e?i?o+=this._countInIndex(a.objects,f,l,u):o+=this._countInIndex(a.subjects,l,u,f):r?o+=this._countInIndex(a.predicates,u,f,l):o+=this._countInIndex(a.objects,f,l,u));return o}forEach(e,r,i,n,s){this.some(o=>(e(o,this),!1),r,i,n,s)}every(e,r,i,n,s){return!this.some(o=>!e(o,this),r,i,n,s)}some(e,r,i,n,s){for(let o of this.readQuads(r,i,n,s))if(e(o,this))return!0;return!1}getSubjects(e,r,i){let n=[];return this.forSubjects(s=>{n.push(s)},e,r,i),n}forSubjects(e,r,i,n){let s=this._getGraphs(n),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||i&&!(l=this._termToNumericId(i))))for(n in s)(o=s[n])&&(a?l?this._loopBy2Keys(o.predicates,a,l,e):this._loopByKey1(o.subjects,a,e):l?this._loopByKey0(o.objects,l,e):this._loop(o.subjects,e))}getPredicates(e,r,i){let n=[];return this.forPredicates(s=>{n.push(s)},e,r,i),n}forPredicates(e,r,i,n){let s=this._getGraphs(n),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||i&&!(l=this._termToNumericId(i))))for(n in s)(o=s[n])&&(a?l?this._loopBy2Keys(o.objects,l,a,e):this._loopByKey0(o.subjects,a,e):l?this._loopByKey1(o.predicates,l,e):this._loop(o.predicates,e))}getObjects(e,r,i){let n=[];return this.forObjects(s=>{n.push(s)},e,r,i),n}forObjects(e,r,i,n){let s=this._getGraphs(n),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||i&&!(l=this._termToNumericId(i))))for(n in s)(o=s[n])&&(a?l?this._loopBy2Keys(o.subjects,a,l,e):this._loopByKey0Deep(o.subjects,a,e):l?this._loopByKey0(o.predicates,l,e):this._loop(o.objects,e))}getGraphs(e,r,i){let n=[];return this.forGraphs(s=>{n.push(s)},e,r,i),n}forGraphs(e,r,i,n){for(let s in this._graphs)this.some(o=>(e(o.graph),!0),r,i,n,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:r=!1}={}){let i=Object.create(null),n=r?(()=>!0):((a,l)=>{throw new Error(`${a.value} ${l}`)}),s=this.getQuads(null,R.rdf.rest,R.rdf.nil,null),o=e?[...s]:[];return s.forEach(a=>{let l=[],u=!1,f,c,_=a.graph,h=a.subject;for(;h&&!u;){let b=this.getQuads(null,null,h,null),p=this.getQuads(h,null,null,null),y,g=null,E=null,A=null;for(let w=0;w<p.length&&!u;w++)y=p[w],y.graph.equals(_)?f?u=n(h,"has non-list arcs out"):y.predicate.value===R.rdf.first?g?u=n(h,"has multiple rdf:first arcs"):o.push(g=y):y.predicate.value===R.rdf.rest?E?u=n(h,"has multiple rdf:rest arcs"):o.push(E=y):b.length?u=n(h,"can't be subject and object"):(f=y,c="subject"):u=n(h,"not confined to single graph");for(let w=0;w<b.length&&!u;++w)y=b[w],f?u=n(h,"can't have coreferences"):y.predicate.value===R.rdf.rest?A?u=n(h,"has incoming rdf:rest arcs"):A=y:(f=y,c="object");g?l.unshift(g.object):u=n(h,"has no list head"),h=A&&A.subject}u?e=!1:f&&(i[f[c].value]=l)}),e&&this.removeQuads(o),i}addAll(e){if(e instanceof ve&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof t&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=Ut(this._graphs,e._graphs),this._size=null);else for(let r of e)this.add(r);return this}contains(e){if(e instanceof ve&&(e=e.filtered),e===this)return!0;if(!(e instanceof t)||this._entityIndex!==e._entityIndex)return e.every(u=>this.has(u));let r=this._graphs,i=e._graphs,n,s,o,a,l;for(let u in i){if(!(n=r[u]))return!1;n=n.subjects;for(let f in s=i[u].subjects){if(!(o=n[f]))return!1;for(let c in a=s[f]){if(!(l=o[c]))return!1;for(let _ in a[c])if(!(_ in l))return!1}}}return!0}deleteMatches(e,r,i,n){for(let s of this.match(e,r,i,n))this.removeQuad(s);return this}difference(e){if(e&&e instanceof ve&&(e=e.filtered),e===this)return new t({entityIndex:this._entityIndex});if(e instanceof t&&e._entityIndex===this._entityIndex){let r=new t({entityIndex:this._entityIndex}),i=fl(this._graphs,e._graphs);return i&&(r._graphs=i,r._size=null),r}return this.filter(r=>!e.has(r))}equals(e){return e instanceof ve&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){let r=new t({entityIndex:this._entityIndex});for(let i of this)e(i,this)&&r.add(i);return r}intersection(e){if(e instanceof ve&&(e=e.filtered),e===this){let r=new t({entityIndex:this._entityIndex});return r._graphs=Ut(Object.create(null),this._graphs),r._size=this._size,r}else if(e instanceof t&&this._entityIndex===e._entityIndex){let r=new t({entityIndex:this._entityIndex}),i=ul(e._graphs,this._graphs);return i&&(r._graphs=i,r._size=null),r}return this.filter(r=>e.has(r))}map(e){let r=new t({entityIndex:this._entityIndex});for(let i of this)r.add(e(i,this));return r}reduce(e,r){let i=this.readQuads(),n=r===void 0?i.next().value:r;for(let s of i)n=e(n,s,this);return n}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new Z().quadsToString(this)}union(e){let r=new t({entityIndex:this._entityIndex});return r._graphs=Ut(Object.create(null),this._graphs),r._size=this._size,r.addAll(e),r}*[Symbol.iterator](){yield*this.readQuads()}};function le(t,e,r=0){let i=e[r];if(i&&!(i in t))return!1;let n=!1;for(let s in i?{[i]:t[i]}:t){let o=r===2?null:le(t[s],e,r+1);o!==!1&&(n=n||Object.create(null),n[s]=o)}return n}var ve=class t extends pn.Readable{constructor(e,r,i,n,s,o){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:r,predicate:i,object:n,graph:s,options:o})}get filtered(){if(!this._filtered){let{n3Store:e,graph:r,object:i,predicate:n,subject:s}=this,o=this._filtered=new je({factory:e._factory,entityIndex:this.options.entityIndex}),a,l,u;if(s&&!(a=o._termToNumericId(s))||n&&!(l=o._termToNumericId(n))||i&&!(u=o._termToNumericId(i)))return o;let f=e._getGraphs(r);for(let c in f){let _,h,b,p;(p=f[c])&&(!a&&l?(h=le(p.predicates,[l,u,a]))&&(_=le(p.subjects,[a,l,u]),b=le(p.objects,[u,a,l])):u?(b=le(p.objects,[u,a,l]))&&(_=le(p.subjects,[a,l,u]),h=le(p.predicates,[l,u,a])):(_=le(p.subjects,[a,l,u]))&&(h=le(p.predicates,[l,u,a]),b=le(p.objects,[u,a,l])),_&&(o._graphs[c]={subjects:_,predicates:h,objects:b}))}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[hn]&&(this[hn]=this[Symbol.iterator]());let r=this[hn];for(;--e>=0;){let{done:i,value:n}=r.next();if(i){this.push(null);return}this.push(n)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,r,i,n){return this.filtered.deleteMatches(e,r,i,n)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,r,i,n,s){return this.filtered.every(e,r,i,n,s)}filter(e){return this.filtered.filter(e)}forEach(e,r,i,n,s){return this.filtered.forEach(e,r,i,n,s)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,r,i,n,s){return this.filtered.some(e,r,i,n,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(e)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,r){return this.filtered.reduce(e,r)}toString(){return new Z().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,r,i,n){return new t(this.filtered,e,r,i,n,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}};var Gt=class{dataset(e){return new je(e)}};function dl(t){let e=[];for(let{subject:r,object:i}of t.match(null,W.namedNode("http://www.w3.org/2000/10/swap/log#implies"),null,W.defaultGraph())){let n=[...t.match(null,null,null,r)],s=[...t.match(null,null,null,i)];e.push({premise:n,conclusion:s})}return e}var Vt=class{constructor(e,r={}){this._store=e,this._maxDerivations=r.maxDerivations===void 0?1/0:r.maxDerivations,this._maxPremiseDepth=r.maxPremiseDepth===void 0?1/0:r.maxPremiseDepth}_add(e,r,i,n,s){if(this._store._addToIndex(n.subjects,e,r,i)){if(this._store._addToIndex(n.predicates,r,i,e),this._store._addToIndex(n.objects,i,e,r),++this._derivations>this._maxDerivations)throw new Error(`Reasoning exceeded the maximum of ${this._maxDerivations} derivations`);s()}}_evaluatePremise(e,r,i,n=0){let s,o,a,l,u,[f,c,_]=e.premise[n].value,h=r[e.premise[n].content],b=!(a=f.value);for(a in b?h:{[a]:h[a]})if(l=h[a]){b&&(f.value=Number(a)),s=!(a=c.value);for(a in s?l:{[a]:l[a]})if(u=l[a]){s&&(c.value=Number(a)),o=!(a=_.value);for(a in o?u:{[a]:u[a]})o&&(_.value=Number(a)),n===e.premise.length-1?e.conclusion.forEach(p=>{this._add(p.subject.value,p.predicate.value,p.object.value,r,()=>{i(p)})}):this._evaluatePremise(e,r,i,n+1);o&&(_.value=null)}s&&(c.value=null)}b&&(f.value=null)}_evaluateRules(e,r,i){for(let n=0;n<e.length;n++)this._evaluatePremise(e[n],r,i)}_reasonGraphNaive(e,r){let i=[];function n(a){a.next&&a.next.forEach(l=>{i.push([a.subject.value,a.predicate.value,a.object.value,l])})}let s=a=>{a.forEach(l=>{this._add(l.subject.value,l.predicate.value,l.object.value,r,()=>{n(l)})})};this._evaluateRules(e,r,n);let o;for(;(o=i.pop())!==void 0;){let[a,l,u,f]=o,c=f.basePremise.subject.value;c||(f.basePremise.subject.value=a);let _=f.basePremise.predicate.value;_||(f.basePremise.predicate.value=l);let h=f.basePremise.object.value;h||(f.basePremise.object.value=u),f.premise.length===0?s(f.conclusion):this._evaluatePremise(f,r,n),c||(f.basePremise.subject.value=null),_||(f.basePremise.predicate.value=null),h||(f.basePremise.object.value=null)}}_createRule({premise:e,conclusion:r}){let i={},n=o=>o.termType==="Variable"?i[o.value]=i[o.value]||{}:{value:this._store._termToNewNumericId(o)},s=o=>({subject:n(o.subject),predicate:n(o.predicate),object:n(o.object)});return{premise:e.map(o=>s(o)),conclusion:r.map(o=>s(o)),variables:Object.values(i)}}reason(e){this._derivations=0,Array.isArray(e)||(e=dl(e)),e=e.map(i=>this._createRule(i));for(let i of e)if(i.premise.length>this._maxPremiseDepth)throw new Error(`Reasoning rule exceeds the maximum premise depth of ${this._maxPremiseDepth}`);for(let i of e)for(let n of e)for(let s=0;s<n.premise.length;s++){let o=n.premise[s];for(let a of i.conclusion){if(_n(o.subject,a.subject)&&_n(o.predicate,a.predicate)&&_n(o.object,a.object)){let l=new Set,u=[];o.subject.value=o.subject.value||1,o.object.value=o.object.value||1,o.predicate.value=o.predicate.value||1;for(let f=0;f<n.premise.length;f++)f!==s&&u.push(cl(n.premise[f],l));(a.next=a.next||[]).push({premise:u,conclusion:n.conclusion,basePremise:o})}n.variables.forEach(l=>{l.value=null})}}for(let i of e){let n=new Set;i.premise=i.premise.map(s=>cl(s,n))}let r=this._store._getGraphs();try{for(let i in r)this._reasonGraphNaive(e,r[i])}finally{this._store._size=null}}};function cl({subject:t,predicate:e,object:r},i){let n=t.value||i.has(t)||(i.add(t),!1),s=e.value||i.has(e)||(i.add(e),!1),o=r.value||i.has(r)||(i.add(r),!1);return!n&&s?{content:"predicates",value:[e,r,t]}:o?{content:"objects",value:[r,t,e]}:{content:"subjects",value:[t,e,r]}}function _n(t,e){return t.value===null&&(t.value=e.value),t.value===e.value}var hl=zt(Fr());var Ht=class extends hl.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;let r=new he(e),i,n,s={onQuad:(o,a)=>{o&&this.emit("error",o)||a&&this.push(a)},onPrefix:(o,a)=>{this.emit("prefix",o,a)}};e&&e.comments&&(s.onComment=o=>{this.emit("comment",o)}),r.parse({on:(o,a)=>{switch(o){case"data":i=a;break;case"end":n=a;break}}},s),this._transform=(o,a,l)=>{i(o),l()},this._flush=o=>{n(),o()}}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this.emit("error",r)}),this}};var pl=zt(Fr());var Qt=class extends pl.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0});let r=this._writer=new Z({write:(i,n,s)=>{this.push(i),s&&s()},end:i=>{this.push(null),i&&i()}},e);this._transform=(i,n,s)=>{r.addQuad(i,s)},this._flush=i=>{r.end(i)}}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this.emit("error",r)}),e.on("prefix",(r,i)=>{this._writer.addPrefix(r,i)}),this}};var gb={Lexer:Ce,Parser:he,Writer:Z,Store:je,StoreFactory:Gt,EntityIndex:Wt,StreamParser:Ht,StreamWriter:Qt,Util:Kr,Reasoner:Vt,BaseIRI:Me,DataFactory:W,Term:U,NamedNode:rt,Literal:ce,BlankNode:It,Variable:Rt,DefaultGraph:Tt,Quad:Ie,Triple:Ie,termFromId:Se,termToId:de};export{Me as BaseIRI,It as BlankNode,W as DataFactory,Tt as DefaultGraph,Wt as EntityIndex,Ce as Lexer,ce as Literal,rt as NamedNode,he as Parser,Ie as Quad,Vt as Reasoner,je as Store,Gt as StoreFactory,Ht as StreamParser,Qt as StreamWriter,U as Term,Ie as Triple,Kr as Util,Rt as Variable,Z as Writer,gb as default,dl as getRulesFromDataset,Se as termFromId,de as termToId};
23
23
  /*! Bundled license information:
24
24
 
25
25
  ieee754/index.js: