@muze-nl/jsfs-solid 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +1,25 @@
1
- (()=>{var Sf=Object.create;var zn=Object.defineProperty;var Ef=Object.getOwnPropertyDescriptor;var Rf=Object.getOwnPropertyNames;var If=Object.getPrototypeOf,Af=Object.prototype.hasOwnProperty;var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Tt=(t,e)=>{for(var r in e)zn(t,r,{get:e[r],enumerable:!0})},Tf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Rf(e))!Af.call(t,i)&&i!==r&&zn(t,i,{get:()=>e[i],enumerable:!(n=Ef(e,i))||n.enumerable});return t};var zr=(t,e,r)=>(r=t!=null?Sf(If(t)):{},Tf(e||!t||!t.__esModule?zn(r,"default",{value:t,enumerable:!0}):r,t));var mo=v(Zr=>{"use strict";Zr.byteLength=rc;Zr.toByteArray=ic;Zr.fromByteArray=ac;var de=[],ne=[],tc=typeof Uint8Array<"u"?Uint8Array:Array,li="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ot=0,yo=li.length;ot<yo;++ot)de[ot]=li[ot],ne[li.charCodeAt(ot)]=ot;var ot,yo;ne[45]=62;ne[95]=63;function bo(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 n=r===e?0:4-r%4;return[r,n]}function rc(t){var e=bo(t),r=e[0],n=e[1];return(r+n)*3/4-n}function nc(t,e,r){return(e+r)*3/4-r}function ic(t){var e,r=bo(t),n=r[0],i=r[1],s=new tc(nc(t,n,i)),o=0,a=i>0?n-4:n,l;for(l=0;l<a;l+=4)e=ne[t.charCodeAt(l)]<<18|ne[t.charCodeAt(l+1)]<<12|ne[t.charCodeAt(l+2)]<<6|ne[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=ne[t.charCodeAt(l)]<<2|ne[t.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=ne[t.charCodeAt(l)]<<10|ne[t.charCodeAt(l+1)]<<4|ne[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function sc(t){return de[t>>18&63]+de[t>>12&63]+de[t>>6&63]+de[t&63]}function oc(t,e,r){for(var n,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),i.push(sc(n));return i.join("")}function ac(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,a=r-n;o<a;o+=s)i.push(oc(t,o,o+s>a?a:o+s));return n===1?(e=t[r-1],i.push(de[e>>2]+de[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(de[e>>10]+de[e>>4&63]+de[e<<2&63]+"=")),i.join("")}});var go=v(ui=>{ui.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,l=(1<<a)-1,u=l>>1,f=-7,c=r?i-1:0,d=r?-1:1,h=t[e+c];for(c+=d,s=h&(1<<-f)-1,h>>=-f,f+=a;f>0;s=s*256+t[e+c],c+=d,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+c],c+=d,f-=8);if(s===0)s=1-u;else{if(s===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-u}return(h?-1:1)*o*Math.pow(2,s-n)};ui.write=function(t,e,r,n,i,s){var o,a,l,u=s*8-i-1,f=(1<<u)-1,c=f>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:s-1,y=n?1:-1,_=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+c>=1?e+=d/l:e+=d*Math.pow(2,1-c),e*l>=2&&(o++,l/=2),o+c>=f?(a=0,o=f):o+c>=1?(a=(e*l-1)*Math.pow(2,i),o=o+c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;t[r+h]=a&255,h+=y,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;t[r+h]=o&255,h+=y,o/=256,u-=8);t[r+h-y]|=_*128}});var pe=v(Mt=>{"use strict";var fi=mo(),Ct=go(),wo=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Mt.Buffer=p;Mt.SlowBuffer=hc;Mt.INSPECT_MAX_BYTES=50;var Xr=2147483647;Mt.kMaxLength=Xr;p.TYPED_ARRAY_SUPPORT=lc();!p.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function lc(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}});Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function ke(t){if(t>Xr)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,p.prototype),e}function p(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 pi(t)}return Ro(t,e,r)}p.poolSize=8192;function Ro(t,e,r){if(typeof t=="string")return fc(t,e);if(ArrayBuffer.isView(t))return cc(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(he(t,ArrayBuffer)||t&&he(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(he(t,SharedArrayBuffer)||t&&he(t.buffer,SharedArrayBuffer)))return di(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return p.from(n,e,r);let i=dc(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return p.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)}p.from=function(t,e,r){return Ro(t,e,r)};Object.setPrototypeOf(p.prototype,Uint8Array.prototype);Object.setPrototypeOf(p,Uint8Array);function Io(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 uc(t,e,r){return Io(t),t<=0?ke(t):e!==void 0?typeof r=="string"?ke(t).fill(e,r):ke(t).fill(e):ke(t)}p.alloc=function(t,e,r){return uc(t,e,r)};function pi(t){return Io(t),ke(t<0?0:_i(t)|0)}p.allocUnsafe=function(t){return pi(t)};p.allocUnsafeSlow=function(t){return pi(t)};function fc(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!p.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Ao(t,e)|0,n=ke(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function ci(t){let e=t.length<0?0:_i(t.length)|0,r=ke(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function cc(t){if(he(t,Uint8Array)){let e=new Uint8Array(t);return di(e.buffer,e.byteOffset,e.byteLength)}return ci(t)}function di(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 n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,p.prototype),n}function dc(t){if(p.isBuffer(t)){let e=_i(t.length)|0,r=ke(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||bi(t.length)?ke(0):ci(t);if(t.type==="Buffer"&&Array.isArray(t.data))return ci(t.data)}function _i(t){if(t>=Xr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Xr.toString(16)+" bytes");return t|0}function hc(t){return+t!=t&&(t=0),p.alloc(+t)}p.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==p.prototype};p.compare=function(e,r){if(he(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),he(r,Uint8Array)&&(r=p.from(r,r.offset,r.byteLength)),!p.isBuffer(e)||!p.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);s<o;++s)if(e[s]!==r[s]){n=e[s],i=r[s];break}return n<i?-1:i<n?1:0};p.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}};p.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return p.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let i=p.allocUnsafe(r),s=0;for(n=0;n<e.length;++n){let o=e[n];if(he(o,Uint8Array))s+o.length>i.length?(p.isBuffer(o)||(o=p.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(p.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function Ao(t,e){if(p.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||he(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,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return hi(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Bo(t).length;default:if(i)return n?-1:hi(t).length;e=(""+e).toLowerCase(),i=!0}}p.byteLength=Ao;function pc(t,e,r){let n=!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 Rc(this,e,r);case"utf8":case"utf-8":return vo(this,e,r);case"ascii":return Sc(this,e,r);case"latin1":case"binary":return Ec(this,e,r);case"base64":return wc(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ic(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}p.prototype._isBuffer=!0;function at(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}p.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)at(this,r,r+1);return this};p.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)at(this,r,r+3),at(this,r+1,r+2);return this};p.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)at(this,r,r+7),at(this,r+1,r+6),at(this,r+2,r+5),at(this,r+3,r+4);return this};p.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?vo(this,0,e):pc.apply(this,arguments)};p.prototype.toLocaleString=p.prototype.toString;p.prototype.equals=function(e){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:p.compare(this,e)===0};p.prototype.inspect=function(){let e="",r=Mt.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};wo&&(p.prototype[wo]=p.prototype.inspect);p.prototype.compare=function(e,r,n,i,s){if(he(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),!p.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),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=n-r,l=Math.min(o,a),u=this.slice(i,s),f=e.slice(r,n);for(let c=0;c<l;++c)if(u[c]!==f[c]){o=u[c],a=f[c];break}return o<a?-1:a<o?1:0};function To(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,bi(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=p.from(e,n)),p.isBuffer(e))return e.length===0?-1:xo(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):xo(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function xo(t,e,r,n,i){let s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function l(f,c){return s===1?f[c]:f.readUInt16BE(c*s)}let u;if(i){let f=-1;for(u=r;u<o;u++)if(l(t,u)===l(e,f===-1?0:u-f)){if(f===-1&&(f=u),u-f+1===a)return f*s}else f!==-1&&(u-=u-f),f=-1}else for(r+a>o&&(r=o-a),u=r;u>=0;u--){let f=!0;for(let c=0;c<a;c++)if(l(t,u+c)!==l(e,c)){f=!1;break}if(f)return u}return-1}p.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};p.prototype.indexOf=function(e,r,n){return To(this,e,r,n,!0)};p.prototype.lastIndexOf=function(e,r,n){return To(this,e,r,n,!1)};function _c(t,e,r,n){r=Number(r)||0;let i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o<n;++o){let a=parseInt(e.substr(o*2,2),16);if(bi(a))return o;t[r+o]=a}return o}function yc(t,e,r,n){return en(hi(e,t.length-r),t,r,n)}function bc(t,e,r,n){return en(kc(e),t,r,n)}function mc(t,e,r,n){return en(Bo(e),t,r,n)}function gc(t,e,r,n){return en(jc(e,t.length-r),t,r,n)}p.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return _c(this,e,r,n);case"utf8":case"utf-8":return yc(this,e,r,n);case"ascii":case"latin1":case"binary":return bc(this,e,r,n);case"base64":return mc(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gc(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function wc(t,e,r){return e===0&&r===t.length?fi.fromByteArray(t):fi.fromByteArray(t.slice(e,r))}function vo(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i<r;){let s=t[i],o=null,a=s>239?4:s>223?3:s>191?2:1;if(i+a<=r){let l,u,f,c;switch(a){case 1:s<128&&(o=s);break;case 2:l=t[i+1],(l&192)===128&&(c=(s&31)<<6|l&63,c>127&&(o=c));break;case 3:l=t[i+1],u=t[i+2],(l&192)===128&&(u&192)===128&&(c=(s&15)<<12|(l&63)<<6|u&63,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:l=t[i+1],u=t[i+2],f=t[i+3],(l&192)===128&&(u&192)===128&&(f&192)===128&&(c=(s&15)<<18|(l&63)<<12|(u&63)<<6|f&63,c>65535&&c<1114112&&(o=c))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return xc(n)}var So=4096;function xc(t){let e=t.length;if(e<=So)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=So));return r}function Sc(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function Ec(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function Rc(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let s=e;s<r;++s)i+=Nc[t[s]];return i}function Ic(t,e,r){let n=t.slice(e,r),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}p.prototype.slice=function(e,r){let n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);let i=this.subarray(e,r);return Object.setPrototypeOf(i,p.prototype),i};function H(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")}p.prototype.readUintLE=p.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||H(e,r,this.length);let i=this[e],s=1,o=0;for(;++o<r&&(s*=256);)i+=this[e+o]*s;return i};p.prototype.readUintBE=p.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||H(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};p.prototype.readUint8=p.prototype.readUInt8=function(e,r){return e=e>>>0,r||H(e,1,this.length),this[e]};p.prototype.readUint16LE=p.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||H(e,2,this.length),this[e]|this[e+1]<<8};p.prototype.readUint16BE=p.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||H(e,2,this.length),this[e]<<8|this[e+1]};p.prototype.readUint32LE=p.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||H(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};p.prototype.readUint32BE=p.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||H(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};p.prototype.readBigUInt64LE=He(function(e){e=e>>>0,Ft(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&_r(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))});p.prototype.readBigUInt64BE=He(function(e){e=e>>>0,Ft(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&_r(e,this.length-8);let i=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+n;return(BigInt(i)<<BigInt(32))+BigInt(s)});p.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||H(e,r,this.length);let i=this[e],s=1,o=0;for(;++o<r&&(s*=256);)i+=this[e+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*r)),i};p.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||H(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};p.prototype.readInt8=function(e,r){return e=e>>>0,r||H(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};p.prototype.readInt16LE=function(e,r){e=e>>>0,r||H(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};p.prototype.readInt16BE=function(e,r){e=e>>>0,r||H(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};p.prototype.readInt32LE=function(e,r){return e=e>>>0,r||H(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};p.prototype.readInt32BE=function(e,r){return e=e>>>0,r||H(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};p.prototype.readBigInt64LE=He(function(e){e=e>>>0,Ft(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&_r(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});p.prototype.readBigInt64BE=He(function(e){e=e>>>0,Ft(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&_r(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});p.prototype.readFloatLE=function(e,r){return e=e>>>0,r||H(e,4,this.length),Ct.read(this,e,!0,23,4)};p.prototype.readFloatBE=function(e,r){return e=e>>>0,r||H(e,4,this.length),Ct.read(this,e,!1,23,4)};p.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||H(e,8,this.length),Ct.read(this,e,!0,52,8)};p.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||H(e,8,this.length),Ct.read(this,e,!1,52,8)};function X(t,e,r,n,i,s){if(!p.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;X(this,e,r,n,a,0)}let s=1,o=0;for(this[r]=e&255;++o<n&&(s*=256);)this[r+o]=e/s&255;return r+n};p.prototype.writeUintBE=p.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;X(this,e,r,n,a,0)}let s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};p.prototype.writeUint8=p.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||X(this,e,r,1,255,0),this[r]=e&255,r+1};p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||X(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||X(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||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};p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||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 ko(t,e,r,n,i){Lo(e,n,i,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 jo(t,e,r,n,i){Lo(e,n,i,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}p.prototype.writeBigUInt64LE=He(function(e,r=0){return ko(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeBigUInt64BE=He(function(e,r=0){return jo(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let l=Math.pow(2,8*n-1);X(this,e,r,n,l-1,-l)}let s=0,o=1,a=0;for(this[r]=e&255;++s<n&&(o*=256);)e<0&&a===0&&this[r+s-1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+n};p.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let l=Math.pow(2,8*n-1);X(this,e,r,n,l-1,-l)}let s=n-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+n};p.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||X(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};p.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||X(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};p.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||X(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};p.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||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};p.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||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};p.prototype.writeBigInt64LE=He(function(e,r=0){return ko(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});p.prototype.writeBigInt64BE=He(function(e,r=0){return jo(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function No(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Po(t,e,r,n,i){return e=+e,r=r>>>0,i||No(t,e,r,4,34028234663852886e22,-34028234663852886e22),Ct.write(t,e,r,n,23,4),r+4}p.prototype.writeFloatLE=function(e,r,n){return Po(this,e,r,!0,n)};p.prototype.writeFloatBE=function(e,r,n){return Po(this,e,r,!1,n)};function Oo(t,e,r,n,i){return e=+e,r=r>>>0,i||No(t,e,r,8,17976931348623157e292,-17976931348623157e292),Ct.write(t,e,r,n,52,8),r+8}p.prototype.writeDoubleLE=function(e,r,n){return Oo(this,e,r,!0,n)};p.prototype.writeDoubleBE=function(e,r,n){return Oo(this,e,r,!1,n)};p.prototype.copy=function(e,r,n,i){if(!p.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);let s=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),r),s};p.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!p.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let o=e.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s<n;++s)this[s]=e;else{let o=p.isBuffer(e)?e:p.from(e,i),a=o.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<n-r;++s)this[s+r]=o[s%a]}return this};var Bt={};function yi(t,e,r){Bt[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(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}yi("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);yi("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);yi("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=Eo(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Eo(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Eo(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function Ac(t,e,r){Ft(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&_r(e,t.length-(r+1))}function Lo(t,e,r,n,i,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 Bt.ERR_OUT_OF_RANGE("value",a,t)}Ac(n,i,s)}function Ft(t,e){if(typeof t!="number")throw new Bt.ERR_INVALID_ARG_TYPE(e,"number",t)}function _r(t,e,r){throw Math.floor(t)!==t?(Ft(t,r),new Bt.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Bt.ERR_BUFFER_OUT_OF_BOUNDS:new Bt.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Tc=/[^+/0-9A-Za-z-_]/g;function vc(t){if(t=t.split("=")[0],t=t.trim().replace(Tc,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function hi(t,e){e=e||1/0;let r,n=t.length,i=null,s=[];for(let o=0;o<n;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=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 kc(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function jc(t,e){let r,n,i,s=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),n=r>>8,i=r%256,s.push(i),s.push(n);return s}function Bo(t){return fi.toByteArray(vc(t))}function en(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function he(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function bi(t){return t!==t}var Nc=(function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e})();function He(t){return typeof BigInt>"u"?Pc:t}function Pc(){throw new Error("BigInt not supported")}});var B=v((Ig,Zo)=>{"use strict";var Si=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 n=0;n<e.length;n++)r+=` ${e[n].stack}
2
- `;super(r),this.name="AggregateError",this.errors=e}};Zo.exports={AggregateError:Si,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 Ei=v((Ag,Xo)=>{"use strict";Xo.exports={format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,n]){let i=e.shift();return n==="f"?i.toFixed(6):n==="j"?JSON.stringify(i):n==="s"&&typeof i=="object"?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}}}});var Q=v((Tg,ra)=>{"use strict";var{format:Yc,inspect:nn}=Ei(),{AggregateError:Zc}=B(),Xc=globalThis.AggregateError||Zc,ed=Symbol("kIsNodeError"),td=["string","function","number","object","Function","Object","boolean","bigint","symbol"],rd=/^([A-Z][a-z0-9]*)+$/,nd="__node_internal_",sn={};function pt(t,e){if(!t)throw new sn.ERR_INTERNAL_ASSERTION(e)}function ea(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function id(t,e,r){if(typeof e=="function")return pt(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let n=(e.match(/%[dfijoOs]/g)||[]).length;return pt(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:Yc(e,...r)}function K(t,e,r){r||(r=Error);class n extends r{constructor(...s){super(id(t,e,s))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(n.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}}),n.prototype.code=t,n.prototype[ed]=!0,sn[t]=n}function ta(t){let e=nd+t.name;return Object.defineProperty(t,"name",{value:e}),t}function sd(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new Xc([e,t],e.message);return r.code=e.code,r}return t||e}var Ri=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new sn.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};K("ERR_ASSERTION","%s",Error);K("ERR_INVALID_ARG_TYPE",(t,e,r)=>{pt(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let n="The ";t.endsWith(" argument")?n+=`${t} `:n+=`"${t}" ${t.includes(".")?"property":"argument"} `,n+="must be ";let i=[],s=[],o=[];for(let l of e)pt(typeof l=="string","All expected entries have to be of type string"),td.includes(l)?i.push(l.toLowerCase()):rd.test(l)?s.push(l):(pt(l!=="object",'The value "object" should be written as "Object"'),o.push(l));if(s.length>0){let l=i.indexOf("object");l!==-1&&(i.splice(i,l,1),s.push("Object"))}if(i.length>0){switch(i.length){case 1:n+=`of type ${i[0]}`;break;case 2:n+=`one of type ${i[0]} or ${i[1]}`;break;default:{let l=i.pop();n+=`one of type ${i.join(", ")}, or ${l}`}}(s.length>0||o.length>0)&&(n+=" or ")}if(s.length>0){switch(s.length){case 1:n+=`an instance of ${s[0]}`;break;case 2:n+=`an instance of ${s[0]} or ${s[1]}`;break;default:{let l=s.pop();n+=`an instance of ${s.join(", ")}, or ${l}`}}o.length>0&&(n+=" or ")}switch(o.length){case 0:break;case 1:o[0].toLowerCase()!==o[0]&&(n+="an "),n+=`${o[0]}`;break;case 2:n+=`one of ${o[0]} or ${o[1]}`;break;default:{let l=o.pop();n+=`one of ${o.join(", ")}, or ${l}`}}if(r==null)n+=`. Received ${r}`;else if(typeof r=="function"&&r.name)n+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)n+=`. Received an instance of ${r.constructor.name}`;else{let l=nn(r,{depth:-1});n+=`. Received ${l}`}}else{let l=nn(r,{colors:!1});l.length>25&&(l=`${l.slice(0,25)}...`),n+=`. Received type ${typeof r} (${l})`}return n},TypeError);K("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=nn(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);K("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var n;let i=r!=null&&(n=r.constructor)!==null&&n!==void 0&&n.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${i}.`},TypeError);K("ERR_MISSING_ARGS",(...t)=>{pt(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(n=>`"${n}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let n=t.pop();e+=`The ${t.join(", ")}, and ${n} arguments`}break}return`${e} must be specified`},TypeError);K("ERR_OUT_OF_RANGE",(t,e,r)=>{pt(e,'Missing "range" argument');let n;if(Number.isInteger(r)&&Math.abs(r)>2**32)n=ea(String(r));else if(typeof r=="bigint"){n=String(r);let i=BigInt(2)**BigInt(32);(r>i||r<-i)&&(n=ea(n)),n+="n"}else n=nn(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);K("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);K("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);K("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);K("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);K("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);K("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);K("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);K("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);K("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);K("ERR_STREAM_WRITE_AFTER_END","write after end",Error);K("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);ra.exports={AbortError:Ri,aggregateTwoErrors:ta(sd),hideStackFrames:ta,codes:sn}});var Wt=v((vg,on)=>{"use strict";var{AbortController:na,AbortSignal:od}=typeof self<"u"?self:typeof window<"u"?window:void 0;on.exports=na;on.exports.AbortSignal=od;on.exports.default=na});var Er=v((kg,Ii)=>{"use strict";var zt=typeof Reflect=="object"?Reflect:null,ia=zt&&typeof zt.apply=="function"?zt.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},an;zt&&typeof zt.ownKeys=="function"?an=zt.ownKeys:Object.getOwnPropertySymbols?an=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:an=function(e){return Object.getOwnPropertyNames(e)};function ad(t){console&&console.warn&&console.warn(t)}var oa=Number.isNaN||function(e){return e!==e};function j(){j.init.call(this)}Ii.exports=j;Ii.exports.once=cd;j.EventEmitter=j;j.prototype._events=void 0;j.prototype._eventsCount=0;j.prototype._maxListeners=void 0;var sa=10;function ln(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(j,"defaultMaxListeners",{enumerable:!0,get:function(){return sa},set:function(t){if(typeof t!="number"||t<0||oa(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");sa=t}});j.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};j.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||oa(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 aa(t){return t._maxListeners===void 0?j.defaultMaxListeners:t._maxListeners}j.prototype.getMaxListeners=function(){return aa(this)};j.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){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")ia(l,this,r);else for(var u=l.length,f=da(l,u),n=0;n<u;++n)ia(f[n],this,r);return!0};function la(t,e,r,n){var i,s,o;if(ln(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]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=aa(t),i>0&&o.length>i&&!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,ad(a)}return t}j.prototype.addListener=function(e,r){return la(this,e,r,!1)};j.prototype.on=j.prototype.addListener;j.prototype.prependListener=function(e,r){return la(this,e,r,!0)};function ld(){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 ua(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=ld.bind(n);return i.listener=r,n.wrapFn=i,i}j.prototype.once=function(e,r){return ln(r),this.on(e,ua(this,e,r)),this};j.prototype.prependOnceListener=function(e,r){return ln(r),this.prependListener(e,ua(this,e,r)),this};j.prototype.removeListener=function(e,r){var n,i,s,o,a;if(ln(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():ud(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};j.prototype.off=j.prototype.removeListener;j.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function fa(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?fd(i):da(i,i.length)}j.prototype.listeners=function(e){return fa(this,e,!0)};j.prototype.rawListeners=function(e){return fa(this,e,!1)};j.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ca.call(t,e)};j.prototype.listenerCount=ca;function ca(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}j.prototype.eventNames=function(){return this._eventsCount>0?an(this._events):[]};function da(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function ud(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function fd(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function cd(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}ha(t,e,s,{once:!0}),e!=="error"&&dd(t,i,{once:!0})})}function dd(t,e,r){typeof t.on=="function"&&ha(t,"error",e,r)}function ha(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var Y=v((jg,Ti)=>{"use strict";var hd=pe(),{format:pd,inspect:_d}=Ei(),{codes:{ERR_INVALID_ARG_TYPE:Ai}}=Q(),{kResistStopPropagation:yd,AggregateError:bd,SymbolDispose:md}=B(),gd=globalThis.AbortSignal||Wt().AbortSignal,wd=globalThis.AbortController||Wt().AbortController,xd=Object.getPrototypeOf(async function(){}).constructor,pa=globalThis.Blob||hd.Blob,Sd=typeof pa<"u"?function(e){return e instanceof pa}:function(e){return!1},_a=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Ai(e,"AbortSignal",t)},Ed=(t,e)=>{if(typeof t!="function")throw new Ai(e,"Function",t)};Ti.exports={AggregateError:bd,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((n,i)=>{t=n,e=i}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((n,...i)=>n?r(n):e(...i))})},debuglog(){return function(){}},format:pd,inspect:_d,types:{isAsyncFunction(t){return t instanceof xd},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Sd,deprecate(t,e){return t},addAbortListener:Er().addAbortListener||function(e,r){if(e===void 0)throw new Ai("signal","AbortSignal",e);_a(e,"signal"),Ed(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[yd]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[md](){var i;(i=n)===null||i===void 0||i()}}},AbortSignalAny:gd.any||function(e){if(e.length===1)return e[0];let r=new wd,n=()=>r.abort();return e.forEach(i=>{_a(i,"signals"),i.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(i=>i.removeEventListener("abort",n))},{once:!0}),r.signal}};Ti.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Ht=v((Ng,Ia)=>{"use strict";var{ArrayIsArray:ki,ArrayPrototypeIncludes:ga,ArrayPrototypeJoin:wa,ArrayPrototypeMap:Rd,NumberIsInteger:ji,NumberIsNaN:Id,NumberMAX_SAFE_INTEGER:Ad,NumberMIN_SAFE_INTEGER:Td,NumberParseInt:vd,ObjectPrototypeHasOwnProperty:kd,RegExpPrototypeExec:xa,String:jd,StringPrototypeToUpperCase:Nd,StringPrototypeTrim:Pd}=B(),{hideStackFrames:ie,codes:{ERR_SOCKET_BAD_PORT:Od,ERR_INVALID_ARG_TYPE:J,ERR_INVALID_ARG_VALUE:Gt,ERR_OUT_OF_RANGE:_t,ERR_UNKNOWN_SIGNAL:ya}}=Q(),{normalizeEncoding:Ld}=Y(),{isAsyncFunction:Bd,isArrayBufferView:Cd}=Y().types,ba={};function Fd(t){return t===(t|0)}function Md(t){return t===t>>>0}var Dd=/^[0-7]+$/,Ud="must be a 32-bit unsigned integer or an octal string";function $d(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(xa(Dd,t)===null)throw new Gt(e,t,Ud);t=vd(t,8)}return Sa(t,e),t}var qd=ie((t,e,r=Td,n=Ad)=>{if(typeof t!="number")throw new J(e,"number",t);if(!ji(t))throw new _t(e,"an integer",t);if(t<r||t>n)throw new _t(e,`>= ${r} && <= ${n}`,t)}),Wd=ie((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new J(e,"number",t);if(!ji(t))throw new _t(e,"an integer",t);if(t<r||t>n)throw new _t(e,`>= ${r} && <= ${n}`,t)}),Sa=ie((t,e,r=!1)=>{if(typeof t!="number")throw new J(e,"number",t);if(!ji(t))throw new _t(e,"an integer",t);let n=r?1:0,i=4294967295;if(t<n||t>i)throw new _t(e,`>= ${n} && <= ${i}`,t)});function Ni(t,e){if(typeof t!="string")throw new J(e,"string",t)}function zd(t,e,r=void 0,n){if(typeof t!="number")throw new J(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&Id(t))throw new _t(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var Gd=ie((t,e,r)=>{if(!ga(r,t)){let i="must be one of: "+wa(Rd(r,s=>typeof s=="string"?`'${s}'`:jd(s)),", ");throw new Gt(e,t,i)}});function Ea(t,e){if(typeof t!="boolean")throw new J(e,"boolean",t)}function vi(t,e,r){return t==null||!kd(t,e)?r:t[e]}var Hd=ie((t,e,r=null)=>{let n=vi(r,"allowArray",!1),i=vi(r,"allowFunction",!1);if(!vi(r,"nullable",!1)&&t===null||!n&&ki(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new J(e,"Object",t)}),Vd=ie((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new J(e,"a dictionary",t)}),un=ie((t,e,r=0)=>{if(!ki(t))throw new J(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new Gt(e,t,n)}});function Kd(t,e){un(t,e);for(let r=0;r<t.length;r++)Ni(t[r],`${e}[${r}]`)}function Qd(t,e){un(t,e);for(let r=0;r<t.length;r++)Ea(t[r],`${e}[${r}]`)}function Jd(t,e){un(t,e);for(let r=0;r<t.length;r++){let n=t[r],i=`${e}[${r}]`;if(n==null)throw new J(i,"AbortSignal",n);Ra(n,i)}}function Yd(t,e="signal"){if(Ni(t,e),ba[t]===void 0)throw ba[Nd(t)]!==void 0?new ya(t+" (signals must use all capital letters)"):new ya(t)}var Zd=ie((t,e="buffer")=>{if(!Cd(t))throw new J(e,["Buffer","TypedArray","DataView"],t)});function Xd(t,e){let r=Ld(e),n=t.length;if(r==="hex"&&n%2!==0)throw new Gt("encoding",e,`is invalid for data of length ${n}`)}function eh(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&Pd(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new Od(e,t,r);return t|0}var Ra=ie((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new J(e,"AbortSignal",t)}),th=ie((t,e)=>{if(typeof t!="function")throw new J(e,"Function",t)}),rh=ie((t,e)=>{if(typeof t!="function"||Bd(t))throw new J(e,"Function",t)}),nh=ie((t,e)=>{if(t!==void 0)throw new J(e,"undefined",t)});function ih(t,e,r){if(!ga(r,t))throw new J(e,`('${wa(r,"|")}')`,t)}var sh=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function ma(t,e){if(typeof t>"u"||!xa(sh,t))throw new Gt(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function oh(t){if(typeof t=="string")return ma(t,"hints"),t;if(ki(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let i=t[n];ma(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new Gt("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Ia.exports={isInt32:Fd,isUint32:Md,parseFileMode:$d,validateArray:un,validateStringArray:Kd,validateBooleanArray:Qd,validateAbortSignalArray:Jd,validateBoolean:Ea,validateBuffer:Zd,validateDictionary:Vd,validateEncoding:Xd,validateFunction:th,validateInt32:Wd,validateInteger:qd,validateNumber:zd,validateObject:Hd,validateOneOf:Gd,validatePlainFunction:rh,validatePort:eh,validateSignalName:Yd,validateString:Ni,validateUint32:Sa,validateUndefined:nh,validateUnion:ih,validateAbortSignal:Ra,validateLinkHeaderValue:oh}});var Qe=v((Pg,ka)=>{var F=ka.exports={},ye,be;function Pi(){throw new Error("setTimeout has not been defined")}function Oi(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ye=setTimeout:ye=Pi}catch{ye=Pi}try{typeof clearTimeout=="function"?be=clearTimeout:be=Oi}catch{be=Oi}})();function Aa(t){if(ye===setTimeout)return setTimeout(t,0);if((ye===Pi||!ye)&&setTimeout)return ye=setTimeout,setTimeout(t,0);try{return ye(t,0)}catch{try{return ye.call(null,t,0)}catch{return ye.call(this,t,0)}}}function ah(t){if(be===clearTimeout)return clearTimeout(t);if((be===Oi||!be)&&clearTimeout)return be=clearTimeout,clearTimeout(t);try{return be(t)}catch{try{return be.call(null,t)}catch{return be.call(this,t)}}}var Oe=[],Vt=!1,yt,fn=-1;function lh(){!Vt||!yt||(Vt=!1,yt.length?Oe=yt.concat(Oe):fn=-1,Oe.length&&Ta())}function Ta(){if(!Vt){var t=Aa(lh);Vt=!0;for(var e=Oe.length;e;){for(yt=Oe,Oe=[];++fn<e;)yt&&yt[fn].run();fn=-1,e=Oe.length}yt=null,Vt=!1,ah(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];Oe.push(new va(t,e)),Oe.length===1&&!Vt&&Aa(Ta)};function va(t,e){this.fun=t,this.array=e}va.prototype.run=function(){this.fun.apply(null,this.array)};F.title="browser";F.browser=!0;F.env={};F.argv=[];F.version="";F.versions={};function Le(){}F.on=Le;F.addListener=Le;F.once=Le;F.off=Le;F.removeListener=Le;F.removeAllListeners=Le;F.emit=Le;F.prependListener=Le;F.prependOnceListener=Le;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 ge=v((Og,za)=>{"use strict";var{SymbolAsyncIterator:ja,SymbolIterator:Na,SymbolFor:bt}=B(),Pa=bt("nodejs.stream.destroyed"),Oa=bt("nodejs.stream.errored"),Li=bt("nodejs.stream.readable"),Bi=bt("nodejs.stream.writable"),La=bt("nodejs.stream.disturbed"),uh=bt("nodejs.webstream.isClosedPromise"),fh=bt("nodejs.webstream.controllerErrorFunction");function cn(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 dn(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 ch(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function me(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Ba(t){return!!(t&&!me(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Ca(t){return!!(t&&!me(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Fa(t){return!!(t&&!me(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function dh(t){return Ba(t)||Ca(t)||Fa(t)}function hh(t,e){return t==null?!1:e===!0?typeof t[ja]=="function":e===!1?typeof t[Na]=="function":typeof t[ja]=="function"||typeof t[Na]=="function"}function hn(t){if(!me(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[Pa]||n!=null&&n.destroyed)}function Ma(t){if(!dn(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function ph(t,e){if(!dn(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function _h(t){if(!cn(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Da(t,e){if(!cn(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function Ua(t){return t&&t[Li]!=null?t[Li]:typeof t?.readable!="boolean"?null:hn(t)?!1:cn(t)&&t.readable&&!Da(t)}function $a(t){return t&&t[Bi]!=null?t[Bi]:typeof t?.writable!="boolean"?null:hn(t)?!1:dn(t)&&t.writable&&!Ma(t)}function yh(t,e){return me(t)?hn(t)?!0:!(e?.readable!==!1&&Ua(t)||e?.writable!==!1&&$a(t)):null}function bh(t){var e,r;return me(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 mh(t){var e,r;return me(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 gh(t){if(!me(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&qa(t)?t._closed:null}function qa(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Wa(t){return typeof t._sent100=="boolean"&&qa(t)}function wh(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 xh(t){if(!me(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&Wa(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function Sh(t){var e;return!!(t&&((e=t[La])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function Eh(t){var e,r,n,i,s,o,a,l,u,f;return!!(t&&((e=(r=(n=(i=(s=(o=t[Oa])!==null&&o!==void 0?o:t.readableErrored)!==null&&s!==void 0?s:t.writableErrored)!==null&&i!==void 0?i:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&n!==void 0?n:(l=t._writableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&r!==void 0?r:(u=t._readableState)===null||u===void 0?void 0:u.errored)!==null&&e!==void 0?e:!((f=t._writableState)===null||f===void 0)&&f.errored))}za.exports={isDestroyed:hn,kIsDestroyed:Pa,isDisturbed:Sh,kIsDisturbed:La,isErrored:Eh,kIsErrored:Oa,isReadable:Ua,kIsReadable:Li,kIsClosedPromise:uh,kControllerErrorFunction:fh,kIsWritable:Bi,isClosed:gh,isDuplexNodeStream:ch,isFinished:yh,isIterable:hh,isReadableNodeStream:cn,isReadableStream:Ba,isReadableEnded:_h,isReadableFinished:Da,isReadableErrored:mh,isNodeStream:me,isWebStream:dh,isWritable:$a,isWritableNodeStream:dn,isWritableStream:Ca,isWritableEnded:Ma,isWritableFinished:ph,isWritableErrored:bh,isServerRequest:wh,isServerResponse:Wa,willEmitClose:xh,isTransformStream:Fa}});var Be=v((Lg,Ui)=>{"use strict";var Je=Qe(),{AbortError:Xa,codes:Rh}=Q(),{ERR_INVALID_ARG_TYPE:Ih,ERR_STREAM_PREMATURE_CLOSE:Ga}=Rh,{kEmptyObject:Fi,once:Mi}=Y(),{validateAbortSignal:Ah,validateFunction:Th,validateObject:vh,validateBoolean:kh}=Ht(),{Promise:jh,PromisePrototypeThen:Nh,SymbolDispose:el}=B(),{isClosed:Ph,isReadable:Ha,isReadableNodeStream:Ci,isReadableStream:Oh,isReadableFinished:Va,isReadableErrored:Ka,isWritable:Qa,isWritableNodeStream:Ja,isWritableStream:Lh,isWritableFinished:Ya,isWritableErrored:Za,isNodeStream:Bh,willEmitClose:Ch,kIsClosedPromise:Fh}=ge(),Kt;function Mh(t){return t.setHeader&&typeof t.abort=="function"}var Di=()=>{};function tl(t,e,r){var n,i;if(arguments.length===2?(r=e,e=Fi):e==null?e=Fi:vh(e,"options"),Th(r,"callback"),Ah(e.signal,"options.signal"),r=Mi(r),Oh(t)||Lh(t))return Dh(t,e,r);if(!Bh(t))throw new Ih("stream",["ReadableStream","WritableStream","Stream"],t);let s=(n=e.readable)!==null&&n!==void 0?n:Ci(t),o=(i=e.writable)!==null&&i!==void 0?i:Ja(t),a=t._writableState,l=t._readableState,u=()=>{t.writable||d()},f=Ch(t)&&Ci(t)===s&&Ja(t)===o,c=Ya(t,!1),d=()=>{c=!0,t.destroyed&&(f=!1),!(f&&(!t.readable||s))&&(!s||h)&&r.call(t)},h=Va(t,!1),y=()=>{h=!0,t.destroyed&&(f=!1),!(f&&(!t.writable||o))&&(!o||c)&&r.call(t)},_=T=>{r.call(t,T)},x=Ph(t),b=()=>{x=!0;let T=Za(t)||Ka(t);if(T&&typeof T!="boolean")return r.call(t,T);if(s&&!h&&Ci(t,!0)&&!Va(t,!1))return r.call(t,new Ga);if(o&&!c&&!Ya(t,!1))return r.call(t,new Ga);r.call(t)},g=()=>{x=!0;let T=Za(t)||Ka(t);if(T&&typeof T!="boolean")return r.call(t,T);r.call(t)},S=()=>{t.req.on("finish",d)};Mh(t)?(t.on("complete",d),f||t.on("abort",b),t.req?S():t.on("request",S)):o&&!a&&(t.on("end",u),t.on("close",u)),!f&&typeof t.aborted=="boolean"&&t.on("aborted",b),t.on("end",y),t.on("finish",d),e.error!==!1&&t.on("error",_),t.on("close",b),x?Je.nextTick(b):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?f||Je.nextTick(g):(!s&&(!f||Ha(t))&&(c||Qa(t)===!1)||!o&&(!f||Qa(t))&&(h||Ha(t)===!1)||l&&t.req&&t.aborted)&&Je.nextTick(g);let w=()=>{r=Di,t.removeListener("aborted",b),t.removeListener("complete",d),t.removeListener("abort",b),t.removeListener("request",S),t.req&&t.req.removeListener("finish",d),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",d),t.removeListener("end",y),t.removeListener("error",_),t.removeListener("close",b)};if(e.signal&&!x){let T=()=>{let Ae=r;w(),Ae.call(t,new Xa(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Je.nextTick(T);else{Kt=Kt||Y().addAbortListener;let Ae=Kt(e.signal,T),U=r;r=Mi((...At)=>{Ae[el](),U.apply(t,At)})}}return w}function Dh(t,e,r){let n=!1,i=Di;if(e.signal)if(i=()=>{n=!0,r.call(t,new Xa(void 0,{cause:e.signal.reason}))},e.signal.aborted)Je.nextTick(i);else{Kt=Kt||Y().addAbortListener;let o=Kt(e.signal,i),a=r;r=Mi((...l)=>{o[el](),a.apply(t,l)})}let s=(...o)=>{n||Je.nextTick(()=>r.apply(t,o))};return Nh(t[Fh].promise,s,s),Di}function Uh(t,e){var r;let n=!1;return e===null&&(e=Fi),(r=e)!==null&&r!==void 0&&r.cleanup&&(kh(e.cleanup,"cleanup"),n=e.cleanup),new jh((i,s)=>{let o=tl(t,e,a=>{n&&o(),a?s(a):i()})})}Ui.exports=tl;Ui.exports.finished=Uh});var mt=v((Bg,ul)=>{"use strict";var we=Qe(),{aggregateTwoErrors:$h,codes:{ERR_MULTIPLE_CALLBACK:qh},AbortError:Wh}=Q(),{Symbol:il}=B(),{kIsDestroyed:zh,isDestroyed:Gh,isFinished:Hh,isServerRequest:Vh}=ge(),sl=il("kDestroy"),$i=il("kConstruct");function ol(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Kh(t,e){let r=this._readableState,n=this._writableState,i=n||r;return n!=null&&n.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(ol(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?rl(this,t,e):this.once(sl,function(s){rl(this,$h(s,t),e)}),this)}function rl(t,e,r){let n=!1;function i(s){if(n)return;n=!0;let o=t._readableState,a=t._writableState;ol(s,a,o),a&&(a.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?we.nextTick(Qh,t,s):we.nextTick(al,t)}try{t._destroy(e||null,i)}catch(s){i(s)}}function Qh(t,e){qi(t,e),al(t)}function al(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 qi(t,e){let r=t._readableState,n=t._writableState;n!=null&&n.errorEmitted||r!=null&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function Jh(){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 Wi(t,e,r){let n=t._readableState,i=t._writableState;if(i!=null&&i.destroyed||n!=null&&n.destroyed)return this;n!=null&&n.autoDestroy||i!=null&&i.autoDestroy?t.destroy(e):e&&(e.stack,i&&!i.errored&&(i.errored=e),n&&!n.errored&&(n.errored=e),r?we.nextTick(qi,t,e):qi(t,e))}function Yh(t,e){if(typeof t._construct!="function")return;let r=t._readableState,n=t._writableState;r&&(r.constructed=!1),n&&(n.constructed=!1),t.once($i,e),!(t.listenerCount($i)>1)&&we.nextTick(Zh,t)}function Zh(t){let e=!1;function r(n){if(e){Wi(t,n??new qh);return}e=!0;let i=t._readableState,s=t._writableState,o=s||i;i&&(i.constructed=!0),s&&(s.constructed=!0),o.destroyed?t.emit(sl,n):n?Wi(t,n,!0):we.nextTick(Xh,t)}try{t._construct(n=>{we.nextTick(r,n)})}catch(n){we.nextTick(r,n)}}function Xh(t){t.emit($i)}function nl(t){return t?.setHeader&&typeof t.abort=="function"}function ll(t){t.emit("close")}function ep(t,e){t.emit("error",e),we.nextTick(ll,t)}function tp(t,e){!t||Gh(t)||(!e&&!Hh(t)&&(e=new Wh),Vh(t)?(t.socket=null,t.destroy(e)):nl(t)?t.abort():nl(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?we.nextTick(ep,t,e):we.nextTick(ll,t),t.destroyed||(t[zh]=!0))}ul.exports={construct:Yh,destroyer:tp,destroy:Kh,undestroy:Jh,errorOrDestroy:Wi}});var yn=v((Cg,cl)=>{"use strict";var{ArrayIsArray:rp,ObjectSetPrototypeOf:fl}=B(),{EventEmitter:pn}=Er();function _n(t){pn.call(this,t)}fl(_n.prototype,pn.prototype);fl(_n,pn);_n.prototype.pipe=function(t,e){let r=this;function n(f){t.writable&&t.write(f)===!1&&r.pause&&r.pause()}r.on("data",n);function i(){r.readable&&r.resume&&r.resume()}t.on("drain",i),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",o),r.on("close",a));let s=!1;function o(){s||(s=!0,t.end())}function a(){s||(s=!0,typeof t.destroy=="function"&&t.destroy())}function l(f){u(),pn.listenerCount(this,"error")===0&&this.emit("error",f)}zi(r,"error",l),zi(t,"error",l);function u(){r.removeListener("data",n),t.removeListener("drain",i),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 zi(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):rp(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}cl.exports={Stream:_n,prependListener:zi}});var Rr=v((Fg,bn)=>{"use strict";var{SymbolDispose:np}=B(),{AbortError:dl,codes:ip}=Q(),{isNodeStream:hl,isWebStream:sp,kControllerErrorFunction:op}=ge(),ap=Be(),{ERR_INVALID_ARG_TYPE:pl}=ip,Gi,lp=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new pl(e,"AbortSignal",t)};bn.exports.addAbortSignal=function(e,r){if(lp(e,"signal"),!hl(r)&&!sp(r))throw new pl("stream",["ReadableStream","WritableStream","Stream"],r);return bn.exports.addAbortSignalNoValidate(e,r)};bn.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=hl(e)?()=>{e.destroy(new dl(void 0,{cause:t.reason}))}:()=>{e[op](new dl(void 0,{cause:t.reason}))};if(t.aborted)r();else{Gi=Gi||Y().addAbortListener;let n=Gi(t,r);ap(e,n[np])}return e}});var bl=v((Dg,yl)=>{"use strict";var{StringPrototypeSlice:_l,SymbolIterator:up,TypedArrayPrototypeSet:mn,Uint8Array:fp}=B(),{Buffer:Hi}=pe(),{inspect:cp}=Y();yl.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,n=""+r.data;for(;(r=r.next)!==null;)n+=e+r.data;return n}concat(e){if(this.length===0)return Hi.alloc(0);let r=Hi.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)mn(r,n.data,i),i+=n.data.length,n=n.next;return r}consume(e,r){let n=this.head.data;if(e<n.length){let i=n.slice(0,e);return this.head.data=n.slice(e),i}return e===n.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[up](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",n=this.head,i=0;do{let s=n.data;if(e>s.length)r+=s,e-=s.length;else{e===s.length?(r+=s,++i,n.next?this.head=n.next:this.head=this.tail=null):(r+=_l(s,0,e),this.head=n,n.data=_l(s,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=Hi.allocUnsafe(e),n=e,i=this.head,s=0;do{let o=i.data;if(e>o.length)mn(r,o,n-e),e-=o.length;else{e===o.length?(mn(r,o,n-e),++s,i.next?this.head=i.next:this.head=this.tail=null):(mn(r,new fp(o.buffer,o.byteOffset,e),n-e),this.head=i,i.data=o.slice(e));break}++s}while((i=i.next)!==null);return this.length-=s,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return cp(this,{...r,depth:0,customInspect:!1})}}});var Ir=v((Ug,xl)=>{"use strict";var{MathFloor:dp,NumberIsInteger:hp}=B(),{validateInteger:pp}=Ht(),{ERR_INVALID_ARG_VALUE:_p}=Q().codes,ml=16*1024,gl=16;function yp(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function wl(t){return t?gl:ml}function bp(t,e){pp(e,"value",0),t?gl=e:ml=e}function mp(t,e,r,n){let i=yp(e,n,r);if(i!=null){if(!hp(i)||i<0){let s=n?`options.${r}`:"options.highWaterMark";throw new _p(s,i)}return dp(i)}return wl(t.objectMode)}xl.exports={getHighWaterMark:mp,getDefaultHighWaterMark:wl,setDefaultHighWaterMark:bp}});var Rl=v((Vi,El)=>{var gn=pe(),xe=gn.Buffer;function Sl(t,e){for(var r in t)e[r]=t[r]}xe.from&&xe.alloc&&xe.allocUnsafe&&xe.allocUnsafeSlow?El.exports=gn:(Sl(gn,Vi),Vi.Buffer=gt);function gt(t,e,r){return xe(t,e,r)}gt.prototype=Object.create(xe.prototype);Sl(xe,gt);gt.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return xe(t,e,r)};gt.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=xe(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};gt.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return xe(t)};gt.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return gn.SlowBuffer(t)}});var Tl=v(Al=>{"use strict";var Qi=Rl().Buffer,Il=Qi.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 gp(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 wp(t){var e=gp(t);if(typeof e!="string"&&(Qi.isEncoding===Il||!Il(t)))throw new Error("Unknown encoding: "+t);return e||t}Al.StringDecoder=Ar;function Ar(t){this.encoding=wp(t);var e;switch(this.encoding){case"utf16le":this.text=Ap,this.end=Tp,e=4;break;case"utf8":this.fillLast=Ep,e=4;break;case"base64":this.text=vp,this.end=kp,e=3;break;default:this.write=jp,this.end=Np;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Qi.allocUnsafe(e)}Ar.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||""};Ar.prototype.end=Ip;Ar.prototype.text=Rp;Ar.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 Ki(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function xp(t,e,r){var n=e.length-1;if(n<r)return 0;var i=Ki(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=Ki(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=Ki(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function Sp(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 Ep(t){var e=this.lastTotal-this.lastNeed,r=Sp(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 Rp(t,e){var r=xp(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function Ip(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Ap(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=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 Tp(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 vp(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 kp(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function jp(t){return t.toString(this.encoding)}function Np(t){return t&&t.length?this.write(t):""}});var Ji=v((qg,Nl)=>{"use strict";var vl=Qe(),{PromisePrototypeThen:Pp,SymbolAsyncIterator:kl,SymbolIterator:jl}=B(),{Buffer:Op}=pe(),{ERR_INVALID_ARG_TYPE:Lp,ERR_STREAM_NULL_VALUES:Bp}=Q().codes;function Cp(t,e,r){let n;if(typeof e=="string"||e instanceof Op)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[kl])i=!0,n=e[kl]();else if(e&&e[jl])i=!1,n=e[jl]();else throw new Lp("iterable",["Iterable"],e);let s=new t({objectMode:!0,highWaterMark:1,...r}),o=!1;s._read=function(){o||(o=!0,l())},s._destroy=function(u,f){Pp(a(u),()=>vl.nextTick(f,u),c=>vl.nextTick(f,c||u))};async function a(u){let f=u!=null,c=typeof n.throw=="function";if(f&&c){let{value:d,done:h}=await n.throw(u);if(await d,h)return}if(typeof n.return=="function"){let{value:d}=await n.return();await d}}async function l(){for(;;){try{let{value:u,done:f}=i?await n.next():n.next();if(f)s.push(null);else{let c=u&&typeof u.then=="function"?await u:u;if(c===null)throw o=!1,new Bp;if(s.push(c))continue;o=!1}}catch(u){s.destroy(u)}break}}return s}Nl.exports=Cp});var vr=v((Wg,Ql)=>{"use strict";var le=Qe(),{ArrayPrototypeIndexOf:Fp,NumberIsInteger:Mp,NumberIsNaN:Dp,NumberParseInt:Up,ObjectDefineProperties:is,ObjectKeys:$p,ObjectSetPrototypeOf:Ll,Promise:Bl,SafeSet:qp,SymbolAsyncDispose:Wp,SymbolAsyncIterator:zp,Symbol:Gp}=B();Ql.exports=I;I.ReadableState=En;var{EventEmitter:Hp}=Er(),{Stream:Ye,prependListener:Vp}=yn(),{Buffer:Yi}=pe(),{addAbortSignal:Kp}=Rr(),Cl=Be(),A=Y().debuglog("stream",t=>{A=t}),Qp=bl(),Yt=mt(),{getHighWaterMark:Jp,getDefaultHighWaterMark:Yp}=Ir(),{aggregateTwoErrors:Pl,codes:{ERR_INVALID_ARG_TYPE:Zp,ERR_METHOD_NOT_IMPLEMENTED:Xp,ERR_OUT_OF_RANGE:e_,ERR_STREAM_PUSH_AFTER_EOF:t_,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:r_},AbortError:n_}=Q(),{validateObject:i_}=Ht(),wt=Gp("kPaused"),{StringDecoder:Fl}=Tl(),s_=Ji();Ll(I.prototype,Ye.prototype);Ll(I,Ye);var Zi=()=>{},{errorOrDestroy:Qt}=Yt,Jt=1,o_=2,Ml=4,Tr=8,Dl=16,wn=32,xn=64,Ul=128,a_=256,l_=512,u_=1024,rs=2048,ns=4096,f_=8192,c_=16384,d_=32768,$l=65536,h_=1<<17,p_=1<<18;function q(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}is(En.prototype,{objectMode:q(Jt),ended:q(o_),endEmitted:q(Ml),reading:q(Tr),constructed:q(Dl),sync:q(wn),needReadable:q(xn),emittedReadable:q(Ul),readableListening:q(a_),resumeScheduled:q(l_),errorEmitted:q(u_),emitClose:q(rs),autoDestroy:q(ns),destroyed:q(f_),closed:q(c_),closeEmitted:q(d_),multiAwaitDrain:q($l),readingMore:q(h_),dataEmitted:q(p_)});function En(t,e,r){typeof r!="boolean"&&(r=e instanceof Se()),this.state=rs|ns|Dl|wn,t&&t.objectMode&&(this.state|=Jt),r&&t&&t.readableObjectMode&&(this.state|=Jt),this.highWaterMark=t?Jp(this,t,"readableHighWaterMark",r):Yp(!1),this.buffer=new Qp,this.length=0,this.pipes=[],this.flowing=null,this[wt]=null,t&&t.emitClose===!1&&(this.state&=~rs),t&&t.autoDestroy===!1&&(this.state&=~ns),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Fl(t.encoding),this.encoding=t.encoding)}function I(t){if(!(this instanceof I))return new I(t);let e=this instanceof Se();this._readableState=new En(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&&Kp(t.signal,this)),Ye.call(this,t),Yt.construct(this,()=>{this._readableState.needReadable&&Sn(this,this._readableState)})}I.prototype.destroy=Yt.destroy;I.prototype._undestroy=Yt.undestroy;I.prototype._destroy=function(t,e){e(t)};I.prototype[Hp.captureRejectionSymbol]=function(t){this.destroy(t)};I.prototype[Wp]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new n_,this.destroy(t)),new Bl((e,r)=>Cl(this,n=>n&&n!==t?r(n):e(null)))};I.prototype.push=function(t,e){return ql(this,t,e,!1)};I.prototype.unshift=function(t,e){return ql(this,t,e,!0)};function ql(t,e,r,n){A("readableAddChunk",e);let i=t._readableState,s;if((i.state&Jt)===0&&(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=Yi.from(e,r).toString(i.encoding):(e=Yi.from(e,r),r=""))):e instanceof Yi?r="":Ye._isUint8Array(e)?(e=Ye._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new Zp("chunk",["string","Buffer","Uint8Array"],e))),s)Qt(t,s);else if(e===null)i.state&=~Tr,b_(t,i);else if((i.state&Jt)!==0||e&&e.length>0)if(n)if((i.state&Ml)!==0)Qt(t,new r_);else{if(i.destroyed||i.errored)return!1;Xi(t,i,e,!0)}else if(i.ended)Qt(t,new t_);else{if(i.destroyed||i.errored)return!1;i.state&=~Tr,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?Xi(t,i,e,!1):Sn(t,i)):Xi(t,i,e,!1)}else n||(i.state&=~Tr,Sn(t,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function Xi(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&$l)!==0?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),(e.state&xn)!==0&&Rn(t)),Sn(t,e)}I.prototype.isPaused=function(){let t=this._readableState;return t[wt]===!0||t.flowing===!1};I.prototype.setEncoding=function(t){let e=new Fl(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,n="";for(let i of r)n+=e.write(i);return r.clear(),n!==""&&r.push(n),this._readableState.length=n.length,this};var __=1073741824;function y_(t){if(t>__)throw new e_("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Ol(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&Jt)!==0?1:Dp(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}I.prototype.read=function(t){A("read",t),t===void 0?t=NaN:Mp(t)||(t=Up(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=y_(t)),t!==0&&(e.state&=~Ul),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return A("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?es(this):Rn(this),null;if(t=Ol(t,e),t===0&&e.ended)return e.length===0&&es(this),null;let n=(e.state&xn)!==0;if(A("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,A("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,A("reading, ended or constructing",n);else if(n){A("do read"),e.state|=Tr|wn,e.length===0&&(e.state|=xn);try{this._read(e.highWaterMark)}catch(s){Qt(this,s)}e.state&=~wn,e.reading||(t=Ol(r,e))}let i;return t>0?i=Vl(t,e):i=null,i===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&&es(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function b_(t,e){if(A("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?Rn(t):(e.needReadable=!1,e.emittedReadable=!0,Wl(t))}}function Rn(t){let e=t._readableState;A("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(A("emitReadable",e.flowing),e.emittedReadable=!0,le.nextTick(Wl,t))}function Wl(t){let e=t._readableState;A("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,Gl(t)}function Sn(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,le.nextTick(m_,t,e))}function m_(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(A("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}I.prototype._read=function(t){throw new Xp("_read()")};I.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new qp(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),A("pipe count=%d opts=%j",n.pipes.length,e);let s=(!e||e.end!==!1)&&t!==le.stdout&&t!==le.stderr?a:x;n.endEmitted?le.nextTick(s):r.once("end",s),t.on("unpipe",o);function o(b,g){A("onunpipe"),b===r&&g&&g.hasUnpiped===!1&&(g.hasUnpiped=!0,f())}function a(){A("onend"),t.end()}let l,u=!1;function f(){A("cleanup"),t.removeListener("close",y),t.removeListener("finish",_),l&&t.removeListener("drain",l),t.removeListener("error",h),t.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",x),r.removeListener("data",d),u=!0,l&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&l()}function c(){u||(n.pipes.length===1&&n.pipes[0]===t?(A("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(A("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),l||(l=g_(r,t),t.on("drain",l))}r.on("data",d);function d(b){A("ondata");let g=t.write(b);A("dest.write",g),g===!1&&c()}function h(b){if(A("onerror",b),x(),t.removeListener("error",h),t.listenerCount("error")===0){let g=t._writableState||t._readableState;g&&!g.errorEmitted?Qt(t,b):t.emit("error",b)}}Vp(t,"error",h);function y(){t.removeListener("finish",_),x()}t.once("close",y);function _(){A("onfinish"),t.removeListener("close",y),x()}t.once("finish",_);function x(){A("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?c():n.flowing||(A("pipe resume"),r.resume()),t};function g_(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(A("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(A("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}I.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let i=e.pipes;e.pipes=[],this.pause();for(let s=0;s<i.length;s++)i[s].emit("unpipe",this,{hasUnpiped:!1});return this}let n=Fp(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};I.prototype.on=function(t,e){let r=Ye.prototype.on.call(this,t,e),n=this._readableState;return t==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,A("on readable",n.length,n.reading),n.length?Rn(this):n.reading||le.nextTick(w_,this)),r};I.prototype.addListener=I.prototype.on;I.prototype.removeListener=function(t,e){let r=Ye.prototype.removeListener.call(this,t,e);return t==="readable"&&le.nextTick(zl,this),r};I.prototype.off=I.prototype.removeListener;I.prototype.removeAllListeners=function(t){let e=Ye.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&le.nextTick(zl,this),e};function zl(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[wt]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function w_(t){A("readable nexttick read 0"),t.read(0)}I.prototype.resume=function(){let t=this._readableState;return t.flowing||(A("resume"),t.flowing=!t.readableListening,x_(this,t)),t[wt]=!1,this};function x_(t,e){e.resumeScheduled||(e.resumeScheduled=!0,le.nextTick(S_,t,e))}function S_(t,e){A("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Gl(t),e.flowing&&!e.reading&&t.read(0)}I.prototype.pause=function(){return A("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(A("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[wt]=!0,this};function Gl(t){let e=t._readableState;for(A("flow",e.flowing);e.flowing&&t.read()!==null;);}I.prototype.wrap=function(t){let e=!1;t.on("data",n=>{!this.push(n)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",n=>{Qt(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=$p(t);for(let n=1;n<r.length;n++){let i=r[n];this[i]===void 0&&typeof t[i]=="function"&&(this[i]=t[i].bind(t))}return this};I.prototype[zp]=function(){return Hl(this)};I.prototype.iterator=function(t){return t!==void 0&&i_(t,"options"),Hl(this,t)};function Hl(t,e){typeof t.read!="function"&&(t=I.wrap(t,{objectMode:!0}));let r=E_(t,e);return r.stream=t,r}async function*E_(t,e){let r=Zi;function n(o){this===t?(r(),r=Zi):r=o}t.on("readable",n);let i,s=Cl(t,{writable:!1},o=>{i=o?Pl(i,o):null,r(),r=Zi});try{for(;;){let o=t.destroyed?null:t.read();if(o!==null)yield o;else{if(i)throw i;if(i===null)return;await new Bl(n)}}}catch(o){throw i=Pl(i,o),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?Yt.destroyer(t,null):(t.off("readable",n),s())}}is(I.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}}});is(En.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[wt]!==!1},set(t){this[wt]=!!t}}});I._fromList=Vl;function Vl(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 es(t){let e=t._readableState;A("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,le.nextTick(R_,e,t))}function R_(t,e){if(A("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)le.nextTick(I_,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function I_(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}I.from=function(t,e){return s_(I,t,e)};var ts;function Kl(){return ts===void 0&&(ts={}),ts}I.fromWeb=function(t,e){return Kl().newStreamReadableFromReadableStream(t,e)};I.toWeb=function(t,e){return Kl().newReadableStreamFromStreamReadable(t,e)};I.wrap=function(t,e){var r,n;return new I({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(i,s){Yt.destroyer(t,i),s(i)}}).wrap(t)}});var kn=v((zg,au)=>{"use strict";var xt=Qe(),{ArrayPrototypeSlice:Zl,Error:A_,FunctionPrototypeSymbolHasInstance:Xl,ObjectDefineProperty:eu,ObjectDefineProperties:T_,ObjectSetPrototypeOf:tu,StringPrototypeToLowerCase:v_,Symbol:k_,SymbolHasInstance:j_}=B();au.exports=C;C.WritableState=Nr;var{EventEmitter:N_}=Er(),kr=yn().Stream,{Buffer:In}=pe(),vn=mt(),{addAbortSignal:P_}=Rr(),{getHighWaterMark:O_,getDefaultHighWaterMark:L_}=Ir(),{ERR_INVALID_ARG_TYPE:B_,ERR_METHOD_NOT_IMPLEMENTED:C_,ERR_MULTIPLE_CALLBACK:ru,ERR_STREAM_CANNOT_PIPE:F_,ERR_STREAM_DESTROYED:jr,ERR_STREAM_ALREADY_FINISHED:M_,ERR_STREAM_NULL_VALUES:D_,ERR_STREAM_WRITE_AFTER_END:U_,ERR_UNKNOWN_ENCODING:nu}=Q().codes,{errorOrDestroy:Zt}=vn;tu(C.prototype,kr.prototype);tu(C,kr);function as(){}var Xt=k_("kOnFinished");function Nr(t,e,r){typeof r!="boolean"&&(r=e instanceof Se()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?O_(this,t,"writableHighWaterMark",r):L_(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let n=!!(t&&t.decodeStrings===!1);this.decodeStrings=!n,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=q_.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Tn(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[Xt]=[]}function Tn(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Nr.prototype.getBuffer=function(){return Zl(this.buffered,this.bufferedIndex)};eu(Nr.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function C(t){let e=this instanceof Se();if(!e&&!Xl(C,this))return new C(t);this._writableState=new Nr(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&&P_(t.signal,this)),kr.call(this,t),vn.construct(this,()=>{let r=this._writableState;r.writing||us(this,r),fs(this,r)})}eu(C,j_,{__proto__:null,value:function(t){return Xl(this,t)?!0:this!==C?!1:t&&t._writableState instanceof Nr}});C.prototype.pipe=function(){Zt(this,new F_)};function iu(t,e,r,n){let i=t._writableState;if(typeof r=="function")n=r,r=i.defaultEncoding;else{if(!r)r=i.defaultEncoding;else if(r!=="buffer"&&!In.isEncoding(r))throw new nu(r);typeof n!="function"&&(n=as)}if(e===null)throw new D_;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=In.from(e,r),r="buffer");else if(e instanceof In)r="buffer";else if(kr._isUint8Array(e))e=kr._uint8ArrayToBuffer(e),r="buffer";else throw new B_("chunk",["string","Buffer","Uint8Array"],e);let s;return i.ending?s=new U_:i.destroyed&&(s=new jr("write")),s?(xt.nextTick(n,s),Zt(t,s,!0),s):(i.pendingcb++,$_(t,i,e,r,n))}C.prototype.write=function(t,e,r){return iu(this,t,e,r)===!0};C.prototype.cork=function(){this._writableState.corked++};C.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||us(this,t))};C.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=v_(e)),!In.isEncoding(e))throw new nu(e);return this._writableState.defaultEncoding=e,this};function $_(t,e,r,n,i){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:n,callback:i}),e.allBuffers&&n!=="buffer"&&(e.allBuffers=!1),e.allNoop&&i!==as&&(e.allNoop=!1)):(e.writelen=s,e.writecb=i,e.writing=!0,e.sync=!0,t._write(r,n,e.onwrite),e.sync=!1),o&&!e.errored&&!e.destroyed}function Jl(t,e,r,n,i,s,o){e.writelen=n,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new jr("write")):r?t._writev(i,e.onwrite):t._write(i,s,e.onwrite),e.sync=!1}function Yl(t,e,r,n){--e.pendingcb,n(r),ls(e),Zt(t,r)}function q_(t,e){let r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function"){Zt(t,new ru);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),n?xt.nextTick(Yl,t,r,e,i):Yl(t,r,e,i)):(r.buffered.length>r.bufferedIndex&&us(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},xt.nextTick(W_,r.afterWriteTickInfo)):su(t,r,1,i))}function W_({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,su(t,e,r,n)}function su(t,e,r,n){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,n();e.destroyed&&ls(e),fs(t,e)}function ls(t){if(t.writing)return;for(let i=t.bufferedIndex;i<t.buffered.length;++i){var e;let{chunk:s,callback:o}=t.buffered[i],a=t.objectMode?1:s.length;t.length-=a,o((e=t.errored)!==null&&e!==void 0?e:new jr("write"))}let r=t[Xt].splice(0);for(let i=0;i<r.length;i++){var n;r[i]((n=t.errored)!==null&&n!==void 0?n:new jr("end"))}Tn(t)}function us(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:n,objectMode:i}=e,s=r.length-n;if(!s)return;let o=n;if(e.bufferProcessing=!0,s>1&&t._writev){e.pendingcb-=s-1;let a=e.allNoop?as:u=>{for(let f=o;f<r.length;++f)r[f].callback(u)},l=e.allNoop&&o===0?r:Zl(r,o);l.allBuffers=e.allBuffers,Jl(t,e,!0,e.length,l,"",a),Tn(e)}else{do{let{chunk:a,encoding:l,callback:u}=r[o];r[o++]=null;let f=i?1:a.length;Jl(t,e,!1,f,a,l,u)}while(o<r.length&&!e.writing);o===r.length?Tn(e):o>256?(r.splice(0,o),e.bufferedIndex=0):e.bufferedIndex=o}e.bufferProcessing=!1}C.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new C_("_write()")};C.prototype._writev=null;C.prototype.end=function(t,e,r){let n=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let i;if(t!=null){let s=iu(this,t,e);s instanceof A_&&(i=s)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,fs(this,n,!0),n.ended=!0):n.finished?i=new M_("end"):n.destroyed&&(i=new jr("end"))),typeof r=="function"&&(i||n.finished?xt.nextTick(r,i):n[Xt].push(r)),this};function An(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 z_(t,e){let r=!1;function n(i){if(r){Zt(t,i??ru());return}if(r=!0,e.pendingcb--,i){let s=e[Xt].splice(0);for(let o=0;o<s.length;o++)s[o](i);Zt(t,i,e.sync)}else An(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,xt.nextTick(os,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(i){n(i)}e.sync=!1}function G_(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,z_(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function fs(t,e,r){An(e)&&(G_(t,e),e.pendingcb===0&&(r?(e.pendingcb++,xt.nextTick((n,i)=>{An(i)?os(n,i):i.pendingcb--},t,e)):An(e)&&(e.pendingcb++,os(t,e))))}function os(t,e){e.pendingcb--,e.finished=!0;let r=e[Xt].splice(0);for(let n=0;n<r.length;n++)r[n]();if(t.emit("finish"),e.autoDestroy){let n=t._readableState;(!n||n.autoDestroy&&(n.endEmitted||n.readable===!1))&&t.destroy()}}T_(C.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var H_=vn.destroy;C.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[Xt].length)&&xt.nextTick(ls,r),H_.call(this,t,e),this};C.prototype._undestroy=vn.undestroy;C.prototype._destroy=function(t,e){e(t)};C.prototype[N_.captureRejectionSymbol]=function(t){this.destroy(t)};var ss;function ou(){return ss===void 0&&(ss={}),ss}C.fromWeb=function(t,e){return ou().newStreamWritableFromWritableStream(t,e)};C.toWeb=function(t){return ou().newWritableStreamFromStreamWritable(t)}});var Su=v((Gg,xu)=>{var cs=Qe(),V_=pe(),{isReadable:K_,isWritable:Q_,isIterable:lu,isNodeStream:J_,isReadableNodeStream:uu,isWritableNodeStream:fu,isDuplexNodeStream:Y_,isReadableStream:cu,isWritableStream:du}=ge(),hu=Be(),{AbortError:gu,codes:{ERR_INVALID_ARG_TYPE:Z_,ERR_INVALID_RETURN_VALUE:pu}}=Q(),{destroyer:tr}=mt(),X_=Se(),wu=vr(),ey=kn(),{createDeferredPromise:_u}=Y(),yu=Ji(),bu=globalThis.Blob||V_.Blob,ty=typeof bu<"u"?function(e){return e instanceof bu}:function(e){return!1},ry=globalThis.AbortController||Wt().AbortController,{FunctionPrototypeCall:mu}=B(),Ze=class extends X_{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};xu.exports=function t(e,r){if(Y_(e))return e;if(uu(e))return er({readable:e});if(fu(e))return er({writable:e});if(J_(e))return er({writable:!1,readable:!1});if(cu(e))return er({readable:wu.fromWeb(e)});if(du(e))return er({writable:ey.fromWeb(e)});if(typeof e=="function"){let{value:i,write:s,final:o,destroy:a}=ny(e);if(lu(i))return yu(Ze,i,{objectMode:!0,write:s,final:o,destroy:a});let l=i?.then;if(typeof l=="function"){let u,f=mu(l,i,c=>{if(c!=null)throw new pu("nully","body",c)},c=>{tr(u,c)});return u=new Ze({objectMode:!0,readable:!1,write:s,final(c){o(async()=>{try{await f,cs.nextTick(c,null)}catch(d){cs.nextTick(c,d)}})},destroy:a})}throw new pu("Iterable, AsyncIterable or AsyncFunction",r,i)}if(ty(e))return t(e.arrayBuffer());if(lu(e))return yu(Ze,e,{objectMode:!0,writable:!1});if(cu(e?.readable)&&du(e?.writable))return Ze.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?uu(e?.readable)?e?.readable:t(e.readable):void 0,s=e!=null&&e.writable?fu(e?.writable)?e?.writable:t(e.writable):void 0;return er({readable:i,writable:s})}let n=e?.then;if(typeof n=="function"){let i;return mu(n,e,s=>{s!=null&&i.push(s),i.push(null)},s=>{tr(i,s)}),i=new Ze({objectMode:!0,writable:!1,read(){}})}throw new Z_(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function ny(t){let{promise:e,resolve:r}=_u(),n=new ry,i=n.signal;return{value:t((async function*(){for(;;){let o=e;e=null;let{chunk:a,done:l,cb:u}=await o;if(cs.nextTick(u),l)return;if(i.aborted)throw new gu(void 0,{cause:i.reason});({promise:e,resolve:r}=_u()),yield a}})(),{signal:i}),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){n.abort(),a(o)}}}function er(t){let e=t.readable&&typeof t.readable.read!="function"?wu.wrap(t.readable):t.readable,r=t.writable,n=!!K_(e),i=!!Q_(r),s,o,a,l,u;function f(c){let d=l;l=null,d?d(c):c&&u.destroy(c)}return u=new Ze({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(hu(r,c=>{i=!1,c&&tr(e,c),f(c)}),u._write=function(c,d,h){r.write(c,d)?h():s=h},u._final=function(c){r.end(),o=c},r.on("drain",function(){if(s){let c=s;s=null,c()}}),r.on("finish",function(){if(o){let c=o;o=null,c()}})),n&&(hu(e,c=>{n=!1,c&&tr(e,c),f(c)}),e.on("readable",function(){if(a){let c=a;a=null,c()}}),e.on("end",function(){u.push(null)}),u._read=function(){for(;;){let c=e.read();if(c===null){a=u._read;return}if(!u.push(c))return}}),u._destroy=function(c,d){!c&&l!==null&&(c=new gu),a=null,s=null,o=null,l===null?d(c):(l=d,tr(r,c),tr(e,c))},u}});var Se=v((Hg,Iu)=>{"use strict";var{ObjectDefineProperties:iy,ObjectGetOwnPropertyDescriptor:Ce,ObjectKeys:sy,ObjectSetPrototypeOf:Eu}=B();Iu.exports=ue;var ps=vr(),se=kn();Eu(ue.prototype,ps.prototype);Eu(ue,ps);{let t=sy(se.prototype);for(let e=0;e<t.length;e++){let r=t[e];ue.prototype[r]||(ue.prototype[r]=se.prototype[r])}}function ue(t){if(!(this instanceof ue))return new ue(t);ps.call(this,t),se.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}iy(ue.prototype,{writable:{__proto__:null,...Ce(se.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Ce(se.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Ce(se.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Ce(se.prototype,"writableBuffer")},writableLength:{__proto__:null,...Ce(se.prototype,"writableLength")},writableFinished:{__proto__:null,...Ce(se.prototype,"writableFinished")},writableCorked:{__proto__:null,...Ce(se.prototype,"writableCorked")},writableEnded:{__proto__:null,...Ce(se.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Ce(se.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 ds;function Ru(){return ds===void 0&&(ds={}),ds}ue.fromWeb=function(t,e){return Ru().newStreamDuplexFromReadableWritablePair(t,e)};ue.toWeb=function(t){return Ru().newReadableWritablePairFromDuplex(t)};var hs;ue.from=function(t){return hs||(hs=Su()),hs(t,"body")}});var bs=v((Vg,Tu)=>{"use strict";var{ObjectSetPrototypeOf:Au,Symbol:oy}=B();Tu.exports=Fe;var{ERR_METHOD_NOT_IMPLEMENTED:ay}=Q().codes,ys=Se(),{getHighWaterMark:ly}=Ir();Au(Fe.prototype,ys.prototype);Au(Fe,ys);var Pr=oy("kCallback");function Fe(t){if(!(this instanceof Fe))return new Fe(t);let e=t?ly(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),ys.call(this,t),this._readableState.sync=!1,this[Pr]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",uy)}function _s(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 uy(){this._final!==_s&&_s.call(this)}Fe.prototype._final=_s;Fe.prototype._transform=function(t,e,r){throw new ay("_transform()")};Fe.prototype._write=function(t,e,r){let n=this._readableState,i=this._writableState,s=n.length;this._transform(t,e,(o,a)=>{if(o){r(o);return}a!=null&&this.push(a),i.ended||s===n.length||n.length<n.highWaterMark?r():this[Pr]=r})};Fe.prototype._read=function(){if(this[Pr]){let t=this[Pr];this[Pr]=null,t()}}});var gs=v((Kg,ku)=>{"use strict";var{ObjectSetPrototypeOf:vu}=B();ku.exports=rr;var ms=bs();vu(rr.prototype,ms.prototype);vu(rr,ms);function rr(t){if(!(this instanceof rr))return new rr(t);ms.call(this,t)}rr.prototype._transform=function(t,e,r){r(null,t)}});var On=v((Qg,Lu)=>{var Or=Qe(),{ArrayIsArray:fy,Promise:cy,SymbolAsyncIterator:dy,SymbolDispose:hy}=B(),Pn=Be(),{once:py}=Y(),_y=mt(),ju=Se(),{aggregateTwoErrors:yy,codes:{ERR_INVALID_ARG_TYPE:vs,ERR_INVALID_RETURN_VALUE:ws,ERR_MISSING_ARGS:by,ERR_STREAM_DESTROYED:my,ERR_STREAM_PREMATURE_CLOSE:gy},AbortError:wy}=Q(),{validateFunction:xy,validateAbortSignal:Sy}=Ht(),{isIterable:St,isReadable:xs,isReadableNodeStream:Nn,isNodeStream:Nu,isTransformStream:nr,isWebStream:Ey,isReadableStream:Ss,isReadableFinished:Ry}=ge(),Iy=globalThis.AbortController||Wt().AbortController,Es,Rs,Is;function Pu(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=Pn(t,{readable:e,writable:r},s=>{n=!s});return{destroy:s=>{n||(n=!0,_y.destroyer(t,s||new my("pipe")))},cleanup:i}}function Ay(t){return xy(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function As(t){if(St(t))return t;if(Nn(t))return Ty(t);throw new vs("val",["Readable","Iterable","AsyncIterable"],t)}async function*Ty(t){Rs||(Rs=vr()),yield*Rs.prototype[dy].call(t)}async function jn(t,e,r,{end:n}){let i,s=null,o=u=>{if(u&&(i=u),s){let f=s;s=null,f()}},a=()=>new cy((u,f)=>{i?f(i):s=()=>{i?f(i):u()}});e.on("drain",o);let l=Pn(e,{readable:!1},o);try{e.writableNeedDrain&&await a();for await(let u of t)e.write(u)||await a();n&&(e.end(),await a()),r()}catch(u){r(i!==u?yy(i,u):u)}finally{l(),e.off("drain",o)}}async function Ts(t,e,r,{end:n}){nr(e)&&(e=e.writable);let i=e.getWriter();try{for await(let s of t)await i.ready,i.write(s).catch(()=>{});await i.ready,n&&await i.close(),r()}catch(s){try{await i.abort(s),r(s)}catch(o){r(o)}}}function vy(...t){return Ou(t,py(Ay(t)))}function Ou(t,e,r){if(t.length===1&&fy(t[0])&&(t=t[0]),t.length<2)throw new by("streams");let n=new Iy,i=n.signal,s=r?.signal,o=[];Sy(s,"options.signal");function a(){y(new wy)}Is=Is||Y().addAbortListener;let l;s&&(l=Is(s,a));let u,f,c=[],d=0;function h(S){y(S,--d===0)}function y(S,w){var T;if(S&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=S),!(!u&&!w)){for(;c.length;)c.shift()(u);(T=l)===null||T===void 0||T[hy](),n.abort(),w&&(u||o.forEach(Ae=>Ae()),Or.nextTick(e,u,f))}}let _;for(let S=0;S<t.length;S++){let w=t[S],T=S<t.length-1,Ae=S>0,U=T||r?.end!==!1,At=S===t.length-1;if(Nu(w)){let Z=function(Te){Te&&Te.name!=="AbortError"&&Te.code!=="ERR_STREAM_PREMATURE_CLOSE"&&h(Te)};var g=Z;if(U){let{destroy:Te,cleanup:Wn}=Pu(w,T,Ae);c.push(Te),xs(w)&&At&&o.push(Wn)}w.on("error",Z),xs(w)&&At&&o.push(()=>{w.removeListener("error",Z)})}if(S===0)if(typeof w=="function"){if(_=w({signal:i}),!St(_))throw new ws("Iterable, AsyncIterable or Stream","source",_)}else St(w)||Nn(w)||nr(w)?_=w:_=ju.from(w);else if(typeof w=="function"){if(nr(_)){var x;_=As((x=_)===null||x===void 0?void 0:x.readable)}else _=As(_);if(_=w(_,{signal:i}),T){if(!St(_,!0))throw new ws("AsyncIterable",`transform[${S-1}]`,_)}else{var b;Es||(Es=gs());let Z=new Es({objectMode:!0}),Te=(b=_)===null||b===void 0?void 0:b.then;if(typeof Te=="function")d++,Te.call(_,Ue=>{f=Ue,Ue!=null&&Z.write(Ue),U&&Z.end(),Or.nextTick(h)},Ue=>{Z.destroy(Ue),Or.nextTick(h,Ue)});else if(St(_,!0))d++,jn(_,Z,h,{end:U});else if(Ss(_)||nr(_)){let Ue=_.readable||_;d++,jn(Ue,Z,h,{end:U})}else throw new ws("AsyncIterable or Promise","destination",_);_=Z;let{destroy:Wn,cleanup:xf}=Pu(_,!1,!0);c.push(Wn),At&&o.push(xf)}}else if(Nu(w)){if(Nn(_)){d+=2;let Z=ky(_,w,h,{end:U});xs(w)&&At&&o.push(Z)}else if(nr(_)||Ss(_)){let Z=_.readable||_;d++,jn(Z,w,h,{end:U})}else if(St(_))d++,jn(_,w,h,{end:U});else throw new vs("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);_=w}else if(Ey(w)){if(Nn(_))d++,Ts(As(_),w,h,{end:U});else if(Ss(_)||St(_))d++,Ts(_,w,h,{end:U});else if(nr(_))d++,Ts(_.readable,w,h,{end:U});else throw new vs("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);_=w}else _=ju.from(w)}return(i!=null&&i.aborted||s!=null&&s.aborted)&&Or.nextTick(a),_}function ky(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new gy)}),t.pipe(e,{end:!1}),n){let o=function(){i=!0,e.end()};var s=o;Ry(t)?Or.nextTick(o):t.once("end",o)}else r();return Pn(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)}),Pn(e,{readable:!1,writable:!0},r)}Lu.exports={pipelineImpl:Ou,pipeline:vy}});var js=v((Jg,Uu)=>{"use strict";var{pipeline:jy}=On(),Ln=Se(),{destroyer:Ny}=mt(),{isNodeStream:Bn,isReadable:Bu,isWritable:Cu,isWebStream:ks,isTransformStream:Et,isWritableStream:Fu,isReadableStream:Mu}=ge(),{AbortError:Py,codes:{ERR_INVALID_ARG_VALUE:Du,ERR_MISSING_ARGS:Oy}}=Q(),Ly=Be();Uu.exports=function(...e){if(e.length===0)throw new Oy("streams");if(e.length===1)return Ln.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=Ln.from(e[0])),typeof e[e.length-1]=="function"){let h=e.length-1;e[h]=Ln.from(e[h])}for(let h=0;h<e.length;++h)if(!(!Bn(e[h])&&!ks(e[h]))){if(h<e.length-1&&!(Bu(e[h])||Mu(e[h])||Et(e[h])))throw new Du(`streams[${h}]`,r[h],"must be readable");if(h>0&&!(Cu(e[h])||Fu(e[h])||Et(e[h])))throw new Du(`streams[${h}]`,r[h],"must be writable")}let n,i,s,o,a;function l(h){let y=o;o=null,y?y(h):h?a.destroy(h):!d&&!c&&a.destroy()}let u=e[0],f=jy(e,l),c=!!(Cu(u)||Fu(u)||Et(u)),d=!!(Bu(f)||Mu(f)||Et(f));if(a=new Ln({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(f!=null&&f.readableObjectMode),writable:c,readable:d}),c){if(Bn(u))a._write=function(y,_,x){u.write(y,_)?x():n=x},a._final=function(y){u.end(),i=y},u.on("drain",function(){if(n){let y=n;n=null,y()}});else if(ks(u)){let _=(Et(u)?u.writable:u).getWriter();a._write=async function(x,b,g){try{await _.ready,_.write(x).catch(()=>{}),g()}catch(S){g(S)}},a._final=async function(x){try{await _.ready,_.close().catch(()=>{}),i=x}catch(b){x(b)}}}let h=Et(f)?f.readable:f;Ly(h,()=>{if(i){let y=i;i=null,y()}})}if(d){if(Bn(f))f.on("readable",function(){if(s){let h=s;s=null,h()}}),f.on("end",function(){a.push(null)}),a._read=function(){for(;;){let h=f.read();if(h===null){s=a._read;return}if(!a.push(h))return}};else if(ks(f)){let y=(Et(f)?f.readable:f).getReader();a._read=async function(){for(;;)try{let{value:_,done:x}=await y.read();if(!a.push(_))return;if(x){a.push(null);return}}catch{return}}}}return a._destroy=function(h,y){!h&&o!==null&&(h=new Py),s=null,n=null,i=null,o===null?y(h):(o=y,Bn(f)&&Ny(f,h))},a}});var Ju=v((Yg,Os)=>{"use strict";var By=globalThis.AbortController||Wt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Cy,ERR_INVALID_ARG_TYPE:Lr,ERR_MISSING_ARGS:Fy,ERR_OUT_OF_RANGE:My},AbortError:Ee}=Q(),{validateAbortSignal:Rt,validateInteger:$u,validateObject:It}=Ht(),Dy=B().Symbol("kWeak"),Uy=B().Symbol("kResistStopPropagation"),{finished:$y}=Be(),qy=js(),{addAbortSignalNoValidate:Wy}=Rr(),{isWritable:zy,isNodeStream:Gy}=ge(),{deprecate:Hy}=Y(),{ArrayPrototypePush:Vy,Boolean:Ky,MathFloor:qu,Number:Qy,NumberIsNaN:Jy,Promise:Wu,PromiseReject:zu,PromiseResolve:Yy,PromisePrototypeThen:Gu,Symbol:Vu}=B(),Cn=Vu("kEmpty"),Hu=Vu("kEof");function Zy(t,e){if(e!=null&&It(e,"options"),e?.signal!=null&&Rt(e.signal,"options.signal"),Gy(t)&&!zy(t))throw new Cy("stream",t,"must be writable");let r=qy(this,t);return e!=null&&e.signal&&Wy(e.signal,r),r}function Fn(t,e){if(typeof t!="function")throw new Lr("fn",["Function","AsyncFunction"],t);e!=null&&It(e,"options"),e?.signal!=null&&Rt(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=qu(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=qu(e.highWaterMark)),$u(r,"options.concurrency",1),$u(n,"options.highWaterMark",0),n+=r,async function*(){let s=Y().AbortSignalAny([e?.signal].filter(Ky)),o=this,a=[],l={signal:s},u,f,c=!1,d=0;function h(){c=!0,y()}function y(){d-=1,_()}function _(){f&&!c&&d<r&&a.length<n&&(f(),f=null)}async function x(){try{for await(let b of o){if(c)return;if(s.aborted)throw new Ee;try{if(b=t(b,l),b===Cn)continue;b=Yy(b)}catch(g){b=zu(g)}d+=1,Gu(b,y,h),a.push(b),u&&(u(),u=null),!c&&(a.length>=n||d>=r)&&await new Wu(g=>{f=g})}a.push(Hu)}catch(b){let g=zu(b);Gu(g,y,h),a.push(g)}finally{c=!0,u&&(u(),u=null)}}x();try{for(;;){for(;a.length>0;){let b=await a[0];if(b===Hu)return;if(s.aborted)throw new Ee;b!==Cn&&(yield b),a.shift(),_()}await new Wu(b=>{u=b})}}finally{c=!0,f&&(f(),f=null)}}.call(this)}function Xy(t=void 0){return t!=null&&It(t,"options"),t?.signal!=null&&Rt(t.signal,"options.signal"),async function*(){let r=0;for await(let i of this){var n;if(t!=null&&(n=t.signal)!==null&&n!==void 0&&n.aborted)throw new Ee({cause:t.signal.reason});yield[r++,i]}}.call(this)}async function Ku(t,e=void 0){for await(let r of Ps.call(this,t,e))return!0;return!1}async function eb(t,e=void 0){if(typeof t!="function")throw new Lr("fn",["Function","AsyncFunction"],t);return!await Ku.call(this,async(...r)=>!await t(...r),e)}async function tb(t,e){for await(let r of Ps.call(this,t,e))return r}async function rb(t,e){if(typeof t!="function")throw new Lr("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),Cn}for await(let n of Fn.call(this,r,e));}function Ps(t,e){if(typeof t!="function")throw new Lr("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:Cn}return Fn.call(this,r,e)}var Ns=class extends Fy{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function nb(t,e,r){var n;if(typeof t!="function")throw new Lr("reducer",["Function","AsyncFunction"],t);r!=null&&It(r,"options"),r?.signal!=null&&Rt(r.signal,"options.signal");let i=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let u=new Ee(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await $y(this.destroy(u)),u}let s=new By,o=s.signal;if(r!=null&&r.signal){let u={once:!0,[Dy]:this,[Uy]:!0};r.signal.addEventListener("abort",()=>s.abort(),u)}let a=!1;try{for await(let u of this){var l;if(a=!0,r!=null&&(l=r.signal)!==null&&l!==void 0&&l.aborted)throw new Ee;i?e=await t(e,u,{signal:o}):(e=u,i=!0)}if(!a&&!i)throw new Ns}finally{s.abort()}return e}async function ib(t){t!=null&&It(t,"options"),t?.signal!=null&&Rt(t.signal,"options.signal");let e=[];for await(let n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new Ee(void 0,{cause:t.signal.reason});Vy(e,n)}return e}function sb(t,e){let r=Fn.call(this,t,e);return async function*(){for await(let i of r)yield*i}.call(this)}function Qu(t){if(t=Qy(t),Jy(t))return 0;if(t<0)throw new My("number",">= 0",t);return t}function ob(t,e=void 0){return e!=null&&It(e,"options"),e?.signal!=null&&Rt(e.signal,"options.signal"),t=Qu(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ee;for await(let s of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Ee;t--<=0&&(yield s)}}.call(this)}function ab(t,e=void 0){return e!=null&&It(e,"options"),e?.signal!=null&&Rt(e.signal,"options.signal"),t=Qu(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ee;for await(let s of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Ee;if(t-- >0&&(yield s),t<=0)return}}.call(this)}Os.exports.streamReturningOperators={asIndexedPairs:Hy(Xy,"readable.asIndexedPairs will be removed in a future version."),drop:ob,filter:Ps,flatMap:sb,map:Fn,take:ab,compose:Zy};Os.exports.promiseReturningOperators={every:eb,forEach:rb,reduce:nb,toArray:ib,some:Ku,find:tb}});var Ls=v((Zg,Yu)=>{"use strict";var{ArrayPrototypePop:lb,Promise:ub}=B(),{isIterable:fb,isNodeStream:cb,isWebStream:db}=ge(),{pipelineImpl:hb}=On(),{finished:pb}=Be();Bs();function _b(...t){return new ub((e,r)=>{let n,i,s=t[t.length-1];if(s&&typeof s=="object"&&!cb(s)&&!fb(s)&&!db(s)){let o=lb(t);n=o.signal,i=o.end}hb(t,(o,a)=>{o?r(o):e(a)},{signal:n,end:i})})}Yu.exports={finished:pb,pipeline:_b}});var Bs=v((Xg,af)=>{"use strict";var{Buffer:yb}=pe(),{ObjectDefineProperty:Me,ObjectKeys:ef,ReflectApply:tf}=B(),{promisify:{custom:rf}}=Y(),{streamReturningOperators:Zu,promiseReturningOperators:Xu}=Ju(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:nf}}=Q(),bb=js(),{setDefaultHighWaterMark:mb,getDefaultHighWaterMark:gb}=Ir(),{pipeline:sf}=On(),{destroyer:wb}=mt(),of=Be(),Cs=Ls(),Br=ge(),L=af.exports=yn().Stream;L.isDestroyed=Br.isDestroyed;L.isDisturbed=Br.isDisturbed;L.isErrored=Br.isErrored;L.isReadable=Br.isReadable;L.isWritable=Br.isWritable;L.Readable=vr();for(let t of ef(Zu)){let r=function(...n){if(new.target)throw nf();return L.Readable.from(tf(e,this,n))},e=Zu[t];Me(r,"name",{__proto__:null,value:e.name}),Me(r,"length",{__proto__:null,value:e.length}),Me(L.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of ef(Xu)){let r=function(...n){if(new.target)throw nf();return tf(e,this,n)},e=Xu[t];Me(r,"name",{__proto__:null,value:e.name}),Me(r,"length",{__proto__:null,value:e.length}),Me(L.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}L.Writable=kn();L.Duplex=Se();L.Transform=bs();L.PassThrough=gs();L.pipeline=sf;var{addAbortSignal:xb}=Rr();L.addAbortSignal=xb;L.finished=of;L.destroy=wb;L.compose=bb;L.setDefaultHighWaterMark=mb;L.getDefaultHighWaterMark=gb;Me(L,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Cs}});Me(sf,rf,{__proto__:null,enumerable:!0,get(){return Cs.pipeline}});Me(of,rf,{__proto__:null,enumerable:!0,get(){return Cs.finished}});L.Stream=L;L._isUint8Array=function(e){return e instanceof Uint8Array};L._uint8ArrayToBuffer=function(e){return yb.from(e.buffer,e.byteOffset,e.byteLength)}});var Mn=v((ew,M)=>{"use strict";var W=Bs(),Sb=Ls(),Eb=W.Readable.destroy;M.exports=W.Readable;M.exports._uint8ArrayToBuffer=W._uint8ArrayToBuffer;M.exports._isUint8Array=W._isUint8Array;M.exports.isDisturbed=W.isDisturbed;M.exports.isErrored=W.isErrored;M.exports.isReadable=W.isReadable;M.exports.Readable=W.Readable;M.exports.Writable=W.Writable;M.exports.Duplex=W.Duplex;M.exports.Transform=W.Transform;M.exports.PassThrough=W.PassThrough;M.exports.addAbortSignal=W.addAbortSignal;M.exports.finished=W.finished;M.exports.destroy=W.destroy;M.exports.destroy=Eb;M.exports.pipeline=W.pipeline;M.exports.compose=W.compose;Object.defineProperty(W,"promises",{configurable:!0,enumerable:!0,get(){return Sb}});M.exports.Stream=W.Stream;M.exports.default=M.exports});var R=class t{#e;constructor(e){this.#e=t.collapse(e)}get value(){return this.#e}toString(){return this.#e}get length(){return this.#e.length}static collapse(e,r=""){if(e instanceof t)return e.value;if(typeof e!="string")throw new TypeError("path argument must be a string or an instance of Path");if(r&&!(r instanceof t)&&(r=new t(r)),e=e.trim(),e.length===0)return r.value;t.isRelative(e)&&(e=r+e);let n=t.reduce(e,(s,o)=>(o==".."?s.pop():o!=="."&&s.push(o),s),[]),i="/";return n.length&&(i+=n.join("/"),t.isFolder(e)&&(i+="/")),""+i}static isAbsolute(e){return e instanceof t?!0:e.length&&e[0]==="/"}static isRelative(e){return!t.isAbsolute(e)}static isFolder(e){return e instanceof t&&(e=e.value),e.length&&e[e.length-1]=="/"}static isPath(e){return e instanceof t?!0:typeof e!="string"?!1:(e=e.trim(),new URL(e,document.location).pathname==e)}static reduce(e,r,n){return e instanceof t&&(e=e.value),e.split("/").filter(Boolean).reduce(r,n)}static map(e,r){return e instanceof t&&(e=e.value),e.split("/").filter(Boolean).map(r)}static parent(e){e instanceof t&&(e=e.value),e=e.split("/").filter(Boolean),e.pop();let r="/";return e.length&&(r+=e.join("/")+"/"),r}static filename(e){return e instanceof t&&(e=e.value),e.split("/").filter(Boolean).pop()}static head(e){return e instanceof t&&(e=e.value),e.split("/").filter(Boolean).shift()}static tail(e){e instanceof t&&(e=e.value),e=e.split("/").filter(Boolean),e.shift();let r="/";return e.length&&(r+=e.join("/")+"/"),r}};var or=class t{#e;#t="/";constructor(e){this.#e=e,this.#t=this.#e.path}get path(){return this.#t}cd(e){return e instanceof R||(e=new R(R.collapse(e,this.#t))),new t(this.#e.cd(e))}async read(e,r=null){if(e instanceof R||(e=new R(R.collapse(e,this.#t))),typeof r=="function"){if(!this.#e.supportsStreamingRead())throw new Error("Adapter "+this.#e.name+" does not support streaming reading.");return this.#e.readStream(e,r)}else return this.#e.read(e)}async write(e,r,n=null){if(e instanceof R||(e=new R(R.collapse(e,this.#t))),!this.#e.supportsWrite())throw new Error("Adapter "+this.#e.name+" is read only.");if(typeof r=="function"){if(!this.#e.supportsStreamingWrite())throw new Error("Adapter "+this.#e.name+" does not support streaming writing.");return this.#e.writeStream(e,r,n)}else{if(typeof r=="string")return this.#e.write(e,r,n);throw new TypeError("Cannot write contents of type "+typeof r)}}async delete(e){return e instanceof R||(e=new R(R.collapse(e,this.#t))),this.#e.delete(e)}async exists(e){return e instanceof R||(e=new R(R.collapse(e,this.#t))),this.#e.exists(e)}async list(e=""){return e instanceof R||(e=new R(R.collapse(e,this.#t))),this.#e.list(e)}};var kt={};Tt(kt,{Client:()=>oe,client:()=>re,deepClone:()=>$e,formdata:()=>Hs,metroError:()=>V,request:()=>rt,response:()=>vt,trace:()=>kf,url:()=>z});var tt="https://metro.muze.nl/details/";Symbol.metroProxy||(Symbol.metroProxy=Symbol("isProxy"));Symbol.metroSource||(Symbol.metroSource=Symbol("source"));var oe=class t{clientOptions={url:z(typeof window<"u"?window.location:"https://localhost"),verbs:["get","post","put","delete","patch","head","options","query"]};static tracers={};constructor(...e){for(let r of e)if(typeof r=="string"||r instanceof String)this.clientOptions.url=z(this.clientOptions.url.href,r);else if(r instanceof t)Object.assign(this.clientOptions,r.clientOptions);else if(r instanceof Function)this.#e([r]);else if(r&&typeof r=="object")for(let n in r)n=="middlewares"?this.#e(r[n]):n=="url"?this.clientOptions.url=z(this.clientOptions.url.href,r[n]):typeof r[n]=="function"?this.clientOptions[n]=r[n](this.clientOptions[n],this.clientOptions):this.clientOptions[n]=r[n];for(let r of this.clientOptions.verbs)this[r]=async function(...n){return this.fetch(rt(this.clientOptions,...n,{method:r.toUpperCase()}))}}#e(e){typeof e=="function"&&(e=[e]);let r=e.findIndex(n=>typeof n!="function");if(r>=0)throw V("metro.client: middlewares must be a function or an array of functions "+tt+"client/invalid-middlewares/",e[r]);Array.isArray(this.clientOptions.middlewares)||(this.clientOptions.middlewares=[]),this.clientOptions.middlewares=this.clientOptions.middlewares.concat(e)}fetch(e,r){if(e=rt(e,r),!e.url)throw V("metro.client."+e.method.toLowerCase()+": Missing url parameter "+tt+"client/fetch-missing-url/",e);if(r||(r={}),typeof r!="object"||r instanceof String)throw V("metro.client.fetch: Invalid options parameter "+tt+"client/fetch-invalid-options/",r);let i=[async function(a){a[Symbol.metroProxy]&&(a=a[Symbol.metroSource]);let l=await fetch(a);return vt(l)}].concat(this.clientOptions?.middlewares?.slice()||[]);r=Object.assign({},this.clientOptions,r);let s;for(let o of i)s=(function(a,l){return async function(u){let f,c=Object.values(t.tracers);for(let d of c)d.request&&d.request.call(d,u,l);f=await l(u,a);for(let d of c)d.response&&d.response.call(d,f,l);return f}})(s,o);return s(e)}with(...e){return new t($e(this.clientOptions),...e)}get location(){return this.clientOptions.url}};function re(...t){return new oe(...$e(t))}function vf(t,e){let r=e||{};!r.url&&e.url&&(r.url=e.url);for(let n of["method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal","priority","url"]){let i=t[n];if(!(typeof i>"u"||i==null))if(i?.[Symbol.metroProxy]&&(i=i[Symbol.metroSource]),typeof i=="function")r[n]=i(r[n],r);else if(n=="url")r.url=z(r.url,i);else if(n=="headers"){r.headers=new Headers(e.headers),i instanceof Headers||(i=new Headers(t.headers));for(let[s,o]of i.entries())r.headers.set(s,o)}else r[n]=i}return t instanceof Request&&t.data&&(r.body=t.data),r}function rt(...t){let e={url:z(typeof window<"u"?window.location:"https://localhost/"),duplex:"half"};for(let i of t)typeof i=="string"||i instanceof URL||i instanceof URLSearchParams?e.url=z(e.url,i):i&&(i instanceof FormData||i instanceof ReadableStream||i instanceof Blob||i instanceof ArrayBuffer||i instanceof DataView)?e.body=i:i&&typeof i=="object"&&Object.assign(e,vf(i,e));let r=new Request(e.url,e),n=e.body;return n&&typeof n=="object"&&!(n instanceof String)&&!(n instanceof ReadableStream)&&!(n instanceof Blob)&&!(n instanceof ArrayBuffer)&&!(n instanceof DataView)&&!(n instanceof FormData)&&!(n instanceof URLSearchParams)&&(typeof globalThis.TypedArray>"u"||!(n instanceof globalThis.TypedArray))&&typeof n.toString=="function"&&(e.body=n.toString({headers:r.headers}),r=new Request(e.url,e)),Object.freeze(r),new Proxy(r,{get(i,s){let o;switch(s){case Symbol.metroSource:o=i;break;case Symbol.metroProxy:o=!0;break;case"with":o=function(...a){return n&&a.unshift({body:n}),rt(i,...a)};break;case"data":o=n;break;default:i[s]instanceof Function?o=i[s].bind(i):o=i[s];break}return o}})}function zs(t,e){let r=e||{};!r.url&&e.url&&(r.url=e.url);for(let n of["status","statusText","headers","body","url","type","redirected"]){let i=t[n];typeof i>"u"||i==null||(i?.[Symbol.metroProxy]&&(i=i[Symbol.metroSource]),typeof i=="function"?r[n]=i(r[n],r):n=="url"?r.url=new URL(i,r.url||"https://localhost/"):r[n]=i)}return t instanceof Response&&t.data&&(r.body=t.data),r}function vt(...t){let e={};for(let i of t)typeof i=="string"?e.body=i:i instanceof Response?Object.assign(e,zs(i,e)):i&&typeof i=="object"&&(i instanceof FormData||i instanceof Blob||i instanceof ArrayBuffer||i instanceof DataView||i instanceof ReadableStream||i instanceof URLSearchParams||i instanceof String||typeof globalThis.TypedArray<"u"&&i instanceof globalThis.TypedArray?e.body=i:Object.assign(e,zs(i,e)));let r;e.body&&(r=e.body),[101,204,205,304].includes(e.status)&&(e.body=null);let n=new Response(e.body,e);return Object.freeze(n),new Proxy(n,{get(i,s){let o;switch(s){case Symbol.metroProxy:o=!0;break;case Symbol.metroSource:o=i;break;case"with":o=function(...a){return vt(i,...a)};break;case"data":o=r;break;case"ok":o=i.status>=200&&i.status<400;break;default:typeof i[s]=="function"?o=i[s].bind(i):o=i[s];break}return o}})}function Gs(t,e){typeof e=="function"?e(t.searchParams,t):(e=new URLSearchParams(e),e.forEach((r,n)=>{t.searchParams.append(n,r)}))}function z(...t){let e=["hash","host","hostname","href","password","pathname","port","protocol","username","search","searchParams"],r=new URL("https://localhost/");for(let n of t)if(typeof n=="string"||n instanceof String)r=new URL(n,r);else if(n instanceof URL||typeof Location<"u"&&n instanceof Location)r=new URL(n);else if(n instanceof URLSearchParams)Gs(r,n);else if(n&&typeof n=="object")for(let i in n)switch(i){case"search":typeof n.search=="function"?n.search(r.search,r):r.search=new URLSearchParams(n.search);break;case"searchParams":Gs(r,n.searchParams);break;default:if(!e.includes(i))throw V("metro.url: unknown url parameter "+tt+"url/unknown-param-name/",i);if(typeof n[i]=="function")n[i](r[i],r);else if(typeof n[i]=="string"||n[i]instanceof String||typeof n[i]=="number"||n[i]instanceof Number||typeof n[i]=="boolean"||n[i]instanceof Boolean)r[i]=""+n[i];else if(typeof n[i]=="object"&&n[i].toString)r[i]=n[i].toString();else throw V("metro.url: unsupported value for "+i+" "+tt+"url/unsupported-param-value/",t[i]);break}else throw V("metro.url: unsupported option value "+tt+"url/unsupported-option-value/",n);return Object.freeze(r),new Proxy(r,{get(n,i){let s;switch(i){case Symbol.metroProxy:s=!0;break;case Symbol.metroSource:s=n;break;case"with":s=function(...o){return z(n,...o)};break;case"filename":s=n.pathname.split("/").pop();break;case"folderpath":s=n.pathname.substring(0,n.pathname.lastIndexOf("\\")+1);break;case"authority":s=n.username??"",s+=n.password?":"+n.password:"",s+=s?"@":"",s+=n.hostname,s+=n.port?":"+n.port:"",s+="/",s=n.protocol+"//"+s;break;case"origin":s=n.protocol+"//"+n.hostname,s+=n.port?":"+n.port:"",s+="/";break;case"fragment":s=n.hash.substring(1);break;case"scheme":n.protocol?s=n.protocol.substring(0,n.protocol.length-1):s="";break;default:n[i]instanceof Function?s=n[i].bind(n):s=n[i];break}return s}})}function Hs(...t){var e=new FormData;for(let r of t)if(r instanceof HTMLFormElement&&(r=new FormData(r)),r instanceof FormData)for(let n of r.entries())e.append(n[0],n[1]);else if(r&&typeof r=="object")for(let n of Object.entries(r))if(Array.isArray(n[1]))for(let i of n[1])e.append(n[0],i);else e.append(n[0],n[1]);else throw new V("metro.formdata: unknown option type "+tt+"formdata/unknown-option-value/",r);return Object.freeze(e),new Proxy(e,{get(r,n){let i;switch(n){case Symbol.metroProxy:i=!0;break;case Symbol.metroSource:i=r;break;case"with":i=function(...s){return Hs(r,...s)};break;default:r[n]instanceof Function?i=r[n].bind(r):i=r[n];break}return i}})}var ar={error:(t,...e)=>{console.error("\u24C2\uFE0F ",t,...e)},info:(t,...e)=>{console.info("\u24C2\uFE0F ",t,...e)},group:t=>{console.group("\u24C2\uFE0F "+t)},groupEnd:t=>{console.groupEnd("\u24C2\uFE0F "+t)}};function V(t,...e){return ar.error(t,...e),new Error(t,...e)}var kf={add(t,e){oe.tracers[t]=e},delete(t){delete oe.tracers[t]},clear(){oe.tracers={}},group(){let t=0;return{request:(e,r)=>{t++,ar.group(t),ar.info(e?.url,e,r)},response:(e,r)=>{ar.info(e?.body?e.body[Symbol.metroSource]:null,e,r),ar.groupEnd(t),t--}}}};function $e(t){if(Array.isArray(t))return t.slice().map($e);if(t&&typeof t=="object")if(t.__proto__.constructor==Object||!t.__proto__){let e=Object.assign({},t);return Object.keys(e).forEach(r=>{e[r]=$e(t[r])}),e}else return t;return t}var nt=class{#e;#t;constructor(e,r="/"){this.#e=re(e),this.#t=new R(r)}get name(){return"HttpAdapter"}get path(){return this.#t}supportsWrite(){return!0}supportsStreamingWrite(){return jf}supportsStreamingRead(){return!0}cd(e){if(!R.isPath(e))throw new TypeError(e+" is not a valid path");return R.isRelative(e)&&(e=R.collapse(e,this.#t)),new this.constructor(this.#e,e)}async write(e,r,n=null){return this.#e.put({body:r})}writeStream(e,r,n=null){throw new Error("Not yet implemented")}async read(e){let r=await this.#e.get(e),n={type:this.getMimetype(r),name:R.filename(e),http:{headers:r.headers,status:r.status,url:r.url}};return n.type.match(/text\/.*/)?n.contents=await r.text():n.type.match(/application\/json.*/)?n.contents=await r.json():n.contents=await r.blob(),n}readStream(e,r){throw new Error("Not yet implemented")}async exists(e){return this.#e.head(e)}async delete(e){return this.#e.delete(e)}async list(e){let r=["text/html","text/xhtml","text/xhtml+xml","text/xml"],n=await this.read(e);if(r.includes(n.type.split(";")[0]))var i=n.contents;else{let u=this.getUrl(e);throw new TypeError("URL "+u+" is not of a supported content type",{cause:n})}let s=z(this.#e.clientOptions.url).pathname,o=this.getUrl(e),a=document.createElement("template");a.innerHTML=i;let l=a.content.querySelectorAll("a[href]");return Array.from(l).map(u=>{let f=new URL(u.getAttribute("href"),o.href);return u.href=f.href,{filename:R.filename(u.pathname),path:u.pathname,name:u.innerText,href:u.href}}).filter(u=>{let f=new URL(u.href);return f.pathname=R.parent(f.pathname),f.href===o.href}).map(u=>({filename:u.filename,path:u.path.substring(s.length-1),name:u.name}))}getUrl(e){let r=z(this.#e.clientOptions.url).pathname;return e=R.collapse(r+R.collapse(e)),new URL(e,this.#e.clientOptions.url)}getMimetype(e){return e.headers.has("Content-Type")?e.headers.get("Content-Type"):null}},jf=(async()=>new Request("",{body:new ReadableStream,method:"POST",duplex:"half"}).headers.has("Content-Type")?!1:fetch("data:a/a;charset=utf-8,",{method:"POST",body:new ReadableStream,duplex:"half"}).then(()=>!0,()=>!1))();var Nf={fs:or,adapters:{https:nt},path:R};globalThis.jsfs=Nf;function fe(t){return t=Object.assign({contentType:"application/json",reviver:null,replacer:null,space:""},t),async function(r,n){if(r.headers.get("Accept")||(r=r.with({headers:{Accept:t.accept??t.contentType}})),r.method!=="GET"&&r.method!=="HEAD"&&r.data&&typeof r.data=="object"&&!(r.data instanceof ReadableStream)){let s=r.headers.get("Content-Type");(!s||Of(s))&&(r=r.with({headers:{"Content-Type":t.contentType}})),Vs(r.headers.get("Content-Type"))&&(r=r.with({body:JSON.stringify(r.data,t.replacer,t.space)}))}let i=await n(r);if(i&&Vs(i.headers?.get("Content-Type"))){let o=await i.clone().text();try{let a=JSON.parse(o,t.reviver);return i.with({body:a})}catch{}}return i}}var Pf=/^application\/([a-zA-Z0-9\-_]+\+)?json\b/;function Vs(t){return Pf.exec(t)}function Of(t){return/^text\/plain\b/.exec(t)}function ce(t){return async function(r,n){let i=await n(r);if(!i.ok)if(t&&typeof t[i.status]=="function")i=t[i.status].apply(i,r);else throw new Error(i.status+": "+i.statusText,{cause:i});return i}}function jt(){return async function(e,r){let n=await r(e);return n.ok&&n.data?n.data:n}}var Gr=class extends oe{constructor(e,r,n=null){e instanceof oe?super(e.clientOptions,ce(),jt()):super(e,ce(),jt()),n||(n=this);for(let i in r)typeof r[i]=="function"?this[i]=r[i].bind(n):r[i]&&typeof r[i]=="object"?this[i]=new this.constructor(e,r[i],n):this[i]=r[i]}},Gn=class extends Gr{constructor(e,r,n=null){e instanceof oe?super(e.with(fe()),r,n):super(re(e,fe()),r,n)}};function Ks(...t){return new Gr(...$e(t))}function Qs(...t){return new Gn(...$e(t))}var Js=Object.assign({},kt,{mw:{json:fe,thrower:ce,getdata:jt},api:Ks,jsonApi:Qs});globalThis.metro||(globalThis.metro=Js);var N=Js;var Hr={};Tt(Hr,{base64url_encode:()=>Jn,createState:()=>eo,default:()=>Pt,generateCodeChallenge:()=>Xs,generateCodeVerifier:()=>Zs,getExpires:()=>Kn,isAuthorized:()=>Ff,isExpired:()=>Qn,isRedirected:()=>Yn});globalThis.assertEnabled=!1;function Lf(){globalThis.assertEnabled=!0}function Bf(){globalThis.assertEnabled=!1}function D(t,e){if(globalThis.assertEnabled){let r=G(t,e);if(r)throw console.error("\u{1F170}\uFE0F Assertions failed because of:",r,"in this source:",t),new Error("Assertions failed",{cause:{problems:r,source:t}})}}function m(t){return function(r,n,i){if(typeof r<"u"&&r!=null&&typeof t<"u")return G(r,t,n,i)}}function k(t){return function(r,n,i){return r==null||typeof r>"u"?P("data is required",r,t||"any value",i):typeof t<"u"?G(r,t,n,i):!1}}function qe(t){return function(r,n,i){return r==null||typeof r>"u"?(Ys("data does not contain recommended value",r,t,i),!1):G(r,t,n,i)}}function $(...t){return function(r,n,i){for(let s of t)if(!G(r,s,n,i))return!1;return P("data does not match oneOf patterns",r,t,i)}}function ve(...t){return function(r,n,i){if(!Array.isArray(r))return P("data is not an array",r,"anyOf",i);for(let s of r)if($(...t)(s))return P("data does not match anyOf patterns",s,t,i);return!1}}function Hn(...t){return function(r,n,i){let s=[];for(let o of t)s=s.concat(G(r,o,n,i));if(s=s.filter(Boolean),s.length)return P("data does not match all given patterns",r,t,i,s)}}function E(t,e,r){try{t instanceof URL&&(t=t.href);let n=new URL(t);if(n.href!=t&&!(n.href+"/"==t||n.href==t+"/"))return P("data is not a valid url",t,"validURL",r)}catch{return P("data is not a valid url",t,"validURL",r)}}function Vn(t,e,r){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return P("data is not a valid email",t,"validEmail",r)}function it(t){return function(r,n,i){if(!(r instanceof t))return P("data is not an instanceof pattern",r,t,i)}}function Nt(t){return function(r,n,i){if(!G(r,t,n,i))return P("data matches pattern, when required not to",r,t,i)}}function G(t,e,r,n=""){r||(r=t);let i=[];if(e===Boolean)typeof t!="boolean"&&!(t instanceof Boolean)&&i.push(P("data is not a boolean",t,e,n));else if(e===Number)typeof t!="number"&&!(t instanceof Number)&&i.push(P("data is not a number",t,e,n));else if(e===String)typeof t!="string"&&!(t instanceof String)&&i.push(P("data is not a string",t,e,n)),t==""&&i.push(P("data is an empty string, which is not allowed",t,e,n));else if(e instanceof RegExp)if(Array.isArray(t)){let s=t.findIndex((o,a)=>G(o,e,r,n+"["+a+"]"));s>-1&&i.push(P("data["+s+"] does not match pattern",t[s],e,n+"["+s+"]"))}else typeof t>"u"?i.push(P("data is undefined, should match pattern",t,e,n)):e.test(t)||i.push(P("data does not match pattern",t,e,n));else if(e instanceof Function){let s=e(t,r,n);s&&(Array.isArray(s)?i=i.concat(s):i.push(s))}else if(Array.isArray(e)){Array.isArray(t)||i.push(P("data is not an array",t,[],n));for(let s of e)for(let o of t.keys()){let a=G(t[o],s,r,n+"["+o+"]");Array.isArray(a)?i=i.concat(a):a&&i.push(a)}}else if(e&&typeof e=="object")if(Array.isArray(t)){let s=t.findIndex((o,a)=>G(o,e,r,n+"["+a+"]"));s>-1&&i.push(P("data["+s+"] does not match pattern",t[s],e,n+"["+s+"]"))}else if(!t||typeof t!="object")i.push(P("data is not an object, pattern is",t,e,n));else if(t instanceof URLSearchParams&&(t=Object.fromEntries(t)),e instanceof Function){let s=G(t,e,r,n);s&&(i=i.concat(s))}else for(let[s,o]of Object.entries(e)){let a=G(t[s],o,r,n+"."+s);a&&(i=i.concat(a))}else e!=t&&i.push(P("data and pattern are not equal",t,e,n));return i.length?i:!1}function P(t,e,r,n,i){let s={path:n,message:t,found:e,expected:r};return i&&(s.problems=i),s}function Ys(t,e,r,n){console.warn("\u{1F170}\uFE0F Assert: "+n,t,r,e)}globalThis.assert={warn:Ys,error:P,assert:D,enable:Lf,disable:Bf,Required:k,Recommended:qe,Optional:m,oneOf:$,anyOf:ve,allOf:Hn,validURL:E,validEmail:Vn,instanceOf:it,not:Nt,fails:G};function lr(t){let e,r;if(typeof localStorage<"u")e={get:()=>localStorage.getItem("metro/state:"+t),set:n=>localStorage.setItem("metro/state:"+t,n),has:()=>localStorage.getItem("metro/state:"+t)!==null,delete:()=>localStorage.remoteItem("metro/state:"+t)},r={get:n=>JSON.parse(localStorage.getItem(t+":"+n)),set:(n,i)=>localStorage.setItem(t+":"+n,JSON.stringify(i)),has:n=>localStorage.getItem(t+":"+n)!==null,delete:n=>localStorage.removeItem(t+":"+n)};else{let n=new Map;e={get:()=>n.get("metro/state:"+t),set:i=>n.set("metro/state:"+t,i),has:()=>n.has("metro/state:"+t),delete:()=>n.delete("metro/state:"+t)},r=new Map}return{state:e,tokens:r}}function Pt(t){let e={client:re(),force_authorization:!1,site:"default",oauth2_configuration:{authorization_endpoint:"/authorize",token_endpoint:"/token",redirect_uri:globalThis.document?.location.href,grant_type:"authorization_code",code_verifier:Zs(64)},authorize_callback:async f=>(window.location.href!=f.href&&window.location.replace(f.href),!1)};D(t,{});let r=Object.assign({},e.oauth2_configuration,t?.oauth2_configuration);t=Object.assign({},e,t),t.oauth2_configuration=r;let n=lr(t.site);t.tokens||(t.tokens=n.tokens),t.state||(t.state=n.state),D(t,{oauth2_configuration:{client_id:k(/.+/),grant_type:"authorization_code",authorization_endpoint:k(E),token_endpoint:k(E),redirect_uri:k(E)}});for(let f in r)switch(f){case"access_token":case"authorization_code":case"refresh_token":t.tokens.set(f,r[f]);break}return async function(f,c){if(t.force_authorization)return i(f,c);let d;try{if(d=await c(f),d.ok)return d}catch(h){switch(d?.status){case 400:case 401:return i(f,c)}throw h}if(!d.ok)switch(d.status){case 400:case 401:return i(f,c)}return d};async function i(f,c){s();let d=t.tokens.get("access_token"),h=t.tokens.get("refresh_token"),y=Qn(d);if(!d||y&&!h){try{if(!await o())return vt("false")}catch(_){throw _}return i(f,c)}else if(y&&h){try{if(!await a())return vt("false")}catch(_){throw _}return i(f,c)}else return f=rt(f,{headers:{Authorization:d.type+" "+d.value}}),c(f)}function s(){if(typeof window<"u"&&window?.location){let f=z(window.location),c,d,h;if(f.searchParams.has("code"))h=f.searchParams,f=f.with({search:""}),history.pushState({},"",f.href);else if(f.hash){let y=f.hash.substr(1);h=new URLSearchParams("?"+y),f=f.with({hash:""}),history.pushState({},"",f.href)}if(h){c=h.get("code"),d=h.get("state");let y=t.state.get("metro/state");if(!d||d!==y)return;c&&t.tokens.set("authorization_code",c)}}}async function o(){if(r.grant_type==="authorization_code"&&!t.tokens.has("authorization_code")){let h=await l();if(!t.authorize_callback||typeof t.authorize_callback!="function")throw V("oauth2mw: oauth2 with grant_type:authorization_code requires a callback function in client options.authorize_callback");let y=await t.authorize_callback(h);if(y)t.tokens.set("authorization_code",y);else return!1}let f=u(),c=await t.client.post(f);if(!c.ok){let h=await c.text();throw V("OAuth2mw: fetch access_token: "+c.status+": "+c.statusText+" ("+h+")",{cause:f})}let d=await c.json();if(t.tokens.set("access_token",{value:d.access_token,expires:Kn(d.expires_in),type:d.token_type,scope:d.scope}),d.refresh_token){let h={value:d.refresh_token};t.tokens.set("refresh_token",h)}return t.tokens.delete("authorization_code"),d}async function a(){let f=u("refresh_token"),c=await t.client.post(f);if(!c.ok)throw V("OAuth2mw: refresh access_token: "+c.status+": "+c.statusText,{cause:f});let d=await c.json();if(t.tokens.set("access_token",{value:d.access_token,expires:Kn(d.expires_in),type:d.token_type,scope:d.scope}),d.refresh_token){let h={value:d.refresh_token};t.tokens.set("refresh_token",h)}else return!1;return d}async function l(){if(!r.authorization_endpoint)throw V("oauth2mw: Missing options.oauth2_configuration.authorization_endpoint");let f=z(r.authorization_endpoint,{hash:""});D(r,{client_id:/.+/,redirect_uri:/.+/,scope:/.*/});let c={response_type:"code",client_id:r.client_id,redirect_uri:r.redirect_uri,state:r.state||eo(40)};return r.response_type&&(c.response_type=r.response_type),r.response_mode&&(c.response_mode=r.response_mode),t.state.set(c.state),r.client_secret&&(c.client_secret=r.client_secret),r.code_verifier&&(t.tokens.set("code_verifier",r.code_verifier),c.code_challenge=await Xs(r.code_verifier),c.code_challenge_method="S256"),r.scope&&(c.scope=r.scope),r.prompt&&(c.prompt=r.prompt),z(f,{search:c})}function u(f=null){if(D(r,{client_id:/.+/,redirect_uri:/.+/}),!r.token_endpoint)throw V("oauth2mw: Missing options.endpoints.token url");let c=z(r.token_endpoint,{hash:""}),d={grant_type:f||r.grant_type,client_id:r.client_id};switch(r.client_secret&&(d.client_secret=r.client_secret),r.scope&&(d.scope=r.scope),d.grant_type){case"authorization_code":d.redirect_uri=r.redirect_uri,d.code=t.tokens.get("authorization_code");let h=t.tokens.get("code_verifier");h&&(d.code_verifier=h);break;case"client_credentials":break;case"refresh_token":d.refresh_token=t.tokens.get("refresh_token");break;default:throw new Error("Unknown grant_type: ".oauth2.grant_type)}return rt(c,{method:"POST",body:new URLSearchParams(d)})}}function Qn(t){if(!t)return!0;let e=new Date(t.expires);return new Date().getTime()>e.getTime()}function Kn(t){if(t instanceof Date)return new Date(t.getTime());if(typeof t=="number"){let e=new Date;return e.setSeconds(e.getSeconds()+t),e}throw new TypeError("Unknown expires type "+t)}function Zs(t=64){let e=new Uint8Array(t);return globalThis.crypto.getRandomValues(e),Jn(e)}async function Xs(t){let r=new TextEncoder().encode(t),n=await globalThis.crypto.subtle.digest("SHA-256",r);return Jn(n)}function Jn(t){let e=Array.from(new Uint8Array(t),r=>String.fromCharCode(r)).join("");return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function eo(t){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r="",n=0;for(;n<t;)r+=e.charAt(Math.floor(Math.random()*e.length)),n++;return r}function Yn(){let t=new URL(document.location.href);if(!t.searchParams.has("code")){if(t.hash){let e=t.hash.substr(1);if(new URLSearchParams("?"+e).has("code"))return!0}return!1}return!0}function Ff(t){typeof t=="string"&&(t=lr(t).tokens);let e=t.get("access_token");return!!(e&&!Qn(e)||t.get("refresh_token"))}var Zn={};Tt(Zn,{default:()=>ro});var Vr={status:200,statusText:"OK",headers:{"Content-Type":"application/json"}},ur=t=>({status:400,statusText:"Bad Request",headers:{"Content-Type":"application/json"},body:JSON.stringify({error:"invalid_request",error_description:t})}),We,to={};function ro(t={}){return t=Object.assign({},{PKCE:!1,DPoP:!1},t),async(r,n)=>{let i=N.url(r.url);switch(i.pathname){case"/authorize/":if(We=G(i.searchParams,{response_type:"code",client_id:"mockClientId",state:m(/.*/)}))return N.response(ur(We));if(i.searchParams.has("code_challenge")){if(!i.searchParams.has("code_challenge_method"))return N.response(ur("missing code_challenge_method"));to.code_challenge=i.searchParams.get("code_challenge"),to.code_challenge_method=i.searchParams.get("code_challenge_method")}return N.response(Vr,{body:JSON.stringify({code:"mockAuthorizeToken",state:i.searchParams.get("state")})});case"/token/":if(r.data instanceof URLSearchParams){let l={};r.data.forEach((u,f)=>l[f]=u),r=r.with({body:l})}if(We=G(r,{method:"POST",data:{grant_type:$("refresh_token","authorization_code")}}))return N.response(ur(We));switch(r.data.grant_type){case"refresh_token":if(We=G(r.data,$({refresh_token:"mockRefreshToken",client_id:"mockClientId",client_secret:"mockClientSecret"},{refresh_token:"mockRefreshToken",client_id:"mockClientId",code_verifier:/.+/})))return N.response(ur(We));break;case"access_token":if(We=G(r.data,$({client_id:"mockClientId",client_secret:"mockClientSecret"},{client_id:"mockClientId",code_challenge:/.*/,code_challenge_method:"S256"})))return N.response(ur(We));break}return N.response(Vr,{body:JSON.stringify({access_token:"mockAccessToken",token_type:"mockExample",expires_in:3600,refresh_token:"mockRefreshToken",example_parameter:"mockExampleValue"})});case"/protected/":let s=r.headers.get("Authorization"),[o,a]=s?s.split(" "):[];return!a||a!=="mockAccessToken"?N.response({status:401,statusText:"Forbidden",body:"401 Forbidden"}):N.response(Vr,{body:JSON.stringify({result:"Success"})});case"/public/":return N.response(Vr,{body:JSON.stringify({result:"Success"})});default:return N.response({status:404,statusText:"not found",body:"404 Not Found "+i})}}}var Xn={};Tt(Xn,{default:()=>so});var no=["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512"],io=["client_secret_post","client_secret_base","client_secret_jwt","private_key_jwt"],Mf={issuer:k(E),authorization_endpoint:k(E),token_endpoint:k(E),jwks_uri:m(E),registration_endpoint:m(E),scopes_supported:qe([]),response_types_supported:k(ve("code","token")),response_modes_supported:m([]),grant_types_supported:m([]),token_endpoint_auth_methods_supported:m([]),token_endpoint_auth_signing_alg_values_supported:m([]),service_documentation:m(E),ui_locales_supported:m([]),op_policy_uri:m(E),op_tos_uri:m(E),revocation_endpoint:m(E),revocation_endpoint_auth_methods_supported:m(io),revocation_endpoint_auth_signing_alg_values_supported:m(no),introspection_endpoint:m(E),introspection_endpoint_auth_methods_supported:m(io),introspection_endpoint_auth_signing_alg_values_supported:m(no),code_challendge_methods_supported:m([])};function so(t={}){let e={client:N.client()};t=Object.assign({},e,t),D(t,{issuer:k(E)});let r=Df(t.issuer);return t.client.with(t.issuer)}async function Df(t,e){let r=e.get(N.url(t,".wellknown/oauth_authorization_server"));if(r.ok){D(r.headers.get("Content-Type"),/application\/json.*/);let n=await r.json();return D(n,Mf),n}throw N.metroError("metro.oidcmw: Error while fetching "+t+".wellknown/oauth_authorization_server",r)}function oo(t=null){let e=!1;t=t||window.location.origin;let r=new URLSearchParams(window.location.search);if(!r.has("code")&&window.location.hash){let i=window.location.hash.substr(1);r=new URLSearchParams("?"+i)}let n=window.parent!==window?window.parent:window.opener;return n?r.has("code")?(n.postMessage({authorization_code:r.get("code")},t),e=!0):r.has("error")?n.postMessage({error:r.get("error")},t):n.postMessage({error:"Could not find an authorization_code"},t):console.error("No parent window found, cannot post authorization code (or error)"),e}function ao(t){return new Promise((e,r)=>{addEventListener("message",n=>{n.data.authorization_code?e(n.data.authorization_code):n.data.error?r(n.data.error):r("Unknown authorization error")},{once:!0}),window.open(t)})}function fr(){return new Promise((t,e)=>{let r=globalThis.indexedDB.open("metro",1);r.onupgradeneeded=()=>r.result.createObjectStore("keyPairs",{keyPath:"domain"}),r.onerror=n=>{e(n)},r.onsuccess=n=>{let i=n.target.result;t({set:function(s,o){return new Promise((a,l)=>{let u=i.transaction("keyPairs","readwrite",{durability:"strict"}),f=u.objectStore("keyPairs");u.oncomplete=()=>{a()},u.onerror=l,f.put(s,o)})},get:function(s){return new Promise((o,a)=>{let l=i.transaction("keyPairs","readonly"),f=l.objectStore("keyPairs").get(s);f.onsuccess=()=>{o(f.result)},f.onerror=a,l.onerror=a})},clear:function(){return new Promise((s,o)=>{let a=i.transaction("keyPairs","readwrite"),u=a.objectStore("keyPairs").clear();u.onsuccess=()=>{s()},u.onerror=o,a.onerror=o})}})}})}var Uf=new TextEncoder,$f=new TextDecoder;function Kr(t){return typeof t=="string"?Uf.encode(t):$f.decode(t)}function lo(t){if(typeof t.modulusLength!="number"||t.modulusLength<2048)throw new ti(`${t.name} modulusLength must be at least 2048 bits`)}function qf(t){switch(t.algorithm.name){case"ECDSA":return{name:t.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return lo(t.algorithm),{name:t.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return lo(t.algorithm),{name:t.algorithm.name};case"Ed25519":return{name:t.algorithm.name}}throw new ze}async function Wf(t,e,r){if(r.usages.includes("sign")===!1)throw new TypeError('private CryptoKey instances used for signing assertions must include "sign" in their "usages"');let n=`${Qr(Kr(JSON.stringify(t)))}.${Qr(Kr(JSON.stringify(e)))}`,i=Qr(await crypto.subtle.sign(qf(r),r,Kr(n)));return`${n}.${i}`}var ei;Uint8Array.prototype.toBase64?ei=t=>(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),t.toBase64({alphabet:"base64url",omitPadding:!0})):ei=e=>{e instanceof ArrayBuffer&&(e=new Uint8Array(e));let r=[];for(let n=0;n<e.byteLength;n+=32768)r.push(String.fromCharCode.apply(null,e.subarray(n,n+32768)));return btoa(r.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")};function Qr(t){return ei(t)}var ze=class extends Error{constructor(e){var r;super(e??"operation not supported"),this.name=this.constructor.name,(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,this.constructor)}},ti=class extends Error{constructor(e){var r;super(e),this.name=this.constructor.name,(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,this.constructor)}};function zf(t){switch(t.algorithm.hash.name){case"SHA-256":return"PS256";default:throw new ze("unsupported RsaHashedKeyAlgorithm hash name")}}function Gf(t){switch(t.algorithm.hash.name){case"SHA-256":return"RS256";default:throw new ze("unsupported RsaHashedKeyAlgorithm hash name")}}function Hf(t){switch(t.algorithm.namedCurve){case"P-256":return"ES256";default:throw new ze("unsupported EcKeyAlgorithm namedCurve")}}function Vf(t){switch(t.algorithm.name){case"RSA-PSS":return zf(t);case"RSASSA-PKCS1-v1_5":return Gf(t);case"ECDSA":return Hf(t);case"Ed25519":return"Ed25519";default:throw new ze("unsupported CryptoKey algorithm name")}}function uo(t){return t instanceof CryptoKey}function Kf(t){return uo(t)&&t.type==="private"}function Qf(t){return uo(t)&&t.type==="public"}function Jf(){return Math.floor(Date.now()/1e3)}async function ri(t,e,r,n,i,s){let o=t?.privateKey,a=t?.publicKey;if(!Kf(o))throw new TypeError('"keypair.privateKey" must be a private CryptoKey');if(!Qf(a))throw new TypeError('"keypair.publicKey" must be a public CryptoKey');if(a.extractable!==!0)throw new TypeError('"keypair.publicKey.extractable" must be true');if(typeof e!="string")throw new TypeError('"htu" must be a string');if(typeof r!="string")throw new TypeError('"htm" must be a string');if(n!==void 0&&typeof n!="string")throw new TypeError('"nonce" must be a string or undefined');if(i!==void 0&&typeof i!="string")throw new TypeError('"accessToken" must be a string or undefined');if(s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)))throw new TypeError('"additional" must be an object');return Wf({alg:Vf(o),typ:"dpop+jwt",jwk:await Yf(a)},Object.assign(Object.assign({},s),{iat:Jf(),jti:crypto.randomUUID(),htm:r,nonce:n,htu:e,ath:i?Qr(await crypto.subtle.digest("SHA-256",Kr(i))):void 0}),o)}async function Yf(t){let{kty:e,e:r,n,x:i,y:s,crv:o}=await crypto.subtle.exportKey("jwk",t);return{kty:e,crv:o,e:r,n,x:i,y:s}}async function fo(t,e){var r;let n;if(typeof t!="string"||t.length===0)throw new TypeError('"alg" must be a non-empty string');switch(t){case"PS256":n={name:"RSA-PSS",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"RS256":n={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"ES256":n={name:"ECDSA",namedCurve:"P-256"};break;case"Ed25519":n={name:"Ed25519"};break;default:throw new ze}return crypto.subtle.generateKey(n,(r=e?.extractable)!==null&&r!==void 0?r:!1,["sign","verify"])}function cr(t){return D(t,{site:k(E),authorization_endpoint:k(E),token_endpoint:k(E),dpop_signing_alg_values_supported:m([])}),async(e,r)=>{let n=await fr(),i=await n.get(t.site);if(!i){let a=await fo("ES256");i={domain:t.site,keyPair:a},await n.set(i)}let s=N.url(e.url);if(e.url.startsWith(t.authorization_endpoint)){let a=e.body;a instanceof URLSearchParams||a instanceof FormData?a.set("dpop_jkt",i.keyPair.publicKey):a.dpop_jkt=i.keyPair.publicKey}else if(e.url.startsWith(t.token_endpoint)){let a=await ri(i.keyPair,e.url,e.method);e=e.with({headers:{DPoP:a}})}else if(e.headers.has("Authorization")){let a=localStorage.getItem(s.host+":nonce")||void 0,l=e.headers.get("Authorization").split(" ")[1],u=await ri(i.keyPair,e.url,e.method,a,l);e=e.with({headers:{Authorization:"DPoP "+l,DPoP:u}})}let o=await r(e);return o.headers.get("DPoP-Nonce")&&localStorage.setItem(s.host+":nonce",o.headers.get("DPoP-Nonce")),o}}var Xf=Object.assign({},Hr,{oauth2mw:Pt,mockserver:Zn,discover:Xn,tokenstore:lr,dpopmw:cr,keysstore:fr,authorizePopup:ao,popupHandleRedirect:oo});globalThis.metro.oauth2||(globalThis.metro.oauth2=Xf);var dr=(...t)=>(e,r)=>t.filter(n=>r.hasOwnKey(n)).length>0?!1:P("root data must have all of",r,t),Ge=(...t)=>e=>Array.isArray(e)&&t.filter(r=>!e.includes(r)).length==0?!1:P("data must be an array which includes",e,t);var ae=["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512"],Jr=["client_secret_post","client_secret_basic","client_secret_jwt","private_key_jwt"];async function hr(t={}){D(t,{client:m(it(N.client().constructor)),issuer:k(E)});let e={client:N.client().with(ce()).with(fe()),requireDynamicRegistration:!1};t=Object.assign({},e,t);let r=!1;function n(l){return r}let i={issuer:k(Hn(t.issuer,n)),authorization_endpoint:k(E),token_endpoint:k(E),userinfo_endpoint:qe(E),jwks_uri:k(E),registration_endpoint:t.requireDynamicRegistration?k(E):qe(E),scopes_supported:qe(Ge("openid")),response_types_supported:t.requireDynamicRegistration?k(Ge("code","id_token","id_token token")):k([]),response_modes_supported:m([]),grant_types_supported:t.requireDynamicRegistration?m(Ge("authorization_code")):m([]),acr_values_supported:m([]),subject_types_supported:k([]),id_token_signing_alg_values_supported:k(Ge("RS256")),id_token_encryption_alg_values_supported:m([]),id_token_encryption_enc_values_supported:m([]),userinfo_signing_alg_values_supported:m([]),userinfo_encryption_alg_values_supported:m([]),userinfo_encryption_enc_values_supported:m([]),request_object_signing_alg_values_supported:m(Ge("RS256")),request_object_encryption_alg_values_supported:m([]),request_object_encryption_enc_values_supported:m([]),token_endpoint_auth_methods_supported:m(ve(...Jr)),token_endpoint_auth_signing_alg_values_supported:m(Ge("RS256"),Nt(Ge("none"))),display_values_supported:m(ve("page","popup","touch","wap")),claim_types_supported:m(ve("normal","aggregated","distributed")),claims_supported:qe([]),service_documentation:m(E),claims_locales_supported:m([]),ui_locales_supported:m([]),claims_parameter_supported:m(Boolean),request_parameter_supported:m(Boolean),request_uri_parameter_supported:m(Boolean),op_policy_uri:m(E),op_tos_uri:m(E)},s=N.url(t.issuer,".well-known/openid-configuration"),a=(await t.client.get(s)).data;return D(a,i),D(a.issuer,t.issuer),a}async function pr(t){let e={redirect_uris:k([E]),response_types:m([]),grant_types:m(ve("authorization_code","refresh_token")),application_type:m($("native","web")),contacts:m([Vn]),client_name:m(String),logo_uri:m(E),client_uri:m(E),policy_uri:m(E),tos_uri:m(E),jwks_uri:m(E,Nt(dr("jwks"))),jwks:m(E,Nt(dr("jwks_uri"))),sector_identifier_uri:m(E),subject_type:m(String),id_token_signed_response_alg:m($(...ae)),id_token_encrypted_response_alg:m($(...ae)),id_token_encrypted_response_enc:m($(...ae),dr("id_token_encrypted_response_alg")),userinfo_signed_response_alg:m($(...ae)),userinfo_encrypted_response_alg:m($(...ae)),userinfo_encrypted_response_enc:m($(...ae),dr("userinfo_encrypted_response_alg")),request_object_signing_alg:m($(...ae)),request_object_encryption_alg:m($(...ae)),request_object_encryption_enc:m($(...ae)),token_endpoint_auth_method:m($(...Jr)),token_endpoint_auth_signing_alg:m($(...ae)),default_max_age:m(Number),require_auth_time:m(Boolean),default_acr_values:m([String]),initiate_login_uri:m([E]),request_uris:m([E])};D(t,{client:m(it(N.client().constructor)),registration_endpoint:E,client_info:e});let r={client:N.client().with(ce()).with(fe()),client_info:{redirect_uris:[globalThis.document?.location.href]}};t=Object.assign({},r,t),t.client_info||(t.client_info={}),t.client_info.redirect_uris||(t.client_info.redirect_uris=[globalThis.document?.location.href]);let n=await t.client.post(t.registration_endpoint,{body:t.client_info}),i=n.data;if(!i.client_id||!i.client_secret)throw N.metroError("metro.oidc: Error: dynamic registration of client failed, no client_id or client_secret returned",n);return t.client_info=Object.assign(t.client_info,i),t.client_info}function Yr(t){let e;if(typeof localStorage<"u")e={get:r=>JSON.parse(localStorage.getItem("metro/oidc:"+t+":"+r)),set:(r,n)=>localStorage.setItem("metro/oidc:"+t+":"+r,JSON.stringify(n)),has:r=>localStorage.getItem("metro/oidc:"+t+":"+r)!==null};else{let r=new Map;e={get:n=>JSON.parse(r.get("metro/oidc:"+t+":"+n)||null),set:(n,i)=>r.set("metro/oidc:"+t+":"+n,JSON.stringify(i)),has:n=>r.has("metro/oidc:"+t+":"+n)}}return e}function ni(t={}){let e={client:re(),force_authorization:!1,use_dpop:!0,authorize_callback:async r=>(window.location.href!=r.href&&window.location.replace(r.href),!1)};return t=Object.assign({},e,t),D(t,{client:k(it(re().constructor)),client_info:k(),issuer:k(E),oauth2:m({}),openid_configuration:m()}),t.store||(t.store=Yr(t.issuer)),!t.openid_configuration&&t.store.has("openid_configuration")&&(t.openid_configuration=t.store.get("openid_configuration")),!t.client_info?.client_id&&t.store.has("client_info")&&(t.client_info=t.store.get("client_info")),async(r,n)=>{let i;if(!t.force_authorization){try{i=await n(r)}catch(u){if(i.status!=401&&i.status!=403)throw u}if(i.ok||i.status!=401&&i.status!=403)return i}if(t.openid_configuration||(t.openid_configuration=await hr({issuer:t.issuer}),t.store.set("openid_configuration",t.openid_configuration)),!t.client_info?.client_id){if(!t.openid_configuration.registration_endpoint)throw V("metro.oidcmw: Error: issuer "+t.issuer+" does not support dynamic client registration, but you haven't specified a client_id");t.client_info=await pr({registration_endpoint:t.openid_configuration.registration_endpoint,client_info:t.client_info}),t.store.set("client_info",t.client_info)}let s=t.scope||"openid",o=Object.assign({site:t.issuer,client:t.client,force_authorization:!0,authorize_callback:t.authorize_callback,oauth2_configuration:{client_id:t.client_info?.client_id,client_secret:t.client_info?.client_secret,grant_type:"authorization_code",response_type:"code",response_mode:"query",authorization_endpoint:t.openid_configuration.authorization_endpoint,token_endpoint:t.openid_configuration.token_endpoint,scope:s,redirect_uri:t.client_info.redirect_uris[0]}}),a=async(u,f)=>{let c=await f(u);if(c.headers.get("content-type")?.startsWith("application/json")){let h=c.data?.id_token;if(!h){let y=c.clone();try{let _=await y.json();_&&_.id_token&&(h=_.id_token)}catch{}}h&&t.store.set("id_token",h)}return c},l=t.client.with(t.issuer).with(a);if(t.use_dpop){let u={site:t.issuer,authorization_endpoint:t.openid_configuration.authorization_endpoint,token_endpoint:t.openid_configuration.token_endpoint,dpop_signing_alg_values_supported:t.openid_configuration.dpop_signing_alg_values_supported};l=l.with(cr(u)),o.client=l}return l=l.with(Pt(o)),i=await l.fetch(r),i}}function co(){return Yn()}function ho(t){if(!t.store){if(!t.issuer)throw V("Must supply options.issuer or options.store to get the id_token");t.store=Yr(t.issuer)}return t.store.get("id_token")}var po={oidcmw:ni,discover:hr,register:pr,isRedirected:co,idToken:ho};globalThis.metro.oidc||(globalThis.metro.oidc=po);var _o=po;function oi(t){return new ii(t)}var ai="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",ec={rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",solid:"http://www.w3.org/ns/solid/terms#",schema:"http://schema.org/",vcard:"http://www.w3.org/2006/vcard/ns#"};var ii=class{constructor(e){this.prefixes={...ec,...e?.prefixes},this.prefixes.xsd||(this.prefixes.xsd="http://www.w3.org/2001/XMLSchema#"),this.parser=e?.parser,this.writer=e?.writer,this.sources=Object.create(null),this.separator=e?.separator??"$"}parse(e,r,n){let{quads:i,prefixes:s}=this.parser(e,r,n);if(s)for(let o in s){let a=s[o];if(a.match(/^http(s?):\/\/$/i))a+=r.substring(a.length);else try{a=new URL(s[o],r).href}catch(l){console.error("Could not parse prefix",s[o],l.message)}this.prefixes[o]||(this.prefixes[o]=a)}return this.sources[r]=new si(i,r,n,s,this),this.sources[r]}setType(e,r){if(!r)return e;if(typeof e=="string"?e=new String(e):typeof result=="number"&&(e=new Number(e)),typeof e!="object")throw new Error("cannot set type on ",e,r);return e.type=r,e}getType(e){return e&&typeof e=="object"?e.type:null}},si=class{#e=Object.create(null);constructor(e,r,n,i,s){this.mimetype=n,this.url=r,this.prefixes=i,this.context=s,this.subjects=Object.create(null);for(let o of e){let a;if(o.subject.termType=="BlankNode"){let l=this.shortURI(o.predicate.id,":"),u;switch(l){case"rdf:first":if(a=this.addCollection(o.subject.id),u=this.shortURI(o.object.id,":"),u!="rdf:nil"){let f=this.getValue(o.object);f&&a.push(f)}continue;case"rdf:rest":this.#e[o.object.id]=this.#e[o.subject.id];continue;default:a=this.addBlankNode(o.subject.id);break}}else a=this.addNamedNode(o.subject.id);a.addPredicate(o.predicate.id,o.object)}this.subjects[r]?this.primary=this.subjects[r]:this.primary=null,Object.defineProperty(this,"data",{get(){return Object.values(this.subjects)}})}addNamedNode(e){let r=new URL(e,this.url).href;return this.subjects[r]||(this.subjects[r]=new Ot(r,this)),this.subjects[r]}addBlankNode(e){return this.#e[e]||(this.#e[e]=new st(this)),this.#e[e]}addCollection(e){return this.#e[e]||(this.#e[e]=new Lt(this)),this.#e[e]}write(){return this.context.writer(this)}get(e){return this.subjects[this.fullURI(e)]}fullURI(e,r=null){r||(r=this.context.separator);let[n,i]=e.split(r);return i?this.prefixes[n]+i:e}shortURI(e,r=null){r||(r=this.context.separator);for(let n in this.context.prefixes)if(e.startsWith(this.context.prefixes[n]))return n+r+e.substring(this.context.prefixes[n].length);return this.url&&e.startsWith(this.url)?e.substring(this.url.length):e}setType(e,r){let n=this.shortURI(r);return this.context.setType(e,n)}getType(e){return this.context.getType(e)}setLanguage(e,r){if(typeof e=="string"?e=new String(e):typeof result=="number"&&(e=new Number(e)),typeof e!="object")throw new Error("cannot set language on ",e);return e.language=r,e}getValue(e){let r;if(e.termType=="Literal"){r=e.value;let n=e.datatype?.id;n&&(r=this.setType(r,n));let i=e.language;i&&(r=this.setLanguage(r,i))}else e.termType=="BlankNode"?r=this.addBlankNode(e.id):r=this.addNamedNode(e.id);return r}},st=class{constructor(e){Object.defineProperty(this,"graph",{value:e,writable:!1,enumerable:!1})}addPredicate(e,r){if(e.id&&(e=e.id),e==ai){let n=this.graph.shortURI(r.id);this.addType(n)}else{let n=this.graph.getValue(r);e=this.graph.shortURI(e),this[e]?Array.isArray(this[e])?this[e].push(n):this[e]=[this[e],n]:this[e]=n}}addType(e){this.a?(Array.isArray(this.a)||(this.a=[this.a]),this.a.push(e)):this.a=e}},Ot=class extends st{constructor(e,r){super(r),Object.defineProperty(this,"id",{value:e,writable:!1,enumerable:!0})}},Lt=class extends Array{constructor(e,r){super(),Object.defineProperty(this,"graph",{value:r,writable:!1,enumerable:!1})}};var Us={};Tt(Us,{n3Parser:()=>Rb,n3Writer:()=>Ib});var Fo=zr(pe());var lt="http://www.w3.org/1999/02/22-rdf-syntax-ns#",yr="http://www.w3.org/2001/XMLSchema#",tn="http://www.w3.org/2000/10/swap/",O={xsd:{decimal:`${yr}decimal`,boolean:`${yr}boolean`,double:`${yr}double`,integer:`${yr}integer`,string:`${yr}string`},rdf:{type:`${lt}type`,nil:`${lt}nil`,first:`${lt}first`,rest:`${lt}rest`,langString:`${lt}langString`,dirLangString:`${lt}dirLangString`,reifies:`${lt}reifies`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${tn}reify#forSome`,forAll:`${tn}reify#forAll`},log:{implies:`${tn}log#implies`,isImpliedBy:`${tn}log#isImpliedBy`}};var{xsd:rn}=O,Oc=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Co={"\\":"\\","'":"'",'"':'"',n:`
3
- `,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Lc=/[\x00-\x20<>\\"\{\}\|\^\`]/,Bc={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_dircode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},Cc=/$0^/,ut=class{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9])/i,this._dircode=/^--(ltr)|(rtl)/,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._atKeyword=/^@[a-z]+(?=[\s#<:])/i,this._keyword=/^(?:PREFIX|BASE|VERSION|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e=e||{},this._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(let r in this)!(r in Bc)&&this[r]instanceof RegExp&&(this[r]=Cc)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,r){let n=this._input,i=n.length;for(;;){let a,l;for(;a=this._newline.exec(n);)this.comments&&(l=this._comment.exec(a[0]))&&s("comment",l[1],"",this._line,a[0].length),n=n.substr(a[0].length,n.length),i=n.length,this._line++;if(!a&&(a=this._whitespace.exec(n))&&(n=n.substr(a[0].length,n.length)),this._endOfFile.test(n))return r&&(this.comments&&(l=this._comment.exec(n))&&s("comment",l[1],"",this._line,n.length),n=null,s("eof","","",this._line,0)),this._input=n;let u=this._line,f=n[0],c="",d="",h="",y=null,_=0,x=!1;switch(f){case"^":if(n.length<3)break;if(n[1]==="^"){if(this._previousMarker="^^",n=n.substr(2),n[0]!=="<"){x=!0;break}}else{this._n3Mode&&(_=1,c="^");break}case"<":if(y=this._unescapedIri.exec(n))c="IRI",d=y[1];else if(y=this._iri.exec(n)){if(d=this._unescape(y[1]),d===null||Lc.test(d))return o(this);c="IRI"}else n.length>2&&n[1]==="<"&&n[2]==="("?(c="<<(",_=3):!this._lineMode&&n.length>(r?1:2)&&n[1]==="<"?(c="<<",_=2):this._n3Mode&&n.length>1&&n[1]==="="&&(_=2,this._isImpliedBy?(c="abbreviation",d="<"):(c="inverse",d=">"));break;case">":n.length>1&&n[1]===">"&&(c=">>",_=2);break;case"_":((y=this._blank.exec(n))||r&&(y=this._blank.exec(`${n} `)))&&(c="blank",h="_",d=y[1]);break;case'"':if(y=this._simpleQuotedString.exec(n))d=y[1];else if({value:d,matchLength:_}=this._parseLiteral(n),d===null)return o(this);(y!==null||_!==0)&&(c="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(y=this._simpleApostropheString.exec(n))d=y[1];else if({value:d,matchLength:_}=this._parseLiteral(n),d===null)return o(this);(y!==null||_!==0)&&(c="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(y=this._variable.exec(n))&&(c="var",d=y[0]);break;case"@":this._previousMarker==="literal"&&(y=this._langcode.exec(n))&&y[1]!=="version"?(c="langcode",d=y[1]):(y=this._atKeyword.exec(n))&&(c=y[0]);break;case".":if(n.length===1?r:n[1]<"0"||n[1]>"9"){c=".",_=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(n[1]==="-"){this._previousMarker==="langcode"&&(y=this._dircode.exec(n))&&(c="dircode",_=2,d=y[1]||y[2],_=d.length+2);break}(y=this._number.exec(n)||r&&(y=this._number.exec(`${n} `)))&&(c="literal",d=y[0],h=typeof y[1]=="string"?rn.double:typeof y[2]=="string"?rn.decimal:rn.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":case"V":case"v":(y=this._keyword.exec(n))?c=y[0].toUpperCase():x=!0;break;case"f":case"t":(y=this._boolean.exec(n))?(c="literal",d=y[0],h=rn.boolean):x=!0;break;case"a":(y=this._shortPredicates.exec(n))?(c="abbreviation",d="a"):x=!0;break;case"=":this._n3Mode&&n.length>1&&(c="abbreviation",n[1]!==">"?(_=1,d="="):(_=2,d=">"));break;case"!":if(!this._n3Mode)break;case")":if(!r&&(n.length===1||n.length===2&&n[1]===">"))break;if(n.length>2&&n[1]===">"&&n[2]===">"){c=")>>",_=3;break}case",":case";":case"[":case"]":case"(":case"}":case"~":this._lineMode||(_=1,c=f);break;case"{":!this._lineMode&&n.length>=2&&(n[1]==="|"?(c="{|",_=2):(c=f,_=1));break;case"|":n.length>=2&&n[1]==="}"&&(c="|}",_=2);break;default:x=!0}if(x&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(y=this._prefix.exec(n))?(c="prefix",d=y[1]||""):((y=this._prefixed.exec(n))||r&&(y=this._prefixed.exec(`${n} `)))&&(c="prefixed",h=y[1]||"",d=this._unescape(y[2]))),this._previousMarker==="^^")switch(c){case"prefixed":c="type";break;case"IRI":c="typeIRI";break;default:c=""}if(!c)return r||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?o(this):this._input=n;let b=_||y[0].length,g=s(c,d,h,u,b);this.previousToken=g,this._previousMarker=c,n=n.substr(b,n.length)}function s(a,l,u,f,c){let d=n?i-n.length:i,h=d+c,y={type:a,value:l,prefix:u,line:f,start:d,end:h};return e(null,y),y}function o(a){e(a._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(e){let r=!1,n=e.replace(Oc,(i,s,o,a)=>{if(typeof s=="string")return String.fromCharCode(Number.parseInt(s,16));if(typeof o=="string"){let l=Number.parseInt(o,16);return l<=65535?String.fromCharCode(Number.parseInt(o,16)):String.fromCharCode(55296+((l-=65536)>>10),56320+(l&1023))}return a in Co?Co[a]:(r=!0,"")});return r?null:n}_parseLiteral(e){if(e.length>=3){let r=e.match(/^(?:"""|"|'''|'|)/)[0],n=r.length,i=Math.max(this._literalClosingPos,n);for(;(i=e.indexOf(r,i))>0;){let s=0;for(;e[i-s-1]==="\\";)s++;if(s%2===0){let o=e.substring(n,i),a=o.split(/\r\n|\r|\n/).length-1,l=i+n;if(n===1&&a!==0||n===3&&this._lineMode)break;return this._line+=a,{value:this._unescape(o),matchLength:l}}i++}this._literalClosingPos=e.length-n+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;let r=new Error(`Unexpected "${e}" on line ${this._line}.`);return r.context={token:void 0,line:this._line,previousToken:this.previousToken},r}_readStartingBom(e){return e.startsWith("\uFEFF")?e.substr(1):e}tokenize(e,r){if(this._line=1,typeof e=="string")if(this._input=this._readStartingBom(e),typeof r=="function")queueMicrotask(()=>this._tokenizeToEnd(r,!0));else{let n=[],i;if(this._tokenizeToEnd((s,o)=>s?i=s:n.push(o),!0),i)throw i;return n}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",n=>{this._input!==null&&n.length!==0&&(this._pendingBuffer&&(n=Fo.Buffer.concat([this._pendingBuffer,n]),this._pendingBuffer=null),n[n.length-1]&128?this._pendingBuffer=n:(typeof this._input>"u"?this._input=this._readStartingBom(typeof n=="string"?n:n.toString()):this._input+=n,this._tokenizeToEnd(r,!1)))}),e.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(r,!0)}),e.on("error",r)}};var{rdf:Mo,xsd:ft}=O,Ut,Fc=0;var mi={namedNode:Do,blankNode:Uo,variable:qo,literal:$o,defaultGraph:Mc,quad:gi,triple:gi,fromTerm:br,fromQuad:Wo},te=mi,ee=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}}},Dt=class extends ee{get termType(){return"NamedNode"}},je=class t extends ee{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){let e=this.id,r=e.lastIndexOf('"')+1,n=e.lastIndexOf("--");return r<e.length&&e[r++]==="@"?(n>r?e.substr(0,n):e).substr(r).toLowerCase():""}get direction(){let e=this.id,r=e.lastIndexOf('"'),n=e.lastIndexOf("--");return n>r&&n+2<e.length?e.substr(n+2).toLowerCase():""}get datatype(){return new Dt(this.datatypeString)}get datatypeString(){let e=this.id,r=e.lastIndexOf('"')+1,n=r<e.length?e[r]:"";return n==="^"?e.substr(r+2):n!=="@"?ft.string:e.indexOf("--",r)>0?Mo.dirLangString:Mo.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}}}},mr=class extends ee{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},gr=class extends ee{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},wr=class extends ee{constructor(){return super(""),Ut||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};Ut=new wr;function Ve(t,e,r){if(e=e||mi,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===mi)return new je(t);if(t[t.length-1]==='"')return e.literal(t.substr(1,t.length-2));let n=t.lastIndexOf('"',t.length-1),i;if(t[n+1]==="@"){i=t.substr(n+2);let s=i.lastIndexOf("--");s>0&&s<i.length&&(i={language:i.substr(0,s),direction:i.substr(s+2)})}else i=e.namedNode(t.substr(n+3));return e.literal(t.substr(1,n-1),i);case"[":t=JSON.parse(t);break;default:if(!r||!Array.isArray(t))return e.namedNode(t)}return e.quad(Ve(t[0],e,!0),Ve(t[1],e,!0),Ve(t[2],e,!0),t[3]&&Ve(t[3],e,!0))}function Ne(t,e){if(typeof t=="string")return t;if(t instanceof ee&&t.termType!=="Quad")return t.id;if(!t)return Ut.id;switch(t.termType){case"NamedNode":return t.value;case"BlankNode":return`_:${t.value}`;case"Variable":return`?${t.value}`;case"DefaultGraph":return"";case"Literal":return`"${t.value}"${t.language?`@${t.language}${t.direction?`--${t.direction}`:""}`:t.datatype&&t.datatype.value!==ft.string?`^^${t.datatype.value}`:""}`;case"Quad":let r=[Ne(t.subject,!0),Ne(t.predicate,!0),Ne(t.object,!0)];return t.graph&&t.graph.termType!=="DefaultGraph"&&r.push(Ne(t.graph,!0)),e?r:JSON.stringify(r);default:throw new Error(`Unexpected termType: ${t.termType}`)}}var Ke=class extends ee{constructor(e,r,n,i){super(""),this._subject=e,this._predicate=r,this._object=n,this._graph=i||Ut}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 Do(t){return new Dt(t)}function Uo(t){return new mr(t||`n3-${Fc++}`)}function $o(t,e){if(typeof e=="string")return new je(`"${t}"@${e.toLowerCase()}`);if(e!==void 0&&!("termType"in e))return new je(`"${t}"@${e.language.toLowerCase()}${e.direction?`--${e.direction.toLowerCase()}`:""}`);let r=e?e.value:"";return r===""&&(typeof t=="boolean"?r=ft.boolean:typeof t=="number"&&(Number.isFinite(t)?r=Number.isInteger(t)?ft.integer:ft.double:(r=ft.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),r===""||r===ft.string?new je(`"${t}"`):new je(`"${t}"^^${r}`)}function qo(t){return new gr(t)}function Mc(){return Ut}function gi(t,e,r,n){return new Ke(t,e,r,n)}function br(t){if(t instanceof ee)return t;switch(t.termType){case"NamedNode":return Do(t.value);case"BlankNode":return Uo(t.value);case"Variable":return qo(t.value);case"DefaultGraph":return Ut;case"Literal":return $o(t.value,t.language||t.datatype);case"Quad":return Wo(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function Wo(t){if(t instanceof Ke)return t;if(t.termType!=="Quad")throw new Error(`Unexpected termType: ${t.termType}`);return gi(br(t.subject),br(t.predicate),br(t.object),br(t.graph))}var zo=0,Pe=class t{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Go(this,e.factory);let r=typeof e.format=="string"?e.format.match(/\w*$/)[0].toLowerCase():"",n=/turtle/.test(r),i=/trig/.test(r),s=/triple/.test(r),o=/quad/.test(r),a=this._n3Mode=/n3/.test(r),l=s||o;(this._supportsNamedGraphs=!(n||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(n||i||s||a),this._isImpliedBy=e.isImpliedBy,l&&(this._resolveRelativeIRI=u=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new ut({lineMode:l,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers,this._parseUnsupportedVersions=!!e.parseUnsupportedVersions,this._version=e.version}static _resetBlankNodePrefix(){zo=0}_setBase(e){if(!e)this._base="",this._basePath="";else{let r=e.indexOf("#");r>=0&&(e=e.substr(0,r)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}}_saveContext(e,r,n,i,s){let o=this._n3Mode;this._contextStack.push({type:e,subject:n,predicate:i,object:s,graph:r,inverse:o?this._inversePredicate:!1,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(e,r){let n=this._contextStack.pop();if(!n||n.type!==e)return this._error(`Unexpected ${r.type}`,r);this._subject=n.subject,this._predicate=n.predicate,this._object=n.object,this._graph=n.graph,this._n3Mode&&(this._inversePredicate=n.inverse,this._prefixes._=n.blankPrefix,this._quantified=n.quantified)}_readBeforeTopContext(e){return this._version&&!this._isValidVersion(this._version)?this._error(`Detected unsupported version as media type parameter: "${this._version}"`,e):this._readInTopContext(e)}_readInTopContext(e){switch(e.type){case"eof":return this._graph!==null?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"VERSION":this._sparqlStyle=!0;case"@version":return this._readVersion;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,r){let n;switch(e.type){case"IRI":case"typeIRI":let i=this._resolveIRI(e.value);if(i===null)return this._error("Invalid IRI",e);n=this._factory.namedNode(i);break;case"type":case"prefixed":let s=this._prefixes[e.prefix];if(s===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);n=this._factory.namedNode(s+e.value);break;case"blank":n=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case"var":n=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!r&&this._n3Mode&&n.id in this._quantified&&(n=this._quantified[n.id]),n}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":let r=this._contextStack;return(r.length&&r[r.length-1]).type==="<<"?this._error("Unexpected list in reified triple",e):(this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._factory.blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(e.prefix.length===0)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"<<(":return this._n3Mode?(this._saveContext("<<(",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Disallowed triple term as subject",e);case"<<":return this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject;default:if((this._subject=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){let r=e.type;switch(r){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":case"|}":return this._predicate===null?this._error(`Unexpected ${r}`,e):(this._subject=null,r==="]"?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return this._predicate!==null?this._readPredicate:this._error("Expected predicate but got ;",e);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if((this._predicate=this._readEntity(e))===void 0)return}return this._validAnnotation=!0,this._readObject}_readObject(e){switch(e.type){case"literal":if(e.prefix.length===0)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.blankNode()),this._readBlankNodeHead;case"(":let r=this._contextStack;return(r.length&&r[r.length-1]).type==="<<"?this._error("Unexpected list in reified triple",e):(this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<(":return this._saveContext("<<(",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject;case"<<":return this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject;default:if((this._object=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return e.type==="{"?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return e.type!=="{"?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){if(e.type==="]")return this._subject=null,this._readBlankNodeTail(e);{let r=this._contextStack;return(r.length>1&&r[r.length-2]).type==="<<"?this._error("Unexpected compound blank node expression in reified triple",e):(this._predicate=null,this._readPredicate(e))}}_readBlankNodeTail(e){if(e.type!=="]")return this._readBlankNodePunctuation(e);this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph);let r=this._predicate===null;return this._restoreContext("blank",e),this._object!==null?this._getContextEndReader():this._predicate!==null?this._readObject:r?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let r=null,n=null,i=this._readListItem,s=this._subject,o=this._contextStack,a=o[o.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,n=this._factory.blankNode(),this.RDF_FIRST,this._subject=r=this._factory.blankNode()),i=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,n=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),o.length!==0&&o[o.length-1].type==="list"&&this._emit(this._subject,this._predicate,this._object,this._graph),this._predicate===null){if(i=this._readPredicate,this._subject===this.RDF_NIL)return i}else if(i=this._getContextEndReader(),this._object===this.RDF_NIL)return i;n=this.RDF_NIL;break;case"literal":e.prefix.length===0?(this._literalValue=e.value,i=this._readListItemDataTypeOrLang):(r=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),i=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<":this._saveContext("<<",this._graph,null,null,null),this._graph=null,i=this._readSubject;break;default:if((r=this._readEntity(e))===void 0)return}if(n===null&&(this._subject=n=this._factory.blankNode()),e.type==="<<"&&(o[o.length-1].subject=this._subject),s===null?a.predicate===null?a.subject=n:a.object=n:this._emit(s,this.RDF_REST,n,this._graph),r!==null){if(this._n3Mode&&(e.type==="IRI"||e.type==="prefixed"))return this._saveContext("item",this._graph,n,this.RDF_FIRST,r),this._subject=r,this._predicate=null,this._getPathReader(this._readListItem);this._emit(n,this.RDF_FIRST,r,this._graph)}return i}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e,r){let n=this._factory.literal(this._literalValue),i;switch(e.type){case"type":case"typeIRI":let s=this._readEntity(e);if(s===void 0)return;if(s.value===O.rdf.langString||s.value===O.rdf.dirLangString)return this._error("Detected illegal (directional) languaged-tagged string with explicit datatype",e);n=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);n=this._factory.literal(this._literalValue,e.value),this._literalLanguage=e.value,e=null,i=this._readDirCode.bind(this,r);break}return{token:e,literal:n,readCb:i}}_readDirCode(e,r,n){if(n.type==="dircode"){let i=this._factory.literal(this._literalValue,{language:this._literalLanguage,direction:n.value});e==="subject"?this._subject=i:this._object=i,this._literalLanguage=void 0,n=null}return e==="subject"?n===null?this._readPredicateOrNamedGraph:this._readPredicateOrNamedGraph(n):this._completeObjectLiteralPost(n,r)}_completeSubjectLiteral(e){let r=this._completeLiteral(e,"subject");return this._subject=r.literal,r.readCb?r.readCb.bind(this,!1):this._readPredicateOrNamedGraph}_completeObjectLiteral(e,r){let n=this._completeLiteral(e,"object");if(n)return this._object=n.literal,n.readCb?n.readCb.bind(this,r):this._completeObjectLiteralPost(n.token,r)}_completeObjectLiteralPost(e,r){return r&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),e===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(e))}_readFormulaTail(e){return e.type!=="}"?this._readPunctuation(e):(this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),this._object===null?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let r,n=this._graph,i=!1,s=this._subject,o=this._inversePredicate;switch(e.type){case"}":if(this._graph===null)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,this._tripleTerm=null,r=this._contextStack.length?this._readSubject:this._readInTopContext,o&&(this._inversePredicate=!1);break;case";":r=this._readPredicate;break;case",":r=this._readObject;break;case"~":r=this._readReifierInAnnotation,i=!0;break;case"{|":this._subject=this._readTripleTerm(),this._validAnnotation=!1,i=!0,r=this._readPredicate;break;case"|}":if(!this._annotation)return this._error("Unexpected annotation syntax closing",e);if(!this._validAnnotation)return this._error("Annotation block can not be empty",e);this._subject=null,this._annotation=!1,r=this._readPunctuation;break;default:if(this._supportsQuads&&this._graph===null&&(n=this._readEntity(e))!==void 0){r=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(s!==null&&(!i||i&&!this._annotation)){let a=this._predicate,l=this._object;o?this._emit(l,a,s,n):this._emit(s,a,l,n)}return i&&(this._annotation=!0),r}_readBlankNodePunctuation(e){let r;switch(e.type){case";":r=this._readPredicate;break;case",":r=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),r}_readQuadPunctuation(e){return e.type!=="."?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return e.type!=="prefix"?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if(e.type!=="IRI")return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);let r=this._readEntity(e);return this._prefixes[this._prefix]=r.value,this._prefixCallback(this._prefix,r),this._readDeclarationPunctuation}_readBaseIRI(e){let r=e.type==="IRI"&&this._resolveIRI(e.value);return r?(this._setBase(r),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",e)}_isValidVersion(e){return this._parseUnsupportedVersions||t.SUPPORTED_VERSIONS.includes(e)}_readVersion(e){return e.type!=="literal"?this._error("Expected literal to follow version declaration",e):e.end-e.start!==e.value.length+2?this._error("Version declarations must use single quotes",e):(this._versionCallback(e.value),this._isValidVersion(e.value)?this._readDeclarationPunctuation:this._error(`Detected unsupported version: "${e.value}"`,e))}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return e.type!=="]"?this._error("Invalid graph label",e):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):e.type!=="."?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let r;switch(e.type){case"IRI":case"prefixed":if((r=this._readEntity(e,!0))!==void 0)break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(this._subject===null?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,r,this.QUANTIFIERS_GRAPH)):this._quantified[r.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return e.type===","?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:let r=this._contextStack,n=r.length&&r[r.length-1];if(n&&n.type==="item"){let i=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,i,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let r,n,i=this._factory.blankNode();if((n=this._readEntity(e))!==void 0)return this._predicate===null?(r=this._subject,this._subject=i):(r=this._object,this._object=i),this._emit(r,n,i,this._graph),this._readPath}_readBackwardPath(e){let r=this._factory.blankNode(),n,i;if((n=this._readEntity(e))!==void 0)return this._predicate===null?(i=this._subject,this._subject=r):(i=this._object,this._object=r),this._emit(r,n,i,this._graph),this._readPath}_readTripleTermTail(e){if(e.type!==")>>")return this._error(`Expected )>> but got ${e.type}`,e);let r=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<(",e),this._subject===null?(this._subject=r,this._readPredicate):(this._object=r,this._getContextEndReader())}_readReifiedTripleTailOrReifier(e){return e.type==="~"?this._readReifier:this._readReifiedTripleTail(e)}_readReifiedTripleTail(e){if(e.type!==">>")return this._error(`Expected >> but got ${e.type}`,e);this._tripleTerm=null;let r=this._readTripleTerm();this._restoreContext("<<",e);let n=this._contextStack,i=n.length&&n[n.length-1];return i&&i.type==="list"?(this._emit(this._subject,this.RDF_FIRST,r,this._graph),this._getContextEndReader()):this._subject===null?(this._subject=r,this._readPredicateOrReifierTripleEnd):(this._object=r,this._getContextEndReader())}_readPredicateOrReifierTripleEnd(e){return e.type==="."?(this._subject=null,this._readPunctuation(e)):this._readPredicate(e)}_readReifier(e){return this._reifier=this._readEntity(e),this._readReifiedTripleTail}_readReifierInAnnotation(e){return e.type==="IRI"||e.type==="typeIRI"||e.type==="type"||e.type==="prefixed"||e.type==="blank"||e.type==="var"?(this._reifier=this._readEntity(e),this._readPunctuation):(this._readTripleTerm(),this._subject=null,this._readPunctuation(e))}_readTripleTerm(){let e=this._contextStack,r=e.length&&e[e.length-1],n=r?r.graph:void 0,i=this._reifier||this._factory.blankNode();return this._reifier=null,this._tripleTerm=this._tripleTerm||this._factory.quad(this._subject,this._predicate,this._object),this._emit(i,this.RDF_REIFIES,this._tripleTerm,n||this.DEFAULTGRAPH),i}_getContextEndReader(){let e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<(":return this._readTripleTermTail;case"<<":return this._readReifiedTripleTailOrReifier}}_emit(e,r,n,i){this._callback(null,this._factory.quad(e,r,n,i||this.DEFAULTGRAPH))}_error(e,r){let n=new Error(`${e} on line ${r.line}.`);n.context={token:r,line:r.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=xr}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return(e[1]==="/"?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;let r=e.length,n="",i=-1,s=-1,o=0,a="/";for(;i<r;){switch(a){case":":if(s<0&&e[++i]==="/"&&e[++i]==="/")for(;(s=i+1)<r&&e[s]!=="/";)i=s;break;case"?":case"#":i=r;break;case"/":if(e[i+1]===".")switch(a=e[++i+1],a){case"/":n+=e.substring(o,i-1),o=i+1;break;case void 0:case"?":case"#":return n+e.substring(o,i)+e.substr(i+1);case".":if(a=e[++i+1],a===void 0||a==="/"||a==="?"||a==="#"){if(n+=e.substring(o,i-2),(o=n.lastIndexOf("/"))>=s&&(n=n.substr(0,o)),a!=="/")return`${n}/${e.substr(i+1)}`;o=i+1}}}a=e[++i]}return n+e.substring(o)}parse(e,r,n,i){let s,o,a,l;if(r&&(r.onQuad||r.onPrefix||r.onComment||r.onVersion)?(s=r.onQuad,o=r.onPrefix,a=r.onComment,l=r.onVersion):(s=r,o=n,l=i),this._readCallback=this._readBeforeTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${zo++}_`,this._prefixCallback=o||xr,this._versionCallback=l||xr,this._inversePredicate=!1,this._quantified=Object.create(null),!s){let f=[],c;if(this._callback=(d,h)=>{d?c=d:h&&f.push(h)},this._lexer.tokenize(e).every(d=>this._readCallback=this._readCallback(d)),c)throw c;return f}let u=(f,c)=>{f!==null?(this._callback(f),this._callback=xr):this._readCallback&&(this._readCallback=this._readCallback(c))};a&&(this._lexer.comments=!0,u=(f,c)=>{f!==null?(this._callback(f),this._callback=xr):this._readCallback&&(c.type==="comment"?a(c.value):this._readCallback=this._readCallback(c))}),this._callback=s,this._lexer.tokenize(e,u)}};function xr(){}function Go(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(O.rdf.first),t.RDF_REST=e.namedNode(O.rdf.rest),t.RDF_NIL=e.namedNode(O.rdf.nil),t.RDF_REIFIES=e.namedNode(O.rdf.reifies),t.N3_FORALL=e.namedNode(O.r.forAll),t.N3_FORSOME=e.namedNode(O.r.forSome),t.ABBREVIATIONS={a:e.namedNode(O.rdf.type),"=":e.namedNode(O.owl.sameAs),">":e.namedNode(O.log.implies),"<":e.namedNode(O.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}Pe.SUPPORTED_VERSIONS=["1.2","1.2-basic","1.1"];Go(Pe.prototype,te);var wi={};Tt(wi,{inDefaultGraph:()=>zc,isBlankNode:()=>Uc,isDefaultGraph:()=>ct,isLiteral:()=>$c,isNamedNode:()=>Dc,isQuad:()=>Wc,isVariable:()=>qc,prefix:()=>Gc,prefixes:()=>Ho});function Dc(t){return!!t&&t.termType==="NamedNode"}function Uc(t){return!!t&&t.termType==="BlankNode"}function $c(t){return!!t&&t.termType==="Literal"}function qc(t){return!!t&&t.termType==="Variable"}function Wc(t){return!!t&&t.termType==="Quad"}function ct(t){return!!t&&t.termType==="DefaultGraph"}function zc(t){return ct(t.graph)}function Gc(t,e){return Ho({"":t.value||t},e)("")}function Ho(t,e){let r=Object.create(null);for(let i in t)n(i,t[i]);e=e||te;function n(i,s){if(typeof s=="string"){let o=Object.create(null);r[i]=a=>o[a]||(o[a]=e.namedNode(s+a))}else if(!(i in r))throw new Error(`Unknown prefix: ${i}`);return r[i]}return n}function $t(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}var Hc=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Vc=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,Vo="./",Kc="../",xi="?",Ko="#",dt=class t{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!Hc.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!t.supports(this.base))return this._baseMatcher=/.^/;let e=/^[^:]*:\/*/.exec(this.base)[0],r=["^",$t(e)],n=[],i=[],s=/[^/?#]*([/?#])/y,o,a=0,l=0,u=s.lastIndex=e.length;for(;!a&&!l&&(o=s.exec(this.base));)o[1]===Ko?l=s.lastIndex-1:(r.push($t(o[0]),"(?:"),n.push(")?"),o[1]!==xi?i.push(u=s.lastIndex):(a=u=s.lastIndex,l=this.base.indexOf(Ko,a),this._pathReplacements[a]=xi));for(let f=0;f<i.length;f++)this._pathReplacements[i[f]]=Kc.repeat(i.length-f-1);return this._pathReplacements[i[i.length-1]]=Vo,this._baseLength=l>0?l:this.base.length,r.push($t(this.base.substring(u,this._baseLength)),a?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...r,...n].join(""))}toRelative(e){let r=this._getBaseMatcher().exec(e);if(!r)return e;let n=r[0].length;if(n===this._baseLength&&n===e.length)return"";let i=this._pathReplacements[n];if(i){let s=e.substring(n);return i!==xi&&!Vc.test(s)?e:i===Vo&&/^[^?#]/.test(s)?s:i+s}return e.substring(n-1)}};var Sr=te.defaultGraph(),{rdf:Qc,xsd:qt}=O,Qo=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,Jo=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Jc={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"},ht=class extends ee{equals(e){return e===this}},_e=class{constructor(e,r){if(this._prefixRegex=/$0^/,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 n="";this._outputStream={write(i,s,o){n+=i,o&&o()},end:i=>{i&&i(null,n)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(r.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Sr,this._prefixIRIs=Object.create(null),r.prefixes&&this.addPrefixes(r.prefixes),r.baseIRI&&(this._baseIri=new dt(r.baseIRI)))}get _inDefaultGraph(){return Sr.equals(this._graph)}_write(e,r){this._outputStream.write(e,"utf8",r)}_writeQuad(e,r,n,i,s){try{i.equals(this._graph)||(this._write((this._subject===null?"":this._inDefaultGraph?`.
1
+ (()=>{var Ef=Object.create;var Gn=Object.defineProperty;var Rf=Object.getOwnPropertyDescriptor;var If=Object.getOwnPropertyNames;var Af=Object.getPrototypeOf,Tf=Object.prototype.hasOwnProperty;var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),vt=(t,e)=>{for(var r in e)Gn(t,r,{get:e[r],enumerable:!0})},vf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of If(e))!Tf.call(t,i)&&i!==r&&Gn(t,i,{get:()=>e[i],enumerable:!(n=Rf(e,i))||n.enumerable});return t};var zr=(t,e,r)=>(r=t!=null?Ef(Af(t)):{},vf(e||!t||!t.__esModule?Gn(r,"default",{value:t,enumerable:!0}):r,t));var go=v(Zr=>{"use strict";Zr.byteLength=nc;Zr.toByteArray=sc;Zr.fromByteArray=lc;var de=[],ne=[],rc=typeof Uint8Array<"u"?Uint8Array:Array,ui="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(at=0,bo=ui.length;at<bo;++at)de[at]=ui[at],ne[ui.charCodeAt(at)]=at;var at,bo;ne[45]=62;ne[95]=63;function mo(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 n=r===e?0:4-r%4;return[r,n]}function nc(t){var e=mo(t),r=e[0],n=e[1];return(r+n)*3/4-n}function ic(t,e,r){return(e+r)*3/4-r}function sc(t){var e,r=mo(t),n=r[0],i=r[1],s=new rc(ic(t,n,i)),o=0,a=i>0?n-4:n,l;for(l=0;l<a;l+=4)e=ne[t.charCodeAt(l)]<<18|ne[t.charCodeAt(l+1)]<<12|ne[t.charCodeAt(l+2)]<<6|ne[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=ne[t.charCodeAt(l)]<<2|ne[t.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=ne[t.charCodeAt(l)]<<10|ne[t.charCodeAt(l+1)]<<4|ne[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function oc(t){return de[t>>18&63]+de[t>>12&63]+de[t>>6&63]+de[t&63]}function ac(t,e,r){for(var n,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),i.push(oc(n));return i.join("")}function lc(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,a=r-n;o<a;o+=s)i.push(ac(t,o,o+s>a?a:o+s));return n===1?(e=t[r-1],i.push(de[e>>2]+de[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(de[e>>10]+de[e>>4&63]+de[e<<2&63]+"=")),i.join("")}});var wo=v(fi=>{fi.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,l=(1<<a)-1,u=l>>1,f=-7,c=r?i-1:0,d=r?-1:1,h=t[e+c];for(c+=d,s=h&(1<<-f)-1,h>>=-f,f+=a;f>0;s=s*256+t[e+c],c+=d,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+c],c+=d,f-=8);if(s===0)s=1-u;else{if(s===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-u}return(h?-1:1)*o*Math.pow(2,s-n)};fi.write=function(t,e,r,n,i,s){var o,a,l,u=s*8-i-1,f=(1<<u)-1,c=f>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:s-1,y=n?1:-1,_=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+c>=1?e+=d/l:e+=d*Math.pow(2,1-c),e*l>=2&&(o++,l/=2),o+c>=f?(a=0,o=f):o+c>=1?(a=(e*l-1)*Math.pow(2,i),o=o+c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;t[r+h]=a&255,h+=y,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;t[r+h]=o&255,h+=y,o/=256,u-=8);t[r+h-y]|=_*128}});var pe=v(Dt=>{"use strict";var ci=go(),Ft=wo(),xo=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Dt.Buffer=p;Dt.SlowBuffer=pc;Dt.INSPECT_MAX_BYTES=50;var Xr=2147483647;Dt.kMaxLength=Xr;p.TYPED_ARRAY_SUPPORT=uc();!p.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function uc(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}});Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function ke(t){if(t>Xr)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,p.prototype),e}function p(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 _i(t)}return Io(t,e,r)}p.poolSize=8192;function Io(t,e,r){if(typeof t=="string")return cc(t,e);if(ArrayBuffer.isView(t))return dc(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(he(t,ArrayBuffer)||t&&he(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(he(t,SharedArrayBuffer)||t&&he(t.buffer,SharedArrayBuffer)))return hi(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return p.from(n,e,r);let i=hc(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return p.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)}p.from=function(t,e,r){return Io(t,e,r)};Object.setPrototypeOf(p.prototype,Uint8Array.prototype);Object.setPrototypeOf(p,Uint8Array);function Ao(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 fc(t,e,r){return Ao(t),t<=0?ke(t):e!==void 0?typeof r=="string"?ke(t).fill(e,r):ke(t).fill(e):ke(t)}p.alloc=function(t,e,r){return fc(t,e,r)};function _i(t){return Ao(t),ke(t<0?0:yi(t)|0)}p.allocUnsafe=function(t){return _i(t)};p.allocUnsafeSlow=function(t){return _i(t)};function cc(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!p.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=To(t,e)|0,n=ke(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function di(t){let e=t.length<0?0:yi(t.length)|0,r=ke(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function dc(t){if(he(t,Uint8Array)){let e=new Uint8Array(t);return hi(e.buffer,e.byteOffset,e.byteLength)}return di(t)}function hi(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 n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,p.prototype),n}function hc(t){if(p.isBuffer(t)){let e=yi(t.length)|0,r=ke(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||mi(t.length)?ke(0):di(t);if(t.type==="Buffer"&&Array.isArray(t.data))return di(t.data)}function yi(t){if(t>=Xr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Xr.toString(16)+" bytes");return t|0}function pc(t){return+t!=t&&(t=0),p.alloc(+t)}p.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==p.prototype};p.compare=function(e,r){if(he(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),he(r,Uint8Array)&&(r=p.from(r,r.offset,r.byteLength)),!p.isBuffer(e)||!p.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);s<o;++s)if(e[s]!==r[s]){n=e[s],i=r[s];break}return n<i?-1:i<n?1:0};p.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}};p.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return p.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let i=p.allocUnsafe(r),s=0;for(n=0;n<e.length;++n){let o=e[n];if(he(o,Uint8Array))s+o.length>i.length?(p.isBuffer(o)||(o=p.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(p.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function To(t,e){if(p.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||he(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,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return pi(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Co(t).length;default:if(i)return n?-1:pi(t).length;e=(""+e).toLowerCase(),i=!0}}p.byteLength=To;function _c(t,e,r){let n=!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 Ic(this,e,r);case"utf8":case"utf-8":return ko(this,e,r);case"ascii":return Ec(this,e,r);case"latin1":case"binary":return Rc(this,e,r);case"base64":return xc(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ac(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}p.prototype._isBuffer=!0;function lt(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}p.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)lt(this,r,r+1);return this};p.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)lt(this,r,r+3),lt(this,r+1,r+2);return this};p.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)lt(this,r,r+7),lt(this,r+1,r+6),lt(this,r+2,r+5),lt(this,r+3,r+4);return this};p.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?ko(this,0,e):_c.apply(this,arguments)};p.prototype.toLocaleString=p.prototype.toString;p.prototype.equals=function(e){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:p.compare(this,e)===0};p.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+">"};xo&&(p.prototype[xo]=p.prototype.inspect);p.prototype.compare=function(e,r,n,i,s){if(he(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),!p.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),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=n-r,l=Math.min(o,a),u=this.slice(i,s),f=e.slice(r,n);for(let c=0;c<l;++c)if(u[c]!==f[c]){o=u[c],a=f[c];break}return o<a?-1:a<o?1:0};function vo(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,mi(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=p.from(e,n)),p.isBuffer(e))return e.length===0?-1:So(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):So(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function So(t,e,r,n,i){let s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function l(f,c){return s===1?f[c]:f.readUInt16BE(c*s)}let u;if(i){let f=-1;for(u=r;u<o;u++)if(l(t,u)===l(e,f===-1?0:u-f)){if(f===-1&&(f=u),u-f+1===a)return f*s}else f!==-1&&(u-=u-f),f=-1}else for(r+a>o&&(r=o-a),u=r;u>=0;u--){let f=!0;for(let c=0;c<a;c++)if(l(t,u+c)!==l(e,c)){f=!1;break}if(f)return u}return-1}p.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};p.prototype.indexOf=function(e,r,n){return vo(this,e,r,n,!0)};p.prototype.lastIndexOf=function(e,r,n){return vo(this,e,r,n,!1)};function yc(t,e,r,n){r=Number(r)||0;let i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o<n;++o){let a=parseInt(e.substr(o*2,2),16);if(mi(a))return o;t[r+o]=a}return o}function bc(t,e,r,n){return en(pi(e,t.length-r),t,r,n)}function mc(t,e,r,n){return en(jc(e),t,r,n)}function gc(t,e,r,n){return en(Co(e),t,r,n)}function wc(t,e,r,n){return en(Nc(e,t.length-r),t,r,n)}p.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return yc(this,e,r,n);case"utf8":case"utf-8":return bc(this,e,r,n);case"ascii":case"latin1":case"binary":return mc(this,e,r,n);case"base64":return gc(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wc(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function xc(t,e,r){return e===0&&r===t.length?ci.fromByteArray(t):ci.fromByteArray(t.slice(e,r))}function ko(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i<r;){let s=t[i],o=null,a=s>239?4:s>223?3:s>191?2:1;if(i+a<=r){let l,u,f,c;switch(a){case 1:s<128&&(o=s);break;case 2:l=t[i+1],(l&192)===128&&(c=(s&31)<<6|l&63,c>127&&(o=c));break;case 3:l=t[i+1],u=t[i+2],(l&192)===128&&(u&192)===128&&(c=(s&15)<<12|(l&63)<<6|u&63,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:l=t[i+1],u=t[i+2],f=t[i+3],(l&192)===128&&(u&192)===128&&(f&192)===128&&(c=(s&15)<<18|(l&63)<<12|(u&63)<<6|f&63,c>65535&&c<1114112&&(o=c))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return Sc(n)}var Eo=4096;function Sc(t){let e=t.length;if(e<=Eo)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Eo));return r}function Ec(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function Rc(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function Ic(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let s=e;s<r;++s)i+=Pc[t[s]];return i}function Ac(t,e,r){let n=t.slice(e,r),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}p.prototype.slice=function(e,r){let n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);let i=this.subarray(e,r);return Object.setPrototypeOf(i,p.prototype),i};function H(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")}p.prototype.readUintLE=p.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||H(e,r,this.length);let i=this[e],s=1,o=0;for(;++o<r&&(s*=256);)i+=this[e+o]*s;return i};p.prototype.readUintBE=p.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||H(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};p.prototype.readUint8=p.prototype.readUInt8=function(e,r){return e=e>>>0,r||H(e,1,this.length),this[e]};p.prototype.readUint16LE=p.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||H(e,2,this.length),this[e]|this[e+1]<<8};p.prototype.readUint16BE=p.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||H(e,2,this.length),this[e]<<8|this[e+1]};p.prototype.readUint32LE=p.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||H(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};p.prototype.readUint32BE=p.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||H(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};p.prototype.readBigUInt64LE=He(function(e){e=e>>>0,Mt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&yr(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))});p.prototype.readBigUInt64BE=He(function(e){e=e>>>0,Mt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&yr(e,this.length-8);let i=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+n;return(BigInt(i)<<BigInt(32))+BigInt(s)});p.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||H(e,r,this.length);let i=this[e],s=1,o=0;for(;++o<r&&(s*=256);)i+=this[e+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*r)),i};p.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||H(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};p.prototype.readInt8=function(e,r){return e=e>>>0,r||H(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};p.prototype.readInt16LE=function(e,r){e=e>>>0,r||H(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};p.prototype.readInt16BE=function(e,r){e=e>>>0,r||H(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};p.prototype.readInt32LE=function(e,r){return e=e>>>0,r||H(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};p.prototype.readInt32BE=function(e,r){return e=e>>>0,r||H(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};p.prototype.readBigInt64LE=He(function(e){e=e>>>0,Mt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&yr(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});p.prototype.readBigInt64BE=He(function(e){e=e>>>0,Mt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&yr(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});p.prototype.readFloatLE=function(e,r){return e=e>>>0,r||H(e,4,this.length),Ft.read(this,e,!0,23,4)};p.prototype.readFloatBE=function(e,r){return e=e>>>0,r||H(e,4,this.length),Ft.read(this,e,!1,23,4)};p.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||H(e,8,this.length),Ft.read(this,e,!0,52,8)};p.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||H(e,8,this.length),Ft.read(this,e,!1,52,8)};function X(t,e,r,n,i,s){if(!p.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;X(this,e,r,n,a,0)}let s=1,o=0;for(this[r]=e&255;++o<n&&(s*=256);)this[r+o]=e/s&255;return r+n};p.prototype.writeUintBE=p.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;X(this,e,r,n,a,0)}let s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};p.prototype.writeUint8=p.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||X(this,e,r,1,255,0),this[r]=e&255,r+1};p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||X(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||X(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||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};p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||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 jo(t,e,r,n,i){Bo(e,n,i,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 No(t,e,r,n,i){Bo(e,n,i,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}p.prototype.writeBigUInt64LE=He(function(e,r=0){return jo(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeBigUInt64BE=He(function(e,r=0){return No(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let l=Math.pow(2,8*n-1);X(this,e,r,n,l-1,-l)}let s=0,o=1,a=0;for(this[r]=e&255;++s<n&&(o*=256);)e<0&&a===0&&this[r+s-1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+n};p.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let l=Math.pow(2,8*n-1);X(this,e,r,n,l-1,-l)}let s=n-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+n};p.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||X(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};p.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||X(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};p.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||X(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};p.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||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};p.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||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};p.prototype.writeBigInt64LE=He(function(e,r=0){return jo(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});p.prototype.writeBigInt64BE=He(function(e,r=0){return No(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Po(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Oo(t,e,r,n,i){return e=+e,r=r>>>0,i||Po(t,e,r,4,34028234663852886e22,-34028234663852886e22),Ft.write(t,e,r,n,23,4),r+4}p.prototype.writeFloatLE=function(e,r,n){return Oo(this,e,r,!0,n)};p.prototype.writeFloatBE=function(e,r,n){return Oo(this,e,r,!1,n)};function Lo(t,e,r,n,i){return e=+e,r=r>>>0,i||Po(t,e,r,8,17976931348623157e292,-17976931348623157e292),Ft.write(t,e,r,n,52,8),r+8}p.prototype.writeDoubleLE=function(e,r,n){return Lo(this,e,r,!0,n)};p.prototype.writeDoubleBE=function(e,r,n){return Lo(this,e,r,!1,n)};p.prototype.copy=function(e,r,n,i){if(!p.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);let s=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),r),s};p.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!p.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let o=e.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s<n;++s)this[s]=e;else{let o=p.isBuffer(e)?e:p.from(e,i),a=o.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<n-r;++s)this[s+r]=o[s%a]}return this};var Ct={};function bi(t,e,r){Ct[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(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}bi("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);bi("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);bi("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=Ro(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Ro(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Ro(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function Tc(t,e,r){Mt(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&yr(e,t.length-(r+1))}function Bo(t,e,r,n,i,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 Ct.ERR_OUT_OF_RANGE("value",a,t)}Tc(n,i,s)}function Mt(t,e){if(typeof t!="number")throw new Ct.ERR_INVALID_ARG_TYPE(e,"number",t)}function yr(t,e,r){throw Math.floor(t)!==t?(Mt(t,r),new Ct.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Ct.ERR_BUFFER_OUT_OF_BOUNDS:new Ct.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var vc=/[^+/0-9A-Za-z-_]/g;function kc(t){if(t=t.split("=")[0],t=t.trim().replace(vc,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function pi(t,e){e=e||1/0;let r,n=t.length,i=null,s=[];for(let o=0;o<n;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=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 jc(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Nc(t,e){let r,n,i,s=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),n=r>>8,i=r%256,s.push(i),s.push(n);return s}function Co(t){return ci.toByteArray(kc(t))}function en(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function he(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function mi(t){return t!==t}var Pc=(function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e})();function He(t){return typeof BigInt>"u"?Oc:t}function Oc(){throw new Error("BigInt not supported")}});var B=v((Ig,Xo)=>{"use strict";var Ei=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 n=0;n<e.length;n++)r+=` ${e[n].stack}
2
+ `;super(r),this.name="AggregateError",this.errors=e}};Xo.exports={AggregateError:Ei,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 Ri=v((Ag,ea)=>{"use strict";ea.exports={format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,n]){let i=e.shift();return n==="f"?i.toFixed(6):n==="j"?JSON.stringify(i):n==="s"&&typeof i=="object"?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}}}});var Q=v((Tg,na)=>{"use strict";var{format:Zc,inspect:nn}=Ri(),{AggregateError:Xc}=B(),ed=globalThis.AggregateError||Xc,td=Symbol("kIsNodeError"),rd=["string","function","number","object","Function","Object","boolean","bigint","symbol"],nd=/^([A-Z][a-z0-9]*)+$/,id="__node_internal_",sn={};function _t(t,e){if(!t)throw new sn.ERR_INTERNAL_ASSERTION(e)}function ta(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function sd(t,e,r){if(typeof e=="function")return _t(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let n=(e.match(/%[dfijoOs]/g)||[]).length;return _t(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:Zc(e,...r)}function K(t,e,r){r||(r=Error);class n extends r{constructor(...s){super(sd(t,e,s))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(n.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}}),n.prototype.code=t,n.prototype[td]=!0,sn[t]=n}function ra(t){let e=id+t.name;return Object.defineProperty(t,"name",{value:e}),t}function od(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new ed([e,t],e.message);return r.code=e.code,r}return t||e}var Ii=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new sn.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};K("ERR_ASSERTION","%s",Error);K("ERR_INVALID_ARG_TYPE",(t,e,r)=>{_t(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let n="The ";t.endsWith(" argument")?n+=`${t} `:n+=`"${t}" ${t.includes(".")?"property":"argument"} `,n+="must be ";let i=[],s=[],o=[];for(let l of e)_t(typeof l=="string","All expected entries have to be of type string"),rd.includes(l)?i.push(l.toLowerCase()):nd.test(l)?s.push(l):(_t(l!=="object",'The value "object" should be written as "Object"'),o.push(l));if(s.length>0){let l=i.indexOf("object");l!==-1&&(i.splice(i,l,1),s.push("Object"))}if(i.length>0){switch(i.length){case 1:n+=`of type ${i[0]}`;break;case 2:n+=`one of type ${i[0]} or ${i[1]}`;break;default:{let l=i.pop();n+=`one of type ${i.join(", ")}, or ${l}`}}(s.length>0||o.length>0)&&(n+=" or ")}if(s.length>0){switch(s.length){case 1:n+=`an instance of ${s[0]}`;break;case 2:n+=`an instance of ${s[0]} or ${s[1]}`;break;default:{let l=s.pop();n+=`an instance of ${s.join(", ")}, or ${l}`}}o.length>0&&(n+=" or ")}switch(o.length){case 0:break;case 1:o[0].toLowerCase()!==o[0]&&(n+="an "),n+=`${o[0]}`;break;case 2:n+=`one of ${o[0]} or ${o[1]}`;break;default:{let l=o.pop();n+=`one of ${o.join(", ")}, or ${l}`}}if(r==null)n+=`. Received ${r}`;else if(typeof r=="function"&&r.name)n+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)n+=`. Received an instance of ${r.constructor.name}`;else{let l=nn(r,{depth:-1});n+=`. Received ${l}`}}else{let l=nn(r,{colors:!1});l.length>25&&(l=`${l.slice(0,25)}...`),n+=`. Received type ${typeof r} (${l})`}return n},TypeError);K("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=nn(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);K("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var n;let i=r!=null&&(n=r.constructor)!==null&&n!==void 0&&n.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${i}.`},TypeError);K("ERR_MISSING_ARGS",(...t)=>{_t(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(n=>`"${n}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let n=t.pop();e+=`The ${t.join(", ")}, and ${n} arguments`}break}return`${e} must be specified`},TypeError);K("ERR_OUT_OF_RANGE",(t,e,r)=>{_t(e,'Missing "range" argument');let n;if(Number.isInteger(r)&&Math.abs(r)>2**32)n=ta(String(r));else if(typeof r=="bigint"){n=String(r);let i=BigInt(2)**BigInt(32);(r>i||r<-i)&&(n=ta(n)),n+="n"}else n=nn(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);K("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);K("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);K("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);K("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);K("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);K("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);K("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);K("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);K("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);K("ERR_STREAM_WRITE_AFTER_END","write after end",Error);K("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);na.exports={AbortError:Ii,aggregateTwoErrors:ra(od),hideStackFrames:ra,codes:sn}});var zt=v((vg,on)=>{"use strict";var{AbortController:ia,AbortSignal:ad}=typeof self<"u"?self:typeof window<"u"?window:void 0;on.exports=ia;on.exports.AbortSignal=ad;on.exports.default=ia});var Rr=v((kg,Ai)=>{"use strict";var Gt=typeof Reflect=="object"?Reflect:null,sa=Gt&&typeof Gt.apply=="function"?Gt.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},an;Gt&&typeof Gt.ownKeys=="function"?an=Gt.ownKeys:Object.getOwnPropertySymbols?an=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:an=function(e){return Object.getOwnPropertyNames(e)};function ld(t){console&&console.warn&&console.warn(t)}var aa=Number.isNaN||function(e){return e!==e};function j(){j.init.call(this)}Ai.exports=j;Ai.exports.once=dd;j.EventEmitter=j;j.prototype._events=void 0;j.prototype._eventsCount=0;j.prototype._maxListeners=void 0;var oa=10;function ln(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(j,"defaultMaxListeners",{enumerable:!0,get:function(){return oa},set:function(t){if(typeof t!="number"||t<0||aa(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");oa=t}});j.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};j.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||aa(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 la(t){return t._maxListeners===void 0?j.defaultMaxListeners:t._maxListeners}j.prototype.getMaxListeners=function(){return la(this)};j.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){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")sa(l,this,r);else for(var u=l.length,f=ha(l,u),n=0;n<u;++n)sa(f[n],this,r);return!0};function ua(t,e,r,n){var i,s,o;if(ln(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]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=la(t),i>0&&o.length>i&&!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,ld(a)}return t}j.prototype.addListener=function(e,r){return ua(this,e,r,!1)};j.prototype.on=j.prototype.addListener;j.prototype.prependListener=function(e,r){return ua(this,e,r,!0)};function ud(){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 fa(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=ud.bind(n);return i.listener=r,n.wrapFn=i,i}j.prototype.once=function(e,r){return ln(r),this.on(e,fa(this,e,r)),this};j.prototype.prependOnceListener=function(e,r){return ln(r),this.prependListener(e,fa(this,e,r)),this};j.prototype.removeListener=function(e,r){var n,i,s,o,a;if(ln(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():fd(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};j.prototype.off=j.prototype.removeListener;j.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function ca(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?cd(i):ha(i,i.length)}j.prototype.listeners=function(e){return ca(this,e,!0)};j.prototype.rawListeners=function(e){return ca(this,e,!1)};j.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):da.call(t,e)};j.prototype.listenerCount=da;function da(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}j.prototype.eventNames=function(){return this._eventsCount>0?an(this._events):[]};function ha(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function fd(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function cd(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function dd(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}pa(t,e,s,{once:!0}),e!=="error"&&hd(t,i,{once:!0})})}function hd(t,e,r){typeof t.on=="function"&&pa(t,"error",e,r)}function pa(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var Y=v((jg,vi)=>{"use strict";var pd=pe(),{format:_d,inspect:yd}=Ri(),{codes:{ERR_INVALID_ARG_TYPE:Ti}}=Q(),{kResistStopPropagation:bd,AggregateError:md,SymbolDispose:gd}=B(),wd=globalThis.AbortSignal||zt().AbortSignal,xd=globalThis.AbortController||zt().AbortController,Sd=Object.getPrototypeOf(async function(){}).constructor,_a=globalThis.Blob||pd.Blob,Ed=typeof _a<"u"?function(e){return e instanceof _a}:function(e){return!1},ya=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Ti(e,"AbortSignal",t)},Rd=(t,e)=>{if(typeof t!="function")throw new Ti(e,"Function",t)};vi.exports={AggregateError:md,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((n,i)=>{t=n,e=i}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((n,...i)=>n?r(n):e(...i))})},debuglog(){return function(){}},format:_d,inspect:yd,types:{isAsyncFunction(t){return t instanceof Sd},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Ed,deprecate(t,e){return t},addAbortListener:Rr().addAbortListener||function(e,r){if(e===void 0)throw new Ti("signal","AbortSignal",e);ya(e,"signal"),Rd(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[bd]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[gd](){var i;(i=n)===null||i===void 0||i()}}},AbortSignalAny:wd.any||function(e){if(e.length===1)return e[0];let r=new xd,n=()=>r.abort();return e.forEach(i=>{ya(i,"signals"),i.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(i=>i.removeEventListener("abort",n))},{once:!0}),r.signal}};vi.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Vt=v((Ng,Aa)=>{"use strict";var{ArrayIsArray:ji,ArrayPrototypeIncludes:wa,ArrayPrototypeJoin:xa,ArrayPrototypeMap:Id,NumberIsInteger:Ni,NumberIsNaN:Ad,NumberMAX_SAFE_INTEGER:Td,NumberMIN_SAFE_INTEGER:vd,NumberParseInt:kd,ObjectPrototypeHasOwnProperty:jd,RegExpPrototypeExec:Sa,String:Nd,StringPrototypeToUpperCase:Pd,StringPrototypeTrim:Od}=B(),{hideStackFrames:ie,codes:{ERR_SOCKET_BAD_PORT:Ld,ERR_INVALID_ARG_TYPE:J,ERR_INVALID_ARG_VALUE:Ht,ERR_OUT_OF_RANGE:yt,ERR_UNKNOWN_SIGNAL:ba}}=Q(),{normalizeEncoding:Bd}=Y(),{isAsyncFunction:Cd,isArrayBufferView:Fd}=Y().types,ma={};function Md(t){return t===(t|0)}function Dd(t){return t===t>>>0}var Ud=/^[0-7]+$/,$d="must be a 32-bit unsigned integer or an octal string";function qd(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(Sa(Ud,t)===null)throw new Ht(e,t,$d);t=kd(t,8)}return Ea(t,e),t}var Wd=ie((t,e,r=vd,n=Td)=>{if(typeof t!="number")throw new J(e,"number",t);if(!Ni(t))throw new yt(e,"an integer",t);if(t<r||t>n)throw new yt(e,`>= ${r} && <= ${n}`,t)}),zd=ie((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new J(e,"number",t);if(!Ni(t))throw new yt(e,"an integer",t);if(t<r||t>n)throw new yt(e,`>= ${r} && <= ${n}`,t)}),Ea=ie((t,e,r=!1)=>{if(typeof t!="number")throw new J(e,"number",t);if(!Ni(t))throw new yt(e,"an integer",t);let n=r?1:0,i=4294967295;if(t<n||t>i)throw new yt(e,`>= ${n} && <= ${i}`,t)});function Pi(t,e){if(typeof t!="string")throw new J(e,"string",t)}function Gd(t,e,r=void 0,n){if(typeof t!="number")throw new J(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&Ad(t))throw new yt(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var Hd=ie((t,e,r)=>{if(!wa(r,t)){let i="must be one of: "+xa(Id(r,s=>typeof s=="string"?`'${s}'`:Nd(s)),", ");throw new Ht(e,t,i)}});function Ra(t,e){if(typeof t!="boolean")throw new J(e,"boolean",t)}function ki(t,e,r){return t==null||!jd(t,e)?r:t[e]}var Vd=ie((t,e,r=null)=>{let n=ki(r,"allowArray",!1),i=ki(r,"allowFunction",!1);if(!ki(r,"nullable",!1)&&t===null||!n&&ji(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new J(e,"Object",t)}),Kd=ie((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new J(e,"a dictionary",t)}),un=ie((t,e,r=0)=>{if(!ji(t))throw new J(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new Ht(e,t,n)}});function Qd(t,e){un(t,e);for(let r=0;r<t.length;r++)Pi(t[r],`${e}[${r}]`)}function Jd(t,e){un(t,e);for(let r=0;r<t.length;r++)Ra(t[r],`${e}[${r}]`)}function Yd(t,e){un(t,e);for(let r=0;r<t.length;r++){let n=t[r],i=`${e}[${r}]`;if(n==null)throw new J(i,"AbortSignal",n);Ia(n,i)}}function Zd(t,e="signal"){if(Pi(t,e),ma[t]===void 0)throw ma[Pd(t)]!==void 0?new ba(t+" (signals must use all capital letters)"):new ba(t)}var Xd=ie((t,e="buffer")=>{if(!Fd(t))throw new J(e,["Buffer","TypedArray","DataView"],t)});function eh(t,e){let r=Bd(e),n=t.length;if(r==="hex"&&n%2!==0)throw new Ht("encoding",e,`is invalid for data of length ${n}`)}function th(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&Od(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new Ld(e,t,r);return t|0}var Ia=ie((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new J(e,"AbortSignal",t)}),rh=ie((t,e)=>{if(typeof t!="function")throw new J(e,"Function",t)}),nh=ie((t,e)=>{if(typeof t!="function"||Cd(t))throw new J(e,"Function",t)}),ih=ie((t,e)=>{if(t!==void 0)throw new J(e,"undefined",t)});function sh(t,e,r){if(!wa(r,t))throw new J(e,`('${xa(r,"|")}')`,t)}var oh=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function ga(t,e){if(typeof t>"u"||!Sa(oh,t))throw new Ht(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function ah(t){if(typeof t=="string")return ga(t,"hints"),t;if(ji(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let i=t[n];ga(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new Ht("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Aa.exports={isInt32:Md,isUint32:Dd,parseFileMode:qd,validateArray:un,validateStringArray:Qd,validateBooleanArray:Jd,validateAbortSignalArray:Yd,validateBoolean:Ra,validateBuffer:Xd,validateDictionary:Kd,validateEncoding:eh,validateFunction:rh,validateInt32:zd,validateInteger:Wd,validateNumber:Gd,validateObject:Vd,validateOneOf:Hd,validatePlainFunction:nh,validatePort:th,validateSignalName:Zd,validateString:Pi,validateUint32:Ea,validateUndefined:ih,validateUnion:sh,validateAbortSignal:Ia,validateLinkHeaderValue:ah}});var Qe=v((Pg,ja)=>{var F=ja.exports={},ye,be;function Oi(){throw new Error("setTimeout has not been defined")}function Li(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ye=setTimeout:ye=Oi}catch{ye=Oi}try{typeof clearTimeout=="function"?be=clearTimeout:be=Li}catch{be=Li}})();function Ta(t){if(ye===setTimeout)return setTimeout(t,0);if((ye===Oi||!ye)&&setTimeout)return ye=setTimeout,setTimeout(t,0);try{return ye(t,0)}catch{try{return ye.call(null,t,0)}catch{return ye.call(this,t,0)}}}function lh(t){if(be===clearTimeout)return clearTimeout(t);if((be===Li||!be)&&clearTimeout)return be=clearTimeout,clearTimeout(t);try{return be(t)}catch{try{return be.call(null,t)}catch{return be.call(this,t)}}}var Oe=[],Kt=!1,bt,fn=-1;function uh(){!Kt||!bt||(Kt=!1,bt.length?Oe=bt.concat(Oe):fn=-1,Oe.length&&va())}function va(){if(!Kt){var t=Ta(uh);Kt=!0;for(var e=Oe.length;e;){for(bt=Oe,Oe=[];++fn<e;)bt&&bt[fn].run();fn=-1,e=Oe.length}bt=null,Kt=!1,lh(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];Oe.push(new ka(t,e)),Oe.length===1&&!Kt&&Ta(va)};function ka(t,e){this.fun=t,this.array=e}ka.prototype.run=function(){this.fun.apply(null,this.array)};F.title="browser";F.browser=!0;F.env={};F.argv=[];F.version="";F.versions={};function Le(){}F.on=Le;F.addListener=Le;F.once=Le;F.off=Le;F.removeListener=Le;F.removeAllListeners=Le;F.emit=Le;F.prependListener=Le;F.prependOnceListener=Le;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 ge=v((Og,Ga)=>{"use strict";var{SymbolAsyncIterator:Na,SymbolIterator:Pa,SymbolFor:mt}=B(),Oa=mt("nodejs.stream.destroyed"),La=mt("nodejs.stream.errored"),Bi=mt("nodejs.stream.readable"),Ci=mt("nodejs.stream.writable"),Ba=mt("nodejs.stream.disturbed"),fh=mt("nodejs.webstream.isClosedPromise"),ch=mt("nodejs.webstream.controllerErrorFunction");function cn(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 dn(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 dh(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function me(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Ca(t){return!!(t&&!me(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Fa(t){return!!(t&&!me(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Ma(t){return!!(t&&!me(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function hh(t){return Ca(t)||Fa(t)||Ma(t)}function ph(t,e){return t==null?!1:e===!0?typeof t[Na]=="function":e===!1?typeof t[Pa]=="function":typeof t[Na]=="function"||typeof t[Pa]=="function"}function hn(t){if(!me(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[Oa]||n!=null&&n.destroyed)}function Da(t){if(!dn(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function _h(t,e){if(!dn(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function yh(t){if(!cn(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Ua(t,e){if(!cn(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function $a(t){return t&&t[Bi]!=null?t[Bi]:typeof t?.readable!="boolean"?null:hn(t)?!1:cn(t)&&t.readable&&!Ua(t)}function qa(t){return t&&t[Ci]!=null?t[Ci]:typeof t?.writable!="boolean"?null:hn(t)?!1:dn(t)&&t.writable&&!Da(t)}function bh(t,e){return me(t)?hn(t)?!0:!(e?.readable!==!1&&$a(t)||e?.writable!==!1&&qa(t)):null}function mh(t){var e,r;return me(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 gh(t){var e,r;return me(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 wh(t){if(!me(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&Wa(t)?t._closed:null}function Wa(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function za(t){return typeof t._sent100=="boolean"&&Wa(t)}function xh(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 Sh(t){if(!me(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&za(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function Eh(t){var e;return!!(t&&((e=t[Ba])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function Rh(t){var e,r,n,i,s,o,a,l,u,f;return!!(t&&((e=(r=(n=(i=(s=(o=t[La])!==null&&o!==void 0?o:t.readableErrored)!==null&&s!==void 0?s:t.writableErrored)!==null&&i!==void 0?i:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&n!==void 0?n:(l=t._writableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&r!==void 0?r:(u=t._readableState)===null||u===void 0?void 0:u.errored)!==null&&e!==void 0?e:!((f=t._writableState)===null||f===void 0)&&f.errored))}Ga.exports={isDestroyed:hn,kIsDestroyed:Oa,isDisturbed:Eh,kIsDisturbed:Ba,isErrored:Rh,kIsErrored:La,isReadable:$a,kIsReadable:Bi,kIsClosedPromise:fh,kControllerErrorFunction:ch,kIsWritable:Ci,isClosed:wh,isDuplexNodeStream:dh,isFinished:bh,isIterable:ph,isReadableNodeStream:cn,isReadableStream:Ca,isReadableEnded:yh,isReadableFinished:Ua,isReadableErrored:gh,isNodeStream:me,isWebStream:hh,isWritable:qa,isWritableNodeStream:dn,isWritableStream:Fa,isWritableEnded:Da,isWritableFinished:_h,isWritableErrored:mh,isServerRequest:xh,isServerResponse:za,willEmitClose:Sh,isTransformStream:Ma}});var Be=v((Lg,$i)=>{"use strict";var Je=Qe(),{AbortError:el,codes:Ih}=Q(),{ERR_INVALID_ARG_TYPE:Ah,ERR_STREAM_PREMATURE_CLOSE:Ha}=Ih,{kEmptyObject:Mi,once:Di}=Y(),{validateAbortSignal:Th,validateFunction:vh,validateObject:kh,validateBoolean:jh}=Vt(),{Promise:Nh,PromisePrototypeThen:Ph,SymbolDispose:tl}=B(),{isClosed:Oh,isReadable:Va,isReadableNodeStream:Fi,isReadableStream:Lh,isReadableFinished:Ka,isReadableErrored:Qa,isWritable:Ja,isWritableNodeStream:Ya,isWritableStream:Bh,isWritableFinished:Za,isWritableErrored:Xa,isNodeStream:Ch,willEmitClose:Fh,kIsClosedPromise:Mh}=ge(),Qt;function Dh(t){return t.setHeader&&typeof t.abort=="function"}var Ui=()=>{};function rl(t,e,r){var n,i;if(arguments.length===2?(r=e,e=Mi):e==null?e=Mi:kh(e,"options"),vh(r,"callback"),Th(e.signal,"options.signal"),r=Di(r),Lh(t)||Bh(t))return Uh(t,e,r);if(!Ch(t))throw new Ah("stream",["ReadableStream","WritableStream","Stream"],t);let s=(n=e.readable)!==null&&n!==void 0?n:Fi(t),o=(i=e.writable)!==null&&i!==void 0?i:Ya(t),a=t._writableState,l=t._readableState,u=()=>{t.writable||d()},f=Fh(t)&&Fi(t)===s&&Ya(t)===o,c=Za(t,!1),d=()=>{c=!0,t.destroyed&&(f=!1),!(f&&(!t.readable||s))&&(!s||h)&&r.call(t)},h=Ka(t,!1),y=()=>{h=!0,t.destroyed&&(f=!1),!(f&&(!t.writable||o))&&(!o||c)&&r.call(t)},_=T=>{r.call(t,T)},x=Oh(t),b=()=>{x=!0;let T=Xa(t)||Qa(t);if(T&&typeof T!="boolean")return r.call(t,T);if(s&&!h&&Fi(t,!0)&&!Ka(t,!1))return r.call(t,new Ha);if(o&&!c&&!Za(t,!1))return r.call(t,new Ha);r.call(t)},g=()=>{x=!0;let T=Xa(t)||Qa(t);if(T&&typeof T!="boolean")return r.call(t,T);r.call(t)},S=()=>{t.req.on("finish",d)};Dh(t)?(t.on("complete",d),f||t.on("abort",b),t.req?S():t.on("request",S)):o&&!a&&(t.on("end",u),t.on("close",u)),!f&&typeof t.aborted=="boolean"&&t.on("aborted",b),t.on("end",y),t.on("finish",d),e.error!==!1&&t.on("error",_),t.on("close",b),x?Je.nextTick(b):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?f||Je.nextTick(g):(!s&&(!f||Va(t))&&(c||Ja(t)===!1)||!o&&(!f||Ja(t))&&(h||Va(t)===!1)||l&&t.req&&t.aborted)&&Je.nextTick(g);let w=()=>{r=Ui,t.removeListener("aborted",b),t.removeListener("complete",d),t.removeListener("abort",b),t.removeListener("request",S),t.req&&t.req.removeListener("finish",d),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",d),t.removeListener("end",y),t.removeListener("error",_),t.removeListener("close",b)};if(e.signal&&!x){let T=()=>{let Ae=r;w(),Ae.call(t,new el(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Je.nextTick(T);else{Qt=Qt||Y().addAbortListener;let Ae=Qt(e.signal,T),U=r;r=Di((...Tt)=>{Ae[tl](),U.apply(t,Tt)})}}return w}function Uh(t,e,r){let n=!1,i=Ui;if(e.signal)if(i=()=>{n=!0,r.call(t,new el(void 0,{cause:e.signal.reason}))},e.signal.aborted)Je.nextTick(i);else{Qt=Qt||Y().addAbortListener;let o=Qt(e.signal,i),a=r;r=Di((...l)=>{o[tl](),a.apply(t,l)})}let s=(...o)=>{n||Je.nextTick(()=>r.apply(t,o))};return Ph(t[Mh].promise,s,s),Ui}function $h(t,e){var r;let n=!1;return e===null&&(e=Mi),(r=e)!==null&&r!==void 0&&r.cleanup&&(jh(e.cleanup,"cleanup"),n=e.cleanup),new Nh((i,s)=>{let o=rl(t,e,a=>{n&&o(),a?s(a):i()})})}$i.exports=rl;$i.exports.finished=$h});var gt=v((Bg,fl)=>{"use strict";var we=Qe(),{aggregateTwoErrors:qh,codes:{ERR_MULTIPLE_CALLBACK:Wh},AbortError:zh}=Q(),{Symbol:sl}=B(),{kIsDestroyed:Gh,isDestroyed:Hh,isFinished:Vh,isServerRequest:Kh}=ge(),ol=sl("kDestroy"),qi=sl("kConstruct");function al(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Qh(t,e){let r=this._readableState,n=this._writableState,i=n||r;return n!=null&&n.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(al(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?nl(this,t,e):this.once(ol,function(s){nl(this,qh(s,t),e)}),this)}function nl(t,e,r){let n=!1;function i(s){if(n)return;n=!0;let o=t._readableState,a=t._writableState;al(s,a,o),a&&(a.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?we.nextTick(Jh,t,s):we.nextTick(ll,t)}try{t._destroy(e||null,i)}catch(s){i(s)}}function Jh(t,e){Wi(t,e),ll(t)}function ll(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 Wi(t,e){let r=t._readableState,n=t._writableState;n!=null&&n.errorEmitted||r!=null&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function Yh(){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 zi(t,e,r){let n=t._readableState,i=t._writableState;if(i!=null&&i.destroyed||n!=null&&n.destroyed)return this;n!=null&&n.autoDestroy||i!=null&&i.autoDestroy?t.destroy(e):e&&(e.stack,i&&!i.errored&&(i.errored=e),n&&!n.errored&&(n.errored=e),r?we.nextTick(Wi,t,e):Wi(t,e))}function Zh(t,e){if(typeof t._construct!="function")return;let r=t._readableState,n=t._writableState;r&&(r.constructed=!1),n&&(n.constructed=!1),t.once(qi,e),!(t.listenerCount(qi)>1)&&we.nextTick(Xh,t)}function Xh(t){let e=!1;function r(n){if(e){zi(t,n??new Wh);return}e=!0;let i=t._readableState,s=t._writableState,o=s||i;i&&(i.constructed=!0),s&&(s.constructed=!0),o.destroyed?t.emit(ol,n):n?zi(t,n,!0):we.nextTick(ep,t)}try{t._construct(n=>{we.nextTick(r,n)})}catch(n){we.nextTick(r,n)}}function ep(t){t.emit(qi)}function il(t){return t?.setHeader&&typeof t.abort=="function"}function ul(t){t.emit("close")}function tp(t,e){t.emit("error",e),we.nextTick(ul,t)}function rp(t,e){!t||Hh(t)||(!e&&!Vh(t)&&(e=new zh),Kh(t)?(t.socket=null,t.destroy(e)):il(t)?t.abort():il(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?we.nextTick(tp,t,e):we.nextTick(ul,t),t.destroyed||(t[Gh]=!0))}fl.exports={construct:Zh,destroyer:rp,destroy:Qh,undestroy:Yh,errorOrDestroy:zi}});var yn=v((Cg,dl)=>{"use strict";var{ArrayIsArray:np,ObjectSetPrototypeOf:cl}=B(),{EventEmitter:pn}=Rr();function _n(t){pn.call(this,t)}cl(_n.prototype,pn.prototype);cl(_n,pn);_n.prototype.pipe=function(t,e){let r=this;function n(f){t.writable&&t.write(f)===!1&&r.pause&&r.pause()}r.on("data",n);function i(){r.readable&&r.resume&&r.resume()}t.on("drain",i),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",o),r.on("close",a));let s=!1;function o(){s||(s=!0,t.end())}function a(){s||(s=!0,typeof t.destroy=="function"&&t.destroy())}function l(f){u(),pn.listenerCount(this,"error")===0&&this.emit("error",f)}Gi(r,"error",l),Gi(t,"error",l);function u(){r.removeListener("data",n),t.removeListener("drain",i),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 Gi(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):np(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}dl.exports={Stream:_n,prependListener:Gi}});var Ir=v((Fg,bn)=>{"use strict";var{SymbolDispose:ip}=B(),{AbortError:hl,codes:sp}=Q(),{isNodeStream:pl,isWebStream:op,kControllerErrorFunction:ap}=ge(),lp=Be(),{ERR_INVALID_ARG_TYPE:_l}=sp,Hi,up=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new _l(e,"AbortSignal",t)};bn.exports.addAbortSignal=function(e,r){if(up(e,"signal"),!pl(r)&&!op(r))throw new _l("stream",["ReadableStream","WritableStream","Stream"],r);return bn.exports.addAbortSignalNoValidate(e,r)};bn.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=pl(e)?()=>{e.destroy(new hl(void 0,{cause:t.reason}))}:()=>{e[ap](new hl(void 0,{cause:t.reason}))};if(t.aborted)r();else{Hi=Hi||Y().addAbortListener;let n=Hi(t,r);lp(e,n[ip])}return e}});var ml=v((Dg,bl)=>{"use strict";var{StringPrototypeSlice:yl,SymbolIterator:fp,TypedArrayPrototypeSet:mn,Uint8Array:cp}=B(),{Buffer:Vi}=pe(),{inspect:dp}=Y();bl.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,n=""+r.data;for(;(r=r.next)!==null;)n+=e+r.data;return n}concat(e){if(this.length===0)return Vi.alloc(0);let r=Vi.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)mn(r,n.data,i),i+=n.data.length,n=n.next;return r}consume(e,r){let n=this.head.data;if(e<n.length){let i=n.slice(0,e);return this.head.data=n.slice(e),i}return e===n.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[fp](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",n=this.head,i=0;do{let s=n.data;if(e>s.length)r+=s,e-=s.length;else{e===s.length?(r+=s,++i,n.next?this.head=n.next:this.head=this.tail=null):(r+=yl(s,0,e),this.head=n,n.data=yl(s,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=Vi.allocUnsafe(e),n=e,i=this.head,s=0;do{let o=i.data;if(e>o.length)mn(r,o,n-e),e-=o.length;else{e===o.length?(mn(r,o,n-e),++s,i.next?this.head=i.next:this.head=this.tail=null):(mn(r,new cp(o.buffer,o.byteOffset,e),n-e),this.head=i,i.data=o.slice(e));break}++s}while((i=i.next)!==null);return this.length-=s,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return dp(this,{...r,depth:0,customInspect:!1})}}});var Ar=v((Ug,Sl)=>{"use strict";var{MathFloor:hp,NumberIsInteger:pp}=B(),{validateInteger:_p}=Vt(),{ERR_INVALID_ARG_VALUE:yp}=Q().codes,gl=16*1024,wl=16;function bp(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function xl(t){return t?wl:gl}function mp(t,e){_p(e,"value",0),t?wl=e:gl=e}function gp(t,e,r,n){let i=bp(e,n,r);if(i!=null){if(!pp(i)||i<0){let s=n?`options.${r}`:"options.highWaterMark";throw new yp(s,i)}return hp(i)}return xl(t.objectMode)}Sl.exports={getHighWaterMark:gp,getDefaultHighWaterMark:xl,setDefaultHighWaterMark:mp}});var Il=v((Ki,Rl)=>{var gn=pe(),xe=gn.Buffer;function El(t,e){for(var r in t)e[r]=t[r]}xe.from&&xe.alloc&&xe.allocUnsafe&&xe.allocUnsafeSlow?Rl.exports=gn:(El(gn,Ki),Ki.Buffer=wt);function wt(t,e,r){return xe(t,e,r)}wt.prototype=Object.create(xe.prototype);El(xe,wt);wt.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return xe(t,e,r)};wt.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=xe(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};wt.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return xe(t)};wt.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return gn.SlowBuffer(t)}});var vl=v(Tl=>{"use strict";var Ji=Il().Buffer,Al=Ji.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 wp(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 xp(t){var e=wp(t);if(typeof e!="string"&&(Ji.isEncoding===Al||!Al(t)))throw new Error("Unknown encoding: "+t);return e||t}Tl.StringDecoder=Tr;function Tr(t){this.encoding=xp(t);var e;switch(this.encoding){case"utf16le":this.text=Tp,this.end=vp,e=4;break;case"utf8":this.fillLast=Rp,e=4;break;case"base64":this.text=kp,this.end=jp,e=3;break;default:this.write=Np,this.end=Pp;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Ji.allocUnsafe(e)}Tr.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||""};Tr.prototype.end=Ap;Tr.prototype.text=Ip;Tr.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 Sp(t,e,r){var n=e.length-1;if(n<r)return 0;var i=Qi(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=Qi(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=Qi(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function Ep(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 Rp(t){var e=this.lastTotal-this.lastNeed,r=Ep(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 Ip(t,e){var r=Sp(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function Ap(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Tp(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=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 vp(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 kp(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 jp(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Np(t){return t.toString(this.encoding)}function Pp(t){return t&&t.length?this.write(t):""}});var Yi=v((qg,Pl)=>{"use strict";var kl=Qe(),{PromisePrototypeThen:Op,SymbolAsyncIterator:jl,SymbolIterator:Nl}=B(),{Buffer:Lp}=pe(),{ERR_INVALID_ARG_TYPE:Bp,ERR_STREAM_NULL_VALUES:Cp}=Q().codes;function Fp(t,e,r){let n;if(typeof e=="string"||e instanceof Lp)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[jl])i=!0,n=e[jl]();else if(e&&e[Nl])i=!1,n=e[Nl]();else throw new Bp("iterable",["Iterable"],e);let s=new t({objectMode:!0,highWaterMark:1,...r}),o=!1;s._read=function(){o||(o=!0,l())},s._destroy=function(u,f){Op(a(u),()=>kl.nextTick(f,u),c=>kl.nextTick(f,c||u))};async function a(u){let f=u!=null,c=typeof n.throw=="function";if(f&&c){let{value:d,done:h}=await n.throw(u);if(await d,h)return}if(typeof n.return=="function"){let{value:d}=await n.return();await d}}async function l(){for(;;){try{let{value:u,done:f}=i?await n.next():n.next();if(f)s.push(null);else{let c=u&&typeof u.then=="function"?await u:u;if(c===null)throw o=!1,new Cp;if(s.push(c))continue;o=!1}}catch(u){s.destroy(u)}break}}return s}Pl.exports=Fp});var kr=v((Wg,Jl)=>{"use strict";var le=Qe(),{ArrayPrototypeIndexOf:Mp,NumberIsInteger:Dp,NumberIsNaN:Up,NumberParseInt:$p,ObjectDefineProperties:ss,ObjectKeys:qp,ObjectSetPrototypeOf:Bl,Promise:Cl,SafeSet:Wp,SymbolAsyncDispose:zp,SymbolAsyncIterator:Gp,Symbol:Hp}=B();Jl.exports=I;I.ReadableState=En;var{EventEmitter:Vp}=Rr(),{Stream:Ye,prependListener:Kp}=yn(),{Buffer:Zi}=pe(),{addAbortSignal:Qp}=Ir(),Fl=Be(),A=Y().debuglog("stream",t=>{A=t}),Jp=ml(),Zt=gt(),{getHighWaterMark:Yp,getDefaultHighWaterMark:Zp}=Ar(),{aggregateTwoErrors:Ol,codes:{ERR_INVALID_ARG_TYPE:Xp,ERR_METHOD_NOT_IMPLEMENTED:e_,ERR_OUT_OF_RANGE:t_,ERR_STREAM_PUSH_AFTER_EOF:r_,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:n_},AbortError:i_}=Q(),{validateObject:s_}=Vt(),xt=Hp("kPaused"),{StringDecoder:Ml}=vl(),o_=Yi();Bl(I.prototype,Ye.prototype);Bl(I,Ye);var Xi=()=>{},{errorOrDestroy:Jt}=Zt,Yt=1,a_=2,Dl=4,vr=8,Ul=16,wn=32,xn=64,$l=128,l_=256,u_=512,f_=1024,ns=2048,is=4096,c_=8192,d_=16384,h_=32768,ql=65536,p_=1<<17,__=1<<18;function q(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}ss(En.prototype,{objectMode:q(Yt),ended:q(a_),endEmitted:q(Dl),reading:q(vr),constructed:q(Ul),sync:q(wn),needReadable:q(xn),emittedReadable:q($l),readableListening:q(l_),resumeScheduled:q(u_),errorEmitted:q(f_),emitClose:q(ns),autoDestroy:q(is),destroyed:q(c_),closed:q(d_),closeEmitted:q(h_),multiAwaitDrain:q(ql),readingMore:q(p_),dataEmitted:q(__)});function En(t,e,r){typeof r!="boolean"&&(r=e instanceof Se()),this.state=ns|is|Ul|wn,t&&t.objectMode&&(this.state|=Yt),r&&t&&t.readableObjectMode&&(this.state|=Yt),this.highWaterMark=t?Yp(this,t,"readableHighWaterMark",r):Zp(!1),this.buffer=new Jp,this.length=0,this.pipes=[],this.flowing=null,this[xt]=null,t&&t.emitClose===!1&&(this.state&=~ns),t&&t.autoDestroy===!1&&(this.state&=~is),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Ml(t.encoding),this.encoding=t.encoding)}function I(t){if(!(this instanceof I))return new I(t);let e=this instanceof Se();this._readableState=new En(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&&Qp(t.signal,this)),Ye.call(this,t),Zt.construct(this,()=>{this._readableState.needReadable&&Sn(this,this._readableState)})}I.prototype.destroy=Zt.destroy;I.prototype._undestroy=Zt.undestroy;I.prototype._destroy=function(t,e){e(t)};I.prototype[Vp.captureRejectionSymbol]=function(t){this.destroy(t)};I.prototype[zp]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new i_,this.destroy(t)),new Cl((e,r)=>Fl(this,n=>n&&n!==t?r(n):e(null)))};I.prototype.push=function(t,e){return Wl(this,t,e,!1)};I.prototype.unshift=function(t,e){return Wl(this,t,e,!0)};function Wl(t,e,r,n){A("readableAddChunk",e);let i=t._readableState,s;if((i.state&Yt)===0&&(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=Zi.from(e,r).toString(i.encoding):(e=Zi.from(e,r),r=""))):e instanceof Zi?r="":Ye._isUint8Array(e)?(e=Ye._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new Xp("chunk",["string","Buffer","Uint8Array"],e))),s)Jt(t,s);else if(e===null)i.state&=~vr,m_(t,i);else if((i.state&Yt)!==0||e&&e.length>0)if(n)if((i.state&Dl)!==0)Jt(t,new n_);else{if(i.destroyed||i.errored)return!1;es(t,i,e,!0)}else if(i.ended)Jt(t,new r_);else{if(i.destroyed||i.errored)return!1;i.state&=~vr,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?es(t,i,e,!1):Sn(t,i)):es(t,i,e,!1)}else n||(i.state&=~vr,Sn(t,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function es(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&ql)!==0?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),(e.state&xn)!==0&&Rn(t)),Sn(t,e)}I.prototype.isPaused=function(){let t=this._readableState;return t[xt]===!0||t.flowing===!1};I.prototype.setEncoding=function(t){let e=new Ml(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,n="";for(let i of r)n+=e.write(i);return r.clear(),n!==""&&r.push(n),this._readableState.length=n.length,this};var y_=1073741824;function b_(t){if(t>y_)throw new t_("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Ll(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&Yt)!==0?1:Up(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}I.prototype.read=function(t){A("read",t),t===void 0?t=NaN:Dp(t)||(t=$p(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=b_(t)),t!==0&&(e.state&=~$l),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return A("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?ts(this):Rn(this),null;if(t=Ll(t,e),t===0&&e.ended)return e.length===0&&ts(this),null;let n=(e.state&xn)!==0;if(A("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,A("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,A("reading, ended or constructing",n);else if(n){A("do read"),e.state|=vr|wn,e.length===0&&(e.state|=xn);try{this._read(e.highWaterMark)}catch(s){Jt(this,s)}e.state&=~wn,e.reading||(t=Ll(r,e))}let i;return t>0?i=Kl(t,e):i=null,i===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&&ts(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function m_(t,e){if(A("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?Rn(t):(e.needReadable=!1,e.emittedReadable=!0,zl(t))}}function Rn(t){let e=t._readableState;A("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(A("emitReadable",e.flowing),e.emittedReadable=!0,le.nextTick(zl,t))}function zl(t){let e=t._readableState;A("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,Hl(t)}function Sn(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,le.nextTick(g_,t,e))}function g_(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(A("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}I.prototype._read=function(t){throw new e_("_read()")};I.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new Wp(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),A("pipe count=%d opts=%j",n.pipes.length,e);let s=(!e||e.end!==!1)&&t!==le.stdout&&t!==le.stderr?a:x;n.endEmitted?le.nextTick(s):r.once("end",s),t.on("unpipe",o);function o(b,g){A("onunpipe"),b===r&&g&&g.hasUnpiped===!1&&(g.hasUnpiped=!0,f())}function a(){A("onend"),t.end()}let l,u=!1;function f(){A("cleanup"),t.removeListener("close",y),t.removeListener("finish",_),l&&t.removeListener("drain",l),t.removeListener("error",h),t.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",x),r.removeListener("data",d),u=!0,l&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&l()}function c(){u||(n.pipes.length===1&&n.pipes[0]===t?(A("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(A("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),l||(l=w_(r,t),t.on("drain",l))}r.on("data",d);function d(b){A("ondata");let g=t.write(b);A("dest.write",g),g===!1&&c()}function h(b){if(A("onerror",b),x(),t.removeListener("error",h),t.listenerCount("error")===0){let g=t._writableState||t._readableState;g&&!g.errorEmitted?Jt(t,b):t.emit("error",b)}}Kp(t,"error",h);function y(){t.removeListener("finish",_),x()}t.once("close",y);function _(){A("onfinish"),t.removeListener("close",y),x()}t.once("finish",_);function x(){A("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?c():n.flowing||(A("pipe resume"),r.resume()),t};function w_(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(A("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(A("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}I.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let i=e.pipes;e.pipes=[],this.pause();for(let s=0;s<i.length;s++)i[s].emit("unpipe",this,{hasUnpiped:!1});return this}let n=Mp(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};I.prototype.on=function(t,e){let r=Ye.prototype.on.call(this,t,e),n=this._readableState;return t==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,A("on readable",n.length,n.reading),n.length?Rn(this):n.reading||le.nextTick(x_,this)),r};I.prototype.addListener=I.prototype.on;I.prototype.removeListener=function(t,e){let r=Ye.prototype.removeListener.call(this,t,e);return t==="readable"&&le.nextTick(Gl,this),r};I.prototype.off=I.prototype.removeListener;I.prototype.removeAllListeners=function(t){let e=Ye.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&le.nextTick(Gl,this),e};function Gl(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[xt]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function x_(t){A("readable nexttick read 0"),t.read(0)}I.prototype.resume=function(){let t=this._readableState;return t.flowing||(A("resume"),t.flowing=!t.readableListening,S_(this,t)),t[xt]=!1,this};function S_(t,e){e.resumeScheduled||(e.resumeScheduled=!0,le.nextTick(E_,t,e))}function E_(t,e){A("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Hl(t),e.flowing&&!e.reading&&t.read(0)}I.prototype.pause=function(){return A("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(A("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[xt]=!0,this};function Hl(t){let e=t._readableState;for(A("flow",e.flowing);e.flowing&&t.read()!==null;);}I.prototype.wrap=function(t){let e=!1;t.on("data",n=>{!this.push(n)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",n=>{Jt(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=qp(t);for(let n=1;n<r.length;n++){let i=r[n];this[i]===void 0&&typeof t[i]=="function"&&(this[i]=t[i].bind(t))}return this};I.prototype[Gp]=function(){return Vl(this)};I.prototype.iterator=function(t){return t!==void 0&&s_(t,"options"),Vl(this,t)};function Vl(t,e){typeof t.read!="function"&&(t=I.wrap(t,{objectMode:!0}));let r=R_(t,e);return r.stream=t,r}async function*R_(t,e){let r=Xi;function n(o){this===t?(r(),r=Xi):r=o}t.on("readable",n);let i,s=Fl(t,{writable:!1},o=>{i=o?Ol(i,o):null,r(),r=Xi});try{for(;;){let o=t.destroyed?null:t.read();if(o!==null)yield o;else{if(i)throw i;if(i===null)return;await new Cl(n)}}}catch(o){throw i=Ol(i,o),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?Zt.destroyer(t,null):(t.off("readable",n),s())}}ss(I.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}}});ss(En.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[xt]!==!1},set(t){this[xt]=!!t}}});I._fromList=Kl;function Kl(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 ts(t){let e=t._readableState;A("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,le.nextTick(I_,e,t))}function I_(t,e){if(A("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)le.nextTick(A_,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function A_(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}I.from=function(t,e){return o_(I,t,e)};var rs;function Ql(){return rs===void 0&&(rs={}),rs}I.fromWeb=function(t,e){return Ql().newStreamReadableFromReadableStream(t,e)};I.toWeb=function(t,e){return Ql().newReadableStreamFromStreamReadable(t,e)};I.wrap=function(t,e){var r,n;return new I({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(i,s){Zt.destroyer(t,i),s(i)}}).wrap(t)}});var kn=v((zg,lu)=>{"use strict";var St=Qe(),{ArrayPrototypeSlice:Xl,Error:T_,FunctionPrototypeSymbolHasInstance:eu,ObjectDefineProperty:tu,ObjectDefineProperties:v_,ObjectSetPrototypeOf:ru,StringPrototypeToLowerCase:k_,Symbol:j_,SymbolHasInstance:N_}=B();lu.exports=C;C.WritableState=Pr;var{EventEmitter:P_}=Rr(),jr=yn().Stream,{Buffer:In}=pe(),vn=gt(),{addAbortSignal:O_}=Ir(),{getHighWaterMark:L_,getDefaultHighWaterMark:B_}=Ar(),{ERR_INVALID_ARG_TYPE:C_,ERR_METHOD_NOT_IMPLEMENTED:F_,ERR_MULTIPLE_CALLBACK:nu,ERR_STREAM_CANNOT_PIPE:M_,ERR_STREAM_DESTROYED:Nr,ERR_STREAM_ALREADY_FINISHED:D_,ERR_STREAM_NULL_VALUES:U_,ERR_STREAM_WRITE_AFTER_END:$_,ERR_UNKNOWN_ENCODING:iu}=Q().codes,{errorOrDestroy:Xt}=vn;ru(C.prototype,jr.prototype);ru(C,jr);function ls(){}var er=j_("kOnFinished");function Pr(t,e,r){typeof r!="boolean"&&(r=e instanceof Se()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?L_(this,t,"writableHighWaterMark",r):B_(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let n=!!(t&&t.decodeStrings===!1);this.decodeStrings=!n,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=W_.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Tn(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[er]=[]}function Tn(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Pr.prototype.getBuffer=function(){return Xl(this.buffered,this.bufferedIndex)};tu(Pr.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function C(t){let e=this instanceof Se();if(!e&&!eu(C,this))return new C(t);this._writableState=new Pr(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&&O_(t.signal,this)),jr.call(this,t),vn.construct(this,()=>{let r=this._writableState;r.writing||fs(this,r),cs(this,r)})}tu(C,N_,{__proto__:null,value:function(t){return eu(this,t)?!0:this!==C?!1:t&&t._writableState instanceof Pr}});C.prototype.pipe=function(){Xt(this,new M_)};function su(t,e,r,n){let i=t._writableState;if(typeof r=="function")n=r,r=i.defaultEncoding;else{if(!r)r=i.defaultEncoding;else if(r!=="buffer"&&!In.isEncoding(r))throw new iu(r);typeof n!="function"&&(n=ls)}if(e===null)throw new U_;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=In.from(e,r),r="buffer");else if(e instanceof In)r="buffer";else if(jr._isUint8Array(e))e=jr._uint8ArrayToBuffer(e),r="buffer";else throw new C_("chunk",["string","Buffer","Uint8Array"],e);let s;return i.ending?s=new $_:i.destroyed&&(s=new Nr("write")),s?(St.nextTick(n,s),Xt(t,s,!0),s):(i.pendingcb++,q_(t,i,e,r,n))}C.prototype.write=function(t,e,r){return su(this,t,e,r)===!0};C.prototype.cork=function(){this._writableState.corked++};C.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||fs(this,t))};C.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=k_(e)),!In.isEncoding(e))throw new iu(e);return this._writableState.defaultEncoding=e,this};function q_(t,e,r,n,i){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:n,callback:i}),e.allBuffers&&n!=="buffer"&&(e.allBuffers=!1),e.allNoop&&i!==ls&&(e.allNoop=!1)):(e.writelen=s,e.writecb=i,e.writing=!0,e.sync=!0,t._write(r,n,e.onwrite),e.sync=!1),o&&!e.errored&&!e.destroyed}function Yl(t,e,r,n,i,s,o){e.writelen=n,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Nr("write")):r?t._writev(i,e.onwrite):t._write(i,s,e.onwrite),e.sync=!1}function Zl(t,e,r,n){--e.pendingcb,n(r),us(e),Xt(t,r)}function W_(t,e){let r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function"){Xt(t,new nu);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),n?St.nextTick(Zl,t,r,e,i):Zl(t,r,e,i)):(r.buffered.length>r.bufferedIndex&&fs(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},St.nextTick(z_,r.afterWriteTickInfo)):ou(t,r,1,i))}function z_({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,ou(t,e,r,n)}function ou(t,e,r,n){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,n();e.destroyed&&us(e),cs(t,e)}function us(t){if(t.writing)return;for(let i=t.bufferedIndex;i<t.buffered.length;++i){var e;let{chunk:s,callback:o}=t.buffered[i],a=t.objectMode?1:s.length;t.length-=a,o((e=t.errored)!==null&&e!==void 0?e:new Nr("write"))}let r=t[er].splice(0);for(let i=0;i<r.length;i++){var n;r[i]((n=t.errored)!==null&&n!==void 0?n:new Nr("end"))}Tn(t)}function fs(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:n,objectMode:i}=e,s=r.length-n;if(!s)return;let o=n;if(e.bufferProcessing=!0,s>1&&t._writev){e.pendingcb-=s-1;let a=e.allNoop?ls:u=>{for(let f=o;f<r.length;++f)r[f].callback(u)},l=e.allNoop&&o===0?r:Xl(r,o);l.allBuffers=e.allBuffers,Yl(t,e,!0,e.length,l,"",a),Tn(e)}else{do{let{chunk:a,encoding:l,callback:u}=r[o];r[o++]=null;let f=i?1:a.length;Yl(t,e,!1,f,a,l,u)}while(o<r.length&&!e.writing);o===r.length?Tn(e):o>256?(r.splice(0,o),e.bufferedIndex=0):e.bufferedIndex=o}e.bufferProcessing=!1}C.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new F_("_write()")};C.prototype._writev=null;C.prototype.end=function(t,e,r){let n=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let i;if(t!=null){let s=su(this,t,e);s instanceof T_&&(i=s)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,cs(this,n,!0),n.ended=!0):n.finished?i=new D_("end"):n.destroyed&&(i=new Nr("end"))),typeof r=="function"&&(i||n.finished?St.nextTick(r,i):n[er].push(r)),this};function An(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 G_(t,e){let r=!1;function n(i){if(r){Xt(t,i??nu());return}if(r=!0,e.pendingcb--,i){let s=e[er].splice(0);for(let o=0;o<s.length;o++)s[o](i);Xt(t,i,e.sync)}else An(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,St.nextTick(as,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(i){n(i)}e.sync=!1}function H_(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,G_(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function cs(t,e,r){An(e)&&(H_(t,e),e.pendingcb===0&&(r?(e.pendingcb++,St.nextTick((n,i)=>{An(i)?as(n,i):i.pendingcb--},t,e)):An(e)&&(e.pendingcb++,as(t,e))))}function as(t,e){e.pendingcb--,e.finished=!0;let r=e[er].splice(0);for(let n=0;n<r.length;n++)r[n]();if(t.emit("finish"),e.autoDestroy){let n=t._readableState;(!n||n.autoDestroy&&(n.endEmitted||n.readable===!1))&&t.destroy()}}v_(C.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var V_=vn.destroy;C.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[er].length)&&St.nextTick(us,r),V_.call(this,t,e),this};C.prototype._undestroy=vn.undestroy;C.prototype._destroy=function(t,e){e(t)};C.prototype[P_.captureRejectionSymbol]=function(t){this.destroy(t)};var os;function au(){return os===void 0&&(os={}),os}C.fromWeb=function(t,e){return au().newStreamWritableFromWritableStream(t,e)};C.toWeb=function(t){return au().newWritableStreamFromStreamWritable(t)}});var Eu=v((Gg,Su)=>{var ds=Qe(),K_=pe(),{isReadable:Q_,isWritable:J_,isIterable:uu,isNodeStream:Y_,isReadableNodeStream:fu,isWritableNodeStream:cu,isDuplexNodeStream:Z_,isReadableStream:du,isWritableStream:hu}=ge(),pu=Be(),{AbortError:wu,codes:{ERR_INVALID_ARG_TYPE:X_,ERR_INVALID_RETURN_VALUE:_u}}=Q(),{destroyer:rr}=gt(),ey=Se(),xu=kr(),ty=kn(),{createDeferredPromise:yu}=Y(),bu=Yi(),mu=globalThis.Blob||K_.Blob,ry=typeof mu<"u"?function(e){return e instanceof mu}:function(e){return!1},ny=globalThis.AbortController||zt().AbortController,{FunctionPrototypeCall:gu}=B(),Ze=class extends ey{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};Su.exports=function t(e,r){if(Z_(e))return e;if(fu(e))return tr({readable:e});if(cu(e))return tr({writable:e});if(Y_(e))return tr({writable:!1,readable:!1});if(du(e))return tr({readable:xu.fromWeb(e)});if(hu(e))return tr({writable:ty.fromWeb(e)});if(typeof e=="function"){let{value:i,write:s,final:o,destroy:a}=iy(e);if(uu(i))return bu(Ze,i,{objectMode:!0,write:s,final:o,destroy:a});let l=i?.then;if(typeof l=="function"){let u,f=gu(l,i,c=>{if(c!=null)throw new _u("nully","body",c)},c=>{rr(u,c)});return u=new Ze({objectMode:!0,readable:!1,write:s,final(c){o(async()=>{try{await f,ds.nextTick(c,null)}catch(d){ds.nextTick(c,d)}})},destroy:a})}throw new _u("Iterable, AsyncIterable or AsyncFunction",r,i)}if(ry(e))return t(e.arrayBuffer());if(uu(e))return bu(Ze,e,{objectMode:!0,writable:!1});if(du(e?.readable)&&hu(e?.writable))return Ze.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?fu(e?.readable)?e?.readable:t(e.readable):void 0,s=e!=null&&e.writable?cu(e?.writable)?e?.writable:t(e.writable):void 0;return tr({readable:i,writable:s})}let n=e?.then;if(typeof n=="function"){let i;return gu(n,e,s=>{s!=null&&i.push(s),i.push(null)},s=>{rr(i,s)}),i=new Ze({objectMode:!0,writable:!1,read(){}})}throw new X_(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function iy(t){let{promise:e,resolve:r}=yu(),n=new ny,i=n.signal;return{value:t((async function*(){for(;;){let o=e;e=null;let{chunk:a,done:l,cb:u}=await o;if(ds.nextTick(u),l)return;if(i.aborted)throw new wu(void 0,{cause:i.reason});({promise:e,resolve:r}=yu()),yield a}})(),{signal:i}),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){n.abort(),a(o)}}}function tr(t){let e=t.readable&&typeof t.readable.read!="function"?xu.wrap(t.readable):t.readable,r=t.writable,n=!!Q_(e),i=!!J_(r),s,o,a,l,u;function f(c){let d=l;l=null,d?d(c):c&&u.destroy(c)}return u=new Ze({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(pu(r,c=>{i=!1,c&&rr(e,c),f(c)}),u._write=function(c,d,h){r.write(c,d)?h():s=h},u._final=function(c){r.end(),o=c},r.on("drain",function(){if(s){let c=s;s=null,c()}}),r.on("finish",function(){if(o){let c=o;o=null,c()}})),n&&(pu(e,c=>{n=!1,c&&rr(e,c),f(c)}),e.on("readable",function(){if(a){let c=a;a=null,c()}}),e.on("end",function(){u.push(null)}),u._read=function(){for(;;){let c=e.read();if(c===null){a=u._read;return}if(!u.push(c))return}}),u._destroy=function(c,d){!c&&l!==null&&(c=new wu),a=null,s=null,o=null,l===null?d(c):(l=d,rr(r,c),rr(e,c))},u}});var Se=v((Hg,Au)=>{"use strict";var{ObjectDefineProperties:sy,ObjectGetOwnPropertyDescriptor:Ce,ObjectKeys:oy,ObjectSetPrototypeOf:Ru}=B();Au.exports=ue;var _s=kr(),se=kn();Ru(ue.prototype,_s.prototype);Ru(ue,_s);{let t=oy(se.prototype);for(let e=0;e<t.length;e++){let r=t[e];ue.prototype[r]||(ue.prototype[r]=se.prototype[r])}}function ue(t){if(!(this instanceof ue))return new ue(t);_s.call(this,t),se.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}sy(ue.prototype,{writable:{__proto__:null,...Ce(se.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Ce(se.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Ce(se.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Ce(se.prototype,"writableBuffer")},writableLength:{__proto__:null,...Ce(se.prototype,"writableLength")},writableFinished:{__proto__:null,...Ce(se.prototype,"writableFinished")},writableCorked:{__proto__:null,...Ce(se.prototype,"writableCorked")},writableEnded:{__proto__:null,...Ce(se.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Ce(se.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 hs;function Iu(){return hs===void 0&&(hs={}),hs}ue.fromWeb=function(t,e){return Iu().newStreamDuplexFromReadableWritablePair(t,e)};ue.toWeb=function(t){return Iu().newReadableWritablePairFromDuplex(t)};var ps;ue.from=function(t){return ps||(ps=Eu()),ps(t,"body")}});var ms=v((Vg,vu)=>{"use strict";var{ObjectSetPrototypeOf:Tu,Symbol:ay}=B();vu.exports=Fe;var{ERR_METHOD_NOT_IMPLEMENTED:ly}=Q().codes,bs=Se(),{getHighWaterMark:uy}=Ar();Tu(Fe.prototype,bs.prototype);Tu(Fe,bs);var Or=ay("kCallback");function Fe(t){if(!(this instanceof Fe))return new Fe(t);let e=t?uy(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),bs.call(this,t),this._readableState.sync=!1,this[Or]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",fy)}function ys(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 fy(){this._final!==ys&&ys.call(this)}Fe.prototype._final=ys;Fe.prototype._transform=function(t,e,r){throw new ly("_transform()")};Fe.prototype._write=function(t,e,r){let n=this._readableState,i=this._writableState,s=n.length;this._transform(t,e,(o,a)=>{if(o){r(o);return}a!=null&&this.push(a),i.ended||s===n.length||n.length<n.highWaterMark?r():this[Or]=r})};Fe.prototype._read=function(){if(this[Or]){let t=this[Or];this[Or]=null,t()}}});var ws=v((Kg,ju)=>{"use strict";var{ObjectSetPrototypeOf:ku}=B();ju.exports=nr;var gs=ms();ku(nr.prototype,gs.prototype);ku(nr,gs);function nr(t){if(!(this instanceof nr))return new nr(t);gs.call(this,t)}nr.prototype._transform=function(t,e,r){r(null,t)}});var On=v((Qg,Bu)=>{var Lr=Qe(),{ArrayIsArray:cy,Promise:dy,SymbolAsyncIterator:hy,SymbolDispose:py}=B(),Pn=Be(),{once:_y}=Y(),yy=gt(),Nu=Se(),{aggregateTwoErrors:by,codes:{ERR_INVALID_ARG_TYPE:ks,ERR_INVALID_RETURN_VALUE:xs,ERR_MISSING_ARGS:my,ERR_STREAM_DESTROYED:gy,ERR_STREAM_PREMATURE_CLOSE:wy},AbortError:xy}=Q(),{validateFunction:Sy,validateAbortSignal:Ey}=Vt(),{isIterable:Et,isReadable:Ss,isReadableNodeStream:Nn,isNodeStream:Pu,isTransformStream:ir,isWebStream:Ry,isReadableStream:Es,isReadableFinished:Iy}=ge(),Ay=globalThis.AbortController||zt().AbortController,Rs,Is,As;function Ou(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=Pn(t,{readable:e,writable:r},s=>{n=!s});return{destroy:s=>{n||(n=!0,yy.destroyer(t,s||new gy("pipe")))},cleanup:i}}function Ty(t){return Sy(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function Ts(t){if(Et(t))return t;if(Nn(t))return vy(t);throw new ks("val",["Readable","Iterable","AsyncIterable"],t)}async function*vy(t){Is||(Is=kr()),yield*Is.prototype[hy].call(t)}async function jn(t,e,r,{end:n}){let i,s=null,o=u=>{if(u&&(i=u),s){let f=s;s=null,f()}},a=()=>new dy((u,f)=>{i?f(i):s=()=>{i?f(i):u()}});e.on("drain",o);let l=Pn(e,{readable:!1},o);try{e.writableNeedDrain&&await a();for await(let u of t)e.write(u)||await a();n&&(e.end(),await a()),r()}catch(u){r(i!==u?by(i,u):u)}finally{l(),e.off("drain",o)}}async function vs(t,e,r,{end:n}){ir(e)&&(e=e.writable);let i=e.getWriter();try{for await(let s of t)await i.ready,i.write(s).catch(()=>{});await i.ready,n&&await i.close(),r()}catch(s){try{await i.abort(s),r(s)}catch(o){r(o)}}}function ky(...t){return Lu(t,_y(Ty(t)))}function Lu(t,e,r){if(t.length===1&&cy(t[0])&&(t=t[0]),t.length<2)throw new my("streams");let n=new Ay,i=n.signal,s=r?.signal,o=[];Ey(s,"options.signal");function a(){y(new xy)}As=As||Y().addAbortListener;let l;s&&(l=As(s,a));let u,f,c=[],d=0;function h(S){y(S,--d===0)}function y(S,w){var T;if(S&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=S),!(!u&&!w)){for(;c.length;)c.shift()(u);(T=l)===null||T===void 0||T[py](),n.abort(),w&&(u||o.forEach(Ae=>Ae()),Lr.nextTick(e,u,f))}}let _;for(let S=0;S<t.length;S++){let w=t[S],T=S<t.length-1,Ae=S>0,U=T||r?.end!==!1,Tt=S===t.length-1;if(Pu(w)){let Z=function(Te){Te&&Te.name!=="AbortError"&&Te.code!=="ERR_STREAM_PREMATURE_CLOSE"&&h(Te)};var g=Z;if(U){let{destroy:Te,cleanup:zn}=Ou(w,T,Ae);c.push(Te),Ss(w)&&Tt&&o.push(zn)}w.on("error",Z),Ss(w)&&Tt&&o.push(()=>{w.removeListener("error",Z)})}if(S===0)if(typeof w=="function"){if(_=w({signal:i}),!Et(_))throw new xs("Iterable, AsyncIterable or Stream","source",_)}else Et(w)||Nn(w)||ir(w)?_=w:_=Nu.from(w);else if(typeof w=="function"){if(ir(_)){var x;_=Ts((x=_)===null||x===void 0?void 0:x.readable)}else _=Ts(_);if(_=w(_,{signal:i}),T){if(!Et(_,!0))throw new xs("AsyncIterable",`transform[${S-1}]`,_)}else{var b;Rs||(Rs=ws());let Z=new Rs({objectMode:!0}),Te=(b=_)===null||b===void 0?void 0:b.then;if(typeof Te=="function")d++,Te.call(_,Ue=>{f=Ue,Ue!=null&&Z.write(Ue),U&&Z.end(),Lr.nextTick(h)},Ue=>{Z.destroy(Ue),Lr.nextTick(h,Ue)});else if(Et(_,!0))d++,jn(_,Z,h,{end:U});else if(Es(_)||ir(_)){let Ue=_.readable||_;d++,jn(Ue,Z,h,{end:U})}else throw new xs("AsyncIterable or Promise","destination",_);_=Z;let{destroy:zn,cleanup:Sf}=Ou(_,!1,!0);c.push(zn),Tt&&o.push(Sf)}}else if(Pu(w)){if(Nn(_)){d+=2;let Z=jy(_,w,h,{end:U});Ss(w)&&Tt&&o.push(Z)}else if(ir(_)||Es(_)){let Z=_.readable||_;d++,jn(Z,w,h,{end:U})}else if(Et(_))d++,jn(_,w,h,{end:U});else throw new ks("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);_=w}else if(Ry(w)){if(Nn(_))d++,vs(Ts(_),w,h,{end:U});else if(Es(_)||Et(_))d++,vs(_,w,h,{end:U});else if(ir(_))d++,vs(_.readable,w,h,{end:U});else throw new ks("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);_=w}else _=Nu.from(w)}return(i!=null&&i.aborted||s!=null&&s.aborted)&&Lr.nextTick(a),_}function jy(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new wy)}),t.pipe(e,{end:!1}),n){let o=function(){i=!0,e.end()};var s=o;Iy(t)?Lr.nextTick(o):t.once("end",o)}else r();return Pn(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)}),Pn(e,{readable:!1,writable:!0},r)}Bu.exports={pipelineImpl:Lu,pipeline:ky}});var Ns=v((Jg,$u)=>{"use strict";var{pipeline:Ny}=On(),Ln=Se(),{destroyer:Py}=gt(),{isNodeStream:Bn,isReadable:Cu,isWritable:Fu,isWebStream:js,isTransformStream:Rt,isWritableStream:Mu,isReadableStream:Du}=ge(),{AbortError:Oy,codes:{ERR_INVALID_ARG_VALUE:Uu,ERR_MISSING_ARGS:Ly}}=Q(),By=Be();$u.exports=function(...e){if(e.length===0)throw new Ly("streams");if(e.length===1)return Ln.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=Ln.from(e[0])),typeof e[e.length-1]=="function"){let h=e.length-1;e[h]=Ln.from(e[h])}for(let h=0;h<e.length;++h)if(!(!Bn(e[h])&&!js(e[h]))){if(h<e.length-1&&!(Cu(e[h])||Du(e[h])||Rt(e[h])))throw new Uu(`streams[${h}]`,r[h],"must be readable");if(h>0&&!(Fu(e[h])||Mu(e[h])||Rt(e[h])))throw new Uu(`streams[${h}]`,r[h],"must be writable")}let n,i,s,o,a;function l(h){let y=o;o=null,y?y(h):h?a.destroy(h):!d&&!c&&a.destroy()}let u=e[0],f=Ny(e,l),c=!!(Fu(u)||Mu(u)||Rt(u)),d=!!(Cu(f)||Du(f)||Rt(f));if(a=new Ln({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(f!=null&&f.readableObjectMode),writable:c,readable:d}),c){if(Bn(u))a._write=function(y,_,x){u.write(y,_)?x():n=x},a._final=function(y){u.end(),i=y},u.on("drain",function(){if(n){let y=n;n=null,y()}});else if(js(u)){let _=(Rt(u)?u.writable:u).getWriter();a._write=async function(x,b,g){try{await _.ready,_.write(x).catch(()=>{}),g()}catch(S){g(S)}},a._final=async function(x){try{await _.ready,_.close().catch(()=>{}),i=x}catch(b){x(b)}}}let h=Rt(f)?f.readable:f;By(h,()=>{if(i){let y=i;i=null,y()}})}if(d){if(Bn(f))f.on("readable",function(){if(s){let h=s;s=null,h()}}),f.on("end",function(){a.push(null)}),a._read=function(){for(;;){let h=f.read();if(h===null){s=a._read;return}if(!a.push(h))return}};else if(js(f)){let y=(Rt(f)?f.readable:f).getReader();a._read=async function(){for(;;)try{let{value:_,done:x}=await y.read();if(!a.push(_))return;if(x){a.push(null);return}}catch{return}}}}return a._destroy=function(h,y){!h&&o!==null&&(h=new Oy),s=null,n=null,i=null,o===null?y(h):(o=y,Bn(f)&&Py(f,h))},a}});var Yu=v((Yg,Ls)=>{"use strict";var Cy=globalThis.AbortController||zt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Fy,ERR_INVALID_ARG_TYPE:Br,ERR_MISSING_ARGS:My,ERR_OUT_OF_RANGE:Dy},AbortError:Ee}=Q(),{validateAbortSignal:It,validateInteger:qu,validateObject:At}=Vt(),Uy=B().Symbol("kWeak"),$y=B().Symbol("kResistStopPropagation"),{finished:qy}=Be(),Wy=Ns(),{addAbortSignalNoValidate:zy}=Ir(),{isWritable:Gy,isNodeStream:Hy}=ge(),{deprecate:Vy}=Y(),{ArrayPrototypePush:Ky,Boolean:Qy,MathFloor:Wu,Number:Jy,NumberIsNaN:Yy,Promise:zu,PromiseReject:Gu,PromiseResolve:Zy,PromisePrototypeThen:Hu,Symbol:Ku}=B(),Cn=Ku("kEmpty"),Vu=Ku("kEof");function Xy(t,e){if(e!=null&&At(e,"options"),e?.signal!=null&&It(e.signal,"options.signal"),Hy(t)&&!Gy(t))throw new Fy("stream",t,"must be writable");let r=Wy(this,t);return e!=null&&e.signal&&zy(e.signal,r),r}function Fn(t,e){if(typeof t!="function")throw new Br("fn",["Function","AsyncFunction"],t);e!=null&&At(e,"options"),e?.signal!=null&&It(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Wu(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=Wu(e.highWaterMark)),qu(r,"options.concurrency",1),qu(n,"options.highWaterMark",0),n+=r,async function*(){let s=Y().AbortSignalAny([e?.signal].filter(Qy)),o=this,a=[],l={signal:s},u,f,c=!1,d=0;function h(){c=!0,y()}function y(){d-=1,_()}function _(){f&&!c&&d<r&&a.length<n&&(f(),f=null)}async function x(){try{for await(let b of o){if(c)return;if(s.aborted)throw new Ee;try{if(b=t(b,l),b===Cn)continue;b=Zy(b)}catch(g){b=Gu(g)}d+=1,Hu(b,y,h),a.push(b),u&&(u(),u=null),!c&&(a.length>=n||d>=r)&&await new zu(g=>{f=g})}a.push(Vu)}catch(b){let g=Gu(b);Hu(g,y,h),a.push(g)}finally{c=!0,u&&(u(),u=null)}}x();try{for(;;){for(;a.length>0;){let b=await a[0];if(b===Vu)return;if(s.aborted)throw new Ee;b!==Cn&&(yield b),a.shift(),_()}await new zu(b=>{u=b})}}finally{c=!0,f&&(f(),f=null)}}.call(this)}function eb(t=void 0){return t!=null&&At(t,"options"),t?.signal!=null&&It(t.signal,"options.signal"),async function*(){let r=0;for await(let i of this){var n;if(t!=null&&(n=t.signal)!==null&&n!==void 0&&n.aborted)throw new Ee({cause:t.signal.reason});yield[r++,i]}}.call(this)}async function Qu(t,e=void 0){for await(let r of Os.call(this,t,e))return!0;return!1}async function tb(t,e=void 0){if(typeof t!="function")throw new Br("fn",["Function","AsyncFunction"],t);return!await Qu.call(this,async(...r)=>!await t(...r),e)}async function rb(t,e){for await(let r of Os.call(this,t,e))return r}async function nb(t,e){if(typeof t!="function")throw new Br("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),Cn}for await(let n of Fn.call(this,r,e));}function Os(t,e){if(typeof t!="function")throw new Br("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:Cn}return Fn.call(this,r,e)}var Ps=class extends My{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function ib(t,e,r){var n;if(typeof t!="function")throw new Br("reducer",["Function","AsyncFunction"],t);r!=null&&At(r,"options"),r?.signal!=null&&It(r.signal,"options.signal");let i=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let u=new Ee(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await qy(this.destroy(u)),u}let s=new Cy,o=s.signal;if(r!=null&&r.signal){let u={once:!0,[Uy]:this,[$y]:!0};r.signal.addEventListener("abort",()=>s.abort(),u)}let a=!1;try{for await(let u of this){var l;if(a=!0,r!=null&&(l=r.signal)!==null&&l!==void 0&&l.aborted)throw new Ee;i?e=await t(e,u,{signal:o}):(e=u,i=!0)}if(!a&&!i)throw new Ps}finally{s.abort()}return e}async function sb(t){t!=null&&At(t,"options"),t?.signal!=null&&It(t.signal,"options.signal");let e=[];for await(let n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new Ee(void 0,{cause:t.signal.reason});Ky(e,n)}return e}function ob(t,e){let r=Fn.call(this,t,e);return async function*(){for await(let i of r)yield*i}.call(this)}function Ju(t){if(t=Jy(t),Yy(t))return 0;if(t<0)throw new Dy("number",">= 0",t);return t}function ab(t,e=void 0){return e!=null&&At(e,"options"),e?.signal!=null&&It(e.signal,"options.signal"),t=Ju(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ee;for await(let s of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Ee;t--<=0&&(yield s)}}.call(this)}function lb(t,e=void 0){return e!=null&&At(e,"options"),e?.signal!=null&&It(e.signal,"options.signal"),t=Ju(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ee;for await(let s of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Ee;if(t-- >0&&(yield s),t<=0)return}}.call(this)}Ls.exports.streamReturningOperators={asIndexedPairs:Vy(eb,"readable.asIndexedPairs will be removed in a future version."),drop:ab,filter:Os,flatMap:ob,map:Fn,take:lb,compose:Xy};Ls.exports.promiseReturningOperators={every:tb,forEach:nb,reduce:ib,toArray:sb,some:Qu,find:rb}});var Bs=v((Zg,Zu)=>{"use strict";var{ArrayPrototypePop:ub,Promise:fb}=B(),{isIterable:cb,isNodeStream:db,isWebStream:hb}=ge(),{pipelineImpl:pb}=On(),{finished:_b}=Be();Cs();function yb(...t){return new fb((e,r)=>{let n,i,s=t[t.length-1];if(s&&typeof s=="object"&&!db(s)&&!cb(s)&&!hb(s)){let o=ub(t);n=o.signal,i=o.end}pb(t,(o,a)=>{o?r(o):e(a)},{signal:n,end:i})})}Zu.exports={finished:_b,pipeline:yb}});var Cs=v((Xg,lf)=>{"use strict";var{Buffer:bb}=pe(),{ObjectDefineProperty:Me,ObjectKeys:tf,ReflectApply:rf}=B(),{promisify:{custom:nf}}=Y(),{streamReturningOperators:Xu,promiseReturningOperators:ef}=Yu(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:sf}}=Q(),mb=Ns(),{setDefaultHighWaterMark:gb,getDefaultHighWaterMark:wb}=Ar(),{pipeline:of}=On(),{destroyer:xb}=gt(),af=Be(),Fs=Bs(),Cr=ge(),L=lf.exports=yn().Stream;L.isDestroyed=Cr.isDestroyed;L.isDisturbed=Cr.isDisturbed;L.isErrored=Cr.isErrored;L.isReadable=Cr.isReadable;L.isWritable=Cr.isWritable;L.Readable=kr();for(let t of tf(Xu)){let r=function(...n){if(new.target)throw sf();return L.Readable.from(rf(e,this,n))},e=Xu[t];Me(r,"name",{__proto__:null,value:e.name}),Me(r,"length",{__proto__:null,value:e.length}),Me(L.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of tf(ef)){let r=function(...n){if(new.target)throw sf();return rf(e,this,n)},e=ef[t];Me(r,"name",{__proto__:null,value:e.name}),Me(r,"length",{__proto__:null,value:e.length}),Me(L.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}L.Writable=kn();L.Duplex=Se();L.Transform=ms();L.PassThrough=ws();L.pipeline=of;var{addAbortSignal:Sb}=Ir();L.addAbortSignal=Sb;L.finished=af;L.destroy=xb;L.compose=mb;L.setDefaultHighWaterMark=gb;L.getDefaultHighWaterMark=wb;Me(L,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Fs}});Me(of,nf,{__proto__:null,enumerable:!0,get(){return Fs.pipeline}});Me(af,nf,{__proto__:null,enumerable:!0,get(){return Fs.finished}});L.Stream=L;L._isUint8Array=function(e){return e instanceof Uint8Array};L._uint8ArrayToBuffer=function(e){return bb.from(e.buffer,e.byteOffset,e.byteLength)}});var Mn=v((ew,M)=>{"use strict";var W=Cs(),Eb=Bs(),Rb=W.Readable.destroy;M.exports=W.Readable;M.exports._uint8ArrayToBuffer=W._uint8ArrayToBuffer;M.exports._isUint8Array=W._isUint8Array;M.exports.isDisturbed=W.isDisturbed;M.exports.isErrored=W.isErrored;M.exports.isReadable=W.isReadable;M.exports.Readable=W.Readable;M.exports.Writable=W.Writable;M.exports.Duplex=W.Duplex;M.exports.Transform=W.Transform;M.exports.PassThrough=W.PassThrough;M.exports.addAbortSignal=W.addAbortSignal;M.exports.finished=W.finished;M.exports.destroy=W.destroy;M.exports.destroy=Rb;M.exports.pipeline=W.pipeline;M.exports.compose=W.compose;Object.defineProperty(W,"promises",{configurable:!0,enumerable:!0,get(){return Eb}});M.exports.Stream=W.Stream;M.exports.default=M.exports});var R=class t{#e;constructor(e){this.#e=t.collapse(e)}get value(){return this.#e}toString(){return this.#e}get length(){return this.#e.length}static collapse(e,r=""){if(e instanceof t)return e.value;if(typeof e!="string")throw new TypeError("path argument must be a string or an instance of Path");if(r&&!(r instanceof t)&&(r=new t(r)),e=e.trim(),e.length===0)return r.value;t.isRelative(e)&&(e=r+e);let n=t.reduce(e,(s,o)=>(o==".."?s.pop():o!=="."&&s.push(o),s),[]),i="/";return n.length&&(i+=n.join("/"),t.isFolder(e)&&(i+="/")),""+i}static isAbsolute(e){return e instanceof t?!0:e.length&&e[0]==="/"}static isRelative(e){return!t.isAbsolute(e)}static isFolder(e){return e instanceof t&&(e=e.value),e.length&&e[e.length-1]=="/"}static isPath(e){return e instanceof t?!0:typeof e!="string"?!1:(e=e.trim(),new URL(e,document.location).pathname==e)}static reduce(e,r,n){return e instanceof t&&(e=e.value),e.split("/").filter(Boolean).reduce(r,n)}static map(e,r){return e instanceof t&&(e=e.value),e.split("/").filter(Boolean).map(r)}static parent(e){e instanceof t&&(e=e.value),e=e.split("/").filter(Boolean),e.pop();let r="/";return e.length&&(r+=e.join("/")+"/"),r}static filename(e){return e instanceof t&&(e=e.value),e.split("/").filter(Boolean).pop()}static head(e){return e instanceof t&&(e=e.value),e.split("/").filter(Boolean).shift()}static tail(e){e instanceof t&&(e=e.value),e=e.split("/").filter(Boolean),e.shift();let r="/";return e.length&&(r+=e.join("/")+"/"),r}};var ar=class t{#e;#t="/";constructor(e){this.#e=e,this.#t=this.#e.path}get path(){return this.#t}cd(e){return e instanceof R||(e=new R(R.collapse(e,this.#t))),new t(this.#e.cd(e))}async read(e,r=null){if(e instanceof R||(e=new R(R.collapse(e,this.#t))),typeof r=="function"){if(!this.#e.supportsStreamingRead())throw new Error("Adapter "+this.#e.name+" does not support streaming reading.");return this.#e.readStream(e,r)}else return this.#e.read(e)}async write(e,r,n=null){if(e instanceof R||(e=new R(R.collapse(e,this.#t))),!this.#e.supportsWrite())throw new Error("Adapter "+this.#e.name+" is read only.");if(typeof r=="function"){if(!this.#e.supportsStreamingWrite())throw new Error("Adapter "+this.#e.name+" does not support streaming writing.");return this.#e.writeStream(e,r,n)}else{if(typeof r=="string")return this.#e.write(e,r,n);throw new TypeError("Cannot write contents of type "+typeof r)}}async delete(e){return e instanceof R||(e=new R(R.collapse(e,this.#t))),this.#e.delete(e)}async exists(e){return e instanceof R||(e=new R(R.collapse(e,this.#t))),this.#e.exists(e)}async list(e=""){return e instanceof R||(e=new R(R.collapse(e,this.#t))),this.#e.list(e)}};var jt={};vt(jt,{Client:()=>oe,client:()=>re,deepClone:()=>$e,formdata:()=>Vs,metroError:()=>V,request:()=>nt,response:()=>kt,trace:()=>jf,url:()=>z});var rt="https://metro.muze.nl/details/";Symbol.metroProxy||(Symbol.metroProxy=Symbol("isProxy"));Symbol.metroSource||(Symbol.metroSource=Symbol("source"));var oe=class t{clientOptions={url:z(typeof window<"u"?window.location:"https://localhost"),verbs:["get","post","put","delete","patch","head","options","query"]};static tracers={};constructor(...e){for(let r of e)if(typeof r=="string"||r instanceof String)this.clientOptions.url=z(this.clientOptions.url.href,r);else if(r instanceof t)Object.assign(this.clientOptions,r.clientOptions);else if(r instanceof Function)this.#e([r]);else if(r&&typeof r=="object")for(let n in r)n=="middlewares"?this.#e(r[n]):n=="url"?this.clientOptions.url=z(this.clientOptions.url.href,r[n]):typeof r[n]=="function"?this.clientOptions[n]=r[n](this.clientOptions[n],this.clientOptions):this.clientOptions[n]=r[n];for(let r of this.clientOptions.verbs)this[r]=async function(...n){return this.fetch(nt(this.clientOptions,...n,{method:r.toUpperCase()}))}}#e(e){typeof e=="function"&&(e=[e]);let r=e.findIndex(n=>typeof n!="function");if(r>=0)throw V("metro.client: middlewares must be a function or an array of functions "+rt+"client/invalid-middlewares/",e[r]);Array.isArray(this.clientOptions.middlewares)||(this.clientOptions.middlewares=[]),this.clientOptions.middlewares=this.clientOptions.middlewares.concat(e)}fetch(e,r){if(e=nt(e,r),!e.url)throw V("metro.client."+e.method.toLowerCase()+": Missing url parameter "+rt+"client/fetch-missing-url/",e);if(r||(r={}),typeof r!="object"||r instanceof String)throw V("metro.client.fetch: Invalid options parameter "+rt+"client/fetch-invalid-options/",r);let i=[async function(a){a[Symbol.metroProxy]&&(a=a[Symbol.metroSource]);let l=await fetch(a);return kt(l)}].concat(this.clientOptions?.middlewares?.slice()||[]);r=Object.assign({},this.clientOptions,r);let s;for(let o of i)s=(function(a,l){return async function(u){let f,c=Object.values(t.tracers);for(let d of c)d.request&&d.request.call(d,u,l);f=await l(u,a);for(let d of c)d.response&&d.response.call(d,f,l);return f}})(s,o);return s(e)}with(...e){return new t($e(this.clientOptions),...e)}get location(){return this.clientOptions.url}};function re(...t){return new oe(...$e(t))}function kf(t,e){let r=e||{};!r.url&&e.url&&(r.url=e.url);for(let n of["method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal","priority","url"]){let i=t[n];if(!(typeof i>"u"||i==null))if(i?.[Symbol.metroProxy]&&(i=i[Symbol.metroSource]),typeof i=="function")r[n]=i(r[n],r);else if(n=="url")r.url=z(r.url,i);else if(n=="headers"){r.headers=new Headers(e.headers),i instanceof Headers||(i=new Headers(t.headers));for(let[s,o]of i.entries())r.headers.set(s,o)}else r[n]=i}return t instanceof Request&&t.data&&(r.body=t.data),r}function nt(...t){let e={url:z(typeof window<"u"?window.location:"https://localhost/"),duplex:"half"};for(let i of t)typeof i=="string"||i instanceof URL||i instanceof URLSearchParams?e.url=z(e.url,i):i&&(i instanceof FormData||i instanceof ReadableStream||i instanceof Blob||i instanceof ArrayBuffer||i instanceof DataView)?e.body=i:i&&typeof i=="object"&&Object.assign(e,kf(i,e));let r=new Request(e.url,e),n=e.body;return n&&typeof n=="object"&&!(n instanceof String)&&!(n instanceof ReadableStream)&&!(n instanceof Blob)&&!(n instanceof ArrayBuffer)&&!(n instanceof DataView)&&!(n instanceof FormData)&&!(n instanceof URLSearchParams)&&(typeof globalThis.TypedArray>"u"||!(n instanceof globalThis.TypedArray))&&typeof n.toString=="function"&&(e.body=n.toString({headers:r.headers}),r=new Request(e.url,e)),Object.freeze(r),new Proxy(r,{get(i,s){let o;switch(s){case Symbol.metroSource:o=i;break;case Symbol.metroProxy:o=!0;break;case"with":o=function(...a){return n&&a.unshift({body:n}),nt(i,...a)};break;case"data":o=n;break;default:i[s]instanceof Function?o=i[s].bind(i):o=i[s];break}return o}})}function Gs(t,e){let r=e||{};!r.url&&e.url&&(r.url=e.url);for(let n of["status","statusText","headers","body","url","type","redirected"]){let i=t[n];typeof i>"u"||i==null||(i?.[Symbol.metroProxy]&&(i=i[Symbol.metroSource]),typeof i=="function"?r[n]=i(r[n],r):n=="url"?r.url=new URL(i,r.url||"https://localhost/"):r[n]=i)}return t instanceof Response&&t.data&&(r.body=t.data),r}function kt(...t){let e={};for(let i of t)typeof i=="string"?e.body=i:i instanceof Response?Object.assign(e,Gs(i,e)):i&&typeof i=="object"&&(i instanceof FormData||i instanceof Blob||i instanceof ArrayBuffer||i instanceof DataView||i instanceof ReadableStream||i instanceof URLSearchParams||i instanceof String||typeof globalThis.TypedArray<"u"&&i instanceof globalThis.TypedArray?e.body=i:Object.assign(e,Gs(i,e)));let r;e.body&&(r=e.body),[101,204,205,304].includes(e.status)&&(e.body=null);let n=new Response(e.body,e);return Object.freeze(n),new Proxy(n,{get(i,s){let o;switch(s){case Symbol.metroProxy:o=!0;break;case Symbol.metroSource:o=i;break;case"with":o=function(...a){return kt(i,...a)};break;case"data":o=r;break;case"ok":o=i.status>=200&&i.status<400;break;default:typeof i[s]=="function"?o=i[s].bind(i):o=i[s];break}return o}})}function Hs(t,e){typeof e=="function"?e(t.searchParams,t):(e=new URLSearchParams(e),e.forEach((r,n)=>{t.searchParams.append(n,r)}))}function z(...t){let e=["hash","host","hostname","href","password","pathname","port","protocol","username","search","searchParams"],r=new URL("https://localhost/");for(let n of t)if(typeof n=="string"||n instanceof String)r=new URL(n,r);else if(n instanceof URL||typeof Location<"u"&&n instanceof Location)r=new URL(n);else if(n instanceof URLSearchParams)Hs(r,n);else if(n&&typeof n=="object")for(let i in n)switch(i){case"search":typeof n.search=="function"?n.search(r.search,r):r.search=new URLSearchParams(n.search);break;case"searchParams":Hs(r,n.searchParams);break;default:if(!e.includes(i))throw V("metro.url: unknown url parameter "+rt+"url/unknown-param-name/",i);if(typeof n[i]=="function")n[i](r[i],r);else if(typeof n[i]=="string"||n[i]instanceof String||typeof n[i]=="number"||n[i]instanceof Number||typeof n[i]=="boolean"||n[i]instanceof Boolean)r[i]=""+n[i];else if(typeof n[i]=="object"&&n[i].toString)r[i]=n[i].toString();else throw V("metro.url: unsupported value for "+i+" "+rt+"url/unsupported-param-value/",t[i]);break}else throw V("metro.url: unsupported option value "+rt+"url/unsupported-option-value/",n);return Object.freeze(r),new Proxy(r,{get(n,i){let s;switch(i){case Symbol.metroProxy:s=!0;break;case Symbol.metroSource:s=n;break;case"with":s=function(...o){return z(n,...o)};break;case"filename":s=n.pathname.split("/").pop();break;case"folderpath":s=n.pathname.substring(0,n.pathname.lastIndexOf("\\")+1);break;case"authority":s=n.username??"",s+=n.password?":"+n.password:"",s+=s?"@":"",s+=n.hostname,s+=n.port?":"+n.port:"",s+="/",s=n.protocol+"//"+s;break;case"origin":s=n.protocol+"//"+n.hostname,s+=n.port?":"+n.port:"",s+="/";break;case"fragment":s=n.hash.substring(1);break;case"scheme":n.protocol?s=n.protocol.substring(0,n.protocol.length-1):s="";break;default:n[i]instanceof Function?s=n[i].bind(n):s=n[i];break}return s}})}function Vs(...t){var e=new FormData;for(let r of t)if(r instanceof HTMLFormElement&&(r=new FormData(r)),r instanceof FormData)for(let n of r.entries())e.append(n[0],n[1]);else if(r&&typeof r=="object")for(let n of Object.entries(r))if(Array.isArray(n[1]))for(let i of n[1])e.append(n[0],i);else e.append(n[0],n[1]);else throw new V("metro.formdata: unknown option type "+rt+"formdata/unknown-option-value/",r);return Object.freeze(e),new Proxy(e,{get(r,n){let i;switch(n){case Symbol.metroProxy:i=!0;break;case Symbol.metroSource:i=r;break;case"with":i=function(...s){return Vs(r,...s)};break;default:r[n]instanceof Function?i=r[n].bind(r):i=r[n];break}return i}})}var lr={error:(t,...e)=>{console.error("\u24C2\uFE0F ",t,...e)},info:(t,...e)=>{console.info("\u24C2\uFE0F ",t,...e)},group:t=>{console.group("\u24C2\uFE0F "+t)},groupEnd:t=>{console.groupEnd("\u24C2\uFE0F "+t)}};function V(t,...e){return lr.error(t,...e),new Error(t,...e)}var jf={add(t,e){oe.tracers[t]=e},delete(t){delete oe.tracers[t]},clear(){oe.tracers={}},group(){let t=0;return{request:(e,r)=>{t++,lr.group(t),lr.info(e?.url,e,r)},response:(e,r)=>{lr.info(e?.body?e.body[Symbol.metroSource]:null,e,r),lr.groupEnd(t),t--}}}};function $e(t){if(Array.isArray(t))return t.slice().map($e);if(t&&typeof t=="object")if(t.__proto__.constructor==Object||!t.__proto__){let e=Object.assign({},t);return Object.keys(e).forEach(r=>{e[r]=$e(t[r])}),e}else return t;return t}var it=class{#e;#t;constructor(e,r="/"){this.#e=re(e),this.#t=new R(r)}get name(){return"HttpAdapter"}get path(){return this.#t}supportsWrite(){return!0}supportsStreamingWrite(){return Nf}supportsStreamingRead(){return!0}cd(e){if(!R.isPath(e))throw new TypeError(e+" is not a valid path");return R.isRelative(e)&&(e=R.collapse(e,this.#t)),new this.constructor(this.#e,e)}async write(e,r,n=null){return this.#e.put({body:r})}writeStream(e,r,n=null){throw new Error("Not yet implemented")}async read(e){let r=await this.#e.get(e),n={type:this.getMimetype(r),name:R.filename(e),http:{headers:r.headers,status:r.status,url:r.url}};return n.type.match(/text\/.*/)?n.contents=await r.text():n.type.match(/application\/json.*/)?n.contents=await r.json():n.contents=await r.blob(),n}readStream(e,r){throw new Error("Not yet implemented")}async exists(e){return this.#e.head(e)}async delete(e){return this.#e.delete(e)}async list(e){let r=["text/html","text/xhtml","text/xhtml+xml","text/xml"],n=await this.read(e);if(r.includes(n.type.split(";")[0]))var i=n.contents;else{let u=this.getUrl(e);throw new TypeError("URL "+u+" is not of a supported content type",{cause:n})}let s=z(this.#e.clientOptions.url).pathname,o=this.getUrl(e),a=document.createElement("template");a.innerHTML=i;let l=a.content.querySelectorAll("a[href]");return Array.from(l).map(u=>{let f=new URL(u.getAttribute("href"),o.href);return u.href=f.href,{filename:R.filename(u.pathname),path:u.pathname,name:u.innerText,href:u.href}}).filter(u=>{let f=new URL(u.href);return f.pathname=R.parent(f.pathname),f.href===o.href}).map(u=>({filename:u.filename,path:u.path.substring(s.length-1),name:u.name}))}getUrl(e){let r=z(this.#e.clientOptions.url).pathname;return e=R.collapse(r+R.collapse(e)),new URL(e,this.#e.clientOptions.url)}getMimetype(e){return e.headers.has("Content-Type")?e.headers.get("Content-Type"):null}},Nf=(async()=>new Request("",{body:new ReadableStream,method:"POST",duplex:"half"}).headers.has("Content-Type")?!1:fetch("data:a/a;charset=utf-8,",{method:"POST",body:new ReadableStream,duplex:"half"}).then(()=>!0,()=>!1))();var Pf={fs:ar,adapters:{https:it},path:R};globalThis.jsfs=Pf;function fe(t){return t=Object.assign({contentType:"application/json",reviver:null,replacer:null,space:""},t),async function(r,n){if(r.headers.get("Accept")||(r=r.with({headers:{Accept:t.accept??t.contentType}})),r.method!=="GET"&&r.method!=="HEAD"&&r.data&&typeof r.data=="object"&&!(r.data instanceof ReadableStream)){let s=r.headers.get("Content-Type");(!s||Lf(s))&&(r=r.with({headers:{"Content-Type":t.contentType}})),Ks(r.headers.get("Content-Type"))&&(r=r.with({body:JSON.stringify(r.data,t.replacer,t.space)}))}let i=await n(r);if(i&&Ks(i.headers?.get("Content-Type"))){let o=await i.clone().text();try{let a=JSON.parse(o,t.reviver);return i.with({body:a})}catch{}}return i}}var Of=/^application\/([a-zA-Z0-9\-_]+\+)?json\b/;function Ks(t){return Of.exec(t)}function Lf(t){return/^text\/plain\b/.exec(t)}function ce(t){return async function(r,n){let i=await n(r);if(!i.ok)if(t&&typeof t[i.status]=="function")i=t[i.status].apply(i,r);else throw new Error(i.status+": "+i.statusText,{cause:i});return i}}function Nt(){return async function(e,r){let n=await r(e);return n.ok&&n.data?n.data:n}}var Gr=class extends oe{constructor(e,r,n=null){e instanceof oe?super(e.clientOptions,ce(),Nt()):super(e,ce(),Nt()),n||(n=this);for(let i in r)typeof r[i]=="function"?this[i]=r[i].bind(n):r[i]&&typeof r[i]=="object"?this[i]=new this.constructor(e,r[i],n):this[i]=r[i]}},Hn=class extends Gr{constructor(e,r,n=null){e instanceof oe?super(e.with(fe()),r,n):super(re(e,fe()),r,n)}};function Qs(...t){return new Gr(...$e(t))}function Js(...t){return new Hn(...$e(t))}var Ys=Object.assign({},jt,{mw:{json:fe,thrower:ce,getdata:Nt},api:Qs,jsonApi:Js});globalThis.metro||(globalThis.metro=Ys);var N=Ys;var Hr={};vt(Hr,{base64url_encode:()=>Yn,createState:()=>to,default:()=>Ot,generateCodeChallenge:()=>eo,generateCodeVerifier:()=>Xs,getExpires:()=>Qn,isAuthorized:()=>Mf,isExpired:()=>Jn,isRedirected:()=>Zn});globalThis.assertEnabled=!1;function Bf(){globalThis.assertEnabled=!0}function Cf(){globalThis.assertEnabled=!1}function D(t,e){if(globalThis.assertEnabled){let r=G(t,e);if(r)throw console.error("\u{1F170}\uFE0F Assertions failed because of:",r,"in this source:",t),new Error("Assertions failed",{cause:{problems:r,source:t}})}}function m(t){return function(r,n,i){if(typeof r<"u"&&r!=null&&typeof t<"u")return G(r,t,n,i)}}function k(t){return function(r,n,i){return r==null||typeof r>"u"?P("data is required",r,t||"any value",i):typeof t<"u"?G(r,t,n,i):!1}}function qe(t){return function(r,n,i){return r==null||typeof r>"u"?(Zs("data does not contain recommended value",r,t,i),!1):G(r,t,n,i)}}function $(...t){return function(r,n,i){for(let s of t)if(!G(r,s,n,i))return!1;return P("data does not match oneOf patterns",r,t,i)}}function ve(...t){return function(r,n,i){if(!Array.isArray(r))return P("data is not an array",r,"anyOf",i);for(let s of r)if($(...t)(s))return P("data does not match anyOf patterns",s,t,i);return!1}}function Vn(...t){return function(r,n,i){let s=[];for(let o of t)s=s.concat(G(r,o,n,i));if(s=s.filter(Boolean),s.length)return P("data does not match all given patterns",r,t,i,s)}}function E(t,e,r){try{t instanceof URL&&(t=t.href);let n=new URL(t);if(n.href!=t&&!(n.href+"/"==t||n.href==t+"/"))return P("data is not a valid url",t,"validURL",r)}catch{return P("data is not a valid url",t,"validURL",r)}}function Kn(t,e,r){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return P("data is not a valid email",t,"validEmail",r)}function st(t){return function(r,n,i){if(!(r instanceof t))return P("data is not an instanceof pattern",r,t,i)}}function Pt(t){return function(r,n,i){if(!G(r,t,n,i))return P("data matches pattern, when required not to",r,t,i)}}function G(t,e,r,n=""){r||(r=t);let i=[];if(e===Boolean)typeof t!="boolean"&&!(t instanceof Boolean)&&i.push(P("data is not a boolean",t,e,n));else if(e===Number)typeof t!="number"&&!(t instanceof Number)&&i.push(P("data is not a number",t,e,n));else if(e===String)typeof t!="string"&&!(t instanceof String)&&i.push(P("data is not a string",t,e,n)),t==""&&i.push(P("data is an empty string, which is not allowed",t,e,n));else if(e instanceof RegExp)if(Array.isArray(t)){let s=t.findIndex((o,a)=>G(o,e,r,n+"["+a+"]"));s>-1&&i.push(P("data["+s+"] does not match pattern",t[s],e,n+"["+s+"]"))}else typeof t>"u"?i.push(P("data is undefined, should match pattern",t,e,n)):e.test(t)||i.push(P("data does not match pattern",t,e,n));else if(e instanceof Function){let s=e(t,r,n);s&&(Array.isArray(s)?i=i.concat(s):i.push(s))}else if(Array.isArray(e)){Array.isArray(t)||i.push(P("data is not an array",t,[],n));for(let s of e)for(let o of t.keys()){let a=G(t[o],s,r,n+"["+o+"]");Array.isArray(a)?i=i.concat(a):a&&i.push(a)}}else if(e&&typeof e=="object")if(Array.isArray(t)){let s=t.findIndex((o,a)=>G(o,e,r,n+"["+a+"]"));s>-1&&i.push(P("data["+s+"] does not match pattern",t[s],e,n+"["+s+"]"))}else if(!t||typeof t!="object")i.push(P("data is not an object, pattern is",t,e,n));else if(t instanceof URLSearchParams&&(t=Object.fromEntries(t)),e instanceof Function){let s=G(t,e,r,n);s&&(i=i.concat(s))}else for(let[s,o]of Object.entries(e)){let a=G(t[s],o,r,n+"."+s);a&&(i=i.concat(a))}else e!=t&&i.push(P("data and pattern are not equal",t,e,n));return i.length?i:!1}function P(t,e,r,n,i){let s={path:n,message:t,found:e,expected:r};return i&&(s.problems=i),s}function Zs(t,e,r,n){console.warn("\u{1F170}\uFE0F Assert: "+n,t,r,e)}globalThis.assert={warn:Zs,error:P,assert:D,enable:Bf,disable:Cf,Required:k,Recommended:qe,Optional:m,oneOf:$,anyOf:ve,allOf:Vn,validURL:E,validEmail:Kn,instanceOf:st,not:Pt,fails:G};function ur(t){let e,r;if(typeof localStorage<"u")e={get:()=>localStorage.getItem("metro/state:"+t),set:n=>localStorage.setItem("metro/state:"+t,n),has:()=>localStorage.getItem("metro/state:"+t)!==null,delete:()=>localStorage.remoteItem("metro/state:"+t)},r={get:n=>JSON.parse(localStorage.getItem(t+":"+n)),set:(n,i)=>localStorage.setItem(t+":"+n,JSON.stringify(i)),has:n=>localStorage.getItem(t+":"+n)!==null,delete:n=>localStorage.removeItem(t+":"+n)};else{let n=new Map;e={get:()=>n.get("metro/state:"+t),set:i=>n.set("metro/state:"+t,i),has:()=>n.has("metro/state:"+t),delete:()=>n.delete("metro/state:"+t)},r=new Map}return{state:e,tokens:r}}function Ot(t){let e={client:re(),force_authorization:!1,site:"default",oauth2_configuration:{authorization_endpoint:"/authorize",token_endpoint:"/token",redirect_uri:globalThis.document?.location.href,grant_type:"authorization_code",code_verifier:Xs(64)},authorize_callback:async f=>(window.location.href!=f.href&&window.location.replace(f.href),!1)};D(t,{});let r=Object.assign({},e.oauth2_configuration,t?.oauth2_configuration);t=Object.assign({},e,t),t.oauth2_configuration=r;let n=ur(t.site);t.tokens||(t.tokens=n.tokens),t.state||(t.state=n.state),D(t,{oauth2_configuration:{client_id:k(/.+/),grant_type:"authorization_code",authorization_endpoint:k(E),token_endpoint:k(E),redirect_uri:k(E)}});for(let f in r)switch(f){case"access_token":case"authorization_code":case"refresh_token":t.tokens.set(f,r[f]);break}return async function(f,c){if(t.force_authorization)return i(f,c);let d;try{if(d=await c(f),d.ok)return d}catch(h){switch(d?.status){case 400:case 401:return i(f,c)}throw h}if(!d.ok)switch(d.status){case 400:case 401:return i(f,c)}return d};async function i(f,c){s();let d=t.tokens.get("access_token"),h=t.tokens.get("refresh_token"),y=Jn(d);if(!d||y&&!h){try{if(!await o())return kt("false")}catch(_){throw _}return i(f,c)}else if(y&&h){try{if(!await a())return kt("false")}catch(_){throw _}return i(f,c)}else return f=nt(f,{headers:{Authorization:d.type+" "+d.value}}),c(f)}function s(){if(typeof window<"u"&&window?.location){let f=z(window.location),c,d,h;if(f.searchParams.has("code"))h=f.searchParams,f=f.with({search:""}),history.pushState({},"",f.href);else if(f.hash){let y=f.hash.substr(1);h=new URLSearchParams("?"+y),f=f.with({hash:""}),history.pushState({},"",f.href)}if(h){c=h.get("code"),d=h.get("state");let y=t.state.get("metro/state");if(!d||d!==y)return;c&&t.tokens.set("authorization_code",c)}}}async function o(){if(r.grant_type==="authorization_code"&&!t.tokens.has("authorization_code")){let h=await l();if(!t.authorize_callback||typeof t.authorize_callback!="function")throw V("oauth2mw: oauth2 with grant_type:authorization_code requires a callback function in client options.authorize_callback");let y=await t.authorize_callback(h);if(y)t.tokens.set("authorization_code",y);else return!1}let f=u(),c=await t.client.post(f);if(!c.ok){let h=await c.text();throw V("OAuth2mw: fetch access_token: "+c.status+": "+c.statusText+" ("+h+")",{cause:f})}let d=await c.json();if(t.tokens.set("access_token",{value:d.access_token,expires:Qn(d.expires_in),type:d.token_type,scope:d.scope}),d.refresh_token){let h={value:d.refresh_token};t.tokens.set("refresh_token",h)}return t.tokens.delete("authorization_code"),d}async function a(){let f=u("refresh_token"),c=await t.client.post(f);if(!c.ok)throw V("OAuth2mw: refresh access_token: "+c.status+": "+c.statusText,{cause:f});let d=await c.json();if(t.tokens.set("access_token",{value:d.access_token,expires:Qn(d.expires_in),type:d.token_type,scope:d.scope}),d.refresh_token){let h={value:d.refresh_token};t.tokens.set("refresh_token",h)}else return!1;return d}async function l(){if(!r.authorization_endpoint)throw V("oauth2mw: Missing options.oauth2_configuration.authorization_endpoint");let f=z(r.authorization_endpoint,{hash:""});D(r,{client_id:/.+/,redirect_uri:/.+/,scope:/.*/});let c={response_type:"code",client_id:r.client_id,redirect_uri:r.redirect_uri,state:r.state||to(40)};return r.response_type&&(c.response_type=r.response_type),r.response_mode&&(c.response_mode=r.response_mode),t.state.set(c.state),r.client_secret&&(c.client_secret=r.client_secret),r.code_verifier&&(t.tokens.set("code_verifier",r.code_verifier),c.code_challenge=await eo(r.code_verifier),c.code_challenge_method="S256"),r.scope&&(c.scope=r.scope),r.prompt&&(c.prompt=r.prompt),z(f,{search:c})}function u(f=null){if(D(r,{client_id:/.+/,redirect_uri:/.+/}),!r.token_endpoint)throw V("oauth2mw: Missing options.endpoints.token url");let c=z(r.token_endpoint,{hash:""}),d={grant_type:f||r.grant_type,client_id:r.client_id};switch(r.client_secret&&(d.client_secret=r.client_secret),r.scope&&(d.scope=r.scope),d.grant_type){case"authorization_code":d.redirect_uri=r.redirect_uri,d.code=t.tokens.get("authorization_code");let h=t.tokens.get("code_verifier");h&&(d.code_verifier=h);break;case"client_credentials":break;case"refresh_token":d.refresh_token=t.tokens.get("refresh_token");break;default:throw new Error("Unknown grant_type: ".oauth2.grant_type)}return nt(c,{method:"POST",body:new URLSearchParams(d)})}}function Jn(t){if(!t)return!0;let e=new Date(t.expires);return new Date().getTime()>e.getTime()}function Qn(t){if(t instanceof Date)return new Date(t.getTime());if(typeof t=="number"){let e=new Date;return e.setSeconds(e.getSeconds()+t),e}throw new TypeError("Unknown expires type "+t)}function Xs(t=64){let e=new Uint8Array(t);return globalThis.crypto.getRandomValues(e),Yn(e)}async function eo(t){let r=new TextEncoder().encode(t),n=await globalThis.crypto.subtle.digest("SHA-256",r);return Yn(n)}function Yn(t){let e=Array.from(new Uint8Array(t),r=>String.fromCharCode(r)).join("");return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function to(t){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r="",n=0;for(;n<t;)r+=e.charAt(Math.floor(Math.random()*e.length)),n++;return r}function Zn(){let t=new URL(document.location.href);if(!t.searchParams.has("code")){if(t.hash){let e=t.hash.substr(1);if(new URLSearchParams("?"+e).has("code"))return!0}return!1}return!0}function Mf(t){typeof t=="string"&&(t=ur(t).tokens);let e=t.get("access_token");return!!(e&&!Jn(e)||t.get("refresh_token"))}var Xn={};vt(Xn,{default:()=>no});var Vr={status:200,statusText:"OK",headers:{"Content-Type":"application/json"}},fr=t=>({status:400,statusText:"Bad Request",headers:{"Content-Type":"application/json"},body:JSON.stringify({error:"invalid_request",error_description:t})}),We,ro={};function no(t={}){return t=Object.assign({},{PKCE:!1,DPoP:!1},t),async(r,n)=>{let i=N.url(r.url);switch(i.pathname){case"/authorize/":if(We=G(i.searchParams,{response_type:"code",client_id:"mockClientId",state:m(/.*/)}))return N.response(fr(We));if(i.searchParams.has("code_challenge")){if(!i.searchParams.has("code_challenge_method"))return N.response(fr("missing code_challenge_method"));ro.code_challenge=i.searchParams.get("code_challenge"),ro.code_challenge_method=i.searchParams.get("code_challenge_method")}return N.response(Vr,{body:JSON.stringify({code:"mockAuthorizeToken",state:i.searchParams.get("state")})});case"/token/":if(r.data instanceof URLSearchParams){let l={};r.data.forEach((u,f)=>l[f]=u),r=r.with({body:l})}if(We=G(r,{method:"POST",data:{grant_type:$("refresh_token","authorization_code")}}))return N.response(fr(We));switch(r.data.grant_type){case"refresh_token":if(We=G(r.data,$({refresh_token:"mockRefreshToken",client_id:"mockClientId",client_secret:"mockClientSecret"},{refresh_token:"mockRefreshToken",client_id:"mockClientId",code_verifier:/.+/})))return N.response(fr(We));break;case"access_token":if(We=G(r.data,$({client_id:"mockClientId",client_secret:"mockClientSecret"},{client_id:"mockClientId",code_challenge:/.*/,code_challenge_method:"S256"})))return N.response(fr(We));break}return N.response(Vr,{body:JSON.stringify({access_token:"mockAccessToken",token_type:"mockExample",expires_in:3600,refresh_token:"mockRefreshToken",example_parameter:"mockExampleValue"})});case"/protected/":let s=r.headers.get("Authorization"),[o,a]=s?s.split(" "):[];return!a||a!=="mockAccessToken"?N.response({status:401,statusText:"Forbidden",body:"401 Forbidden"}):N.response(Vr,{body:JSON.stringify({result:"Success"})});case"/public/":return N.response(Vr,{body:JSON.stringify({result:"Success"})});default:return N.response({status:404,statusText:"not found",body:"404 Not Found "+i})}}}var ei={};vt(ei,{default:()=>oo});var io=["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512"],so=["client_secret_post","client_secret_base","client_secret_jwt","private_key_jwt"],Df={issuer:k(E),authorization_endpoint:k(E),token_endpoint:k(E),jwks_uri:m(E),registration_endpoint:m(E),scopes_supported:qe([]),response_types_supported:k(ve("code","token")),response_modes_supported:m([]),grant_types_supported:m([]),token_endpoint_auth_methods_supported:m([]),token_endpoint_auth_signing_alg_values_supported:m([]),service_documentation:m(E),ui_locales_supported:m([]),op_policy_uri:m(E),op_tos_uri:m(E),revocation_endpoint:m(E),revocation_endpoint_auth_methods_supported:m(so),revocation_endpoint_auth_signing_alg_values_supported:m(io),introspection_endpoint:m(E),introspection_endpoint_auth_methods_supported:m(so),introspection_endpoint_auth_signing_alg_values_supported:m(io),code_challendge_methods_supported:m([])};function oo(t={}){let e={client:N.client()};t=Object.assign({},e,t),D(t,{issuer:k(E)});let r=Uf(t.issuer);return t.client.with(t.issuer)}async function Uf(t,e){let r=e.get(N.url(t,".wellknown/oauth_authorization_server"));if(r.ok){D(r.headers.get("Content-Type"),/application\/json.*/);let n=await r.json();return D(n,Df),n}throw N.metroError("metro.oidcmw: Error while fetching "+t+".wellknown/oauth_authorization_server",r)}function ao(t=null){let e=!1;t=t||window.location.origin;let r=new URLSearchParams(window.location.search);if(!r.has("code")&&window.location.hash){let i=window.location.hash.substr(1);r=new URLSearchParams("?"+i)}let n=window.parent!==window?window.parent:window.opener;return n?r.has("code")?(n.postMessage({authorization_code:r.get("code")},t),e=!0):r.has("error")?n.postMessage({error:r.get("error")},t):n.postMessage({error:"Could not find an authorization_code"},t):console.error("No parent window found, cannot post authorization code (or error)"),e}function lo(t){return new Promise((e,r)=>{addEventListener("message",n=>{n.data.authorization_code?e(n.data.authorization_code):n.data.error?r(n.data.error):r("Unknown authorization error")},{once:!0}),window.open(t)})}function cr(){return new Promise((t,e)=>{let r=globalThis.indexedDB.open("metro",1);r.onupgradeneeded=()=>r.result.createObjectStore("keyPairs",{keyPath:"domain"}),r.onerror=n=>{e(n)},r.onsuccess=n=>{let i=n.target.result;t({set:function(s,o){return new Promise((a,l)=>{let u=i.transaction("keyPairs","readwrite",{durability:"strict"}),f=u.objectStore("keyPairs");u.oncomplete=()=>{a()},u.onerror=l,f.put(s,o)})},get:function(s){return new Promise((o,a)=>{let l=i.transaction("keyPairs","readonly"),f=l.objectStore("keyPairs").get(s);f.onsuccess=()=>{o(f.result)},f.onerror=a,l.onerror=a})},clear:function(){return new Promise((s,o)=>{let a=i.transaction("keyPairs","readwrite"),u=a.objectStore("keyPairs").clear();u.onsuccess=()=>{s()},u.onerror=o,a.onerror=o})}})}})}var $f=new TextEncoder,qf=new TextDecoder;function Kr(t){return typeof t=="string"?$f.encode(t):qf.decode(t)}function uo(t){if(typeof t.modulusLength!="number"||t.modulusLength<2048)throw new ri(`${t.name} modulusLength must be at least 2048 bits`)}function Wf(t){switch(t.algorithm.name){case"ECDSA":return{name:t.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return uo(t.algorithm),{name:t.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return uo(t.algorithm),{name:t.algorithm.name};case"Ed25519":return{name:t.algorithm.name}}throw new ze}async function zf(t,e,r){if(r.usages.includes("sign")===!1)throw new TypeError('private CryptoKey instances used for signing assertions must include "sign" in their "usages"');let n=`${Qr(Kr(JSON.stringify(t)))}.${Qr(Kr(JSON.stringify(e)))}`,i=Qr(await crypto.subtle.sign(Wf(r),r,Kr(n)));return`${n}.${i}`}var ti;Uint8Array.prototype.toBase64?ti=t=>(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),t.toBase64({alphabet:"base64url",omitPadding:!0})):ti=e=>{e instanceof ArrayBuffer&&(e=new Uint8Array(e));let r=[];for(let n=0;n<e.byteLength;n+=32768)r.push(String.fromCharCode.apply(null,e.subarray(n,n+32768)));return btoa(r.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")};function Qr(t){return ti(t)}var ze=class extends Error{constructor(e){var r;super(e??"operation not supported"),this.name=this.constructor.name,(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,this.constructor)}},ri=class extends Error{constructor(e){var r;super(e),this.name=this.constructor.name,(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,this.constructor)}};function Gf(t){switch(t.algorithm.hash.name){case"SHA-256":return"PS256";default:throw new ze("unsupported RsaHashedKeyAlgorithm hash name")}}function Hf(t){switch(t.algorithm.hash.name){case"SHA-256":return"RS256";default:throw new ze("unsupported RsaHashedKeyAlgorithm hash name")}}function Vf(t){switch(t.algorithm.namedCurve){case"P-256":return"ES256";default:throw new ze("unsupported EcKeyAlgorithm namedCurve")}}function Kf(t){switch(t.algorithm.name){case"RSA-PSS":return Gf(t);case"RSASSA-PKCS1-v1_5":return Hf(t);case"ECDSA":return Vf(t);case"Ed25519":return"Ed25519";default:throw new ze("unsupported CryptoKey algorithm name")}}function fo(t){return t instanceof CryptoKey}function Qf(t){return fo(t)&&t.type==="private"}function Jf(t){return fo(t)&&t.type==="public"}function Yf(){return Math.floor(Date.now()/1e3)}async function ni(t,e,r,n,i,s){let o=t?.privateKey,a=t?.publicKey;if(!Qf(o))throw new TypeError('"keypair.privateKey" must be a private CryptoKey');if(!Jf(a))throw new TypeError('"keypair.publicKey" must be a public CryptoKey');if(a.extractable!==!0)throw new TypeError('"keypair.publicKey.extractable" must be true');if(typeof e!="string")throw new TypeError('"htu" must be a string');if(typeof r!="string")throw new TypeError('"htm" must be a string');if(n!==void 0&&typeof n!="string")throw new TypeError('"nonce" must be a string or undefined');if(i!==void 0&&typeof i!="string")throw new TypeError('"accessToken" must be a string or undefined');if(s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)))throw new TypeError('"additional" must be an object');return zf({alg:Kf(o),typ:"dpop+jwt",jwk:await Zf(a)},Object.assign(Object.assign({},s),{iat:Yf(),jti:crypto.randomUUID(),htm:r,nonce:n,htu:e,ath:i?Qr(await crypto.subtle.digest("SHA-256",Kr(i))):void 0}),o)}async function Zf(t){let{kty:e,e:r,n,x:i,y:s,crv:o}=await crypto.subtle.exportKey("jwk",t);return{kty:e,crv:o,e:r,n,x:i,y:s}}async function co(t,e){var r;let n;if(typeof t!="string"||t.length===0)throw new TypeError('"alg" must be a non-empty string');switch(t){case"PS256":n={name:"RSA-PSS",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"RS256":n={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"ES256":n={name:"ECDSA",namedCurve:"P-256"};break;case"Ed25519":n={name:"Ed25519"};break;default:throw new ze}return crypto.subtle.generateKey(n,(r=e?.extractable)!==null&&r!==void 0?r:!1,["sign","verify"])}function dr(t){return D(t,{site:k(E),authorization_endpoint:k(E),token_endpoint:k(E),dpop_signing_alg_values_supported:m([])}),async(e,r)=>{let n=await cr(),i=await n.get(t.site);if(!i){let a=await co("ES256");i={domain:t.site,keyPair:a},await n.set(i)}let s=N.url(e.url);if(e.url.startsWith(t.authorization_endpoint)){let a=e.body;a instanceof URLSearchParams||a instanceof FormData?a.set("dpop_jkt",i.keyPair.publicKey):a.dpop_jkt=i.keyPair.publicKey}else if(e.url.startsWith(t.token_endpoint)){let a=await ni(i.keyPair,e.url,e.method);e=e.with({headers:{DPoP:a}})}else if(e.headers.has("Authorization")){let a=localStorage.getItem(s.host+":nonce")||void 0,l=e.headers.get("Authorization").split(" ")[1],u=await ni(i.keyPair,e.url,e.method,a,l);e=e.with({headers:{Authorization:"DPoP "+l,DPoP:u}})}let o=await r(e);return o.headers.get("DPoP-Nonce")&&localStorage.setItem(s.host+":nonce",o.headers.get("DPoP-Nonce")),o}}var ec=Object.assign({},Hr,{oauth2mw:Ot,mockserver:Xn,discover:ei,tokenstore:ur,dpopmw:dr,keysstore:cr,authorizePopup:lo,popupHandleRedirect:ao});globalThis.metro.oauth2||(globalThis.metro.oauth2=ec);var hr=(...t)=>(e,r)=>t.filter(n=>r.hasOwnKey(n)).length>0?!1:P("root data must have all of",r,t),Ge=(...t)=>e=>Array.isArray(e)&&t.filter(r=>!e.includes(r)).length==0?!1:P("data must be an array which includes",e,t);var ae=["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512"],Jr=["client_secret_post","client_secret_basic","client_secret_jwt","private_key_jwt"];async function pr(t={}){D(t,{client:m(st(N.client().constructor)),issuer:k(E)});let e={client:N.client().with(ce()).with(fe()),requireDynamicRegistration:!1};t=Object.assign({},e,t);let r=!1;function n(l){return r}let i={issuer:k(Vn(t.issuer,n)),authorization_endpoint:k(E),token_endpoint:k(E),userinfo_endpoint:qe(E),jwks_uri:k(E),registration_endpoint:t.requireDynamicRegistration?k(E):qe(E),scopes_supported:qe(Ge("openid")),response_types_supported:t.requireDynamicRegistration?k(Ge("code","id_token","id_token token")):k([]),response_modes_supported:m([]),grant_types_supported:t.requireDynamicRegistration?m(Ge("authorization_code")):m([]),acr_values_supported:m([]),subject_types_supported:k([]),id_token_signing_alg_values_supported:k(Ge("RS256")),id_token_encryption_alg_values_supported:m([]),id_token_encryption_enc_values_supported:m([]),userinfo_signing_alg_values_supported:m([]),userinfo_encryption_alg_values_supported:m([]),userinfo_encryption_enc_values_supported:m([]),request_object_signing_alg_values_supported:m(Ge("RS256")),request_object_encryption_alg_values_supported:m([]),request_object_encryption_enc_values_supported:m([]),token_endpoint_auth_methods_supported:m(ve(...Jr)),token_endpoint_auth_signing_alg_values_supported:m(Ge("RS256"),Pt(Ge("none"))),display_values_supported:m(ve("page","popup","touch","wap")),claim_types_supported:m(ve("normal","aggregated","distributed")),claims_supported:qe([]),service_documentation:m(E),claims_locales_supported:m([]),ui_locales_supported:m([]),claims_parameter_supported:m(Boolean),request_parameter_supported:m(Boolean),request_uri_parameter_supported:m(Boolean),op_policy_uri:m(E),op_tos_uri:m(E)},s=N.url(t.issuer,".well-known/openid-configuration"),a=(await t.client.get(s)).data;return D(a,i),D(a.issuer,t.issuer),a}async function _r(t){let e={redirect_uris:k([E]),response_types:m([]),grant_types:m(ve("authorization_code","refresh_token")),application_type:m($("native","web")),contacts:m([Kn]),client_name:m(String),logo_uri:m(E),client_uri:m(E),policy_uri:m(E),tos_uri:m(E),jwks_uri:m(E,Pt(hr("jwks"))),jwks:m(E,Pt(hr("jwks_uri"))),sector_identifier_uri:m(E),subject_type:m(String),id_token_signed_response_alg:m($(...ae)),id_token_encrypted_response_alg:m($(...ae)),id_token_encrypted_response_enc:m($(...ae),hr("id_token_encrypted_response_alg")),userinfo_signed_response_alg:m($(...ae)),userinfo_encrypted_response_alg:m($(...ae)),userinfo_encrypted_response_enc:m($(...ae),hr("userinfo_encrypted_response_alg")),request_object_signing_alg:m($(...ae)),request_object_encryption_alg:m($(...ae)),request_object_encryption_enc:m($(...ae)),token_endpoint_auth_method:m($(...Jr)),token_endpoint_auth_signing_alg:m($(...ae)),default_max_age:m(Number),require_auth_time:m(Boolean),default_acr_values:m([String]),initiate_login_uri:m([E]),request_uris:m([E])};D(t,{client:m(st(N.client().constructor)),registration_endpoint:E,client_info:e});let r={client:N.client().with(ce()).with(fe()),client_info:{redirect_uris:[globalThis.document?.location.href]}};t=Object.assign({},r,t),t.client_info||(t.client_info={}),t.client_info.redirect_uris||(t.client_info.redirect_uris=[globalThis.document?.location.href]);let n=await t.client.post(t.registration_endpoint,{body:t.client_info}),i=n.data;if(!i.client_id||!i.client_secret)throw N.metroError("metro.oidc: Error: dynamic registration of client failed, no client_id or client_secret returned",n);return t.client_info=Object.assign(t.client_info,i),t.client_info}function Yr(t){let e;if(typeof localStorage<"u")e={get:r=>JSON.parse(localStorage.getItem("metro/oidc:"+t+":"+r)),set:(r,n)=>localStorage.setItem("metro/oidc:"+t+":"+r,JSON.stringify(n)),has:r=>localStorage.getItem("metro/oidc:"+t+":"+r)!==null};else{let r=new Map;e={get:n=>JSON.parse(r.get("metro/oidc:"+t+":"+n)||null),set:(n,i)=>r.set("metro/oidc:"+t+":"+n,JSON.stringify(i)),has:n=>r.has("metro/oidc:"+t+":"+n)}}return e}function ii(t={}){let e={client:re(),force_authorization:!1,use_dpop:!0,authorize_callback:async r=>(window.location.href!=r.href&&window.location.replace(r.href),!1)};return t=Object.assign({},e,t),D(t,{client:k(st(re().constructor)),client_info:k(),issuer:k(E),oauth2:m({}),openid_configuration:m()}),t.store||(t.store=Yr(t.issuer)),!t.openid_configuration&&t.store.has("openid_configuration")&&(t.openid_configuration=t.store.get("openid_configuration")),!t.client_info?.client_id&&t.store.has("client_info")&&(t.client_info=t.store.get("client_info")),async(r,n)=>{let i;if(!t.force_authorization){try{i=await n(r)}catch(u){if(i.status!=401&&i.status!=403)throw u}if(i.ok||i.status!=401&&i.status!=403)return i}if(t.openid_configuration||(t.openid_configuration=await pr({issuer:t.issuer}),t.store.set("openid_configuration",t.openid_configuration)),!t.client_info?.client_id){if(!t.openid_configuration.registration_endpoint)throw V("metro.oidcmw: Error: issuer "+t.issuer+" does not support dynamic client registration, but you haven't specified a client_id");t.client_info=await _r({registration_endpoint:t.openid_configuration.registration_endpoint,client_info:t.client_info}),t.store.set("client_info",t.client_info)}let s=t.scope||"openid",o=Object.assign({site:t.issuer,client:t.client,force_authorization:!0,authorize_callback:t.authorize_callback,oauth2_configuration:{client_id:t.client_info?.client_id,client_secret:t.client_info?.client_secret,grant_type:"authorization_code",response_type:"code",response_mode:"query",authorization_endpoint:t.openid_configuration.authorization_endpoint,token_endpoint:t.openid_configuration.token_endpoint,scope:s,redirect_uri:t.client_info.redirect_uris[0]}}),a=async(u,f)=>{let c=await f(u);if(c.headers.get("content-type")?.startsWith("application/json")){let h=c.data?.id_token;if(!h){let y=c.clone();try{let _=await y.json();_&&_.id_token&&(h=_.id_token)}catch{}}h&&t.store.set("id_token",h)}return c},l=t.client.with(t.issuer).with(a);if(t.use_dpop){let u={site:t.issuer,authorization_endpoint:t.openid_configuration.authorization_endpoint,token_endpoint:t.openid_configuration.token_endpoint,dpop_signing_alg_values_supported:t.openid_configuration.dpop_signing_alg_values_supported};l=l.with(dr(u)),o.client=l}return l=l.with(Ot(o)),i=await l.fetch(r),i}}function ho(){return Zn()}function po(t){if(!t.store){if(!t.issuer)throw V("Must supply options.issuer or options.store to get the id_token");t.store=Yr(t.issuer)}return t.store.get("id_token")}var _o={oidcmw:ii,discover:pr,register:_r,isRedirected:ho,idToken:po};globalThis.metro.oidc||(globalThis.metro.oidc=_o);var yo=_o;function ai(t){return new si(t)}var li="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",tc={rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",solid:"http://www.w3.org/ns/solid/terms#",schema:"http://schema.org/",vcard:"http://www.w3.org/2006/vcard/ns#"};var si=class{constructor(e){this.prefixes={...tc,...e?.prefixes},this.prefixes.xsd||(this.prefixes.xsd="http://www.w3.org/2001/XMLSchema#"),this.parser=e?.parser,this.writer=e?.writer,this.sources=Object.create(null),this.separator=e?.separator??"$"}parse(e,r,n){let{quads:i,prefixes:s}=this.parser(e,r,n);if(s)for(let o in s){let a=s[o];if(a.match(/^http(s?):\/\/$/i))a+=r.substring(a.length);else try{a=new URL(s[o],r).href}catch(l){console.error("Could not parse prefix",s[o],l.message)}this.prefixes[o]||(this.prefixes[o]=a)}return this.sources[r]=new oi(i,r,n,s,this),this.sources[r]}setType(e,r){if(!r)return e;if(typeof e=="string"?e=new String(e):typeof result=="number"&&(e=new Number(e)),typeof e!="object")throw new Error("cannot set type on ",e,r);return e.type=r,e}getType(e){return e&&typeof e=="object"?e.type:null}},oi=class{#e=Object.create(null);constructor(e,r,n,i,s){this.mimetype=n,this.url=r,this.prefixes=i,this.context=s,this.subjects=Object.create(null);for(let o of e){let a;if(o.subject.termType=="BlankNode"){let l=this.shortURI(o.predicate.id,":"),u;switch(l){case"rdf:first":if(a=this.addCollection(o.subject.id),u=this.shortURI(o.object.id,":"),u!="rdf:nil"){let f=this.getValue(o.object);f&&a.push(f)}continue;case"rdf:rest":this.#e[o.object.id]=this.#e[o.subject.id];continue;default:a=this.addBlankNode(o.subject.id);break}}else a=this.addNamedNode(o.subject.id);a.addPredicate(o.predicate.id,o.object)}this.subjects[r]?this.primary=this.subjects[r]:this.primary=null,Object.defineProperty(this,"data",{get(){return Object.values(this.subjects)}})}addNamedNode(e){let r=new URL(e,this.url).href;return this.subjects[r]||(this.subjects[r]=new Lt(r,this)),this.subjects[r]}addBlankNode(e){return this.#e[e]||(this.#e[e]=new ot(this)),this.#e[e]}addCollection(e){return this.#e[e]||(this.#e[e]=new Bt(this)),this.#e[e]}write(){return this.context.writer(this)}get(e){return this.subjects[this.fullURI(e)]}fullURI(e,r=null){r||(r=this.context.separator);let[n,i]=e.split(r);return i?this.prefixes[n]+i:e}shortURI(e,r=null){r||(r=this.context.separator);for(let n in this.context.prefixes)if(e.startsWith(this.context.prefixes[n]))return n+r+e.substring(this.context.prefixes[n].length);return this.url&&e.startsWith(this.url)?e.substring(this.url.length):e}setType(e,r){let n=this.shortURI(r);return this.context.setType(e,n)}getType(e){return this.context.getType(e)}setLanguage(e,r){if(typeof e=="string"?e=new String(e):typeof result=="number"&&(e=new Number(e)),typeof e!="object")throw new Error("cannot set language on ",e);return e.language=r,e}getValue(e){let r;if(e.termType=="Literal"){r=e.value;let n=e.datatype?.id;n&&(r=this.setType(r,n));let i=e.language;i&&(r=this.setLanguage(r,i))}else e.termType=="BlankNode"?r=this.addBlankNode(e.id):r=this.addNamedNode(e.id);return r}},ot=class{constructor(e){Object.defineProperty(this,"graph",{value:e,writable:!1,enumerable:!1})}addPredicate(e,r){if(e.id&&(e=e.id),e==li){let n=this.graph.shortURI(r.id);this.addType(n)}else{let n=this.graph.getValue(r);e=this.graph.shortURI(e),this[e]?Array.isArray(this[e])?this[e].push(n):this[e]=[this[e],n]:this[e]=n}}addType(e){this.a?(Array.isArray(this.a)||(this.a=[this.a]),this.a.push(e)):this.a=e}},Lt=class extends ot{constructor(e,r){super(r),Object.defineProperty(this,"id",{value:e,writable:!1,enumerable:!0})}},Bt=class extends Array{constructor(e,r){super(),Object.defineProperty(this,"graph",{value:r,writable:!1,enumerable:!1})}};var $s={};vt($s,{n3Parser:()=>Ib,n3Writer:()=>Ab});var Mo=zr(pe());var ut="http://www.w3.org/1999/02/22-rdf-syntax-ns#",br="http://www.w3.org/2001/XMLSchema#",tn="http://www.w3.org/2000/10/swap/",O={xsd:{decimal:`${br}decimal`,boolean:`${br}boolean`,double:`${br}double`,integer:`${br}integer`,string:`${br}string`},rdf:{type:`${ut}type`,nil:`${ut}nil`,first:`${ut}first`,rest:`${ut}rest`,langString:`${ut}langString`,dirLangString:`${ut}dirLangString`,reifies:`${ut}reifies`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${tn}reify#forSome`,forAll:`${tn}reify#forAll`},log:{implies:`${tn}log#implies`,isImpliedBy:`${tn}log#isImpliedBy`}};var{xsd:rn}=O,Lc=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Fo={"\\":"\\","'":"'",'"':'"',n:`
3
+ `,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Bc=/[\x00-\x20<>\\"\{\}\|\^\`]/,Cc={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_dircode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},Fc=/$0^/,ft=class{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9])/i,this._dircode=/^--(ltr)|(rtl)/,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._atKeyword=/^@[a-z]+(?=[\s#<:])/i,this._keyword=/^(?:PREFIX|BASE|VERSION|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e=e||{},this._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(let r in this)!(r in Cc)&&this[r]instanceof RegExp&&(this[r]=Fc)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,r){let n=this._input,i=n.length;for(;;){let a,l;for(;a=this._newline.exec(n);)this.comments&&(l=this._comment.exec(a[0]))&&s("comment",l[1],"",this._line,a[0].length),n=n.substr(a[0].length,n.length),i=n.length,this._line++;if(!a&&(a=this._whitespace.exec(n))&&(n=n.substr(a[0].length,n.length)),this._endOfFile.test(n))return r&&(this.comments&&(l=this._comment.exec(n))&&s("comment",l[1],"",this._line,n.length),n=null,s("eof","","",this._line,0)),this._input=n;let u=this._line,f=n[0],c="",d="",h="",y=null,_=0,x=!1;switch(f){case"^":if(n.length<3)break;if(n[1]==="^"){if(this._previousMarker="^^",n=n.substr(2),n[0]!=="<"){x=!0;break}}else{this._n3Mode&&(_=1,c="^");break}case"<":if(y=this._unescapedIri.exec(n))c="IRI",d=y[1];else if(y=this._iri.exec(n)){if(d=this._unescape(y[1]),d===null||Bc.test(d))return o(this);c="IRI"}else n.length>2&&n[1]==="<"&&n[2]==="("?(c="<<(",_=3):!this._lineMode&&n.length>(r?1:2)&&n[1]==="<"?(c="<<",_=2):this._n3Mode&&n.length>1&&n[1]==="="&&(_=2,this._isImpliedBy?(c="abbreviation",d="<"):(c="inverse",d=">"));break;case">":n.length>1&&n[1]===">"&&(c=">>",_=2);break;case"_":((y=this._blank.exec(n))||r&&(y=this._blank.exec(`${n} `)))&&(c="blank",h="_",d=y[1]);break;case'"':if(y=this._simpleQuotedString.exec(n))d=y[1];else if({value:d,matchLength:_}=this._parseLiteral(n),d===null)return o(this);(y!==null||_!==0)&&(c="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(y=this._simpleApostropheString.exec(n))d=y[1];else if({value:d,matchLength:_}=this._parseLiteral(n),d===null)return o(this);(y!==null||_!==0)&&(c="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(y=this._variable.exec(n))&&(c="var",d=y[0]);break;case"@":this._previousMarker==="literal"&&(y=this._langcode.exec(n))&&y[1]!=="version"?(c="langcode",d=y[1]):(y=this._atKeyword.exec(n))&&(c=y[0]);break;case".":if(n.length===1?r:n[1]<"0"||n[1]>"9"){c=".",_=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(n[1]==="-"){this._previousMarker==="langcode"&&(y=this._dircode.exec(n))&&(c="dircode",_=2,d=y[1]||y[2],_=d.length+2);break}(y=this._number.exec(n)||r&&(y=this._number.exec(`${n} `)))&&(c="literal",d=y[0],h=typeof y[1]=="string"?rn.double:typeof y[2]=="string"?rn.decimal:rn.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":case"V":case"v":(y=this._keyword.exec(n))?c=y[0].toUpperCase():x=!0;break;case"f":case"t":(y=this._boolean.exec(n))?(c="literal",d=y[0],h=rn.boolean):x=!0;break;case"a":(y=this._shortPredicates.exec(n))?(c="abbreviation",d="a"):x=!0;break;case"=":this._n3Mode&&n.length>1&&(c="abbreviation",n[1]!==">"?(_=1,d="="):(_=2,d=">"));break;case"!":if(!this._n3Mode)break;case")":if(!r&&(n.length===1||n.length===2&&n[1]===">"))break;if(n.length>2&&n[1]===">"&&n[2]===">"){c=")>>",_=3;break}case",":case";":case"[":case"]":case"(":case"}":case"~":this._lineMode||(_=1,c=f);break;case"{":!this._lineMode&&n.length>=2&&(n[1]==="|"?(c="{|",_=2):(c=f,_=1));break;case"|":n.length>=2&&n[1]==="}"&&(c="|}",_=2);break;default:x=!0}if(x&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(y=this._prefix.exec(n))?(c="prefix",d=y[1]||""):((y=this._prefixed.exec(n))||r&&(y=this._prefixed.exec(`${n} `)))&&(c="prefixed",h=y[1]||"",d=this._unescape(y[2]))),this._previousMarker==="^^")switch(c){case"prefixed":c="type";break;case"IRI":c="typeIRI";break;default:c=""}if(!c)return r||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?o(this):this._input=n;let b=_||y[0].length,g=s(c,d,h,u,b);this.previousToken=g,this._previousMarker=c,n=n.substr(b,n.length)}function s(a,l,u,f,c){let d=n?i-n.length:i,h=d+c,y={type:a,value:l,prefix:u,line:f,start:d,end:h};return e(null,y),y}function o(a){e(a._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(e){let r=!1,n=e.replace(Lc,(i,s,o,a)=>{if(typeof s=="string")return String.fromCharCode(Number.parseInt(s,16));if(typeof o=="string"){let l=Number.parseInt(o,16);return l<=65535?String.fromCharCode(Number.parseInt(o,16)):String.fromCharCode(55296+((l-=65536)>>10),56320+(l&1023))}return a in Fo?Fo[a]:(r=!0,"")});return r?null:n}_parseLiteral(e){if(e.length>=3){let r=e.match(/^(?:"""|"|'''|'|)/)[0],n=r.length,i=Math.max(this._literalClosingPos,n);for(;(i=e.indexOf(r,i))>0;){let s=0;for(;e[i-s-1]==="\\";)s++;if(s%2===0){let o=e.substring(n,i),a=o.split(/\r\n|\r|\n/).length-1,l=i+n;if(n===1&&a!==0||n===3&&this._lineMode)break;return this._line+=a,{value:this._unescape(o),matchLength:l}}i++}this._literalClosingPos=e.length-n+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;let r=new Error(`Unexpected "${e}" on line ${this._line}.`);return r.context={token:void 0,line:this._line,previousToken:this.previousToken},r}_readStartingBom(e){return e.startsWith("\uFEFF")?e.substr(1):e}tokenize(e,r){if(this._line=1,typeof e=="string")if(this._input=this._readStartingBom(e),typeof r=="function")queueMicrotask(()=>this._tokenizeToEnd(r,!0));else{let n=[],i;if(this._tokenizeToEnd((s,o)=>s?i=s:n.push(o),!0),i)throw i;return n}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",n=>{this._input!==null&&n.length!==0&&(this._pendingBuffer&&(n=Mo.Buffer.concat([this._pendingBuffer,n]),this._pendingBuffer=null),n[n.length-1]&128?this._pendingBuffer=n:(typeof this._input>"u"?this._input=this._readStartingBom(typeof n=="string"?n:n.toString()):this._input+=n,this._tokenizeToEnd(r,!1)))}),e.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(r,!0)}),e.on("error",r)}};var{rdf:Do,xsd:ct}=O,$t,Mc=0;var gi={namedNode:Uo,blankNode:$o,variable:Wo,literal:qo,defaultGraph:Dc,quad:wi,triple:wi,fromTerm:mr,fromQuad:zo},te=gi,ee=class t{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof t?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}},Ut=class extends ee{get termType(){return"NamedNode"}},je=class t extends ee{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){let e=this.id,r=e.lastIndexOf('"')+1,n=e.lastIndexOf("--");return r<e.length&&e[r++]==="@"?(n>r?e.substr(0,n):e).substr(r).toLowerCase():""}get direction(){let e=this.id,r=e.lastIndexOf('"'),n=e.lastIndexOf("--");return n>r&&n+2<e.length?e.substr(n+2).toLowerCase():""}get datatype(){return new Ut(this.datatypeString)}get datatypeString(){let e=this.id,r=e.lastIndexOf('"')+1,n=r<e.length?e[r]:"";return n==="^"?e.substr(r+2):n!=="@"?ct.string:e.indexOf("--",r)>0?Do.dirLangString:Do.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}}}},gr=class extends ee{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},wr=class extends ee{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},xr=class extends ee{constructor(){return super(""),$t||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};$t=new xr;function Ve(t,e,r){if(e=e||gi,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===gi)return new je(t);if(t[t.length-1]==='"')return e.literal(t.substr(1,t.length-2));let n=t.lastIndexOf('"',t.length-1),i;if(t[n+1]==="@"){i=t.substr(n+2);let s=i.lastIndexOf("--");s>0&&s<i.length&&(i={language:i.substr(0,s),direction:i.substr(s+2)})}else i=e.namedNode(t.substr(n+3));return e.literal(t.substr(1,n-1),i);case"[":t=JSON.parse(t);break;default:if(!r||!Array.isArray(t))return e.namedNode(t)}return e.quad(Ve(t[0],e,!0),Ve(t[1],e,!0),Ve(t[2],e,!0),t[3]&&Ve(t[3],e,!0))}function Ne(t,e){if(typeof t=="string")return t;if(t instanceof ee&&t.termType!=="Quad")return t.id;if(!t)return $t.id;switch(t.termType){case"NamedNode":return t.value;case"BlankNode":return`_:${t.value}`;case"Variable":return`?${t.value}`;case"DefaultGraph":return"";case"Literal":return`"${t.value}"${t.language?`@${t.language}${t.direction?`--${t.direction}`:""}`:t.datatype&&t.datatype.value!==ct.string?`^^${t.datatype.value}`:""}`;case"Quad":let r=[Ne(t.subject,!0),Ne(t.predicate,!0),Ne(t.object,!0)];return t.graph&&t.graph.termType!=="DefaultGraph"&&r.push(Ne(t.graph,!0)),e?r:JSON.stringify(r);default:throw new Error(`Unexpected termType: ${t.termType}`)}}var Ke=class extends ee{constructor(e,r,n,i){super(""),this._subject=e,this._predicate=r,this._object=n,this._graph=i||$t}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 Uo(t){return new Ut(t)}function $o(t){return new gr(t||`n3-${Mc++}`)}function qo(t,e){if(typeof e=="string")return new je(`"${t}"@${e.toLowerCase()}`);if(e!==void 0&&!("termType"in e))return new je(`"${t}"@${e.language.toLowerCase()}${e.direction?`--${e.direction.toLowerCase()}`:""}`);let r=e?e.value:"";return r===""&&(typeof t=="boolean"?r=ct.boolean:typeof t=="number"&&(Number.isFinite(t)?r=Number.isInteger(t)?ct.integer:ct.double:(r=ct.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),r===""||r===ct.string?new je(`"${t}"`):new je(`"${t}"^^${r}`)}function Wo(t){return new wr(t)}function Dc(){return $t}function wi(t,e,r,n){return new Ke(t,e,r,n)}function mr(t){if(t instanceof ee)return t;switch(t.termType){case"NamedNode":return Uo(t.value);case"BlankNode":return $o(t.value);case"Variable":return Wo(t.value);case"DefaultGraph":return $t;case"Literal":return qo(t.value,t.language||t.datatype);case"Quad":return zo(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function zo(t){if(t instanceof Ke)return t;if(t.termType!=="Quad")throw new Error(`Unexpected termType: ${t.termType}`);return wi(mr(t.subject),mr(t.predicate),mr(t.object),mr(t.graph))}var Go=0,Pe=class t{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Ho(this,e.factory);let r=typeof e.format=="string"?e.format.match(/\w*$/)[0].toLowerCase():"",n=/turtle/.test(r),i=/trig/.test(r),s=/triple/.test(r),o=/quad/.test(r),a=this._n3Mode=/n3/.test(r),l=s||o;(this._supportsNamedGraphs=!(n||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(n||i||s||a),this._isImpliedBy=e.isImpliedBy,l&&(this._resolveRelativeIRI=u=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new ft({lineMode:l,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers,this._parseUnsupportedVersions=!!e.parseUnsupportedVersions,this._version=e.version}static _resetBlankNodePrefix(){Go=0}_setBase(e){if(!e)this._base="",this._basePath="";else{let r=e.indexOf("#");r>=0&&(e=e.substr(0,r)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}}_saveContext(e,r,n,i,s){let o=this._n3Mode;this._contextStack.push({type:e,subject:n,predicate:i,object:s,graph:r,inverse:o?this._inversePredicate:!1,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(e,r){let n=this._contextStack.pop();if(!n||n.type!==e)return this._error(`Unexpected ${r.type}`,r);this._subject=n.subject,this._predicate=n.predicate,this._object=n.object,this._graph=n.graph,this._n3Mode&&(this._inversePredicate=n.inverse,this._prefixes._=n.blankPrefix,this._quantified=n.quantified)}_readBeforeTopContext(e){return this._version&&!this._isValidVersion(this._version)?this._error(`Detected unsupported version as media type parameter: "${this._version}"`,e):this._readInTopContext(e)}_readInTopContext(e){switch(e.type){case"eof":return this._graph!==null?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"VERSION":this._sparqlStyle=!0;case"@version":return this._readVersion;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,r){let n;switch(e.type){case"IRI":case"typeIRI":let i=this._resolveIRI(e.value);if(i===null)return this._error("Invalid IRI",e);n=this._factory.namedNode(i);break;case"type":case"prefixed":let s=this._prefixes[e.prefix];if(s===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);n=this._factory.namedNode(s+e.value);break;case"blank":n=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case"var":n=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!r&&this._n3Mode&&n.id in this._quantified&&(n=this._quantified[n.id]),n}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":let r=this._contextStack;return(r.length&&r[r.length-1]).type==="<<"?this._error("Unexpected list in reified triple",e):(this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._factory.blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(e.prefix.length===0)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"<<(":return this._n3Mode?(this._saveContext("<<(",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Disallowed triple term as subject",e);case"<<":return this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject;default:if((this._subject=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){let r=e.type;switch(r){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":case"|}":return this._predicate===null?this._error(`Unexpected ${r}`,e):(this._subject=null,r==="]"?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return this._predicate!==null?this._readPredicate:this._error("Expected predicate but got ;",e);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if((this._predicate=this._readEntity(e))===void 0)return}return this._validAnnotation=!0,this._readObject}_readObject(e){switch(e.type){case"literal":if(e.prefix.length===0)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.blankNode()),this._readBlankNodeHead;case"(":let r=this._contextStack;return(r.length&&r[r.length-1]).type==="<<"?this._error("Unexpected list in reified triple",e):(this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<(":return this._saveContext("<<(",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject;case"<<":return this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject;default:if((this._object=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return e.type==="{"?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return e.type!=="{"?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){if(e.type==="]")return this._subject=null,this._readBlankNodeTail(e);{let r=this._contextStack;return(r.length>1&&r[r.length-2]).type==="<<"?this._error("Unexpected compound blank node expression in reified triple",e):(this._predicate=null,this._readPredicate(e))}}_readBlankNodeTail(e){if(e.type!=="]")return this._readBlankNodePunctuation(e);this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph);let r=this._predicate===null;return this._restoreContext("blank",e),this._object!==null?this._getContextEndReader():this._predicate!==null?this._readObject:r?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let r=null,n=null,i=this._readListItem,s=this._subject,o=this._contextStack,a=o[o.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,n=this._factory.blankNode(),this.RDF_FIRST,this._subject=r=this._factory.blankNode()),i=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,n=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),o.length!==0&&o[o.length-1].type==="list"&&this._emit(this._subject,this._predicate,this._object,this._graph),this._predicate===null){if(i=this._readPredicate,this._subject===this.RDF_NIL)return i}else if(i=this._getContextEndReader(),this._object===this.RDF_NIL)return i;n=this.RDF_NIL;break;case"literal":e.prefix.length===0?(this._literalValue=e.value,i=this._readListItemDataTypeOrLang):(r=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),i=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<":this._saveContext("<<",this._graph,null,null,null),this._graph=null,i=this._readSubject;break;default:if((r=this._readEntity(e))===void 0)return}if(n===null&&(this._subject=n=this._factory.blankNode()),e.type==="<<"&&(o[o.length-1].subject=this._subject),s===null?a.predicate===null?a.subject=n:a.object=n:this._emit(s,this.RDF_REST,n,this._graph),r!==null){if(this._n3Mode&&(e.type==="IRI"||e.type==="prefixed"))return this._saveContext("item",this._graph,n,this.RDF_FIRST,r),this._subject=r,this._predicate=null,this._getPathReader(this._readListItem);this._emit(n,this.RDF_FIRST,r,this._graph)}return i}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e,r){let n=this._factory.literal(this._literalValue),i;switch(e.type){case"type":case"typeIRI":let s=this._readEntity(e);if(s===void 0)return;if(s.value===O.rdf.langString||s.value===O.rdf.dirLangString)return this._error("Detected illegal (directional) languaged-tagged string with explicit datatype",e);n=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);n=this._factory.literal(this._literalValue,e.value),this._literalLanguage=e.value,e=null,i=this._readDirCode.bind(this,r);break}return{token:e,literal:n,readCb:i}}_readDirCode(e,r,n){if(n.type==="dircode"){let i=this._factory.literal(this._literalValue,{language:this._literalLanguage,direction:n.value});e==="subject"?this._subject=i:this._object=i,this._literalLanguage=void 0,n=null}return e==="subject"?n===null?this._readPredicateOrNamedGraph:this._readPredicateOrNamedGraph(n):this._completeObjectLiteralPost(n,r)}_completeSubjectLiteral(e){let r=this._completeLiteral(e,"subject");return this._subject=r.literal,r.readCb?r.readCb.bind(this,!1):this._readPredicateOrNamedGraph}_completeObjectLiteral(e,r){let n=this._completeLiteral(e,"object");if(n)return this._object=n.literal,n.readCb?n.readCb.bind(this,r):this._completeObjectLiteralPost(n.token,r)}_completeObjectLiteralPost(e,r){return r&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),e===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(e))}_readFormulaTail(e){return e.type!=="}"?this._readPunctuation(e):(this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),this._object===null?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let r,n=this._graph,i=!1,s=this._subject,o=this._inversePredicate;switch(e.type){case"}":if(this._graph===null)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,this._tripleTerm=null,r=this._contextStack.length?this._readSubject:this._readInTopContext,o&&(this._inversePredicate=!1);break;case";":r=this._readPredicate;break;case",":r=this._readObject;break;case"~":r=this._readReifierInAnnotation,i=!0;break;case"{|":this._subject=this._readTripleTerm(),this._validAnnotation=!1,i=!0,r=this._readPredicate;break;case"|}":if(!this._annotation)return this._error("Unexpected annotation syntax closing",e);if(!this._validAnnotation)return this._error("Annotation block can not be empty",e);this._subject=null,this._annotation=!1,r=this._readPunctuation;break;default:if(this._supportsQuads&&this._graph===null&&(n=this._readEntity(e))!==void 0){r=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(s!==null&&(!i||i&&!this._annotation)){let a=this._predicate,l=this._object;o?this._emit(l,a,s,n):this._emit(s,a,l,n)}return i&&(this._annotation=!0),r}_readBlankNodePunctuation(e){let r;switch(e.type){case";":r=this._readPredicate;break;case",":r=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),r}_readQuadPunctuation(e){return e.type!=="."?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return e.type!=="prefix"?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if(e.type!=="IRI")return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);let r=this._readEntity(e);return this._prefixes[this._prefix]=r.value,this._prefixCallback(this._prefix,r),this._readDeclarationPunctuation}_readBaseIRI(e){let r=e.type==="IRI"&&this._resolveIRI(e.value);return r?(this._setBase(r),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",e)}_isValidVersion(e){return this._parseUnsupportedVersions||t.SUPPORTED_VERSIONS.includes(e)}_readVersion(e){return e.type!=="literal"?this._error("Expected literal to follow version declaration",e):e.end-e.start!==e.value.length+2?this._error("Version declarations must use single quotes",e):(this._versionCallback(e.value),this._isValidVersion(e.value)?this._readDeclarationPunctuation:this._error(`Detected unsupported version: "${e.value}"`,e))}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return e.type!=="]"?this._error("Invalid graph label",e):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):e.type!=="."?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let r;switch(e.type){case"IRI":case"prefixed":if((r=this._readEntity(e,!0))!==void 0)break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(this._subject===null?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,r,this.QUANTIFIERS_GRAPH)):this._quantified[r.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return e.type===","?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:let r=this._contextStack,n=r.length&&r[r.length-1];if(n&&n.type==="item"){let i=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,i,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let r,n,i=this._factory.blankNode();if((n=this._readEntity(e))!==void 0)return this._predicate===null?(r=this._subject,this._subject=i):(r=this._object,this._object=i),this._emit(r,n,i,this._graph),this._readPath}_readBackwardPath(e){let r=this._factory.blankNode(),n,i;if((n=this._readEntity(e))!==void 0)return this._predicate===null?(i=this._subject,this._subject=r):(i=this._object,this._object=r),this._emit(r,n,i,this._graph),this._readPath}_readTripleTermTail(e){if(e.type!==")>>")return this._error(`Expected )>> but got ${e.type}`,e);let r=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<(",e),this._subject===null?(this._subject=r,this._readPredicate):(this._object=r,this._getContextEndReader())}_readReifiedTripleTailOrReifier(e){return e.type==="~"?this._readReifier:this._readReifiedTripleTail(e)}_readReifiedTripleTail(e){if(e.type!==">>")return this._error(`Expected >> but got ${e.type}`,e);this._tripleTerm=null;let r=this._readTripleTerm();this._restoreContext("<<",e);let n=this._contextStack,i=n.length&&n[n.length-1];return i&&i.type==="list"?(this._emit(this._subject,this.RDF_FIRST,r,this._graph),this._getContextEndReader()):this._subject===null?(this._subject=r,this._readPredicateOrReifierTripleEnd):(this._object=r,this._getContextEndReader())}_readPredicateOrReifierTripleEnd(e){return e.type==="."?(this._subject=null,this._readPunctuation(e)):this._readPredicate(e)}_readReifier(e){return this._reifier=this._readEntity(e),this._readReifiedTripleTail}_readReifierInAnnotation(e){return e.type==="IRI"||e.type==="typeIRI"||e.type==="type"||e.type==="prefixed"||e.type==="blank"||e.type==="var"?(this._reifier=this._readEntity(e),this._readPunctuation):(this._readTripleTerm(),this._subject=null,this._readPunctuation(e))}_readTripleTerm(){let e=this._contextStack,r=e.length&&e[e.length-1],n=r?r.graph:void 0,i=this._reifier||this._factory.blankNode();return this._reifier=null,this._tripleTerm=this._tripleTerm||this._factory.quad(this._subject,this._predicate,this._object),this._emit(i,this.RDF_REIFIES,this._tripleTerm,n||this.DEFAULTGRAPH),i}_getContextEndReader(){let e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<(":return this._readTripleTermTail;case"<<":return this._readReifiedTripleTailOrReifier}}_emit(e,r,n,i){this._callback(null,this._factory.quad(e,r,n,i||this.DEFAULTGRAPH))}_error(e,r){let n=new Error(`${e} on line ${r.line}.`);n.context={token:r,line:r.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=Sr}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return(e[1]==="/"?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;let r=e.length,n="",i=-1,s=-1,o=0,a="/";for(;i<r;){switch(a){case":":if(s<0&&e[++i]==="/"&&e[++i]==="/")for(;(s=i+1)<r&&e[s]!=="/";)i=s;break;case"?":case"#":i=r;break;case"/":if(e[i+1]===".")switch(a=e[++i+1],a){case"/":n+=e.substring(o,i-1),o=i+1;break;case void 0:case"?":case"#":return n+e.substring(o,i)+e.substr(i+1);case".":if(a=e[++i+1],a===void 0||a==="/"||a==="?"||a==="#"){if(n+=e.substring(o,i-2),(o=n.lastIndexOf("/"))>=s&&(n=n.substr(0,o)),a!=="/")return`${n}/${e.substr(i+1)}`;o=i+1}}}a=e[++i]}return n+e.substring(o)}parse(e,r,n,i){let s,o,a,l;if(r&&(r.onQuad||r.onPrefix||r.onComment||r.onVersion)?(s=r.onQuad,o=r.onPrefix,a=r.onComment,l=r.onVersion):(s=r,o=n,l=i),this._readCallback=this._readBeforeTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Go++}_`,this._prefixCallback=o||Sr,this._versionCallback=l||Sr,this._inversePredicate=!1,this._quantified=Object.create(null),!s){let f=[],c;if(this._callback=(d,h)=>{d?c=d:h&&f.push(h)},this._lexer.tokenize(e).every(d=>this._readCallback=this._readCallback(d)),c)throw c;return f}let u=(f,c)=>{f!==null?(this._callback(f),this._callback=Sr):this._readCallback&&(this._readCallback=this._readCallback(c))};a&&(this._lexer.comments=!0,u=(f,c)=>{f!==null?(this._callback(f),this._callback=Sr):this._readCallback&&(c.type==="comment"?a(c.value):this._readCallback=this._readCallback(c))}),this._callback=s,this._lexer.tokenize(e,u)}};function Sr(){}function Ho(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(O.rdf.first),t.RDF_REST=e.namedNode(O.rdf.rest),t.RDF_NIL=e.namedNode(O.rdf.nil),t.RDF_REIFIES=e.namedNode(O.rdf.reifies),t.N3_FORALL=e.namedNode(O.r.forAll),t.N3_FORSOME=e.namedNode(O.r.forSome),t.ABBREVIATIONS={a:e.namedNode(O.rdf.type),"=":e.namedNode(O.owl.sameAs),">":e.namedNode(O.log.implies),"<":e.namedNode(O.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}Pe.SUPPORTED_VERSIONS=["1.2","1.2-basic","1.1"];Ho(Pe.prototype,te);var xi={};vt(xi,{inDefaultGraph:()=>Gc,isBlankNode:()=>$c,isDefaultGraph:()=>dt,isLiteral:()=>qc,isNamedNode:()=>Uc,isQuad:()=>zc,isVariable:()=>Wc,prefix:()=>Hc,prefixes:()=>Vo});function Uc(t){return!!t&&t.termType==="NamedNode"}function $c(t){return!!t&&t.termType==="BlankNode"}function qc(t){return!!t&&t.termType==="Literal"}function Wc(t){return!!t&&t.termType==="Variable"}function zc(t){return!!t&&t.termType==="Quad"}function dt(t){return!!t&&t.termType==="DefaultGraph"}function Gc(t){return dt(t.graph)}function Hc(t,e){return Vo({"":t.value||t},e)("")}function Vo(t,e){let r=Object.create(null);for(let i in t)n(i,t[i]);e=e||te;function n(i,s){if(typeof s=="string"){let o=Object.create(null);r[i]=a=>o[a]||(o[a]=e.namedNode(s+a))}else if(!(i in r))throw new Error(`Unknown prefix: ${i}`);return r[i]}return n}function qt(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}var Vc=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Kc=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,Ko="./",Qc="../",Si="?",Qo="#",ht=class t{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!Vc.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!t.supports(this.base))return this._baseMatcher=/.^/;let e=/^[^:]*:\/*/.exec(this.base)[0],r=["^",qt(e)],n=[],i=[],s=/[^/?#]*([/?#])/y,o,a=0,l=0,u=s.lastIndex=e.length;for(;!a&&!l&&(o=s.exec(this.base));)o[1]===Qo?l=s.lastIndex-1:(r.push(qt(o[0]),"(?:"),n.push(")?"),o[1]!==Si?i.push(u=s.lastIndex):(a=u=s.lastIndex,l=this.base.indexOf(Qo,a),this._pathReplacements[a]=Si));for(let f=0;f<i.length;f++)this._pathReplacements[i[f]]=Qc.repeat(i.length-f-1);return this._pathReplacements[i[i.length-1]]=Ko,this._baseLength=l>0?l:this.base.length,r.push(qt(this.base.substring(u,this._baseLength)),a?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...r,...n].join(""))}toRelative(e){let r=this._getBaseMatcher().exec(e);if(!r)return e;let n=r[0].length;if(n===this._baseLength&&n===e.length)return"";let i=this._pathReplacements[n];if(i){let s=e.substring(n);return i!==Si&&!Kc.test(s)?e:i===Ko&&/^[^?#]/.test(s)?s:i+s}return e.substring(n-1)}};var Er=te.defaultGraph(),{rdf:Jc,xsd:Wt}=O,Jo=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,Yo=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Yc={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"},pt=class extends ee{equals(e){return e===this}},_e=class{constructor(e,r){if(this._prefixRegex=/$0^/,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 n="";this._outputStream={write(i,s,o){n+=i,o&&o()},end:i=>{i&&i(null,n)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(r.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Er,this._prefixIRIs=Object.create(null),r.prefixes&&this.addPrefixes(r.prefixes),r.baseIRI&&(this._baseIri=new ht(r.baseIRI)))}get _inDefaultGraph(){return Er.equals(this._graph)}_write(e,r){this._outputStream.write(e,"utf8",r)}_writeQuad(e,r,n,i,s){try{i.equals(this._graph)||(this._write((this._subject===null?"":this._inDefaultGraph?`.
4
4
  `:`
5
5
  }
6
- `)+(Sr.equals(i)?"":`${this._encodeIriOrBlank(i)} {
6
+ `)+(Er.equals(i)?"":`${this._encodeIriOrBlank(i)} {
7
7
  `)),this._graph=i,this._subject=null),e.equals(this._subject)?r.equals(this._predicate)?this._write(`, ${this._encodeObject(n)}`,s):this._write(`;
8
8
  ${this._encodePredicate(this._predicate=r)} ${this._encodeObject(n)}`,s):this._write(`${(this._subject===null?"":`.
9
9
  `)+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=r)} ${this._encodeObject(n)}`,s)}catch(o){s&&s(o)}}_writeQuadLine(e,r,n,i,s){delete this._prefixMatch,this._write(this.quadToString(e,r,n,i),s)}quadToString(e,r,n,i){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(r)} ${this._encodeObject(n)}${i&&i.value?` ${this._encodeIriOrBlank(i)} .
10
10
  `:` .
11
- `}`}quadsToString(e){let r="";for(let n of e)r+=this.quadToString(n.subject,n.predicate,n.object,n.graph);return r}_encodeSubject(e){return e.termType==="Quad"?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if(e.termType!=="NamedNode")return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let r=e.value;this._baseIri&&(r=this._baseIri.toRelative(r)),Qo.test(r)&&(r=r.replace(Jo,Yo));let n=this._prefixRegex.exec(r);return n?n[1]?this._prefixIRIs[n[1]]+n[2]:r:`<${r}>`}_encodeLiteral(e){let r=e.value;Qo.test(r)&&(r=r.replace(Jo,Yo));let n=e.direction?`--${e.direction}`:"";if(e.language)return`"${r}"@${e.language}${n}`;if(this._lineMode){if(e.datatype.value===qt.string)return`"${r}"`}else switch(e.datatype.value){case qt.string:return`"${r}"`;case qt.boolean:if(r==="true"||r==="false")return r;break;case qt.integer:if(/^[+-]?\d+$/.test(r))return r;break;case qt.decimal:if(/^[+-]?\d*\.\d+$/.test(r))return r;break;case qt.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(r))return r;break}return`"${r}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===Qc.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:r,object:n,graph:i}){return`<<(${this._encodeSubject(e)} ${this._encodePredicate(r)} ${this._encodeObject(n)}${ct(i)?"":` ${this._encodeIriOrBlank(i)}`})>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,r,n,i,s){n===void 0?this._writeQuad(e.subject,e.predicate,e.object,e.graph,r):typeof i=="function"?this._writeQuad(e,r,n,Sr,i):this._writeQuad(e,r,n,i||Sr,s)}addQuads(e){for(let r=0;r<e.length;r++)this.addQuad(e[r])}addPrefix(e,r,n){let i={};i[e]=r,this.addPrefixes(i,n)}addPrefixes(e,r){if(!this._prefixIRIs)return r&&r();let n=!1;for(let i in e){let s=e[i];typeof s!="string"&&(s=s.value),n=!0,this._subject!==null&&(this._write(this._inDefaultGraph?`.
11
+ `}`}quadsToString(e){let r="";for(let n of e)r+=this.quadToString(n.subject,n.predicate,n.object,n.graph);return r}_encodeSubject(e){return e.termType==="Quad"?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if(e.termType!=="NamedNode")return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let r=e.value;this._baseIri&&(r=this._baseIri.toRelative(r)),Jo.test(r)&&(r=r.replace(Yo,Zo));let n=this._prefixRegex.exec(r);return n?n[1]?this._prefixIRIs[n[1]]+n[2]:r:`<${r}>`}_encodeLiteral(e){let r=e.value;Jo.test(r)&&(r=r.replace(Yo,Zo));let n=e.direction?`--${e.direction}`:"";if(e.language)return`"${r}"@${e.language}${n}`;if(this._lineMode){if(e.datatype.value===Wt.string)return`"${r}"`}else switch(e.datatype.value){case Wt.string:return`"${r}"`;case Wt.boolean:if(r==="true"||r==="false")return r;break;case Wt.integer:if(/^[+-]?\d+$/.test(r))return r;break;case Wt.decimal:if(/^[+-]?\d*\.\d+$/.test(r))return r;break;case Wt.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(r))return r;break}return`"${r}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===Jc.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:r,object:n,graph:i}){return`<<(${this._encodeSubject(e)} ${this._encodePredicate(r)} ${this._encodeObject(n)}${dt(i)?"":` ${this._encodeIriOrBlank(i)}`})>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,r,n,i,s){n===void 0?this._writeQuad(e.subject,e.predicate,e.object,e.graph,r):typeof i=="function"?this._writeQuad(e,r,n,Er,i):this._writeQuad(e,r,n,i||Er,s)}addQuads(e){for(let r=0;r<e.length;r++)this.addQuad(e[r])}addPrefix(e,r,n){let i={};i[e]=r,this.addPrefixes(i,n)}addPrefixes(e,r){if(!this._prefixIRIs)return r&&r();let n=!1;for(let i in e){let s=e[i];typeof s!="string"&&(s=s.value),n=!0,this._subject!==null&&(this._write(this._inDefaultGraph?`.
12
12
  `:`
13
13
  }
14
14
  `),this._subject=null,this._graph=""),this._prefixIRIs[s]=i+=":",this._write(`@prefix ${i} <${s}>.
15
- `)}if(n){let i="",s="";for(let o in this._prefixIRIs)i+=i?`|${o}`:o,s+=(s?"|":"")+this._prefixIRIs[o];i=$t(i,/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&"),this._prefixRegex=new RegExp(`^(?:${s})[^/]*$|^(${i})([_a-zA-Z0-9][\\-_a-zA-Z0-9]*)$`)}this._write(n?`
16
- `:"",r)}blank(e,r){let n=e,i,s;switch(e===void 0?n=[]:e.termType?n=[{predicate:e,object:r}]:"length"in e||(n=[e]),s=n.length){case 0:return new ht("[]");case 1:if(i=n[0],!(i.object instanceof ht))return new ht(`[ ${this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)} ]`);default:let o="[";for(let a=0;a<s;a++)i=n[a],i.predicate.equals(e)?o+=`, ${this._encodeObject(i.object)}`:(o+=`${(a?`;
15
+ `)}if(n){let i="",s="";for(let o in this._prefixIRIs)i+=i?`|${o}`:o,s+=(s?"|":"")+this._prefixIRIs[o];i=qt(i,/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&"),this._prefixRegex=new RegExp(`^(?:${s})[^/]*$|^(${i})([_a-zA-Z0-9][\\-_a-zA-Z0-9]*)$`)}this._write(n?`
16
+ `:"",r)}blank(e,r){let n=e,i,s;switch(e===void 0?n=[]:e.termType?n=[{predicate:e,object:r}]:"length"in e||(n=[e]),s=n.length){case 0:return new pt("[]");case 1:if(i=n[0],!(i.object instanceof pt))return new pt(`[ ${this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)} ]`);default:let o="[";for(let a=0;a<s;a++)i=n[a],i.predicate.equals(e)?o+=`, ${this._encodeObject(i.object)}`:(o+=`${(a?`;
17
17
  `:`
18
- `)+this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)}`,e=i.predicate);return new ht(`${o}
19
- ]`)}}list(e){let r=e&&e.length||0,n=new Array(r);for(let i=0;i<r;i++)n[i]=this._encodeObject(e[i]);return new ht(`(${n.join(" ")})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
18
+ `)+this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)}`,e=i.predicate);return new pt(`${o}
19
+ ]`)}}list(e){let r=e&&e.length||0,n=new Array(r);for(let i=0;i<r;i++)n[i]=this._encodeObject(e[i]);return new pt(`(${n.join(" ")})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
20
20
  `:`
21
21
  }
22
- `),this._subject=null),this._write=this._blockedWrite;let r=e&&((n,i)=>{r=null,e(n,i)});if(this._endStream)try{return this._outputStream.end(r)}catch{}r&&r()}};function Yo(t){let e=Jc[t];return e===void 0&&(t.length===1?(e=t.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=((t.charCodeAt(0)-55296)*1024+t.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}var Ms=zr(Mn());var Fs=Symbol("iter");function Cr(t,e,r=4){if(r===0)return Object.assign(t,e);for(let n in e)t[n]=Cr(t[n]||Object.create(null),e[n],r-1);return t}function lf(t,e,r=4){let n=!1;for(let i in t)if(i in e){let s=r===0?null:lf(t[i],e[i],r-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(r===3)return!1}return n}function uf(t,e,r=4){let n=!1;for(let i in t)if(!(i in e))n=n||Object.create(null),n[i]=r===0?null:Cr({},t[i],r-1);else if(r!==0){let s=uf(t[i],e[i],r-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(r===3)return!1}return n}var Fr=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||te}_termFromId(e){if(e[0]==="."){let r=this._entities,n=e.split(".");return this._factory.quad(this._termFromId(r[n[1]]),this._termFromId(r[n[2]]),this._termFromId(r[n[3]]),n[4]&&this._termFromId(r[n[4]]))}return Ve(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){let r=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),i=this._termToNumericId(e.object),s;return r&&n&&i&&(ct(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${r}.${n}.${i}.${s}`:`.${r}.${n}.${i}`]}return this._ids[Ne(e)]}_termToNewNumericId(e){let r=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${ct(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Ne(e);return this._ids[r]||(this._ids[this._entities[++this._id]=r]=this._id)}createBlankNode(e){let r,n;if(e)for(r=e=`_:${e}`,n=1;this._ids[r];)r=e+n++;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))}},et=class t{constructor(e,r){this._size=0,this._graphs=Object.create(null),!r&&e&&!e[0]&&typeof e.match!="function"&&(r=e,e=null),r=r||{},this._factory=r.factory||te,this._entityIndex=r.entityIndex||new Fr({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,n,i;for(let s in r)for(let o in n=r[s].subjects)for(let a in i=n[o])e+=Object.keys(i[a]).length;return this._size=e}_addToIndex(e,r,n,i){let s=e[r]||(e[r]={}),o=s[n]||(s[n]={}),a=i in o;return a||(o[i]=null),!a}_removeFromIndex(e,r,n,i){let s=e[r],o=s[n];delete o[i];for(let a in o)return;delete s[n];for(let a in s)return;delete e[r]}*_findInIndex(e,r,n,i,s,o,a,l){let u,f,c,d=this._entities,h=this._termFromId(d[l]),y={subject:null,predicate:null,object:null};r&&((u=e,e={})[r]=u[r]);for(let _ in e)if(f=e[_]){y[s]=this._termFromId(d[_]),n&&((u=f,f={})[n]=u[n]);for(let x in f)if(c=f[x]){y[o]=this._termFromId(d[x]);let b=i?i in c?[i]:[]:Object.keys(c);for(let g=0;g<b.length;g++)y[a]=this._termFromId(d[b[g]]),yield this._factory.quad(y.subject,y.predicate,y.object,h)}}}_loop(e,r){for(let n in e)r(n)}_loopByKey0(e,r,n){let i,s;if(i=e[r])for(s in i)n(s)}_loopByKey1(e,r,n){let i,s;for(i in e)s=e[i],s[r]&&n(i)}_loopBy2Keys(e,r,n,i){let s,o,a;if((s=e[r])&&(o=s[n]))for(a in o)i(a)}_countInIndex(e,r,n,i){let s=0,o,a,l;r&&((o=e,e={})[r]=o[r]);for(let u in e)if(a=e[u]){n&&((o=a,a={})[n]=o[n]);for(let f in a)(l=a[f])&&(i?i in l&&s++:s+=Object.keys(l).length)}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){let r=Object.create(null);return n=>{n in r||(r[n]=!0,e(this._termFromId(this._entities[n],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,r,n,i){r||(i=e.graph,n=e.object,r=e.predicate,e=e.subject),i=i?this._termToNewNumericId(i):1;let s=this._graphs[i];return s||(s=this._graphs[i]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),e=this._termToNewNumericId(e),r=this._termToNewNumericId(r),n=this._termToNewNumericId(n),this._addToIndex(s.subjects,e,r,n)?(this._addToIndex(s.predicates,r,n,e),this._addToIndex(s.objects,n,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,n,i){return e&&e.subject&&({subject:e,predicate:r,object:n,graph:i}=e),!this.readQuads(e,r,n,i).next().done}import(e){return e.on("data",r=>{this.addQuad(r)}),e}removeQuad(e,r,n,i){r||({subject:e,predicate:r,object:n,graph:i}=e),i=i?this._termToNumericId(i):1;let s=this._graphs,o,a,l;if(!(e=e&&this._termToNumericId(e))||!(r=r&&this._termToNumericId(r))||!(n=n&&this._termToNumericId(n))||!(o=s[i])||!(a=o.subjects[e])||!(l=a[r])||!(n in l))return!1;this._removeFromIndex(o.subjects,e,r,n),this._removeFromIndex(o.predicates,r,n,e),this._removeFromIndex(o.objects,n,e,r),this._size!==null&&this._size--;for(e in o.subjects)return!0;return delete s[i],!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,n,i){let s=new Ms.Readable({objectMode:!0}),o=this.readQuads(e,r,n,i);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,n,i){return[...this.readQuads(e,r,n,i)]}*readQuads(e,r,n,i){let s=this._getGraphs(i),o,a,l,u;if(!(e&&!(a=this._termToNumericId(e))||r&&!(l=this._termToNumericId(r))||n&&!(u=this._termToNumericId(n))))for(let f in s)(o=s[f])&&(a?u?yield*this._findInIndex(o.objects,u,a,l,"object","subject","predicate",f):yield*this._findInIndex(o.subjects,a,l,null,"subject","predicate","object",f):l?yield*this._findInIndex(o.predicates,l,u,null,"predicate","object","subject",f):u?yield*this._findInIndex(o.objects,u,null,null,"object","subject","predicate",f):yield*this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",f))}match(e,r,n,i){return new Xe(this,e,r,n,i,{entityIndex:this._entityIndex})}countQuads(e,r,n,i){let s=this._getGraphs(i),o=0,a,l,u,f;if(e&&!(l=this._termToNumericId(e))||r&&!(u=this._termToNumericId(r))||n&&!(f=this._termToNumericId(n)))return 0;for(let c in s)(a=s[c])&&(e?n?o+=this._countInIndex(a.objects,f,l,u):o+=this._countInIndex(a.subjects,l,u,f):r?o+=this._countInIndex(a.predicates,u,f,l):o+=this._countInIndex(a.objects,f,l,u));return o}forEach(e,r,n,i,s){this.some(o=>(e(o,this),!1),r,n,i,s)}every(e,r,n,i,s){return!this.some(o=>!e(o,this),r,n,i,s)}some(e,r,n,i,s){for(let o of this.readQuads(r,n,i,s))if(e(o,this))return!0;return!1}getSubjects(e,r,n){let i=[];return this.forSubjects(s=>{i.push(s)},e,r,n),i}forSubjects(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(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,n){let i=[];return this.forPredicates(s=>{i.push(s)},e,r,n),i}forPredicates(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(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,n){let i=[];return this.forObjects(s=>{i.push(s)},e,r,n),i}forObjects(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(a?l?this._loopBy2Keys(o.subjects,a,l,e):this._loopByKey1(o.objects,a,e):l?this._loopByKey0(o.predicates,l,e):this._loop(o.objects,e))}getGraphs(e,r,n){let i=[];return this.forGraphs(s=>{i.push(s)},e,r,n),i}forGraphs(e,r,n,i){for(let s in this._graphs)this.some(o=>(e(o.graph),!0),r,n,i,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:r=!1}={}){let n={},i=r?(()=>!0):((a,l)=>{throw new Error(`${a.value} ${l}`)}),s=this.getQuads(null,O.rdf.rest,O.rdf.nil,null),o=e?[...s]:[];return s.forEach(a=>{let l=[],u=!1,f,c,d=a.graph,h=a.subject;for(;h&&!u;){let y=this.getQuads(null,null,h,null),_=this.getQuads(h,null,null,null),x,b=null,g=null,S=null;for(let w=0;w<_.length&&!u;w++)x=_[w],x.graph.equals(d)?f?u=i(h,"has non-list arcs out"):x.predicate.value===O.rdf.first?b?u=i(h,"has multiple rdf:first arcs"):o.push(b=x):x.predicate.value===O.rdf.rest?g?u=i(h,"has multiple rdf:rest arcs"):o.push(g=x):y.length?u=i(h,"can't be subject and object"):(f=x,c="subject"):u=i(h,"not confined to single graph");for(let w=0;w<y.length&&!u;++w)x=y[w],f?u=i(h,"can't have coreferences"):x.predicate.value===O.rdf.rest?S?u=i(h,"has incoming rdf:rest arcs"):S=x:(f=x,c="object");b?l.unshift(b.object):u=i(h,"has no list head"),h=S&&S.subject}u?e=!1:f&&(n[f[c].value]=l)}),e&&this.removeQuads(o),n}addAll(e){if(e instanceof Xe&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof t&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=Cr(this._graphs,e._graphs),this._size=null);else for(let r of e)this.add(r);return this}contains(e){if(e instanceof Xe&&(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,n=e._graphs,i,s,o,a,l;for(let u in n){if(!(i=r[u]))return!1;i=i.subjects;for(let f in s=n[u].subjects){if(!(o=i[f]))return!1;for(let c in a=s[f]){if(!(l=o[c]))return!1;for(let d in a[c])if(!(d in l))return!1}}}return!0}deleteMatches(e,r,n,i){for(let s of this.match(e,r,n,i))this.removeQuad(s);return this}difference(e){if(e&&e instanceof Xe&&(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}),n=uf(this._graphs,e._graphs);return n&&(r._graphs=n,r._size=null),r}return this.filter(r=>!e.has(r))}equals(e){return e instanceof Xe&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){let r=new t({entityIndex:this._entityIndex});for(let n of this)e(n,this)&&r.add(n);return r}intersection(e){if(e instanceof Xe&&(e=e.filtered),e===this){let r=new t({entityIndex:this._entityIndex});return r._graphs=Cr(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}),n=lf(e._graphs,this._graphs);return n&&(r._graphs=n,r._size=null),r}return this.filter(r=>e.has(r))}map(e){let r=new t({entityIndex:this._entityIndex});for(let n of this)r.add(e(n,this));return r}reduce(e,r){let n=this.readQuads(),i=r===void 0?n.next().value:r;for(let s of n)i=e(i,s,this);return i}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new _e().quadsToString(this)}union(e){let r=new t({entityIndex:this._entityIndex});return r._graphs=Cr(Object.create(null),this._graphs),r._size=this._size,r.addAll(e),r}*[Symbol.iterator](){yield*this.readQuads()}};function Re(t,e,r=0){let n=e[r];if(n&&!(n in t))return!1;let i=!1;for(let s in n?{[n]:t[n]}:t){let o=r===2?null:Re(t[s],e,r+1);o!==!1&&(i=i||Object.create(null),i[s]=o)}return i}var Xe=class t extends Ms.Readable{constructor(e,r,n,i,s,o){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:r,predicate:n,object:i,graph:s,options:o})}get filtered(){if(!this._filtered){let{n3Store:e,graph:r,object:n,predicate:i,subject:s}=this,o=this._filtered=new et({factory:e._factory,entityIndex:this.options.entityIndex}),a,l,u;if(s&&!(a=o._termToNumericId(s))||i&&!(l=o._termToNumericId(i))||n&&!(u=o._termToNumericId(n)))return o;let f=e._getGraphs(r);for(let c in f){let d,h,y,_;(_=f[c])&&(!a&&l?(h=Re(_.predicates,[l,u,a]))&&(d=Re(_.subjects,[a,l,u]),y=Re(_.objects,[u,a,l])):u?(y=Re(_.objects,[u,a,l]))&&(d=Re(_.subjects,[a,l,u]),h=Re(_.predicates,[l,u,a])):(d=Re(_.subjects,[a,l,u]))&&(h=Re(_.predicates,[l,u,a]),y=Re(_.objects,[u,a,l])),d&&(o._graphs[c]={subjects:d,predicates:h,objects:y}))}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Fs]&&(this[Fs]=this[Symbol.iterator]());let r=this[Fs];for(;--e>=0;){let{done:n,value:i}=r.next();if(n){this.push(null);return}this.push(i)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,r,n,i){return this.filtered.deleteMatches(e,r,n,i)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,r,n,i,s){return this.filtered.every(e,r,n,i,s)}filter(e){return this.filtered.filter(e)}forEach(e,r,n,i,s){return this.filtered.forEach(e,r,n,i,s)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,r,n,i,s){return this.filtered.some(e,r,n,i,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(e)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,r){return this.filtered.reduce(e,r)}toString(){return new _e().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,r,n,i){return new t(this.filtered,e,r,n,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}};var Mr=class{dataset(e){return new et(e)}};function cf(t){let e=[];for(let{subject:r,object:n}of t.match(null,te.namedNode("http://www.w3.org/2000/10/swap/log#implies"),null,te.defaultGraph())){let i=[...t.match(null,null,null,r)],s=[...t.match(null,null,null,n)];e.push({premise:i,conclusion:s})}return e}var Dr=class{constructor(e){this._store=e}_add(e,r,n,i,s){this._store._addToIndex(i.subjects,e,r,n)&&(this._store._addToIndex(i.predicates,r,n,e),this._store._addToIndex(i.objects,n,e,r),s())}_evaluatePremise(e,r,n,i=0){let s,o,a,l,u,[f,c,d]=e.premise[i].value,h=r[e.premise[i].content],y=!(a=f.value);for(a in y?h:{[a]:h[a]})if(l=h[a]){y&&(f.value=Number(a)),s=!(a=c.value);for(a in s?l:{[a]:l[a]})if(u=l[a]){s&&(c.value=Number(a)),o=!(a=d.value);for(a in o?u:{[a]:u[a]})o&&(d.value=Number(a)),i===e.premise.length-1?e.conclusion.forEach(_=>{this._add(_.subject.value,_.predicate.value,_.object.value,r,()=>{n(_)})}):this._evaluatePremise(e,r,n,i+1);o&&(d.value=null)}s&&(c.value=null)}y&&(f.value=null)}_evaluateRules(e,r,n){for(let i=0;i<e.length;i++)this._evaluatePremise(e[i],r,n)}_reasonGraphNaive(e,r){let n=[];function i(a){a.next&&a.next.forEach(l=>{n.push([a.subject.value,a.predicate.value,a.object.value,l])})}let s=a=>{a.forEach(l=>{this._add(l.subject.value,l.predicate.value,l.object.value,r,()=>{i(l)})})};this._evaluateRules(e,r,i);let o;for(;(o=n.pop())!==void 0;){let[a,l,u,f]=o,c=f.basePremise.subject.value;c||(f.basePremise.subject.value=a);let d=f.basePremise.predicate.value;d||(f.basePremise.predicate.value=l);let h=f.basePremise.object.value;h||(f.basePremise.object.value=u),f.premise.length===0?s(f.conclusion):this._evaluatePremise(f,r,i),c||(f.basePremise.subject.value=null),d||(f.basePremise.predicate.value=null),h||(f.basePremise.object.value=null)}}_createRule({premise:e,conclusion:r}){let n={},i=o=>o.termType==="Variable"?n[o.value]=n[o.value]||{}:{value:this._store._termToNewNumericId(o)},s=o=>({subject:i(o.subject),predicate:i(o.predicate),object:i(o.object)});return{premise:e.map(o=>s(o)),conclusion:r.map(o=>s(o)),variables:Object.values(n)}}reason(e){Array.isArray(e)||(e=cf(e)),e=e.map(n=>this._createRule(n));for(let n of e)for(let i of e)for(let s=0;s<i.premise.length;s++){let o=i.premise[s];for(let a of n.conclusion){if(Ds(o.subject,a.subject)&&Ds(o.predicate,a.predicate)&&Ds(o.object,a.object)){let l=new Set,u=[];o.subject.value=o.subject.value||1,o.object.value=o.object.value||1,o.predicate.value=o.predicate.value||1;for(let f=0;f<i.premise.length;f++)f!==s&&u.push(ff(i.premise[f],l));(a.next=a.next||[]).push({premise:u,conclusion:i.conclusion,basePremise:o})}i.variables.forEach(l=>{l.value=null})}}for(let n of e){let i=new Set;n.premise=n.premise.map(s=>ff(s,i))}let r=this._store._getGraphs();for(let n in r)this._reasonGraphNaive(e,r[n]);this._store._size=null}};function ff({subject:t,predicate:e,object:r},n){let i=t.value||n.has(t)||(n.add(t),!1),s=e.value||n.has(e)||(n.add(e),!1),o=r.value||n.has(r)||(n.add(r),!1);return!i&&s?{content:"predicates",value:[e,r,t]}:o?{content:"objects",value:[r,t,e]}:{content:"subjects",value:[t,e,r]}}function Ds(t,e){return t.value===null&&(t.value=e.value),t.value===e.value}var df=zr(Mn());var Ur=class extends df.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;let r=new Pe(e),n,i,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":n=a;break;case"end":i=a;break}}},s),this._transform=(o,a,l)=>{n(o),l()},this._flush=o=>{i(),o()}}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this.emit("error",r)}),this}};var hf=zr(Mn());var $r=class extends hf.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0});let r=this._writer=new _e({write:(n,i,s)=>{this.push(n),s&&s()},end:n=>{this.push(null),n&&n()}},e);this._transform=(n,i,s)=>{r.addQuad(n,s)},this._flush=n=>{r.end(n)}}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this.emit("error",r)}),e.on("prefix",(r,n)=>{this._writer.addPrefix(r,n)}),this}};var Dn={Lexer:ut,Parser:Pe,Writer:_e,Store:et,StoreFactory:Mr,EntityIndex:Fr,StreamParser:Ur,StreamWriter:$r,Util:wi,Reasoner:Dr,BaseIRI:dt,DataFactory:te,Term:ee,NamedNode:Dt,Literal:je,BlankNode:mr,Variable:gr,DefaultGraph:wr,Quad:Ke,Triple:Ke,termFromId:Ve,termToId:Ne};var Rb=(t,e,r)=>{let n=new Dn.Parser({baseIRI:e,blankNodePrefix:"",format:r}),i=Object.create(null);return{quads:n.parse(t,null,(o,a)=>{i[o]=a.id}),prefixes:i}},Ib=t=>new Promise((e,r)=>{let n=new Dn.Writer({format:t.type,prefixes:{...t.prefixes}}),i=t.prefixes.xsd,{quad:s,namedNode:o,literal:a,blankNode:l}=Dn.DataFactory,u=(b,g)=>{let S=g.a;if(Array.isArray(S)||(S=[S]),S?.length)for(let w of S)w=t.fullURI(w),n.addQuad(s(o(b),o(ai),o(w)))},f=(b,g)=>{if(!g)return;let S=c(g);for(let w of S)if(!(w.predicate.id=="id"||w.predicate.id=="a")){Array.isArray(w.object)||(w.object=[w.object]);for(let T of w.object)n.addQuad(s(o(b),w.predicate,T))}},c=b=>{let g=[];return Object.entries(b).forEach(S=>{let w=S[0],T=S[1],Ae=t.fullURI(w),U={predicate:o(Ae)};T instanceof Lt?U.object=y(T):Array.isArray(T)?U.object=x(T):T instanceof Ot?U.object=o(T.id):T instanceof st?U.object=_(T):h(T)?U.object=d(T):console.log("oldm-ns: encountered unknown object",T,w),g.push(U)}),g},d=b=>{let g=t.getType(b)||void 0;if(g)g==i+t.context.separator+"string"||g==i+t.context.separator+"number"?g=void 0:g=t.fullURI(g),g=o(g);else{let S=b?.language;S&&(g=S)}return b instanceof String?b=""+b:b instanceof Number&&(b=+b),a(b,g)},h=b=>b instanceof String||b instanceof Number||typeof b=="boolean"||typeof b=="string"||typeof b=="number",y=b=>{let g=[];for(let S of b)h(S)?g.push(d(S)):S.id?g.push(o(S.id)):g.push(_(S));return n.list(g)},_=b=>n.blank(c(b)),x=(b,g)=>{let S=[];for(let w of g)h(w)?S.push(d(w)):w instanceof Ot?S.push(o(w.id)):w instanceof st?S.push(_(w)):w instanceof Lt&&S.push(y(w));return S};Object.entries(t.subjects).forEach(([b,g])=>{b=t.shortURI(b,":"),u(b,g),f(b,g)}),n.end((b,g)=>{g?e(g):r(b)})});var pf={context:oi,...Us};globalThis.oldm=pf;var Un=pf;function Ie(t){return[String,Boolean,Number,BigInt].includes(t?.constructor)}function $s(t){let e=[];if(t instanceof Function)e.push(t);else for(let[r,n]of Object.entries(t))n instanceof Function?e.push(i=>r=="_"?n(i,r,"select"):{[r]:n(i,r,"select")}):Ie(n)?e.push(()=>r=="_"?n:{[r]:n}):e.push(i=>r=="_"?sr(i[r]).select(n):{[r]:sr(i[r]).select(n)});return e.length==1?e[0]:r=>{let n={};for(let i of e)Object.assign(n,i(r));return n}}function qs(t){let e=[];if(Array.isArray(t))e.push(kb(...t));else if(t instanceof RegExp)e.push(r=>t.test(r));else if(t instanceof Function)e.push(r=>t(r));else if(Ie(t))e.push(r=>Array.isArray(r)?r.filter(n=>t==n).length>0:t==r);else{let r={};for(let[i,s]of Object.entries(t))r[i]=qs(s);let n=i=>{if(Array.isArray(i))return i.filter(s=>n(s)).length>0;if(Ie(i))return!1;for(let s in r){let o=r[s];if(!o(i?.[s]))return!1}return!0};e.push(n)}return e.length==1?e[0]:r=>{for(let n of e)if(!n(r))return!1;return!0}}var Ab=Symbol("asc"),Tb=Symbol("desc");function _f(t){let e=Object.entries(t),r=[];for(let[n,i]of e)if(i instanceof Function)r.push(i);else if(i===Ab)r.push((s,o)=>s[n]>o[n]?1:s[n]<o[n]?-1:0);else if(i===Tb)r.push((s,o)=>s[n]<o[n]?1:s[n]>o[n]?-1:0);else{if(Ie(i))throw new Error("Unknown sort order",i);{let s=_f(i);r.push((o,a)=>s(o[n],a[n]))}}return r.length==1?r[0]:(n,i)=>{for(let s of r){let o=s(n,i);if(o!==0)return o}return 0}}function yf(t){let e=[];if(t instanceof Function)e.push(t);else for(let[r,n]of Object.entries(t))n instanceof Function?e.push((i,s,o,a)=>(Ie(i)&&(i={}),s.reduce?i[r]=s.reduce(n,i[r]||[]):i[r]=n(i[r]||[],s,o,a),i)):Ie(n)?e.push(i=>(Ie(i)&&(i={}),i[r]=n,i)):e.push((i,s)=>(Ie(i)&&(i={}),i[r]=sr(s[r]).reduce(n,[]),i));return e.length==1?e[0]:(r,n,i,s)=>{let o={};for(let a of e)Object.assign(o,a(r,n,i,s));return o}}function vb(t,e){let r={};for(let n of t){let i=e(n);Array.isArray(i)||(i=[i]);for(let s of i){if(typeof s!="string"&&!(s instanceof String)){console.warn("JAQT: groupBy(selector) can only handle string values, got:",s);continue}r[s]||(r[s]=[]),r[s].push(n)}}return r}function bf(t,e){let r=e.shift();if(typeof r=="string"&&(r=Nb[r]),typeof r!="function")throw new Error("groupBy parameters must be either a property name or a pointer function (e.g.: _.name)");let n=vb(t,r);if(e.length)for(let i in n)n[i]=bf(n[i],e);return n}function kb(...t){let e=t.map(r=>qs(r));return r=>e.some(n=>n(r))}var jb={apply(t,e,r){let n=t.apply(e,r);return typeof n=="object"?new Proxy(n,De):n}},De={get(t,e){let r=null;if(typeof e=="symbol"&&(r=t[e]),Array.isArray(t))switch(e){case"where":r=function(n){let i=qs(n);return new Proxy(t.filter(s=>i(s)),De)};break;case"select":r=function(n){let i=$s(n);return new Proxy(t.map(i),De)};break;case"reduce":r=function(n,i=[]){let s=yf(n),o=t.reduce(s,i);return Array.isArray(o)?new Proxy(o,De):Ie(o)?o:new Proxy(o,qr)};break;case"orderBy":r=function(n){let i=_f(n);return new Proxy(t.toSorted(i),De)};break;case"groupBy":r=function(...n){let i=bf(t,n);return new Proxy(i,qr)};break}return!r&&t&&typeof t=="object"&&e==="select"&&(r=function(n){let i=$s(n);return new Proxy(i(t),De)}),!r&&t&&typeof t[e]=="function"&&(r=new Proxy(t[e],jb)),r||(r=t[e]),r}},qr={get(t,e){let r=null;switch(e){case"select":r=function(n){let i=$s(n),s={};for(let o in t)Array.isArray(t[o])?s[o]=new Proxy(t[o].map(i),De):s[o]=new Proxy(t[o],qr);return s};break;case"reduce":r=function(n,i=[]){let s=yf(n),o={};for(let a in t)if(Array.isArray(t[a])){let l=t[a].reduce(s,i);Array.isArray(l)?o[a]=new Proxy(l,De):Ie(l)?o[a]=l:o[a]=new Proxy(l,qr)}else o[a]=new Proxy(t[a],qr);return o};break;default:Array.isArray(t[e])?r=sr(t[e]):r=t[e];break}return r}},$n={get(t,e){let r=null;switch(e){case"where":r=function(){return new Proxy(new ir,$n)};break;case"reduce":case"select":r=function(){return null};break;case"orderBy":r=function(){return new Proxy(new ir,$n)};break;case"groupBy":r=function(){return new Proxy(new ir,$n)};break}return!r&&typeof t?.[e]=="function"&&(r=t[e]),r}},ir=class{toJSON(){return null}};function sr(t){return!t||typeof t!="object"?new Proxy(new ir,$n):new Proxy(t,De)}function Ws(t){return(e,r)=>{if(t?.length>0){let n=t.slice(),i=n.shift();for(;i;){if(Array.isArray(e)&&parseInt(i)!=i)return n.unshift(i),e.map(Ws(n));typeof e?.[i]<"u"?e=e[i]:e=null,i=n.shift()}return e}else return r&&r!=="_"?typeof e?.[r]<"u"?e[r]:null:e}}var mf=t=>(t||(t=[]),{get(e,r){if(r=="constructor"||typeof r=="symbol")return e[r];let n=t.concat([r]);return new Proxy(Ws(n),mf(n))},apply(e,r,n){let i=e(...n);return Array.isArray(i)&&(i=i.flat(1/0)),i}}),Nb=new Proxy(Ws(),mf());function qn(t){t=Object.assign({contentType:"text/turtle",prefixes:{ldp:"http://www.w3.org/ns/ldp#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",dct:"http://purl.org/dc/terms/",stat:"http://www.w3.org/ns/posix/stat#",turtle:"http://www.w3.org/ns/iana/media-types/text/turtle#",schem:"https://schema.org/",solid:"http://www.w3.org/ns/solid/terms#",acl:"http://www.w3.org/ns/auth/acl#",pims:"http://www.w3.org/ns/pim/space#",vcard:"http://www.w3.org/2006/vcard/ns#",foaf:"http://xmlns.com/foaf/0.1/"},parser:Un.n3Parser,writer:Un.n3Writer},t),t.prefixes.ldp||(t.prefixes.ldp="http://www.w3.org/ns/ldp#");let e=Un.context(t);return async function(n,i){if(n.headers.get("Accept")||(n=n.with({headers:{Accept:t.accept??t.contentType}})),n.method!=="GET"&&n.method!=="HEAD"&&n.data&&typeof n.data=="object"&&!(n.data instanceof ReadableStream)){let o=n.headers.get("Content-Type");(!o||isPlainText(o))&&(n=n.with({headers:{"Content-Type":t.contentType}})),gf(n.headers.get("Content-Type"))&&(n=n.with({body:await e.writer(n.data)}))}let s=await i(n);if(s&&gf(s.headers?.get("Content-Type"))){let a=await s.clone().text();try{let l=e.parse(a,n.url,s.headers.get("Content-Type"));return s.with({body:l})}catch{}}return s}}var Pb=[/^text\/turtle\b/,/^application\/n-quads\b/,/^text\/x-nquads\b/,/^appliction\/n-triples\b/,/^application\/trig\b/];function gf(t){for(let e of Pb)if(e.exec(t))return!0;return!1}globalThis.oldmmw=qn;var wf=qn;var Wr=class extends nt{#e;#t;constructor(e,r="/",n={}){e=re(e).with(_o.oidcmw(n)).with(wf(n)),r=R.collapse(r),super(e,r),this.#e=e,this.#t=r}get name(){return"SolidAdapter"}supportsDirectories(){return!0}async read(e){let r=await this.#e.get(R.collapse(e,this.#t)),n={type:this.getMimetype(r),name:R.filename(e),http:{headers:r.headers,status:r.status,url:r.url}};return r.data&&(n.data=r.data),n.type.match(/text\/.*/)?n.contents=await r.text():n.type.match(/application\/json.*/)?n.contents=await r.json():n.contents=await r.blob(),n}async list(e){let r=await this.read(e);if(r.data){if(!r.data.primary?.ldp$contains)throw new Error(e+" could not find ldp container",{cause:r});return sr(r.data.primary.ldp$contains).where({a:"ldp$Resource"}).select({filename:n=>jsfs.path.filename(metro.url(n.id).pathname),path:n=>metro.url(n.id).pathname,type:n=>n.a.includes("ldp$Container")?"folder":"file"})}else throw new Error(e+" could not be parsed",{cause:r})}async mkdir(e){this.#e.put(R.collapse(e,this.#t))}async rmdir(e){this.#e.delete(R.collapse(e,this.#t))}};async function Ob(t,e){let r={prefixes:{ldp:"http://www.w3.org/ns/ldp#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",dct:"http://purl.org/dc/terms/",stat:"http://www.w3.org/ns/posix/stat#",turtle:"http://www.w3.org/ns/iana/media-types/text/turtle#",schema:"https://schema.org/",solid:"http://www.w3.org/ns/solid/terms#",acl:"http://www.w3.org/ns/auth/acl#",space:"http://www.w3.org/ns/pim/space#",vcard:"http://www.w3.org/2006/vcard/ns#",foaf:"http://xmlns.com/foaf/0.1/"},parser:n3Parser,writer:n3Writer},n=Object.assign({},r,e);for(let o in r.prefixes)info.prefixes[o]||(info.prefixes[o]=r.prefixes[o]);let i=await metro.client().with(oldmmw(info),getdatamw()).get(t)?.primary;if(!i||!i.solid$oidcIssuer)throw new Error("solidClient: "+t+" did not return valid solid profile");info.issuer=i.solid$oidcIssuer;let s=oldm.many(i.space$storage).map(o=>new jsfs.fs(new Wr(o,"/",info)));return metro.api(metro.client(oidcmw(info),oldmmw(info)),{profile:i,issuer:i.solid$oidcIssuer,inbox:i.ldp$inbox,id:function(){return metro.oidc.idToken(this.issuer)},logout:async function(){throw new Error("not yet implemented")},...s})}})();
22
+ `),this._subject=null),this._write=this._blockedWrite;let r=e&&((n,i)=>{r=null,e(n,i)});if(this._endStream)try{return this._outputStream.end(r)}catch{}r&&r()}};function Zo(t){let e=Yc[t];return e===void 0&&(t.length===1?(e=t.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=((t.charCodeAt(0)-55296)*1024+t.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}var Ds=zr(Mn());var Ms=Symbol("iter");function Fr(t,e,r=4){if(r===0)return Object.assign(t,e);for(let n in e)t[n]=Fr(t[n]||Object.create(null),e[n],r-1);return t}function uf(t,e,r=4){let n=!1;for(let i in t)if(i in e){let s=r===0?null:uf(t[i],e[i],r-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(r===3)return!1}return n}function ff(t,e,r=4){let n=!1;for(let i in t)if(!(i in e))n=n||Object.create(null),n[i]=r===0?null:Fr({},t[i],r-1);else if(r!==0){let s=ff(t[i],e[i],r-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(r===3)return!1}return n}var Mr=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||te}_termFromId(e){if(e[0]==="."){let r=this._entities,n=e.split(".");return this._factory.quad(this._termFromId(r[n[1]]),this._termFromId(r[n[2]]),this._termFromId(r[n[3]]),n[4]&&this._termFromId(r[n[4]]))}return Ve(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){let r=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),i=this._termToNumericId(e.object),s;return r&&n&&i&&(dt(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${r}.${n}.${i}.${s}`:`.${r}.${n}.${i}`]}return this._ids[Ne(e)]}_termToNewNumericId(e){let r=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${dt(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Ne(e);return this._ids[r]||(this._ids[this._entities[++this._id]=r]=this._id)}createBlankNode(e){let r,n;if(e)for(r=e=`_:${e}`,n=1;this._ids[r];)r=e+n++;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))}},et=class t{constructor(e,r){this._size=0,this._graphs=Object.create(null),!r&&e&&!e[0]&&typeof e.match!="function"&&(r=e,e=null),r=r||{},this._factory=r.factory||te,this._entityIndex=r.entityIndex||new Mr({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,n,i;for(let s in r)for(let o in n=r[s].subjects)for(let a in i=n[o])e+=Object.keys(i[a]).length;return this._size=e}_addToIndex(e,r,n,i){let s=e[r]||(e[r]={}),o=s[n]||(s[n]={}),a=i in o;return a||(o[i]=null),!a}_removeFromIndex(e,r,n,i){let s=e[r],o=s[n];delete o[i];for(let a in o)return;delete s[n];for(let a in s)return;delete e[r]}*_findInIndex(e,r,n,i,s,o,a,l){let u,f,c,d=this._entities,h=this._termFromId(d[l]),y={subject:null,predicate:null,object:null};r&&((u=e,e={})[r]=u[r]);for(let _ in e)if(f=e[_]){y[s]=this._termFromId(d[_]),n&&((u=f,f={})[n]=u[n]);for(let x in f)if(c=f[x]){y[o]=this._termFromId(d[x]);let b=i?i in c?[i]:[]:Object.keys(c);for(let g=0;g<b.length;g++)y[a]=this._termFromId(d[b[g]]),yield this._factory.quad(y.subject,y.predicate,y.object,h)}}}_loop(e,r){for(let n in e)r(n)}_loopByKey0(e,r,n){let i,s;if(i=e[r])for(s in i)n(s)}_loopByKey1(e,r,n){let i,s;for(i in e)s=e[i],s[r]&&n(i)}_loopBy2Keys(e,r,n,i){let s,o,a;if((s=e[r])&&(o=s[n]))for(a in o)i(a)}_countInIndex(e,r,n,i){let s=0,o,a,l;r&&((o=e,e={})[r]=o[r]);for(let u in e)if(a=e[u]){n&&((o=a,a={})[n]=o[n]);for(let f in a)(l=a[f])&&(i?i in l&&s++:s+=Object.keys(l).length)}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){let r=Object.create(null);return n=>{n in r||(r[n]=!0,e(this._termFromId(this._entities[n],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,r,n,i){r||(i=e.graph,n=e.object,r=e.predicate,e=e.subject),i=i?this._termToNewNumericId(i):1;let s=this._graphs[i];return s||(s=this._graphs[i]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),e=this._termToNewNumericId(e),r=this._termToNewNumericId(r),n=this._termToNewNumericId(n),this._addToIndex(s.subjects,e,r,n)?(this._addToIndex(s.predicates,r,n,e),this._addToIndex(s.objects,n,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,n,i){return e&&e.subject&&({subject:e,predicate:r,object:n,graph:i}=e),!this.readQuads(e,r,n,i).next().done}import(e){return e.on("data",r=>{this.addQuad(r)}),e}removeQuad(e,r,n,i){r||({subject:e,predicate:r,object:n,graph:i}=e),i=i?this._termToNumericId(i):1;let s=this._graphs,o,a,l;if(!(e=e&&this._termToNumericId(e))||!(r=r&&this._termToNumericId(r))||!(n=n&&this._termToNumericId(n))||!(o=s[i])||!(a=o.subjects[e])||!(l=a[r])||!(n in l))return!1;this._removeFromIndex(o.subjects,e,r,n),this._removeFromIndex(o.predicates,r,n,e),this._removeFromIndex(o.objects,n,e,r),this._size!==null&&this._size--;for(e in o.subjects)return!0;return delete s[i],!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,n,i){let s=new Ds.Readable({objectMode:!0}),o=this.readQuads(e,r,n,i);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,n,i){return[...this.readQuads(e,r,n,i)]}*readQuads(e,r,n,i){let s=this._getGraphs(i),o,a,l,u;if(!(e&&!(a=this._termToNumericId(e))||r&&!(l=this._termToNumericId(r))||n&&!(u=this._termToNumericId(n))))for(let f in s)(o=s[f])&&(a?u?yield*this._findInIndex(o.objects,u,a,l,"object","subject","predicate",f):yield*this._findInIndex(o.subjects,a,l,null,"subject","predicate","object",f):l?yield*this._findInIndex(o.predicates,l,u,null,"predicate","object","subject",f):u?yield*this._findInIndex(o.objects,u,null,null,"object","subject","predicate",f):yield*this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",f))}match(e,r,n,i){return new Xe(this,e,r,n,i,{entityIndex:this._entityIndex})}countQuads(e,r,n,i){let s=this._getGraphs(i),o=0,a,l,u,f;if(e&&!(l=this._termToNumericId(e))||r&&!(u=this._termToNumericId(r))||n&&!(f=this._termToNumericId(n)))return 0;for(let c in s)(a=s[c])&&(e?n?o+=this._countInIndex(a.objects,f,l,u):o+=this._countInIndex(a.subjects,l,u,f):r?o+=this._countInIndex(a.predicates,u,f,l):o+=this._countInIndex(a.objects,f,l,u));return o}forEach(e,r,n,i,s){this.some(o=>(e(o,this),!1),r,n,i,s)}every(e,r,n,i,s){return!this.some(o=>!e(o,this),r,n,i,s)}some(e,r,n,i,s){for(let o of this.readQuads(r,n,i,s))if(e(o,this))return!0;return!1}getSubjects(e,r,n){let i=[];return this.forSubjects(s=>{i.push(s)},e,r,n),i}forSubjects(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(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,n){let i=[];return this.forPredicates(s=>{i.push(s)},e,r,n),i}forPredicates(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(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,n){let i=[];return this.forObjects(s=>{i.push(s)},e,r,n),i}forObjects(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(a?l?this._loopBy2Keys(o.subjects,a,l,e):this._loopByKey1(o.objects,a,e):l?this._loopByKey0(o.predicates,l,e):this._loop(o.objects,e))}getGraphs(e,r,n){let i=[];return this.forGraphs(s=>{i.push(s)},e,r,n),i}forGraphs(e,r,n,i){for(let s in this._graphs)this.some(o=>(e(o.graph),!0),r,n,i,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:r=!1}={}){let n={},i=r?(()=>!0):((a,l)=>{throw new Error(`${a.value} ${l}`)}),s=this.getQuads(null,O.rdf.rest,O.rdf.nil,null),o=e?[...s]:[];return s.forEach(a=>{let l=[],u=!1,f,c,d=a.graph,h=a.subject;for(;h&&!u;){let y=this.getQuads(null,null,h,null),_=this.getQuads(h,null,null,null),x,b=null,g=null,S=null;for(let w=0;w<_.length&&!u;w++)x=_[w],x.graph.equals(d)?f?u=i(h,"has non-list arcs out"):x.predicate.value===O.rdf.first?b?u=i(h,"has multiple rdf:first arcs"):o.push(b=x):x.predicate.value===O.rdf.rest?g?u=i(h,"has multiple rdf:rest arcs"):o.push(g=x):y.length?u=i(h,"can't be subject and object"):(f=x,c="subject"):u=i(h,"not confined to single graph");for(let w=0;w<y.length&&!u;++w)x=y[w],f?u=i(h,"can't have coreferences"):x.predicate.value===O.rdf.rest?S?u=i(h,"has incoming rdf:rest arcs"):S=x:(f=x,c="object");b?l.unshift(b.object):u=i(h,"has no list head"),h=S&&S.subject}u?e=!1:f&&(n[f[c].value]=l)}),e&&this.removeQuads(o),n}addAll(e){if(e instanceof Xe&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof t&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=Fr(this._graphs,e._graphs),this._size=null);else for(let r of e)this.add(r);return this}contains(e){if(e instanceof Xe&&(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,n=e._graphs,i,s,o,a,l;for(let u in n){if(!(i=r[u]))return!1;i=i.subjects;for(let f in s=n[u].subjects){if(!(o=i[f]))return!1;for(let c in a=s[f]){if(!(l=o[c]))return!1;for(let d in a[c])if(!(d in l))return!1}}}return!0}deleteMatches(e,r,n,i){for(let s of this.match(e,r,n,i))this.removeQuad(s);return this}difference(e){if(e&&e instanceof Xe&&(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}),n=ff(this._graphs,e._graphs);return n&&(r._graphs=n,r._size=null),r}return this.filter(r=>!e.has(r))}equals(e){return e instanceof Xe&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){let r=new t({entityIndex:this._entityIndex});for(let n of this)e(n,this)&&r.add(n);return r}intersection(e){if(e instanceof Xe&&(e=e.filtered),e===this){let r=new t({entityIndex:this._entityIndex});return r._graphs=Fr(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}),n=uf(e._graphs,this._graphs);return n&&(r._graphs=n,r._size=null),r}return this.filter(r=>e.has(r))}map(e){let r=new t({entityIndex:this._entityIndex});for(let n of this)r.add(e(n,this));return r}reduce(e,r){let n=this.readQuads(),i=r===void 0?n.next().value:r;for(let s of n)i=e(i,s,this);return i}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new _e().quadsToString(this)}union(e){let r=new t({entityIndex:this._entityIndex});return r._graphs=Fr(Object.create(null),this._graphs),r._size=this._size,r.addAll(e),r}*[Symbol.iterator](){yield*this.readQuads()}};function Re(t,e,r=0){let n=e[r];if(n&&!(n in t))return!1;let i=!1;for(let s in n?{[n]:t[n]}:t){let o=r===2?null:Re(t[s],e,r+1);o!==!1&&(i=i||Object.create(null),i[s]=o)}return i}var Xe=class t extends Ds.Readable{constructor(e,r,n,i,s,o){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:r,predicate:n,object:i,graph:s,options:o})}get filtered(){if(!this._filtered){let{n3Store:e,graph:r,object:n,predicate:i,subject:s}=this,o=this._filtered=new et({factory:e._factory,entityIndex:this.options.entityIndex}),a,l,u;if(s&&!(a=o._termToNumericId(s))||i&&!(l=o._termToNumericId(i))||n&&!(u=o._termToNumericId(n)))return o;let f=e._getGraphs(r);for(let c in f){let d,h,y,_;(_=f[c])&&(!a&&l?(h=Re(_.predicates,[l,u,a]))&&(d=Re(_.subjects,[a,l,u]),y=Re(_.objects,[u,a,l])):u?(y=Re(_.objects,[u,a,l]))&&(d=Re(_.subjects,[a,l,u]),h=Re(_.predicates,[l,u,a])):(d=Re(_.subjects,[a,l,u]))&&(h=Re(_.predicates,[l,u,a]),y=Re(_.objects,[u,a,l])),d&&(o._graphs[c]={subjects:d,predicates:h,objects:y}))}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Ms]&&(this[Ms]=this[Symbol.iterator]());let r=this[Ms];for(;--e>=0;){let{done:n,value:i}=r.next();if(n){this.push(null);return}this.push(i)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,r,n,i){return this.filtered.deleteMatches(e,r,n,i)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,r,n,i,s){return this.filtered.every(e,r,n,i,s)}filter(e){return this.filtered.filter(e)}forEach(e,r,n,i,s){return this.filtered.forEach(e,r,n,i,s)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,r,n,i,s){return this.filtered.some(e,r,n,i,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(e)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,r){return this.filtered.reduce(e,r)}toString(){return new _e().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,r,n,i){return new t(this.filtered,e,r,n,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}};var Dr=class{dataset(e){return new et(e)}};function df(t){let e=[];for(let{subject:r,object:n}of t.match(null,te.namedNode("http://www.w3.org/2000/10/swap/log#implies"),null,te.defaultGraph())){let i=[...t.match(null,null,null,r)],s=[...t.match(null,null,null,n)];e.push({premise:i,conclusion:s})}return e}var Ur=class{constructor(e){this._store=e}_add(e,r,n,i,s){this._store._addToIndex(i.subjects,e,r,n)&&(this._store._addToIndex(i.predicates,r,n,e),this._store._addToIndex(i.objects,n,e,r),s())}_evaluatePremise(e,r,n,i=0){let s,o,a,l,u,[f,c,d]=e.premise[i].value,h=r[e.premise[i].content],y=!(a=f.value);for(a in y?h:{[a]:h[a]})if(l=h[a]){y&&(f.value=Number(a)),s=!(a=c.value);for(a in s?l:{[a]:l[a]})if(u=l[a]){s&&(c.value=Number(a)),o=!(a=d.value);for(a in o?u:{[a]:u[a]})o&&(d.value=Number(a)),i===e.premise.length-1?e.conclusion.forEach(_=>{this._add(_.subject.value,_.predicate.value,_.object.value,r,()=>{n(_)})}):this._evaluatePremise(e,r,n,i+1);o&&(d.value=null)}s&&(c.value=null)}y&&(f.value=null)}_evaluateRules(e,r,n){for(let i=0;i<e.length;i++)this._evaluatePremise(e[i],r,n)}_reasonGraphNaive(e,r){let n=[];function i(a){a.next&&a.next.forEach(l=>{n.push([a.subject.value,a.predicate.value,a.object.value,l])})}let s=a=>{a.forEach(l=>{this._add(l.subject.value,l.predicate.value,l.object.value,r,()=>{i(l)})})};this._evaluateRules(e,r,i);let o;for(;(o=n.pop())!==void 0;){let[a,l,u,f]=o,c=f.basePremise.subject.value;c||(f.basePremise.subject.value=a);let d=f.basePremise.predicate.value;d||(f.basePremise.predicate.value=l);let h=f.basePremise.object.value;h||(f.basePremise.object.value=u),f.premise.length===0?s(f.conclusion):this._evaluatePremise(f,r,i),c||(f.basePremise.subject.value=null),d||(f.basePremise.predicate.value=null),h||(f.basePremise.object.value=null)}}_createRule({premise:e,conclusion:r}){let n={},i=o=>o.termType==="Variable"?n[o.value]=n[o.value]||{}:{value:this._store._termToNewNumericId(o)},s=o=>({subject:i(o.subject),predicate:i(o.predicate),object:i(o.object)});return{premise:e.map(o=>s(o)),conclusion:r.map(o=>s(o)),variables:Object.values(n)}}reason(e){Array.isArray(e)||(e=df(e)),e=e.map(n=>this._createRule(n));for(let n of e)for(let i of e)for(let s=0;s<i.premise.length;s++){let o=i.premise[s];for(let a of n.conclusion){if(Us(o.subject,a.subject)&&Us(o.predicate,a.predicate)&&Us(o.object,a.object)){let l=new Set,u=[];o.subject.value=o.subject.value||1,o.object.value=o.object.value||1,o.predicate.value=o.predicate.value||1;for(let f=0;f<i.premise.length;f++)f!==s&&u.push(cf(i.premise[f],l));(a.next=a.next||[]).push({premise:u,conclusion:i.conclusion,basePremise:o})}i.variables.forEach(l=>{l.value=null})}}for(let n of e){let i=new Set;n.premise=n.premise.map(s=>cf(s,i))}let r=this._store._getGraphs();for(let n in r)this._reasonGraphNaive(e,r[n]);this._store._size=null}};function cf({subject:t,predicate:e,object:r},n){let i=t.value||n.has(t)||(n.add(t),!1),s=e.value||n.has(e)||(n.add(e),!1),o=r.value||n.has(r)||(n.add(r),!1);return!i&&s?{content:"predicates",value:[e,r,t]}:o?{content:"objects",value:[r,t,e]}:{content:"subjects",value:[t,e,r]}}function Us(t,e){return t.value===null&&(t.value=e.value),t.value===e.value}var hf=zr(Mn());var $r=class extends hf.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;let r=new Pe(e),n,i,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":n=a;break;case"end":i=a;break}}},s),this._transform=(o,a,l)=>{n(o),l()},this._flush=o=>{i(),o()}}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this.emit("error",r)}),this}};var pf=zr(Mn());var qr=class extends pf.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0});let r=this._writer=new _e({write:(n,i,s)=>{this.push(n),s&&s()},end:n=>{this.push(null),n&&n()}},e);this._transform=(n,i,s)=>{r.addQuad(n,s)},this._flush=n=>{r.end(n)}}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this.emit("error",r)}),e.on("prefix",(r,n)=>{this._writer.addPrefix(r,n)}),this}};var Dn={Lexer:ft,Parser:Pe,Writer:_e,Store:et,StoreFactory:Dr,EntityIndex:Mr,StreamParser:$r,StreamWriter:qr,Util:xi,Reasoner:Ur,BaseIRI:ht,DataFactory:te,Term:ee,NamedNode:Ut,Literal:je,BlankNode:gr,Variable:wr,DefaultGraph:xr,Quad:Ke,Triple:Ke,termFromId:Ve,termToId:Ne};var Ib=(t,e,r)=>{let n=new Dn.Parser({baseIRI:e,blankNodePrefix:"",format:r}),i=Object.create(null);return{quads:n.parse(t,null,(o,a)=>{i[o]=a.id}),prefixes:i}},Ab=t=>new Promise((e,r)=>{let n=new Dn.Writer({format:t.type,prefixes:{...t.prefixes}}),i=t.prefixes.xsd,{quad:s,namedNode:o,literal:a,blankNode:l}=Dn.DataFactory,u=(b,g)=>{let S=g.a;if(Array.isArray(S)||(S=[S]),S?.length)for(let w of S)w=t.fullURI(w),n.addQuad(s(o(b),o(li),o(w)))},f=(b,g)=>{if(!g)return;let S=c(g);for(let w of S)if(!(w.predicate.id=="id"||w.predicate.id=="a")){Array.isArray(w.object)||(w.object=[w.object]);for(let T of w.object)n.addQuad(s(o(b),w.predicate,T))}},c=b=>{let g=[];return Object.entries(b).forEach(S=>{let w=S[0],T=S[1],Ae=t.fullURI(w),U={predicate:o(Ae)};T instanceof Bt?U.object=y(T):Array.isArray(T)?U.object=x(T):T instanceof Lt?U.object=o(T.id):T instanceof ot?U.object=_(T):h(T)?U.object=d(T):console.log("oldm-ns: encountered unknown object",T,w),g.push(U)}),g},d=b=>{let g=t.getType(b)||void 0;if(g)g==i+t.context.separator+"string"||g==i+t.context.separator+"number"?g=void 0:g=t.fullURI(g),g=o(g);else{let S=b?.language;S&&(g=S)}return b instanceof String?b=""+b:b instanceof Number&&(b=+b),a(b,g)},h=b=>b instanceof String||b instanceof Number||typeof b=="boolean"||typeof b=="string"||typeof b=="number",y=b=>{let g=[];for(let S of b)h(S)?g.push(d(S)):S.id?g.push(o(S.id)):g.push(_(S));return n.list(g)},_=b=>n.blank(c(b)),x=(b,g)=>{let S=[];for(let w of g)h(w)?S.push(d(w)):w instanceof Lt?S.push(o(w.id)):w instanceof ot?S.push(_(w)):w instanceof Bt&&S.push(y(w));return S};Object.entries(t.subjects).forEach(([b,g])=>{b=t.shortURI(b,":"),u(b,g),f(b,g)}),n.end((b,g)=>{g?e(g):r(b)})});var _f={context:ai,...$s};globalThis.oldm=_f;var Un=_f;function Ie(t){return[String,Boolean,Number,BigInt].includes(t?.constructor)}function qs(t){let e=[];if(t instanceof Function)e.push(t);else for(let[r,n]of Object.entries(t))n instanceof Function?e.push(i=>r=="_"?n(i,r,"select"):{[r]:n(i,r,"select")}):Ie(n)?e.push(()=>r=="_"?n:{[r]:n}):e.push(i=>r=="_"?or(i[r]).select(n):{[r]:or(i[r]).select(n)});return e.length==1?e[0]:r=>{let n={};for(let i of e)Object.assign(n,i(r));return n}}function Ws(t){let e=[];if(Array.isArray(t))e.push(jb(...t));else if(t instanceof RegExp)e.push(r=>t.test(r));else if(t instanceof Function)e.push(r=>t(r));else if(Ie(t))e.push(r=>Array.isArray(r)?r.filter(n=>t==n).length>0:t==r);else{let r={};for(let[i,s]of Object.entries(t))r[i]=Ws(s);let n=i=>{if(Array.isArray(i))return i.filter(s=>n(s)).length>0;if(Ie(i))return!1;for(let s in r){let o=r[s];if(!o(i?.[s]))return!1}return!0};e.push(n)}return e.length==1?e[0]:r=>{for(let n of e)if(!n(r))return!1;return!0}}var Tb=Symbol("asc"),vb=Symbol("desc");function yf(t){let e=Object.entries(t),r=[];for(let[n,i]of e)if(i instanceof Function)r.push(i);else if(i===Tb)r.push((s,o)=>s[n]>o[n]?1:s[n]<o[n]?-1:0);else if(i===vb)r.push((s,o)=>s[n]<o[n]?1:s[n]>o[n]?-1:0);else{if(Ie(i))throw new Error("Unknown sort order",i);{let s=yf(i);r.push((o,a)=>s(o[n],a[n]))}}return r.length==1?r[0]:(n,i)=>{for(let s of r){let o=s(n,i);if(o!==0)return o}return 0}}function bf(t){let e=[];if(t instanceof Function)e.push(t);else for(let[r,n]of Object.entries(t))n instanceof Function?e.push((i,s,o,a)=>(Ie(i)&&(i={}),s.reduce?i[r]=s.reduce(n,i[r]||[]):i[r]=n(i[r]||[],s,o,a),i)):Ie(n)?e.push(i=>(Ie(i)&&(i={}),i[r]=n,i)):e.push((i,s)=>(Ie(i)&&(i={}),i[r]=or(s[r]).reduce(n,[]),i));return e.length==1?e[0]:(r,n,i,s)=>{let o={};for(let a of e)Object.assign(o,a(r,n,i,s));return o}}function kb(t,e){let r={};for(let n of t){let i=e(n);Array.isArray(i)||(i=[i]);for(let s of i){if(typeof s!="string"&&!(s instanceof String)){console.warn("JAQT: groupBy(selector) can only handle string values, got:",s);continue}r[s]||(r[s]=[]),r[s].push(n)}}return r}function mf(t,e){let r=e.shift();if(typeof r=="string"&&(r=Pb[r]),typeof r!="function")throw new Error("groupBy parameters must be either a property name or a pointer function (e.g.: _.name)");let n=kb(t,r);if(e.length)for(let i in n)n[i]=mf(n[i],e);return n}function jb(...t){let e=t.map(r=>Ws(r));return r=>e.some(n=>n(r))}var Nb={apply(t,e,r){let n=t.apply(e,r);return typeof n=="object"?new Proxy(n,De):n}},De={get(t,e){let r=null;if(typeof e=="symbol"&&(r=t[e]),Array.isArray(t))switch(e){case"where":r=function(n){let i=Ws(n);return new Proxy(t.filter(s=>i(s)),De)};break;case"select":r=function(n){let i=qs(n);return new Proxy(t.map(i),De)};break;case"reduce":r=function(n,i=[]){let s=bf(n),o=t.reduce(s,i);return Array.isArray(o)?new Proxy(o,De):Ie(o)?o:new Proxy(o,Wr)};break;case"orderBy":r=function(n){let i=yf(n);return new Proxy(t.toSorted(i),De)};break;case"groupBy":r=function(...n){let i=mf(t,n);return new Proxy(i,Wr)};break}return!r&&t&&typeof t=="object"&&e==="select"&&(r=function(n){let i=qs(n);return new Proxy(i(t),De)}),!r&&t&&typeof t[e]=="function"&&(r=new Proxy(t[e],Nb)),r||(r=t[e]),r}},Wr={get(t,e){let r=null;switch(e){case"select":r=function(n){let i=qs(n),s={};for(let o in t)Array.isArray(t[o])?s[o]=new Proxy(t[o].map(i),De):s[o]=new Proxy(t[o],Wr);return s};break;case"reduce":r=function(n,i=[]){let s=bf(n),o={};for(let a in t)if(Array.isArray(t[a])){let l=t[a].reduce(s,i);Array.isArray(l)?o[a]=new Proxy(l,De):Ie(l)?o[a]=l:o[a]=new Proxy(l,Wr)}else o[a]=new Proxy(t[a],Wr);return o};break;default:Array.isArray(t[e])?r=or(t[e]):r=t[e];break}return r}},$n={get(t,e){let r=null;switch(e){case"where":r=function(){return new Proxy(new sr,$n)};break;case"reduce":case"select":r=function(){return null};break;case"orderBy":r=function(){return new Proxy(new sr,$n)};break;case"groupBy":r=function(){return new Proxy(new sr,$n)};break}return!r&&typeof t?.[e]=="function"&&(r=t[e]),r}},sr=class{toJSON(){return null}};function or(t){return!t||typeof t!="object"?new Proxy(new sr,$n):new Proxy(t,De)}function zs(t){return(e,r)=>{if(t?.length>0){let n=t.slice(),i=n.shift();for(;i;){if(Array.isArray(e)&&parseInt(i)!=i)return n.unshift(i),e.map(zs(n));typeof e?.[i]<"u"?e=e[i]:e=null,i=n.shift()}return e}else return r&&r!=="_"?typeof e?.[r]<"u"?e[r]:null:e}}var gf=t=>(t||(t=[]),{get(e,r){if(r=="constructor"||typeof r=="symbol")return e[r];let n=t.concat([r]);return new Proxy(zs(n),gf(n))},apply(e,r,n){let i=e(...n);return Array.isArray(i)&&(i=i.flat(1/0)),i}}),Pb=new Proxy(zs(),gf());function qn(t){t=Object.assign({contentType:"text/turtle",prefixes:{ldp:"http://www.w3.org/ns/ldp#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",dct:"http://purl.org/dc/terms/",stat:"http://www.w3.org/ns/posix/stat#",turtle:"http://www.w3.org/ns/iana/media-types/text/turtle#",schem:"https://schema.org/",solid:"http://www.w3.org/ns/solid/terms#",acl:"http://www.w3.org/ns/auth/acl#",pims:"http://www.w3.org/ns/pim/space#",vcard:"http://www.w3.org/2006/vcard/ns#",foaf:"http://xmlns.com/foaf/0.1/"},parser:Un.n3Parser,writer:Un.n3Writer},t),t.prefixes.ldp||(t.prefixes.ldp="http://www.w3.org/ns/ldp#");let e=Un.context(t);return async function(n,i){if(n.headers.get("Accept")||(n=n.with({headers:{Accept:t.accept??t.contentType}})),n.method!=="GET"&&n.method!=="HEAD"&&n.data&&typeof n.data=="object"&&!(n.data instanceof ReadableStream)){let o=n.headers.get("Content-Type");(!o||isPlainText(o))&&(n=n.with({headers:{"Content-Type":t.contentType}})),wf(n.headers.get("Content-Type"))&&(n=n.with({body:await e.writer(n.data)}))}let s=await i(n);if(s&&wf(s.headers?.get("Content-Type"))){let a=await s.clone().text();try{let l=e.parse(a,n.url,s.headers.get("Content-Type"));return s.with({body:l})}catch{}}return s}}var Ob=[/^text\/turtle\b/,/^application\/n-quads\b/,/^text\/x-nquads\b/,/^appliction\/n-triples\b/,/^application\/trig\b/];function wf(t){for(let e of Ob)if(e.exec(t))return!0;return!1}globalThis.oldmmw=qn;var xf=qn;var tt=class extends it{#e;#t;constructor(e,r="/",n={}){e=re(e).with(yo.oidcmw(n)).with(xf(n)),r=R.collapse(r),super(e,r),this.#e=e,this.#t=r}get name(){return"SolidAdapter"}supportsDirectories(){return!0}async read(e){let r=await this.#e.get(R.collapse(e,this.#t)),n={type:this.getMimetype(r),name:R.filename(e),http:{headers:r.headers,status:r.status,url:r.url}};return r.data&&(n.data=r.data),n.type.match(/text\/.*/)?n.contents=await r.text():n.type.match(/application\/json.*/)?n.contents=await r.json():n.contents=await r.blob(),n}async list(e){let r=await this.read(e);if(r.data){if(!r.data.primary?.ldp$contains)throw new Error(e+" could not find ldp container",{cause:r});return or(r.data.primary.ldp$contains).where({a:"ldp$Resource"}).select({filename:n=>jsfs.path.filename(metro.url(n.id).pathname),path:n=>metro.url(n.id).pathname,type:n=>n.a.includes("ldp$Container")?"folder":"file"})}else throw new Error(e+" could not be parsed",{cause:r})}async mkdir(e){this.#e.put(R.collapse(e,this.#t))}async rmdir(e){this.#e.delete(R.collapse(e,this.#t))}};async function Wn(t,e){let r={prefixes:{ldp:"http://www.w3.org/ns/ldp#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",dct:"http://purl.org/dc/terms/",stat:"http://www.w3.org/ns/posix/stat#",turtle:"http://www.w3.org/ns/iana/media-types/text/turtle#",schema:"https://schema.org/",solid:"http://www.w3.org/ns/solid/terms#",acl:"http://www.w3.org/ns/auth/acl#",space:"http://www.w3.org/ns/pim/space#",vcard:"http://www.w3.org/2006/vcard/ns#",foaf:"http://xmlns.com/foaf/0.1/"},parser:n3Parser,writer:n3Writer},n=Object.assign({},r,e);for(let o in r.prefixes)info.prefixes[o]||(info.prefixes[o]=r.prefixes[o]);let i=await metro.client().with(oldmmw(info),getdatamw()).get(t)?.primary;if(!i||!i.solid$oidcIssuer)throw new Error("solidClient: "+t+" did not return valid solid profile");info.issuer=i.solid$oidcIssuer;let s=oldm.many(i.space$storage).map(o=>new jsfs.fs(new tt(o,"/",info)));return metro.api(metro.client(oidcmw(info),oldmmw(info)),{profile:i,issuer:i.solid$oidcIssuer,inbox:i.ldp$inbox,id:function(){return metro.oidc.idToken(this.issuer)},logout:async function(){throw new Error("not yet implemented")},...s})}var u0={adapter:tt,client:Wn};globalThis.solidClient=Wn;globalThis.SolidAdapter=tt;})();
23
23
  /*! Bundled license information:
24
24
 
25
25
  ieee754/index.js: