n3 2.11.4 → 2.11.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/browser/n3.esm.min.js +10 -10
- package/browser/n3.min.js +12 -12
- package/lib/N3Parser.js +12 -5
- package/lib/N3Reasoner.js +1 -1
- package/lib/N3Store.js +46 -5
- package/package.json +1 -1
- package/src/N3Parser.js +15 -5
- package/src/N3Reasoner.js +1 -1
- package/src/N3Store.js +57 -8
package/browser/n3.min.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
var N3=(()=>{var ql=Object.create;var qt=Object.defineProperty,Ul=Object.defineProperties,Wl=Object.getOwnPropertyDescriptor,Gl=Object.getOwnPropertyDescriptors,Ql=Object.getOwnPropertyNames,Dn=Object.getOwnPropertySymbols,zl=Object.getPrototypeOf,Mn=Object.prototype.hasOwnProperty,Vl=Object.prototype.propertyIsEnumerable;var lt=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Hl=t=>{throw TypeError(t)};var On=(t,e,r)=>e in t?qt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M=(t,e)=>{for(var r in e||(e={}))Mn.call(e,r)&&On(t,r,e[r]);if(Dn)for(var r of Dn(e))Vl.call(e,r)&&On(t,r,e[r]);return t},Ce=(t,e)=>Ul(t,Gl(e));var A=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},$n=(t,e)=>{for(var r in e)qt(t,r,{get:e[r],enumerable:!0})},kn=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ql(e))!Mn.call(t,n)&&n!==r&&qt(t,n,{get:()=>e[n],enumerable:!(i=Wl(e,n))||i.enumerable});return t};var ar=(t,e,r)=>(r=t!=null?ql(zl(t)):{},kn(e||!t||!t.__esModule?qt(r,"default",{value:t,enumerable:!0}):r,t)),Kl=t=>kn(qt({},"__esModule",{value:!0}),t);var G=function(t,e){this[0]=t,this[1]=e},ee=(t,e,r)=>{var i=(a,l,u,c)=>{try{var f=r[a](l),h=(l=f.value)instanceof G,d=f.done;Promise.resolve(h?l[0]:l).then(_=>h?i(a==="return"?a:"next",l[1]?{done:_.done,value:_.value}:_,u,c):u({value:_,done:d})).catch(_=>i("throw",_,u,c))}catch(_){c(_)}},n=(a,l,u,c)=>o[a]=f=>(l=new Promise((h,d,_)=>(_=()=>i(a,f,h,d),s?s.then(_):_())),c=()=>s===u&&(s=0),s=u=l.then(c,c),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 G(new Promise(a=>{var l=e[s](o);l instanceof Object||Hl("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},Z=(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 Wn=A(lr=>{"use strict";lr.byteLength=Zl;lr.toByteArray=Jl;lr.fromByteArray=ru;var le=[],te=[],Yl=typeof Uint8Array!="undefined"?Uint8Array:Array,ei="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ge=0,qn=ei.length;Ge<qn;++Ge)le[Ge]=ei[Ge],te[ei.charCodeAt(Ge)]=Ge;var Ge,qn;te[45]=62;te[95]=63;function Un(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 Zl(t){var e=Un(t),r=e[0],i=e[1];return(r+i)*3/4-i}function Xl(t,e,r){return(e+r)*3/4-r}function Jl(t){var e,r=Un(t),i=r[0],n=r[1],s=new Yl(Xl(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 eu(t){return le[t>>18&63]+le[t>>12&63]+le[t>>6&63]+le[t&63]}function tu(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(eu(i));return n.join("")}function ru(t){for(var e,r=t.length,i=r%3,n=[],s=16383,o=0,a=r-i;o<a;o+=s)n.push(tu(t,o,o+s>a?a:o+s));return i===1?(e=t[r-1],n.push(le[e>>2]+le[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(le[e>>10]+le[e>>4&63]+le[e<<2&63]+"=")),n.join("")}});var Gn=A(ti=>{ti.read=function(t,e,r,i,n){var s,o,a=n*8-i-1,l=(1<<a)-1,u=l>>1,c=-7,f=r?n-1:0,h=r?-1:1,d=t[e+f];for(f+=h,s=d&(1<<-c)-1,d>>=-c,c+=a;c>0;s=s*256+t[e+f],f+=h,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=i;c>0;o=o*256+t[e+f],f+=h,c-=8);if(s===0)s=1-u;else{if(s===l)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-u}return(d?-1:1)*o*Math.pow(2,s-i)};ti.write=function(t,e,r,i,n,s){var o,a,l,u=s*8-n-1,c=(1<<u)-1,f=c>>1,h=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:s-1,_=i?1:-1,p=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+f>=1?e+=h/l:e+=h*Math.pow(2,1-f),e*l>=2&&(o++,l/=2),o+f>=c?(a=0,o=c):o+f>=1?(a=(e*l-1)*Math.pow(2,n),o=o+f):(a=e*Math.pow(2,f-1)*Math.pow(2,n),o=0));n>=8;t[r+d]=a&255,d+=_,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;t[r+d]=o&255,d+=_,o/=256,u-=8);t[r+d-_]|=p*128}});var fe=A(dt=>{"use strict";var ri=Wn(),ft=Gn(),Qn=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;dt.Buffer=b;dt.SlowBuffer=lu;dt.INSPECT_MAX_BYTES=50;var ur=2147483647;dt.kMaxLength=ur;b.TYPED_ARRAY_SUPPORT=iu();!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 iu(){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 Ie(t){if(t>ur)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 oi(t)}return Kn(t,e,r)}b.poolSize=8192;function Kn(t,e,r){if(typeof t=="string")return su(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(ue(t,ArrayBuffer)||t&&ue(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(ue(t,SharedArrayBuffer)||t&&ue(t.buffer,SharedArrayBuffer)))return ni(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=au(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 Kn(t,e,r)};Object.setPrototypeOf(b.prototype,Uint8Array.prototype);Object.setPrototypeOf(b,Uint8Array);function Yn(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 nu(t,e,r){return Yn(t),t<=0?Ie(t):e!==void 0?typeof r=="string"?Ie(t).fill(e,r):Ie(t).fill(e):Ie(t)}b.alloc=function(t,e,r){return nu(t,e,r)};function oi(t){return Yn(t),Ie(t<0?0:ai(t)|0)}b.allocUnsafe=function(t){return oi(t)};b.allocUnsafeSlow=function(t){return oi(t)};function su(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!b.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Zn(t,e)|0,i=Ie(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function ii(t){let e=t.length<0?0:ai(t.length)|0,r=Ie(e);for(let i=0;i<e;i+=1)r[i]=t[i]&255;return r}function ou(t){if(ue(t,Uint8Array)){let e=new Uint8Array(t);return ni(e.buffer,e.byteOffset,e.byteLength)}return ii(t)}function ni(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 au(t){if(b.isBuffer(t)){let e=ai(t.length)|0,r=Ie(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||ui(t.length)?Ie(0):ii(t);if(t.type==="Buffer"&&Array.isArray(t.data))return ii(t.data)}function ai(t){if(t>=ur)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ur.toString(16)+" bytes");return t|0}function lu(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(ue(e,Uint8Array)&&(e=b.from(e,e.offset,e.byteLength)),ue(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(ue(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 Zn(t,e){if(b.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||ue(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 si(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return os(t).length;default:if(n)return i?-1:si(t).length;e=(""+e).toLowerCase(),n=!0}}b.byteLength=Zn;function uu(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 mu(this,e,r);case"utf8":case"utf-8":return Jn(this,e,r);case"ascii":return yu(this,e,r);case"latin1":case"binary":return gu(this,e,r);case"base64":return pu(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wu(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}b.prototype._isBuffer=!0;function Qe(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)Qe(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)Qe(this,r,r+3),Qe(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)Qe(this,r,r+7),Qe(this,r+1,r+6),Qe(this,r+2,r+5),Qe(this,r+3,r+4);return this};b.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Jn(this,0,e):uu.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=dt.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Qn&&(b.prototype[Qn]=b.prototype.inspect);b.prototype.compare=function(e,r,i,n,s){if(ue(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),c=e.slice(r,i);for(let f=0;f<l;++f)if(u[f]!==c[f]){o=u[f],a=c[f];break}return o<a?-1:a<o?1:0};function Xn(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,ui(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:zn(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):zn(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function zn(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(c,f){return s===1?c[f]:c.readUInt16BE(f*s)}let u;if(n){let c=-1;for(u=r;u<o;u++)if(l(t,u)===l(e,c===-1?0:u-c)){if(c===-1&&(c=u),u-c+1===a)return c*s}else c!==-1&&(u-=u-c),c=-1}else for(r+a>o&&(r=o-a),u=r;u>=0;u--){let c=!0;for(let f=0;f<a;f++)if(l(t,u+f)!==l(e,f)){c=!1;break}if(c)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 Xn(this,e,r,i,!0)};b.prototype.lastIndexOf=function(e,r,i){return Xn(this,e,r,i,!1)};function fu(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(ui(a))return o;t[r+o]=a}return o}function cu(t,e,r,i){return fr(si(e,t.length-r),t,r,i)}function du(t,e,r,i){return fr(Iu(e),t,r,i)}function hu(t,e,r,i){return fr(os(e),t,r,i)}function _u(t,e,r,i){return fr(Ru(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 fu(this,e,r,i);case"utf8":case"utf-8":return cu(this,e,r,i);case"ascii":case"latin1":case"binary":return du(this,e,r,i);case"base64":return hu(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _u(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 pu(t,e,r){return e===0&&r===t.length?ri.fromByteArray(t):ri.fromByteArray(t.slice(e,r))}function Jn(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,c,f;switch(a){case 1:s<128&&(o=s);break;case 2:l=t[n+1],(l&192)===128&&(f=(s&31)<<6|l&63,f>127&&(o=f));break;case 3:l=t[n+1],u=t[n+2],(l&192)===128&&(u&192)===128&&(f=(s&15)<<12|(l&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:l=t[n+1],u=t[n+2],c=t[n+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(f=(s&15)<<18|(l&63)<<12|(u&63)<<6|c&63,f>65535&&f<1114112&&(o=f))}}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 bu(i)}var Vn=4096;function bu(t){let e=t.length;if(e<=Vn)return String.fromCharCode.apply(String,t);let r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=Vn));return r}function yu(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 gu(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 mu(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+=Tu[t[s]];return n}function wu(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 W(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||W(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||W(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||W(e,1,this.length),this[e]};b.prototype.readUint16LE=b.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||W(e,2,this.length),this[e]|this[e+1]<<8};b.prototype.readUint16BE=b.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||W(e,2,this.length),this[e]<<8|this[e+1]};b.prototype.readUint32LE=b.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||W(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||W(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};b.prototype.readBigUInt64LE=De(function(e){e=e>>>0,ct(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Ut(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=De(function(e){e=e>>>0,ct(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Ut(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||W(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||W(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||W(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};b.prototype.readInt16LE=function(e,r){e=e>>>0,r||W(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||W(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||W(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||W(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};b.prototype.readBigInt64LE=De(function(e){e=e>>>0,ct(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Ut(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=De(function(e){e=e>>>0,ct(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Ut(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||W(e,4,this.length),ft.read(this,e,!0,23,4)};b.prototype.readFloatBE=function(e,r){return e=e>>>0,r||W(e,4,this.length),ft.read(this,e,!1,23,4)};b.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||W(e,8,this.length),ft.read(this,e,!0,52,8)};b.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||W(e,8,this.length),ft.read(this,e,!1,52,8)};function X(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;X(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;X(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||X(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||X(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||X(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||X(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||X(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 es(t,e,r,i,n){ss(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 ts(t,e,r,i,n){ss(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=De(function(e,r=0){return es(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});b.prototype.writeBigUInt64BE=De(function(e,r=0){return ts(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);X(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);X(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||X(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||X(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||X(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||X(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||X(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=De(function(e,r=0){return es(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});b.prototype.writeBigInt64BE=De(function(e,r=0){return ts(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function rs(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 is(t,e,r,i,n){return e=+e,r=r>>>0,n||rs(t,e,r,4,34028234663852886e22,-34028234663852886e22),ft.write(t,e,r,i,23,4),r+4}b.prototype.writeFloatLE=function(e,r,i){return is(this,e,r,!0,i)};b.prototype.writeFloatBE=function(e,r,i){return is(this,e,r,!1,i)};function ns(t,e,r,i,n){return e=+e,r=r>>>0,n||rs(t,e,r,8,17976931348623157e292,-17976931348623157e292),ft.write(t,e,r,i,52,8),r+8}b.prototype.writeDoubleLE=function(e,r,i){return ns(this,e,r,!0,i)};b.prototype.writeDoubleBE=function(e,r,i){return ns(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 ut={};function li(t,e,r){ut[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}`}}}li("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);li("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);li("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=Hn(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=Hn(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function Hn(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 xu(t,e,r){ct(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Ut(e,t.length-(r+1))}function ss(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 ut.ERR_OUT_OF_RANGE("value",a,t)}xu(i,n,s)}function ct(t,e){if(typeof t!="number")throw new ut.ERR_INVALID_ARG_TYPE(e,"number",t)}function Ut(t,e,r){throw Math.floor(t)!==t?(ct(t,r),new ut.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new ut.ERR_BUFFER_OUT_OF_BOUNDS:new ut.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Eu=/[^+/0-9A-Za-z-_]/g;function Su(t){if(t=t.split("=")[0],t=t.trim().replace(Eu,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function si(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 Iu(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Ru(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 os(t){return ri.toByteArray(Su(t))}function fr(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 ue(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function ui(t){return t!==t}var Tu=(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 De(t){return typeof BigInt=="undefined"?Au:t}function Au(){throw new Error("BigInt not supported")}});var j=A((sb,Ss)=>{"use strict";var pi=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}};Ss.exports={AggregateError:pi,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 bi=A((ob,Is)=>{"use strict";Is.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 V=A((ab,As)=>{"use strict";var{format:tf,inspect:yr}=bi(),{AggregateError:rf}=j(),nf=globalThis.AggregateError||rf,sf=Symbol("kIsNodeError"),of=["string","function","number","object","Function","Object","boolean","bigint","symbol"],af=/^([A-Z][a-z0-9]*)+$/,lf="__node_internal_",gr={};function Ye(t,e){if(!t)throw new gr.ERR_INTERNAL_ASSERTION(e)}function Rs(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 uf(t,e,r){if(typeof e=="function")return Ye(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 Ye(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:tf(e,...r)}function Q(t,e,r){r||(r=Error);class i extends r{constructor(...s){super(uf(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[sf]=!0,gr[t]=i}function Ts(t){let e=lf+t.name;return Object.defineProperty(t,"name",{value:e}),t}function ff(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new nf([e,t],e.message);return r.code=e.code,r}return t||e}var yi=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"}};Q("ERR_ASSERTION","%s",Error);Q("ERR_INVALID_ARG_TYPE",(t,e,r)=>{Ye(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)Ye(typeof l=="string","All expected entries have to be of type string"),of.includes(l)?n.push(l.toLowerCase()):af.test(l)?s.push(l):(Ye(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);Q("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);Q("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);Q("ERR_MISSING_ARGS",(...t)=>{Ye(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);Q("ERR_OUT_OF_RANGE",(t,e,r)=>{Ye(e,'Missing "range" argument');let i;if(Number.isInteger(r)&&Math.abs(r)>2**32)i=Rs(String(r));else if(typeof r=="bigint"){i=String(r);let n=BigInt(2)**BigInt(32);(r>n||r<-n)&&(i=Rs(i)),i+="n"}else i=yr(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${i}`},RangeError);Q("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Q("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Q("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Q("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Q("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Q("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Q("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);As.exports={AbortError:yi,aggregateTwoErrors:Ts(ff),hideStackFrames:Ts,codes:gr}});var mt=A((lb,mr)=>{"use strict";var{AbortController:vs,AbortSignal:cf}=typeof self!="undefined"?self:typeof window!="undefined"?window:void 0;mr.exports=vs;mr.exports.AbortSignal=cf;mr.exports.default=vs});var Ht=A((ub,gi)=>{"use strict";var wt=typeof Reflect=="object"?Reflect:null,Ns=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 df(t){console&&console.warn&&console.warn(t)}var js=Number.isNaN||function(e){return e!==e};function v(){v.init.call(this)}gi.exports=v;gi.exports.once=bf;v.EventEmitter=v;v.prototype._events=void 0;v.prototype._eventsCount=0;v.prototype._maxListeners=void 0;var Ps=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 Ps},set:function(t){if(typeof t!="number"||t<0||js(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ps=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||js(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Ls(t){return t._maxListeners===void 0?v.defaultMaxListeners:t._maxListeners}v.prototype.getMaxListeners=function(){return Ls(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")Ns(l,this,r);else for(var u=l.length,c=Os(l,u),i=0;i<u;++i)Ns(c[i],this,r);return!0};function Bs(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=Ls(t),n>0&&o.length>n&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,df(a)}return t}v.prototype.addListener=function(e,r){return Bs(this,e,r,!1)};v.prototype.on=v.prototype.addListener;v.prototype.prependListener=function(e,r){return Bs(this,e,r,!0)};function hf(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Fs(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=hf.bind(i);return n.listener=r,i.wrapFn=n,n}v.prototype.once=function(e,r){return xr(r),this.on(e,Fs(this,e,r)),this};v.prototype.prependOnceListener=function(e,r){return xr(r),this.prependListener(e,Fs(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():_f(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?pf(n):Os(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):Ds.call(t,e)};v.prototype.listenerCount=Ds;function Ds(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}v.prototype.eventNames=function(){return this._eventsCount>0?wr(this._events):[]};function Os(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function _f(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function pf(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function bf(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))}Ms(t,e,s,{once:!0}),e!=="error"&&yf(t,n,{once:!0})})}function yf(t,e,r){typeof t.on=="function"&&Ms(t,"error",e,r)}function Ms(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 Y=A((fb,wi)=>{"use strict";var gf=fe(),{format:mf,inspect:wf}=bi(),{codes:{ERR_INVALID_ARG_TYPE:mi}}=V(),{kResistStopPropagation:xf,AggregateError:Ef,SymbolDispose:Sf}=j(),If=globalThis.AbortSignal||mt().AbortSignal,Rf=globalThis.AbortController||mt().AbortController,Tf=Object.getPrototypeOf(async function(){}).constructor,$s=globalThis.Blob||gf.Blob,Af=typeof $s!="undefined"?function(e){return e instanceof $s}:function(e){return!1},ks=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new mi(e,"AbortSignal",t)},vf=(t,e)=>{if(typeof t!="function")throw new mi(e,"Function",t)};wi.exports={AggregateError:Ef,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:mf,inspect:wf,types:{isAsyncFunction(t){return t instanceof Tf},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Af,deprecate(t,e){return t},addAbortListener:Ht().addAbortListener||function(e,r){if(e===void 0)throw new mi("signal","AbortSignal",e);ks(e,"signal"),vf(r,"listener");let i;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[xf]:!0}),i=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[Sf](){var n;(n=i)===null||n===void 0||n()}}},AbortSignalAny:If.any||function(e){if(e.length===1)return e[0];let r=new Rf,i=()=>r.abort();return e.forEach(n=>{ks(n,"signals"),n.addEventListener("abort",i,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",i))},{once:!0}),r.signal}};wi.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Et=A((cb,Ys)=>{"use strict";var{ArrayIsArray:Ei,ArrayPrototypeIncludes:Gs,ArrayPrototypeJoin:Qs,ArrayPrototypeMap:Nf,NumberIsInteger:Si,NumberIsNaN:Pf,NumberMAX_SAFE_INTEGER:jf,NumberMIN_SAFE_INTEGER:Lf,NumberParseInt:Bf,ObjectPrototypeHasOwnProperty:Ff,RegExpPrototypeExec:zs,String:Cf,StringPrototypeToUpperCase:Df,StringPrototypeTrim:Of}=j(),{hideStackFrames:re,codes:{ERR_SOCKET_BAD_PORT:Mf,ERR_INVALID_ARG_TYPE:H,ERR_INVALID_ARG_VALUE:xt,ERR_OUT_OF_RANGE:Ze,ERR_UNKNOWN_SIGNAL:qs}}=V(),{normalizeEncoding:$f}=Y(),{isAsyncFunction:kf,isArrayBufferView:qf}=Y().types,Us={};function Uf(t){return t===(t|0)}function Wf(t){return t===t>>>0}var Gf=/^[0-7]+$/,Qf="must be a 32-bit unsigned integer or an octal string";function zf(t,e,r){if(typeof t=="undefined"&&(t=r),typeof t=="string"){if(zs(Gf,t)===null)throw new xt(e,t,Qf);t=Bf(t,8)}return Vs(t,e),t}var Vf=re((t,e,r=Lf,i=jf)=>{if(typeof t!="number")throw new H(e,"number",t);if(!Si(t))throw new Ze(e,"an integer",t);if(t<r||t>i)throw new Ze(e,`>= ${r} && <= ${i}`,t)}),Hf=re((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!="number")throw new H(e,"number",t);if(!Si(t))throw new Ze(e,"an integer",t);if(t<r||t>i)throw new Ze(e,`>= ${r} && <= ${i}`,t)}),Vs=re((t,e,r=!1)=>{if(typeof t!="number")throw new H(e,"number",t);if(!Si(t))throw new Ze(e,"an integer",t);let i=r?1:0,n=4294967295;if(t<i||t>n)throw new Ze(e,`>= ${i} && <= ${n}`,t)});function Ii(t,e){if(typeof t!="string")throw new H(e,"string",t)}function Kf(t,e,r=void 0,i){if(typeof t!="number")throw new H(e,"number",t);if(r!=null&&t<r||i!=null&&t>i||(r!=null||i!=null)&&Pf(t))throw new Ze(e,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,t)}var Yf=re((t,e,r)=>{if(!Gs(r,t)){let n="must be one of: "+Qs(Nf(r,s=>typeof s=="string"?`'${s}'`:Cf(s)),", ");throw new xt(e,t,n)}});function Hs(t,e){if(typeof t!="boolean")throw new H(e,"boolean",t)}function xi(t,e,r){return t==null||!Ff(t,e)?r:t[e]}var Zf=re((t,e,r=null)=>{let i=xi(r,"allowArray",!1),n=xi(r,"allowFunction",!1);if(!xi(r,"nullable",!1)&&t===null||!i&&Ei(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new H(e,"Object",t)}),Xf=re((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new H(e,"a dictionary",t)}),Er=re((t,e,r=0)=>{if(!Ei(t))throw new H(e,"Array",t);if(t.length<r){let i=`must be longer than ${r}`;throw new xt(e,t,i)}});function Jf(t,e){Er(t,e);for(let r=0;r<t.length;r++)Ii(t[r],`${e}[${r}]`)}function ec(t,e){Er(t,e);for(let r=0;r<t.length;r++)Hs(t[r],`${e}[${r}]`)}function tc(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 H(n,"AbortSignal",i);Ks(i,n)}}function rc(t,e="signal"){if(Ii(t,e),Us[t]===void 0)throw Us[Df(t)]!==void 0?new qs(t+" (signals must use all capital letters)"):new qs(t)}var ic=re((t,e="buffer")=>{if(!qf(t))throw new H(e,["Buffer","TypedArray","DataView"],t)});function nc(t,e){let r=$f(e),i=t.length;if(r==="hex"&&i%2!==0)throw new xt("encoding",e,`is invalid for data of length ${i}`)}function sc(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&Of(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new Mf(e,t,r);return t|0}var Ks=re((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new H(e,"AbortSignal",t)}),oc=re((t,e)=>{if(typeof t!="function")throw new H(e,"Function",t)}),ac=re((t,e)=>{if(typeof t!="function"||kf(t))throw new H(e,"Function",t)}),lc=re((t,e)=>{if(t!==void 0)throw new H(e,"undefined",t)});function uc(t,e,r){if(!Gs(r,t))throw new H(e,`('${Qs(r,"|")}')`,t)}var fc=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Ws(t,e){if(typeof t=="undefined"||!zs(fc,t))throw new xt(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function cc(t){if(typeof t=="string")return Ws(t,"hints"),t;if(Ei(t)){let e=t.length,r="";if(e===0)return r;for(let i=0;i<e;i++){let n=t[i];Ws(n,"hints"),r+=n,i!==e-1&&(r+=", ")}return r}throw new xt("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Ys.exports={isInt32:Uf,isUint32:Wf,parseFileMode:zf,validateArray:Er,validateStringArray:Jf,validateBooleanArray:ec,validateAbortSignalArray:tc,validateBoolean:Hs,validateBuffer:ic,validateDictionary:Xf,validateEncoding:nc,validateFunction:oc,validateInt32:Hf,validateInteger:Vf,validateNumber:Kf,validateObject:Zf,validateOneOf:Yf,validatePlainFunction:ac,validatePort:sc,validateSignalName:rc,validateString:Ii,validateUint32:Vs,validateUndefined:lc,validateUnion:uc,validateAbortSignal:Ks,validateLinkHeaderValue:cc}});var $e=A((db,eo)=>{var F=eo.exports={},_e,pe;function Ri(){throw new Error("setTimeout has not been defined")}function Ti(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?_e=setTimeout:_e=Ri}catch(t){_e=Ri}try{typeof clearTimeout=="function"?pe=clearTimeout:pe=Ti}catch(t){pe=Ti}})();function Zs(t){if(_e===setTimeout)return setTimeout(t,0);if((_e===Ri||!_e)&&setTimeout)return _e=setTimeout,setTimeout(t,0);try{return _e(t,0)}catch(e){try{return _e.call(null,t,0)}catch(r){return _e.call(this,t,0)}}}function dc(t){if(pe===clearTimeout)return clearTimeout(t);if((pe===Ti||!pe)&&clearTimeout)return pe=clearTimeout,clearTimeout(t);try{return pe(t)}catch(e){try{return pe.call(null,t)}catch(r){return pe.call(this,t)}}}var ve=[],St=!1,Xe,Sr=-1;function hc(){!St||!Xe||(St=!1,Xe.length?ve=Xe.concat(ve):Sr=-1,ve.length&&Xs())}function Xs(){if(!St){var t=Zs(hc);St=!0;for(var e=ve.length;e;){for(Xe=ve,ve=[];++Sr<e;)Xe&&Xe[Sr].run();Sr=-1,e=ve.length}Xe=null,St=!1,dc(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];ve.push(new Js(t,e)),ve.length===1&&!St&&Zs(Xs)};function Js(t,e){this.fun=t,this.array=e}Js.prototype.run=function(){this.fun.apply(null,this.array)};F.title="browser";F.browser=!0;F.env={};F.argv=[];F.version="";F.versions={};function Ne(){}F.on=Ne;F.addListener=Ne;F.once=Ne;F.off=Ne;F.removeListener=Ne;F.removeAllListeners=Ne;F.emit=Ne;F.prependListener=Ne;F.prependOnceListener=Ne;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 ye=A((hb,bo)=>{"use strict";var{SymbolAsyncIterator:to,SymbolIterator:ro,SymbolFor:Je}=j(),io=Je("nodejs.stream.destroyed"),no=Je("nodejs.stream.errored"),Ai=Je("nodejs.stream.readable"),vi=Je("nodejs.stream.writable"),so=Je("nodejs.stream.disturbed"),_c=Je("nodejs.webstream.isClosedPromise"),pc=Je("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 bc(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function be(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function oo(t){return!!(t&&!be(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function ao(t){return!!(t&&!be(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function lo(t){return!!(t&&!be(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function yc(t){return oo(t)||ao(t)||lo(t)}function gc(t,e){return t==null?!1:e===!0?typeof t[to]=="function":e===!1?typeof t[ro]=="function":typeof t[to]=="function"||typeof t[ro]=="function"}function Tr(t){if(!be(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[io]||i!=null&&i.destroyed)}function uo(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 mc(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 wc(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 fo(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 co(t){return t&&t[Ai]!=null?t[Ai]:typeof(t==null?void 0:t.readable)!="boolean"?null:Tr(t)?!1:Ir(t)&&t.readable&&!fo(t)}function ho(t){return t&&t[vi]!=null?t[vi]:typeof(t==null?void 0:t.writable)!="boolean"?null:Tr(t)?!1:Rr(t)&&t.writable&&!uo(t)}function xc(t,e){return be(t)?Tr(t)?!0:!((e==null?void 0:e.readable)!==!1&&co(t)||(e==null?void 0:e.writable)!==!1&&ho(t)):null}function Ec(t){var e,r;return be(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 Sc(t){var e,r;return be(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 Ic(t){if(!be(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"&&_o(t)?t._closed:null}function _o(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function po(t){return typeof t._sent100=="boolean"&&_o(t)}function Rc(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 Tc(t){if(!be(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&po(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}function Ac(t){var e;return!!(t&&((e=t[so])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function vc(t){var e,r,i,n,s,o,a,l,u,c;return!!(t&&((e=(r=(i=(n=(s=(o=t[no])!==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:!((c=t._writableState)===null||c===void 0)&&c.errored))}bo.exports={isDestroyed:Tr,kIsDestroyed:io,isDisturbed:Ac,kIsDisturbed:so,isErrored:vc,kIsErrored:no,isReadable:co,kIsReadable:Ai,kIsClosedPromise:_c,kControllerErrorFunction:pc,kIsWritable:vi,isClosed:Ic,isDuplexNodeStream:bc,isFinished:xc,isIterable:gc,isReadableNodeStream:Ir,isReadableStream:oo,isReadableEnded:wc,isReadableFinished:fo,isReadableErrored:Sc,isNodeStream:be,isWebStream:yc,isWritable:ho,isWritableNodeStream:Rr,isWritableStream:ao,isWritableEnded:uo,isWritableFinished:mc,isWritableErrored:Ec,isServerRequest:Rc,isServerResponse:po,willEmitClose:Tc,isTransformStream:lo}});var Pe=A((_b,Bi)=>{"use strict";var ke=$e(),{AbortError:Ro,codes:Nc}=V(),{ERR_INVALID_ARG_TYPE:Pc,ERR_STREAM_PREMATURE_CLOSE:yo}=Nc,{kEmptyObject:Pi,once:ji}=Y(),{validateAbortSignal:jc,validateFunction:Lc,validateObject:Bc,validateBoolean:Fc}=Et(),{Promise:Cc,PromisePrototypeThen:Dc,SymbolDispose:To}=j(),{isClosed:Oc,isReadable:go,isReadableNodeStream:Ni,isReadableStream:Mc,isReadableFinished:mo,isReadableErrored:wo,isWritable:xo,isWritableNodeStream:Eo,isWritableStream:$c,isWritableFinished:So,isWritableErrored:Io,isNodeStream:kc,willEmitClose:qc,kIsClosedPromise:Uc}=ye(),It;function Wc(t){return t.setHeader&&typeof t.abort=="function"}var Li=()=>{};function Ao(t,e,r){var i,n;if(arguments.length===2?(r=e,e=Pi):e==null?e=Pi:Bc(e,"options"),Lc(r,"callback"),jc(e.signal,"options.signal"),r=ji(r),Mc(t)||$c(t))return Gc(t,e,r);if(!kc(t))throw new Pc("stream",["ReadableStream","WritableStream","Stream"],t);let s=(i=e.readable)!==null&&i!==void 0?i:Ni(t),o=(n=e.writable)!==null&&n!==void 0?n:Eo(t),a=t._writableState,l=t._readableState,u=()=>{t.writable||h()},c=qc(t)&&Ni(t)===s&&Eo(t)===o,f=So(t,!1),h=()=>{f=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||s))&&(!s||d)&&r.call(t)},d=mo(t,!1),_=()=>{d=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||o))&&(!o||f)&&r.call(t)},p=w=>{r.call(t,w)},y=Oc(t),m=()=>{y=!0;let w=Io(t)||wo(t);if(w&&typeof w!="boolean")return r.call(t,w);if(s&&!d&&Ni(t,!0)&&!mo(t,!1))return r.call(t,new yo);if(o&&!f&&!So(t,!1))return r.call(t,new yo);r.call(t)},S=()=>{y=!0;let w=Io(t)||wo(t);if(w&&typeof w!="boolean")return r.call(t,w);r.call(t)},x=()=>{t.req.on("finish",h)};Wc(t)?(t.on("complete",h),c||t.on("abort",m),t.req?x():t.on("request",x)):o&&!a&&(t.on("end",u),t.on("close",u)),!c&&typeof t.aborted=="boolean"&&t.on("aborted",m),t.on("end",_),t.on("finish",h),e.error!==!1&&t.on("error",p),t.on("close",m),y?ke.nextTick(m):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?c||ke.nextTick(S):(!s&&(!c||go(t))&&(f||xo(t)===!1)||!o&&(!c||xo(t))&&(d||go(t)===!1)||l&&t.req&&t.aborted)&&ke.nextTick(S);let g=()=>{r=Li,t.removeListener("aborted",m),t.removeListener("complete",h),t.removeListener("abort",m),t.removeListener("request",x),t.req&&t.req.removeListener("finish",h),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",h),t.removeListener("end",_),t.removeListener("error",p),t.removeListener("close",m)};if(e.signal&&!y){let w=()=>{let R=r;g(),R.call(t,new Ro(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)ke.nextTick(w);else{It=It||Y().addAbortListener;let R=It(e.signal,w),T=r;r=ji((...U)=>{R[To](),T.apply(t,U)})}}return g}function Gc(t,e,r){let i=!1,n=Li;if(e.signal)if(n=()=>{i=!0,r.call(t,new Ro(void 0,{cause:e.signal.reason}))},e.signal.aborted)ke.nextTick(n);else{It=It||Y().addAbortListener;let o=It(e.signal,n),a=r;r=ji((...l)=>{o[To](),a.apply(t,l)})}let s=(...o)=>{i||ke.nextTick(()=>r.apply(t,o))};return Dc(t[Uc].promise,s,s),Li}function Qc(t,e){var r;let i=!1;return e===null&&(e=Pi),(r=e)!==null&&r!==void 0&&r.cleanup&&(Fc(e.cleanup,"cleanup"),i=e.cleanup),new Cc((n,s)=>{let o=Ao(t,e,a=>{i&&o(),a?s(a):n()})})}Bi.exports=Ao;Bi.exports.finished=Qc});var et=A((pb,Co)=>{"use strict";var ge=$e(),{aggregateTwoErrors:zc,codes:{ERR_MULTIPLE_CALLBACK:Vc},AbortError:Hc}=V(),{Symbol:Po}=j(),{kIsDestroyed:Kc,isDestroyed:Yc,isFinished:Zc,isServerRequest:Xc}=ye(),jo=Po("kDestroy"),Fi=Po("kConstruct");function Lo(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Jc(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):(Lo(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?vo(this,t,e):this.once(jo,function(s){vo(this,zc(s,t),e)}),this)}function vo(t,e,r){let i=!1;function n(s){if(i)return;i=!0;let o=t._readableState,a=t._writableState;Lo(s,a,o),a&&(a.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?ge.nextTick(ed,t,s):ge.nextTick(Bo,t)}try{t._destroy(e||null,n)}catch(s){n(s)}}function ed(t,e){Ci(t,e),Bo(t)}function Bo(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 Ci(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 td(){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 Di(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?ge.nextTick(Ci,t,e):Ci(t,e))}function rd(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(Fi,e),!(t.listenerCount(Fi)>1)&&ge.nextTick(id,t)}function id(t){let e=!1;function r(i){if(e){Di(t,i!=null?i:new Vc);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(jo,i):i?Di(t,i,!0):ge.nextTick(nd,t)}try{t._construct(i=>{ge.nextTick(r,i)})}catch(i){ge.nextTick(r,i)}}function nd(t){t.emit(Fi)}function No(t){return(t==null?void 0:t.setHeader)&&typeof t.abort=="function"}function Fo(t){t.emit("close")}function sd(t,e){t.emit("error",e),ge.nextTick(Fo,t)}function od(t,e){!t||Yc(t)||(!e&&!Zc(t)&&(e=new Hc),Xc(t)?(t.socket=null,t.destroy(e)):No(t)?t.abort():No(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?ge.nextTick(sd,t,e):ge.nextTick(Fo,t),t.destroyed||(t[Kc]=!0))}Co.exports={construct:rd,destroyer:od,destroy:Jc,undestroy:td,errorOrDestroy:Di}});var Nr=A((bb,Oo)=>{"use strict";var{ArrayIsArray:ad,ObjectSetPrototypeOf:Do}=j(),{EventEmitter:Ar}=Ht();function vr(t){Ar.call(this,t)}Do(vr.prototype,Ar.prototype);Do(vr,Ar);vr.prototype.pipe=function(t,e){let r=this;function i(c){t.writable&&t.write(c)===!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(c){u(),Ar.listenerCount(this,"error")===0&&this.emit("error",c)}Oi(r,"error",l),Oi(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 Oi(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):ad(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}Oo.exports={Stream:vr,prependListener:Oi}});var Kt=A((yb,Pr)=>{"use strict";var{SymbolDispose:ld}=j(),{AbortError:Mo,codes:ud}=V(),{isNodeStream:$o,isWebStream:fd,kControllerErrorFunction:cd}=ye(),dd=Pe(),{ERR_INVALID_ARG_TYPE:ko}=ud,Mi,hd=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new ko(e,"AbortSignal",t)};Pr.exports.addAbortSignal=function(e,r){if(hd(e,"signal"),!$o(r)&&!fd(r))throw new ko("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=$o(e)?()=>{e.destroy(new Mo(void 0,{cause:t.reason}))}:()=>{e[cd](new Mo(void 0,{cause:t.reason}))};if(t.aborted)r();else{Mi=Mi||Y().addAbortListener;let i=Mi(t,r);dd(e,i[ld])}return e}});var Wo=A((mb,Uo)=>{"use strict";var{StringPrototypeSlice:qo,SymbolIterator:_d,TypedArrayPrototypeSet:jr,Uint8Array:pd}=j(),{Buffer:$i}=fe(),{inspect:bd}=Y();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 $i.alloc(0);let r=$i.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}*[_d](){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+=qo(s,0,e),this.head=i,i.data=qo(s,e));break}++n}while((i=i.next)!==null);return this.length-=n,r}_getBuffer(e){let r=$i.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 pd(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 bd(this,Ce(M({},r),{depth:0,customInspect:!1}))}}});var Yt=A((xb,Vo)=>{"use strict";var{MathFloor:yd,NumberIsInteger:gd}=j(),{validateInteger:md}=Et(),{ERR_INVALID_ARG_VALUE:wd}=V().codes,Go=16*1024,Qo=16;function xd(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function zo(t){return t?Qo:Go}function Ed(t,e){md(e,"value",0),t?Qo=e:Go=e}function Sd(t,e,r,i){let n=xd(e,i,r);if(n!=null){if(!gd(n)||n<0){let s=i?`options.${r}`:"options.highWaterMark";throw new wd(s,n)}return yd(n)}return zo(t.objectMode)}Vo.exports={getHighWaterMark:Sd,getDefaultHighWaterMark:zo,setDefaultHighWaterMark:Ed}});var Yo=A((ki,Ko)=>{var Lr=fe(),me=Lr.Buffer;function Ho(t,e){for(var r in t)e[r]=t[r]}me.from&&me.alloc&&me.allocUnsafe&&me.allocUnsafeSlow?Ko.exports=Lr:(Ho(Lr,ki),ki.Buffer=tt);function tt(t,e,r){return me(t,e,r)}tt.prototype=Object.create(me.prototype);Ho(me,tt);tt.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return me(t,e,r)};tt.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=me(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};tt.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return me(t)};tt.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Lr.SlowBuffer(t)}});var Jo=A(Xo=>{"use strict";var Ui=Yo().Buffer,Zo=Ui.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 Id(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 Rd(t){var e=Id(t);if(typeof e!="string"&&(Ui.isEncoding===Zo||!Zo(t)))throw new Error("Unknown encoding: "+t);return e||t}Xo.StringDecoder=Zt;function Zt(t){this.encoding=Rd(t);var e;switch(this.encoding){case"utf16le":this.text=jd,this.end=Ld,e=4;break;case"utf8":this.fillLast=vd,e=4;break;case"base64":this.text=Bd,this.end=Fd,e=3;break;default:this.write=Cd,this.end=Dd;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Ui.allocUnsafe(e)}Zt.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||""};Zt.prototype.end=Pd;Zt.prototype.text=Nd;Zt.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 qi(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Td(t,e,r){var i=e.length-1;if(i<r)return 0;var n=qi(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=qi(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=qi(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}function Ad(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 vd(t){var e=this.lastTotal-this.lastNeed,r=Ad(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 Nd(t,e){var r=Td(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 Pd(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function jd(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 Ld(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 Bd(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 Fd(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Cd(t){return t.toString(this.encoding)}function Dd(t){return t&&t.length?this.write(t):""}});var Wi=A((Sb,ia)=>{"use strict";var ea=$e(),{PromisePrototypeThen:Od,SymbolAsyncIterator:ta,SymbolIterator:ra}=j(),{Buffer:Md}=fe(),{ERR_INVALID_ARG_TYPE:$d,ERR_STREAM_NULL_VALUES:kd}=V().codes;function qd(t,e,r){let i;if(typeof e=="string"||e instanceof Md)return new t(Ce(M({objectMode:!0},r),{read(){this.push(e),this.push(null)}}));let n;if(e&&e[ta])n=!0,i=e[ta]();else if(e&&e[ra])n=!1,i=e[ra]();else throw new $d("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,c){Od(a(u),()=>ea.nextTick(c,u),f=>ea.nextTick(c,f||u))};async function a(u){let c=u!=null,f=typeof i.throw=="function";if(c&&f){let{value:h,done:d}=await i.throw(u);if(await h,d)return}if(typeof i.return=="function"){let{value:h}=await i.return();await h}}async function l(){for(;;){try{let{value:u,done:c}=n?await i.next():i.next();if(c)s.push(null);else{let f=u&&typeof u.then=="function"?await u:u;if(f===null)throw o=!1,new kd;if(s.push(f))continue;o=!1}}catch(u){s.destroy(u)}break}}return s}ia.exports=qd});var Jt=A((Rb,xa)=>{"use strict";var oe=$e(),{ArrayPrototypeIndexOf:Ud,NumberIsInteger:Wd,NumberIsNaN:Gd,NumberParseInt:Qd,ObjectDefineProperties:Zi,ObjectKeys:zd,ObjectSetPrototypeOf:oa,Promise:aa,SafeSet:Vd,SymbolAsyncDispose:Hd,SymbolAsyncIterator:Kd,Symbol:Yd}=j();xa.exports=E;E.ReadableState=Dr;var{EventEmitter:Zd}=Ht(),{Stream:qe,prependListener:Xd}=Nr(),{Buffer:Gi}=fe(),{addAbortSignal:Jd}=Kt(),la=Pe(),I=Y().debuglog("stream",t=>{I=t}),eh=Wo(),At=et(),{getHighWaterMark:th,getDefaultHighWaterMark:rh}=Yt(),{aggregateTwoErrors:na,codes:{ERR_INVALID_ARG_TYPE:ih,ERR_METHOD_NOT_IMPLEMENTED:nh,ERR_OUT_OF_RANGE:sh,ERR_STREAM_PUSH_AFTER_EOF:oh,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:ah},AbortError:lh}=V(),{validateObject:uh}=Et(),rt=Yd("kPaused"),{StringDecoder:ua}=Jo(),fh=Wi();oa(E.prototype,qe.prototype);oa(E,qe);var Qi=()=>{},{errorOrDestroy:Rt}=At,Tt=1,ch=2,fa=4,Xt=8,ca=16,Br=32,Fr=64,da=128,dh=256,hh=512,_h=1024,Ki=2048,Yi=4096,ph=8192,bh=16384,yh=32768,ha=65536,gh=1<<17,mh=1<<18;function k(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}Zi(Dr.prototype,{objectMode:k(Tt),ended:k(ch),endEmitted:k(fa),reading:k(Xt),constructed:k(ca),sync:k(Br),needReadable:k(Fr),emittedReadable:k(da),readableListening:k(dh),resumeScheduled:k(hh),errorEmitted:k(_h),emitClose:k(Ki),autoDestroy:k(Yi),destroyed:k(ph),closed:k(bh),closeEmitted:k(yh),multiAwaitDrain:k(ha),readingMore:k(gh),dataEmitted:k(mh)});function Dr(t,e,r){typeof r!="boolean"&&(r=e instanceof we()),this.state=Ki|Yi|ca|Br,t&&t.objectMode&&(this.state|=Tt),r&&t&&t.readableObjectMode&&(this.state|=Tt),this.highWaterMark=t?th(this,t,"readableHighWaterMark",r):rh(!1),this.buffer=new eh,this.length=0,this.pipes=[],this.flowing=null,this[rt]=null,t&&t.emitClose===!1&&(this.state&=~Ki),t&&t.autoDestroy===!1&&(this.state&=~Yi),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new ua(t.encoding),this.encoding=t.encoding)}function E(t){if(!(this instanceof E))return new E(t);let e=this instanceof we();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&&Jd(t.signal,this)),qe.call(this,t),At.construct(this,()=>{this._readableState.needReadable&&Cr(this,this._readableState)})}E.prototype.destroy=At.destroy;E.prototype._undestroy=At.undestroy;E.prototype._destroy=function(t,e){e(t)};E.prototype[Zd.captureRejectionSymbol]=function(t){this.destroy(t)};E.prototype[Hd]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new lh,this.destroy(t)),new aa((e,r)=>la(this,i=>i&&i!==t?r(i):e(null)))};E.prototype.push=function(t,e){return _a(this,t,e,!1)};E.prototype.unshift=function(t,e){return _a(this,t,e,!0)};function _a(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=Gi.from(e,r).toString(n.encoding):(e=Gi.from(e,r),r=""))):e instanceof Gi?r="":qe._isUint8Array(e)?(e=qe._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new ih("chunk",["string","Buffer","Uint8Array"],e))),s)Rt(t,s);else if(e===null)n.state&=~Xt,Eh(t,n);else if((n.state&Tt)!==0||e&&e.length>0)if(i)if((n.state&fa)!==0)Rt(t,new ah);else{if(n.destroyed||n.errored)return!1;zi(t,n,e,!0)}else if(n.ended)Rt(t,new oh);else{if(n.destroyed||n.errored)return!1;n.state&=~Xt,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?zi(t,n,e,!1):Cr(t,n)):zi(t,n,e,!1)}else i||(n.state&=~Xt,Cr(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}function zi(t,e,r,i){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&ha)!==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)),Cr(t,e)}E.prototype.isPaused=function(){let t=this._readableState;return t[rt]===!0||t.flowing===!1};E.prototype.setEncoding=function(t){let e=new ua(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 wh=1073741824;function xh(t){if(t>wh)throw new sh("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function sa(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&Tt)!==0?1:Gd(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:Wd(t)||(t=Qd(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=xh(t)),t!==0&&(e.state&=~da),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?Vi(this):Or(this),null;if(t=sa(t,e),t===0&&e.ended)return e.length===0&&Vi(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|=Xt|Br,e.length===0&&(e.state|=Fr);try{this._read(e.highWaterMark)}catch(s){Rt(this,s)}e.state&=~Br,e.reading||(t=sa(r,e))}let n;return t>0?n=ma(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Vi(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function Eh(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,pa(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(pa,t))}function pa(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,ya(t)}function Cr(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,oe.nextTick(Sh,t,e))}function Sh(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 nh("_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 Vd(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(m,S){I("onunpipe"),m===r&&S&&S.hasUnpiped===!1&&(S.hasUnpiped=!0,c())}function a(){I("onend"),t.end()}let l,u=!1;function c(){I("cleanup"),t.removeListener("close",_),t.removeListener("finish",p),l&&t.removeListener("drain",l),t.removeListener("error",d),t.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",y),r.removeListener("data",h),u=!0,l&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&l()}function f(){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=Ih(r,t),t.on("drain",l))}r.on("data",h);function h(m){I("ondata");let S=t.write(m);I("dest.write",S),S===!1&&f()}function d(m){if(I("onerror",m),y(),t.removeListener("error",d),t.listenerCount("error")===0){let S=t._writableState||t._readableState;S&&!S.errorEmitted?Rt(t,m):t.emit("error",m)}}Xd(t,"error",d);function _(){t.removeListener("finish",p),y()}t.once("close",_);function p(){I("onfinish"),t.removeListener("close",_),y()}t.once("finish",p);function y(){I("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?f():i.flowing||(I("pipe resume"),r.resume()),t};function Ih(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=Ud(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=qe.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(Rh,this)),r};E.prototype.addListener=E.prototype.on;E.prototype.removeListener=function(t,e){let r=qe.prototype.removeListener.call(this,t,e);return t==="readable"&&oe.nextTick(ba,this),r};E.prototype.off=E.prototype.removeListener;E.prototype.removeAllListeners=function(t){let e=qe.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&oe.nextTick(ba,this),e};function ba(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[rt]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function Rh(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,Th(this,t)),t[rt]=!1,this};function Th(t,e){e.resumeScheduled||(e.resumeScheduled=!0,oe.nextTick(Ah,t,e))}function Ah(t,e){I("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),ya(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[rt]=!0,this};function ya(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=zd(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[Kd]=function(){return ga(this)};E.prototype.iterator=function(t){return t!==void 0&&uh(t,"options"),ga(this,t)};function ga(t,e){typeof t.read!="function"&&(t=E.wrap(t,{objectMode:!0}));let r=vh(t,e);return r.stream=t,r}function vh(t,e){return ee(this,null,function*(){let r=Qi;function i(o){this===t?(r(),r=Qi):r=o}t.on("readable",i);let n,s=la(t,{writable:!1},o=>{n=o?na(n,o):null,r(),r=Qi});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 G(new aa(i))}}}catch(o){throw n=na(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())}})}Zi(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}}});Zi(Dr.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[rt]!==!1},set(t){this[rt]=!!t}}});E._fromList=ma;function ma(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function Vi(t){let e=t._readableState;I("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,oe.nextTick(Nh,e,t))}function Nh(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(Ph,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function Ph(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}E.from=function(t,e){return fh(E,t,e)};var Hi;function wa(){return Hi===void 0&&(Hi={}),Hi}E.fromWeb=function(t,e){return wa().newStreamReadableFromReadableStream(t,e)};E.toWeb=function(t,e){return wa().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){At.destroyer(t,n),s(n)}})).wrap(t)}});var Ur=A((Ab,Ba)=>{"use strict";var it=$e(),{ArrayPrototypeSlice:Ia,Error:jh,FunctionPrototypeSymbolHasInstance:Ra,ObjectDefineProperty:Ta,ObjectDefineProperties:Lh,ObjectSetPrototypeOf:Aa,StringPrototypeToLowerCase:Bh,Symbol:Fh,SymbolHasInstance:Ch}=j();Ba.exports=L;L.WritableState=rr;var{EventEmitter:Dh}=Ht(),er=Nr().Stream,{Buffer:Mr}=fe(),qr=et(),{addAbortSignal:Oh}=Kt(),{getHighWaterMark:Mh,getDefaultHighWaterMark:$h}=Yt(),{ERR_INVALID_ARG_TYPE:kh,ERR_METHOD_NOT_IMPLEMENTED:qh,ERR_MULTIPLE_CALLBACK:va,ERR_STREAM_CANNOT_PIPE:Uh,ERR_STREAM_DESTROYED:tr,ERR_STREAM_ALREADY_FINISHED:Wh,ERR_STREAM_NULL_VALUES:Gh,ERR_STREAM_WRITE_AFTER_END:Qh,ERR_UNKNOWN_ENCODING:Na}=V().codes,{errorOrDestroy:vt}=qr;Aa(L.prototype,er.prototype);Aa(L,er);function en(){}var Nt=Fh("kOnFinished");function rr(t,e,r){typeof r!="boolean"&&(r=e instanceof we()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?Mh(this,t,"writableHighWaterMark",r):$h(!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=Vh.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}rr.prototype.getBuffer=function(){return Ia(this.buffered,this.bufferedIndex)};Ta(rr.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function L(t){let e=this instanceof we();if(!e&&!Ra(L,this))return new L(t);this._writableState=new rr(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&&Oh(t.signal,this)),er.call(this,t),qr.construct(this,()=>{let r=this._writableState;r.writing||rn(this,r),nn(this,r)})}Ta(L,Ch,{__proto__:null,value:function(t){return Ra(this,t)?!0:this!==L?!1:t&&t._writableState instanceof rr}});L.prototype.pipe=function(){vt(this,new Uh)};function Pa(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 Na(r);typeof i!="function"&&(i=en)}if(e===null)throw new Gh;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(er._isUint8Array(e))e=er._uint8ArrayToBuffer(e),r="buffer";else throw new kh("chunk",["string","Buffer","Uint8Array"],e);let s;return n.ending?s=new Qh:n.destroyed&&(s=new tr("write")),s?(it.nextTick(i,s),vt(t,s,!0),s):(n.pendingcb++,zh(t,n,e,r,i))}L.prototype.write=function(t,e,r){return Pa(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||rn(this,t))};L.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=Bh(e)),!Mr.isEncoding(e))throw new Na(e);return this._writableState.defaultEncoding=e,this};function zh(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!==en&&(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 Ea(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new tr("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function Sa(t,e,r,i){--e.pendingcb,i(r),tn(e),vt(t,r)}function Vh(t,e){let r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function"){vt(t,new va);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?it.nextTick(Sa,t,r,e,n):Sa(t,r,e,n)):(r.buffered.length>r.bufferedIndex&&rn(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},it.nextTick(Hh,r.afterWriteTickInfo)):ja(t,r,1,n))}function Hh({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,ja(t,e,r,i)}function ja(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&&tn(e),nn(t,e)}function tn(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 tr("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 tr("end"))}kr(t)}function rn(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?en:u=>{for(let c=o;c<r.length;++c)r[c].callback(u)},l=e.allNoop&&o===0?r:Ia(r,o);l.allBuffers=e.allBuffers,Ea(t,e,!0,e.length,l,"",a),kr(e)}else{do{let{chunk:a,encoding:l,callback:u}=r[o];r[o++]=null;let c=n?1:a.length;Ea(t,e,!1,c,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}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=Pa(this,t,e);s instanceof jh&&(n=s)}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,nn(this,i,!0),i.ended=!0):i.finished?n=new Wh("end"):i.destroyed&&(n=new tr("end"))),typeof r=="function"&&(n||i.finished?it.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 Kh(t,e){let r=!1;function i(n){if(r){vt(t,n!=null?n:va());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++,it.nextTick(Ji,t,e))}e.sync=!0,e.pendingcb++;try{t._final(i)}catch(n){i(n)}e.sync=!1}function Yh(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,Kh(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function nn(t,e,r){$r(e)&&(Yh(t,e),e.pendingcb===0&&(r?(e.pendingcb++,it.nextTick((i,n)=>{$r(n)?Ji(i,n):n.pendingcb--},t,e)):$r(e)&&(e.pendingcb++,Ji(t,e))))}function Ji(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()}}Lh(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 Zh=qr.destroy;L.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[Nt].length)&&it.nextTick(tn,r),Zh.call(this,t,e),this};L.prototype._undestroy=qr.undestroy;L.prototype._destroy=function(t,e){e(t)};L.prototype[Dh.captureRejectionSymbol]=function(t){this.destroy(t)};var Xi;function La(){return Xi===void 0&&(Xi={}),Xi}L.fromWeb=function(t,e){return La().newStreamWritableFromWritableStream(t,e)};L.toWeb=function(t){return La().newWritableStreamFromStreamWritable(t)}});var Ha=A((vb,Va)=>{var sn=$e(),Xh=fe(),{isReadable:Jh,isWritable:e_,isIterable:Fa,isNodeStream:t_,isReadableNodeStream:Ca,isWritableNodeStream:Da,isDuplexNodeStream:r_,isReadableStream:Oa,isWritableStream:Ma}=ye(),$a=Pe(),{AbortError:Qa,codes:{ERR_INVALID_ARG_TYPE:i_,ERR_INVALID_RETURN_VALUE:ka}}=V(),{destroyer:jt}=et(),n_=we(),za=Jt(),s_=Ur(),{createDeferredPromise:qa}=Y(),Ua=Wi(),Wa=globalThis.Blob||Xh.Blob,o_=typeof Wa!="undefined"?function(e){return e instanceof Wa}:function(e){return!1},a_=globalThis.AbortController||mt().AbortController,{FunctionPrototypeCall:Ga}=j(),Ue=class extends n_{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)}};Va.exports=function t(e,r){if(r_(e))return e;if(Ca(e))return Pt({readable:e});if(Da(e))return Pt({writable:e});if(t_(e))return Pt({writable:!1,readable:!1});if(Oa(e))return Pt({readable:za.fromWeb(e)});if(Ma(e))return Pt({writable:s_.fromWeb(e)});if(typeof e=="function"){let{value:n,write:s,final:o,destroy:a}=l_(e);if(Fa(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,c=Ga(l,n,f=>{if(f!=null)throw new ka("nully","body",f)},f=>{jt(u,f)});return u=new Ue({objectMode:!0,readable:!1,write:s,final(f){o(async()=>{try{await c,sn.nextTick(f,null)}catch(h){sn.nextTick(f,h)}})},destroy:a})}throw new ka("Iterable, AsyncIterable or AsyncFunction",r,n)}if(o_(e))return t(e.arrayBuffer());if(Fa(e))return Ua(Ue,e,{objectMode:!0,writable:!1});if(Oa(e==null?void 0:e.readable)&&Ma(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?Da(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 Ga(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 i_(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function l_(t){let{promise:e,resolve:r}=qa(),i=new a_,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 G(o);if(sn.nextTick(u),l)return;if(n.aborted)throw new Qa(void 0,{cause:n.reason});({promise:e,resolve:r}=qa()),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"?za.wrap(t.readable):t.readable,r=t.writable,i=!!Jh(e),n=!!e_(r),s,o,a,l,u;function c(f){let h=l;l=null,h?h(f):f&&u.destroy(f)}return u=new Ue({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&($a(r,f=>{n=!1,f&&jt(e,f),c(f)}),u._write=function(f,h,d){r.write(f,h)?d():s=d},u._final=function(f){r.end(),o=f},r.on("drain",function(){if(s){let f=s;s=null,f()}}),r.on("finish",function(){if(o){let f=o;o=null,f()}})),i&&($a(e,f=>{i=!1,f&&jt(e,f),c(f)}),e.on("readable",function(){if(a){let f=a;a=null,f()}}),e.on("end",function(){u.push(null)}),u._read=function(){for(;;){let f=e.read();if(f===null){a=u._read;return}if(!u.push(f))return}}),u._destroy=function(f,h){!f&&l!==null&&(f=new Qa),a=null,s=null,o=null,l===null?h(f):(l=h,jt(r,f),jt(e,f))},u}});var we=A((Pb,Za)=>{"use strict";var{ObjectDefineProperties:u_,ObjectGetOwnPropertyDescriptor:je,ObjectKeys:f_,ObjectSetPrototypeOf:Ka}=j();Za.exports=ae;var ln=Jt(),ie=Ur();Ka(ae.prototype,ln.prototype);Ka(ae,ln);{let t=f_(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);ln.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}u_(ae.prototype,{writable:M({__proto__:null},je(ie.prototype,"writable")),writableHighWaterMark:M({__proto__:null},je(ie.prototype,"writableHighWaterMark")),writableObjectMode:M({__proto__:null},je(ie.prototype,"writableObjectMode")),writableBuffer:M({__proto__:null},je(ie.prototype,"writableBuffer")),writableLength:M({__proto__:null},je(ie.prototype,"writableLength")),writableFinished:M({__proto__:null},je(ie.prototype,"writableFinished")),writableCorked:M({__proto__:null},je(ie.prototype,"writableCorked")),writableEnded:M({__proto__:null},je(ie.prototype,"writableEnded")),writableNeedDrain:M({__proto__:null},je(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 on;function Ya(){return on===void 0&&(on={}),on}ae.fromWeb=function(t,e){return Ya().newStreamDuplexFromReadableWritablePair(t,e)};ae.toWeb=function(t){return Ya().newReadableWritablePairFromDuplex(t)};var an;ae.from=function(t){return an||(an=Ha()),an(t,"body")}});var cn=A((Lb,Ja)=>{"use strict";var{ObjectSetPrototypeOf:Xa,Symbol:c_}=j();Ja.exports=Le;var{ERR_METHOD_NOT_IMPLEMENTED:d_}=V().codes,fn=we(),{getHighWaterMark:h_}=Yt();Xa(Le.prototype,fn.prototype);Xa(Le,fn);var ir=c_("kCallback");function Le(t){if(!(this instanceof Le))return new Le(t);let e=t?h_(this,t,"readableHighWaterMark",!0):null;e===0&&(t=Ce(M({},t),{highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0})),fn.call(this,t),this._readableState.sync=!1,this[ir]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",__)}function un(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 __(){this._final!==un&&un.call(this)}Le.prototype._final=un;Le.prototype._transform=function(t,e,r){throw new d_("_transform()")};Le.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[ir]=r})};Le.prototype._read=function(){if(this[ir]){let t=this[ir];this[ir]=null,t()}}});var hn=A((Fb,tl)=>{"use strict";var{ObjectSetPrototypeOf:el}=j();tl.exports=Lt;var dn=cn();el(Lt.prototype,dn.prototype);el(Lt,dn);function Lt(t){if(!(this instanceof Lt))return new Lt(t);dn.call(this,t)}Lt.prototype._transform=function(t,e,r){r(null,t)}});var zr=A((Cb,ol)=>{var nr=$e(),{ArrayIsArray:p_,Promise:b_,SymbolAsyncIterator:y_,SymbolDispose:g_}=j(),Qr=Pe(),{once:m_}=Y(),w_=et(),rl=we(),{aggregateTwoErrors:x_,codes:{ERR_INVALID_ARG_TYPE:En,ERR_INVALID_RETURN_VALUE:_n,ERR_MISSING_ARGS:E_,ERR_STREAM_DESTROYED:S_,ERR_STREAM_PREMATURE_CLOSE:I_},AbortError:R_}=V(),{validateFunction:T_,validateAbortSignal:A_}=Et(),{isIterable:nt,isReadable:pn,isReadableNodeStream:Gr,isNodeStream:il,isTransformStream:Bt,isWebStream:v_,isReadableStream:bn,isReadableFinished:N_}=ye(),P_=globalThis.AbortController||mt().AbortController,yn,gn,mn;function nl(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,w_.destroyer(t,s||new S_("pipe")))},cleanup:n}}function j_(t){return T_(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function wn(t){if(nt(t))return t;if(Gr(t))return L_(t);throw new En("val",["Readable","Iterable","AsyncIterable"],t)}function L_(t){return ee(this,null,function*(){gn||(gn=Jt()),yield*ne(gn.prototype[y_].call(t))})}async function Wr(t,e,r,{end:i}){let n,s=null,o=d=>{if(d&&(n=d),s){let _=s;s=null,_()}},a=()=>new b_((d,_)=>{n?_(n):s=()=>{n?_(n):d()}});e.on("drain",o);let l=Qr(e,{readable:!1},o);try{e.writableNeedDrain&&await a();try{for(var u=Z(t),c,f,h;c=!(f=await u.next()).done;c=!1){let d=f.value;e.write(d)||await a()}}catch(f){h=[f]}finally{try{c&&(f=u.return)&&await f.call(u)}finally{if(h)throw h[0]}}i&&(e.end(),await a()),r()}catch(d){r(n!==d?x_(n,d):d)}finally{l(),e.off("drain",o)}}async function xn(t,e,r,{end:i}){Bt(e)&&(e=e.writable);let n=e.getWriter();try{try{for(var s=Z(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(c){r(c)}}}function B_(...t){return sl(t,m_(j_(t)))}function sl(t,e,r){if(t.length===1&&p_(t[0])&&(t=t[0]),t.length<2)throw new E_("streams");let i=new P_,n=i.signal,s=r==null?void 0:r.signal,o=[];A_(s,"options.signal");function a(){_(new R_)}mn=mn||Y().addAbortListener;let l;s&&(l=mn(s,a));let u,c,f=[],h=0;function d(x){_(x,--h===0)}function _(x,g){var w;if(x&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=x),!(!u&&!g)){for(;f.length;)f.shift()(u);(w=l)===null||w===void 0||w[g_](),i.abort(),g&&(u||o.forEach(R=>R()),nr.nextTick(e,u,c))}}let p;for(let x=0;x<t.length;x++){let g=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(il(g)){let D=function(J){J&&J.name!=="AbortError"&&J.code!=="ERR_STREAM_PREMATURE_CLOSE"&&d(J)};var S=D;if(T){let{destroy:J,cleanup:Jr}=nl(g,w,R);f.push(J),pn(g)&&U&&o.push(Jr)}g.on("error",D),pn(g)&&U&&o.push(()=>{g.removeListener("error",D)})}if(x===0)if(typeof g=="function"){if(p=g({signal:n}),!nt(p))throw new _n("Iterable, AsyncIterable or Stream","source",p)}else nt(g)||Gr(g)||Bt(g)?p=g:p=rl.from(g);else if(typeof g=="function"){if(Bt(p)){var y;p=wn((y=p)===null||y===void 0?void 0:y.readable)}else p=wn(p);if(p=g(p,{signal:n}),w){if(!nt(p,!0))throw new _n("AsyncIterable",`transform[${x-1}]`,p)}else{var m;yn||(yn=hn());let D=new yn({objectMode:!0}),J=(m=p)===null||m===void 0?void 0:m.then;if(typeof J=="function")h++,J.call(p,Fe=>{c=Fe,Fe!=null&&D.write(Fe),T&&D.end(),nr.nextTick(d)},Fe=>{D.destroy(Fe),nr.nextTick(d,Fe)});else if(nt(p,!0))h++,Wr(p,D,d,{end:T});else if(bn(p)||Bt(p)){let Fe=p.readable||p;h++,Wr(Fe,D,d,{end:T})}else throw new _n("AsyncIterable or Promise","destination",p);p=D;let{destroy:Jr,cleanup:kl}=nl(p,!1,!0);f.push(Jr),U&&o.push(kl)}}else if(il(g)){if(Gr(p)){h+=2;let D=F_(p,g,d,{end:T});pn(g)&&U&&o.push(D)}else if(Bt(p)||bn(p)){let D=p.readable||p;h++,Wr(D,g,d,{end:T})}else if(nt(p))h++,Wr(p,g,d,{end:T});else throw new En("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],p);p=g}else if(v_(g)){if(Gr(p))h++,xn(wn(p),g,d,{end:T});else if(bn(p)||nt(p))h++,xn(p,g,d,{end:T});else if(Bt(p))h++,xn(p.readable,g,d,{end:T});else throw new En("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],p);p=g}else p=rl.from(g)}return(n!=null&&n.aborted||s!=null&&s.aborted)&&nr.nextTick(a),p}function F_(t,e,r,{end:i}){let n=!1;if(e.on("close",()=>{n||r(new I_)}),t.pipe(e,{end:!1}),i){let o=function(){n=!0,e.end()};var s=o;N_(t)?nr.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)}ol.exports={pipelineImpl:sl,pipeline:B_}});var In=A((Ob,dl)=>{"use strict";var{pipeline:C_}=zr(),Vr=we(),{destroyer:D_}=et(),{isNodeStream:Hr,isReadable:al,isWritable:ll,isWebStream:Sn,isTransformStream:st,isWritableStream:ul,isReadableStream:fl}=ye(),{AbortError:O_,codes:{ERR_INVALID_ARG_VALUE:cl,ERR_MISSING_ARGS:M_}}=V(),$_=Pe();dl.exports=function(...e){if(e.length===0)throw new M_("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 d=e.length-1;e[d]=Vr.from(e[d])}for(let d=0;d<e.length;++d)if(!(!Hr(e[d])&&!Sn(e[d]))){if(d<e.length-1&&!(al(e[d])||fl(e[d])||st(e[d])))throw new cl(`streams[${d}]`,r[d],"must be readable");if(d>0&&!(ll(e[d])||ul(e[d])||st(e[d])))throw new cl(`streams[${d}]`,r[d],"must be writable")}let i,n,s,o,a;function l(d){let _=o;o=null,_?_(d):d?a.destroy(d):!h&&!f&&a.destroy()}let u=e[0],c=C_(e,l),f=!!(ll(u)||ul(u)||st(u)),h=!!(al(c)||fl(c)||st(c));if(a=new Vr({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:f,readable:h}),f){if(Hr(u))a._write=function(_,p,y){u.write(_,p)?y():i=y},a._final=function(_){u.end(),n=_},u.on("drain",function(){if(i){let _=i;i=null,_()}});else if(Sn(u)){let p=(st(u)?u.writable:u).getWriter();a._write=async function(y,m,S){try{await p.ready,p.write(y).catch(()=>{}),S()}catch(x){S(x)}},a._final=async function(y){try{await p.ready,p.close().catch(()=>{}),n=y}catch(m){y(m)}}}let d=st(c)?c.readable:c;$_(d,()=>{if(n){let _=n;n=null,_()}})}if(h){if(Hr(c))c.on("readable",function(){if(s){let d=s;s=null,d()}}),c.on("end",function(){a.push(null)}),a._read=function(){for(;;){let d=c.read();if(d===null){s=a._read;return}if(!a.push(d))return}};else if(Sn(c)){let _=(st(c)?c.readable:c).getReader();a._read=async function(){for(;;)try{let{value:p,done:y}=await _.read();if(!a.push(p))return;if(y){a.push(null);return}}catch(p){return}}}}return a._destroy=function(d,_){!d&&o!==null&&(d=new O_),s=null,i=null,n=null,o===null?_(d):(o=_,Hr(c)&&D_(c,d))},a}});var El=A((Mb,An)=>{"use strict";var k_=globalThis.AbortController||mt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:q_,ERR_INVALID_ARG_TYPE:sr,ERR_MISSING_ARGS:U_,ERR_OUT_OF_RANGE:W_},AbortError:xe}=V(),{validateAbortSignal:ot,validateInteger:hl,validateObject:at}=Et(),G_=j().Symbol("kWeak"),Q_=j().Symbol("kResistStopPropagation"),{finished:z_}=Pe(),V_=In(),{addAbortSignalNoValidate:H_}=Kt(),{isWritable:K_,isNodeStream:Y_}=ye(),{deprecate:Z_}=Y(),{ArrayPrototypePush:X_,Boolean:J_,MathFloor:_l,Number:ep,NumberIsNaN:tp,Promise:pl,PromiseReject:bl,PromiseResolve:rp,PromisePrototypeThen:yl,Symbol:ml}=j(),Kr=ml("kEmpty"),gl=ml("kEof");function ip(t,e){if(e!=null&&at(e,"options"),(e==null?void 0:e.signal)!=null&&ot(e.signal,"options.signal"),Y_(t)&&!K_(t))throw new q_("stream",t,"must be writable");let r=V_(this,t);return e!=null&&e.signal&&H_(e.signal,r),r}function Yr(t,e){if(typeof t!="function")throw new sr("fn",["Function","AsyncFunction"],t);e!=null&&at(e,"options"),(e==null?void 0:e.signal)!=null&&ot(e.signal,"options.signal");let r=1;(e==null?void 0:e.concurrency)!=null&&(r=_l(e.concurrency));let i=r-1;return(e==null?void 0:e.highWaterMark)!=null&&(i=_l(e.highWaterMark)),hl(r,"options.concurrency",1),hl(i,"options.highWaterMark",0),i+=r,function(){return ee(this,null,function*(){let s=Y().AbortSignalAny([e==null?void 0:e.signal].filter(J_)),o=this,a=[],l={signal:s},u,c,f=!1,h=0;function d(){f=!0,_()}function _(){h-=1,p()}function p(){c&&!f&&h<r&&a.length<i&&(c(),c=null)}async function y(){try{try{for(var m=Z(o),S,x,g;S=!(x=await m.next()).done;S=!1){let w=x.value;if(f)return;if(s.aborted)throw new xe;try{if(w=t(w,l),w===Kr)continue;w=rp(w)}catch(R){w=bl(R)}h+=1,yl(w,_,d),a.push(w),u&&(u(),u=null),!f&&(a.length>=i||h>=r)&&await new pl(R=>{c=R})}}catch(x){g=[x]}finally{try{S&&(x=m.return)&&await x.call(m)}finally{if(g)throw g[0]}}a.push(gl)}catch(w){let R=bl(w);yl(R,_,d),a.push(R)}finally{f=!0,u&&(u(),u=null)}}y();try{for(;;){for(;a.length>0;){let m=yield new G(a[0]);if(m===gl)return;if(s.aborted)throw new xe;m!==Kr&&(yield m),a.shift(),p()}yield new G(new pl(m=>{u=m}))}}finally{f=!0,c&&(c(),c=null)}})}.call(this)}function np(t=void 0){return t!=null&&at(t,"options"),(t==null?void 0:t.signal)!=null&&ot(t.signal,"options.signal"),function(){return ee(this,null,function*(){let r=0;try{for(var n=Z(this),s,o,a;s=!(o=yield new G(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 xe({cause:t.signal.reason});yield[r++,l]}}catch(o){a=[o]}finally{try{s&&(o=n.return)&&(yield new G(o.call(n)))}finally{if(a)throw a[0]}}})}.call(this)}async function wl(t,e=void 0){try{for(var r=Z(Tn.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 sp(t,e=void 0){if(typeof t!="function")throw new sr("fn",["Function","AsyncFunction"],t);return!await wl.call(this,async(...r)=>!await t(...r),e)}async function op(t,e){try{for(var r=Z(Tn.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 ap(t,e){if(typeof t!="function")throw new sr("fn",["Function","AsyncFunction"],t);async function r(a,l){return await t(a,l),Kr}try{for(var i=Z(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 Tn(t,e){if(typeof t!="function")throw new sr("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n)?i:Kr}return Yr.call(this,r,e)}var Rn=class extends U_{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function lp(t,e,r){var i;if(typeof t!="function")throw new sr("reducer",["Function","AsyncFunction"],t);r!=null&&at(r,"options"),(r==null?void 0:r.signal)!=null&&ot(r.signal,"options.signal");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let d=new xe(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await z_(this.destroy(d)),d}let s=new k_,o=s.signal;if(r!=null&&r.signal){let d={once:!0,[G_]:this,[Q_]:!0};r.signal.addEventListener("abort",()=>s.abort(),d)}let a=!1;try{try{for(var u=Z(this),c,f,h;c=!(f=await u.next()).done;c=!1){let d=f.value;var l;if(a=!0,r!=null&&(l=r.signal)!==null&&l!==void 0&&l.aborted)throw new xe;n?e=await t(e,d,{signal:o}):(e=d,n=!0)}}catch(f){h=[f]}finally{try{c&&(f=u.return)&&await f.call(u)}finally{if(h)throw h[0]}}if(!a&&!n)throw new Rn}finally{s.abort()}return e}async function up(t){t!=null&&at(t,"options"),(t==null?void 0:t.signal)!=null&&ot(t.signal,"options.signal");let e=[];try{for(var i=Z(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 xe(void 0,{cause:t.signal.reason});X_(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 fp(t,e){let r=Yr.call(this,t,e);return function(){return ee(this,null,function*(){try{for(var n=Z(r),s,o,a;s=!(o=yield new G(n.next())).done;s=!1){let l=o.value;yield*ne(l)}}catch(o){a=[o]}finally{try{s&&(o=n.return)&&(yield new G(o.call(n)))}finally{if(a)throw a[0]}}})}.call(this)}function xl(t){if(t=ep(t),tp(t))return 0;if(t<0)throw new W_("number",">= 0",t);return t}function cp(t,e=void 0){return e!=null&&at(e,"options"),(e==null?void 0:e.signal)!=null&&ot(e.signal,"options.signal"),t=xl(t),function(){return ee(this,null,function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new xe;try{for(var s=Z(this),o,a,l;o=!(a=yield new G(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 xe;t--<=0&&(yield u)}}catch(a){l=[a]}finally{try{o&&(a=s.return)&&(yield new G(a.call(s)))}finally{if(l)throw l[0]}}})}.call(this)}function dp(t,e=void 0){return e!=null&&at(e,"options"),(e==null?void 0:e.signal)!=null&&ot(e.signal,"options.signal"),t=xl(t),function(){return ee(this,null,function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new xe;try{for(var s=Z(this),o,a,l;o=!(a=yield new G(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 xe;if(t-- >0&&(yield u),t<=0)return}}catch(a){l=[a]}finally{try{o&&(a=s.return)&&(yield new G(a.call(s)))}finally{if(l)throw l[0]}}})}.call(this)}An.exports.streamReturningOperators={asIndexedPairs:Z_(np,"readable.asIndexedPairs will be removed in a future version."),drop:cp,filter:Tn,flatMap:fp,map:Yr,take:dp,compose:ip};An.exports.promiseReturningOperators={every:sp,forEach:ap,reduce:lp,toArray:up,some:wl,find:op}});var vn=A((kb,Sl)=>{"use strict";var{ArrayPrototypePop:hp,Promise:_p}=j(),{isIterable:pp,isNodeStream:bp,isWebStream:yp}=ye(),{pipelineImpl:gp}=zr(),{finished:mp}=Pe();Nn();function wp(...t){return new _p((e,r)=>{let i,n,s=t[t.length-1];if(s&&typeof s=="object"&&!bp(s)&&!pp(s)&&!yp(s)){let o=hp(t);i=o.signal,n=o.end}gp(t,(o,a)=>{o?r(o):e(a)},{signal:i,end:n})})}Sl.exports={finished:mp,pipeline:wp}});var Nn=A((qb,Ll)=>{"use strict";var{Buffer:xp}=fe(),{ObjectDefineProperty:Be,ObjectKeys:Tl,ReflectApply:Al}=j(),{promisify:{custom:vl}}=Y(),{streamReturningOperators:Il,promiseReturningOperators:Rl}=El(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Nl}}=V(),Ep=In(),{setDefaultHighWaterMark:Sp,getDefaultHighWaterMark:Ip}=Yt(),{pipeline:Pl}=zr(),{destroyer:Rp}=et(),jl=Pe(),Pn=vn(),or=ye(),P=Ll.exports=Nr().Stream;P.isDestroyed=or.isDestroyed;P.isDisturbed=or.isDisturbed;P.isErrored=or.isErrored;P.isReadable=or.isReadable;P.isWritable=or.isWritable;P.Readable=Jt();for(let t of Tl(Il)){let r=function(...i){if(new.target)throw Nl();return P.Readable.from(Al(e,this,i))},e=Il[t];Be(r,"name",{__proto__:null,value:e.name}),Be(r,"length",{__proto__:null,value:e.length}),Be(P.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of Tl(Rl)){let r=function(...i){if(new.target)throw Nl();return Al(e,this,i)},e=Rl[t];Be(r,"name",{__proto__:null,value:e.name}),Be(r,"length",{__proto__:null,value:e.length}),Be(P.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}P.Writable=Ur();P.Duplex=we();P.Transform=cn();P.PassThrough=hn();P.pipeline=Pl;var{addAbortSignal:Tp}=Kt();P.addAbortSignal=Tp;P.finished=jl;P.destroy=Rp;P.compose=Ep;P.setDefaultHighWaterMark=Sp;P.getDefaultHighWaterMark=Ip;Be(P,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Pn}});Be(Pl,vl,{__proto__:null,enumerable:!0,get(){return Pn.pipeline}});Be(jl,vl,{__proto__:null,enumerable:!0,get(){return Pn.finished}});P.Stream=P;P._isUint8Array=function(e){return e instanceof Uint8Array};P._uint8ArrayToBuffer=function(e){return xp.from(e.buffer,e.byteOffset,e.byteLength)}});var Zr=A((Ub,C)=>{"use strict";var q=Nn(),Ap=vn(),vp=q.Readable.destroy;C.exports=q.Readable;C.exports._uint8ArrayToBuffer=q._uint8ArrayToBuffer;C.exports._isUint8Array=q._isUint8Array;C.exports.isDisturbed=q.isDisturbed;C.exports.isErrored=q.isErrored;C.exports.isReadable=q.isReadable;C.exports.Readable=q.Readable;C.exports.Writable=q.Writable;C.exports.Duplex=q.Duplex;C.exports.Transform=q.Transform;C.exports.PassThrough=q.PassThrough;C.exports.addAbortSignal=q.addAbortSignal;C.exports.finished=q.finished;C.exports.destroy=q.destroy;C.exports.destroy=vp;C.exports.pipeline=q.pipeline;C.exports.compose=q.compose;Object.defineProperty(q,"promises",{configurable:!0,enumerable:!0,get(){return Ap}});C.exports.Stream=q.Stream;C.exports.default=C.exports});var Fp={};$n(Fp,{BaseIRI:()=>Me,BlankNode:()=>_t,DataFactory:()=>K,DefaultGraph:()=>bt,EntityIndex:()=>Dt,Lexer:()=>Oe,Literal:()=>ce,NamedNode:()=>Ve,Parser:()=>de,Quad:()=>Ae,Reasoner:()=>Mt,Store:()=>Se,StoreFactory:()=>Ot,StreamParser:()=>$t,StreamWriter:()=>kt,Term:()=>z,Triple:()=>Ae,Util:()=>br,Variable:()=>pt,Writer:()=>se,default:()=>Bp,getRulesFromDataset:()=>Cn,termFromId:()=>Te,termToId:()=>O});var ls=ar(fe());var ze="http://www.w3.org/1999/02/22-rdf-syntax-ns#",ht="http://www.w3.org/2001/XMLSchema#",cr="http://www.w3.org/2000/10/swap/",N={xsd:{decimal:`${ht}decimal`,boolean:`${ht}boolean`,dateTime:`${ht}dateTime`,double:`${ht}double`,integer:`${ht}integer`,string:`${ht}string`},rdf:{type:`${ze}type`,nil:`${ze}nil`,first:`${ze}first`,rest:`${ze}rest`,langString:`${ze}langString`,dirLangString:`${ze}dirLangString`,reifies:`${ze}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}=N,Wt=32,Gt=9,fi=10,Qt=13,us=35,as={"\\":"\\","'":"'",'"':'"',n:`
|
|
3
|
-
`,r:"\r",t:" ",f:"\f",b:"\b"},vu={_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","'":"'","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Nu=/[\x00-\x20<>\\"\{\}\|\^\`]/,Pu=/[\s<>"{}|^`]/g;function ju(t){return t<=1114111&&(t<55296||t>57343)}var Lu={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_commentLine:!0,_whitespace:!0},Bu=/$0^/,Fu=/\S*/y;function $(t,e,r){return t.lastIndex=r,t.exec(e)}function hr(t,e,r){return t.lastIndex=r,t.test(e)}function _r(t,e,r){return t.lastIndex=0,t.exec(`${e.slice(r)} `)}function Cu(t){return t===Wt||t===Gt||t===fi||t===Qt||t===us}var Oe=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 Lu)&&this[r]instanceof RegExp&&(this[r]=Bu)}else this._n3Mode=e.n3!==!1;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===Wt||R===Gt){let U=i.charCodeAt(n+1);T=U===Wt||U===Gt?$(this._whitespace,i,n)[0].length:1,R=i.charCodeAt(n+T)}if(R===us){let U=$(this._commentLine,i,n);if(U){let D=U[0].length;if(!r&&n+D===i.length&&i.charCodeAt(i.length-1)===Qt)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===fi||R===Qt){if(!r&&R===Qt&&n+T+1===i.length)return this._suspend(i,n,s);T+=R===Qt&&i.charCodeAt(n+T+1)===fi?2:1;let U=0,D=i.charCodeAt(n+T);if(D===Wt||D===Gt){let J=i.charCodeAt(n+T+1);U=J===Wt||J===Gt?$(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,c=i[n],f="",h="",d="",_=null,p=0,y=0,m=0,S=!1;switch(c){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(Cu(i.charCodeAt(n)))continue;S=!0;break}}else{this._n3Mode&&(p=1,f="^");break}case"<":if(_=$(this._unescapedIri,i,n))f="IRI",h=_[1],y=_[1].length+2;else if(_=$(this._iri,i,n)){if(h=this._unescape(_[1],as),h===null||Nu.test(h))return l(this,i,n);f="IRI",y=_[1].length+2}else i.length-n>2&&i[n+1]==="<"&&i[n+2]==="("?(f="<<(",p=3):!this._lineMode&&i.length-n>(r?1:2)&&i[n+1]==="<"?(f="<<",p=2):this._n3Mode&&i.length-n>1&&i[n+1]==="="?(p=2,this._isImpliedBy?(f="abbreviation",h="<"):(f="inverse",h=">")):this._n3Mode&&i.length-n>1&&i[n+1]==="-"&&(f="inversePredicate",p=2);break;case">":i.length-n>1&&i[n+1]===">"&&(f=">>",p=2);break;case"_":((_=$(this._blank,i,n))||r&&(_=_r(this._blank,i,n)))&&(f="blank",d="_",h=_[1],y=_[1].length+2);break;case'"':if(_=$(this._simpleQuotedString,i,n))h=_[1];else if({value:h,matchLength:p,finalLineLength:m}=this._parseLiteral(i,n),h===null)return l(this,i,n);(_!==null||p!==0)&&(f="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(_=$(this._simpleApostropheString,i,n))h=_[1];else if({value:h,matchLength:p,finalLineLength:m}=this._parseLiteral(i,n),h===null)return l(this,i,n);(_!==null||p!==0)&&(f="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(_=$(this._variable,i,n))&&(f="var",h=_[0]);break;case"@":if(this._previousMarker==="literal"&&(_=$(this._langcode,i,n))&&_[1]!=="version"){let R=n+_[0].length;!r&&i[R]==="-"&&i[R+1]!=="-"?_=null:(f="langcode",h=_[1])}else(_=$(this._atKeyword,i,n))&&(f=_[0]);break;case".":if(i.length-n===1?r:i[n+1]<"0"||i[n+1]>"9"){f=".",p=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":if(i[n+1]==="-"){this._previousMarker==="langcode"&&(i.startsWith("--ltr",n)?(f="dircode",h="ltr",p=5):i.startsWith("--rtl",n)&&(f="dircode",h="rtl",p=5));break}(_=$(this._number,i,n)||r&&(_=_r(this._number,i,n)))&&(f="literal",h=_[0],d=typeof _[1]=="string"?dr.double:typeof _[2]=="string"?dr.decimal:dr.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":case"V":case"v":(_=$(this._keyword,i,n))?f=_[0].toUpperCase():S=!0;break;case"f":case"t":hr(this._boolean,i,n)?(f="literal",h=c==="t"?"true":"false",d=dr.boolean,p=h.length):S=!0;break;case"a":hr(this._shortPredicates,i,n)?(f="abbreviation",h="a",p=1):S=!0;break;case"h":case"o":this._n3Mode&&(_=this._matchN3Verb(i,n,r))?f=_[0]:S=!0;break;case"i":this._n3Mode&&hr(this._n3Id,i,n)?(f="id",p=2):this._n3Mode&&(_=this._matchN3Verb(i,n,r))?f=_[0]:S=!0;break;case"=":this._n3Mode&&i.length-n>1&&(f="abbreviation",i[n+1]!==">"?(p=1,h="="):(p=2,h=">"));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]===">"){f=")>>",p=3;break}case",":case";":case"[":case"]":case"(":case"}":case"~":this._lineMode||(p=1,f=c);break;case"{":!this._lineMode&&i.length-n>=2&&(i[n+1]==="|"?(f="{|",p=2):(f=c,p=1));break;case"|":i.length-n>=2&&i[n+1]==="}"&&(f="|}",p=2);break;default:S=!0}if(S&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(_=$(this._prefix,i,n))?(f="prefix",h=_[1]||""):((_=$(this._prefixed,i,n))||r&&(_=_r(this._prefixed,i,n)))&&(f="prefixed",d=_[1]||"",h=this._unescape(_[2],vu),y=d.length+_[2].length+1)),this._previousMarker==="^^")switch(f){case"prefixed":f="type";break;case"IRI":f="typeIRI";break;default:f=""}if(!f)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=p||_[0].length,g=s-(i.length-n),w;m?(w={type:f,value:h,prefix:d,line:u,start:g,end:m,endLine:this._line},e(null,w)):w=a(f,h,d,u,g,y||x),this.previousToken=w,this._previousMarker=f,n=Math.min(n+x,i.length),m&&(s=i.length-n+m)}function o(u,c,f){e(null,{type:"comment",value:u,prefix:"",line:c,start:f,end:f+u.length+1})}function a(u,c,f,h,d,_){let p={type:u,value:c,prefix:f,line:h,start:d,end:d+_};return e(null,p),p}function l(u,c,f){e(u._syntaxError($(Fu,c,f)[0]))}}_suspend(e,r,i){return this._linePosition=i-(e.length-r),this._input=e.slice(r)}_matchN3Verb(e,r,i){let n=$(this._n3Verb,e,r);if(!n)return null;let s=e[r+n[0].length];return s!=="-"&&s!=="_"&&(s<"0"||s>"9")?n:$(this._prefixed,e,r)?null:hr(Pu,e,r)?n:_r(this._prefixed,e,r)||!i&&$(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 c=i+2;c<a;c++){let f=e.charCodeAt(c);if(f>=48&&f<=57)f-=48;else if(f>=65&&f<=70)f-=55;else if(f>=97&&f<=102)f-=87;else return null;u=u*16+f}if(!ju(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/),c=u.length-1,f=o-r+n;if(n===1&&c!==0||n===3&&this._lineMode)break;this._line+=c;let h=c===0?0:u[u.length-1].length+n;return{value:this._unescape(l,as),matchLength:f,finalLineLength:h}}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 this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",n=>{this._tokenization===i&&this._input!==null&&n.length!==0&&(this._pendingBuffer&&(n=ls.Buffer.concat([this._pendingBuffer,n]),this._pendingBuffer=null),n[n.length-1]&128?this._pendingBuffer=n:(typeof this._input=="undefined"?this._input=this._readStartingBom(typeof n=="string"?n:n.toString()):this._input+=n,this._tokenizeToEnd(r,!1)))}),e.on("end",()=>{this._tokenization===i&&typeof this._input=="string"&&this._tokenizeToEnd(r,!0)}),e.on("error",n=>{this._tokenization===i&&r(n)})}};var{rdf:fs,xsd:Re}=N,yt,Du=0,hi="<>";var ci={namedNode:cs,blankNode:ds,variable:_s,literal:hs,defaultGraph:Ou,quad:di,triple:di,fromTerm:zt,fromQuad:ps},K=ci,z=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}}},Ve=class extends z{constructor(e){e!==""?super(e):(super(hi),Object.defineProperty(this,"value",{value:""}))}get termType(){return"NamedNode"}},ce=class t extends z{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 Ve(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!=="@"?Re.string:e.indexOf("--",r)>0?fs.dirLangString:fs.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 z{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},pt=class extends z{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},bt=class extends z{constructor(){return super(""),yt||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};yt=new bt;function Te(t,e,r){if(e=e||ci,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===ci)return new ce(t);if(t[t.length-1]==='"')return e.literal(t.substr(1,t.length-2));let i=t.lastIndexOf('"',t.length-1),n;if(t[i+1]==="@"){n=t.substr(i+2);let s=n.lastIndexOf("--");s>0&&s<n.length&&(n={language:n.substr(0,s),direction:n.substr(s+2)})}else n=e.namedNode(t.substr(i+3));return e.literal(t.substr(1,i-1),n);case"[":t=JSON.parse(t);break;case"<":if(t===hi)return e.namedNode("");default:if(!r||!Array.isArray(t))return e.namedNode(t)}return e.quad(Te(t[0],e,!0),Te(t[1],e,!0),Te(t[2],e,!0),t[3]&&Te(t[3],e,!0))}function O(t,e){if(typeof t=="string")return t;if(t instanceof z&&t.termType!=="Quad")return t.id;if(!t)return yt.id;switch(t.termType){case"NamedNode":{let i=t.value;return i!==""?i:hi}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!==Re.string?`^^${t.datatype.value}`:""}`;case"Quad":let r=[O(t.subject,!0),O(t.predicate,!0),O(t.object,!0)];return t.graph&&t.graph.termType!=="DefaultGraph"&&r.push(O(t.graph,!0)),e?r:JSON.stringify(r);default:throw new Error(`Unexpected termType: ${t.termType}`)}}var Ae=class extends z{constructor(e,r,i,n){super(""),this._subject=e,this._predicate=r,this._object=i,this._graph=n||yt}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 cs(t){return new Ve(t)}function ds(t){return new _t(t||`n3-${Du++}`)}function hs(t,e){if(typeof e=="string")return new ce(`"${t}"@${e.toLowerCase()}`);if(e!==void 0&&!("termType"in e))return new ce(`"${t}"@${e.language.toLowerCase()}${e.direction?`--${e.direction.toLowerCase()}`:""}`);let r=e?e.value:"";return r===""&&(typeof t=="boolean"?r=Re.boolean:typeof t=="number"?Number.isFinite(t)?r=Number.isInteger(t)&&Math.abs(t)<1e21?Re.integer:Re.double:(r=Re.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")):typeof t=="bigint"?r=Re.integer:t instanceof Date&&!Number.isNaN(t.getTime())&&(r=Re.dateTime,t=t.toISOString())),r===""||r===Re.string?new ce(`"${t}"`):new ce(`"${t}"^^${r}`)}function _s(t){return new pt(t)}function Ou(){return yt}function di(t,e,r,i){return new Ae(t,e,r,i)}function zt(t){if(t instanceof z)return t;switch(t.termType){case"NamedNode":return cs(t.value);case"BlankNode":return ds(t.value);case"Variable":return _s(t.value);case"DefaultGraph":return yt;case"Literal":return hs(t.value,t.language?t.direction?{language:t.language,direction:t.direction}:t.language:t.datatype);case"Quad":return ps(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function ps(t){if(t instanceof Ae)return t;if(t.termType!=="Quad")throw new Error(`Unexpected termType: ${t.termType}`);return di(zt(t.subject),zt(t.predicate),zt(t.object),zt(t.graph))}var bs=0,de=class t{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&gs(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;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,this._emptyFormulaAsTrue=!!e.emptyFormulaAsTrue,l&&(this._resolveRelativeIRI=c=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new Oe({lineMode:l,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers,this._formulaScopedBlankNodes=!!e.formulaScopedBlankNodes,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(){bs=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),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}}_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&&(ys(this._prefixes,this._prefixChanges),this._prefixChanges=i.prefixChanges),this._prefixes._=i.blankPrefix,this._quantifiedChanges!==i.quantifiedChanges&&(ys(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._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=pr}_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._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;let r=e.length,i="",n=-1,s=-1,o=0,a="/";for(;n<r;){switch(a){case":":if(s<0&&e[++n]==="/"&&e[++n]==="/")for(;(s=n+1)<r&&e[s]!=="/";)n=s;break;case"?":case"#":n=r;break;case"/":if(e[n+1]===".")switch(a=e[++n+1],a){case"/":i+=e.substring(o,n-1),o=n+1;break;case void 0:case"?":case"#":return i+e.substring(o,n)+e.substr(n+1);case".":if(a=e[++n+1],a===void 0||a==="/"||a==="?"||a==="#"){if(i+=e.substring(o,n-2),(o=i.lastIndexOf("/"))>=s&&(i=i.substr(0,o)),a!=="/")return`${i}/${e.substr(n+1)}`;o=n+1}}}a=e[++n]}return i+e.substring(o)}parse(e,r,i,n){let s,o,a,l,u,c;r&&(r.onQuad||r.onPrefix||r.onComment||r.onVersion||r.onToken||r.onTokenEnd)?(s=r.onQuad,o=r.onPrefix,a=r.onComment,l=r.onVersion,u=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${bs++}_`,this._n3Mode&&this._implicitEmptyPrefix&&this._base&&(this._prefixes[""]=this._resolveIRI("#")),this._prefixCallback=o||pr,this._versionCallback=l||pr,this._inversePredicate=!1,this._expectOf=!1,this._quantified=Object.create(null),this._prefixChanges=null,this._quantifiedChanges=null,this._emptyFormula=!1,this._tripleTermDepth=0;let f=d=>this._readCallback=this._readCallback(d);if(a||this._lexer.comments){this._lexer.comments=!0;let d=f;f=_=>_.type!=="comment"?d(_):(a&&a(_.value),this._readCallback)}if(u||c){let d=f;f=_=>{try{try{return u&&u(_),d(_)}finally{c&&c(_)}}catch(p){throw this._readCallback=null,p}}}if(!s){let d=[],_;if(this._callback=(p,y)=>{p?_=p:y&&d.push(y)},this._lexer.tokenize(e).every(f),_)throw _;return d}let h=(d,_)=>{d!==null?(this._callback(d),this._callback=pr):this._readCallback&&f(_)};this._callback=s,this._lexer.tokenize(e,h)}};function ys(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 pr(){}function gs(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")}de.SUPPORTED_VERSIONS=["1.2","1.2-basic","1.1"];gs(de.prototype,K);var br={};$n(br,{inDefaultGraph:()=>Wu,isBlankNode:()=>$u,isDefaultGraph:()=>he,isLiteral:()=>ku,isNamedNode:()=>Mu,isQuad:()=>Uu,isVariable:()=>qu,prefix:()=>Gu,prefixes:()=>ms});function Mu(t){return!!t&&t.termType==="NamedNode"}function $u(t){return!!t&&t.termType==="BlankNode"}function ku(t){return!!t&&t.termType==="Literal"}function qu(t){return!!t&&t.termType==="Variable"}function Uu(t){return!!t&&t.termType==="Quad"}function he(t){return!!t&&t.termType==="DefaultGraph"}function Wu(t){return he(t.graph)}function Gu(t,e){return ms({"":t.value||t},e)("")}function ms(t,e){let r=Object.create(null);for(let n in t)i(n,t[n]);e=e||K;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 He(t){return t.replace(/[.*+?^${}()|[\]\\/-]/g,"\\$&")}var Qu=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,zu=/^(?:(?!\.\.?(?:[/?#]|$))[^/?#]+(?:\/[^/?#]{3,})*\/?)?(?:[?#]|$)/,ws="./",Vu="../",_i="?",xs="#",Me=class t{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!Qu.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!t.supports(this.base))return this._baseMatcher=/.^/;let e=/^[^:]*:\/*/.exec(this.base)[0],r=["^",He(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]===xs?l=s.lastIndex-1:(r.push(He(o[0]),"(?:"),i.push(")?"),o[1]!==_i?n.push(u=s.lastIndex):(a=u=s.lastIndex,l=this.base.indexOf(xs,a),this._pathReplacements[a]=_i));for(let c=0;c<n.length;c++)this._pathReplacements[n[c]]=Vu.repeat(n.length-c-1);return this._pathReplacements[n[n.length-1]]=ws,this._baseLength=l>0?l:this.base.length,r.push(He(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!==_i&&!zu.test(s)?e:n===ws&&/^[^?#]/.test(s)&&(s.indexOf(":")<0||!/^[^/?#]*:/.test(s))?s:n+s}return e.substring(i-1)}};var Vt=K.defaultGraph(),{rdf:Hu,xsd:gt}=N,Ku=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,Yu=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Zu=/[^ !#-\[\]-~\u0080-\uFFFD]/,Xu=/[^ !#-\[\]-~\u0080-\uFFFD]/g,Es={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"},Ke=class extends z{equals(e){return e===this}},se=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=Zu,this._escapeAll=Xu,this._characterReplacer=ef):(this._lineMode=!1,this._escape=Ku,this._escapeAll=Yu,this._characterReplacer=Ju,this._graph=Vt,this._prefixIRIs=Object.create(null),this._prefixPatterns=Object.create(null),r.baseIRI&&(this._baseIri=new Me(r.baseIRI),r.writeBase&&this._write(`@base <${r.baseIRI}>.
|
|
4
|
-
`)),r.prefixes&&this.addPrefixes(r.prefixes))}get _inDefaultGraph(){return
|
|
1
|
+
var N3=(()=>{var Gl=Object.create;var qt=Object.defineProperty,Ql=Object.defineProperties,zl=Object.getOwnPropertyDescriptor,Vl=Object.getOwnPropertyDescriptors,Hl=Object.getOwnPropertyNames,Mn=Object.getOwnPropertySymbols,Kl=Object.getPrototypeOf,kn=Object.prototype.hasOwnProperty,Yl=Object.prototype.propertyIsEnumerable;var ut=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Zl=t=>{throw TypeError(t)};var $n=(t,e,r)=>e in t?qt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,O=(t,e)=>{for(var r in e||(e={}))kn.call(e,r)&&$n(t,r,e[r]);if(Mn)for(var r of Mn(e))Yl.call(e,r)&&$n(t,r,e[r]);return t},De=(t,e)=>Ql(t,Vl(e));var A=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Un=(t,e)=>{for(var r in e)qt(t,r,{get:e[r],enumerable:!0})},qn=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Hl(e))!kn.call(t,n)&&n!==r&&qt(t,n,{get:()=>e[n],enumerable:!(i=zl(e,n))||i.enumerable});return t};var lr=(t,e,r)=>(r=t!=null?Gl(Kl(t)):{},qn(e||!t||!t.__esModule?qt(r,"default",{value:t,enumerable:!0}):r,t)),Jl=t=>qn(qt({},"__esModule",{value:!0}),t);var W=function(t,e){this[0]=t,this[1]=e},ee=(t,e,r)=>{var i=(a,l,u,c)=>{try{var f=r[a](l),h=(l=f.value)instanceof W,d=f.done;Promise.resolve(h?l[0]:l).then(_=>h?i(a==="return"?a:"next",l[1]?{done:_.done,value:_.value}:_,u,c):u({value:_,done:d})).catch(_=>i("throw",_,u,c))}catch(_){c(_)}},n=(a,l,u,c)=>o[a]=f=>(l=new Promise((h,d,_)=>(_=()=>i(a,f,h,d),s?s.then(_):_())),c=()=>s===u&&(s=0),s=u=l.then(c,c),l),s,o={};return r=r.apply(t,e),o[ut("asyncIterator")]=()=>o,n("next"),n("throw"),n("return"),o},ne=t=>{var e=t[ut("asyncIterator")],r=!1,i,n={};return e==null?(e=t[ut("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||Zl("Object expected"),a(l)}),1)}}),n[ut("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[ut("asyncIterator")])?e.call(t):(t=t[ut("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 Qn=A(ur=>{"use strict";ur.byteLength=eu;ur.toByteArray=ru;ur.fromByteArray=su;var ue=[],te=[],Xl=typeof Uint8Array!="undefined"?Uint8Array:Array,ri="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Qe=0,Wn=ri.length;Qe<Wn;++Qe)ue[Qe]=ri[Qe],te[ri.charCodeAt(Qe)]=Qe;var Qe,Wn;te[45]=62;te[95]=63;function Gn(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function eu(t){var e=Gn(t),r=e[0],i=e[1];return(r+i)*3/4-i}function tu(t,e,r){return(e+r)*3/4-r}function ru(t){var e,r=Gn(t),i=r[0],n=r[1],s=new Xl(tu(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 iu(t){return ue[t>>18&63]+ue[t>>12&63]+ue[t>>6&63]+ue[t&63]}function nu(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(iu(i));return n.join("")}function su(t){for(var e,r=t.length,i=r%3,n=[],s=16383,o=0,a=r-i;o<a;o+=s)n.push(nu(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 zn=A(ii=>{ii.read=function(t,e,r,i,n){var s,o,a=n*8-i-1,l=(1<<a)-1,u=l>>1,c=-7,f=r?n-1:0,h=r?-1:1,d=t[e+f];for(f+=h,s=d&(1<<-c)-1,d>>=-c,c+=a;c>0;s=s*256+t[e+f],f+=h,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=i;c>0;o=o*256+t[e+f],f+=h,c-=8);if(s===0)s=1-u;else{if(s===l)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-u}return(d?-1:1)*o*Math.pow(2,s-i)};ii.write=function(t,e,r,i,n,s){var o,a,l,u=s*8-n-1,c=(1<<u)-1,f=c>>1,h=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:s-1,_=i?1:-1,p=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+f>=1?e+=h/l:e+=h*Math.pow(2,1-f),e*l>=2&&(o++,l/=2),o+f>=c?(a=0,o=c):o+f>=1?(a=(e*l-1)*Math.pow(2,n),o=o+f):(a=e*Math.pow(2,f-1)*Math.pow(2,n),o=0));n>=8;t[r+d]=a&255,d+=_,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;t[r+d]=o&255,d+=_,o/=256,u-=8);t[r+d-_]|=p*128}});var ce=A(ht=>{"use strict";var ni=Qn(),ct=zn(),Vn=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ht.Buffer=b;ht.SlowBuffer=cu;ht.INSPECT_MAX_BYTES=50;var fr=2147483647;ht.kMaxLength=fr;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 Ie(t){if(t>fr)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 li(t)}return Zn(t,e,r)}b.poolSize=8192;function Zn(t,e,r){if(typeof t=="string")return lu(t,e);if(ArrayBuffer.isView(t))return uu(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 oi(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=fu(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 Zn(t,e,r)};Object.setPrototypeOf(b.prototype,Uint8Array.prototype);Object.setPrototypeOf(b,Uint8Array);function Jn(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 au(t,e,r){return Jn(t),t<=0?Ie(t):e!==void 0?typeof r=="string"?Ie(t).fill(e,r):Ie(t).fill(e):Ie(t)}b.alloc=function(t,e,r){return au(t,e,r)};function li(t){return Jn(t),Ie(t<0?0:ui(t)|0)}b.allocUnsafe=function(t){return li(t)};b.allocUnsafeSlow=function(t){return li(t)};function lu(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!b.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Xn(t,e)|0,i=Ie(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function si(t){let e=t.length<0?0:ui(t.length)|0,r=Ie(e);for(let i=0;i<e;i+=1)r[i]=t[i]&255;return r}function uu(t){if(fe(t,Uint8Array)){let e=new Uint8Array(t);return oi(e.buffer,e.byteOffset,e.byteLength)}return si(t)}function oi(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 fu(t){if(b.isBuffer(t)){let e=ui(t.length)|0,r=Ie(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||ci(t.length)?Ie(0):si(t);if(t.type==="Buffer"&&Array.isArray(t.data))return si(t.data)}function ui(t){if(t>=fr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+fr.toString(16)+" bytes");return t|0}function cu(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 Xn(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 ai(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return ls(t).length;default:if(n)return i?-1:ai(t).length;e=(""+e).toLowerCase(),n=!0}}b.byteLength=Xn;function du(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 Eu(this,e,r);case"utf8":case"utf-8":return ts(this,e,r);case"ascii":return wu(this,e,r);case"latin1":case"binary":return xu(this,e,r);case"base64":return gu(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Su(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}b.prototype._isBuffer=!0;function ze(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)ze(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)ze(this,r,r+3),ze(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)ze(this,r,r+7),ze(this,r+1,r+6),ze(this,r+2,r+5),ze(this,r+3,r+4);return this};b.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?ts(this,0,e):du.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=ht.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Vn&&(b.prototype[Vn]=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),c=e.slice(r,i);for(let f=0;f<l;++f)if(u[f]!==c[f]){o=u[f],a=c[f];break}return o<a?-1:a<o?1:0};function es(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,ci(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:Hn(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):Hn(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function Hn(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(c,f){return s===1?c[f]:c.readUInt16BE(f*s)}let u;if(n){let c=-1;for(u=r;u<o;u++)if(l(t,u)===l(e,c===-1?0:u-c)){if(c===-1&&(c=u),u-c+1===a)return c*s}else c!==-1&&(u-=u-c),c=-1}else for(r+a>o&&(r=o-a),u=r;u>=0;u--){let c=!0;for(let f=0;f<a;f++)if(l(t,u+f)!==l(e,f)){c=!1;break}if(c)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 es(this,e,r,i,!0)};b.prototype.lastIndexOf=function(e,r,i){return es(this,e,r,i,!1)};function hu(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(ci(a))return o;t[r+o]=a}return o}function _u(t,e,r,i){return cr(ai(e,t.length-r),t,r,i)}function pu(t,e,r,i){return cr(Au(e),t,r,i)}function bu(t,e,r,i){return cr(ls(e),t,r,i)}function yu(t,e,r,i){return cr(Nu(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 hu(this,e,r,i);case"utf8":case"utf-8":return _u(this,e,r,i);case"ascii":case"latin1":case"binary":return pu(this,e,r,i);case"base64":return bu(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yu(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 gu(t,e,r){return e===0&&r===t.length?ni.fromByteArray(t):ni.fromByteArray(t.slice(e,r))}function ts(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,c,f;switch(a){case 1:s<128&&(o=s);break;case 2:l=t[n+1],(l&192)===128&&(f=(s&31)<<6|l&63,f>127&&(o=f));break;case 3:l=t[n+1],u=t[n+2],(l&192)===128&&(u&192)===128&&(f=(s&15)<<12|(l&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:l=t[n+1],u=t[n+2],c=t[n+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(f=(s&15)<<18|(l&63)<<12|(u&63)<<6|c&63,f>65535&&f<1114112&&(o=f))}}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 mu(i)}var Kn=4096;function mu(t){let e=t.length;if(e<=Kn)return String.fromCharCode.apply(String,t);let r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=Kn));return r}function wu(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 xu(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 Eu(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+=vu[t[s]];return n}function Su(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,dt(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Wt(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,dt(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Wt(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,dt(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Wt(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,dt(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Wt(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),ct.read(this,e,!0,23,4)};b.prototype.readFloatBE=function(e,r){return e=e>>>0,r||q(e,4,this.length),ct.read(this,e,!1,23,4)};b.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||q(e,8,this.length),ct.read(this,e,!0,52,8)};b.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||q(e,8,this.length),ct.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 rs(t,e,r,i,n){as(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 is(t,e,r,i,n){as(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 rs(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});b.prototype.writeBigUInt64BE=Oe(function(e,r=0){return is(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 rs(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});b.prototype.writeBigInt64BE=Oe(function(e,r=0){return is(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ns(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 ss(t,e,r,i,n){return e=+e,r=r>>>0,n||ns(t,e,r,4,34028234663852886e22,-34028234663852886e22),ct.write(t,e,r,i,23,4),r+4}b.prototype.writeFloatLE=function(e,r,i){return ss(this,e,r,!0,i)};b.prototype.writeFloatBE=function(e,r,i){return ss(this,e,r,!1,i)};function os(t,e,r,i,n){return e=+e,r=r>>>0,n||ns(t,e,r,8,17976931348623157e292,-17976931348623157e292),ct.write(t,e,r,i,52,8),r+8}b.prototype.writeDoubleLE=function(e,r,i){return os(this,e,r,!0,i)};b.prototype.writeDoubleBE=function(e,r,i){return os(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 ft={};function fi(t,e,r){ft[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}`}}}fi("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);fi("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);fi("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=Yn(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=Yn(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function Yn(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 Iu(t,e,r){dt(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Wt(e,t.length-(r+1))}function as(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 ft.ERR_OUT_OF_RANGE("value",a,t)}Iu(i,n,s)}function dt(t,e){if(typeof t!="number")throw new ft.ERR_INVALID_ARG_TYPE(e,"number",t)}function Wt(t,e,r){throw Math.floor(t)!==t?(dt(t,r),new ft.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new ft.ERR_BUFFER_OUT_OF_BOUNDS:new ft.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Ru=/[^+/0-9A-Za-z-_]/g;function Tu(t){if(t=t.split("=")[0],t=t.trim().replace(Ru,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function ai(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 Au(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Nu(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 ls(t){return ni.toByteArray(Tu(t))}function cr(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 ci(t){return t!==t}var vu=(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"?Pu:t}function Pu(){throw new Error("BigInt not supported")}});var j=A((ub,Rs)=>{"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}};Rs.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((fb,Ts)=>{"use strict";Ts.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 z=A((cb,vs)=>{"use strict";var{format:sf,inspect:gr}=gi(),{AggregateError:of}=j(),af=globalThis.AggregateError||of,lf=Symbol("kIsNodeError"),uf=["string","function","number","object","Function","Object","boolean","bigint","symbol"],ff=/^([A-Z][a-z0-9]*)+$/,cf="__node_internal_",mr={};function Ze(t,e){if(!t)throw new mr.ERR_INTERNAL_ASSERTION(e)}function As(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 df(t,e,r){if(typeof e=="function")return Ze(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 Ze(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:sf(e,...r)}function G(t,e,r){r||(r=Error);class i extends r{constructor(...s){super(df(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[lf]=!0,mr[t]=i}function Ns(t){let e=cf+t.name;return Object.defineProperty(t,"name",{value:e}),t}function hf(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new af([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 mr.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)=>{Ze(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)Ze(typeof l=="string","All expected entries have to be of type string"),uf.includes(l)?n.push(l.toLowerCase()):ff.test(l)?s.push(l):(Ze(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=gr(r,{depth:-1});i+=`. Received ${l}`}}else{let l=gr(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=gr(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)=>{Ze(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)=>{Ze(e,'Missing "range" argument');let i;if(Number.isInteger(r)&&Math.abs(r)>2**32)i=As(String(r));else if(typeof r=="bigint"){i=String(r);let n=BigInt(2)**BigInt(32);(r>n||r<-n)&&(i=As(i)),i+="n"}else i=gr(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);vs.exports={AbortError:mi,aggregateTwoErrors:Ns(hf),hideStackFrames:Ns,codes:mr}});var wt=A((db,wr)=>{"use strict";var{AbortController:Ps,AbortSignal:_f}=typeof self!="undefined"?self:typeof window!="undefined"?window:void 0;wr.exports=Ps;wr.exports.AbortSignal=_f;wr.exports.default=Ps});var Kt=A((hb,wi)=>{"use strict";var xt=typeof Reflect=="object"?Reflect:null,js=xt&&typeof xt.apply=="function"?xt.apply:function(e,r,i){return Function.prototype.apply.call(e,r,i)},xr;xt&&typeof xt.ownKeys=="function"?xr=xt.ownKeys:Object.getOwnPropertySymbols?xr=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:xr=function(e){return Object.getOwnPropertyNames(e)};function pf(t){console&&console.warn&&console.warn(t)}var Bs=Number.isNaN||function(e){return e!==e};function N(){N.init.call(this)}wi.exports=N;wi.exports.once=mf;N.EventEmitter=N;N.prototype._events=void 0;N.prototype._eventsCount=0;N.prototype._maxListeners=void 0;var Ls=10;function Er(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(N,"defaultMaxListeners",{enumerable:!0,get:function(){return Ls},set:function(t){if(typeof t!="number"||t<0||Bs(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ls=t}});N.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};N.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Bs(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 Fs(t){return t._maxListeners===void 0?N.defaultMaxListeners:t._maxListeners}N.prototype.getMaxListeners=function(){return Fs(this)};N.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")js(l,this,r);else for(var u=l.length,c=$s(l,u),i=0;i<u;++i)js(c[i],this,r);return!0};function Cs(t,e,r,i){var n,s,o;if(Er(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=Fs(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,pf(a)}return t}N.prototype.addListener=function(e,r){return Cs(this,e,r,!1)};N.prototype.on=N.prototype.addListener;N.prototype.prependListener=function(e,r){return Cs(this,e,r,!0)};function bf(){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 Ds(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=bf.bind(i);return n.listener=r,i.wrapFn=n,n}N.prototype.once=function(e,r){return Er(r),this.on(e,Ds(this,e,r)),this};N.prototype.prependOnceListener=function(e,r){return Er(r),this.prependListener(e,Ds(this,e,r)),this};N.prototype.removeListener=function(e,r){var i,n,s,o,a;if(Er(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():yf(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};N.prototype.off=N.prototype.removeListener;N.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 Os(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?gf(n):$s(n,n.length)}N.prototype.listeners=function(e){return Os(this,e,!0)};N.prototype.rawListeners=function(e){return Os(this,e,!1)};N.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Ms.call(t,e)};N.prototype.listenerCount=Ms;function Ms(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}N.prototype.eventNames=function(){return this._eventsCount>0?xr(this._events):[]};function $s(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function yf(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function gf(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function mf(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))}ks(t,e,s,{once:!0}),e!=="error"&&wf(t,n,{once:!0})})}function wf(t,e,r){typeof t.on=="function"&&ks(t,"error",e,r)}function ks(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=A((_b,Ei)=>{"use strict";var xf=ce(),{format:Ef,inspect:Sf}=gi(),{codes:{ERR_INVALID_ARG_TYPE:xi}}=z(),{kResistStopPropagation:If,AggregateError:Rf,SymbolDispose:Tf}=j(),Af=globalThis.AbortSignal||wt().AbortSignal,Nf=globalThis.AbortController||wt().AbortController,vf=Object.getPrototypeOf(async function(){}).constructor,Us=globalThis.Blob||xf.Blob,Pf=typeof Us!="undefined"?function(e){return e instanceof Us}:function(e){return!1},qs=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new xi(e,"AbortSignal",t)},jf=(t,e)=>{if(typeof t!="function")throw new xi(e,"Function",t)};Ei.exports={AggregateError:Rf,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:Ef,inspect:Sf,types:{isAsyncFunction(t){return t instanceof vf},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Pf,deprecate(t,e){return t},addAbortListener:Kt().addAbortListener||function(e,r){if(e===void 0)throw new xi("signal","AbortSignal",e);qs(e,"signal"),jf(r,"listener");let i;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[If]:!0}),i=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[Tf](){var n;(n=i)===null||n===void 0||n()}}},AbortSignalAny:Af.any||function(e){if(e.length===1)return e[0];let r=new Nf,i=()=>r.abort();return e.forEach(n=>{qs(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 St=A((pb,Js)=>{"use strict";var{ArrayIsArray:Ii,ArrayPrototypeIncludes:zs,ArrayPrototypeJoin:Vs,ArrayPrototypeMap:Lf,NumberIsInteger:Ri,NumberIsNaN:Bf,NumberMAX_SAFE_INTEGER:Ff,NumberMIN_SAFE_INTEGER:Cf,NumberParseInt:Df,ObjectPrototypeHasOwnProperty:Of,RegExpPrototypeExec:Hs,String:Mf,StringPrototypeToUpperCase:$f,StringPrototypeTrim:kf}=j(),{hideStackFrames:re,codes:{ERR_SOCKET_BAD_PORT:Uf,ERR_INVALID_ARG_TYPE:V,ERR_INVALID_ARG_VALUE:Et,ERR_OUT_OF_RANGE:Je,ERR_UNKNOWN_SIGNAL:Ws}}=z(),{normalizeEncoding:qf}=K(),{isAsyncFunction:Wf,isArrayBufferView:Gf}=K().types,Gs={};function Qf(t){return t===(t|0)}function zf(t){return t===t>>>0}var Vf=/^[0-7]+$/,Hf="must be a 32-bit unsigned integer or an octal string";function Kf(t,e,r){if(typeof t=="undefined"&&(t=r),typeof t=="string"){if(Hs(Vf,t)===null)throw new Et(e,t,Hf);t=Df(t,8)}return Ks(t,e),t}var Yf=re((t,e,r=Cf,i=Ff)=>{if(typeof t!="number")throw new V(e,"number",t);if(!Ri(t))throw new Je(e,"an integer",t);if(t<r||t>i)throw new Je(e,`>= ${r} && <= ${i}`,t)}),Zf=re((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!="number")throw new V(e,"number",t);if(!Ri(t))throw new Je(e,"an integer",t);if(t<r||t>i)throw new Je(e,`>= ${r} && <= ${i}`,t)}),Ks=re((t,e,r=!1)=>{if(typeof t!="number")throw new V(e,"number",t);if(!Ri(t))throw new Je(e,"an integer",t);let i=r?1:0,n=4294967295;if(t<i||t>n)throw new Je(e,`>= ${i} && <= ${n}`,t)});function Ti(t,e){if(typeof t!="string")throw new V(e,"string",t)}function Jf(t,e,r=void 0,i){if(typeof t!="number")throw new V(e,"number",t);if(r!=null&&t<r||i!=null&&t>i||(r!=null||i!=null)&&Bf(t))throw new Je(e,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,t)}var Xf=re((t,e,r)=>{if(!zs(r,t)){let n="must be one of: "+Vs(Lf(r,s=>typeof s=="string"?`'${s}'`:Mf(s)),", ");throw new Et(e,t,n)}});function Ys(t,e){if(typeof t!="boolean")throw new V(e,"boolean",t)}function Si(t,e,r){return t==null||!Of(t,e)?r:t[e]}var ec=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 V(e,"Object",t)}),tc=re((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new V(e,"a dictionary",t)}),Sr=re((t,e,r=0)=>{if(!Ii(t))throw new V(e,"Array",t);if(t.length<r){let i=`must be longer than ${r}`;throw new Et(e,t,i)}});function rc(t,e){Sr(t,e);for(let r=0;r<t.length;r++)Ti(t[r],`${e}[${r}]`)}function ic(t,e){Sr(t,e);for(let r=0;r<t.length;r++)Ys(t[r],`${e}[${r}]`)}function nc(t,e){Sr(t,e);for(let r=0;r<t.length;r++){let i=t[r],n=`${e}[${r}]`;if(i==null)throw new V(n,"AbortSignal",i);Zs(i,n)}}function sc(t,e="signal"){if(Ti(t,e),Gs[t]===void 0)throw Gs[$f(t)]!==void 0?new Ws(t+" (signals must use all capital letters)"):new Ws(t)}var oc=re((t,e="buffer")=>{if(!Gf(t))throw new V(e,["Buffer","TypedArray","DataView"],t)});function ac(t,e){let r=qf(e),i=t.length;if(r==="hex"&&i%2!==0)throw new Et("encoding",e,`is invalid for data of length ${i}`)}function lc(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&kf(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new Uf(e,t,r);return t|0}var Zs=re((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new V(e,"AbortSignal",t)}),uc=re((t,e)=>{if(typeof t!="function")throw new V(e,"Function",t)}),fc=re((t,e)=>{if(typeof t!="function"||Wf(t))throw new V(e,"Function",t)}),cc=re((t,e)=>{if(t!==void 0)throw new V(e,"undefined",t)});function dc(t,e,r){if(!zs(r,t))throw new V(e,`('${Vs(r,"|")}')`,t)}var hc=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Qs(t,e){if(typeof t=="undefined"||!Hs(hc,t))throw new Et(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function _c(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 Et("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Js.exports={isInt32:Qf,isUint32:zf,parseFileMode:Kf,validateArray:Sr,validateStringArray:rc,validateBooleanArray:ic,validateAbortSignalArray:nc,validateBoolean:Ys,validateBuffer:oc,validateDictionary:tc,validateEncoding:ac,validateFunction:uc,validateInt32:Zf,validateInteger:Yf,validateNumber:Jf,validateObject:ec,validateOneOf:Xf,validatePlainFunction:fc,validatePort:lc,validateSignalName:sc,validateString:Ti,validateUint32:Ks,validateUndefined:cc,validateUnion:dc,validateAbortSignal:Zs,validateLinkHeaderValue:_c}});var ke=A((bb,ro)=>{var F=ro.exports={},_e,pe;function Ai(){throw new Error("setTimeout has not been defined")}function Ni(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?_e=setTimeout:_e=Ai}catch(t){_e=Ai}try{typeof clearTimeout=="function"?pe=clearTimeout:pe=Ni}catch(t){pe=Ni}})();function Xs(t){if(_e===setTimeout)return setTimeout(t,0);if((_e===Ai||!_e)&&setTimeout)return _e=setTimeout,setTimeout(t,0);try{return _e(t,0)}catch(e){try{return _e.call(null,t,0)}catch(r){return _e.call(this,t,0)}}}function pc(t){if(pe===clearTimeout)return clearTimeout(t);if((pe===Ni||!pe)&&clearTimeout)return pe=clearTimeout,clearTimeout(t);try{return pe(t)}catch(e){try{return pe.call(null,t)}catch(r){return pe.call(this,t)}}}var ve=[],It=!1,Xe,Ir=-1;function bc(){!It||!Xe||(It=!1,Xe.length?ve=Xe.concat(ve):Ir=-1,ve.length&&eo())}function eo(){if(!It){var t=Xs(bc);It=!0;for(var e=ve.length;e;){for(Xe=ve,ve=[];++Ir<e;)Xe&&Xe[Ir].run();Ir=-1,e=ve.length}Xe=null,It=!1,pc(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];ve.push(new to(t,e)),ve.length===1&&!It&&Xs(eo)};function to(t,e){this.fun=t,this.array=e}to.prototype.run=function(){this.fun.apply(null,this.array)};F.title="browser";F.browser=!0;F.env={};F.argv=[];F.version="";F.versions={};function Pe(){}F.on=Pe;F.addListener=Pe;F.once=Pe;F.off=Pe;F.removeListener=Pe;F.removeAllListeners=Pe;F.emit=Pe;F.prependListener=Pe;F.prependOnceListener=Pe;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 ye=A((yb,go)=>{"use strict";var{SymbolAsyncIterator:io,SymbolIterator:no,SymbolFor:et}=j(),so=et("nodejs.stream.destroyed"),oo=et("nodejs.stream.errored"),vi=et("nodejs.stream.readable"),Pi=et("nodejs.stream.writable"),ao=et("nodejs.stream.disturbed"),yc=et("nodejs.webstream.isClosedPromise"),gc=et("nodejs.webstream.controllerErrorFunction");function Rr(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 Tr(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 mc(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function be(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function lo(t){return!!(t&&!be(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function uo(t){return!!(t&&!be(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function fo(t){return!!(t&&!be(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function wc(t){return lo(t)||uo(t)||fo(t)}function xc(t,e){return t==null?!1:e===!0?typeof t[io]=="function":e===!1?typeof t[no]=="function":typeof t[io]=="function"||typeof t[no]=="function"}function Ar(t){if(!be(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[so]||i!=null&&i.destroyed)}function co(t){if(!Tr(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 Ec(t,e){if(!Tr(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 Sc(t){if(!Rr(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 ho(t,e){if(!Rr(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 _o(t){return t&&t[vi]!=null?t[vi]:typeof(t==null?void 0:t.readable)!="boolean"?null:Ar(t)?!1:Rr(t)&&t.readable&&!ho(t)}function po(t){return t&&t[Pi]!=null?t[Pi]:typeof(t==null?void 0:t.writable)!="boolean"?null:Ar(t)?!1:Tr(t)&&t.writable&&!co(t)}function Ic(t,e){return be(t)?Ar(t)?!0:!((e==null?void 0:e.readable)!==!1&&_o(t)||(e==null?void 0:e.writable)!==!1&&po(t)):null}function Rc(t){var e,r;return be(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 Tc(t){var e,r;return be(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 Ac(t){if(!be(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"&&bo(t)?t._closed:null}function bo(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function yo(t){return typeof t._sent100=="boolean"&&bo(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 vc(t){if(!be(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&yo(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}function Pc(t){var e;return!!(t&&((e=t[ao])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function jc(t){var e,r,i,n,s,o,a,l,u,c;return!!(t&&((e=(r=(i=(n=(s=(o=t[oo])!==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:!((c=t._writableState)===null||c===void 0)&&c.errored))}go.exports={isDestroyed:Ar,kIsDestroyed:so,isDisturbed:Pc,kIsDisturbed:ao,isErrored:jc,kIsErrored:oo,isReadable:_o,kIsReadable:vi,kIsClosedPromise:yc,kControllerErrorFunction:gc,kIsWritable:Pi,isClosed:Ac,isDuplexNodeStream:mc,isFinished:Ic,isIterable:xc,isReadableNodeStream:Rr,isReadableStream:lo,isReadableEnded:Sc,isReadableFinished:ho,isReadableErrored:Tc,isNodeStream:be,isWebStream:wc,isWritable:po,isWritableNodeStream:Tr,isWritableStream:uo,isWritableEnded:co,isWritableFinished:Ec,isWritableErrored:Rc,isServerRequest:Nc,isServerResponse:yo,willEmitClose:vc,isTransformStream:fo}});var je=A((gb,Ci)=>{"use strict";var Ue=ke(),{AbortError:Ao,codes:Lc}=z(),{ERR_INVALID_ARG_TYPE:Bc,ERR_STREAM_PREMATURE_CLOSE:mo}=Lc,{kEmptyObject:Li,once:Bi}=K(),{validateAbortSignal:Fc,validateFunction:Cc,validateObject:Dc,validateBoolean:Oc}=St(),{Promise:Mc,PromisePrototypeThen:$c,SymbolDispose:No}=j(),{isClosed:kc,isReadable:wo,isReadableNodeStream:ji,isReadableStream:Uc,isReadableFinished:xo,isReadableErrored:Eo,isWritable:So,isWritableNodeStream:Io,isWritableStream:qc,isWritableFinished:Ro,isWritableErrored:To,isNodeStream:Wc,willEmitClose:Gc,kIsClosedPromise:Qc}=ye(),Rt;function zc(t){return t.setHeader&&typeof t.abort=="function"}var Fi=()=>{};function vo(t,e,r){var i,n;if(arguments.length===2?(r=e,e=Li):e==null?e=Li:Dc(e,"options"),Cc(r,"callback"),Fc(e.signal,"options.signal"),r=Bi(r),Uc(t)||qc(t))return Vc(t,e,r);if(!Wc(t))throw new Bc("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:Io(t),a=t._writableState,l=t._readableState,u=()=>{t.writable||h()},c=Gc(t)&&ji(t)===s&&Io(t)===o,f=Ro(t,!1),h=()=>{f=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||s))&&(!s||d)&&r.call(t)},d=xo(t,!1),_=()=>{d=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||o))&&(!o||f)&&r.call(t)},p=w=>{r.call(t,w)},y=kc(t),m=()=>{y=!0;let w=To(t)||Eo(t);if(w&&typeof w!="boolean")return r.call(t,w);if(s&&!d&&ji(t,!0)&&!xo(t,!1))return r.call(t,new mo);if(o&&!f&&!Ro(t,!1))return r.call(t,new mo);r.call(t)},S=()=>{y=!0;let w=To(t)||Eo(t);if(w&&typeof w!="boolean")return r.call(t,w);r.call(t)},x=()=>{t.req.on("finish",h)};zc(t)?(t.on("complete",h),c||t.on("abort",m),t.req?x():t.on("request",x)):o&&!a&&(t.on("end",u),t.on("close",u)),!c&&typeof t.aborted=="boolean"&&t.on("aborted",m),t.on("end",_),t.on("finish",h),e.error!==!1&&t.on("error",p),t.on("close",m),y?Ue.nextTick(m):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?c||Ue.nextTick(S):(!s&&(!c||wo(t))&&(f||So(t)===!1)||!o&&(!c||So(t))&&(d||wo(t)===!1)||l&&t.req&&t.aborted)&&Ue.nextTick(S);let g=()=>{r=Fi,t.removeListener("aborted",m),t.removeListener("complete",h),t.removeListener("abort",m),t.removeListener("request",x),t.req&&t.req.removeListener("finish",h),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",h),t.removeListener("end",_),t.removeListener("error",p),t.removeListener("close",m)};if(e.signal&&!y){let w=()=>{let R=r;g(),R.call(t,new Ao(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Ue.nextTick(w);else{Rt=Rt||K().addAbortListener;let R=Rt(e.signal,w),T=r;r=Bi((...U)=>{R[No](),T.apply(t,U)})}}return g}function Vc(t,e,r){let i=!1,n=Fi;if(e.signal)if(n=()=>{i=!0,r.call(t,new Ao(void 0,{cause:e.signal.reason}))},e.signal.aborted)Ue.nextTick(n);else{Rt=Rt||K().addAbortListener;let o=Rt(e.signal,n),a=r;r=Bi((...l)=>{o[No](),a.apply(t,l)})}let s=(...o)=>{i||Ue.nextTick(()=>r.apply(t,o))};return $c(t[Qc].promise,s,s),Fi}function Hc(t,e){var r;let i=!1;return e===null&&(e=Li),(r=e)!==null&&r!==void 0&&r.cleanup&&(Oc(e.cleanup,"cleanup"),i=e.cleanup),new Mc((n,s)=>{let o=vo(t,e,a=>{i&&o(),a?s(a):n()})})}Ci.exports=vo;Ci.exports.finished=Hc});var tt=A((mb,Oo)=>{"use strict";var ge=ke(),{aggregateTwoErrors:Kc,codes:{ERR_MULTIPLE_CALLBACK:Yc},AbortError:Zc}=z(),{Symbol:Lo}=j(),{kIsDestroyed:Jc,isDestroyed:Xc,isFinished:ed,isServerRequest:td}=ye(),Bo=Lo("kDestroy"),Di=Lo("kConstruct");function Fo(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function rd(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):(Fo(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?Po(this,t,e):this.once(Bo,function(s){Po(this,Kc(s,t),e)}),this)}function Po(t,e,r){let i=!1;function n(s){if(i)return;i=!0;let o=t._readableState,a=t._writableState;Fo(s,a,o),a&&(a.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?ge.nextTick(id,t,s):ge.nextTick(Co,t)}try{t._destroy(e||null,n)}catch(s){n(s)}}function id(t,e){Oi(t,e),Co(t)}function Co(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 nd(){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?ge.nextTick(Oi,t,e):Oi(t,e))}function sd(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)&&ge.nextTick(od,t)}function od(t){let e=!1;function r(i){if(e){Mi(t,i!=null?i:new Yc);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(Bo,i):i?Mi(t,i,!0):ge.nextTick(ad,t)}try{t._construct(i=>{ge.nextTick(r,i)})}catch(i){ge.nextTick(r,i)}}function ad(t){t.emit(Di)}function jo(t){return(t==null?void 0:t.setHeader)&&typeof t.abort=="function"}function Do(t){t.emit("close")}function ld(t,e){t.emit("error",e),ge.nextTick(Do,t)}function ud(t,e){!t||Xc(t)||(!e&&!ed(t)&&(e=new Zc),td(t)?(t.socket=null,t.destroy(e)):jo(t)?t.abort():jo(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?ge.nextTick(ld,t,e):ge.nextTick(Do,t),t.destroyed||(t[Jc]=!0))}Oo.exports={construct:sd,destroyer:ud,destroy:rd,undestroy:nd,errorOrDestroy:Mi}});var Pr=A((wb,$o)=>{"use strict";var{ArrayIsArray:fd,ObjectSetPrototypeOf:Mo}=j(),{EventEmitter:Nr}=Kt();function vr(t){Nr.call(this,t)}Mo(vr.prototype,Nr.prototype);Mo(vr,Nr);vr.prototype.pipe=function(t,e){let r=this;function i(c){t.writable&&t.write(c)===!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(c){u(),Nr.listenerCount(this,"error")===0&&this.emit("error",c)}$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):fd(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}$o.exports={Stream:vr,prependListener:$i}});var Yt=A((xb,jr)=>{"use strict";var{SymbolDispose:cd}=j(),{AbortError:ko,codes:dd}=z(),{isNodeStream:Uo,isWebStream:hd,kControllerErrorFunction:_d}=ye(),pd=je(),{ERR_INVALID_ARG_TYPE:qo}=dd,ki,bd=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new qo(e,"AbortSignal",t)};jr.exports.addAbortSignal=function(e,r){if(bd(e,"signal"),!Uo(r)&&!hd(r))throw new qo("stream",["ReadableStream","WritableStream","Stream"],r);return jr.exports.addAbortSignalNoValidate(e,r)};jr.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=Uo(e)?()=>{e.destroy(new ko(void 0,{cause:t.reason}))}:()=>{e[_d](new ko(void 0,{cause:t.reason}))};if(t.aborted)r();else{ki=ki||K().addAbortListener;let i=ki(t,r);pd(e,i[cd])}return e}});var Qo=A((Sb,Go)=>{"use strict";var{StringPrototypeSlice:Wo,SymbolIterator:yd,TypedArrayPrototypeSet:Lr,Uint8Array:gd}=j(),{Buffer:Ui}=ce(),{inspect:md}=K();Go.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;)Lr(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}*[yd](){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+=Wo(s,0,e),this.head=i,i.data=Wo(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)Lr(r,o,i-e),e-=o.length;else{e===o.length?(Lr(r,o,i-e),++s,n.next?this.head=n.next:this.head=this.tail=null):(Lr(r,new gd(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 md(this,De(O({},r),{depth:0,customInspect:!1}))}}});var Zt=A((Rb,Ko)=>{"use strict";var{MathFloor:wd,NumberIsInteger:xd}=j(),{validateInteger:Ed}=St(),{ERR_INVALID_ARG_VALUE:Sd}=z().codes,zo=16*1024,Vo=16;function Id(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Ho(t){return t?Vo:zo}function Rd(t,e){Ed(e,"value",0),t?Vo=e:zo=e}function Td(t,e,r,i){let n=Id(e,i,r);if(n!=null){if(!xd(n)||n<0){let s=i?`options.${r}`:"options.highWaterMark";throw new Sd(s,n)}return wd(n)}return Ho(t.objectMode)}Ko.exports={getHighWaterMark:Td,getDefaultHighWaterMark:Ho,setDefaultHighWaterMark:Rd}});var Jo=A((qi,Zo)=>{var Br=ce(),me=Br.Buffer;function Yo(t,e){for(var r in t)e[r]=t[r]}me.from&&me.alloc&&me.allocUnsafe&&me.allocUnsafeSlow?Zo.exports=Br:(Yo(Br,qi),qi.Buffer=rt);function rt(t,e,r){return me(t,e,r)}rt.prototype=Object.create(me.prototype);Yo(me,rt);rt.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return me(t,e,r)};rt.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=me(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};rt.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return me(t)};rt.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Br.SlowBuffer(t)}});var ta=A(ea=>{"use strict";var Gi=Jo().Buffer,Xo=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 Ad(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=Ad(t);if(typeof e!="string"&&(Gi.isEncoding===Xo||!Xo(t)))throw new Error("Unknown encoding: "+t);return e||t}ea.StringDecoder=Jt;function Jt(t){this.encoding=Nd(t);var e;switch(this.encoding){case"utf16le":this.text=Fd,this.end=Cd,e=4;break;case"utf8":this.fillLast=jd,e=4;break;case"base64":this.text=Dd,this.end=Od,e=3;break;default:this.write=Md,this.end=$d;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Gi.allocUnsafe(e)}Jt.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||""};Jt.prototype.end=Bd;Jt.prototype.text=Ld;Jt.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 vd(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 Pd(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 jd(t){var e=this.lastTotal-this.lastNeed,r=Pd(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 Ld(t,e){var r=vd(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 Bd(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Fd(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 Cd(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 Dd(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 Od(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Md(t){return t.toString(this.encoding)}function $d(t){return t&&t.length?this.write(t):""}});var Qi=A((Ab,sa)=>{"use strict";var ra=ke(),{PromisePrototypeThen:kd,SymbolAsyncIterator:ia,SymbolIterator:na}=j(),{Buffer:Ud}=ce(),{ERR_INVALID_ARG_TYPE:qd,ERR_STREAM_NULL_VALUES:Wd}=z().codes;function Gd(t,e,r){let i;if(typeof e=="string"||e instanceof Ud)return new t(De(O({objectMode:!0},r),{read(){this.push(e),this.push(null)}}));let n;if(e&&e[ia])n=!0,i=e[ia]();else if(e&&e[na])n=!1,i=e[na]();else throw new qd("iterable",["Iterable"],e);let s=new t(O({objectMode:!0,highWaterMark:1},r)),o=!1;s._read=function(){o||(o=!0,l())},s._destroy=function(u,c){kd(a(u),()=>ra.nextTick(c,u),f=>ra.nextTick(c,f||u))};async function a(u){let c=u!=null,f=typeof i.throw=="function";if(c&&f){let{value:h,done:d}=await i.throw(u);if(await h,d)return}if(typeof i.return=="function"){let{value:h}=await i.return();await h}}async function l(){for(;;){try{let{value:u,done:c}=n?await i.next():i.next();if(c)s.push(null);else{let f=u&&typeof u.then=="function"?await u:u;if(f===null)throw o=!1,new Wd;if(s.push(f))continue;o=!1}}catch(u){s.destroy(u)}break}}return s}sa.exports=Gd});var er=A((vb,Sa)=>{"use strict";var ae=ke(),{ArrayPrototypeIndexOf:Qd,NumberIsInteger:zd,NumberIsNaN:Vd,NumberParseInt:Hd,ObjectDefineProperties:Xi,ObjectKeys:Kd,ObjectSetPrototypeOf:la,Promise:ua,SafeSet:Yd,SymbolAsyncDispose:Zd,SymbolAsyncIterator:Jd,Symbol:Xd}=j();Sa.exports=E;E.ReadableState=Or;var{EventEmitter:eh}=Kt(),{Stream:qe,prependListener:th}=Pr(),{Buffer:zi}=ce(),{addAbortSignal:rh}=Yt(),fa=je(),I=K().debuglog("stream",t=>{I=t}),ih=Qo(),Nt=tt(),{getHighWaterMark:nh,getDefaultHighWaterMark:sh}=Zt(),{aggregateTwoErrors:oa,codes:{ERR_INVALID_ARG_TYPE:oh,ERR_METHOD_NOT_IMPLEMENTED:ah,ERR_OUT_OF_RANGE:lh,ERR_STREAM_PUSH_AFTER_EOF:uh,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:fh},AbortError:ch}=z(),{validateObject:dh}=St(),it=Xd("kPaused"),{StringDecoder:ca}=ta(),hh=Qi();la(E.prototype,qe.prototype);la(E,qe);var Vi=()=>{},{errorOrDestroy:Tt}=Nt,At=1,_h=2,da=4,Xt=8,ha=16,Fr=32,Cr=64,_a=128,ph=256,bh=512,yh=1024,Zi=2048,Ji=4096,gh=8192,mh=16384,wh=32768,pa=65536,xh=1<<17,Eh=1<<18;function $(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}Xi(Or.prototype,{objectMode:$(At),ended:$(_h),endEmitted:$(da),reading:$(Xt),constructed:$(ha),sync:$(Fr),needReadable:$(Cr),emittedReadable:$(_a),readableListening:$(ph),resumeScheduled:$(bh),errorEmitted:$(yh),emitClose:$(Zi),autoDestroy:$(Ji),destroyed:$(gh),closed:$(mh),closeEmitted:$(wh),multiAwaitDrain:$(pa),readingMore:$(xh),dataEmitted:$(Eh)});function Or(t,e,r){typeof r!="boolean"&&(r=e instanceof we()),this.state=Zi|Ji|ha|Fr,t&&t.objectMode&&(this.state|=At),r&&t&&t.readableObjectMode&&(this.state|=At),this.highWaterMark=t?nh(this,t,"readableHighWaterMark",r):sh(!1),this.buffer=new ih,this.length=0,this.pipes=[],this.flowing=null,this[it]=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 ca(t.encoding),this.encoding=t.encoding)}function E(t){if(!(this instanceof E))return new E(t);let e=this instanceof we();this._readableState=new Or(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&&rh(t.signal,this)),qe.call(this,t),Nt.construct(this,()=>{this._readableState.needReadable&&Dr(this,this._readableState)})}E.prototype.destroy=Nt.destroy;E.prototype._undestroy=Nt.undestroy;E.prototype._destroy=function(t,e){e(t)};E.prototype[eh.captureRejectionSymbol]=function(t){this.destroy(t)};E.prototype[Zd]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new ch,this.destroy(t)),new ua((e,r)=>fa(this,i=>i&&i!==t?r(i):e(null)))};E.prototype.push=function(t,e){return ba(this,t,e,!1)};E.prototype.unshift=function(t,e){return ba(this,t,e,!0)};function ba(t,e,r,i){I("readableAddChunk",e);let n=t._readableState,s;if((n.state&At)===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="":qe._isUint8Array(e)?(e=qe._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new oh("chunk",["string","Buffer","Uint8Array"],e))),s)Tt(t,s);else if(e===null)n.state&=~Xt,Rh(t,n);else if((n.state&At)!==0||e&&e.length>0)if(i)if((n.state&da)!==0)Tt(t,new fh);else{if(n.destroyed||n.errored)return!1;Hi(t,n,e,!0)}else if(n.ended)Tt(t,new uh);else{if(n.destroyed||n.errored)return!1;n.state&=~Xt,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?Hi(t,n,e,!1):Dr(t,n)):Hi(t,n,e,!1)}else i||(n.state&=~Xt,Dr(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&pa)!==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&&Mr(t)),Dr(t,e)}E.prototype.isPaused=function(){let t=this._readableState;return t[it]===!0||t.flowing===!1};E.prototype.setEncoding=function(t){let e=new ca(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 Sh=1073741824;function Ih(t){if(t>Sh)throw new lh("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function aa(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&At)!==0?1:Vd(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:zd(t)||(t=Hd(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=Ih(t)),t!==0&&(e.state&=~_a),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):Mr(this),null;if(t=aa(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|=Xt|Fr,e.length===0&&(e.state|=Cr);try{this._read(e.highWaterMark)}catch(s){Tt(this,s)}e.state&=~Fr,e.reading||(t=aa(r,e))}let n;return t>0?n=xa(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 Rh(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?Mr(t):(e.needReadable=!1,e.emittedReadable=!0,ya(t))}}function Mr(t){let e=t._readableState;I("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(I("emitReadable",e.flowing),e.emittedReadable=!0,ae.nextTick(ya,t))}function ya(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,ma(t)}function Dr(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,ae.nextTick(Th,t,e))}function Th(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 ah("_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 Yd(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!==ae.stdout&&t!==ae.stderr?a:y;i.endEmitted?ae.nextTick(s):r.once("end",s),t.on("unpipe",o);function o(m,S){I("onunpipe"),m===r&&S&&S.hasUnpiped===!1&&(S.hasUnpiped=!0,c())}function a(){I("onend"),t.end()}let l,u=!1;function c(){I("cleanup"),t.removeListener("close",_),t.removeListener("finish",p),l&&t.removeListener("drain",l),t.removeListener("error",d),t.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",y),r.removeListener("data",h),u=!0,l&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&l()}function f(){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=Ah(r,t),t.on("drain",l))}r.on("data",h);function h(m){I("ondata");let S=t.write(m);I("dest.write",S),S===!1&&f()}function d(m){if(I("onerror",m),y(),t.removeListener("error",d),t.listenerCount("error")===0){let S=t._writableState||t._readableState;S&&!S.errorEmitted?Tt(t,m):t.emit("error",m)}}th(t,"error",d);function _(){t.removeListener("finish",p),y()}t.once("close",_);function p(){I("onfinish"),t.removeListener("close",_),y()}t.once("finish",p);function y(){I("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?f():i.flowing||(I("pipe resume"),r.resume()),t};function Ah(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=Qd(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=qe.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?Mr(this):i.reading||ae.nextTick(Nh,this)),r};E.prototype.addListener=E.prototype.on;E.prototype.removeListener=function(t,e){let r=qe.prototype.removeListener.call(this,t,e);return t==="readable"&&ae.nextTick(ga,this),r};E.prototype.off=E.prototype.removeListener;E.prototype.removeAllListeners=function(t){let e=qe.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&ae.nextTick(ga,this),e};function ga(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[it]===!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,vh(this,t)),t[it]=!1,this};function vh(t,e){e.resumeScheduled||(e.resumeScheduled=!0,ae.nextTick(Ph,t,e))}function Ph(t,e){I("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),ma(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[it]=!0,this};function ma(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=>{Tt(this,i)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=Kd(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[Jd]=function(){return wa(this)};E.prototype.iterator=function(t){return t!==void 0&&dh(t,"options"),wa(this,t)};function wa(t,e){typeof t.read!="function"&&(t=E.wrap(t,{objectMode:!0}));let r=jh(t,e);return r.stream=t,r}function jh(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=fa(t,{writable:!1},o=>{n=o?oa(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 ua(i))}}}catch(o){throw n=oa(n,o),n}finally{(n||(e==null?void 0:e.destroyOnReturn)!==!1)&&(n===void 0||t._readableState.autoDestroy)?Nt.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(Or.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[it]!==!1},set(t){this[it]=!!t}}});E._fromList=xa;function xa(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,ae.nextTick(Lh,e,t))}function Lh(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)ae.nextTick(Bh,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function Bh(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}E.from=function(t,e){return hh(E,t,e)};var Yi;function Ea(){return Yi===void 0&&(Yi={}),Yi}E.fromWeb=function(t,e){return Ea().newStreamReadableFromReadableStream(t,e)};E.toWeb=function(t,e){return Ea().newReadableStreamFromStreamReadable(t,e)};E.wrap=function(t,e){var r,i;return new E(De(O({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0},e),{destroy(n,s){Nt.destroyer(t,n),s(n)}})).wrap(t)}});var Wr=A((jb,Ca)=>{"use strict";var nt=ke(),{ArrayPrototypeSlice:Ta,Error:Fh,FunctionPrototypeSymbolHasInstance:Aa,ObjectDefineProperty:Na,ObjectDefineProperties:Ch,ObjectSetPrototypeOf:va,StringPrototypeToLowerCase:Dh,Symbol:Oh,SymbolHasInstance:Mh}=j();Ca.exports=L;L.WritableState=ir;var{EventEmitter:$h}=Kt(),tr=Pr().Stream,{Buffer:$r}=ce(),qr=tt(),{addAbortSignal:kh}=Yt(),{getHighWaterMark:Uh,getDefaultHighWaterMark:qh}=Zt(),{ERR_INVALID_ARG_TYPE:Wh,ERR_METHOD_NOT_IMPLEMENTED:Gh,ERR_MULTIPLE_CALLBACK:Pa,ERR_STREAM_CANNOT_PIPE:Qh,ERR_STREAM_DESTROYED:rr,ERR_STREAM_ALREADY_FINISHED:zh,ERR_STREAM_NULL_VALUES:Vh,ERR_STREAM_WRITE_AFTER_END:Hh,ERR_UNKNOWN_ENCODING:ja}=z().codes,{errorOrDestroy:vt}=qr;va(L.prototype,tr.prototype);va(L,tr);function rn(){}var Pt=Oh("kOnFinished");function ir(t,e,r){typeof r!="boolean"&&(r=e instanceof we()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?Uh(this,t,"writableHighWaterMark",r):qh(!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=Yh.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Ur(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[Pt]=[]}function Ur(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}ir.prototype.getBuffer=function(){return Ta(this.buffered,this.bufferedIndex)};Na(ir.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function L(t){let e=this instanceof we();if(!e&&!Aa(L,this))return new L(t);this._writableState=new ir(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&&kh(t.signal,this)),tr.call(this,t),qr.construct(this,()=>{let r=this._writableState;r.writing||sn(this,r),on(this,r)})}Na(L,Mh,{__proto__:null,value:function(t){return Aa(this,t)?!0:this!==L?!1:t&&t._writableState instanceof ir}});L.prototype.pipe=function(){vt(this,new Qh)};function La(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"&&!$r.isEncoding(r))throw new ja(r);typeof i!="function"&&(i=rn)}if(e===null)throw new Vh;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=$r.from(e,r),r="buffer");else if(e instanceof $r)r="buffer";else if(tr._isUint8Array(e))e=tr._uint8ArrayToBuffer(e),r="buffer";else throw new Wh("chunk",["string","Buffer","Uint8Array"],e);let s;return n.ending?s=new Hh:n.destroyed&&(s=new rr("write")),s?(nt.nextTick(i,s),vt(t,s,!0),s):(n.pendingcb++,Kh(t,n,e,r,i))}L.prototype.write=function(t,e,r){return La(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=Dh(e)),!$r.isEncoding(e))throw new ja(e);return this._writableState.defaultEncoding=e,this};function Kh(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 Ia(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new rr("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function Ra(t,e,r,i){--e.pendingcb,i(r),nn(e),vt(t,r)}function Yh(t,e){let r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function"){vt(t,new Pa);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?nt.nextTick(Ra,t,r,e,n):Ra(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},nt.nextTick(Zh,r.afterWriteTickInfo)):Ba(t,r,1,n))}function Zh({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,Ba(t,e,r,i)}function Ba(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 rr("write"))}let r=t[Pt].splice(0);for(let n=0;n<r.length;n++){var i;r[n]((i=t.errored)!==null&&i!==void 0?i:new rr("end"))}Ur(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 c=o;c<r.length;++c)r[c].callback(u)},l=e.allNoop&&o===0?r:Ta(r,o);l.allBuffers=e.allBuffers,Ia(t,e,!0,e.length,l,"",a),Ur(e)}else{do{let{chunk:a,encoding:l,callback:u}=r[o];r[o++]=null;let c=n?1:a.length;Ia(t,e,!1,c,a,l,u)}while(o<r.length&&!e.writing);o===r.length?Ur(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 Gh("_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=La(this,t,e);s instanceof Fh&&(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 zh("end"):i.destroyed&&(n=new rr("end"))),typeof r=="function"&&(n||i.finished?nt.nextTick(r,n):i[Pt].push(r)),this};function kr(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 Jh(t,e){let r=!1;function i(n){if(r){vt(t,n!=null?n:Pa());return}if(r=!0,e.pendingcb--,n){let s=e[Pt].splice(0);for(let o=0;o<s.length;o++)s[o](n);vt(t,n,e.sync)}else kr(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,nt.nextTick(tn,t,e))}e.sync=!0,e.pendingcb++;try{t._final(i)}catch(n){i(n)}e.sync=!1}function Xh(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,Jh(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function on(t,e,r){kr(e)&&(Xh(t,e),e.pendingcb===0&&(r?(e.pendingcb++,nt.nextTick((i,n)=>{kr(n)?tn(i,n):n.pendingcb--},t,e)):kr(e)&&(e.pendingcb++,tn(t,e))))}function tn(t,e){e.pendingcb--,e.finished=!0;let r=e[Pt].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()}}Ch(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 e_=qr.destroy;L.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[Pt].length)&&nt.nextTick(nn,r),e_.call(this,t,e),this};L.prototype._undestroy=qr.undestroy;L.prototype._destroy=function(t,e){e(t)};L.prototype[$h.captureRejectionSymbol]=function(t){this.destroy(t)};var en;function Fa(){return en===void 0&&(en={}),en}L.fromWeb=function(t,e){return Fa().newStreamWritableFromWritableStream(t,e)};L.toWeb=function(t){return Fa().newWritableStreamFromStreamWritable(t)}});var Ya=A((Lb,Ka)=>{var an=ke(),t_=ce(),{isReadable:r_,isWritable:i_,isIterable:Da,isNodeStream:n_,isReadableNodeStream:Oa,isWritableNodeStream:Ma,isDuplexNodeStream:s_,isReadableStream:$a,isWritableStream:ka}=ye(),Ua=je(),{AbortError:Va,codes:{ERR_INVALID_ARG_TYPE:o_,ERR_INVALID_RETURN_VALUE:qa}}=z(),{destroyer:Lt}=tt(),a_=we(),Ha=er(),l_=Wr(),{createDeferredPromise:Wa}=K(),Ga=Qi(),Qa=globalThis.Blob||t_.Blob,u_=typeof Qa!="undefined"?function(e){return e instanceof Qa}:function(e){return!1},f_=globalThis.AbortController||wt().AbortController,{FunctionPrototypeCall:za}=j(),We=class extends a_{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)}};Ka.exports=function t(e,r){if(s_(e))return e;if(Oa(e))return jt({readable:e});if(Ma(e))return jt({writable:e});if(n_(e))return jt({writable:!1,readable:!1});if($a(e))return jt({readable:Ha.fromWeb(e)});if(ka(e))return jt({writable:l_.fromWeb(e)});if(typeof e=="function"){let{value:n,write:s,final:o,destroy:a}=c_(e);if(Da(n))return Ga(We,n,{objectMode:!0,write:s,final:o,destroy:a});let l=n==null?void 0:n.then;if(typeof l=="function"){let u,c=za(l,n,f=>{if(f!=null)throw new qa("nully","body",f)},f=>{Lt(u,f)});return u=new We({objectMode:!0,readable:!1,write:s,final(f){o(async()=>{try{await c,an.nextTick(f,null)}catch(h){an.nextTick(f,h)}})},destroy:a})}throw new qa("Iterable, AsyncIterable or AsyncFunction",r,n)}if(u_(e))return t(e.arrayBuffer());if(Da(e))return Ga(We,e,{objectMode:!0,writable:!1});if($a(e==null?void 0:e.readable)&&ka(e==null?void 0:e.writable))return We.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?Oa(e==null?void 0:e.readable)?e==null?void 0:e.readable:t(e.readable):void 0,s=e!=null&&e.writable?Ma(e==null?void 0:e.writable)?e==null?void 0:e.writable:t(e.writable):void 0;return jt({readable:n,writable:s})}let i=e==null?void 0:e.then;if(typeof i=="function"){let n;return za(i,e,s=>{s!=null&&n.push(s),n.push(null)},s=>{Lt(n,s)}),n=new We({objectMode:!0,writable:!1,read(){}})}throw new o_(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function c_(t){let{promise:e,resolve:r}=Wa(),i=new f_,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 Va(void 0,{cause:n.reason});({promise:e,resolve:r}=Wa()),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 jt(t){let e=t.readable&&typeof t.readable.read!="function"?Ha.wrap(t.readable):t.readable,r=t.writable,i=!!r_(e),n=!!i_(r),s,o,a,l,u;function c(f){let h=l;l=null,h?h(f):f&&u.destroy(f)}return u=new We({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(Ua(r,f=>{n=!1,f&&Lt(e,f),c(f)}),u._write=function(f,h,d){r.write(f,h)?d():s=d},u._final=function(f){r.end(),o=f},r.on("drain",function(){if(s){let f=s;s=null,f()}}),r.on("finish",function(){if(o){let f=o;o=null,f()}})),i&&(Ua(e,f=>{i=!1,f&&Lt(e,f),c(f)}),e.on("readable",function(){if(a){let f=a;a=null,f()}}),e.on("end",function(){u.push(null)}),u._read=function(){for(;;){let f=e.read();if(f===null){a=u._read;return}if(!u.push(f))return}}),u._destroy=function(f,h){!f&&l!==null&&(f=new Va),a=null,s=null,o=null,l===null?h(f):(l=h,Lt(r,f),Lt(e,f))},u}});var we=A((Fb,Xa)=>{"use strict";var{ObjectDefineProperties:d_,ObjectGetOwnPropertyDescriptor:Le,ObjectKeys:h_,ObjectSetPrototypeOf:Za}=j();Xa.exports=le;var fn=er(),ie=Wr();Za(le.prototype,fn.prototype);Za(le,fn);{let t=h_(ie.prototype);for(let e=0;e<t.length;e++){let r=t[e];le.prototype[r]||(le.prototype[r]=ie.prototype[r])}}function le(t){if(!(this instanceof le))return new le(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}d_(le.prototype,{writable:O({__proto__:null},Le(ie.prototype,"writable")),writableHighWaterMark:O({__proto__:null},Le(ie.prototype,"writableHighWaterMark")),writableObjectMode:O({__proto__:null},Le(ie.prototype,"writableObjectMode")),writableBuffer:O({__proto__:null},Le(ie.prototype,"writableBuffer")),writableLength:O({__proto__:null},Le(ie.prototype,"writableLength")),writableFinished:O({__proto__:null},Le(ie.prototype,"writableFinished")),writableCorked:O({__proto__:null},Le(ie.prototype,"writableCorked")),writableEnded:O({__proto__:null},Le(ie.prototype,"writableEnded")),writableNeedDrain:O({__proto__:null},Le(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 Ja(){return ln===void 0&&(ln={}),ln}le.fromWeb=function(t,e){return Ja().newStreamDuplexFromReadableWritablePair(t,e)};le.toWeb=function(t){return Ja().newReadableWritablePairFromDuplex(t)};var un;le.from=function(t){return un||(un=Ya()),un(t,"body")}});var hn=A((Db,tl)=>{"use strict";var{ObjectSetPrototypeOf:el,Symbol:__}=j();tl.exports=Be;var{ERR_METHOD_NOT_IMPLEMENTED:p_}=z().codes,dn=we(),{getHighWaterMark:b_}=Zt();el(Be.prototype,dn.prototype);el(Be,dn);var nr=__("kCallback");function Be(t){if(!(this instanceof Be))return new Be(t);let e=t?b_(this,t,"readableHighWaterMark",!0):null;e===0&&(t=De(O({},t),{highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0})),dn.call(this,t),this._readableState.sync=!1,this[nr]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",y_)}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 y_(){this._final!==cn&&cn.call(this)}Be.prototype._final=cn;Be.prototype._transform=function(t,e,r){throw new p_("_transform()")};Be.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[nr]=r})};Be.prototype._read=function(){if(this[nr]){let t=this[nr];this[nr]=null,t()}}});var pn=A((Mb,il)=>{"use strict";var{ObjectSetPrototypeOf:rl}=j();il.exports=Bt;var _n=hn();rl(Bt.prototype,_n.prototype);rl(Bt,_n);function Bt(t){if(!(this instanceof Bt))return new Bt(t);_n.call(this,t)}Bt.prototype._transform=function(t,e,r){r(null,t)}});var Vr=A(($b,ll)=>{var sr=ke(),{ArrayIsArray:g_,Promise:m_,SymbolAsyncIterator:w_,SymbolDispose:x_}=j(),zr=je(),{once:E_}=K(),S_=tt(),nl=we(),{aggregateTwoErrors:I_,codes:{ERR_INVALID_ARG_TYPE:In,ERR_INVALID_RETURN_VALUE:bn,ERR_MISSING_ARGS:R_,ERR_STREAM_DESTROYED:T_,ERR_STREAM_PREMATURE_CLOSE:A_},AbortError:N_}=z(),{validateFunction:v_,validateAbortSignal:P_}=St(),{isIterable:st,isReadable:yn,isReadableNodeStream:Qr,isNodeStream:sl,isTransformStream:Ft,isWebStream:j_,isReadableStream:gn,isReadableFinished:L_}=ye(),B_=globalThis.AbortController||wt().AbortController,mn,wn,xn;function ol(t,e,r){let i=!1;t.on("close",()=>{i=!0});let n=zr(t,{readable:e,writable:r},s=>{i=!s});return{destroy:s=>{i||(i=!0,S_.destroyer(t,s||new T_("pipe")))},cleanup:n}}function F_(t){return v_(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function En(t){if(st(t))return t;if(Qr(t))return C_(t);throw new In("val",["Readable","Iterable","AsyncIterable"],t)}function C_(t){return ee(this,null,function*(){wn||(wn=er()),yield*ne(wn.prototype[w_].call(t))})}async function Gr(t,e,r,{end:i}){let n,s=null,o=d=>{if(d&&(n=d),s){let _=s;s=null,_()}},a=()=>new m_((d,_)=>{n?_(n):s=()=>{n?_(n):d()}});e.on("drain",o);let l=zr(e,{readable:!1},o);try{e.writableNeedDrain&&await a();try{for(var u=Y(t),c,f,h;c=!(f=await u.next()).done;c=!1){let d=f.value;e.write(d)||await a()}}catch(f){h=[f]}finally{try{c&&(f=u.return)&&await f.call(u)}finally{if(h)throw h[0]}}i&&(e.end(),await a()),r()}catch(d){r(n!==d?I_(n,d):d)}finally{l(),e.off("drain",o)}}async function Sn(t,e,r,{end:i}){Ft(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(c){r(c)}}}function D_(...t){return al(t,E_(F_(t)))}function al(t,e,r){if(t.length===1&&g_(t[0])&&(t=t[0]),t.length<2)throw new R_("streams");let i=new B_,n=i.signal,s=r==null?void 0:r.signal,o=[];P_(s,"options.signal");function a(){_(new N_)}xn=xn||K().addAbortListener;let l;s&&(l=xn(s,a));let u,c,f=[],h=0;function d(x){_(x,--h===0)}function _(x,g){var w;if(x&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=x),!(!u&&!g)){for(;f.length;)f.shift()(u);(w=l)===null||w===void 0||w[x_](),i.abort(),g&&(u||o.forEach(R=>R()),sr.nextTick(e,u,c))}}let p;for(let x=0;x<t.length;x++){let g=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(sl(g)){let D=function(X){X&&X.name!=="AbortError"&&X.code!=="ERR_STREAM_PREMATURE_CLOSE"&&d(X)};var S=D;if(T){let{destroy:X,cleanup:ti}=ol(g,w,R);f.push(X),yn(g)&&U&&o.push(ti)}g.on("error",D),yn(g)&&U&&o.push(()=>{g.removeListener("error",D)})}if(x===0)if(typeof g=="function"){if(p=g({signal:n}),!st(p))throw new bn("Iterable, AsyncIterable or Stream","source",p)}else st(g)||Qr(g)||Ft(g)?p=g:p=nl.from(g);else if(typeof g=="function"){if(Ft(p)){var y;p=En((y=p)===null||y===void 0?void 0:y.readable)}else p=En(p);if(p=g(p,{signal:n}),w){if(!st(p,!0))throw new bn("AsyncIterable",`transform[${x-1}]`,p)}else{var m;mn||(mn=pn());let D=new mn({objectMode:!0}),X=(m=p)===null||m===void 0?void 0:m.then;if(typeof X=="function")h++,X.call(p,Ce=>{c=Ce,Ce!=null&&D.write(Ce),T&&D.end(),sr.nextTick(d)},Ce=>{D.destroy(Ce),sr.nextTick(d,Ce)});else if(st(p,!0))h++,Gr(p,D,d,{end:T});else if(gn(p)||Ft(p)){let Ce=p.readable||p;h++,Gr(Ce,D,d,{end:T})}else throw new bn("AsyncIterable or Promise","destination",p);p=D;let{destroy:ti,cleanup:Wl}=ol(p,!1,!0);f.push(ti),U&&o.push(Wl)}}else if(sl(g)){if(Qr(p)){h+=2;let D=O_(p,g,d,{end:T});yn(g)&&U&&o.push(D)}else if(Ft(p)||gn(p)){let D=p.readable||p;h++,Gr(D,g,d,{end:T})}else if(st(p))h++,Gr(p,g,d,{end:T});else throw new In("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],p);p=g}else if(j_(g)){if(Qr(p))h++,Sn(En(p),g,d,{end:T});else if(gn(p)||st(p))h++,Sn(p,g,d,{end:T});else if(Ft(p))h++,Sn(p.readable,g,d,{end:T});else throw new In("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],p);p=g}else p=nl.from(g)}return(n!=null&&n.aborted||s!=null&&s.aborted)&&sr.nextTick(a),p}function O_(t,e,r,{end:i}){let n=!1;if(e.on("close",()=>{n||r(new A_)}),t.pipe(e,{end:!1}),i){let o=function(){n=!0,e.end()};var s=o;L_(t)?sr.nextTick(o):t.once("end",o)}else r();return zr(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)}),zr(e,{readable:!1,writable:!0},r)}ll.exports={pipelineImpl:al,pipeline:D_}});var Tn=A((Ub,_l)=>{"use strict";var{pipeline:M_}=Vr(),Hr=we(),{destroyer:$_}=tt(),{isNodeStream:Kr,isReadable:ul,isWritable:fl,isWebStream:Rn,isTransformStream:ot,isWritableStream:cl,isReadableStream:dl}=ye(),{AbortError:k_,codes:{ERR_INVALID_ARG_VALUE:hl,ERR_MISSING_ARGS:U_}}=z(),q_=je();_l.exports=function(...e){if(e.length===0)throw new U_("streams");if(e.length===1)return Hr.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=Hr.from(e[0])),typeof e[e.length-1]=="function"){let d=e.length-1;e[d]=Hr.from(e[d])}for(let d=0;d<e.length;++d)if(!(!Kr(e[d])&&!Rn(e[d]))){if(d<e.length-1&&!(ul(e[d])||dl(e[d])||ot(e[d])))throw new hl(`streams[${d}]`,r[d],"must be readable");if(d>0&&!(fl(e[d])||cl(e[d])||ot(e[d])))throw new hl(`streams[${d}]`,r[d],"must be writable")}let i,n,s,o,a;function l(d){let _=o;o=null,_?_(d):d?a.destroy(d):!h&&!f&&a.destroy()}let u=e[0],c=M_(e,l),f=!!(fl(u)||cl(u)||ot(u)),h=!!(ul(c)||dl(c)||ot(c));if(a=new Hr({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:f,readable:h}),f){if(Kr(u))a._write=function(_,p,y){u.write(_,p)?y():i=y},a._final=function(_){u.end(),n=_},u.on("drain",function(){if(i){let _=i;i=null,_()}});else if(Rn(u)){let p=(ot(u)?u.writable:u).getWriter();a._write=async function(y,m,S){try{await p.ready,p.write(y).catch(()=>{}),S()}catch(x){S(x)}},a._final=async function(y){try{await p.ready,p.close().catch(()=>{}),n=y}catch(m){y(m)}}}let d=ot(c)?c.readable:c;q_(d,()=>{if(n){let _=n;n=null,_()}})}if(h){if(Kr(c))c.on("readable",function(){if(s){let d=s;s=null,d()}}),c.on("end",function(){a.push(null)}),a._read=function(){for(;;){let d=c.read();if(d===null){s=a._read;return}if(!a.push(d))return}};else if(Rn(c)){let _=(ot(c)?c.readable:c).getReader();a._read=async function(){for(;;)try{let{value:p,done:y}=await _.read();if(!a.push(p))return;if(y){a.push(null);return}}catch(p){return}}}}return a._destroy=function(d,_){!d&&o!==null&&(d=new k_),s=null,i=null,n=null,o===null?_(d):(o=_,Kr(c)&&$_(c,d))},a}});var Il=A((qb,vn)=>{"use strict";var W_=globalThis.AbortController||wt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:G_,ERR_INVALID_ARG_TYPE:or,ERR_MISSING_ARGS:Q_,ERR_OUT_OF_RANGE:z_},AbortError:xe}=z(),{validateAbortSignal:at,validateInteger:pl,validateObject:lt}=St(),V_=j().Symbol("kWeak"),H_=j().Symbol("kResistStopPropagation"),{finished:K_}=je(),Y_=Tn(),{addAbortSignalNoValidate:Z_}=Yt(),{isWritable:J_,isNodeStream:X_}=ye(),{deprecate:ep}=K(),{ArrayPrototypePush:tp,Boolean:rp,MathFloor:bl,Number:ip,NumberIsNaN:np,Promise:yl,PromiseReject:gl,PromiseResolve:sp,PromisePrototypeThen:ml,Symbol:xl}=j(),Yr=xl("kEmpty"),wl=xl("kEof");function op(t,e){if(e!=null&<(e,"options"),(e==null?void 0:e.signal)!=null&&at(e.signal,"options.signal"),X_(t)&&!J_(t))throw new G_("stream",t,"must be writable");let r=Y_(this,t);return e!=null&&e.signal&&Z_(e.signal,r),r}function Zr(t,e){if(typeof t!="function")throw new or("fn",["Function","AsyncFunction"],t);e!=null&<(e,"options"),(e==null?void 0:e.signal)!=null&&at(e.signal,"options.signal");let r=1;(e==null?void 0:e.concurrency)!=null&&(r=bl(e.concurrency));let i=r-1;return(e==null?void 0:e.highWaterMark)!=null&&(i=bl(e.highWaterMark)),pl(r,"options.concurrency",1),pl(i,"options.highWaterMark",0),i+=r,function(){return ee(this,null,function*(){let s=K().AbortSignalAny([e==null?void 0:e.signal].filter(rp)),o=this,a=[],l={signal:s},u,c,f=!1,h=0;function d(){f=!0,_()}function _(){h-=1,p()}function p(){c&&!f&&h<r&&a.length<i&&(c(),c=null)}async function y(){try{try{for(var m=Y(o),S,x,g;S=!(x=await m.next()).done;S=!1){let w=x.value;if(f)return;if(s.aborted)throw new xe;try{if(w=t(w,l),w===Yr)continue;w=sp(w)}catch(R){w=gl(R)}h+=1,ml(w,_,d),a.push(w),u&&(u(),u=null),!f&&(a.length>=i||h>=r)&&await new yl(R=>{c=R})}}catch(x){g=[x]}finally{try{S&&(x=m.return)&&await x.call(m)}finally{if(g)throw g[0]}}a.push(wl)}catch(w){let R=gl(w);ml(R,_,d),a.push(R)}finally{f=!0,u&&(u(),u=null)}}y();try{for(;;){for(;a.length>0;){let m=yield new W(a[0]);if(m===wl)return;if(s.aborted)throw new xe;m!==Yr&&(yield m),a.shift(),p()}yield new W(new yl(m=>{u=m}))}}finally{f=!0,c&&(c(),c=null)}})}.call(this)}function ap(t=void 0){return t!=null&<(t,"options"),(t==null?void 0:t.signal)!=null&&at(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 xe({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 El(t,e=void 0){try{for(var r=Y(Nn.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 lp(t,e=void 0){if(typeof t!="function")throw new or("fn",["Function","AsyncFunction"],t);return!await El.call(this,async(...r)=>!await t(...r),e)}async function up(t,e){try{for(var r=Y(Nn.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 fp(t,e){if(typeof t!="function")throw new or("fn",["Function","AsyncFunction"],t);async function r(a,l){return await t(a,l),Yr}try{for(var i=Y(Zr.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 Nn(t,e){if(typeof t!="function")throw new or("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n)?i:Yr}return Zr.call(this,r,e)}var An=class extends Q_{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function cp(t,e,r){var i;if(typeof t!="function")throw new or("reducer",["Function","AsyncFunction"],t);r!=null&<(r,"options"),(r==null?void 0:r.signal)!=null&&at(r.signal,"options.signal");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let d=new xe(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await K_(this.destroy(d)),d}let s=new W_,o=s.signal;if(r!=null&&r.signal){let d={once:!0,[V_]:this,[H_]:!0};r.signal.addEventListener("abort",()=>s.abort(),d)}let a=!1;try{try{for(var u=Y(this),c,f,h;c=!(f=await u.next()).done;c=!1){let d=f.value;var l;if(a=!0,r!=null&&(l=r.signal)!==null&&l!==void 0&&l.aborted)throw new xe;n?e=await t(e,d,{signal:o}):(e=d,n=!0)}}catch(f){h=[f]}finally{try{c&&(f=u.return)&&await f.call(u)}finally{if(h)throw h[0]}}if(!a&&!n)throw new An}finally{s.abort()}return e}async function dp(t){t!=null&<(t,"options"),(t==null?void 0:t.signal)!=null&&at(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 xe(void 0,{cause:t.signal.reason});tp(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 hp(t,e){let r=Zr.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 Sl(t){if(t=ip(t),np(t))return 0;if(t<0)throw new z_("number",">= 0",t);return t}function _p(t,e=void 0){return e!=null&<(e,"options"),(e==null?void 0:e.signal)!=null&&at(e.signal,"options.signal"),t=Sl(t),function(){return ee(this,null,function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new xe;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 xe;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 pp(t,e=void 0){return e!=null&<(e,"options"),(e==null?void 0:e.signal)!=null&&at(e.signal,"options.signal"),t=Sl(t),function(){return ee(this,null,function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new xe;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 xe;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)}vn.exports.streamReturningOperators={asIndexedPairs:ep(ap,"readable.asIndexedPairs will be removed in a future version."),drop:_p,filter:Nn,flatMap:hp,map:Zr,take:pp,compose:op};vn.exports.promiseReturningOperators={every:lp,forEach:fp,reduce:cp,toArray:dp,some:El,find:up}});var Pn=A((Gb,Rl)=>{"use strict";var{ArrayPrototypePop:bp,Promise:yp}=j(),{isIterable:gp,isNodeStream:mp,isWebStream:wp}=ye(),{pipelineImpl:xp}=Vr(),{finished:Ep}=je();jn();function Sp(...t){return new yp((e,r)=>{let i,n,s=t[t.length-1];if(s&&typeof s=="object"&&!mp(s)&&!gp(s)&&!wp(s)){let o=bp(t);i=o.signal,n=o.end}xp(t,(o,a)=>{o?r(o):e(a)},{signal:i,end:n})})}Rl.exports={finished:Ep,pipeline:Sp}});var jn=A((Qb,Fl)=>{"use strict";var{Buffer:Ip}=ce(),{ObjectDefineProperty:Fe,ObjectKeys:Nl,ReflectApply:vl}=j(),{promisify:{custom:Pl}}=K(),{streamReturningOperators:Tl,promiseReturningOperators:Al}=Il(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:jl}}=z(),Rp=Tn(),{setDefaultHighWaterMark:Tp,getDefaultHighWaterMark:Ap}=Zt(),{pipeline:Ll}=Vr(),{destroyer:Np}=tt(),Bl=je(),Ln=Pn(),ar=ye(),P=Fl.exports=Pr().Stream;P.isDestroyed=ar.isDestroyed;P.isDisturbed=ar.isDisturbed;P.isErrored=ar.isErrored;P.isReadable=ar.isReadable;P.isWritable=ar.isWritable;P.Readable=er();for(let t of Nl(Tl)){let r=function(...i){if(new.target)throw jl();return P.Readable.from(vl(e,this,i))},e=Tl[t];Fe(r,"name",{__proto__:null,value:e.name}),Fe(r,"length",{__proto__:null,value:e.length}),Fe(P.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of Nl(Al)){let r=function(...i){if(new.target)throw jl();return vl(e,this,i)},e=Al[t];Fe(r,"name",{__proto__:null,value:e.name}),Fe(r,"length",{__proto__:null,value:e.length}),Fe(P.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}P.Writable=Wr();P.Duplex=we();P.Transform=hn();P.PassThrough=pn();P.pipeline=Ll;var{addAbortSignal:vp}=Yt();P.addAbortSignal=vp;P.finished=Bl;P.destroy=Np;P.compose=Rp;P.setDefaultHighWaterMark=Tp;P.getDefaultHighWaterMark=Ap;Fe(P,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Ln}});Fe(Ll,Pl,{__proto__:null,enumerable:!0,get(){return Ln.pipeline}});Fe(Bl,Pl,{__proto__:null,enumerable:!0,get(){return Ln.finished}});P.Stream=P;P._isUint8Array=function(e){return e instanceof Uint8Array};P._uint8ArrayToBuffer=function(e){return Ip.from(e.buffer,e.byteOffset,e.byteLength)}});var Jr=A((zb,C)=>{"use strict";var k=jn(),Pp=Pn(),jp=k.Readable.destroy;C.exports=k.Readable;C.exports._uint8ArrayToBuffer=k._uint8ArrayToBuffer;C.exports._isUint8Array=k._isUint8Array;C.exports.isDisturbed=k.isDisturbed;C.exports.isErrored=k.isErrored;C.exports.isReadable=k.isReadable;C.exports.Readable=k.Readable;C.exports.Writable=k.Writable;C.exports.Duplex=k.Duplex;C.exports.Transform=k.Transform;C.exports.PassThrough=k.PassThrough;C.exports.addAbortSignal=k.addAbortSignal;C.exports.finished=k.finished;C.exports.destroy=k.destroy;C.exports.destroy=jp;C.exports.pipeline=k.pipeline;C.exports.compose=k.compose;Object.defineProperty(k,"promises",{configurable:!0,enumerable:!0,get(){return Pp}});C.exports.Stream=k.Stream;C.exports.default=C.exports});var Mp={};Un(Mp,{BaseIRI:()=>$e,BlankNode:()=>pt,DataFactory:()=>H,DefaultGraph:()=>yt,EntityIndex:()=>Ot,Lexer:()=>Me,Literal:()=>de,NamedNode:()=>He,Parser:()=>he,Quad:()=>Ne,Reasoner:()=>$t,Store:()=>Se,StoreFactory:()=>Mt,StreamParser:()=>kt,StreamWriter:()=>Ut,Term:()=>Q,Triple:()=>Ne,Util:()=>yr,Variable:()=>bt,Writer:()=>oe,default:()=>Op,getRulesFromDataset:()=>On,termFromId:()=>Te,termToId:()=>Ae});var fs=lr(ce());var Ve="http://www.w3.org/1999/02/22-rdf-syntax-ns#",_t="http://www.w3.org/2001/XMLSchema#",dr="http://www.w3.org/2000/10/swap/",v={xsd:{decimal:`${_t}decimal`,boolean:`${_t}boolean`,dateTime:`${_t}dateTime`,double:`${_t}double`,integer:`${_t}integer`,string:`${_t}string`},rdf:{type:`${Ve}type`,nil:`${Ve}nil`,first:`${Ve}first`,rest:`${Ve}rest`,langString:`${Ve}langString`,dirLangString:`${Ve}dirLangString`,reifies:`${Ve}reifies`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${dr}reify#forSome`,forAll:`${dr}reify#forAll`},log:{implies:`${dr}log#implies`,isImpliedBy:`${dr}log#isImpliedBy`}};var{xsd:hr}=v,Gt=32,Qt=9,di=10,zt=13,cs=35,us={"\\":"\\","'":"'",'"':'"',n:`
|
|
3
|
+
`,r:"\r",t:" ",f:"\f",b:"\b"},ju={_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","'":"'","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Lu=/[\x00-\x20<>\\"\{\}\|\^\`]/,Bu=/[\s<>"{}|^`]/g;function Fu(t){return t<=1114111&&(t<55296||t>57343)}var Cu={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_commentLine:!0,_whitespace:!0},Du=/$0^/,Ou=/\S*/y;function M(t,e,r){return t.lastIndex=r,t.exec(e)}function _r(t,e,r){return t.lastIndex=r,t.test(e)}function pr(t,e,r){return t.lastIndex=0,t.exec(`${e.slice(r)} `)}function Mu(t){return t===Gt||t===Qt||t===di||t===zt||t===cs}var Me=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 Cu)&&this[r]instanceof RegExp&&(this[r]=Du)}else this._n3Mode=e.n3!==!1;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===Gt||R===Qt){let U=i.charCodeAt(n+1);T=U===Gt||U===Qt?M(this._whitespace,i,n)[0].length:1,R=i.charCodeAt(n+T)}if(R===cs){let U=M(this._commentLine,i,n);if(U){let D=U[0].length;if(!r&&n+D===i.length&&i.charCodeAt(i.length-1)===zt)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===di||R===zt){if(!r&&R===zt&&n+T+1===i.length)return this._suspend(i,n,s);T+=R===zt&&i.charCodeAt(n+T+1)===di?2:1;let U=0,D=i.charCodeAt(n+T);if(D===Gt||D===Qt){let X=i.charCodeAt(n+T+1);U=X===Gt||X===Qt?M(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,c=i[n],f="",h="",d="",_=null,p=0,y=0,m=0,S=!1;switch(c){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(Mu(i.charCodeAt(n)))continue;S=!0;break}}else{this._n3Mode&&(p=1,f="^");break}case"<":if(_=M(this._unescapedIri,i,n))f="IRI",h=_[1],y=_[1].length+2;else if(_=M(this._iri,i,n)){if(h=this._unescape(_[1],us),h===null||Lu.test(h))return l(this,i,n);f="IRI",y=_[1].length+2}else i.length-n>2&&i[n+1]==="<"&&i[n+2]==="("?(f="<<(",p=3):!this._lineMode&&i.length-n>(r?1:2)&&i[n+1]==="<"?(f="<<",p=2):this._n3Mode&&i.length-n>1&&i[n+1]==="="?(p=2,this._isImpliedBy?(f="abbreviation",h="<"):(f="inverse",h=">")):this._n3Mode&&i.length-n>1&&i[n+1]==="-"&&(f="inversePredicate",p=2);break;case">":i.length-n>1&&i[n+1]===">"&&(f=">>",p=2);break;case"_":((_=M(this._blank,i,n))||r&&(_=pr(this._blank,i,n)))&&(f="blank",d="_",h=_[1],y=_[1].length+2);break;case'"':if(_=M(this._simpleQuotedString,i,n))h=_[1];else if({value:h,matchLength:p,finalLineLength:m}=this._parseLiteral(i,n),h===null)return l(this,i,n);(_!==null||p!==0)&&(f="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(_=M(this._simpleApostropheString,i,n))h=_[1];else if({value:h,matchLength:p,finalLineLength:m}=this._parseLiteral(i,n),h===null)return l(this,i,n);(_!==null||p!==0)&&(f="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(_=M(this._variable,i,n))&&(f="var",h=_[0]);break;case"@":if(this._previousMarker==="literal"&&(_=M(this._langcode,i,n))&&_[1]!=="version"){let R=n+_[0].length;!r&&i[R]==="-"&&i[R+1]!=="-"?_=null:(f="langcode",h=_[1])}else(_=M(this._atKeyword,i,n))&&(f=_[0]);break;case".":if(i.length-n===1?r:i[n+1]<"0"||i[n+1]>"9"){f=".",p=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":if(i[n+1]==="-"){this._previousMarker==="langcode"&&(i.startsWith("--ltr",n)?(f="dircode",h="ltr",p=5):i.startsWith("--rtl",n)&&(f="dircode",h="rtl",p=5));break}(_=M(this._number,i,n)||r&&(_=pr(this._number,i,n)))&&(f="literal",h=_[0],d=typeof _[1]=="string"?hr.double:typeof _[2]=="string"?hr.decimal:hr.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":case"V":case"v":(_=M(this._keyword,i,n))?f=_[0].toUpperCase():S=!0;break;case"f":case"t":_r(this._boolean,i,n)?(f="literal",h=c==="t"?"true":"false",d=hr.boolean,p=h.length):S=!0;break;case"a":_r(this._shortPredicates,i,n)?(f="abbreviation",h="a",p=1):S=!0;break;case"h":case"o":this._n3Mode&&(_=this._matchN3Verb(i,n,r))?f=_[0]:S=!0;break;case"i":this._n3Mode&&_r(this._n3Id,i,n)?(f="id",p=2):this._n3Mode&&(_=this._matchN3Verb(i,n,r))?f=_[0]:S=!0;break;case"=":this._n3Mode&&i.length-n>1&&(f="abbreviation",i[n+1]!==">"?(p=1,h="="):(p=2,h=">"));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]===">"){f=")>>",p=3;break}case",":case";":case"[":case"]":case"(":case"}":case"~":this._lineMode||(p=1,f=c);break;case"{":!this._lineMode&&i.length-n>=2&&(i[n+1]==="|"?(f="{|",p=2):(f=c,p=1));break;case"|":i.length-n>=2&&i[n+1]==="}"&&(f="|}",p=2);break;default:S=!0}if(S&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(_=M(this._prefix,i,n))?(f="prefix",h=_[1]||""):((_=M(this._prefixed,i,n))||r&&(_=pr(this._prefixed,i,n)))&&(f="prefixed",d=_[1]||"",h=this._unescape(_[2],ju),y=d.length+_[2].length+1)),this._previousMarker==="^^")switch(f){case"prefixed":f="type";break;case"IRI":f="typeIRI";break;default:f=""}if(!f)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=p||_[0].length,g=s-(i.length-n),w;m?(w={type:f,value:h,prefix:d,line:u,start:g,end:m,endLine:this._line},e(null,w)):w=a(f,h,d,u,g,y||x),this.previousToken=w,this._previousMarker=f,n=Math.min(n+x,i.length),m&&(s=i.length-n+m)}function o(u,c,f){e(null,{type:"comment",value:u,prefix:"",line:c,start:f,end:f+u.length+1})}function a(u,c,f,h,d,_){let p={type:u,value:c,prefix:f,line:h,start:d,end:d+_};return e(null,p),p}function l(u,c,f){e(u._syntaxError(M(Ou,c,f)[0]))}}_suspend(e,r,i){return this._linePosition=i-(e.length-r),this._input=e.slice(r)}_matchN3Verb(e,r,i){let n=M(this._n3Verb,e,r);if(!n)return null;let s=e[r+n[0].length];return s!=="-"&&s!=="_"&&(s<"0"||s>"9")?n:M(this._prefixed,e,r)?null:_r(Bu,e,r)?n:pr(this._prefixed,e,r)||!i&&M(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 c=i+2;c<a;c++){let f=e.charCodeAt(c);if(f>=48&&f<=57)f-=48;else if(f>=65&&f<=70)f-=55;else if(f>=97&&f<=102)f-=87;else return null;u=u*16+f}if(!Fu(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/),c=u.length-1,f=o-r+n;if(n===1&&c!==0||n===3&&this._lineMode)break;this._line+=c;let h=c===0?0:u[u.length-1].length+n;return{value:this._unescape(l,us),matchLength:f,finalLineLength:h}}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 this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",n=>{this._tokenization===i&&this._input!==null&&n.length!==0&&(this._pendingBuffer&&(n=fs.Buffer.concat([this._pendingBuffer,n]),this._pendingBuffer=null),n[n.length-1]&128?this._pendingBuffer=n:(typeof this._input=="undefined"?this._input=this._readStartingBom(typeof n=="string"?n:n.toString()):this._input+=n,this._tokenizeToEnd(r,!1)))}),e.on("end",()=>{this._tokenization===i&&typeof this._input=="string"&&this._tokenizeToEnd(r,!0)}),e.on("error",n=>{this._tokenization===i&&r(n)})}};var{rdf:ds,xsd:Re}=v,gt,$u=0,pi="<>";var hi={namedNode:hs,blankNode:_s,variable:bs,literal:ps,defaultGraph:ku,quad:_i,triple:_i,fromTerm:Vt,fromQuad:ys},H=hi,Q=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}}},He=class extends Q{constructor(e){e!==""?super(e):(super(pi),Object.defineProperty(this,"value",{value:""}))}get termType(){return"NamedNode"}},de=class t extends Q{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 He(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!=="@"?Re.string:e.indexOf("--",r)>0?ds.dirLangString:ds.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}}}},pt=class extends Q{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},bt=class extends Q{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},yt=class extends Q{constructor(){return super(""),gt||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};gt=new yt;function Te(t,e,r){if(e=e||hi,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===hi)return new de(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===pi)return e.namedNode("");default:if(!r||!Array.isArray(t))return e.namedNode(t)}return e.quad(Te(t[0],e,!0),Te(t[1],e,!0),Te(t[2],e,!0),t[3]&&Te(t[3],e,!0))}function Ae(t,e){if(typeof t=="string")return t;if(t instanceof Q&&t.termType!=="Quad")return t.id;if(!t)return gt.id;switch(t.termType){case"NamedNode":{let i=t.value;return i!==""?i:pi}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!==Re.string?`^^${t.datatype.value}`:""}`;case"Quad":let r=[Ae(t.subject,!0),Ae(t.predicate,!0),Ae(t.object,!0)];return t.graph&&t.graph.termType!=="DefaultGraph"&&r.push(Ae(t.graph,!0)),e?r:JSON.stringify(r);default:throw new Error(`Unexpected termType: ${t.termType}`)}}var Ne=class extends Q{constructor(e,r,i,n){super(""),this._subject=e,this._predicate=r,this._object=i,this._graph=n||gt}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 hs(t){return new He(t)}function _s(t){return new pt(t||`n3-${$u++}`)}function ps(t,e){if(typeof e=="string")return new de(`"${t}"@${e.toLowerCase()}`);if(e!==void 0&&!("termType"in e))return new de(`"${t}"@${e.language.toLowerCase()}${e.direction?`--${e.direction.toLowerCase()}`:""}`);let r=e?e.value:"";return r===""&&(typeof t=="boolean"?r=Re.boolean:typeof t=="number"?Number.isFinite(t)?r=Number.isInteger(t)&&Math.abs(t)<1e21?Re.integer:Re.double:(r=Re.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")):typeof t=="bigint"?r=Re.integer:t instanceof Date&&!Number.isNaN(t.getTime())&&(r=Re.dateTime,t=t.toISOString())),r===""||r===Re.string?new de(`"${t}"`):new de(`"${t}"^^${r}`)}function bs(t){return new bt(t)}function ku(){return gt}function _i(t,e,r,i){return new Ne(t,e,r,i)}function Vt(t){if(t instanceof Q)return t;switch(t.termType){case"NamedNode":return hs(t.value);case"BlankNode":return _s(t.value);case"Variable":return bs(t.value);case"DefaultGraph":return gt;case"Literal":return ps(t.value,t.language?t.direction?{language:t.language,direction:t.direction}:t.language:t.datatype);case"Quad":return ys(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function ys(t){if(t instanceof Ne)return t;if(t.termType!=="Quad")throw new Error(`Unexpected termType: ${t.termType}`);return _i(Vt(t.subject),Vt(t.predicate),Vt(t.object),Vt(t.graph))}var gs=0,he=class t{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&ws(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;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,this._emptyFormulaAsTrue=!!e.emptyFormulaAsTrue,l&&(this._resolveRelativeIRI=c=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new Me({lineMode:l,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers,this._formulaScopedBlankNodes=!!e.formulaScopedBlankNodes,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(){gs=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&&(ms(this._prefixes,this._prefixChanges),this._prefixChanges=i.prefixChanges),this._prefixes._=i.blankPrefix,this._quantifiedChanges!==i.quantifiedChanges&&(ms(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._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===v.rdf.langString||s.value===v.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=br}_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,c;r&&(r.onQuad||r.onPrefix||r.onComment||r.onVersion||r.onToken||r.onTokenEnd)?(s=r.onQuad,o=r.onPrefix,a=r.onComment,l=r.onVersion,u=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${gs++}_`,this._n3Mode&&this._implicitEmptyPrefix&&this._base&&(this._prefixes[""]=this._resolveIRI("#")),this._prefixCallback=o||br,this._versionCallback=l||br,this._inversePredicate=!1,this._expectOf=!1,this._quantified=Object.create(null),this._prefixChanges=null,this._quantifiedChanges=null,this._emptyFormula=!1,this._tripleTermDepth=0;let f=d=>this._readCallback=this._readCallback(d);if(a||this._lexer.comments){this._lexer.comments=!0;let d=f;f=_=>_.type!=="comment"?d(_):(a&&a(_.value),this._readCallback)}if(u||c){let d=f;f=_=>{try{try{return u&&u(_),d(_)}finally{c&&c(_)}}catch(p){throw this._readCallback=null,p}}}if(!s){let d=[],_;if(this._callback=(p,y)=>{p?_=p:y&&d.push(y)},this._lexer.tokenize(e).every(f),_)throw _;return d}let h=(d,_)=>{d!==null?(this._callback(d),this._callback=br):this._readCallback&&f(_)};this._callback=s,this._lexer.tokenize(e,h)}};function ms(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 br(){}function ws(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(v.rdf.first),t.RDF_REST=e.namedNode(v.rdf.rest),t.RDF_NIL=e.namedNode(v.rdf.nil),t.RDF_REIFIES=e.namedNode(v.rdf.reifies),t.N3_FORALL=e.namedNode(v.r.forAll),t.N3_FORSOME=e.namedNode(v.r.forSome),t.N3_TRUE=e.literal("true",e.namedNode(v.xsd.boolean)),t.ABBREVIATIONS={a:e.namedNode(v.rdf.type),"=":e.namedNode(v.owl.sameAs),">":e.namedNode(v.log.implies),"<":e.namedNode(v.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}he.SUPPORTED_VERSIONS=["1.2","1.2-basic","1.1"];ws(he.prototype,H);var yr={};Un(yr,{inDefaultGraph:()=>zu,isBlankNode:()=>qu,isDefaultGraph:()=>se,isLiteral:()=>Wu,isNamedNode:()=>Uu,isQuad:()=>Qu,isVariable:()=>Gu,prefix:()=>Vu,prefixes:()=>xs});function Uu(t){return!!t&&t.termType==="NamedNode"}function qu(t){return!!t&&t.termType==="BlankNode"}function Wu(t){return!!t&&t.termType==="Literal"}function Gu(t){return!!t&&t.termType==="Variable"}function Qu(t){return!!t&&t.termType==="Quad"}function se(t){return!!t&&t.termType==="DefaultGraph"}function zu(t){return se(t.graph)}function Vu(t,e){return xs({"":t.value||t},e)("")}function xs(t,e){let r=Object.create(null);for(let n in t)i(n,t[n]);e=e||H;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 Ke(t){return t.replace(/[.*+?^${}()|[\]\\/-]/g,"\\$&")}var Hu=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Ku=/^(?:(?!\.\.?(?:[/?#]|$))[^/?#]+(?:\/[^/?#]{3,})*\/?)?(?:[?#]|$)/,Es="./",Yu="../",bi="?",Ss="#",$e=class t{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!Hu.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!t.supports(this.base))return this._baseMatcher=/.^/;let e=/^[^:]*:\/*/.exec(this.base)[0],r=["^",Ke(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]===Ss?l=s.lastIndex-1:(r.push(Ke(o[0]),"(?:"),i.push(")?"),o[1]!==bi?n.push(u=s.lastIndex):(a=u=s.lastIndex,l=this.base.indexOf(Ss,a),this._pathReplacements[a]=bi));for(let c=0;c<n.length;c++)this._pathReplacements[n[c]]=Yu.repeat(n.length-c-1);return this._pathReplacements[n[n.length-1]]=Es,this._baseLength=l>0?l:this.base.length,r.push(Ke(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!==bi&&!Ku.test(s)?e:n===Es&&/^[^?#]/.test(s)&&(s.indexOf(":")<0||!/^[^/?#]*:/.test(s))?s:n+s}return e.substring(i-1)}};var Ht=H.defaultGraph(),{rdf:Zu,xsd:mt}=v,Ju=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,Xu=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,ef=/[^ !#-\[\]-~\u0080-\uFFFD]/,tf=/[^ !#-\[\]-~\u0080-\uFFFD]/g,Is={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"},Ye=class extends Q{equals(e){return e===this}},oe=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=ef,this._escapeAll=tf,this._characterReplacer=nf):(this._lineMode=!1,this._escape=Ju,this._escapeAll=Xu,this._characterReplacer=rf,this._graph=Ht,this._prefixIRIs=Object.create(null),this._prefixPatterns=Object.create(null),r.baseIRI&&(this._baseIri=new $e(r.baseIRI),r.writeBase&&this._write(`@base <${r.baseIRI}>.
|
|
4
|
+
`)),r.prefixes&&this.addPrefixes(r.prefixes))}get _inDefaultGraph(){return Ht.equals(this._graph)}_write(e,r){this._outputStream.write(e,"utf8",r)}_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?`.
|
|
5
5
|
`:`
|
|
6
6
|
}
|
|
7
|
-
`)+(
|
|
7
|
+
`)+(Ht.equals(n)?"":`${this._encodeIriOrBlank(n)} {
|
|
8
8
|
`)),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
9
|
${this._encodePredicate(this._predicate=r)} ${this._encodeObject(i)}`,s):this._write(`${(this._subject===null?"":`.
|
|
10
|
-
`)+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&&!
|
|
10
|
+
`)+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
11
|
`:` .
|
|
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&&e.value in this._lists&&(e=this.list(this._lists[e.value])),e instanceof
|
|
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&&e.value in this._lists&&(e=this.list(this._lists[e.value])),e instanceof Q?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.exec(r):null;return i?i[1]?this._prefixIRIs[i[1]]+i[2]:r:`<${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===mt.string)return`"${r}"`}else switch(e.datatype.value){case mt.string:return`"${r}"`;case mt.boolean:if(r==="true"||r==="false")return r;break;case mt.integer:if(/^[+-]?\d+$/.test(r))return r;break;case mt.decimal:if(/^[+-]?\d*\.\d+$/.test(r))return r;break;case mt.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===Zu.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._subject!==null&&(this._write(this._inDefaultGraph?`.
|
|
13
13
|
`:`
|
|
14
14
|
}
|
|
15
|
-
`),this._subject=null,this._graph=""),this._prefixIRIs[s]=n+=":",this._prefixPatterns[s]=[
|
|
15
|
+
`),this._subject=null,this._graph=""),this._prefixIRIs[s]=n+=":",this._prefixPatterns[s]=[Ke(s),Ke(n)],this._write(`@prefix ${n} <${s}>.
|
|
16
16
|
`)}if(i){this._hasPrefixes=!0;let n="",s="";for(let o in this._prefixPatterns){let[a,l]=this._prefixPatterns[o];n+=n?`|${a}`:a,s+=s?`|${l}`:l}this._prefixRegex=new RegExp(`^(?:${s})[^/]*$|^(${n})([_a-zA-Z0-9](?:\\.?[\\-_a-zA-Z0-9])*)$`)}this._write(i?`
|
|
17
|
-
`:"",r)}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
|
|
17
|
+
`:"",r)}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 Ye("[]");case 1:if(n=i[0],!(n.object instanceof Ye))return new Ye(`[ ${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
18
|
`:`
|
|
19
|
-
`)+this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)}`,e=n.predicate);return new
|
|
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
|
|
19
|
+
`)+this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)}`,e=n.predicate);return new Ye(`${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 Ye(`(${i.join(" ")})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
|
|
21
21
|
`:`
|
|
22
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 Ju(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 ef(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 Xr=ar(Zr());var Ft=Symbol("iter"),B=Symbol("size"),jn;function Np({store:t,observer:e}){let r=t.deref();r&&r._removeObserver(e)}function Ln(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[B]||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[B]=i),t}function Cl(t,e,r=4){let i=!1,n=0;r<=2&&e[B]<t[B]&&([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[B]=n),i}function Dl(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=Dl(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[B]=n),i}var Dt=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||K}_termFromId(e){if(e[0]==="."){let r=this._entities,i=e.split(".");return this._factory.quad(this._termFromId(r[i[1]]),this._termFromId(r[i[2]]),this._termFromId(r[i[3]]),i[4]&&this._termFromId(r[i[4]]))}return Te(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&&(he(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${r}.${i}.${n}.${s}`:`.${r}.${i}.${n}`]}return this._ids[O(e)]}_termToNewNumericId(e){let r=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${he(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:O(e);return this._ids[r]||(this._ids[this._entities[++this._id]=r]=this._id)}createBlankNode(e){let r,i;if(e)for(r=e=`_:${e}`,i=1;this._ids[r];)r=e+i++;else do r=`_:b${this._blankNodeIndex++}`;while(this._ids[r]);return this._ids[r]=++this._id,this._entities[this._id]=r,this._factory.blankNode(r.substr(2))}},Se=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||K,this._matchSemantics=Bn(r.matchSemantics),this._entityIndex=r.entityIndex||new Dt({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][B];return this._size=e}_addToIndex(e,r,i,n){let s=e[r];s||(e[r]=s={[B]:0},e[B]++);let o=s[i];o||(s[i]=o={[B]:0},s[B]++);let a=n in o;return a||(o[n]=null,o[B]++),!a}_removeFromIndex(e,r,i,n){let s=e[r],o=s[i];delete o[n],--o[B]===0&&(delete s[i],--s[B]===0&&(delete e[r],e[B]--))}*_findInIndex(e,r,i,n,s,o,a,l){let u=this._entities,c=this._termFromId(u[l]),f={subject:null,predicate:null,object:null};if(n){let d=e[r],_=d&&d[i];if(!_||!(n in _))return;f[s]=this._termFromId(u[r]),f[o]=this._termFromId(u[i]),f[a]=this._termFromId(u[n]),yield this._factory.quad(f.subject,f.predicate,f.object,c);return}if(r&&!(r in e))return;let h=r?null:Object.keys(e);for(let d=0,_=r||h[0];_;_=h&&h[++d]){let p=e[_];if(!p)continue;if(f[s]=this._termFromId(u[_]),i&&!(i in p))return;let y=i?null:Object.keys(p);for(let m=0,S=i||y[0];S;S=y&&y[++m]){let x=p[S];if(!x)continue;f[o]=this._termFromId(u[S]);let g=Object.keys(x);for(let w=0;w<g.length;w++)f[a]=this._termFromId(u[g[w]]),yield this._factory.quad(f.subject,f.predicate,f.object,c)}}}_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[B]:0;let u=Object.keys(o);for(let c=0;c<u.length;c++)s+=o[u[c]][B];return s}let l=Object.keys(e);for(let u=0;u<l.length;u++){o=e[l[u]];let c=Object.keys(o);for(let f=0;f<c.length;f++)s+=o[c[f]][B]}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(jn||(jn=new FinalizationRegistry(Np))).register(e,{store:new WeakRef(this),observer:r},r),(this._observers||(this._observers=new Set)).add(r),r}_removeObserver(e){jn.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:{[B]:0},predicates:{[B]:0},objects:{[B]:0}},Object.freeze(s)),this._observers!==null){if(Ln(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===""||he(n)?1:this._termToNumericId(n),u=l&&this._graphs[l];return!!s&&!!o&&!!a&&!!u&&Ln(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||!Ln(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[B]===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 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 c in s)(o=s[c])&&(a?u?yield*ne(this._findInIndex(o.objects,u,a,l,"object","subject","predicate",c)):yield*ne(this._findInIndex(o.subjects,a,l,null,"subject","predicate","object",c)):l?yield*ne(this._findInIndex(o.predicates,l,u,null,"predicate","object","subject",c)):u?yield*ne(this._findInIndex(o.objects,u,null,null,"object","subject","predicate",c)):yield*ne(this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",c)))}match(e,r,i,n,s=null){return new We(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,c;if(e&&!(l=this._termToNumericId(e))||r&&!(u=this._termToNumericId(r))||i&&!(c=this._termToNumericId(i)))return 0;for(let f in s)(a=s[f])&&(e?i?o+=this._countInIndex(a.objects,c,l,u):o+=this._countInIndex(a.subjects,l,u,c):r?o+=this._countInIndex(a.predicates,u,c,l):o+=this._countInIndex(a.objects,c,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=[],c=!1,f=!1,h,d,_=l.graph,p=[],y=l.subject;for(;y&&!c;){let m=this.getQuads(null,null,y,null),S=this.getQuads(y,null,null,null),x,g=null,w=null,R=null;for(let T=0;T<S.length&&!c;T++)x=S[T],x.graph.equals(_)?h?c=s(y,"has non-list arcs out"):x.predicate.value===N.rdf.first?(g?c=s(y,"has multiple rdf:first arcs"):g=x,e&&g===x&&p.push(x)):x.predicate.value===N.rdf.rest?(w?c=s(y,"has multiple rdf:rest arcs"):w=x,e&&w===x&&p.push(x)):m.length?i?f=!0:c=s(y,`has non-list arc ${x.predicate.value}`):(h=x,d="subject"):c=s(y,"not confined to single graph");for(let T=0;T<m.length&&!c;++T)x=m[T],h?c=s(y,"can't have coreferences"):x.predicate.value===N.rdf.rest?R?c=s(y,"has incoming rdf:rest arcs"):R=x:(h=x,d="object");g?u.push(g.object):c=s(y,"has no list head"),y=R&&R.subject}if(c)e=!1;else if(u.reverse(),h&&(n[h[d].value]=u),e&&!f)for(let m=0;m<p.length;m++)a.push(p[m])}),e&&this.removeQuads(a),n}addAll(e){if(e instanceof We&&(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 We&&(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 c in s=i[u].subjects){if(!(o=n[c]))return!1;for(let f in a=s[c]){if(!(l=o[f]))return!1;for(let h in a[f])if(!(h 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 We&&(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=Dl(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 We&&(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 We&&(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 se().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 Ee(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:Ee(t[o],e,r+1);a!==!1&&(n=n||Object.create(null),n[o]=a,s++)}return n&&(n[B]=s),n}function Bl(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,c,f,h,d;l&&(o||!a)?(u="objects",[c,f,h]=[l,o,a],d=[2,0,1]):!o&&a?(u="predicates",[c,f,h]=[a,l,o],d=[1,2,0]):(u="subjects",[c,f,h]=[o,a,l],d=[0,1,2]);let _=t._getGraphs(n),p=[];for(let y in _){let m=_[y][u],S=Number(y);for(let x in c?{[c]:m[c]}:m){let g=m[x];if(g){p[d[0]]=Number(x);for(let w in f?{[f]:g[f]}:g){let R=g[w];if(R){p[d[1]]=Number(w);for(let T in h?h in R?{[h]:null}:{}:R)p[d[2]]=Number(T),s.ids.push(p[0],p[1],p[2],S)}}}}}return s}function*Pp({store:t,ids:e},r){let i=t._entities,n,s,o,a,l,u,c,f;for(let h=r*4;h<e.length;h+=4)l!==e[h]&&(n=t._termFromId(i[l=e[h]])),u!==e[h+1]&&(s=t._termFromId(i[u=e[h+1]])),c!==e[h+2]&&(o=t._termFromId(i[c=e[h+2]])),f!==e[h+3]&&(a=t._termFromId(i[f=e[h+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 Fl(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||O(n)===O(s))r[i]=n;else return!1}return r}var We=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 Se({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===""||he(l)?1:u._termToNumericId(l)))}_matchesQuad(e){let{subject:r,predicate:i,object:n,graph:s}=this;return!this._matchesNothing&&(r==null||O(r)===O(e.subject))&&(i==null||O(i)===O(e.predicate))&&(n==null||O(n)===O(e.object))&&(s==null||O(s)===O(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?Bl(this._filtered):Bl(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 Se({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 c=e._getGraphs(r);for(let f in c){let h,d,_,p;(p=c[f])&&(!a&&l?(d=Ee(p.predicates,[l,u,a]))&&(h=Ee(p.subjects,[a,l,u]),_=Ee(p.objects,[u,a,l])):u?(_=Ee(p.objects,[u,a,l]))&&(h=Ee(p.subjects,[a,l,u]),d=Ee(p.predicates,[l,u,a])):(h=Ee(p.subjects,[a,l,u]))&&(d=Ee(p.predicates,[l,u,a]),_=Ee(p.objects,[u,a,l])),h&&(o._graphs[f]={subjects:h,predicates:d,objects:_}))}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=Fl([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 se().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&&Fl([this.subject,this.predicate,this.object,this.graph],[e,r,i,n]),[l,u,c,f]=a||[null,null,null,null];return new t(this.n3Store,l,u,c,f,{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(Pp(e.snapshot,i)))}finally{r.return(),--e.count===0&&(e.snapshot=null,this._readers===e&&(this._readers=null))}}};var Ot=class{dataset(e){return new Se(e)}};function Cn(t){let e=[];for(let{subject:r,object:i}of t.match(null,K.namedNode("http://www.w3.org/2000/10/swap/log#implies"),null,K.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 Mt=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,c=r[e.premise[n].content],f=n===e.premise.length-1;if(!(s=a.value)){for(s in c)o=c[s],a.value=Number(s),this._evaluateLevel1(e,r,i,n,f,l,u,o);a.value=null}else(o=c[s])&&this._evaluateLevel1(e,r,i,n,f,l,u,o)}_evaluateLevel1(e,r,i,n,s,o,a,l){let u,c;if(!(u=o.value)){for(u in l)c=l[u],o.value=Number(u),this._evaluateLevel2(e,r,i,n,s,a,c);o.value=null}else(c=l[u])&&this._evaluateLevel2(e,r,i,n,s,a,c)}_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,c]=o,f=c.basePremise.subject.value;f||(c.basePremise.subject.value=a);let h=c.basePremise.predicate.value;h||(c.basePremise.predicate.value=l);let d=c.basePremise.object.value;d||(c.basePremise.object.value=u),c.premise.length===0?s(c.conclusion):this._evaluatePremise(c,r,n),f||(c.basePremise.subject.value=null),h||(c.basePremise.predicate.value=null),d||(c.basePremise.object.value=null)}}_createRule({premise:e,conclusion:r}){let i={},n=o=>o.termType==="Variable"?i[o.value]=i[o.value]||{}:{value:this._store._termToNewNumericId(o)},s=o=>({subject:n(o.subject),predicate:n(o.predicate),object:n(o.object)});return{premise:e.map(o=>s(o)),conclusion:r.map(o=>s(o)),variables:Object.values(i)}}reason(e){this._derivations=0,Array.isArray(e)||(e=Cn(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(Fn(o.subject,a.subject)&&Fn(o.predicate,a.predicate)&&Fn(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 c=0;c<n.premise.length;c++)c!==s&&u.push(Ol(n.premise[c],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 Fn(t,e){return t.value===null&&(t.value=e.value),t.value===e.value}var Ml=ar(Zr());var $t=class extends Ml.Transform{constructor(e){super({decodeStrings:!0,readableObjectMode:!0});let r=new de(e),i,n,s={onQuad:(o,a)=>{o&&this.emit("error",o)||a&&this.push(a)},onPrefix:(o,a)=>{this.emit("prefix",o,a)}};e&&e.comments&&(s.onComment=o=>{this.emit("comment",o)}),r.parse({on:(o,a)=>{switch(o){case"data":i=a;break;case"end":n=a;break}}},s),this._transform=(o,a,l)=>{i(o),l()},this._flush=o=>{n(),o()}}import(e){return e.on("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=ar(Zr());var jp=16*1024,Lp=20,kt=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:Lp;let r=this._writer=new se({write:(s,o,a)=>{this._buffer+=s,this._buffer.length>=jp?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 Bp={Lexer:Oe,Parser:de,Writer:se,Store:Se,StoreFactory:Ot,EntityIndex:Dt,StreamParser:$t,StreamWriter:kt,Util:br,Reasoner:Mt,BaseIRI:Me,DataFactory:K,Term:z,NamedNode:Ve,Literal:ce,BlankNode:_t,Variable:pt,DefaultGraph:bt,Quad:Ae,Triple:Ae,termFromId:Te,termToId:O};return Kl(Fp);})();
|
|
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 rf(t){let e=Is[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 nf(t){let e=Is[t];return e===void 0&&(e=t.charCodeAt(0).toString(16).toUpperCase(),e="\\u0000".substr(0,6-e.length)+e),e}var ei=lr(Jr());var Ct=Symbol("iter"),B=Symbol("size"),Bn;function Lp({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 Dt(t,e,r=4){let i=t[B]||0;for(let n in e)n in t?r!==0&&Dt(t[n],e[n],r-1):(i++,t[n]=r===0?null:Dt(Object.create(null),e[n],r-1));return r<=2&&(t[B]=i),t}function Ol(t,e,r=4){let i=!1,n=0;r<=2&&e[B]<t[B]&&([t,e]=[e,t]);for(let s in t)if(s in e){let o=r===0?null:Ol(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[B]=n),i}function Ml(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:Dt({},t[s],r-1),n++;else if(r!==0){let o=Ml(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[B]=n),i}var Bp=/^[?_"[.<]/;function J(t){if(typeof t=="string")return t.charCodeAt(0)!==60||t==="<>"?t:`<${t}>`;let e=Ae(t);return e.charCodeAt(0)>=97||!t?e:t.termType==="Quad"?JSON.stringify($l(t)):t.termType!=="NamedNode"||!Bp.test(t.value)?e:`<${t.value}>`}function $l(t){let e=[Xr(t.subject),Xr(t.predicate),Xr(t.object)];return t.graph&&!se(t.graph)&&e.push(Xr(t.graph)),e}function Xr(t){return t.termType==="Quad"?$l(t):J(t)}var Ot=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||H}_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 Te(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))}},Se=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||H,this._matchSemantics=Cn(r.matchSemantics),this._entityIndex=r.entityIndex||new Ot({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][B];return this._size=e}_addToIndex(e,r,i,n){let s=e[r];s||(e[r]=s={[B]:0},e[B]++);let o=s[i];o||(s[i]=o={[B]:0},s[B]++);let a=n in o;return a||(o[n]=null,o[B]++),!a}_removeFromIndex(e,r,i,n){let s=e[r],o=s[i];delete o[n],--o[B]===0&&(delete s[i],--s[B]===0&&(delete e[r],e[B]--))}*_findInIndex(e,r,i,n,s,o,a,l){let u=this._entities,c=this._termFromId(u[l]),f={subject:null,predicate:null,object:null};if(n){let d=e[r],_=d&&d[i];if(!_||!(n in _))return;f[s]=this._termFromId(u[r]),f[o]=this._termFromId(u[i]),f[a]=this._termFromId(u[n]),yield this._factory.quad(f.subject,f.predicate,f.object,c);return}if(r&&!(r in e))return;let h=r?null:Object.keys(e);for(let d=0,_=r||h[0];_;_=h&&h[++d]){let p=e[_];if(!p)continue;if(f[s]=this._termFromId(u[_]),i&&!(i in p))return;let y=i?null:Object.keys(p);for(let m=0,S=i||y[0];S;S=y&&y[++m]){let x=p[S];if(!x)continue;f[o]=this._termFromId(u[S]);let g=Object.keys(x);for(let w=0;w<g.length;w++)f[a]=this._termFromId(u[g[w]]),yield this._factory.quad(f.subject,f.predicate,f.object,c)}}}_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[B]:0;let u=Object.keys(o);for(let c=0;c<u.length;c++)s+=o[u[c]][B];return s}let l=Object.keys(e);for(let u=0;u<l.length;u++){o=e[l[u]];let c=Object.keys(o);for(let f=0;f<c.length;f++)s+=o[c[f]][B]}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(Bn||(Bn=new FinalizationRegistry(Lp))).register(e,{store:new WeakRef(this),observer:r},r),(this._observers||(this._observers=new Set)).add(r),r}_removeObserver(e){Bn.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:{[B]:0},predicates:{[B]:0},objects:{[B]: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[B]===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 ei.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 c in s)(o=s[c])&&(a?u?yield*ne(this._findInIndex(o.objects,u,a,l,"object","subject","predicate",c)):yield*ne(this._findInIndex(o.subjects,a,l,null,"subject","predicate","object",c)):l?yield*ne(this._findInIndex(o.predicates,l,u,null,"predicate","object","subject",c)):u?yield*ne(this._findInIndex(o.objects,u,null,null,"object","subject","predicate",c)):yield*ne(this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",c)))}match(e,r,i,n,s=null){return new Ge(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,c;if(e&&!(l=this._termToNumericId(e))||r&&!(u=this._termToNumericId(r))||i&&!(c=this._termToNumericId(i)))return 0;for(let f in s)(a=s[f])&&(e?i?o+=this._countInIndex(a.objects,c,l,u):o+=this._countInIndex(a.subjects,l,u,c):r?o+=this._countInIndex(a.predicates,u,c,l):o+=this._countInIndex(a.objects,c,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,v.rdf.rest,v.rdf.nil,null),a=[];return o.forEach(l=>{let u=[],c=!1,f=!1,h,d,_=l.graph,p=[],y=l.subject;for(;y&&!c;){let m=this.getQuads(null,null,y,null),S=this.getQuads(y,null,null,null),x,g=null,w=null,R=null;for(let T=0;T<S.length&&!c;T++)x=S[T],x.graph.equals(_)?h?c=s(y,"has non-list arcs out"):x.predicate.value===v.rdf.first?(g?c=s(y,"has multiple rdf:first arcs"):g=x,e&&g===x&&p.push(x)):x.predicate.value===v.rdf.rest?(w?c=s(y,"has multiple rdf:rest arcs"):w=x,e&&w===x&&p.push(x)):m.length?i?f=!0:c=s(y,`has non-list arc ${x.predicate.value}`):(h=x,d="subject"):c=s(y,"not confined to single graph");for(let T=0;T<m.length&&!c;++T)x=m[T],h?c=s(y,"can't have coreferences"):x.predicate.value===v.rdf.rest?R?c=s(y,"has incoming rdf:rest arcs"):R=x:(h=x,d="object");g?u.push(g.object):c=s(y,"has no list head"),y=R&&R.subject}if(c)e=!1;else if(u.reverse(),h&&(n[h[d].value]=u),e&&!f)for(let m=0;m<p.length;m++)a.push(p[m])}),e&&this.removeQuads(a),n}addAll(e){if(e instanceof Ge&&(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=Dt(this._graphs,e._graphs),this._size=null);else for(let r of e)this.add(r);return this}contains(e){if(e instanceof Ge&&(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 c in s=i[u].subjects){if(!(o=n[c]))return!1;for(let f in a=s[c]){if(!(l=o[f]))return!1;for(let h in a[f])if(!(h 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 Ge&&(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=Ml(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 Ge&&(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 Ge&&(e=e.filtered),e===this){let r=new t({entityIndex:this._entityIndex});return r._graphs=Dt(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=Ol(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 oe().quadsToString(this)}union(e){let r=new t({entityIndex:this._entityIndex});return r._graphs=Dt(Object.create(null),this._graphs),r._size=this._size,r.addAll(e),r}[Symbol.iterator](){return this.readQuads()}};function Ee(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:Ee(t[o],e,r+1);a!==!1&&(n=n||Object.create(null),n[o]=a,s++)}return n&&(n[B]=s),n}function Cl(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,c,f,h,d;l&&(o||!a)?(u="objects",[c,f,h]=[l,o,a],d=[2,0,1]):!o&&a?(u="predicates",[c,f,h]=[a,l,o],d=[1,2,0]):(u="subjects",[c,f,h]=[o,a,l],d=[0,1,2]);let _=t._getGraphs(n),p=[];for(let y in _){let m=_[y][u],S=Number(y);for(let x in c?{[c]:m[c]}:m){let g=m[x];if(g){p[d[0]]=Number(x);for(let w in f?{[f]:g[f]}:g){let R=g[w];if(R){p[d[1]]=Number(w);for(let T in h?h in R?{[h]:null}:{}:R)p[d[2]]=Number(T),s.ids.push(p[0],p[1],p[2],S)}}}}}return s}function*Fp({store:t,ids:e},r){let i=t._entities,n,s,o,a,l,u,c,f;for(let h=r*4;h<e.length;h+=4)l!==e[h]&&(n=t._termFromId(i[l=e[h]])),u!==e[h+1]&&(s=t._termFromId(i[u=e[h+1]])),c!==e[h+2]&&(o=t._termFromId(i[c=e[h+2]])),f!==e[h+3]&&(a=t._termFromId(i[f=e[h+3]])),yield t._factory.quad(n,s,o,a)}function Cn(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 Dl(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 Ge=class t extends ei.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=Cn(o.matchSemantics);o.matchesNothing&&(this._matchesNothing=!0,this._filtered=new Se({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?Cl(this._filtered):Cl(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 Se({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 c=e._getGraphs(r);for(let f in c){let h,d,_,p;(p=c[f])&&(!a&&l?(d=Ee(p.predicates,[l,u,a]))&&(h=Ee(p.subjects,[a,l,u]),_=Ee(p.objects,[u,a,l])):u?(_=Ee(p.objects,[u,a,l]))&&(h=Ee(p.subjects,[a,l,u]),d=Ee(p.predicates,[l,u,a])):(h=Ee(p.subjects,[a,l,u]))&&(d=Ee(p.predicates,[l,u,a]),_=Ee(p.objects,[u,a,l])),h&&(o._graphs[f]={subjects:h,predicates:d,objects:_}))}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Ct]&&(this[Ct]=this[Symbol.iterator]());let r=this[Ct];for(;--e>=0;){let{done:i,value:n}=r.next();if(i){this.push(null);return}this.push(n)}}_destroy(e,r){this[Ct]&&(this[Ct].return(),this[Ct]=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=Dl([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"?ei.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 oe().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&&(Cn(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&&Dl([this.subject,this.predicate,this.object,this.graph],[e,r,i,n]),[l,u,c,f]=a||[null,null,null,null];return new t(this.n3Store,l,u,c,f,{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(Fp(e.snapshot,i)))}finally{r.return(),--e.count===0&&(e.snapshot=null,this._readers===e&&(this._readers=null))}}};var Mt=class{dataset(e){return new Se(e)}};function On(t){let e=[];for(let{subject:r,object:i}of t.match(null,H.namedNode("http://www.w3.org/2000/10/swap/log#implies"),null,H.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 $t=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,c=r[e.premise[n].content],f=n===e.premise.length-1;if(!(s=a.value)){for(s in c)o=c[s],a.value=Number(s),this._evaluateLevel1(e,r,i,n,f,l,u,o);a.value=null}else(o=c[s])&&this._evaluateLevel1(e,r,i,n,f,l,u,o)}_evaluateLevel1(e,r,i,n,s,o,a,l){let u,c;if(!(u=o.value)){for(u in l)c=l[u],o.value=Number(u),this._evaluateLevel2(e,r,i,n,s,a,c);o.value=null}else(c=l[u])&&this._evaluateLevel2(e,r,i,n,s,a,c)}_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,c]=o,f=c.basePremise.subject.value;f||(c.basePremise.subject.value=a);let h=c.basePremise.predicate.value;h||(c.basePremise.predicate.value=l);let d=c.basePremise.object.value;d||(c.basePremise.object.value=u),c.premise.length===0?s(c.conclusion):this._evaluatePremise(c,r,n),f||(c.basePremise.subject.value=null),h||(c.basePremise.predicate.value=null),d||(c.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=On(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 c=0;c<n.premise.length;c++)c!==s&&u.push(kl(n.premise[c],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=>kl(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 kl({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 Ul=lr(Jr());var kt=class extends Ul.Transform{constructor(e){super({decodeStrings:!0,readableObjectMode:!0});let r=new he(e),i,n,s={onQuad:(o,a)=>{o&&this.emit("error",o)||a&&this.push(a)},onPrefix:(o,a)=>{this.emit("prefix",o,a)}};e&&e.comments&&(s.onComment=o=>{this.emit("comment",o)}),r.parse({on:(o,a)=>{switch(o){case"data":i=a;break;case"end":n=a;break}}},s),this._transform=(o,a,l)=>{i(o),l()},this._flush=o=>{n(),o()}}import(e){return e.on("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 ql=lr(Jr());var Cp=16*1024,Dp=20,Ut=class extends ql.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0}),this._buffer="",this._flushTimer=null,this._flushDelay=e&&e.flushDelay!==void 0?e.flushDelay:Dp;let r=this._writer=new oe({write:(s,o,a)=>{this._buffer+=s,this._buffer.length>=Cp?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 Op={Lexer:Me,Parser:he,Writer:oe,Store:Se,StoreFactory:Mt,EntityIndex:Ot,StreamParser:kt,StreamWriter:Ut,Util:yr,Reasoner:$t,BaseIRI:$e,DataFactory:H,Term:Q,NamedNode:He,Literal:de,BlankNode:pt,Variable:bt,DefaultGraph:yt,Quad:Ne,Triple:Ne,termFromId:Te,termToId:Ae};return Jl(Mp);})();
|
|
24
24
|
/*! Bundled license information:
|
|
25
25
|
|
|
26
26
|
ieee754/index.js:
|