n3 3.0.0-alpha.5 → 3.0.0-alpha.6
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.
- package/README.md +24 -0
- package/browser/n3.esm.min.js +12 -13
- package/browser/n3.min.js +12 -13
- package/lib/N3Lexer.js +54 -14
- package/lib/N3Parser.js +16 -5
- package/lib/N3Store.js +4 -1
- package/lib/N3Writer.js +20 -8
- package/package.json +1 -1
- package/src/N3Lexer.js +46 -14
- package/src/N3Parser.js +20 -5
- package/src/N3Store.js +4 -1
- package/src/N3Writer.js +23 -8
package/browser/n3.esm.min.js
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
var Ul=Object.create;var ur=Object.defineProperty,ql=Object.defineProperties,Wl=Object.getOwnPropertyDescriptor,Gl=Object.getOwnPropertyDescriptors,Ql=Object.getOwnPropertyNames,On=Object.getOwnPropertySymbols,zl=Object.getPrototypeOf,$n=Object.prototype.hasOwnProperty,Vl=Object.prototype.propertyIsEnumerable;var at=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Hl=t=>{throw TypeError(t)};var Mn=(t,e,r)=>e in t?ur(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M=(t,e)=>{for(var r in e||(e={}))$n.call(e,r)&&Mn(t,r,e[r]);if(On)for(var r of On(e))Vl.call(e,r)&&Mn(t,r,e[r]);return t},Ce=(t,e)=>ql(t,Gl(e));var A=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Kl=(t,e)=>{for(var r in e)ur(t,r,{get:e[r],enumerable:!0})},Yl=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ql(e))!$n.call(t,n)&&n!==r&&ur(t,n,{get:()=>e[n],enumerable:!(i=Wl(e,n))||i.enumerable});return t};var ei=(t,e,r)=>(r=t!=null?Ul(zl(t)):{},Yl(e||!t||!t.__esModule?ur(r,"default",{value:t,enumerable:!0}):r,t));var W=function(t,e){this[0]=t,this[1]=e},ee=(t,e,r)=>{var i=(a,l,u,f)=>{try{var c=r[a](l),d=(l=c.value)instanceof W,_=c.done;Promise.resolve(d?l[0]:l).then(p=>d?i(a==="return"?a:"next",l[1]?{done:p.done,value:p.value}:p,u,f):u({value:p,done:_})).catch(p=>i("throw",p,u,f))}catch(p){f(p)}},n=(a,l,u,f)=>o[a]=c=>(l=new Promise((d,_,p)=>(p=()=>i(a,c,d,_),s?s.then(p):p())),f=()=>s===u&&(s=0),s=u=l.then(f,f),l),s,o={};return r=r.apply(t,e),o[at("asyncIterator")]=()=>o,n("next"),n("throw"),n("return"),o},ne=t=>{var e=t[at("asyncIterator")],r=!1,i,n={};return e==null?(e=t[at("iterator")](),i=s=>n[s]=o=>e[s](o)):(e=e.call(t),i=s=>n[s]=o=>{if(r){if(r=!1,s==="throw")throw o;return o}return r=!0,{done:!1,value:new W(new Promise(a=>{var l=e[s](o);l instanceof Object||Hl("Object expected"),a(l)}),1)}}),n[at("iterator")]=()=>n,i("next"),"throw"in e?i("throw"):n.throw=s=>{throw s},"return"in e&&i("return"),n},K=(t,e,r)=>(e=t[at("asyncIterator")])?e.call(t):(t=t[at("iterator")](),e={},r=(i,n)=>(n=t[i])&&(e[i]=s=>new Promise((o,a,l)=>(s=n.call(t,s),l=s.done,Promise.resolve(s.value).then(u=>o({value:u,done:l}),a)))),r("next"),r("return"),e);var is=A(hr=>{"use strict";hr.byteLength=vu;hr.toByteArray=Pu;hr.fromByteArray=Cu;var ue=[],te=[],Au=typeof Uint8Array!="undefined"?Uint8Array:Array,ai="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ve=0,ts=ai.length;Ve<ts;++Ve)ue[Ve]=ai[Ve],te[ai.charCodeAt(Ve)]=Ve;var Ve,ts;te[45]=62;te[95]=63;function rs(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 vu(t){var e=rs(t),r=e[0],i=e[1];return(r+i)*3/4-i}function Nu(t,e,r){return(e+r)*3/4-r}function Pu(t){var e,r=rs(t),i=r[0],n=r[1],s=new Au(Nu(t,i,n)),o=0,a=n>0?i-4:i,l;for(l=0;l<a;l+=4)e=te[t.charCodeAt(l)]<<18|te[t.charCodeAt(l+1)]<<12|te[t.charCodeAt(l+2)]<<6|te[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return n===2&&(e=te[t.charCodeAt(l)]<<2|te[t.charCodeAt(l+1)]>>4,s[o++]=e&255),n===1&&(e=te[t.charCodeAt(l)]<<10|te[t.charCodeAt(l+1)]<<4|te[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function ju(t){return ue[t>>18&63]+ue[t>>12&63]+ue[t>>6&63]+ue[t&63]}function Lu(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(ju(i));return n.join("")}function Cu(t){for(var e,r=t.length,i=r%3,n=[],s=16383,o=0,a=r-i;o<a;o+=s)n.push(Lu(t,o,o+s>a?a:o+s));return i===1?(e=t[r-1],n.push(ue[e>>2]+ue[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(ue[e>>10]+ue[e>>4&63]+ue[e<<2&63]+"=")),n.join("")}});var ns=A(li=>{li.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,d=r?-1:1,_=t[e+c];for(c+=d,s=_&(1<<-f)-1,_>>=-f,f+=a;f>0;s=s*256+t[e+c],c+=d,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=i;f>0;o=o*256+t[e+c],c+=d,f-=8);if(s===0)s=1-u;else{if(s===l)return o?NaN:(_?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-u}return(_?-1:1)*o*Math.pow(2,s-i)};li.write=function(t,e,r,i,n,s){var o,a,l,u=s*8-n-1,f=(1<<u)-1,c=f>>1,d=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=i?0:s-1,p=i?1:-1,h=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+=d/l:e+=d*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+_]=a&255,_+=p,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;t[r+_]=o&255,_+=p,o/=256,u-=8);t[r+_-p]|=h*128}});var Ie=A(bt=>{"use strict";var ui=is(),_t=ns(),ss=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;bt.Buffer=b;bt.SlowBuffer=$u;bt.INSPECT_MAX_BYTES=50;var _r=2147483647;bt.kMaxLength=_r;b.TYPED_ARRAY_SUPPORT=Fu();!b.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&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 Fu(){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(t){return!1}}Object.defineProperty(b.prototype,"parent",{enumerable:!0,get:function(){if(b.isBuffer(this))return this.buffer}});Object.defineProperty(b.prototype,"offset",{enumerable:!0,get:function(){if(b.isBuffer(this))return this.byteOffset}});function Se(t){if(t>_r)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,b.prototype),e}function b(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 hi(t)}return us(t,e,r)}b.poolSize=8192;function us(t,e,r){if(typeof t=="string")return Du(t,e);if(ArrayBuffer.isView(t))return Ou(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(fe(t,ArrayBuffer)||t&&fe(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(fe(t,SharedArrayBuffer)||t&&fe(t.buffer,SharedArrayBuffer)))return ci(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 b.from(i,e,r);let n=Mu(t);if(n)return n;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return b.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)}b.from=function(t,e,r){return us(t,e,r)};Object.setPrototypeOf(b.prototype,Uint8Array.prototype);Object.setPrototypeOf(b,Uint8Array);function fs(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 Bu(t,e,r){return fs(t),t<=0?Se(t):e!==void 0?typeof r=="string"?Se(t).fill(e,r):Se(t).fill(e):Se(t)}b.alloc=function(t,e,r){return Bu(t,e,r)};function hi(t){return fs(t),Se(t<0?0:_i(t)|0)}b.allocUnsafe=function(t){return hi(t)};b.allocUnsafeSlow=function(t){return hi(t)};function Du(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!b.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=cs(t,e)|0,i=Se(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function fi(t){let e=t.length<0?0:_i(t.length)|0,r=Se(e);for(let i=0;i<e;i+=1)r[i]=t[i]&255;return r}function Ou(t){if(fe(t,Uint8Array)){let e=new Uint8Array(t);return ci(e.buffer,e.byteOffset,e.byteLength)}return fi(t)}function ci(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,b.prototype),i}function Mu(t){if(b.isBuffer(t)){let e=_i(t.length)|0,r=Se(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||bi(t.length)?Se(0):fi(t);if(t.type==="Buffer"&&Array.isArray(t.data))return fi(t.data)}function _i(t){if(t>=_r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_r.toString(16)+" bytes");return t|0}function $u(t){return+t!=t&&(t=0),b.alloc(+t)}b.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==b.prototype};b.compare=function(e,r){if(fe(e,Uint8Array)&&(e=b.from(e,e.offset,e.byteLength)),fe(r,Uint8Array)&&(r=b.from(r,r.offset,r.byteLength)),!b.isBuffer(e)||!b.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};b.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}};b.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return b.alloc(0);let i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;let n=b.allocUnsafe(r),s=0;for(i=0;i<e.length;++i){let o=e[i];if(fe(o,Uint8Array))s+o.length>n.length?(b.isBuffer(o)||(o=b.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(b.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function cs(t,e){if(b.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||fe(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 di(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return ws(t).length;default:if(n)return i?-1:di(t).length;e=(""+e).toLowerCase(),n=!0}}b.byteLength=cs;function ku(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 Yu(this,e,r);case"utf8":case"utf-8":return hs(this,e,r);case"ascii":return Hu(this,e,r);case"latin1":case"binary":return Ku(this,e,r);case"base64":return zu(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Zu(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}b.prototype._isBuffer=!0;function He(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}b.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)He(this,r,r+1);return this};b.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)He(this,r,r+3),He(this,r+1,r+2);return this};b.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)He(this,r,r+7),He(this,r+1,r+6),He(this,r+2,r+5),He(this,r+3,r+4);return this};b.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?hs(this,0,e):ku.apply(this,arguments)};b.prototype.toLocaleString=b.prototype.toString;b.prototype.equals=function(e){if(!b.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:b.compare(this,e)===0};b.prototype.inspect=function(){let e="",r=bt.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};ss&&(b.prototype[ss]=b.prototype.inspect);b.prototype.compare=function(e,r,i,n,s){if(fe(e,Uint8Array)&&(e=b.from(e,e.offset,e.byteLength)),!b.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 ds(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,bi(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=b.from(e,i)),b.isBuffer(e))return e.length===0?-1:os(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):os(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function os(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}b.prototype.includes=function(e,r,i){return this.indexOf(e,r,i)!==-1};b.prototype.indexOf=function(e,r,i){return ds(this,e,r,i,!0)};b.prototype.lastIndexOf=function(e,r,i){return ds(this,e,r,i,!1)};function Uu(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(bi(a))return o;t[r+o]=a}return o}function qu(t,e,r,i){return pr(di(e,t.length-r),t,r,i)}function Wu(t,e,r,i){return pr(tf(e),t,r,i)}function Gu(t,e,r,i){return pr(ws(e),t,r,i)}function Qu(t,e,r,i){return pr(rf(e,t.length-r),t,r,i)}b.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 Uu(this,e,r,i);case"utf8":case"utf-8":return qu(this,e,r,i);case"ascii":case"latin1":case"binary":return Wu(this,e,r,i);case"base64":return Gu(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Qu(this,e,r,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};b.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function zu(t,e,r){return e===0&&r===t.length?ui.fromByteArray(t):ui.fromByteArray(t.slice(e,r))}function hs(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 Vu(i)}var as=4096;function Vu(t){let e=t.length;if(e<=as)return String.fromCharCode.apply(String,t);let r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=as));return r}function Hu(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 Ku(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 Yu(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+=nf[t[s]];return n}function Zu(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}b.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,b.prototype),n};function q(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")}b.prototype.readUintLE=b.prototype.readUIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||q(e,r,this.length);let n=this[e],s=1,o=0;for(;++o<r&&(s*=256);)n+=this[e+o]*s;return n};b.prototype.readUintBE=b.prototype.readUIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||q(e,r,this.length);let n=this[e+--r],s=1;for(;r>0&&(s*=256);)n+=this[e+--r]*s;return n};b.prototype.readUint8=b.prototype.readUInt8=function(e,r){return e=e>>>0,r||q(e,1,this.length),this[e]};b.prototype.readUint16LE=b.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||q(e,2,this.length),this[e]|this[e+1]<<8};b.prototype.readUint16BE=b.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||q(e,2,this.length),this[e]<<8|this[e+1]};b.prototype.readUint32LE=b.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||q(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};b.prototype.readUint32BE=b.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||q(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};b.prototype.readBigUInt64LE=Oe(function(e){e=e>>>0,pt(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Gt(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))});b.prototype.readBigUInt64BE=Oe(function(e){e=e>>>0,pt(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Gt(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)});b.prototype.readIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||q(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};b.prototype.readIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||q(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};b.prototype.readInt8=function(e,r){return e=e>>>0,r||q(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};b.prototype.readInt16LE=function(e,r){e=e>>>0,r||q(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};b.prototype.readInt16BE=function(e,r){e=e>>>0,r||q(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};b.prototype.readInt32LE=function(e,r){return e=e>>>0,r||q(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};b.prototype.readInt32BE=function(e,r){return e=e>>>0,r||q(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};b.prototype.readBigInt64LE=Oe(function(e){e=e>>>0,pt(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Gt(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)});b.prototype.readBigInt64BE=Oe(function(e){e=e>>>0,pt(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Gt(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)});b.prototype.readFloatLE=function(e,r){return e=e>>>0,r||q(e,4,this.length),_t.read(this,e,!0,23,4)};b.prototype.readFloatBE=function(e,r){return e=e>>>0,r||q(e,4,this.length),_t.read(this,e,!1,23,4)};b.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||q(e,8,this.length),_t.read(this,e,!0,52,8)};b.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||q(e,8,this.length),_t.read(this,e,!1,52,8)};function Z(t,e,r,i,n,s){if(!b.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")}b.prototype.writeUintLE=b.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;Z(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};b.prototype.writeUintBE=b.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;Z(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};b.prototype.writeUint8=b.prototype.writeUInt8=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,1,255,0),this[r]=e&255,r+1};b.prototype.writeUint16LE=b.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};b.prototype.writeUint16BE=b.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};b.prototype.writeUint32LE=b.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||Z(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};b.prototype.writeUint32BE=b.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||Z(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 _s(t,e,r,i,n){ms(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 ps(t,e,r,i,n){ms(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}b.prototype.writeBigUInt64LE=Oe(function(e,r=0){return _s(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});b.prototype.writeBigUInt64BE=Oe(function(e,r=0){return ps(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});b.prototype.writeIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);Z(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};b.prototype.writeIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);Z(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};b.prototype.writeInt8=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};b.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};b.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};b.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||Z(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};b.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||Z(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};b.prototype.writeBigInt64LE=Oe(function(e,r=0){return _s(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});b.prototype.writeBigInt64BE=Oe(function(e,r=0){return ps(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function bs(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 ys(t,e,r,i,n){return e=+e,r=r>>>0,n||bs(t,e,r,4,34028234663852886e22,-34028234663852886e22),_t.write(t,e,r,i,23,4),r+4}b.prototype.writeFloatLE=function(e,r,i){return ys(this,e,r,!0,i)};b.prototype.writeFloatBE=function(e,r,i){return ys(this,e,r,!1,i)};function gs(t,e,r,i,n){return e=+e,r=r>>>0,n||bs(t,e,r,8,17976931348623157e292,-17976931348623157e292),_t.write(t,e,r,i,52,8),r+8}b.prototype.writeDoubleLE=function(e,r,i){return gs(this,e,r,!0,i)};b.prototype.writeDoubleBE=function(e,r,i){return gs(this,e,r,!1,i)};b.prototype.copy=function(e,r,i,n){if(!b.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};b.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"&&!b.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=b.isBuffer(e)?e:b.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 ht={};function pi(t,e,r){ht[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}`}}}pi("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);pi("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);pi("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=ls(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=ls(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function ls(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 Ju(t,e,r){pt(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Gt(e,t.length-(r+1))}function ms(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 ht.ERR_OUT_OF_RANGE("value",a,t)}Ju(i,n,s)}function pt(t,e){if(typeof t!="number")throw new ht.ERR_INVALID_ARG_TYPE(e,"number",t)}function Gt(t,e,r){throw Math.floor(t)!==t?(pt(t,r),new ht.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new ht.ERR_BUFFER_OUT_OF_BOUNDS:new ht.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Xu=/[^+/0-9A-Za-z-_]/g;function ef(t){if(t=t.split("=")[0],t=t.trim().replace(Xu,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function di(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 tf(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function rf(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 ws(t){return ui.toByteArray(ef(t))}function pr(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 fe(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function bi(t){return t!==t}var nf=(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 Oe(t){return typeof BigInt=="undefined"?sf:t}function sf(){throw new Error("BigInt not supported")}});var j=A((lb,xs)=>{"use strict";var yi=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}};xs.exports={AggregateError:yi,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 gi=A((ub,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 Q=A((fb,Rs)=>{"use strict";var{format:of,inspect:br}=gi(),{AggregateError:af}=j(),lf=globalThis.AggregateError||af,uf=Symbol("kIsNodeError"),ff=["string","function","number","object","Function","Object","boolean","bigint","symbol"],cf=/^([A-Z][a-z0-9]*)+$/,df="__node_internal_",yr={};function Ke(t,e){if(!t)throw new yr.ERR_INTERNAL_ASSERTION(e)}function Ss(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 hf(t,e,r){if(typeof e=="function")return Ke(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 Ke(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:of(e,...r)}function G(t,e,r){r||(r=Error);class i extends r{constructor(...s){super(hf(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[uf]=!0,yr[t]=i}function Is(t){let e=df+t.name;return Object.defineProperty(t,"name",{value:e}),t}function _f(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new lf([e,t],e.message);return r.code=e.code,r}return t||e}var mi=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new yr.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};G("ERR_ASSERTION","%s",Error);G("ERR_INVALID_ARG_TYPE",(t,e,r)=>{Ke(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)Ke(typeof l=="string","All expected entries have to be of type string"),ff.includes(l)?n.push(l.toLowerCase()):cf.test(l)?s.push(l):(Ke(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=br(r,{depth:-1});i+=`. Received ${l}`}}else{let l=br(r,{colors:!1});l.length>25&&(l=`${l.slice(0,25)}...`),i+=`. Received type ${typeof r} (${l})`}return i},TypeError);G("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let i=br(e);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${i}`},TypeError);G("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);G("ERR_MISSING_ARGS",(...t)=>{Ke(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);G("ERR_OUT_OF_RANGE",(t,e,r)=>{Ke(e,'Missing "range" argument');let i;if(Number.isInteger(r)&&Math.abs(r)>2**32)i=Ss(String(r));else if(typeof r=="bigint"){i=String(r);let n=BigInt(2)**BigInt(32);(r>n||r<-n)&&(i=Ss(i)),i+="n"}else i=br(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${i}`},RangeError);G("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);G("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);G("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);G("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);G("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);G("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);G("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);G("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);G("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);G("ERR_STREAM_WRITE_AFTER_END","write after end",Error);G("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Rs.exports={AbortError:mi,aggregateTwoErrors:Is(_f),hideStackFrames:Is,codes:yr}});var yt=A((cb,gr)=>{"use strict";var{AbortController:Ts,AbortSignal:pf}=typeof self!="undefined"?self:typeof window!="undefined"?window:void 0;gr.exports=Ts;gr.exports.AbortSignal=pf;gr.exports.default=Ts});var Qt=A((db,wi)=>{"use strict";var gt=typeof Reflect=="object"?Reflect:null,As=gt&&typeof gt.apply=="function"?gt.apply:function(e,r,i){return Function.prototype.apply.call(e,r,i)},mr;gt&&typeof gt.ownKeys=="function"?mr=gt.ownKeys:Object.getOwnPropertySymbols?mr=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:mr=function(e){return Object.getOwnPropertyNames(e)};function bf(t){console&&console.warn&&console.warn(t)}var Ns=Number.isNaN||function(e){return e!==e};function v(){v.init.call(this)}wi.exports=v;wi.exports.once=wf;v.EventEmitter=v;v.prototype._events=void 0;v.prototype._eventsCount=0;v.prototype._maxListeners=void 0;var vs=10;function wr(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(v,"defaultMaxListeners",{enumerable:!0,get:function(){return vs},set:function(t){if(typeof t!="number"||t<0||Ns(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");vs=t}});v.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};v.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ns(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 Ps(t){return t._maxListeners===void 0?v.defaultMaxListeners:t._maxListeners}v.prototype.getMaxListeners=function(){return Ps(this)};v.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")As(l,this,r);else for(var u=l.length,f=Bs(l,u),i=0;i<u;++i)As(f[i],this,r);return!0};function js(t,e,r,i){var n,s,o;if(wr(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=Ps(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,bf(a)}return t}v.prototype.addListener=function(e,r){return js(this,e,r,!1)};v.prototype.on=v.prototype.addListener;v.prototype.prependListener=function(e,r){return js(this,e,r,!0)};function yf(){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 Ls(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=yf.bind(i);return n.listener=r,i.wrapFn=n,n}v.prototype.once=function(e,r){return wr(r),this.on(e,Ls(this,e,r)),this};v.prototype.prependOnceListener=function(e,r){return wr(r),this.prependListener(e,Ls(this,e,r)),this};v.prototype.removeListener=function(e,r){var i,n,s,o,a;if(wr(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():gf(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};v.prototype.off=v.prototype.removeListener;v.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?mf(n):Bs(n,n.length)}v.prototype.listeners=function(e){return Cs(this,e,!0)};v.prototype.rawListeners=function(e){return Cs(this,e,!1)};v.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Fs.call(t,e)};v.prototype.listenerCount=Fs;function Fs(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}v.prototype.eventNames=function(){return this._eventsCount>0?mr(this._events):[]};function Bs(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function gf(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function mf(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function wf(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))}Ds(t,e,s,{once:!0}),e!=="error"&&xf(t,n,{once:!0})})}function xf(t,e,r){typeof t.on=="function"&&Ds(t,"error",e,r)}function Ds(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 H=A((hb,Ei)=>{"use strict";var Ef=Ie(),{format:Sf,inspect:If}=gi(),{codes:{ERR_INVALID_ARG_TYPE:xi}}=Q(),{kResistStopPropagation:Rf,AggregateError:Tf,SymbolDispose:Af}=j(),vf=globalThis.AbortSignal||yt().AbortSignal,Nf=globalThis.AbortController||yt().AbortController,Pf=Object.getPrototypeOf(async function(){}).constructor,Os=globalThis.Blob||Ef.Blob,jf=typeof Os!="undefined"?function(e){return e instanceof Os}:function(e){return!1},Ms=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new xi(e,"AbortSignal",t)},Lf=(t,e)=>{if(typeof t!="function")throw new xi(e,"Function",t)};Ei.exports={AggregateError:Tf,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:Sf,inspect:If,types:{isAsyncFunction(t){return t instanceof Pf},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:jf,deprecate(t,e){return t},addAbortListener:Qt().addAbortListener||function(e,r){if(e===void 0)throw new xi("signal","AbortSignal",e);Ms(e,"signal"),Lf(r,"listener");let i;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Rf]:!0}),i=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[Af](){var n;(n=i)===null||n===void 0||n()}}},AbortSignalAny:vf.any||function(e){if(e.length===1)return e[0];let r=new Nf,i=()=>r.abort();return e.forEach(n=>{Ms(n,"signals"),n.addEventListener("abort",i,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",i))},{once:!0}),r.signal}};Ei.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var wt=A((_b,Hs)=>{"use strict";var{ArrayIsArray:Ii,ArrayPrototypeIncludes:qs,ArrayPrototypeJoin:Ws,ArrayPrototypeMap:Cf,NumberIsInteger:Ri,NumberIsNaN:Ff,NumberMAX_SAFE_INTEGER:Bf,NumberMIN_SAFE_INTEGER:Df,NumberParseInt:Of,ObjectPrototypeHasOwnProperty:Mf,RegExpPrototypeExec:Gs,String:$f,StringPrototypeToUpperCase:kf,StringPrototypeTrim:Uf}=j(),{hideStackFrames:re,codes:{ERR_SOCKET_BAD_PORT:qf,ERR_INVALID_ARG_TYPE:z,ERR_INVALID_ARG_VALUE:mt,ERR_OUT_OF_RANGE:Ye,ERR_UNKNOWN_SIGNAL:$s}}=Q(),{normalizeEncoding:Wf}=H(),{isAsyncFunction:Gf,isArrayBufferView:Qf}=H().types,ks={};function zf(t){return t===(t|0)}function Vf(t){return t===t>>>0}var Hf=/^[0-7]+$/,Kf="must be a 32-bit unsigned integer or an octal string";function Yf(t,e,r){if(typeof t=="undefined"&&(t=r),typeof t=="string"){if(Gs(Hf,t)===null)throw new mt(e,t,Kf);t=Of(t,8)}return Qs(t,e),t}var Zf=re((t,e,r=Df,i=Bf)=>{if(typeof t!="number")throw new z(e,"number",t);if(!Ri(t))throw new Ye(e,"an integer",t);if(t<r||t>i)throw new Ye(e,`>= ${r} && <= ${i}`,t)}),Jf=re((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!="number")throw new z(e,"number",t);if(!Ri(t))throw new Ye(e,"an integer",t);if(t<r||t>i)throw new Ye(e,`>= ${r} && <= ${i}`,t)}),Qs=re((t,e,r=!1)=>{if(typeof t!="number")throw new z(e,"number",t);if(!Ri(t))throw new Ye(e,"an integer",t);let i=r?1:0,n=4294967295;if(t<i||t>n)throw new Ye(e,`>= ${i} && <= ${n}`,t)});function Ti(t,e){if(typeof t!="string")throw new z(e,"string",t)}function Xf(t,e,r=void 0,i){if(typeof t!="number")throw new z(e,"number",t);if(r!=null&&t<r||i!=null&&t>i||(r!=null||i!=null)&&Ff(t))throw new Ye(e,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,t)}var ec=re((t,e,r)=>{if(!qs(r,t)){let n="must be one of: "+Ws(Cf(r,s=>typeof s=="string"?`'${s}'`:$f(s)),", ");throw new mt(e,t,n)}});function zs(t,e){if(typeof t!="boolean")throw new z(e,"boolean",t)}function Si(t,e,r){return t==null||!Mf(t,e)?r:t[e]}var tc=re((t,e,r=null)=>{let i=Si(r,"allowArray",!1),n=Si(r,"allowFunction",!1);if(!Si(r,"nullable",!1)&&t===null||!i&&Ii(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new z(e,"Object",t)}),rc=re((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new z(e,"a dictionary",t)}),xr=re((t,e,r=0)=>{if(!Ii(t))throw new z(e,"Array",t);if(t.length<r){let i=`must be longer than ${r}`;throw new mt(e,t,i)}});function ic(t,e){xr(t,e);for(let r=0;r<t.length;r++)Ti(t[r],`${e}[${r}]`)}function nc(t,e){xr(t,e);for(let r=0;r<t.length;r++)zs(t[r],`${e}[${r}]`)}function sc(t,e){xr(t,e);for(let r=0;r<t.length;r++){let i=t[r],n=`${e}[${r}]`;if(i==null)throw new z(n,"AbortSignal",i);Vs(i,n)}}function oc(t,e="signal"){if(Ti(t,e),ks[t]===void 0)throw ks[kf(t)]!==void 0?new $s(t+" (signals must use all capital letters)"):new $s(t)}var ac=re((t,e="buffer")=>{if(!Qf(t))throw new z(e,["Buffer","TypedArray","DataView"],t)});function lc(t,e){let r=Wf(e),i=t.length;if(r==="hex"&&i%2!==0)throw new mt("encoding",e,`is invalid for data of length ${i}`)}function uc(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&Uf(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new qf(e,t,r);return t|0}var Vs=re((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new z(e,"AbortSignal",t)}),fc=re((t,e)=>{if(typeof t!="function")throw new z(e,"Function",t)}),cc=re((t,e)=>{if(typeof t!="function"||Gf(t))throw new z(e,"Function",t)}),dc=re((t,e)=>{if(t!==void 0)throw new z(e,"undefined",t)});function hc(t,e,r){if(!qs(r,t))throw new z(e,`('${Ws(r,"|")}')`,t)}var _c=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Us(t,e){if(typeof t=="undefined"||!Gs(_c,t))throw new mt(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function pc(t){if(typeof t=="string")return Us(t,"hints"),t;if(Ii(t)){let e=t.length,r="";if(e===0)return r;for(let i=0;i<e;i++){let n=t[i];Us(n,"hints"),r+=n,i!==e-1&&(r+=", ")}return r}throw new mt("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Hs.exports={isInt32:zf,isUint32:Vf,parseFileMode:Yf,validateArray:xr,validateStringArray:ic,validateBooleanArray:nc,validateAbortSignalArray:sc,validateBoolean:zs,validateBuffer:ac,validateDictionary:rc,validateEncoding:lc,validateFunction:fc,validateInt32:Jf,validateInteger:Zf,validateNumber:Xf,validateObject:tc,validateOneOf:ec,validatePlainFunction:cc,validatePort:uc,validateSignalName:oc,validateString:Ti,validateUint32:Qs,validateUndefined:dc,validateUnion:hc,validateAbortSignal:Vs,validateLinkHeaderValue:pc}});var Me=A((pb,Js)=>{var F=Js.exports={},ce,de;function Ai(){throw new Error("setTimeout has not been defined")}function vi(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ce=setTimeout:ce=Ai}catch(t){ce=Ai}try{typeof clearTimeout=="function"?de=clearTimeout:de=vi}catch(t){de=vi}})();function Ks(t){if(ce===setTimeout)return setTimeout(t,0);if((ce===Ai||!ce)&&setTimeout)return ce=setTimeout,setTimeout(t,0);try{return ce(t,0)}catch(e){try{return ce.call(null,t,0)}catch(r){return ce.call(this,t,0)}}}function bc(t){if(de===clearTimeout)return clearTimeout(t);if((de===vi||!de)&&clearTimeout)return de=clearTimeout,clearTimeout(t);try{return de(t)}catch(e){try{return de.call(null,t)}catch(r){return de.call(this,t)}}}var Re=[],xt=!1,Ze,Er=-1;function yc(){!xt||!Ze||(xt=!1,Ze.length?Re=Ze.concat(Re):Er=-1,Re.length&&Ys())}function Ys(){if(!xt){var t=Ks(yc);xt=!0;for(var e=Re.length;e;){for(Ze=Re,Re=[];++Er<e;)Ze&&Ze[Er].run();Er=-1,e=Re.length}Ze=null,xt=!1,bc(t)}}F.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];Re.push(new Zs(t,e)),Re.length===1&&!xt&&Ks(Ys)};function Zs(t,e){this.fun=t,this.array=e}Zs.prototype.run=function(){this.fun.apply(null,this.array)};F.title="browser";F.browser=!0;F.env={};F.argv=[];F.version="";F.versions={};function Te(){}F.on=Te;F.addListener=Te;F.once=Te;F.off=Te;F.removeListener=Te;F.removeAllListeners=Te;F.emit=Te;F.prependListener=Te;F.prependOnceListener=Te;F.listeners=function(t){return[]};F.binding=function(t){throw new Error("process.binding is not supported")};F.cwd=function(){return"/"};F.chdir=function(t){throw new Error("process.chdir is not supported")};F.umask=function(){return 0}});var _e=A((bb,_o)=>{"use strict";var{SymbolAsyncIterator:Xs,SymbolIterator:eo,SymbolFor:Je}=j(),to=Je("nodejs.stream.destroyed"),ro=Je("nodejs.stream.errored"),Ni=Je("nodejs.stream.readable"),Pi=Je("nodejs.stream.writable"),io=Je("nodejs.stream.disturbed"),gc=Je("nodejs.webstream.isClosedPromise"),mc=Je("nodejs.webstream.controllerErrorFunction");function Sr(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 Ir(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 wc(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function he(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function no(t){return!!(t&&!he(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function so(t){return!!(t&&!he(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function oo(t){return!!(t&&!he(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function xc(t){return no(t)||so(t)||oo(t)}function Ec(t,e){return t==null?!1:e===!0?typeof t[Xs]=="function":e===!1?typeof t[eo]=="function":typeof t[Xs]=="function"||typeof t[eo]=="function"}function Rr(t){if(!he(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[to]||i!=null&&i.destroyed)}function ao(t){if(!Ir(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof(e==null?void 0:e.ended)!="boolean"?null:e.ended}function Sc(t,e){if(!Ir(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof(r==null?void 0:r.finished)!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function Ic(t){if(!Sr(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof(e==null?void 0:e.ended)!="boolean"?null:e.ended}function lo(t,e){if(!Sr(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof(r==null?void 0:r.endEmitted)!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function uo(t){return t&&t[Ni]!=null?t[Ni]:typeof(t==null?void 0:t.readable)!="boolean"?null:Rr(t)?!1:Sr(t)&&t.readable&&!lo(t)}function fo(t){return t&&t[Pi]!=null?t[Pi]:typeof(t==null?void 0:t.writable)!="boolean"?null:Rr(t)?!1:Ir(t)&&t.writable&&!ao(t)}function Rc(t,e){return he(t)?Rr(t)?!0:!((e==null?void 0:e.readable)!==!1&&uo(t)||(e==null?void 0:e.writable)!==!1&&fo(t)):null}function Tc(t){var e,r;return he(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 Ac(t){var e,r;return he(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 vc(t){if(!he(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof(e==null?void 0:e.closed)=="boolean"||typeof(r==null?void 0:r.closed)=="boolean"?(e==null?void 0:e.closed)||(r==null?void 0:r.closed):typeof t._closed=="boolean"&&co(t)?t._closed:null}function co(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function ho(t){return typeof t._sent100=="boolean"&&co(t)}function Nc(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 Pc(t){if(!he(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&ho(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}function jc(t){var e;return!!(t&&((e=t[io])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function Lc(t){var e,r,i,n,s,o,a,l,u,f;return!!(t&&((e=(r=(i=(n=(s=(o=t[ro])!==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))}_o.exports={isDestroyed:Rr,kIsDestroyed:to,isDisturbed:jc,kIsDisturbed:io,isErrored:Lc,kIsErrored:ro,isReadable:uo,kIsReadable:Ni,kIsClosedPromise:gc,kControllerErrorFunction:mc,kIsWritable:Pi,isClosed:vc,isDuplexNodeStream:wc,isFinished:Rc,isIterable:Ec,isReadableNodeStream:Sr,isReadableStream:no,isReadableEnded:Ic,isReadableFinished:lo,isReadableErrored:Ac,isNodeStream:he,isWebStream:xc,isWritable:fo,isWritableNodeStream:Ir,isWritableStream:so,isWritableEnded:ao,isWritableFinished:Sc,isWritableErrored:Tc,isServerRequest:Nc,isServerResponse:ho,willEmitClose:Pc,isTransformStream:oo}});var Ae=A((yb,Bi)=>{"use strict";var $e=Me(),{AbortError:So,codes:Cc}=Q(),{ERR_INVALID_ARG_TYPE:Fc,ERR_STREAM_PREMATURE_CLOSE:po}=Cc,{kEmptyObject:Li,once:Ci}=H(),{validateAbortSignal:Bc,validateFunction:Dc,validateObject:Oc,validateBoolean:Mc}=wt(),{Promise:$c,PromisePrototypeThen:kc,SymbolDispose:Io}=j(),{isClosed:Uc,isReadable:bo,isReadableNodeStream:ji,isReadableStream:qc,isReadableFinished:yo,isReadableErrored:go,isWritable:mo,isWritableNodeStream:wo,isWritableStream:Wc,isWritableFinished:xo,isWritableErrored:Eo,isNodeStream:Gc,willEmitClose:Qc,kIsClosedPromise:zc}=_e(),Et;function Vc(t){return t.setHeader&&typeof t.abort=="function"}var Fi=()=>{};function Ro(t,e,r){var i,n;if(arguments.length===2?(r=e,e=Li):e==null?e=Li:Oc(e,"options"),Dc(r,"callback"),Bc(e.signal,"options.signal"),r=Ci(r),qc(t)||Wc(t))return Hc(t,e,r);if(!Gc(t))throw new Fc("stream",["ReadableStream","WritableStream","Stream"],t);let s=(i=e.readable)!==null&&i!==void 0?i:ji(t),o=(n=e.writable)!==null&&n!==void 0?n:wo(t),a=t._writableState,l=t._readableState,u=()=>{t.writable||d()},f=Qc(t)&&ji(t)===s&&wo(t)===o,c=xo(t,!1),d=()=>{c=!0,t.destroyed&&(f=!1),!(f&&(!t.readable||s))&&(!s||_)&&r.call(t)},_=yo(t,!1),p=()=>{_=!0,t.destroyed&&(f=!1),!(f&&(!t.writable||o))&&(!o||c)&&r.call(t)},h=w=>{r.call(t,w)},y=Uc(t),g=()=>{y=!0;let w=Eo(t)||go(t);if(w&&typeof w!="boolean")return r.call(t,w);if(s&&!_&&ji(t,!0)&&!yo(t,!1))return r.call(t,new po);if(o&&!c&&!xo(t,!1))return r.call(t,new po);r.call(t)},S=()=>{y=!0;let w=Eo(t)||go(t);if(w&&typeof w!="boolean")return r.call(t,w);r.call(t)},x=()=>{t.req.on("finish",d)};Vc(t)?(t.on("complete",d),f||t.on("abort",g),t.req?x():t.on("request",x)):o&&!a&&(t.on("end",u),t.on("close",u)),!f&&typeof t.aborted=="boolean"&&t.on("aborted",g),t.on("end",p),t.on("finish",d),e.error!==!1&&t.on("error",h),t.on("close",g),y?$e.nextTick(g):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?f||$e.nextTick(S):(!s&&(!f||bo(t))&&(c||mo(t)===!1)||!o&&(!f||mo(t))&&(_||bo(t)===!1)||l&&t.req&&t.aborted)&&$e.nextTick(S);let m=()=>{r=Fi,t.removeListener("aborted",g),t.removeListener("complete",d),t.removeListener("abort",g),t.removeListener("request",x),t.req&&t.req.removeListener("finish",d),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",d),t.removeListener("end",p),t.removeListener("error",h),t.removeListener("close",g)};if(e.signal&&!y){let w=()=>{let R=r;m(),R.call(t,new So(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)$e.nextTick(w);else{Et=Et||H().addAbortListener;let R=Et(e.signal,w),T=r;r=Ci((...U)=>{R[Io](),T.apply(t,U)})}}return m}function Hc(t,e,r){let i=!1,n=Fi;if(e.signal)if(n=()=>{i=!0,r.call(t,new So(void 0,{cause:e.signal.reason}))},e.signal.aborted)$e.nextTick(n);else{Et=Et||H().addAbortListener;let o=Et(e.signal,n),a=r;r=Ci((...l)=>{o[Io](),a.apply(t,l)})}let s=(...o)=>{i||$e.nextTick(()=>r.apply(t,o))};return kc(t[zc].promise,s,s),Fi}function Kc(t,e){var r;let i=!1;return e===null&&(e=Li),(r=e)!==null&&r!==void 0&&r.cleanup&&(Mc(e.cleanup,"cleanup"),i=e.cleanup),new $c((n,s)=>{let o=Ro(t,e,a=>{i&&o(),a?s(a):n()})})}Bi.exports=Ro;Bi.exports.finished=Kc});var Xe=A((gb,Co)=>{"use strict";var pe=Me(),{aggregateTwoErrors:Yc,codes:{ERR_MULTIPLE_CALLBACK:Zc},AbortError:Jc}=Q(),{Symbol:vo}=j(),{kIsDestroyed:Xc,isDestroyed:ed,isFinished:td,isServerRequest:rd}=_e(),No=vo("kDestroy"),Di=vo("kConstruct");function Po(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function id(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):(Po(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?To(this,t,e):this.once(No,function(s){To(this,Yc(s,t),e)}),this)}function To(t,e,r){let i=!1;function n(s){if(i)return;i=!0;let o=t._readableState,a=t._writableState;Po(s,a,o),a&&(a.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?pe.nextTick(nd,t,s):pe.nextTick(jo,t)}try{t._destroy(e||null,n)}catch(s){n(s)}}function nd(t,e){Oi(t,e),jo(t)}function jo(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 Oi(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 sd(){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 Mi(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?pe.nextTick(Oi,t,e):Oi(t,e))}function od(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(Di,e),!(t.listenerCount(Di)>1)&&pe.nextTick(ad,t)}function ad(t){let e=!1;function r(i){if(e){Mi(t,i!=null?i:new Zc);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(No,i):i?Mi(t,i,!0):pe.nextTick(ld,t)}try{t._construct(i=>{pe.nextTick(r,i)})}catch(i){pe.nextTick(r,i)}}function ld(t){t.emit(Di)}function Ao(t){return(t==null?void 0:t.setHeader)&&typeof t.abort=="function"}function Lo(t){t.emit("close")}function ud(t,e){t.emit("error",e),pe.nextTick(Lo,t)}function fd(t,e){!t||ed(t)||(!e&&!td(t)&&(e=new Jc),rd(t)?(t.socket=null,t.destroy(e)):Ao(t)?t.abort():Ao(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?pe.nextTick(ud,t,e):pe.nextTick(Lo,t),t.destroyed||(t[Xc]=!0))}Co.exports={construct:od,destroyer:fd,destroy:id,undestroy:sd,errorOrDestroy:Mi}});var vr=A((mb,Bo)=>{"use strict";var{ArrayIsArray:cd,ObjectSetPrototypeOf:Fo}=j(),{EventEmitter:Tr}=Qt();function Ar(t){Tr.call(this,t)}Fo(Ar.prototype,Tr.prototype);Fo(Ar,Tr);Ar.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(),Tr.listenerCount(this,"error")===0&&this.emit("error",f)}$i(r,"error",l),$i(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 $i(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):cd(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}Bo.exports={Stream:Ar,prependListener:$i}});var zt=A((wb,Nr)=>{"use strict";var{SymbolDispose:dd}=j(),{AbortError:Do,codes:hd}=Q(),{isNodeStream:Oo,isWebStream:_d,kControllerErrorFunction:pd}=_e(),bd=Ae(),{ERR_INVALID_ARG_TYPE:Mo}=hd,ki,yd=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new Mo(e,"AbortSignal",t)};Nr.exports.addAbortSignal=function(e,r){if(yd(e,"signal"),!Oo(r)&&!_d(r))throw new Mo("stream",["ReadableStream","WritableStream","Stream"],r);return Nr.exports.addAbortSignalNoValidate(e,r)};Nr.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=Oo(e)?()=>{e.destroy(new Do(void 0,{cause:t.reason}))}:()=>{e[pd](new Do(void 0,{cause:t.reason}))};if(t.aborted)r();else{ki=ki||H().addAbortListener;let i=ki(t,r);bd(e,i[dd])}return e}});var Uo=A((Eb,ko)=>{"use strict";var{StringPrototypeSlice:$o,SymbolIterator:gd,TypedArrayPrototypeSet:Pr,Uint8Array:md}=j(),{Buffer:Ui}=Ie(),{inspect:wd}=H();ko.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 Ui.alloc(0);let r=Ui.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}*[gd](){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+=$o(s,0,e),this.head=i,i.data=$o(s,e));break}++n}while((i=i.next)!==null);return this.length-=n,r}_getBuffer(e){let r=Ui.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 md(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 wd(this,Ce(M({},r),{depth:0,customInspect:!1}))}}});var Vt=A((Ib,Qo)=>{"use strict";var{MathFloor:xd,NumberIsInteger:Ed}=j(),{validateInteger:Sd}=wt(),{ERR_INVALID_ARG_VALUE:Id}=Q().codes,qo=16*1024,Wo=16;function Rd(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Go(t){return t?Wo:qo}function Td(t,e){Sd(e,"value",0),t?Wo=e:qo=e}function Ad(t,e,r,i){let n=Rd(e,i,r);if(n!=null){if(!Ed(n)||n<0){let s=i?`options.${r}`:"options.highWaterMark";throw new Id(s,n)}return xd(n)}return Go(t.objectMode)}Qo.exports={getHighWaterMark:Ad,getDefaultHighWaterMark:Go,setDefaultHighWaterMark:Td}});var Ho=A((qi,Vo)=>{var jr=Ie(),be=jr.Buffer;function zo(t,e){for(var r in t)e[r]=t[r]}be.from&&be.alloc&&be.allocUnsafe&&be.allocUnsafeSlow?Vo.exports=jr:(zo(jr,qi),qi.Buffer=et);function et(t,e,r){return be(t,e,r)}et.prototype=Object.create(be.prototype);zo(be,et);et.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return be(t,e,r)};et.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=be(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};et.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return be(t)};et.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return jr.SlowBuffer(t)}});var Zo=A(Yo=>{"use strict";var Gi=Ho().Buffer,Ko=Gi.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 vd(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 Nd(t){var e=vd(t);if(typeof e!="string"&&(Gi.isEncoding===Ko||!Ko(t)))throw new Error("Unknown encoding: "+t);return e||t}Yo.StringDecoder=Ht;function Ht(t){this.encoding=Nd(t);var e;switch(this.encoding){case"utf16le":this.text=Bd,this.end=Dd,e=4;break;case"utf8":this.fillLast=Ld,e=4;break;case"base64":this.text=Od,this.end=Md,e=3;break;default:this.write=$d,this.end=kd;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Gi.allocUnsafe(e)}Ht.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||""};Ht.prototype.end=Fd;Ht.prototype.text=Cd;Ht.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 Wi(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Pd(t,e,r){var i=e.length-1;if(i<r)return 0;var n=Wi(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=Wi(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=Wi(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}function jd(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 Ld(t){var e=this.lastTotal-this.lastNeed,r=jd(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 Cd(t,e){var r=Pd(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 Fd(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Bd(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 Dd(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 Od(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 Md(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function $d(t){return t.toString(this.encoding)}function kd(t){return t&&t.length?this.write(t):""}});var Qi=A((Tb,ta)=>{"use strict";var Jo=Me(),{PromisePrototypeThen:Ud,SymbolAsyncIterator:Xo,SymbolIterator:ea}=j(),{Buffer:qd}=Ie(),{ERR_INVALID_ARG_TYPE:Wd,ERR_STREAM_NULL_VALUES:Gd}=Q().codes;function Qd(t,e,r){let i;if(typeof e=="string"||e instanceof qd)return new t(Ce(M({objectMode:!0},r),{read(){this.push(e),this.push(null)}}));let n;if(e&&e[Xo])n=!0,i=e[Xo]();else if(e&&e[ea])n=!1,i=e[ea]();else throw new Wd("iterable",["Iterable"],e);let s=new t(M({objectMode:!0,highWaterMark:1},r)),o=!1;s._read=function(){o||(o=!0,l())},s._destroy=function(u,f){Ud(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:d,done:_}=await i.throw(u);if(await d,_)return}if(typeof i.return=="function"){let{value:d}=await i.return();await d}}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 Gd;if(s.push(c))continue;o=!1}}catch(u){s.destroy(u)}break}}return s}ta.exports=Qd});var Yt=A((vb,ma)=>{"use strict";var oe=Me(),{ArrayPrototypeIndexOf:zd,NumberIsInteger:Vd,NumberIsNaN:Hd,NumberParseInt:Kd,ObjectDefineProperties:Xi,ObjectKeys:Yd,ObjectSetPrototypeOf:na,Promise:sa,SafeSet:Zd,SymbolAsyncDispose:Jd,SymbolAsyncIterator:Xd,Symbol:eh}=j();ma.exports=E;E.ReadableState=Br;var{EventEmitter:th}=Qt(),{Stream:ke,prependListener:rh}=vr(),{Buffer:zi}=Ie(),{addAbortSignal:ih}=zt(),oa=Ae(),I=H().debuglog("stream",t=>{I=t}),nh=Uo(),Rt=Xe(),{getHighWaterMark:sh,getDefaultHighWaterMark:oh}=Vt(),{aggregateTwoErrors:ra,codes:{ERR_INVALID_ARG_TYPE:ah,ERR_METHOD_NOT_IMPLEMENTED:lh,ERR_OUT_OF_RANGE:uh,ERR_STREAM_PUSH_AFTER_EOF:fh,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:ch},AbortError:dh}=Q(),{validateObject:hh}=wt(),tt=eh("kPaused"),{StringDecoder:aa}=Zo(),_h=Qi();na(E.prototype,ke.prototype);na(E,ke);var Vi=()=>{},{errorOrDestroy:St}=Rt,It=1,ph=2,la=4,Kt=8,ua=16,Lr=32,Cr=64,fa=128,bh=256,yh=512,gh=1024,Zi=2048,Ji=4096,mh=8192,wh=16384,xh=32768,ca=65536,Eh=1<<17,Sh=1<<18;function $(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}Xi(Br.prototype,{objectMode:$(It),ended:$(ph),endEmitted:$(la),reading:$(Kt),constructed:$(ua),sync:$(Lr),needReadable:$(Cr),emittedReadable:$(fa),readableListening:$(bh),resumeScheduled:$(yh),errorEmitted:$(gh),emitClose:$(Zi),autoDestroy:$(Ji),destroyed:$(mh),closed:$(wh),closeEmitted:$(xh),multiAwaitDrain:$(ca),readingMore:$(Eh),dataEmitted:$(Sh)});function Br(t,e,r){typeof r!="boolean"&&(r=e instanceof ye()),this.state=Zi|Ji|ua|Lr,t&&t.objectMode&&(this.state|=It),r&&t&&t.readableObjectMode&&(this.state|=It),this.highWaterMark=t?sh(this,t,"readableHighWaterMark",r):oh(!1),this.buffer=new nh,this.length=0,this.pipes=[],this.flowing=null,this[tt]=null,t&&t.emitClose===!1&&(this.state&=~Zi),t&&t.autoDestroy===!1&&(this.state&=~Ji),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new aa(t.encoding),this.encoding=t.encoding)}function E(t){if(!(this instanceof E))return new E(t);let e=this instanceof ye();this._readableState=new Br(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&&ih(t.signal,this)),ke.call(this,t),Rt.construct(this,()=>{this._readableState.needReadable&&Fr(this,this._readableState)})}E.prototype.destroy=Rt.destroy;E.prototype._undestroy=Rt.undestroy;E.prototype._destroy=function(t,e){e(t)};E.prototype[th.captureRejectionSymbol]=function(t){this.destroy(t)};E.prototype[Jd]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new dh,this.destroy(t)),new sa((e,r)=>oa(this,i=>i&&i!==t?r(i):e(null)))};E.prototype.push=function(t,e){return da(this,t,e,!1)};E.prototype.unshift=function(t,e){return da(this,t,e,!0)};function da(t,e,r,i){I("readableAddChunk",e);let n=t._readableState,s;if((n.state&It)===0&&(typeof e=="string"?(r=r||n.defaultEncoding,n.encoding!==r&&(i&&n.encoding?e=zi.from(e,r).toString(n.encoding):(e=zi.from(e,r),r=""))):e instanceof zi?r="":ke._isUint8Array(e)?(e=ke._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new ah("chunk",["string","Buffer","Uint8Array"],e))),s)St(t,s);else if(e===null)n.state&=~Kt,Th(t,n);else if((n.state&It)!==0||e&&e.length>0)if(i)if((n.state&la)!==0)St(t,new ch);else{if(n.destroyed||n.errored)return!1;Hi(t,n,e,!0)}else if(n.ended)St(t,new fh);else{if(n.destroyed||n.errored)return!1;n.state&=~Kt,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?Hi(t,n,e,!1):Fr(t,n)):Hi(t,n,e,!1)}else i||(n.state&=~Kt,Fr(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}function Hi(t,e,r,i){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&ca)!==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&Cr)!==0&&Dr(t)),Fr(t,e)}E.prototype.isPaused=function(){let t=this._readableState;return t[tt]===!0||t.flowing===!1};E.prototype.setEncoding=function(t){let e=new aa(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 Ih=1073741824;function Rh(t){if(t>Ih)throw new uh("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function ia(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&It)!==0?1:Hd(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}E.prototype.read=function(t){I("read",t),t===void 0?t=NaN:Vd(t)||(t=Kd(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=Rh(t)),t!==0&&(e.state&=~fa),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return I("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Ki(this):Dr(this),null;if(t=ia(t,e),t===0&&e.ended)return e.length===0&&Ki(this),null;let i=(e.state&Cr)!==0;if(I("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,I("length less than watermark",i)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)i=!1,I("reading, ended or constructing",i);else if(i){I("do read"),e.state|=Kt|Lr,e.length===0&&(e.state|=Cr);try{this._read(e.highWaterMark)}catch(s){St(this,s)}e.state&=~Lr,e.reading||(t=ia(r,e))}let n;return t>0?n=ya(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&&Ki(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function Th(t,e){if(I("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?Dr(t):(e.needReadable=!1,e.emittedReadable=!0,ha(t))}}function Dr(t){let e=t._readableState;I("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(I("emitReadable",e.flowing),e.emittedReadable=!0,oe.nextTick(ha,t))}function ha(t){let e=t._readableState;I("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,pa(t)}function Fr(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,oe.nextTick(Ah,t,e))}function Ah(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(I("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}E.prototype._read=function(t){throw new lh("_read()")};E.prototype.pipe=function(t,e){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new Zd(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(t),I("pipe count=%d opts=%j",i.pipes.length,e);let s=(!e||e.end!==!1)&&t!==oe.stdout&&t!==oe.stderr?a:y;i.endEmitted?oe.nextTick(s):r.once("end",s),t.on("unpipe",o);function o(g,S){I("onunpipe"),g===r&&S&&S.hasUnpiped===!1&&(S.hasUnpiped=!0,f())}function a(){I("onend"),t.end()}let l,u=!1;function f(){I("cleanup"),t.removeListener("close",p),t.removeListener("finish",h),l&&t.removeListener("drain",l),t.removeListener("error",_),t.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",y),r.removeListener("data",d),u=!0,l&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&l()}function c(){u||(i.pipes.length===1&&i.pipes[0]===t?(I("false write response, pause",0),i.awaitDrainWriters=t,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(t)&&(I("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),r.pause()),l||(l=vh(r,t),t.on("drain",l))}r.on("data",d);function d(g){I("ondata");let S=t.write(g);I("dest.write",S),S===!1&&c()}function _(g){if(I("onerror",g),y(),t.removeListener("error",_),t.listenerCount("error")===0){let S=t._writableState||t._readableState;S&&!S.errorEmitted?St(t,g):t.emit("error",g)}}rh(t,"error",_);function p(){t.removeListener("finish",h),y()}t.once("close",p);function h(){I("onfinish"),t.removeListener("close",p),y()}t.once("finish",h);function y(){I("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?c():i.flowing||(I("pipe resume"),r.resume()),t};function vh(t,e){return function(){let i=t._readableState;i.awaitDrainWriters===e?(I("pipeOnDrain",1),i.awaitDrainWriters=null):i.multiAwaitDrain&&(I("pipeOnDrain",i.awaitDrainWriters.size),i.awaitDrainWriters.delete(e)),(!i.awaitDrainWriters||i.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}E.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=zd(e.pipes,t);return i===-1?this:(e.pipes.splice(i,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};E.prototype.on=function(t,e){let r=ke.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,I("on readable",i.length,i.reading),i.length?Dr(this):i.reading||oe.nextTick(Nh,this)),r};E.prototype.addListener=E.prototype.on;E.prototype.removeListener=function(t,e){let r=ke.prototype.removeListener.call(this,t,e);return t==="readable"&&oe.nextTick(_a,this),r};E.prototype.off=E.prototype.removeListener;E.prototype.removeAllListeners=function(t){let e=ke.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&oe.nextTick(_a,this),e};function _a(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[tt]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function Nh(t){I("readable nexttick read 0"),t.read(0)}E.prototype.resume=function(){let t=this._readableState;return t.flowing||(I("resume"),t.flowing=!t.readableListening,Ph(this,t)),t[tt]=!1,this};function Ph(t,e){e.resumeScheduled||(e.resumeScheduled=!0,oe.nextTick(jh,t,e))}function jh(t,e){I("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),pa(t),e.flowing&&!e.reading&&t.read(0)}E.prototype.pause=function(){return I("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(I("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[tt]=!0,this};function pa(t){let e=t._readableState;for(I("flow",e.flowing);e.flowing&&t.read()!==null;);}E.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=>{St(this,i)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=Yd(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};E.prototype[Xd]=function(){return ba(this)};E.prototype.iterator=function(t){return t!==void 0&&hh(t,"options"),ba(this,t)};function ba(t,e){typeof t.read!="function"&&(t=E.wrap(t,{objectMode:!0}));let r=Lh(t,e);return r.stream=t,r}function Lh(t,e){return ee(this,null,function*(){let r=Vi;function i(o){this===t?(r(),r=Vi):r=o}t.on("readable",i);let n,s=oa(t,{writable:!1},o=>{n=o?ra(n,o):null,r(),r=Vi});try{for(;;){let o=t.destroyed?null:t.read();if(o!==null)yield o;else{if(n)throw n;if(n===null)return;yield new W(new sa(i))}}}catch(o){throw n=ra(n,o),n}finally{(n||(e==null?void 0:e.destroyOnReturn)!==!1)&&(n===void 0||t._readableState.autoDestroy)?Rt.destroyer(t,null):(t.off("readable",i),s())}})}Xi(E.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}}});Xi(Br.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[tt]!==!1},set(t){this[tt]=!!t}}});E._fromList=ya;function ya(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 Ki(t){let e=t._readableState;I("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,oe.nextTick(Ch,e,t))}function Ch(t,e){if(I("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)oe.nextTick(Fh,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function Fh(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}E.from=function(t,e){return _h(E,t,e)};var Yi;function ga(){return Yi===void 0&&(Yi={}),Yi}E.fromWeb=function(t,e){return ga().newStreamReadableFromReadableStream(t,e)};E.toWeb=function(t,e){return ga().newReadableStreamFromStreamReadable(t,e)};E.wrap=function(t,e){var r,i;return new E(Ce(M({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0},e),{destroy(n,s){Rt.destroyer(t,n),s(n)}})).wrap(t)}});var Ur=A((Pb,ja)=>{"use strict";var rt=Me(),{ArrayPrototypeSlice:Ea,Error:Bh,FunctionPrototypeSymbolHasInstance:Sa,ObjectDefineProperty:Ia,ObjectDefineProperties:Dh,ObjectSetPrototypeOf:Ra,StringPrototypeToLowerCase:Oh,Symbol:Mh,SymbolHasInstance:$h}=j();ja.exports=L;L.WritableState=Xt;var{EventEmitter:kh}=Qt(),Zt=vr().Stream,{Buffer:Or}=Ie(),kr=Xe(),{addAbortSignal:Uh}=zt(),{getHighWaterMark:qh,getDefaultHighWaterMark:Wh}=Vt(),{ERR_INVALID_ARG_TYPE:Gh,ERR_METHOD_NOT_IMPLEMENTED:Qh,ERR_MULTIPLE_CALLBACK:Ta,ERR_STREAM_CANNOT_PIPE:zh,ERR_STREAM_DESTROYED:Jt,ERR_STREAM_ALREADY_FINISHED:Vh,ERR_STREAM_NULL_VALUES:Hh,ERR_STREAM_WRITE_AFTER_END:Kh,ERR_UNKNOWN_ENCODING:Aa}=Q().codes,{errorOrDestroy:Tt}=kr;Ra(L.prototype,Zt.prototype);Ra(L,Zt);function rn(){}var At=Mh("kOnFinished");function Xt(t,e,r){typeof r!="boolean"&&(r=e instanceof ye()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?qh(this,t,"writableHighWaterMark",r):Wh(!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=Zh.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,$r(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[At]=[]}function $r(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Xt.prototype.getBuffer=function(){return Ea(this.buffered,this.bufferedIndex)};Ia(Xt.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function L(t){let e=this instanceof ye();if(!e&&!Sa(L,this))return new L(t);this._writableState=new Xt(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&&Uh(t.signal,this)),Zt.call(this,t),kr.construct(this,()=>{let r=this._writableState;r.writing||sn(this,r),on(this,r)})}Ia(L,$h,{__proto__:null,value:function(t){return Sa(this,t)?!0:this!==L?!1:t&&t._writableState instanceof Xt}});L.prototype.pipe=function(){Tt(this,new zh)};function va(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"&&!Or.isEncoding(r))throw new Aa(r);typeof i!="function"&&(i=rn)}if(e===null)throw new Hh;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=Or.from(e,r),r="buffer");else if(e instanceof Or)r="buffer";else if(Zt._isUint8Array(e))e=Zt._uint8ArrayToBuffer(e),r="buffer";else throw new Gh("chunk",["string","Buffer","Uint8Array"],e);let s;return n.ending?s=new Kh:n.destroyed&&(s=new Jt("write")),s?(rt.nextTick(i,s),Tt(t,s,!0),s):(n.pendingcb++,Yh(t,n,e,r,i))}L.prototype.write=function(t,e,r){return va(this,t,e,r)===!0};L.prototype.cork=function(){this._writableState.corked++};L.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||sn(this,t))};L.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=Oh(e)),!Or.isEncoding(e))throw new Aa(e);return this._writableState.defaultEncoding=e,this};function Yh(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!==rn&&(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 wa(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Jt("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function xa(t,e,r,i){--e.pendingcb,i(r),nn(e),Tt(t,r)}function Zh(t,e){let r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function"){Tt(t,new Ta);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?rt.nextTick(xa,t,r,e,n):xa(t,r,e,n)):(r.buffered.length>r.bufferedIndex&&sn(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},rt.nextTick(Jh,r.afterWriteTickInfo)):Na(t,r,1,n))}function Jh({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,Na(t,e,r,i)}function Na(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&&nn(e),on(t,e)}function nn(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 Jt("write"))}let r=t[At].splice(0);for(let n=0;n<r.length;n++){var i;r[n]((i=t.errored)!==null&&i!==void 0?i:new Jt("end"))}$r(t)}function sn(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?rn: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,wa(t,e,!0,e.length,l,"",a),$r(e)}else{do{let{chunk:a,encoding:l,callback:u}=r[o];r[o++]=null;let f=n?1:a.length;wa(t,e,!1,f,a,l,u)}while(o<r.length&&!e.writing);o===r.length?$r(e):o>256?(r.splice(0,o),e.bufferedIndex=0):e.bufferedIndex=o}e.bufferProcessing=!1}L.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new Qh("_write()")};L.prototype._writev=null;L.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=va(this,t,e);s instanceof Bh&&(n=s)}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,on(this,i,!0),i.ended=!0):i.finished?n=new Vh("end"):i.destroyed&&(n=new Jt("end"))),typeof r=="function"&&(n||i.finished?rt.nextTick(r,n):i[At].push(r)),this};function Mr(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 Xh(t,e){let r=!1;function i(n){if(r){Tt(t,n!=null?n:Ta());return}if(r=!0,e.pendingcb--,n){let s=e[At].splice(0);for(let o=0;o<s.length;o++)s[o](n);Tt(t,n,e.sync)}else Mr(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,rt.nextTick(tn,t,e))}e.sync=!0,e.pendingcb++;try{t._final(i)}catch(n){i(n)}e.sync=!1}function e_(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,Xh(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function on(t,e,r){Mr(e)&&(e_(t,e),e.pendingcb===0&&(r?(e.pendingcb++,rt.nextTick((i,n)=>{Mr(n)?tn(i,n):n.pendingcb--},t,e)):Mr(e)&&(e.pendingcb++,tn(t,e))))}function tn(t,e){e.pendingcb--,e.finished=!0;let r=e[At].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()}}Dh(L.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 t_=kr.destroy;L.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[At].length)&&rt.nextTick(nn,r),t_.call(this,t,e),this};L.prototype._undestroy=kr.undestroy;L.prototype._destroy=function(t,e){e(t)};L.prototype[kh.captureRejectionSymbol]=function(t){this.destroy(t)};var en;function Pa(){return en===void 0&&(en={}),en}L.fromWeb=function(t,e){return Pa().newStreamWritableFromWritableStream(t,e)};L.toWeb=function(t){return Pa().newWritableStreamFromStreamWritable(t)}});var za=A((jb,Qa)=>{var an=Me(),r_=Ie(),{isReadable:i_,isWritable:n_,isIterable:La,isNodeStream:s_,isReadableNodeStream:Ca,isWritableNodeStream:Fa,isDuplexNodeStream:o_,isReadableStream:Ba,isWritableStream:Da}=_e(),Oa=Ae(),{AbortError:Wa,codes:{ERR_INVALID_ARG_TYPE:a_,ERR_INVALID_RETURN_VALUE:Ma}}=Q(),{destroyer:Nt}=Xe(),l_=ye(),Ga=Yt(),u_=Ur(),{createDeferredPromise:$a}=H(),ka=Qi(),Ua=globalThis.Blob||r_.Blob,f_=typeof Ua!="undefined"?function(e){return e instanceof Ua}:function(e){return!1},c_=globalThis.AbortController||yt().AbortController,{FunctionPrototypeCall:qa}=j(),Ue=class extends l_{constructor(e){super(e),(e==null?void 0:e.readable)===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),(e==null?void 0:e.writable)===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};Qa.exports=function t(e,r){if(o_(e))return e;if(Ca(e))return vt({readable:e});if(Fa(e))return vt({writable:e});if(s_(e))return vt({writable:!1,readable:!1});if(Ba(e))return vt({readable:Ga.fromWeb(e)});if(Da(e))return vt({writable:u_.fromWeb(e)});if(typeof e=="function"){let{value:n,write:s,final:o,destroy:a}=d_(e);if(La(n))return ka(Ue,n,{objectMode:!0,write:s,final:o,destroy:a});let l=n==null?void 0:n.then;if(typeof l=="function"){let u,f=qa(l,n,c=>{if(c!=null)throw new Ma("nully","body",c)},c=>{Nt(u,c)});return u=new Ue({objectMode:!0,readable:!1,write:s,final(c){o(async()=>{try{await f,an.nextTick(c,null)}catch(d){an.nextTick(c,d)}})},destroy:a})}throw new Ma("Iterable, AsyncIterable or AsyncFunction",r,n)}if(f_(e))return t(e.arrayBuffer());if(La(e))return ka(Ue,e,{objectMode:!0,writable:!1});if(Ba(e==null?void 0:e.readable)&&Da(e==null?void 0:e.writable))return Ue.fromWeb(e);if(typeof(e==null?void 0:e.writable)=="object"||typeof(e==null?void 0:e.readable)=="object"){let n=e!=null&&e.readable?Ca(e==null?void 0:e.readable)?e==null?void 0:e.readable:t(e.readable):void 0,s=e!=null&&e.writable?Fa(e==null?void 0:e.writable)?e==null?void 0:e.writable:t(e.writable):void 0;return vt({readable:n,writable:s})}let i=e==null?void 0:e.then;if(typeof i=="function"){let n;return qa(i,e,s=>{s!=null&&n.push(s),n.push(null)},s=>{Nt(n,s)}),n=new Ue({objectMode:!0,writable:!1,read(){}})}throw new a_(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function d_(t){let{promise:e,resolve:r}=$a(),i=new c_,n=i.signal;return{value:t((function(){return ee(this,null,function*(){for(;;){let o=e;e=null;let{chunk:a,done:l,cb:u}=yield new W(o);if(an.nextTick(u),l)return;if(n.aborted)throw new Wa(void 0,{cause:n.reason});({promise:e,resolve:r}=$a()),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 vt(t){let e=t.readable&&typeof t.readable.read!="function"?Ga.wrap(t.readable):t.readable,r=t.writable,i=!!i_(e),n=!!n_(r),s,o,a,l,u;function f(c){let d=l;l=null,d?d(c):c&&u.destroy(c)}return u=new Ue({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(Oa(r,c=>{n=!1,c&&Nt(e,c),f(c)}),u._write=function(c,d,_){r.write(c,d)?_():s=_},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&&(Oa(e,c=>{i=!1,c&&Nt(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,d){!c&&l!==null&&(c=new Wa),a=null,s=null,o=null,l===null?d(c):(l=d,Nt(r,c),Nt(e,c))},u}});var ye=A((Cb,Ka)=>{"use strict";var{ObjectDefineProperties:h_,ObjectGetOwnPropertyDescriptor:ve,ObjectKeys:__,ObjectSetPrototypeOf:Va}=j();Ka.exports=ae;var fn=Yt(),ie=Ur();Va(ae.prototype,fn.prototype);Va(ae,fn);{let t=__(ie.prototype);for(let e=0;e<t.length;e++){let r=t[e];ae.prototype[r]||(ae.prototype[r]=ie.prototype[r])}}function ae(t){if(!(this instanceof ae))return new ae(t);fn.call(this,t),ie.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}h_(ae.prototype,{writable:M({__proto__:null},ve(ie.prototype,"writable")),writableHighWaterMark:M({__proto__:null},ve(ie.prototype,"writableHighWaterMark")),writableObjectMode:M({__proto__:null},ve(ie.prototype,"writableObjectMode")),writableBuffer:M({__proto__:null},ve(ie.prototype,"writableBuffer")),writableLength:M({__proto__:null},ve(ie.prototype,"writableLength")),writableFinished:M({__proto__:null},ve(ie.prototype,"writableFinished")),writableCorked:M({__proto__:null},ve(ie.prototype,"writableCorked")),writableEnded:M({__proto__:null},ve(ie.prototype,"writableEnded")),writableNeedDrain:M({__proto__:null},ve(ie.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 ln;function Ha(){return ln===void 0&&(ln={}),ln}ae.fromWeb=function(t,e){return Ha().newStreamDuplexFromReadableWritablePair(t,e)};ae.toWeb=function(t){return Ha().newReadableWritablePairFromDuplex(t)};var un;ae.from=function(t){return un||(un=za()),un(t,"body")}});var hn=A((Bb,Za)=>{"use strict";var{ObjectSetPrototypeOf:Ya,Symbol:p_}=j();Za.exports=Ne;var{ERR_METHOD_NOT_IMPLEMENTED:b_}=Q().codes,dn=ye(),{getHighWaterMark:y_}=Vt();Ya(Ne.prototype,dn.prototype);Ya(Ne,dn);var er=p_("kCallback");function Ne(t){if(!(this instanceof Ne))return new Ne(t);let e=t?y_(this,t,"readableHighWaterMark",!0):null;e===0&&(t=Ce(M({},t),{highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0})),dn.call(this,t),this._readableState.sync=!1,this[er]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",g_)}function cn(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 g_(){this._final!==cn&&cn.call(this)}Ne.prototype._final=cn;Ne.prototype._transform=function(t,e,r){throw new b_("_transform()")};Ne.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[er]=r})};Ne.prototype._read=function(){if(this[er]){let t=this[er];this[er]=null,t()}}});var pn=A((Ob,Xa)=>{"use strict";var{ObjectSetPrototypeOf:Ja}=j();Xa.exports=Pt;var _n=hn();Ja(Pt.prototype,_n.prototype);Ja(Pt,_n);function Pt(t){if(!(this instanceof Pt))return new Pt(t);_n.call(this,t)}Pt.prototype._transform=function(t,e,r){r(null,t)}});var Qr=A((Mb,nl)=>{var tr=Me(),{ArrayIsArray:m_,Promise:w_,SymbolAsyncIterator:x_,SymbolDispose:E_}=j(),Gr=Ae(),{once:S_}=H(),I_=Xe(),el=ye(),{aggregateTwoErrors:R_,codes:{ERR_INVALID_ARG_TYPE:In,ERR_INVALID_RETURN_VALUE:bn,ERR_MISSING_ARGS:T_,ERR_STREAM_DESTROYED:A_,ERR_STREAM_PREMATURE_CLOSE:v_},AbortError:N_}=Q(),{validateFunction:P_,validateAbortSignal:j_}=wt(),{isIterable:it,isReadable:yn,isReadableNodeStream:Wr,isNodeStream:tl,isTransformStream:jt,isWebStream:L_,isReadableStream:gn,isReadableFinished:C_}=_e(),F_=globalThis.AbortController||yt().AbortController,mn,wn,xn;function rl(t,e,r){let i=!1;t.on("close",()=>{i=!0});let n=Gr(t,{readable:e,writable:r},s=>{i=!s});return{destroy:s=>{i||(i=!0,I_.destroyer(t,s||new A_("pipe")))},cleanup:n}}function B_(t){return P_(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function En(t){if(it(t))return t;if(Wr(t))return D_(t);throw new In("val",["Readable","Iterable","AsyncIterable"],t)}function D_(t){return ee(this,null,function*(){wn||(wn=Yt()),yield*ne(wn.prototype[x_].call(t))})}async function qr(t,e,r,{end:i}){let n,s=null,o=_=>{if(_&&(n=_),s){let p=s;s=null,p()}},a=()=>new w_((_,p)=>{n?p(n):s=()=>{n?p(n):_()}});e.on("drain",o);let l=Gr(e,{readable:!1},o);try{e.writableNeedDrain&&await a();try{for(var u=K(t),f,c,d;f=!(c=await u.next()).done;f=!1){let _=c.value;e.write(_)||await a()}}catch(c){d=[c]}finally{try{f&&(c=u.return)&&await c.call(u)}finally{if(d)throw d[0]}}i&&(e.end(),await a()),r()}catch(_){r(n!==_?R_(n,_):_)}finally{l(),e.off("drain",o)}}async function Sn(t,e,r,{end:i}){jt(e)&&(e=e.writable);let n=e.getWriter();try{try{for(var s=K(t),o,a,l;o=!(a=await s.next()).done;o=!1){let u=a.value;await n.ready,n.write(u).catch(()=>{})}}catch(a){l=[a]}finally{try{o&&(a=s.return)&&await a.call(s)}finally{if(l)throw l[0]}}await n.ready,i&&await n.close(),r()}catch(u){try{await n.abort(u),r(u)}catch(f){r(f)}}}function O_(...t){return il(t,S_(B_(t)))}function il(t,e,r){if(t.length===1&&m_(t[0])&&(t=t[0]),t.length<2)throw new T_("streams");let i=new F_,n=i.signal,s=r==null?void 0:r.signal,o=[];j_(s,"options.signal");function a(){p(new N_)}xn=xn||H().addAbortListener;let l;s&&(l=xn(s,a));let u,f,c=[],d=0;function _(x){p(x,--d===0)}function p(x,m){var w;if(x&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=x),!(!u&&!m)){for(;c.length;)c.shift()(u);(w=l)===null||w===void 0||w[E_](),i.abort(),m&&(u||o.forEach(R=>R()),tr.nextTick(e,u,f))}}let h;for(let x=0;x<t.length;x++){let m=t[x],w=x<t.length-1,R=x>0,T=w||(r==null?void 0:r.end)!==!1,U=x===t.length-1;if(tl(m)){let D=function(X){X&&X.name!=="AbortError"&&X.code!=="ERR_STREAM_PREMATURE_CLOSE"&&_(X)};var S=D;if(T){let{destroy:X,cleanup:Xr}=rl(m,w,R);c.push(X),yn(m)&&U&&o.push(Xr)}m.on("error",D),yn(m)&&U&&o.push(()=>{m.removeListener("error",D)})}if(x===0)if(typeof m=="function"){if(h=m({signal:n}),!it(h))throw new bn("Iterable, AsyncIterable or Stream","source",h)}else it(m)||Wr(m)||jt(m)?h=m:h=el.from(m);else if(typeof m=="function"){if(jt(h)){var y;h=En((y=h)===null||y===void 0?void 0:y.readable)}else h=En(h);if(h=m(h,{signal:n}),w){if(!it(h,!0))throw new bn("AsyncIterable",`transform[${x-1}]`,h)}else{var g;mn||(mn=pn());let D=new mn({objectMode:!0}),X=(g=h)===null||g===void 0?void 0:g.then;if(typeof X=="function")d++,X.call(h,Le=>{f=Le,Le!=null&&D.write(Le),T&&D.end(),tr.nextTick(_)},Le=>{D.destroy(Le),tr.nextTick(_,Le)});else if(it(h,!0))d++,qr(h,D,_,{end:T});else if(gn(h)||jt(h)){let Le=h.readable||h;d++,qr(Le,D,_,{end:T})}else throw new bn("AsyncIterable or Promise","destination",h);h=D;let{destroy:Xr,cleanup:kl}=rl(h,!1,!0);c.push(Xr),U&&o.push(kl)}}else if(tl(m)){if(Wr(h)){d+=2;let D=M_(h,m,_,{end:T});yn(m)&&U&&o.push(D)}else if(jt(h)||gn(h)){let D=h.readable||h;d++,qr(D,m,_,{end:T})}else if(it(h))d++,qr(h,m,_,{end:T});else throw new In("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=m}else if(L_(m)){if(Wr(h))d++,Sn(En(h),m,_,{end:T});else if(gn(h)||it(h))d++,Sn(h,m,_,{end:T});else if(jt(h))d++,Sn(h.readable,m,_,{end:T});else throw new In("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=m}else h=el.from(m)}return(n!=null&&n.aborted||s!=null&&s.aborted)&&tr.nextTick(a),h}function M_(t,e,r,{end:i}){let n=!1;if(e.on("close",()=>{n||r(new v_)}),t.pipe(e,{end:!1}),i){let o=function(){n=!0,e.end()};var s=o;C_(t)?tr.nextTick(o):t.once("end",o)}else r();return Gr(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)}),Gr(e,{readable:!1,writable:!0},r)}nl.exports={pipelineImpl:il,pipeline:O_}});var Tn=A((kb,fl)=>{"use strict";var{pipeline:$_}=Qr(),zr=ye(),{destroyer:k_}=Xe(),{isNodeStream:Vr,isReadable:sl,isWritable:ol,isWebStream:Rn,isTransformStream:nt,isWritableStream:al,isReadableStream:ll}=_e(),{AbortError:U_,codes:{ERR_INVALID_ARG_VALUE:ul,ERR_MISSING_ARGS:q_}}=Q(),W_=Ae();fl.exports=function(...e){if(e.length===0)throw new q_("streams");if(e.length===1)return zr.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=zr.from(e[0])),typeof e[e.length-1]=="function"){let _=e.length-1;e[_]=zr.from(e[_])}for(let _=0;_<e.length;++_)if(!(!Vr(e[_])&&!Rn(e[_]))){if(_<e.length-1&&!(sl(e[_])||ll(e[_])||nt(e[_])))throw new ul(`streams[${_}]`,r[_],"must be readable");if(_>0&&!(ol(e[_])||al(e[_])||nt(e[_])))throw new ul(`streams[${_}]`,r[_],"must be writable")}let i,n,s,o,a;function l(_){let p=o;o=null,p?p(_):_?a.destroy(_):!d&&!c&&a.destroy()}let u=e[0],f=$_(e,l),c=!!(ol(u)||al(u)||nt(u)),d=!!(sl(f)||ll(f)||nt(f));if(a=new zr({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(f!=null&&f.readableObjectMode),writable:c,readable:d}),c){if(Vr(u))a._write=function(p,h,y){u.write(p,h)?y():i=y},a._final=function(p){u.end(),n=p},u.on("drain",function(){if(i){let p=i;i=null,p()}});else if(Rn(u)){let h=(nt(u)?u.writable:u).getWriter();a._write=async function(y,g,S){try{await h.ready,h.write(y).catch(()=>{}),S()}catch(x){S(x)}},a._final=async function(y){try{await h.ready,h.close().catch(()=>{}),n=y}catch(g){y(g)}}}let _=nt(f)?f.readable:f;W_(_,()=>{if(n){let p=n;n=null,p()}})}if(d){if(Vr(f))f.on("readable",function(){if(s){let _=s;s=null,_()}}),f.on("end",function(){a.push(null)}),a._read=function(){for(;;){let _=f.read();if(_===null){s=a._read;return}if(!a.push(_))return}};else if(Rn(f)){let p=(nt(f)?f.readable:f).getReader();a._read=async function(){for(;;)try{let{value:h,done:y}=await p.read();if(!a.push(h))return;if(y){a.push(null);return}}catch(h){return}}}}return a._destroy=function(_,p){!_&&o!==null&&(_=new U_),s=null,i=null,n=null,o===null?p(_):(o=p,Vr(f)&&k_(f,_))},a}});var wl=A((Ub,Nn)=>{"use strict";var G_=globalThis.AbortController||yt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Q_,ERR_INVALID_ARG_TYPE:rr,ERR_MISSING_ARGS:z_,ERR_OUT_OF_RANGE:V_},AbortError:ge}=Q(),{validateAbortSignal:st,validateInteger:cl,validateObject:ot}=wt(),H_=j().Symbol("kWeak"),K_=j().Symbol("kResistStopPropagation"),{finished:Y_}=Ae(),Z_=Tn(),{addAbortSignalNoValidate:J_}=zt(),{isWritable:X_,isNodeStream:ep}=_e(),{deprecate:tp}=H(),{ArrayPrototypePush:rp,Boolean:ip,MathFloor:dl,Number:np,NumberIsNaN:sp,Promise:hl,PromiseReject:_l,PromiseResolve:op,PromisePrototypeThen:pl,Symbol:yl}=j(),Hr=yl("kEmpty"),bl=yl("kEof");function ap(t,e){if(e!=null&&ot(e,"options"),(e==null?void 0:e.signal)!=null&&st(e.signal,"options.signal"),ep(t)&&!X_(t))throw new Q_("stream",t,"must be writable");let r=Z_(this,t);return e!=null&&e.signal&&J_(e.signal,r),r}function Kr(t,e){if(typeof t!="function")throw new rr("fn",["Function","AsyncFunction"],t);e!=null&&ot(e,"options"),(e==null?void 0:e.signal)!=null&&st(e.signal,"options.signal");let r=1;(e==null?void 0:e.concurrency)!=null&&(r=dl(e.concurrency));let i=r-1;return(e==null?void 0:e.highWaterMark)!=null&&(i=dl(e.highWaterMark)),cl(r,"options.concurrency",1),cl(i,"options.highWaterMark",0),i+=r,function(){return ee(this,null,function*(){let s=H().AbortSignalAny([e==null?void 0:e.signal].filter(ip)),o=this,a=[],l={signal:s},u,f,c=!1,d=0;function _(){c=!0,p()}function p(){d-=1,h()}function h(){f&&!c&&d<r&&a.length<i&&(f(),f=null)}async function y(){try{try{for(var g=K(o),S,x,m;S=!(x=await g.next()).done;S=!1){let w=x.value;if(c)return;if(s.aborted)throw new ge;try{if(w=t(w,l),w===Hr)continue;w=op(w)}catch(R){w=_l(R)}d+=1,pl(w,p,_),a.push(w),u&&(u(),u=null),!c&&(a.length>=i||d>=r)&&await new hl(R=>{f=R})}}catch(x){m=[x]}finally{try{S&&(x=g.return)&&await x.call(g)}finally{if(m)throw m[0]}}a.push(bl)}catch(w){let R=_l(w);pl(R,p,_),a.push(R)}finally{c=!0,u&&(u(),u=null)}}y();try{for(;;){for(;a.length>0;){let g=yield new W(a[0]);if(g===bl)return;if(s.aborted)throw new ge;g!==Hr&&(yield g),a.shift(),h()}yield new W(new hl(g=>{u=g}))}}finally{c=!0,f&&(f(),f=null)}})}.call(this)}function lp(t=void 0){return t!=null&&ot(t,"options"),(t==null?void 0:t.signal)!=null&&st(t.signal,"options.signal"),function(){return ee(this,null,function*(){let r=0;try{for(var n=K(this),s,o,a;s=!(o=yield new W(n.next())).done;s=!1){let l=o.value;var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new ge({cause:t.signal.reason});yield[r++,l]}}catch(o){a=[o]}finally{try{s&&(o=n.return)&&(yield new W(o.call(n)))}finally{if(a)throw a[0]}}})}.call(this)}async function gl(t,e=void 0){try{for(var r=K(vn.call(this,t,e)),i,n,s;i=!(n=await r.next()).done;i=!1){let o=n.value;return!0}}catch(n){s=[n]}finally{try{i&&(n=r.return)&&await n.call(r)}finally{if(s)throw s[0]}}return!1}async function up(t,e=void 0){if(typeof t!="function")throw new rr("fn",["Function","AsyncFunction"],t);return!await gl.call(this,async(...r)=>!await t(...r),e)}async function fp(t,e){try{for(var r=K(vn.call(this,t,e)),i,n,s;i=!(n=await r.next()).done;i=!1){let o=n.value;return o}}catch(n){s=[n]}finally{try{i&&(n=r.return)&&await n.call(r)}finally{if(s)throw s[0]}}}async function cp(t,e){if(typeof t!="function")throw new rr("fn",["Function","AsyncFunction"],t);async function r(a,l){return await t(a,l),Hr}try{for(var i=K(Kr.call(this,r,e)),n,s,o;n=!(s=await i.next()).done;n=!1){let a=s.value;;}}catch(s){o=[s]}finally{try{n&&(s=i.return)&&await s.call(i)}finally{if(o)throw o[0]}}}function vn(t,e){if(typeof t!="function")throw new rr("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n)?i:Hr}return Kr.call(this,r,e)}var An=class extends z_{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function dp(t,e,r){var i;if(typeof t!="function")throw new rr("reducer",["Function","AsyncFunction"],t);r!=null&&ot(r,"options"),(r==null?void 0:r.signal)!=null&&st(r.signal,"options.signal");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let _=new ge(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await Y_(this.destroy(_)),_}let s=new G_,o=s.signal;if(r!=null&&r.signal){let _={once:!0,[H_]:this,[K_]:!0};r.signal.addEventListener("abort",()=>s.abort(),_)}let a=!1;try{try{for(var u=K(this),f,c,d;f=!(c=await u.next()).done;f=!1){let _=c.value;var l;if(a=!0,r!=null&&(l=r.signal)!==null&&l!==void 0&&l.aborted)throw new ge;n?e=await t(e,_,{signal:o}):(e=_,n=!0)}}catch(c){d=[c]}finally{try{f&&(c=u.return)&&await c.call(u)}finally{if(d)throw d[0]}}if(!a&&!n)throw new An}finally{s.abort()}return e}async function hp(t){t!=null&&ot(t,"options"),(t==null?void 0:t.signal)!=null&&st(t.signal,"options.signal");let e=[];try{for(var i=K(this),n,s,o;n=!(s=await i.next()).done;n=!1){let a=s.value;var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new ge(void 0,{cause:t.signal.reason});rp(e,a)}}catch(s){o=[s]}finally{try{n&&(s=i.return)&&await s.call(i)}finally{if(o)throw o[0]}}return e}function _p(t,e){let r=Kr.call(this,t,e);return function(){return ee(this,null,function*(){try{for(var n=K(r),s,o,a;s=!(o=yield new W(n.next())).done;s=!1){let l=o.value;yield*ne(l)}}catch(o){a=[o]}finally{try{s&&(o=n.return)&&(yield new W(o.call(n)))}finally{if(a)throw a[0]}}})}.call(this)}function ml(t){if(t=np(t),sp(t))return 0;if(t<0)throw new V_("number",">= 0",t);return t}function pp(t,e=void 0){return e!=null&&ot(e,"options"),(e==null?void 0:e.signal)!=null&&st(e.signal,"options.signal"),t=ml(t),function(){return ee(this,null,function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new ge;try{for(var s=K(this),o,a,l;o=!(a=yield new W(s.next())).done;o=!1){let u=a.value;var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new ge;t--<=0&&(yield u)}}catch(a){l=[a]}finally{try{o&&(a=s.return)&&(yield new W(a.call(s)))}finally{if(l)throw l[0]}}})}.call(this)}function bp(t,e=void 0){return e!=null&&ot(e,"options"),(e==null?void 0:e.signal)!=null&&st(e.signal,"options.signal"),t=ml(t),function(){return ee(this,null,function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new ge;try{for(var s=K(this),o,a,l;o=!(a=yield new W(s.next())).done;o=!1){let u=a.value;var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new ge;if(t-- >0&&(yield u),t<=0)return}}catch(a){l=[a]}finally{try{o&&(a=s.return)&&(yield new W(a.call(s)))}finally{if(l)throw l[0]}}})}.call(this)}Nn.exports.streamReturningOperators={asIndexedPairs:tp(lp,"readable.asIndexedPairs will be removed in a future version."),drop:pp,filter:vn,flatMap:_p,map:Kr,take:bp,compose:ap};Nn.exports.promiseReturningOperators={every:up,forEach:cp,reduce:dp,toArray:hp,some:gl,find:fp}});var Pn=A((Wb,xl)=>{"use strict";var{ArrayPrototypePop:yp,Promise:gp}=j(),{isIterable:mp,isNodeStream:wp,isWebStream:xp}=_e(),{pipelineImpl:Ep}=Qr(),{finished:Sp}=Ae();jn();function Ip(...t){return new gp((e,r)=>{let i,n,s=t[t.length-1];if(s&&typeof s=="object"&&!wp(s)&&!mp(s)&&!xp(s)){let o=yp(t);i=o.signal,n=o.end}Ep(t,(o,a)=>{o?r(o):e(a)},{signal:i,end:n})})}xl.exports={finished:Sp,pipeline:Ip}});var jn=A((Gb,Pl)=>{"use strict";var{Buffer:Rp}=Ie(),{ObjectDefineProperty:Pe,ObjectKeys:Il,ReflectApply:Rl}=j(),{promisify:{custom:Tl}}=H(),{streamReturningOperators:El,promiseReturningOperators:Sl}=wl(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Al}}=Q(),Tp=Tn(),{setDefaultHighWaterMark:Ap,getDefaultHighWaterMark:vp}=Vt(),{pipeline:vl}=Qr(),{destroyer:Np}=Xe(),Nl=Ae(),Ln=Pn(),ir=_e(),P=Pl.exports=vr().Stream;P.isDestroyed=ir.isDestroyed;P.isDisturbed=ir.isDisturbed;P.isErrored=ir.isErrored;P.isReadable=ir.isReadable;P.isWritable=ir.isWritable;P.Readable=Yt();for(let t of Il(El)){let r=function(...i){if(new.target)throw Al();return P.Readable.from(Rl(e,this,i))},e=El[t];Pe(r,"name",{__proto__:null,value:e.name}),Pe(r,"length",{__proto__:null,value:e.length}),Pe(P.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of Il(Sl)){let r=function(...i){if(new.target)throw Al();return Rl(e,this,i)},e=Sl[t];Pe(r,"name",{__proto__:null,value:e.name}),Pe(r,"length",{__proto__:null,value:e.length}),Pe(P.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}P.Writable=Ur();P.Duplex=ye();P.Transform=hn();P.PassThrough=pn();P.pipeline=vl;var{addAbortSignal:Pp}=zt();P.addAbortSignal=Pp;P.finished=Nl;P.destroy=Np;P.compose=Tp;P.setDefaultHighWaterMark=Ap;P.getDefaultHighWaterMark=vp;Pe(P,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Ln}});Pe(vl,Tl,{__proto__:null,enumerable:!0,get(){return Ln.pipeline}});Pe(Nl,Tl,{__proto__:null,enumerable:!0,get(){return Ln.finished}});P.Stream=P;P._isUint8Array=function(e){return e instanceof Uint8Array};P._uint8ArrayToBuffer=function(e){return Rp.from(e.buffer,e.byteOffset,e.byteLength)}});var Yr=A((Qb,B)=>{"use strict";var k=jn(),jp=Pn(),Lp=k.Readable.destroy;B.exports=k.Readable;B.exports._uint8ArrayToBuffer=k._uint8ArrayToBuffer;B.exports._isUint8Array=k._isUint8Array;B.exports.isDisturbed=k.isDisturbed;B.exports.isErrored=k.isErrored;B.exports.isReadable=k.isReadable;B.exports.Readable=k.Readable;B.exports.Writable=k.Writable;B.exports.Duplex=k.Duplex;B.exports.Transform=k.Transform;B.exports.PassThrough=k.PassThrough;B.exports.addAbortSignal=k.addAbortSignal;B.exports.finished=k.finished;B.exports.destroy=k.destroy;B.exports.destroy=Lp;B.exports.pipeline=k.pipeline;B.exports.compose=k.compose;Object.defineProperty(k,"promises",{configurable:!0,enumerable:!0,get(){return jp}});B.exports.Stream=k.Stream;B.exports.default=B.exports});var We="http://www.w3.org/1999/02/22-rdf-syntax-ns#",lt="http://www.w3.org/2001/XMLSchema#",fr="http://www.w3.org/2000/10/swap/",N={xsd:{decimal:`${lt}decimal`,boolean:`${lt}boolean`,dateTime:`${lt}dateTime`,double:`${lt}double`,integer:`${lt}integer`,string:`${lt}string`},rdf:{type:`${We}type`,nil:`${We}nil`,first:`${We}first`,rest:`${We}rest`,langString:`${We}langString`,dirLangString:`${We}dirLangString`,reifies:`${We}reifies`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${fr}reify#forSome`,forAll:`${fr}reify#forAll`},log:{implies:`${fr}log#implies`,isImpliedBy:`${fr}log#isImpliedBy`}};var{xsd:cr}=N,Bt=32,Dt=9,ti=10,Ot=13,Un=35,kn={"\\":"\\","'":"'",'"':'"',n:`
|
|
3
|
-
`,r:"\r",t:" ",f:"\f",b:"\b"},Zl={_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","'":"'","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Jl=/[\x00-\x20<>\\"\{\}\|\^\`]/,Xl=/[\s<>"{}|^`]/g;function eu(t){return t<=1114111&&(t<55296||t>57343)}var tu={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_commentLine:!0,_whitespace:!0},ru=/$0^/,iu=/\S*/y;function O(t,e,r){return t.lastIndex=r,t.exec(e)}function dr(t,e,r){return t.lastIndex=r,t.test(e)}function Ft(t,e,r){return t.lastIndex=0,t.exec(`${e.slice(r)} `)}function nu(t){return t===Bt||t===Dt||t===ti||t===Ot||t===Un}var su=/^(?:prefix|base|version|graph|forsome|forall|iri|a|true|false|has|is|of|id)$/i,ou=1024,Ge=class{constructor(e){if(this._iri=/<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/y,this._unescapedIri=/<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/y,this._simpleQuotedString=/"([^"\\\r\n]*)"(?=[^"])/y,this._simpleApostropheString=/'([^'\\\r\n]*)'(?=[^'])/y,this._langcode=/@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9])/iy,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<])/y,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-9: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-9: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-9: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#()\[\]\{\}"'<>]))/y,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-9: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#()\[\]\{\}"'<>])/y,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#()\[\]\{\}"'<>]))/y,this._number=/[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?\d+|(?=\.?\d)\d*(?:(\.)\d+)?)(?=\.?[,;:!\^\s#()\[\]\{\}"'<>])/y,this._boolean=/(?:true|false)(?=[.,;!\^\s#()\[\]\{\}"'<>])/y,this._atKeyword=/@[a-z]+(?=[\s#<:])/iy,this._keyword=/(?:PREFIX|BASE|VERSION|GRAPH)(?=[\s#<])/iy,this._n3Verb=/(?:has|is|of)(?=[\s#()\[\]\{\}"'<>?_+\-0-9])/y,this._n3Id=/id(?=[\s#<])/y,this._shortPredicates=/a(?=[\s#()\[\]\{\}"'<>])/y,this._commentLine=/[ \t]*#([^\n\r]*)(?:\r\n|\n|\r)([ \t]*)/y,this._whitespace=/[ \t]+/y,e=e||{},this._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(let r in this)!(r in tu)&&this[r]instanceof RegExp&&(this[r]=ru)}else this._n3Mode=e.n3!==!1;if(this._directive=null,e.directives&&e.directives.length!==0){for(let r of e.directives)if(!/^[a-z]+$/i.test(r)||su.test(r))throw new Error(`Invalid directive name: "${r}"`);this._directive=new RegExp(`(?:${e.directives.join("|")})(?=[\\s#<])`,"iy"),this._directiveMaxLength=Math.max(...e.directives.map(r=>r.length)),this._directiveStarts=e.directives.map(r=>r[0].toLowerCase()+r[0].toUpperCase()).join("")}this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,r){let i=this._input,n=0,s=this._linePosition+i.length;for(;;){for(;;){let R=i.charCodeAt(n),T=0;if(R===Bt||R===Dt){let U=i.charCodeAt(n+1);T=U===Bt||U===Dt?O(this._whitespace,i,n)[0].length:1,R=i.charCodeAt(n+T)}if(R===Un){let U=O(this._commentLine,i,n);if(U){let D=U[0].length;if(!r&&n+D===i.length&&i.charCodeAt(i.length-1)===Ot)return this._suspend(i,n,s);this.comments&&o(U[1],this._line,s-(i.length-n)+T),n+=D,s=i.length-n+U[2].length,this._line++}else{if(n+=T,!r)return this._suspend(i,n,s);this.comments&&o(i.slice(n+1),this._line,s-(i.length-n)),n=i.length;break}}else if(R===ti||R===Ot){if(!r&&R===Ot&&n+T+1===i.length)return this._suspend(i,n,s);T+=R===Ot&&i.charCodeAt(n+T+1)===ti?2:1;let U=0,D=i.charCodeAt(n+T);if(D===Bt||D===Dt){let X=i.charCodeAt(n+T+1);U=X===Bt||X===Dt?O(this._whitespace,i,n+T)[0].length:1}n+=T+U,s=i.length-n+U,this._line++}else{n+=T;break}}if(n>=i.length)return r&&this._previousMarker==="^^"?l(this,i,n):(this._linePosition=s,r?(a("eof","","",this._line,s,0),this._input=null):this._input="");let u=this._line,f=i[n],c="",d="",_="",p=null,h=0,y=0,g=0,S=!1;switch(f){case"^":if(this._previousMarker==="^^")return l(this,i,n);if(i.length-n<3)break;if(i[n+1]==="^"){if(this._previousMarker="^^",n+=2,i[n]!=="<"){if(nu(i.charCodeAt(n)))continue;S=!0;break}}else{this._n3Mode&&(h=1,c="^");break}case"<":if(p=O(this._unescapedIri,i,n))c="IRI",d=p[1],y=p[1].length+2;else if(p=O(this._iri,i,n)){if(d=this._unescape(p[1],kn),d===null||Jl.test(d))return l(this,i,n);c="IRI",y=p[1].length+2}else i.length-n>2&&i[n+1]==="<"&&i[n+2]==="("?(c="<<(",h=3):!this._lineMode&&i.length-n>(r?1:2)&&i[n+1]==="<"?(c="<<",h=2):this._n3Mode&&i.length-n>1&&i[n+1]==="="?(h=2,this._isImpliedBy?(c="abbreviation",d="<"):(c="inverse",d=">")):this._n3Mode&&i.length-n>1&&i[n+1]==="-"&&(c="inversePredicate",h=2);break;case">":i.length-n>1&&i[n+1]===">"&&(c=">>",h=2);break;case"_":((p=O(this._blank,i,n))||r&&(p=Ft(this._blank,i,n)))&&(c="blank",_="_",d=p[1],y=p[1].length+2);break;case'"':if(p=O(this._simpleQuotedString,i,n))d=p[1];else if({value:d,matchLength:h,finalLineLength:g}=this._parseLiteral(i,n),d===null)return l(this,i,n);(p!==null||h!==0)&&(c="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(p=O(this._simpleApostropheString,i,n))d=p[1];else if({value:d,matchLength:h,finalLineLength:g}=this._parseLiteral(i,n),d===null)return l(this,i,n);(p!==null||h!==0)&&(c="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(p=O(this._variable,i,n))&&(c="var",d=p[0]);break;case"@":if(this._previousMarker==="literal"&&(p=O(this._langcode,i,n))&&p[1]!=="version"){let R=n+p[0].length;!r&&i[R]==="-"&&i[R+1]!=="-"?p=null:(c="langcode",d=p[1])}else(p=O(this._atKeyword,i,n))&&(c=p[0]);break;case".":if(i.length-n===1?r:i[n+1]<"0"||i[n+1]>"9"){c=".",h=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[n+1]==="-"){this._previousMarker==="langcode"&&(i.startsWith("--ltr",n)?(c="dircode",d="ltr",h=5):i.startsWith("--rtl",n)&&(c="dircode",d="rtl",h=5));break}(p=O(this._number,i,n)||r&&(p=Ft(this._number,i,n)))&&(c="literal",d=p[0],_=typeof p[1]=="string"?cr.double:typeof p[2]=="string"?cr.decimal:cr.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":case"V":case"v":(p=O(this._keyword,i,n))?c=p[0].toUpperCase():S=!0;break;case"f":case"t":dr(this._boolean,i,n)?(c="literal",d=f==="t"?"true":"false",_=cr.boolean,h=d.length):S=!0;break;case"a":dr(this._shortPredicates,i,n)?(c="abbreviation",d="a",h=1):S=!0;break;case"h":case"o":this._n3Mode&&(p=this._matchN3Verb(i,n,r))?c=p[0]:S=!0;break;case"i":this._n3Mode&&dr(this._n3Id,i,n)?(c="id",h=2):this._n3Mode&&(p=this._matchN3Verb(i,n,r))?c=p[0]:S=!0;break;case"=":this._n3Mode&&i.length-n>1&&(c="abbreviation",i[n+1]!==">"?(h=1,d="="):(h=2,d=">"));break;case"!":if(!this._n3Mode)break;case")":if(!r&&(i.length-n===1||i.length-n===2&&i[n+1]===">"))break;if(i.length-n>2&&i[n+1]===">"&&i[n+2]===">"){c=")>>",h=3;break}case",":case";":case"[":case"]":case"(":case"}":case"~":this._lineMode||(h=1,c=f);break;case"{":!this._lineMode&&i.length-n>=2&&(i[n+1]==="|"?(c="{|",h=2):(c=f,h=1));break;case"|":i.length-n>=2&&i[n+1]==="}"&&(c="|}",h=2);break;default:S=!0}if(S&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(p=O(this._prefix,i,n))?(c="prefix",d=p[1]||""):this._directive!==null&&this._directiveStarts.includes(f)&&((p=O(this._directive,i,n))||r&&i.length-n<=this._directiveMaxLength&&(p=Ft(this._directive,i,n)))?c=p[0].toUpperCase():((p=O(this._prefixed,i,n))||r&&(p=Ft(this._prefixed,i,n)))&&(c="prefixed",_=p[1]||"",d=this._unescape(p[2],Zl),y=_.length+p[2].length+1)),this._previousMarker==="^^")switch(c){case"prefixed":c="type";break;case"IRI":c="typeIRI";break;default:c=""}if(!c)return r||!i.startsWith("'''",n)&&!i.startsWith('"""',n)&&/\n|\r/.test(i.slice(n))?l(this,i,n):this._suspend(i,n,s);let x=h||p[0].length,m=s-(i.length-n),w;g?(w={type:c,value:d,prefix:_,line:u,start:m,end:g,endLine:this._line},e(null,w)):w=a(c,d,_,u,m,y||x),this.previousToken=w,this._previousMarker=c==="literal"&&(this._previousMarker==="VERSION"||this._previousMarker==="@version")?"version":c,n=Math.min(n+x,i.length),g&&(s=i.length-n+g)}function o(u,f,c){e(null,{type:"comment",value:u,prefix:"",line:f,start:c,end:c+u.length+1})}function a(u,f,c,d,_,p){let h={type:u,value:f,prefix:c,line:d,start:_,end:_+p};return e(null,h),h}function l(u,f,c){e(u._syntaxError(O(iu,f,c)[0]))}}_suspend(e,r,i){return this._linePosition=i-(e.length-r),this._input=e.slice(r)}_matchN3Verb(e,r,i){let n=O(this._n3Verb,e,r);if(!n)return null;let s=e[r+n[0].length];return s!=="-"&&s!=="_"&&(s<"0"||s>"9")?n:O(this._prefixed,e,r)?null:dr(Xl,e,r)?n:Ft(this._prefixed,e,r)||!i&&O(this._prefix,`${e.slice(r)}: `,0)?null:n}_unescape(e,r){let i=e.indexOf("\\");if(i<0)return e;let n="",s=0;for(;i>=0&&i+1<e.length;){let o=e[i+1],a=i+2,l;if(o==="u"||o==="U"){if(a+=o==="u"?4:8,a>e.length)return null;let u=0;for(let f=i+2;f<a;f++){let c=e.charCodeAt(f);if(c>=48&&c<=57)c-=48;else if(c>=65&&c<=70)c-=55;else if(c>=97&&c<=102)c-=87;else return null;u=u*16+c}if(!eu(u))return null;l=String.fromCodePoint(u)}else{if(!(o in r))return null;l=r[o]}n+=e.slice(s,i)+l,s=a,i=e.indexOf("\\",s)}return n+e.slice(s)}_parseLiteral(e,r){if(e.length-r>=3){let i=e[r],n=e[r+1]===i&&e[r+2]===i?3:1,s=i;n===3&&(s=i==='"'?'"""':"'''");let o=r+Math.max(this._literalClosingPos,n);for(;(o=e.indexOf(s,o))>r;){let a=0;for(;e[o-a-1]==="\\";)a++;if(a%2===0){let l=e.substring(r+n,o),u=l.split(/\r\n|\r|\n/),f=u.length-1,c=o-r+n;if(n===1&&f!==0||n===3&&this._lineMode)break;this._line+=f;let d=f===0?0:u[u.length-1].length+n;return{value:this._unescape(l,kn),matchLength:c,finalLineLength:d}}o++}this._literalClosingPos=e.length-r-n+1}return{value:"",matchLength:0,finalLineLength: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")?(this._linePosition=1,e.slice(1)):e}tokenize(e,r){let i=this._tokenization={};if(this._line=1,this._linePosition=0,this._previousMarker=void 0,this.previousToken=void 0,this._literalClosingPos=0,this._input=void 0,typeof e=="string")if(this._input=this._readStartingBom(e),typeof r=="function")queueMicrotask(()=>{this._tokenization===i&&this._tokenizeToEnd(r,!0)});else{let n=[],s;if(this._tokenizeToEnd((o,a)=>o?s=o:n.push(a),!0),s)throw s;return n}else{let n,s=0;typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",o=>{if(this._tokenization===i&&this._input!==null&&o.length!==0){if(typeof o!="string"&&(n=n||new TextDecoder("utf-8",{ignoreBOM:!0}),!(o=n.decode(o,{stream:!0}))))return;typeof this._input=="undefined"?this._input=this._readStartingBom(o):this._input+=o,this._input.length>=s&&(this._tokenizeToEnd(r,!1),s=this._input!==null&&this._input.length>ou?2*this._input.length:0)}}),e.on("end",()=>{if(this._tokenization===i&&this._input!==null){let o=n?n.decode():"";o&&(this._input=typeof this._input=="string"?this._input+o:o),typeof this._input=="string"&&this._tokenizeToEnd(r,!0)}}),e.on("error",o=>{this._tokenization===i&&r(o)})}}};var{rdf:qn,xsd:we}=N,ft,au=0,ni="<>";var ri={namedNode:Wn,blankNode:Gn,variable:zn,literal:Qn,defaultGraph:lu,quad:ii,triple:ii,fromTerm:Mt,fromQuad:Vn},Y=ri,V=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}}},ut=class extends V{constructor(e){e!==""?super(e):(super(ni),Object.defineProperty(this,"value",{value:""}))}get termType(){return"NamedNode"}},xe=class t extends V{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 ut(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!=="@"?we.string:e.indexOf("--",r)>0?qn.dirLangString:qn.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}}}},$t=class extends V{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},kt=class extends V{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},Ut=class extends V{constructor(){return super(""),ft||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};ft=new Ut;function Fe(t,e,r){if(e=e||ri,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===ri)return new xe(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;case"<":if(t===ni)return e.namedNode("");default:if(!r||!Array.isArray(t))return e.namedNode(t)}return e.quad(Fe(t[0],e,!0),Fe(t[1],e,!0),Fe(t[2],e,!0),t[3]&&Fe(t[3],e,!0))}function Be(t,e){if(typeof t=="string")return t;if(t instanceof V&&t.termType!=="Quad")return t.id;if(!t)return ft.id;switch(t.termType){case"NamedNode":{let i=t.value;return i!==""?i:ni}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!==we.string?`^^${t.datatype.value}`:""}`;case"Quad":let r=[Be(t.subject,!0),Be(t.predicate,!0),Be(t.object,!0)];return t.graph&&t.graph.termType!=="DefaultGraph"&&r.push(Be(t.graph,!0)),e?r:JSON.stringify(r);default:throw new Error(`Unexpected termType: ${t.termType}`)}}var De=class extends V{constructor(e,r,i,n){super(""),this._subject=e,this._predicate=r,this._object=i,this._graph=n||ft}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 Wn(t){return new ut(t)}function Gn(t){return new $t(t||`n3-${au++}`)}function Qn(t,e){if(typeof e=="string")return new xe(`"${t}"@${e.toLowerCase()}`);if(e!==void 0&&!("termType"in e))return new xe(`"${t}"@${e.language.toLowerCase()}${e.direction?`--${e.direction.toLowerCase()}`:""}`);let r=e?e.value:"";return r===""&&(typeof t=="boolean"?r=we.boolean:typeof t=="number"?Number.isFinite(t)?r=Number.isInteger(t)&&Math.abs(t)<1e21?we.integer:we.double:(r=we.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")):typeof t=="bigint"?r=we.integer:t instanceof Date&&!Number.isNaN(t.getTime())&&(r=we.dateTime,t=t.toISOString())),r===""||r===we.string?new xe(`"${t}"`):new xe(`"${t}"^^${r}`)}function zn(t){return new kt(t)}function lu(){return ft}function ii(t,e,r,i){return new De(t,e,r,i)}function Mt(t){if(t instanceof V)return t;switch(t.termType){case"NamedNode":return Wn(t.value);case"BlankNode":return Gn(t.value);case"Variable":return zn(t.value);case"DefaultGraph":return ft;case"Literal":return Qn(t.value,t.language?t.direction?{language:t.language,direction:t.direction}:t.language:t.datatype);case"Quad":return Vn(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function Vn(t){if(t instanceof De)return t;if(t.termType!=="Quad")throw new Error(`Unexpected termType: ${t.termType}`);return ii(Mt(t.subject),Mt(t.predicate),Mt(t.object),Mt(t.graph))}var Hn=0,Ee=class t{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Yn(this,e.factory);let r=typeof e.format=="string"?e.format.match(/(?:^|\W)(\w*)$/)[1].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;if(this._emitCurrent=this._emit,a&&(this._createQuad=this._createQuadInDirection,this._emit=this._emitInDirection,this._emitCurrent=this._emitCurrentInDirection),(this._supportsNamedGraphs=!(i||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(i||n||s||a),this._isImpliedBy=e.isImpliedBy,this._implicitEmptyPrefix=e.implicitEmptyPrefix!==!1,this._emptyFormulaAsTrue=e.emptyFormulaAsTrue!==!1,l&&(this._resolveRelativeIRI=f=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._directives=null,e.directives){this._directives=Object.create(null);for(let f of e.directives)this._directives[`@${f.toLowerCase()}`]=this._directives[f.toUpperCase()]=f}this._lexer=e.lexer||new Ge({lineMode:l,n3:a,isImpliedBy:this._isImpliedBy,directives:e.directives}),this._explicitQuantifiers=!!e.explicitQuantifiers,this._formulaScopedBlankNodes=e.formulaScopedBlankNodes!==!1,this._parseUnsupportedVersions=!!e.parseUnsupportedVersions,this._version=e.version;let u=e.maxTripleTermDepth;this._maxTripleTermDepth=u===1/0||Number.isInteger(u)&&u>=0?u:1024}static _resetBlankNodePrefix(){Hn=0}_setBase(e){if(!e)this._base="",this._basePath="";else{let r=e.indexOf("#");r>=0&&(e=e.substr(0,r)),this._base=e;let i=e.indexOf("?"),n=i<0?e:e.substr(0,i);this._basePath=e.indexOf("/")<0?e:n.substr(0,n.lastIndexOf("/")+1);let s=e;e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(\/\/[^\/?#]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1],e[2]!==void 0&&(s.length===this._baseRoot.length||s[this._baseRoot.length]==="?")&&(this._basePath=`${this._baseRoot}/`)}}_enterTripleTerm(e,r,i,n){return this._tripleTermDepth>=this._maxTripleTermDepth?(this._error(`Triple terms nested deeper than ${this._maxTripleTermDepth} level${this._maxTripleTermDepth===1?"":"s"}`,n),!1):(this._tripleTermDepth++,this._saveContext(e,this._graph,r,i,null),this._graph=null,!0)}_saveContext(e,r,i,n,s){if(!this._n3Mode){this._contextStack.push({type:e,subject:i,predicate:n,object:s,graph:r});return}let o={type:e,subject:i,predicate:n,object:s,graph:r,inverse:this._inversePredicate,expectOf:this._expectOf,blankPrefix:this._prefixes._,prefixChanges:this._prefixChanges,quantifiedChanges:this._quantifiedChanges,emptyFormula:this._emptyFormula};e==="formula"&&(o.base=[this._base,this._basePath,this._baseRoot,this._baseScheme],this._prefixChanges=[]),this._contextStack.push(o),this._inversePredicate=!1,this._expectOf=!1,(!this._formulaScopedBlankNodes||e==="formula")&&(this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantifiedChanges=[]),e==="formula"&&(this._subject=null,this._emptyFormula=!0)}_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._expectOf=i.expectOf,e==="formula"&&([this._base,this._basePath,this._baseRoot,this._baseScheme]=i.base),this._prefixChanges!==i.prefixChanges&&(Kn(this._prefixes,this._prefixChanges),this._prefixChanges=i.prefixChanges),this._prefixes._=i.blankPrefix,this._quantifiedChanges!==i.quantifiedChanges&&(Kn(this._quantified,this._quantifiedChanges),this._quantifiedChanges=i.quantifiedChanges),this._emptyFormula=i.emptyFormula)}_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._directives!==null&&e.type in this._directives&&this._graph===null?(this._sparqlStyle=e.type[0]!=="@",this._directiveCallback(this._directives[e.type]),this._readDeclarationPunctuation):this._readSubject(e)}}_readInFormulaContext(e){switch(e.type){case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;default:return this._readSubject(e)}}_getStatementReader(){let e=this._contextStack[this._contextStack.length-1];return e&&e.type==="formula"?this._readInFormulaContext:this._readInTopContext}_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}_readList(e,r,i,n){let s=this._contextStack;return(s.length&&s[s.length-1]).type==="<<"?this._error("Unexpected list in reified triple",e):(this._saveContext("list",this._graph,r,i,n),this._subject=null,this._readListItem)}_readSubject(e){switch(this._predicate=null,e.type!=="}"&&(this._emptyFormula=!1),e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":return this._readList(e,this.RDF_NIL,null,null);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._factory.blankNode(),null,null),this._readInFormulaContext):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._enterTripleTerm("<<(",null,null,e)&&this._readSubject:this._error("Disallowed triple term as subject",e);case"<<":return this._enterTripleTerm("<<",null,null,e)&&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,i=!1;switch(r){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case"has":return this._readPredicateAfterVerb;case"is":return this._inversePredicate=!0,this._expectOf=!0,this._readPredicateAfterVerb;case"inversePredicate":return this._inversePredicate=!0,this._readPredicateAfterVerb;case"|}":return this._subject=null,this._readAnnotationBlockPunctuation(e);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)),i=!0;break;case"(":return this._n3Mode?this._readList(e,this._subject,this.RDF_NIL,null):this._error(`Expected entity but got ${r}`,e);case"[":return this._n3Mode?(this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead):this._error("Disallowed blank node as predicate",e);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._graph=this._factory.blankNode(),null),this._readSubject):this._readEntity(e);case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if((this._predicate=this._readEntity(e))===void 0)return;i=this._n3Mode}return this._validAnnotation=!0,i?this._getPathReader(this._readObject,"predicate"):this._readObject}_readPredicateAfterVerb(e){return e.type==="has"||e.type==="is"||e.type==="of"||e.type==="inversePredicate"?this._error(`Expected expression but got ${e.type}`,e):this._readPredicate(e)}_readObject(e){if(this._expectOf)return e.type!=="of"?this._error(`Expected of but got ${e.type}`,e):(this._expectOf=!1,this._readObject);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"(":return this._readList(e,this._subject,this._predicate,this.RDF_NIL);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readInFormulaContext):this._error("Unexpected graph",e);case"<<(":return this._enterTripleTerm("<<(",this._subject,this._predicate,e)&&this._readSubject;case"<<":return this._enterTripleTerm("<<",this._subject,this._predicate,e)&&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):e.type==="id"?this._readIriPropertyListId:(this._predicate=null,this._readPredicate(e))}}_readIriPropertyListId(e){let r=this._readEntity(e);if(r===void 0)return;if(r.termType!=="NamedNode")return this._error(`Expected IRI after id but got ${e.type}`,e);let i=this._subject;this._subject=r;let n=this._contextStack[this._contextStack.length-1];return n.subject===i&&(n.subject=r),n.predicate===i&&(n.predicate=r),n.object===i&&(n.object=r),this._predicate=null,this._readIriPropertyListPredicate}_readIriPropertyListPredicate(e){return e.type===";"||e.type==="]"||e.type==="."||e.type==="}"?this._error(`Expected predicate but got ${e.type}`,e):this._readPredicate(e)}_readBlankNodeTail(e){if(e.type!=="]")return this._readBlankNodePunctuation(e);this._subject!==null&&this._emitCurrent(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._getPathReader(this._readObject,"predicate"):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(this._object===null){if(n=this._getPathReader(this._readObject,"predicate"),this._predicate===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?(i=this._factory.blankNode(),r=this._factory.blankNode(),s===null?a.predicate===null?a.subject=i:a.object=i:this._emit(s,this.RDF_REST,i,this._graph),this._emit(i,this.RDF_FIRST,r,this._graph),this._saveContext("formula",this._graph,i,this.RDF_FIRST,this._graph=r),this._subject=null,this._readInFormulaContext):this._error("Unexpected graph",e);case"<<(":case"<<":if(!this._enterTripleTerm(e.type,null,null,e))return;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===null?a.predicate=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,n=!1;switch(e.type){case"type":case"typeIRI":let s=this._readEntity(e);if(s===void 0)return;if(s.value===N.rdf.langString||s.value===N.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,this._literalComponent=r,n=!0;break;default:i=this._factory.literal(this._literalValue)}return{token:e,literal:i,readCb:n}}_readDirCode(e){let r=this._literalComponent,i=this._literalListItem;if(e.type==="dircode"){let n=this._factory.literal(this._literalValue,{language:this._literalLanguage,direction:e.value});r==="subject"?this._subject=n:r==="predicate"?this._predicate=n:this._object=n,this._literalLanguage=void 0,e=null}if(r==="subject"||r==="predicate"){let n=r==="subject"?this._readPredicateOrNamedGraph:this._readObject;return this._getPathEndReader(e,n,r)||n.call(this,e)}return this._completeObjectLiteralPost(e,i)}_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 this._literalListItem=!1,this._readDirCode;let s=this._getPathEndReader(i.token,n,r);return s||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?(this._literalListItem=r,this._readDirCode):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){if(e.type!=="}")return this._readPunctuation(e);this._subject!==null&&this._emitCurrent(this._subject,this._predicate,this._object,this._graph);let r=this._graph,i=this._emptyFormula;return this._restoreContext("formula",e),i&&this._emptyFormulaAsTrue&&(this._subject===r?this._subject=this.N3_TRUE:this._predicate===r?this._predicate=this.N3_TRUE:this._object=this.N3_TRUE),this._object!==null?this._getPathReader(this._getContextEndReader(),"object"):this._predicate!==null?this._getPathReader(this._readObject,"predicate"):this._getPathReader(this._readPredicate,"subject")}_readPunctuation(e){let r,i=this._graph,n=this._subject,s=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._getStatementReader(),s&&(this._inversePredicate=!1);break;case";":s&&(this._inversePredicate=!1),r=this._readPredicate;break;case",":r=this._readObject;break;case"~":case"{|":return this._readAnnotationStart(e);case"|}":return this._error("Unexpected annotation syntax closing",e);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(n!==null){let o=this._predicate,a=this._object;this._emit(n,o,a,i,s)}return r}_readBlankNodePunctuation(e){let r,i=!1;switch(e.type){case";":i=this._inversePredicate,r=this._readPredicate;break;case",":r=this._readObject;break;case"~":case"{|":return this._readAnnotationStart(e);case"|}":return this._error("Unexpected annotation syntax closing",e);default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emitCurrent(this._subject,this._predicate,this._object,this._graph),i&&(this._inversePredicate=!1),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._prefixChanges!==null&&this._prefixChanges.push(this._prefix,this._prefixes[this._prefix]),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._getStatementReader().call(this,e)):e.type!=="."?this._error("Expected declaration to end with a dot",e):this._getStatementReader()}_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._quantifiedChanges!==null&&this._quantifiedChanges.push(r.id,this._quantified[r.id]),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,r){return this._afterPath=e,this._pathPosition=r||(this._predicate===null?"subject":"object"),this._readPath}_getPathEndReader(e,r,i){if(e!==null&&e.type!=="!"&&e.type!=="^")return null;let n=this._getPathReader(r,i);return e===null?n:n.call(this,e)}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:let r=this._afterPath,i=this._contextStack,n=i.length&&i[i.length-1];if(n&&n.type==="item"){let s=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,s,this._graph)}return this._afterPath=null,this._pathPosition=null,r.call(this,e)}}_readForwardPath(e){let r,i,n=this._factory.blankNode();if((i=this._readEntity(e))!==void 0)return this._pathPosition==="subject"?(r=this._subject,this._subject=n):this._pathPosition==="predicate"?(r=this._predicate,this._predicate=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._pathPosition==="subject"?(n=this._subject,this._subject=r):this._pathPosition==="predicate"?(n=this._predicate,this._predicate=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._createQuad(this._subject,this._predicate,this._object,this._graph,this._inversePredicate);this._restoreContext("<<(",e),this._tripleTermDepth--;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),this._tripleTermDepth--;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 e.type===">>"?this._readReifiedTripleTail(e):(this._reifier=this._readEntity(e),this._readReifiedTripleTail)}_readAnnotationStart(e){return this._emitCurrent(this._subject,this._predicate,this._object,this._graph),this._tripleTerm=null,this._readAnnotation(e)}_readAnnotation(e){switch(e.type){case"~":return this._readReifierInAnnotation;case"{|":return this._readAnnotationBlockHead(e)}switch(this._tripleTerm=null,e.type){case";":return this._inversePredicate=!1,this._readPredicate;case",":return this._readObject;default:return this._subject=null,this._getContextEndReader().call(this,e)}}_readReifierInAnnotation(e){switch(e.type){case"IRI":case"typeIRI":case"type":case"prefixed":case"blank":case"var":return this._reifier=this._readEntity(e),this._readAnnotationBlockOrReifier}return this._reifier=this._factory.blankNode(),this._readAnnotationBlockOrReifier(e)}_readAnnotationBlockOrReifier(e){return e.type==="{|"?this._readAnnotationBlockHead(e):(this._readTripleTerm(),this._readAnnotation(e))}_readAnnotationBlockHead(e){let r=this._readTripleTerm();return this._saveContext("annotation",this._graph,this._subject,this._predicate,this._object),this._contextStack[this._contextStack.length-1].tripleTerm=this._tripleTerm,this._subject=r,this._predicate=this._object=this._tripleTerm=null,this._inversePredicate=!1,this._validAnnotation=!1,this._readPredicate}_readAnnotationBlockPunctuation(e){let r=this._contextStack;if(e.type==="|}"){if(!r.length||r[r.length-1].type!=="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._emitCurrent(this._subject,this._predicate,this._object,this._graph);let{tripleTerm:i}=r[r.length-1];return this._restoreContext("annotation",e),this._tripleTerm=i,this._readAnnotation}return this._readBlankNodePunctuation(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._createQuad(this._subject,this._predicate,this._object,null,this._inversePredicate),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;case"annotation":return this._readAnnotationBlockPunctuation}}_createQuad(e,r,i,n){return this._factory.quad(e,r,i,n||this.DEFAULTGRAPH)}_createQuadInDirection(e,r,i,n,s){return s?this._factory.quad(i,r,e,n||this.DEFAULTGRAPH):this._factory.quad(e,r,i,n||this.DEFAULTGRAPH)}_emitInDirection(e,r,i,n,s){this._callback(null,this._createQuad(e,r,i,n,s))}_emitCurrentInDirection(e,r,i,n){this._callback(null,this._createQuad(e,r,i,n,this._inversePredicate))}_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=qt}_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"?":{let r=this._base.indexOf("?");return(r<0?this._base:this._base.substr(0,r))+e}case"/":return e[1]!=="/"?this._baseRoot+this._removeDotSegments(e):this._baseScheme?this._removeDotSegments(this._baseScheme+e):this._removeDotSegments(`:${e}`).substr(1);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]!=="/"&&e[s]!=="?"&&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,u,f,c;r&&(r.onQuad||r.onPrefix||r.onComment||r.onVersion||r.onDirective||r.onToken||r.onTokenEnd)?(s=r.onQuad,o=r.onPrefix,a=r.onComment,l=r.onVersion,u=r.onDirective,f=r.onToken,c=r.onTokenEnd):(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${Hn++}_`,this._n3Mode&&this._implicitEmptyPrefix&&this._base&&(this._prefixes[""]=this._resolveIRI("#")),this._prefixCallback=o||qt,this._versionCallback=l||qt,this._directiveCallback=u||qt,this._inversePredicate=!1,this._expectOf=!1,this._quantified=Object.create(null),this._prefixChanges=null,this._quantifiedChanges=null,this._emptyFormula=!1,this._tripleTermDepth=0;let d=p=>this._readCallback=this._readCallback(p);if(a||this._lexer.comments){this._lexer.comments=!0;let p=d;d=h=>h.type!=="comment"?p(h):(a&&a(h.value),this._readCallback)}if(f||c){let p=d;d=h=>{try{try{return f&&f(h),p(h)}finally{c&&c(h)}}catch(y){throw this._readCallback=null,y}}}if(!s){let p=[],h;if(this._callback=(y,g)=>{y?h=y:g&&p.push(g)},this._lexer.tokenize(e).every(d),h)throw h;return p}let _=(p,h)=>{p!==null?(this._callback(p),this._callback=qt):this._readCallback&&d(h)};this._callback=s,this._lexer.tokenize(e,_)}};function Kn(t,e){for(let r=e.length-2;r>=0;r-=2)e[r+1]===void 0?delete t[e[r]]:t[e[r]]=e[r+1]}function qt(){}function Yn(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(N.rdf.first),t.RDF_REST=e.namedNode(N.rdf.rest),t.RDF_NIL=e.namedNode(N.rdf.nil),t.RDF_REIFIES=e.namedNode(N.rdf.reifies),t.N3_FORALL=e.namedNode(N.r.forAll),t.N3_FORSOME=e.namedNode(N.r.forSome),t.N3_TRUE=e.literal("true",e.namedNode(N.xsd.boolean)),t.ABBREVIATIONS={a:e.namedNode(N.rdf.type),"=":e.namedNode(N.owl.sameAs),">":e.namedNode(N.log.implies),"<":e.namedNode(N.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}Ee.SUPPORTED_VERSIONS=["1.2","1.2-basic","1.1"];Yn(Ee.prototype,Y);var si={};Kl(si,{inDefaultGraph:()=>_u,isBlankNode:()=>fu,isDefaultGraph:()=>se,isLiteral:()=>cu,isNamedNode:()=>uu,isQuad:()=>hu,isVariable:()=>du,prefix:()=>pu,prefixes:()=>Zn});function uu(t){return!!t&&t.termType==="NamedNode"}function fu(t){return!!t&&t.termType==="BlankNode"}function cu(t){return!!t&&t.termType==="Literal"}function du(t){return!!t&&t.termType==="Variable"}function hu(t){return!!t&&t.termType==="Quad"}function se(t){return!!t&&t.termType==="DefaultGraph"}function _u(t){return se(t.graph)}function pu(t,e){return Zn({"":t.value||t},e)("")}function Zn(t,e){let r=Object.create(null);for(let n in t)i(n,t[n]);e=e||Y;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 ct(t){return t.replace(/[.*+?^${}()|[\]\\/-]/g,"\\$&")}var bu=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,yu=/^(?:(?!\.\.?(?:[/?#]|$))[^/?#]+(?:\/[^/?#]{3,})*\/?)?(?:[?#]|$)/,Jn="./",gu="../",oi="?",Xn="#",Qe=class t{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!bu.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!t.supports(this.base))return this._baseMatcher=/.^/;let e=/^[^:]*:\/*/.exec(this.base)[0],r=["^",ct(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]===Xn?l=s.lastIndex-1:(r.push(ct(o[0]),"(?:"),i.push(")?"),o[1]!==oi?n.push(u=s.lastIndex):(a=u=s.lastIndex,l=this.base.indexOf(Xn,a),this._pathReplacements[a]=oi));for(let f=0;f<n.length;f++)this._pathReplacements[n[f]]=gu.repeat(n.length-f-1);return this._pathReplacements[n[n.length-1]]=Jn,this._baseLength=l>0?l:this.base.length,r.push(ct(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!==oi&&!yu.test(s)?e:n===Jn&&/^[^?#]/.test(s)&&(s.indexOf(":")<0||!/^[^/?#]*:/.test(s))?s:n+s}return e.substring(i-1)}};var Wt=Y.defaultGraph(),{rdf:mu,xsd:dt}=N,{hasOwnProperty:wu}=Object.prototype,xu=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,Eu=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Su=/[^ !#-\[\]-~\u0080-\uFFFD]/,Iu=/[^ !#-\[\]-~\u0080-\uFFFD]/g,es={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"},ze=class extends V{equals(e){return e===this}},le=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._escape=Su,this._escapeAll=Iu,this._characterReplacer=Tu):(this._lineMode=!1,this._escape=xu,this._escapeAll=Eu,this._characterReplacer=Ru,this._graph=Wt,this._prefixIRIs=Object.create(null),this._prefixPatterns=Object.create(null),r.baseIRI&&(this._baseIri=new Qe(r.baseIRI),r.writeBase!==!1&&this._write(`@base <${r.baseIRI}>.
|
|
4
|
-
`))
|
|
1
|
+
var ql=Object.create;var fr=Object.defineProperty,Wl=Object.defineProperties,Gl=Object.getOwnPropertyDescriptor,Ql=Object.getOwnPropertyDescriptors,zl=Object.getOwnPropertyNames,On=Object.getOwnPropertySymbols,Vl=Object.getPrototypeOf,$n=Object.prototype.hasOwnProperty,Hl=Object.prototype.propertyIsEnumerable;var lt=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Kl=t=>{throw TypeError(t)};var Mn=(t,e,r)=>e in t?fr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$=(t,e)=>{for(var r in e||(e={}))$n.call(e,r)&&Mn(t,r,e[r]);if(On)for(var r of On(e))Hl.call(e,r)&&Mn(t,r,e[r]);return t},Ce=(t,e)=>Wl(t,Ql(e));var T=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Yl=(t,e)=>{for(var r in e)fr(t,r,{get:e[r],enumerable:!0})},Jl=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of zl(e))!$n.call(t,n)&&n!==r&&fr(t,n,{get:()=>e[n],enumerable:!(i=Gl(e,n))||i.enumerable});return t};var ei=(t,e,r)=>(r=t!=null?ql(Vl(t)):{},Jl(e||!t||!t.__esModule?fr(r,"default",{value:t,enumerable:!0}):r,t));var W=function(t,e){this[0]=t,this[1]=e},ee=(t,e,r)=>{var i=(a,l,u,f)=>{try{var c=r[a](l),d=(l=c.value)instanceof W,_=c.done;Promise.resolve(d?l[0]:l).then(p=>d?i(a==="return"?a:"next",l[1]?{done:p.done,value:p.value}:p,u,f):u({value:p,done:_})).catch(p=>i("throw",p,u,f))}catch(p){f(p)}},n=(a,l,u,f)=>o[a]=c=>(l=new Promise((d,_,p)=>(p=()=>i(a,c,d,_),s?s.then(p):p())),f=()=>s===u&&(s=0),s=u=l.then(f,f),l),s,o={};return r=r.apply(t,e),o[lt("asyncIterator")]=()=>o,n("next"),n("throw"),n("return"),o},ne=t=>{var e=t[lt("asyncIterator")],r=!1,i,n={};return e==null?(e=t[lt("iterator")](),i=s=>n[s]=o=>e[s](o)):(e=e.call(t),i=s=>n[s]=o=>{if(r){if(r=!1,s==="throw")throw o;return o}return r=!0,{done:!1,value:new W(new Promise(a=>{var l=e[s](o);l instanceof Object||Kl("Object expected"),a(l)}),1)}}),n[lt("iterator")]=()=>n,i("next"),"throw"in e?i("throw"):n.throw=s=>{throw s},"return"in e&&i("return"),n},Y=(t,e,r)=>(e=t[lt("asyncIterator")])?e.call(t):(t=t[lt("iterator")](),e={},r=(i,n)=>(n=t[i])&&(e[i]=s=>new Promise((o,a,l)=>(s=n.call(t,s),l=s.done,Promise.resolve(s.value).then(u=>o({value:u,done:l}),a)))),r("next"),r("return"),e);var ns=T(_r=>{"use strict";_r.byteLength=ju;_r.toByteArray=Cu;_r.fromByteArray=Du;var ue=[],te=[],Pu=typeof Uint8Array!="undefined"?Uint8Array:Array,ai="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ve=0,rs=ai.length;Ve<rs;++Ve)ue[Ve]=ai[Ve],te[ai.charCodeAt(Ve)]=Ve;var Ve,rs;te[45]=62;te[95]=63;function is(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 ju(t){var e=is(t),r=e[0],i=e[1];return(r+i)*3/4-i}function Lu(t,e,r){return(e+r)*3/4-r}function Cu(t){var e,r=is(t),i=r[0],n=r[1],s=new Pu(Lu(t,i,n)),o=0,a=n>0?i-4:i,l;for(l=0;l<a;l+=4)e=te[t.charCodeAt(l)]<<18|te[t.charCodeAt(l+1)]<<12|te[t.charCodeAt(l+2)]<<6|te[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return n===2&&(e=te[t.charCodeAt(l)]<<2|te[t.charCodeAt(l+1)]>>4,s[o++]=e&255),n===1&&(e=te[t.charCodeAt(l)]<<10|te[t.charCodeAt(l+1)]<<4|te[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function Fu(t){return ue[t>>18&63]+ue[t>>12&63]+ue[t>>6&63]+ue[t&63]}function Bu(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(Fu(i));return n.join("")}function Du(t){for(var e,r=t.length,i=r%3,n=[],s=16383,o=0,a=r-i;o<a;o+=s)n.push(Bu(t,o,o+s>a?a:o+s));return i===1?(e=t[r-1],n.push(ue[e>>2]+ue[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(ue[e>>10]+ue[e>>4&63]+ue[e<<2&63]+"=")),n.join("")}});var ss=T(li=>{li.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,d=r?-1:1,_=t[e+c];for(c+=d,s=_&(1<<-f)-1,_>>=-f,f+=a;f>0;s=s*256+t[e+c],c+=d,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=i;f>0;o=o*256+t[e+c],c+=d,f-=8);if(s===0)s=1-u;else{if(s===l)return o?NaN:(_?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-u}return(_?-1:1)*o*Math.pow(2,s-i)};li.write=function(t,e,r,i,n,s){var o,a,l,u=s*8-n-1,f=(1<<u)-1,c=f>>1,d=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=i?0:s-1,p=i?1:-1,h=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+=d/l:e+=d*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+_]=a&255,_+=p,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;t[r+_]=o&255,_+=p,o/=256,u-=8);t[r+_-p]|=h*128}});var Ie=T(gt=>{"use strict";var ui=ns(),bt=ss(),os=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;gt.Buffer=b;gt.SlowBuffer=qu;gt.INSPECT_MAX_BYTES=50;var pr=2147483647;gt.kMaxLength=pr;b.TYPED_ARRAY_SUPPORT=Ou();!b.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&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 Ou(){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(t){return!1}}Object.defineProperty(b.prototype,"parent",{enumerable:!0,get:function(){if(b.isBuffer(this))return this.buffer}});Object.defineProperty(b.prototype,"offset",{enumerable:!0,get:function(){if(b.isBuffer(this))return this.byteOffset}});function Se(t){if(t>pr)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,b.prototype),e}function b(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 hi(t)}return fs(t,e,r)}b.poolSize=8192;function fs(t,e,r){if(typeof t=="string")return $u(t,e);if(ArrayBuffer.isView(t))return ku(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(fe(t,ArrayBuffer)||t&&fe(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(fe(t,SharedArrayBuffer)||t&&fe(t.buffer,SharedArrayBuffer)))return ci(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 b.from(i,e,r);let n=Uu(t);if(n)return n;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return b.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)}b.from=function(t,e,r){return fs(t,e,r)};Object.setPrototypeOf(b.prototype,Uint8Array.prototype);Object.setPrototypeOf(b,Uint8Array);function cs(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 Mu(t,e,r){return cs(t),t<=0?Se(t):e!==void 0?typeof r=="string"?Se(t).fill(e,r):Se(t).fill(e):Se(t)}b.alloc=function(t,e,r){return Mu(t,e,r)};function hi(t){return cs(t),Se(t<0?0:_i(t)|0)}b.allocUnsafe=function(t){return hi(t)};b.allocUnsafeSlow=function(t){return hi(t)};function $u(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!b.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=ds(t,e)|0,i=Se(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function fi(t){let e=t.length<0?0:_i(t.length)|0,r=Se(e);for(let i=0;i<e;i+=1)r[i]=t[i]&255;return r}function ku(t){if(fe(t,Uint8Array)){let e=new Uint8Array(t);return ci(e.buffer,e.byteOffset,e.byteLength)}return fi(t)}function ci(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,b.prototype),i}function Uu(t){if(b.isBuffer(t)){let e=_i(t.length)|0,r=Se(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||bi(t.length)?Se(0):fi(t);if(t.type==="Buffer"&&Array.isArray(t.data))return fi(t.data)}function _i(t){if(t>=pr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+pr.toString(16)+" bytes");return t|0}function qu(t){return+t!=t&&(t=0),b.alloc(+t)}b.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==b.prototype};b.compare=function(e,r){if(fe(e,Uint8Array)&&(e=b.from(e,e.offset,e.byteLength)),fe(r,Uint8Array)&&(r=b.from(r,r.offset,r.byteLength)),!b.isBuffer(e)||!b.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};b.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}};b.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return b.alloc(0);let i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;let n=b.allocUnsafe(r),s=0;for(i=0;i<e.length;++i){let o=e[i];if(fe(o,Uint8Array))s+o.length>n.length?(b.isBuffer(o)||(o=b.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(b.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function ds(t,e){if(b.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||fe(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 di(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return xs(t).length;default:if(n)return i?-1:di(t).length;e=(""+e).toLowerCase(),n=!0}}b.byteLength=ds;function Wu(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 Xu(this,e,r);case"utf8":case"utf-8":return _s(this,e,r);case"ascii":return Ju(this,e,r);case"latin1":case"binary":return Zu(this,e,r);case"base64":return Ku(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ef(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}b.prototype._isBuffer=!0;function He(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}b.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)He(this,r,r+1);return this};b.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)He(this,r,r+3),He(this,r+1,r+2);return this};b.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)He(this,r,r+7),He(this,r+1,r+6),He(this,r+2,r+5),He(this,r+3,r+4);return this};b.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?_s(this,0,e):Wu.apply(this,arguments)};b.prototype.toLocaleString=b.prototype.toString;b.prototype.equals=function(e){if(!b.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:b.compare(this,e)===0};b.prototype.inspect=function(){let e="",r=gt.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};os&&(b.prototype[os]=b.prototype.inspect);b.prototype.compare=function(e,r,i,n,s){if(fe(e,Uint8Array)&&(e=b.from(e,e.offset,e.byteLength)),!b.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 hs(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,bi(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=b.from(e,i)),b.isBuffer(e))return e.length===0?-1:as(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):as(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function as(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}b.prototype.includes=function(e,r,i){return this.indexOf(e,r,i)!==-1};b.prototype.indexOf=function(e,r,i){return hs(this,e,r,i,!0)};b.prototype.lastIndexOf=function(e,r,i){return hs(this,e,r,i,!1)};function Gu(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(bi(a))return o;t[r+o]=a}return o}function Qu(t,e,r,i){return br(di(e,t.length-r),t,r,i)}function zu(t,e,r,i){return br(sf(e),t,r,i)}function Vu(t,e,r,i){return br(xs(e),t,r,i)}function Hu(t,e,r,i){return br(of(e,t.length-r),t,r,i)}b.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 Gu(this,e,r,i);case"utf8":case"utf-8":return Qu(this,e,r,i);case"ascii":case"latin1":case"binary":return zu(this,e,r,i);case"base64":return Vu(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Hu(this,e,r,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};b.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ku(t,e,r){return e===0&&r===t.length?ui.fromByteArray(t):ui.fromByteArray(t.slice(e,r))}function _s(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 Yu(i)}var ls=4096;function Yu(t){let e=t.length;if(e<=ls)return String.fromCharCode.apply(String,t);let r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=ls));return r}function Ju(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 Zu(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 Xu(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+=af[t[s]];return n}function ef(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}b.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,b.prototype),n};function q(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")}b.prototype.readUintLE=b.prototype.readUIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||q(e,r,this.length);let n=this[e],s=1,o=0;for(;++o<r&&(s*=256);)n+=this[e+o]*s;return n};b.prototype.readUintBE=b.prototype.readUIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||q(e,r,this.length);let n=this[e+--r],s=1;for(;r>0&&(s*=256);)n+=this[e+--r]*s;return n};b.prototype.readUint8=b.prototype.readUInt8=function(e,r){return e=e>>>0,r||q(e,1,this.length),this[e]};b.prototype.readUint16LE=b.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||q(e,2,this.length),this[e]|this[e+1]<<8};b.prototype.readUint16BE=b.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||q(e,2,this.length),this[e]<<8|this[e+1]};b.prototype.readUint32LE=b.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||q(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};b.prototype.readUint32BE=b.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||q(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};b.prototype.readBigUInt64LE=Oe(function(e){e=e>>>0,yt(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Qt(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))});b.prototype.readBigUInt64BE=Oe(function(e){e=e>>>0,yt(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Qt(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)});b.prototype.readIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||q(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};b.prototype.readIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||q(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};b.prototype.readInt8=function(e,r){return e=e>>>0,r||q(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};b.prototype.readInt16LE=function(e,r){e=e>>>0,r||q(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};b.prototype.readInt16BE=function(e,r){e=e>>>0,r||q(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};b.prototype.readInt32LE=function(e,r){return e=e>>>0,r||q(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};b.prototype.readInt32BE=function(e,r){return e=e>>>0,r||q(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};b.prototype.readBigInt64LE=Oe(function(e){e=e>>>0,yt(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Qt(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)});b.prototype.readBigInt64BE=Oe(function(e){e=e>>>0,yt(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Qt(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)});b.prototype.readFloatLE=function(e,r){return e=e>>>0,r||q(e,4,this.length),bt.read(this,e,!0,23,4)};b.prototype.readFloatBE=function(e,r){return e=e>>>0,r||q(e,4,this.length),bt.read(this,e,!1,23,4)};b.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||q(e,8,this.length),bt.read(this,e,!0,52,8)};b.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||q(e,8,this.length),bt.read(this,e,!1,52,8)};function Z(t,e,r,i,n,s){if(!b.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")}b.prototype.writeUintLE=b.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;Z(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};b.prototype.writeUintBE=b.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;Z(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};b.prototype.writeUint8=b.prototype.writeUInt8=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,1,255,0),this[r]=e&255,r+1};b.prototype.writeUint16LE=b.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};b.prototype.writeUint16BE=b.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};b.prototype.writeUint32LE=b.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||Z(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};b.prototype.writeUint32BE=b.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||Z(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 ps(t,e,r,i,n){ws(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 bs(t,e,r,i,n){ws(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}b.prototype.writeBigUInt64LE=Oe(function(e,r=0){return ps(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});b.prototype.writeBigUInt64BE=Oe(function(e,r=0){return bs(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});b.prototype.writeIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);Z(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};b.prototype.writeIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);Z(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};b.prototype.writeInt8=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};b.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};b.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};b.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||Z(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};b.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||Z(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};b.prototype.writeBigInt64LE=Oe(function(e,r=0){return ps(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});b.prototype.writeBigInt64BE=Oe(function(e,r=0){return bs(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ys(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 gs(t,e,r,i,n){return e=+e,r=r>>>0,n||ys(t,e,r,4,34028234663852886e22,-34028234663852886e22),bt.write(t,e,r,i,23,4),r+4}b.prototype.writeFloatLE=function(e,r,i){return gs(this,e,r,!0,i)};b.prototype.writeFloatBE=function(e,r,i){return gs(this,e,r,!1,i)};function ms(t,e,r,i,n){return e=+e,r=r>>>0,n||ys(t,e,r,8,17976931348623157e292,-17976931348623157e292),bt.write(t,e,r,i,52,8),r+8}b.prototype.writeDoubleLE=function(e,r,i){return ms(this,e,r,!0,i)};b.prototype.writeDoubleBE=function(e,r,i){return ms(this,e,r,!1,i)};b.prototype.copy=function(e,r,i,n){if(!b.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};b.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"&&!b.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=b.isBuffer(e)?e:b.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 pt={};function pi(t,e,r){pt[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}`}}}pi("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);pi("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);pi("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=us(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=us(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function us(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 tf(t,e,r){yt(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Qt(e,t.length-(r+1))}function ws(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 pt.ERR_OUT_OF_RANGE("value",a,t)}tf(i,n,s)}function yt(t,e){if(typeof t!="number")throw new pt.ERR_INVALID_ARG_TYPE(e,"number",t)}function Qt(t,e,r){throw Math.floor(t)!==t?(yt(t,r),new pt.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new pt.ERR_BUFFER_OUT_OF_BOUNDS:new pt.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var rf=/[^+/0-9A-Za-z-_]/g;function nf(t){if(t=t.split("=")[0],t=t.trim().replace(rf,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function di(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 sf(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function of(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 xs(t){return ui.toByteArray(nf(t))}function br(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 fe(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function bi(t){return t!==t}var af=(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 Oe(t){return typeof BigInt=="undefined"?lf:t}function lf(){throw new Error("BigInt not supported")}});var L=T((cb,Es)=>{"use strict";var yi=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}};Es.exports={AggregateError:yi,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 gi=T((db,Ss)=>{"use strict";Ss.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 Q=T((hb,Ts)=>{"use strict";var{format:uf,inspect:yr}=gi(),{AggregateError:ff}=L(),cf=globalThis.AggregateError||ff,df=Symbol("kIsNodeError"),hf=["string","function","number","object","Function","Object","boolean","bigint","symbol"],_f=/^([A-Z][a-z0-9]*)+$/,pf="__node_internal_",gr={};function Ke(t,e){if(!t)throw new gr.ERR_INTERNAL_ASSERTION(e)}function Is(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 bf(t,e,r){if(typeof e=="function")return Ke(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 Ke(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:uf(e,...r)}function G(t,e,r){r||(r=Error);class i extends r{constructor(...s){super(bf(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[df]=!0,gr[t]=i}function Rs(t){let e=pf+t.name;return Object.defineProperty(t,"name",{value:e}),t}function yf(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new cf([e,t],e.message);return r.code=e.code,r}return t||e}var mi=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new gr.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};G("ERR_ASSERTION","%s",Error);G("ERR_INVALID_ARG_TYPE",(t,e,r)=>{Ke(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)Ke(typeof l=="string","All expected entries have to be of type string"),hf.includes(l)?n.push(l.toLowerCase()):_f.test(l)?s.push(l):(Ke(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=yr(r,{depth:-1});i+=`. Received ${l}`}}else{let l=yr(r,{colors:!1});l.length>25&&(l=`${l.slice(0,25)}...`),i+=`. Received type ${typeof r} (${l})`}return i},TypeError);G("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let i=yr(e);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${i}`},TypeError);G("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);G("ERR_MISSING_ARGS",(...t)=>{Ke(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);G("ERR_OUT_OF_RANGE",(t,e,r)=>{Ke(e,'Missing "range" argument');let i;if(Number.isInteger(r)&&Math.abs(r)>2**32)i=Is(String(r));else if(typeof r=="bigint"){i=String(r);let n=BigInt(2)**BigInt(32);(r>n||r<-n)&&(i=Is(i)),i+="n"}else i=yr(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${i}`},RangeError);G("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);G("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);G("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);G("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);G("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);G("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);G("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);G("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);G("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);G("ERR_STREAM_WRITE_AFTER_END","write after end",Error);G("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Ts.exports={AbortError:mi,aggregateTwoErrors:Rs(yf),hideStackFrames:Rs,codes:gr}});var mt=T((_b,mr)=>{"use strict";var{AbortController:As,AbortSignal:gf}=typeof self!="undefined"?self:typeof window!="undefined"?window:void 0;mr.exports=As;mr.exports.AbortSignal=gf;mr.exports.default=As});var zt=T((pb,wi)=>{"use strict";var wt=typeof Reflect=="object"?Reflect:null,vs=wt&&typeof wt.apply=="function"?wt.apply:function(e,r,i){return Function.prototype.apply.call(e,r,i)},wr;wt&&typeof wt.ownKeys=="function"?wr=wt.ownKeys:Object.getOwnPropertySymbols?wr=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:wr=function(e){return Object.getOwnPropertyNames(e)};function mf(t){console&&console.warn&&console.warn(t)}var Ps=Number.isNaN||function(e){return e!==e};function v(){v.init.call(this)}wi.exports=v;wi.exports.once=Sf;v.EventEmitter=v;v.prototype._events=void 0;v.prototype._eventsCount=0;v.prototype._maxListeners=void 0;var Ns=10;function xr(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(v,"defaultMaxListeners",{enumerable:!0,get:function(){return Ns},set:function(t){if(typeof t!="number"||t<0||Ps(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ns=t}});v.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};v.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ps(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 js(t){return t._maxListeners===void 0?v.defaultMaxListeners:t._maxListeners}v.prototype.getMaxListeners=function(){return js(this)};v.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")vs(l,this,r);else for(var u=l.length,f=Ds(l,u),i=0;i<u;++i)vs(f[i],this,r);return!0};function Ls(t,e,r,i){var n,s,o;if(xr(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=js(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,mf(a)}return t}v.prototype.addListener=function(e,r){return Ls(this,e,r,!1)};v.prototype.on=v.prototype.addListener;v.prototype.prependListener=function(e,r){return Ls(this,e,r,!0)};function wf(){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 Cs(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=wf.bind(i);return n.listener=r,i.wrapFn=n,n}v.prototype.once=function(e,r){return xr(r),this.on(e,Cs(this,e,r)),this};v.prototype.prependOnceListener=function(e,r){return xr(r),this.prependListener(e,Cs(this,e,r)),this};v.prototype.removeListener=function(e,r){var i,n,s,o,a;if(xr(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():xf(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};v.prototype.off=v.prototype.removeListener;v.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 Fs(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?Ef(n):Ds(n,n.length)}v.prototype.listeners=function(e){return Fs(this,e,!0)};v.prototype.rawListeners=function(e){return Fs(this,e,!1)};v.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Bs.call(t,e)};v.prototype.listenerCount=Bs;function Bs(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}v.prototype.eventNames=function(){return this._eventsCount>0?wr(this._events):[]};function Ds(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function xf(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Ef(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Sf(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))}Os(t,e,s,{once:!0}),e!=="error"&&If(t,n,{once:!0})})}function If(t,e,r){typeof t.on=="function"&&Os(t,"error",e,r)}function Os(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 K=T((bb,Ei)=>{"use strict";var Rf=Ie(),{format:Tf,inspect:Af}=gi(),{codes:{ERR_INVALID_ARG_TYPE:xi}}=Q(),{kResistStopPropagation:vf,AggregateError:Nf,SymbolDispose:Pf}=L(),jf=globalThis.AbortSignal||mt().AbortSignal,Lf=globalThis.AbortController||mt().AbortController,Cf=Object.getPrototypeOf(async function(){}).constructor,Ms=globalThis.Blob||Rf.Blob,Ff=typeof Ms!="undefined"?function(e){return e instanceof Ms}:function(e){return!1},$s=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new xi(e,"AbortSignal",t)},Bf=(t,e)=>{if(typeof t!="function")throw new xi(e,"Function",t)};Ei.exports={AggregateError:Nf,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:Tf,inspect:Af,types:{isAsyncFunction(t){return t instanceof Cf},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Ff,deprecate(t,e){return t},addAbortListener:zt().addAbortListener||function(e,r){if(e===void 0)throw new xi("signal","AbortSignal",e);$s(e,"signal"),Bf(r,"listener");let i;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[vf]:!0}),i=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[Pf](){var n;(n=i)===null||n===void 0||n()}}},AbortSignalAny:jf.any||function(e){if(e.length===1)return e[0];let r=new Lf,i=()=>r.abort();return e.forEach(n=>{$s(n,"signals"),n.addEventListener("abort",i,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",i))},{once:!0}),r.signal}};Ei.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Et=T((yb,Ks)=>{"use strict";var{ArrayIsArray:Ii,ArrayPrototypeIncludes:Ws,ArrayPrototypeJoin:Gs,ArrayPrototypeMap:Df,NumberIsInteger:Ri,NumberIsNaN:Of,NumberMAX_SAFE_INTEGER:Mf,NumberMIN_SAFE_INTEGER:$f,NumberParseInt:kf,ObjectPrototypeHasOwnProperty:Uf,RegExpPrototypeExec:Qs,String:qf,StringPrototypeToUpperCase:Wf,StringPrototypeTrim:Gf}=L(),{hideStackFrames:re,codes:{ERR_SOCKET_BAD_PORT:Qf,ERR_INVALID_ARG_TYPE:z,ERR_INVALID_ARG_VALUE:xt,ERR_OUT_OF_RANGE:Ye,ERR_UNKNOWN_SIGNAL:ks}}=Q(),{normalizeEncoding:zf}=K(),{isAsyncFunction:Vf,isArrayBufferView:Hf}=K().types,Us={};function Kf(t){return t===(t|0)}function Yf(t){return t===t>>>0}var Jf=/^[0-7]+$/,Zf="must be a 32-bit unsigned integer or an octal string";function Xf(t,e,r){if(typeof t=="undefined"&&(t=r),typeof t=="string"){if(Qs(Jf,t)===null)throw new xt(e,t,Zf);t=kf(t,8)}return zs(t,e),t}var ec=re((t,e,r=$f,i=Mf)=>{if(typeof t!="number")throw new z(e,"number",t);if(!Ri(t))throw new Ye(e,"an integer",t);if(t<r||t>i)throw new Ye(e,`>= ${r} && <= ${i}`,t)}),tc=re((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!="number")throw new z(e,"number",t);if(!Ri(t))throw new Ye(e,"an integer",t);if(t<r||t>i)throw new Ye(e,`>= ${r} && <= ${i}`,t)}),zs=re((t,e,r=!1)=>{if(typeof t!="number")throw new z(e,"number",t);if(!Ri(t))throw new Ye(e,"an integer",t);let i=r?1:0,n=4294967295;if(t<i||t>n)throw new Ye(e,`>= ${i} && <= ${n}`,t)});function Ti(t,e){if(typeof t!="string")throw new z(e,"string",t)}function rc(t,e,r=void 0,i){if(typeof t!="number")throw new z(e,"number",t);if(r!=null&&t<r||i!=null&&t>i||(r!=null||i!=null)&&Of(t))throw new Ye(e,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,t)}var ic=re((t,e,r)=>{if(!Ws(r,t)){let n="must be one of: "+Gs(Df(r,s=>typeof s=="string"?`'${s}'`:qf(s)),", ");throw new xt(e,t,n)}});function Vs(t,e){if(typeof t!="boolean")throw new z(e,"boolean",t)}function Si(t,e,r){return t==null||!Uf(t,e)?r:t[e]}var nc=re((t,e,r=null)=>{let i=Si(r,"allowArray",!1),n=Si(r,"allowFunction",!1);if(!Si(r,"nullable",!1)&&t===null||!i&&Ii(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new z(e,"Object",t)}),sc=re((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new z(e,"a dictionary",t)}),Er=re((t,e,r=0)=>{if(!Ii(t))throw new z(e,"Array",t);if(t.length<r){let i=`must be longer than ${r}`;throw new xt(e,t,i)}});function oc(t,e){Er(t,e);for(let r=0;r<t.length;r++)Ti(t[r],`${e}[${r}]`)}function ac(t,e){Er(t,e);for(let r=0;r<t.length;r++)Vs(t[r],`${e}[${r}]`)}function lc(t,e){Er(t,e);for(let r=0;r<t.length;r++){let i=t[r],n=`${e}[${r}]`;if(i==null)throw new z(n,"AbortSignal",i);Hs(i,n)}}function uc(t,e="signal"){if(Ti(t,e),Us[t]===void 0)throw Us[Wf(t)]!==void 0?new ks(t+" (signals must use all capital letters)"):new ks(t)}var fc=re((t,e="buffer")=>{if(!Hf(t))throw new z(e,["Buffer","TypedArray","DataView"],t)});function cc(t,e){let r=zf(e),i=t.length;if(r==="hex"&&i%2!==0)throw new xt("encoding",e,`is invalid for data of length ${i}`)}function dc(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&Gf(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new Qf(e,t,r);return t|0}var Hs=re((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new z(e,"AbortSignal",t)}),hc=re((t,e)=>{if(typeof t!="function")throw new z(e,"Function",t)}),_c=re((t,e)=>{if(typeof t!="function"||Vf(t))throw new z(e,"Function",t)}),pc=re((t,e)=>{if(t!==void 0)throw new z(e,"undefined",t)});function bc(t,e,r){if(!Ws(r,t))throw new z(e,`('${Gs(r,"|")}')`,t)}var yc=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function qs(t,e){if(typeof t=="undefined"||!Qs(yc,t))throw new xt(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function gc(t){if(typeof t=="string")return qs(t,"hints"),t;if(Ii(t)){let e=t.length,r="";if(e===0)return r;for(let i=0;i<e;i++){let n=t[i];qs(n,"hints"),r+=n,i!==e-1&&(r+=", ")}return r}throw new xt("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Ks.exports={isInt32:Kf,isUint32:Yf,parseFileMode:Xf,validateArray:Er,validateStringArray:oc,validateBooleanArray:ac,validateAbortSignalArray:lc,validateBoolean:Vs,validateBuffer:fc,validateDictionary:sc,validateEncoding:cc,validateFunction:hc,validateInt32:tc,validateInteger:ec,validateNumber:rc,validateObject:nc,validateOneOf:ic,validatePlainFunction:_c,validatePort:dc,validateSignalName:uc,validateString:Ti,validateUint32:zs,validateUndefined:pc,validateUnion:bc,validateAbortSignal:Hs,validateLinkHeaderValue:gc}});var Me=T((gb,Xs)=>{var B=Xs.exports={},ce,de;function Ai(){throw new Error("setTimeout has not been defined")}function vi(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ce=setTimeout:ce=Ai}catch(t){ce=Ai}try{typeof clearTimeout=="function"?de=clearTimeout:de=vi}catch(t){de=vi}})();function Ys(t){if(ce===setTimeout)return setTimeout(t,0);if((ce===Ai||!ce)&&setTimeout)return ce=setTimeout,setTimeout(t,0);try{return ce(t,0)}catch(e){try{return ce.call(null,t,0)}catch(r){return ce.call(this,t,0)}}}function mc(t){if(de===clearTimeout)return clearTimeout(t);if((de===vi||!de)&&clearTimeout)return de=clearTimeout,clearTimeout(t);try{return de(t)}catch(e){try{return de.call(null,t)}catch(r){return de.call(this,t)}}}var Re=[],St=!1,Je,Sr=-1;function wc(){!St||!Je||(St=!1,Je.length?Re=Je.concat(Re):Sr=-1,Re.length&&Js())}function Js(){if(!St){var t=Ys(wc);St=!0;for(var e=Re.length;e;){for(Je=Re,Re=[];++Sr<e;)Je&&Je[Sr].run();Sr=-1,e=Re.length}Je=null,St=!1,mc(t)}}B.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];Re.push(new Zs(t,e)),Re.length===1&&!St&&Ys(Js)};function Zs(t,e){this.fun=t,this.array=e}Zs.prototype.run=function(){this.fun.apply(null,this.array)};B.title="browser";B.browser=!0;B.env={};B.argv=[];B.version="";B.versions={};function Te(){}B.on=Te;B.addListener=Te;B.once=Te;B.off=Te;B.removeListener=Te;B.removeAllListeners=Te;B.emit=Te;B.prependListener=Te;B.prependOnceListener=Te;B.listeners=function(t){return[]};B.binding=function(t){throw new Error("process.binding is not supported")};B.cwd=function(){return"/"};B.chdir=function(t){throw new Error("process.chdir is not supported")};B.umask=function(){return 0}});var _e=T((mb,po)=>{"use strict";var{SymbolAsyncIterator:eo,SymbolIterator:to,SymbolFor:Ze}=L(),ro=Ze("nodejs.stream.destroyed"),io=Ze("nodejs.stream.errored"),Ni=Ze("nodejs.stream.readable"),Pi=Ze("nodejs.stream.writable"),no=Ze("nodejs.stream.disturbed"),xc=Ze("nodejs.webstream.isClosedPromise"),Ec=Ze("nodejs.webstream.controllerErrorFunction");function Ir(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 Rr(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 Sc(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function he(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function so(t){return!!(t&&!he(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function oo(t){return!!(t&&!he(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function ao(t){return!!(t&&!he(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function Ic(t){return so(t)||oo(t)||ao(t)}function Rc(t,e){return t==null?!1:e===!0?typeof t[eo]=="function":e===!1?typeof t[to]=="function":typeof t[eo]=="function"||typeof t[to]=="function"}function Tr(t){if(!he(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[ro]||i!=null&&i.destroyed)}function lo(t){if(!Rr(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof(e==null?void 0:e.ended)!="boolean"?null:e.ended}function Tc(t,e){if(!Rr(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof(r==null?void 0:r.finished)!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function Ac(t){if(!Ir(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof(e==null?void 0:e.ended)!="boolean"?null:e.ended}function uo(t,e){if(!Ir(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof(r==null?void 0:r.endEmitted)!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function fo(t){return t&&t[Ni]!=null?t[Ni]:typeof(t==null?void 0:t.readable)!="boolean"?null:Tr(t)?!1:Ir(t)&&t.readable&&!uo(t)}function co(t){return t&&t[Pi]!=null?t[Pi]:typeof(t==null?void 0:t.writable)!="boolean"?null:Tr(t)?!1:Rr(t)&&t.writable&&!lo(t)}function vc(t,e){return he(t)?Tr(t)?!0:!((e==null?void 0:e.readable)!==!1&&fo(t)||(e==null?void 0:e.writable)!==!1&&co(t)):null}function Nc(t){var e,r;return he(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 Pc(t){var e,r;return he(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 jc(t){if(!he(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof(e==null?void 0:e.closed)=="boolean"||typeof(r==null?void 0:r.closed)=="boolean"?(e==null?void 0:e.closed)||(r==null?void 0:r.closed):typeof t._closed=="boolean"&&ho(t)?t._closed:null}function ho(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function _o(t){return typeof t._sent100=="boolean"&&ho(t)}function Lc(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 Cc(t){if(!he(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&_o(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}function Fc(t){var e;return!!(t&&((e=t[no])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function Bc(t){var e,r,i,n,s,o,a,l,u,f;return!!(t&&((e=(r=(i=(n=(s=(o=t[io])!==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))}po.exports={isDestroyed:Tr,kIsDestroyed:ro,isDisturbed:Fc,kIsDisturbed:no,isErrored:Bc,kIsErrored:io,isReadable:fo,kIsReadable:Ni,kIsClosedPromise:xc,kControllerErrorFunction:Ec,kIsWritable:Pi,isClosed:jc,isDuplexNodeStream:Sc,isFinished:vc,isIterable:Rc,isReadableNodeStream:Ir,isReadableStream:so,isReadableEnded:Ac,isReadableFinished:uo,isReadableErrored:Pc,isNodeStream:he,isWebStream:Ic,isWritable:co,isWritableNodeStream:Rr,isWritableStream:oo,isWritableEnded:lo,isWritableFinished:Tc,isWritableErrored:Nc,isServerRequest:Lc,isServerResponse:_o,willEmitClose:Cc,isTransformStream:ao}});var Ae=T((wb,Bi)=>{"use strict";var $e=Me(),{AbortError:Io,codes:Dc}=Q(),{ERR_INVALID_ARG_TYPE:Oc,ERR_STREAM_PREMATURE_CLOSE:bo}=Dc,{kEmptyObject:Li,once:Ci}=K(),{validateAbortSignal:Mc,validateFunction:$c,validateObject:kc,validateBoolean:Uc}=Et(),{Promise:qc,PromisePrototypeThen:Wc,SymbolDispose:Ro}=L(),{isClosed:Gc,isReadable:yo,isReadableNodeStream:ji,isReadableStream:Qc,isReadableFinished:go,isReadableErrored:mo,isWritable:wo,isWritableNodeStream:xo,isWritableStream:zc,isWritableFinished:Eo,isWritableErrored:So,isNodeStream:Vc,willEmitClose:Hc,kIsClosedPromise:Kc}=_e(),It;function Yc(t){return t.setHeader&&typeof t.abort=="function"}var Fi=()=>{};function To(t,e,r){var i,n;if(arguments.length===2?(r=e,e=Li):e==null?e=Li:kc(e,"options"),$c(r,"callback"),Mc(e.signal,"options.signal"),r=Ci(r),Qc(t)||zc(t))return Jc(t,e,r);if(!Vc(t))throw new Oc("stream",["ReadableStream","WritableStream","Stream"],t);let s=(i=e.readable)!==null&&i!==void 0?i:ji(t),o=(n=e.writable)!==null&&n!==void 0?n:xo(t),a=t._writableState,l=t._readableState,u=()=>{t.writable||d()},f=Hc(t)&&ji(t)===s&&xo(t)===o,c=Eo(t,!1),d=()=>{c=!0,t.destroyed&&(f=!1),!(f&&(!t.readable||s))&&(!s||_)&&r.call(t)},_=go(t,!1),p=()=>{_=!0,t.destroyed&&(f=!1),!(f&&(!t.writable||o))&&(!o||c)&&r.call(t)},h=x=>{r.call(t,x)},y=Gc(t),g=()=>{y=!0;let x=So(t)||mo(t);if(x&&typeof x!="boolean")return r.call(t,x);if(s&&!_&&ji(t,!0)&&!go(t,!1))return r.call(t,new bo);if(o&&!c&&!Eo(t,!1))return r.call(t,new bo);r.call(t)},S=()=>{y=!0;let x=So(t)||mo(t);if(x&&typeof x!="boolean")return r.call(t,x);r.call(t)},w=()=>{t.req.on("finish",d)};Yc(t)?(t.on("complete",d),f||t.on("abort",g),t.req?w():t.on("request",w)):o&&!a&&(t.on("end",u),t.on("close",u)),!f&&typeof t.aborted=="boolean"&&t.on("aborted",g),t.on("end",p),t.on("finish",d),e.error!==!1&&t.on("error",h),t.on("close",g),y?$e.nextTick(g):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?f||$e.nextTick(S):(!s&&(!f||yo(t))&&(c||wo(t)===!1)||!o&&(!f||wo(t))&&(_||yo(t)===!1)||l&&t.req&&t.aborted)&&$e.nextTick(S);let m=()=>{r=Fi,t.removeListener("aborted",g),t.removeListener("complete",d),t.removeListener("abort",g),t.removeListener("request",w),t.req&&t.req.removeListener("finish",d),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",d),t.removeListener("end",p),t.removeListener("error",h),t.removeListener("close",g)};if(e.signal&&!y){let x=()=>{let A=r;m(),A.call(t,new Io(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)$e.nextTick(x);else{It=It||K().addAbortListener;let A=It(e.signal,x),R=r;r=Ci((...M)=>{A[Ro](),R.apply(t,M)})}}return m}function Jc(t,e,r){let i=!1,n=Fi;if(e.signal)if(n=()=>{i=!0,r.call(t,new Io(void 0,{cause:e.signal.reason}))},e.signal.aborted)$e.nextTick(n);else{It=It||K().addAbortListener;let o=It(e.signal,n),a=r;r=Ci((...l)=>{o[Ro](),a.apply(t,l)})}let s=(...o)=>{i||$e.nextTick(()=>r.apply(t,o))};return Wc(t[Kc].promise,s,s),Fi}function Zc(t,e){var r;let i=!1;return e===null&&(e=Li),(r=e)!==null&&r!==void 0&&r.cleanup&&(Uc(e.cleanup,"cleanup"),i=e.cleanup),new qc((n,s)=>{let o=To(t,e,a=>{i&&o(),a?s(a):n()})})}Bi.exports=To;Bi.exports.finished=Zc});var Xe=T((xb,Fo)=>{"use strict";var pe=Me(),{aggregateTwoErrors:Xc,codes:{ERR_MULTIPLE_CALLBACK:ed},AbortError:td}=Q(),{Symbol:No}=L(),{kIsDestroyed:rd,isDestroyed:id,isFinished:nd,isServerRequest:sd}=_e(),Po=No("kDestroy"),Di=No("kConstruct");function jo(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function od(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):(jo(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?Ao(this,t,e):this.once(Po,function(s){Ao(this,Xc(s,t),e)}),this)}function Ao(t,e,r){let i=!1;function n(s){if(i)return;i=!0;let o=t._readableState,a=t._writableState;jo(s,a,o),a&&(a.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?pe.nextTick(ad,t,s):pe.nextTick(Lo,t)}try{t._destroy(e||null,n)}catch(s){n(s)}}function ad(t,e){Oi(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 Oi(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 ld(){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 Mi(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?pe.nextTick(Oi,t,e):Oi(t,e))}function ud(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(Di,e),!(t.listenerCount(Di)>1)&&pe.nextTick(fd,t)}function fd(t){let e=!1;function r(i){if(e){Mi(t,i!=null?i:new ed);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(Po,i):i?Mi(t,i,!0):pe.nextTick(cd,t)}try{t._construct(i=>{pe.nextTick(r,i)})}catch(i){pe.nextTick(r,i)}}function cd(t){t.emit(Di)}function vo(t){return(t==null?void 0:t.setHeader)&&typeof t.abort=="function"}function Co(t){t.emit("close")}function dd(t,e){t.emit("error",e),pe.nextTick(Co,t)}function hd(t,e){!t||id(t)||(!e&&!nd(t)&&(e=new td),sd(t)?(t.socket=null,t.destroy(e)):vo(t)?t.abort():vo(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?pe.nextTick(dd,t,e):pe.nextTick(Co,t),t.destroyed||(t[rd]=!0))}Fo.exports={construct:ud,destroyer:hd,destroy:od,undestroy:ld,errorOrDestroy:Mi}});var Nr=T((Eb,Do)=>{"use strict";var{ArrayIsArray:_d,ObjectSetPrototypeOf:Bo}=L(),{EventEmitter:Ar}=zt();function vr(t){Ar.call(this,t)}Bo(vr.prototype,Ar.prototype);Bo(vr,Ar);vr.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(),Ar.listenerCount(this,"error")===0&&this.emit("error",f)}$i(r,"error",l),$i(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 $i(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):_d(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}Do.exports={Stream:vr,prependListener:$i}});var Vt=T((Sb,Pr)=>{"use strict";var{SymbolDispose:pd}=L(),{AbortError:Oo,codes:bd}=Q(),{isNodeStream:Mo,isWebStream:yd,kControllerErrorFunction:gd}=_e(),md=Ae(),{ERR_INVALID_ARG_TYPE:$o}=bd,ki,wd=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new $o(e,"AbortSignal",t)};Pr.exports.addAbortSignal=function(e,r){if(wd(e,"signal"),!Mo(r)&&!yd(r))throw new $o("stream",["ReadableStream","WritableStream","Stream"],r);return Pr.exports.addAbortSignalNoValidate(e,r)};Pr.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=Mo(e)?()=>{e.destroy(new Oo(void 0,{cause:t.reason}))}:()=>{e[gd](new Oo(void 0,{cause:t.reason}))};if(t.aborted)r();else{ki=ki||K().addAbortListener;let i=ki(t,r);md(e,i[pd])}return e}});var qo=T((Rb,Uo)=>{"use strict";var{StringPrototypeSlice:ko,SymbolIterator:xd,TypedArrayPrototypeSet:jr,Uint8Array:Ed}=L(),{Buffer:Ui}=Ie(),{inspect:Sd}=K();Uo.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 Ui.alloc(0);let r=Ui.allocUnsafe(e>>>0),i=this.head,n=0;for(;i;)jr(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}*[xd](){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+=ko(s,0,e),this.head=i,i.data=ko(s,e));break}++n}while((i=i.next)!==null);return this.length-=n,r}_getBuffer(e){let r=Ui.allocUnsafe(e),i=e,n=this.head,s=0;do{let o=n.data;if(e>o.length)jr(r,o,i-e),e-=o.length;else{e===o.length?(jr(r,o,i-e),++s,n.next?this.head=n.next:this.head=this.tail=null):(jr(r,new Ed(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 Sd(this,Ce($({},r),{depth:0,customInspect:!1}))}}});var Ht=T((Ab,zo)=>{"use strict";var{MathFloor:Id,NumberIsInteger:Rd}=L(),{validateInteger:Td}=Et(),{ERR_INVALID_ARG_VALUE:Ad}=Q().codes,Wo=16*1024,Go=16;function vd(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Qo(t){return t?Go:Wo}function Nd(t,e){Td(e,"value",0),t?Go=e:Wo=e}function Pd(t,e,r,i){let n=vd(e,i,r);if(n!=null){if(!Rd(n)||n<0){let s=i?`options.${r}`:"options.highWaterMark";throw new Ad(s,n)}return Id(n)}return Qo(t.objectMode)}zo.exports={getHighWaterMark:Pd,getDefaultHighWaterMark:Qo,setDefaultHighWaterMark:Nd}});var Ko=T((qi,Ho)=>{var Lr=Ie(),be=Lr.Buffer;function Vo(t,e){for(var r in t)e[r]=t[r]}be.from&&be.alloc&&be.allocUnsafe&&be.allocUnsafeSlow?Ho.exports=Lr:(Vo(Lr,qi),qi.Buffer=et);function et(t,e,r){return be(t,e,r)}et.prototype=Object.create(be.prototype);Vo(be,et);et.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return be(t,e,r)};et.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=be(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};et.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return be(t)};et.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Lr.SlowBuffer(t)}});var Zo=T(Jo=>{"use strict";var Gi=Ko().Buffer,Yo=Gi.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 jd(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 Ld(t){var e=jd(t);if(typeof e!="string"&&(Gi.isEncoding===Yo||!Yo(t)))throw new Error("Unknown encoding: "+t);return e||t}Jo.StringDecoder=Kt;function Kt(t){this.encoding=Ld(t);var e;switch(this.encoding){case"utf16le":this.text=Md,this.end=$d,e=4;break;case"utf8":this.fillLast=Bd,e=4;break;case"base64":this.text=kd,this.end=Ud,e=3;break;default:this.write=qd,this.end=Wd;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Gi.allocUnsafe(e)}Kt.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||""};Kt.prototype.end=Od;Kt.prototype.text=Dd;Kt.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 Wi(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Cd(t,e,r){var i=e.length-1;if(i<r)return 0;var n=Wi(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=Wi(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=Wi(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}function Fd(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 Bd(t){var e=this.lastTotal-this.lastNeed,r=Fd(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 Dd(t,e){var r=Cd(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 Od(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Md(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 $d(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 kd(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 Ud(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function qd(t){return t.toString(this.encoding)}function Wd(t){return t&&t.length?this.write(t):""}});var Qi=T((Nb,ra)=>{"use strict";var Xo=Me(),{PromisePrototypeThen:Gd,SymbolAsyncIterator:ea,SymbolIterator:ta}=L(),{Buffer:Qd}=Ie(),{ERR_INVALID_ARG_TYPE:zd,ERR_STREAM_NULL_VALUES:Vd}=Q().codes;function Hd(t,e,r){let i;if(typeof e=="string"||e instanceof Qd)return new t(Ce($({objectMode:!0},r),{read(){this.push(e),this.push(null)}}));let n;if(e&&e[ea])n=!0,i=e[ea]();else if(e&&e[ta])n=!1,i=e[ta]();else throw new zd("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){Gd(a(u),()=>Xo.nextTick(f,u),c=>Xo.nextTick(f,c||u))};async function a(u){let f=u!=null,c=typeof i.throw=="function";if(f&&c){let{value:d,done:_}=await i.throw(u);if(await d,_)return}if(typeof i.return=="function"){let{value:d}=await i.return();await d}}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 Vd;if(s.push(c))continue;o=!1}}catch(u){s.destroy(u)}break}}return s}ra.exports=Hd});var Jt=T((jb,wa)=>{"use strict";var oe=Me(),{ArrayPrototypeIndexOf:Kd,NumberIsInteger:Yd,NumberIsNaN:Jd,NumberParseInt:Zd,ObjectDefineProperties:Xi,ObjectKeys:Xd,ObjectSetPrototypeOf:sa,Promise:oa,SafeSet:eh,SymbolAsyncDispose:th,SymbolAsyncIterator:rh,Symbol:ih}=L();wa.exports=E;E.ReadableState=Dr;var{EventEmitter:nh}=zt(),{Stream:ke,prependListener:sh}=Nr(),{Buffer:zi}=Ie(),{addAbortSignal:oh}=Vt(),aa=Ae(),I=K().debuglog("stream",t=>{I=t}),ah=qo(),At=Xe(),{getHighWaterMark:lh,getDefaultHighWaterMark:uh}=Ht(),{aggregateTwoErrors:ia,codes:{ERR_INVALID_ARG_TYPE:fh,ERR_METHOD_NOT_IMPLEMENTED:ch,ERR_OUT_OF_RANGE:dh,ERR_STREAM_PUSH_AFTER_EOF:hh,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:_h},AbortError:ph}=Q(),{validateObject:bh}=Et(),tt=ih("kPaused"),{StringDecoder:la}=Zo(),yh=Qi();sa(E.prototype,ke.prototype);sa(E,ke);var Vi=()=>{},{errorOrDestroy:Rt}=At,Tt=1,gh=2,ua=4,Yt=8,fa=16,Cr=32,Fr=64,ca=128,mh=256,wh=512,xh=1024,Ji=2048,Zi=4096,Eh=8192,Sh=16384,Ih=32768,da=65536,Rh=1<<17,Th=1<<18;function k(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}Xi(Dr.prototype,{objectMode:k(Tt),ended:k(gh),endEmitted:k(ua),reading:k(Yt),constructed:k(fa),sync:k(Cr),needReadable:k(Fr),emittedReadable:k(ca),readableListening:k(mh),resumeScheduled:k(wh),errorEmitted:k(xh),emitClose:k(Ji),autoDestroy:k(Zi),destroyed:k(Eh),closed:k(Sh),closeEmitted:k(Ih),multiAwaitDrain:k(da),readingMore:k(Rh),dataEmitted:k(Th)});function Dr(t,e,r){typeof r!="boolean"&&(r=e instanceof ye()),this.state=Ji|Zi|fa|Cr,t&&t.objectMode&&(this.state|=Tt),r&&t&&t.readableObjectMode&&(this.state|=Tt),this.highWaterMark=t?lh(this,t,"readableHighWaterMark",r):uh(!1),this.buffer=new ah,this.length=0,this.pipes=[],this.flowing=null,this[tt]=null,t&&t.emitClose===!1&&(this.state&=~Ji),t&&t.autoDestroy===!1&&(this.state&=~Zi),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new la(t.encoding),this.encoding=t.encoding)}function E(t){if(!(this instanceof E))return new E(t);let e=this instanceof ye();this._readableState=new Dr(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&&oh(t.signal,this)),ke.call(this,t),At.construct(this,()=>{this._readableState.needReadable&&Br(this,this._readableState)})}E.prototype.destroy=At.destroy;E.prototype._undestroy=At.undestroy;E.prototype._destroy=function(t,e){e(t)};E.prototype[nh.captureRejectionSymbol]=function(t){this.destroy(t)};E.prototype[th]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new ph,this.destroy(t)),new oa((e,r)=>aa(this,i=>i&&i!==t?r(i):e(null)))};E.prototype.push=function(t,e){return ha(this,t,e,!1)};E.prototype.unshift=function(t,e){return ha(this,t,e,!0)};function ha(t,e,r,i){I("readableAddChunk",e);let n=t._readableState,s;if((n.state&Tt)===0&&(typeof e=="string"?(r=r||n.defaultEncoding,n.encoding!==r&&(i&&n.encoding?e=zi.from(e,r).toString(n.encoding):(e=zi.from(e,r),r=""))):e instanceof zi?r="":ke._isUint8Array(e)?(e=ke._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new fh("chunk",["string","Buffer","Uint8Array"],e))),s)Rt(t,s);else if(e===null)n.state&=~Yt,Nh(t,n);else if((n.state&Tt)!==0||e&&e.length>0)if(i)if((n.state&ua)!==0)Rt(t,new _h);else{if(n.destroyed||n.errored)return!1;Hi(t,n,e,!0)}else if(n.ended)Rt(t,new hh);else{if(n.destroyed||n.errored)return!1;n.state&=~Yt,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?Hi(t,n,e,!1):Br(t,n)):Hi(t,n,e,!1)}else i||(n.state&=~Yt,Br(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}function Hi(t,e,r,i){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&da)!==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&Fr)!==0&&Or(t)),Br(t,e)}E.prototype.isPaused=function(){let t=this._readableState;return t[tt]===!0||t.flowing===!1};E.prototype.setEncoding=function(t){let e=new la(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 Ah=1073741824;function vh(t){if(t>Ah)throw new dh("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function na(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&Tt)!==0?1:Jd(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}E.prototype.read=function(t){I("read",t),t===void 0?t=NaN:Yd(t)||(t=Zd(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=vh(t)),t!==0&&(e.state&=~ca),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return I("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Ki(this):Or(this),null;if(t=na(t,e),t===0&&e.ended)return e.length===0&&Ki(this),null;let i=(e.state&Fr)!==0;if(I("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,I("length less than watermark",i)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)i=!1,I("reading, ended or constructing",i);else if(i){I("do read"),e.state|=Yt|Cr,e.length===0&&(e.state|=Fr);try{this._read(e.highWaterMark)}catch(s){Rt(this,s)}e.state&=~Cr,e.reading||(t=na(r,e))}let n;return t>0?n=ga(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&&Ki(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function Nh(t,e){if(I("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?Or(t):(e.needReadable=!1,e.emittedReadable=!0,_a(t))}}function Or(t){let e=t._readableState;I("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(I("emitReadable",e.flowing),e.emittedReadable=!0,oe.nextTick(_a,t))}function _a(t){let e=t._readableState;I("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,ba(t)}function Br(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,oe.nextTick(Ph,t,e))}function Ph(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(I("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}E.prototype._read=function(t){throw new ch("_read()")};E.prototype.pipe=function(t,e){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new eh(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(t),I("pipe count=%d opts=%j",i.pipes.length,e);let s=(!e||e.end!==!1)&&t!==oe.stdout&&t!==oe.stderr?a:y;i.endEmitted?oe.nextTick(s):r.once("end",s),t.on("unpipe",o);function o(g,S){I("onunpipe"),g===r&&S&&S.hasUnpiped===!1&&(S.hasUnpiped=!0,f())}function a(){I("onend"),t.end()}let l,u=!1;function f(){I("cleanup"),t.removeListener("close",p),t.removeListener("finish",h),l&&t.removeListener("drain",l),t.removeListener("error",_),t.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",y),r.removeListener("data",d),u=!0,l&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&l()}function c(){u||(i.pipes.length===1&&i.pipes[0]===t?(I("false write response, pause",0),i.awaitDrainWriters=t,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(t)&&(I("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),r.pause()),l||(l=jh(r,t),t.on("drain",l))}r.on("data",d);function d(g){I("ondata");let S=t.write(g);I("dest.write",S),S===!1&&c()}function _(g){if(I("onerror",g),y(),t.removeListener("error",_),t.listenerCount("error")===0){let S=t._writableState||t._readableState;S&&!S.errorEmitted?Rt(t,g):t.emit("error",g)}}sh(t,"error",_);function p(){t.removeListener("finish",h),y()}t.once("close",p);function h(){I("onfinish"),t.removeListener("close",p),y()}t.once("finish",h);function y(){I("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?c():i.flowing||(I("pipe resume"),r.resume()),t};function jh(t,e){return function(){let i=t._readableState;i.awaitDrainWriters===e?(I("pipeOnDrain",1),i.awaitDrainWriters=null):i.multiAwaitDrain&&(I("pipeOnDrain",i.awaitDrainWriters.size),i.awaitDrainWriters.delete(e)),(!i.awaitDrainWriters||i.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}E.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=Kd(e.pipes,t);return i===-1?this:(e.pipes.splice(i,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};E.prototype.on=function(t,e){let r=ke.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,I("on readable",i.length,i.reading),i.length?Or(this):i.reading||oe.nextTick(Lh,this)),r};E.prototype.addListener=E.prototype.on;E.prototype.removeListener=function(t,e){let r=ke.prototype.removeListener.call(this,t,e);return t==="readable"&&oe.nextTick(pa,this),r};E.prototype.off=E.prototype.removeListener;E.prototype.removeAllListeners=function(t){let e=ke.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&oe.nextTick(pa,this),e};function pa(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[tt]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function Lh(t){I("readable nexttick read 0"),t.read(0)}E.prototype.resume=function(){let t=this._readableState;return t.flowing||(I("resume"),t.flowing=!t.readableListening,Ch(this,t)),t[tt]=!1,this};function Ch(t,e){e.resumeScheduled||(e.resumeScheduled=!0,oe.nextTick(Fh,t,e))}function Fh(t,e){I("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),ba(t),e.flowing&&!e.reading&&t.read(0)}E.prototype.pause=function(){return I("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(I("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[tt]=!0,this};function ba(t){let e=t._readableState;for(I("flow",e.flowing);e.flowing&&t.read()!==null;);}E.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=>{Rt(this,i)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=Xd(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};E.prototype[rh]=function(){return ya(this)};E.prototype.iterator=function(t){return t!==void 0&&bh(t,"options"),ya(this,t)};function ya(t,e){typeof t.read!="function"&&(t=E.wrap(t,{objectMode:!0}));let r=Bh(t,e);return r.stream=t,r}function Bh(t,e){return ee(this,null,function*(){let r=Vi;function i(o){this===t?(r(),r=Vi):r=o}t.on("readable",i);let n,s=aa(t,{writable:!1},o=>{n=o?ia(n,o):null,r(),r=Vi});try{for(;;){let o=t.destroyed?null:t.read();if(o!==null)yield o;else{if(n)throw n;if(n===null)return;yield new W(new oa(i))}}}catch(o){throw n=ia(n,o),n}finally{(n||(e==null?void 0:e.destroyOnReturn)!==!1)&&(n===void 0||t._readableState.autoDestroy)?At.destroyer(t,null):(t.off("readable",i),s())}})}Xi(E.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}}});Xi(Dr.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[tt]!==!1},set(t){this[tt]=!!t}}});E._fromList=ga;function ga(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 Ki(t){let e=t._readableState;I("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,oe.nextTick(Dh,e,t))}function Dh(t,e){if(I("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)oe.nextTick(Oh,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function Oh(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}E.from=function(t,e){return yh(E,t,e)};var Yi;function ma(){return Yi===void 0&&(Yi={}),Yi}E.fromWeb=function(t,e){return ma().newStreamReadableFromReadableStream(t,e)};E.toWeb=function(t,e){return ma().newReadableStreamFromStreamReadable(t,e)};E.wrap=function(t,e){var r,i;return new E(Ce($({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0},e),{destroy(n,s){At.destroyer(t,n),s(n)}})).wrap(t)}});var qr=T((Cb,La)=>{"use strict";var rt=Me(),{ArrayPrototypeSlice:Sa,Error:Mh,FunctionPrototypeSymbolHasInstance:Ia,ObjectDefineProperty:Ra,ObjectDefineProperties:$h,ObjectSetPrototypeOf:Ta,StringPrototypeToLowerCase:kh,Symbol:Uh,SymbolHasInstance:qh}=L();La.exports=C;C.WritableState=er;var{EventEmitter:Wh}=zt(),Zt=Nr().Stream,{Buffer:Mr}=Ie(),Ur=Xe(),{addAbortSignal:Gh}=Vt(),{getHighWaterMark:Qh,getDefaultHighWaterMark:zh}=Ht(),{ERR_INVALID_ARG_TYPE:Vh,ERR_METHOD_NOT_IMPLEMENTED:Hh,ERR_MULTIPLE_CALLBACK:Aa,ERR_STREAM_CANNOT_PIPE:Kh,ERR_STREAM_DESTROYED:Xt,ERR_STREAM_ALREADY_FINISHED:Yh,ERR_STREAM_NULL_VALUES:Jh,ERR_STREAM_WRITE_AFTER_END:Zh,ERR_UNKNOWN_ENCODING:va}=Q().codes,{errorOrDestroy:vt}=Ur;Ta(C.prototype,Zt.prototype);Ta(C,Zt);function rn(){}var Nt=Uh("kOnFinished");function er(t,e,r){typeof r!="boolean"&&(r=e instanceof ye()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?Qh(this,t,"writableHighWaterMark",r):zh(!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=e_.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,kr(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[Nt]=[]}function kr(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}er.prototype.getBuffer=function(){return Sa(this.buffered,this.bufferedIndex)};Ra(er.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function C(t){let e=this instanceof ye();if(!e&&!Ia(C,this))return new C(t);this._writableState=new er(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&&Gh(t.signal,this)),Zt.call(this,t),Ur.construct(this,()=>{let r=this._writableState;r.writing||sn(this,r),on(this,r)})}Ra(C,qh,{__proto__:null,value:function(t){return Ia(this,t)?!0:this!==C?!1:t&&t._writableState instanceof er}});C.prototype.pipe=function(){vt(this,new Kh)};function Na(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"&&!Mr.isEncoding(r))throw new va(r);typeof i!="function"&&(i=rn)}if(e===null)throw new Jh;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=Mr.from(e,r),r="buffer");else if(e instanceof Mr)r="buffer";else if(Zt._isUint8Array(e))e=Zt._uint8ArrayToBuffer(e),r="buffer";else throw new Vh("chunk",["string","Buffer","Uint8Array"],e);let s;return n.ending?s=new Zh:n.destroyed&&(s=new Xt("write")),s?(rt.nextTick(i,s),vt(t,s,!0),s):(n.pendingcb++,Xh(t,n,e,r,i))}C.prototype.write=function(t,e,r){return Na(this,t,e,r)===!0};C.prototype.cork=function(){this._writableState.corked++};C.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||sn(this,t))};C.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=kh(e)),!Mr.isEncoding(e))throw new va(e);return this._writableState.defaultEncoding=e,this};function Xh(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!==rn&&(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 xa(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Xt("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function Ea(t,e,r,i){--e.pendingcb,i(r),nn(e),vt(t,r)}function e_(t,e){let r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function"){vt(t,new Aa);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?rt.nextTick(Ea,t,r,e,n):Ea(t,r,e,n)):(r.buffered.length>r.bufferedIndex&&sn(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},rt.nextTick(t_,r.afterWriteTickInfo)):Pa(t,r,1,n))}function t_({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,Pa(t,e,r,i)}function Pa(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&&nn(e),on(t,e)}function nn(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 Xt("write"))}let r=t[Nt].splice(0);for(let n=0;n<r.length;n++){var i;r[n]((i=t.errored)!==null&&i!==void 0?i:new Xt("end"))}kr(t)}function sn(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?rn:u=>{for(let f=o;f<r.length;++f)r[f].callback(u)},l=e.allNoop&&o===0?r:Sa(r,o);l.allBuffers=e.allBuffers,xa(t,e,!0,e.length,l,"",a),kr(e)}else{do{let{chunk:a,encoding:l,callback:u}=r[o];r[o++]=null;let f=n?1:a.length;xa(t,e,!1,f,a,l,u)}while(o<r.length&&!e.writing);o===r.length?kr(e):o>256?(r.splice(0,o),e.bufferedIndex=0):e.bufferedIndex=o}e.bufferProcessing=!1}C.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new Hh("_write()")};C.prototype._writev=null;C.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=Na(this,t,e);s instanceof Mh&&(n=s)}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,on(this,i,!0),i.ended=!0):i.finished?n=new Yh("end"):i.destroyed&&(n=new Xt("end"))),typeof r=="function"&&(n||i.finished?rt.nextTick(r,n):i[Nt].push(r)),this};function $r(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 r_(t,e){let r=!1;function i(n){if(r){vt(t,n!=null?n:Aa());return}if(r=!0,e.pendingcb--,n){let s=e[Nt].splice(0);for(let o=0;o<s.length;o++)s[o](n);vt(t,n,e.sync)}else $r(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,rt.nextTick(tn,t,e))}e.sync=!0,e.pendingcb++;try{t._final(i)}catch(n){i(n)}e.sync=!1}function i_(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,r_(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function on(t,e,r){$r(e)&&(i_(t,e),e.pendingcb===0&&(r?(e.pendingcb++,rt.nextTick((i,n)=>{$r(n)?tn(i,n):n.pendingcb--},t,e)):$r(e)&&(e.pendingcb++,tn(t,e))))}function tn(t,e){e.pendingcb--,e.finished=!0;let r=e[Nt].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()}}$h(C.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 n_=Ur.destroy;C.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[Nt].length)&&rt.nextTick(nn,r),n_.call(this,t,e),this};C.prototype._undestroy=Ur.undestroy;C.prototype._destroy=function(t,e){e(t)};C.prototype[Wh.captureRejectionSymbol]=function(t){this.destroy(t)};var en;function ja(){return en===void 0&&(en={}),en}C.fromWeb=function(t,e){return ja().newStreamWritableFromWritableStream(t,e)};C.toWeb=function(t){return ja().newWritableStreamFromStreamWritable(t)}});var Va=T((Fb,za)=>{var an=Me(),s_=Ie(),{isReadable:o_,isWritable:a_,isIterable:Ca,isNodeStream:l_,isReadableNodeStream:Fa,isWritableNodeStream:Ba,isDuplexNodeStream:u_,isReadableStream:Da,isWritableStream:Oa}=_e(),Ma=Ae(),{AbortError:Ga,codes:{ERR_INVALID_ARG_TYPE:f_,ERR_INVALID_RETURN_VALUE:$a}}=Q(),{destroyer:jt}=Xe(),c_=ye(),Qa=Jt(),d_=qr(),{createDeferredPromise:ka}=K(),Ua=Qi(),qa=globalThis.Blob||s_.Blob,h_=typeof qa!="undefined"?function(e){return e instanceof qa}:function(e){return!1},__=globalThis.AbortController||mt().AbortController,{FunctionPrototypeCall:Wa}=L(),Ue=class extends c_{constructor(e){super(e),(e==null?void 0:e.readable)===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),(e==null?void 0:e.writable)===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};za.exports=function t(e,r){if(u_(e))return e;if(Fa(e))return Pt({readable:e});if(Ba(e))return Pt({writable:e});if(l_(e))return Pt({writable:!1,readable:!1});if(Da(e))return Pt({readable:Qa.fromWeb(e)});if(Oa(e))return Pt({writable:d_.fromWeb(e)});if(typeof e=="function"){let{value:n,write:s,final:o,destroy:a}=p_(e);if(Ca(n))return Ua(Ue,n,{objectMode:!0,write:s,final:o,destroy:a});let l=n==null?void 0:n.then;if(typeof l=="function"){let u,f=Wa(l,n,c=>{if(c!=null)throw new $a("nully","body",c)},c=>{jt(u,c)});return u=new Ue({objectMode:!0,readable:!1,write:s,final(c){o(async()=>{try{await f,an.nextTick(c,null)}catch(d){an.nextTick(c,d)}})},destroy:a})}throw new $a("Iterable, AsyncIterable or AsyncFunction",r,n)}if(h_(e))return t(e.arrayBuffer());if(Ca(e))return Ua(Ue,e,{objectMode:!0,writable:!1});if(Da(e==null?void 0:e.readable)&&Oa(e==null?void 0:e.writable))return Ue.fromWeb(e);if(typeof(e==null?void 0:e.writable)=="object"||typeof(e==null?void 0:e.readable)=="object"){let n=e!=null&&e.readable?Fa(e==null?void 0:e.readable)?e==null?void 0:e.readable:t(e.readable):void 0,s=e!=null&&e.writable?Ba(e==null?void 0:e.writable)?e==null?void 0:e.writable:t(e.writable):void 0;return Pt({readable:n,writable:s})}let i=e==null?void 0:e.then;if(typeof i=="function"){let n;return Wa(i,e,s=>{s!=null&&n.push(s),n.push(null)},s=>{jt(n,s)}),n=new Ue({objectMode:!0,writable:!1,read(){}})}throw new f_(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function p_(t){let{promise:e,resolve:r}=ka(),i=new __,n=i.signal;return{value:t((function(){return ee(this,null,function*(){for(;;){let o=e;e=null;let{chunk:a,done:l,cb:u}=yield new W(o);if(an.nextTick(u),l)return;if(n.aborted)throw new Ga(void 0,{cause:n.reason});({promise:e,resolve:r}=ka()),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 Pt(t){let e=t.readable&&typeof t.readable.read!="function"?Qa.wrap(t.readable):t.readable,r=t.writable,i=!!o_(e),n=!!a_(r),s,o,a,l,u;function f(c){let d=l;l=null,d?d(c):c&&u.destroy(c)}return u=new Ue({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(Ma(r,c=>{n=!1,c&&jt(e,c),f(c)}),u._write=function(c,d,_){r.write(c,d)?_():s=_},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&&(Ma(e,c=>{i=!1,c&&jt(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,d){!c&&l!==null&&(c=new Ga),a=null,s=null,o=null,l===null?d(c):(l=d,jt(r,c),jt(e,c))},u}});var ye=T((Db,Ya)=>{"use strict";var{ObjectDefineProperties:b_,ObjectGetOwnPropertyDescriptor:ve,ObjectKeys:y_,ObjectSetPrototypeOf:Ha}=L();Ya.exports=ae;var fn=Jt(),ie=qr();Ha(ae.prototype,fn.prototype);Ha(ae,fn);{let t=y_(ie.prototype);for(let e=0;e<t.length;e++){let r=t[e];ae.prototype[r]||(ae.prototype[r]=ie.prototype[r])}}function ae(t){if(!(this instanceof ae))return new ae(t);fn.call(this,t),ie.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}b_(ae.prototype,{writable:$({__proto__:null},ve(ie.prototype,"writable")),writableHighWaterMark:$({__proto__:null},ve(ie.prototype,"writableHighWaterMark")),writableObjectMode:$({__proto__:null},ve(ie.prototype,"writableObjectMode")),writableBuffer:$({__proto__:null},ve(ie.prototype,"writableBuffer")),writableLength:$({__proto__:null},ve(ie.prototype,"writableLength")),writableFinished:$({__proto__:null},ve(ie.prototype,"writableFinished")),writableCorked:$({__proto__:null},ve(ie.prototype,"writableCorked")),writableEnded:$({__proto__:null},ve(ie.prototype,"writableEnded")),writableNeedDrain:$({__proto__:null},ve(ie.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 ln;function Ka(){return ln===void 0&&(ln={}),ln}ae.fromWeb=function(t,e){return Ka().newStreamDuplexFromReadableWritablePair(t,e)};ae.toWeb=function(t){return Ka().newReadableWritablePairFromDuplex(t)};var un;ae.from=function(t){return un||(un=Va()),un(t,"body")}});var hn=T((Mb,Za)=>{"use strict";var{ObjectSetPrototypeOf:Ja,Symbol:g_}=L();Za.exports=Ne;var{ERR_METHOD_NOT_IMPLEMENTED:m_}=Q().codes,dn=ye(),{getHighWaterMark:w_}=Ht();Ja(Ne.prototype,dn.prototype);Ja(Ne,dn);var tr=g_("kCallback");function Ne(t){if(!(this instanceof Ne))return new Ne(t);let e=t?w_(this,t,"readableHighWaterMark",!0):null;e===0&&(t=Ce($({},t),{highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0})),dn.call(this,t),this._readableState.sync=!1,this[tr]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",x_)}function cn(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 x_(){this._final!==cn&&cn.call(this)}Ne.prototype._final=cn;Ne.prototype._transform=function(t,e,r){throw new m_("_transform()")};Ne.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[tr]=r})};Ne.prototype._read=function(){if(this[tr]){let t=this[tr];this[tr]=null,t()}}});var pn=T((kb,el)=>{"use strict";var{ObjectSetPrototypeOf:Xa}=L();el.exports=Lt;var _n=hn();Xa(Lt.prototype,_n.prototype);Xa(Lt,_n);function Lt(t){if(!(this instanceof Lt))return new Lt(t);_n.call(this,t)}Lt.prototype._transform=function(t,e,r){r(null,t)}});var zr=T((Ub,sl)=>{var rr=Me(),{ArrayIsArray:E_,Promise:S_,SymbolAsyncIterator:I_,SymbolDispose:R_}=L(),Qr=Ae(),{once:T_}=K(),A_=Xe(),tl=ye(),{aggregateTwoErrors:v_,codes:{ERR_INVALID_ARG_TYPE:In,ERR_INVALID_RETURN_VALUE:bn,ERR_MISSING_ARGS:N_,ERR_STREAM_DESTROYED:P_,ERR_STREAM_PREMATURE_CLOSE:j_},AbortError:L_}=Q(),{validateFunction:C_,validateAbortSignal:F_}=Et(),{isIterable:it,isReadable:yn,isReadableNodeStream:Gr,isNodeStream:rl,isTransformStream:Ct,isWebStream:B_,isReadableStream:gn,isReadableFinished:D_}=_e(),O_=globalThis.AbortController||mt().AbortController,mn,wn,xn;function il(t,e,r){let i=!1;t.on("close",()=>{i=!0});let n=Qr(t,{readable:e,writable:r},s=>{i=!s});return{destroy:s=>{i||(i=!0,A_.destroyer(t,s||new P_("pipe")))},cleanup:n}}function M_(t){return C_(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function En(t){if(it(t))return t;if(Gr(t))return $_(t);throw new In("val",["Readable","Iterable","AsyncIterable"],t)}function $_(t){return ee(this,null,function*(){wn||(wn=Jt()),yield*ne(wn.prototype[I_].call(t))})}async function Wr(t,e,r,{end:i}){let n,s=null,o=_=>{if(_&&(n=_),s){let p=s;s=null,p()}},a=()=>new S_((_,p)=>{n?p(n):s=()=>{n?p(n):_()}});e.on("drain",o);let l=Qr(e,{readable:!1},o);try{e.writableNeedDrain&&await a();try{for(var u=Y(t),f,c,d;f=!(c=await u.next()).done;f=!1){let _=c.value;e.write(_)||await a()}}catch(c){d=[c]}finally{try{f&&(c=u.return)&&await c.call(u)}finally{if(d)throw d[0]}}i&&(e.end(),await a()),r()}catch(_){r(n!==_?v_(n,_):_)}finally{l(),e.off("drain",o)}}async function Sn(t,e,r,{end:i}){Ct(e)&&(e=e.writable);let n=e.getWriter();try{try{for(var s=Y(t),o,a,l;o=!(a=await s.next()).done;o=!1){let u=a.value;await n.ready,n.write(u).catch(()=>{})}}catch(a){l=[a]}finally{try{o&&(a=s.return)&&await a.call(s)}finally{if(l)throw l[0]}}await n.ready,i&&await n.close(),r()}catch(u){try{await n.abort(u),r(u)}catch(f){r(f)}}}function k_(...t){return nl(t,T_(M_(t)))}function nl(t,e,r){if(t.length===1&&E_(t[0])&&(t=t[0]),t.length<2)throw new N_("streams");let i=new O_,n=i.signal,s=r==null?void 0:r.signal,o=[];F_(s,"options.signal");function a(){p(new L_)}xn=xn||K().addAbortListener;let l;s&&(l=xn(s,a));let u,f,c=[],d=0;function _(w){p(w,--d===0)}function p(w,m){var x;if(w&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=w),!(!u&&!m)){for(;c.length;)c.shift()(u);(x=l)===null||x===void 0||x[R_](),i.abort(),m&&(u||o.forEach(A=>A()),rr.nextTick(e,u,f))}}let h;for(let w=0;w<t.length;w++){let m=t[w],x=w<t.length-1,A=w>0,R=x||(r==null?void 0:r.end)!==!1,M=w===t.length-1;if(rl(m)){let N=function(V){V&&V.name!=="AbortError"&&V.code!=="ERR_STREAM_PREMATURE_CLOSE"&&_(V)};var S=N;if(R){let{destroy:V,cleanup:at}=il(m,x,A);c.push(V),yn(m)&&M&&o.push(at)}m.on("error",N),yn(m)&&M&&o.push(()=>{m.removeListener("error",N)})}if(w===0)if(typeof m=="function"){if(h=m({signal:n}),!it(h))throw new bn("Iterable, AsyncIterable or Stream","source",h)}else it(m)||Gr(m)||Ct(m)?h=m:h=tl.from(m);else if(typeof m=="function"){if(Ct(h)){var y;h=En((y=h)===null||y===void 0?void 0:y.readable)}else h=En(h);if(h=m(h,{signal:n}),x){if(!it(h,!0))throw new bn("AsyncIterable",`transform[${w-1}]`,h)}else{var g;mn||(mn=pn());let N=new mn({objectMode:!0}),V=(g=h)===null||g===void 0?void 0:g.then;if(typeof V=="function")d++,V.call(h,Le=>{f=Le,Le!=null&&N.write(Le),R&&N.end(),rr.nextTick(_)},Le=>{N.destroy(Le),rr.nextTick(_,Le)});else if(it(h,!0))d++,Wr(h,N,_,{end:R});else if(gn(h)||Ct(h)){let Le=h.readable||h;d++,Wr(Le,N,_,{end:R})}else throw new bn("AsyncIterable or Promise","destination",h);h=N;let{destroy:at,cleanup:Ul}=il(h,!1,!0);c.push(at),M&&o.push(Ul)}}else if(rl(m)){if(Gr(h)){d+=2;let N=U_(h,m,_,{end:R});yn(m)&&M&&o.push(N)}else if(Ct(h)||gn(h)){let N=h.readable||h;d++,Wr(N,m,_,{end:R})}else if(it(h))d++,Wr(h,m,_,{end:R});else throw new In("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=m}else if(B_(m)){if(Gr(h))d++,Sn(En(h),m,_,{end:R});else if(gn(h)||it(h))d++,Sn(h,m,_,{end:R});else if(Ct(h))d++,Sn(h.readable,m,_,{end:R});else throw new In("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=m}else h=tl.from(m)}return(n!=null&&n.aborted||s!=null&&s.aborted)&&rr.nextTick(a),h}function U_(t,e,r,{end:i}){let n=!1;if(e.on("close",()=>{n||r(new j_)}),t.pipe(e,{end:!1}),i){let o=function(){n=!0,e.end()};var s=o;D_(t)?rr.nextTick(o):t.once("end",o)}else r();return Qr(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)}),Qr(e,{readable:!1,writable:!0},r)}sl.exports={pipelineImpl:nl,pipeline:k_}});var Tn=T((Wb,cl)=>{"use strict";var{pipeline:q_}=zr(),Vr=ye(),{destroyer:W_}=Xe(),{isNodeStream:Hr,isReadable:ol,isWritable:al,isWebStream:Rn,isTransformStream:nt,isWritableStream:ll,isReadableStream:ul}=_e(),{AbortError:G_,codes:{ERR_INVALID_ARG_VALUE:fl,ERR_MISSING_ARGS:Q_}}=Q(),z_=Ae();cl.exports=function(...e){if(e.length===0)throw new Q_("streams");if(e.length===1)return Vr.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=Vr.from(e[0])),typeof e[e.length-1]=="function"){let _=e.length-1;e[_]=Vr.from(e[_])}for(let _=0;_<e.length;++_)if(!(!Hr(e[_])&&!Rn(e[_]))){if(_<e.length-1&&!(ol(e[_])||ul(e[_])||nt(e[_])))throw new fl(`streams[${_}]`,r[_],"must be readable");if(_>0&&!(al(e[_])||ll(e[_])||nt(e[_])))throw new fl(`streams[${_}]`,r[_],"must be writable")}let i,n,s,o,a;function l(_){let p=o;o=null,p?p(_):_?a.destroy(_):!d&&!c&&a.destroy()}let u=e[0],f=q_(e,l),c=!!(al(u)||ll(u)||nt(u)),d=!!(ol(f)||ul(f)||nt(f));if(a=new Vr({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(f!=null&&f.readableObjectMode),writable:c,readable:d}),c){if(Hr(u))a._write=function(p,h,y){u.write(p,h)?y():i=y},a._final=function(p){u.end(),n=p},u.on("drain",function(){if(i){let p=i;i=null,p()}});else if(Rn(u)){let h=(nt(u)?u.writable:u).getWriter();a._write=async function(y,g,S){try{await h.ready,h.write(y).catch(()=>{}),S()}catch(w){S(w)}},a._final=async function(y){try{await h.ready,h.close().catch(()=>{}),n=y}catch(g){y(g)}}}let _=nt(f)?f.readable:f;z_(_,()=>{if(n){let p=n;n=null,p()}})}if(d){if(Hr(f))f.on("readable",function(){if(s){let _=s;s=null,_()}}),f.on("end",function(){a.push(null)}),a._read=function(){for(;;){let _=f.read();if(_===null){s=a._read;return}if(!a.push(_))return}};else if(Rn(f)){let p=(nt(f)?f.readable:f).getReader();a._read=async function(){for(;;)try{let{value:h,done:y}=await p.read();if(!a.push(h))return;if(y){a.push(null);return}}catch(h){return}}}}return a._destroy=function(_,p){!_&&o!==null&&(_=new G_),s=null,i=null,n=null,o===null?p(_):(o=p,Hr(f)&&W_(f,_))},a}});var xl=T((Gb,Nn)=>{"use strict";var V_=globalThis.AbortController||mt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:H_,ERR_INVALID_ARG_TYPE:ir,ERR_MISSING_ARGS:K_,ERR_OUT_OF_RANGE:Y_},AbortError:ge}=Q(),{validateAbortSignal:st,validateInteger:dl,validateObject:ot}=Et(),J_=L().Symbol("kWeak"),Z_=L().Symbol("kResistStopPropagation"),{finished:X_}=Ae(),ep=Tn(),{addAbortSignalNoValidate:tp}=Vt(),{isWritable:rp,isNodeStream:ip}=_e(),{deprecate:np}=K(),{ArrayPrototypePush:sp,Boolean:op,MathFloor:hl,Number:ap,NumberIsNaN:lp,Promise:_l,PromiseReject:pl,PromiseResolve:up,PromisePrototypeThen:bl,Symbol:gl}=L(),Kr=gl("kEmpty"),yl=gl("kEof");function fp(t,e){if(e!=null&&ot(e,"options"),(e==null?void 0:e.signal)!=null&&st(e.signal,"options.signal"),ip(t)&&!rp(t))throw new H_("stream",t,"must be writable");let r=ep(this,t);return e!=null&&e.signal&&tp(e.signal,r),r}function Yr(t,e){if(typeof t!="function")throw new ir("fn",["Function","AsyncFunction"],t);e!=null&&ot(e,"options"),(e==null?void 0:e.signal)!=null&&st(e.signal,"options.signal");let r=1;(e==null?void 0:e.concurrency)!=null&&(r=hl(e.concurrency));let i=r-1;return(e==null?void 0:e.highWaterMark)!=null&&(i=hl(e.highWaterMark)),dl(r,"options.concurrency",1),dl(i,"options.highWaterMark",0),i+=r,function(){return ee(this,null,function*(){let s=K().AbortSignalAny([e==null?void 0:e.signal].filter(op)),o=this,a=[],l={signal:s},u,f,c=!1,d=0;function _(){c=!0,p()}function p(){d-=1,h()}function h(){f&&!c&&d<r&&a.length<i&&(f(),f=null)}async function y(){try{try{for(var g=Y(o),S,w,m;S=!(w=await g.next()).done;S=!1){let x=w.value;if(c)return;if(s.aborted)throw new ge;try{if(x=t(x,l),x===Kr)continue;x=up(x)}catch(A){x=pl(A)}d+=1,bl(x,p,_),a.push(x),u&&(u(),u=null),!c&&(a.length>=i||d>=r)&&await new _l(A=>{f=A})}}catch(w){m=[w]}finally{try{S&&(w=g.return)&&await w.call(g)}finally{if(m)throw m[0]}}a.push(yl)}catch(x){let A=pl(x);bl(A,p,_),a.push(A)}finally{c=!0,u&&(u(),u=null)}}y();try{for(;;){for(;a.length>0;){let g=yield new W(a[0]);if(g===yl)return;if(s.aborted)throw new ge;g!==Kr&&(yield g),a.shift(),h()}yield new W(new _l(g=>{u=g}))}}finally{c=!0,f&&(f(),f=null)}})}.call(this)}function cp(t=void 0){return t!=null&&ot(t,"options"),(t==null?void 0:t.signal)!=null&&st(t.signal,"options.signal"),function(){return ee(this,null,function*(){let r=0;try{for(var n=Y(this),s,o,a;s=!(o=yield new W(n.next())).done;s=!1){let l=o.value;var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new ge({cause:t.signal.reason});yield[r++,l]}}catch(o){a=[o]}finally{try{s&&(o=n.return)&&(yield new W(o.call(n)))}finally{if(a)throw a[0]}}})}.call(this)}async function ml(t,e=void 0){try{for(var r=Y(vn.call(this,t,e)),i,n,s;i=!(n=await r.next()).done;i=!1){let o=n.value;return!0}}catch(n){s=[n]}finally{try{i&&(n=r.return)&&await n.call(r)}finally{if(s)throw s[0]}}return!1}async function dp(t,e=void 0){if(typeof t!="function")throw new ir("fn",["Function","AsyncFunction"],t);return!await ml.call(this,async(...r)=>!await t(...r),e)}async function hp(t,e){try{for(var r=Y(vn.call(this,t,e)),i,n,s;i=!(n=await r.next()).done;i=!1){let o=n.value;return o}}catch(n){s=[n]}finally{try{i&&(n=r.return)&&await n.call(r)}finally{if(s)throw s[0]}}}async function _p(t,e){if(typeof t!="function")throw new ir("fn",["Function","AsyncFunction"],t);async function r(a,l){return await t(a,l),Kr}try{for(var i=Y(Yr.call(this,r,e)),n,s,o;n=!(s=await i.next()).done;n=!1){let a=s.value;;}}catch(s){o=[s]}finally{try{n&&(s=i.return)&&await s.call(i)}finally{if(o)throw o[0]}}}function vn(t,e){if(typeof t!="function")throw new ir("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n)?i:Kr}return Yr.call(this,r,e)}var An=class extends K_{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function pp(t,e,r){var i;if(typeof t!="function")throw new ir("reducer",["Function","AsyncFunction"],t);r!=null&&ot(r,"options"),(r==null?void 0:r.signal)!=null&&st(r.signal,"options.signal");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let _=new ge(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await X_(this.destroy(_)),_}let s=new V_,o=s.signal;if(r!=null&&r.signal){let _={once:!0,[J_]:this,[Z_]:!0};r.signal.addEventListener("abort",()=>s.abort(),_)}let a=!1;try{try{for(var u=Y(this),f,c,d;f=!(c=await u.next()).done;f=!1){let _=c.value;var l;if(a=!0,r!=null&&(l=r.signal)!==null&&l!==void 0&&l.aborted)throw new ge;n?e=await t(e,_,{signal:o}):(e=_,n=!0)}}catch(c){d=[c]}finally{try{f&&(c=u.return)&&await c.call(u)}finally{if(d)throw d[0]}}if(!a&&!n)throw new An}finally{s.abort()}return e}async function bp(t){t!=null&&ot(t,"options"),(t==null?void 0:t.signal)!=null&&st(t.signal,"options.signal");let e=[];try{for(var i=Y(this),n,s,o;n=!(s=await i.next()).done;n=!1){let a=s.value;var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new ge(void 0,{cause:t.signal.reason});sp(e,a)}}catch(s){o=[s]}finally{try{n&&(s=i.return)&&await s.call(i)}finally{if(o)throw o[0]}}return e}function yp(t,e){let r=Yr.call(this,t,e);return function(){return ee(this,null,function*(){try{for(var n=Y(r),s,o,a;s=!(o=yield new W(n.next())).done;s=!1){let l=o.value;yield*ne(l)}}catch(o){a=[o]}finally{try{s&&(o=n.return)&&(yield new W(o.call(n)))}finally{if(a)throw a[0]}}})}.call(this)}function wl(t){if(t=ap(t),lp(t))return 0;if(t<0)throw new Y_("number",">= 0",t);return t}function gp(t,e=void 0){return e!=null&&ot(e,"options"),(e==null?void 0:e.signal)!=null&&st(e.signal,"options.signal"),t=wl(t),function(){return ee(this,null,function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new ge;try{for(var s=Y(this),o,a,l;o=!(a=yield new W(s.next())).done;o=!1){let u=a.value;var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new ge;t--<=0&&(yield u)}}catch(a){l=[a]}finally{try{o&&(a=s.return)&&(yield new W(a.call(s)))}finally{if(l)throw l[0]}}})}.call(this)}function mp(t,e=void 0){return e!=null&&ot(e,"options"),(e==null?void 0:e.signal)!=null&&st(e.signal,"options.signal"),t=wl(t),function(){return ee(this,null,function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new ge;try{for(var s=Y(this),o,a,l;o=!(a=yield new W(s.next())).done;o=!1){let u=a.value;var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new ge;if(t-- >0&&(yield u),t<=0)return}}catch(a){l=[a]}finally{try{o&&(a=s.return)&&(yield new W(a.call(s)))}finally{if(l)throw l[0]}}})}.call(this)}Nn.exports.streamReturningOperators={asIndexedPairs:np(cp,"readable.asIndexedPairs will be removed in a future version."),drop:gp,filter:vn,flatMap:yp,map:Yr,take:mp,compose:fp};Nn.exports.promiseReturningOperators={every:dp,forEach:_p,reduce:pp,toArray:bp,some:ml,find:hp}});var Pn=T((zb,El)=>{"use strict";var{ArrayPrototypePop:wp,Promise:xp}=L(),{isIterable:Ep,isNodeStream:Sp,isWebStream:Ip}=_e(),{pipelineImpl:Rp}=zr(),{finished:Tp}=Ae();jn();function Ap(...t){return new xp((e,r)=>{let i,n,s=t[t.length-1];if(s&&typeof s=="object"&&!Sp(s)&&!Ep(s)&&!Ip(s)){let o=wp(t);i=o.signal,n=o.end}Rp(t,(o,a)=>{o?r(o):e(a)},{signal:i,end:n})})}El.exports={finished:Tp,pipeline:Ap}});var jn=T((Vb,jl)=>{"use strict";var{Buffer:vp}=Ie(),{ObjectDefineProperty:Pe,ObjectKeys:Rl,ReflectApply:Tl}=L(),{promisify:{custom:Al}}=K(),{streamReturningOperators:Sl,promiseReturningOperators:Il}=xl(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:vl}}=Q(),Np=Tn(),{setDefaultHighWaterMark:Pp,getDefaultHighWaterMark:jp}=Ht(),{pipeline:Nl}=zr(),{destroyer:Lp}=Xe(),Pl=Ae(),Ln=Pn(),nr=_e(),j=jl.exports=Nr().Stream;j.isDestroyed=nr.isDestroyed;j.isDisturbed=nr.isDisturbed;j.isErrored=nr.isErrored;j.isReadable=nr.isReadable;j.isWritable=nr.isWritable;j.Readable=Jt();for(let t of Rl(Sl)){let r=function(...i){if(new.target)throw vl();return j.Readable.from(Tl(e,this,i))},e=Sl[t];Pe(r,"name",{__proto__:null,value:e.name}),Pe(r,"length",{__proto__:null,value:e.length}),Pe(j.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of Rl(Il)){let r=function(...i){if(new.target)throw vl();return Tl(e,this,i)},e=Il[t];Pe(r,"name",{__proto__:null,value:e.name}),Pe(r,"length",{__proto__:null,value:e.length}),Pe(j.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}j.Writable=qr();j.Duplex=ye();j.Transform=hn();j.PassThrough=pn();j.pipeline=Nl;var{addAbortSignal:Cp}=Vt();j.addAbortSignal=Cp;j.finished=Pl;j.destroy=Lp;j.compose=Np;j.setDefaultHighWaterMark=Pp;j.getDefaultHighWaterMark=jp;Pe(j,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Ln}});Pe(Nl,Al,{__proto__:null,enumerable:!0,get(){return Ln.pipeline}});Pe(Pl,Al,{__proto__:null,enumerable:!0,get(){return Ln.finished}});j.Stream=j;j._isUint8Array=function(e){return e instanceof Uint8Array};j._uint8ArrayToBuffer=function(e){return vp.from(e.buffer,e.byteOffset,e.byteLength)}});var Jr=T((Hb,D)=>{"use strict";var U=jn(),Fp=Pn(),Bp=U.Readable.destroy;D.exports=U.Readable;D.exports._uint8ArrayToBuffer=U._uint8ArrayToBuffer;D.exports._isUint8Array=U._isUint8Array;D.exports.isDisturbed=U.isDisturbed;D.exports.isErrored=U.isErrored;D.exports.isReadable=U.isReadable;D.exports.Readable=U.Readable;D.exports.Writable=U.Writable;D.exports.Duplex=U.Duplex;D.exports.Transform=U.Transform;D.exports.PassThrough=U.PassThrough;D.exports.addAbortSignal=U.addAbortSignal;D.exports.finished=U.finished;D.exports.destroy=U.destroy;D.exports.destroy=Bp;D.exports.pipeline=U.pipeline;D.exports.compose=U.compose;Object.defineProperty(U,"promises",{configurable:!0,enumerable:!0,get(){return Fp}});D.exports.Stream=U.Stream;D.exports.default=D.exports});var We="http://www.w3.org/1999/02/22-rdf-syntax-ns#",ut="http://www.w3.org/2001/XMLSchema#",cr="http://www.w3.org/2000/10/swap/",P={xsd:{decimal:`${ut}decimal`,boolean:`${ut}boolean`,dateTime:`${ut}dateTime`,double:`${ut}double`,integer:`${ut}integer`,string:`${ut}string`},rdf:{type:`${We}type`,nil:`${We}nil`,first:`${We}first`,rest:`${We}rest`,langString:`${We}langString`,dirLangString:`${We}dirLangString`,reifies:`${We}reifies`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${cr}reify#forSome`,forAll:`${cr}reify#forAll`},log:{implies:`${cr}log#implies`,isImpliedBy:`${cr}log#isImpliedBy`}};var{xsd:dr}=P,Ot=32,Mt=9,ti=10,$t=13,Un=35,kn={"\\":"\\","'":"'",'"':'"',n:`
|
|
3
|
+
`,r:"\r",t:" ",f:"\f",b:"\b"},Zl={_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","'":"'","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Xl=/[\x00-\x20<>\\"\{\}\|\^\`]/,eu=/[\s<>"{}|^`]/g;function tu(t){return t<=1114111&&(t<55296||t>57343)}var ru={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_commentLine:!0,_whitespace:!0},iu=/$0^/,nu=/\S*/y;function O(t,e,r){return t.lastIndex=r,t.exec(e)}function hr(t,e,r){return t.lastIndex=r,t.test(e)}function Dt(t,e,r){return t.lastIndex=0,t.exec(`${e.slice(r)} `)}function su(t){return t===Ot||t===Mt||t===ti||t===$t||t===Un}var ou=/^(?:prefix|base|version|graph|forsome|forall|iri|a|true|false|has|is|of|id)$/i,au=1024,Ge=class{constructor(e){if(this._iri=/<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/y,this._unescapedIri=/<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/y,this._simpleQuotedString=/"([^"\\\r\n]*)"(?=[^"])/y,this._simpleApostropheString=/'([^'\\\r\n]*)'(?=[^'])/y,this._langcode=/@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9])/iy,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<])/y,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-9: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-9: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-9: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#()\[\]\{\}"'<>]))/y,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-9: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#()\[\]\{\}"'<>])/y,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#()\[\]\{\}"'<>]))/y,this._number=/[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?\d+|(?=\.?\d)\d*(?:(\.)\d+)?)(?=\.?[,;:!\^\s#()\[\]\{\}"'<>])/y,this._boolean=/(?:true|false)(?=[.,;!\^\s#()\[\]\{\}"'<>])/y,this._atKeyword=/@[a-z]+(?=[\s#<:"'])/iy,this._keyword=/(?:PREFIX|BASE|VERSION|GRAPH)(?=[\s#<"'])/iy,this._n3Verb=/(?:has|is|of)(?=[\s#()\[\]\{\}"'<>?_+\-0-9])/y,this._n3Id=/id(?=[\s#<])/y,this._shortPredicates=/a(?=[\s#()\[\]\{\}"'<>])/y,this._commentLine=/[ \t]*#([^\n\r]*)(?:\r\n|\n|\r)([ \t]*)/y,this._whitespace=/[ \t]+/y,e=e||{},this._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(let r in this)!(r in ru)&&this[r]instanceof RegExp&&(this[r]=iu);this._keyword=/VERSION(?=[\s#<"])/y}else this._n3Mode=e.n3!==!1;if(this._directive=null,e.directives&&e.directives.length!==0){for(let r of e.directives)if(!/^[a-z]+$/i.test(r)||ou.test(r))throw new Error(`Invalid directive name: "${r}"`);this._directive=new RegExp(`(?:${e.directives.join("|")})(?=[\\s#<])`,"iy"),this._directiveMaxLength=Math.max(...e.directives.map(r=>r.length)),this._directiveStarts=e.directives.map(r=>r[0].toLowerCase()+r[0].toUpperCase()).join("")}this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,r){let i=this._input,n=0,s=this._linePosition+i.length;for(;;){for(;;){let R=i.charCodeAt(n),M=0;if(R===Ot||R===Mt){let N=i.charCodeAt(n+1);M=N===Ot||N===Mt?O(this._whitespace,i,n)[0].length:1,R=i.charCodeAt(n+M)}if(R===Un){let N=O(this._commentLine,i,n);if(N){let V=N[0].length;if(!r&&n+V===i.length&&i.charCodeAt(i.length-1)===$t)return this._suspend(i,n,s);this.comments&&o(N[1],this._line,s-(i.length-n)+M),n+=V,s=i.length-n+N[2].length,this._line++}else{if(n+=M,!r)return this._suspend(i,n,s);this.comments&&o(i.slice(n+1),this._line,s-(i.length-n)),n=i.length;break}}else if(R===ti||R===$t){if(!r&&R===$t&&n+M+1===i.length)return this._suspend(i,n,s);M+=R===$t&&i.charCodeAt(n+M+1)===ti?2:1;let N=0,V=i.charCodeAt(n+M);if(V===Ot||V===Mt){let at=i.charCodeAt(n+M+1);N=at===Ot||at===Mt?O(this._whitespace,i,n+M)[0].length:1}n+=M+N,s=i.length-n+N,this._line++}else{n+=M;break}}if(n>=i.length)return r&&this._previousMarker==="^^"?l(this,i,n):(this._linePosition=s,r?(a("eof","","",this._line,s,0),this._input=null):this._input="");let u=this._line,f=i[n],c="",d="",_="",p=null,h=0,y=0,g=0,S=!1,w=!1;switch(f){case"^":if(this._previousMarker==="^^")return l(this,i,n);if(i.length-n<3)break;if(i[n+1]==="^"){if(this._previousMarker="^^",n+=2,i[n]!=="<"){if(su(i.charCodeAt(n)))continue;S=!0;break}}else{this._n3Mode&&(h=1,c="^");break}case"<":if(p=O(this._unescapedIri,i,n))c="IRI",d=p[1],y=p[1].length+2;else if(p=O(this._iri,i,n)){if(d=this._unescape(p[1],kn),d===null||Xl.test(d))return l(this,i,n);c="IRI",y=p[1].length+2}else i.length-n>2&&i[n+1]==="<"&&i[n+2]==="("?(c="<<(",h=3):!this._lineMode&&i.length-n>(r?1:2)&&i[n+1]==="<"?(c="<<",h=2):this._n3Mode&&i.length-n>1&&i[n+1]==="="?(h=2,this._isImpliedBy?(c="abbreviation",d="<"):(c="inverse",d=">")):this._n3Mode&&i.length-n>1&&i[n+1]==="-"&&(c="inversePredicate",h=2);break;case">":i.length-n>1&&i[n+1]===">"&&(c=">>",h=2);break;case"_":((p=O(this._blank,i,n))||r&&(p=Dt(this._blank,i,n)))&&(c="blank",_="_",d=p[1],y=p[1].length+2);break;case'"':if(p=O(this._simpleQuotedString,i,n))d=p[1];else if({value:d,matchLength:h,finalLineLength:g,tripleQuoted:w}=this._parseLiteral(i,n),d===null)return l(this,i,n);(p!==null||h!==0)&&(c="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(p=O(this._simpleApostropheString,i,n))d=p[1];else if({value:d,matchLength:h,finalLineLength:g,tripleQuoted:w}=this._parseLiteral(i,n),d===null)return l(this,i,n);(p!==null||h!==0)&&(c="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(p=O(this._variable,i,n))&&(c="var",d=p[0]);break;case"@":if(this._previousMarker==="literal"&&(p=O(this._langcode,i,n))&&p[1]!=="version"){let R=n+p[0].length;!r&&i[R]==="-"&&i[R+1]!=="-"?p=null:(c="langcode",d=p[1])}else(p=O(this._atKeyword,i,n))&&(c=p[0]);break;case".":if(i.length-n===1?r:i[n+1]<"0"||i[n+1]>"9"){c=".",h=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[n+1]==="-"){this._previousMarker==="langcode"&&(i.startsWith("--ltr",n)?(c="dircode",d="ltr",h=5):i.startsWith("--rtl",n)&&(c="dircode",d="rtl",h=5));break}(p=O(this._number,i,n)||r&&(p=Dt(this._number,i,n)))&&(c="literal",d=p[0],_=typeof p[1]=="string"?dr.double:typeof p[2]=="string"?dr.decimal:dr.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":case"V":case"v":(p=O(this._keyword,i,n))?c=p[0].toUpperCase():S=!0;break;case"f":case"t":hr(this._boolean,i,n)?(c="literal",d=f==="t"?"true":"false",_=dr.boolean,h=d.length):S=!0;break;case"a":hr(this._shortPredicates,i,n)?(c="abbreviation",d="a",h=1):S=!0;break;case"h":case"o":this._n3Mode&&(p=this._matchN3Verb(i,n,r))?c=p[0]:S=!0;break;case"i":this._n3Mode&&hr(this._n3Id,i,n)?(c="id",h=2):this._n3Mode&&(p=this._matchN3Verb(i,n,r))?c=p[0]:S=!0;break;case"=":this._n3Mode&&i.length-n>1&&(c="abbreviation",i[n+1]!==">"?(h=1,d="="):(h=2,d=">"));break;case"!":if(!this._n3Mode)break;case")":if(!r&&(i.length-n===1||i.length-n===2&&i[n+1]===">"))break;if(i.length-n>2&&i[n+1]===">"&&i[n+2]===">"){c=")>>",h=3;break}case",":case";":case"[":case"]":case"(":case"}":case"~":this._lineMode||(h=1,c=f);break;case"{":!this._lineMode&&i.length-n>=2&&(i[n+1]==="|"?(c="{|",h=2):(c=f,h=1));break;case"|":i.length-n>=2&&i[n+1]==="}"&&(c="|}",h=2);break;default:S=!0}if(S&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(p=O(this._prefix,i,n))?(c="prefix",d=p[1]||""):this._directive!==null&&this._directiveStarts.includes(f)&&((p=O(this._directive,i,n))||r&&i.length-n<=this._directiveMaxLength&&(p=Dt(this._directive,i,n)))?c=p[0].toUpperCase():((p=O(this._prefixed,i,n))||r&&(p=Dt(this._prefixed,i,n)))&&(c="prefixed",_=p[1]||"",d=this._unescape(p[2],Zl),y=_.length+p[2].length+1)),this._previousMarker==="^^")switch(c){case"prefixed":c="type";break;case"IRI":c="typeIRI";break;default:c=""}if(!c)return r||!i.startsWith("'''",n)&&!i.startsWith('"""',n)&&/\n|\r/.test(i.slice(n))?l(this,i,n):this._suspend(i,n,s);let m=h||p[0].length,x=s-(i.length-n),A;g?(A={type:c,value:d,prefix:_,line:u,start:x,end:g,endLine:this._line,tripleQuoted:w},e(null,A)):w?(A={type:c,value:d,prefix:_,line:u,start:x,end:x+m,tripleQuoted:w},e(null,A)):A=a(c,d,_,u,x,y||m),this.previousToken=A,this._previousMarker=c==="literal"&&(this._previousMarker==="VERSION"||this._previousMarker==="@version")?"version":c,n=Math.min(n+m,i.length),g&&(s=i.length-n+g)}function o(u,f,c){e(null,{type:"comment",value:u,prefix:"",line:f,start:c,end:c+u.length+1})}function a(u,f,c,d,_,p){let h={type:u,value:f,prefix:c,line:d,start:_,end:_+p};return e(null,h),h}function l(u,f,c){e(u._syntaxError(O(nu,f,c)[0]))}}_suspend(e,r,i){return this._linePosition=i-(e.length-r),this._input=e.slice(r)}_matchN3Verb(e,r,i){let n=O(this._n3Verb,e,r);if(!n)return null;let s=e[r+n[0].length];return s!=="-"&&s!=="_"&&(s<"0"||s>"9")?n:O(this._prefixed,e,r)?null:hr(eu,e,r)?n:Dt(this._prefixed,e,r)||!i&&O(this._prefix,`${e.slice(r)}: `,0)?null:n}_unescape(e,r){let i=e.indexOf("\\");if(i<0)return e;let n="",s=0;for(;i>=0&&i+1<e.length;){let o=e[i+1],a=i+2,l;if(o==="u"||o==="U"){if(a+=o==="u"?4:8,a>e.length)return null;let u=0;for(let f=i+2;f<a;f++){let c=e.charCodeAt(f);if(c>=48&&c<=57)c-=48;else if(c>=65&&c<=70)c-=55;else if(c>=97&&c<=102)c-=87;else return null;u=u*16+c}if(!tu(u))return null;l=String.fromCodePoint(u)}else{if(!(o in r))return null;l=r[o]}n+=e.slice(s,i)+l,s=a,i=e.indexOf("\\",s)}return n+e.slice(s)}_parseLiteral(e,r){if(e.length-r>=3){let i=e[r],n=e[r+1]===i&&e[r+2]===i?3:1,s=i;n===3&&(s=i==='"'?'"""':"'''");let o=r+Math.max(this._literalClosingPos,n);for(;(o=e.indexOf(s,o))>r;){let a=0;for(;e[o-a-1]==="\\";)a++;if(a%2===0){let l=e.substring(r+n,o),u=l.split(/\r\n|\r|\n/),f=u.length-1,c=o-r+n;if(n===1&&f!==0||n===3&&this._lineMode)break;this._line+=f;let d=f===0?0:u[u.length-1].length+n;return{value:this._unescape(l,kn),matchLength:c,finalLineLength:d,tripleQuoted:n===3}}o++}this._literalClosingPos=e.length-r-n+1}return{value:"",matchLength:0,finalLineLength:0,tripleQuoted:!1}}_tryTokenizeToEnd(e,r){let i;try{this._tokenizeToEnd((n,s)=>{try{return e(n,s)}catch(o){throw i=o}},r)}catch(n){if(n===i||!(n instanceof RangeError))throw n;e(this._syntaxError(null,`Token too long on line ${this._line}.`))}}_syntaxError(e,r=`Unexpected "${e}" on line ${this._line}.`){this._input=null;let i=new Error(r);return i.context={token:void 0,line:this._line,previousToken:this.previousToken},i}_readStartingBom(e){return e.startsWith("\uFEFF")?(this._linePosition=1,e.slice(1)):e}tokenize(e,r){let i=this._tokenization={};if(this._line=1,this._linePosition=0,this._previousMarker=void 0,this.previousToken=void 0,this._literalClosingPos=0,this._input=void 0,typeof e=="string")if(this._input=this._readStartingBom(e),typeof r=="function")queueMicrotask(()=>{this._tokenization===i&&this._tryTokenizeToEnd(r,!0)});else{let n=[],s;if(this._tryTokenizeToEnd((o,a)=>o?s=o:n.push(a),!0),s)throw s;return n}else{let n,s=0;typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",o=>{if(this._tokenization===i&&this._input!==null&&o.length!==0){if(typeof o!="string"&&(n=n||new TextDecoder("utf-8",{ignoreBOM:!0}),!(o=n.decode(o,{stream:!0}))))return;typeof this._input=="undefined"?this._input=this._readStartingBom(o):this._input+=o,this._input.length>=s&&(this._tryTokenizeToEnd(r,!1),s=this._input!==null&&this._input.length>au?2*this._input.length:0)}}),e.on("end",()=>{if(this._tokenization===i&&this._input!==null){let o=n?n.decode():"";o&&(this._input=typeof this._input=="string"?this._input+o:o),typeof this._input=="string"&&this._tryTokenizeToEnd(r,!0)}}),e.on("error",o=>{this._tokenization===i&&r(o)})}}};var{rdf:qn,xsd:we}=P,ct,lu=0,ni="<>";var ri={namedNode:Wn,blankNode:Gn,variable:zn,literal:Qn,defaultGraph:uu,quad:ii,triple:ii,fromTerm:kt,fromQuad:Vn},J=ri,H=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}}},ft=class extends H{constructor(e){e!==""?super(e):(super(ni),Object.defineProperty(this,"value",{value:""}))}get termType(){return"NamedNode"}},xe=class t extends H{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 ft(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!=="@"?we.string:e.indexOf("--",r)>0?qn.dirLangString:qn.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}}}},Ut=class extends H{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},qt=class extends H{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},Wt=class extends H{constructor(){return super(""),ct||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};ct=new Wt;function Fe(t,e,r){if(e=e||ri,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===ri)return new xe(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;case"<":if(t===ni)return e.namedNode("");default:if(!r||!Array.isArray(t))return e.namedNode(t)}return e.quad(Fe(t[0],e,!0),Fe(t[1],e,!0),Fe(t[2],e,!0),t[3]&&Fe(t[3],e,!0))}function Be(t,e){if(typeof t=="string")return t;if(t instanceof H&&t.termType!=="Quad")return t.id;if(!t)return ct.id;switch(t.termType){case"NamedNode":{let i=t.value;return i!==""?i:ni}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!==we.string?`^^${t.datatype.value}`:""}`;case"Quad":let r=[Be(t.subject,!0),Be(t.predicate,!0),Be(t.object,!0)];return t.graph&&t.graph.termType!=="DefaultGraph"&&r.push(Be(t.graph,!0)),e?r:JSON.stringify(r);default:throw new Error(`Unexpected termType: ${t.termType}`)}}var De=class extends H{constructor(e,r,i,n){super(""),this._subject=e,this._predicate=r,this._object=i,this._graph=n||ct}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 Wn(t){return new ft(t)}function Gn(t){return new Ut(t||`n3-${lu++}`)}function Qn(t,e){if(typeof e=="string")return new xe(`"${t}"@${e.toLowerCase()}`);if(e!==void 0&&!("termType"in e))return new xe(`"${t}"@${e.language.toLowerCase()}${e.direction?`--${e.direction.toLowerCase()}`:""}`);let r=e?e.value:"";return r===""&&(typeof t=="boolean"?r=we.boolean:typeof t=="number"?Number.isFinite(t)?r=Number.isInteger(t)&&Math.abs(t)<1e21?we.integer:we.double:(r=we.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")):typeof t=="bigint"?r=we.integer:t instanceof Date&&!Number.isNaN(t.getTime())&&(r=we.dateTime,t=t.toISOString())),r===""||r===we.string?new xe(`"${t}"`):new xe(`"${t}"^^${r}`)}function zn(t){return new qt(t)}function uu(){return ct}function ii(t,e,r,i){return new De(t,e,r,i)}function kt(t){if(t instanceof H)return t;switch(t.termType){case"NamedNode":return Wn(t.value);case"BlankNode":return Gn(t.value);case"Variable":return zn(t.value);case"DefaultGraph":return ct;case"Literal":return Qn(t.value,t.language?t.direction?{language:t.language,direction:t.direction}:t.language:t.datatype);case"Quad":return Vn(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function Vn(t){if(t instanceof De)return t;if(t.termType!=="Quad")throw new Error(`Unexpected termType: ${t.termType}`);return ii(kt(t.subject),kt(t.predicate),kt(t.object),kt(t.graph))}var Hn=0,Kn=/(^|\/)\.\.?($|[/#?])/,fu=/^[^?#]*(?:^|\/)\.\.?(?:$|[/#?])/,Ee=class t{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Jn(this,e.factory);let r=typeof e.format=="string"?e.format.match(/(?:^|\W)(\w*)$/)[1].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;if(this._emitCurrent=this._emit,a&&(this._createQuad=this._createQuadInDirection,this._emit=this._emitInDirection,this._emitCurrent=this._emitCurrentInDirection),(this._supportsNamedGraphs=!(i||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(i||n||s||a),this._isImpliedBy=e.isImpliedBy,this._implicitEmptyPrefix=e.implicitEmptyPrefix!==!1,this._emptyFormulaAsTrue=e.emptyFormulaAsTrue!==!1,l&&(this._resolveRelativeIRI=f=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._directives=null,e.directives){this._directives=Object.create(null);for(let f of e.directives)this._directives[`@${f.toLowerCase()}`]=this._directives[f.toUpperCase()]=f}this._lexer=e.lexer||new Ge({lineMode:l,n3:a,isImpliedBy:this._isImpliedBy,directives:e.directives}),this._explicitQuantifiers=!!e.explicitQuantifiers,this._formulaScopedBlankNodes=e.formulaScopedBlankNodes!==!1,this._parseUnsupportedVersions=!!e.parseUnsupportedVersions,this._version=e.version;let u=e.maxTripleTermDepth;this._maxTripleTermDepth=u===1/0||Number.isInteger(u)&&u>=0?u:1024}static _resetBlankNodePrefix(){Hn=0}_setBase(e){if(!e)this._base="",this._basePath="",this._basePathHasDotSegments=!1;else{let r=e.indexOf("#");r>=0&&(e=e.substr(0,r)),this._base=e;let i=e.indexOf("?"),n=i<0?e:e.substr(0,i);this._basePath=e.indexOf("/")<0?e:n.substr(0,n.lastIndexOf("/")+1);let s=e;e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(\/\/[^\/?#]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1],e[2]!==void 0&&(s.length===this._baseRoot.length||s[this._baseRoot.length]==="?")&&(this._basePath=`${this._baseRoot}/`),this._basePathHasDotSegments=Kn.test(this._basePath)}}_enterTripleTerm(e,r,i,n){return this._tripleTermDepth>=this._maxTripleTermDepth?(this._error(`Triple terms nested deeper than ${this._maxTripleTermDepth} level${this._maxTripleTermDepth===1?"":"s"}`,n),!1):(this._tripleTermDepth++,this._saveContext(e,this._graph,r,i,null),this._graph=null,!0)}_saveContext(e,r,i,n,s){if(!this._n3Mode){this._contextStack.push({type:e,subject:i,predicate:n,object:s,graph:r});return}let o={type:e,subject:i,predicate:n,object:s,graph:r,inverse:this._inversePredicate,expectOf:this._expectOf,blankPrefix:this._prefixes._,prefixChanges:this._prefixChanges,quantifiedChanges:this._quantifiedChanges,emptyFormula:this._emptyFormula};e==="formula"&&(o.base=[this._base,this._basePath,this._baseRoot,this._baseScheme,this._basePathHasDotSegments],this._prefixChanges=[]),this._contextStack.push(o),this._inversePredicate=!1,this._expectOf=!1,(!this._formulaScopedBlankNodes||e==="formula")&&(this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantifiedChanges=[]),e==="formula"&&(this._subject=null,this._emptyFormula=!0)}_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._expectOf=i.expectOf,e==="formula"&&([this._base,this._basePath,this._baseRoot,this._baseScheme,this._basePathHasDotSegments]=i.base),this._prefixChanges!==i.prefixChanges&&(Yn(this._prefixes,this._prefixChanges),this._prefixChanges=i.prefixChanges),this._prefixes._=i.blankPrefix,this._quantifiedChanges!==i.quantifiedChanges&&(Yn(this._quantified,this._quantifiedChanges),this._quantifiedChanges=i.quantifiedChanges),this._emptyFormula=i.emptyFormula)}_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._directives!==null&&e.type in this._directives&&this._graph===null?(this._sparqlStyle=e.type[0]!=="@",this._directiveCallback(this._directives[e.type]),this._readDeclarationPunctuation):this._readSubject(e)}}_readInFormulaContext(e){switch(e.type){case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;default:return this._readSubject(e)}}_getStatementReader(){let e=this._contextStack[this._contextStack.length-1];return e&&e.type==="formula"?this._readInFormulaContext:this._readInTopContext}_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}_readList(e,r,i,n){let s=this._contextStack;return(s.length&&s[s.length-1]).type==="<<"?this._error("Unexpected list in reified triple",e):(this._saveContext("list",this._graph,r,i,n),this._subject=null,this._readListItem)}_readSubject(e){switch(this._predicate=null,e.type!=="}"&&(this._emptyFormula=!1),e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":return this._readList(e,this.RDF_NIL,null,null);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._factory.blankNode(),null,null),this._readInFormulaContext):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._enterTripleTerm("<<(",null,null,e)&&this._readSubject:this._error("Disallowed triple term as subject",e);case"<<":return this._enterTripleTerm("<<",null,null,e)&&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,i=!1;switch(r){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case"has":return this._readPredicateAfterVerb;case"is":return this._inversePredicate=!0,this._expectOf=!0,this._readPredicateAfterVerb;case"inversePredicate":return this._inversePredicate=!0,this._readPredicateAfterVerb;case"|}":return this._subject=null,this._readAnnotationBlockPunctuation(e);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)),i=!0;break;case"(":return this._n3Mode?this._readList(e,this._subject,this.RDF_NIL,null):this._error(`Expected entity but got ${r}`,e);case"[":return this._n3Mode?(this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead):this._error("Disallowed blank node as predicate",e);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._graph=this._factory.blankNode(),null),this._readSubject):this._readEntity(e);case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if((this._predicate=this._readEntity(e))===void 0)return;i=this._n3Mode}return this._validAnnotation=!0,i?this._getPathReader(this._readObject,"predicate"):this._readObject}_readPredicateAfterVerb(e){return e.type==="has"||e.type==="is"||e.type==="of"||e.type==="inversePredicate"?this._error(`Expected expression but got ${e.type}`,e):this._readPredicate(e)}_readObject(e){if(this._expectOf)return e.type!=="of"?this._error(`Expected of but got ${e.type}`,e):(this._expectOf=!1,this._readObject);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"(":return this._readList(e,this._subject,this._predicate,this.RDF_NIL);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readInFormulaContext):this._error("Unexpected graph",e);case"<<(":return this._enterTripleTerm("<<(",this._subject,this._predicate,e)&&this._readSubject;case"<<":return this._enterTripleTerm("<<",this._subject,this._predicate,e)&&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):e.type==="id"?this._readIriPropertyListId:(this._predicate=null,this._readPredicate(e))}}_readIriPropertyListId(e){let r=this._readEntity(e);if(r===void 0)return;if(r.termType!=="NamedNode")return this._error(`Expected IRI after id but got ${e.type}`,e);let i=this._subject;this._subject=r;let n=this._contextStack[this._contextStack.length-1];return n.subject===i&&(n.subject=r),n.predicate===i&&(n.predicate=r),n.object===i&&(n.object=r),this._predicate=null,this._readIriPropertyListPredicate}_readIriPropertyListPredicate(e){return e.type===";"||e.type==="]"||e.type==="."||e.type==="}"?this._error(`Expected predicate but got ${e.type}`,e):this._readPredicate(e)}_readBlankNodeTail(e){if(e.type!=="]")return this._readBlankNodePunctuation(e);this._subject!==null&&this._emitCurrent(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._getPathReader(this._readObject,"predicate"):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(this._object===null){if(n=this._getPathReader(this._readObject,"predicate"),this._predicate===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?(i=this._factory.blankNode(),r=this._factory.blankNode(),s===null?a.predicate===null?a.subject=i:a.object=i:this._emit(s,this.RDF_REST,i,this._graph),this._emit(i,this.RDF_FIRST,r,this._graph),this._saveContext("formula",this._graph,i,this.RDF_FIRST,this._graph=r),this._subject=null,this._readInFormulaContext):this._error("Unexpected graph",e);case"<<(":case"<<":if(!this._enterTripleTerm(e.type,null,null,e))return;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===null?a.predicate=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,n=!1;switch(e.type){case"type":case"typeIRI":let s=this._readEntity(e);if(s===void 0)return;if(s.value===P.rdf.langString||s.value===P.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,this._literalComponent=r,n=!0;break;default:i=this._factory.literal(this._literalValue)}return{token:e,literal:i,readCb:n}}_readDirCode(e){let r=this._literalComponent,i=this._literalListItem;if(e.type==="dircode"){let n=this._factory.literal(this._literalValue,{language:this._literalLanguage,direction:e.value});r==="subject"?this._subject=n:r==="predicate"?this._predicate=n:this._object=n,this._literalLanguage=void 0,e=null}if(r==="subject"||r==="predicate"){let n=r==="subject"?this._readPredicateOrNamedGraph:this._readObject;return this._getPathEndReader(e,n,r)||n.call(this,e)}return this._completeObjectLiteralPost(e,i)}_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 this._literalListItem=!1,this._readDirCode;let s=this._getPathEndReader(i.token,n,r);return s||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?(this._literalListItem=r,this._readDirCode):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){if(e.type!=="}")return this._readPunctuation(e);this._subject!==null&&this._emitCurrent(this._subject,this._predicate,this._object,this._graph);let r=this._graph,i=this._emptyFormula;return this._restoreContext("formula",e),i&&this._emptyFormulaAsTrue&&(this._subject===r?this._subject=this.N3_TRUE:this._predicate===r?this._predicate=this.N3_TRUE:this._object=this.N3_TRUE),this._object!==null?this._getPathReader(this._getContextEndReader(),"object"):this._predicate!==null?this._getPathReader(this._readObject,"predicate"):this._getPathReader(this._readPredicate,"subject")}_readPunctuation(e){let r,i=this._graph,n=this._subject,s=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._getStatementReader(),s&&(this._inversePredicate=!1);break;case";":s&&(this._inversePredicate=!1),r=this._readPredicate;break;case",":r=this._readObject;break;case"~":case"{|":return this._readAnnotationStart(e);case"|}":return this._error("Unexpected annotation syntax closing",e);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(n!==null){let o=this._predicate,a=this._object;this._emit(n,o,a,i,s)}return r}_readBlankNodePunctuation(e){let r,i=!1;switch(e.type){case";":i=this._inversePredicate,r=this._readPredicate;break;case",":r=this._readObject;break;case"~":case"{|":return this._readAnnotationStart(e);case"|}":return this._error("Unexpected annotation syntax closing",e);default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emitCurrent(this._subject,this._predicate,this._object,this._graph),i&&(this._inversePredicate=!1),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._prefixChanges!==null&&this._prefixChanges.push(this._prefix,this._prefixes[this._prefix]),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.prefix!==""||e.tripleQuoted?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._getStatementReader().call(this,e)):e.type!=="."?this._error("Expected declaration to end with a dot",e):this._getStatementReader()}_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._quantifiedChanges!==null&&this._quantifiedChanges.push(r.id,this._quantified[r.id]),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,r){return this._afterPath=e,this._pathPosition=r||(this._predicate===null?"subject":"object"),this._readPath}_getPathEndReader(e,r,i){if(e!==null&&e.type!=="!"&&e.type!=="^")return null;let n=this._getPathReader(r,i);return e===null?n:n.call(this,e)}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:let r=this._afterPath,i=this._contextStack,n=i.length&&i[i.length-1];if(n&&n.type==="item"){let s=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,s,this._graph)}return this._afterPath=null,this._pathPosition=null,r.call(this,e)}}_readForwardPath(e){let r,i,n=this._factory.blankNode();if((i=this._readEntity(e))!==void 0)return this._pathPosition==="subject"?(r=this._subject,this._subject=n):this._pathPosition==="predicate"?(r=this._predicate,this._predicate=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._pathPosition==="subject"?(n=this._subject,this._subject=r):this._pathPosition==="predicate"?(n=this._predicate,this._predicate=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._createQuad(this._subject,this._predicate,this._object,this._graph,this._inversePredicate);this._restoreContext("<<(",e),this._tripleTermDepth--;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),this._tripleTermDepth--;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 e.type===">>"?this._readReifiedTripleTail(e):(this._reifier=this._readEntity(e),this._readReifiedTripleTail)}_readAnnotationStart(e){return this._emitCurrent(this._subject,this._predicate,this._object,this._graph),this._tripleTerm=null,this._readAnnotation(e)}_readAnnotation(e){switch(e.type){case"~":return this._readReifierInAnnotation;case"{|":return this._readAnnotationBlockHead(e)}switch(this._tripleTerm=null,e.type){case";":return this._inversePredicate=!1,this._readPredicate;case",":return this._readObject;default:return this._subject=null,this._getContextEndReader().call(this,e)}}_readReifierInAnnotation(e){switch(e.type){case"IRI":case"typeIRI":case"type":case"prefixed":case"blank":case"var":return this._reifier=this._readEntity(e),this._readAnnotationBlockOrReifier}return this._reifier=this._factory.blankNode(),this._readAnnotationBlockOrReifier(e)}_readAnnotationBlockOrReifier(e){return e.type==="{|"?this._readAnnotationBlockHead(e):(this._readTripleTerm(),this._readAnnotation(e))}_readAnnotationBlockHead(e){let r=this._readTripleTerm();return this._saveContext("annotation",this._graph,this._subject,this._predicate,this._object),this._contextStack[this._contextStack.length-1].tripleTerm=this._tripleTerm,this._subject=r,this._predicate=this._object=this._tripleTerm=null,this._inversePredicate=!1,this._validAnnotation=!1,this._readPredicate}_readAnnotationBlockPunctuation(e){let r=this._contextStack;if(e.type==="|}"){if(!r.length||r[r.length-1].type!=="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._emitCurrent(this._subject,this._predicate,this._object,this._graph);let{tripleTerm:i}=r[r.length-1];return this._restoreContext("annotation",e),this._tripleTerm=i,this._readAnnotation}return this._readBlankNodePunctuation(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._createQuad(this._subject,this._predicate,this._object,null,this._inversePredicate),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;case"annotation":return this._readAnnotationBlockPunctuation}}_createQuad(e,r,i,n){return this._factory.quad(e,r,i,n||this.DEFAULTGRAPH)}_createQuadInDirection(e,r,i,n,s){return s?this._factory.quad(i,r,e,n||this.DEFAULTGRAPH):this._factory.quad(e,r,i,n||this.DEFAULTGRAPH)}_emitInDirection(e,r,i,n,s){this._callback(null,this._createQuad(e,r,i,n,s))}_emitCurrentInDirection(e,r,i,n){this._callback(null,this._createQuad(e,r,i,n,this._inversePredicate))}_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=Gt}_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"?":{let r=this._base.indexOf("?");return(r<0?this._base:this._base.substr(0,r))+e}case"/":return e[1]!=="/"?this._baseRoot+this._removeDotSegments(e):this._baseScheme?this._removeDotSegments(this._baseScheme+e):this._removeDotSegments(`:${e}`).substr(1);default:return/^[^/:]*:/.test(e)?null:this._basePathHasDotSegments||fu.test(e)?this._removeDotSegments(this._basePath+e):this._basePath+e}}_removeDotSegments(e){if(!Kn.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]!=="/"&&e[s]!=="?"&&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,u,f,c;r&&(r.onQuad||r.onPrefix||r.onComment||r.onVersion||r.onDirective||r.onToken||r.onTokenEnd)?(s=r.onQuad,o=r.onPrefix,a=r.onComment,l=r.onVersion,u=r.onDirective,f=r.onToken,c=r.onTokenEnd):(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${Hn++}_`,this._n3Mode&&this._implicitEmptyPrefix&&this._base&&(this._prefixes[""]=this._resolveIRI("#")),this._prefixCallback=o||Gt,this._versionCallback=l||Gt,this._directiveCallback=u||Gt,this._inversePredicate=!1,this._expectOf=!1,this._quantified=Object.create(null),this._prefixChanges=null,this._quantifiedChanges=null,this._emptyFormula=!1,this._tripleTermDepth=0;let d=p=>this._readCallback=this._readCallback(p);if(a||this._lexer.comments){this._lexer.comments=!0;let p=d;d=h=>h.type!=="comment"?p(h):(a&&a(h.value),this._readCallback)}if(f||c){let p=d;d=h=>{try{try{return f&&f(h),p(h)}finally{c&&c(h)}}catch(y){throw this._readCallback=null,y}}}if(!s){let p=[],h;if(this._callback=(y,g)=>{y?h=y:g&&p.push(g)},this._lexer.tokenize(e).every(d),h)throw h;return p}let _=(p,h)=>{p!==null?(this._callback(p),this._callback=Gt):this._readCallback&&d(h)};this._callback=s,this._lexer.tokenize(e,_)}};function Yn(t,e){for(let r=e.length-2;r>=0;r-=2)e[r+1]===void 0?delete t[e[r]]:t[e[r]]=e[r+1]}function Gt(){}function Jn(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(P.rdf.first),t.RDF_REST=e.namedNode(P.rdf.rest),t.RDF_NIL=e.namedNode(P.rdf.nil),t.RDF_REIFIES=e.namedNode(P.rdf.reifies),t.N3_FORALL=e.namedNode(P.r.forAll),t.N3_FORSOME=e.namedNode(P.r.forSome),t.N3_TRUE=e.literal("true",e.namedNode(P.xsd.boolean)),t.ABBREVIATIONS={a:e.namedNode(P.rdf.type),"=":e.namedNode(P.owl.sameAs),">":e.namedNode(P.log.implies),"<":e.namedNode(P.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}Ee.SUPPORTED_VERSIONS=["1.2","1.2-basic","1.1"];Jn(Ee.prototype,J);var si={};Yl(si,{inDefaultGraph:()=>bu,isBlankNode:()=>du,isDefaultGraph:()=>se,isLiteral:()=>hu,isNamedNode:()=>cu,isQuad:()=>pu,isVariable:()=>_u,prefix:()=>yu,prefixes:()=>Zn});function cu(t){return!!t&&t.termType==="NamedNode"}function du(t){return!!t&&t.termType==="BlankNode"}function hu(t){return!!t&&t.termType==="Literal"}function _u(t){return!!t&&t.termType==="Variable"}function pu(t){return!!t&&t.termType==="Quad"}function se(t){return!!t&&t.termType==="DefaultGraph"}function bu(t){return se(t.graph)}function yu(t,e){return Zn({"":t.value||t},e)("")}function Zn(t,e){let r=Object.create(null);for(let n in t)i(n,t[n]);e=e||J;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 dt(t){return t.replace(/[.*+?^${}()|[\]\\/-]/g,"\\$&")}var gu=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,mu=/^(?:(?!\.\.?(?:[/?#]|$))[^/?#]+(?:\/[^/?#]{3,})*\/?)?(?:[?#]|$)/,Xn="./",wu="../",oi="?",es="#",Qe=class t{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!gu.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!t.supports(this.base))return this._baseMatcher=/.^/;let e=/^[^:]*:\/*/.exec(this.base)[0],r=["^",dt(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]===es?l=s.lastIndex-1:(r.push(dt(o[0]),"(?:"),i.push(")?"),o[1]!==oi?n.push(u=s.lastIndex):(a=u=s.lastIndex,l=this.base.indexOf(es,a),this._pathReplacements[a]=oi));for(let f=0;f<n.length;f++)this._pathReplacements[n[f]]=wu.repeat(n.length-f-1);return this._pathReplacements[n[n.length-1]]=Xn,this._baseLength=l>0?l:this.base.length,r.push(dt(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!==oi&&!mu.test(s)?e:n===Xn&&/^[^?#]/.test(s)&&(s.indexOf(":")<0||!/^[^/?#]*:/.test(s))?s:n+s}return e.substring(i-1)}};var ht=J.defaultGraph(),{rdf:xu,xsd:_t}=P,{hasOwnProperty:Eu}=Object.prototype,Su=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,Iu=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Ru=/[^ !#-\[\]-~\u0080-\uFFFD]/,Tu=/[^ !#-\[\]-~\u0080-\uFFFD]/g,ts={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"},Au=/["\\\u0000-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?:^|[^\ud800-\udbff])[\udc00-\udfff]/,ze=class extends H{equals(e){return e===this}},le=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}if(r.version&&Au.test(r.version))throw new Error(`Invalid version label: ${JSON.stringify(r.version)}`);this._subject=null,/triple|quad/i.test(r.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine,this._escape=Ru,this._escapeAll=Tu,this._characterReplacer=Nu,r.version&&this._write(`VERSION "${r.version}"
|
|
4
|
+
`)):(this._lineMode=!1,this._escape=Su,this._escapeAll=Iu,this._characterReplacer=vu,this._graph=ht,r.version&&this._write(`@version "${r.version}".
|
|
5
|
+
`),this._prefixIRIs=Object.create(null),this._prefixPatterns=Object.create(null),r.baseIRI&&(this._baseIri=new Qe(r.baseIRI),r.writeBase!==!1&&this._write(`@base <${r.baseIRI}>.
|
|
6
|
+
`)),r.prefixes&&this.addPrefixes(r.prefixes))}get _inDefaultGraph(){return ht.equals(this._graph)}_write(e,r){this._outputStream.write(e,"utf8",r)}_endStatement(){this._subject!==null&&(this._write(this._inDefaultGraph?`.
|
|
5
7
|
`:`
|
|
6
8
|
}
|
|
7
|
-
`)
|
|
9
|
+
`),this._subject=null,this._graph=ht)}_writeQuad(e,r,i,n,s){try{n!==this._graph&&(!n.equals(this._graph)||n.termType!==this._graph.termType)&&(this._write((this._subject===null?"":this._inDefaultGraph?`.
|
|
10
|
+
`:`
|
|
11
|
+
}
|
|
12
|
+
`)+(ht.equals(n)?"":`${this._encodeIriOrBlank(n)} {
|
|
8
13
|
`)),this._graph=n,this._subject=null),e===this._subject||e.equals(this._subject)?r===this._predicate||r.equals(this._predicate)?this._write(`, ${this._encodeObject(i)}`,s):this._write(`;
|
|
9
14
|
${this._encodePredicate(this._predicate=r)} ${this._encodeObject(i)}`,s):this._write(`${(this._subject===null?"":`.
|
|
10
15
|
`)+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)} ${r.termType==="Literal"?this._encodeLiteral(r):this._encodeIriOrBlank(r)} ${this._encodeObject(i)}${n&&!se(n)?` ${this._encodeIriOrBlank(n)} .
|
|
11
16
|
`:` .
|
|
12
|
-
`}`}quadsToString(e){let r="";for(let i of e)r+=this.quadToString(i.subject,i.predicate,i.object,i.graph);return r}_encodeSubject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeIriOrBlank(e){if(e.termType!=="NamedNode")return this._lists&&
|
|
13
|
-
`:`
|
|
14
|
-
}
|
|
15
|
-
`),this._subject=null,this._graph=""),this._prefixIRIs[s]=n+=":",this._prefixPatterns[s]=ct(s),this._write(`@prefix ${n} <${s}>.
|
|
17
|
+
`}`}quadsToString(e){let r="";for(let i of e)r+=this.quadToString(i.subject,i.predicate,i.object,i.graph);return r}_encodeSubject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeIriOrBlank(e){if(e.termType!=="NamedNode")return this._lists&&Eu.call(this._lists,e.value)&&(e=this.list(this._lists[e.value])),e instanceof H?e.id:e.termType==="Variable"?`?${e.value}`:`_:${e.value}`;let r=e.value;this._baseIri&&(r=this._baseIri.toRelative(r)),this._escape.test(r)&&(r=r.replace(this._escapeAll,this._characterReplacer));let i=this._hasPrefixes?(this._prefixRegex||this._createPrefixRegex()).exec(r):null;return i?this._prefixIRIs[i[1]]+i[2]:`<${r}>`}_encodeLiteral(e){let r=e.value;this._escape.test(r)&&(r=r.replace(this._escapeAll,this._characterReplacer));let i=e.language;if(i){let n=e.direction,s=n?`--${n}`:"";return`"${r}"@${i}${s}`}if(this._lineMode){if(e.datatype.value===_t.string)return`"${r}"`}else switch(e.datatype.value){case _t.string:return`"${r}"`;case _t.boolean:if(r==="true"||r==="false")return r;break;case _t.integer:if(/^[+-]?\d+$/.test(r))return r;break;case _t.decimal:if(/^[+-]?\d*\.\d+$/.test(r))return r;break;case _t.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(r))return r;break}return`"${r}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){switch(e.termType){case"NamedNode":return e.value===xu.type?"a":this._encodeIriOrBlank(e);case"Literal":return this._encodeLiteral(e);default:return 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}){let s=this._lineMode?" ":"";return`<<(${s}${this._encodeSubject(e)} ${this._encodePredicate(r)} ${this._encodeObject(i)}${se(n)?"":` ${this._encodeIriOrBlank(n)}`}${s})>>`}_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,ht,n):this._writeQuad(e,r,i,n||ht,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._endStatement(),this._prefixIRIs[s]=n+=":",this._prefixPatterns[s]=dt(s),this._write(`@prefix ${n} <${s}>.
|
|
16
18
|
`)}i&&(this._hasPrefixes=!0,this._prefixRegex=null),this._write(i?`
|
|
17
19
|
`:"",r)}_createPrefixRegex(){let e="";for(let r in this._prefixPatterns)e+=e?`|${this._prefixPatterns[r]}`:this._prefixPatterns[r];return this._prefixRegex=new RegExp(`^(${e})([_a-zA-Z0-9](?:\\.?[\\-_a-zA-Z0-9])*)$`)}blank(e,r){let i=e,n,s;switch(e===void 0?i=[]:e.termType?i=[{predicate:e,object:r}]:"length"in e||(i=[e]),s=i.length){case 0:return new ze("[]");case 1:if(n=i[0],!(n.object instanceof ze))return new ze(`[ ${this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)} ]`);default:let o="[";for(let a=0;a<s;a++)n=i[a],n.predicate.equals(e)?o+=`, ${this._encodeObject(n.object)}`:(o+=`${(a?`;
|
|
18
20
|
`:`
|
|
19
21
|
`)+this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)}`,e=n.predicate);return new ze(`${o}
|
|
20
|
-
]`)}}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 ze(`(${i.join(" ")})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
|
|
21
|
-
`:`
|
|
22
|
-
}
|
|
23
|
-
`),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(i){}r&&r()}};function Ru(t){let e=es[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}function Tu(t){let e=es[t];return e===void 0&&(e=t.charCodeAt(0).toString(16).toUpperCase(),e="\\u0000".substr(0,6-e.length)+e),e}var Jr=ei(Yr());var Lt=Symbol("iter"),C=Symbol("size"),Cn;function Cp({store:t,observer:e}){let r=t.deref();r&&r._removeObserver(e)}function Fn(t,e,r,i){let n=t&&t[e],s=n&&n[r];return!!s&&i in s}function Ct(t,e,r=4){let i=t[C]||0;for(let n in e)n in t?r!==0&&Ct(t[n],e[n],r-1):(i++,t[n]=r===0?null:Ct(Object.create(null),e[n],r-1));return r<=2&&(t[C]=i),t}function Cl(t,e,r=4){let i=!1,n=0;r<=2&&e[C]<t[C]&&([t,e]=[e,t]);for(let s in t)if(s in e){let o=r===0?null:Cl(t[s],e[s],r-1);if(o!==!1)i=i||Object.create(null),i[s]=o,n++;else if(r===3)return!1}return r<=2&&i&&(i[C]=n),i}function Fl(t,e,r=4){let i=!1,n=0;for(let s in t)if(!(s in e))i=i||Object.create(null),i[s]=r===0?null:Ct({},t[s],r-1),n++;else if(r!==0){let o=Fl(t[s],e[s],r-1);if(o!==!1)i=i||Object.create(null),i[s]=o,n++;else if(r===3)return!1}return r<=2&&i&&(i[C]=n),i}var Fp=/^[?_"[.<]/;function J(t){if(typeof t=="string")return t.charCodeAt(0)!==60||t==="<>"?t:`<${t}>`;let e=Be(t);return e.charCodeAt(0)>=97||!t?e:t.termType==="Quad"?JSON.stringify(Bl(t)):t.termType!=="NamedNode"||!Fp.test(t.value)?e:`<${t.value}>`}function Bl(t){let e=[Zr(t.subject),Zr(t.predicate),Zr(t.object)];return t.graph&&!se(t.graph)&&e.push(Zr(t.graph)),e}function Zr(t){return t.termType==="Quad"?Bl(t):J(t)}var nr=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||Y}_termFromId(e){if(e[0]==="<")return this._factory.namedNode(e.substring(1,e.length-1));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 Fe(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&&(se(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${r}.${i}.${n}.${s}`:`.${r}.${i}.${n}`]}return typeof e=="string"?this._stringToNumericId(e):this._ids[J(e)]}_stringToNumericId(e){let r=this._ids[e];return(r?this._entities[r].charCodeAt(0)!==60:e.charCodeAt(0)!==60)||e==="<>"?r:this._ids[`<${e}>`]}_termToNewNumericId(e){if(typeof e=="string")return this._stringToNumericId(e)||this._addEntity(J(e));let r=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${se(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:J(e);return this._ids[r]||this._addEntity(r)}_addEntity(e){return this._ids[this._entities[++this._id]=e]=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),this._observers=null,!r&&e&&!e[0]&&typeof e.match!="function"&&(r=e,e=null),r=r||{},this._factory=r.factory||Y,this._matchSemantics=Bn(r.matchSemantics),this._entityIndex=r.entityIndex||new nr({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+=n[a][C];return this._size=e}_addToIndex(e,r,i,n){let s=e[r];s||(e[r]=s={[C]:0},e[C]++);let o=s[i];o||(s[i]=o={[C]:0},s[C]++);let a=n in o;return a||(o[n]=null,o[C]++),!a}_removeFromIndex(e,r,i,n){let s=e[r],o=s[i];delete o[n],--o[C]===0&&(delete s[i],--s[C]===0&&(delete e[r],e[C]--))}*_findInIndex(e,r,i,n,s,o,a,l){let u=this._entities,f=this._termFromId(u[l]),c={subject:null,predicate:null,object:null};if(n){let _=e[r],p=_&&_[i];if(!p||!(n in p))return;c[s]=this._termFromId(u[r]),c[o]=this._termFromId(u[i]),c[a]=this._termFromId(u[n]),yield this._factory.quad(c.subject,c.predicate,c.object,f);return}if(r&&!(r in e))return;let d=r?null:Object.keys(e);for(let _=0,p=r||d[0];p;p=d&&d[++_]){let h=e[p];if(!h)continue;if(c[s]=this._termFromId(u[p]),i&&!(i in h))return;let y=i?null:Object.keys(h);for(let g=0,S=i||y[0];S;S=y&&y[++g]){let x=h[S];if(!x)continue;c[o]=this._termFromId(u[S]);let m=Object.keys(x);for(let w=0;w<m.length;w++)c[a]=this._termFromId(u[m[w]]),yield this._factory.quad(c.subject,c.predicate,c.object,f)}}}_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;if(r){if(!(o=e[r]))return 0;if(i)return(a=o[i])?n?n in a?1:0:a[C]:0;let u=Object.keys(o);for(let f=0;f<u.length;f++)s+=o[u[f]][C];return s}let l=Object.keys(e);for(let u=0;u<l.length;u++){o=e[l[u]];let f=Object.keys(o);for(let c=0;c<f.length;c++)s+=o[f[c]][C]}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_addObserver(e){let r=new WeakRef(e);return(Cn||(Cn=new FinalizationRegistry(Cp))).register(e,{store:new WeakRef(this),observer:r},r),(this._observers||(this._observers=new Set)).add(r),r}_removeObserver(e){Cn.unregister(e),this._observers&&(this._observers.delete(e),this._observers.size===0&&(this._observers=null))}_notifyObservers(e,r,i,n,s){for(let o of this._observers){let a=o.deref();a?a._onParentMutation(e,r,i,n,s):this._removeObserver(o)}}_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){return r||(n=e.graph,i=e.object,r=e.predicate,e=e.subject),n=n?this._termToNewNumericId(n):1,e=this._termToNewNumericId(e),r=this._termToNewNumericId(r),i=this._termToNewNumericId(i),this._addQuad(e,r,i,n)}_addQuad(e,r,i,n){let s=this._graphs[n];if(s||(s=this._graphs[n]={subjects:{[C]:0},predicates:{[C]:0},objects:{[C]:0}},Object.freeze(s)),this._observers!==null){if(Fn(s.subjects,e,r,i))return!1;this._notifyObservers(e,r,i,n,!0)}return 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===""||se(n)?1:this._termToNumericId(n),u=l&&this._graphs[l];return!!s&&!!o&&!!a&&!!u&&Fn(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){return r||({subject:e,predicate:r,object:i,graph:n}=e),n=n?this._termToNumericId(n):1,!(e=e&&this._termToNumericId(e))||!(r=r&&this._termToNumericId(r))||!(i=i&&this._termToNumericId(i))?!1:this._removeQuad(e,r,i,n)}_removeQuad(e,r,i,n){let s=this._graphs,o=s[n];return!o||!Fn(o.subjects,e,r,i)?!1:(this._observers!==null&&this._notifyObservers(e,r,i,n,!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--,o.subjects[C]===0&&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 Jr.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*ne(this._findInIndex(o.objects,u,a,l,"object","subject","predicate",f)):yield*ne(this._findInIndex(o.subjects,a,l,null,"subject","predicate","object",f)):l?yield*ne(this._findInIndex(o.predicates,l,u,null,"predicate","object","subject",f)):u?yield*ne(this._findInIndex(o.objects,u,null,null,"object","subject","predicate",f)):yield*ne(this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",f)))}match(e,r,i,n,s=null){return new qe(this,e,r,i,n,{entityIndex:this._entityIndex,matchSemantics:s&&s.matchSemantics!==void 0?s.matchSemantics:this._matchSemantics})}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,allowExtraArcs:i=!1}={}){let n=Object.create(null),s=r?(()=>!0):((l,u)=>{throw new Error(`${l.value} ${u}`)}),o=this.getQuads(null,N.rdf.rest,N.rdf.nil,null),a=[];return o.forEach(l=>{let u=[],f=!1,c=!1,d,_,p=l.graph,h=[],y=l.subject;for(;y&&!f;){let g=this.getQuads(null,null,y,null),S=this.getQuads(y,null,null,null),x,m=null,w=null,R=null;for(let T=0;T<S.length&&!f;T++)x=S[T],x.graph.equals(p)?d?f=s(y,"has non-list arcs out"):x.predicate.value===N.rdf.first?(m?f=s(y,"has multiple rdf:first arcs"):m=x,e&&m===x&&h.push(x)):x.predicate.value===N.rdf.rest?(w?f=s(y,"has multiple rdf:rest arcs"):w=x,e&&w===x&&h.push(x)):g.length?i?c=!0:f=s(y,`has non-list arc ${x.predicate.value}`):(d=x,_="subject"):f=s(y,"not confined to single graph");for(let T=0;T<g.length&&!f;++T)x=g[T],d?f=s(y,"can't have coreferences"):x.predicate.value===N.rdf.rest?R?f=s(y,"has incoming rdf:rest arcs"):R=x:(d=x,_="object");m?u.push(m.object):f=s(y,"has no list head"),y=R&&R.subject}if(f)e=!1;else if(u.reverse(),d&&(n[d[_].value]=u),e&&!c)for(let g=0;g<h.length;g++)a.push(h[g])}),e&&this.removeQuads(a),n}addAll(e){if(e instanceof qe&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(this._observers===null&&e instanceof t&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=Ct(this._graphs,e._graphs),this._size=null);else for(let r of e)this.add(r);return this}contains(e){if(e instanceof qe&&(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 d in a[c])if(!(d in l))return!1}}}return!0}deleteMatches(e,r,i,n){for(let s of this.match(e,r,i,n,{matchSemantics:"lazy"}))this.removeQuad(s);return this}difference(e){if(e&&e instanceof qe&&(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 qe&&(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 qe&&(e=e.filtered),e===this){let r=new t({entityIndex:this._entityIndex});return r._graphs=Ct(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=Cl(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(null,null,null,null,{matchSemantics:"lazy"})}toString(){return new le().quadsToString(this)}union(e){let r=new t({entityIndex:this._entityIndex});return r._graphs=Ct(Object.create(null),this._graphs),r._size=this._size,r.addAll(e),r}[Symbol.iterator](){return this.readQuads()}};function me(t,e,r=0){let i=e[r];if(i&&!(i in t))return!1;let n=!1,s=0;for(let o in i?{[i]:t[i]}:t){let a=r===2?null:me(t[o],e,r+1);a!==!1&&(n=n||Object.create(null),n[o]=a,s++)}return n&&(n[C]=s),n}function jl(t,e,r,i,n){let s={store:t,ids:[]},o=e&&t._termToNumericId(e),a=r&&t._termToNumericId(r),l=i&&t._termToNumericId(i),u,f,c,d,_;l&&(o||!a)?(u="objects",[f,c,d]=[l,o,a],_=[2,0,1]):!o&&a?(u="predicates",[f,c,d]=[a,l,o],_=[1,2,0]):(u="subjects",[f,c,d]=[o,a,l],_=[0,1,2]);let p=t._getGraphs(n),h=[];for(let y in p){let g=p[y][u],S=Number(y);for(let x in f?{[f]:g[f]}:g){let m=g[x];if(m){h[_[0]]=Number(x);for(let w in c?{[c]:m[c]}:m){let R=m[w];if(R){h[_[1]]=Number(w);for(let T in d?d in R?{[d]:null}:{}:R)h[_[2]]=Number(T),s.ids.push(h[0],h[1],h[2],S)}}}}}return s}function*Bp({store:t,ids:e},r){let i=t._entities,n,s,o,a,l,u,f,c;for(let d=r*4;d<e.length;d+=4)l!==e[d]&&(n=t._termFromId(i[l=e[d]])),u!==e[d+1]&&(s=t._termFromId(i[u=e[d+1]])),f!==e[d+2]&&(o=t._termFromId(i[f=e[d+2]])),c!==e[d+3]&&(a=t._termFromId(i[c=e[d+3]])),yield t._factory.quad(n,s,o,a)}function Bn(t="lazy"){if(t!=="lazy"&&t!=="snapshot"&&t!=="forwarded")throw new Error(`Unknown matchSemantics: ${t}`);if(t!=="lazy"&&(typeof WeakRef!="function"||typeof FinalizationRegistry!="function"))throw new Error("Non-lazy matchSemantics requires WeakRef and FinalizationRegistry support");return t}function Ll(t,e){let r=new Array(4);for(let i=0;i<4;i++){let n=t[i],s=e[i];if(n==null)r[i]=s;else if(s==null||J(n)===J(s))r[i]=n;else return!1}return r}var qe=class t extends Jr.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});let a=this._semantics=Bn(o.matchSemantics);o.matchesNothing&&(this._matchesNothing=!0,this._filtered=new je({factory:e._factory,entityIndex:o.entityIndex})),a!=="lazy"&&(this._readers=null,this._subjectId=this._predicateId=this._objectId=this._graphId=void 0,this._matchesNothing||(this._observer=e._addObserver(this)))}_matchesPattern(e,r,i,n){let{subject:s,predicate:o,object:a,graph:l,n3Store:u}=this;return s&&e!==(this._subjectId||(this._subjectId=u._termToNumericId(s)))||o&&r!==(this._predicateId||(this._predicateId=u._termToNumericId(o)))||a&&i!==(this._objectId||(this._objectId=u._termToNumericId(a)))?!1:l==null||n===(this._graphId||(this._graphId=l===""||se(l)?1:u._termToNumericId(l)))}_matchesQuad(e){let{subject:r,predicate:i,object:n,graph:s}=this;return!this._matchesNothing&&(r==null||J(r)===J(e.subject))&&(i==null||J(i)===J(e.predicate))&&(n==null||J(n)===J(e.object))&&(s==null||J(s)===J(e.graph))}_assertMatchesPattern(e){if(!this._matchesQuad(e))throw new Error("Quad does not match the forwarded view pattern")}_sourceIterator(){return this._filtered?this._filtered[Symbol.iterator]():this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}_freezeCurrentIterators(){this._readers&&(this._readers.snapshot=this._filtered?jl(this._filtered):jl(this.n3Store,this.subject,this.predicate,this.object,this.graph),this._readers=null)}_onParentMutation(e,r,i,n,s){if(this._matchesPattern(e,r,i,n)){if(this._freezeCurrentIterators(),this._semantics==="forwarded"){this._filtered&&(s?this._filtered._addQuad(e,r,i,n):this._filtered._removeQuad(e,r,i,n));return}this._filtered=this.filtered}}get filtered(){if(!this._filtered){let{n3Store:e,graph:r,object:i,predicate:n,subject:s}=this;this._semantics!=="lazy"&&this._freezeCurrentIterators();let o=this._filtered=new je({factory:e._factory,entityIndex:this.options.entityIndex});this._semantics==="snapshot"&&this._detachObserver();let 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 d,_,p,h;(h=f[c])&&(!a&&l?(_=me(h.predicates,[l,u,a]))&&(d=me(h.subjects,[a,l,u]),p=me(h.objects,[u,a,l])):u?(p=me(h.objects,[u,a,l]))&&(d=me(h.subjects,[a,l,u]),_=me(h.predicates,[l,u,a])):(d=me(h.subjects,[a,l,u]))&&(_=me(h.predicates,[l,u,a]),p=me(h.objects,[u,a,l])),d&&(o._graphs[c]={subjects:d,predicates:_,objects:p}))}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Lt]&&(this[Lt]=this[Symbol.iterator]());let r=this[Lt];for(;--e>=0;){let{done:i,value:n}=r.next();if(i){this.push(null);return}this.push(n)}}_destroy(e,r){this[Lt]&&(this[Lt].return(),this[Lt]=null),r(e)}_detachObserver(){this._observer&&(this.n3Store._removeObserver(this._observer),this._observer=null)}_detach(){return this._filtered=this.filtered,this._detachObserver(),this._semantics==="lazy"&&(this._readers=null),this._semantics="snapshot",this}addAll(e){if(this._semantics==="forwarded"){for(let r of e)this._assertMatchesPattern(r),this.n3Store.addQuad(r);return this}return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,r,i,n){if(this._semantics==="forwarded"){if(this._matchesNothing)throw new Error("Cannot delete from a conflicting forwarded view pattern");let s=Ll([this.subject,this.predicate,this.object,this.graph],[e,r,i,n]);if(!s)throw new Error("Deletion pattern does not match the forwarded view pattern");return this.n3Store.deleteMatches(...s),this}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(this._semantics==="forwarded"?o=>e(o,this):e,r,i,n,s)}filter(e){return this.filtered.filter(this._semantics==="forwarded"?r=>e(r,this):e)}forEach(e,r,i,n,s){return this.filtered.forEach(this._semantics==="forwarded"?o=>e(o,this):e,r,i,n,s)}import(e){if(this._semantics!=="forwarded")return this.filtered.import(e);let r=this;function i(n){try{r._assertMatchesPattern(n),r.n3Store.addQuad(n)}catch(s){e.removeListener("data",i),typeof e.destroy=="function"?e.destroy(s):e.emit("error",s)}}return e.on("data",i),e}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(this._semantics==="forwarded"?r=>e(r,this):e)}some(e,r,i,n,s){return this.filtered.some(this._semantics==="forwarded"?o=>e(o,this):e,r,i,n,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._semantics!=="lazy"?Jr.Readable.from(this[Symbol.iterator]()):this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph,{matchSemantics:"lazy"})}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph,{matchSemantics:"lazy"}).addAll(e)}toArray(){return this._semantics!=="lazy"?[...this]:this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,r){return this.filtered.reduce(this._semantics==="forwarded"?(i,n)=>e(i,n,this):e,r)}toString(){return new le().quadsToString(this)}add(e){return this._semantics==="forwarded"?(this._assertMatchesPattern(e),this.n3Store.addQuad(e),this):this.filtered.add(e)}delete(e){return this._semantics==="forwarded"?(this._assertMatchesPattern(e),this.n3Store.removeQuad(e),this):this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,r,i,n,s=null){let o=s&&s.matchSemantics;if(s&&o!==void 0&&(Bn(o),o!==this._semantics))throw new Error(`Cannot override matchSemantics on a view: inherited "${this._semantics}", received "${o}"`);if(this._semantics!=="forwarded")return new t(this.filtered,e,r,i,n,{entityIndex:this.options.entityIndex,matchSemantics:this._semantics});let a=!this._matchesNothing&&Ll([this.subject,this.predicate,this.object,this.graph],[e,r,i,n]),[l,u,f,c]=a||[null,null,null,null];return new t(this.n3Store,l,u,f,c,{entityIndex:this.options.entityIndex,matchSemantics:"forwarded",matchesNothing:!a})}[Symbol.iterator](){return this._semantics==="lazy"?this._sourceIterator():this._iterateStable()}*_iterateStable(){let e=this._readers||(this._readers={count:0,snapshot:null}),r=this._sourceIterator(),i=0;e.count++;try{for(;!e.snapshot;){let{value:n,done:s}=r.next();if(e.snapshot||s)break;i++,yield n}e.snapshot&&(yield*ne(Bp(e.snapshot,i)))}finally{r.return(),--e.count===0&&(e.snapshot=null,this._readers===e&&(this._readers=null))}}};var sr=class{dataset(e){return new je(e)}};function Ol(t){let e=[];for(let{subject:r,object:i}of t.match(null,Y.namedNode("http://www.w3.org/2000/10/swap/log#implies"),null,Y.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 or=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,o){let a=this._store;if(a._observers){if(!a._addQuad(e,r,i,this._graphId))return}else{if(!a._addToIndex(n.subjects,e,r,i))return;a._addToIndex(n.predicates,r,i,e),a._addToIndex(n.objects,i,e,r)}if(++this._derivations>this._maxDerivations)throw new Error(`Reasoning exceeded the maximum of ${this._maxDerivations} derivations`);o(s)}_emit(e,r,i){let n=e.conclusion;for(let s=0;s<n.length;s++){let o=n[s];this._add(o.subject.value,o.predicate.value,o.object.value,r,o,i)}}_evaluatePremise(e,r,i,n=0){let s,o,[a,l,u]=e.premise[n].value,f=r[e.premise[n].content],c=n===e.premise.length-1;if(!(s=a.value)){for(s in f)o=f[s],a.value=Number(s),this._evaluateLevel1(e,r,i,n,c,l,u,o);a.value=null}else(o=f[s])&&this._evaluateLevel1(e,r,i,n,c,l,u,o)}_evaluateLevel1(e,r,i,n,s,o,a,l){let u,f;if(!(u=o.value)){for(u in l)f=l[u],o.value=Number(u),this._evaluateLevel2(e,r,i,n,s,a,f);o.value=null}else(f=l[u])&&this._evaluateLevel2(e,r,i,n,s,a,f)}_evaluateLevel2(e,r,i,n,s,o,a){let l;if(!(l=o.value)){for(l in a)o.value=Number(l),s?this._emit(e,r,i):this._evaluatePremise(e,r,i,n+1);o.value=null}else s?this._emit(e,r,i):this._evaluatePremise(e,r,i,n+1)}_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=>{for(let l=0;l<a.length;l++){let u=a[l];this._add(u.subject.value,u.predicate.value,u.object.value,r,u,n)}};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 d=f.basePremise.predicate.value;d||(f.basePremise.predicate.value=l);let _=f.basePremise.object.value;_||(f.basePremise.object.value=u),f.premise.length===0?s(f.conclusion):this._evaluatePremise(f,r,n),c||(f.basePremise.subject.value=null),d||(f.basePremise.predicate.value=null),_||(f.basePremise.object.value=null)}}_createRule({premise:e,conclusion:r}){let i=Object.create(null),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=Ol(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(Dn(o.subject,a.subject)&&Dn(o.predicate,a.predicate)&&Dn(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(Dl(n.premise[f],l));(a.next=a.next||[]).push({premise:u,conclusion:n.conclusion,basePremise:o})}for(let l=0;l<n.variables.length;l++)n.variables[l].value=null}}for(let i of e){let n=new Set;i.premise=i.premise.map(s=>Dl(s,n))}let r=this._store._getGraphs();try{for(let i in r)this._graphId=Number(i),this._reasonGraphNaive(e,r[i])}finally{this._store._size=null}}};function Dl({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 Dn(t,e){return t.value===null&&(t.value=e.value),t.value===e.value}var Ml=ei(Yr());var ar=class extends Ml.Transform{constructor(e){super({decodeStrings:!0,readableObjectMode:!0});let r=new Ee(e),i,n,s={onQuad:(o,a)=>{o&&this.emit("error",o)||a&&this.push(a)},onPrefix:(o,a)=>{this.emit("prefix",o,a)},onDirective:o=>{this.emit("directive",o)}};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("error",r=>{this.emit("error",r)}),typeof e.pipe=="function"?e.pipe(this):(e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()})),this}};var $l=ei(Yr());var Dp=16*1024,Op=20,lr=class extends $l.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0}),this._buffer="",this._flushTimer=null,this._flushDelay=e&&e.flushDelay!==void 0?e.flushDelay:Op;let r=this._writer=new le({write:(s,o,a)=>{this._buffer+=s,this._buffer.length>=Dp?this._pushBuffer():this._flushTimer===null&&this._armFlushTimer(),a&&a()},end:s=>{this._pushBuffer(),this.push(null),s&&s()}},e),i=null,n=s=>{let o=i;i=null,s&&this._pushBuffer(),o(s)};this._transform=(s,o,a)=>{i=a,r.addQuad(s,n)},this._flush=s=>{r.end(s)}}_pushBuffer(){this._clearFlushTimer(),this._buffer!==""&&(this.push(this._buffer),this._buffer="")}_armFlushTimer(){this._flushTimer=setTimeout(()=>{this._flushTimer=null,this._pushBuffer()},this._flushDelay),this._flushTimer.unref&&this._flushTimer.unref()}_clearFlushTimer(){this._flushTimer!==null&&(clearTimeout(this._flushTimer),this._flushTimer=null)}_destroy(e,r){this._clearFlushTimer(),super._destroy(e,r)}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this._pushBuffer(),this.emit("error",r)}),e.on("prefix",(r,i)=>{this._writer.addPrefix(r,i)}),this}};var by={Lexer:Ge,Parser:Ee,Writer:le,Store:je,StoreFactory:sr,EntityIndex:nr,StreamParser:ar,StreamWriter:lr,Util:si,Reasoner:or,BaseIRI:Qe,DataFactory:Y,Term:V,NamedNode:ut,Literal:xe,BlankNode:$t,Variable:kt,DefaultGraph:Ut,Quad:De,Triple:De,termFromId:Fe,termToId:Be};export{Qe as BaseIRI,$t as BlankNode,Y as DataFactory,Ut as DefaultGraph,nr as EntityIndex,Ge as Lexer,xe as Literal,ut as NamedNode,Ee as Parser,De as Quad,or as Reasoner,je as Store,sr as StoreFactory,ar as StreamParser,lr as StreamWriter,V as Term,De as Triple,si as Util,kt as Variable,le as Writer,by as default,Ol as getRulesFromDataset,Fe as termFromId,Be as termToId};
|
|
22
|
+
]`)}}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 ze(`(${i.join(" ")})`)}end(e){this._endStatement(),this._write=this._blockedWrite;let r=e&&((i,n)=>{r=null,e(i,n)});if(this._endStream)try{return this._outputStream.end(r)}catch(i){}r&&r()}};function vu(t){let e=ts[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}function Nu(t){let e=ts[t];return e===void 0&&(e=t.charCodeAt(0).toString(16).toUpperCase(),e="\\u0000".substr(0,6-e.length)+e),e}var Xr=ei(Jr());var Ft=Symbol("iter"),F=Symbol("size"),Cn;function Dp({store:t,observer:e}){let r=t.deref();r&&r._removeObserver(e)}function Fn(t,e,r,i){let n=t&&t[e],s=n&&n[r];return!!s&&i in s}function Bt(t,e,r=4){let i=t[F]||0;for(let n in e)n in t?r!==0&&Bt(t[n],e[n],r-1):(i++,t[n]=r===0?null:Bt(Object.create(null),e[n],r-1));return r<=2&&(t[F]=i),t}function Fl(t,e,r=4){let i=!1,n=0;r<=2&&e[F]<t[F]&&([t,e]=[e,t]);for(let s in t)if(s in e){let o=r===0?null:Fl(t[s],e[s],r-1);if(o!==!1)i=i||Object.create(null),i[s]=o,n++;else if(r===3)return!1}return r<=2&&i&&(i[F]=n),i}function Bl(t,e,r=4){let i=!1,n=0;for(let s in t)if(!(s in e))i=i||Object.create(null),i[s]=r===0?null:Bt({},t[s],r-1),n++;else if(r!==0){let o=Bl(t[s],e[s],r-1);if(o!==!1)i=i||Object.create(null),i[s]=o,n++;else if(r===3)return!1}return r<=2&&i&&(i[F]=n),i}var Op=/^[?_"[.<]/;function X(t){if(typeof t=="string")return t.charCodeAt(0)!==60||t==="<>"?t:`<${t}>`;let e=Be(t);return e.charCodeAt(0)>=97||!t?e:t.termType==="Quad"?JSON.stringify(Dl(t)):t.termType!=="NamedNode"||!Op.test(t.value)?e:`<${t.value}>`}function Dl(t){let e=[Zr(t.subject),Zr(t.predicate),Zr(t.object)];return t.graph&&!se(t.graph)&&e.push(Zr(t.graph)),e}function Zr(t){return t.termType==="Quad"?Dl(t):X(t)}var sr=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||J}_termFromId(e){if(e[0]==="<")return this._factory.namedNode(e.substring(1,e.length-1));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 Fe(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&&(se(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${r}.${i}.${n}.${s}`:`.${r}.${i}.${n}`]}return typeof e=="string"?this._stringToNumericId(e):this._ids[X(e)]}_stringToNumericId(e){let r=this._ids[e];return(r?this._entities[r].charCodeAt(0)!==60:e.charCodeAt(0)!==60)||e==="<>"?r:this._ids[`<${e}>`]}_termToNewNumericId(e){if(typeof e=="string")return this._stringToNumericId(e)||this._addEntity(X(e));let r=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${se(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:X(e);return this._ids[r]||this._addEntity(r)}_addEntity(e){return this._ids[this._entities[++this._id]=e]=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),this._observers=null,!r&&e&&!e[0]&&typeof e.match!="function"&&(r=e,e=null),r=r||{},this._factory=r.factory||J,this._matchSemantics=Bn(r.matchSemantics),this._entityIndex=r.entityIndex||new sr({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+=n[a][F];return this._size=e}_addToIndex(e,r,i,n){let s=e[r];s||(e[r]=s={[F]:0},e[F]++);let o=s[i];o||(s[i]=o={[F]:0},s[F]++);let a=n in o;return a||(o[n]=null,o[F]++),!a}_removeFromIndex(e,r,i,n){let s=e[r],o=s[i];delete o[n],--o[F]===0&&(delete s[i],--s[F]===0&&(delete e[r],e[F]--))}*_findInIndex(e,r,i,n,s,o,a,l){let u=this._entities,f=this._termFromId(u[l]),c={subject:null,predicate:null,object:null};if(n){let _=e[r],p=_&&_[i];if(!p||!(n in p))return;c[s]=this._termFromId(u[r]),c[o]=this._termFromId(u[i]),c[a]=this._termFromId(u[n]),yield this._factory.quad(c.subject,c.predicate,c.object,f);return}if(r&&!(r in e))return;let d=r?null:Object.keys(e);for(let _=0,p=r||d[0];p;p=d&&d[++_]){let h=e[p];if(!h)continue;if(c[s]=this._termFromId(u[p]),i&&!(i in h))return;let y=i?null:Object.keys(h);for(let g=0,S=i||y[0];S;S=y&&y[++g]){let w=h[S];if(!w)continue;c[o]=this._termFromId(u[S]);let m=Object.keys(w);for(let x=0;x<m.length;x++)c[a]=this._termFromId(u[m[x]]),yield this._factory.quad(c.subject,c.predicate,c.object,f)}}}_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;if(r){if(!(o=e[r]))return 0;if(i)return(a=o[i])?n?n in a?1:0:a[F]:0;let u=Object.keys(o);for(let f=0;f<u.length;f++)s+=o[u[f]][F];return s}let l=Object.keys(e);for(let u=0;u<l.length;u++){o=e[l[u]];let f=Object.keys(o);for(let c=0;c<f.length;c++)s+=o[f[c]][F]}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_addObserver(e){let r=new WeakRef(e);return(Cn||(Cn=new FinalizationRegistry(Dp))).register(e,{store:new WeakRef(this),observer:r},r),(this._observers||(this._observers=new Set)).add(r),r}_removeObserver(e){Cn.unregister(e),this._observers&&(this._observers.delete(e),this._observers.size===0&&(this._observers=null))}_notifyObservers(e,r,i,n,s){for(let o of this._observers){let a=o.deref();a?a._onParentMutation(e,r,i,n,s):this._removeObserver(o)}}_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){return r||(n=e.graph,i=e.object,r=e.predicate,e=e.subject),n=n?this._termToNewNumericId(n):1,e=this._termToNewNumericId(e),r=this._termToNewNumericId(r),i=this._termToNewNumericId(i),this._addQuad(e,r,i,n)}_addQuad(e,r,i,n){let s=this._graphs[n];if(s||(s=this._graphs[n]={subjects:{[F]:0},predicates:{[F]:0},objects:{[F]:0}},Object.freeze(s)),this._observers!==null){if(Fn(s.subjects,e,r,i))return!1;this._notifyObservers(e,r,i,n,!0)}return 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===""||se(n)?1:this._termToNumericId(n),u=l&&this._graphs[l];return!!s&&!!o&&!!a&&!!u&&Fn(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){return r||({subject:e,predicate:r,object:i,graph:n}=e),n=n?this._termToNumericId(n):1,!(e=e&&this._termToNumericId(e))||!(r=r&&this._termToNumericId(r))||!(i=i&&this._termToNumericId(i))?!1:this._removeQuad(e,r,i,n)}_removeQuad(e,r,i,n){let s=this._graphs,o=s[n];return!o||!Fn(o.subjects,e,r,i)?!1:(this._observers!==null&&this._notifyObservers(e,r,i,n,!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--,o.subjects[F]===0&&delete s[n],!0)}removeQuads(e){let r=!0;for(let i=0;i<e.length;i++)r=this.removeQuad(e[i])&&r;return r}remove(e){return e.on("data",r=>{this.removeQuad(r)}),e}removeMatches(e,r,i,n){let s=new Xr.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*ne(this._findInIndex(o.objects,u,a,l,"object","subject","predicate",f)):yield*ne(this._findInIndex(o.subjects,a,l,null,"subject","predicate","object",f)):l?yield*ne(this._findInIndex(o.predicates,l,u,null,"predicate","object","subject",f)):u?yield*ne(this._findInIndex(o.objects,u,null,null,"object","subject","predicate",f)):yield*ne(this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",f)))}match(e,r,i,n,s=null){return new qe(this,e,r,i,n,{entityIndex:this._entityIndex,matchSemantics:s&&s.matchSemantics!==void 0?s.matchSemantics:this._matchSemantics})}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,allowExtraArcs:i=!1}={}){let n=Object.create(null),s=r?(()=>!0):((l,u)=>{throw new Error(`${l.value} ${u}`)}),o=this.getQuads(null,P.rdf.rest,P.rdf.nil,null),a=[];return o.forEach(l=>{let u=[],f=!1,c=!1,d,_,p=l.graph,h=[],y=l.subject;for(;y&&!f;){let g=this.getQuads(null,null,y,null),S=this.getQuads(y,null,null,null),w,m=null,x=null,A=null;for(let R=0;R<S.length&&!f;R++)w=S[R],w.graph.equals(p)?d?f=s(y,"has non-list arcs out"):w.predicate.value===P.rdf.first?(m?f=s(y,"has multiple rdf:first arcs"):m=w,e&&m===w&&h.push(w)):w.predicate.value===P.rdf.rest?(x?f=s(y,"has multiple rdf:rest arcs"):x=w,e&&x===w&&h.push(w)):g.length?i?c=!0:f=s(y,`has non-list arc ${w.predicate.value}`):(d=w,_="subject"):f=s(y,"not confined to single graph");for(let R=0;R<g.length&&!f;++R)w=g[R],d?f=s(y,"can't have coreferences"):w.predicate.value===P.rdf.rest?A?f=s(y,"has incoming rdf:rest arcs"):A=w:(d=w,_="object");m?u.push(m.object):f=s(y,"has no list head"),y=A&&A.subject}if(f)e=!1;else if(u.reverse(),d&&(n[d[_].value]=u),e&&!c)for(let g=0;g<h.length;g++)a.push(h[g])}),e&&this.removeQuads(a),n}addAll(e){if(e instanceof qe&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(this._observers===null&&e instanceof t&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=Bt(this._graphs,e._graphs),this._size=null);else for(let r of e)this.add(r);return this}contains(e){if(e instanceof qe&&(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 d in a[c])if(!(d in l))return!1}}}return!0}deleteMatches(e,r,i,n){for(let s of this.match(e,r,i,n,{matchSemantics:"lazy"}))this.removeQuad(s);return this}difference(e){if(e&&e instanceof qe&&(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=Bl(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 qe&&(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 qe&&(e=e.filtered),e===this){let r=new t({entityIndex:this._entityIndex});return r._graphs=Bt(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=Fl(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(null,null,null,null,{matchSemantics:"lazy"})}toString(){return new le().quadsToString(this)}union(e){let r=new t({entityIndex:this._entityIndex});return r._graphs=Bt(Object.create(null),this._graphs),r._size=this._size,r.addAll(e),r}[Symbol.iterator](){return this.readQuads()}};function me(t,e,r=0){let i=e[r];if(i&&!(i in t))return!1;let n=!1,s=0;for(let o in i?{[i]:t[i]}:t){let a=r===2?null:me(t[o],e,r+1);a!==!1&&(n=n||Object.create(null),n[o]=a,s++)}return n&&(n[F]=s),n}function Ll(t,e,r,i,n){let s={store:t,ids:[]},o=e&&t._termToNumericId(e),a=r&&t._termToNumericId(r),l=i&&t._termToNumericId(i),u,f,c,d,_;l&&(o||!a)?(u="objects",[f,c,d]=[l,o,a],_=[2,0,1]):!o&&a?(u="predicates",[f,c,d]=[a,l,o],_=[1,2,0]):(u="subjects",[f,c,d]=[o,a,l],_=[0,1,2]);let p=t._getGraphs(n),h=[];for(let y in p){let g=p[y][u],S=Number(y);for(let w in f?{[f]:g[f]}:g){let m=g[w];if(m){h[_[0]]=Number(w);for(let x in c?{[c]:m[c]}:m){let A=m[x];if(A){h[_[1]]=Number(x);for(let R in d?d in A?{[d]:null}:{}:A)h[_[2]]=Number(R),s.ids.push(h[0],h[1],h[2],S)}}}}}return s}function*Mp({store:t,ids:e},r){let i=t._entities,n,s,o,a,l,u,f,c;for(let d=r*4;d<e.length;d+=4)l!==e[d]&&(n=t._termFromId(i[l=e[d]])),u!==e[d+1]&&(s=t._termFromId(i[u=e[d+1]])),f!==e[d+2]&&(o=t._termFromId(i[f=e[d+2]])),c!==e[d+3]&&(a=t._termFromId(i[c=e[d+3]])),yield t._factory.quad(n,s,o,a)}function Bn(t="lazy"){if(t!=="lazy"&&t!=="snapshot"&&t!=="forwarded")throw new Error(`Unknown matchSemantics: ${t}`);if(t!=="lazy"&&(typeof WeakRef!="function"||typeof FinalizationRegistry!="function"))throw new Error("Non-lazy matchSemantics requires WeakRef and FinalizationRegistry support");return t}function Cl(t,e){let r=new Array(4);for(let i=0;i<4;i++){let n=t[i],s=e[i];if(n==null)r[i]=s;else if(s==null||X(n)===X(s))r[i]=n;else return!1}return r}var qe=class t extends Xr.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});let a=this._semantics=Bn(o.matchSemantics);o.matchesNothing&&(this._matchesNothing=!0,this._filtered=new je({factory:e._factory,entityIndex:o.entityIndex})),a!=="lazy"&&(this._readers=null,this._subjectId=this._predicateId=this._objectId=this._graphId=void 0,this._matchesNothing||(this._observer=e._addObserver(this)))}_matchesPattern(e,r,i,n){let{subject:s,predicate:o,object:a,graph:l,n3Store:u}=this;return s&&e!==(this._subjectId||(this._subjectId=u._termToNumericId(s)))||o&&r!==(this._predicateId||(this._predicateId=u._termToNumericId(o)))||a&&i!==(this._objectId||(this._objectId=u._termToNumericId(a)))?!1:l==null||n===(this._graphId||(this._graphId=l===""||se(l)?1:u._termToNumericId(l)))}_matchesQuad(e){let{subject:r,predicate:i,object:n,graph:s}=this;return!this._matchesNothing&&(r==null||X(r)===X(e.subject))&&(i==null||X(i)===X(e.predicate))&&(n==null||X(n)===X(e.object))&&(s==null||X(s)===X(e.graph))}_assertMatchesPattern(e){if(!this._matchesQuad(e))throw new Error("Quad does not match the forwarded view pattern")}_sourceIterator(){return this._filtered?this._filtered[Symbol.iterator]():this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}_freezeCurrentIterators(){this._readers&&(this._readers.snapshot=this._filtered?Ll(this._filtered):Ll(this.n3Store,this.subject,this.predicate,this.object,this.graph),this._readers=null)}_onParentMutation(e,r,i,n,s){if(this._matchesPattern(e,r,i,n)){if(this._freezeCurrentIterators(),this._semantics==="forwarded"){this._filtered&&(s?this._filtered._addQuad(e,r,i,n):this._filtered._removeQuad(e,r,i,n));return}this._filtered=this.filtered}}get filtered(){if(!this._filtered){let{n3Store:e,graph:r,object:i,predicate:n,subject:s}=this;this._semantics!=="lazy"&&this._freezeCurrentIterators();let o=this._filtered=new je({factory:e._factory,entityIndex:this.options.entityIndex});this._semantics==="snapshot"&&this._detachObserver();let 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 d,_,p,h;(h=f[c])&&(!a&&l?(_=me(h.predicates,[l,u,a]))&&(d=me(h.subjects,[a,l,u]),p=me(h.objects,[u,a,l])):u?(p=me(h.objects,[u,a,l]))&&(d=me(h.subjects,[a,l,u]),_=me(h.predicates,[l,u,a])):(d=me(h.subjects,[a,l,u]))&&(_=me(h.predicates,[l,u,a]),p=me(h.objects,[u,a,l])),d&&(o._graphs[c]={subjects:d,predicates:_,objects:p}))}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Ft]&&(this[Ft]=this[Symbol.iterator]());let r=this[Ft];for(;--e>=0;){let{done:i,value:n}=r.next();if(i){this.push(null);return}this.push(n)}}_destroy(e,r){this[Ft]&&(this[Ft].return(),this[Ft]=null),r(e)}_detachObserver(){this._observer&&(this.n3Store._removeObserver(this._observer),this._observer=null)}_detach(){return this._filtered=this.filtered,this._detachObserver(),this._semantics==="lazy"&&(this._readers=null),this._semantics="snapshot",this}addAll(e){if(this._semantics==="forwarded"){for(let r of e)this._assertMatchesPattern(r),this.n3Store.addQuad(r);return this}return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,r,i,n){if(this._semantics==="forwarded"){if(this._matchesNothing)throw new Error("Cannot delete from a conflicting forwarded view pattern");let s=Cl([this.subject,this.predicate,this.object,this.graph],[e,r,i,n]);if(!s)throw new Error("Deletion pattern does not match the forwarded view pattern");return this.n3Store.deleteMatches(...s),this}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(this._semantics==="forwarded"?o=>e(o,this):e,r,i,n,s)}filter(e){return this.filtered.filter(this._semantics==="forwarded"?r=>e(r,this):e)}forEach(e,r,i,n,s){return this.filtered.forEach(this._semantics==="forwarded"?o=>e(o,this):e,r,i,n,s)}import(e){if(this._semantics!=="forwarded")return this.filtered.import(e);let r=this;function i(n){try{r._assertMatchesPattern(n),r.n3Store.addQuad(n)}catch(s){e.removeListener("data",i),typeof e.destroy=="function"?e.destroy(s):e.emit("error",s)}}return e.on("data",i),e}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(this._semantics==="forwarded"?r=>e(r,this):e)}some(e,r,i,n,s){return this.filtered.some(this._semantics==="forwarded"?o=>e(o,this):e,r,i,n,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._semantics!=="lazy"?Xr.Readable.from(this[Symbol.iterator]()):this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph,{matchSemantics:"lazy"})}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph,{matchSemantics:"lazy"}).addAll(e)}toArray(){return this._semantics!=="lazy"?[...this]:this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,r){return this.filtered.reduce(this._semantics==="forwarded"?(i,n)=>e(i,n,this):e,r)}toString(){return new le().quadsToString(this)}add(e){return this._semantics==="forwarded"?(this._assertMatchesPattern(e),this.n3Store.addQuad(e),this):this.filtered.add(e)}delete(e){return this._semantics==="forwarded"?(this._assertMatchesPattern(e),this.n3Store.removeQuad(e),this):this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,r,i,n,s=null){let o=s&&s.matchSemantics;if(s&&o!==void 0&&(Bn(o),o!==this._semantics))throw new Error(`Cannot override matchSemantics on a view: inherited "${this._semantics}", received "${o}"`);if(this._semantics!=="forwarded")return new t(this.filtered,e,r,i,n,{entityIndex:this.options.entityIndex,matchSemantics:this._semantics});let a=!this._matchesNothing&&Cl([this.subject,this.predicate,this.object,this.graph],[e,r,i,n]),[l,u,f,c]=a||[null,null,null,null];return new t(this.n3Store,l,u,f,c,{entityIndex:this.options.entityIndex,matchSemantics:"forwarded",matchesNothing:!a})}[Symbol.iterator](){return this._semantics==="lazy"?this._sourceIterator():this._iterateStable()}*_iterateStable(){let e=this._readers||(this._readers={count:0,snapshot:null}),r=this._sourceIterator(),i=0;e.count++;try{for(;!e.snapshot;){let{value:n,done:s}=r.next();if(e.snapshot||s)break;i++,yield n}e.snapshot&&(yield*ne(Mp(e.snapshot,i)))}finally{r.return(),--e.count===0&&(e.snapshot=null,this._readers===e&&(this._readers=null))}}};var or=class{dataset(e){return new je(e)}};function Ml(t){let e=[];for(let{subject:r,object:i}of t.match(null,J.namedNode("http://www.w3.org/2000/10/swap/log#implies"),null,J.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 ar=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,o){let a=this._store;if(a._observers){if(!a._addQuad(e,r,i,this._graphId))return}else{if(!a._addToIndex(n.subjects,e,r,i))return;a._addToIndex(n.predicates,r,i,e),a._addToIndex(n.objects,i,e,r)}if(++this._derivations>this._maxDerivations)throw new Error(`Reasoning exceeded the maximum of ${this._maxDerivations} derivations`);o(s)}_emit(e,r,i){let n=e.conclusion;for(let s=0;s<n.length;s++){let o=n[s];this._add(o.subject.value,o.predicate.value,o.object.value,r,o,i)}}_evaluatePremise(e,r,i,n=0){let s,o,[a,l,u]=e.premise[n].value,f=r[e.premise[n].content],c=n===e.premise.length-1;if(!(s=a.value)){for(s in f)o=f[s],a.value=Number(s),this._evaluateLevel1(e,r,i,n,c,l,u,o);a.value=null}else(o=f[s])&&this._evaluateLevel1(e,r,i,n,c,l,u,o)}_evaluateLevel1(e,r,i,n,s,o,a,l){let u,f;if(!(u=o.value)){for(u in l)f=l[u],o.value=Number(u),this._evaluateLevel2(e,r,i,n,s,a,f);o.value=null}else(f=l[u])&&this._evaluateLevel2(e,r,i,n,s,a,f)}_evaluateLevel2(e,r,i,n,s,o,a){let l;if(!(l=o.value)){for(l in a)o.value=Number(l),s?this._emit(e,r,i):this._evaluatePremise(e,r,i,n+1);o.value=null}else s?this._emit(e,r,i):this._evaluatePremise(e,r,i,n+1)}_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=>{for(let l=0;l<a.length;l++){let u=a[l];this._add(u.subject.value,u.predicate.value,u.object.value,r,u,n)}};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 d=f.basePremise.predicate.value;d||(f.basePremise.predicate.value=l);let _=f.basePremise.object.value;_||(f.basePremise.object.value=u),f.premise.length===0?s(f.conclusion):this._evaluatePremise(f,r,n),c||(f.basePremise.subject.value=null),d||(f.basePremise.predicate.value=null),_||(f.basePremise.object.value=null)}}_createRule({premise:e,conclusion:r}){let i=Object.create(null),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=Ml(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(Dn(o.subject,a.subject)&&Dn(o.predicate,a.predicate)&&Dn(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(Ol(n.premise[f],l));(a.next=a.next||[]).push({premise:u,conclusion:n.conclusion,basePremise:o})}for(let l=0;l<n.variables.length;l++)n.variables[l].value=null}}for(let i of e){let n=new Set;i.premise=i.premise.map(s=>Ol(s,n))}let r=this._store._getGraphs();try{for(let i in r)this._graphId=Number(i),this._reasonGraphNaive(e,r[i])}finally{this._store._size=null}}};function Ol({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 Dn(t,e){return t.value===null&&(t.value=e.value),t.value===e.value}var $l=ei(Jr());var lr=class extends $l.Transform{constructor(e){super({decodeStrings:!0,readableObjectMode:!0});let r=new Ee(e),i,n,s={onQuad:(o,a)=>{o&&this.emit("error",o)||a&&this.push(a)},onPrefix:(o,a)=>{this.emit("prefix",o,a)},onDirective:o=>{this.emit("directive",o)}};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("error",r=>{this.emit("error",r)}),typeof e.pipe=="function"?e.pipe(this):(e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()})),this}};var kl=ei(Jr());var $p=16*1024,kp=20,ur=class extends kl.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0}),this._buffer="",this._flushTimer=null,this._flushDelay=e&&e.flushDelay!==void 0?e.flushDelay:kp;let r=this._writer=new le({write:(s,o,a)=>{this._buffer+=s,this._buffer.length>=$p?this._pushBuffer():this._flushTimer===null&&this._armFlushTimer(),a&&a()},end:s=>{this._pushBuffer(),this.push(null),s&&s()}},e),i=null,n=s=>{let o=i;i=null,s&&this._pushBuffer(),o(s)};this._transform=(s,o,a)=>{i=a,r.addQuad(s,n)},this._flush=s=>{r.end(s)}}_pushBuffer(){this._clearFlushTimer(),this._buffer!==""&&(this.push(this._buffer),this._buffer="")}_armFlushTimer(){this._flushTimer=setTimeout(()=>{this._flushTimer=null,this._pushBuffer()},this._flushDelay),this._flushTimer.unref&&this._flushTimer.unref()}_clearFlushTimer(){this._flushTimer!==null&&(clearTimeout(this._flushTimer),this._flushTimer=null)}_destroy(e,r){this._clearFlushTimer(),super._destroy(e,r)}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this._pushBuffer(),this.emit("error",r)}),e.on("prefix",(r,i)=>{this._writer.addPrefix(r,i)}),this}};var my={Lexer:Ge,Parser:Ee,Writer:le,Store:je,StoreFactory:or,EntityIndex:sr,StreamParser:lr,StreamWriter:ur,Util:si,Reasoner:ar,BaseIRI:Qe,DataFactory:J,Term:H,NamedNode:ft,Literal:xe,BlankNode:Ut,Variable:qt,DefaultGraph:Wt,Quad:De,Triple:De,termFromId:Fe,termToId:Be};export{Qe as BaseIRI,Ut as BlankNode,J as DataFactory,Wt as DefaultGraph,sr as EntityIndex,Ge as Lexer,xe as Literal,ft as NamedNode,Ee as Parser,De as Quad,ar as Reasoner,je as Store,or as StoreFactory,lr as StreamParser,ur as StreamWriter,H as Term,De as Triple,si as Util,qt as Variable,le as Writer,my as default,Ml as getRulesFromDataset,Fe as termFromId,Be as termToId};
|
|
24
23
|
/*! Bundled license information:
|
|
25
24
|
|
|
26
25
|
ieee754/index.js:
|