@ulb-darmstadt/shacl-form 1.6.5 → 1.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see form-material.js.LICENSE.txt */
2
- import*as e from"mdui";var t={5568:e=>{const{AbortController:t,AbortSignal:n}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;e.exports=t,e.exports.AbortSignal=n,e.exports.default=t},7526:(e,t)=>{t.byteLength=function(e){var t=s(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,o=s(e),a=o[0],l=o[1],c=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,l)),u=0,d=l>0?a-4:a;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=255&t;return 2===l&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,c[u++]=255&t),1===l&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t),c},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],a=16383,s=0,c=r-i;s<c;s+=a)o.push(l(e,s,s+a>c?c:s+a));return 1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=o[a],r[o.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,r){for(var i,o,a=[],s=t;s<r;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},8287:(e,t,n)=>{const r=n(7526),i=n(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l,t.SlowBuffer=function(e){return+e!=e&&(e=0),l.alloc(+e)},t.INSPECT_MAX_BYTES=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return c(e,t,n)}function c(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=s(n);const i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Q(e,Uint8Array)){const t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Q(e,ArrayBuffer)||e&&Q(e.buffer,ArrayBuffer))return f(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Q(e,SharedArrayBuffer)||e&&Q(e.buffer,SharedArrayBuffer)))return f(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return l.from(r,t,n);const i=function(e){if(l.isBuffer(e)){const t=0|p(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||X(e.length)?s(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return u(e),s(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),n=s(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function f(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,l.prototype),r}function p(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function g(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return z(e).length;default:if(i)return r?-1:W(e).length;t=(""+t).toLowerCase(),i=!0}}function y(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,n);case"utf8":case"utf-8":return E(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return R(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function b(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),X(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){let o,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let r=-1;for(o=n;o<s;o++)if(c(e,o)===c(t,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===l)return r*a}else-1!==r&&(o-=o-r),r=-1}else for(n+l>s&&(n=s-l),o=n;o>=0;o--){let n=!0;for(let r=0;r<l;r++)if(c(e,o+r)!==c(t,r)){n=!1;break}if(n)return o}return-1}function w(e,t,n,r){n=Number(n)||0;const i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=t.length;let a;for(r>o/2&&(r=o/2),a=0;a<r;++a){const r=parseInt(t.substr(2*a,2),16);if(X(r))return a;e[n+a]=r}return a}function _(e,t,n,r){return J(W(t,e.length-n),e,n,r)}function x(e,t,n,r){return J(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function S(e,t,n,r){return J(z(t),e,n,r)}function j(e,t,n,r){return J(function(e,t){let n,r,i;const o=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function I(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function E(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i<n;){const t=e[i];let o=null,a=t>239?4:t>223?3:t>191?2:1;if(i+a<=n){let n,r,s,l;switch(a){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128==(192&n)&&(l=(31&t)<<6|63&n,l>127&&(o=l));break;case 3:n=e[i+1],r=e[i+2],128==(192&n)&&128==(192&r)&&(l=(15&t)<<12|(63&n)<<6|63&r,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(l=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,l>65535&&l<1114112&&(o=l))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(e){const t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=N));return n}(r)}t.kMaxLength=a,l.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,n){return function(e,t,n){return u(e),e<=0?s(e):void 0!==t?"string"==typeof n?s(e).fill(t,n):s(e).fill(t):s(e)}(e,t,n)},l.allocUnsafe=function(e){return d(e)},l.allocUnsafeSlow=function(e){return d(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(Q(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),Q(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},l.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}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=l.allocUnsafe(t);let i=0;for(n=0;n<e.length;++n){let t=e[n];if(Q(t,Uint8Array))i+t.length>r.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!l.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},l.byteLength=g,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)m(this,t,t+1);return this},l.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},l.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},l.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?E(this,0,e):y.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){let e="";const n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},o&&(l.prototype[o]=l.prototype.inspect),l.prototype.compare=function(e,t,n,r,i){if(Q(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(o,a),c=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<s;++e)if(c[e]!==u[e]){o=c[e],a=u[e];break}return o<a?-1:a<o?1:0},l.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},l.prototype.indexOf=function(e,t,n){return b(this,e,t,n,!0)},l.prototype.lastIndexOf=function(e,t,n){return b(this,e,t,n,!1)},l.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return _(this,e,t,n);case"ascii":case"latin1":case"binary":return x(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const N=4096;function T(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function R(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function O(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=t;r<n;++r)i+=K[e[r]];return i}function k(e,t,n){const r=e.slice(t,n);let i="";for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+256*r[e+1]);return i}function L(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function A(e,t,n,r,i,o){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function C(e,t,n,r,i){U(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function D(e,t,n,r,i){U(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function M(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function P(e,t,n,r,o){return t=+t,n>>>=0,o||M(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function $(e,t,n,r,o){return t=+t,n>>>=0,o||M(e,0,n,8),i.write(e,t,n,r,52,8),n+8}l.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,l.prototype),r},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return r},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=Y((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),l.prototype.readBigUInt64BE=Y((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),l.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},l.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=Y((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),l.prototype.readBigInt64BE=Y((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),i.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||A(this,e,t,n,Math.pow(2,8*n)-1,0);let i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||A(this,e,t,n,Math.pow(2,8*n)-1,0);let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigUInt64LE=Y((function(e,t=0){return C(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeBigUInt64BE=Y((function(e,t=0){return D(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);A(this,e,t,n,r-1,-r)}let i=0,o=1,a=0;for(this[t]=255&e;++i<n&&(o*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/o|0)-a&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);A(this,e,t,n,r-1,-r)}let i=n-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o|0)-a&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigInt64LE=Y((function(e,t=0){return C(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeBigInt64BE=Y((function(e,t=0){return D(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeFloatLE=function(e,t,n){return P(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return P(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return $(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return $(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const i=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},l.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!l.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{const o=l.isBuffer(e)?e:l.from(e,r),a=o.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=o[i%a]}return this};const B={};function F(e,t,n){B[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function q(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function U(e,t,n,r,i,o){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new B.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||H(t,e.length-(n+1))}(r,i,o)}function G(e,t){if("number"!=typeof e)throw new B.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,n){if(Math.floor(e)!==e)throw G(e,n),new B.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new B.ERR_BUFFER_OUT_OF_BOUNDS;throw new B.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=q(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=q(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function W(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let a=0;a<r;++a){if(n=e.charCodeAt(a),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function z(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function J(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function X(e){return e!=e}const K=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Y(e){return"undefined"==typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},2341:e=>{e.exports=function e(t){return null===t||"object"!=typeof t||null!=t.toJSON?JSON.stringify(t):Array.isArray(t)?"["+t.reduce(((t,n,r)=>t+(0===r?"":",")+e(void 0===n||"symbol"==typeof n?null:n)),"")+"]":"{"+Object.keys(t).sort().reduce(((n,r,i)=>void 0===t[r]||"symbol"==typeof t[r]?n:n+(0===n.length?"":",")+e(r)+":"+e(t[r])),"")+"}"}},7007:e=>{var t,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function c(e,t,n,r){var i,o,a,c;if(s(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=l(e))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,c=u,console&&console.warn&&console.warn(c)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=u.bind(r);return i.listener=n,r.wrapFn=i,i}function h(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):p(i,i.length)}function f(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function p(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function g(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){r.once&&e.removeEventListener(t,i),n(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(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},o.prototype.getMaxListeners=function(){return l(this)},o.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)r(l,this,t);else{var c=l.length,u=p(l,c);for(n=0;n<c;++n)r(u[n],this,t)}return!0},o.prototype.addListener=function(e,t){return c(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return c(this,e,t,!0)},o.prototype.once=function(e,t){return s(t),this.on(e,d(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,d(this,e,t)),this},o.prototype.removeListener=function(e,t){var n,r,i,o,a;if(s(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,a||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},o.prototype.listeners=function(e){return h(this,e,!0)},o.prototype.rawListeners=function(e){return h(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},o.prototype.listenerCount=f,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},251:(e,t)=>{t.read=function(e,t,n,r,i){var o,a,s=8*i-r-1,l=(1<<s)-1,c=l>>1,u=-7,d=n?i-1:0,h=n?-1:1,f=e[t+d];for(d+=h,o=f&(1<<-u)-1,f>>=-u,u+=s;u>0;o=256*o+e[t+d],d+=h,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=r;u>0;a=256*a+e[t+d],d+=h,u-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,s,l,c=8*o-i-1,u=(1<<c)-1,d=u>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?h/l:h*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=u?(s=0,a=u):a+d>=1?(s=(t*l-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;e[n+f]=255&a,f+=p,a/=256,c-=8);e[n+f-p]|=128*g}},7034:(e,t,n)=>{const{isArray:r,isObject:i,isString:o}=n(7382),{asArray:a}=n(9263),{prependBase:s}=n(470),l=n(2207),c=n(7532);function u(e){throw new l("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:e})}function d({context:e,base:t}){if(!e)return;const n=e["@context"];if(o(n))e["@context"]=s(t,n);else if(r(n))for(let e=0;e<n.length;++e){const r=n[e];o(r)?n[e]=s(t,r):i(r)&&d({context:{"@context":r},base:t})}else if(i(n))for(const e in n)d({context:n[e],base:t})}e.exports=class{constructor({sharedCache:e}){this.perOpCache=new Map,this.sharedCache=e}async resolve({activeCtx:e,context:t,documentLoader:n,base:s,cycles:l=new Set}){t&&i(t)&&t["@context"]&&(t=t["@context"]),t=a(t);const d=[];for(const a of t){if(o(a)){let t=this._get(a);t||(t=await this._resolveRemoteContext({activeCtx:e,url:a,documentLoader:n,base:s,cycles:l})),r(t)?d.push(...t):d.push(t);continue}if(null===a){d.push(new c({document:null}));continue}i(a)||u(t);const h=JSON.stringify(a);let f=this._get(h);f||(f=new c({document:a}),this._cacheResolvedContext({key:h,resolved:f,tag:"static"})),d.push(f)}return d}_get(e){let t=this.perOpCache.get(e);if(!t){const n=this.sharedCache.get(e);n&&(t=n.get("static"),t&&this.perOpCache.set(e,t))}return t}_cacheResolvedContext({key:e,resolved:t,tag:n}){if(this.perOpCache.set(e,t),void 0!==n){let r=this.sharedCache.get(e);r||(r=new Map,this.sharedCache.set(e,r)),r.set(n,t)}return t}async _resolveRemoteContext({activeCtx:e,url:t,documentLoader:n,base:r,cycles:i}){t=s(r,t);const{context:o,remoteDoc:a}=await this._fetchContext({activeCtx:e,url:t,documentLoader:n,cycles:i});d({context:o,base:r=a.documentUrl||t});const l=await this.resolve({activeCtx:e,context:o,documentLoader:n,base:r,cycles:i});return this._cacheResolvedContext({key:t,resolved:l,tag:a.tag}),l}async _fetchContext({activeCtx:e,url:t,documentLoader:n,cycles:a}){if(a.size>10)throw new l("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"json-ld-1.0"===e.processingMode?"loading remote context failed":"context overflow",max:10});if(a.has(t))throw new l("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"json-ld-1.0"===e.processingMode?"recursive context inclusion":"context overflow",url:t});let s,c;a.add(t);try{c=await n(t),s=c.document||null,o(s)&&(s=JSON.parse(s))}catch(e){throw new l("Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.","jsonld.InvalidUrl",{code:"loading remote context failed",url:t,cause:e})}if(!i(s))throw new l("Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.","jsonld.InvalidUrl",{code:"invalid remote context",url:t});return s="@context"in s?{"@context":s["@context"]}:{"@context":{}},c.contextUrl&&(r(s["@context"])||(s["@context"]=[s["@context"]]),s["@context"].push(c.contextUrl)),{context:s,remoteDoc:c}}}},2207:e=>{e.exports=class extends Error{constructor(e="An unspecified JSON-LD error occurred.",t="jsonld.Error",n={}){super(e),this.name=t,this.message=e,this.details=n}}},5445:e=>{e.exports=e=>{class t{toString(){return"[object JsonLdProcessor]"}}return Object.defineProperty(t,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(t.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:t}),t.compact=function(t,n){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):e.compact(t,n)},t.expand=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):e.expand(t)},t.flatten=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):e.flatten(t)},t}},8229:(e,t,n)=>{e.exports=n(989).NQuads},3743:e=>{e.exports=class{constructor(){this._requests={}}wrapLoader(e){const t=this;return t._loader=e,function(){return t.add.apply(t,arguments)}}async add(e){let t=this._requests[e];if(t)return Promise.resolve(t);t=this._requests[e]=this._loader(e);try{return await t}finally{delete this._requests[e]}}}},7532:(e,t,n)=>{const r=n(9749);e.exports=class{constructor({document:e}){this.document=e,this.cache=new r({max:10})}getProcessed(e){return this.cache.get(e)}setProcessed(e,t){this.cache.set(e,t)}}},1058:(e,t,n)=>{const r=n(2207),{isArray:i,isObject:o,isString:a,isUndefined:s}=n(7382),{isList:l,isValue:c,isGraph:u,isSimpleGraph:d,isSubjectReference:h}=n(3978),{expandIri:f,getContextValue:p,isKeyword:g,process:y,processingMode:m}=n(1972),{removeBase:b,prependBase:v}=n(470),{REGEX_KEYWORD:w,addValue:_,asArray:x,compareShortestLeast:S}=n(9263),j={};function I(e,t,n){if("@nest"!==f(e,t,{vocab:!0},n))throw new r("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}e.exports=j,j.compact=async({activeCtx:e,activeProperty:t=null,element:n,options:f={}})=>{if(i(n)){let r=[];for(let i=0;i<n.length;++i){const o=await j.compact({activeCtx:e,activeProperty:t,element:n[i],options:f});null!==o&&r.push(o)}return f.compactArrays&&1===r.length&&0===(p(e,t,"@container")||[]).length&&(r=r[0]),r}const b=p(e,t,"@context");if(s(b)||(e=await y({activeCtx:e,localCtx:b,propagate:!0,overrideProtected:!0,options:f})),o(n)){if(f.link&&"@id"in n&&f.link.hasOwnProperty(n["@id"])){const e=f.link[n["@id"]];for(let t=0;t<e.length;++t)if(e[t].expanded===n)return e[t].compacted}if(c(n)||h(n)){const r=j.compactValue({activeCtx:e,activeProperty:t,value:n,options:f});return f.link&&h(n)&&(f.link.hasOwnProperty(n["@id"])||(f.link[n["@id"]]=[]),f.link[n["@id"]].push({expanded:n,compacted:r})),r}if(l(n)&&(p(e,t,"@container")||[]).includes("@list"))return j.compact({activeCtx:e,activeProperty:t,element:n["@list"],options:f});const b="@reverse"===t,v={},w=e;c(n)||h(n)||(e=e.revertToPreviousContext());const S=p(w,t,"@context");s(S)||(e=await y({activeCtx:e,localCtx:S,propagate:!0,overrideProtected:!0,options:f})),f.link&&"@id"in n&&(f.link.hasOwnProperty(n["@id"])||(f.link[n["@id"]]=[]),f.link[n["@id"]].push({expanded:n,compacted:v}));let E=n["@type"]||[];E.length>1&&(E=Array.from(E).sort());const N=e;for(const t of E){const n=j.compactIri({activeCtx:N,iri:t,relativeTo:{vocab:!0}}),r=p(w,n,"@context");s(r)||(e=await y({activeCtx:e,localCtx:r,options:f,propagate:!1}))}const T=Object.keys(n).sort();for(const s of T){const h=n[s];if("@id"!==s)if("@type"!==s)if("@reverse"!==s)if("@preserve"!==s)if("@index"!==s)if("@graph"!==s&&"@list"!==s&&"@included"!==s&&g(s)){const t=j.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});_(v,t,h)}else{if(!i(h))throw new r("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(0===h.length){const t=j.compactIri({activeCtx:e,iri:s,value:h,relativeTo:{vocab:!0},reverse:b}),n=e.mappings.has(t)?e.mappings.get(t)["@nest"]:null;let r=v;n&&(I(e,n,f),o(v[n])||(v[n]={}),r=v[n]),_(r,t,h,{propertyIsArray:!0})}for(const t of h){const n=j.compactIri({activeCtx:e,iri:s,value:t,relativeTo:{vocab:!0},reverse:b}),r=e.mappings.has(n)?e.mappings.get(n)["@nest"]:null;let h=v;r&&(I(e,r,f),o(v[r])||(v[r]={}),h=v[r]);const g=p(e,n,"@container")||[],y=u(t),m=l(t);let w;m?w=t["@list"]:y&&(w=t["@graph"]);let S=await j.compact({activeCtx:e,activeProperty:n,element:m||y?w:t,options:f});if(m){if(i(S)||(S=[S]),g.includes("@list")){_(h,n,S,{valueIsArray:!0,allowDuplicate:!0});continue}S={[j.compactIri({activeCtx:e,iri:"@list",relativeTo:{vocab:!0}})]:S},"@index"in t&&(S[j.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=t["@index"])}if(y)if(g.includes("@graph")&&(g.includes("@id")||g.includes("@index")&&d(t))){let r;h.hasOwnProperty(n)?r=h[n]:h[n]=r={};const i=(g.includes("@id")?t["@id"]:t["@index"])||j.compactIri({activeCtx:e,iri:"@none",relativeTo:{vocab:!0}});_(r,i,S,{propertyIsArray:!f.compactArrays||g.includes("@set")})}else g.includes("@graph")&&d(t)?(i(S)&&S.length>1&&(S={"@included":S}),_(h,n,S,{propertyIsArray:!f.compactArrays||g.includes("@set")})):(i(S)&&1===S.length&&f.compactArrays&&(S=S[0]),S={[j.compactIri({activeCtx:e,iri:"@graph",relativeTo:{vocab:!0}})]:S},"@id"in t&&(S[j.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]=t["@id"]),"@index"in t&&(S[j.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=t["@index"]),_(h,n,S,{propertyIsArray:!f.compactArrays||g.includes("@set")}));else if(g.includes("@language")||g.includes("@index")||g.includes("@id")||g.includes("@type")){let r,i;if(h.hasOwnProperty(n)?r=h[n]:h[n]=r={},g.includes("@language"))c(S)&&(S=S["@value"]),i=t["@language"];else if(g.includes("@index")){const r=p(e,n,"@index")||"@index",o=j.compactIri({activeCtx:e,iri:r,relativeTo:{vocab:!0}});if("@index"===r)i=t["@index"],delete S[o];else{let e;if([i,...e]=x(S[r]||[]),a(i))switch(e.length){case 0:delete S[r];break;case 1:S[r]=e[0];break;default:S[r]=e}else i=null}}else if(g.includes("@id")){const t=j.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}});i=S[t],delete S[t]}else if(g.includes("@type")){const r=j.compactIri({activeCtx:e,iri:"@type",relativeTo:{vocab:!0}});let o;switch([i,...o]=x(S[r]||[]),o.length){case 0:delete S[r];break;case 1:S[r]=o[0];break;default:S[r]=o}1===Object.keys(S).length&&"@id"in t&&(S=await j.compact({activeCtx:e,activeProperty:n,element:{"@id":t["@id"]},options:f}))}i||(i=j.compactIri({activeCtx:e,iri:"@none",relativeTo:{vocab:!0}})),_(r,i,S,{propertyIsArray:g.includes("@set")})}else{const e=!f.compactArrays||g.includes("@set")||g.includes("@list")||i(S)&&0===S.length||"@list"===s||"@graph"===s;_(h,n,S,{propertyIsArray:e})}}}else{if((p(e,t,"@container")||[]).includes("@index"))continue;const n=j.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});_(v,n,h)}else{const n=await j.compact({activeCtx:e,activeProperty:t,element:h,options:f});i(n)&&0===n.length||_(v,s,n)}else{const t=await j.compact({activeCtx:e,activeProperty:"@reverse",element:h,options:f});for(const n in t)if(e.mappings.has(n)&&e.mappings.get(n).reverse){const r=t[n],i=(p(e,n,"@container")||[]).includes("@set")||!f.compactArrays;_(v,n,r,{propertyIsArray:i}),delete t[n]}if(Object.keys(t).length>0){const n=j.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});_(v,n,t)}}else{let t=x(h).map((e=>j.compactIri({activeCtx:w,iri:e,relativeTo:{vocab:!0}})));1===t.length&&(t=t[0]);const n=j.compactIri({activeCtx:e,iri:"@type",relativeTo:{vocab:!0}}),r=(p(e,n,"@container")||[]).includes("@set")&&m(e,1.1)||i(t)&&0===h.length;_(v,n,t,{propertyIsArray:r})}else{let t=x(h).map((t=>j.compactIri({activeCtx:e,iri:t,relativeTo:{vocab:!1},base:f.base})));1===t.length&&(t=t[0]),v[j.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]=t}}return v}return n},j.compactIri=({activeCtx:e,iri:t,value:n=null,relativeTo:i={vocab:!1},reverse:a=!1,base:s=null})=>{if(null===t)return t;e.isPropertyTermScoped&&e.previousContext&&(e=e.previousContext);const d=e.getInverse();if(g(t)&&t in d&&"@none"in d[t]&&"@type"in d[t]["@none"]&&"@none"in d[t]["@none"]["@type"])return d[t]["@none"]["@type"]["@none"];if(i.vocab&&t in d){const r=e["@language"]||"@none",i=[];o(n)&&"@index"in n&&!("@graph"in n)&&i.push("@index","@index@set"),o(n)&&"@preserve"in n&&(n=n["@preserve"][0]),u(n)?("@index"in n&&i.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in n&&i.push("@graph@id","@graph@id@set"),i.push("@graph","@graph@set","@set"),"@index"in n||i.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in n||i.push("@graph@id","@graph@id@set")):o(n)&&!c(n)&&i.push("@id","@id@set","@type","@set@type");let s="@language",d="@null";if(a)s="@type",d="@reverse",i.push("@set");else if(l(n)){"@index"in n||i.push("@list");const e=n["@list"];if(0===e.length)s="@any",d="@none";else{let t=0===e.length?r:null,n=null;for(let r=0;r<e.length;++r){const i=e[r];let o="@none",a="@none";if(c(i)?"@direction"in i?o=`${(i["@language"]||"").toLowerCase()}_${i["@direction"]}`:"@language"in i?o=i["@language"].toLowerCase():"@type"in i?a=i["@type"]:o="@null":a="@id",null===t?t=o:o!==t&&c(i)&&(t="@none"),null===n?n=a:a!==n&&(n="@none"),"@none"===t&&"@none"===n)break}t=t||"@none",n=n||"@none","@none"!==n?(s="@type",d=n):d=t}}else{if(c(n))if("@language"in n&&!("@index"in n)){i.push("@language","@language@set"),d=n["@language"];const e=n["@direction"];e&&(d=`${d}_${e}`)}else"@direction"in n&&!("@index"in n)?d=`_${n["@direction"]}`:"@type"in n&&(s="@type",d=n["@type"]);else s="@type",d="@id";i.push("@set")}i.push("@none"),o(n)&&!("@index"in n)&&i.push("@index","@index@set"),c(n)&&1===Object.keys(n).length&&i.push("@language","@language@set");const h=function(e,t,n,r,i,a){null===a&&(a="@null");const s=[];if(("@id"===a||"@reverse"===a)&&o(n)&&"@id"in n){"@reverse"===a&&s.push("@reverse");const t=j.compactIri({activeCtx:e,iri:n["@id"],relativeTo:{vocab:!0}});e.mappings.has(t)&&e.mappings.get(t)&&e.mappings.get(t)["@id"]===n["@id"]?s.push.apply(s,["@vocab","@id"]):s.push.apply(s,["@id","@vocab"])}else{s.push(a);const e=s.find((e=>e.includes("_")));e&&s.push(e.replace(/^[^_]+_/,"_"))}s.push("@none");const l=e.inverse[t];for(const e of r){if(!(e in l))continue;const t=l[e][i];for(const e of s)if(e in t)return t[e]}return null}(e,t,n,i,s,d);if(null!==h)return h}if(i.vocab&&"@vocab"in e){const n=e["@vocab"];if(0===t.indexOf(n)&&t!==n){const r=t.substr(n.length);if(!e.mappings.has(r))return r}}let h=null;const f=[];let p=e.fastCurieMap;const y=t.length-1;for(let e=0;e<y&&t[e]in p;++e)p=p[t[e]],""in p&&f.push(p[""][0]);for(let r=f.length-1;r>=0;--r){const i=f[r],o=i.terms;for(const r of o){const o=r+":"+t.substr(i.iri.length);e.mappings.get(r)._prefix&&(!e.mappings.has(o)||null===n&&e.mappings.get(o)["@id"]===t)&&(null===h||S(o,h)<0)&&(h=o)}}if(null!==h)return h;for(const[n,i]of e.mappings)if(i&&i._prefix&&t.startsWith(n+":"))throw new r(`Absolute IRI "${t}" confused with prefix "${n}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:e});if(!i.vocab){if("@base"in e){if(e["@base"]){const n=b(v(s,e["@base"]),t);return w.test(n)?`./${n}`:n}return t}return b(s,t)}return t},j.compactValue=({activeCtx:e,activeProperty:t,value:n,options:r})=>{if(c(n)){const r=p(e,t,"@type"),i=p(e,t,"@language"),o=p(e,t,"@direction"),s=p(e,t,"@container")||[],l="@index"in n&&!s.includes("@index");if(!l&&"@none"!==r){if(n["@type"]===r)return n["@value"];if("@language"in n&&n["@language"]===i&&"@direction"in n&&n["@direction"]===o)return n["@value"];if("@language"in n&&n["@language"]===i)return n["@value"];if("@direction"in n&&n["@direction"]===o)return n["@value"]}const c=Object.keys(n).length,u=1===c||2===c&&"@index"in n&&!l,d="@language"in e,h=a(n["@value"]),f=e.mappings.has(t)&&null===e.mappings.get(t)["@language"];if(u&&"@none"!==r&&(!d||!h||f))return n["@value"];const g={};return l&&(g[j.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=n["@index"]),"@type"in n?g[j.compactIri({activeCtx:e,iri:"@type",relativeTo:{vocab:!0}})]=j.compactIri({activeCtx:e,iri:n["@type"],relativeTo:{vocab:!0}}):"@language"in n&&(g[j.compactIri({activeCtx:e,iri:"@language",relativeTo:{vocab:!0}})]=n["@language"]),"@direction"in n&&(g[j.compactIri({activeCtx:e,iri:"@direction",relativeTo:{vocab:!0}})]=n["@direction"]),g[j.compactIri({activeCtx:e,iri:"@value",relativeTo:{vocab:!0}})]=n["@value"],g}const i=f(e,t,{vocab:!0},r),o=p(e,t,"@type"),s=j.compactIri({activeCtx:e,iri:n["@id"],relativeTo:{vocab:"@vocab"===o},base:r.base});return"@id"===o||"@vocab"===o||"@graph"===i?s:{[j.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]:s}}},9378:e=>{const t="http://www.w3.org/1999/02/22-rdf-syntax-ns#",n="http://www.w3.org/2001/XMLSchema#";e.exports={LINK_HEADER_REL:"http://www.w3.org/ns/json-ld#context",LINK_HEADER_CONTEXT:"http://www.w3.org/ns/json-ld#context",RDF:t,RDF_LIST:t+"List",RDF_FIRST:t+"first",RDF_REST:t+"rest",RDF_NIL:t+"nil",RDF_TYPE:t+"type",RDF_PLAIN_LITERAL:t+"PlainLiteral",RDF_XML_LITERAL:t+"XMLLiteral",RDF_JSON_LITERAL:t+"JSON",RDF_OBJECT:t+"object",RDF_LANGSTRING:t+"langString",XSD:n,XSD_BOOLEAN:n+"boolean",XSD_DOUBLE:n+"double",XSD_INTEGER:n+"integer",XSD_STRING:n+"string"}},1972:(e,t,n)=>{const r=n(9263),i=n(2207),{isArray:o,isObject:a,isString:s,isUndefined:l}=n(7382),{isAbsolute:c,isRelative:u,prependBase:d}=n(470),{handleEvent:h}=n(2246),{REGEX_BCP47:f,REGEX_KEYWORD:p,asArray:g,compareShortestLeast:y}=n(9263),m=new Map,b={};function v(e,t,n,r,i,o){if(null===t||!s(t)||b.isKeyword(t))return t;if(t.match(p))return null;if(r&&r.hasOwnProperty(t)&&!0!==i.get(t)&&b.createTermDefinition({activeCtx:e,localCtx:r,term:t,defined:i,options:o}),(n=n||{}).vocab){const n=e.mappings.get(t);if(null===n)return null;if(a(n)&&"@id"in n)return n["@id"]}const l=t.indexOf(":");if(l>0){const n=t.substr(0,l),a=t.substr(l+1);if("_"===n||0===a.indexOf("//"))return t;r&&r.hasOwnProperty(n)&&b.createTermDefinition({activeCtx:e,localCtx:r,term:n,defined:i,options:o});const s=e.mappings.get(n);if(s&&s._prefix)return s["@id"]+a;if(c(t))return t}if(n.vocab&&"@vocab"in e)t=e["@vocab"]+t;else if(n.base){let n,r;"@base"in e?e["@base"]?(r=d(o.base,e["@base"]),n=d(r,t)):(r=e["@base"],n=t):(r=o.base,n=d(o.base,t)),t=n}return t}function w(e,t){if(!e||"object"!=typeof e||!t||"object"!=typeof t)return e===t;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!w(e[n],t[n]))return!1;return!0}const r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(const n in e){let r=e[n],i=t[n];if("@container"===n&&Array.isArray(r)&&Array.isArray(i)&&(r=r.slice().sort(),i=i.slice().sort()),!w(r,i))return!1}return!0}e.exports=b,b.process=async({activeCtx:e,localCtx:t,options:n,propagate:r=!0,overrideProtected:l=!1,cycles:p=new Set})=>{if(a(t)&&"@context"in t&&o(t["@context"])&&(t=t["@context"]),0===g(t).length)return e;const y=[],m=[({event:e,next:t})=>{y.push(e),t()}];n.eventHandler&&m.push(n.eventHandler);const w=n;n={...n,eventHandler:m};const _=await n.contextResolver.resolve({activeCtx:e,context:t,documentLoader:n.documentLoader,base:n.base});a(_[0].document)&&"boolean"==typeof _[0].document["@propagate"]&&(r=_[0].document["@propagate"]);let x=e;r||x.previousContext||(x=x.clone(),x.previousContext=e);for(const r of _){let{document:o}=r;if(e=x,null===o){if(!l&&0!==Object.keys(e.protected).length)throw new i("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});x=e=b.getInitialContext(n).clone();continue}const g=r.getProcessed(e);if(g){if(w.eventHandler)for(const e of g.events)h({event:e,options:w});x=e=g.context;continue}if(a(o)&&"@context"in o&&(o=o["@context"]),!a(o))throw new i("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:o});x=x.clone();const m=new Map;if("@version"in o){if(1.1!==o["@version"])throw new i("Unsupported JSON-LD version: "+o["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:o});if(e.processingMode&&"json-ld-1.0"===e.processingMode)throw new i("@version: "+o["@version"]+" not compatible with "+e.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:o});x.processingMode="json-ld-1.1",x["@version"]=o["@version"],m.set("@version",!0)}if(x.processingMode=x.processingMode||e.processingMode,"@base"in o){let e=o["@base"];if(null===e||c(e));else{if(!u(e))throw new i('Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI, a relative IRI, or null.',"jsonld.SyntaxError",{code:"invalid base IRI",context:o});e=d(x["@base"],e)}x["@base"]=e,m.set("@base",!0)}if("@vocab"in o){const e=o["@vocab"];if(null===e)delete x["@vocab"];else{if(!s(e))throw new i('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:o});if(!c(e)&&b.processingMode(x,1))throw new i('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:o});{const t=v(x,e,{vocab:!0,base:!0},void 0,void 0,n);c(t)||n.eventHandler&&h({event:{type:["JsonLdEvent"],code:"relative @vocab reference",level:"warning",message:"Relative @vocab reference found.",details:{vocab:t}},options:n}),x["@vocab"]=t}}m.set("@vocab",!0)}if("@language"in o){const e=o["@language"];if(null===e)delete x["@language"];else{if(!s(e))throw new i('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:o});e.match(f)||n.eventHandler&&h({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:e}},options:n}),x["@language"]=e.toLowerCase()}m.set("@language",!0)}if("@direction"in o){const t=o["@direction"];if("json-ld-1.0"===e.processingMode)throw new i("Invalid JSON-LD syntax; @direction not compatible with "+e.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:o});if(null===t)delete x["@direction"];else{if("ltr"!==t&&"rtl"!==t)throw new i('Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:o});x["@direction"]=t}m.set("@direction",!0)}if("@propagate"in o){const n=o["@propagate"];if("json-ld-1.0"===e.processingMode)throw new i("Invalid JSON-LD syntax; @propagate not compatible with "+e.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:o});if("boolean"!=typeof n)throw new i("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:t});m.set("@propagate",!0)}if("@import"in o){const r=o["@import"];if("json-ld-1.0"===e.processingMode)throw new i("Invalid JSON-LD syntax; @import not compatible with "+e.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:o});if(!s(r))throw new i("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:t});const a=await n.contextResolver.resolve({activeCtx:e,context:r,documentLoader:n.documentLoader,base:n.base});if(1!==a.length)throw new i("Invalid JSON-LD syntax; @import must reference a single context.","jsonld.SyntaxError",{code:"invalid remote context",context:t});const l=a[0].getProcessed(e);if(l)o=l;else{const n=a[0].document;if("@import"in n)throw new i("Invalid JSON-LD syntax: imported context must not include @import.","jsonld.SyntaxError",{code:"invalid context entry",context:t});for(const e in n)o.hasOwnProperty(e)||(o[e]=n[e]);a[0].setProcessed(e,o)}m.set("@import",!0)}m.set("@protected",o["@protected"]||!1);for(const e in o)if(b.createTermDefinition({activeCtx:x,localCtx:o,term:e,defined:m,options:n,overrideProtected:l}),a(o[e])&&"@context"in o[e]){const t=o[e]["@context"];let r=!0;if(s(t)){const e=d(n.base,t);p.has(e)?r=!1:p.add(e)}if(r)try{await b.process({activeCtx:x.clone(),localCtx:o[e]["@context"],overrideProtected:!0,options:n,cycles:p})}catch(t){throw new i("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:o[e]["@context"],term:e})}}r.setProcessed(e,{context:x,events:y})}return x},b.createTermDefinition=({activeCtx:e,localCtx:t,term:n,defined:r,options:l,overrideProtected:u=!1})=>{if(r.has(n)){if(r.get(n))return;throw new i("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:t,term:n})}let d;if(r.set(n,!1),t.hasOwnProperty(n)&&(d=t[n]),"@type"===n&&a(d)&&"@set"===(d["@container"]||"@set")&&b.processingMode(e,1.1)){const e=["@container","@id","@protected"],r=Object.keys(d);if(0===r.length||r.some((t=>!e.includes(t))))throw new i("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:t,term:n})}else{if(b.isKeyword(n))throw new i("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:t,term:n});if(n.match(p))return void(l.eventHandler&&h({event:{type:["JsonLdEvent"],code:"reserved term",level:"warning",message:'Terms beginning with "@" are reserved for future use and dropped.',details:{term:n}},options:l}));if(""===n)throw new i("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:t})}const f=e.mappings.get(n);e.mappings.has(n)&&e.mappings.delete(n);let g=!1;if((s(d)||null===d)&&(g=!0,d={"@id":d}),!a(d))throw new i("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:t});const y={};e.mappings.set(n,y),y.reverse=!1;const m=["@container","@id","@language","@reverse","@type"];b.processingMode(e,1.1)&&m.push("@context","@direction","@index","@nest","@prefix","@protected");for(const e in d)if(!m.includes(e))throw new i("Invalid JSON-LD syntax; a term definition must not contain "+e,"jsonld.SyntaxError",{code:"invalid term definition",context:t});const _=n.indexOf(":");if(y._termHasColon=_>0,"@reverse"in d){if("@id"in d)throw new i("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});if("@nest"in d)throw new i("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});const o=d["@reverse"];if(!s(o))throw new i("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});if(o.match(p))return l.eventHandler&&h({event:{type:["JsonLdEvent"],code:"reserved @reverse value",level:"warning",message:'@reverse values beginning with "@" are reserved for future use and dropped.',details:{reverse:o}},options:l}),void(f?e.mappings.set(n,f):e.mappings.delete(n));const a=v(e,o,{vocab:!0,base:!1},t,r,l);if(!c(a))throw new i("Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});y["@id"]=a,y.reverse=!0}else if("@id"in d){let o=d["@id"];if(o&&!s(o))throw new i("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});if(null===o)y["@id"]=null;else{if(!b.isKeyword(o)&&o.match(p))return l.eventHandler&&h({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:'@id values beginning with "@" are reserved for future use and dropped.',details:{id:o}},options:l}),void(f?e.mappings.set(n,f):e.mappings.delete(n));if(o!==n){if(o=v(e,o,{vocab:!0,base:!1},t,r,l),!c(o)&&!b.isKeyword(o))throw new i("Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});if(n.match(/(?::[^:])|\//)&&v(e,n,{vocab:!0,base:!1},t,new Map(r).set(n,!0),l)!==o)throw new i("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});y["@id"]=o,y._prefix=g&&!y._termHasColon&&null!==o.match(/[:\/\?#\[\]@]$/)}}}if(!("@id"in y))if(y._termHasColon){const i=n.substr(0,_);if(t.hasOwnProperty(i)&&b.createTermDefinition({activeCtx:e,localCtx:t,term:i,defined:r,options:l}),e.mappings.has(i)){const t=n.substr(_+1);y["@id"]=e.mappings.get(i)["@id"]+t}else y["@id"]=n}else if("@type"===n)y["@id"]=n;else{if(!("@vocab"in e))throw new i("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t,term:n});y["@id"]=e["@vocab"]+n}if((!0===d["@protected"]||!0===r.get("@protected")&&!1!==d["@protected"])&&(e.protected[n]=!0,y.protected=!0),r.set(n,!0),"@type"in d){let n=d["@type"];if(!s(n))throw new i("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if("@json"===n||"@none"===n){if(b.processingMode(e,1))throw new i(`Invalid JSON-LD syntax; an @context @type value must not be "${n}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:t})}else if("@id"!==n&&"@vocab"!==n){if(n=v(e,n,{vocab:!0,base:!1},t,r,l),!c(n))throw new i("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if(0===n.indexOf("_:"))throw new i("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:t})}y["@type"]=n}if("@container"in d){const n=s(d["@container"])?[d["@container"]]:d["@container"]||[],r=["@list","@set","@index","@language"];let a=!0;const l=n.includes("@set");if(b.processingMode(e,1.1)){if(r.push("@graph","@id","@type"),n.includes("@list")){if(1!==n.length)throw new i("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:t})}else if(n.includes("@graph")){if(n.some((e=>"@graph"!==e&&"@id"!==e&&"@index"!==e&&"@set"!==e)))throw new i("Invalid JSON-LD syntax; @context @container with @graph must have no other values other than @id, @index, and @set","jsonld.SyntaxError",{code:"invalid container mapping",context:t})}else a&=n.length<=(l?2:1);if(n.includes("@type")&&(y["@type"]=y["@type"]||"@id",!["@id","@vocab"].includes(y["@type"])))throw new i("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:t})}else a&=!o(d["@container"]),a&=n.length<=1;if(a&=n.every((e=>r.includes(e))),a&=!(l&&n.includes("@list")),!a)throw new i("Invalid JSON-LD syntax; @context @container value must be one of the following: "+r.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:t});if(y.reverse&&!n.every((e=>["@index","@set"].includes(e))))throw new i("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});y["@container"]=n}if("@index"in d){if(!("@container"in d)||!y["@container"].includes("@index"))throw new i(`Invalid JSON-LD syntax; @index without @index in @container: "${d["@index"]}" on term "${n}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:t});if(!s(d["@index"])||0===d["@index"].indexOf("@"))throw new i(`Invalid JSON-LD syntax; @index must expand to an IRI: "${d["@index"]}" on term "${n}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:t});y["@index"]=d["@index"]}if("@context"in d&&(y["@context"]=d["@context"]),"@language"in d&&!("@type"in d)){let e=d["@language"];if(null!==e&&!s(e))throw new i("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:t});null!==e&&(e=e.toLowerCase()),y["@language"]=e}if("@prefix"in d){if(n.match(/:|\//))throw new i("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:t});if(b.isKeyword(y["@id"]))throw new i("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:t});if("boolean"!=typeof d["@prefix"])throw new i("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:t});y._prefix=!0===d["@prefix"]}if("@direction"in d){const e=d["@direction"];if(null!==e&&"ltr"!==e&&"rtl"!==e)throw new i('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:t});y["@direction"]=e}if("@nest"in d){const e=d["@nest"];if(!s(e)||"@nest"!==e&&0===e.indexOf("@"))throw new i("Invalid JSON-LD syntax; @context @nest value must be a string which is not a keyword other than @nest.","jsonld.SyntaxError",{code:"invalid @nest value",context:t});y["@nest"]=e}const x=y["@id"];if("@context"===x||"@preserve"===x)throw new i("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:t});if(f&&f.protected&&!u&&(e.protected[n]=!0,y.protected=!0,!w(f,y)))throw new i("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:t,term:n})},b.expandIri=(e,t,n,r)=>v(e,t,n,void 0,void 0,r),b.getInitialContext=e=>{const t=JSON.stringify({processingMode:e.processingMode}),n=m.get(t);if(n)return n;const i={processingMode:e.processingMode,mappings:new Map,inverse:null,getInverse:function(){const e=this;if(e.inverse)return e.inverse;const t=e.inverse={},n=e.fastCurieMap={},r={},i=(e["@language"]||"@none").toLowerCase(),s=e["@direction"],l=e.mappings,c=[...l.keys()].sort(y);for(const e of c){const o=l.get(e);if(null===o)continue;let c=o["@container"]||"@none";if(c=[].concat(c).sort().join(""),null===o["@id"])continue;const u=g(o["@id"]);for(const l of u){let u=t[l];const d=b.isKeyword(l);if(u)d||o._termHasColon||r[l].push(e);else if(t[l]=u={},!d&&!o._termHasColon){r[l]=[e];const t={iri:l,terms:r[l]};l[0]in n?n[l[0]].push(t):n[l[0]]=[t]}if(u[c]||(u[c]={"@language":{},"@type":{},"@any":{}}),u=u[c],a(e,u["@any"],"@none"),o.reverse)a(e,u["@type"],"@reverse");else if("@none"===o["@type"])a(e,u["@any"],"@none"),a(e,u["@language"],"@none"),a(e,u["@type"],"@none");else if("@type"in o)a(e,u["@type"],o["@type"]);else if("@language"in o&&"@direction"in o){const t=o["@language"],n=o["@direction"];a(e,u["@language"],t&&n?`${t}_${n}`.toLowerCase():t?t.toLowerCase():n?`_${n}`:"@null")}else"@language"in o?a(e,u["@language"],(o["@language"]||"@null").toLowerCase()):"@direction"in o?o["@direction"]?a(e,u["@language"],`_${o["@direction"]}`):a(e,u["@language"],"@none"):s?(a(e,u["@language"],`_${s}`),a(e,u["@language"],"@none"),a(e,u["@type"],"@none")):(a(e,u["@language"],i),a(e,u["@language"],"@none"),a(e,u["@type"],"@none"))}}for(const e in n)o(n,e,1);return t},clone:function(){const e={};return e.mappings=r.clone(this.mappings),e.clone=this.clone,e.inverse=null,e.getInverse=this.getInverse,e.protected=r.clone(this.protected),this.previousContext&&(e.previousContext=this.previousContext.clone()),e.revertToPreviousContext=this.revertToPreviousContext,"@base"in this&&(e["@base"]=this["@base"]),"@language"in this&&(e["@language"]=this["@language"]),"@vocab"in this&&(e["@vocab"]=this["@vocab"]),e},revertToPreviousContext:function(){return this.previousContext?this.previousContext.clone():this},protected:{}};return 1e4===m.size&&m.clear(),m.set(t,i),i;function o(e,t,n){const r=e[t],i=e[t]={};let a,s;for(const e of r)a=e.iri,s=n>=a.length?"":a[n],s in i?i[s].push(e):i[s]=[e];for(const e in i)""!==e&&o(i,e,n+1)}function a(e,t,n){t.hasOwnProperty(n)||(t[n]=e)}},b.getContextValue=(e,t,n)=>{if(null===t){if("@context"===n)return;return null}if(e.mappings.has(t)){const r=e.mappings.get(t);if(l(n))return r;if(r.hasOwnProperty(n))return r[n]}return"@language"===n&&n in e||"@direction"===n&&n in e?e[n]:"@context"!==n?null:void 0},b.processingMode=(e,t)=>t.toString()>="1.1"?!e.processingMode||e.processingMode>="json-ld-"+t.toString():"json-ld-1.0"===e.processingMode,b.isKeyword=e=>{if(!s(e)||"@"!==e[0])return!1;switch(e){case"@base":case"@container":case"@context":case"@default":case"@direction":case"@embed":case"@explicit":case"@graph":case"@id":case"@included":case"@index":case"@json":case"@language":case"@list":case"@nest":case"@none":case"@omitDefault":case"@prefix":case"@preserve":case"@protected":case"@requireAll":case"@reverse":case"@set":case"@type":case"@value":case"@version":case"@vocab":return!0}return!1}},6957:(e,t,n)=>{const{parseLinkHeader:r,buildHeaders:i}=n(9263),{LINK_HEADER_CONTEXT:o}=n(9378),a=n(2207),s=n(3743),{prependBase:l}=n(470),c=/(^|(\r\n))link:/i;e.exports=({secure:e,headers:t={},xhr:n}={headers:{}})=>(t=i(t),(new s).wrapLoader((async function i(s){if(0!==s.indexOf("http:")&&0!==s.indexOf("https:"))throw new a('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:s});if(e&&0!==s.indexOf("https"))throw new a('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:s});let u;try{u=await function(e,t,n){const r=new(e=e||XMLHttpRequest);return new Promise(((e,i)=>{r.onload=()=>e(r),r.onerror=e=>i(e),r.open("GET",t,!0);for(const e in n)r.setRequestHeader(e,n[e]);r.send()}))}(n,s,t)}catch(e){throw new a("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:s,cause:e})}if(u.status>=400)throw new a("URL could not be dereferenced: "+u.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:s,httpStatusCode:u.status});let d={contextUrl:null,documentUrl:s,document:u.response},h=null;const f=u.getResponseHeader("Content-Type");let p;if(c.test(u.getAllResponseHeaders())&&(p=u.getResponseHeader("Link")),p&&"application/ld+json"!==f){const e=r(p),t=e[o];if(Array.isArray(t))throw new a("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:s});t&&(d.contextUrl=t.target),h=e.alternate,h&&"application/ld+json"==h.type&&!(f||"").match(/^application\/(\w*\+)?json$/)&&(d=await i(l(s,h.target)))}return d})))},2246:(e,t,n)=>{const r=n(2207),{isArray:i}=n(7382),{asArray:o}=n(9263),a={};function s({event:e,handlers:t}){let n=!0;for(let o=0;n&&o<t.length;++o){n=!1;const a=t[o];if(i(a))n=s({event:e,handlers:a});else if("function"==typeof a)a({event:e,next:()=>{n=!0}});else{if("object"!=typeof a)throw new r("Invalid event handler.","jsonld.InvalidEventHandler",{event:e});e.code in a?a[e.code]({event:e,next:()=>{n=!0}}):n=!0}}return n}e.exports=a,a.defaultEventHandler=null,a.setupEventHandler=({options:e={}})=>{const t=[].concat(e.safe?a.safeEventHandler:[],e.eventHandler?o(e.eventHandler):[],a.defaultEventHandler?a.defaultEventHandler:[]);return 0===t.length?null:t},a.handleEvent=({event:e,options:t})=>{s({event:e,handlers:t.eventHandler})};const l=new Set(["empty object","free-floating scalar","invalid @language value","invalid property","null @id value","null @value value","object with only @id","object with only @language","object with only @list","object with only @value","relative @id reference","relative @type reference","relative @vocab reference","reserved @id value","reserved @reverse value","reserved term","blank node predicate","relative graph reference","relative object reference","relative predicate reference","relative subject reference","rdfDirection not set"]);a.safeEventHandler=function({event:e,next:t}){if("warning"===e.level&&l.has(e.code))throw new r("Safe mode validation error.","jsonld.ValidationError",{event:e});t()},a.logEventHandler=function({event:e,next:t}){console.log(`EVENT: ${e.message}`,{event:e}),t()},a.logWarningEventHandler=function({event:e,next:t}){"warning"===e.level&&console.warn(`WARNING: ${e.message}`,{event:e}),t()},a.unhandledEventHandler=function({event:e}){throw new r("No handler for event.","jsonld.UnhandledEvent",{event:e})},a.setDefaultEventHandler=function({eventHandler:e}={}){a.defaultEventHandler=e?o(e):null}},4019:(e,t,n)=>{const r=n(2207),{isArray:i,isObject:o,isEmptyObject:a,isString:s,isUndefined:l}=n(7382),{isList:c,isValue:u,isGraph:d,isSubject:h}=n(3978),{expandIri:f,getContextValue:p,isKeyword:g,process:y,processingMode:m}=n(1972),{isAbsolute:b}=n(470),{REGEX_BCP47:v,REGEX_KEYWORD:w,addValue:_,asArray:x,getValues:S,validateTypeValue:j}=n(9263),{handleEvent:I}=n(2246),E={};function N({value:e,count:t,options:n}){if(0===t||"@value"in e||"@list"in e||1===t&&"@id"in e){if(n.eventHandler){let r,i;0===t?(r="empty object",i="Dropping empty object."):"@value"in e?(r="object with only @value",i="Dropping object with only @value."):"@list"in e?(r="object with only @list",i="Dropping object with only @list."):1===t&&"@id"in e&&(r="object with only @id",i="Dropping object with only @id."),I({event:{type:["JsonLdEvent"],code:r,level:"warning",message:i,details:{value:e}},options:n})}return null}return e}async function T({activeCtx:e,activeProperty:t,expandedActiveProperty:n,element:d,expandedParent:w,options:S={},insideList:R,typeKey:L,typeScopedContext:A}){const C=Object.keys(d).sort(),D=[];let M;const P=d[L]&&"@json"===f(e,i(d[L])?d[L][0]:d[L],{vocab:!0},{...S,typeExpansion:!0});for(const T of C){let R,L=d[T];if("@context"===T)continue;const C=f(e,T,{vocab:!0},S);if(null===C||!b(C)&&!g(C)){S.eventHandler&&I({event:{type:["JsonLdEvent"],code:"invalid property",level:"warning",message:"Dropping property that did not expand into an absolute IRI or keyword.",details:{property:T,expandedProperty:C}},options:S});continue}if(g(C)){if("@reverse"===n)throw new r("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:L});if(C in w&&"@included"!==C&&"@type"!==C)throw new r("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:C})}if("@id"===C){if(!s(L)){if(!S.isFrame)throw new r('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:L});if(o(L)){if(!a(L))throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:L})}else{if(!i(L))throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:L});if(!L.every((e=>s(e))))throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:L})}}_(w,"@id",x(L).map((t=>{if(s(t)){const n=f(e,t,{base:!0},S);return S.eventHandler&&(null===n?I(null===t?{event:{type:["JsonLdEvent"],code:"null @id value",level:"warning",message:"Null @id found.",details:{id:t}},options:S}:{event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:t}},options:S}):b(n)||I({event:{type:["JsonLdEvent"],code:"relative @id reference",level:"warning",message:"Relative @id reference found.",details:{id:t,expandedId:n}},options:S})),n}return t})),{propertyIsArray:S.isFrame});continue}if("@type"===C){o(L)&&(L=Object.fromEntries(Object.entries(L).map((([e,t])=>[f(A,e,{vocab:!0}),x(t).map((e=>f(A,e,{base:!0,vocab:!0},{...S,typeExpansion:!0})))])))),j(L,S.isFrame),_(w,"@type",x(L).map((e=>{if(s(e)){const t=f(A,e,{base:!0,vocab:!0},{...S,typeExpansion:!0});return"@json"===t||b(t)||S.eventHandler&&I({event:{type:["JsonLdEvent"],code:"relative @type reference",level:"warning",message:"Relative @type reference found.",details:{type:e}},options:S}),t}return e})),{propertyIsArray:!!S.isFrame});continue}if("@included"===C&&m(e,1.1)){const n=x(await E.expand({activeCtx:e,activeProperty:t,element:L,options:S}));if(!n.every((e=>h(e))))throw new r("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:L});_(w,"@included",n,{propertyIsArray:!0});continue}if("@graph"===C&&!o(L)&&!i(L))throw new r('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:L});if("@value"===C){M=L,P&&m(e,1.1)?w["@value"]=L:_(w,"@value",L,{propertyIsArray:S.isFrame});continue}if("@language"===C){if(null===L)continue;if(!s(L)&&!S.isFrame)throw new r('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:L});L=x(L).map((e=>s(e)?e.toLowerCase():e));for(const e of L)s(e)&&!e.match(v)&&S.eventHandler&&I({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:e}},options:S});_(w,"@language",L,{propertyIsArray:S.isFrame});continue}if("@direction"===C){if(!s(L)&&!S.isFrame)throw new r('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:L});L=x(L);for(const e of L)if(s(e)&&"ltr"!==e&&"rtl"!==e)throw new r('Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",value:L});_(w,"@direction",L,{propertyIsArray:S.isFrame});continue}if("@index"===C){if(!s(L))throw new r('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:L});_(w,"@index",L);continue}if("@reverse"===C){if(!o(L))throw new r('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:L});if(R=await E.expand({activeCtx:e,activeProperty:"@reverse",element:L,options:S}),"@reverse"in R)for(const e in R["@reverse"])_(w,e,R["@reverse"][e],{propertyIsArray:!0});let t=w["@reverse"]||null;for(const e in R){if("@reverse"===e)continue;null===t&&(t=w["@reverse"]={}),_(t,e,[],{propertyIsArray:!0});const n=R[e];for(let i=0;i<n.length;++i){const o=n[i];if(u(o)||c(o))throw new r('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:R});_(t,e,o,{propertyIsArray:!0})}}continue}if("@nest"===C){D.push(T);continue}let $=e;const B=p(e,T,"@context");l(B)||($=await y({activeCtx:e,localCtx:B,propagate:!0,overrideProtected:!0,options:S}));const F=p(e,T,"@container")||[];if(F.includes("@language")&&o(L))R=O($,L,p($,T,"@direction"),S);else if(F.includes("@index")&&o(L)){const t=F.includes("@graph"),n=p($,T,"@index")||"@index",r="@index"!==n&&f(e,n,{vocab:!0},S);R=await k({activeCtx:$,options:S,activeProperty:T,value:L,asGraph:t,indexKey:n,propertyIndex:r})}else if(F.includes("@id")&&o(L)){const e=F.includes("@graph");R=await k({activeCtx:$,options:S,activeProperty:T,value:L,asGraph:e,indexKey:"@id"})}else if(F.includes("@type")&&o(L))R=await k({activeCtx:$.revertToPreviousContext(),options:S,activeProperty:T,value:L,asGraph:!1,indexKey:"@type"});else{const r="@list"===C;if(r||"@set"===C){let e=t;r&&"@graph"===n&&(e=null),R=await E.expand({activeCtx:$,activeProperty:e,element:L,options:S,insideList:r})}else R="@json"===p(e,T,"@type")?{"@type":"@json","@value":L}:await E.expand({activeCtx:$,activeProperty:T,element:L,options:S,insideList:!1})}if(null!==R||"@value"===C){if("@list"!==C&&!c(R)&&F.includes("@list")&&(R={"@list":x(R)}),F.includes("@graph")&&!F.some((e=>"@id"===e||"@index"===e))){if(R=x(R),S.isFrame||(R=R.filter((e=>null!==N({value:e,count:Object.keys(e).length,options:S})))),0===R.length)continue;R=R.map((e=>({"@graph":x(e)})))}if($.mappings.has(T)&&$.mappings.get(T).reverse){const e=w["@reverse"]=w["@reverse"]||{};R=x(R);for(let t=0;t<R.length;++t){const n=R[t];if(u(n)||c(n))throw new r('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:R});_(e,C,n,{propertyIsArray:!0})}}else _(w,C,R,{propertyIsArray:!0})}}if("@value"in w)if("@json"===w["@type"]&&m(e,1.1));else if((o(M)||i(M))&&!S.isFrame)throw new r('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",value:M});for(const a of D){const s=i(d[a])?d[a]:[d[a]];for(const i of s){if(!o(i)||Object.keys(i).some((t=>"@value"===f(e,t,{vocab:!0},S))))throw new r("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:i});await T({activeCtx:e,activeProperty:t,expandedActiveProperty:n,element:i,expandedParent:w,options:S,insideList:R,typeScopedContext:A,typeKey:L})}}}function R({activeCtx:e,activeProperty:t,value:n,options:r}){if(null==n)return null;const i=f(e,t,{vocab:!0},r);if("@id"===i)return f(e,n,{base:!0},r);if("@type"===i)return f(e,n,{vocab:!0,base:!0},{...r,typeExpansion:!0});const o=p(e,t,"@type");if(("@id"===o||"@graph"===i)&&s(n)){const i=f(e,n,{base:!0},r);return null===i&&n.match(w)&&r.eventHandler&&I({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:t}},options:r}),{"@id":i}}if("@vocab"===o&&s(n))return{"@id":f(e,n,{vocab:!0,base:!0},r)};if(g(i))return n;const a={};if(o&&!["@id","@vocab","@none"].includes(o))a["@type"]=o;else if(s(n)){const n=p(e,t,"@language");null!==n&&(a["@language"]=n);const r=p(e,t,"@direction");null!==r&&(a["@direction"]=r)}return["boolean","number","string"].includes(typeof n)||(n=n.toString()),a["@value"]=n,a}function O(e,t,n,o){const a=[],l=Object.keys(t).sort();for(const c of l){const l=f(e,c,{vocab:!0},o);let u=t[c];i(u)||(u=[u]);for(const e of u){if(null===e)continue;if(!s(e))throw new r("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:t});const i={"@value":e};"@none"!==l&&(c.match(v)||o.eventHandler&&I({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:c}},options:o}),i["@language"]=c.toLowerCase()),n&&(i["@direction"]=n),a.push(i)}}return a}async function k({activeCtx:e,options:t,activeProperty:n,value:o,asGraph:a,indexKey:s,propertyIndex:c}){const h=[],g=Object.keys(o).sort(),m="@type"===s;for(let b of g){if(m){const n=p(e,b,"@context");l(n)||(e=await y({activeCtx:e,localCtx:n,propagate:!1,options:t}))}let g,v=o[b];i(v)||(v=[v]),v=await E.expand({activeCtx:e,activeProperty:n,element:v,options:t,insideList:!1,insideIndex:!0}),g=c?"@none"===b?"@none":R({activeCtx:e,activeProperty:s,value:b,options:t}):f(e,b,{vocab:!0},t),"@id"===s?b=f(e,b,{base:!0},t):m&&(b=g);for(let e of v){if(a&&!d(e)&&(e={"@graph":[e]}),"@type"===s)"@none"===g||(e["@type"]?e["@type"]=[b].concat(e["@type"]):e["@type"]=[b]);else{if(u(e)&&!["@language","@type","@index"].includes(s))throw new r(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${s}".`,"jsonld.SyntaxError",{code:"invalid value object",value:e});c?"@none"!==g&&_(e,c,g,{propertyIsArray:!0,prependValue:!0}):"@none"===g||s in e||(e[s]=b)}h.push(e)}}return h}e.exports=E,E.expand=async({activeCtx:e,activeProperty:t=null,element:n,options:c={},insideList:u=!1,insideIndex:d=!1,typeScopedContext:h=null})=>{if(null==n)return null;if("@default"===t&&(c=Object.assign({},c,{isFrame:!1})),!i(n)&&!o(n))return u||null!==t&&"@graph"!==f(e,t,{vocab:!0},c)?R({activeCtx:e,activeProperty:t,value:n,options:c}):(c.eventHandler&&I({event:{type:["JsonLdEvent"],code:"free-floating scalar",level:"warning",message:"Dropping free-floating scalar not in a list.",details:{value:n}},options:c}),null);if(i(n)){let r=[];const o=p(e,t,"@container")||[];u=u||o.includes("@list");for(let o=0;o<n.length;++o){let a=await E.expand({activeCtx:e,activeProperty:t,element:n[o],options:c,insideIndex:d,typeScopedContext:h});u&&i(a)&&(a={"@list":a}),null!==a&&(i(a)?r=r.concat(a):r.push(a))}return r}const g=f(e,t,{vocab:!0},c),v=p(e,t,"@context");h=h||(e.previousContext?e:null);let w=Object.keys(n).sort(),_=!d;if(_&&h&&w.length<=2&&!w.includes("@context"))for(const t of w){const n=f(h,t,{vocab:!0},c);if("@value"===n){_=!1,e=h;break}if("@id"===n&&1===w.length){_=!1;break}}_&&(e=e.revertToPreviousContext()),l(v)||(e=await y({activeCtx:e,localCtx:v,propagate:!0,overrideProtected:!0,options:c})),"@context"in n&&(e=await y({activeCtx:e,localCtx:n["@context"],options:c})),h=e;let j=null;for(const t of w)if("@type"===f(e,t,{vocab:!0},c)){j=j||t;const r=n[t],i=Array.isArray(r)?r.length>1?r.slice().sort():r:[r];for(const t of i){const n=p(h,t,"@context");l(n)||(e=await y({activeCtx:e,localCtx:n,options:c,propagate:!1}))}}let O={};await T({activeCtx:e,activeProperty:t,expandedActiveProperty:g,element:n,expandedParent:O,options:c,insideList:u,typeKey:j,typeScopedContext:h}),w=Object.keys(O);let k=w.length;if("@value"in O){if("@type"in O&&("@language"in O||"@direction"in O))throw new r('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and either "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:O});let t=k-1;if("@type"in O&&(t-=1),"@index"in O&&(t-=1),"@language"in O&&(t-=1),"@direction"in O&&(t-=1),0!==t)throw new r('Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and either "@type" or either or both "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:O});const n=null===O["@value"]?[]:x(O["@value"]),i=S(O,"@type");if(m(e,1.1)&&i.includes("@json")&&1===i.length);else if(0===n.length)c.eventHandler&&I({event:{type:["JsonLdEvent"],code:"null @value value",level:"warning",message:"Dropping null @value value.",details:{value:O}},options:c}),O=null;else{if(!n.every((e=>s(e)||a(e)))&&"@language"in O)throw new r("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:O});if(!i.every((e=>b(e)&&!(s(e)&&0===e.indexOf("_:"))||a(e))))throw new r('Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".',"jsonld.SyntaxError",{code:"invalid typed value",element:O})}}else if("@type"in O&&!i(O["@type"]))O["@type"]=[O["@type"]];else if("@set"in O||"@list"in O){if(k>1&&(2!==k||!("@index"in O)))throw new r('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',"jsonld.SyntaxError",{code:"invalid set or list object",element:O});"@set"in O&&(O=O["@set"],w=Object.keys(O),k=w.length)}else 1===k&&"@language"in O&&(c.eventHandler&&I({event:{type:["JsonLdEvent"],code:"object with only @language",level:"warning",message:"Dropping object with only @language.",details:{value:O}},options:c}),O=null);return!o(O)||c.keepFreeFloatingNodes||u||null!==t&&"@graph"!==g&&!(p(e,t,"@container")||[]).includes("@graph")||(O=N({value:O,count:k,options:c})),O}},5229:(e,t,n)=>{const{isSubjectReference:r}=n(3978),{createMergedNodeMap:i}=n(9233),o={};e.exports=o,o.flatten=e=>{const t=i(e),n=[],o=Object.keys(t).sort();for(let e=0;e<o.length;++e){const i=t[o[e]];r(i)||n.push(i)}return n}},7946:(e,t,n)=>{const{isKeyword:r}=n(1972),i=n(3978),o=n(7382),a=n(9263),s=n(470),l=n(2207),{createNodeMap:c,mergeNodeMapGraphs:u}=n(9233),d={};function h(e){const t={};for(const n in e)void 0!==e[n]&&(t["@"+n]=[e[n]]);return[t]}function f(e,t,n){for(let r=n.length-1;r>=0;--r){const i=n[r];if(i.graph===t&&i.subject["@id"]===e["@id"])return!0}return!1}function p(e,t,n){const r="@"+n;let i=r in e?e[r][0]:t[n];if("embed"===n)if(!0===i)i="@once";else if(!1===i)i="@never";else if("@always"!==i&&"@never"!==i&&"@link"!==i&&"@first"!==i&&"@last"!==i&&"@once"!==i)throw new l("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:e});return i}function g(e){if(!o.isArray(e)||1!==e.length||!o.isObject(e[0]))throw new l("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:e});if("@id"in e[0])for(const t of a.asArray(e[0]["@id"]))if(!o.isObject(t)&&!s.isAbsolute(t)||o.isString(t)&&0===t.indexOf("_:"))throw new l("Invalid JSON-LD syntax; invalid @id in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:e});if("@type"in e[0])for(const t of a.asArray(e[0]["@type"]))if(!o.isObject(t)&&!s.isAbsolute(t)&&"@json"!==t||o.isString(t)&&0===t.indexOf("_:"))throw new l("Invalid JSON-LD syntax; invalid @type in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:e})}function y(e,t,n,s){let l=!0,c=!1;for(const u in n){let d=!1;const h=a.getValues(t,u),f=0===a.getValues(n,u).length;if("@id"===u){if(o.isEmptyObject(n["@id"][0]||{})?d=!0:n["@id"].length>=0&&(d=n["@id"].includes(h[0])),!s.requireAll)return d}else if("@type"===u){if(l=!1,f){if(h.length>0)return!1;d=!0}else if(1===n["@type"].length&&o.isEmptyObject(n["@type"][0]))d=h.length>0;else for(const e of n["@type"])d=!(!o.isObject(e)||!("@default"in e))||d||h.some((t=>t===e));if(!s.requireAll)return d}else{if(r(u))continue;{const t=a.getValues(n,u)[0];let r=!1;if(t&&(g([t]),r="@default"in t),l=!1,0===h.length&&r)continue;if(h.length>0&&f)return!1;if(void 0===t){if(h.length>0)return!1;d=!0}else if(i.isList(t)){const n=t["@list"][0];if(i.isList(h[0])){const t=h[0]["@list"];i.isValue(n)?d=t.some((e=>_(n,e))):(i.isSubject(n)||i.isSubjectReference(n))&&(d=t.some((t=>w(e,n,t,s))))}}else d=i.isValue(t)?h.some((e=>_(t,e))):i.isSubjectReference(t)?h.some((n=>w(e,t,n,s))):!!o.isObject(t)&&h.length>0}}if(!d&&s.requireAll)return!1;c=c||d}return l||c}function m(e,t){const n=e.uniqueEmbeds[e.graph],r=n[t],i=r.parent,s=r.property,l={"@id":t};if(o.isArray(i)){for(let e=0;e<i.length;++e)if(a.compareValues(i[e],l)){i[e]=l;break}}else{const e=o.isArray(i[s]);a.removeValue(i,s,l,{propertyIsArray:e}),a.addValue(i,s,l,{propertyIsArray:e})}const c=e=>{const t=Object.keys(n);for(const r of t)r in n&&o.isObject(n[r].parent)&&n[r].parent["@id"]===e&&(delete n[r],c(r))};c(t)}function b(e,t){if(o.isArray(e))return e.map((e=>b(e,t)));if(o.isObject(e)){if("@preserve"in e)return e["@preserve"][0];if(i.isValue(e))return e;if(i.isList(e))return e["@list"]=b(e["@list"],t),e;if("@id"in e){const n=e["@id"];if(t.link.hasOwnProperty(n)){const r=t.link[n].indexOf(e);if(-1!==r)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(const n in e)"@id"===n&&t.bnodesToClear.includes(e[n])?delete e["@id"]:e[n]=b(e[n],t)}return e}function v(e,t,n){o.isObject(e)?a.addValue(e,t,n,{propertyIsArray:!0}):e.push(n)}function w(e,t,n,r){if(!("@id"in n))return!1;const i=e.subjects[n["@id"]];return i&&y(e,i,t,r)}function _(e,t){const n=t["@value"],r=t["@type"],i=t["@language"],a=e["@value"]?o.isArray(e["@value"])?e["@value"]:[e["@value"]]:[],s=e["@type"]?o.isArray(e["@type"])?e["@type"]:[e["@type"]]:[],l=e["@language"]?o.isArray(e["@language"])?e["@language"]:[e["@language"]]:[];return 0===a.length&&0===s.length&&0===l.length||!(!a.includes(n)&&!o.isEmptyObject(a[0]))&&!!(!r&&0===s.length||s.includes(r)||r&&o.isEmptyObject(s[0]))&&!!(!i&&0===l.length||l.includes(i)||i&&o.isEmptyObject(l[0]))}e.exports=d,d.frameMergedOrDefault=(e,t,n)=>{const r={options:n,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},i=new a.IdentifierIssuer("_:b");c(e,r.graphMap,"@default",i),n.merged&&(r.graphMap["@merged"]=u(r.graphMap),r.graph="@merged"),r.subjects=r.graphMap[r.graph];const o=[];return d.frame(r,Object.keys(r.subjects).sort(),t,o),n.pruneBlankNodeIdentifiers&&(n.bnodesToClear=Object.keys(r.bnodeMap).filter((e=>1===r.bnodeMap[e].length))),n.link={},b(o,n)},d.frame=(e,t,n,s,c=null)=>{g(n),n=n[0];const u=e.options,b={embed:p(n,u,"embed"),explicit:p(n,u,"explicit"),requireAll:p(n,u,"requireAll")};e.link.hasOwnProperty(e.graph)||(e.link[e.graph]={});const w=e.link[e.graph],x=function(e,t,n,r){const i={};for(const o of t){const t=e.graphMap[e.graph][o];y(e,t,n,r)&&(i[o]=t)}return i}(e,t,n,b),S=Object.keys(x).sort();for(const g of S){const y=x[g];if(null===c?e.uniqueEmbeds={[e.graph]:{}}:e.uniqueEmbeds[e.graph]=e.uniqueEmbeds[e.graph]||{},"@link"===b.embed&&g in w){v(s,c,w[g]);continue}const S={"@id":g};if(0===g.indexOf("_:")&&a.addValue(e.bnodeMap,g,S,{propertyIsArray:!0}),w[g]=S,("@first"===b.embed||"@last"===b.embed)&&e.is11)throw new l("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:n});if(e.embedded||!e.uniqueEmbeds[e.graph].hasOwnProperty(g))if(!e.embedded||"@never"!==b.embed&&!f(y,e.graph,e.subjectStack))if(!e.embedded||"@first"!=b.embed&&"@once"!=b.embed||!e.uniqueEmbeds[e.graph].hasOwnProperty(g)){if("@last"===b.embed&&g in e.uniqueEmbeds[e.graph]&&m(e,g),e.uniqueEmbeds[e.graph][g]={parent:s,property:c},e.subjectStack.push({subject:y,graph:e.graph}),g in e.graphMap){let t=!1,r=null;"@graph"in n?(r=n["@graph"][0],t=!("@merged"===g||"@default"===g),o.isObject(r)||(r={})):(t="@merged"!==e.graph,r={}),t&&d.frame({...e,graph:g,embedded:!1},Object.keys(e.graphMap[g]).sort(),[r],S,"@graph")}"@included"in n&&d.frame({...e,embedded:!1},t,n["@included"],S,"@included");for(const t of Object.keys(y).sort())if(r(t)){if(S[t]=a.clone(y[t]),"@type"===t)for(const t of y["@type"])0===t.indexOf("_:")&&a.addValue(e.bnodeMap,t,S,{propertyIsArray:!0})}else if(!b.explicit||t in n)for(const r of y[t]){const o=t in n?n[t]:h(b);if(i.isList(r)){const o=n[t]&&n[t][0]&&n[t][0]["@list"]?n[t][0]["@list"]:h(b),s={"@list":[]};v(S,t,s);const l=r["@list"];for(const t of l)i.isSubjectReference(t)?d.frame({...e,embedded:!0},[t["@id"]],o,s,"@list"):v(s,"@list",a.clone(t))}else i.isSubjectReference(r)?d.frame({...e,embedded:!0},[r["@id"]],o,S,t):_(o[0],r)&&v(S,t,a.clone(r))}for(const e of Object.keys(n).sort()){if("@type"===e){if(!o.isObject(n[e][0])||!("@default"in n[e][0]))continue}else if(r(e))continue;const t=n[e][0]||{};if(!p(t,u,"omitDefault")&&!(e in S)){let n="@null";"@default"in t&&(n=a.clone(t["@default"])),o.isArray(n)||(n=[n]),S[e]=[{"@preserve":n}]}}for(const t of Object.keys(n["@reverse"]||{}).sort()){const r=n["@reverse"][t];for(const n of Object.keys(e.subjects))a.getValues(e.subjects[n],t).some((e=>e["@id"]===g))&&(S["@reverse"]=S["@reverse"]||{},a.addValue(S["@reverse"],t,[],{propertyIsArray:!0}),d.frame({...e,embedded:!0},[n],r,S["@reverse"][t],c))}v(s,c,S),e.subjectStack.pop()}else v(s,c,S);else v(s,c,S)}},d.cleanupNull=(e,t)=>{if(o.isArray(e))return e.map((e=>d.cleanupNull(e,t))).filter((e=>e));if("@null"===e)return null;if(o.isObject(e)){if("@id"in e){const n=e["@id"];if(t.link.hasOwnProperty(n)){const r=t.link[n].indexOf(e);if(-1!==r)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(const n in e)e[n]=d.cleanupNull(e[n],t)}return e}},3947:(e,t,n)=>{const r=n(2207),i=n(3978),o=n(7382),{REGEX_BCP47:a,addValue:s}=n(9263),{handleEvent:l}=n(2246),{RDF_LIST:c,RDF_FIRST:u,RDF_REST:d,RDF_NIL:h,RDF_TYPE:f,RDF_JSON_LITERAL:p,XSD_BOOLEAN:g,XSD_DOUBLE:y,XSD_INTEGER:m,XSD_STRING:b}=n(9378),v={};function w(e,t,n,i){if(e.termType.endsWith("Node"))return{"@id":e.value};const s={"@value":e.value};if(e.language)e.language.match(a)||i.eventHandler&&l({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:e.language}},options:i}),s["@language"]=e.language;else{let c=e.datatype.value;if(c||(c=b),c===p){c="@json";try{s["@value"]=JSON.parse(s["@value"])}catch(e){throw new r("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:s["@value"],cause:e})}}if(t){if(c===g)"true"===s["@value"]?s["@value"]=!0:"false"===s["@value"]&&(s["@value"]=!1);else if(o.isNumeric(s["@value"]))if(c===m){const e=parseInt(s["@value"],10);e.toFixed(0)===s["@value"]&&(s["@value"]=e)}else c===y&&(s["@value"]=parseFloat(s["@value"]));[g,m,y,b].includes(c)||(s["@type"]=c)}else if("i18n-datatype"===n&&c.startsWith("https://www.w3.org/ns/i18n#")){const[,e,t]=c.split(/[#_]/);e.length>0&&(s["@language"]=e,e.match(a)||i.eventHandler&&l({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:e}},options:i})),s["@direction"]=t}else c!==b&&(s["@type"]=c)}return s}e.exports=v,v.fromRDF=async(e,t)=>{const{useRdfType:n=!1,useNativeTypes:a=!1,rdfDirection:l=null}=t,p={},g={"@default":p},y={};if(l){if("compound-literal"===l)throw new r("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:l});if("i18n-datatype"!==l)throw new r("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:l})}for(const r of e){const e="DefaultGraph"===r.graph.termType?"@default":r.graph.value;e in g||(g[e]={}),"@default"===e||e in p||(p[e]={"@id":e});const i=g[e],o=r.subject.value,c=r.predicate.value,u=r.object;o in i||(i[o]={"@id":o});const d=i[o],m=u.termType.endsWith("Node");if(m&&!(u.value in i)&&(i[u.value]={"@id":u.value}),c===f&&!n&&m){s(d,"@type",u.value,{propertyIsArray:!0});continue}const b=w(u,a,l,t);if(s(d,c,b,{propertyIsArray:!0}),m)if(u.value===h){const e=i[u.value];"usages"in e||(e.usages=[]),e.usages.push({node:d,property:c,value:b})}else u.value in y?y[u.value]=!1:y[u.value]={node:d,property:c,value:b}}for(const e in g){const t=g[e];if(!(h in t))continue;const n=t[h];if(n.usages){for(let e of n.usages){let n=e.node,r=e.property,a=e.value;const s=[],l=[];let h=Object.keys(n).length;for(;r===d&&o.isObject(y[n["@id"]])&&o.isArray(n[u])&&1===n[u].length&&o.isArray(n[d])&&1===n[d].length&&(3===h||4===h&&o.isArray(n["@type"])&&1===n["@type"].length&&n["@type"][0]===c)&&(s.push(n[u][0]),l.push(n["@id"]),e=y[n["@id"]],n=e.node,r=e.property,a=e.value,h=Object.keys(n).length,i.isBlankNode(n)););delete a["@id"],a["@list"]=s.reverse();for(const e of l)delete t[e]}delete n.usages}}const m=[],b=Object.keys(p).sort();for(const e of b){const t=p[e];if(e in g){const n=t["@graph"]=[],r=g[e],o=Object.keys(r).sort();for(const e of o){const t=r[e];i.isSubjectReference(t)||n.push(t)}}i.isSubjectReference(t)||m.push(t)}return m}},3978:(e,t,n)=>{const r=n(7382),i={};e.exports=i,i.isSubject=e=>!(!r.isObject(e)||"@value"in e||"@set"in e||"@list"in e)&&(Object.keys(e).length>1||!("@id"in e)),i.isSubjectReference=e=>r.isObject(e)&&1===Object.keys(e).length&&"@id"in e,i.isValue=e=>r.isObject(e)&&"@value"in e,i.isList=e=>r.isObject(e)&&"@list"in e,i.isGraph=e=>r.isObject(e)&&"@graph"in e&&1===Object.keys(e).filter((e=>"@id"!==e&&"@index"!==e)).length,i.isSimpleGraph=e=>i.isGraph(e)&&!("@id"in e),i.isBlankNode=e=>{if(r.isObject(e)){if("@id"in e){const t=e["@id"];return!r.isString(t)||0===t.indexOf("_:")}return 0===Object.keys(e).length||!("@value"in e||"@set"in e||"@list"in e)}return!1}},4841:(e,t,n)=>{const r=n(989),i=n(701),o=n(9263),a=n(7034),s=o.IdentifierIssuer,l=n(2207),c=n(9749),u=n(8229),{expand:d}=n(4019),{flatten:h}=n(5229),{fromRDF:f}=n(3947),{toRDF:p}=n(9180),{frameMergedOrDefault:g,cleanupNull:y}=n(7946),{isArray:m,isObject:b,isString:v}=n(7382),{isSubjectReference:w}=n(3978),{expandIri:_,getInitialContext:x,process:S,processingMode:j}=n(1972),{compact:I,compactIri:E}=n(1058),{createNodeMap:N,createMergedNodeMap:T,mergeNodeMaps:R}=n(9233),{logEventHandler:O,logWarningEventHandler:k,safeEventHandler:L,setDefaultEventHandler:A,setupEventHandler:C,strictEventHandler:D,unhandledEventHandler:M}=n(2246),P=function(e){const t={},P=new c({max:100});function $(t,{documentLoader:n=e.documentLoader,...r}){if(t&&"compactionMap"in t)throw new l('"compactionMap" not supported.',"jsonld.OptionsError");if(t&&"expansionMap"in t)throw new l('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:n},r,t,{eventHandler:C({options:t})})}return e.compact=async function(t,n,r){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(null===n)throw new l("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(null===t)return null;let i;(r=$(r,{base:v(t)?t:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new s("_:b"),contextResolver:new a({sharedCache:P})})).link&&(r.skipExpansion=!0),r.compactToRelative||delete r.base,i=r.skipExpansion?t:await e.expand(t,r);const c=await e.processContext(x(r),n,r);let u=await I({activeCtx:c,element:i,options:r});r.compactArrays&&!r.graph&&m(u)?1===u.length?u=u[0]:0===u.length&&(u={}):r.graph&&b(u)&&(u=[u]),b(n)&&"@context"in n&&(n=n["@context"]),n=o.clone(n),m(n)||(n=[n]);const d=n;n=[];for(let e=0;e<d.length;++e)(!b(d[e])||Object.keys(d[e]).length>0)&&n.push(d[e]);const h=n.length>0;if(1===n.length&&(n=n[0]),m(u)){const e=E({activeCtx:c,iri:"@graph",relativeTo:{vocab:!0}}),t=u;u={},h&&(u["@context"]=n),u[e]=t}else if(b(u)&&h){const e=u;u={"@context":n};for(const t in e)u[t]=e[t]}return u},e.expand=async function(t,n){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");const r={},i=[];if("expandContext"in(n=$(n,{keepFreeFloatingNodes:!1,contextResolver:new a({sharedCache:P})}))){const e=o.clone(n.expandContext);b(e)&&"@context"in e?r.expandContext=e:r.expandContext={"@context":e},i.push(r.expandContext)}let s;if(v(t)){const o=await e.get(t,n);s=o.documentUrl,r.input=o.document,o.contextUrl&&(r.remoteContext={"@context":o.contextUrl},i.push(r.remoteContext))}else r.input=o.clone(t);"base"in n||(n.base=s||"");let l=x(n);for(const e of i)l=await S({activeCtx:l,localCtx:e,options:n});let c=await d({activeCtx:l,element:r.input,options:n});return b(c)&&"@graph"in c&&1===Object.keys(c).length?c=c["@graph"]:null===c&&(c=[]),m(c)||(c=[c]),c},e.flatten=async function(t,n,r){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");n="function"==typeof n?null:n||null,r=$(r,{base:v(t)?t:"",contextResolver:new a({sharedCache:P})});const i=await e.expand(t,r),o=h(i);return null===n?o:(r.graph=!0,r.skipExpansion=!0,await e.compact(o,n,r))},e.frame=async function(t,n,r){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(r=$(r,{base:v(t)?t:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new a({sharedCache:P})}),v(n)){const t=await e.get(n,r);if(n=t.document,t.contextUrl){let e=n["@context"];e?m(e)?e.push(t.contextUrl):e=[e,t.contextUrl]:e=t.contextUrl,n["@context"]=e}}const i=n&&n["@context"]||{},o=await e.processContext(x(r),i,r);r.hasOwnProperty("omitGraph")||(r.omitGraph=j(o,1.1)),r.hasOwnProperty("pruneBlankNodeIdentifiers")||(r.pruneBlankNodeIdentifiers=j(o,1.1));const s=await e.expand(t,r),l={...r};l.isFrame=!0,l.keepFreeFloatingNodes=!0;const c=await e.expand(n,l),u=Object.keys(n).map((e=>_(o,e,{vocab:!0})));l.merged=!u.includes("@graph"),l.is11=j(o,1.1);const d=g(s,c,l);l.graph=!r.omitGraph,l.skipExpansion=!0,l.link={},l.framing=!0;let h=await e.compact(d,i,l);return l.link={},h=y(h,l),h},e.link=async function(t,n,r){const i={};return n&&(i["@context"]=n),i["@embed"]="@link",e.frame(t,i,r)},e.normalize=e.canonize=async function(t,n){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if("inputFormat"in(n=$(n,{base:v(t)?t:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new a({sharedCache:P})}))){if("application/n-quads"!==n.inputFormat&&"application/nquads"!==n.inputFormat)throw new l("Unknown canonicalization input format.","jsonld.CanonizeError");const e=u.parse(t);return r.canonize(e,n)}const i={...n};delete i.format,i.produceGeneralizedRdf=!1;const o=await e.toRDF(t,i);return r.canonize(o,n)},e.fromRDF=async function(e,n){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");n=$(n,{format:v(e)?"application/n-quads":void 0});const{format:r}=n;let{rdfParser:i}=n;if(r){if(i=i||t[r],!i)throw new l("Unknown input format.","jsonld.UnknownFormat",{format:r})}else i=()=>e;const o=await i(e);return f(o,n)},e.toRDF=async function(t,n){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");let r;r=(n=$(n,{base:v(t)?t:"",skipExpansion:!1,contextResolver:new a({sharedCache:P})})).skipExpansion?t:await e.expand(t,n);const i=p(r,n);if(n.format){if("application/n-quads"===n.format||"application/nquads"===n.format)return u.serialize(i);throw new l("Unknown output format.","jsonld.UnknownFormat",{format:n.format})}return i},e.createNodeMap=async function(t,n){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");n=$(n,{base:v(t)?t:"",contextResolver:new a({sharedCache:P})});const r=await e.expand(t,n);return T(r,n)},e.merge=async function(t,n,r){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!m(t))throw new TypeError('Could not merge, "docs" must be an array.');n="function"==typeof n?null:n||null,r=$(r,{contextResolver:new a({sharedCache:P})});const i=await Promise.all(t.map((t=>{const n={...r};return e.expand(t,n)})));let l=!0;"mergeNodes"in r&&(l=r.mergeNodes);const c=r.issuer||new s("_:b"),u={"@default":{}};for(let e=0;e<i.length;++e){const t=o.relabelBlankNodes(i[e],{issuer:new s("_:b"+e+"-")}),n=l||0===e?u:{"@default":{}};if(N(t,n,"@default",c),n!==u)for(const e in n){const t=n[e];if(!(e in u)){u[e]=t;continue}const r=u[e];for(const e in t)e in r||(r[e]=t[e])}}const d=R(u),h=[],f=Object.keys(d).sort();for(let e=0;e<f.length;++e){const t=d[f[e]];w(t)||h.push(t)}return null===n?h:(r.graph=!0,r.skipExpansion=!0,await e.compact(h,n,r))},Object.defineProperty(e,"documentLoader",{get:()=>e._documentLoader,set:t=>e._documentLoader=t}),e.documentLoader=async e=>{throw new l("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:e})},e.get=async function(t,n){let r;r="function"==typeof n.documentLoader?n.documentLoader:e.documentLoader;const i=await r(t);try{if(!i.document)throw new l("No remote document found at the given URL.","jsonld.NullRemoteDocument");v(i.document)&&(i.document=JSON.parse(i.document))}catch(e){throw new l("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:e,remoteDoc:i})}return i},e.processContext=async function(e,t,n){return n=$(n,{base:"",contextResolver:new a({sharedCache:P})}),null===t?x(n):(t=o.clone(t),b(t)&&"@context"in t||(t={"@context":t}),S({activeCtx:e,localCtx:t,options:n}))},e.getContextValue=n(1972).getContextValue,e.documentLoaders={},e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new l('Unknown document loader type: "'+t+'"',"jsonld.UnknownDocumentLoader",{type:t});e.documentLoader=e.documentLoaders[t].apply(e,Array.prototype.slice.call(arguments,1))},e.registerRDFParser=function(e,n){t[e]=n},e.unregisterRDFParser=function(e){delete t[e]},e.registerRDFParser("application/n-quads",u.parse),e.registerRDFParser("application/nquads",u.parse),e.url=n(470),e.logEventHandler=O,e.logWarningEventHandler=k,e.safeEventHandler=L,e.setDefaultEventHandler=A,e.strictEventHandler=D,e.unhandledEventHandler=M,e.util=o,Object.assign(e,o),e.promises=e,e.RequestQueue=n(3743),e.JsonLdProcessor=n(5445)(e),i.setupGlobals(e),i.setupDocumentLoaders(e),e},$=function(){return P((function(){return $()}))};P($),e.exports=$},9233:(e,t,n)=>{const{isKeyword:r}=n(1972),i=n(3978),o=n(7382),a=n(9263),s=n(2207),l={};e.exports=l,l.createMergedNodeMap=(e,t)=>{const n=(t=t||{}).issuer||new a.IdentifierIssuer("_:b"),r={"@default":{}};return l.createNodeMap(e,r,"@default",n),l.mergeNodeMaps(r)},l.createNodeMap=(e,t,n,c,u,d)=>{if(o.isArray(e)){for(const r of e)l.createNodeMap(r,t,n,c,void 0,d);return}if(!o.isObject(e))return void(d&&d.push(e));if(i.isValue(e)){if("@type"in e){let t=e["@type"];0===t.indexOf("_:")&&(e["@type"]=t=c.getId(t))}return void(d&&d.push(e))}if(d&&i.isList(e)){const r=[];return l.createNodeMap(e["@list"],t,n,c,u,r),void d.push({"@list":r})}if("@type"in e){const t=e["@type"];for(const e of t)0===e.indexOf("_:")&&c.getId(e)}o.isUndefined(u)&&(u=i.isBlankNode(e)?c.getId(e["@id"]):e["@id"]),d&&d.push({"@id":u});const h=t[n],f=h[u]=h[u]||{};f["@id"]=u;const p=Object.keys(e).sort();for(let o of p){if("@id"===o)continue;if("@reverse"===o){const r={"@id":u},o=e["@reverse"];for(const e in o){const s=o[e];for(const o of s){let s=o["@id"];i.isBlankNode(o)&&(s=c.getId(s)),l.createNodeMap(o,t,n,c,s),a.addValue(h[s],e,r,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if("@graph"===o){u in t||(t[u]={}),l.createNodeMap(e[o],t,u,c);continue}if("@included"===o){l.createNodeMap(e[o],t,n,c);continue}if("@type"!==o&&r(o)){if("@index"===o&&o in f&&(e[o]!==f[o]||e[o]["@id"]!==f[o]["@id"]))throw new s("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:f});f[o]=e[o];continue}const d=e[o];if(0===o.indexOf("_:")&&(o=c.getId(o)),0!==d.length)for(let e of d)if("@type"===o&&(e=0===e.indexOf("_:")?c.getId(e):e),i.isSubject(e)||i.isSubjectReference(e)){if("@id"in e&&!e["@id"])continue;const r=i.isBlankNode(e)?c.getId(e["@id"]):e["@id"];a.addValue(f,o,{"@id":r},{propertyIsArray:!0,allowDuplicate:!1}),l.createNodeMap(e,t,n,c,r)}else if(i.isValue(e))a.addValue(f,o,e,{propertyIsArray:!0,allowDuplicate:!1});else if(i.isList(e)){const r=[];l.createNodeMap(e["@list"],t,n,c,u,r),e={"@list":r},a.addValue(f,o,e,{propertyIsArray:!0,allowDuplicate:!1})}else l.createNodeMap(e,t,n,c,u),a.addValue(f,o,e,{propertyIsArray:!0,allowDuplicate:!1});else a.addValue(f,o,[],{propertyIsArray:!0})}},l.mergeNodeMapGraphs=e=>{const t={};for(const n of Object.keys(e).sort())for(const i of Object.keys(e[n]).sort()){const o=e[n][i];i in t||(t[i]={"@id":i});const s=t[i];for(const e of Object.keys(o).sort())if(r(e)&&"@type"!==e)s[e]=a.clone(o[e]);else for(const t of o[e])a.addValue(s,e,a.clone(t),{propertyIsArray:!0,allowDuplicate:!1})}return t},l.mergeNodeMaps=e=>{const t=e["@default"],n=Object.keys(e).sort();for(const r of n){if("@default"===r)continue;const n=e[r];let o=t[r];o?"@graph"in o||(o["@graph"]=[]):t[r]=o={"@id":r,"@graph":[]};const a=o["@graph"];for(const e of Object.keys(n).sort()){const t=n[e];i.isSubjectReference(t)||a.push(t)}}return t}},701:(e,t,n)=>{const r=n(6957),i={};e.exports=i,i.setupDocumentLoaders=function(e){"undefined"!=typeof XMLHttpRequest&&(e.documentLoaders.xhr=r,e.useDocumentLoader("xhr"))},i.setupGlobals=function(e){void 0===globalThis.JsonLdProcessor&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:e.JsonLdProcessor})}},9180:(e,t,n)=>{const{createNodeMap:r}=n(9233),{isKeyword:i}=n(1972),o=n(3978),a=n(2341),s=n(2207),l=n(7382),c=n(9263),{handleEvent:u}=n(2246),{RDF_FIRST:d,RDF_REST:h,RDF_NIL:f,RDF_TYPE:p,RDF_JSON_LITERAL:g,RDF_LANGSTRING:y,XSD_BOOLEAN:m,XSD_DOUBLE:b,XSD_INTEGER:v,XSD_STRING:w}=n(9378),{isAbsolute:_}=n(470),x={};function S(e,t,n,r,o){const a=Object.keys(t).sort();for(const s of a){const a=t[s],l=Object.keys(a).sort();for(let t of l){const l=a[t];if("@type"===t)t=p;else if(i(t))continue;for(const i of l){const a={termType:s.startsWith("_:")?"BlankNode":"NamedNode",value:s};if(!_(s)){o.eventHandler&&u({event:{type:["JsonLdEvent"],code:"relative subject reference",level:"warning",message:"Relative subject reference found.",details:{subject:s}},options:o});continue}const l={termType:t.startsWith("_:")?"BlankNode":"NamedNode",value:t};if(!_(t)){o.eventHandler&&u({event:{type:["JsonLdEvent"],code:"relative predicate reference",level:"warning",message:"Relative predicate reference found.",details:{predicate:t}},options:o});continue}if("BlankNode"===l.termType&&!o.produceGeneralizedRdf){o.eventHandler&&u({event:{type:["JsonLdEvent"],code:"blank node predicate",level:"warning",message:"Dropping blank node predicate.",details:{property:r.getOldIds().find((e=>r.getId(e)===t))}},options:o});continue}const c=j(i,r,e,n,o.rdfDirection,o);c&&e.push({subject:a,predicate:l,object:c,graph:n})}}}}function j(e,t,n,r,i,c){const p={};if(o.isValue(e)){p.termType="Literal",p.value=void 0,p.datatype={termType:"NamedNode"};let t=e["@value"];const n=e["@type"]||null;if("@json"===n)p.value=a(t),p.datatype.value=g;else if(l.isBoolean(t))p.value=t.toString(),p.datatype.value=n||m;else if(l.isDouble(t)||n===b)l.isDouble(t)||(t=parseFloat(t)),p.value=t.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),p.datatype.value=n||b;else if(l.isNumber(t))p.value=t.toFixed(0),p.datatype.value=n||v;else if("@direction"in e&&"i18n-datatype"===i){const n=`https://www.w3.org/ns/i18n#${(e["@language"]||"").toLowerCase()}_${e["@direction"]}`;p.datatype.value=n,p.value=t}else{if("@direction"in e&&"compound-literal"===i)throw new s("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:i});if("@direction"in e&&i)throw new s("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:i});"@language"in e?("@direction"in e&&!i&&c.eventHandler&&u({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:p.value}},options:c}),p.value=t,p.datatype.value=n||y,p.language=e["@language"]):("@direction"in e&&!i&&c.eventHandler&&u({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:p.value}},options:c}),p.value=t,p.datatype.value=n||w)}}else if(o.isList(e)){const o=function(e,t,n,r,i,o){const a={termType:"NamedNode",value:d},s={termType:"NamedNode",value:h},l={termType:"NamedNode",value:f},c=e.pop(),u=c?{termType:"BlankNode",value:t.getId()}:l;let p=u;for(const l of e){const e=j(l,t,n,r,i,o),c={termType:"BlankNode",value:t.getId()};n.push({subject:p,predicate:a,object:e,graph:r}),n.push({subject:p,predicate:s,object:c,graph:r}),p=c}if(c){const e=j(c,t,n,r,i,o);n.push({subject:p,predicate:a,object:e,graph:r}),n.push({subject:p,predicate:s,object:l,graph:r})}return u}(e["@list"],t,n,r,i,c);p.termType=o.termType,p.value=o.value}else{const t=l.isObject(e)?e["@id"]:e;p.termType=t.startsWith("_:")?"BlankNode":"NamedNode",p.value=t}return"NamedNode"!==p.termType||_(p.value)?p:(c.eventHandler&&u({event:{type:["JsonLdEvent"],code:"relative object reference",level:"warning",message:"Relative object reference found.",details:{object:p.value}},options:c}),null)}e.exports=x,x.toRDF=(e,t)=>{const n=new c.IdentifierIssuer("_:b"),i={"@default":{}};r(e,i,"@default",n);const o=[],a=Object.keys(i).sort();for(const e of a){let r;if("@default"===e)r={termType:"DefaultGraph",value:""};else{if(!_(e)){t.eventHandler&&u({event:{type:["JsonLdEvent"],code:"relative graph reference",level:"warning",message:"Relative graph reference found.",details:{graph:e}},options:t});continue}r=e.startsWith("_:")?{termType:"BlankNode"}:{termType:"NamedNode"},r.value=e}S(o,i[e],r,n,t)}return o}},7382:e=>{const t={};e.exports=t,t.isArray=Array.isArray,t.isBoolean=e=>"boolean"==typeof e||"[object Boolean]"===Object.prototype.toString.call(e),t.isDouble=e=>t.isNumber(e)&&(-1!==String(e).indexOf(".")||Math.abs(e)>=1e21),t.isEmptyObject=e=>t.isObject(e)&&0===Object.keys(e).length,t.isNumber=e=>"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e),t.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),t.isObject=e=>"[object Object]"===Object.prototype.toString.call(e),t.isString=e=>"string"==typeof e||"[object String]"===Object.prototype.toString.call(e),t.isUndefined=e=>void 0===e},470:(e,t,n)=>{const r=n(7382),i={};e.exports=i,i.parsers={simple:{keys:["href","scheme","authority","path","query","fragment"],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:["href","protocol","scheme","authority","auth","user","password","hostname","port","path","directory","file","query","fragment"],regex:/^(([a-zA-Z][a-zA-Z0-9+-.]*):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},i.parse=(e,t)=>{const n={},r=i.parsers[t||"full"],o=r.regex.exec(e);let a=r.keys.length;for(;a--;)n[r.keys[a]]=void 0===o[a]?null:o[a];return("https"===n.scheme&&"443"===n.port||"http"===n.scheme&&"80"===n.port)&&(n.href=n.href.replace(":"+n.port,""),n.authority=n.authority.replace(":"+n.port,""),n.port=null),n.normalizedPath=i.removeDotSegments(n.path),n},i.prependBase=(e,t)=>{if(null===e)return t;if(i.isAbsolute(t))return t;e&&!r.isString(e)||(e=i.parse(e||""));const n=i.parse(t),o={protocol:e.protocol||""};if(null!==n.authority)o.authority=n.authority,o.path=n.path,o.query=n.query;else if(o.authority=e.authority,""===n.path)o.path=e.path,null!==n.query?o.query=n.query:o.query=e.query;else{if(0===n.path.indexOf("/"))o.path=n.path;else{let t=e.path;t=t.substr(0,t.lastIndexOf("/")+1),(t.length>0||e.authority)&&"/"!==t.substr(-1)&&(t+="/"),t+=n.path,o.path=t}o.query=n.query}""!==n.path&&(o.path=i.removeDotSegments(o.path));let a=o.protocol;return null!==o.authority&&(a+="//"+o.authority),a+=o.path,null!==o.query&&(a+="?"+o.query),null!==n.fragment&&(a+="#"+n.fragment),""===a&&(a="./"),a},i.removeBase=(e,t)=>{if(null===e)return t;e&&!r.isString(e)||(e=i.parse(e||""));let n="";if(""!==e.href?n+=(e.protocol||"")+"//"+(e.authority||""):t.indexOf("//")&&(n+="//"),0!==t.indexOf(n))return t;const o=i.parse(t.substr(n.length)),a=e.normalizedPath.split("/"),s=o.normalizedPath.split("/"),l=o.fragment||o.query?0:1;for(;a.length>0&&s.length>l&&a[0]===s[0];)a.shift(),s.shift();let c="";if(a.length>0){a.pop();for(let e=0;e<a.length;++e)c+="../"}return c+=s.join("/"),null!==o.query&&(c+="?"+o.query),null!==o.fragment&&(c+="#"+o.fragment),""===c&&(c="./"),c},i.removeDotSegments=e=>{if(0===e.length)return"";const t=e.split("/"),n=[];for(;t.length>0;){const e=t.shift(),r=0===t.length;"."!==e?".."!==e?n.push(e):(n.pop(),r&&n.push("")):r&&n.push("")}return"/"===e[0]&&n.length>0&&""!==n[0]&&n.unshift(""),1===n.length&&""===n[0]?"/":n.join("/")};const o=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;i.isAbsolute=e=>r.isString(e)&&o.test(e),i.isRelative=e=>r.isString(e)},9263:(e,t,n)=>{const r=n(3978),i=n(7382),o=n(989).IdentifierIssuer,a=n(2207),s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,l=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,c=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,u="application/ld+json, application/json",d={};function h(e,t){if(i.isArray(t))for(let n=0;n<t.length;++n)t[n]=h(e,t[n]);else if(r.isList(t))t["@list"]=h(e,t["@list"]);else if(i.isObject(t)){r.isBlankNode(t)&&(t["@id"]=e.getId(t["@id"]));const n=Object.keys(t).sort();for(let r=0;r<n.length;++r){const i=n[r];"@id"!==i&&(t[i]=h(e,t[i]))}}return t}e.exports=d,d.IdentifierIssuer=o,d.REGEX_BCP47=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,d.REGEX_KEYWORD=/^@[a-zA-Z]+$/,d.clone=function(e){if(e&&"object"==typeof e){let t;if(i.isArray(e)){t=[];for(let n=0;n<e.length;++n)t[n]=d.clone(e[n])}else if(e instanceof Map){t=new Map;for(const[n,r]of e)t.set(n,d.clone(r))}else if(e instanceof Set){t=new Set;for(const n of e)t.add(d.clone(n))}else if(i.isObject(e)){t={};for(const n in e)t[n]=d.clone(e[n])}else t=e.toString();return t}return e},d.asArray=function(e){return Array.isArray(e)?e:[e]},d.buildHeaders=(e={})=>{if(Object.keys(e).some((e=>"accept"===e.toLowerCase())))throw new RangeError('Accept header may not be specified; only "'+u+'" is supported.');return Object.assign({Accept:u},e)},d.parseLinkHeader=e=>{const t={},n=e.match(s);for(let e=0;e<n.length;++e){let r=n[e].match(l);if(!r)continue;const i={target:r[1]},o=r[2];for(;r=c.exec(o);)i[r[1]]=void 0===r[2]?r[3]:r[2];const a=i.rel||"";Array.isArray(t[a])?t[a].push(i):t.hasOwnProperty(a)?t[a]=[t[a],i]:t[a]=i}return t},d.validateTypeValue=(e,t)=>{if(!(i.isString(e)||i.isArray(e)&&e.every((e=>i.isString(e))))){if(t&&i.isObject(e))switch(Object.keys(e).length){case 0:return;case 1:if("@default"in e&&d.asArray(e["@default"]).every((e=>i.isString(e))))return}throw new a('Invalid JSON-LD syntax; "@type" value must a string, an array of strings, an empty object, or a default object.',"jsonld.SyntaxError",{code:"invalid type value",value:e})}},d.hasProperty=(e,t)=>{if(e.hasOwnProperty(t)){const n=e[t];return!i.isArray(n)||n.length>0}return!1},d.hasValue=(e,t,n)=>{if(d.hasProperty(e,t)){let o=e[t];const a=r.isList(o);if(i.isArray(o)||a){a&&(o=o["@list"]);for(let e=0;e<o.length;++e)if(d.compareValues(n,o[e]))return!0}else if(!i.isArray(n))return d.compareValues(n,o)}return!1},d.addValue=(e,t,n,r)=>{if("propertyIsArray"in(r=r||{})||(r.propertyIsArray=!1),"valueIsArray"in r||(r.valueIsArray=!1),"allowDuplicate"in r||(r.allowDuplicate=!0),"prependValue"in r||(r.prependValue=!1),r.valueIsArray)e[t]=n;else if(i.isArray(n)){0===n.length&&r.propertyIsArray&&!e.hasOwnProperty(t)&&(e[t]=[]),r.prependValue&&(n=n.concat(e[t]),e[t]=[]);for(let i=0;i<n.length;++i)d.addValue(e,t,n[i],r)}else if(e.hasOwnProperty(t)){const o=!r.allowDuplicate&&d.hasValue(e,t,n);i.isArray(e[t])||o&&!r.propertyIsArray||(e[t]=[e[t]]),o||(r.prependValue?e[t].unshift(n):e[t].push(n))}else e[t]=r.propertyIsArray?[n]:n},d.getValues=(e,t)=>[].concat(e[t]||[]),d.removeProperty=(e,t)=>{delete e[t]},d.removeValue=(e,t,n,r)=>{"propertyIsArray"in(r=r||{})||(r.propertyIsArray=!1);const i=d.getValues(e,t).filter((e=>!d.compareValues(e,n)));0===i.length?d.removeProperty(e,t):1!==i.length||r.propertyIsArray?e[t]=i:e[t]=i[0]},d.relabelBlankNodes=(e,t)=>h((t=t||{}).issuer||new o("_:b"),e),d.compareValues=(e,t)=>e===t||!(!r.isValue(e)||!r.isValue(t)||e["@value"]!==t["@value"]||e["@type"]!==t["@type"]||e["@language"]!==t["@language"]||e["@index"]!==t["@index"])||!!(i.isObject(e)&&"@id"in e&&i.isObject(t)&&"@id"in t)&&e["@id"]===t["@id"],d.compareShortestLeast=(e,t)=>e.length<t.length?-1:t.length<e.length?1:e===t?0:e<t?-1:1},1873:(e,t,n)=>{var r=n(9325).Symbol;e.exports=r},2552:(e,t,n)=>{var r=n(1873),i=n(659),o=n(9350),a=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?i(e):o(e)}},4128:(e,t,n)=>{var r=n(1800),i=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(i,""):e}},4840:(e,t,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},659:(e,t,n)=>{var r=n(1873),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=r?r.toStringTag:void 0;e.exports=function(e){var t=o.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(e){}var i=a.call(e);return r&&(t?e[s]=n:delete e[s]),i}},9350:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},9325:(e,t,n)=>{var r=n(4840),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();e.exports=o},1800:e=>{var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},2177:(e,t,n)=>{var r=n(1489);e.exports=function(e,t){var n;if("function"!=typeof t)throw new TypeError("Expected a function");return e=r(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}},3805:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},4394:(e,t,n)=>{var r=n(2552),i=n(346);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==r(e)}},8059:(e,t,n)=>{var r=n(2177);e.exports=function(e){return r(2,e)}},7400:(e,t,n)=>{var r=n(9374),i=1/0;e.exports=function(e){return e?(e=r(e))===i||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},1489:(e,t,n)=>{var r=n(7400);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},9374:(e,t,n)=>{var r=n(4128),i=n(3805),o=n(4394),a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(o(e))return NaN;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=s.test(e);return n||l.test(e)?c(e.slice(2),n?2:8):a.test(e)?NaN:+e}},9749:(e,t,n)=>{const r=n(8799),i=Symbol("max"),o=Symbol("length"),a=Symbol("lengthCalculator"),s=Symbol("allowStale"),l=Symbol("maxAge"),c=Symbol("dispose"),u=Symbol("noDisposeOnSet"),d=Symbol("lruList"),h=Symbol("cache"),f=Symbol("updateAgeOnGet"),p=()=>1,g=(e,t,n)=>{const r=e[h].get(t);if(r){const t=r.value;if(y(e,t)){if(b(e,r),!e[s])return}else n&&(e[f]&&(r.value.now=Date.now()),e[d].unshiftNode(r));return t.value}},y=(e,t)=>{if(!t||!t.maxAge&&!e[l])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[l]&&n>e[l]},m=e=>{if(e[o]>e[i])for(let t=e[d].tail;e[o]>e[i]&&null!==t;){const n=t.prev;b(e,t),t=n}},b=(e,t)=>{if(t){const n=t.value;e[c]&&e[c](n.key,n.value),e[o]-=n.length,e[h].delete(n.key),e[d].removeNode(t)}};class v{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}}const w=(e,t,n,r)=>{let i=n.value;y(e,i)&&(b(e,n),e[s]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[i]=e.max||1/0;const t=e.length||p;if(this[a]="function"!=typeof t?p:t,this[s]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[l]=e.maxAge||0,this[c]=e.dispose,this[u]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,m(this)}get max(){return this[i]}set allowStale(e){this[s]=!!e}get allowStale(){return this[s]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[l]=e,m(this)}get maxAge(){return this[l]}set lengthCalculator(e){"function"!=typeof e&&(e=p),e!==this[a]&&(this[a]=e,this[o]=0,this[d].forEach((e=>{e.length=this[a](e.value,e.key),this[o]+=e.length}))),m(this)}get lengthCalculator(){return this[a]}get length(){return this[o]}get itemCount(){return this[d].length}rforEach(e,t){t=t||this;for(let n=this[d].tail;null!==n;){const r=n.prev;w(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[d].head;null!==n;){const r=n.next;w(this,e,n,t),n=r}}keys(){return this[d].toArray().map((e=>e.key))}values(){return this[d].toArray().map((e=>e.value))}reset(){this[c]&&this[d]&&this[d].length&&this[d].forEach((e=>this[c](e.key,e.value))),this[h]=new Map,this[d]=new r,this[o]=0}dump(){return this[d].map((e=>!y(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[d]}set(e,t,n){if((n=n||this[l])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const r=n?Date.now():0,s=this[a](t,e);if(this[h].has(e)){if(s>this[i])return b(this,this[h].get(e)),!1;const a=this[h].get(e).value;return this[c]&&(this[u]||this[c](e,a.value)),a.now=r,a.maxAge=n,a.value=t,this[o]+=s-a.length,a.length=s,this.get(e),m(this),!0}const f=new v(e,t,s,r,n);return f.length>this[i]?(this[c]&&this[c](e,t),!1):(this[o]+=f.length,this[d].unshift(f),this[h].set(e,this[d].head),m(this),!0)}has(e){if(!this[h].has(e))return!1;const t=this[h].get(e).value;return!y(this,t)}get(e){return g(this,e,!0)}peek(e){return g(this,e,!1)}pop(){const e=this[d].tail;return e?(b(this,e),e.value):null}del(e){b(this,this[h].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{const e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[h].forEach(((e,t)=>g(this,t,!1)))}}},5606:e=>{var t,n,r=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var s,l=[],c=!1,u=-1;function d(){c&&s&&(c=!1,s.length?l=s.concat(l):u=-1,l.length&&h())}function h(){if(!c){var e=a(d);c=!0;for(var t=l.length;t;){for(s=l,l=[];++u<t;)s&&s[u].run();u=-1,t=l.length}s=null,c=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{return n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function p(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new f(e,t)),1!==l.length||c||a(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=p,r.addListener=p,r.once=p,r.off=p,r.removeListener=p,r.removeAllListeners=p,r.emit=p,r.prependListener=p,r.prependOnceListener=p,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},9596:(e,t,n)=>{let r;e.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:n.g):e=>(r||(r=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)))},989:(e,t,n)=>{e.exports=n(4005)},2985:e=>{e.exports=class e{constructor(e,t=new Map,n=0){this.prefix=e,this._existing=t,this.counter=n}clone(){const{prefix:t,_existing:n,counter:r}=this;return new e(t,new Map(n),r)}getId(e){const t=e&&this._existing.get(e);if(t)return t;const n=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,n),n}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}}},3751:(e,t,n)=>{n(2791);const r=self.crypto||self.msCrypto;e.exports=class{constructor(e){if(!r||!r.subtle)throw new Error("crypto.subtle not found.");if("sha256"===e)this.algorithm={name:"SHA-256"};else{if("sha1"!==e)throw new Error(`Unsupported algorithm "${e}".`);this.algorithm={name:"SHA-1"}}this._content=""}update(e){this._content+=e}async digest(){const e=(new TextEncoder).encode(this._content),t=new Uint8Array(await r.subtle.digest(this.algorithm,e));let n="";for(let e=0;e<t.length;++e)n+=t[e].toString(16).padStart(2,"0");return n}}},1227:e=>{const t="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",n="http://www.w3.org/2001/XMLSchema#string",r="NamedNode",i="BlankNode",o="Literal",a="DefaultGraph",s={};(()=>{const e="(?:<([^:]+:[^>]*)>)",t="A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_",n=t+"0-9-·̀-ͯ‿-⁀",r="(_:(?:["+t+"0-9])(?:(?:["+n+".])*(?:["+n+"]))?)",i="[ \\t]+",o="[ \\t]*",a="(?:"+e+"|"+r+")"+i,l=e+i,c="(?:"+e+"|"+r+'|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^'+e+")|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))"+o,u="(?:\\.|(?:(?:"+e+"|"+r+")"+o+"\\.))";s.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,s.empty=new RegExp("^"+o+"$"),s.quad=new RegExp("^"+o+a+l+c+u+o+"$")})(),e.exports=class e{static parse(e){const l=[],u={},d=e.split(s.eoln);let h=0;for(const e of d){if(h++,s.empty.test(e))continue;const d=e.match(s.quad);if(null===d)throw new Error("N-Quads parse error on line "+h+".");const g={subject:null,predicate:null,object:null,graph:null};if(void 0!==d[1]?g.subject={termType:r,value:d[1]}:g.subject={termType:i,value:d[2]},g.predicate={termType:r,value:d[3]},void 0!==d[4]?g.object={termType:r,value:d[4]}:void 0!==d[5]?g.object={termType:i,value:d[5]}:(g.object={termType:o,value:void 0,datatype:{termType:r}},void 0!==d[7]?g.object.datatype.value=d[7]:void 0!==d[8]?(g.object.datatype.value=t,g.object.language=d[8]):g.object.datatype.value=n,g.object.value=d[6].replace(c,(function(e,t,n,r){if(t)switch(t){case"t":return"\t";case"b":return"\b";case"n":return"\n";case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(n)return String.fromCharCode(parseInt(n,16));if(r)throw new Error("Unsupported U escape")}))),void 0!==d[9]?g.graph={termType:r,value:d[9]}:void 0!==d[10]?g.graph={termType:i,value:d[10]}:g.graph={termType:a,value:""},g.graph.value in u){let e=!0;const t=u[g.graph.value];for(const n of t)if(p=g,(f=n).subject.termType===p.subject.termType&&f.object.termType===p.object.termType&&f.subject.value===p.subject.value&&f.predicate.value===p.predicate.value&&f.object.value===p.object.value&&(f.object.termType!==o||f.object.datatype.termType===p.object.datatype.termType&&f.object.language===p.object.language&&f.object.datatype.value===p.object.datatype.value)){e=!1;break}e&&(t.push(g),l.push(g))}else u[g.graph.value]=[g],l.push(g)}var f,p;return l}static serialize(t){Array.isArray(t)||(t=e.legacyDatasetToQuads(t));const n=[];for(const r of t)n.push(e.serializeQuad(r));return n.sort().join("")}static serializeQuadComponents(e,o,a,s){let c="";return e.termType===r?c+=`<${e.value}>`:c+=`${e.value}`,c+=` <${o.value}> `,a.termType===r?c+=`<${a.value}>`:a.termType===i?c+=a.value:(c+=`"${function(e){return e.replace(l,(function(e){switch(e){case'"':return'\\"';case"\\":return"\\\\";case"\n":return"\\n";case"\r":return"\\r"}}))}(a.value)}"`,a.datatype.value===t?a.language&&(c+=`@${a.language}`):a.datatype.value!==n&&(c+=`^^<${a.datatype.value}>`)),s.termType===r?c+=` <${s.value}>`:s.termType===i&&(c+=` ${s.value}`),c+=" .\n",c}static serializeQuad(t){return e.serializeQuadComponents(t.subject,t.predicate,t.object,t.graph)}static legacyDatasetToQuads(e){const s=[],l={"blank node":i,IRI:r,literal:o};for(const c in e)e[c].forEach((e=>{const u={};for(const i in e){const a=e[i],s={termType:l[a.type],value:a.value};s.termType===o&&(s.datatype={termType:r},"datatype"in a&&(s.datatype.value=a.datatype),"language"in a?("datatype"in a||(s.datatype.value=t),s.language=a.language):"datatype"in a||(s.datatype.value=n)),u[i]=s}u.graph="@default"===c?{termType:a,value:""}:{termType:c.startsWith("_:")?i:r,value:c},s.push(u)}));return s}};const l=/["\\\n\r]/g,c=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g},9925:e=>{e.exports=class{constructor(e){this.current=e.sort(),this.done=!1,this.dir=new Map;for(let t=0;t<e.length;++t)this.dir.set(e[t],!0)}hasNext(){return!this.done}next(){const{current:e,dir:t}=this,n=e.slice();let r=null,i=0;const o=e.length;for(let n=0;n<o;++n){const a=e[n],s=t.get(a);(null===r||a>r)&&(s&&n>0&&a>e[n-1]||!s&&n<o-1&&a>e[n+1])&&(r=a,i=n)}if(null===r)this.done=!0;else{const n=t.get(r)?i-1:i+1;e[i]=e[n],e[n]=r;for(const n of e)n>r&&t.set(n,!t.get(n))}return n}}},3513:(e,t,n)=>{const r=n(2985),i=n(3751),o=n(9925),a=n(1227);function s(e,t){return e.hash<t.hash?-1:e.hash>t.hash?1:0}e.exports=class{constructor({createMessageDigest:e=()=>new i("sha256"),canonicalIdMap:t=new Map,maxDeepIterations:n=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",t),this.createMessageDigest=e,this.maxDeepIterations=n,this.quads=null,this.deepIterations=null}async main(e){this.deepIterations=new Map,this.quads=e;for(const t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});const t=new Map,n=[...this.blankNodeInfo.keys()];let i=0;for(const e of n)++i%100==0&&await this._yield(),await this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});const o=[...t.keys()].sort(),l=[];for(const e of o){const n=t.get(e);if(n.length>1){l.push(n);continue}const r=n[0];this.canonicalIssuer.getId(r)}for(const e of l){const t=[];for(const n of e){if(this.canonicalIssuer.hasId(n))continue;const e=new r("_:b");e.getId(n);const i=await this.hashNDegreeQuads(n,e);t.push(i)}t.sort(s);for(const e of t){const t=e.issuer.getOldIds();for(const e of t)this.canonicalIssuer.getId(e)}}const c=[];for(const e of this.quads){const t=a.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));c.push(t)}return c.sort(),c.join("")}async hashFirstDegreeQuads(e){const t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(const n of r){const r={subject:null,predicate:n.predicate,object:null,graph:null};r.subject=this.modifyFirstDegreeComponent(e,n.subject,"subject"),r.object=this.modifyFirstDegreeComponent(e,n.object,"object"),r.graph=this.modifyFirstDegreeComponent(e,n.graph,"graph"),t.push(a.serializeQuad(r))}t.sort();const i=this.createMessageDigest();for(const e of t)i.update(e);return n.hash=await i.digest(),n.hash}async hashRelatedBlankNode(e,t,n,r){let i;i=this.canonicalIssuer.hasId(e)?this.canonicalIssuer.getId(e):n.hasId(e)?n.getId(e):this.blankNodeInfo.get(e).hash;const o=this.createMessageDigest();return o.update(r),"g"!==r&&o.update(this.getRelatedPredicate(t)),o.update(i),o.digest()}async hashNDegreeQuads(e,t){const n=this.deepIterations.get(e)||0;if(n>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(e,n+1);const r=this.createMessageDigest(),i=await this.createHashToRelated(e,t),a=[...i.keys()].sort();for(const e of a){r.update(e);let n,a="";const s=new o(i.get(e));let l=0;for(;s.hasNext();){const e=s.next();++l%3==0&&await this._yield();let r=t.clone(),i="";const o=[];let c=!1;for(const t of e)if(this.canonicalIssuer.hasId(t)?i+=this.canonicalIssuer.getId(t):(r.hasId(t)||o.push(t),i+=r.getId(t)),0!==a.length&&i>a){c=!0;break}if(!c){for(const e of o){const t=await this.hashNDegreeQuads(e,r);if(i+=r.getId(e),i+=`<${t.hash}>`,r=t.issuer,0!==a.length&&i>a){c=!0;break}}c||(0===a.length||i<a)&&(a=i,n=r)}}r.update(a),t=n}return{hash:await r.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return"BlankNode"!==t.termType?t:{termType:"BlankNode",value:t.value===e?"_:a":"_:z"}}getRelatedPredicate(e){return`<${e.predicate.value}>`}async createHashToRelated(e,t){const n=new Map,r=this.blankNodeInfo.get(e).quads;let i=0;for(const o of r)++i%100==0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:o,component:o.subject,position:"s",id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:o,component:o.object,position:"o",id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:o,component:o.graph,position:"g",id:e,issuer:t,hashToRelated:n})]);return n}async _hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){const n=await this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if("BlankNode"!==t.termType)return;const n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}async _addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:o}){if("BlankNode"!==t.termType||t.value===r)return;const a=t.value,s=await this.hashRelatedBlankNode(a,e,i,n),l=o.get(s);l?l.push(a):o.set(s,[a])}_componentWithCanonicalId(e){return"BlankNode"!==e.termType||e.value.startsWith(this.canonicalIssuer.prefix)?e:{termType:"BlankNode",value:this.canonicalIssuer.getId(e.value)}}async _yield(){return new Promise((e=>setImmediate(e)))}}},2438:(e,t,n)=>{const r=n(2985),i=n(3751),o=n(9925),a=n(1227);function s(e,t){return e.hash<t.hash?-1:e.hash>t.hash?1:0}e.exports=class{constructor({createMessageDigest:e=()=>new i("sha256"),canonicalIdMap:t=new Map,maxDeepIterations:n=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",t),this.createMessageDigest=e,this.maxDeepIterations=n,this.quads=null,this.deepIterations=null}main(e){this.deepIterations=new Map,this.quads=e;for(const t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});const t=new Map,n=[...this.blankNodeInfo.keys()];for(const e of n)this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});const i=[...t.keys()].sort(),o=[];for(const e of i){const n=t.get(e);if(n.length>1){o.push(n);continue}const r=n[0];this.canonicalIssuer.getId(r)}for(const e of o){const t=[];for(const n of e){if(this.canonicalIssuer.hasId(n))continue;const e=new r("_:b");e.getId(n);const i=this.hashNDegreeQuads(n,e);t.push(i)}t.sort(s);for(const e of t){const t=e.issuer.getOldIds();for(const e of t)this.canonicalIssuer.getId(e)}}const l=[];for(const e of this.quads){const t=a.serializeQuadComponents(this._componentWithCanonicalId({component:e.subject}),e.predicate,this._componentWithCanonicalId({component:e.object}),this._componentWithCanonicalId({component:e.graph}));l.push(t)}return l.sort(),l.join("")}hashFirstDegreeQuads(e){const t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(const n of r){const r={subject:null,predicate:n.predicate,object:null,graph:null};r.subject=this.modifyFirstDegreeComponent(e,n.subject,"subject"),r.object=this.modifyFirstDegreeComponent(e,n.object,"object"),r.graph=this.modifyFirstDegreeComponent(e,n.graph,"graph"),t.push(a.serializeQuad(r))}t.sort();const i=this.createMessageDigest();for(const e of t)i.update(e);return n.hash=i.digest(),n.hash}hashRelatedBlankNode(e,t,n,r){let i;i=this.canonicalIssuer.hasId(e)?this.canonicalIssuer.getId(e):n.hasId(e)?n.getId(e):this.blankNodeInfo.get(e).hash;const o=this.createMessageDigest();return o.update(r),"g"!==r&&o.update(this.getRelatedPredicate(t)),o.update(i),o.digest()}hashNDegreeQuads(e,t){const n=this.deepIterations.get(e)||0;if(n>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(e,n+1);const r=this.createMessageDigest(),i=this.createHashToRelated(e,t),a=[...i.keys()].sort();for(const e of a){r.update(e);let n,a="";const s=new o(i.get(e));for(;s.hasNext();){const e=s.next();let r=t.clone(),i="";const o=[];let l=!1;for(const t of e)if(this.canonicalIssuer.hasId(t)?i+=this.canonicalIssuer.getId(t):(r.hasId(t)||o.push(t),i+=r.getId(t)),0!==a.length&&i>a){l=!0;break}if(!l){for(const e of o){const t=this.hashNDegreeQuads(e,r);if(i+=r.getId(e),i+=`<${t.hash}>`,r=t.issuer,0!==a.length&&i>a){l=!0;break}}l||(0===a.length||i<a)&&(a=i,n=r)}}r.update(a),t=n}return{hash:r.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return"BlankNode"!==t.termType?t:{termType:"BlankNode",value:t.value===e?"_:a":"_:z"}}getRelatedPredicate(e){return`<${e.predicate.value}>`}createHashToRelated(e,t){const n=new Map,r=this.blankNodeInfo.get(e).quads;for(const i of r)this._addRelatedBlankNodeHash({quad:i,component:i.subject,position:"s",id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.object,position:"o",id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.graph,position:"g",id:e,issuer:t,hashToRelated:n});return n}_hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){const n=this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if("BlankNode"!==t.termType)return;const n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}_addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:o}){if("BlankNode"!==t.termType||t.value===r)return;const a=t.value,s=this.hashRelatedBlankNode(a,e,i,n),l=o.get(s);l?l.push(a):o.set(s,[a])}_componentWithCanonicalId({component:e}){return"BlankNode"!==e.termType||e.value.startsWith(this.canonicalIssuer.prefix)?e:{termType:"BlankNode",value:this.canonicalIssuer.getId(e.value)}}}},3845:(e,t,n)=>{const r=n(3751),i=n(3513);e.exports=class extends i{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new r("sha1")}modifyFirstDegreeComponent(e,t,n){return"BlankNode"!==t.termType?t:"graph"===n?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:t.value===e?"_:a":"_:z"}}getRelatedPredicate(e){return e.predicate.value}async createHashToRelated(e,t){const n=new Map,r=this.blankNodeInfo.get(e).quads;let i=0;for(const o of r){let r,a;if("BlankNode"===o.subject.termType&&o.subject.value!==e)a=o.subject.value,r="p";else{if("BlankNode"!==o.object.termType||o.object.value===e)continue;a=o.object.value,r="r"}++i%100==0&&await this._yield();const s=await this.hashRelatedBlankNode(a,o,t,r),l=n.get(s);l?l.push(a):n.set(s,[a])}return n}}},378:(e,t,n)=>{const r=n(3751),i=n(2438);e.exports=class extends i{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new r("sha1")}modifyFirstDegreeComponent(e,t,n){return"BlankNode"!==t.termType?t:"graph"===n?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:t.value===e?"_:a":"_:z"}}getRelatedPredicate(e){return e.predicate.value}createHashToRelated(e,t){const n=new Map,r=this.blankNodeInfo.get(e).quads;for(const i of r){let r,o;if("BlankNode"===i.subject.termType&&i.subject.value!==e)o=i.subject.value,r="p";else{if("BlankNode"!==i.object.termType||i.object.value===e)continue;o=i.object.value,r="r"}const a=this.hashRelatedBlankNode(o,i,t,r),s=n.get(a);s?s.push(o):n.set(a,[o])}return n}}},4005:(e,t,n)=>{const r=n(3513),i=n(3845),o=n(2438),a=n(378);let s;try{s=n(7789)}catch(e){}function l(e){return Array.isArray(e)?e:t.NQuads.legacyDatasetToQuads(e)}t.NQuads=n(1227),t.IdentifierIssuer=n(2985),t._rdfCanonizeNative=function(e){return e&&(s=e),s},t.canonize=async function(e,t){const n=l(e);if(t.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(t.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return new Promise(((e,r)=>s.canonize(n,t,((t,n)=>t?r(t):e(n)))))}if("URDNA2015"===t.algorithm)return new r(t).main(n);if("URGNA2012"===t.algorithm){if(t.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new i(t).main(n)}if(!("algorithm"in t))throw new Error("No RDF Dataset Canonicalization algorithm specified.");throw new Error("Invalid RDF Dataset Canonicalization algorithm: "+t.algorithm)},t._canonizeSync=function(e,t){const n=l(e);if(t.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(t.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return s.canonizeSync(n,t)}if("URDNA2015"===t.algorithm)return new o(t).main(n);if("URGNA2012"===t.algorithm){if(t.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new a(t).main(n)}if(!("algorithm"in t))throw new Error("No RDF Dataset Canonicalization algorithm specified.");throw new Error("Invalid RDF Dataset Canonicalization algorithm: "+t.algorithm)}},7793:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(9931),t),i(n(8483),t),i(n(2142),t),i(n(2426),t),i(n(3988),t),i(n(6754),t),i(n(8401),t)},9931:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BlankNode=void 0,t.BlankNode=class{constructor(e){this.termType="BlankNode",this.value=e}equals(e){return!!e&&"BlankNode"===e.termType&&e.value===this.value}}},8483:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DataFactory=void 0;const r=n(9931),i=n(2142),o=n(2426),a=n(3988),s=n(6754),l=n(8401);let c=0;t.DataFactory=class{constructor(e){this.blankNodeCounter=0,e=e||{},this.blankNodePrefix=e.blankNodePrefix||`df_${c++}_`}namedNode(e){return new a.NamedNode(e)}blankNode(e){return new r.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new o.Literal(e,t)}variable(e){return new l.Variable(e)}defaultGraph(){return i.DefaultGraph.INSTANCE}quad(e,t,n,r){return new s.Quad(e,t,n,r||this.defaultGraph())}fromTerm(e){switch(e.termType){case"NamedNode":return this.namedNode(e.value);case"BlankNode":return this.blankNode(e.value);case"Literal":return e.language?this.literal(e.value,e.language):e.datatype.equals(o.Literal.XSD_STRING)?this.literal(e.value):this.literal(e.value,this.fromTerm(e.datatype));case"Variable":return this.variable(e.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(e.subject),this.fromTerm(e.predicate),this.fromTerm(e.object),this.fromTerm(e.graph))}}fromQuad(e){return this.fromTerm(e)}resetBlankNodeCounter(){this.blankNodeCounter=0}}},2142:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultGraph=void 0;class n{constructor(){this.termType="DefaultGraph",this.value=""}equals(e){return!!e&&"DefaultGraph"===e.termType}}t.DefaultGraph=n,n.INSTANCE=new n},2426:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Literal=void 0;const r=n(3988);class i{constructor(e,t){this.termType="Literal",this.value=e,"string"==typeof t?(this.language=t,this.datatype=i.RDF_LANGUAGE_STRING):t?(this.language="",this.datatype=t):(this.language="",this.datatype=i.XSD_STRING)}equals(e){return!!e&&"Literal"===e.termType&&e.value===this.value&&e.language===this.language&&this.datatype.equals(e.datatype)}}t.Literal=i,i.RDF_LANGUAGE_STRING=new r.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),i.XSD_STRING=new r.NamedNode("http://www.w3.org/2001/XMLSchema#string")},3988:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NamedNode=void 0,t.NamedNode=class{constructor(e){this.termType="NamedNode",this.value=e}equals(e){return!!e&&"NamedNode"===e.termType&&e.value===this.value}}},6754:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Quad=void 0,t.Quad=class{constructor(e,t,n,r){this.termType="Quad",this.value="",this.subject=e,this.predicate=t,this.object=n,this.graph=r}equals(e){return!!e&&("Quad"===e.termType||!e.termType)&&this.subject.equals(e.subject)&&this.predicate.equals(e.predicate)&&this.object.equals(e.object)&&this.graph.equals(e.graph)}}},8401:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Variable=void 0,t.Variable=class{constructor(e){this.termType="Variable",this.value=e}equals(e){return!!e&&"Variable"===e.termType&&e.value===this.value}}},9349:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.getSupportedJavaScriptPrimitives=t.getSupportedRdfDatatypes=t.getTermRaw=t.toRdf=t.fromRdf=void 0;const o=n(7793),a=n(4802),s=n(103);i(n(4802),t),i(n(5448),t),i(n(103),t);const l=new o.DataFactory,c=new s.Translator;function u(e,t){return c.fromRdf(e,t)}c.registerHandler(new a.TypeHandlerString,a.TypeHandlerString.TYPES.map((e=>l.namedNode(e))),["string"]),c.registerHandler(new a.TypeHandlerBoolean,[a.TypeHandlerBoolean.TYPE].map((e=>l.namedNode(e))),["boolean"]),c.registerHandler(new a.TypeHandlerNumberDouble,a.TypeHandlerNumberDouble.TYPES.map((e=>l.namedNode(e))),["number"]),c.registerHandler(new a.TypeHandlerNumberInteger,a.TypeHandlerNumberInteger.TYPES.map((e=>l.namedNode(e))),["number"]),c.registerHandler(new a.TypeHandlerDate,a.TypeHandlerDate.TYPES.map((e=>l.namedNode(e))),["object"]),t.fromRdf=u,t.toRdf=function(e,t){return t&&"namedNode"in t&&(t={dataFactory:t}),(t=t||{})&&!t.dataFactory&&(t.dataFactory=l),c.toRdf(e,t)},t.getTermRaw=function(e,t){return"Literal"===e.termType?u(e,t):e.value},t.getSupportedRdfDatatypes=function(){return c.getSupportedRdfDatatypes()},t.getSupportedJavaScriptPrimitives=function(){return c.getSupportedJavaScriptPrimitives()}},5448:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},103:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Translator=void 0,t.Translator=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(e){throw new Error(`Invalid RDF ${e.datatype.value} value: '${e.value}'`)}registerHandler(e,t,n){for(const n of t)this.supportedRdfDatatypes.push(n),this.fromRdfHandlers[n.value]=e;for(const t of n){let n=this.toRdfHandlers[t];n||(this.toRdfHandlers[t]=n=[]),n.push(e)}}fromRdf(e,t){const n=this.fromRdfHandlers[e.datatype.value];return n?n.fromRdf(e,t):e.value}toRdf(e,t){const n=this.toRdfHandlers[typeof e];if(n)for(const r of n){const n=r.toRdf(e,t);if(n)return n}throw new Error(`Invalid JavaScript value: '${e}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}}},92:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TypeHandlerBoolean=void 0;const r=n(103);class i{fromRdf(e,t){switch(e.value){case"true":case"1":return!0;case"false":case"0":return!1}return t&&r.Translator.incorrectRdfDataType(e),!1}toRdf(e,{datatype:t,dataFactory:n}){return n.literal(e?"true":"false",t||n.namedNode(i.TYPE))}}i.TYPE="http://www.w3.org/2001/XMLSchema#boolean",t.TypeHandlerBoolean=i},7258:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TypeHandlerDate=void 0;const r=n(103);class i{fromRdf(e,t){switch(t&&!e.value.match(i.VALIDATORS[e.datatype.value.substr(33,e.datatype.value.length)])&&r.Translator.incorrectRdfDataType(e),e.datatype.value){case"http://www.w3.org/2001/XMLSchema#gDay":return new Date(0,0,parseInt(e.value,10));case"http://www.w3.org/2001/XMLSchema#gMonthDay":const t=e.value.split("-");return new Date(0,parseInt(t[0],10)-1,parseInt(t[1],10));case"http://www.w3.org/2001/XMLSchema#gYear":return new Date(e.value+"-01-01");case"http://www.w3.org/2001/XMLSchema#gYearMonth":return new Date(e.value+"-01");default:return new Date(e.value)}}toRdf(e,{datatype:t,dataFactory:n}){if(t=t||n.namedNode(i.TYPES[0]),!(e instanceof Date))return null;const r=e;let o;switch(t.value){case"http://www.w3.org/2001/XMLSchema#gDay":o=String(r.getUTCDate());break;case"http://www.w3.org/2001/XMLSchema#gMonthDay":o=r.getUTCMonth()+1+"-"+r.getUTCDate();break;case"http://www.w3.org/2001/XMLSchema#gYear":o=String(r.getUTCFullYear());break;case"http://www.w3.org/2001/XMLSchema#gYearMonth":o=r.getUTCFullYear()+"-"+(r.getUTCMonth()+1);break;case"http://www.w3.org/2001/XMLSchema#date":o=r.toISOString().replace(/T.*$/,"");break;default:o=r.toISOString()}return n.literal(o,t)}}i.TYPES=["http://www.w3.org/2001/XMLSchema#dateTime","http://www.w3.org/2001/XMLSchema#date","http://www.w3.org/2001/XMLSchema#gDay","http://www.w3.org/2001/XMLSchema#gMonthDay","http://www.w3.org/2001/XMLSchema#gYear","http://www.w3.org/2001/XMLSchema#gYearMonth"],i.VALIDATORS={date:/^[0-9]+-[0-9][0-9]-[0-9][0-9]Z?$/,dateTime:/^[0-9]+-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9](\.[0-9][0-9][0-9])?((Z?)|([\+-][0-9][0-9]:[0-9][0-9]))$/,gDay:/^[0-9]+$/,gMonthDay:/^[0-9]+-[0-9][0-9]$/,gYear:/^[0-9]+$/,gYearMonth:/^[0-9]+-[0-9][0-9]$/},t.TypeHandlerDate=i},2406:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TypeHandlerNumberDouble=void 0;const r=n(103);class i{fromRdf(e,t){const n=parseFloat(e.value);return t&&isNaN(n)&&r.Translator.incorrectRdfDataType(e),n}toRdf(e,{datatype:t,dataFactory:n}){return t=t||n.namedNode(i.TYPES[0]),isNaN(e)?n.literal("NaN",t):isFinite(e)?e%1==0?null:n.literal(e.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),t):n.literal(e>0?"INF":"-INF",t)}}i.TYPES=["http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float"],t.TypeHandlerNumberDouble=i},6925:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TypeHandlerNumberInteger=void 0;const r=n(103);class i{fromRdf(e,t){const n=parseInt(e.value,10);return t&&(isNaN(n)||e.value.indexOf(".")>=0)&&r.Translator.incorrectRdfDataType(e),n}toRdf(e,{datatype:t,dataFactory:n}){return n.literal(String(e),t||(e<=i.MAX_INT&&e>=i.MIN_INT?n.namedNode(i.TYPES[0]):n.namedNode(i.TYPES[1])))}}i.TYPES=["http://www.w3.org/2001/XMLSchema#integer","http://www.w3.org/2001/XMLSchema#long","http://www.w3.org/2001/XMLSchema#int","http://www.w3.org/2001/XMLSchema#byte","http://www.w3.org/2001/XMLSchema#short","http://www.w3.org/2001/XMLSchema#negativeInteger","http://www.w3.org/2001/XMLSchema#nonNegativeInteger","http://www.w3.org/2001/XMLSchema#nonPositiveInteger","http://www.w3.org/2001/XMLSchema#positiveInteger","http://www.w3.org/2001/XMLSchema#unsignedByte","http://www.w3.org/2001/XMLSchema#unsignedInt","http://www.w3.org/2001/XMLSchema#unsignedLong","http://www.w3.org/2001/XMLSchema#unsignedShort"],i.MAX_INT=2147483647,i.MIN_INT=-2147483648,t.TypeHandlerNumberInteger=i},4191:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TypeHandlerString=void 0;class n{fromRdf(e){return e.value}toRdf(e,{datatype:t,dataFactory:n}){return n.literal(e,t)}}n.TYPES=["http://www.w3.org/2001/XMLSchema#string","http://www.w3.org/2001/XMLSchema#normalizedString","http://www.w3.org/2001/XMLSchema#anyURI","http://www.w3.org/2001/XMLSchema#base64Binary","http://www.w3.org/2001/XMLSchema#language","http://www.w3.org/2001/XMLSchema#Name","http://www.w3.org/2001/XMLSchema#NCName","http://www.w3.org/2001/XMLSchema#NMTOKEN","http://www.w3.org/2001/XMLSchema#token","http://www.w3.org/2001/XMLSchema#hexBinary","http://www.w3.org/1999/02/22-rdf-syntax-ns#langString","http://www.w3.org/2001/XMLSchema#time","http://www.w3.org/2001/XMLSchema#duration"],t.TypeHandlerString=n},4802:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(92),t),i(n(7258),t),i(n(2406),t),i(n(6925),t),i(n(4191),t)},4147:(e,t,n)=>{const{SymbolDispose:r}=n(4134),{AbortError:i,codes:o}=n(6371),{isNodeStream:a,isWebStream:s,kControllerErrorFunction:l}=n(6115),c=n(6238),{ERR_INVALID_ARG_TYPE:u}=o;let d;e.exports.addAbortSignal=function(t,n){if((e=>{if("object"!=typeof e||!("aborted"in e))throw new u("signal","AbortSignal",e)})(t),!a(n)&&!s(n))throw new u("stream",["ReadableStream","WritableStream","Stream"],n);return e.exports.addAbortSignalNoValidate(t,n)},e.exports.addAbortSignalNoValidate=function(e,t){if("object"!=typeof e||!("aborted"in e))return t;const o=a(t)?()=>{t.destroy(new i(void 0,{cause:e.reason}))}:()=>{t[l](new i(void 0,{cause:e.reason}))};if(e.aborted)o();else{d=d||n(7760).addAbortListener;const i=d(e,o);c(t,i[r])}return t}},345:(e,t,n)=>{const{StringPrototypeSlice:r,SymbolIterator:i,TypedArrayPrototypeSet:o,Uint8Array:a}=n(4134),{Buffer:s}=n(8287),{inspect:l}=n(7760);e.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){const t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){const t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}shift(){if(0===this.length)return;const e=this.head.data;return 1===this.length?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(0===this.length)return"";let t=this.head,n=""+t.data;for(;null!==(t=t.next);)n+=e+t.data;return n}concat(e){if(0===this.length)return s.alloc(0);const t=s.allocUnsafe(e>>>0);let n=this.head,r=0;for(;n;)o(t,n.data,r),r+=n.data.length,n=n.next;return t}consume(e,t){const n=this.head.data;if(e<n.length){const t=n.slice(0,e);return this.head.data=n.slice(e),t}return e===n.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[i](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let t="",n=this.head,i=0;do{const o=n.data;if(!(e>o.length)){e===o.length?(t+=o,++i,n.next?this.head=n.next:this.head=this.tail=null):(t+=r(o,0,e),this.head=n,n.data=r(o,e));break}t+=o,e-=o.length,++i}while(null!==(n=n.next));return this.length-=i,t}_getBuffer(e){const t=s.allocUnsafe(e),n=e;let r=this.head,i=0;do{const s=r.data;if(!(e>s.length)){e===s.length?(o(t,s,n-e),++i,r.next?this.head=r.next:this.head=this.tail=null):(o(t,new a(s.buffer,s.byteOffset,e),n-e),this.head=r,r.data=s.slice(e));break}o(t,s,n-e),e-=s.length,++i}while(null!==(r=r.next));return this.length-=i,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return l(this,{...t,depth:0,customInspect:!1})}}},7830:(e,t,n)=>{const{pipeline:r}=n(7758),i=n(3370),{destroyer:o}=n(5896),{isNodeStream:a,isReadable:s,isWritable:l,isWebStream:c,isTransformStream:u,isWritableStream:d,isReadableStream:h}=n(6115),{AbortError:f,codes:{ERR_INVALID_ARG_VALUE:p,ERR_MISSING_ARGS:g}}=n(6371),y=n(6238);e.exports=function(...e){if(0===e.length)throw new g("streams");if(1===e.length)return i.from(e[0]);const t=[...e];if("function"==typeof e[0]&&(e[0]=i.from(e[0])),"function"==typeof e[e.length-1]){const t=e.length-1;e[t]=i.from(e[t])}for(let n=0;n<e.length;++n)if(a(e[n])||c(e[n])){if(n<e.length-1&&!(s(e[n])||h(e[n])||u(e[n])))throw new p(`streams[${n}]`,t[n],"must be readable");if(n>0&&!(l(e[n])||d(e[n])||u(e[n])))throw new p(`streams[${n}]`,t[n],"must be writable")}let n,m,b,v,w;const _=e[0],x=r(e,(function(e){const t=v;v=null,t?t(e):e?w.destroy(e):j||S||w.destroy()})),S=!!(l(_)||d(_)||u(_)),j=!!(s(x)||h(x)||u(x));if(w=new i({writableObjectMode:!(null==_||!_.writableObjectMode),readableObjectMode:!(null==x||!x.readableObjectMode),writable:S,readable:j}),S){if(a(_))w._write=function(e,t,r){_.write(e,t)?r():n=r},w._final=function(e){_.end(),m=e},_.on("drain",(function(){if(n){const e=n;n=null,e()}}));else if(c(_)){const e=(u(_)?_.writable:_).getWriter();w._write=async function(t,n,r){try{await e.ready,e.write(t).catch((()=>{})),r()}catch(e){r(e)}},w._final=async function(t){try{await e.ready,e.close().catch((()=>{})),m=t}catch(e){t(e)}}}const e=u(x)?x.readable:x;y(e,(()=>{if(m){const e=m;m=null,e()}}))}if(j)if(a(x))x.on("readable",(function(){if(b){const e=b;b=null,e()}})),x.on("end",(function(){w.push(null)})),w._read=function(){for(;;){const e=x.read();if(null===e)return void(b=w._read);if(!w.push(e))return}};else if(c(x)){const e=(u(x)?x.readable:x).getReader();w._read=async function(){for(;;)try{const{value:t,done:n}=await e.read();if(!w.push(t))return;if(n)return void w.push(null)}catch{return}}}return w._destroy=function(e,t){e||null===v||(e=new f),b=null,n=null,m=null,null===v?t(e):(v=t,a(x)&&o(x,e))},w}},5896:(e,t,n)=>{const r=n(5606),{aggregateTwoErrors:i,codes:{ERR_MULTIPLE_CALLBACK:o},AbortError:a}=n(6371),{Symbol:s}=n(4134),{kIsDestroyed:l,isDestroyed:c,isFinished:u,isServerRequest:d}=n(6115),h=s("kDestroy"),f=s("kConstruct");function p(e,t,n){e&&(e.stack,t&&!t.errored&&(t.errored=e),n&&!n.errored&&(n.errored=e))}function g(e,t,n){let i=!1;function o(t){if(i)return;i=!0;const o=e._readableState,a=e._writableState;p(t,a,o),a&&(a.closed=!0),o&&(o.closed=!0),"function"==typeof n&&n(t),t?r.nextTick(y,e,t):r.nextTick(m,e)}try{e._destroy(t||null,o)}catch(t){o(t)}}function y(e,t){b(e,t),m(e)}function m(e){const t=e._readableState,n=e._writableState;n&&(n.closeEmitted=!0),t&&(t.closeEmitted=!0),(null!=n&&n.emitClose||null!=t&&t.emitClose)&&e.emit("close")}function b(e,t){const n=e._readableState,r=e._writableState;null!=r&&r.errorEmitted||null!=n&&n.errorEmitted||(r&&(r.errorEmitted=!0),n&&(n.errorEmitted=!0),e.emit("error",t))}function v(e,t,n){const i=e._readableState,o=e._writableState;if(null!=o&&o.destroyed||null!=i&&i.destroyed)return this;null!=i&&i.autoDestroy||null!=o&&o.autoDestroy?e.destroy(t):t&&(t.stack,o&&!o.errored&&(o.errored=t),i&&!i.errored&&(i.errored=t),n?r.nextTick(b,e,t):b(e,t))}function w(e){let t=!1;function n(n){if(t)return void v(e,null!=n?n:new o);t=!0;const i=e._readableState,a=e._writableState,s=a||i;i&&(i.constructed=!0),a&&(a.constructed=!0),s.destroyed?e.emit(h,n):n?v(e,n,!0):r.nextTick(_,e)}try{e._construct((e=>{r.nextTick(n,e)}))}catch(e){r.nextTick(n,e)}}function _(e){e.emit(f)}function x(e){return(null==e?void 0:e.setHeader)&&"function"==typeof e.abort}function S(e){e.emit("close")}function j(e,t){e.emit("error",t),r.nextTick(S,e)}e.exports={construct:function(e,t){if("function"!=typeof e._construct)return;const n=e._readableState,i=e._writableState;n&&(n.constructed=!1),i&&(i.constructed=!1),e.once(f,t),e.listenerCount(f)>1||r.nextTick(w,e)},destroyer:function(e,t){e&&!c(e)&&(t||u(e)||(t=new a),d(e)?(e.socket=null,e.destroy(t)):x(e)?e.abort():x(e.req)?e.req.abort():"function"==typeof e.destroy?e.destroy(t):"function"==typeof e.close?e.close():t?r.nextTick(j,e,t):r.nextTick(S,e),e.destroyed||(e[l]=!0))},destroy:function(e,t){const n=this._readableState,r=this._writableState,o=r||n;return null!=r&&r.destroyed||null!=n&&n.destroyed?("function"==typeof t&&t(),this):(p(e,r,n),r&&(r.destroyed=!0),n&&(n.destroyed=!0),o.constructed?g(this,e,t):this.once(h,(function(n){g(this,i(n,e),t)})),this)},undestroy:function(){const e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=!1===e.readable,e.endEmitted=!1===e.readable),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=!1===t.writable,t.ending=!1===t.writable,t.finished=!1===t.writable)},errorOrDestroy:v}},3370:(e,t,n)=>{const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:i,ObjectKeys:o,ObjectSetPrototypeOf:a}=n(4134);e.exports=c;const s=n(7576),l=n(8584);a(c.prototype,s.prototype),a(c,s);{const e=o(l.prototype);for(let t=0;t<e.length;t++){const n=e[t];c.prototype[n]||(c.prototype[n]=l.prototype[n])}}function c(e){if(!(this instanceof c))return new c(e);s.call(this,e),l.call(this,e),e?(this.allowHalfOpen=!1!==e.allowHalfOpen,!1===e.readable&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===e.writable&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}let u,d;function h(){return void 0===u&&(u={}),u}r(c.prototype,{writable:{__proto__:null,...i(l.prototype,"writable")},writableHighWaterMark:{__proto__:null,...i(l.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...i(l.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...i(l.prototype,"writableBuffer")},writableLength:{__proto__:null,...i(l.prototype,"writableLength")},writableFinished:{__proto__:null,...i(l.prototype,"writableFinished")},writableCorked:{__proto__:null,...i(l.prototype,"writableCorked")},writableEnded:{__proto__:null,...i(l.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...i(l.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}}),c.fromWeb=function(e,t){return h().newStreamDuplexFromReadableWritablePair(e,t)},c.toWeb=function(e){return h().newReadableWritablePairFromDuplex(e)},c.from=function(e){return d||(d=n(6706)),d(e,"body")}},6706:(e,t,n)=>{const r=n(5606),i=n(8287),{isReadable:o,isWritable:a,isIterable:s,isNodeStream:l,isReadableNodeStream:c,isWritableNodeStream:u,isDuplexNodeStream:d,isReadableStream:h,isWritableStream:f}=n(6115),p=n(6238),{AbortError:g,codes:{ERR_INVALID_ARG_TYPE:y,ERR_INVALID_RETURN_VALUE:m}}=n(6371),{destroyer:b}=n(5896),v=n(3370),w=n(7576),_=n(8584),{createDeferredPromise:x}=n(7760),S=n(6532),j=globalThis.Blob||i.Blob,I=void 0!==j?function(e){return e instanceof j}:function(e){return!1},E=globalThis.AbortController||n(5568).AbortController,{FunctionPrototypeCall:N}=n(4134);class T extends v{constructor(e){super(e),!1===(null==e?void 0:e.readable)&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===(null==e?void 0:e.writable)&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}function R(e){const t=e.readable&&"function"!=typeof e.readable.read?w.wrap(e.readable):e.readable,n=e.writable;let r,i,s,l,c,u=!!o(t),d=!!a(n);function h(e){const t=l;l=null,t?t(e):e&&c.destroy(e)}return c=new T({readableObjectMode:!(null==t||!t.readableObjectMode),writableObjectMode:!(null==n||!n.writableObjectMode),readable:u,writable:d}),d&&(p(n,(e=>{d=!1,e&&b(t,e),h(e)})),c._write=function(e,t,i){n.write(e,t)?i():r=i},c._final=function(e){n.end(),i=e},n.on("drain",(function(){if(r){const e=r;r=null,e()}})),n.on("finish",(function(){if(i){const e=i;i=null,e()}}))),u&&(p(t,(e=>{u=!1,e&&b(t,e),h(e)})),t.on("readable",(function(){if(s){const e=s;s=null,e()}})),t.on("end",(function(){c.push(null)})),c._read=function(){for(;;){const e=t.read();if(null===e)return void(s=c._read);if(!c.push(e))return}}),c._destroy=function(e,o){e||null===l||(e=new g),s=null,r=null,i=null,null===l?o(e):(l=o,b(n,e),b(t,e))},c}e.exports=function e(t,n){if(d(t))return t;if(c(t))return R({readable:t});if(u(t))return R({writable:t});if(l(t))return R({writable:!1,readable:!1});if(h(t))return R({readable:w.fromWeb(t)});if(f(t))return R({writable:_.fromWeb(t)});if("function"==typeof t){const{value:e,write:i,final:o,destroy:a}=function(e){let{promise:t,resolve:n}=x();const i=new E,o=i.signal;return{value:e(async function*(){for(;;){const e=t;t=null;const{chunk:i,done:a,cb:s}=await e;if(r.nextTick(s),a)return;if(o.aborted)throw new g(void 0,{cause:o.reason});({promise:t,resolve:n}=x()),yield i}}(),{signal:o}),write(e,t,r){const i=n;n=null,i({chunk:e,done:!1,cb:r})},final(e){const t=n;n=null,t({done:!0,cb:e})},destroy(e,t){i.abort(),t(e)}}}(t);if(s(e))return S(T,e,{objectMode:!0,write:i,final:o,destroy:a});const l=null==e?void 0:e.then;if("function"==typeof l){let t;const n=N(l,e,(e=>{if(null!=e)throw new m("nully","body",e)}),(e=>{b(t,e)}));return t=new T({objectMode:!0,readable:!1,write:i,final(e){o((async()=>{try{await n,r.nextTick(e,null)}catch(t){r.nextTick(e,t)}}))},destroy:a})}throw new m("Iterable, AsyncIterable or AsyncFunction",n,e)}if(I(t))return e(t.arrayBuffer());if(s(t))return S(T,t,{objectMode:!0,writable:!1});if(h(null==t?void 0:t.readable)&&f(null==t?void 0:t.writable))return T.fromWeb(t);if("object"==typeof(null==t?void 0:t.writable)||"object"==typeof(null==t?void 0:t.readable))return R({readable:null!=t&&t.readable?c(null==t?void 0:t.readable)?null==t?void 0:t.readable:e(t.readable):void 0,writable:null!=t&&t.writable?u(null==t?void 0:t.writable)?null==t?void 0:t.writable:e(t.writable):void 0});const i=null==t?void 0:t.then;if("function"==typeof i){let e;return N(i,t,(t=>{null!=t&&e.push(t),e.push(null)}),(t=>{b(e,t)})),e=new T({objectMode:!0,writable:!1,read(){}})}throw new y(n,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],t)}},6238:(e,t,n)=>{const r=n(5606),{AbortError:i,codes:o}=n(6371),{ERR_INVALID_ARG_TYPE:a,ERR_STREAM_PREMATURE_CLOSE:s}=o,{kEmptyObject:l,once:c}=n(7760),{validateAbortSignal:u,validateFunction:d,validateObject:h,validateBoolean:f}=n(277),{Promise:p,PromisePrototypeThen:g,SymbolDispose:y}=n(4134),{isClosed:m,isReadable:b,isReadableNodeStream:v,isReadableStream:w,isReadableFinished:_,isReadableErrored:x,isWritable:S,isWritableNodeStream:j,isWritableStream:I,isWritableFinished:E,isWritableErrored:N,isNodeStream:T,willEmitClose:R,kIsClosedPromise:O}=n(6115);let k;const L=()=>{};function A(e,t,o){var f,p;if(2===arguments.length?(o=t,t=l):null==t?t=l:h(t,"options"),d(o,"callback"),u(t.signal,"options.signal"),o=c(o),w(e)||I(e))return function(e,t,o){let a=!1,s=L;if(t.signal)if(s=()=>{a=!0,o.call(e,new i(void 0,{cause:t.signal.reason}))},t.signal.aborted)r.nextTick(s);else{k=k||n(7760).addAbortListener;const r=k(t.signal,s),i=o;o=c(((...t)=>{r[y](),i.apply(e,t)}))}const l=(...t)=>{a||r.nextTick((()=>o.apply(e,t)))};return g(e[O].promise,l,l),L}(e,t,o);if(!T(e))throw new a("stream",["ReadableStream","WritableStream","Stream"],e);const A=null!==(f=t.readable)&&void 0!==f?f:v(e),C=null!==(p=t.writable)&&void 0!==p?p:j(e),D=e._writableState,M=e._readableState,P=()=>{e.writable||F()};let $=R(e)&&v(e)===A&&j(e)===C,B=E(e,!1);const F=()=>{B=!0,e.destroyed&&($=!1),(!$||e.readable&&!A)&&(A&&!q||o.call(e))};let q=_(e,!1);const U=()=>{q=!0,e.destroyed&&($=!1),(!$||e.writable&&!C)&&(C&&!B||o.call(e))},G=t=>{o.call(e,t)};let H=m(e);const V=()=>{H=!0;const t=N(e)||x(e);return t&&"boolean"!=typeof t?o.call(e,t):A&&!q&&v(e,!0)&&!_(e,!1)?o.call(e,new s):!C||B||E(e,!1)?void o.call(e):o.call(e,new s)},W=()=>{H=!0;const t=N(e)||x(e);if(t&&"boolean"!=typeof t)return o.call(e,t);o.call(e)},z=()=>{e.req.on("finish",F)};!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?C&&!D&&(e.on("end",P),e.on("close",P)):(e.on("complete",F),$||e.on("abort",V),e.req?z():e.on("request",z)),$||"boolean"!=typeof e.aborted||e.on("aborted",V),e.on("end",U),e.on("finish",F),!1!==t.error&&e.on("error",G),e.on("close",V),H?r.nextTick(V):null!=D&&D.errorEmitted||null!=M&&M.errorEmitted?$||r.nextTick(W):(A||$&&!b(e)||!B&&!1!==S(e))&&(C||$&&!S(e)||!q&&!1!==b(e))?M&&e.req&&e.aborted&&r.nextTick(W):r.nextTick(W);const J=()=>{o=L,e.removeListener("aborted",V),e.removeListener("complete",F),e.removeListener("abort",V),e.removeListener("request",z),e.req&&e.req.removeListener("finish",F),e.removeListener("end",P),e.removeListener("close",P),e.removeListener("finish",F),e.removeListener("end",U),e.removeListener("error",G),e.removeListener("close",V)};if(t.signal&&!H){const a=()=>{const n=o;J(),n.call(e,new i(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)r.nextTick(a);else{k=k||n(7760).addAbortListener;const r=k(t.signal,a),i=o;o=c(((...t)=>{r[y](),i.apply(e,t)}))}}return J}e.exports=A,e.exports.finished=function(e,t){var n;let r=!1;return null===t&&(t=l),null!==(n=t)&&void 0!==n&&n.cleanup&&(f(t.cleanup,"cleanup"),r=t.cleanup),new p(((n,i)=>{const o=A(e,t,(e=>{r&&o(),e?i(e):n()}))}))}},6532:(e,t,n)=>{const r=n(5606),{PromisePrototypeThen:i,SymbolAsyncIterator:o,SymbolIterator:a}=n(4134),{Buffer:s}=n(8287),{ERR_INVALID_ARG_TYPE:l,ERR_STREAM_NULL_VALUES:c}=n(6371).codes;e.exports=function(e,t,n){let u,d;if("string"==typeof t||t instanceof s)return new e({objectMode:!0,...n,read(){this.push(t),this.push(null)}});if(t&&t[o])d=!0,u=t[o]();else{if(!t||!t[a])throw new l("iterable",["Iterable"],t);d=!1,u=t[a]()}const h=new e({objectMode:!0,highWaterMark:1,...n});let f=!1;return h._read=function(){f||(f=!0,async function(){for(;;){try{const{value:e,done:t}=d?await u.next():u.next();if(t)h.push(null);else{const t=e&&"function"==typeof e.then?await e:e;if(null===t)throw f=!1,new c;if(h.push(t))continue;f=!1}}catch(e){h.destroy(e)}break}}())},h._destroy=function(e,t){i(async function(e){const t=null!=e,n="function"==typeof u.throw;if(t&&n){const{value:t,done:n}=await u.throw(e);if(await t,n)return}if("function"==typeof u.return){const{value:e}=await u.return();await e}}(e),(()=>r.nextTick(t,e)),(n=>r.nextTick(t,n||e)))},h}},4259:(e,t,n)=>{const{ArrayIsArray:r,ObjectSetPrototypeOf:i}=n(4134),{EventEmitter:o}=n(7007);function a(e){o.call(this,e)}function s(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?r(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}i(a.prototype,o.prototype),i(a,o),a.prototype.pipe=function(e,t){const n=this;function r(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function i(){n.readable&&n.resume&&n.resume()}n.on("data",r),e.on("drain",i),e._isStdio||t&&!1===t.end||(n.on("end",l),n.on("close",c));let a=!1;function l(){a||(a=!0,e.end())}function c(){a||(a=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){d(),0===o.listenerCount(this,"error")&&this.emit("error",e)}function d(){n.removeListener("data",r),e.removeListener("drain",i),n.removeListener("end",l),n.removeListener("close",c),n.removeListener("error",u),e.removeListener("error",u),n.removeListener("end",d),n.removeListener("close",d),e.removeListener("close",d)}return s(n,"error",u),s(e,"error",u),n.on("end",d),n.on("close",d),e.on("close",d),e.emit("pipe",n),e},e.exports={Stream:a,prependListener:s}},823:(e,t,n)=>{const r=globalThis.AbortController||n(5568).AbortController,{codes:{ERR_INVALID_ARG_VALUE:i,ERR_INVALID_ARG_TYPE:o,ERR_MISSING_ARGS:a,ERR_OUT_OF_RANGE:s},AbortError:l}=n(6371),{validateAbortSignal:c,validateInteger:u,validateObject:d}=n(277),h=n(4134).Symbol("kWeak"),f=n(4134).Symbol("kResistStopPropagation"),{finished:p}=n(6238),g=n(7830),{addAbortSignalNoValidate:y}=n(4147),{isWritable:m,isNodeStream:b}=n(6115),{deprecate:v}=n(7760),{ArrayPrototypePush:w,Boolean:_,MathFloor:x,Number:S,NumberIsNaN:j,Promise:I,PromiseReject:E,PromiseResolve:N,PromisePrototypeThen:T,Symbol:R}=n(4134),O=R("kEmpty"),k=R("kEof");function L(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&c(t.signal,"options.signal");let r=1;null!=(null==t?void 0:t.concurrency)&&(r=x(t.concurrency));let i=r-1;return null!=(null==t?void 0:t.highWaterMark)&&(i=x(t.highWaterMark)),u(r,"options.concurrency",1),u(i,"options.highWaterMark",0),i+=r,async function*(){const o=n(7760).AbortSignalAny([null==t?void 0:t.signal].filter(_)),a=this,s=[],c={signal:o};let u,d,h=!1,f=0;function p(){h=!0,g()}function g(){f-=1,y()}function y(){d&&!h&&f<r&&s.length<i&&(d(),d=null)}!async function(){try{for await(let t of a){if(h)return;if(o.aborted)throw new l;try{if(t=e(t,c),t===O)continue;t=N(t)}catch(e){t=E(e)}f+=1,T(t,g,p),s.push(t),u&&(u(),u=null),!h&&(s.length>=i||f>=r)&&await new I((e=>{d=e}))}s.push(k)}catch(e){const t=E(e);T(t,g,p),s.push(t)}finally{h=!0,u&&(u(),u=null)}}();try{for(;;){for(;s.length>0;){const e=await s[0];if(e===k)return;if(o.aborted)throw new l;e!==O&&(yield e),s.shift(),y()}await new I((e=>{u=e}))}}finally{h=!0,d&&(d(),d=null)}}.call(this)}async function A(e,t=void 0){for await(const n of C.call(this,e,t))return!0;return!1}function C(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);return L.call(this,(async function(t,n){return await e(t,n)?t:O}),t)}class D extends a{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}function M(e){if(e=S(e),j(e))return 0;if(e<0)throw new s("number",">= 0",e);return e}e.exports.streamReturningOperators={asIndexedPairs:v((function(e=void 0){return null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&c(e.signal,"options.signal"),async function*(){let t=0;for await(const r of this){var n;if(null!=e&&null!==(n=e.signal)&&void 0!==n&&n.aborted)throw new l({cause:e.signal.reason});yield[t++,r]}}.call(this)}),"readable.asIndexedPairs will be removed in a future version."),drop:function(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&c(t.signal,"options.signal"),e=M(e),async function*(){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new l;for await(const n of this){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new l;e--<=0&&(yield n)}}.call(this)},filter:C,flatMap:function(e,t){const n=L.call(this,e,t);return async function*(){for await(const e of n)yield*e}.call(this)},map:L,take:function(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&c(t.signal,"options.signal"),e=M(e),async function*(){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new l;for await(const n of this){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new l;if(e-- >0&&(yield n),e<=0)return}}.call(this)},compose:function(e,t){if(null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&c(t.signal,"options.signal"),b(e)&&!m(e))throw new i("stream",e,"must be writable");const n=g(this,e);return null!=t&&t.signal&&y(t.signal,n),n}},e.exports.promiseReturningOperators={every:async function(e,t=void 0){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);return!await A.call(this,(async(...t)=>!await e(...t)),t)},forEach:async function(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);for await(const n of L.call(this,(async function(t,n){return await e(t,n),O}),t));},reduce:async function(e,t,n){var i;if("function"!=typeof e)throw new o("reducer",["Function","AsyncFunction"],e);null!=n&&d(n,"options"),null!=(null==n?void 0:n.signal)&&c(n.signal,"options.signal");let a=arguments.length>1;if(null!=n&&null!==(i=n.signal)&&void 0!==i&&i.aborted){const e=new l(void 0,{cause:n.signal.reason});throw this.once("error",(()=>{})),await p(this.destroy(e)),e}const s=new r,u=s.signal;if(null!=n&&n.signal){const e={once:!0,[h]:this,[f]:!0};n.signal.addEventListener("abort",(()=>s.abort()),e)}let g=!1;try{for await(const r of this){var y;if(g=!0,null!=n&&null!==(y=n.signal)&&void 0!==y&&y.aborted)throw new l;a?t=await e(t,r,{signal:u}):(t=r,a=!0)}if(!g&&!a)throw new D}finally{s.abort()}return t},toArray:async function(e){null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&c(e.signal,"options.signal");const t=[];for await(const r of this){var n;if(null!=e&&null!==(n=e.signal)&&void 0!==n&&n.aborted)throw new l(void 0,{cause:e.signal.reason});w(t,r)}return t},some:A,find:async function(e,t){for await(const n of C.call(this,e,t))return n}}},6524:(e,t,n)=>{const{ObjectSetPrototypeOf:r}=n(4134);e.exports=o;const i=n(5001);function o(e){if(!(this instanceof o))return new o(e);i.call(this,e)}r(o.prototype,i.prototype),r(o,i),o.prototype._transform=function(e,t,n){n(null,e)}},7758:(e,t,n)=>{const r=n(5606),{ArrayIsArray:i,Promise:o,SymbolAsyncIterator:a,SymbolDispose:s}=n(4134),l=n(6238),{once:c}=n(7760),u=n(5896),d=n(3370),{aggregateTwoErrors:h,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:p,ERR_MISSING_ARGS:g,ERR_STREAM_DESTROYED:y,ERR_STREAM_PREMATURE_CLOSE:m},AbortError:b}=n(6371),{validateFunction:v,validateAbortSignal:w}=n(277),{isIterable:_,isReadable:x,isReadableNodeStream:S,isNodeStream:j,isTransformStream:I,isWebStream:E,isReadableStream:N,isReadableFinished:T}=n(6115),R=globalThis.AbortController||n(5568).AbortController;let O,k,L;function A(e,t,n){let r=!1;return e.on("close",(()=>{r=!0})),{destroy:t=>{r||(r=!0,u.destroyer(e,t||new y("pipe")))},cleanup:l(e,{readable:t,writable:n},(e=>{r=!e}))}}function C(e){if(_(e))return e;if(S(e))return async function*(e){k||(k=n(7576)),yield*k.prototype[a].call(e)}(e);throw new f("val",["Readable","Iterable","AsyncIterable"],e)}async function D(e,t,n,{end:r}){let i,a=null;const s=e=>{if(e&&(i=e),a){const e=a;a=null,e()}},c=()=>new o(((e,t)=>{i?t(i):a=()=>{i?t(i):e()}}));t.on("drain",s);const u=l(t,{readable:!1},s);try{t.writableNeedDrain&&await c();for await(const n of e)t.write(n)||await c();r&&(t.end(),await c()),n()}catch(e){n(i!==e?h(i,e):e)}finally{u(),t.off("drain",s)}}async function M(e,t,n,{end:r}){I(t)&&(t=t.writable);const i=t.getWriter();try{for await(const t of e)await i.ready,i.write(t).catch((()=>{}));await i.ready,r&&await i.close(),n()}catch(e){try{await i.abort(e),n(e)}catch(e){n(e)}}}function P(e,t,o){if(1===e.length&&i(e[0])&&(e=e[0]),e.length<2)throw new g("streams");const a=new R,l=a.signal,c=null==o?void 0:o.signal,u=[];function h(){F(new b)}let y,m,v;w(c,"options.signal"),L=L||n(7760).addAbortListener,c&&(y=L(c,h));const T=[];let k,P=0;function B(e){F(e,0==--P)}function F(e,n){var i;if(!e||m&&"ERR_STREAM_PREMATURE_CLOSE"!==m.code||(m=e),m||n){for(;T.length;)T.shift()(m);null===(i=y)||void 0===i||i[s](),a.abort(),n&&(m||u.forEach((e=>e())),r.nextTick(t,m,v))}}for(let G=0;G<e.length;G++){const H=e[G],V=G<e.length-1,W=G>0,z=V||!1!==(null==o?void 0:o.end),J=G===e.length-1;if(j(H)){if(z){const{destroy:X,cleanup:K}=A(H,V,W);T.push(X),x(H)&&J&&u.push(K)}function Q(e){e&&"AbortError"!==e.name&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code&&B(e)}H.on("error",Q),x(H)&&J&&u.push((()=>{H.removeListener("error",Q)}))}if(0===G)if("function"==typeof H){if(k=H({signal:l}),!_(k))throw new p("Iterable, AsyncIterable or Stream","source",k)}else k=_(H)||S(H)||I(H)?H:d.from(H);else if("function"==typeof H){var q;if(k=I(k)?C(null===(q=k)||void 0===q?void 0:q.readable):C(k),k=H(k,{signal:l}),V){if(!_(k,!0))throw new p("AsyncIterable",`transform[${G-1}]`,k)}else{var U;O||(O=n(6524));const Y=new O({objectMode:!0}),Z=null===(U=k)||void 0===U?void 0:U.then;if("function"==typeof Z)P++,Z.call(k,(e=>{v=e,null!=e&&Y.write(e),z&&Y.end(),r.nextTick(B)}),(e=>{Y.destroy(e),r.nextTick(B,e)}));else if(_(k,!0))P++,D(k,Y,B,{end:z});else{if(!N(k)&&!I(k))throw new p("AsyncIterable or Promise","destination",k);{const ne=k.readable||k;P++,D(ne,Y,B,{end:z})}}k=Y;const{destroy:ee,cleanup:te}=A(k,!1,!0);T.push(ee),J&&u.push(te)}}else if(j(H)){if(S(k)){P+=2;const re=$(k,H,B,{end:z});x(H)&&J&&u.push(re)}else if(I(k)||N(k)){const ie=k.readable||k;P++,D(ie,H,B,{end:z})}else{if(!_(k))throw new f("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],k);P++,D(k,H,B,{end:z})}k=H}else if(E(H)){if(S(k))P++,M(C(k),H,B,{end:z});else if(N(k)||_(k))P++,M(k,H,B,{end:z});else{if(!I(k))throw new f("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],k);P++,M(k.readable,H,B,{end:z})}k=H}else k=d.from(H)}return(null!=l&&l.aborted||null!=c&&c.aborted)&&r.nextTick(h),k}function $(e,t,n,{end:i}){let o=!1;if(t.on("close",(()=>{o||n(new m)})),e.pipe(t,{end:!1}),i){function a(){o=!0,t.end()}T(e)?r.nextTick(a):e.once("end",a)}else n();return l(e,{readable:!0,writable:!1},(t=>{const r=e._readableState;t&&"ERR_STREAM_PREMATURE_CLOSE"===t.code&&r&&r.ended&&!r.errored&&!r.errorEmitted?e.once("end",n).once("error",n):n(t)})),l(t,{readable:!1,writable:!0},n)}e.exports={pipelineImpl:P,pipeline:function(...e){return P(e,c(function(e){return v(e[e.length-1],"streams[stream.length - 1]"),e.pop()}(e)))}}},7576:(e,t,n)=>{const r=n(5606),{ArrayPrototypeIndexOf:i,NumberIsInteger:o,NumberIsNaN:a,NumberParseInt:s,ObjectDefineProperties:l,ObjectKeys:c,ObjectSetPrototypeOf:u,Promise:d,SafeSet:h,SymbolAsyncDispose:f,SymbolAsyncIterator:p,Symbol:g}=n(4134);e.exports=z,z.ReadableState=W;const{EventEmitter:y}=n(7007),{Stream:m,prependListener:b}=n(4259),{Buffer:v}=n(8287),{addAbortSignal:w}=n(4147),_=n(6238);let x=n(7760).debuglog("stream",(e=>{x=e}));const S=n(345),j=n(5896),{getHighWaterMark:I,getDefaultHighWaterMark:E}=n(5291),{aggregateTwoErrors:N,codes:{ERR_INVALID_ARG_TYPE:T,ERR_METHOD_NOT_IMPLEMENTED:R,ERR_OUT_OF_RANGE:O,ERR_STREAM_PUSH_AFTER_EOF:k,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:L},AbortError:A}=n(6371),{validateObject:C}=n(277),D=g("kPaused"),{StringDecoder:M}=n(3141),P=n(6532);u(z.prototype,m.prototype),u(z,m);const $=()=>{},{errorOrDestroy:B}=j,F=1,q=16,U=32,G=2048,H=4096;function V(e){return{enumerable:!1,get(){return!!(this.state&e)},set(t){t?this.state|=e:this.state&=~e}}}function W(e,t,r){"boolean"!=typeof r&&(r=t instanceof n(3370)),this.state=G|H|q|U,e&&e.objectMode&&(this.state|=F),r&&e&&e.readableObjectMode&&(this.state|=F),this.highWaterMark=e?I(this,e,"readableHighWaterMark",r):E(!1),this.buffer=new S,this.length=0,this.pipes=[],this.flowing=null,this[D]=null,e&&!1===e.emitClose&&(this.state&=~G),e&&!1===e.autoDestroy&&(this.state&=~H),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new M(e.encoding),this.encoding=e.encoding)}function z(e){if(!(this instanceof z))return new z(e);const t=this instanceof n(3370);this._readableState=new W(e,this,t),e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&!t&&w(e.signal,this)),m.call(this,e),j.construct(this,(()=>{this._readableState.needReadable&&Z(this,this._readableState)}))}function J(e,t,n,r){x("readableAddChunk",t);const i=e._readableState;let o;if(i.state&F||("string"==typeof t?(n=n||i.defaultEncoding,i.encoding!==n&&(r&&i.encoding?t=v.from(t,n).toString(i.encoding):(t=v.from(t,n),n=""))):t instanceof v?n="":m._isUint8Array(t)?(t=m._uint8ArrayToBuffer(t),n=""):null!=t&&(o=new T("chunk",["string","Buffer","Uint8Array"],t))),o)B(e,o);else if(null===t)i.state&=-9,function(e,t){if(x("onEofChunk"),!t.ended){if(t.decoder){const e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?K(e):(t.needReadable=!1,t.emittedReadable=!0,Y(e))}}(e,i);else if(i.state&F||t&&t.length>0)if(r)if(4&i.state)B(e,new L);else{if(i.destroyed||i.errored)return!1;Q(e,i,t,!0)}else if(i.ended)B(e,new k);else{if(i.destroyed||i.errored)return!1;i.state&=-9,i.decoder&&!n?(t=i.decoder.write(t),i.objectMode||0!==t.length?Q(e,i,t,!1):Z(e,i)):Q(e,i,t,!1)}else r||(i.state&=-9,Z(e,i));return!i.ended&&(i.length<i.highWaterMark||0===i.length)}function Q(e,t,n,r){t.flowing&&0===t.length&&!t.sync&&e.listenerCount("data")>0?(65536&t.state?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),64&t.state&&K(e)),Z(e,t)}function X(e,t){return e<=0||0===t.length&&t.ended?0:t.state&F?1:a(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}function K(e){const t=e._readableState;x("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(x("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(Y,e))}function Y(e){const t=e._readableState;x("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||t.errored||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,ie(e)}function Z(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,r.nextTick(ee,e,t))}function ee(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){const n=t.length;if(x("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function te(e){const t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!1===t[D]?t.flowing=!0:e.listenerCount("data")>0?e.resume():t.readableListening||(t.flowing=null)}function ne(e){x("readable nexttick read 0"),e.read(0)}function re(e,t){x("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),ie(e),t.flowing&&!t.reading&&e.read(0)}function ie(e){const t=e._readableState;for(x("flow",t.flowing);t.flowing&&null!==e.read(););}function oe(e,t){"function"!=typeof e.read&&(e=z.wrap(e,{objectMode:!0}));const n=async function*(e,t){let n,r=$;function i(t){this===e?(r(),r=$):r=t}e.on("readable",i);const o=_(e,{writable:!1},(e=>{n=e?N(n,e):null,r(),r=$}));try{for(;;){const t=e.destroyed?null:e.read();if(null!==t)yield t;else{if(n)throw n;if(null===n)return;await new d(i)}}}catch(e){throw n=N(n,e),n}finally{!n&&!1===(null==t?void 0:t.destroyOnReturn)||void 0!==n&&!e._readableState.autoDestroy?(e.off("readable",i),o()):j.destroyer(e,null)}}(e,t);return n.stream=e,n}function ae(e,t){if(0===t.length)return null;let n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}function se(e){const t=e._readableState;x("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(le,t,e))}function le(e,t){if(x("endReadableNT",e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&0===e.length)if(e.endEmitted=!0,t.emit("end"),t.writable&&!1===t.allowHalfOpen)r.nextTick(ce,t);else if(e.autoDestroy){const e=t._writableState;(!e||e.autoDestroy&&(e.finished||!1===e.writable))&&t.destroy()}}function ce(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}let ue;function de(){return void 0===ue&&(ue={}),ue}l(W.prototype,{objectMode:V(F),ended:V(2),endEmitted:V(4),reading:V(8),constructed:V(q),sync:V(U),needReadable:V(64),emittedReadable:V(128),readableListening:V(256),resumeScheduled:V(512),errorEmitted:V(1024),emitClose:V(G),autoDestroy:V(H),destroyed:V(8192),closed:V(16384),closeEmitted:V(32768),multiAwaitDrain:V(65536),readingMore:V(1<<17),dataEmitted:V(1<<18)}),z.prototype.destroy=j.destroy,z.prototype._undestroy=j.undestroy,z.prototype._destroy=function(e,t){t(e)},z.prototype[y.captureRejectionSymbol]=function(e){this.destroy(e)},z.prototype[f]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new A,this.destroy(e)),new d(((t,n)=>_(this,(r=>r&&r!==e?n(r):t(null)))))},z.prototype.push=function(e,t){return J(this,e,t,!1)},z.prototype.unshift=function(e,t){return J(this,e,t,!0)},z.prototype.isPaused=function(){const e=this._readableState;return!0===e[D]||!1===e.flowing},z.prototype.setEncoding=function(e){const t=new M(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;const n=this._readableState.buffer;let r="";for(const e of n)r+=t.write(e);return n.clear(),""!==r&&n.push(r),this._readableState.length=r.length,this},z.prototype.read=function(e){x("read",e),void 0===e?e=NaN:o(e)||(e=s(e,10));const t=this._readableState,n=e;if(e>t.highWaterMark&&(t.highWaterMark=function(e){if(e>1073741824)throw new O("size","<= 1GiB",e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,++e}(e)),0!==e&&(t.state&=-129),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return x("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?se(this):K(this),null;if(0===(e=X(e,t))&&t.ended)return 0===t.length&&se(this),null;let r,i=!!(64&t.state);if(x("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&(i=!0,x("length less than watermark",i)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)i=!1,x("reading, ended or constructing",i);else if(i){x("do read"),t.state|=8|U,0===t.length&&(t.state|=64);try{this._read(t.highWaterMark)}catch(e){B(this,e)}t.state&=~U,t.reading||(e=X(n,t))}return r=e>0?ae(e,t):null,null===r?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&se(this)),null===r||t.errorEmitted||t.closeEmitted||(t.dataEmitted=!0,this.emit("data",r)),r},z.prototype._read=function(e){throw new R("_read()")},z.prototype.pipe=function(e,t){const n=this,i=this._readableState;1===i.pipes.length&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new h(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),x("pipe count=%d opts=%j",i.pipes.length,t);const o=t&&!1===t.end||e===r.stdout||e===r.stderr?g:a;function a(){x("onend"),e.end()}let s;i.endEmitted?r.nextTick(o):n.once("end",o),e.on("unpipe",(function t(r,o){x("onunpipe"),r===n&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,x("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),s&&e.removeListener("drain",s),e.removeListener("error",d),e.removeListener("unpipe",t),n.removeListener("end",a),n.removeListener("end",g),n.removeListener("data",u),l=!0,s&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&s())}));let l=!1;function c(){l||(1===i.pipes.length&&i.pipes[0]===e?(x("false write response, pause",0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(x("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),n.pause()),s||(s=function(e,t){return function(){const n=e._readableState;n.awaitDrainWriters===t?(x("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(x("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(t)),n.awaitDrainWriters&&0!==n.awaitDrainWriters.size||!e.listenerCount("data")||e.resume()}}(n,e),e.on("drain",s))}function u(t){x("ondata");const n=e.write(t);x("dest.write",n),!1===n&&c()}function d(t){if(x("onerror",t),g(),e.removeListener("error",d),0===e.listenerCount("error")){const n=e._writableState||e._readableState;n&&!n.errorEmitted?B(e,t):e.emit("error",t)}}function f(){e.removeListener("finish",p),g()}function p(){x("onfinish"),e.removeListener("close",f),g()}function g(){x("unpipe"),n.unpipe(e)}return n.on("data",u),b(e,"error",d),e.once("close",f),e.once("finish",p),e.emit("pipe",n),!0===e.writableNeedDrain?c():i.flowing||(x("pipe resume"),n.resume()),e},z.prototype.unpipe=function(e){const t=this._readableState;if(0===t.pipes.length)return this;if(!e){const e=t.pipes;t.pipes=[],this.pause();for(let t=0;t<e.length;t++)e[t].emit("unpipe",this,{hasUnpiped:!1});return this}const n=i(t.pipes,e);return-1===n||(t.pipes.splice(n,1),0===t.pipes.length&&this.pause(),e.emit("unpipe",this,{hasUnpiped:!1})),this},z.prototype.on=function(e,t){const n=m.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,x("on readable",i.length,i.reading),i.length?K(this):i.reading||r.nextTick(ne,this))),n},z.prototype.addListener=z.prototype.on,z.prototype.removeListener=function(e,t){const n=m.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(te,this),n},z.prototype.off=z.prototype.removeListener,z.prototype.removeAllListeners=function(e){const t=m.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(te,this),t},z.prototype.resume=function(){const e=this._readableState;return e.flowing||(x("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(re,e,t))}(this,e)),e[D]=!1,this},z.prototype.pause=function(){return x("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(x("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[D]=!0,this},z.prototype.wrap=function(e){let t=!1;e.on("data",(n=>{!this.push(n)&&e.pause&&(t=!0,e.pause())})),e.on("end",(()=>{this.push(null)})),e.on("error",(e=>{B(this,e)})),e.on("close",(()=>{this.destroy()})),e.on("destroy",(()=>{this.destroy()})),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};const n=c(e);for(let t=1;t<n.length;t++){const r=n[t];void 0===this[r]&&"function"==typeof e[r]&&(this[r]=e[r].bind(e))}return this},z.prototype[p]=function(){return oe(this)},z.prototype.iterator=function(e){return void 0!==e&&C(e,"options"),oe(this,e)},l(z.prototype,{readable:{__proto__:null,get(){const e=this._readableState;return!(!e||!1===e.readable||e.destroyed||e.errorEmitted||e.endEmitted)},set(e){this._readableState&&(this._readableState.readable=!!e)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!(!1===this._readableState.readable||!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(e){this._readableState&&(this._readableState.flowing=e)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.objectMode}},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}},destroyed:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.destroyed},set(e){this._readableState&&(this._readableState.destroyed=e)}},readableEnded:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.endEmitted}}}),l(W.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return!1!==this[D]},set(e){this[D]=!!e}}}),z._fromList=ae,z.from=function(e,t){return P(z,e,t)},z.fromWeb=function(e,t){return de().newStreamReadableFromReadableStream(e,t)},z.toWeb=function(e,t){return de().newReadableStreamFromStreamReadable(e,t)},z.wrap=function(e,t){var n,r;return new z({objectMode:null===(n=null!==(r=e.readableObjectMode)&&void 0!==r?r:e.objectMode)||void 0===n||n,...t,destroy(t,n){j.destroyer(e,t),n(t)}}).wrap(e)}},5291:(e,t,n)=>{const{MathFloor:r,NumberIsInteger:i}=n(4134),{validateInteger:o}=n(277),{ERR_INVALID_ARG_VALUE:a}=n(6371).codes;let s=16384,l=16;function c(e){return e?l:s}e.exports={getHighWaterMark:function(e,t,n,o){const s=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,o,n);if(null!=s){if(!i(s)||s<0)throw new a(o?`options.${n}`:"options.highWaterMark",s);return r(s)}return c(e.objectMode)},getDefaultHighWaterMark:c,setDefaultHighWaterMark:function(e,t){o(t,"value",0),e?l=t:s=t}}},5001:(e,t,n)=>{const{ObjectSetPrototypeOf:r,Symbol:i}=n(4134);e.exports=c;const{ERR_METHOD_NOT_IMPLEMENTED:o}=n(6371).codes,a=n(3370),{getHighWaterMark:s}=n(5291);r(c.prototype,a.prototype),r(c,a);const l=i("kCallback");function c(e){if(!(this instanceof c))return new c(e);const t=e?s(this,e,"readableHighWaterMark",!0):null;0===t&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),a.call(this,e),this._readableState.sync=!1,this[l]=null,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",d)}function u(e){"function"!=typeof this._flush||this.destroyed?(this.push(null),e&&e()):this._flush(((t,n)=>{t?e?e(t):this.destroy(t):(null!=n&&this.push(n),this.push(null),e&&e())}))}function d(){this._final!==u&&u.call(this)}c.prototype._final=u,c.prototype._transform=function(e,t,n){throw new o("_transform()")},c.prototype._write=function(e,t,n){const r=this._readableState,i=this._writableState,o=r.length;this._transform(e,t,((e,t)=>{e?n(e):(null!=t&&this.push(t),i.ended||o===r.length||r.length<r.highWaterMark?n():this[l]=n)}))},c.prototype._read=function(){if(this[l]){const e=this[l];this[l]=null,e()}}},6115:(e,t,n)=>{const{SymbolAsyncIterator:r,SymbolIterator:i,SymbolFor:o}=n(4134),a=o("nodejs.stream.destroyed"),s=o("nodejs.stream.errored"),l=o("nodejs.stream.readable"),c=o("nodejs.stream.writable"),u=o("nodejs.stream.disturbed"),d=o("nodejs.webstream.isClosedPromise"),h=o("nodejs.webstream.controllerErrorFunction");function f(e,t=!1){var n;return!(!e||"function"!=typeof e.pipe||"function"!=typeof e.on||t&&("function"!=typeof e.pause||"function"!=typeof e.resume)||e._writableState&&!1===(null===(n=e._readableState)||void 0===n?void 0:n.readable)||e._writableState&&!e._readableState)}function p(e){var t;return!(!e||"function"!=typeof e.write||"function"!=typeof e.on||e._readableState&&!1===(null===(t=e._writableState)||void 0===t?void 0:t.writable))}function g(e){return e&&(e._readableState||e._writableState||"function"==typeof e.write&&"function"==typeof e.on||"function"==typeof e.pipe&&"function"==typeof e.on)}function y(e){return!(!e||g(e)||"function"!=typeof e.pipeThrough||"function"!=typeof e.getReader||"function"!=typeof e.cancel)}function m(e){return!(!e||g(e)||"function"!=typeof e.getWriter||"function"!=typeof e.abort)}function b(e){return!(!e||g(e)||"object"!=typeof e.readable||"object"!=typeof e.writable)}function v(e){if(!g(e))return null;const t=e._writableState,n=e._readableState,r=t||n;return!!(e.destroyed||e[a]||null!=r&&r.destroyed)}function w(e){if(!p(e))return null;if(!0===e.writableEnded)return!0;const t=e._writableState;return(null==t||!t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)}function _(e,t){if(!f(e))return null;const n=e._readableState;return(null==n||!n.errored)&&("boolean"!=typeof(null==n?void 0:n.endEmitted)?null:!!(n.endEmitted||!1===t&&!0===n.ended&&0===n.length))}function x(e){return e&&null!=e[l]?e[l]:"boolean"!=typeof(null==e?void 0:e.readable)?null:!v(e)&&f(e)&&e.readable&&!_(e)}function S(e){return e&&null!=e[c]?e[c]:"boolean"!=typeof(null==e?void 0:e.writable)?null:!v(e)&&p(e)&&e.writable&&!w(e)}function j(e){return"boolean"==typeof e._closed&&"boolean"==typeof e._defaultKeepAlive&&"boolean"==typeof e._removedConnection&&"boolean"==typeof e._removedContLen}function I(e){return"boolean"==typeof e._sent100&&j(e)}e.exports={isDestroyed:v,kIsDestroyed:a,isDisturbed:function(e){var t;return!(!e||!(null!==(t=e[u])&&void 0!==t?t:e.readableDidRead||e.readableAborted))},kIsDisturbed:u,isErrored:function(e){var t,n,r,i,o,a,l,c,u,d;return!(!e||!(null!==(t=null!==(n=null!==(r=null!==(i=null!==(o=null!==(a=e[s])&&void 0!==a?a:e.readableErrored)&&void 0!==o?o:e.writableErrored)&&void 0!==i?i:null===(l=e._readableState)||void 0===l?void 0:l.errorEmitted)&&void 0!==r?r:null===(c=e._writableState)||void 0===c?void 0:c.errorEmitted)&&void 0!==n?n:null===(u=e._readableState)||void 0===u?void 0:u.errored)&&void 0!==t?t:null===(d=e._writableState)||void 0===d?void 0:d.errored))},kIsErrored:s,isReadable:x,kIsReadable:l,kIsClosedPromise:d,kControllerErrorFunction:h,kIsWritable:c,isClosed:function(e){if(!g(e))return null;if("boolean"==typeof e.closed)return e.closed;const t=e._writableState,n=e._readableState;return"boolean"==typeof(null==t?void 0:t.closed)||"boolean"==typeof(null==n?void 0:n.closed)?(null==t?void 0:t.closed)||(null==n?void 0:n.closed):"boolean"==typeof e._closed&&j(e)?e._closed:null},isDuplexNodeStream:function(e){return!(!e||"function"!=typeof e.pipe||!e._readableState||"function"!=typeof e.on||"function"!=typeof e.write)},isFinished:function(e,t){return g(e)?!(!v(e)&&(!1!==(null==t?void 0:t.readable)&&x(e)||!1!==(null==t?void 0:t.writable)&&S(e))):null},isIterable:function(e,t){return null!=e&&(!0===t?"function"==typeof e[r]:!1===t?"function"==typeof e[i]:"function"==typeof e[r]||"function"==typeof e[i])},isReadableNodeStream:f,isReadableStream:y,isReadableEnded:function(e){if(!f(e))return null;if(!0===e.readableEnded)return!0;const t=e._readableState;return!(!t||t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)},isReadableFinished:_,isReadableErrored:function(e){var t,n;return g(e)?e.readableErrored?e.readableErrored:null!==(t=null===(n=e._readableState)||void 0===n?void 0:n.errored)&&void 0!==t?t:null:null},isNodeStream:g,isWebStream:function(e){return y(e)||m(e)||b(e)},isWritable:S,isWritableNodeStream:p,isWritableStream:m,isWritableEnded:w,isWritableFinished:function(e,t){if(!p(e))return null;if(!0===e.writableFinished)return!0;const n=e._writableState;return(null==n||!n.errored)&&("boolean"!=typeof(null==n?void 0:n.finished)?null:!!(n.finished||!1===t&&!0===n.ended&&0===n.length))},isWritableErrored:function(e){var t,n;return g(e)?e.writableErrored?e.writableErrored:null!==(t=null===(n=e._writableState)||void 0===n?void 0:n.errored)&&void 0!==t?t:null:null},isServerRequest:function(e){var t;return"boolean"==typeof e._consuming&&"boolean"==typeof e._dumped&&void 0===(null===(t=e.req)||void 0===t?void 0:t.upgradeOrConnect)},isServerResponse:I,willEmitClose:function(e){if(!g(e))return null;const t=e._writableState,n=e._readableState,r=t||n;return!r&&I(e)||!!(r&&r.autoDestroy&&r.emitClose&&!1===r.closed)},isTransformStream:b}},8584:(e,t,n)=>{const r=n(5606),{ArrayPrototypeSlice:i,Error:o,FunctionPrototypeSymbolHasInstance:a,ObjectDefineProperty:s,ObjectDefineProperties:l,ObjectSetPrototypeOf:c,StringPrototypeToLowerCase:u,Symbol:d,SymbolHasInstance:h}=n(4134);e.exports=C,C.WritableState=L;const{EventEmitter:f}=n(7007),p=n(4259).Stream,{Buffer:g}=n(8287),y=n(5896),{addAbortSignal:m}=n(4147),{getHighWaterMark:b,getDefaultHighWaterMark:v}=n(5291),{ERR_INVALID_ARG_TYPE:w,ERR_METHOD_NOT_IMPLEMENTED:_,ERR_MULTIPLE_CALLBACK:x,ERR_STREAM_CANNOT_PIPE:S,ERR_STREAM_DESTROYED:j,ERR_STREAM_ALREADY_FINISHED:I,ERR_STREAM_NULL_VALUES:E,ERR_STREAM_WRITE_AFTER_END:N,ERR_UNKNOWN_ENCODING:T}=n(6371).codes,{errorOrDestroy:R}=y;function O(){}c(C.prototype,p.prototype),c(C,p);const k=d("kOnFinished");function L(e,t,r){"boolean"!=typeof r&&(r=t instanceof n(3370)),this.objectMode=!(!e||!e.objectMode),r&&(this.objectMode=this.objectMode||!(!e||!e.writableObjectMode)),this.highWaterMark=e?b(this,e,"writableHighWaterMark",r):v(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const i=!(!e||!1!==e.decodeStrings);this.decodeStrings=!i,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=$.bind(void 0,t),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,A(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!e||!1!==e.emitClose,this.autoDestroy=!e||!1!==e.autoDestroy,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[k]=[]}function A(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0}function C(e){const t=this instanceof n(3370);if(!t&&!a(C,this))return new C(e);this._writableState=new L(e,this,t),e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&m(e.signal,this)),p.call(this,e),y.construct(this,(()=>{const e=this._writableState;e.writing||U(this,e),H(this,e)}))}function D(e,t,n,i){const o=e._writableState;if("function"==typeof n)i=n,n=o.defaultEncoding;else{if(n){if("buffer"!==n&&!g.isEncoding(n))throw new T(n)}else n=o.defaultEncoding;"function"!=typeof i&&(i=O)}if(null===t)throw new E;if(!o.objectMode)if("string"==typeof t)!1!==o.decodeStrings&&(t=g.from(t,n),n="buffer");else if(t instanceof g)n="buffer";else{if(!p._isUint8Array(t))throw new w("chunk",["string","Buffer","Uint8Array"],t);t=p._uint8ArrayToBuffer(t),n="buffer"}let a;return o.ending?a=new N:o.destroyed&&(a=new j("write")),a?(r.nextTick(i,a),R(e,a,!0),a):(o.pendingcb++,function(e,t,n,r,i){const o=t.objectMode?1:n.length;t.length+=o;const a=t.length<t.highWaterMark;return a||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:n,encoding:r,callback:i}),t.allBuffers&&"buffer"!==r&&(t.allBuffers=!1),t.allNoop&&i!==O&&(t.allNoop=!1)):(t.writelen=o,t.writecb=i,t.writing=!0,t.sync=!0,e._write(n,r,t.onwrite),t.sync=!1),a&&!t.errored&&!t.destroyed}(e,o,t,n,i))}function M(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new j("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function P(e,t,n,r){--t.pendingcb,r(n),q(t),R(e,n)}function $(e,t){const n=e._writableState,i=n.sync,o=n.writecb;"function"==typeof o?(n.writing=!1,n.writecb=null,n.length-=n.writelen,n.writelen=0,t?(t.stack,n.errored||(n.errored=t),e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),i?r.nextTick(P,e,n,t,o):P(e,n,t,o)):(n.buffered.length>n.bufferedIndex&&U(e,n),i?null!==n.afterWriteTickInfo&&n.afterWriteTickInfo.cb===o?n.afterWriteTickInfo.count++:(n.afterWriteTickInfo={count:1,cb:o,stream:e,state:n},r.nextTick(B,n.afterWriteTickInfo)):F(e,n,1,o))):R(e,new x)}function B({stream:e,state:t,count:n,cb:r}){return t.afterWriteTickInfo=null,F(e,t,n,r)}function F(e,t,n,r){for(!t.ending&&!e.destroyed&&0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"));n-- >0;)t.pendingcb--,r();t.destroyed&&q(t),H(e,t)}function q(e){if(e.writing)return;for(let n=e.bufferedIndex;n<e.buffered.length;++n){var t;const{chunk:r,callback:i}=e.buffered[n],o=e.objectMode?1:r.length;e.length-=o,i(null!==(t=e.errored)&&void 0!==t?t:new j("write"))}const n=e[k].splice(0);for(let t=0;t<n.length;t++){var r;n[t](null!==(r=e.errored)&&void 0!==r?r:new j("end"))}A(e)}function U(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;const{buffered:n,bufferedIndex:r,objectMode:o}=t,a=n.length-r;if(!a)return;let s=r;if(t.bufferProcessing=!0,a>1&&e._writev){t.pendingcb-=a-1;const r=t.allNoop?O:e=>{for(let t=s;t<n.length;++t)n[t].callback(e)},o=t.allNoop&&0===s?n:i(n,s);o.allBuffers=t.allBuffers,M(e,t,!0,t.length,o,"",r),A(t)}else{do{const{chunk:r,encoding:i,callback:a}=n[s];n[s++]=null,M(e,t,!1,o?1:r.length,r,i,a)}while(s<n.length&&!t.writing);s===n.length?A(t):s>256?(n.splice(0,s),t.bufferedIndex=0):t.bufferedIndex=s}t.bufferProcessing=!1}function G(e){return e.ending&&!e.destroyed&&e.constructed&&0===e.length&&!e.errored&&0===e.buffered.length&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function H(e,t,n){G(t)&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.finalCalled=!0,function(e,t){let n=!1;function i(i){if(n)R(e,null!=i?i:x());else if(n=!0,t.pendingcb--,i){const n=t[k].splice(0);for(let e=0;e<n.length;e++)n[e](i);R(e,i,t.sync)}else G(t)&&(t.prefinished=!0,e.emit("prefinish"),t.pendingcb++,r.nextTick(V,e,t))}t.sync=!0,t.pendingcb++;try{e._final(i)}catch(e){i(e)}t.sync=!1}(e,t)))}(e,t),0===t.pendingcb&&(n?(t.pendingcb++,r.nextTick(((e,t)=>{G(t)?V(e,t):t.pendingcb--}),e,t)):G(t)&&(t.pendingcb++,V(e,t))))}function V(e,t){t.pendingcb--,t.finished=!0;const n=t[k].splice(0);for(let e=0;e<n.length;e++)n[e]();if(e.emit("finish"),t.autoDestroy){const t=e._readableState;(!t||t.autoDestroy&&(t.endEmitted||!1===t.readable))&&e.destroy()}}L.prototype.getBuffer=function(){return i(this.buffered,this.bufferedIndex)},s(L.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}}),s(C,h,{__proto__:null,value:function(e){return!!a(this,e)||this===C&&e&&e._writableState instanceof L}}),C.prototype.pipe=function(){R(this,new S)},C.prototype.write=function(e,t,n){return!0===D(this,e,t,n)},C.prototype.cork=function(){this._writableState.corked++},C.prototype.uncork=function(){const e=this._writableState;e.corked&&(e.corked--,e.writing||U(this,e))},C.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=u(e)),!g.isEncoding(e))throw new T(e);return this._writableState.defaultEncoding=e,this},C.prototype._write=function(e,t,n){if(!this._writev)throw new _("_write()");this._writev([{chunk:e,encoding:t}],n)},C.prototype._writev=null,C.prototype.end=function(e,t,n){const i=this._writableState;let a;if("function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e){const n=D(this,e,t);n instanceof o&&(a=n)}return i.corked&&(i.corked=1,this.uncork()),a||(i.errored||i.ending?i.finished?a=new I("end"):i.destroyed&&(a=new j("end")):(i.ending=!0,H(this,i,!0),i.ended=!0)),"function"==typeof n&&(a||i.finished?r.nextTick(n,a):i[k].push(n)),this},l(C.prototype,{closed:{__proto__:null,get(){return!!this._writableState&&this._writableState.closed}},destroyed:{__proto__:null,get(){return!!this._writableState&&this._writableState.destroyed},set(e){this._writableState&&(this._writableState.destroyed=e)}},writable:{__proto__:null,get(){const e=this._writableState;return!(!e||!1===e.writable||e.destroyed||e.errored||e.ending||e.ended)},set(e){this._writableState&&(this._writableState.writable=!!e)}},writableFinished:{__proto__:null,get(){return!!this._writableState&&this._writableState.finished}},writableObjectMode:{__proto__:null,get(){return!!this._writableState&&this._writableState.objectMode}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return!!this._writableState&&this._writableState.ending}},writableNeedDrain:{__proto__:null,get(){const e=this._writableState;return!!e&&!e.destroyed&&!e.ending&&e.needDrain}},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!(!1===this._writableState.writable||!this._writableState.destroyed&&!this._writableState.errored||this._writableState.finished)}}});const W=y.destroy;let z;function J(){return void 0===z&&(z={}),z}C.prototype.destroy=function(e,t){const n=this._writableState;return!n.destroyed&&(n.bufferedIndex<n.buffered.length||n[k].length)&&r.nextTick(q,n),W.call(this,e,t),this},C.prototype._undestroy=y.undestroy,C.prototype._destroy=function(e,t){t(e)},C.prototype[f.captureRejectionSymbol]=function(e){this.destroy(e)},C.fromWeb=function(e,t){return J().newStreamWritableFromWritableStream(e,t)},C.toWeb=function(e){return J().newWritableStreamFromStreamWritable(e)}},277:(e,t,n)=>{const{ArrayIsArray:r,ArrayPrototypeIncludes:i,ArrayPrototypeJoin:o,ArrayPrototypeMap:a,NumberIsInteger:s,NumberIsNaN:l,NumberMAX_SAFE_INTEGER:c,NumberMIN_SAFE_INTEGER:u,NumberParseInt:d,ObjectPrototypeHasOwnProperty:h,RegExpPrototypeExec:f,String:p,StringPrototypeToUpperCase:g,StringPrototypeTrim:y}=n(4134),{hideStackFrames:m,codes:{ERR_SOCKET_BAD_PORT:b,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:w,ERR_OUT_OF_RANGE:_,ERR_UNKNOWN_SIGNAL:x}}=n(6371),{normalizeEncoding:S}=n(7760),{isAsyncFunction:j,isArrayBufferView:I}=n(7760).types,E={},N=/^[0-7]+$/,T=m(((e,t,n=u,r=c)=>{if("number"!=typeof e)throw new v(t,"number",e);if(!s(e))throw new _(t,"an integer",e);if(e<n||e>r)throw new _(t,`>= ${n} && <= ${r}`,e)})),R=m(((e,t,n=-2147483648,r=2147483647)=>{if("number"!=typeof e)throw new v(t,"number",e);if(!s(e))throw new _(t,"an integer",e);if(e<n||e>r)throw new _(t,`>= ${n} && <= ${r}`,e)})),O=m(((e,t,n=!1)=>{if("number"!=typeof e)throw new v(t,"number",e);if(!s(e))throw new _(t,"an integer",e);const r=n?1:0,i=4294967295;if(e<r||e>i)throw new _(t,`>= ${r} && <= ${i}`,e)}));function k(e,t){if("string"!=typeof e)throw new v(t,"string",e)}const L=m(((e,t,n)=>{if(!i(n,e)){const r=o(a(n,(e=>"string"==typeof e?`'${e}'`:p(e))),", ");throw new w(t,e,"must be one of: "+r)}}));function A(e,t){if("boolean"!=typeof e)throw new v(t,"boolean",e)}function C(e,t,n){return null!=e&&h(e,t)?e[t]:n}const D=m(((e,t,n=null)=>{const i=C(n,"allowArray",!1),o=C(n,"allowFunction",!1);if(!C(n,"nullable",!1)&&null===e||!i&&r(e)||"object"!=typeof e&&(!o||"function"!=typeof e))throw new v(t,"Object",e)})),M=m(((e,t)=>{if(null!=e&&"object"!=typeof e&&"function"!=typeof e)throw new v(t,"a dictionary",e)})),P=m(((e,t,n=0)=>{if(!r(e))throw new v(t,"Array",e);if(e.length<n)throw new w(t,e,`must be longer than ${n}`)})),$=m(((e,t="buffer")=>{if(!I(e))throw new v(t,["Buffer","TypedArray","DataView"],e)})),B=m(((e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new v(t,"AbortSignal",e)})),F=m(((e,t)=>{if("function"!=typeof e)throw new v(t,"Function",e)})),q=m(((e,t)=>{if("function"!=typeof e||j(e))throw new v(t,"Function",e)})),U=m(((e,t)=>{if(void 0!==e)throw new v(t,"undefined",e)})),G=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function H(e,t){if(void 0===e||!f(G,e))throw new w(t,e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}e.exports={isInt32:function(e){return e===(0|e)},isUint32:function(e){return e===e>>>0},parseFileMode:function(e,t,n){if(void 0===e&&(e=n),"string"==typeof e){if(null===f(N,e))throw new w(t,e,"must be a 32-bit unsigned integer or an octal string");e=d(e,8)}return O(e,t),e},validateArray:P,validateStringArray:function(e,t){P(e,t);for(let n=0;n<e.length;n++)k(e[n],`${t}[${n}]`)},validateBooleanArray:function(e,t){P(e,t);for(let n=0;n<e.length;n++)A(e[n],`${t}[${n}]`)},validateAbortSignalArray:function(e,t){P(e,t);for(let n=0;n<e.length;n++){const r=e[n],i=`${t}[${n}]`;if(null==r)throw new v(i,"AbortSignal",r);B(r,i)}},validateBoolean:A,validateBuffer:$,validateDictionary:M,validateEncoding:function(e,t){const n=S(t),r=e.length;if("hex"===n&&r%2!=0)throw new w("encoding",t,`is invalid for data of length ${r}`)},validateFunction:F,validateInt32:R,validateInteger:T,validateNumber:function(e,t,n=void 0,r){if("number"!=typeof e)throw new v(t,"number",e);if(null!=n&&e<n||null!=r&&e>r||(null!=n||null!=r)&&l(e))throw new _(t,`${null!=n?`>= ${n}`:""}${null!=n&&null!=r?" && ":""}${null!=r?`<= ${r}`:""}`,e)},validateObject:D,validateOneOf:L,validatePlainFunction:q,validatePort:function(e,t="Port",n=!0){if("number"!=typeof e&&"string"!=typeof e||"string"==typeof e&&0===y(e).length||+e!=+e>>>0||e>65535||0===e&&!n)throw new b(t,e,n);return 0|e},validateSignalName:function(e,t="signal"){if(k(e,t),void 0===E[e]){if(void 0!==E[g(e)])throw new x(e+" (signals must use all capital letters)");throw new x(e)}},validateString:k,validateUint32:O,validateUndefined:U,validateUnion:function(e,t,n){if(!i(n,e))throw new v(t,`('${o(n,"|")}')`,e)},validateAbortSignal:B,validateLinkHeaderValue:function(e){if("string"==typeof e)return H(e,"hints"),e;if(r(e)){const t=e.length;let n="";if(0===t)return n;for(let r=0;r<t;r++){const i=e[r];H(i,"hints"),n+=i,r!==t-1&&(n+=", ")}return n}throw new w("hints",e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}}},9198:(e,t,n)=>{const r=n(5506),i=n(3095),o=r.Readable.destroy;e.exports=r.Readable,e.exports._uint8ArrayToBuffer=r._uint8ArrayToBuffer,e.exports._isUint8Array=r._isUint8Array,e.exports.isDisturbed=r.isDisturbed,e.exports.isErrored=r.isErrored,e.exports.isReadable=r.isReadable,e.exports.Readable=r.Readable,e.exports.Writable=r.Writable,e.exports.Duplex=r.Duplex,e.exports.Transform=r.Transform,e.exports.PassThrough=r.PassThrough,e.exports.addAbortSignal=r.addAbortSignal,e.exports.finished=r.finished,e.exports.destroy=r.destroy,e.exports.destroy=o,e.exports.pipeline=r.pipeline,e.exports.compose=r.compose,Object.defineProperty(r,"promises",{configurable:!0,enumerable:!0,get:()=>i}),e.exports.Stream=r.Stream,e.exports.default=e.exports},6371:(e,t,n)=>{const{format:r,inspect:i,AggregateError:o}=n(7760),a=globalThis.AggregateError||o,s=Symbol("kIsNodeError"),l=["string","function","number","object","Function","Object","boolean","bigint","symbol"],c=/^([A-Z][a-z0-9]*)+$/,u={};function d(e,t){if(!e)throw new u.ERR_INTERNAL_ASSERTION(t)}function h(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function f(e,t,n){n||(n=Error);class i extends n{constructor(...n){super(function(e,t,n){if("function"==typeof t)return d(t.length<=n.length,`Code: ${e}; The provided arguments length (${n.length}) does not match the required ones (${t.length}).`),t(...n);const i=(t.match(/%[dfijoOs]/g)||[]).length;return d(i===n.length,`Code: ${e}; The provided arguments length (${n.length}) does not match the required ones (${i}).`),0===n.length?t:r(t,...n)}(e,t,n))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:n.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=e,i.prototype[s]=!0,u[e]=i}function p(e){const t="__node_internal_"+e.name;return Object.defineProperty(e,"name",{value:t}),e}class g extends Error{constructor(e="The operation was aborted",t=void 0){if(void 0!==t&&"object"!=typeof t)throw new u.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError"}}f("ERR_ASSERTION","%s",Error),f("ERR_INVALID_ARG_TYPE",((e,t,n)=>{d("string"==typeof e,"'name' must be a string"),Array.isArray(t)||(t=[t]);let r="The ";e.endsWith(" argument")?r+=`${e} `:r+=`"${e}" ${e.includes(".")?"property":"argument"} `,r+="must be ";const o=[],a=[],s=[];for(const e of t)d("string"==typeof e,"All expected entries have to be of type string"),l.includes(e)?o.push(e.toLowerCase()):c.test(e)?a.push(e):(d("object"!==e,'The value "object" should be written as "Object"'),s.push(e));if(a.length>0){const e=o.indexOf("object");-1!==e&&(o.splice(o,e,1),a.push("Object"))}if(o.length>0){switch(o.length){case 1:r+=`of type ${o[0]}`;break;case 2:r+=`one of type ${o[0]} or ${o[1]}`;break;default:{const e=o.pop();r+=`one of type ${o.join(", ")}, or ${e}`}}(a.length>0||s.length>0)&&(r+=" or ")}if(a.length>0){switch(a.length){case 1:r+=`an instance of ${a[0]}`;break;case 2:r+=`an instance of ${a[0]} or ${a[1]}`;break;default:{const e=a.pop();r+=`an instance of ${a.join(", ")}, or ${e}`}}s.length>0&&(r+=" or ")}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(r+="an "),r+=`${s[0]}`;break;case 2:r+=`one of ${s[0]} or ${s[1]}`;break;default:{const e=s.pop();r+=`one of ${s.join(", ")}, or ${e}`}}if(null==n)r+=`. Received ${n}`;else if("function"==typeof n&&n.name)r+=`. Received function ${n.name}`;else if("object"==typeof n){var u;null!==(u=n.constructor)&&void 0!==u&&u.name?r+=`. Received an instance of ${n.constructor.name}`:r+=`. Received ${i(n,{depth:-1})}`}else{let e=i(n,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),r+=`. Received type ${typeof n} (${e})`}return r}),TypeError),f("ERR_INVALID_ARG_VALUE",((e,t,n="is invalid")=>{let r=i(t);return r.length>128&&(r=r.slice(0,128)+"..."),`The ${e.includes(".")?"property":"argument"} '${e}' ${n}. Received ${r}`}),TypeError),f("ERR_INVALID_RETURN_VALUE",((e,t,n)=>{var r;return`Expected ${e} to be returned from the "${t}" function but got ${null!=n&&null!==(r=n.constructor)&&void 0!==r&&r.name?`instance of ${n.constructor.name}`:"type "+typeof n}.`}),TypeError),f("ERR_MISSING_ARGS",((...e)=>{let t;d(e.length>0,"At least one arg needs to be specified");const n=e.length;switch(e=(Array.isArray(e)?e:[e]).map((e=>`"${e}"`)).join(" or "),n){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const n=e.pop();t+=`The ${e.join(", ")}, and ${n} arguments`}}return`${t} must be specified`}),TypeError),f("ERR_OUT_OF_RANGE",((e,t,n)=>{let r;return d(t,'Missing "range" argument'),Number.isInteger(n)&&Math.abs(n)>2**32?r=h(String(n)):"bigint"==typeof n?(r=String(n),(n>2n**32n||n<-(2n**32n))&&(r=h(r)),r+="n"):r=i(n),`The value of "${e}" is out of range. It must be ${t}. Received ${r}`}),RangeError),f("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),f("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),f("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),f("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),f("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),f("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),f("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),f("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),f("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),f("ERR_STREAM_WRITE_AFTER_END","write after end",Error),f("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),e.exports={AbortError:g,aggregateTwoErrors:p((function(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;const n=new a([t,e],t.message);return n.code=t.code,n}return e||t})),hideStackFrames:p,codes:u}},4134:e=>{e.exports={ArrayIsArray:e=>Array.isArray(e),ArrayPrototypeIncludes:(e,t)=>e.includes(t),ArrayPrototypeIndexOf:(e,t)=>e.indexOf(t),ArrayPrototypeJoin:(e,t)=>e.join(t),ArrayPrototypeMap:(e,t)=>e.map(t),ArrayPrototypePop:(e,t)=>e.pop(t),ArrayPrototypePush:(e,t)=>e.push(t),ArrayPrototypeSlice:(e,t,n)=>e.slice(t,n),Error,FunctionPrototypeCall:(e,t,...n)=>e.call(t,...n),FunctionPrototypeSymbolHasInstance:(e,t)=>Function.prototype[Symbol.hasInstance].call(e,t),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:(e,t)=>Object.defineProperties(e,t),ObjectDefineProperty:(e,t,n)=>Object.defineProperty(e,t,n),ObjectGetOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(e,t),ObjectKeys:e=>Object.keys(e),ObjectSetPrototypeOf:(e,t)=>Object.setPrototypeOf(e,t),Promise,PromisePrototypeCatch:(e,t)=>e.catch(t),PromisePrototypeThen:(e,t,n)=>e.then(t,n),PromiseReject:e=>Promise.reject(e),PromiseResolve:e=>Promise.resolve(e),ReflectApply:Reflect.apply,RegExpPrototypeTest:(e,t)=>e.test(t),SafeSet:Set,String,StringPrototypeSlice:(e,t,n)=>e.slice(t,n),StringPrototypeToLowerCase:e=>e.toLowerCase(),StringPrototypeToUpperCase:e=>e.toUpperCase(),StringPrototypeTrim:e=>e.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:(e,t,n)=>e.set(t,n),Boolean,Uint8Array}},7760:(e,t,n)=>{const r=n(8287),{kResistStopPropagation:i,SymbolDispose:o}=n(4134),a=globalThis.AbortSignal||n(5568).AbortSignal,s=globalThis.AbortController||n(5568).AbortController,l=Object.getPrototypeOf((async function(){})).constructor,c=globalThis.Blob||r.Blob,u=void 0!==c?function(e){return e instanceof c}:function(e){return!1},d=(e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new ERR_INVALID_ARG_TYPE(t,"AbortSignal",e)};class h extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t="";for(let n=0;n<e.length;n++)t+=` ${e[n].stack}\n`;super(t),this.name="AggregateError",this.errors=e}}e.exports={AggregateError:h,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...n){t||(t=!0,e.apply(this,n))}},createDeferredPromise:function(){let e,t;return{promise:new Promise(((n,r)=>{e=n,t=r})),resolve:e,reject:t}},promisify:e=>new Promise(((t,n)=>{e(((e,...r)=>e?n(e):t(...r)))})),debuglog:()=>function(){},format:(e,...t)=>e.replace(/%([sdifj])/g,(function(...[e,n]){const r=t.shift();return"f"===n?r.toFixed(6):"j"===n?JSON.stringify(r):"s"===n&&"object"==typeof r?`${r.constructor!==Object?r.constructor.name:""} {}`.trim():r.toString()})),inspect(e){switch(typeof e){case"string":if(e.includes("'")){if(!e.includes('"'))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case"number":return isNaN(e)?"NaN":Object.is(e,-0)?String(e):e;case"bigint":return`${String(e)}n`;case"boolean":case"undefined":return String(e);case"object":return"{}"}},types:{isAsyncFunction:e=>e instanceof l,isArrayBufferView:e=>ArrayBuffer.isView(e)},isBlob:u,deprecate:(e,t)=>e,addAbortListener:n(7007).addAbortListener||function(e,t){if(void 0===e)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);let n;return d(e,"signal"),(e=>{if("function"!=typeof e)throw new ERR_INVALID_ARG_TYPE("listener","Function",e)})(t),e.aborted?queueMicrotask((()=>t())):(e.addEventListener("abort",t,{__proto__:null,once:!0,[i]:!0}),n=()=>{e.removeEventListener("abort",t)}),{__proto__:null,[o](){var e;null===(e=n)||void 0===e||e()}}},AbortSignalAny:a.any||function(e){if(1===e.length)return e[0];const t=new s,n=()=>t.abort();return e.forEach((e=>{d(e,"signals"),e.addEventListener("abort",n,{once:!0})})),t.signal.addEventListener("abort",(()=>{e.forEach((e=>e.removeEventListener("abort",n)))}),{once:!0}),t.signal}},e.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")},5506:(e,t,n)=>{const{Buffer:r}=n(8287),{ObjectDefineProperty:i,ObjectKeys:o,ReflectApply:a}=n(4134),{promisify:{custom:s}}=n(7760),{streamReturningOperators:l,promiseReturningOperators:c}=n(823),{codes:{ERR_ILLEGAL_CONSTRUCTOR:u}}=n(6371),d=n(7830),{setDefaultHighWaterMark:h,getDefaultHighWaterMark:f}=n(5291),{pipeline:p}=n(7758),{destroyer:g}=n(5896),y=n(6238),m=n(3095),b=n(6115),v=e.exports=n(4259).Stream;v.isDestroyed=b.isDestroyed,v.isDisturbed=b.isDisturbed,v.isErrored=b.isErrored,v.isReadable=b.isReadable,v.isWritable=b.isWritable,v.Readable=n(7576);for(const _ of o(l)){const x=l[_];function S(...e){if(new.target)throw u();return v.Readable.from(a(x,this,e))}i(S,"name",{__proto__:null,value:x.name}),i(S,"length",{__proto__:null,value:x.length}),i(v.Readable.prototype,_,{__proto__:null,value:S,enumerable:!1,configurable:!0,writable:!0})}for(const j of o(c)){const I=c[j];function E(...e){if(new.target)throw u();return a(I,this,e)}i(E,"name",{__proto__:null,value:I.name}),i(E,"length",{__proto__:null,value:I.length}),i(v.Readable.prototype,j,{__proto__:null,value:E,enumerable:!1,configurable:!0,writable:!0})}v.Writable=n(8584),v.Duplex=n(3370),v.Transform=n(5001),v.PassThrough=n(6524),v.pipeline=p;const{addAbortSignal:w}=n(4147);v.addAbortSignal=w,v.finished=y,v.destroy=g,v.compose=d,v.setDefaultHighWaterMark=h,v.getDefaultHighWaterMark=f,i(v,"promises",{__proto__:null,configurable:!0,enumerable:!0,get:()=>m}),i(p,s,{__proto__:null,enumerable:!0,get:()=>m.pipeline}),i(y,s,{__proto__:null,enumerable:!0,get:()=>m.finished}),v.Stream=v,v._isUint8Array=function(e){return e instanceof Uint8Array},v._uint8ArrayToBuffer=function(e){return r.from(e.buffer,e.byteOffset,e.byteLength)}},3095:(e,t,n)=>{const{ArrayPrototypePop:r,Promise:i}=n(4134),{isIterable:o,isNodeStream:a,isWebStream:s}=n(6115),{pipelineImpl:l}=n(7758),{finished:c}=n(6238);n(5506),e.exports={finished:c,pipeline:function(...e){return new i(((t,n)=>{let i,c;const u=e[e.length-1];if(u&&"object"==typeof u&&!a(u)&&!o(u)&&!s(u)){const t=r(e);i=t.signal,c=t.end}l(e,((e,r)=>{e?n(e):t(r)}),{signal:i,end:c})}))}}},2791:function(e,t,n){!function(e){if(!e.setImmediate){var t,n,r,i,o,a=1,s={},l=!1,c=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?t=function(e){process.nextTick((function(){h(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?(i="setImmediate$"+Math.random()+"$",o=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(i)&&h(+t.data.slice(i.length))},e.addEventListener?e.addEventListener("message",o,!1):e.attachEvent("onmessage",o),t=function(t){e.postMessage(i+t,"*")}):e.MessageChannel?((r=new MessageChannel).port1.onmessage=function(e){h(e.data)},t=function(e){r.port2.postMessage(e)}):c&&"onreadystatechange"in c.createElement("script")?(n=c.documentElement,t=function(e){var t=c.createElement("script");t.onreadystatechange=function(){h(e),t.onreadystatechange=null,n.removeChild(t),t=null},n.appendChild(t)}):t=function(e){setTimeout(h,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var n=new Array(arguments.length-1),r=0;r<n.length;r++)n[r]=arguments[r+1];var i={callback:e,args:n};return s[a]=i,t(a),a++},u.clearImmediate=d}function d(e){delete s[e]}function h(e){if(l)setTimeout(h,0,e);else{var t=s[e];if(t){l=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(void 0,n)}}(t)}finally{d(e),l=!1}}}}}("undefined"==typeof self?void 0===n.g?this:n.g:self)},3141:(e,t,n)=>{var r=n(5003).Buffer,i=r.isEncoding||function(e){switch((e=""+e)&&e.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 o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=c,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=u,this.end=d,t=3;break;default:return this.write=h,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,n=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function l(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function u(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function f(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var n=function(e,t,n){var r=t.length-1;if(r<n)return 0;var i=a(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||-2===i?0:(i=a(t[r]))>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||-2===i?0:(i=a(t[r]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},5003:(e,t,n)=>{var r=n(8287),i=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},259:e=>{e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},8799:(e,t,n)=>{function r(e){var t=this;if(t instanceof r||(t=new r),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var n=0,i=arguments.length;n<i;n++)t.push(arguments[n]);return t}function i(e,t,n){var r=t===e.head?new s(n,null,t,e):new s(n,t,t.next,e);return null===r.next&&(e.tail=r),null===r.prev&&(e.head=r),e.length++,r}function o(e,t){e.tail=new s(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function a(e,t){e.head=new s(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function s(e,t,n,r){if(!(this instanceof s))return new s(e,t,n,r);this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}e.exports=r,r.Node=s,r.create=r,r.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t},r.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},r.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},r.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)o(this,arguments[e]);return this.length},r.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)a(this,arguments[e]);return this.length},r.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},r.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},r.prototype.forEach=function(e,t){t=t||this;for(var n=this.head,r=0;null!==n;r++)e.call(t,n.value,r,this),n=n.next},r.prototype.forEachReverse=function(e,t){t=t||this;for(var n=this.tail,r=this.length-1;null!==n;r--)e.call(t,n.value,r,this),n=n.prev},r.prototype.get=function(e){for(var t=0,n=this.head;null!==n&&t<e;t++)n=n.next;if(t===e&&null!==n)return n.value},r.prototype.getReverse=function(e){for(var t=0,n=this.tail;null!==n&&t<e;t++)n=n.prev;if(t===e&&null!==n)return n.value},r.prototype.map=function(e,t){t=t||this;for(var n=new r,i=this.head;null!==i;)n.push(e.call(t,i.value,this)),i=i.next;return n},r.prototype.mapReverse=function(e,t){t=t||this;for(var n=new r,i=this.tail;null!==i;)n.push(e.call(t,i.value,this)),i=i.prev;return n},r.prototype.reduce=function(e,t){var n,r=this.head;if(arguments.length>1)n=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");r=this.head.next,n=this.head.value}for(var i=0;null!==r;i++)n=e(n,r.value,i),r=r.next;return n},r.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");r=this.tail.prev,n=this.tail.value}for(var i=this.length-1;null!==r;i--)n=e(n,r.value,i),r=r.prev;return n},r.prototype.toArray=function(){for(var e=new Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},r.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},r.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new r;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,o=this.head;null!==o&&i<e;i++)o=o.next;for(;null!==o&&i<t;i++,o=o.next)n.push(o.value);return n},r.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new r;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,o=this.tail;null!==o&&i>t;i--)o=o.prev;for(;null!==o&&i>e;i--,o=o.prev)n.push(o.value);return n},r.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var r=0,o=this.head;null!==o&&r<e;r++)o=o.next;var a=[];for(r=0;o&&r<t;r++)a.push(o.value),o=this.removeNode(o);for(null===o&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev),r=0;r<n.length;r++)o=i(this,o,n[r]);return a},r.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;null!==n;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=t,this.tail=e,this};try{n(259)(r)}catch(e){}},7789:()=>{}},n={};function r(e){var i=n[e];if(void 0!==i)return i.exports;var o=n[e]={exports:{}};return t[e].call(o.exports,o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};r.d(i,{TS:()=>ut,aH:()=>st,k_:()=>_e,a6:()=>Ur,nt:()=>oe,Sx:()=>ae,E7:()=>X,F3:()=>we,WW:()=>lt});var o={};r.r(o),r.d(o,{anyAtomicType:()=>Gn,anySimpleType:()=>Un,anyURI:()=>ur,base64Binary:()=>cr,boolean:()=>Qn,byte:()=>_r,date:()=>nr,dateTime:()=>er,dateTimeStamp:()=>Or,dayTimeDuration:()=>Rr,decimal:()=>Xn,double:()=>Yn,duration:()=>Zn,float:()=>Kn,gDay:()=>ar,gMonth:()=>sr,gMonthDay:()=>or,gYear:()=>ir,gYearMonth:()=>rr,hexBinary:()=>lr,int:()=>vr,integer:()=>gr,language:()=>pr,long:()=>br,negativeInteger:()=>mr,nonNegativeInteger:()=>xr,nonPositiveInteger:()=>yr,normalizedString:()=>hr,positiveInteger:()=>Nr,short:()=>wr,string:()=>Jn,time:()=>tr,token:()=>fr,unsignedByte:()=>Er,unsignedInt:()=>jr,unsignedLong:()=>Sr,unsignedShort:()=>Ir,yearMonthDuration:()=>Tr});const a="http://www.w3.org/1999/02/22-rdf-syntax-ns#",s="http://www.w3.org/2001/XMLSchema#",l="http://www.w3.org/2000/10/swap/",c={xsd:{decimal:`${s}decimal`,boolean:`${s}boolean`,double:`${s}double`,integer:`${s}integer`,string:`${s}string`},rdf:{type:`${a}type`,nil:`${a}nil`,first:`${a}first`,rest:`${a}rest`,langString:`${a}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${l}reify#forSome`,forAll:`${l}reify#forAll`},log:{implies:`${l}log#implies`}},{rdf:u,xsd:d}=c;let h,f=0;const p={namedNode:j,blankNode:I,variable:N,literal:E,defaultGraph:function(){return h},quad:T,triple:T,fromTerm:R,fromQuad:O},g=p;class y{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof y?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}class m extends y{get termType(){return"NamedNode"}}class b extends y{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const e=this.id;let t=e.lastIndexOf('"')+1;return t<e.length&&"@"===e[t++]?e.substr(t).toLowerCase():""}get datatype(){return new m(this.datatypeString)}get datatypeString(){const e=this.id,t=e.lastIndexOf('"')+1,n=t<e.length?e[t]:"";return"^"===n?e.substr(t+2):"@"!==n?d.string:u.langString}equals(e){return e instanceof b?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&this.datatype.value===e.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}}class v extends y{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}}class w extends y{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}}function _(e,t,n){if(t=t||p,!e)return t.defaultGraph();switch(e[0]){case"?":return t.variable(e.substr(1));case"_":return t.blankNode(e.substr(2));case'"':if(t===p)return new b(e);if('"'===e[e.length-1])return t.literal(e.substr(1,e.length-2));const r=e.lastIndexOf('"',e.length-1);return t.literal(e.substr(1,r-1),"@"===e[r+1]?e.substr(r+2):t.namedNode(e.substr(r+3)));case"[":e=JSON.parse(e);break;default:if(!n||!Array.isArray(e))return t.namedNode(e)}return t.quad(_(e[0],t,!0),_(e[1],t,!0),_(e[2],t,!0),e[3]&&_(e[3],t,!0))}function x(e,t){if("string"==typeof e)return e;if(e instanceof y&&"Quad"!==e.termType)return e.id;if(!e)return h.id;switch(e.termType){case"NamedNode":return e.value;case"BlankNode":return`_:${e.value}`;case"Variable":return`?${e.value}`;case"DefaultGraph":return"";case"Literal":return`"${e.value}"${e.language?`@${e.language}`:e.datatype&&e.datatype.value!==d.string?`^^${e.datatype.value}`:""}`;case"Quad":const n=[x(e.subject,!0),x(e.predicate,!0),x(e.object,!0)];return e.graph&&"DefaultGraph"!==e.graph.termType&&n.push(x(e.graph,!0)),t?n:JSON.stringify(n);default:throw new Error(`Unexpected termType: ${e.termType}`)}}h=new class extends y{constructor(){return super(""),h||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};class S extends y{constructor(e,t,n,r){super(""),this._subject=e,this._predicate=t,this._object=n,this._graph=r||h}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 j(e){return new m(e)}function I(e){return new v(e||"n3-"+f++)}function E(e,t){if("string"==typeof t)return new b(`"${e}"@${t.toLowerCase()}`);let n=t?t.value:"";return""===n&&("boolean"==typeof e?n=d.boolean:"number"==typeof e&&(Number.isFinite(e)?n=Number.isInteger(e)?d.integer:d.double:(n=d.double,Number.isNaN(e)||(e=e>0?"INF":"-INF")))),""===n||n===d.string?new b(`"${e}"`):new b(`"${e}"^^${n}`)}function N(e){return new w(e)}function T(e,t,n,r){return new S(e,t,n,r)}function R(e){if(e instanceof y)return e;switch(e.termType){case"NamedNode":return j(e.value);case"BlankNode":return I(e.value);case"Variable":return N(e.value);case"DefaultGraph":return h;case"Literal":return E(e.value,e.language||e.datatype);case"Quad":return O(e);default:throw new Error(`Unexpected termType: ${e.termType}`)}}function O(e){if(e instanceof S)return e;if("Quad"!==e.termType)throw new Error(`Unexpected termType: ${e.termType}`);return T(R(e.subject),R(e.predicate),R(e.object),R(e.graph))}const k="http://www.w3.org/ns/shacl#",L="http://www.w3.org/2001/XMLSchema#",A="http://www.w3.org/1999/02/22-rdf-syntax-ns#",C="http://www.w3.org/2000/01/rdf-schema#",D="http://www.w3.org/2004/02/skos/core#",M="http://www.w3.org/2002/07/owl#",P=g.namedNode("shapes"),$=g.namedNode(A+"type"),B=g.namedNode("http://purl.org/dc/terms/conformsTo"),F=g.namedNode(C+"subClassOf"),q=g.namedNode(D+"broader"),U=g.namedNode(M+"imports"),G=g.namedNode(M+"NamedIndividual"),H=g.namedNode(k+"NodeShape"),V=g.namedNode(k+"IRI"),W=g.namedNode(k+"class"),z=g.namedNode(k+"targetClass"),J=g.namedNode(k+"nodeKind");function Q(e,t,n=k,r){let i="";const o=function(e,t,n=k,r){let i;const o=n+t;if(null==r?void 0:r.length){for(const t of r)for(const n of e)if(n.predicate.value===o){if(n.object.id.endsWith(`@${t}`))return n.object;n.object.id.indexOf("@")<0?i=n.object:i||(i=n.object)}}else for(const t of e)if(t.predicate.value===o)return t.object;return i}(e,t,n,r);return o&&(i=o.value),i}function X(e,t){return Q(e,"prefLabel",D,t)||Q(e,"label",C,t)}function K(e,t,n,r){const i=[];for(const o of e)i.push({value:o,label:X(t.getQuads(o,null,null,null),n),indent:r});return i}function Y(e,t){for(const n in t)e=e.replace(t[n],"");return e}function Z(e,t,n,r,i=new Set){for(const o of t.owlImports)i.has(o.id)||(i.add(o.id),r.push(...n.getSubjects($,e,o)));t.parent&&Z(e,t.parent,n,r,i)}function ee(e,t,n=0){const r=t.config.shapesGraph.getSubjects($,e,P);r.push(...t.config.dataGraph.getSubjects($,e,null)),Z(e,t,t.config.shapesGraph,r);const i=K(r,t.config.shapesGraph,t.config.languages,n);for(const r of t.config.shapesGraph.getSubjects(F,e,null))i.push(...ee(r,t,n+1));if(t.config.shapesGraph.getQuads(e,$,G,null).length>0){i.push(...K([e],t.config.shapesGraph,t.config.languages,n));for(const r of t.config.shapesGraph.getSubjects(q,e,null))i.push(...ee(r,t,n+1))}return i}function te(e){let t;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}function ne(e,t,n){if(void 0===t)return n;if(void 0===n)return t;const r=e.indexOf(t.language);if(r<0)return n;const i=e.indexOf(n.language);return i<0||i>r?t:n}function re(e,t,n){const r=document.createElement("div");r.classList.add("shacl-or-constraint");const i=[];if(i.push({label:"--- please choose ---",value:""}),t instanceof Ae){const o=[];for(let r=0;r<e.length;r++){const a=new xe(e[r],t,n);o.push(a),i.push({label:a.template.label,value:r.toString()})}const a=n.theme.createListEditor("Please choose",null,!1,i),s=a.querySelector(".editor");s.onchange=()=>{s.value&&r.replaceWith(o[parseInt(s.value)])},r.appendChild(a)}else{const o=[];for(let t=0;t<e.length;t++){const r=n.shapesGraph.getQuads(e[t],null,null,null);r.length&&(o.push(r),i.push({label:X(r,n.languages)||Y(r[0].predicate.value,n.prefixes)+" = "+Y(r[0].object.value,n.prefixes),value:t.toString()}))}const a=n.theme.createListEditor(t.template.label+"?",null,!1,i,t.template),s=a.querySelector(".editor");s.onchange=()=>{s.value&&r.replaceWith(Se(t.template.clone().merge(o[parseInt(s.value)]),void 0,!0))},r.appendChild(a)}return r}const ie={[`${k}name`]:(e,t)=>{const n=t;e.name=ne(e.config.languages,e.name,n)},[`${k}description`]:(e,t)=>{const n=t;e.description=ne(e.config.languages,e.description,n)},[`${k}path`]:(e,t)=>{e.path=t.value},[`${k}node`]:(e,t)=>{e.node=t},[`${k}datatype`]:(e,t)=>{e.datatype=t},[`${k}nodeKind`]:(e,t)=>{e.nodeKind=t},[`${k}minCount`]:(e,t)=>{e.minCount=parseInt(t.value)},[`${k}maxCount`]:(e,t)=>{e.maxCount=parseInt(t.value)},[`${k}minLength`]:(e,t)=>{e.minLength=parseInt(t.value)},[`${k}maxLength`]:(e,t)=>{e.maxLength=parseInt(t.value)},[`${k}minInclusive`]:(e,t)=>{e.minInclusive=parseInt(t.value)},[`${k}maxInclusive`]:(e,t)=>{e.maxInclusive=parseInt(t.value)},[`${k}minExclusive`]:(e,t)=>{e.minExclusive=parseInt(t.value)},[`${k}maxExclusive`]:(e,t)=>{e.maxExclusive=parseInt(t.value)},[`${k}pattern`]:(e,t)=>{e.pattern=t.value},[`${k}order`]:(e,t)=>{e.order=parseInt(t.value)},"http://datashapes.org/dash#singleLine":(e,t)=>{e.singleLine="true"===t.value},"http://www.w3.org/ns/oa#styleClass":(e,t)=>{e.cssClass=t.value},[`${k}and`]:(e,t)=>{e.shaclAnd=t.value},[`${k}in`]:(e,t)=>{e.shaclIn=t.value},[`${k}languageIn`]:(e,t)=>{e.languageIn=e.config.lists[t.value],e.datatype=g.namedNode(A+"langString")},[`${k}defaultValue`]:(e,t)=>{e.defaultValue=t},[`${k}hasValue`]:(e,t)=>{e.hasValue=t},[U.id]:(e,t)=>{e.owlImports.push(t)},[W.id]:(e,t)=>{e.class=t;const n=e.config.shapesGraph.getSubjects(z,t,null);n.length>0&&(e.node=n[0])},[`${k}or`]:(e,t)=>{const n=e.config.lists[t.value];(null==n?void 0:n.length)?e.shaclOr=n:console.error("list not found:",t.value,"existing lists:",e.config.lists)}};class oe{constructor(e,t,n){this.label="",this.owlImports=[],this.parent=t,this.config=n,this.merge(e)}merge(e){var t,n;for(const n of e)null===(t=ie[n.predicate.id])||void 0===t||t.call(this,this,n.object);if(this.label=(null===(n=this.name)||void 0===n?void 0:n.value)||X(e,this.config.languages),this.label||this.shaclAnd||(this.label=this.path?Y(this.path,this.config.prefixes):"unknown"),(this.node||this.shaclAnd)&&(this.extendedShapes=[],this.node&&this.extendedShapes.push(this.node),this.shaclAnd)){const e=this.config.lists[this.shaclAnd];if(null==e?void 0:e.length)for(const t of e)this.extendedShapes.push(t)}return this}clone(){const e=Object.assign({},this);return e.owlImports=[...this.owlImports],this.languageIn&&(e.languageIn=[...this.languageIn]),this.shaclOr&&(e.shaclOr=[...this.shaclOr]),e.merge=this.merge.bind(e),e.clone=this.clone.bind(e),e}}class ae{constructor(e){let t="form { box-sizing: border-box; display:block; --label-width: 8em; --caret-size: 10px; }\nform.mode-edit { padding-left: 1em; }\nform *, form ::after, form ::before { box-sizing: inherit; }\nshacl-node, .shacl-group { display: flex; flex-direction: column; width: 100%; position: relative; }\nshacl-node .control-button { text-decoration: none; cursor: pointer; border: 1px solid transparent; border-radius: 4px; padding: 2px 4px; }\nshacl-node .control-button:hover { border-color: inherit; }\nshacl-node .remove-button { margin-left: 4px; }\nshacl-node .add-button { font-size: 0.8rem; color: #555; margin: 4px 24px 0 0; }\nshacl-node .add-button:before { content: '+'; margin-right: 0.2em; }\nshacl-node .add-button:hover { color: inherit; }\nshacl-node h1 { font-size: 1.1rem; border-bottom: 1px solid; margin-top: 4px; color: #555; }\nshacl-property { display: flex; flex-direction: column; align-items: end; position: relative; }\nshacl-property:not(.may-add) > .add-button { display: none; }\nshacl-property:not(.may-remove) > .property-instance > .remove-button:not(.persistent) { visibility: hidden; }\nshacl-property:not(.may-remove) > .shacl-or-constraint > .remove-button:not(.persistent) { visibility: hidden; }\n.shacl-group { margin-bottom: 1em; padding-bottom: 1em; }\n.mode-view .shacl-group:not(:has(shacl-property)) { display: none; }\n.property-instance, .shacl-or-constraint { display: flex; align-items: flex-start; padding: 4px 0; width: 100%; position: relative; }\n.shacl-or-constraint label { display: inline-block; word-break: break-word; width: var(--label-width); line-height: 1em; padding-top: 0.15em; padding-right: 1em; flex-shrink: 0; position: relative; }\n.property-instance label[title] { cursor: help; text-decoration: underline dashed #AAA; }\n.mode-edit .property-instance label.required::before { color: red; content: '\\2736'; font-size: 0.6rem; position: absolute; left: -1.4em; top: 0.15rem; }\n.property-instance.valid::before { position: absolute; left: calc(var(--label-width) - 1em); top: 6px; color: green; content: '\\2713'; }\n.editor:not([type='checkbox']), .shacl-or-constraint select { flex-grow: 1; }\n.shacl-or-constraint select { border: 1px solid #DDD; padding: 2px 4px; }\nselect { overflow: hidden; text-overflow: ellipsis; }\ntextarea.editor { resize: vertical; }\n.lang-chooser { position: absolute; top: 5px; right: 24px; border: 0; background-color: #e9e9ed; padding: 2px 4px; max-width: 40px; width: 40px; box-sizing: content-box; }\n.lang-chooser+.editor { padding-right: 55px; }\n.validation-error { position: absolute; left: calc(var(--label-width) - 1em); top: 6px; color: red; cursor: help; }\n.validation-error::before { content: '\\26a0' }\n.validation-error.node { left: -1em; }\n.invalid > .editor { border-color: red !important; }\n.ml-0 { margin-left: 0 !important; }\n.pr-0 { padding-right: 0 !important; }\n.mode-view .property-instance:not(:first-child) > label { visibility: hidden; }\n.mode-view .property-instance label { width: var(--label-width); }\n\n.d-flex { display: flex; }\n.lang { opacity: 0.65; font-size: 0.6em; }\na, a:visited { color: inherit; }\n\n.fadeIn, .fadeOut { animation: fadeIn 0.2s ease-out; }\n.fadeOut { animation-direction: reverse; animation-timing-function: ease-out;}\n@keyframes fadeIn {\n 0% { opacity: 0; transform: scaleY(0.8); }\n 100% { opacity: 1; transform: scaleY(1); }\n}\n \n.collapsible > .activator { display: flex; justify-content: space-between; align-items: center; cursor: pointer; width: 100%; border: 0; padding: 8px 0; transition: 0.2s; }\n.collapsible > .activator:hover, .collapsible.open > .activator { background-color: #F5F5F5; }\n.collapsible > .activator::after { content:''; width: var(--caret-size); height: var(--caret-size); border-style: none solid solid none; border-width: calc(0.3 * var(--caret-size)); transform: rotate(45deg); transition: transform .15s ease-out; margin-right: calc(0.5 * var(--caret-size)); }\n.collapsible.open > .activator::after { transform: rotate(225deg); }\n.collapsible > *:not(.activator) { transition: all 0.2s ease-out; opacity: 1; }\n.collapsible:not(.open) > *:not(.activator) { max-height: 0; padding: 0; opacity: 0; overflow: hidden; }\n.collapsible > .property-instance > shacl-node > h1 { display: none; }\n.collapsible.open > .property-instance:nth-child(odd) { background-color: #F5F5F5; }\n.ref-link { cursor: pointer; }\n.ref-link:hover { text-decoration: underline; }\n.node-id-display { color: #999; font-size: 11px; }";e&&(t+="\n"+e),this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t)}apply(e){}createViewer(e,t,n){const r=document.createElement("div"),i=document.createElement("label");i.innerHTML=e+":",n.description&&i.setAttribute("title",n.description.value),r.appendChild(i);let o,a=t.value,s=null;if(t instanceof m){const e=n.config.shapesGraph.getQuads(a,null,null,null);if(e.length){const t=X(e,n.config.languages);t&&(a=t)}}else t instanceof b&&(t.language?(s=document.createElement("span"),s.classList.add("lang"),s.innerText=`@${t.language}`):t.datatype.value===`${L}date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`${L}dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));return te(t.value)?(o=document.createElement("a"),o.setAttribute("href",t.value)):o=document.createElement("div"),o.classList.add("d-flex"),o.innerText=a,s&&o.appendChild(s),r.appendChild(o),r}}function se(e){return!!e&&"DefaultGraph"===e.termType}const le=g.defaultGraph(),{rdf:ce,xsd:ue}=c,de=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,he=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,fe={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class pe extends y{equals(e){return e===this}}class ge{constructor(e,t){if(this._prefixRegex=/$0^/,e&&"function"!=typeof e.write&&(t=e,e=null),t=t||{},this._lists=t.lists,e)this._outputStream=e,this._endStream=void 0===t.end||!!t.end;else{let e="";this._outputStream={write(t,n,r){e+=t,r&&r()},end:t=>{t&&t(null,e)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=le,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseMatcher=new RegExp(`^${me(t.baseIRI)}${t.baseIRI.endsWith("/")?"":"[#?]"}`),this._baseLength=t.baseIRI.length))}get _inDefaultGraph(){return le.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t)}_writeQuad(e,t,n,r,i){try{r.equals(this._graph)||(this._write((null===this._subject?"":this._inDefaultGraph?".\n":"\n}\n")+(le.equals(r)?"":`${this._encodeIriOrBlank(r)} {\n`)),this._graph=r,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(`, ${this._encodeObject(n)}`,i):this._write(`;\n ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(n)}`,i):this._write(`${(null===this._subject?"":".\n")+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(n)}`,i)}catch(e){i&&i(e)}}_writeQuadLine(e,t,n,r,i){delete this._prefixMatch,this._write(this.quadToString(e,t,n,r),i)}quadToString(e,t,n,r){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(n)}${r&&r.value?` ${this._encodeIriOrBlank(r)} .\n`:" .\n"}`}quadsToString(e){let t="";for(const n of e)t+=this.quadToString(n.subject,n.predicate,n.object,n.graph);return t}_encodeSubject(e){return"Quad"===e.termType?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if("NamedNode"!==e.termType)return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let t=e.value;this._baseMatcher&&this._baseMatcher.test(t)&&(t=t.substr(this._baseLength)),de.test(t)&&(t=t.replace(he,ye));const n=this._prefixRegex.exec(t);return n?n[1]?this._prefixIRIs[n[1]]+n[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(de.test(t)&&(t=t.replace(he,ye)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===ue.string)return`"${t}"`}else switch(e.datatype.value){case ue.string:return`"${t}"`;case ue.boolean:if("true"===t||"false"===t)return t;break;case ue.integer:if(/^[+-]?\d+$/.test(t))return t;break;case ue.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case ue.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===ce.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:t,object:n,graph:r}){return`<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(n)}${se(r)?"":` ${this._encodeIriOrBlank(r)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,n,r,i){void 0===n?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):"function"==typeof r?this._writeQuad(e,t,n,le,r):this._writeQuad(e,t,n,r||le,i)}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}addPrefix(e,t,n){const r={};r[e]=t,this.addPrefixes(r,n)}addPrefixes(e,t){if(!this._prefixIRIs)return t&&t();let n=!1;for(let t in e){let r=e[t];"string"!=typeof r&&(r=r.value),n=!0,null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null,this._graph=""),this._prefixIRIs[r]=t+=":",this._write(`@prefix ${t} <${r}>.\n`)}if(n){let e="",t="";for(const n in this._prefixIRIs)e+=e?`|${n}`:n,t+=(t?"|":"")+this._prefixIRIs[n];e=me(e),this._prefixRegex=new RegExp(`^(?:${t})[^/]*$|^(${e})([_a-zA-Z][\\-_a-zA-Z0-9]*)$`)}this._write(n?"\n":"",t)}blank(e,t){let n,r,i=e;switch(void 0===e?i=[]:e.termType?i=[{predicate:e,object:t}]:"length"in e||(i=[e]),r=i.length){case 0:return new pe("[]");case 1:if(n=i[0],!(n.object instanceof pe))return new pe(`[ ${this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)} ]`);default:let t="[";for(let o=0;o<r;o++)n=i[o],n.predicate.equals(e)?t+=`, ${this._encodeObject(n.object)}`:(t+=`${(o?";\n ":"\n ")+this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)}`,e=n.predicate);return new pe(`${t}\n]`)}}list(e){const t=e&&e.length||0,n=new Array(t);for(let r=0;r<t;r++)n[r]=this._encodeObject(e[r]);return new pe(`(${n.join(" ")})`)}end(e){null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null),this._write=this._blockedWrite;let t=e&&((n,r)=>{t=null,e(n,r)});if(this._endStream)try{return this._outputStream.end(t)}catch(e){}t&&t()}}function ye(e){let t=fe[e];return void 0===t&&(1===e.length?(t=e.charCodeAt(0).toString(16),t="\\u0000".substr(0,6-t.length)+t):(t=(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)+9216).toString(16),t="\\U00000000".substr(0,10-t.length)+t)),t}function me(e){return e.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}function be(e){let t=e.shaclDatatype,n=e.value;return n?e.dataset.class||e.dataset.nodeKind===k+"IRI"?g.namedNode(n):(e.dataset.lang?t=e.dataset.lang:"number"===e.type?n=parseFloat(n):"file"===e.type&&e.binaryData?n=e.binaryData:"datetime-local"===e.type&&(n=new Date(n).toISOString().slice(0,19)),g.literal(n,t)):"checkbox"!==e.type&&"checkbox"!==e.getAttribute("type")||!(e.checked||parseInt(e.dataset.minCount||"0")>0)?void 0:g.literal(e.checked?"true":"false",t)}const ve={};function we(e){void 0===e.predicate&&void 0===e.datatype?console.warn('not registering plugin because it does neither define "predicate" nor "datatype"',e):ve[`${e.predicate}^${e.datatype}`]=e}class _e{constructor(e,t){this.predicate=e.predicate,this.datatype=e.datatype,t&&(this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t))}createViewer(e,t){return e.config.theme.createViewer(e.label,t,e)}}class xe extends HTMLElement{constructor(e,t,n,r){var i;if(super(),this.template=new oe(n.shapesGraph.getQuads(e,null,null,null),t,n),void 0!==this.template.order&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),n.editMode&&(this.addButton=document.createElement("a"),this.addButton.innerText=this.template.label,this.addButton.title="Add "+this.template.label,this.addButton.classList.add("control-button","add-button"),this.addButton.addEventListener("click",(e=>{const t=this.addPropertyInstance();t.classList.add("fadeIn"),this.updateControls(),function(e){var t;null===(t=e.querySelector("input,select,textarea"))||void 0===t||t.focus()}(t),setTimeout((()=>{t.classList.remove("fadeIn")}),200)})),this.appendChild(this.addButton)),this.template.path){const e=r?n.dataGraph.getQuads(r,this.template.path,null,null):[];let t=!1;for(const n of e)this.addPropertyInstance(n.object),this.template.hasValue&&n.object.equals(this.template.hasValue)&&(t=!0);n.editMode&&this.template.hasValue&&!t&&this.addPropertyInstance(this.template.hasValue)}if(n.editMode&&(this.addEventListener("change",(()=>{this.updateControls()})),this.updateControls()),(null===(i=this.template.extendedShapes)||void 0===i?void 0:i.length)&&null!==this.template.config.attributes.collapse&&(!this.template.maxCount||this.template.maxCount>1)&&(n.editMode||this.childElementCount>0)){const e=this;e.classList.add("collapsible"),"open"===this.template.config.attributes.collapse&&e.classList.add("open");const t=document.createElement("h1");t.classList.add("activator"),t.innerText=this.template.label,t.addEventListener("click",(()=>{e.classList.toggle("open")})),this.prepend(t)}}addPropertyInstance(e){var t;let n;return(null===(t=this.template.shaclOr)||void 0===t?void 0:t.length)?e?n=Se(function(e,t){if(!e.shaclOr)return console.warn("can't resolve sh:or because template has no options",e),e;if(t instanceof b){const n=t.datatype;for(const t of e.shaclOr){const r=e.config.shapesGraph.getQuads(t,null,null,null);for(const t of r)if(t.predicate.value===`${k}datatype`&&t.object.equals(n))return e.clone().merge(r)}}else{let n=e.config.dataGraph.getObjects(t,$,null);n.push(...e.config.shapesGraph.getObjects(t,$,null));for(const t of e.shaclOr){const r=e.config.shapesGraph.getQuads(t,null,null,null);for(const t of r)if(n.length>0){if(t.predicate.value===`${k}node`)for(const i of n)if(e.config.shapesGraph.getQuads(t.object,z,i,null).length>0)return e.clone().merge(r);if(t.predicate.equals(W))for(const i of n)if(t.object.equals(i))return e.clone().merge(r)}else if(t.predicate.equals(J)&&t.object.equals(V))return e.clone().merge(r)}}return console.error("couldn't resolve sh:or for value",t),e}(this.template,e),e,!0):(n=re(this.template.shaclOr,this,this.template.config),je(n,"")):n=Se(this.template,e),this.template.config.editMode?this.insertBefore(n,this.addButton):this.appendChild(n),n}updateControls(){var e;let t,n=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length;0===n&&(!(null===(e=this.template.extendedShapes)||void 0===e?void 0:e.length)||void 0!==this.template.minCount&&this.template.minCount>0)&&(this.addPropertyInstance(),n=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length),t=void 0!==this.template.minCount?n>this.template.minCount:this.template.extendedShapes&&this.template.extendedShapes.length>0||n>1;const r=void 0===this.template.maxCount||n<this.template.maxCount;this.classList.toggle("may-remove",t),this.classList.toggle("may-add",r)}toRDF(e,t){for(const n of this.querySelectorAll(":scope > .property-instance")){const r=g.namedNode(n.dataset.path);if(n.firstChild instanceof Ae){const i=n.firstChild.toRDF(e);e.addQuad(t,r,i,this.template.config.valuesGraph)}else{const i=be(n.querySelector(".editor"));i&&e.addQuad(t,r,i,this.template.config.valuesGraph)}}}}function Se(e,t,n=!1){var r,i;let o;if(null===(r=e.extendedShapes)||void 0===r?void 0:r.length){o=document.createElement("div"),o.classList.add("property-instance");for(const n of e.extendedShapes)o.appendChild(new Ae(n,e.config,t,e.parent,e.nodeKind,e.label))}else{const n=function(e,t){let n=ve[`${e}^${t}`];return n||(n=ve[`${e}^undefined`],n||ve[`undefined^${t}`])}(e.path,null===(i=e.datatype)||void 0===i?void 0:i.value);o=n?e.config.editMode?n.createEditor(e,t):n.createViewer(e,t):function(e,t){var n,r,i;if(e.config.editMode){const o=void 0!==e.minCount&&e.minCount>0;if(e.class)return e.config.theme.createListEditor(e.label,t,o,ee(e.class,e),e);if(e.shaclIn){const n=e.config.lists[e.shaclIn];if(null==n?void 0:n.length){const r=K(n,e.config.shapesGraph,e.config.languages);return e.config.theme.createListEditor(e.label,t,o,r,e)}console.error("list not found:",e.shaclIn,"existing lists:",e.config.lists)}if((null===(n=e.datatype)||void 0===n?void 0:n.value)===`${A}langString`||(null===(r=e.languageIn)||void 0===r?void 0:r.length))return e.config.theme.createLangStringEditor(e.label,t,o,e);switch(null===(i=e.datatype)||void 0===i?void 0:i.value.replace(L,"")){case"integer":case"float":case"double":case"decimal":return e.config.theme.createNumberEditor(e.label,t,o,e);case"date":case"dateTime":return e.config.theme.createDateEditor(e.label,t,o,e);case"boolean":return e.config.theme.createBooleanEditor(e.label,t,o,e);case"base64Binary":return e.config.theme.createFileEditor(e.label,t,o,e)}return e.config.theme.createTextEditor(e.label,t,o,e)}{if(t)return e.config.theme.createViewer(e.label,t,e);const n=document.createElement("div");return n.innerHTML="No value",n}}(e,t||null),o.classList.add("property-instance")}return e.config.editMode&&je(o,e.label,n),o.dataset.path=e.path,o}function je(e,t,n=!1){const r=document.createElement("a");r.innerText="×",r.classList.add("control-button","btn","remove-button"),r.title="Remove "+t,r.addEventListener("click",(t=>{e.classList.remove("fadeIn"),e.classList.add("fadeOut"),setTimeout((()=>{const t=e.parentElement;e.remove(),null==t||t.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))}),200)})),n&&r.classList.add("persistent"),e.appendChild(r)}function Ie(e,t){const n=document.createElement("div");n.dataset.subject=e,n.classList.add("shacl-group");let r=e;const i=t.shapesGraph.getQuads(e,null,null,null),o=Q(i,"label",C,t.languages);o&&(r=o);const a=Q(i,"order");a&&(n.style.order=a);const s=document.createElement("h1");return s.innerText=r,n.appendChild(s),null!==t.attributes.collapse&&(n.classList.add("collapsible"),"open"===t.attributes.collapse&&n.classList.add("open"),s.classList.add("activator"),s.addEventListener("click",(()=>{n.classList.toggle("open")}))),n}window.customElements.define("shacl-property",xe);const Ee={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};var Ne,Te=new Uint8Array(16);function Re(){if(!Ne&&!(Ne="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ne(Te)}for(var Oe=[],ke=0;ke<256;++ke)Oe.push((ke+256).toString(16).slice(1));const Le=function(e,t,n){if(Ee.randomUUID&&!t&&!e)return Ee.randomUUID();var r=(e=e||{}).random||(e.rng||Re)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return function(e,t=0){return(Oe[e[t+0]]+Oe[e[t+1]]+Oe[e[t+2]]+Oe[e[t+3]]+"-"+Oe[e[t+4]]+Oe[e[t+5]]+"-"+Oe[e[t+6]]+Oe[e[t+7]]+"-"+Oe[e[t+8]]+Oe[e[t+9]]+"-"+Oe[e[t+10]]+Oe[e[t+11]]+Oe[e[t+12]]+Oe[e[t+13]]+Oe[e[t+14]]+Oe[e[t+15]]).toLowerCase()}(r)};class Ae extends HTMLElement{constructor(e,t,n,r,i,o){super(),this.owlImports=[],this.parent=r,this.config=t,this.shaclSubject=e;let a=n;if(!a){if(!i){const n=t.shapesGraph.getObjects(e,`${k}nodeKind`,null);n.length&&(i=n[0])}a=void 0===i&&t.attributes.valuesNamespace||(null==i?void 0:i.id)===`${k}IRI`?g.namedNode(t.attributes.valuesNamespace+Le()):g.blankNode(Le())}this.nodeId=a;const s=JSON.stringify([e,n]);if(n&&t.renderedNodes.has(s)){if(o&&null===t.attributes.collapse){const e=document.createElement("label");e.innerText=o,this.appendChild(e)}const e=document.createElement("a");e.innerText=n.id,e.classList.add("ref-link"),e.onclick=()=>{var e;null===(e=this.config.form.querySelector(`shacl-node[data-node-id='${this.nodeId.id}']`))||void 0===e||e.scrollIntoView()},this.appendChild(e),this.style.flexDirection="row"}else{n&&t.renderedNodes.add(s),this.dataset.nodeId=this.nodeId.id;const r=t.shapesGraph.getQuads(e,null,null,null);let i;if(null!==this.config.attributes.showNodeIds){const e=document.createElement("div");e.innerText=`id: ${this.nodeId.id}`,e.classList.add("node-id-display"),this.appendChild(e)}for(const e of r)switch(e.predicate.id){case`${k}property`:let r=this;const o=t.shapesGraph.getQuads(e.object,`${k}group`,null,null);if(o.length>0){const e=o[0].object.value;if(t.groups.indexOf(e)>-1){let n=this.querySelector(`:scope > .shacl-group[data-subject='${e}']`);n||(n=Ie(e,t),this.appendChild(n)),r=n}else console.warn("ignoring unknown group reference",o[0],"existing groups:",t.groups)}setTimeout((()=>{const i=new xe(e.object,this,t,n);i.childElementCount>0&&r.appendChild(i)}));break;case`${k}and`:if(i=t.lists[e.object.value],null==i?void 0:i.length)for(const e of i)this.prepend(new Ae(e,t,n,this));else console.error("list not found:",e.object.value,"existing lists:",t.lists);break;case`${k}node`:this.prepend(new Ae(e.object,t,n,this));break;case`${k}targetClass`:this.targetClass=e.object;break;case U.id:this.owlImports.push(e.object);break;case`${k}or`:i=t.lists[e.object.value],(null==i?void 0:i.length)?this.appendChild(re(i,this,t)):console.error("list not found:",e.object.value,"existing lists:",t.lists)}if(o){const e=document.createElement("h1");e.innerText=o,this.prepend(e)}}}toRDF(e,t){t||(t=this.nodeId);for(const n of this.querySelectorAll(":scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property"))n.toRDF(e,t);return this.targetClass&&e.addQuad(t,$,this.targetClass,this.config.valuesGraph),this.config.attributes.generateNodeShapeReference&&!this.parent&&e.addQuad(t,g.namedNode(this.config.attributes.generateNodeShapeReference),this.shaclSubject,this.config.valuesGraph),t}}window.customElements.define("shacl-node",Ae);var Ce=r(9198);const De=Symbol("iter");function Me(e,t,n=4){if(0===n)return Object.assign(e,t);for(const r in t)e[r]=Me(e[r]||Object.create(null),t[r],n-1);return e}function Pe(e,t,n=4){let r=!1;for(const i in e)if(i in t){const o=0===n?null:Pe(e[i],t[i],n-1);if(!1!==o)r=r||Object.create(null),r[i]=o;else if(3===n)return!1}return r}class $e{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||g}_termFromId(e){if("."===e[0]){const t=this._entities,n=e.split(".");return this._factory.quad(this._termFromId(t[n[1]]),this._termFromId(t[n[2]]),this._termFromId(t[n[3]]),n[4]&&this._termFromId(t[n[4]]))}return _(e,this._factory)}_termToNumericId(e){if("Quad"===e.termType){const t=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),r=this._termToNumericId(e.object);let i;return t&&n&&r&&(se(e.graph)||(i=this._termToNumericId(e.graph)))&&this._ids[i?`.${t}.${n}.${r}.${i}`:`.${t}.${n}.${r}`]}return this._ids[x(e)]}_termToNewNumericId(e){const t=e&&"Quad"===e.termType?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${se(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:x(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,n;if(e)for(t=e=`_:${e}`,n=1;this._ids[t];)t=e+n++;else do{t="_:b"+this._blankNodeIndex++}while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}}class Be{constructor(e,t){this._size=0,this._graphs=Object.create(null),t||!e||e[0]||(t=e,e=null),t=t||{},this._factory=t.factory||g,this._entityIndex=t.entityIndex||new $e({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.addQuads(e)}get size(){let e=this._size;if(null!==e)return e;e=0;const t=this._graphs;let n,r;for(const i in t)for(const o in n=t[i].subjects)for(const t in r=n[o])e+=Object.keys(r[t]).length;return this._size=e}_addToIndex(e,t,n,r){const i=e[t]||(e[t]={}),o=i[n]||(i[n]={}),a=r in o;return a||(o[r]=null),!a}_removeFromIndex(e,t,n,r){const i=e[t],o=i[n];delete o[r];for(const e in o)return;delete i[n];for(const e in i)return;delete e[t]}*_findInIndex(e,t,n,r,i,o,a,s){let l,c,u;const d=this._entities,h=this._termFromId(d[s]),f={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const t in e)if(c=e[t]){f[i]=this._termFromId(d[t]),n&&((l=c,c={})[n]=l[n]);for(const e in c)if(u=c[e]){f[o]=this._termFromId(d[e]);const t=r?r in u?[r]:[]:Object.keys(u);for(let e=0;e<t.length;e++)f[a]=this._termFromId(d[t[e]]),yield this._factory.quad(f.subject,f.predicate,f.object,h)}}}_loop(e,t){for(const n in e)t(n)}_loopByKey0(e,t,n){let r,i;if(r=e[t])for(i in r)n(i)}_loopByKey1(e,t,n){let r,i;for(r in e)i=e[r],i[t]&&n(r)}_loopBy2Keys(e,t,n,r){let i,o,a;if((i=e[t])&&(o=i[n]))for(a in o)r(a)}_countInIndex(e,t,n,r){let i,o,a,s=0;t&&((i=e,e={})[t]=i[t]);for(const t in e)if(o=e[t]){n&&((i=o,o={})[n]=i[n]);for(const e in o)(a=o[e])&&(r?r in a&&s++:s+=Object.keys(a).length)}return s}_getGraphs(e){return"number"!=typeof(e=""===e?1:e&&(this._termToNumericId(e)||-1))?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){const t=Object.create(null);return n=>{n in t||(t[n]=!0,e(this._termFromId(this._entities[n],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,n,r){t||(r=e.graph,n=e.object,t=e.predicate,e=e.subject),r=r?this._termToNewNumericId(r):1;let i=this._graphs[r];return i||(i=this._graphs[r]={subjects:{},predicates:{},objects:{}},Object.freeze(i)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),n=this._termToNewNumericId(n),!!this._addToIndex(i.subjects,e,t,n)&&(this._addToIndex(i.predicates,t,n,e),this._addToIndex(i.objects,n,e,t),this._size=null,!0)}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}delete(e){return this.removeQuad(e),this}has(e,t,n,r){return e&&e.subject&&({subject:e,predicate:t,object:n,graph:r}=e),!this.readQuads(e,t,n,r).next().done}import(e){return e.on("data",(e=>{this.addQuad(e)})),e}removeQuad(e,t,n,r){t||({subject:e,predicate:t,object:n,graph:r}=e),r=r?this._termToNumericId(r):1;const i=this._graphs;let o,a,s;if(!((e=e&&this._termToNumericId(e))&&(t=t&&this._termToNumericId(t))&&(n=n&&this._termToNumericId(n))&&(o=i[r])&&(a=o.subjects[e])&&(s=a[t])&&n in s))return!1;for(e in this._removeFromIndex(o.subjects,e,t,n),this._removeFromIndex(o.predicates,t,n,e),this._removeFromIndex(o.objects,n,e,t),null!==this._size&&this._size--,o.subjects)return!0;return delete i[r],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t])}remove(e){return e.on("data",(e=>{this.removeQuad(e)})),e}removeMatches(e,t,n,r){const i=new Ce.Readable({objectMode:!0}),o=this.readQuads(e,t,n,r);return i._read=e=>{for(;--e>=0;){const{done:e,value:t}=o.next();if(e)return void i.push(null);i.push(t)}},this.remove(i)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,n,r){return[...this.readQuads(e,t,n,r)]}*readQuads(e,t,n,r){const i=this._getGraphs(r);let o,a,s,l;if(!(e&&!(a=this._termToNumericId(e))||t&&!(s=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n))))for(const e in i)(o=i[e])&&(a?l?yield*this._findInIndex(o.objects,l,a,s,"object","subject","predicate",e):yield*this._findInIndex(o.subjects,a,s,null,"subject","predicate","object",e):s?yield*this._findInIndex(o.predicates,s,l,null,"predicate","object","subject",e):l?yield*this._findInIndex(o.objects,l,null,null,"object","subject","predicate",e):yield*this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",e))}match(e,t,n,r){return new qe(this,e,t,n,r,{entityIndex:this._entityIndex})}countQuads(e,t,n,r){const i=this._getGraphs(r);let o,a,s,l,c=0;if(e&&!(a=this._termToNumericId(e))||t&&!(s=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n)))return 0;for(const r in i)(o=i[r])&&(c+=e?n?this._countInIndex(o.objects,l,a,s):this._countInIndex(o.subjects,a,s,l):t?this._countInIndex(o.predicates,s,l,a):this._countInIndex(o.objects,l,a,s));return c}forEach(e,t,n,r,i){this.some((t=>(e(t,this),!1)),t,n,r,i)}every(e,t,n,r,i){return!this.some((t=>!e(t,this)),t,n,r,i)}some(e,t,n,r,i){for(const o of this.readQuads(t,n,r,i))if(e(o))return!0;return!1}getSubjects(e,t,n){const r=[];return this.forSubjects((e=>{r.push(e)}),e,t,n),r}forSubjects(e,t,n,r){const i=this._getGraphs(r);let o,a,s;if(e=this._uniqueEntities(e),!(t&&!(a=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(o=i[r])&&(a?s?this._loopBy2Keys(o.predicates,a,s,e):this._loopByKey1(o.subjects,a,e):s?this._loopByKey0(o.objects,s,e):this._loop(o.subjects,e))}getPredicates(e,t,n){const r=[];return this.forPredicates((e=>{r.push(e)}),e,t,n),r}forPredicates(e,t,n,r){const i=this._getGraphs(r);let o,a,s;if(e=this._uniqueEntities(e),!(t&&!(a=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(o=i[r])&&(a?s?this._loopBy2Keys(o.objects,s,a,e):this._loopByKey0(o.subjects,a,e):s?this._loopByKey1(o.predicates,s,e):this._loop(o.predicates,e))}getObjects(e,t,n){const r=[];return this.forObjects((e=>{r.push(e)}),e,t,n),r}forObjects(e,t,n,r){const i=this._getGraphs(r);let o,a,s;if(e=this._uniqueEntities(e),!(t&&!(a=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(o=i[r])&&(a?s?this._loopBy2Keys(o.subjects,a,s,e):this._loopByKey1(o.objects,a,e):s?this._loopByKey0(o.predicates,s,e):this._loop(o.objects,e))}getGraphs(e,t,n){const r=[];return this.forGraphs((e=>{r.push(e)}),e,t,n),r}forGraphs(e,t,n,r){for(const i in this._graphs)this.some((t=>(e(t.graph),!0)),t,n,r,this._termFromId(this._entities[i]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const n={},r=t?()=>!0:(e,t)=>{throw new Error(`${e.value} ${t}`)},i=this.getQuads(null,c.rdf.rest,c.rdf.nil,null),o=e?[...i]:[];return i.forEach((t=>{const i=[];let a,s,l=!1;const u=t.graph;let d=t.subject;for(;d&&!l;){const e=this.getQuads(null,null,d,null),t=this.getQuads(d,null,null,null);let n,h=null,f=null,p=null;for(let i=0;i<t.length&&!l;i++)n=t[i],n.graph.equals(u)?a?l=r(d,"has non-list arcs out"):n.predicate.value===c.rdf.first?h?l=r(d,"has multiple rdf:first arcs"):o.push(h=n):n.predicate.value===c.rdf.rest?f?l=r(d,"has multiple rdf:rest arcs"):o.push(f=n):e.length?l=r(d,"can't be subject and object"):(a=n,s="subject"):l=r(d,"not confined to single graph");for(let t=0;t<e.length&&!l;++t)n=e[t],a?l=r(d,"can't have coreferences"):n.predicate.value===c.rdf.rest?p?l=r(d,"has incoming rdf:rest arcs"):p=n:(a=n,s="object");h?i.unshift(h.object):l=r(d,"has no list head"),d=p&&p.subject}l?e=!1:a&&(n[a[s].value]=i)})),e&&this.removeQuads(o),n}addAll(e){if(Array.isArray(e))this.addQuads(e);else if(e instanceof Be&&e._entityIndex===this._entityIndex)0!==e._size&&(this._graphs=Me(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e===this)return!0;if(!(e instanceof Be)||this._entityIndex!==e._entityIndex)return e.every((e=>this.has(e)));const t=this._graphs,n=e._graphs;let r,i,o,a,s;for(const e in n){if(!(r=t[e]))return!1;r=r.subjects;for(const t in i=n[e].subjects){if(!(o=r[t]))return!1;for(const e in a=i[t]){if(!(s=o[e]))return!1;for(const t in a[e])if(!(t in s))return!1}}}return!0}deleteMatches(e,t,n,r){for(const i of this.match(e,t,n,r))this.removeQuad(i);return this}difference(e){return e===this?new Be({entityIndex:this._entityIndex}):this.filter((t=>!e.has(t)))}equals(e){return e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new Be({entityIndex:this._entityIndex});for(const n of this)e(n,this)&&t.add(n);return t}intersection(e){if(e===this){const e=new Be({entityIndex:this._entityIndex});return e._graphs=Me(Object.create(null),this._graphs),e._size=this._size,e}if(e instanceof Be&&this._entityIndex===e._entityIndex){const t=new Be({entityIndex:this._entityIndex}),n=Pe(e._graphs,this._graphs);return n&&(t._graphs=n,t._size=null),t}return this.filter((t=>e.has(t)))}map(e){const t=new Be({entityIndex:this._entityIndex});for(const n of this)t.add(e(n,this));return t}reduce(e,t){const n=this.readQuads();let r=void 0===t?n.next().value:t;for(const t of n)r=e(r,t,this);return r}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return(new ge).quadsToString(this)}union(e){const t=new Be({entityIndex:this._entityIndex});return t._graphs=Me(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function Fe(e,t,n=0){const r=t[n];if(r&&!(r in e))return!1;let i=!1;for(const o in r?{[r]:e[r]}:e){const r=2===n?null:Fe(e[o],t,n+1);!1!==r&&(i=i||Object.create(null),i[o]=r)}return i}class qe extends Ce.Readable{constructor(e,t,n,r,i,o){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:n,object:r,graph:i,options:o})}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:n,predicate:r,subject:i}=this,o=this._filtered=new Be({factory:e._factory,entityIndex:this.options.entityIndex}),a=e._getGraphs(t);let s,l,c;if(i&&!(s=o._termToNumericId(i))||r&&!(l=o._termToNumericId(r))||n&&!(c=o._termToNumericId(n)))return o;for(const e in a){const t=Fe(a[e].subjects,[s,l,c]);t&&(o._graphs[e]={subjects:t,predicates:Fe(a[e].predicates,[l,c,s]),objects:Fe(a[e].objects,[c,s,l])})}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[De]&&(this[De]=this[Symbol.iterator]());const t=this[De];for(;--e>=0;){const{done:e,value:n}=t.next();if(e)return void this.push(null);this.push(n)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,n,r){return this.filtered.deleteMatches(e,t,n,r)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,n,r,i){return this.filtered.every(e,t,n,r,i)}filter(e){return this.filtered.filter(e)}forEach(e,t,n,r,i){return this.filtered.forEach(e,t,n,r,i)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,t,n,r,i){return this.filtered.some(e,t,n,r,i)}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,t){return this.filtered.reduce(e,t)}toString(){return(new ge).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,t,n,r){return new qe(this.filtered,e,t,n,r,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}var Ue=r(8287),Ge=r(9596),He=r.n(Ge);const{xsd:Ve}=c,We=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,ze={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Je=/[\x00-\x20<>\\"\{\}\|\^\`]/,Qe={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},Xe=/$0^/;class Ke{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._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._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|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._lineMode=!!e.lineMode){this._n3Mode=!1;for(const e in this)!(e in Qe)&&this[e]instanceof RegExp&&(this[e]=Xe)}else this._n3Mode=!1!==e.n3;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let n=this._input,r=n.length;for(;;){let e,a;for(;e=this._newline.exec(n);)this.comments&&(a=this._comment.exec(e[0]))&&i("comment",a[1],"",this._line,e[0].length),n=n.substr(e[0].length,n.length),r=n.length,this._line++;if(!e&&(e=this._whitespace.exec(n))&&(n=n.substr(e[0].length,n.length)),this._endOfFile.test(n))return t&&(this.comments&&(a=this._comment.exec(n))&&i("comment",a[1],"",this._line,n.length),n=null,i("eof","","",this._line,0)),this._input=n;const s=this._line,l=n[0];let c="",u="",d="",h=null,f=0,p=!1;switch(l){case"^":if(n.length<3)break;if("^"!==n[1]){this._n3Mode&&(f=1,c="^");break}if(this._previousMarker="^^",n=n.substr(2),"<"!==n[0]){p=!0;break}case"<":if(h=this._unescapedIri.exec(n))c="IRI",u=h[1];else if(h=this._iri.exec(n)){if(u=this._unescape(h[1]),null===u||Je.test(u))return o(this);c="IRI"}else n.length>1&&"<"===n[1]?(c="<<",f=2):this._n3Mode&&n.length>1&&"="===n[1]&&(c="inverse",f=2,u=">");break;case">":n.length>1&&">"===n[1]&&(c=">>",f=2);break;case"_":((h=this._blank.exec(n))||t&&(h=this._blank.exec(`${n} `)))&&(c="blank",d="_",u=h[1]);break;case'"':if(h=this._simpleQuotedString.exec(n))u=h[1];else if(({value:u,matchLength:f}=this._parseLiteral(n)),null===u)return o(this);null===h&&0===f||(c="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(h=this._simpleApostropheString.exec(n))u=h[1];else if(({value:u,matchLength:f}=this._parseLiteral(n)),null===u)return o(this);null===h&&0===f||(c="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(h=this._variable.exec(n))&&(c="var",u=h[0]);break;case"@":"literal"===this._previousMarker&&(h=this._langcode.exec(n))?(c="langcode",u=h[1]):(h=this._keyword.exec(n))&&(c=h[0]);break;case".":if(1===n.length?t:n[1]<"0"||n[1]>"9"){c=".",f=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(h=this._number.exec(n)||t&&(h=this._number.exec(`${n} `)))&&(c="literal",u=h[0],d="string"==typeof h[1]?Ve.double:"string"==typeof h[2]?Ve.decimal:Ve.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(h=this._sparqlKeyword.exec(n))?c=h[0].toUpperCase():p=!0;break;case"f":case"t":(h=this._boolean.exec(n))?(c="literal",u=h[0],d=Ve.boolean):p=!0;break;case"a":(h=this._shortPredicates.exec(n))?(c="abbreviation",u="a"):p=!0;break;case"=":this._n3Mode&&n.length>1&&(c="abbreviation",">"!==n[1]?(f=1,u="="):(f=2,u=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(f=1,c=l);break;case"{":!this._lineMode&&n.length>=2&&("|"===n[1]?(c="{|",f=2):(c=l,f=1));break;case"|":n.length>=2&&"}"===n[1]&&(c="|}",f=2);break;default:p=!0}if(p&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(h=this._prefix.exec(n))?((h=this._prefixed.exec(n))||t&&(h=this._prefixed.exec(`${n} `)))&&(c="prefixed",d=h[1]||"",u=this._unescape(h[2])):(c="prefix",u=h[1]||"")),"^^"===this._previousMarker)switch(c){case"prefixed":c="type";break;case"IRI":c="typeIRI";break;default:c=""}if(!c)return t||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?o(this):this._input=n;const g=f||h[0].length,y=i(c,u,d,s,g);this.previousToken=y,this._previousMarker=c,n=n.substr(g,n.length)}function i(t,i,o,a,s){const l=n?r-n.length:r,c={type:t,value:i,prefix:o,line:a,start:l,end:l+s};return e(null,c),c}function o(t){e(t._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(e){let t=!1;const n=e.replace(We,((e,n,r,i)=>{if("string"==typeof n)return String.fromCharCode(Number.parseInt(n,16));if("string"==typeof r){let e=Number.parseInt(r,16);return e<=65535?String.fromCharCode(Number.parseInt(r,16)):String.fromCharCode(55296+((e-=65536)>>10),56320+(1023&e))}return i in ze?ze[i]:(t=!0,"")}));return t?null:n}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],n=t.length;let r=Math.max(this._literalClosingPos,n);for(;(r=e.indexOf(t,r))>0;){let t=0;for(;"\\"===e[r-t-1];)t++;if(t%2==0){const t=e.substring(n,r),i=t.split(/\r\n|\r|\n/).length-1,o=r+n;if(1===n&&0!==i||3===n&&this._lineMode)break;return this._line+=i,{value:this._unescape(t),matchLength:o}}r++}this._literalClosingPos=e.length-n+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;const t=new Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith("\ufeff")?e.substr(1):e}tokenize(e,t){if(this._line=1,"string"==typeof e){if(this._input=this._readStartingBom(e),"function"!=typeof t){const e=[];let t;if(this._tokenizeToEnd(((n,r)=>n?t=n:e.push(r)),!0),t)throw t;return e}He()((()=>this._tokenizeToEnd(t,!0)))}else this._pendingBuffer=null,"function"==typeof e.setEncoding&&e.setEncoding("utf8"),e.on("data",(e=>{null!==this._input&&0!==e.length&&(this._pendingBuffer&&(e=Ue.Buffer.concat([this._pendingBuffer,e]),this._pendingBuffer=null),128&e[e.length-1]?this._pendingBuffer=e:(void 0===this._input?this._input=this._readStartingBom("string"==typeof e?e:e.toString()):this._input+=e,this._tokenizeToEnd(t,!1)))})),e.on("end",(()=>{"string"==typeof this._input&&this._tokenizeToEnd(t,!0)})),e.on("error",t)}}let Ye=0;class Ze{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&tt(this,e.factory);const t="string"==typeof e.format?e.format.match(/\w*$/)[0].toLowerCase():"",n=/turtle/.test(t),r=/trig/.test(t),i=/triple/.test(t),o=/quad/.test(t),a=this._n3Mode=/n3/.test(t),s=i||o;(this._supportsNamedGraphs=!(n||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(n||r||i||a),this._supportsRDFStar=""===t||/star|\*$/.test(t),s&&(this._resolveRelativeIRI=e=>null),this._blankNodePrefix="string"!=typeof e.blankNodePrefix?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new Ke({lineMode:s,n3:a}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){Ye=0}_setBase(e){if(e){const t=e.indexOf("#");t>=0&&(e=e.substr(0,t)),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]}else this._base="",this._basePath=""}_saveContext(e,t,n,r,i){const o=this._n3Mode;this._contextStack.push({type:e,subject:n,predicate:r,object:i,graph:t,inverse:!!o&&this._inversePredicate,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,t){const n=this._contextStack.pop();if(!n||n.type!==e)return this._error(`Unexpected ${t.type}`,t);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)}_readInTopContext(e){switch(e.type){case"eof":return null!==this._graph?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"{":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,t){let n;switch(e.type){case"IRI":case"typeIRI":const t=this._resolveIRI(e.value);if(null===t)return this._error("Invalid IRI",e);n=this._namedNode(t);break;case"type":case"prefixed":const r=this._prefixes[e.prefix];if(void 0===r)return this._error(`Undefined prefix "${e.prefix}:"`,e);n=this._namedNode(r+e.value);break;case"blank":n=this._blankNode(this._prefixes[e.prefix]+e.value);break;case"var":n=this._variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!t&&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._blankNode(),null,null),this._readBlankNodeHead;case"(":return 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._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=this._blankNode,this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier=this._variable,this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(0===e.prefix.length)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._literal(e.value,this._namedNode(e.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",e);default:if(void 0===(this._subject=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){const t=e.type;switch(t){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${t}`,e):(this._subject=null,"]"===t?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",e);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if(void 0===(this._predicate=this._readEntity(e)))return}return this._readObject}_readObject(e){switch(e.type){case"literal":if(0===e.prefix.length)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._literal(e.value,this._namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._blankNode()),this._readBlankNodeHead;case"(":return 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._blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",e);default:if(void 0===(this._object=this._readEntity(e)))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){return"]"===e.type?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if("]"!==e.type)return this._readBlankNodePunctuation(e);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const t=null===this._predicate;return this._restoreContext("blank",e),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:t?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 t=null,n=null,r=this._readListItem;const i=this._subject,o=this._contextStack,a=o[o.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,n=this._blankNode(),this.RDF_FIRST,this._subject=t=this._blankNode()),r=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,n=this._blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),0!==o.length&&"list"===o[o.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(r=this._readPredicate,this._subject===this.RDF_NIL)return r}else if(r=this._getContextEndReader(),this._object===this.RDF_NIL)return r;n=this.RDF_NIL;break;case"literal":0===e.prefix.length?(this._literalValue=e.value,r=this._readListItemDataTypeOrLang):(t=this._literal(e.value,this._namedNode(e.prefix)),r=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if(void 0===(t=this._readEntity(e)))return}if(null===n&&(this._subject=n=this._blankNode()),null===i?null===a.predicate?a.subject=n:a.object=n:this._emit(i,this.RDF_REST,n,this._graph),null!==t){if(this._n3Mode&&("IRI"===e.type||"prefixed"===e.type))return this._saveContext("item",this._graph,n,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(n,this.RDF_FIRST,t,this._graph)}return r}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let t=this._literal(this._literalValue);switch(e.type){case"type":case"typeIRI":const n=this._readEntity(e);if(void 0===n)return;t=this._literal(this._literalValue,n),e=null;break;case"langcode":t=this._literal(this._literalValue,e.value),e=null}return{token:e,literal:t}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,t){const n=this._completeLiteral(e);if(n)return this._object=n.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),null===n.token?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(n.token))}_readFormulaTail(e){return"}"!==e.type?this._readPunctuation(e):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let t,n=this._graph;const r=this._subject,i=this._inversePredicate;switch(e.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,i&&(this._inversePredicate=!1);break;case";":t=this._readPredicate;break;case",":t=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF-star syntax",e);const o=this._predicate,a=this._object;this._subject=this._quad(r,o,a,this.DEFAULTGRAPH),t=this._readPredicate;break;case"|}":if("Quad"!==this._subject.termType)return this._error("Unexpected asserted triple closing",e);this._subject=null,t=this._readPunctuation;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(n=this._readEntity(e))){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(null!==r){const e=this._predicate,t=this._object;i?this._emit(t,e,r,n):this._emit(r,e,t,n)}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case";":t=this._readPredicate;break;case",":t=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),t}_readQuadPunctuation(e){return"."!==e.type?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return"prefix"!==e.type?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if("IRI"!==e.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);const t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){const t="IRI"===e.type&&this._resolveIRI(e.value);return t?(this._setBase(t),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",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._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 t;switch(e.type){case"IRI":case"prefixed":if(void 0!==(t=this._readEntity(e,!0)))break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._quantifier(this._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:const t=this._contextStack,n=t.length&&t[t.length-1];if(n&&"item"===n.type){const t=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,t,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let t,n;const r=this._blankNode();if(void 0!==(n=this._readEntity(e)))return null===this._predicate?(t=this._subject,this._subject=r):(t=this._object,this._object=r),this._emit(t,n,r,this._graph),this._readPath}_readBackwardPath(e){const t=this._blankNode();let n,r;if(void 0!==(n=this._readEntity(e)))return null===this._predicate?(r=this._subject,this._subject=t):(r=this._object,this._object=t),this._emit(t,n,r,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return">>"!==e.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(e))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e):this._readRDFStarTail(e)}_readRDFStarTail(e){if(">>"!==e.type)return this._error(`Expected >> but got ${e.type}`,e);const t=this._quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",e),null===this._subject?(this._subject=t,this._readPredicate):(this._object=t,this._getContextEndReader())}_getContextEndReader(){const 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._readRDFStarTailOrGraph}}_emit(e,t,n,r){this._callback(null,this._quad(e,t,n,r||this.DEFAULTGRAPH))}_error(e,t){const n=new Error(`${e} on line ${t.line}.`);n.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=et}_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;const t=e.length;let n="",r=-1,i=-1,o=0,a="/";for(;r<t;){switch(a){case":":if(i<0&&"/"===e[++r]&&"/"===e[++r])for(;(i=r+1)<t&&"/"!==e[i];)r=i;break;case"?":case"#":r=t;break;case"/":if("."===e[r+1])switch(a=e[1+ ++r],a){case"/":n+=e.substring(o,r-1),o=r+1;break;case void 0:case"?":case"#":return n+e.substring(o,r)+e.substr(r+1);case".":if(a=e[1+ ++r],void 0===a||"/"===a||"?"===a||"#"===a){if(n+=e.substring(o,r-2),(o=n.lastIndexOf("/"))>=i&&(n=n.substr(0,o)),"/"!==a)return`${n}/${e.substr(r+1)}`;o=r+1}}}a=e[++r]}return n+e.substring(o)}parse(e,t,n){let r,i,o;if(t&&(t.onQuad||t.onPrefix||t.onComment)?(r=t.onQuad,i=t.onPrefix,o=t.onComment):(r=t,i=n),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Ye++}_`,this._prefixCallback=i||et,this._inversePredicate=!1,this._quantified=Object.create(null),!r){const t=[];let n;if(this._callback=(e,r)=>{e?n=e:r&&t.push(r)},this._lexer.tokenize(e).every((e=>this._readCallback=this._readCallback(e))),n)throw n;return t}let a=(e,t)=>{null!==e?(this._callback(e),this._callback=et):this._readCallback&&(this._readCallback=this._readCallback(t))};o&&(this._lexer.comments=!0,a=(e,t)=>{null!==e?(this._callback(e),this._callback=et):this._readCallback&&("comment"===t.type?o(t.value):this._readCallback=this._readCallback(t))}),this._callback=r,this._lexer.tokenize(e,a)}}function et(){}function tt(e,t){const n=t.namedNode;e._namedNode=n,e._blankNode=t.blankNode,e._literal=t.literal,e._variable=t.variable,e._quad=t.quad,e.DEFAULTGRAPH=t.defaultGraph(),e.RDF_FIRST=n(c.rdf.first),e.RDF_REST=n(c.rdf.rest),e.RDF_NIL=n(c.rdf.nil),e.N3_FORALL=n(c.r.forAll),e.N3_FORSOME=n(c.r.forSome),e.ABBREVIATIONS={a:n(c.rdf.type),"=":n(c.owl.sameAs),">":n(c.log.implies)},e.QUANTIFIERS_GRAPH=n("urn:n3:quantifiers")}tt(Ze.prototype,g);var nt=r(4841),rt=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};const it={},ot={};let at;class st{constructor(e){this.loadedExternalUrls=[],this.loadedClasses=[],this.config=e}loadGraphs(){return rt(this,void 0,void 0,(function*(){this.loadedExternalUrls=[],this.loadedClasses=[];let e=at;const t=new Be;this.config.prefixes={};const n=[this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?this.fetchRDF(this.config.attributes.valuesUrl):"",t,void 0,new Ze({blankNodePrefix:""}))];if(e||(e=new Be,n.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?this.fetchRDF(this.config.attributes.shapesUrl):"",e,P))),yield Promise.all(n),!at&&0==(null==e?void 0:e.size)&&this.config.attributes.valuesSubject){const n=[...t.getObjects(this.config.attributes.valuesSubject,$,null),...t.getObjects(this.config.attributes.valuesSubject,B,null)],r=[];for(const t of n){const n=this.toURL(t.value);n&&this.loadedExternalUrls.indexOf(n)<0&&(this.loadedExternalUrls.push(n),r.push(this.importRDF(this.fetchRDF(n),e,P)))}try{yield Promise.allSettled(r)}catch(e){console.warn(e)}}this.config.shapesGraph=e,this.config.dataGraph=t}))}importRDF(e,t,n,r){return rt(this,void 0,void 0,(function*(){const i=r||new Ze,o=e=>rt(this,void 0,void 0,(function*(){const o=[];yield new Promise(((a,s)=>{i.parse(e,((e,i,l)=>{if(e)return s(e);if(i){if(t.add(new S(i.subject,i.predicate,i.object,n)),null===this.config.attributes.ignoreOwlImports&&U.equals(i.predicate)){const e=this.toURL(i.object.value);e&&this.loadedExternalUrls.indexOf(e)<0&&(this.loadedExternalUrls.push(e),o.push(this.importRDF(this.fetchRDF(e),t,g.namedNode(e),r)))}if(this.config.classInstanceProvider&&W.equals(i.predicate)){const e=i.object.value;if(this.loadedClasses.indexOf(e)<0){let i;e in ot?i=ot[e]:(i=this.config.classInstanceProvider(e),ot[e]=i),this.loadedClasses.push(e),o.push(this.importRDF(i,t,n,r))}}}else l&&this.config.registerPrefixes(l),a(null)}))}));try{yield Promise.allSettled(o)}catch(e){console.warn(e)}}));if(e instanceof Promise&&(e=yield e),e){try{e=yield(0,nt.toRDF)(JSON.parse(e),{format:"application/n-quads"})}catch(e){}yield o(e)}}))}fetchRDF(e){return rt(this,void 0,void 0,(function*(){if(e in it)return it[e];const t=fetch(e,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then((e=>e.text()));return it[e]=t,t}))}toURL(e){if(te(e))return e;if(this.config.prefixes){const t=e.split(":");if(2===t.length){const n=this.config.prefixes[t[0]];if(n&&te(e=e.replace(`${t[0]}:`,n)))return e}}return null}}function lt(e){at=e}class ct{constructor(){this.shapes=null,this.shapesUrl=null,this.shapeSubject=null,this.values=null,this.valuesUrl=null,this.valueSubject=null,this.valuesSubject=null,this.valuesNamespace="",this.valuesGraph=null,this.view=null,this.language=null,this.loading="Loading…",this.ignoreOwlImports=null,this.collapse=null,this.submitButton=null,this.generateNodeShapeReference=null,this.showNodeIds=null}}class ut{constructor(e,t){this.attributes=new ct,this.loader=new st(this),this.prefixes={},this.editMode=!0,this.dataGraph=new Be,this.lists={},this.groups=[],this.renderedNodes=new Set,this._shapesGraph=new Be,this.theme=e,this.form=t,this.languages=[...new Set(navigator.languages.flatMap((e=>e.length>2?[e.toLocaleLowerCase(),e.substring(0,2)]:e))),""]}updateAttributes(e){const t=new ct;if(Object.keys(t).forEach((n=>{const r=e.dataset[n];void 0!==r&&(t[n]=r)})),this.editMode=null===t.view,this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){const e=this.languages.indexOf(t.language);e>-1&&this.languages.splice(e,1),this.languages.unshift(t.language)}this.valuesGraph=t.valuesGraph?g.namedNode(t.valuesGraph):void 0}static dataAttributes(){const e=new ct;return Object.keys(e).map((e=>"data-"+e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))))}get shapesGraph(){return this._shapesGraph}set shapesGraph(e){this._shapesGraph=e,this.lists=e.extractLists(),this.groups=[],e.forSubjects((e=>{this.groups.push(e.id)}),$,`${k}PropertyGroup`,null)}registerPrefixes(e){for(const t in e)t&&(this.prefixes[t]=e[t])}}const dt=function(e){return"<"+e.value+">"},ht=/["\\\\\n\r]/,ft=/["\\\\\n\r]/g,pt={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function gt(e){return pt[e]}const yt=function e(t){if(!t)return null;if("BlankNode"===t.termType)return function(e){return"_:"+e.value}(t);if("DefaultGraph"===t.termType)return"";if("Literal"===t.termType)return function(e){const t=(n=e.value,ht.test(n)?n.replace(ft,gt):n);var n;return"http://www.w3.org/2001/XMLSchema#string"===e.datatype.value?'"'+t+'"':"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"===e.datatype.value?'"'+t+'"@'+e.language:'"'+t+'"^^'+dt(e.datatype)}(t);if("NamedNode"===t.termType)return dt(t);if("Quad"===t.termType||t.subject&&t.predicate&&t.object&&t.graph)return function(e,t){const n=t(e.subject),r=t(e.predicate),i=t(e.object),o=t(e.graph);return`${n} ${r} ${i} ${o?o+" ":""}.`}(t,e);if("Variable"===t.termType)return function(e){return"?"+e.value}(t);if(t[Symbol.iterator])return function(e,t){return[...e].map((e=>t(e))).join("\n")+"\n"}(t,e);throw new Error(`unknown termType ${t.termType}`)};class mt{constructor(e){if(this.index=new Map,e)for(const[t,n]of e)this.set(t,n)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(yt(e))}*entries(){for(const[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(const n of this.entries())e.call(t,n[1],n[0],this)}get(e){const t=this.index.get(yt(e));return t&&t.value}has(e){return this.index.has(yt(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const n=yt(e);return this.index.set(n,{term:e,value:t}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}const bt=mt;function vt(e){try{return yt(e)}catch(e){return null}}class wt{constructor(e){if(this.index=new Map,e)for(const t of e)this.add(t)}get size(){return this.index.size}add(e){const t=yt(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return!!e&&this.index.delete(vt(e))}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return!!e&&this.index.has(vt(e))}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}const _t=wt,xt=class{constructor({dataset:e,end:t,quad:n,start:r}){this.dataset=e,this.end=t,this.quad=n,this.start=r}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}};class St{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}St.prototype.termType="BlankNode";const jt=St;class It{equals(e){return!!e&&e.termType===this.termType}}It.prototype.termType="DefaultGraph",It.prototype.value="";const Et=It,Nt=function(e,t){if(!t)return null;if("BlankNode"===t.termType)return e.blankNode(t.value);if("DefaultGraph"===t.termType)return e.defaultGraph();if("Literal"===t.termType)return e.literal(t.value,t.language||e.namedNode(t.datatype.value));if("NamedNode"===t.termType)return e.namedNode(t.value);if("Quad"===t.termType){const n=e.fromTerm(t.subject),r=e.fromTerm(t.predicate),i=e.fromTerm(t.object),o=e.fromTerm(t.graph);return e.quad(n,r,i,o)}if("Variable"===t.termType)return e.variable(t.value);throw new Error(`unknown termType ${t.termType}`)};class Tt{constructor(e,t,n){this.value=e,this.language=t,this.datatype=n}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value&&e.language===this.language&&e.datatype.equals(this.datatype)}}Tt.prototype.termType="Literal";const Rt=Tt;class Ot{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Ot.prototype.termType="NamedNode";const kt=Ot;class Lt{constructor(e,t,n,r){this.subject=e,this.predicate=t,this.object=n,this.graph=r}equals(e){return!!e&&("Quad"===e.termType||!e.termType)&&e.subject.equals(this.subject)&&e.predicate.equals(this.predicate)&&e.object.equals(this.object)&&e.graph.equals(this.graph)}}Lt.prototype.termType="Quad",Lt.prototype.value="";const At=Lt;class Ct{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Ct.prototype.termType="Variable";const Dt=Ct,Mt=new kt("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),Pt=new kt("http://www.w3.org/2001/XMLSchema#string");class $t{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new Et}}namedNode(e){return new kt(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new jt(e)}literal(e,t){return"string"==typeof t?new Rt(e,t,Mt):new Rt(e,"",t||Pt)}variable(e){return new Dt(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,n,r=this.defaultGraph()){return new At(e,t,n,r)}fromTerm(e){return Nt(this,e)}fromQuad(e){return Nt(this,e)}}$t.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const Bt=new $t,Ft={apply:(e,t,n)=>e(n[0]),get:(e,t)=>e(t)},qt=function(e,{factory:t=Bt}={}){const n=(n="")=>t.namedNode(`${e}${n.raw||n}`);return"undefined"==typeof Proxy?n:new Proxy(n,Ft)},Ut=(qt("http://www.w3.org/2001/XMLSchema#"),qt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"));qt("http://www.w3.org/2000/01/rdf-schema#");class Gt{static add({ptr:e,start:t,end:n,subjects:r=[null],predicates:i=[null],objects:o=[null],graphs:a,callback:s}={}){if(!e.factory)throw new Error("add operation requires a factory");let l=()=>{};s&&(l=r=>{s(new xt({dataset:e.dataset,start:t,end:n,quad:r}))});for(const n of r)for(const r of i)for(const i of o)for(const o of a){const a={subject:n,predicate:r,object:i,graph:o};a[t]=e.term;const s=e.factory.quad(a.subject,a.predicate,a.object,a.graph);e.dataset.add(s),l(s)}return e}static addList({ptr:e,predicates:t,items:n,graphs:r}){if(e.isAny())throw new Error("can't attach a list to an any ptr");for(const i of t)for(const t of r){const r=n.map((()=>e.factory.blankNode()));e.dataset.add(e.factory.quad(e.term,i,r[0]||Ut.nil,t));for(let i=0;i<r.length;i++)e.dataset.add(e.factory.quad(r[i],Ut.first,n[i],t)),e.dataset.add(e.factory.quad(r[i],Ut.rest,r[i+1]||Ut.nil,t))}return e}static delete({ptr:e,start:t,subjects:n=[null],predicates:r=[null],objects:i=[null]}){for(const o of n)for(const n of r)for(const r of i){const i={subject:o,predicate:n,object:r};i[t]=e.term;const a=e.dataset.match(i.subject,i.predicate,i.object);for(const t of a)e.dataset.delete(t)}return e}static deleteList({ptr:e,predicates:t}){const n=[];for(const r of t)for(const t of e.dataset.match(e.term,r)){let r=t.object;for(n.push(t);!Ut.nil.equals(r);){r=n[n.length-1].object;const t=e.dataset.match(r);if(0===t.size)break;for(const e of t)n.push(e)}}for(const t of n)e.dataset.delete(t);return e}static execute({ptr:e,operation:t="traverse",quantifier:n,start:r,end:i,subjects:o,predicates:a,objects:s,graphs:l,items:c,callback:u}={}){if("add"===t)return Gt.add({ptr:e,start:r,end:i,subjects:o,predicates:a,objects:s,graphs:l,callback:u});if("addList"===t)return Gt.addList({ptr:e,predicates:a,items:c,graphs:l});if("delete"===t)return Gt.delete({ptr:e,start:r,subjects:o,predicates:a,objects:s});if("deleteList"===t)return Gt.deleteList({ptr:e,predicates:a});if("isList"===t)return Gt.isList({ptr:e});if("list"===t)return Gt.list({ptr:e});if("traverse"===t)return Gt.traverse({ptr:e,quantifier:n,start:r,end:i,subjects:o,predicates:a,objects:s,graphs:l});throw new Error(`unknown operation ${t}`)}static isList({ptr:e}){return!e.isAny()&&(!!Ut.nil.equals(e.term)||1===Gt.traverse({ptr:e,predicates:[Ut.first]}).length)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(Ut.nil);){const t=e.out([Ut.first]);if(1!==t.length)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const n=e.out([Ut.rest]);if(1!==n.length)throw new Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=n[0]}}}}static traverse({ptr:e,quantifier:t="one",start:n="subject",end:r="object",subjects:i=[null],predicates:o=[null],objects:a=[null],graphs:s=[null],callback:l}){if("one"===t)return Gt.traverseOne({ptr:e,start:n,end:r,subjects:i,predicates:o,objects:a,graphs:s,callback:l});if("oneOrMore"===t){const t=Gt.traverse({ptr:e,end:r,start:n,subjects:i,predicates:o,objects:a,graphs:s,callback:l});return Gt.traverseMore({ptrs:t,end:r,start:n,subjects:i,predicates:o,objects:a,graphs:s,callback:l})}if("zeroOrMore"===t)return Gt.traverseMore({ptrs:[e],end:r,start:n,subjects:i,predicates:o,objects:a,graphs:s,callback:l});if("zeroOrOne"===t)return[e,...Gt.traverse({ptr:e,end:r,start:n,subjects:i,predicates:o,objects:a,graphs:s,callback:l})];throw new Error(`unknown quantifier ${t}`)}static traverseMore({ptrs:e,end:t,start:n,subjects:r,predicates:i,objects:o,graphs:a,callback:s}={}){let l,c,u=[...e];do{l=[];for(const c of e)l=[...l,...Gt.traverseOne({ptr:c,end:t,start:n,subjects:r,predicates:i,objects:o,graphs:a,callback:s})];c&&(l=l.filter((e=>!c.has(e.term)))),e=l,u=[...u,...l],c=new _t(u.map((e=>e.term)))}while(l.length>0);return u}static traverseOne({ptr:e,start:t,end:n,subjects:r,predicates:i,objects:o,graphs:a,callback:s=(e,t)=>t.extend(e)}={}){const l=[];for(const c of r)for(const r of i)for(const i of o)for(const o of a){const a={subject:c,predicate:r,object:i,graph:o};a[t]=e.term;for(const r of e.dataset.match(a.subject,a.predicate,a.object,a.graph))l.push(s(new xt({dataset:e.dataset,end:n,quad:r,start:t}),e))}return l}}const Ht=Gt;function Vt(e,t){return t?n=>t(e.extend(n)):()=>{}}const Wt=class{constructor({dataset:e,edges:t=[],factory:n,graph:r,term:i}){if(!e&&0===t.length)throw new Error("dataset or edges is required");if(0===t.length&&void 0===i)throw new Error("edges or term must be given");if(t.length>0&&i)throw new Error("edges or term must be given");this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=n,this._graph=r,0===t.length&&(this._term=i)}get edge(){return this.edges[this.edges.length-1]}get graph(){return"object"==typeof this._graph?this._graph:this.edge&&this.edge.graph}get length(){return void 0!==this._term?1:this.edges.length+1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return void 0!==this._term?this._term:this.edge.term}get value(){const e=this.term;return null===e?void 0:e.value}addIn(e,t,n){return Ht.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:Vt(this,n)})}addList(e,t){return Ht.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,n){return Ht.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:Vt(this,n)})}deleteIn(e,t){return Ht.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return Ht.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return Ht.delete({ptr:this,start:"subject",predicates:e,objects:t})}execute({operation:e,quantifier:t,start:n,end:r,subjects:i,predicates:o,objects:a,graphs:s,items:l,callback:c}){return Ht.execute({ptr:this,operation:e,quantifier:t,start:n,end:r,subjects:i,predicates:o,objects:a,graphs:s,items:l,callback:c})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return Ht.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return Ht.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return Ht.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return Ht.isList({ptr:this})}list(){return Ht.list({ptr:this})}nodes(){const e=this,t=e=>void 0!==this._term?{dataset:this.dataset,term:this._term}:this.edges.length>e?{dataset:this.edges[e].dataset,term:this.edges[e].startTerm}:this.edges.length===e?{dataset:this.edges[e-1].dataset,term:this.edges[e-1].term}:void 0;return{*[Symbol.iterator](){for(let n=0;n<e.length;n++)yield t(n)}}}out(e,t){return Ht.traverse({ptr:this,predicates:e,objects:t,graphs:[this.graph]})}quads(){const e=this;return{*[Symbol.iterator](){for(const t of e.edges)yield t.quad}}}trim(){return new this.constructor({dataset:this.dataset,factory:this.factory,graph:this.graph,term:this.term})}},zt=function(e,t){return e?e.equals(t):e===t};function Jt(e,t){return t?n=>t(new e.constructor({factory:e.factory,ptrs:[n]})):()=>{}}class Qt{constructor({dataset:e,factory:t,ptrs:n,terms:r,graphs:i}){if(this.factory=t,n)this.ptrs=[...n];else{this.ptrs=[];for(const n of r||[null])for(const r of i||[null])this.ptrs.push(new Wt({dataset:e,factory:t,graph:r,term:n}))}}get dataset(){const e=new Set(this.datasets);return 1!==e.size?null:e[Symbol.iterator]().next().value}get datasets(){return this.ptrs.map((e=>e.dataset))}get term(){const e=new _t(this.terms);if(1===e.size)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map((e=>e.term))}get value(){const e=this.term;return null==e?void 0:e.value}get values(){return this.ptrs.map((e=>e.value))}addIn(e,t,n){const r=Jt(this,n);for(const n of this.ptrs)n.addIn(e,t,r);return this}addList(e,t){if(this.isAny())throw new Error("can't attach a list to an any ptr");for(const n of this.ptrs)n.addList(e,t);return this}addOut(e,t,n){const r=Jt(this,n);for(const n of this.ptrs)n.addOut(e,t,r);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(const n of this.ptrs)n.deleteIn(e,t);return this}deleteList(e){for(const t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(const n of this.ptrs)n.deleteOut(e,t);return this}distinct(){const e=this.ptrs.reduce(((e,t)=>(e.some((e=>{return r=t,(n=e).dataset===r.dataset&&!!zt(n.graph,r.graph)&&!!zt(n.term,r.term);var n,r}))||e.push(t.trim()),e)),[]);return this.clone({ptrs:e})}execute(e){return this.clone({ptrs:this.ptrs.flatMap((t=>t.execute(e)))})}executeAll(e){let t=this;for(const n of e)t=t.execute(n);return t}filter(e){return this.clone({ptrs:[...this].filter(e).map((e=>e.ptrs[0]))})}hasIn(e,t){return this.clone({ptrs:this.ptrs.flatMap((n=>n.hasIn(e,t)))})}hasOut(e,t){return this.clone({ptrs:this.ptrs.flatMap((n=>n.hasOut(e,t)))})}in(e,t){return this.clone({ptrs:this.ptrs.flatMap((n=>n.in(e,t)))})}isAny(){return this.ptrs.length>0&&this.ptrs.some((e=>e.isAny()))}isList(){return 1===this.ptrs.length&&this.ptrs[0].isList()}list(){if(!this.isList())return;const e=this.ptrs[0].list()[Symbol.iterator](),t=()=>{const{done:t,value:n}=e.next();return t?{done:!0}:{done:!1,value:this.clone({ptrs:[n]})}};return{[Symbol.iterator]:()=>({next:t})}}map(e){return[...this].map(e)}node(e){const t=this.dataset,n=[...e].map((e=>new Wt({dataset:t,factory:this.factory,term:e})));return this.clone({ptrs:n})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap((n=>n.out(e,t)))})}quads(){const e=this;return{*[Symbol.iterator](){for(const t of e.ptrs)for(const e of t.edges)yield e.quad}}}trim(){return this.clone({ptrs:this.ptrs.map((e=>e.trim()))})}*[Symbol.iterator](){for(const e of this.ptrs)yield this.clone({ptrs:[e]})}}const Xt=Qt;qt("http://www.w3.org/2002/07/owl#");const Kt=qt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),Yt=qt("http://www.w3.org/2000/01/rdf-schema#"),Zt=qt("http://www.w3.org/ns/shacl#"),en=qt("https://schemas.link/shacl-next#"),tn=qt("http://www.w3.org/2001/XMLSchema#");var nn=r(8059);const rn=class{constructor({details:e,factory:t,options:n,results:r=[]}={}){this.details=e,this.factory=t,this.options=n,this.results=r,this._conforms=nn((()=>!this.results.some((e=>e.severity.equals(Zt.Info)||e.severity.equals(Zt.Violation)||e.severity.equals(Zt.Warning))))),this._ptr=nn((()=>this.build()))}get conforms(){return this._conforms()}get dataset(){return this.ptr.dataset}get ptr(){return this._ptr()}get term(){return this.ptr.term}build(){const e=new Xt({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([Kt.type],[Zt.ValidationReport]).addOut([Zt.conforms],[this.factory.literal(this.conforms.toString(),tn.boolean)]);for(const t of this.results)e.addOut([Zt.result],[this.factory.blankNode()],(e=>{t.build(e,this.options)}));return e}coverage(){return this.results.flatMap((e=>e.coverage()))}},on=class{constructor({args:e={},constraintComponent:t,factory:n,focusNode:r,message:i=[],path:o,results:a=[],severity:s,shape:l,source:c=[],value:u,valuePaths:d=[]}={}){this.args=e,this.constraintComponent=t,this.factory=n,this.focusNode=r,this.path=o||l.path,this.results=a,this.severity=s,this.shape=l,this.source=c,this.value=u,this.valuePaths=d,this._message=nn((()=>(this.shape.message.length>0&&(i=this.shape.message),0===i.length&&(i=this.shape.ptr.node([this.constraintComponent]).out([Zt.message]).terms),i.map((t=>n.literal(function(e,t){return Object.entries(t).reduce(((e,[t,n])=>(n&&n.termType&&(n=yt(n)),e.replace(`{$${t}}`,n).replace(`{?${t}}`,n))),e)}(t.value,e),t.language||null))))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([Kt.type],[Zt.ValidationResult]).addOut([Zt.focusNode],this.focusNode.terms).addOut([Zt.resultSeverity],[this.severity]).addOut([Zt.sourceConstraint],this.source).addOut([Zt.sourceConstraintComponent],[this.constraintComponent]).addOut([Zt.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([Zt.resultMessage],this.message);const n=t=>"one"===t.quantifier?t.predicates.length>1?e.node([this.factory.blankNode()]).addList([Zt.alternativePath],t.predicates):"object"===t.start?e.node([this.factory.blankNode()]).addOut([Zt.inversePath],[t.predicates[0]]):e.node([t.predicates[0]]):"oneOrMore"===t.quantifier?e.node([this.factory.blankNode()]).addOut([Zt.oneOrMorePath],[t.predicates[0]]):"zeroOrMore"===t.quantifier?e.node([this.factory.blankNode()]).addOut([Zt.zeroOrMorePath],[t.predicates[0]]):"zeroOrOne"===t.quantifier?e.node([this.factory.blankNode()]).addOut([Zt.zeroOrOnePath],[t.predicates[0]]):void 0;if(this.path&&(1===this.path.length?e.addOut([Zt.resultPath],n(this.path[0]).terms):e.addList([Zt.resultPath],this.path.map((e=>n(e).term)))),void 0!==this.value&&e.addOut([Zt.value],this.value.terms),t)for(const n of this.results)e.addOut([Zt.detail],[this.factory.blankNode()],(e=>{n.build(e,{details:t})}))}coverage(){return[...this.valuePaths.flatMap((e=>[...e.quads()])),...this.results.flatMap((e=>e.coverage()))]}};class an{constructor({factory:e,focusNode:t,options:n={debug:!1,details:!1},processed:r=new Set,report:i=new rn({factory:e,options:n}),results:o=new Map,shape:a,value:s,valueOrNode:l,valuePaths:c,values:u}={}){this.factory=e,this.focusNode=t,this.options=n,this.processed=r,this.report=i,this.results=o,this.shape=a,this.value=s,this.valuePaths=c,this.valueOrNode=l,this.values=u}create({child:e,focusNode:t=this.focusNode,shape:n=this.shape,value:r=this.value,valueOrNode:i=this.valueOrNode,valuePaths:o=this.valuePaths,values:a=this.values}={}){return new an({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new rn({factory:this.factory,options:this.options}):this.report,results:this.results,shape:n,value:r,valueOrNode:i,valuePaths:o,values:a})}id({shape:e=this.shape}={}){return`${yt(e.ptr.term)} - ${yt(this.focusNode.term)} - ${t=this.valuePaths,t?`{${t.map((e=>function(e){return e?`{${[...e.quads()].map((e=>yt(e))).join(" ")}}`:"{}"}(e))).join(" ")}}`:"{}"}`;var t}result(e){const t=new on({factory:this.factory,focusNode:this.focusNode,shape:this.shape,value:this.value,valuePaths:this.valuePaths,...e}),n=this.id();this.results.has(n)?this.results.get(n).add(t):this.results.set(n,new Set([t])),this.report.results.push(t)}debug(e,t){this.options.debug&&this.result({severity:en.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:en.Trace,constraintComponent:e,...t})}test(e,t,n){e?this.debug(t,n):this.violation(t,n)}violation(e,t){this.result({constraintComponent:e,severity:this.shape.severity||Zt.Violation,...t})}}const sn=an;function ln(){return{generic:e=>{e.trace(en.TraversalConstraintComponent,{args:{},message:[e.factory.literal("Traversal")],value:e.valueOrNode})}}}const cn=class{constructor(e){this.validations=new bt(e)}compile(e){const t=e.validator.options.coverage;if(e.deactivated)return[];let n=!1;const r=new Set;for(const t of e.ptr.execute({start:"subject",end:"predicate"})){const e=this.validations.get(t.term);e&&(r.add(e),t.term.equals(Zt.property)&&(n=!0))}return t&&e.isPropertyShape&&!n&&r.add(ln),[...r].map((t=>t(e))).filter(Boolean)}};var un=r(9349);function dn(e){if("BlankNode"!==e.term.termType)return{quantifier:"one",start:"subject",end:"object",predicates:[e.term]};const t=e.out([Zt.alternativePath]);if(1===t.ptrs.length&&t.ptrs[0].isList())return{quantifier:"one",start:"subject",end:"object",predicates:[...t.list()].map((e=>e.term))};const n=e.out([Zt.inversePath]);if(n.term)return{quantifier:"one",start:"object",end:"subject",predicates:[n.term]};const r=e.out([Zt.oneOrMorePath]);if(r.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[r.term]};const i=e.out([Zt.zeroOrMorePath]);if(i.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[i.term]};const o=e.out([Zt.zeroOrOnePath]);return o.term?{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[o.term]}:void 0}const hn=class{constructor(e){this.shape=e,this._compiled=nn((()=>this.shape.validator.registry.compile(e)))}get compiled(){return this._compiled()}async validate(e){return 0===e.focusNode.dataset.size||(this.shape.isPropertyShape?await this.validateProperty(e):await this.validateNode(e)),e}async validateNode(e){const t=e.create({shape:this.shape,valueOrNode:e.value||e.focusNode});for(const e of this.compiled)e.node&&await e.node(t),e.generic&&await e.generic(t)}async validateProperty(e){let t;t=this.shape.isSparqlShape?e.focusNode:e.focusNode.executeAll(this.shape.path);const n=t.node(new _t(t.terms)),r=[...t].reduce(((e,n)=>{const r=n.term,i=t.node([r]);return e.has(r)||e.set(r,{value:i,valuePaths:[]}),e.get(r).valuePaths.push(n),e}),new bt).values(),i=e.create({shape:this.shape,values:n});for(const e of this.compiled)e.property&&await e.property(i);for(const{value:t,valuePaths:n}of r){const r=e.create({shape:this.shape,value:t,valueOrNode:t,valuePaths:n});for(const e of this.compiled)e.generic&&await e.generic(r)}}},fn=function(e){const t=new _t,n=new Xt({dataset:e.dataset,terms:e.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[Yt.subClassOf]});for(const e of n.ptrs)for(const{term:n}of e.nodes())t.add(n);return t},pn=class{constructor(e){this.targetClass=new _t([...fn(e.hasOut([Kt.type],[Zt.NodeShape])),...fn(e.out([Zt.targetClass]))]),this.targetNode=e.out([Zt.targetNode]).terms,this.targetObjectsOf=e.out([Zt.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([Zt.targetSubjectsOf]).terms}resolve(e){const t=e.focusNode.node([null]),n=[...e.focusNode.hasOut([Kt.type],this.targetClass).ptrs,...e.focusNode.node(this.targetNode).ptrs,...t.execute({start:"object",end:"object",predicates:this.targetObjectsOf}).ptrs,...t.execute({start:"subject",end:"subject",predicates:this.targetSubjectsOf}).ptrs],r=e.focusNode.clone({ptrs:n});return r.node([...new _t(r.terms)])}},gn=class{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=nn((()=>{const e=this.ptr.out([Zt.deactivated]).term;return e&&(0,un.fromRdf)(e)})),this._message=nn((()=>this.ptr.out([Zt.message]).terms)),this._path=nn((()=>function(e){return 0===e.terms.length?null:e.ptrs[0].isList()?[...e.list()].map((e=>dn(e))):[dn(e)]}(this.ptr.out([Zt.path])))),this._severity=nn((()=>this.ptr.out([Zt.severity]).term)),this._shapeValidator=nn((()=>new hn(this))),this._sparql=nn((()=>this.ptr.out([Zt.sparql]))),this._targetResolver=nn((()=>new pn(this.ptr)))}get deactivated(){return this._deactivated()}get isPropertyShape(){return Boolean(this.path)}get isSparqlShape(){return this.sparql.terms.length>0}get path(){return this._path()}get targetResolver(){return this._targetResolver()}get message(){return this._message()}get severity(){return this._severity()}get shapeValidator(){return this._shapeValidator()}get sparql(){return this._sparql()}resolveTargets(e){return this.targetResolver.resolve(e)}async validate(e){const t=e.id({shape:this});if(e.processed.has(t)){if(e.results.has(t))for(const n of e.results.get(t))e.report.results.push(n);return e}return e.processed.add(t),this.shapeValidator.validate(e)}};async function yn(e,t){return Promise.all(e.map(t))}function mn(e){return t=>{t.test(e.equals(t.valueOrNode.term),Zt.HasValueConstraintComponent,{args:{hasValue:e},message:[t.factory.literal("Value must be {$hasValue}")]})}}function bn(e){return t=>{const n=[...t.values].some((t=>e.equals(t.term)));t.test(n,Zt.HasValueConstraintComponent,{args:{hasValue:e},message:[t.factory.literal("Missing expected value {$hasValue}")]})}}function vn(e){return tn.dateTime.equals(e.datatype)&&/^.*(((\+|-)\d{2}:\d{2})|Z)$/.test(e.value)}const wn=function(e,t){if(!e||"Literal"!==e.termType)return null;if(!t||"Literal"!==t.termType)return null;if(vn(e)!==vn(t))return null;const n=(0,un.fromRdf)(e),r=(0,un.fromRdf)(t);return typeof n!=typeof r?null:"string"==typeof n?n.localeCompare(r):n-r};function _n(e){return t=>{const n=t.focusNode.out([e]),r=n.filter((e=>!e.term.equals(t.focusNode.term))),i=0!==n.terms.length&&0===r.terms.length;t.test(i,Zt.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal("Must have same values as {$equals}")],value:r.terms[0]&&t.focusNode.node([r.terms[0]])||t.focusNode})}}function xn(e){return t=>{const n=new _t(t.focusNode.out([e]).terms),r=new _t(t.values.terms),i=[...[...r].filter((e=>!n.has(e))),...[...n].filter((e=>!r.has(e)))];for(const n of i)t.violation(Zt.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal("Must have same values as {$equals}")],value:t.focusNode.node([n])});0===i.length&&t.debug(Zt.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal("Must have same values as {$equals}")]})}}function Sn(e,t,n,r){return async i=>{const o=[];let a=[];t&&(a=new Set(i.shape.ptr.in([Zt.property]).out([Zt.property]).out([Zt.qualifiedValueShape]).filter((t=>!t.term.equals(e.ptr.term))).map((e=>i.shape.validator.shape(e)))));const s=(await async function(t){return(await Promise.all(t.map((t=>(async t=>{const n=(await e.validate(i.create({child:!0,focusNode:t}))).report;if(o.push(n.results),!n.conforms)return!1;if(0===a.length)return!0;if(i.options.debug||i.options.details){const e=await yn([...a],(async e=>(await e.validate(i.create({child:!0,focusNode:t}))).report));return o.push(e.flatMap((e=>e.results))),!e.every((e=>e.conforms))}return!await async function(e,t){for(const n of e)if(!await t(n))return!1;return!0}([...a],(async e=>(await e.validate(i.create({child:!0,focusNode:t}))).report.conforms))})(t))))).filter(Boolean)}(i.values)).length;null!==n&&i.test(s<=n,Zt.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:n,qualifiedValueShape:e.ptr.term,qualifiedValueShapesDisjoint:t},message:[i.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:o.flat()}),null!==r&&i.test(s>=r,Zt.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:r,qualifiedValueShape:e.ptr.term,qualifiedValueShapesDisjoint:t},message:[i.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:o.flat()})}}function jn(e,t,n){return r=>{r.test(n.test(r.valueOrNode.term.value),Zt.PatternConstraintComponent,{args:{flags:t,pattern:e},message:[r.factory.literal('Value does not match pattern "{$pattern}"')],value:r.valueOrNode})}}const In=qt("http://www.w3.org/ns/shacl#"),En=qt("https://schemas.link/shacl-next#"),Nn=class{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some((e=>e.severity.equals(In.Info)||e.severity.equals(In.Violation)||e.severity.equals(In.Warning)))}},Tn=class{constructor({args:e={},factory:t,message:n=[],severity:r=In.Violation}={}){this.severity=r,this.message=n.map((n=>t.literal(function(e,t){return Object.entries(t).reduce(((e,[t,n])=>(n&&n.termType&&(n=yt(n)),e.replace(`{$${t}}`,n).replace(`{?${t}}`,n))),e)}(n.value,e),n.language||null)))}};class Rn{constructor({factory:e=Bt}={}){this.factory=e}clone({factory:e}={}){return new Rn({factory:e||this.factory})}validate(){return new Nn}validateSimple(){return!0}}const On=Rn;class kn extends On{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(const t of Array.isArray(e)?e:[e])t&&this.datatypes.push(this.factory.fromTerm(t))}clone({factory:e}={}){return new kn({datatypes:this.datatypes,factory:e||this.factory})}}const Ln=kn,An=class{constructor({factory:e=Bt,validations:t}={}){if(this.factory=e,this.validations=new bt,t)for(const e of Object.values(t)){const t=e.clone({factory:this.factory});for(const e of t.datatypes)this.validations.set(e,t)}}validate(e){const t=this.validations.get(e.datatype);return t?t.validate(e):new Nn}validateSimple(e){const t=this.validations.get(e.datatype);return!t||t.validateSimple(e)}};class Cn extends Ln{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.message=[this.factory.literal("term value {$this} matches pattern {$pattern}")],this.patterns=Array.isArray(e)?e:[e]}clone({factory:e}={}){return new Cn(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map((t=>{let n;t.test(e.value)&&(n=En.Debug);const r={pattern:this.factory.literal(t.toString()),this:e};return new Tn({args:r,factory:this.factory,message:this.message,severity:n})}));return new Nn({results:t})}validateSimple(e){return this.patterns.every((t=>t.test(e.value)))}}const Dn=Cn,Mn=/^([-+]?[0-9]+)$/;class Pn extends Dn{constructor(e=null,t=null,n,{factory:r}={}){super(Mn,n,{factory:r}),this.maxInclusive=null,this.minInclusive=null,"string"==typeof t&&(this.maxInclusive=BigInt(t)),"string"==typeof e&&(this.minInclusive=BigInt(e))}clone({factory:e}={}){return new Pn(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!En.Debug.equals(t[0].severity))return new Nn({results:t});const n=BigInt(e.value);if(null!==this.minInclusive&&n<this.minInclusive){const n=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,r=[this.factory.literal(n)];t.push(new Tn({factory:this.factory,message:r}))}if(null!==this.maxInclusive&&n>this.maxInclusive){const n=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,r=[this.factory.literal(n)];t.push(new Tn({factory:this.factory,message:r}))}return new Nn({results:t})}validateSimple(e){if(!super.validateSimple(e))return!1;const t=BigInt(e.value);return!(null!==this.minInclusive&&t<this.minInclusive||null!==this.maxInclusive&&t>this.maxInclusive)}}const $n=Pn;class Bn extends Ln{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.values=new Set(e)}clone({factory:e}={}){return new Bn(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const n=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,r=[this.factory.literal(n)];t.push(new Tn({factory:this.factory,message:r}))}return new Nn({results:t})}validateSimple(e){return this.values.has(e.value)}}const Fn=Bn,qn={xsd:qt("http://www.w3.org/2001/XMLSchema#")},Un=new Ln({datatypes:qn.xsd.anySimpleType}),Gn=new Ln({datatypes:qn.xsd.anyAtomicType}),Hn=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,Vn=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,Wn=/^(-?P((([0-9]+Y([0-9]+M)?([0-9]+D)?|([0-9]+M)([0-9]+D)?|([0-9]+D))(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))?)|(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))))$/,zn=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Jn=new Dn(Hn,qn.xsd.string),Qn=new Fn(["1","true","0","false"],qn.xsd.boolean),Xn=new Dn(/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,qn.xsd.decimal),Kn=new Dn(Vn,qn.xsd.float),Yn=new Dn(Vn,qn.xsd.double),Zn=new Dn(Wn,qn.xsd.duration),er=new Dn(zn,qn.xsd.dateTime),tr=new Dn(/^((([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,qn.xsd.time),nr=new Dn(/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,qn.xsd.date),rr=new Dn(/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,qn.xsd.gYearMonth),ir=new Dn(/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,qn.xsd.gYear),or=new Dn(/^(--(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,qn.xsd.gMonthDay),ar=new Dn(/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,qn.xsd.gDay),sr=new Dn(/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,qn.xsd.gMonth),lr=new Dn(/^(([0-9a-fA-F]{2})*)$/,qn.xsd.hexBinary),cr=new Dn(/^(((([A-Za-z0-9+/] ?){4})*(([A-Za-z0-9+/] ?){3}[A-Za-z0-9+/]|([A-Za-z0-9+/] ?){2}[AEIMQUYcgkosw048] ?=|[A-Za-z0-9+/] ?[AQgw] ?= ?=))?)$/,qn.xsd.base64Binary),ur=new Dn(Hn,qn.xsd.anyURI),dr=/^([^\u000d\u000a\u0009]*)$/,hr=new Dn([Hn,dr],qn.xsd.normalizedString),fr=new Dn([Hn,dr,/^([^ ]+( [^ ]+)*)*$/],qn.xsd.token),pr=new Dn(/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,qn.xsd.language),gr=new $n(null,null,qn.xsd.integer),yr=new $n(null,"0",qn.xsd.nonPositiveInteger),mr=new $n(null,"-1",qn.xsd.negativeInteger),br=new $n("-9223372036854775808","9223372036854775807",qn.xsd.long),vr=new $n("-2147483648","2147483647",qn.xsd.int),wr=new $n("-32768","32767",qn.xsd.short),_r=new $n("-128","127",qn.xsd.byte),xr=new $n("0",null,qn.xsd.nonNegativeInteger),Sr=new $n("0","18446744073709551615",qn.xsd.unsignedLong),jr=new $n("0","4294967295",qn.xsd.unsignedInt),Ir=new $n("0","65535",qn.xsd.unsignedShort),Er=new $n("0","255",qn.xsd.unsignedByte),Nr=new $n("1",null,qn.xsd.positiveInteger),Tr=new Dn([Wn,/^([^DT]*)$/],qn.xsd.yearMonthDuration),Rr=new Dn([Wn,/^([^YM]*[DT].*)$/],qn.xsd.dayTimeDuration),Or=new Dn([zn,/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/],qn.xsd.dateTimeStamp),kr=class extends An{constructor({factory:e}={}){super({factory:e,validations:{...o}})}},Lr=new bt([[Zt.BlankNode,new Set(["BlankNode"])],[Zt.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[Zt.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[Zt.IRI,new Set(["NamedNode"])],[Zt.IRIOrLiteral,new Set(["NamedNode","Literal"])],[Zt.Literal,new Set(["Literal"])]]);function Ar(e,t){return n=>{n.test(t.has(n.valueOrNode.term.termType),Zt.NodeKindConstraintComponent,{args:{nodeKind:e},message:[n.factory.literal("Value does not have node kind {$nodeKind}")],value:n.valueOrNode})}}const Cr=new bt([[Zt.maxCount,function(e){return{property:(t=parseInt(e.ptr.out([Zt.maxCount]).value),e=>{e.test(e.values.terms.length<=t,Zt.MaxCountConstraintComponent,{args:{maxCount:t},message:[e.factory.literal("More than {$maxCount} values")]})})};var t}],[Zt.minCount,function(e){return{property:(t=parseInt(e.ptr.out([Zt.minCount]).value),e=>{e.test(e.values.terms.length>=t,Zt.MinCountConstraintComponent,{args:{minCount:t},message:[e.factory.literal("Less than {$minCount} values")]})})};var t}],[Zt.and,function(e){return{generic:(t=[...e.ptr.out([Zt.and])].flatMap((e=>[...e.list()])).map((t=>e.validator.shape(t))),async e=>{const n=await yn(t,(async t=>(await t.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report)),r=n.every((e=>e.conforms));e.test(r,Zt.AndConstraintComponent,{results:n.flatMap((e=>e.results)),value:e.valueOrNode})})};var t}],[Zt.not,function(e){return{generic:(t=e.validator.shape(e.ptr.out([Zt.not])),async e=>{const n=(await t.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,r=!n.conforms;e.test(r,Zt.NotConstraintComponent,{args:{not:t.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:n.results,value:e.valueOrNode})})};var t}],[Zt.or,function(e){return{generic:(t=[...e.ptr.out([Zt.or])].flatMap((e=>[...e.list()])).map((t=>e.validator.shape(t))),async e=>{let n,r=[];if(e.options.debug||e.options.details){const i=await yn(t,(async t=>(await t.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report));r=i.flatMap((e=>e.results)),n=i.some((e=>e.conforms))}else n=await async function(e,t){for(const n of e)if(await t(n))return!0;return!1}(t,(async t=>(await t.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms));e.test(n,Zt.OrConstraintComponent,{results:r,value:e.valueOrNode})})};var t}],[Zt.xone,function(e){return{generic:(t=[...e.ptr.out([Zt.xone])].flatMap((e=>[...e.list()])).map((t=>e.validator.shape(t))),async e=>{const n=await yn(t,(async t=>(await t.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report)),r=1===n.filter((e=>e.conforms)).length;e.test(r,Zt.XoneConstraintComponent,{results:n.flatMap((e=>e.results)),value:e.valueOrNode})})};var t}],[Zt.closed,function(e){if(!(0,un.fromRdf)(e.ptr.out([Zt.closed]).term))return null;const t=e.ptr.out([Zt.property]).map((t=>e.validator.shape(t)));return{node:(n=new _t(t.filter((e=>!e.deactivated)).map((e=>e.path[0].predicates[0]))),r=new _t([...e.ptr.out([Zt.ignoredProperties]).list()||[]].map((e=>e.term))),e=>{const t=e.focusNode.execute({start:"subject",end:"predicate"}).filter((e=>!r.has(e.term)&&!n.has(e.term)));if(t.ptrs.length>0)for(const n of t)e.violation(Zt.ClosedConstraintComponent,{message:[e.factory.literal("Predicate is not allowed (closed shape)")],path:[{quantifier:"one",start:"subject",end:"object",predicates:[n.term]}],value:e.focusNode.node([[...n.quads()][0].object])});else e.debug(Zt.ClosedConstraintComponent)})};var n,r}],[Zt.hasValue,function(e){const t=e.ptr.out([Zt.hasValue]).term;return{node:mn(t),property:bn(t)}}],[Zt.in,function(e){return{generic:(t=new _t([...e.ptr.out([Zt.in]).list()].map((e=>e.term))),e=>{e.test(t.has(e.valueOrNode.term),Zt.InConstraintComponent,{args:{in:[...t].map((e=>e.value)).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})})};var t}],[Zt.disjoint,function(e){return{generic:(t=e.ptr.out([Zt.disjoint]).term,e=>{const n=e.focusNode.dataset.match(e.focusNode.term,t,e.valueOrNode.term);e.test(0===n.size,Zt.DisjointConstraintComponent,{args:{disjoint:t},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})})};var t}],[Zt.equals,function(e){const t=e.ptr.out([Zt.equals]).term;return{node:_n(t),property:xn(t)}}],[Zt.lessThan,function(e){return{property:(t=e.ptr.out([Zt.lessThan]).term,e=>{const n=e.focusNode.out([t]).terms;for(const r of e.values)for(const i of n){const n=wn(r.term,i);null===n||n>=0?e.violation(Zt.LessThanConstraintComponent,{args:{lessThan:t},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:r}):e.debug(Zt.LessThanConstraintComponent,{args:{lessThan:t},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:r})}})};var t}],[Zt.lessThanOrEquals,function(e){return{property:(t=e.ptr.out([Zt.lessThanOrEquals]).term,e=>{const n=e.focusNode.out([t]).terms;for(const r of e.values)for(const i of n){const n=wn(r.term,i);null===n||n>0?e.violation(Zt.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:t},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:r}):e.debug(Zt.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:t},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:r})}})};var t}],[Zt.maxExclusive,function(e){return{generic:(t=e.ptr.out([Zt.maxExclusive]).term,e=>{const n=wn(e.valueOrNode.term,t);e.test(null!==n&&n<0,Zt.MaxExclusiveConstraintComponent,{args:{maxExclusive:t},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})})};var t}],[Zt.maxInclusive,function(e){return{generic:(t=e.ptr.out([Zt.maxInclusive]).term,e=>{const n=wn(e.valueOrNode.term,t);e.test(null!==n&&n<=0,Zt.MaxInclusiveConstraintComponent,{args:{maxInclusive:t},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})})};var t}],[Zt.minExclusive,function(e){return{generic:(t=e.ptr.out([Zt.minExclusive]).term,e=>{const n=wn(e.valueOrNode.term,t);e.test(null!==n&&n>0,Zt.MinExclusiveConstraintComponent,{args:{minExclusive:t},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})})};var t}],[Zt.minInclusive,function(e){return{generic:(t=e.ptr.out([Zt.minInclusive]).term,e=>{const n=wn(e.valueOrNode.term,t);e.test(null!==n&&n>=0,Zt.MinInclusiveConstraintComponent,{args:{minInclusive:t},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})})};var t}],[Zt.node,function(e){return{generic:(t=[...e.ptr.out([Zt.node])].map((t=>e.validator.shape(t))),async e=>{for(const n of t){const t=await n.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(t.report.conforms,Zt.NodeConstraintComponent,{args:{node:n.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:t.report.results,value:e.valueOrNode})}})};var t}],[Zt.property,function(e){return{generic:(t=[...e.ptr.out([Zt.property])].map((t=>e.validator.shape(t))),async e=>{const n=e.create({focusNode:e.valueOrNode});for(const e of t)await e.validate(n)})};var t}],[Zt.qualifiedValueShape,function(e){const t=e.validator.shape(e.ptr.out([Zt.qualifiedValueShape])),n=e.ptr.out([Zt.qualifiedValueShapesDisjoint]).term,r=!!n&&(0,un.fromRdf)(n),i=e.ptr.out([Zt.qualifiedMaxCount]).term,o=i?parseInt(i.value):null,a=e.ptr.out([Zt.qualifiedMinCount]).term;return{property:Sn(t,r,o,a?parseInt(a.value):null)}}],[Zt.languageIn,function(e){return{generic:(t=[...new Set([...e.ptr.out([Zt.languageIn]).list()].map((e=>e.value)))],e=>{const n=t.some((t=>function(e,t){return!!t&&t.slice(0,e.length)===e}(t,e.valueOrNode.term.language)));e.test(n,Zt.LanguageInConstraintComponent,{args:{languageIn:t.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})})};var t}],[Zt.maxLength,function(e){return{generic:(t=parseInt(e.ptr.out([Zt.maxLength]).value),e=>{const n="BlankNode"!==e.valueOrNode.term.termType&&e.valueOrNode.value.length<=t;e.test(n,Zt.MaxLengthConstraintComponent,{args:{maxLength:t},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})})};var t}],[Zt.minLength,function(e){return{generic:(t=parseInt(e.ptr.out([Zt.minLength]).value),e=>{const n="BlankNode"!==e.valueOrNode.term.termType&&e.valueOrNode.value.length>=t;e.test(n,Zt.MinLengthConstraintComponent,{args:{minLength:t},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})})};var t}],[Zt.pattern,function(e){const t=e.ptr.out([Zt.pattern]).value,n=e.ptr.out([Zt.flags]).value;return{generic:jn(t,n,new RegExp(t,n))}}],[Zt.uniqueLang,function(e){const t=e.ptr.out([Zt.uniqueLang]).term;return"true"===t.value&&tn.boolean.equals(t.datatype)?{property:e=>{const t=Object.entries(e.values.terms.reduce(((e,t)=>(t.language&&(e[t.language]=(e[t.language]||0)+1),e)),{})),n=t.filter((([,e])=>e>1));for(const[t]of n)e.violation(Zt.UniqueLangConstraintComponent,{args:{lang:t},message:[e.factory.literal('Language "{?lang}" used more than once')]});0===n.length&&e.debug(Zt.UniqueLangConstraintComponent)}}:null}],[Zt.class,function(e){return{generic:(t=e.ptr.out([Zt.class]).map((e=>fn(e))),e=>{const n=new _t(e.valueOrNode.out([Kt.type]).terms);for(const r of t){const t=[...n].some((e=>r.has(e)));e.test(t,Zt.ClassConstraintComponent,{value:e.valueOrNode})}})};var t}],[Zt.datatype,function(e){return{generic:(t=e.ptr.out([Zt.datatype]).term,n=new kr,e=>{const r=t.equals(e.valueOrNode.term.datatype)&&n.validateSimple(e.valueOrNode.term);e.test(r,Zt.DatatypeConstraintComponent,{args:{datatype:t},message:[e.factory.literal("Value does not have datatype {$datatype}")],value:e.valueOrNode})})};var t,n}],[Zt.nodeKind,function(e){const t=e.ptr.out([Zt.nodeKind]).term;return{generic:Ar(t,Lr.get(t))}}]]),Dr=class{constructor(e,{factory:t,...n}){if(this.factory=t,this.options=n,this.registry=new cn(Cr),this.shapesPtr=new Xt({dataset:e,factory:t}),this.shapes=new bt,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0),this.options.validations)for(const[e,t]of this.options.validations)this.registry.validations.set(e,t);const r=[...this.shapesPtr.hasOut([Zt.targetClass]),...this.shapesPtr.hasOut([Zt.targetNode]),...this.shapesPtr.hasOut([Zt.targetObjectsOf]),...this.shapesPtr.hasOut([Zt.targetSubjectsOf]),...this.shapesPtr.hasOut([Kt.type],[Zt.NodeShape]),...this.shapesPtr.hasOut([Kt.type],[Zt.PropertyShape])];for(const e of r)this.shape(e)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new gn(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const n=new Xt({...e,factory:this.factory}),r=new sn({factory:this.factory,focusNode:n,options:this.options,validator:this});t=t?t.map((e=>this.shape(this.shapesPtr.node(e.terms)))):this.shapes.values();for(const e of t){const t=r.create({shape:e});let i;i=n.isAny()?e.resolveTargets(t):n;for(const n of i)await e.validate(t.create({focusNode:n}))}return r.report}};var Mr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Pr extends HTMLElement{static get observedAttributes(){return ut.dataAttributes()}constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new ut(e,this.form),this.form.addEventListener("change",(e=>{e.stopPropagation(),this.config.editMode&&this.validate(!0).then((e=>{this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:e}}))})).catch((e=>{console.warn(e)}))}))}connectedCallback(){this.shadowRoot.prepend(this.form)}attributeChangedCallback(){this.config.updateAttributes(this),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.initDebounceTimeout=setTimeout((()=>Mr(this,void 0,void 0,(function*(){this.form.replaceChildren(document.createTextNode(this.config.attributes.loading));try{yield this.config.loader.loadGraphs(),this.form.replaceChildren(),this.config.renderedNodes.clear();const e=this.findRootShaclShapeSubject();if(e){this.form.classList.forEach((e=>{this.form.classList.remove(e)})),this.form.classList.toggle("mode-edit",this.config.editMode),this.form.classList.toggle("mode-view",!this.config.editMode),this.config.theme.apply(this.form);const t=[this.config.theme.stylesheet];for(const e of Object.entries(ve).map((e=>e[1])))e.stylesheet&&t.push(e.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new Ae(e,this.config,this.config.attributes.valuesSubject?g.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.editMode){if(null!==this.config.attributes.submitButton){const e=this.config.theme.createButton(this.config.attributes.submitButton||"Submit",!0);e.addEventListener("click",(e=>{e.preventDefault(),this.form.reportValidity()&&this.validate().then((e=>{var t;e?this.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0})):null===(t=this.form.querySelector(":scope .invalid > .editor"))||void 0===t||t.focus()}))})),this.form.appendChild(e)}yield this.validate(!0)}}else if(this.config.shapesGraph.size>0)throw new Error("shacl root node shape not found")}catch(e){console.error(e);const t=document.createElement("div");t.innerText=String(e),this.form.replaceChildren(t)}}))),200)}serialize(e="text/turtle",t=this.toRDF()){return function(e,t,n){if("application/ld+json"===t)return function(e){const t=[];for(const n of e){const e={"@id":n.subject.id};if(n.predicate===$)e["@type"]=n.object.id;else{let t=n.object.value;n.object instanceof b?n.object.language?t={"@language":n.object.language,"@value":n.object.value}:n.object.datatype&&n.object.datatype.value!==`${L}#string`&&(t={"@type":n.object.datatype.value,"@value":n.object.value}):t={"@id":n.object.id},e[n.predicate.value]=t}t.push(e)}return JSON.stringify(t)}(e);{const r=new ge({format:t,prefixes:n});r.addQuads(e);let i="";return r.end(((e,t)=>{e&&console.error(e),i=t})),i}}(t.getQuads(null,null,null,null),e,this.config.prefixes)}toRDF(e=new Be){var t;return null===(t=this.shape)||void 0===t||t.toRDF(e),e}registerPlugin(e){we(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setSharedShapesGraph(e){lt(e),this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}validate(){return Mr(this,arguments,void 0,(function*(e=!1){var t,n,r,i,o,a;for(const e of this.form.querySelectorAll(":scope .validation-error"))e.remove();for(const e of this.form.querySelectorAll(":scope .property-instance"))e.classList.remove("invalid"),(null===(t=e.querySelector(":scope > .editor"))||void 0===t?void 0:t.value)?e.classList.add("valid"):e.classList.remove("valid");this.config.shapesGraph.deleteGraph(""),null===(n=this.shape)||void 0===n||n.toRDF(this.config.shapesGraph);try{const t=this.config.shapesGraph,n=yield new Dr(t,{details:!0,factory:g}).validate({dataset:t});for(const t of n.results)if(null===(i=null===(r=t.focusNode)||void 0===r?void 0:r.ptrs)||void 0===i?void 0:i.length)for(const n of t.focusNode.ptrs){const r=n._term;if(null===(o=t.path)||void 0===o?void 0:o.length){const n=t.path[0].predicates[0];let i=this.form.querySelectorAll(`:scope [data-node-id='${r.id}'] [data-path='${n.id}'] > .editor`);0===i.length&&(i=this.form.querySelectorAll(`:scope [data-node-id='${r.id}'] [data-path='${n.id}']`));for(const n of i)if(n.classList.contains("editor")){if(!e||n.value){let e=n.parentElement;e.classList.add("invalid"),e.classList.remove("valid"),e.appendChild(this.createValidationErrorDisplay(t));do{e.classList.contains("collapsible")&&e.classList.add("open"),e=e.parentElement}while(e)}}else e||(n.classList.add("invalid"),n.classList.remove("valid"),n.appendChild(this.createValidationErrorDisplay(t,"node")))}else e||null===(a=this.form.querySelector(`:scope [data-node-id='${r.id}']`))||void 0===a||a.prepend(this.createValidationErrorDisplay(t,"node"))}return n.conforms}catch(e){return console.error(e),!1}}))}createValidationErrorDisplay(e,t){var n,r;const i=document.createElement("span");if(i.classList.add("validation-error"),t&&i.classList.add(t),e)if((null===(n=e.message)||void 0===n?void 0:n.length)>0)for(const t of e.message)i.title+=t.value+"\n";else i.title=null===(r=e.sourceConstraintComponent)||void 0===r?void 0:r.value;return i}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=g.namedNode(this.config.attributes.shapeSubject),0===this.config.shapesGraph.getQuads(e,$,H,null).length)return void console.warn(`shapes graph does not contain requested root shape ${this.config.attributes.shapeSubject}`)}else if(this.config.attributes.valuesSubject&&this.config.dataGraph.size>0){const t=g.namedNode(this.config.attributes.valuesSubject),n=[...this.config.dataGraph.getQuads(t,$,null,null),...this.config.dataGraph.getQuads(t,B,null,null)];if(0===n.length)return void console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${$.id} nor ${B.id} statement`);for(const t of n)if(this.config.shapesGraph.getQuads(t.object,$,H,null).length>0){e=t.object;break}if(!e){const t=this.config.shapesGraph.getQuads(null,z,n[0].object,null);if(0===t.length)return void console.error(`value subject '${this.config.attributes.valuesSubject}' has no shacl shape definition in the shapes graph`);if(t.length>1&&console.warn(`value subject '${this.config.attributes.valuesSubject}' has multiple shacl shape definitions in the shapes graph, choosing the first found (${t[0].subject})`),0===this.config.shapesGraph.getQuads(t[0].subject,$,H,null).length)return void console.error(`value subject '${this.config.attributes.valuesSubject}' references a shape which is not a NodeShape (${t[0].subject})`);e=t[0].subject}}else{const t=this.config.shapesGraph.getQuads(null,$,H,null);if(0==t.length)return void console.warn("shapes graph does not contain any root shapes");t.length>1&&(console.warn("shapes graph contains",t.length,"root shapes. choosing first found which is",t[0].subject.value),console.info('hint: set the shape to use with attribute "data-shape-subject"')),e=t[0].subject}return e}}const $r=(Br={Button:()=>e.Button,Checkbox:()=>e.Checkbox,MenuItem:()=>e.MenuItem,Select:()=>e.Select,TextField:()=>e.TextField},Fr={},r.d(Fr,Br),Fr);var Br,Fr;class qr extends ae{constructor(){super(":host {\n --mdui-color-primary-light: var(--mdui-color-primary-light);\n --mdui-color-primary-dark: var(--mdui-color-primary-dark);\n --mdui-color-background-light: var(--mdui-color-background-light);\n}\n/* this prevents hiding the date picker icon and number controls */\nmdui-text-field::part(input) {\n clip-path: none;\n appearance: inherit;\n}\nform.mode-edit { --label-width: 0em; }\n.property-instance { margin-bottom:14px; }\n.mode-edit .property-instance *[required]::part(icon) { align-self: flex-start; padding-top: 0.7em; }\n.mode-edit .property-instance *[required]::part(icon)::before { color: red; content: '\\2736'; font-size: 0.6em; }")}createDefaultTemplate(e,t,n,r,i){var o;r.classList.add("editor"),(null==i?void 0:i.datatype)&&(r.shaclDatatype=i.datatype),void 0!==(null==i?void 0:i.minCount)&&(r.dataset.minCount=String(i.minCount)),(null==i?void 0:i.class)&&(r.dataset.class=i.class.value),(null==i?void 0:i.nodeKind)&&(r.dataset.nodeKind=i.nodeKind.value),(null==i?void 0:i.hasValue)&&(r.disabled=!0),r.value=(null==t?void 0:t.value)||(null===(o=null==i?void 0:i.defaultValue)||void 0===o?void 0:o.value)||"";const a=(null==i?void 0:i.description)?i.description.value:(null==i?void 0:i.pattern)?i.pattern:null;a&&r.setAttribute("placeholder",a),n&&r.setAttribute("required","true");const s=document.createElement("div");if(e){const t=document.createElement("label");t.htmlFor=r.id,t.innerText=e,s.appendChild(t)}return s.appendChild(r),s}createTextEditor(e,t,n,r){const i=new $r.TextField;return i.variant="outlined",i.label=e,i.type="text",r.description&&(i.helper=r.description.value),!1===r.singleLine&&(i.rows=5),r.pattern&&(i.pattern=r.pattern),this.createDefaultTemplate("",t,n,i,r)}createNumberEditor(e,t,n,r){var i,o;const a=new $r.TextField;a.variant="outlined",a.type="number",a.label=e,a.helper=(null===(i=r.description)||void 0===i?void 0:i.value)||"";const s=void 0!==r.minInclusive?r.minInclusive:void 0!==r.minExclusive?r.minExclusive+1:void 0,l=void 0!==r.maxInclusive?r.maxInclusive:void 0!==r.maxExclusive?r.maxExclusive-1:void 0;return void 0!==s&&a.setAttribute("min",String(s)),void 0!==l&&a.setAttribute("max",String(l)),(null===(o=r.datatype)||void 0===o?void 0:o.value)!==L+"integer"&&a.setAttribute("step","0.1"),this.createDefaultTemplate("",t,n,a,r)}createListEditor(e,t,n,r,i){var o;const a=new $r.Select;a.variant="outlined",a.label=e,a.helper=null===(o=null==i?void 0:i.description)||void 0===o?void 0:o.value,a.clearable=!0;const s=this.createDefaultTemplate("",null,n,a,i);let l=!0;for(const e of r){const t=new $r.MenuItem,n="string"==typeof e.value?e.value:e.value.value,r=e.label?e.label:n;if(t.value=n,t.textContent=r||n,e.indent)for(let n=0;n<e.indent;n++)t.innerHTML="&#160;&#160;"+t.innerHTML;""===n&&(l=!1,t.ariaLabel="blank"),a.appendChild(t)}if(l){const e=new $r.MenuItem;e.ariaLabel="blank",a.prepend(e)}return t&&(a.value=t.value),s}createBooleanEditor(e,t,n,r){const i=new $r.Checkbox,o=this.createDefaultTemplate("",t,n,i,r);return i.removeAttribute("required"),t instanceof b&&(i.checked="true"===t.value),i.innerText=e,o}createDateEditor(e,t,n,r){var i,o,a;const s=new $r.TextField;s.variant="outlined",s.helper=(null===(i=null==r?void 0:r.description)||void 0===i?void 0:i.value)||(null==r?void 0:r.label)||"",(null===(o=r.datatype)||void 0===o?void 0:o.value)===L+"dateTime"?(s.type="datetime-local",s.setAttribute("step","1")):s.type="date",s.classList.add("pr-0");const l=this.createDefaultTemplate("",null,n,s,r);if(t)try{let e=new Date(t.value).toISOString();e=(null===(a=r.datatype)||void 0===a?void 0:a.value)===L+"dateTime"?e.slice(0,19):e.slice(0,10),s.value=e}catch(e){console.error(e,t)}return l}createLangStringEditor(e,t,n,r){var i;const o=this.createTextEditor(e,t,n,r),a=o.querySelector(":scope .editor");let s;if(null===(i=r.languageIn)||void 0===i?void 0:i.length){s=document.createElement("select");for(const e of r.languageIn){const t=document.createElement("option");t.innerText=e.value,s.appendChild(t)}}else s=document.createElement("input"),s.maxLength=5,s.placeholder="lang?";return s.title="Language of the text",s.classList.add("lang-chooser"),s.addEventListener("change",(e=>{e.stopPropagation(),a&&(a.dataset.lang=s.value,a.dispatchEvent(new Event("change",{bubbles:!0})))})),t instanceof b&&(s.value=t.language),a.dataset.lang=s.value,a.after(s),o}createFileEditor(e,t,n,r){const i=document.createElement("input");return i.type="file",i.addEventListener("change",(e=>{var t;if(null===(t=i.files)||void 0===t?void 0:t.length){e.stopPropagation();const t=new FileReader;t.readAsDataURL(i.files[0]),t.onload=()=>{var e;i.binaryData=btoa(t.result),null===(e=i.parentElement)||void 0===e||e.dispatchEvent(new Event("change",{bubbles:!0}))}}else i.binaryData=void 0})),this.createDefaultTemplate(e,t,n,i,r)}createButton(e,t){let n;return t?(n=new $r.Button,n.classList.add("primary")):(n=new $r.Button,n.classList.add("secondary")),n.innerHTML=e,n}}class Ur extends Pr{constructor(){super(new qr)}}window.customElements.define("shacl-form",Ur);var Gr=i.TS,Hr=i.aH,Vr=i.k_,Wr=i.a6,zr=i.nt,Jr=i.Sx,Qr=i.E7,Xr=i.F3,Kr=i.WW;export{Gr as Config,Hr as Loader,Vr as Plugin,Wr as ShaclForm,zr as ShaclPropertyTemplate,Jr as Theme,Qr as findLabel,Xr as registerPlugin,Kr as setSharedShapesGraph};
2
+ import*as e from"mdui";var t={5568:e=>{const{AbortController:t,AbortSignal:n}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;e.exports=t,e.exports.AbortSignal=n,e.exports.default=t},7526:(e,t)=>{t.byteLength=function(e){var t=s(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,o=s(e),a=o[0],l=o[1],c=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,l)),u=0,d=l>0?a-4:a;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=255&t;return 2===l&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,c[u++]=255&t),1===l&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t),c},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],a=16383,s=0,c=r-i;s<c;s+=a)o.push(l(e,s,s+a>c?c:s+a));return 1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=o[a],r[o.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,r){for(var i,o,a=[],s=t;s<r;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},8287:(e,t,n)=>{const r=n(7526),i=n(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l,t.SlowBuffer=function(e){return+e!=e&&(e=0),l.alloc(+e)},t.INSPECT_MAX_BYTES=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return c(e,t,n)}function c(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=s(n);const i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Q(e,Uint8Array)){const t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Q(e,ArrayBuffer)||e&&Q(e.buffer,ArrayBuffer))return f(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Q(e,SharedArrayBuffer)||e&&Q(e.buffer,SharedArrayBuffer)))return f(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return l.from(r,t,n);const i=function(e){if(l.isBuffer(e)){const t=0|p(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||X(e.length)?s(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return u(e),s(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),n=s(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function f(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,l.prototype),r}function p(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function g(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return z(e).length;default:if(i)return r?-1:W(e).length;t=(""+t).toLowerCase(),i=!0}}function y(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,n);case"utf8":case"utf-8":return E(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return R(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function b(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),X(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){let o,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let r=-1;for(o=n;o<s;o++)if(c(e,o)===c(t,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===l)return r*a}else-1!==r&&(o-=o-r),r=-1}else for(n+l>s&&(n=s-l),o=n;o>=0;o--){let n=!0;for(let r=0;r<l;r++)if(c(e,o+r)!==c(t,r)){n=!1;break}if(n)return o}return-1}function w(e,t,n,r){n=Number(n)||0;const i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=t.length;let a;for(r>o/2&&(r=o/2),a=0;a<r;++a){const r=parseInt(t.substr(2*a,2),16);if(X(r))return a;e[n+a]=r}return a}function _(e,t,n,r){return J(W(t,e.length-n),e,n,r)}function x(e,t,n,r){return J(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function S(e,t,n,r){return J(z(t),e,n,r)}function j(e,t,n,r){return J(function(e,t){let n,r,i;const o=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function I(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function E(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i<n;){const t=e[i];let o=null,a=t>239?4:t>223?3:t>191?2:1;if(i+a<=n){let n,r,s,l;switch(a){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128==(192&n)&&(l=(31&t)<<6|63&n,l>127&&(o=l));break;case 3:n=e[i+1],r=e[i+2],128==(192&n)&&128==(192&r)&&(l=(15&t)<<12|(63&n)<<6|63&r,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(l=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,l>65535&&l<1114112&&(o=l))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(e){const t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=N));return n}(r)}t.kMaxLength=a,l.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,n){return function(e,t,n){return u(e),e<=0?s(e):void 0!==t?"string"==typeof n?s(e).fill(t,n):s(e).fill(t):s(e)}(e,t,n)},l.allocUnsafe=function(e){return d(e)},l.allocUnsafeSlow=function(e){return d(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(Q(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),Q(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},l.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}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=l.allocUnsafe(t);let i=0;for(n=0;n<e.length;++n){let t=e[n];if(Q(t,Uint8Array))i+t.length>r.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!l.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},l.byteLength=g,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)m(this,t,t+1);return this},l.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},l.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},l.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?E(this,0,e):y.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){let e="";const n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},o&&(l.prototype[o]=l.prototype.inspect),l.prototype.compare=function(e,t,n,r,i){if(Q(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(o,a),c=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<s;++e)if(c[e]!==u[e]){o=c[e],a=u[e];break}return o<a?-1:a<o?1:0},l.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},l.prototype.indexOf=function(e,t,n){return b(this,e,t,n,!0)},l.prototype.lastIndexOf=function(e,t,n){return b(this,e,t,n,!1)},l.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return _(this,e,t,n);case"ascii":case"latin1":case"binary":return x(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const N=4096;function T(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function R(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function O(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=t;r<n;++r)i+=K[e[r]];return i}function k(e,t,n){const r=e.slice(t,n);let i="";for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+256*r[e+1]);return i}function L(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function A(e,t,n,r,i,o){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function C(e,t,n,r,i){U(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function D(e,t,n,r,i){U(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function M(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function P(e,t,n,r,o){return t=+t,n>>>=0,o||M(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function $(e,t,n,r,o){return t=+t,n>>>=0,o||M(e,0,n,8),i.write(e,t,n,r,52,8),n+8}l.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,l.prototype),r},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return r},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=Y((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),l.prototype.readBigUInt64BE=Y((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),l.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},l.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=Y((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),l.prototype.readBigInt64BE=Y((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||H(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),i.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||A(this,e,t,n,Math.pow(2,8*n)-1,0);let i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||A(this,e,t,n,Math.pow(2,8*n)-1,0);let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigUInt64LE=Y((function(e,t=0){return C(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeBigUInt64BE=Y((function(e,t=0){return D(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);A(this,e,t,n,r-1,-r)}let i=0,o=1,a=0;for(this[t]=255&e;++i<n&&(o*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/o|0)-a&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);A(this,e,t,n,r-1,-r)}let i=n-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o|0)-a&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||A(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigInt64LE=Y((function(e,t=0){return C(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeBigInt64BE=Y((function(e,t=0){return D(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeFloatLE=function(e,t,n){return P(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return P(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return $(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return $(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const i=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},l.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!l.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{const o=l.isBuffer(e)?e:l.from(e,r),a=o.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=o[i%a]}return this};const B={};function F(e,t,n){B[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function q(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function U(e,t,n,r,i,o){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new B.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||H(t,e.length-(n+1))}(r,i,o)}function G(e,t){if("number"!=typeof e)throw new B.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,n){if(Math.floor(e)!==e)throw G(e,n),new B.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new B.ERR_BUFFER_OUT_OF_BOUNDS;throw new B.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=q(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=q(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function W(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let a=0;a<r;++a){if(n=e.charCodeAt(a),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function z(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function J(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function X(e){return e!=e}const K=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Y(e){return"undefined"==typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},2341:e=>{e.exports=function e(t){return null===t||"object"!=typeof t||null!=t.toJSON?JSON.stringify(t):Array.isArray(t)?"["+t.reduce(((t,n,r)=>t+(0===r?"":",")+e(void 0===n||"symbol"==typeof n?null:n)),"")+"]":"{"+Object.keys(t).sort().reduce(((n,r,i)=>void 0===t[r]||"symbol"==typeof t[r]?n:n+(0===n.length?"":",")+e(r)+":"+e(t[r])),"")+"}"}},7007:e=>{var t,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function c(e,t,n,r){var i,o,a,c;if(s(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=l(e))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,c=u,console&&console.warn&&console.warn(c)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=u.bind(r);return i.listener=n,r.wrapFn=i,i}function h(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):p(i,i.length)}function f(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function p(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function g(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){r.once&&e.removeEventListener(t,i),n(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(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},o.prototype.getMaxListeners=function(){return l(this)},o.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)r(l,this,t);else{var c=l.length,u=p(l,c);for(n=0;n<c;++n)r(u[n],this,t)}return!0},o.prototype.addListener=function(e,t){return c(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return c(this,e,t,!0)},o.prototype.once=function(e,t){return s(t),this.on(e,d(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,d(this,e,t)),this},o.prototype.removeListener=function(e,t){var n,r,i,o,a;if(s(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,a||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},o.prototype.listeners=function(e){return h(this,e,!0)},o.prototype.rawListeners=function(e){return h(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},o.prototype.listenerCount=f,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},251:(e,t)=>{t.read=function(e,t,n,r,i){var o,a,s=8*i-r-1,l=(1<<s)-1,c=l>>1,u=-7,d=n?i-1:0,h=n?-1:1,f=e[t+d];for(d+=h,o=f&(1<<-u)-1,f>>=-u,u+=s;u>0;o=256*o+e[t+d],d+=h,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=r;u>0;a=256*a+e[t+d],d+=h,u-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,s,l,c=8*o-i-1,u=(1<<c)-1,d=u>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?h/l:h*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=u?(s=0,a=u):a+d>=1?(s=(t*l-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;e[n+f]=255&a,f+=p,a/=256,c-=8);e[n+f-p]|=128*g}},7034:(e,t,n)=>{const{isArray:r,isObject:i,isString:o}=n(7382),{asArray:a}=n(9263),{prependBase:s}=n(470),l=n(2207),c=n(7532);function u(e){throw new l("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:e})}function d({context:e,base:t}){if(!e)return;const n=e["@context"];if(o(n))e["@context"]=s(t,n);else if(r(n))for(let e=0;e<n.length;++e){const r=n[e];o(r)?n[e]=s(t,r):i(r)&&d({context:{"@context":r},base:t})}else if(i(n))for(const e in n)d({context:n[e],base:t})}e.exports=class{constructor({sharedCache:e}){this.perOpCache=new Map,this.sharedCache=e}async resolve({activeCtx:e,context:t,documentLoader:n,base:s,cycles:l=new Set}){t&&i(t)&&t["@context"]&&(t=t["@context"]),t=a(t);const d=[];for(const a of t){if(o(a)){let t=this._get(a);t||(t=await this._resolveRemoteContext({activeCtx:e,url:a,documentLoader:n,base:s,cycles:l})),r(t)?d.push(...t):d.push(t);continue}if(null===a){d.push(new c({document:null}));continue}i(a)||u(t);const h=JSON.stringify(a);let f=this._get(h);f||(f=new c({document:a}),this._cacheResolvedContext({key:h,resolved:f,tag:"static"})),d.push(f)}return d}_get(e){let t=this.perOpCache.get(e);if(!t){const n=this.sharedCache.get(e);n&&(t=n.get("static"),t&&this.perOpCache.set(e,t))}return t}_cacheResolvedContext({key:e,resolved:t,tag:n}){if(this.perOpCache.set(e,t),void 0!==n){let r=this.sharedCache.get(e);r||(r=new Map,this.sharedCache.set(e,r)),r.set(n,t)}return t}async _resolveRemoteContext({activeCtx:e,url:t,documentLoader:n,base:r,cycles:i}){t=s(r,t);const{context:o,remoteDoc:a}=await this._fetchContext({activeCtx:e,url:t,documentLoader:n,cycles:i});d({context:o,base:r=a.documentUrl||t});const l=await this.resolve({activeCtx:e,context:o,documentLoader:n,base:r,cycles:i});return this._cacheResolvedContext({key:t,resolved:l,tag:a.tag}),l}async _fetchContext({activeCtx:e,url:t,documentLoader:n,cycles:a}){if(a.size>10)throw new l("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"json-ld-1.0"===e.processingMode?"loading remote context failed":"context overflow",max:10});if(a.has(t))throw new l("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"json-ld-1.0"===e.processingMode?"recursive context inclusion":"context overflow",url:t});let s,c;a.add(t);try{c=await n(t),s=c.document||null,o(s)&&(s=JSON.parse(s))}catch(e){throw new l("Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.","jsonld.InvalidUrl",{code:"loading remote context failed",url:t,cause:e})}if(!i(s))throw new l("Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.","jsonld.InvalidUrl",{code:"invalid remote context",url:t});return s="@context"in s?{"@context":s["@context"]}:{"@context":{}},c.contextUrl&&(r(s["@context"])||(s["@context"]=[s["@context"]]),s["@context"].push(c.contextUrl)),{context:s,remoteDoc:c}}}},2207:e=>{e.exports=class extends Error{constructor(e="An unspecified JSON-LD error occurred.",t="jsonld.Error",n={}){super(e),this.name=t,this.message=e,this.details=n}}},5445:e=>{e.exports=e=>{class t{toString(){return"[object JsonLdProcessor]"}}return Object.defineProperty(t,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(t.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:t}),t.compact=function(t,n){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):e.compact(t,n)},t.expand=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):e.expand(t)},t.flatten=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):e.flatten(t)},t}},8229:(e,t,n)=>{e.exports=n(989).NQuads},3743:e=>{e.exports=class{constructor(){this._requests={}}wrapLoader(e){const t=this;return t._loader=e,function(){return t.add.apply(t,arguments)}}async add(e){let t=this._requests[e];if(t)return Promise.resolve(t);t=this._requests[e]=this._loader(e);try{return await t}finally{delete this._requests[e]}}}},7532:(e,t,n)=>{const r=n(9749);e.exports=class{constructor({document:e}){this.document=e,this.cache=new r({max:10})}getProcessed(e){return this.cache.get(e)}setProcessed(e,t){this.cache.set(e,t)}}},1058:(e,t,n)=>{const r=n(2207),{isArray:i,isObject:o,isString:a,isUndefined:s}=n(7382),{isList:l,isValue:c,isGraph:u,isSimpleGraph:d,isSubjectReference:h}=n(3978),{expandIri:f,getContextValue:p,isKeyword:g,process:y,processingMode:m}=n(1972),{removeBase:b,prependBase:v}=n(470),{REGEX_KEYWORD:w,addValue:_,asArray:x,compareShortestLeast:S}=n(9263),j={};function I(e,t,n){if("@nest"!==f(e,t,{vocab:!0},n))throw new r("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}e.exports=j,j.compact=async({activeCtx:e,activeProperty:t=null,element:n,options:f={}})=>{if(i(n)){let r=[];for(let i=0;i<n.length;++i){const o=await j.compact({activeCtx:e,activeProperty:t,element:n[i],options:f});null!==o&&r.push(o)}return f.compactArrays&&1===r.length&&0===(p(e,t,"@container")||[]).length&&(r=r[0]),r}const b=p(e,t,"@context");if(s(b)||(e=await y({activeCtx:e,localCtx:b,propagate:!0,overrideProtected:!0,options:f})),o(n)){if(f.link&&"@id"in n&&f.link.hasOwnProperty(n["@id"])){const e=f.link[n["@id"]];for(let t=0;t<e.length;++t)if(e[t].expanded===n)return e[t].compacted}if(c(n)||h(n)){const r=j.compactValue({activeCtx:e,activeProperty:t,value:n,options:f});return f.link&&h(n)&&(f.link.hasOwnProperty(n["@id"])||(f.link[n["@id"]]=[]),f.link[n["@id"]].push({expanded:n,compacted:r})),r}if(l(n)&&(p(e,t,"@container")||[]).includes("@list"))return j.compact({activeCtx:e,activeProperty:t,element:n["@list"],options:f});const b="@reverse"===t,v={},w=e;c(n)||h(n)||(e=e.revertToPreviousContext());const S=p(w,t,"@context");s(S)||(e=await y({activeCtx:e,localCtx:S,propagate:!0,overrideProtected:!0,options:f})),f.link&&"@id"in n&&(f.link.hasOwnProperty(n["@id"])||(f.link[n["@id"]]=[]),f.link[n["@id"]].push({expanded:n,compacted:v}));let E=n["@type"]||[];E.length>1&&(E=Array.from(E).sort());const N=e;for(const t of E){const n=j.compactIri({activeCtx:N,iri:t,relativeTo:{vocab:!0}}),r=p(w,n,"@context");s(r)||(e=await y({activeCtx:e,localCtx:r,options:f,propagate:!1}))}const T=Object.keys(n).sort();for(const s of T){const h=n[s];if("@id"!==s)if("@type"!==s)if("@reverse"!==s)if("@preserve"!==s)if("@index"!==s)if("@graph"!==s&&"@list"!==s&&"@included"!==s&&g(s)){const t=j.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});_(v,t,h)}else{if(!i(h))throw new r("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(0===h.length){const t=j.compactIri({activeCtx:e,iri:s,value:h,relativeTo:{vocab:!0},reverse:b}),n=e.mappings.has(t)?e.mappings.get(t)["@nest"]:null;let r=v;n&&(I(e,n,f),o(v[n])||(v[n]={}),r=v[n]),_(r,t,h,{propertyIsArray:!0})}for(const t of h){const n=j.compactIri({activeCtx:e,iri:s,value:t,relativeTo:{vocab:!0},reverse:b}),r=e.mappings.has(n)?e.mappings.get(n)["@nest"]:null;let h=v;r&&(I(e,r,f),o(v[r])||(v[r]={}),h=v[r]);const g=p(e,n,"@container")||[],y=u(t),m=l(t);let w;m?w=t["@list"]:y&&(w=t["@graph"]);let S=await j.compact({activeCtx:e,activeProperty:n,element:m||y?w:t,options:f});if(m){if(i(S)||(S=[S]),g.includes("@list")){_(h,n,S,{valueIsArray:!0,allowDuplicate:!0});continue}S={[j.compactIri({activeCtx:e,iri:"@list",relativeTo:{vocab:!0}})]:S},"@index"in t&&(S[j.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=t["@index"])}if(y)if(g.includes("@graph")&&(g.includes("@id")||g.includes("@index")&&d(t))){let r;h.hasOwnProperty(n)?r=h[n]:h[n]=r={};const i=(g.includes("@id")?t["@id"]:t["@index"])||j.compactIri({activeCtx:e,iri:"@none",relativeTo:{vocab:!0}});_(r,i,S,{propertyIsArray:!f.compactArrays||g.includes("@set")})}else g.includes("@graph")&&d(t)?(i(S)&&S.length>1&&(S={"@included":S}),_(h,n,S,{propertyIsArray:!f.compactArrays||g.includes("@set")})):(i(S)&&1===S.length&&f.compactArrays&&(S=S[0]),S={[j.compactIri({activeCtx:e,iri:"@graph",relativeTo:{vocab:!0}})]:S},"@id"in t&&(S[j.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]=t["@id"]),"@index"in t&&(S[j.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=t["@index"]),_(h,n,S,{propertyIsArray:!f.compactArrays||g.includes("@set")}));else if(g.includes("@language")||g.includes("@index")||g.includes("@id")||g.includes("@type")){let r,i;if(h.hasOwnProperty(n)?r=h[n]:h[n]=r={},g.includes("@language"))c(S)&&(S=S["@value"]),i=t["@language"];else if(g.includes("@index")){const r=p(e,n,"@index")||"@index",o=j.compactIri({activeCtx:e,iri:r,relativeTo:{vocab:!0}});if("@index"===r)i=t["@index"],delete S[o];else{let e;if([i,...e]=x(S[r]||[]),a(i))switch(e.length){case 0:delete S[r];break;case 1:S[r]=e[0];break;default:S[r]=e}else i=null}}else if(g.includes("@id")){const t=j.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}});i=S[t],delete S[t]}else if(g.includes("@type")){const r=j.compactIri({activeCtx:e,iri:"@type",relativeTo:{vocab:!0}});let o;switch([i,...o]=x(S[r]||[]),o.length){case 0:delete S[r];break;case 1:S[r]=o[0];break;default:S[r]=o}1===Object.keys(S).length&&"@id"in t&&(S=await j.compact({activeCtx:e,activeProperty:n,element:{"@id":t["@id"]},options:f}))}i||(i=j.compactIri({activeCtx:e,iri:"@none",relativeTo:{vocab:!0}})),_(r,i,S,{propertyIsArray:g.includes("@set")})}else{const e=!f.compactArrays||g.includes("@set")||g.includes("@list")||i(S)&&0===S.length||"@list"===s||"@graph"===s;_(h,n,S,{propertyIsArray:e})}}}else{if((p(e,t,"@container")||[]).includes("@index"))continue;const n=j.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});_(v,n,h)}else{const n=await j.compact({activeCtx:e,activeProperty:t,element:h,options:f});i(n)&&0===n.length||_(v,s,n)}else{const t=await j.compact({activeCtx:e,activeProperty:"@reverse",element:h,options:f});for(const n in t)if(e.mappings.has(n)&&e.mappings.get(n).reverse){const r=t[n],i=(p(e,n,"@container")||[]).includes("@set")||!f.compactArrays;_(v,n,r,{propertyIsArray:i}),delete t[n]}if(Object.keys(t).length>0){const n=j.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});_(v,n,t)}}else{let t=x(h).map((e=>j.compactIri({activeCtx:w,iri:e,relativeTo:{vocab:!0}})));1===t.length&&(t=t[0]);const n=j.compactIri({activeCtx:e,iri:"@type",relativeTo:{vocab:!0}}),r=(p(e,n,"@container")||[]).includes("@set")&&m(e,1.1)||i(t)&&0===h.length;_(v,n,t,{propertyIsArray:r})}else{let t=x(h).map((t=>j.compactIri({activeCtx:e,iri:t,relativeTo:{vocab:!1},base:f.base})));1===t.length&&(t=t[0]),v[j.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]=t}}return v}return n},j.compactIri=({activeCtx:e,iri:t,value:n=null,relativeTo:i={vocab:!1},reverse:a=!1,base:s=null})=>{if(null===t)return t;e.isPropertyTermScoped&&e.previousContext&&(e=e.previousContext);const d=e.getInverse();if(g(t)&&t in d&&"@none"in d[t]&&"@type"in d[t]["@none"]&&"@none"in d[t]["@none"]["@type"])return d[t]["@none"]["@type"]["@none"];if(i.vocab&&t in d){const r=e["@language"]||"@none",i=[];o(n)&&"@index"in n&&!("@graph"in n)&&i.push("@index","@index@set"),o(n)&&"@preserve"in n&&(n=n["@preserve"][0]),u(n)?("@index"in n&&i.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in n&&i.push("@graph@id","@graph@id@set"),i.push("@graph","@graph@set","@set"),"@index"in n||i.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in n||i.push("@graph@id","@graph@id@set")):o(n)&&!c(n)&&i.push("@id","@id@set","@type","@set@type");let s="@language",d="@null";if(a)s="@type",d="@reverse",i.push("@set");else if(l(n)){"@index"in n||i.push("@list");const e=n["@list"];if(0===e.length)s="@any",d="@none";else{let t=0===e.length?r:null,n=null;for(let r=0;r<e.length;++r){const i=e[r];let o="@none",a="@none";if(c(i)?"@direction"in i?o=`${(i["@language"]||"").toLowerCase()}_${i["@direction"]}`:"@language"in i?o=i["@language"].toLowerCase():"@type"in i?a=i["@type"]:o="@null":a="@id",null===t?t=o:o!==t&&c(i)&&(t="@none"),null===n?n=a:a!==n&&(n="@none"),"@none"===t&&"@none"===n)break}t=t||"@none",n=n||"@none","@none"!==n?(s="@type",d=n):d=t}}else{if(c(n))if("@language"in n&&!("@index"in n)){i.push("@language","@language@set"),d=n["@language"];const e=n["@direction"];e&&(d=`${d}_${e}`)}else"@direction"in n&&!("@index"in n)?d=`_${n["@direction"]}`:"@type"in n&&(s="@type",d=n["@type"]);else s="@type",d="@id";i.push("@set")}i.push("@none"),o(n)&&!("@index"in n)&&i.push("@index","@index@set"),c(n)&&1===Object.keys(n).length&&i.push("@language","@language@set");const h=function(e,t,n,r,i,a){null===a&&(a="@null");const s=[];if(("@id"===a||"@reverse"===a)&&o(n)&&"@id"in n){"@reverse"===a&&s.push("@reverse");const t=j.compactIri({activeCtx:e,iri:n["@id"],relativeTo:{vocab:!0}});e.mappings.has(t)&&e.mappings.get(t)&&e.mappings.get(t)["@id"]===n["@id"]?s.push.apply(s,["@vocab","@id"]):s.push.apply(s,["@id","@vocab"])}else{s.push(a);const e=s.find((e=>e.includes("_")));e&&s.push(e.replace(/^[^_]+_/,"_"))}s.push("@none");const l=e.inverse[t];for(const e of r){if(!(e in l))continue;const t=l[e][i];for(const e of s)if(e in t)return t[e]}return null}(e,t,n,i,s,d);if(null!==h)return h}if(i.vocab&&"@vocab"in e){const n=e["@vocab"];if(0===t.indexOf(n)&&t!==n){const r=t.substr(n.length);if(!e.mappings.has(r))return r}}let h=null;const f=[];let p=e.fastCurieMap;const y=t.length-1;for(let e=0;e<y&&t[e]in p;++e)p=p[t[e]],""in p&&f.push(p[""][0]);for(let r=f.length-1;r>=0;--r){const i=f[r],o=i.terms;for(const r of o){const o=r+":"+t.substr(i.iri.length);e.mappings.get(r)._prefix&&(!e.mappings.has(o)||null===n&&e.mappings.get(o)["@id"]===t)&&(null===h||S(o,h)<0)&&(h=o)}}if(null!==h)return h;for(const[n,i]of e.mappings)if(i&&i._prefix&&t.startsWith(n+":"))throw new r(`Absolute IRI "${t}" confused with prefix "${n}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:e});if(!i.vocab){if("@base"in e){if(e["@base"]){const n=b(v(s,e["@base"]),t);return w.test(n)?`./${n}`:n}return t}return b(s,t)}return t},j.compactValue=({activeCtx:e,activeProperty:t,value:n,options:r})=>{if(c(n)){const r=p(e,t,"@type"),i=p(e,t,"@language"),o=p(e,t,"@direction"),s=p(e,t,"@container")||[],l="@index"in n&&!s.includes("@index");if(!l&&"@none"!==r){if(n["@type"]===r)return n["@value"];if("@language"in n&&n["@language"]===i&&"@direction"in n&&n["@direction"]===o)return n["@value"];if("@language"in n&&n["@language"]===i)return n["@value"];if("@direction"in n&&n["@direction"]===o)return n["@value"]}const c=Object.keys(n).length,u=1===c||2===c&&"@index"in n&&!l,d="@language"in e,h=a(n["@value"]),f=e.mappings.has(t)&&null===e.mappings.get(t)["@language"];if(u&&"@none"!==r&&(!d||!h||f))return n["@value"];const g={};return l&&(g[j.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=n["@index"]),"@type"in n?g[j.compactIri({activeCtx:e,iri:"@type",relativeTo:{vocab:!0}})]=j.compactIri({activeCtx:e,iri:n["@type"],relativeTo:{vocab:!0}}):"@language"in n&&(g[j.compactIri({activeCtx:e,iri:"@language",relativeTo:{vocab:!0}})]=n["@language"]),"@direction"in n&&(g[j.compactIri({activeCtx:e,iri:"@direction",relativeTo:{vocab:!0}})]=n["@direction"]),g[j.compactIri({activeCtx:e,iri:"@value",relativeTo:{vocab:!0}})]=n["@value"],g}const i=f(e,t,{vocab:!0},r),o=p(e,t,"@type"),s=j.compactIri({activeCtx:e,iri:n["@id"],relativeTo:{vocab:"@vocab"===o},base:r.base});return"@id"===o||"@vocab"===o||"@graph"===i?s:{[j.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]:s}}},9378:e=>{const t="http://www.w3.org/1999/02/22-rdf-syntax-ns#",n="http://www.w3.org/2001/XMLSchema#";e.exports={LINK_HEADER_REL:"http://www.w3.org/ns/json-ld#context",LINK_HEADER_CONTEXT:"http://www.w3.org/ns/json-ld#context",RDF:t,RDF_LIST:t+"List",RDF_FIRST:t+"first",RDF_REST:t+"rest",RDF_NIL:t+"nil",RDF_TYPE:t+"type",RDF_PLAIN_LITERAL:t+"PlainLiteral",RDF_XML_LITERAL:t+"XMLLiteral",RDF_JSON_LITERAL:t+"JSON",RDF_OBJECT:t+"object",RDF_LANGSTRING:t+"langString",XSD:n,XSD_BOOLEAN:n+"boolean",XSD_DOUBLE:n+"double",XSD_INTEGER:n+"integer",XSD_STRING:n+"string"}},1972:(e,t,n)=>{const r=n(9263),i=n(2207),{isArray:o,isObject:a,isString:s,isUndefined:l}=n(7382),{isAbsolute:c,isRelative:u,prependBase:d}=n(470),{handleEvent:h}=n(2246),{REGEX_BCP47:f,REGEX_KEYWORD:p,asArray:g,compareShortestLeast:y}=n(9263),m=new Map,b={};function v(e,t,n,r,i,o){if(null===t||!s(t)||b.isKeyword(t))return t;if(t.match(p))return null;if(r&&r.hasOwnProperty(t)&&!0!==i.get(t)&&b.createTermDefinition({activeCtx:e,localCtx:r,term:t,defined:i,options:o}),(n=n||{}).vocab){const n=e.mappings.get(t);if(null===n)return null;if(a(n)&&"@id"in n)return n["@id"]}const l=t.indexOf(":");if(l>0){const n=t.substr(0,l),a=t.substr(l+1);if("_"===n||0===a.indexOf("//"))return t;r&&r.hasOwnProperty(n)&&b.createTermDefinition({activeCtx:e,localCtx:r,term:n,defined:i,options:o});const s=e.mappings.get(n);if(s&&s._prefix)return s["@id"]+a;if(c(t))return t}if(n.vocab&&"@vocab"in e)t=e["@vocab"]+t;else if(n.base){let n,r;"@base"in e?e["@base"]?(r=d(o.base,e["@base"]),n=d(r,t)):(r=e["@base"],n=t):(r=o.base,n=d(o.base,t)),t=n}return t}function w(e,t){if(!e||"object"!=typeof e||!t||"object"!=typeof t)return e===t;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!w(e[n],t[n]))return!1;return!0}const r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(const n in e){let r=e[n],i=t[n];if("@container"===n&&Array.isArray(r)&&Array.isArray(i)&&(r=r.slice().sort(),i=i.slice().sort()),!w(r,i))return!1}return!0}e.exports=b,b.process=async({activeCtx:e,localCtx:t,options:n,propagate:r=!0,overrideProtected:l=!1,cycles:p=new Set})=>{if(a(t)&&"@context"in t&&o(t["@context"])&&(t=t["@context"]),0===g(t).length)return e;const y=[],m=[({event:e,next:t})=>{y.push(e),t()}];n.eventHandler&&m.push(n.eventHandler);const w=n;n={...n,eventHandler:m};const _=await n.contextResolver.resolve({activeCtx:e,context:t,documentLoader:n.documentLoader,base:n.base});a(_[0].document)&&"boolean"==typeof _[0].document["@propagate"]&&(r=_[0].document["@propagate"]);let x=e;r||x.previousContext||(x=x.clone(),x.previousContext=e);for(const r of _){let{document:o}=r;if(e=x,null===o){if(!l&&0!==Object.keys(e.protected).length)throw new i("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});x=e=b.getInitialContext(n).clone();continue}const g=r.getProcessed(e);if(g){if(w.eventHandler)for(const e of g.events)h({event:e,options:w});x=e=g.context;continue}if(a(o)&&"@context"in o&&(o=o["@context"]),!a(o))throw new i("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:o});x=x.clone();const m=new Map;if("@version"in o){if(1.1!==o["@version"])throw new i("Unsupported JSON-LD version: "+o["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:o});if(e.processingMode&&"json-ld-1.0"===e.processingMode)throw new i("@version: "+o["@version"]+" not compatible with "+e.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:o});x.processingMode="json-ld-1.1",x["@version"]=o["@version"],m.set("@version",!0)}if(x.processingMode=x.processingMode||e.processingMode,"@base"in o){let e=o["@base"];if(null===e||c(e));else{if(!u(e))throw new i('Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI, a relative IRI, or null.',"jsonld.SyntaxError",{code:"invalid base IRI",context:o});e=d(x["@base"],e)}x["@base"]=e,m.set("@base",!0)}if("@vocab"in o){const e=o["@vocab"];if(null===e)delete x["@vocab"];else{if(!s(e))throw new i('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:o});if(!c(e)&&b.processingMode(x,1))throw new i('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:o});{const t=v(x,e,{vocab:!0,base:!0},void 0,void 0,n);c(t)||n.eventHandler&&h({event:{type:["JsonLdEvent"],code:"relative @vocab reference",level:"warning",message:"Relative @vocab reference found.",details:{vocab:t}},options:n}),x["@vocab"]=t}}m.set("@vocab",!0)}if("@language"in o){const e=o["@language"];if(null===e)delete x["@language"];else{if(!s(e))throw new i('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:o});e.match(f)||n.eventHandler&&h({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:e}},options:n}),x["@language"]=e.toLowerCase()}m.set("@language",!0)}if("@direction"in o){const t=o["@direction"];if("json-ld-1.0"===e.processingMode)throw new i("Invalid JSON-LD syntax; @direction not compatible with "+e.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:o});if(null===t)delete x["@direction"];else{if("ltr"!==t&&"rtl"!==t)throw new i('Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:o});x["@direction"]=t}m.set("@direction",!0)}if("@propagate"in o){const n=o["@propagate"];if("json-ld-1.0"===e.processingMode)throw new i("Invalid JSON-LD syntax; @propagate not compatible with "+e.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:o});if("boolean"!=typeof n)throw new i("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:t});m.set("@propagate",!0)}if("@import"in o){const r=o["@import"];if("json-ld-1.0"===e.processingMode)throw new i("Invalid JSON-LD syntax; @import not compatible with "+e.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:o});if(!s(r))throw new i("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:t});const a=await n.contextResolver.resolve({activeCtx:e,context:r,documentLoader:n.documentLoader,base:n.base});if(1!==a.length)throw new i("Invalid JSON-LD syntax; @import must reference a single context.","jsonld.SyntaxError",{code:"invalid remote context",context:t});const l=a[0].getProcessed(e);if(l)o=l;else{const n=a[0].document;if("@import"in n)throw new i("Invalid JSON-LD syntax: imported context must not include @import.","jsonld.SyntaxError",{code:"invalid context entry",context:t});for(const e in n)o.hasOwnProperty(e)||(o[e]=n[e]);a[0].setProcessed(e,o)}m.set("@import",!0)}m.set("@protected",o["@protected"]||!1);for(const e in o)if(b.createTermDefinition({activeCtx:x,localCtx:o,term:e,defined:m,options:n,overrideProtected:l}),a(o[e])&&"@context"in o[e]){const t=o[e]["@context"];let r=!0;if(s(t)){const e=d(n.base,t);p.has(e)?r=!1:p.add(e)}if(r)try{await b.process({activeCtx:x.clone(),localCtx:o[e]["@context"],overrideProtected:!0,options:n,cycles:p})}catch(t){throw new i("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:o[e]["@context"],term:e})}}r.setProcessed(e,{context:x,events:y})}return x},b.createTermDefinition=({activeCtx:e,localCtx:t,term:n,defined:r,options:l,overrideProtected:u=!1})=>{if(r.has(n)){if(r.get(n))return;throw new i("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:t,term:n})}let d;if(r.set(n,!1),t.hasOwnProperty(n)&&(d=t[n]),"@type"===n&&a(d)&&"@set"===(d["@container"]||"@set")&&b.processingMode(e,1.1)){const e=["@container","@id","@protected"],r=Object.keys(d);if(0===r.length||r.some((t=>!e.includes(t))))throw new i("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:t,term:n})}else{if(b.isKeyword(n))throw new i("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:t,term:n});if(n.match(p))return void(l.eventHandler&&h({event:{type:["JsonLdEvent"],code:"reserved term",level:"warning",message:'Terms beginning with "@" are reserved for future use and dropped.',details:{term:n}},options:l}));if(""===n)throw new i("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:t})}const f=e.mappings.get(n);e.mappings.has(n)&&e.mappings.delete(n);let g=!1;if((s(d)||null===d)&&(g=!0,d={"@id":d}),!a(d))throw new i("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:t});const y={};e.mappings.set(n,y),y.reverse=!1;const m=["@container","@id","@language","@reverse","@type"];b.processingMode(e,1.1)&&m.push("@context","@direction","@index","@nest","@prefix","@protected");for(const e in d)if(!m.includes(e))throw new i("Invalid JSON-LD syntax; a term definition must not contain "+e,"jsonld.SyntaxError",{code:"invalid term definition",context:t});const _=n.indexOf(":");if(y._termHasColon=_>0,"@reverse"in d){if("@id"in d)throw new i("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});if("@nest"in d)throw new i("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});const o=d["@reverse"];if(!s(o))throw new i("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});if(o.match(p))return l.eventHandler&&h({event:{type:["JsonLdEvent"],code:"reserved @reverse value",level:"warning",message:'@reverse values beginning with "@" are reserved for future use and dropped.',details:{reverse:o}},options:l}),void(f?e.mappings.set(n,f):e.mappings.delete(n));const a=v(e,o,{vocab:!0,base:!1},t,r,l);if(!c(a))throw new i("Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});y["@id"]=a,y.reverse=!0}else if("@id"in d){let o=d["@id"];if(o&&!s(o))throw new i("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});if(null===o)y["@id"]=null;else{if(!b.isKeyword(o)&&o.match(p))return l.eventHandler&&h({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:'@id values beginning with "@" are reserved for future use and dropped.',details:{id:o}},options:l}),void(f?e.mappings.set(n,f):e.mappings.delete(n));if(o!==n){if(o=v(e,o,{vocab:!0,base:!1},t,r,l),!c(o)&&!b.isKeyword(o))throw new i("Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});if(n.match(/(?::[^:])|\//)&&v(e,n,{vocab:!0,base:!1},t,new Map(r).set(n,!0),l)!==o)throw new i("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});y["@id"]=o,y._prefix=g&&!y._termHasColon&&null!==o.match(/[:\/\?#\[\]@]$/)}}}if(!("@id"in y))if(y._termHasColon){const i=n.substr(0,_);if(t.hasOwnProperty(i)&&b.createTermDefinition({activeCtx:e,localCtx:t,term:i,defined:r,options:l}),e.mappings.has(i)){const t=n.substr(_+1);y["@id"]=e.mappings.get(i)["@id"]+t}else y["@id"]=n}else if("@type"===n)y["@id"]=n;else{if(!("@vocab"in e))throw new i("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t,term:n});y["@id"]=e["@vocab"]+n}if((!0===d["@protected"]||!0===r.get("@protected")&&!1!==d["@protected"])&&(e.protected[n]=!0,y.protected=!0),r.set(n,!0),"@type"in d){let n=d["@type"];if(!s(n))throw new i("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if("@json"===n||"@none"===n){if(b.processingMode(e,1))throw new i(`Invalid JSON-LD syntax; an @context @type value must not be "${n}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:t})}else if("@id"!==n&&"@vocab"!==n){if(n=v(e,n,{vocab:!0,base:!1},t,r,l),!c(n))throw new i("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if(0===n.indexOf("_:"))throw new i("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:t})}y["@type"]=n}if("@container"in d){const n=s(d["@container"])?[d["@container"]]:d["@container"]||[],r=["@list","@set","@index","@language"];let a=!0;const l=n.includes("@set");if(b.processingMode(e,1.1)){if(r.push("@graph","@id","@type"),n.includes("@list")){if(1!==n.length)throw new i("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:t})}else if(n.includes("@graph")){if(n.some((e=>"@graph"!==e&&"@id"!==e&&"@index"!==e&&"@set"!==e)))throw new i("Invalid JSON-LD syntax; @context @container with @graph must have no other values other than @id, @index, and @set","jsonld.SyntaxError",{code:"invalid container mapping",context:t})}else a&=n.length<=(l?2:1);if(n.includes("@type")&&(y["@type"]=y["@type"]||"@id",!["@id","@vocab"].includes(y["@type"])))throw new i("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:t})}else a&=!o(d["@container"]),a&=n.length<=1;if(a&=n.every((e=>r.includes(e))),a&=!(l&&n.includes("@list")),!a)throw new i("Invalid JSON-LD syntax; @context @container value must be one of the following: "+r.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:t});if(y.reverse&&!n.every((e=>["@index","@set"].includes(e))))throw new i("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});y["@container"]=n}if("@index"in d){if(!("@container"in d)||!y["@container"].includes("@index"))throw new i(`Invalid JSON-LD syntax; @index without @index in @container: "${d["@index"]}" on term "${n}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:t});if(!s(d["@index"])||0===d["@index"].indexOf("@"))throw new i(`Invalid JSON-LD syntax; @index must expand to an IRI: "${d["@index"]}" on term "${n}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:t});y["@index"]=d["@index"]}if("@context"in d&&(y["@context"]=d["@context"]),"@language"in d&&!("@type"in d)){let e=d["@language"];if(null!==e&&!s(e))throw new i("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:t});null!==e&&(e=e.toLowerCase()),y["@language"]=e}if("@prefix"in d){if(n.match(/:|\//))throw new i("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:t});if(b.isKeyword(y["@id"]))throw new i("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:t});if("boolean"!=typeof d["@prefix"])throw new i("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:t});y._prefix=!0===d["@prefix"]}if("@direction"in d){const e=d["@direction"];if(null!==e&&"ltr"!==e&&"rtl"!==e)throw new i('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:t});y["@direction"]=e}if("@nest"in d){const e=d["@nest"];if(!s(e)||"@nest"!==e&&0===e.indexOf("@"))throw new i("Invalid JSON-LD syntax; @context @nest value must be a string which is not a keyword other than @nest.","jsonld.SyntaxError",{code:"invalid @nest value",context:t});y["@nest"]=e}const x=y["@id"];if("@context"===x||"@preserve"===x)throw new i("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:t});if(f&&f.protected&&!u&&(e.protected[n]=!0,y.protected=!0,!w(f,y)))throw new i("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:t,term:n})},b.expandIri=(e,t,n,r)=>v(e,t,n,void 0,void 0,r),b.getInitialContext=e=>{const t=JSON.stringify({processingMode:e.processingMode}),n=m.get(t);if(n)return n;const i={processingMode:e.processingMode,mappings:new Map,inverse:null,getInverse:function(){const e=this;if(e.inverse)return e.inverse;const t=e.inverse={},n=e.fastCurieMap={},r={},i=(e["@language"]||"@none").toLowerCase(),s=e["@direction"],l=e.mappings,c=[...l.keys()].sort(y);for(const e of c){const o=l.get(e);if(null===o)continue;let c=o["@container"]||"@none";if(c=[].concat(c).sort().join(""),null===o["@id"])continue;const u=g(o["@id"]);for(const l of u){let u=t[l];const d=b.isKeyword(l);if(u)d||o._termHasColon||r[l].push(e);else if(t[l]=u={},!d&&!o._termHasColon){r[l]=[e];const t={iri:l,terms:r[l]};l[0]in n?n[l[0]].push(t):n[l[0]]=[t]}if(u[c]||(u[c]={"@language":{},"@type":{},"@any":{}}),u=u[c],a(e,u["@any"],"@none"),o.reverse)a(e,u["@type"],"@reverse");else if("@none"===o["@type"])a(e,u["@any"],"@none"),a(e,u["@language"],"@none"),a(e,u["@type"],"@none");else if("@type"in o)a(e,u["@type"],o["@type"]);else if("@language"in o&&"@direction"in o){const t=o["@language"],n=o["@direction"];a(e,u["@language"],t&&n?`${t}_${n}`.toLowerCase():t?t.toLowerCase():n?`_${n}`:"@null")}else"@language"in o?a(e,u["@language"],(o["@language"]||"@null").toLowerCase()):"@direction"in o?o["@direction"]?a(e,u["@language"],`_${o["@direction"]}`):a(e,u["@language"],"@none"):s?(a(e,u["@language"],`_${s}`),a(e,u["@language"],"@none"),a(e,u["@type"],"@none")):(a(e,u["@language"],i),a(e,u["@language"],"@none"),a(e,u["@type"],"@none"))}}for(const e in n)o(n,e,1);return t},clone:function(){const e={};return e.mappings=r.clone(this.mappings),e.clone=this.clone,e.inverse=null,e.getInverse=this.getInverse,e.protected=r.clone(this.protected),this.previousContext&&(e.previousContext=this.previousContext.clone()),e.revertToPreviousContext=this.revertToPreviousContext,"@base"in this&&(e["@base"]=this["@base"]),"@language"in this&&(e["@language"]=this["@language"]),"@vocab"in this&&(e["@vocab"]=this["@vocab"]),e},revertToPreviousContext:function(){return this.previousContext?this.previousContext.clone():this},protected:{}};return 1e4===m.size&&m.clear(),m.set(t,i),i;function o(e,t,n){const r=e[t],i=e[t]={};let a,s;for(const e of r)a=e.iri,s=n>=a.length?"":a[n],s in i?i[s].push(e):i[s]=[e];for(const e in i)""!==e&&o(i,e,n+1)}function a(e,t,n){t.hasOwnProperty(n)||(t[n]=e)}},b.getContextValue=(e,t,n)=>{if(null===t){if("@context"===n)return;return null}if(e.mappings.has(t)){const r=e.mappings.get(t);if(l(n))return r;if(r.hasOwnProperty(n))return r[n]}return"@language"===n&&n in e||"@direction"===n&&n in e?e[n]:"@context"!==n?null:void 0},b.processingMode=(e,t)=>t.toString()>="1.1"?!e.processingMode||e.processingMode>="json-ld-"+t.toString():"json-ld-1.0"===e.processingMode,b.isKeyword=e=>{if(!s(e)||"@"!==e[0])return!1;switch(e){case"@base":case"@container":case"@context":case"@default":case"@direction":case"@embed":case"@explicit":case"@graph":case"@id":case"@included":case"@index":case"@json":case"@language":case"@list":case"@nest":case"@none":case"@omitDefault":case"@prefix":case"@preserve":case"@protected":case"@requireAll":case"@reverse":case"@set":case"@type":case"@value":case"@version":case"@vocab":return!0}return!1}},6957:(e,t,n)=>{const{parseLinkHeader:r,buildHeaders:i}=n(9263),{LINK_HEADER_CONTEXT:o}=n(9378),a=n(2207),s=n(3743),{prependBase:l}=n(470),c=/(^|(\r\n))link:/i;e.exports=({secure:e,headers:t={},xhr:n}={headers:{}})=>(t=i(t),(new s).wrapLoader((async function i(s){if(0!==s.indexOf("http:")&&0!==s.indexOf("https:"))throw new a('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:s});if(e&&0!==s.indexOf("https"))throw new a('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:s});let u;try{u=await function(e,t,n){const r=new(e=e||XMLHttpRequest);return new Promise(((e,i)=>{r.onload=()=>e(r),r.onerror=e=>i(e),r.open("GET",t,!0);for(const e in n)r.setRequestHeader(e,n[e]);r.send()}))}(n,s,t)}catch(e){throw new a("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:s,cause:e})}if(u.status>=400)throw new a("URL could not be dereferenced: "+u.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:s,httpStatusCode:u.status});let d={contextUrl:null,documentUrl:s,document:u.response},h=null;const f=u.getResponseHeader("Content-Type");let p;if(c.test(u.getAllResponseHeaders())&&(p=u.getResponseHeader("Link")),p&&"application/ld+json"!==f){const e=r(p),t=e[o];if(Array.isArray(t))throw new a("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:s});t&&(d.contextUrl=t.target),h=e.alternate,h&&"application/ld+json"==h.type&&!(f||"").match(/^application\/(\w*\+)?json$/)&&(d=await i(l(s,h.target)))}return d})))},2246:(e,t,n)=>{const r=n(2207),{isArray:i}=n(7382),{asArray:o}=n(9263),a={};function s({event:e,handlers:t}){let n=!0;for(let o=0;n&&o<t.length;++o){n=!1;const a=t[o];if(i(a))n=s({event:e,handlers:a});else if("function"==typeof a)a({event:e,next:()=>{n=!0}});else{if("object"!=typeof a)throw new r("Invalid event handler.","jsonld.InvalidEventHandler",{event:e});e.code in a?a[e.code]({event:e,next:()=>{n=!0}}):n=!0}}return n}e.exports=a,a.defaultEventHandler=null,a.setupEventHandler=({options:e={}})=>{const t=[].concat(e.safe?a.safeEventHandler:[],e.eventHandler?o(e.eventHandler):[],a.defaultEventHandler?a.defaultEventHandler:[]);return 0===t.length?null:t},a.handleEvent=({event:e,options:t})=>{s({event:e,handlers:t.eventHandler})};const l=new Set(["empty object","free-floating scalar","invalid @language value","invalid property","null @id value","null @value value","object with only @id","object with only @language","object with only @list","object with only @value","relative @id reference","relative @type reference","relative @vocab reference","reserved @id value","reserved @reverse value","reserved term","blank node predicate","relative graph reference","relative object reference","relative predicate reference","relative subject reference","rdfDirection not set"]);a.safeEventHandler=function({event:e,next:t}){if("warning"===e.level&&l.has(e.code))throw new r("Safe mode validation error.","jsonld.ValidationError",{event:e});t()},a.logEventHandler=function({event:e,next:t}){console.log(`EVENT: ${e.message}`,{event:e}),t()},a.logWarningEventHandler=function({event:e,next:t}){"warning"===e.level&&console.warn(`WARNING: ${e.message}`,{event:e}),t()},a.unhandledEventHandler=function({event:e}){throw new r("No handler for event.","jsonld.UnhandledEvent",{event:e})},a.setDefaultEventHandler=function({eventHandler:e}={}){a.defaultEventHandler=e?o(e):null}},4019:(e,t,n)=>{const r=n(2207),{isArray:i,isObject:o,isEmptyObject:a,isString:s,isUndefined:l}=n(7382),{isList:c,isValue:u,isGraph:d,isSubject:h}=n(3978),{expandIri:f,getContextValue:p,isKeyword:g,process:y,processingMode:m}=n(1972),{isAbsolute:b}=n(470),{REGEX_BCP47:v,REGEX_KEYWORD:w,addValue:_,asArray:x,getValues:S,validateTypeValue:j}=n(9263),{handleEvent:I}=n(2246),E={};function N({value:e,count:t,options:n}){if(0===t||"@value"in e||"@list"in e||1===t&&"@id"in e){if(n.eventHandler){let r,i;0===t?(r="empty object",i="Dropping empty object."):"@value"in e?(r="object with only @value",i="Dropping object with only @value."):"@list"in e?(r="object with only @list",i="Dropping object with only @list."):1===t&&"@id"in e&&(r="object with only @id",i="Dropping object with only @id."),I({event:{type:["JsonLdEvent"],code:r,level:"warning",message:i,details:{value:e}},options:n})}return null}return e}async function T({activeCtx:e,activeProperty:t,expandedActiveProperty:n,element:d,expandedParent:w,options:S={},insideList:R,typeKey:L,typeScopedContext:A}){const C=Object.keys(d).sort(),D=[];let M;const P=d[L]&&"@json"===f(e,i(d[L])?d[L][0]:d[L],{vocab:!0},{...S,typeExpansion:!0});for(const T of C){let R,L=d[T];if("@context"===T)continue;const C=f(e,T,{vocab:!0},S);if(null===C||!b(C)&&!g(C)){S.eventHandler&&I({event:{type:["JsonLdEvent"],code:"invalid property",level:"warning",message:"Dropping property that did not expand into an absolute IRI or keyword.",details:{property:T,expandedProperty:C}},options:S});continue}if(g(C)){if("@reverse"===n)throw new r("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:L});if(C in w&&"@included"!==C&&"@type"!==C)throw new r("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:C})}if("@id"===C){if(!s(L)){if(!S.isFrame)throw new r('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:L});if(o(L)){if(!a(L))throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:L})}else{if(!i(L))throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:L});if(!L.every((e=>s(e))))throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:L})}}_(w,"@id",x(L).map((t=>{if(s(t)){const n=f(e,t,{base:!0},S);return S.eventHandler&&(null===n?I(null===t?{event:{type:["JsonLdEvent"],code:"null @id value",level:"warning",message:"Null @id found.",details:{id:t}},options:S}:{event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:t}},options:S}):b(n)||I({event:{type:["JsonLdEvent"],code:"relative @id reference",level:"warning",message:"Relative @id reference found.",details:{id:t,expandedId:n}},options:S})),n}return t})),{propertyIsArray:S.isFrame});continue}if("@type"===C){o(L)&&(L=Object.fromEntries(Object.entries(L).map((([e,t])=>[f(A,e,{vocab:!0}),x(t).map((e=>f(A,e,{base:!0,vocab:!0},{...S,typeExpansion:!0})))])))),j(L,S.isFrame),_(w,"@type",x(L).map((e=>{if(s(e)){const t=f(A,e,{base:!0,vocab:!0},{...S,typeExpansion:!0});return"@json"===t||b(t)||S.eventHandler&&I({event:{type:["JsonLdEvent"],code:"relative @type reference",level:"warning",message:"Relative @type reference found.",details:{type:e}},options:S}),t}return e})),{propertyIsArray:!!S.isFrame});continue}if("@included"===C&&m(e,1.1)){const n=x(await E.expand({activeCtx:e,activeProperty:t,element:L,options:S}));if(!n.every((e=>h(e))))throw new r("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:L});_(w,"@included",n,{propertyIsArray:!0});continue}if("@graph"===C&&!o(L)&&!i(L))throw new r('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:L});if("@value"===C){M=L,P&&m(e,1.1)?w["@value"]=L:_(w,"@value",L,{propertyIsArray:S.isFrame});continue}if("@language"===C){if(null===L)continue;if(!s(L)&&!S.isFrame)throw new r('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:L});L=x(L).map((e=>s(e)?e.toLowerCase():e));for(const e of L)s(e)&&!e.match(v)&&S.eventHandler&&I({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:e}},options:S});_(w,"@language",L,{propertyIsArray:S.isFrame});continue}if("@direction"===C){if(!s(L)&&!S.isFrame)throw new r('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:L});L=x(L);for(const e of L)if(s(e)&&"ltr"!==e&&"rtl"!==e)throw new r('Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",value:L});_(w,"@direction",L,{propertyIsArray:S.isFrame});continue}if("@index"===C){if(!s(L))throw new r('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:L});_(w,"@index",L);continue}if("@reverse"===C){if(!o(L))throw new r('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:L});if(R=await E.expand({activeCtx:e,activeProperty:"@reverse",element:L,options:S}),"@reverse"in R)for(const e in R["@reverse"])_(w,e,R["@reverse"][e],{propertyIsArray:!0});let t=w["@reverse"]||null;for(const e in R){if("@reverse"===e)continue;null===t&&(t=w["@reverse"]={}),_(t,e,[],{propertyIsArray:!0});const n=R[e];for(let i=0;i<n.length;++i){const o=n[i];if(u(o)||c(o))throw new r('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:R});_(t,e,o,{propertyIsArray:!0})}}continue}if("@nest"===C){D.push(T);continue}let $=e;const B=p(e,T,"@context");l(B)||($=await y({activeCtx:e,localCtx:B,propagate:!0,overrideProtected:!0,options:S}));const F=p(e,T,"@container")||[];if(F.includes("@language")&&o(L))R=O($,L,p($,T,"@direction"),S);else if(F.includes("@index")&&o(L)){const t=F.includes("@graph"),n=p($,T,"@index")||"@index",r="@index"!==n&&f(e,n,{vocab:!0},S);R=await k({activeCtx:$,options:S,activeProperty:T,value:L,asGraph:t,indexKey:n,propertyIndex:r})}else if(F.includes("@id")&&o(L)){const e=F.includes("@graph");R=await k({activeCtx:$,options:S,activeProperty:T,value:L,asGraph:e,indexKey:"@id"})}else if(F.includes("@type")&&o(L))R=await k({activeCtx:$.revertToPreviousContext(),options:S,activeProperty:T,value:L,asGraph:!1,indexKey:"@type"});else{const r="@list"===C;if(r||"@set"===C){let e=t;r&&"@graph"===n&&(e=null),R=await E.expand({activeCtx:$,activeProperty:e,element:L,options:S,insideList:r})}else R="@json"===p(e,T,"@type")?{"@type":"@json","@value":L}:await E.expand({activeCtx:$,activeProperty:T,element:L,options:S,insideList:!1})}if(null!==R||"@value"===C){if("@list"!==C&&!c(R)&&F.includes("@list")&&(R={"@list":x(R)}),F.includes("@graph")&&!F.some((e=>"@id"===e||"@index"===e))){if(R=x(R),S.isFrame||(R=R.filter((e=>null!==N({value:e,count:Object.keys(e).length,options:S})))),0===R.length)continue;R=R.map((e=>({"@graph":x(e)})))}if($.mappings.has(T)&&$.mappings.get(T).reverse){const e=w["@reverse"]=w["@reverse"]||{};R=x(R);for(let t=0;t<R.length;++t){const n=R[t];if(u(n)||c(n))throw new r('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:R});_(e,C,n,{propertyIsArray:!0})}}else _(w,C,R,{propertyIsArray:!0})}}if("@value"in w)if("@json"===w["@type"]&&m(e,1.1));else if((o(M)||i(M))&&!S.isFrame)throw new r('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",value:M});for(const a of D){const s=i(d[a])?d[a]:[d[a]];for(const i of s){if(!o(i)||Object.keys(i).some((t=>"@value"===f(e,t,{vocab:!0},S))))throw new r("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:i});await T({activeCtx:e,activeProperty:t,expandedActiveProperty:n,element:i,expandedParent:w,options:S,insideList:R,typeScopedContext:A,typeKey:L})}}}function R({activeCtx:e,activeProperty:t,value:n,options:r}){if(null==n)return null;const i=f(e,t,{vocab:!0},r);if("@id"===i)return f(e,n,{base:!0},r);if("@type"===i)return f(e,n,{vocab:!0,base:!0},{...r,typeExpansion:!0});const o=p(e,t,"@type");if(("@id"===o||"@graph"===i)&&s(n)){const i=f(e,n,{base:!0},r);return null===i&&n.match(w)&&r.eventHandler&&I({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:t}},options:r}),{"@id":i}}if("@vocab"===o&&s(n))return{"@id":f(e,n,{vocab:!0,base:!0},r)};if(g(i))return n;const a={};if(o&&!["@id","@vocab","@none"].includes(o))a["@type"]=o;else if(s(n)){const n=p(e,t,"@language");null!==n&&(a["@language"]=n);const r=p(e,t,"@direction");null!==r&&(a["@direction"]=r)}return["boolean","number","string"].includes(typeof n)||(n=n.toString()),a["@value"]=n,a}function O(e,t,n,o){const a=[],l=Object.keys(t).sort();for(const c of l){const l=f(e,c,{vocab:!0},o);let u=t[c];i(u)||(u=[u]);for(const e of u){if(null===e)continue;if(!s(e))throw new r("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:t});const i={"@value":e};"@none"!==l&&(c.match(v)||o.eventHandler&&I({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:c}},options:o}),i["@language"]=c.toLowerCase()),n&&(i["@direction"]=n),a.push(i)}}return a}async function k({activeCtx:e,options:t,activeProperty:n,value:o,asGraph:a,indexKey:s,propertyIndex:c}){const h=[],g=Object.keys(o).sort(),m="@type"===s;for(let b of g){if(m){const n=p(e,b,"@context");l(n)||(e=await y({activeCtx:e,localCtx:n,propagate:!1,options:t}))}let g,v=o[b];i(v)||(v=[v]),v=await E.expand({activeCtx:e,activeProperty:n,element:v,options:t,insideList:!1,insideIndex:!0}),g=c?"@none"===b?"@none":R({activeCtx:e,activeProperty:s,value:b,options:t}):f(e,b,{vocab:!0},t),"@id"===s?b=f(e,b,{base:!0},t):m&&(b=g);for(let e of v){if(a&&!d(e)&&(e={"@graph":[e]}),"@type"===s)"@none"===g||(e["@type"]?e["@type"]=[b].concat(e["@type"]):e["@type"]=[b]);else{if(u(e)&&!["@language","@type","@index"].includes(s))throw new r(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${s}".`,"jsonld.SyntaxError",{code:"invalid value object",value:e});c?"@none"!==g&&_(e,c,g,{propertyIsArray:!0,prependValue:!0}):"@none"===g||s in e||(e[s]=b)}h.push(e)}}return h}e.exports=E,E.expand=async({activeCtx:e,activeProperty:t=null,element:n,options:c={},insideList:u=!1,insideIndex:d=!1,typeScopedContext:h=null})=>{if(null==n)return null;if("@default"===t&&(c=Object.assign({},c,{isFrame:!1})),!i(n)&&!o(n))return u||null!==t&&"@graph"!==f(e,t,{vocab:!0},c)?R({activeCtx:e,activeProperty:t,value:n,options:c}):(c.eventHandler&&I({event:{type:["JsonLdEvent"],code:"free-floating scalar",level:"warning",message:"Dropping free-floating scalar not in a list.",details:{value:n}},options:c}),null);if(i(n)){let r=[];const o=p(e,t,"@container")||[];u=u||o.includes("@list");for(let o=0;o<n.length;++o){let a=await E.expand({activeCtx:e,activeProperty:t,element:n[o],options:c,insideIndex:d,typeScopedContext:h});u&&i(a)&&(a={"@list":a}),null!==a&&(i(a)?r=r.concat(a):r.push(a))}return r}const g=f(e,t,{vocab:!0},c),v=p(e,t,"@context");h=h||(e.previousContext?e:null);let w=Object.keys(n).sort(),_=!d;if(_&&h&&w.length<=2&&!w.includes("@context"))for(const t of w){const n=f(h,t,{vocab:!0},c);if("@value"===n){_=!1,e=h;break}if("@id"===n&&1===w.length){_=!1;break}}_&&(e=e.revertToPreviousContext()),l(v)||(e=await y({activeCtx:e,localCtx:v,propagate:!0,overrideProtected:!0,options:c})),"@context"in n&&(e=await y({activeCtx:e,localCtx:n["@context"],options:c})),h=e;let j=null;for(const t of w)if("@type"===f(e,t,{vocab:!0},c)){j=j||t;const r=n[t],i=Array.isArray(r)?r.length>1?r.slice().sort():r:[r];for(const t of i){const n=p(h,t,"@context");l(n)||(e=await y({activeCtx:e,localCtx:n,options:c,propagate:!1}))}}let O={};await T({activeCtx:e,activeProperty:t,expandedActiveProperty:g,element:n,expandedParent:O,options:c,insideList:u,typeKey:j,typeScopedContext:h}),w=Object.keys(O);let k=w.length;if("@value"in O){if("@type"in O&&("@language"in O||"@direction"in O))throw new r('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and either "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:O});let t=k-1;if("@type"in O&&(t-=1),"@index"in O&&(t-=1),"@language"in O&&(t-=1),"@direction"in O&&(t-=1),0!==t)throw new r('Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and either "@type" or either or both "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:O});const n=null===O["@value"]?[]:x(O["@value"]),i=S(O,"@type");if(m(e,1.1)&&i.includes("@json")&&1===i.length);else if(0===n.length)c.eventHandler&&I({event:{type:["JsonLdEvent"],code:"null @value value",level:"warning",message:"Dropping null @value value.",details:{value:O}},options:c}),O=null;else{if(!n.every((e=>s(e)||a(e)))&&"@language"in O)throw new r("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:O});if(!i.every((e=>b(e)&&!(s(e)&&0===e.indexOf("_:"))||a(e))))throw new r('Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".',"jsonld.SyntaxError",{code:"invalid typed value",element:O})}}else if("@type"in O&&!i(O["@type"]))O["@type"]=[O["@type"]];else if("@set"in O||"@list"in O){if(k>1&&(2!==k||!("@index"in O)))throw new r('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',"jsonld.SyntaxError",{code:"invalid set or list object",element:O});"@set"in O&&(O=O["@set"],w=Object.keys(O),k=w.length)}else 1===k&&"@language"in O&&(c.eventHandler&&I({event:{type:["JsonLdEvent"],code:"object with only @language",level:"warning",message:"Dropping object with only @language.",details:{value:O}},options:c}),O=null);return!o(O)||c.keepFreeFloatingNodes||u||null!==t&&"@graph"!==g&&!(p(e,t,"@container")||[]).includes("@graph")||(O=N({value:O,count:k,options:c})),O}},5229:(e,t,n)=>{const{isSubjectReference:r}=n(3978),{createMergedNodeMap:i}=n(9233),o={};e.exports=o,o.flatten=e=>{const t=i(e),n=[],o=Object.keys(t).sort();for(let e=0;e<o.length;++e){const i=t[o[e]];r(i)||n.push(i)}return n}},7946:(e,t,n)=>{const{isKeyword:r}=n(1972),i=n(3978),o=n(7382),a=n(9263),s=n(470),l=n(2207),{createNodeMap:c,mergeNodeMapGraphs:u}=n(9233),d={};function h(e){const t={};for(const n in e)void 0!==e[n]&&(t["@"+n]=[e[n]]);return[t]}function f(e,t,n){for(let r=n.length-1;r>=0;--r){const i=n[r];if(i.graph===t&&i.subject["@id"]===e["@id"])return!0}return!1}function p(e,t,n){const r="@"+n;let i=r in e?e[r][0]:t[n];if("embed"===n)if(!0===i)i="@once";else if(!1===i)i="@never";else if("@always"!==i&&"@never"!==i&&"@link"!==i&&"@first"!==i&&"@last"!==i&&"@once"!==i)throw new l("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:e});return i}function g(e){if(!o.isArray(e)||1!==e.length||!o.isObject(e[0]))throw new l("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:e});if("@id"in e[0])for(const t of a.asArray(e[0]["@id"]))if(!o.isObject(t)&&!s.isAbsolute(t)||o.isString(t)&&0===t.indexOf("_:"))throw new l("Invalid JSON-LD syntax; invalid @id in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:e});if("@type"in e[0])for(const t of a.asArray(e[0]["@type"]))if(!o.isObject(t)&&!s.isAbsolute(t)&&"@json"!==t||o.isString(t)&&0===t.indexOf("_:"))throw new l("Invalid JSON-LD syntax; invalid @type in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:e})}function y(e,t,n,s){let l=!0,c=!1;for(const u in n){let d=!1;const h=a.getValues(t,u),f=0===a.getValues(n,u).length;if("@id"===u){if(o.isEmptyObject(n["@id"][0]||{})?d=!0:n["@id"].length>=0&&(d=n["@id"].includes(h[0])),!s.requireAll)return d}else if("@type"===u){if(l=!1,f){if(h.length>0)return!1;d=!0}else if(1===n["@type"].length&&o.isEmptyObject(n["@type"][0]))d=h.length>0;else for(const e of n["@type"])d=!(!o.isObject(e)||!("@default"in e))||d||h.some((t=>t===e));if(!s.requireAll)return d}else{if(r(u))continue;{const t=a.getValues(n,u)[0];let r=!1;if(t&&(g([t]),r="@default"in t),l=!1,0===h.length&&r)continue;if(h.length>0&&f)return!1;if(void 0===t){if(h.length>0)return!1;d=!0}else if(i.isList(t)){const n=t["@list"][0];if(i.isList(h[0])){const t=h[0]["@list"];i.isValue(n)?d=t.some((e=>_(n,e))):(i.isSubject(n)||i.isSubjectReference(n))&&(d=t.some((t=>w(e,n,t,s))))}}else d=i.isValue(t)?h.some((e=>_(t,e))):i.isSubjectReference(t)?h.some((n=>w(e,t,n,s))):!!o.isObject(t)&&h.length>0}}if(!d&&s.requireAll)return!1;c=c||d}return l||c}function m(e,t){const n=e.uniqueEmbeds[e.graph],r=n[t],i=r.parent,s=r.property,l={"@id":t};if(o.isArray(i)){for(let e=0;e<i.length;++e)if(a.compareValues(i[e],l)){i[e]=l;break}}else{const e=o.isArray(i[s]);a.removeValue(i,s,l,{propertyIsArray:e}),a.addValue(i,s,l,{propertyIsArray:e})}const c=e=>{const t=Object.keys(n);for(const r of t)r in n&&o.isObject(n[r].parent)&&n[r].parent["@id"]===e&&(delete n[r],c(r))};c(t)}function b(e,t){if(o.isArray(e))return e.map((e=>b(e,t)));if(o.isObject(e)){if("@preserve"in e)return e["@preserve"][0];if(i.isValue(e))return e;if(i.isList(e))return e["@list"]=b(e["@list"],t),e;if("@id"in e){const n=e["@id"];if(t.link.hasOwnProperty(n)){const r=t.link[n].indexOf(e);if(-1!==r)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(const n in e)"@id"===n&&t.bnodesToClear.includes(e[n])?delete e["@id"]:e[n]=b(e[n],t)}return e}function v(e,t,n){o.isObject(e)?a.addValue(e,t,n,{propertyIsArray:!0}):e.push(n)}function w(e,t,n,r){if(!("@id"in n))return!1;const i=e.subjects[n["@id"]];return i&&y(e,i,t,r)}function _(e,t){const n=t["@value"],r=t["@type"],i=t["@language"],a=e["@value"]?o.isArray(e["@value"])?e["@value"]:[e["@value"]]:[],s=e["@type"]?o.isArray(e["@type"])?e["@type"]:[e["@type"]]:[],l=e["@language"]?o.isArray(e["@language"])?e["@language"]:[e["@language"]]:[];return 0===a.length&&0===s.length&&0===l.length||!(!a.includes(n)&&!o.isEmptyObject(a[0]))&&!!(!r&&0===s.length||s.includes(r)||r&&o.isEmptyObject(s[0]))&&!!(!i&&0===l.length||l.includes(i)||i&&o.isEmptyObject(l[0]))}e.exports=d,d.frameMergedOrDefault=(e,t,n)=>{const r={options:n,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},i=new a.IdentifierIssuer("_:b");c(e,r.graphMap,"@default",i),n.merged&&(r.graphMap["@merged"]=u(r.graphMap),r.graph="@merged"),r.subjects=r.graphMap[r.graph];const o=[];return d.frame(r,Object.keys(r.subjects).sort(),t,o),n.pruneBlankNodeIdentifiers&&(n.bnodesToClear=Object.keys(r.bnodeMap).filter((e=>1===r.bnodeMap[e].length))),n.link={},b(o,n)},d.frame=(e,t,n,s,c=null)=>{g(n),n=n[0];const u=e.options,b={embed:p(n,u,"embed"),explicit:p(n,u,"explicit"),requireAll:p(n,u,"requireAll")};e.link.hasOwnProperty(e.graph)||(e.link[e.graph]={});const w=e.link[e.graph],x=function(e,t,n,r){const i={};for(const o of t){const t=e.graphMap[e.graph][o];y(e,t,n,r)&&(i[o]=t)}return i}(e,t,n,b),S=Object.keys(x).sort();for(const g of S){const y=x[g];if(null===c?e.uniqueEmbeds={[e.graph]:{}}:e.uniqueEmbeds[e.graph]=e.uniqueEmbeds[e.graph]||{},"@link"===b.embed&&g in w){v(s,c,w[g]);continue}const S={"@id":g};if(0===g.indexOf("_:")&&a.addValue(e.bnodeMap,g,S,{propertyIsArray:!0}),w[g]=S,("@first"===b.embed||"@last"===b.embed)&&e.is11)throw new l("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:n});if(e.embedded||!e.uniqueEmbeds[e.graph].hasOwnProperty(g))if(!e.embedded||"@never"!==b.embed&&!f(y,e.graph,e.subjectStack))if(!e.embedded||"@first"!=b.embed&&"@once"!=b.embed||!e.uniqueEmbeds[e.graph].hasOwnProperty(g)){if("@last"===b.embed&&g in e.uniqueEmbeds[e.graph]&&m(e,g),e.uniqueEmbeds[e.graph][g]={parent:s,property:c},e.subjectStack.push({subject:y,graph:e.graph}),g in e.graphMap){let t=!1,r=null;"@graph"in n?(r=n["@graph"][0],t=!("@merged"===g||"@default"===g),o.isObject(r)||(r={})):(t="@merged"!==e.graph,r={}),t&&d.frame({...e,graph:g,embedded:!1},Object.keys(e.graphMap[g]).sort(),[r],S,"@graph")}"@included"in n&&d.frame({...e,embedded:!1},t,n["@included"],S,"@included");for(const t of Object.keys(y).sort())if(r(t)){if(S[t]=a.clone(y[t]),"@type"===t)for(const t of y["@type"])0===t.indexOf("_:")&&a.addValue(e.bnodeMap,t,S,{propertyIsArray:!0})}else if(!b.explicit||t in n)for(const r of y[t]){const o=t in n?n[t]:h(b);if(i.isList(r)){const o=n[t]&&n[t][0]&&n[t][0]["@list"]?n[t][0]["@list"]:h(b),s={"@list":[]};v(S,t,s);const l=r["@list"];for(const t of l)i.isSubjectReference(t)?d.frame({...e,embedded:!0},[t["@id"]],o,s,"@list"):v(s,"@list",a.clone(t))}else i.isSubjectReference(r)?d.frame({...e,embedded:!0},[r["@id"]],o,S,t):_(o[0],r)&&v(S,t,a.clone(r))}for(const e of Object.keys(n).sort()){if("@type"===e){if(!o.isObject(n[e][0])||!("@default"in n[e][0]))continue}else if(r(e))continue;const t=n[e][0]||{};if(!p(t,u,"omitDefault")&&!(e in S)){let n="@null";"@default"in t&&(n=a.clone(t["@default"])),o.isArray(n)||(n=[n]),S[e]=[{"@preserve":n}]}}for(const t of Object.keys(n["@reverse"]||{}).sort()){const r=n["@reverse"][t];for(const n of Object.keys(e.subjects))a.getValues(e.subjects[n],t).some((e=>e["@id"]===g))&&(S["@reverse"]=S["@reverse"]||{},a.addValue(S["@reverse"],t,[],{propertyIsArray:!0}),d.frame({...e,embedded:!0},[n],r,S["@reverse"][t],c))}v(s,c,S),e.subjectStack.pop()}else v(s,c,S);else v(s,c,S)}},d.cleanupNull=(e,t)=>{if(o.isArray(e))return e.map((e=>d.cleanupNull(e,t))).filter((e=>e));if("@null"===e)return null;if(o.isObject(e)){if("@id"in e){const n=e["@id"];if(t.link.hasOwnProperty(n)){const r=t.link[n].indexOf(e);if(-1!==r)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(const n in e)e[n]=d.cleanupNull(e[n],t)}return e}},3947:(e,t,n)=>{const r=n(2207),i=n(3978),o=n(7382),{REGEX_BCP47:a,addValue:s}=n(9263),{handleEvent:l}=n(2246),{RDF_LIST:c,RDF_FIRST:u,RDF_REST:d,RDF_NIL:h,RDF_TYPE:f,RDF_JSON_LITERAL:p,XSD_BOOLEAN:g,XSD_DOUBLE:y,XSD_INTEGER:m,XSD_STRING:b}=n(9378),v={};function w(e,t,n,i){if(e.termType.endsWith("Node"))return{"@id":e.value};const s={"@value":e.value};if(e.language)e.language.match(a)||i.eventHandler&&l({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:e.language}},options:i}),s["@language"]=e.language;else{let c=e.datatype.value;if(c||(c=b),c===p){c="@json";try{s["@value"]=JSON.parse(s["@value"])}catch(e){throw new r("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:s["@value"],cause:e})}}if(t){if(c===g)"true"===s["@value"]?s["@value"]=!0:"false"===s["@value"]&&(s["@value"]=!1);else if(o.isNumeric(s["@value"]))if(c===m){const e=parseInt(s["@value"],10);e.toFixed(0)===s["@value"]&&(s["@value"]=e)}else c===y&&(s["@value"]=parseFloat(s["@value"]));[g,m,y,b].includes(c)||(s["@type"]=c)}else if("i18n-datatype"===n&&c.startsWith("https://www.w3.org/ns/i18n#")){const[,e,t]=c.split(/[#_]/);e.length>0&&(s["@language"]=e,e.match(a)||i.eventHandler&&l({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:e}},options:i})),s["@direction"]=t}else c!==b&&(s["@type"]=c)}return s}e.exports=v,v.fromRDF=async(e,t)=>{const{useRdfType:n=!1,useNativeTypes:a=!1,rdfDirection:l=null}=t,p={},g={"@default":p},y={};if(l){if("compound-literal"===l)throw new r("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:l});if("i18n-datatype"!==l)throw new r("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:l})}for(const r of e){const e="DefaultGraph"===r.graph.termType?"@default":r.graph.value;e in g||(g[e]={}),"@default"===e||e in p||(p[e]={"@id":e});const i=g[e],o=r.subject.value,c=r.predicate.value,u=r.object;o in i||(i[o]={"@id":o});const d=i[o],m=u.termType.endsWith("Node");if(m&&!(u.value in i)&&(i[u.value]={"@id":u.value}),c===f&&!n&&m){s(d,"@type",u.value,{propertyIsArray:!0});continue}const b=w(u,a,l,t);if(s(d,c,b,{propertyIsArray:!0}),m)if(u.value===h){const e=i[u.value];"usages"in e||(e.usages=[]),e.usages.push({node:d,property:c,value:b})}else u.value in y?y[u.value]=!1:y[u.value]={node:d,property:c,value:b}}for(const e in g){const t=g[e];if(!(h in t))continue;const n=t[h];if(n.usages){for(let e of n.usages){let n=e.node,r=e.property,a=e.value;const s=[],l=[];let h=Object.keys(n).length;for(;r===d&&o.isObject(y[n["@id"]])&&o.isArray(n[u])&&1===n[u].length&&o.isArray(n[d])&&1===n[d].length&&(3===h||4===h&&o.isArray(n["@type"])&&1===n["@type"].length&&n["@type"][0]===c)&&(s.push(n[u][0]),l.push(n["@id"]),e=y[n["@id"]],n=e.node,r=e.property,a=e.value,h=Object.keys(n).length,i.isBlankNode(n)););delete a["@id"],a["@list"]=s.reverse();for(const e of l)delete t[e]}delete n.usages}}const m=[],b=Object.keys(p).sort();for(const e of b){const t=p[e];if(e in g){const n=t["@graph"]=[],r=g[e],o=Object.keys(r).sort();for(const e of o){const t=r[e];i.isSubjectReference(t)||n.push(t)}}i.isSubjectReference(t)||m.push(t)}return m}},3978:(e,t,n)=>{const r=n(7382),i={};e.exports=i,i.isSubject=e=>!(!r.isObject(e)||"@value"in e||"@set"in e||"@list"in e)&&(Object.keys(e).length>1||!("@id"in e)),i.isSubjectReference=e=>r.isObject(e)&&1===Object.keys(e).length&&"@id"in e,i.isValue=e=>r.isObject(e)&&"@value"in e,i.isList=e=>r.isObject(e)&&"@list"in e,i.isGraph=e=>r.isObject(e)&&"@graph"in e&&1===Object.keys(e).filter((e=>"@id"!==e&&"@index"!==e)).length,i.isSimpleGraph=e=>i.isGraph(e)&&!("@id"in e),i.isBlankNode=e=>{if(r.isObject(e)){if("@id"in e){const t=e["@id"];return!r.isString(t)||0===t.indexOf("_:")}return 0===Object.keys(e).length||!("@value"in e||"@set"in e||"@list"in e)}return!1}},4841:(e,t,n)=>{const r=n(989),i=n(701),o=n(9263),a=n(7034),s=o.IdentifierIssuer,l=n(2207),c=n(9749),u=n(8229),{expand:d}=n(4019),{flatten:h}=n(5229),{fromRDF:f}=n(3947),{toRDF:p}=n(9180),{frameMergedOrDefault:g,cleanupNull:y}=n(7946),{isArray:m,isObject:b,isString:v}=n(7382),{isSubjectReference:w}=n(3978),{expandIri:_,getInitialContext:x,process:S,processingMode:j}=n(1972),{compact:I,compactIri:E}=n(1058),{createNodeMap:N,createMergedNodeMap:T,mergeNodeMaps:R}=n(9233),{logEventHandler:O,logWarningEventHandler:k,safeEventHandler:L,setDefaultEventHandler:A,setupEventHandler:C,strictEventHandler:D,unhandledEventHandler:M}=n(2246),P=function(e){const t={},P=new c({max:100});function $(t,{documentLoader:n=e.documentLoader,...r}){if(t&&"compactionMap"in t)throw new l('"compactionMap" not supported.',"jsonld.OptionsError");if(t&&"expansionMap"in t)throw new l('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:n},r,t,{eventHandler:C({options:t})})}return e.compact=async function(t,n,r){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(null===n)throw new l("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(null===t)return null;let i;(r=$(r,{base:v(t)?t:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new s("_:b"),contextResolver:new a({sharedCache:P})})).link&&(r.skipExpansion=!0),r.compactToRelative||delete r.base,i=r.skipExpansion?t:await e.expand(t,r);const c=await e.processContext(x(r),n,r);let u=await I({activeCtx:c,element:i,options:r});r.compactArrays&&!r.graph&&m(u)?1===u.length?u=u[0]:0===u.length&&(u={}):r.graph&&b(u)&&(u=[u]),b(n)&&"@context"in n&&(n=n["@context"]),n=o.clone(n),m(n)||(n=[n]);const d=n;n=[];for(let e=0;e<d.length;++e)(!b(d[e])||Object.keys(d[e]).length>0)&&n.push(d[e]);const h=n.length>0;if(1===n.length&&(n=n[0]),m(u)){const e=E({activeCtx:c,iri:"@graph",relativeTo:{vocab:!0}}),t=u;u={},h&&(u["@context"]=n),u[e]=t}else if(b(u)&&h){const e=u;u={"@context":n};for(const t in e)u[t]=e[t]}return u},e.expand=async function(t,n){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");const r={},i=[];if("expandContext"in(n=$(n,{keepFreeFloatingNodes:!1,contextResolver:new a({sharedCache:P})}))){const e=o.clone(n.expandContext);b(e)&&"@context"in e?r.expandContext=e:r.expandContext={"@context":e},i.push(r.expandContext)}let s;if(v(t)){const o=await e.get(t,n);s=o.documentUrl,r.input=o.document,o.contextUrl&&(r.remoteContext={"@context":o.contextUrl},i.push(r.remoteContext))}else r.input=o.clone(t);"base"in n||(n.base=s||"");let l=x(n);for(const e of i)l=await S({activeCtx:l,localCtx:e,options:n});let c=await d({activeCtx:l,element:r.input,options:n});return b(c)&&"@graph"in c&&1===Object.keys(c).length?c=c["@graph"]:null===c&&(c=[]),m(c)||(c=[c]),c},e.flatten=async function(t,n,r){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");n="function"==typeof n?null:n||null,r=$(r,{base:v(t)?t:"",contextResolver:new a({sharedCache:P})});const i=await e.expand(t,r),o=h(i);return null===n?o:(r.graph=!0,r.skipExpansion=!0,await e.compact(o,n,r))},e.frame=async function(t,n,r){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(r=$(r,{base:v(t)?t:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new a({sharedCache:P})}),v(n)){const t=await e.get(n,r);if(n=t.document,t.contextUrl){let e=n["@context"];e?m(e)?e.push(t.contextUrl):e=[e,t.contextUrl]:e=t.contextUrl,n["@context"]=e}}const i=n&&n["@context"]||{},o=await e.processContext(x(r),i,r);r.hasOwnProperty("omitGraph")||(r.omitGraph=j(o,1.1)),r.hasOwnProperty("pruneBlankNodeIdentifiers")||(r.pruneBlankNodeIdentifiers=j(o,1.1));const s=await e.expand(t,r),l={...r};l.isFrame=!0,l.keepFreeFloatingNodes=!0;const c=await e.expand(n,l),u=Object.keys(n).map((e=>_(o,e,{vocab:!0})));l.merged=!u.includes("@graph"),l.is11=j(o,1.1);const d=g(s,c,l);l.graph=!r.omitGraph,l.skipExpansion=!0,l.link={},l.framing=!0;let h=await e.compact(d,i,l);return l.link={},h=y(h,l),h},e.link=async function(t,n,r){const i={};return n&&(i["@context"]=n),i["@embed"]="@link",e.frame(t,i,r)},e.normalize=e.canonize=async function(t,n){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if("inputFormat"in(n=$(n,{base:v(t)?t:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new a({sharedCache:P})}))){if("application/n-quads"!==n.inputFormat&&"application/nquads"!==n.inputFormat)throw new l("Unknown canonicalization input format.","jsonld.CanonizeError");const e=u.parse(t);return r.canonize(e,n)}const i={...n};delete i.format,i.produceGeneralizedRdf=!1;const o=await e.toRDF(t,i);return r.canonize(o,n)},e.fromRDF=async function(e,n){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");n=$(n,{format:v(e)?"application/n-quads":void 0});const{format:r}=n;let{rdfParser:i}=n;if(r){if(i=i||t[r],!i)throw new l("Unknown input format.","jsonld.UnknownFormat",{format:r})}else i=()=>e;const o=await i(e);return f(o,n)},e.toRDF=async function(t,n){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");let r;r=(n=$(n,{base:v(t)?t:"",skipExpansion:!1,contextResolver:new a({sharedCache:P})})).skipExpansion?t:await e.expand(t,n);const i=p(r,n);if(n.format){if("application/n-quads"===n.format||"application/nquads"===n.format)return u.serialize(i);throw new l("Unknown output format.","jsonld.UnknownFormat",{format:n.format})}return i},e.createNodeMap=async function(t,n){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");n=$(n,{base:v(t)?t:"",contextResolver:new a({sharedCache:P})});const r=await e.expand(t,n);return T(r,n)},e.merge=async function(t,n,r){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!m(t))throw new TypeError('Could not merge, "docs" must be an array.');n="function"==typeof n?null:n||null,r=$(r,{contextResolver:new a({sharedCache:P})});const i=await Promise.all(t.map((t=>{const n={...r};return e.expand(t,n)})));let l=!0;"mergeNodes"in r&&(l=r.mergeNodes);const c=r.issuer||new s("_:b"),u={"@default":{}};for(let e=0;e<i.length;++e){const t=o.relabelBlankNodes(i[e],{issuer:new s("_:b"+e+"-")}),n=l||0===e?u:{"@default":{}};if(N(t,n,"@default",c),n!==u)for(const e in n){const t=n[e];if(!(e in u)){u[e]=t;continue}const r=u[e];for(const e in t)e in r||(r[e]=t[e])}}const d=R(u),h=[],f=Object.keys(d).sort();for(let e=0;e<f.length;++e){const t=d[f[e]];w(t)||h.push(t)}return null===n?h:(r.graph=!0,r.skipExpansion=!0,await e.compact(h,n,r))},Object.defineProperty(e,"documentLoader",{get:()=>e._documentLoader,set:t=>e._documentLoader=t}),e.documentLoader=async e=>{throw new l("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:e})},e.get=async function(t,n){let r;r="function"==typeof n.documentLoader?n.documentLoader:e.documentLoader;const i=await r(t);try{if(!i.document)throw new l("No remote document found at the given URL.","jsonld.NullRemoteDocument");v(i.document)&&(i.document=JSON.parse(i.document))}catch(e){throw new l("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:e,remoteDoc:i})}return i},e.processContext=async function(e,t,n){return n=$(n,{base:"",contextResolver:new a({sharedCache:P})}),null===t?x(n):(t=o.clone(t),b(t)&&"@context"in t||(t={"@context":t}),S({activeCtx:e,localCtx:t,options:n}))},e.getContextValue=n(1972).getContextValue,e.documentLoaders={},e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new l('Unknown document loader type: "'+t+'"',"jsonld.UnknownDocumentLoader",{type:t});e.documentLoader=e.documentLoaders[t].apply(e,Array.prototype.slice.call(arguments,1))},e.registerRDFParser=function(e,n){t[e]=n},e.unregisterRDFParser=function(e){delete t[e]},e.registerRDFParser("application/n-quads",u.parse),e.registerRDFParser("application/nquads",u.parse),e.url=n(470),e.logEventHandler=O,e.logWarningEventHandler=k,e.safeEventHandler=L,e.setDefaultEventHandler=A,e.strictEventHandler=D,e.unhandledEventHandler=M,e.util=o,Object.assign(e,o),e.promises=e,e.RequestQueue=n(3743),e.JsonLdProcessor=n(5445)(e),i.setupGlobals(e),i.setupDocumentLoaders(e),e},$=function(){return P((function(){return $()}))};P($),e.exports=$},9233:(e,t,n)=>{const{isKeyword:r}=n(1972),i=n(3978),o=n(7382),a=n(9263),s=n(2207),l={};e.exports=l,l.createMergedNodeMap=(e,t)=>{const n=(t=t||{}).issuer||new a.IdentifierIssuer("_:b"),r={"@default":{}};return l.createNodeMap(e,r,"@default",n),l.mergeNodeMaps(r)},l.createNodeMap=(e,t,n,c,u,d)=>{if(o.isArray(e)){for(const r of e)l.createNodeMap(r,t,n,c,void 0,d);return}if(!o.isObject(e))return void(d&&d.push(e));if(i.isValue(e)){if("@type"in e){let t=e["@type"];0===t.indexOf("_:")&&(e["@type"]=t=c.getId(t))}return void(d&&d.push(e))}if(d&&i.isList(e)){const r=[];return l.createNodeMap(e["@list"],t,n,c,u,r),void d.push({"@list":r})}if("@type"in e){const t=e["@type"];for(const e of t)0===e.indexOf("_:")&&c.getId(e)}o.isUndefined(u)&&(u=i.isBlankNode(e)?c.getId(e["@id"]):e["@id"]),d&&d.push({"@id":u});const h=t[n],f=h[u]=h[u]||{};f["@id"]=u;const p=Object.keys(e).sort();for(let o of p){if("@id"===o)continue;if("@reverse"===o){const r={"@id":u},o=e["@reverse"];for(const e in o){const s=o[e];for(const o of s){let s=o["@id"];i.isBlankNode(o)&&(s=c.getId(s)),l.createNodeMap(o,t,n,c,s),a.addValue(h[s],e,r,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if("@graph"===o){u in t||(t[u]={}),l.createNodeMap(e[o],t,u,c);continue}if("@included"===o){l.createNodeMap(e[o],t,n,c);continue}if("@type"!==o&&r(o)){if("@index"===o&&o in f&&(e[o]!==f[o]||e[o]["@id"]!==f[o]["@id"]))throw new s("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:f});f[o]=e[o];continue}const d=e[o];if(0===o.indexOf("_:")&&(o=c.getId(o)),0!==d.length)for(let e of d)if("@type"===o&&(e=0===e.indexOf("_:")?c.getId(e):e),i.isSubject(e)||i.isSubjectReference(e)){if("@id"in e&&!e["@id"])continue;const r=i.isBlankNode(e)?c.getId(e["@id"]):e["@id"];a.addValue(f,o,{"@id":r},{propertyIsArray:!0,allowDuplicate:!1}),l.createNodeMap(e,t,n,c,r)}else if(i.isValue(e))a.addValue(f,o,e,{propertyIsArray:!0,allowDuplicate:!1});else if(i.isList(e)){const r=[];l.createNodeMap(e["@list"],t,n,c,u,r),e={"@list":r},a.addValue(f,o,e,{propertyIsArray:!0,allowDuplicate:!1})}else l.createNodeMap(e,t,n,c,u),a.addValue(f,o,e,{propertyIsArray:!0,allowDuplicate:!1});else a.addValue(f,o,[],{propertyIsArray:!0})}},l.mergeNodeMapGraphs=e=>{const t={};for(const n of Object.keys(e).sort())for(const i of Object.keys(e[n]).sort()){const o=e[n][i];i in t||(t[i]={"@id":i});const s=t[i];for(const e of Object.keys(o).sort())if(r(e)&&"@type"!==e)s[e]=a.clone(o[e]);else for(const t of o[e])a.addValue(s,e,a.clone(t),{propertyIsArray:!0,allowDuplicate:!1})}return t},l.mergeNodeMaps=e=>{const t=e["@default"],n=Object.keys(e).sort();for(const r of n){if("@default"===r)continue;const n=e[r];let o=t[r];o?"@graph"in o||(o["@graph"]=[]):t[r]=o={"@id":r,"@graph":[]};const a=o["@graph"];for(const e of Object.keys(n).sort()){const t=n[e];i.isSubjectReference(t)||a.push(t)}}return t}},701:(e,t,n)=>{const r=n(6957),i={};e.exports=i,i.setupDocumentLoaders=function(e){"undefined"!=typeof XMLHttpRequest&&(e.documentLoaders.xhr=r,e.useDocumentLoader("xhr"))},i.setupGlobals=function(e){void 0===globalThis.JsonLdProcessor&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:e.JsonLdProcessor})}},9180:(e,t,n)=>{const{createNodeMap:r}=n(9233),{isKeyword:i}=n(1972),o=n(3978),a=n(2341),s=n(2207),l=n(7382),c=n(9263),{handleEvent:u}=n(2246),{RDF_FIRST:d,RDF_REST:h,RDF_NIL:f,RDF_TYPE:p,RDF_JSON_LITERAL:g,RDF_LANGSTRING:y,XSD_BOOLEAN:m,XSD_DOUBLE:b,XSD_INTEGER:v,XSD_STRING:w}=n(9378),{isAbsolute:_}=n(470),x={};function S(e,t,n,r,o){const a=Object.keys(t).sort();for(const s of a){const a=t[s],l=Object.keys(a).sort();for(let t of l){const l=a[t];if("@type"===t)t=p;else if(i(t))continue;for(const i of l){const a={termType:s.startsWith("_:")?"BlankNode":"NamedNode",value:s};if(!_(s)){o.eventHandler&&u({event:{type:["JsonLdEvent"],code:"relative subject reference",level:"warning",message:"Relative subject reference found.",details:{subject:s}},options:o});continue}const l={termType:t.startsWith("_:")?"BlankNode":"NamedNode",value:t};if(!_(t)){o.eventHandler&&u({event:{type:["JsonLdEvent"],code:"relative predicate reference",level:"warning",message:"Relative predicate reference found.",details:{predicate:t}},options:o});continue}if("BlankNode"===l.termType&&!o.produceGeneralizedRdf){o.eventHandler&&u({event:{type:["JsonLdEvent"],code:"blank node predicate",level:"warning",message:"Dropping blank node predicate.",details:{property:r.getOldIds().find((e=>r.getId(e)===t))}},options:o});continue}const c=j(i,r,e,n,o.rdfDirection,o);c&&e.push({subject:a,predicate:l,object:c,graph:n})}}}}function j(e,t,n,r,i,c){const p={};if(o.isValue(e)){p.termType="Literal",p.value=void 0,p.datatype={termType:"NamedNode"};let t=e["@value"];const n=e["@type"]||null;if("@json"===n)p.value=a(t),p.datatype.value=g;else if(l.isBoolean(t))p.value=t.toString(),p.datatype.value=n||m;else if(l.isDouble(t)||n===b)l.isDouble(t)||(t=parseFloat(t)),p.value=t.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),p.datatype.value=n||b;else if(l.isNumber(t))p.value=t.toFixed(0),p.datatype.value=n||v;else if("@direction"in e&&"i18n-datatype"===i){const n=`https://www.w3.org/ns/i18n#${(e["@language"]||"").toLowerCase()}_${e["@direction"]}`;p.datatype.value=n,p.value=t}else{if("@direction"in e&&"compound-literal"===i)throw new s("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:i});if("@direction"in e&&i)throw new s("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:i});"@language"in e?("@direction"in e&&!i&&c.eventHandler&&u({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:p.value}},options:c}),p.value=t,p.datatype.value=n||y,p.language=e["@language"]):("@direction"in e&&!i&&c.eventHandler&&u({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:p.value}},options:c}),p.value=t,p.datatype.value=n||w)}}else if(o.isList(e)){const o=function(e,t,n,r,i,o){const a={termType:"NamedNode",value:d},s={termType:"NamedNode",value:h},l={termType:"NamedNode",value:f},c=e.pop(),u=c?{termType:"BlankNode",value:t.getId()}:l;let p=u;for(const l of e){const e=j(l,t,n,r,i,o),c={termType:"BlankNode",value:t.getId()};n.push({subject:p,predicate:a,object:e,graph:r}),n.push({subject:p,predicate:s,object:c,graph:r}),p=c}if(c){const e=j(c,t,n,r,i,o);n.push({subject:p,predicate:a,object:e,graph:r}),n.push({subject:p,predicate:s,object:l,graph:r})}return u}(e["@list"],t,n,r,i,c);p.termType=o.termType,p.value=o.value}else{const t=l.isObject(e)?e["@id"]:e;p.termType=t.startsWith("_:")?"BlankNode":"NamedNode",p.value=t}return"NamedNode"!==p.termType||_(p.value)?p:(c.eventHandler&&u({event:{type:["JsonLdEvent"],code:"relative object reference",level:"warning",message:"Relative object reference found.",details:{object:p.value}},options:c}),null)}e.exports=x,x.toRDF=(e,t)=>{const n=new c.IdentifierIssuer("_:b"),i={"@default":{}};r(e,i,"@default",n);const o=[],a=Object.keys(i).sort();for(const e of a){let r;if("@default"===e)r={termType:"DefaultGraph",value:""};else{if(!_(e)){t.eventHandler&&u({event:{type:["JsonLdEvent"],code:"relative graph reference",level:"warning",message:"Relative graph reference found.",details:{graph:e}},options:t});continue}r=e.startsWith("_:")?{termType:"BlankNode"}:{termType:"NamedNode"},r.value=e}S(o,i[e],r,n,t)}return o}},7382:e=>{const t={};e.exports=t,t.isArray=Array.isArray,t.isBoolean=e=>"boolean"==typeof e||"[object Boolean]"===Object.prototype.toString.call(e),t.isDouble=e=>t.isNumber(e)&&(-1!==String(e).indexOf(".")||Math.abs(e)>=1e21),t.isEmptyObject=e=>t.isObject(e)&&0===Object.keys(e).length,t.isNumber=e=>"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e),t.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),t.isObject=e=>"[object Object]"===Object.prototype.toString.call(e),t.isString=e=>"string"==typeof e||"[object String]"===Object.prototype.toString.call(e),t.isUndefined=e=>void 0===e},470:(e,t,n)=>{const r=n(7382),i={};e.exports=i,i.parsers={simple:{keys:["href","scheme","authority","path","query","fragment"],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:["href","protocol","scheme","authority","auth","user","password","hostname","port","path","directory","file","query","fragment"],regex:/^(([a-zA-Z][a-zA-Z0-9+-.]*):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},i.parse=(e,t)=>{const n={},r=i.parsers[t||"full"],o=r.regex.exec(e);let a=r.keys.length;for(;a--;)n[r.keys[a]]=void 0===o[a]?null:o[a];return("https"===n.scheme&&"443"===n.port||"http"===n.scheme&&"80"===n.port)&&(n.href=n.href.replace(":"+n.port,""),n.authority=n.authority.replace(":"+n.port,""),n.port=null),n.normalizedPath=i.removeDotSegments(n.path),n},i.prependBase=(e,t)=>{if(null===e)return t;if(i.isAbsolute(t))return t;e&&!r.isString(e)||(e=i.parse(e||""));const n=i.parse(t),o={protocol:e.protocol||""};if(null!==n.authority)o.authority=n.authority,o.path=n.path,o.query=n.query;else if(o.authority=e.authority,""===n.path)o.path=e.path,null!==n.query?o.query=n.query:o.query=e.query;else{if(0===n.path.indexOf("/"))o.path=n.path;else{let t=e.path;t=t.substr(0,t.lastIndexOf("/")+1),(t.length>0||e.authority)&&"/"!==t.substr(-1)&&(t+="/"),t+=n.path,o.path=t}o.query=n.query}""!==n.path&&(o.path=i.removeDotSegments(o.path));let a=o.protocol;return null!==o.authority&&(a+="//"+o.authority),a+=o.path,null!==o.query&&(a+="?"+o.query),null!==n.fragment&&(a+="#"+n.fragment),""===a&&(a="./"),a},i.removeBase=(e,t)=>{if(null===e)return t;e&&!r.isString(e)||(e=i.parse(e||""));let n="";if(""!==e.href?n+=(e.protocol||"")+"//"+(e.authority||""):t.indexOf("//")&&(n+="//"),0!==t.indexOf(n))return t;const o=i.parse(t.substr(n.length)),a=e.normalizedPath.split("/"),s=o.normalizedPath.split("/"),l=o.fragment||o.query?0:1;for(;a.length>0&&s.length>l&&a[0]===s[0];)a.shift(),s.shift();let c="";if(a.length>0){a.pop();for(let e=0;e<a.length;++e)c+="../"}return c+=s.join("/"),null!==o.query&&(c+="?"+o.query),null!==o.fragment&&(c+="#"+o.fragment),""===c&&(c="./"),c},i.removeDotSegments=e=>{if(0===e.length)return"";const t=e.split("/"),n=[];for(;t.length>0;){const e=t.shift(),r=0===t.length;"."!==e?".."!==e?n.push(e):(n.pop(),r&&n.push("")):r&&n.push("")}return"/"===e[0]&&n.length>0&&""!==n[0]&&n.unshift(""),1===n.length&&""===n[0]?"/":n.join("/")};const o=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;i.isAbsolute=e=>r.isString(e)&&o.test(e),i.isRelative=e=>r.isString(e)},9263:(e,t,n)=>{const r=n(3978),i=n(7382),o=n(989).IdentifierIssuer,a=n(2207),s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,l=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,c=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,u="application/ld+json, application/json",d={};function h(e,t){if(i.isArray(t))for(let n=0;n<t.length;++n)t[n]=h(e,t[n]);else if(r.isList(t))t["@list"]=h(e,t["@list"]);else if(i.isObject(t)){r.isBlankNode(t)&&(t["@id"]=e.getId(t["@id"]));const n=Object.keys(t).sort();for(let r=0;r<n.length;++r){const i=n[r];"@id"!==i&&(t[i]=h(e,t[i]))}}return t}e.exports=d,d.IdentifierIssuer=o,d.REGEX_BCP47=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,d.REGEX_KEYWORD=/^@[a-zA-Z]+$/,d.clone=function(e){if(e&&"object"==typeof e){let t;if(i.isArray(e)){t=[];for(let n=0;n<e.length;++n)t[n]=d.clone(e[n])}else if(e instanceof Map){t=new Map;for(const[n,r]of e)t.set(n,d.clone(r))}else if(e instanceof Set){t=new Set;for(const n of e)t.add(d.clone(n))}else if(i.isObject(e)){t={};for(const n in e)t[n]=d.clone(e[n])}else t=e.toString();return t}return e},d.asArray=function(e){return Array.isArray(e)?e:[e]},d.buildHeaders=(e={})=>{if(Object.keys(e).some((e=>"accept"===e.toLowerCase())))throw new RangeError('Accept header may not be specified; only "'+u+'" is supported.');return Object.assign({Accept:u},e)},d.parseLinkHeader=e=>{const t={},n=e.match(s);for(let e=0;e<n.length;++e){let r=n[e].match(l);if(!r)continue;const i={target:r[1]},o=r[2];for(;r=c.exec(o);)i[r[1]]=void 0===r[2]?r[3]:r[2];const a=i.rel||"";Array.isArray(t[a])?t[a].push(i):t.hasOwnProperty(a)?t[a]=[t[a],i]:t[a]=i}return t},d.validateTypeValue=(e,t)=>{if(!(i.isString(e)||i.isArray(e)&&e.every((e=>i.isString(e))))){if(t&&i.isObject(e))switch(Object.keys(e).length){case 0:return;case 1:if("@default"in e&&d.asArray(e["@default"]).every((e=>i.isString(e))))return}throw new a('Invalid JSON-LD syntax; "@type" value must a string, an array of strings, an empty object, or a default object.',"jsonld.SyntaxError",{code:"invalid type value",value:e})}},d.hasProperty=(e,t)=>{if(e.hasOwnProperty(t)){const n=e[t];return!i.isArray(n)||n.length>0}return!1},d.hasValue=(e,t,n)=>{if(d.hasProperty(e,t)){let o=e[t];const a=r.isList(o);if(i.isArray(o)||a){a&&(o=o["@list"]);for(let e=0;e<o.length;++e)if(d.compareValues(n,o[e]))return!0}else if(!i.isArray(n))return d.compareValues(n,o)}return!1},d.addValue=(e,t,n,r)=>{if("propertyIsArray"in(r=r||{})||(r.propertyIsArray=!1),"valueIsArray"in r||(r.valueIsArray=!1),"allowDuplicate"in r||(r.allowDuplicate=!0),"prependValue"in r||(r.prependValue=!1),r.valueIsArray)e[t]=n;else if(i.isArray(n)){0===n.length&&r.propertyIsArray&&!e.hasOwnProperty(t)&&(e[t]=[]),r.prependValue&&(n=n.concat(e[t]),e[t]=[]);for(let i=0;i<n.length;++i)d.addValue(e,t,n[i],r)}else if(e.hasOwnProperty(t)){const o=!r.allowDuplicate&&d.hasValue(e,t,n);i.isArray(e[t])||o&&!r.propertyIsArray||(e[t]=[e[t]]),o||(r.prependValue?e[t].unshift(n):e[t].push(n))}else e[t]=r.propertyIsArray?[n]:n},d.getValues=(e,t)=>[].concat(e[t]||[]),d.removeProperty=(e,t)=>{delete e[t]},d.removeValue=(e,t,n,r)=>{"propertyIsArray"in(r=r||{})||(r.propertyIsArray=!1);const i=d.getValues(e,t).filter((e=>!d.compareValues(e,n)));0===i.length?d.removeProperty(e,t):1!==i.length||r.propertyIsArray?e[t]=i:e[t]=i[0]},d.relabelBlankNodes=(e,t)=>h((t=t||{}).issuer||new o("_:b"),e),d.compareValues=(e,t)=>e===t||!(!r.isValue(e)||!r.isValue(t)||e["@value"]!==t["@value"]||e["@type"]!==t["@type"]||e["@language"]!==t["@language"]||e["@index"]!==t["@index"])||!!(i.isObject(e)&&"@id"in e&&i.isObject(t)&&"@id"in t)&&e["@id"]===t["@id"],d.compareShortestLeast=(e,t)=>e.length<t.length?-1:t.length<e.length?1:e===t?0:e<t?-1:1},1873:(e,t,n)=>{var r=n(9325).Symbol;e.exports=r},2552:(e,t,n)=>{var r=n(1873),i=n(659),o=n(9350),a=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?i(e):o(e)}},4128:(e,t,n)=>{var r=n(1800),i=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(i,""):e}},4840:(e,t,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},659:(e,t,n)=>{var r=n(1873),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=r?r.toStringTag:void 0;e.exports=function(e){var t=o.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(e){}var i=a.call(e);return r&&(t?e[s]=n:delete e[s]),i}},9350:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},9325:(e,t,n)=>{var r=n(4840),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();e.exports=o},1800:e=>{var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},2177:(e,t,n)=>{var r=n(1489);e.exports=function(e,t){var n;if("function"!=typeof t)throw new TypeError("Expected a function");return e=r(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}},3805:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},4394:(e,t,n)=>{var r=n(2552),i=n(346);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==r(e)}},8059:(e,t,n)=>{var r=n(2177);e.exports=function(e){return r(2,e)}},7400:(e,t,n)=>{var r=n(9374),i=1/0;e.exports=function(e){return e?(e=r(e))===i||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},1489:(e,t,n)=>{var r=n(7400);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},9374:(e,t,n)=>{var r=n(4128),i=n(3805),o=n(4394),a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(o(e))return NaN;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=s.test(e);return n||l.test(e)?c(e.slice(2),n?2:8):a.test(e)?NaN:+e}},9749:(e,t,n)=>{const r=n(8799),i=Symbol("max"),o=Symbol("length"),a=Symbol("lengthCalculator"),s=Symbol("allowStale"),l=Symbol("maxAge"),c=Symbol("dispose"),u=Symbol("noDisposeOnSet"),d=Symbol("lruList"),h=Symbol("cache"),f=Symbol("updateAgeOnGet"),p=()=>1,g=(e,t,n)=>{const r=e[h].get(t);if(r){const t=r.value;if(y(e,t)){if(b(e,r),!e[s])return}else n&&(e[f]&&(r.value.now=Date.now()),e[d].unshiftNode(r));return t.value}},y=(e,t)=>{if(!t||!t.maxAge&&!e[l])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[l]&&n>e[l]},m=e=>{if(e[o]>e[i])for(let t=e[d].tail;e[o]>e[i]&&null!==t;){const n=t.prev;b(e,t),t=n}},b=(e,t)=>{if(t){const n=t.value;e[c]&&e[c](n.key,n.value),e[o]-=n.length,e[h].delete(n.key),e[d].removeNode(t)}};class v{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}}const w=(e,t,n,r)=>{let i=n.value;y(e,i)&&(b(e,n),e[s]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[i]=e.max||1/0;const t=e.length||p;if(this[a]="function"!=typeof t?p:t,this[s]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[l]=e.maxAge||0,this[c]=e.dispose,this[u]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,m(this)}get max(){return this[i]}set allowStale(e){this[s]=!!e}get allowStale(){return this[s]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[l]=e,m(this)}get maxAge(){return this[l]}set lengthCalculator(e){"function"!=typeof e&&(e=p),e!==this[a]&&(this[a]=e,this[o]=0,this[d].forEach((e=>{e.length=this[a](e.value,e.key),this[o]+=e.length}))),m(this)}get lengthCalculator(){return this[a]}get length(){return this[o]}get itemCount(){return this[d].length}rforEach(e,t){t=t||this;for(let n=this[d].tail;null!==n;){const r=n.prev;w(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[d].head;null!==n;){const r=n.next;w(this,e,n,t),n=r}}keys(){return this[d].toArray().map((e=>e.key))}values(){return this[d].toArray().map((e=>e.value))}reset(){this[c]&&this[d]&&this[d].length&&this[d].forEach((e=>this[c](e.key,e.value))),this[h]=new Map,this[d]=new r,this[o]=0}dump(){return this[d].map((e=>!y(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[d]}set(e,t,n){if((n=n||this[l])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const r=n?Date.now():0,s=this[a](t,e);if(this[h].has(e)){if(s>this[i])return b(this,this[h].get(e)),!1;const a=this[h].get(e).value;return this[c]&&(this[u]||this[c](e,a.value)),a.now=r,a.maxAge=n,a.value=t,this[o]+=s-a.length,a.length=s,this.get(e),m(this),!0}const f=new v(e,t,s,r,n);return f.length>this[i]?(this[c]&&this[c](e,t),!1):(this[o]+=f.length,this[d].unshift(f),this[h].set(e,this[d].head),m(this),!0)}has(e){if(!this[h].has(e))return!1;const t=this[h].get(e).value;return!y(this,t)}get(e){return g(this,e,!0)}peek(e){return g(this,e,!1)}pop(){const e=this[d].tail;return e?(b(this,e),e.value):null}del(e){b(this,this[h].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{const e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[h].forEach(((e,t)=>g(this,t,!1)))}}},5606:e=>{var t,n,r=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var s,l=[],c=!1,u=-1;function d(){c&&s&&(c=!1,s.length?l=s.concat(l):u=-1,l.length&&h())}function h(){if(!c){var e=a(d);c=!0;for(var t=l.length;t;){for(s=l,l=[];++u<t;)s&&s[u].run();u=-1,t=l.length}s=null,c=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{return n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function p(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new f(e,t)),1!==l.length||c||a(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=p,r.addListener=p,r.once=p,r.off=p,r.removeListener=p,r.removeAllListeners=p,r.emit=p,r.prependListener=p,r.prependOnceListener=p,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},9596:(e,t,n)=>{let r;e.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:n.g):e=>(r||(r=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)))},989:(e,t,n)=>{e.exports=n(4005)},2985:e=>{e.exports=class e{constructor(e,t=new Map,n=0){this.prefix=e,this._existing=t,this.counter=n}clone(){const{prefix:t,_existing:n,counter:r}=this;return new e(t,new Map(n),r)}getId(e){const t=e&&this._existing.get(e);if(t)return t;const n=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,n),n}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}}},3751:(e,t,n)=>{n(2791);const r=self.crypto||self.msCrypto;e.exports=class{constructor(e){if(!r||!r.subtle)throw new Error("crypto.subtle not found.");if("sha256"===e)this.algorithm={name:"SHA-256"};else{if("sha1"!==e)throw new Error(`Unsupported algorithm "${e}".`);this.algorithm={name:"SHA-1"}}this._content=""}update(e){this._content+=e}async digest(){const e=(new TextEncoder).encode(this._content),t=new Uint8Array(await r.subtle.digest(this.algorithm,e));let n="";for(let e=0;e<t.length;++e)n+=t[e].toString(16).padStart(2,"0");return n}}},1227:e=>{const t="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",n="http://www.w3.org/2001/XMLSchema#string",r="NamedNode",i="BlankNode",o="Literal",a="DefaultGraph",s={};(()=>{const e="(?:<([^:]+:[^>]*)>)",t="A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_",n=t+"0-9-·̀-ͯ‿-⁀",r="(_:(?:["+t+"0-9])(?:(?:["+n+".])*(?:["+n+"]))?)",i="[ \\t]+",o="[ \\t]*",a="(?:"+e+"|"+r+")"+i,l=e+i,c="(?:"+e+"|"+r+'|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^'+e+")|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))"+o,u="(?:\\.|(?:(?:"+e+"|"+r+")"+o+"\\.))";s.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,s.empty=new RegExp("^"+o+"$"),s.quad=new RegExp("^"+o+a+l+c+u+o+"$")})(),e.exports=class e{static parse(e){const l=[],u={},d=e.split(s.eoln);let h=0;for(const e of d){if(h++,s.empty.test(e))continue;const d=e.match(s.quad);if(null===d)throw new Error("N-Quads parse error on line "+h+".");const g={subject:null,predicate:null,object:null,graph:null};if(void 0!==d[1]?g.subject={termType:r,value:d[1]}:g.subject={termType:i,value:d[2]},g.predicate={termType:r,value:d[3]},void 0!==d[4]?g.object={termType:r,value:d[4]}:void 0!==d[5]?g.object={termType:i,value:d[5]}:(g.object={termType:o,value:void 0,datatype:{termType:r}},void 0!==d[7]?g.object.datatype.value=d[7]:void 0!==d[8]?(g.object.datatype.value=t,g.object.language=d[8]):g.object.datatype.value=n,g.object.value=d[6].replace(c,(function(e,t,n,r){if(t)switch(t){case"t":return"\t";case"b":return"\b";case"n":return"\n";case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(n)return String.fromCharCode(parseInt(n,16));if(r)throw new Error("Unsupported U escape")}))),void 0!==d[9]?g.graph={termType:r,value:d[9]}:void 0!==d[10]?g.graph={termType:i,value:d[10]}:g.graph={termType:a,value:""},g.graph.value in u){let e=!0;const t=u[g.graph.value];for(const n of t)if(p=g,(f=n).subject.termType===p.subject.termType&&f.object.termType===p.object.termType&&f.subject.value===p.subject.value&&f.predicate.value===p.predicate.value&&f.object.value===p.object.value&&(f.object.termType!==o||f.object.datatype.termType===p.object.datatype.termType&&f.object.language===p.object.language&&f.object.datatype.value===p.object.datatype.value)){e=!1;break}e&&(t.push(g),l.push(g))}else u[g.graph.value]=[g],l.push(g)}var f,p;return l}static serialize(t){Array.isArray(t)||(t=e.legacyDatasetToQuads(t));const n=[];for(const r of t)n.push(e.serializeQuad(r));return n.sort().join("")}static serializeQuadComponents(e,o,a,s){let c="";return e.termType===r?c+=`<${e.value}>`:c+=`${e.value}`,c+=` <${o.value}> `,a.termType===r?c+=`<${a.value}>`:a.termType===i?c+=a.value:(c+=`"${function(e){return e.replace(l,(function(e){switch(e){case'"':return'\\"';case"\\":return"\\\\";case"\n":return"\\n";case"\r":return"\\r"}}))}(a.value)}"`,a.datatype.value===t?a.language&&(c+=`@${a.language}`):a.datatype.value!==n&&(c+=`^^<${a.datatype.value}>`)),s.termType===r?c+=` <${s.value}>`:s.termType===i&&(c+=` ${s.value}`),c+=" .\n",c}static serializeQuad(t){return e.serializeQuadComponents(t.subject,t.predicate,t.object,t.graph)}static legacyDatasetToQuads(e){const s=[],l={"blank node":i,IRI:r,literal:o};for(const c in e)e[c].forEach((e=>{const u={};for(const i in e){const a=e[i],s={termType:l[a.type],value:a.value};s.termType===o&&(s.datatype={termType:r},"datatype"in a&&(s.datatype.value=a.datatype),"language"in a?("datatype"in a||(s.datatype.value=t),s.language=a.language):"datatype"in a||(s.datatype.value=n)),u[i]=s}u.graph="@default"===c?{termType:a,value:""}:{termType:c.startsWith("_:")?i:r,value:c},s.push(u)}));return s}};const l=/["\\\n\r]/g,c=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g},9925:e=>{e.exports=class{constructor(e){this.current=e.sort(),this.done=!1,this.dir=new Map;for(let t=0;t<e.length;++t)this.dir.set(e[t],!0)}hasNext(){return!this.done}next(){const{current:e,dir:t}=this,n=e.slice();let r=null,i=0;const o=e.length;for(let n=0;n<o;++n){const a=e[n],s=t.get(a);(null===r||a>r)&&(s&&n>0&&a>e[n-1]||!s&&n<o-1&&a>e[n+1])&&(r=a,i=n)}if(null===r)this.done=!0;else{const n=t.get(r)?i-1:i+1;e[i]=e[n],e[n]=r;for(const n of e)n>r&&t.set(n,!t.get(n))}return n}}},3513:(e,t,n)=>{const r=n(2985),i=n(3751),o=n(9925),a=n(1227);function s(e,t){return e.hash<t.hash?-1:e.hash>t.hash?1:0}e.exports=class{constructor({createMessageDigest:e=()=>new i("sha256"),canonicalIdMap:t=new Map,maxDeepIterations:n=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",t),this.createMessageDigest=e,this.maxDeepIterations=n,this.quads=null,this.deepIterations=null}async main(e){this.deepIterations=new Map,this.quads=e;for(const t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});const t=new Map,n=[...this.blankNodeInfo.keys()];let i=0;for(const e of n)++i%100==0&&await this._yield(),await this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});const o=[...t.keys()].sort(),l=[];for(const e of o){const n=t.get(e);if(n.length>1){l.push(n);continue}const r=n[0];this.canonicalIssuer.getId(r)}for(const e of l){const t=[];for(const n of e){if(this.canonicalIssuer.hasId(n))continue;const e=new r("_:b");e.getId(n);const i=await this.hashNDegreeQuads(n,e);t.push(i)}t.sort(s);for(const e of t){const t=e.issuer.getOldIds();for(const e of t)this.canonicalIssuer.getId(e)}}const c=[];for(const e of this.quads){const t=a.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));c.push(t)}return c.sort(),c.join("")}async hashFirstDegreeQuads(e){const t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(const n of r){const r={subject:null,predicate:n.predicate,object:null,graph:null};r.subject=this.modifyFirstDegreeComponent(e,n.subject,"subject"),r.object=this.modifyFirstDegreeComponent(e,n.object,"object"),r.graph=this.modifyFirstDegreeComponent(e,n.graph,"graph"),t.push(a.serializeQuad(r))}t.sort();const i=this.createMessageDigest();for(const e of t)i.update(e);return n.hash=await i.digest(),n.hash}async hashRelatedBlankNode(e,t,n,r){let i;i=this.canonicalIssuer.hasId(e)?this.canonicalIssuer.getId(e):n.hasId(e)?n.getId(e):this.blankNodeInfo.get(e).hash;const o=this.createMessageDigest();return o.update(r),"g"!==r&&o.update(this.getRelatedPredicate(t)),o.update(i),o.digest()}async hashNDegreeQuads(e,t){const n=this.deepIterations.get(e)||0;if(n>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(e,n+1);const r=this.createMessageDigest(),i=await this.createHashToRelated(e,t),a=[...i.keys()].sort();for(const e of a){r.update(e);let n,a="";const s=new o(i.get(e));let l=0;for(;s.hasNext();){const e=s.next();++l%3==0&&await this._yield();let r=t.clone(),i="";const o=[];let c=!1;for(const t of e)if(this.canonicalIssuer.hasId(t)?i+=this.canonicalIssuer.getId(t):(r.hasId(t)||o.push(t),i+=r.getId(t)),0!==a.length&&i>a){c=!0;break}if(!c){for(const e of o){const t=await this.hashNDegreeQuads(e,r);if(i+=r.getId(e),i+=`<${t.hash}>`,r=t.issuer,0!==a.length&&i>a){c=!0;break}}c||(0===a.length||i<a)&&(a=i,n=r)}}r.update(a),t=n}return{hash:await r.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return"BlankNode"!==t.termType?t:{termType:"BlankNode",value:t.value===e?"_:a":"_:z"}}getRelatedPredicate(e){return`<${e.predicate.value}>`}async createHashToRelated(e,t){const n=new Map,r=this.blankNodeInfo.get(e).quads;let i=0;for(const o of r)++i%100==0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:o,component:o.subject,position:"s",id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:o,component:o.object,position:"o",id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:o,component:o.graph,position:"g",id:e,issuer:t,hashToRelated:n})]);return n}async _hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){const n=await this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if("BlankNode"!==t.termType)return;const n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}async _addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:o}){if("BlankNode"!==t.termType||t.value===r)return;const a=t.value,s=await this.hashRelatedBlankNode(a,e,i,n),l=o.get(s);l?l.push(a):o.set(s,[a])}_componentWithCanonicalId(e){return"BlankNode"!==e.termType||e.value.startsWith(this.canonicalIssuer.prefix)?e:{termType:"BlankNode",value:this.canonicalIssuer.getId(e.value)}}async _yield(){return new Promise((e=>setImmediate(e)))}}},2438:(e,t,n)=>{const r=n(2985),i=n(3751),o=n(9925),a=n(1227);function s(e,t){return e.hash<t.hash?-1:e.hash>t.hash?1:0}e.exports=class{constructor({createMessageDigest:e=()=>new i("sha256"),canonicalIdMap:t=new Map,maxDeepIterations:n=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",t),this.createMessageDigest=e,this.maxDeepIterations=n,this.quads=null,this.deepIterations=null}main(e){this.deepIterations=new Map,this.quads=e;for(const t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});const t=new Map,n=[...this.blankNodeInfo.keys()];for(const e of n)this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});const i=[...t.keys()].sort(),o=[];for(const e of i){const n=t.get(e);if(n.length>1){o.push(n);continue}const r=n[0];this.canonicalIssuer.getId(r)}for(const e of o){const t=[];for(const n of e){if(this.canonicalIssuer.hasId(n))continue;const e=new r("_:b");e.getId(n);const i=this.hashNDegreeQuads(n,e);t.push(i)}t.sort(s);for(const e of t){const t=e.issuer.getOldIds();for(const e of t)this.canonicalIssuer.getId(e)}}const l=[];for(const e of this.quads){const t=a.serializeQuadComponents(this._componentWithCanonicalId({component:e.subject}),e.predicate,this._componentWithCanonicalId({component:e.object}),this._componentWithCanonicalId({component:e.graph}));l.push(t)}return l.sort(),l.join("")}hashFirstDegreeQuads(e){const t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(const n of r){const r={subject:null,predicate:n.predicate,object:null,graph:null};r.subject=this.modifyFirstDegreeComponent(e,n.subject,"subject"),r.object=this.modifyFirstDegreeComponent(e,n.object,"object"),r.graph=this.modifyFirstDegreeComponent(e,n.graph,"graph"),t.push(a.serializeQuad(r))}t.sort();const i=this.createMessageDigest();for(const e of t)i.update(e);return n.hash=i.digest(),n.hash}hashRelatedBlankNode(e,t,n,r){let i;i=this.canonicalIssuer.hasId(e)?this.canonicalIssuer.getId(e):n.hasId(e)?n.getId(e):this.blankNodeInfo.get(e).hash;const o=this.createMessageDigest();return o.update(r),"g"!==r&&o.update(this.getRelatedPredicate(t)),o.update(i),o.digest()}hashNDegreeQuads(e,t){const n=this.deepIterations.get(e)||0;if(n>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(e,n+1);const r=this.createMessageDigest(),i=this.createHashToRelated(e,t),a=[...i.keys()].sort();for(const e of a){r.update(e);let n,a="";const s=new o(i.get(e));for(;s.hasNext();){const e=s.next();let r=t.clone(),i="";const o=[];let l=!1;for(const t of e)if(this.canonicalIssuer.hasId(t)?i+=this.canonicalIssuer.getId(t):(r.hasId(t)||o.push(t),i+=r.getId(t)),0!==a.length&&i>a){l=!0;break}if(!l){for(const e of o){const t=this.hashNDegreeQuads(e,r);if(i+=r.getId(e),i+=`<${t.hash}>`,r=t.issuer,0!==a.length&&i>a){l=!0;break}}l||(0===a.length||i<a)&&(a=i,n=r)}}r.update(a),t=n}return{hash:r.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return"BlankNode"!==t.termType?t:{termType:"BlankNode",value:t.value===e?"_:a":"_:z"}}getRelatedPredicate(e){return`<${e.predicate.value}>`}createHashToRelated(e,t){const n=new Map,r=this.blankNodeInfo.get(e).quads;for(const i of r)this._addRelatedBlankNodeHash({quad:i,component:i.subject,position:"s",id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.object,position:"o",id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.graph,position:"g",id:e,issuer:t,hashToRelated:n});return n}_hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){const n=this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if("BlankNode"!==t.termType)return;const n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}_addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:o}){if("BlankNode"!==t.termType||t.value===r)return;const a=t.value,s=this.hashRelatedBlankNode(a,e,i,n),l=o.get(s);l?l.push(a):o.set(s,[a])}_componentWithCanonicalId({component:e}){return"BlankNode"!==e.termType||e.value.startsWith(this.canonicalIssuer.prefix)?e:{termType:"BlankNode",value:this.canonicalIssuer.getId(e.value)}}}},3845:(e,t,n)=>{const r=n(3751),i=n(3513);e.exports=class extends i{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new r("sha1")}modifyFirstDegreeComponent(e,t,n){return"BlankNode"!==t.termType?t:"graph"===n?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:t.value===e?"_:a":"_:z"}}getRelatedPredicate(e){return e.predicate.value}async createHashToRelated(e,t){const n=new Map,r=this.blankNodeInfo.get(e).quads;let i=0;for(const o of r){let r,a;if("BlankNode"===o.subject.termType&&o.subject.value!==e)a=o.subject.value,r="p";else{if("BlankNode"!==o.object.termType||o.object.value===e)continue;a=o.object.value,r="r"}++i%100==0&&await this._yield();const s=await this.hashRelatedBlankNode(a,o,t,r),l=n.get(s);l?l.push(a):n.set(s,[a])}return n}}},378:(e,t,n)=>{const r=n(3751),i=n(2438);e.exports=class extends i{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new r("sha1")}modifyFirstDegreeComponent(e,t,n){return"BlankNode"!==t.termType?t:"graph"===n?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:t.value===e?"_:a":"_:z"}}getRelatedPredicate(e){return e.predicate.value}createHashToRelated(e,t){const n=new Map,r=this.blankNodeInfo.get(e).quads;for(const i of r){let r,o;if("BlankNode"===i.subject.termType&&i.subject.value!==e)o=i.subject.value,r="p";else{if("BlankNode"!==i.object.termType||i.object.value===e)continue;o=i.object.value,r="r"}const a=this.hashRelatedBlankNode(o,i,t,r),s=n.get(a);s?s.push(o):n.set(a,[o])}return n}}},4005:(e,t,n)=>{const r=n(3513),i=n(3845),o=n(2438),a=n(378);let s;try{s=n(7789)}catch(e){}function l(e){return Array.isArray(e)?e:t.NQuads.legacyDatasetToQuads(e)}t.NQuads=n(1227),t.IdentifierIssuer=n(2985),t._rdfCanonizeNative=function(e){return e&&(s=e),s},t.canonize=async function(e,t){const n=l(e);if(t.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(t.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return new Promise(((e,r)=>s.canonize(n,t,((t,n)=>t?r(t):e(n)))))}if("URDNA2015"===t.algorithm)return new r(t).main(n);if("URGNA2012"===t.algorithm){if(t.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new i(t).main(n)}if(!("algorithm"in t))throw new Error("No RDF Dataset Canonicalization algorithm specified.");throw new Error("Invalid RDF Dataset Canonicalization algorithm: "+t.algorithm)},t._canonizeSync=function(e,t){const n=l(e);if(t.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(t.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return s.canonizeSync(n,t)}if("URDNA2015"===t.algorithm)return new o(t).main(n);if("URGNA2012"===t.algorithm){if(t.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new a(t).main(n)}if(!("algorithm"in t))throw new Error("No RDF Dataset Canonicalization algorithm specified.");throw new Error("Invalid RDF Dataset Canonicalization algorithm: "+t.algorithm)}},7793:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(9931),t),i(n(8483),t),i(n(2142),t),i(n(2426),t),i(n(3988),t),i(n(6754),t),i(n(8401),t)},9931:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BlankNode=void 0,t.BlankNode=class{constructor(e){this.termType="BlankNode",this.value=e}equals(e){return!!e&&"BlankNode"===e.termType&&e.value===this.value}}},8483:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DataFactory=void 0;const r=n(9931),i=n(2142),o=n(2426),a=n(3988),s=n(6754),l=n(8401);let c=0;t.DataFactory=class{constructor(e){this.blankNodeCounter=0,e=e||{},this.blankNodePrefix=e.blankNodePrefix||`df_${c++}_`}namedNode(e){return new a.NamedNode(e)}blankNode(e){return new r.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new o.Literal(e,t)}variable(e){return new l.Variable(e)}defaultGraph(){return i.DefaultGraph.INSTANCE}quad(e,t,n,r){return new s.Quad(e,t,n,r||this.defaultGraph())}fromTerm(e){switch(e.termType){case"NamedNode":return this.namedNode(e.value);case"BlankNode":return this.blankNode(e.value);case"Literal":return e.language?this.literal(e.value,e.language):e.datatype.equals(o.Literal.XSD_STRING)?this.literal(e.value):this.literal(e.value,this.fromTerm(e.datatype));case"Variable":return this.variable(e.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(e.subject),this.fromTerm(e.predicate),this.fromTerm(e.object),this.fromTerm(e.graph))}}fromQuad(e){return this.fromTerm(e)}resetBlankNodeCounter(){this.blankNodeCounter=0}}},2142:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultGraph=void 0;class n{constructor(){this.termType="DefaultGraph",this.value=""}equals(e){return!!e&&"DefaultGraph"===e.termType}}t.DefaultGraph=n,n.INSTANCE=new n},2426:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Literal=void 0;const r=n(3988);class i{constructor(e,t){this.termType="Literal",this.value=e,"string"==typeof t?(this.language=t,this.datatype=i.RDF_LANGUAGE_STRING):t?(this.language="",this.datatype=t):(this.language="",this.datatype=i.XSD_STRING)}equals(e){return!!e&&"Literal"===e.termType&&e.value===this.value&&e.language===this.language&&this.datatype.equals(e.datatype)}}t.Literal=i,i.RDF_LANGUAGE_STRING=new r.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),i.XSD_STRING=new r.NamedNode("http://www.w3.org/2001/XMLSchema#string")},3988:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NamedNode=void 0,t.NamedNode=class{constructor(e){this.termType="NamedNode",this.value=e}equals(e){return!!e&&"NamedNode"===e.termType&&e.value===this.value}}},6754:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Quad=void 0,t.Quad=class{constructor(e,t,n,r){this.termType="Quad",this.value="",this.subject=e,this.predicate=t,this.object=n,this.graph=r}equals(e){return!!e&&("Quad"===e.termType||!e.termType)&&this.subject.equals(e.subject)&&this.predicate.equals(e.predicate)&&this.object.equals(e.object)&&this.graph.equals(e.graph)}}},8401:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Variable=void 0,t.Variable=class{constructor(e){this.termType="Variable",this.value=e}equals(e){return!!e&&"Variable"===e.termType&&e.value===this.value}}},9349:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.getSupportedJavaScriptPrimitives=t.getSupportedRdfDatatypes=t.getTermRaw=t.toRdf=t.fromRdf=void 0;const o=n(7793),a=n(4802),s=n(103);i(n(4802),t),i(n(5448),t),i(n(103),t);const l=new o.DataFactory,c=new s.Translator;function u(e,t){return c.fromRdf(e,t)}c.registerHandler(new a.TypeHandlerString,a.TypeHandlerString.TYPES.map((e=>l.namedNode(e))),["string"]),c.registerHandler(new a.TypeHandlerBoolean,[a.TypeHandlerBoolean.TYPE].map((e=>l.namedNode(e))),["boolean"]),c.registerHandler(new a.TypeHandlerNumberDouble,a.TypeHandlerNumberDouble.TYPES.map((e=>l.namedNode(e))),["number"]),c.registerHandler(new a.TypeHandlerNumberInteger,a.TypeHandlerNumberInteger.TYPES.map((e=>l.namedNode(e))),["number"]),c.registerHandler(new a.TypeHandlerDate,a.TypeHandlerDate.TYPES.map((e=>l.namedNode(e))),["object"]),t.fromRdf=u,t.toRdf=function(e,t){return t&&"namedNode"in t&&(t={dataFactory:t}),(t=t||{})&&!t.dataFactory&&(t.dataFactory=l),c.toRdf(e,t)},t.getTermRaw=function(e,t){return"Literal"===e.termType?u(e,t):e.value},t.getSupportedRdfDatatypes=function(){return c.getSupportedRdfDatatypes()},t.getSupportedJavaScriptPrimitives=function(){return c.getSupportedJavaScriptPrimitives()}},5448:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},103:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Translator=void 0,t.Translator=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(e){throw new Error(`Invalid RDF ${e.datatype.value} value: '${e.value}'`)}registerHandler(e,t,n){for(const n of t)this.supportedRdfDatatypes.push(n),this.fromRdfHandlers[n.value]=e;for(const t of n){let n=this.toRdfHandlers[t];n||(this.toRdfHandlers[t]=n=[]),n.push(e)}}fromRdf(e,t){const n=this.fromRdfHandlers[e.datatype.value];return n?n.fromRdf(e,t):e.value}toRdf(e,t){const n=this.toRdfHandlers[typeof e];if(n)for(const r of n){const n=r.toRdf(e,t);if(n)return n}throw new Error(`Invalid JavaScript value: '${e}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}}},92:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TypeHandlerBoolean=void 0;const r=n(103);class i{fromRdf(e,t){switch(e.value){case"true":case"1":return!0;case"false":case"0":return!1}return t&&r.Translator.incorrectRdfDataType(e),!1}toRdf(e,{datatype:t,dataFactory:n}){return n.literal(e?"true":"false",t||n.namedNode(i.TYPE))}}i.TYPE="http://www.w3.org/2001/XMLSchema#boolean",t.TypeHandlerBoolean=i},7258:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TypeHandlerDate=void 0;const r=n(103);class i{fromRdf(e,t){switch(t&&!e.value.match(i.VALIDATORS[e.datatype.value.substr(33,e.datatype.value.length)])&&r.Translator.incorrectRdfDataType(e),e.datatype.value){case"http://www.w3.org/2001/XMLSchema#gDay":return new Date(0,0,parseInt(e.value,10));case"http://www.w3.org/2001/XMLSchema#gMonthDay":const t=e.value.split("-");return new Date(0,parseInt(t[0],10)-1,parseInt(t[1],10));case"http://www.w3.org/2001/XMLSchema#gYear":return new Date(e.value+"-01-01");case"http://www.w3.org/2001/XMLSchema#gYearMonth":return new Date(e.value+"-01");default:return new Date(e.value)}}toRdf(e,{datatype:t,dataFactory:n}){if(t=t||n.namedNode(i.TYPES[0]),!(e instanceof Date))return null;const r=e;let o;switch(t.value){case"http://www.w3.org/2001/XMLSchema#gDay":o=String(r.getUTCDate());break;case"http://www.w3.org/2001/XMLSchema#gMonthDay":o=r.getUTCMonth()+1+"-"+r.getUTCDate();break;case"http://www.w3.org/2001/XMLSchema#gYear":o=String(r.getUTCFullYear());break;case"http://www.w3.org/2001/XMLSchema#gYearMonth":o=r.getUTCFullYear()+"-"+(r.getUTCMonth()+1);break;case"http://www.w3.org/2001/XMLSchema#date":o=r.toISOString().replace(/T.*$/,"");break;default:o=r.toISOString()}return n.literal(o,t)}}i.TYPES=["http://www.w3.org/2001/XMLSchema#dateTime","http://www.w3.org/2001/XMLSchema#date","http://www.w3.org/2001/XMLSchema#gDay","http://www.w3.org/2001/XMLSchema#gMonthDay","http://www.w3.org/2001/XMLSchema#gYear","http://www.w3.org/2001/XMLSchema#gYearMonth"],i.VALIDATORS={date:/^[0-9]+-[0-9][0-9]-[0-9][0-9]Z?$/,dateTime:/^[0-9]+-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9](\.[0-9][0-9][0-9])?((Z?)|([\+-][0-9][0-9]:[0-9][0-9]))$/,gDay:/^[0-9]+$/,gMonthDay:/^[0-9]+-[0-9][0-9]$/,gYear:/^[0-9]+$/,gYearMonth:/^[0-9]+-[0-9][0-9]$/},t.TypeHandlerDate=i},2406:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TypeHandlerNumberDouble=void 0;const r=n(103);class i{fromRdf(e,t){const n=parseFloat(e.value);return t&&isNaN(n)&&r.Translator.incorrectRdfDataType(e),n}toRdf(e,{datatype:t,dataFactory:n}){return t=t||n.namedNode(i.TYPES[0]),isNaN(e)?n.literal("NaN",t):isFinite(e)?e%1==0?null:n.literal(e.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),t):n.literal(e>0?"INF":"-INF",t)}}i.TYPES=["http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float"],t.TypeHandlerNumberDouble=i},6925:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TypeHandlerNumberInteger=void 0;const r=n(103);class i{fromRdf(e,t){const n=parseInt(e.value,10);return t&&(isNaN(n)||e.value.indexOf(".")>=0)&&r.Translator.incorrectRdfDataType(e),n}toRdf(e,{datatype:t,dataFactory:n}){return n.literal(String(e),t||(e<=i.MAX_INT&&e>=i.MIN_INT?n.namedNode(i.TYPES[0]):n.namedNode(i.TYPES[1])))}}i.TYPES=["http://www.w3.org/2001/XMLSchema#integer","http://www.w3.org/2001/XMLSchema#long","http://www.w3.org/2001/XMLSchema#int","http://www.w3.org/2001/XMLSchema#byte","http://www.w3.org/2001/XMLSchema#short","http://www.w3.org/2001/XMLSchema#negativeInteger","http://www.w3.org/2001/XMLSchema#nonNegativeInteger","http://www.w3.org/2001/XMLSchema#nonPositiveInteger","http://www.w3.org/2001/XMLSchema#positiveInteger","http://www.w3.org/2001/XMLSchema#unsignedByte","http://www.w3.org/2001/XMLSchema#unsignedInt","http://www.w3.org/2001/XMLSchema#unsignedLong","http://www.w3.org/2001/XMLSchema#unsignedShort"],i.MAX_INT=2147483647,i.MIN_INT=-2147483648,t.TypeHandlerNumberInteger=i},4191:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TypeHandlerString=void 0;class n{fromRdf(e){return e.value}toRdf(e,{datatype:t,dataFactory:n}){return n.literal(e,t)}}n.TYPES=["http://www.w3.org/2001/XMLSchema#string","http://www.w3.org/2001/XMLSchema#normalizedString","http://www.w3.org/2001/XMLSchema#anyURI","http://www.w3.org/2001/XMLSchema#base64Binary","http://www.w3.org/2001/XMLSchema#language","http://www.w3.org/2001/XMLSchema#Name","http://www.w3.org/2001/XMLSchema#NCName","http://www.w3.org/2001/XMLSchema#NMTOKEN","http://www.w3.org/2001/XMLSchema#token","http://www.w3.org/2001/XMLSchema#hexBinary","http://www.w3.org/1999/02/22-rdf-syntax-ns#langString","http://www.w3.org/2001/XMLSchema#time","http://www.w3.org/2001/XMLSchema#duration"],t.TypeHandlerString=n},4802:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(92),t),i(n(7258),t),i(n(2406),t),i(n(6925),t),i(n(4191),t)},4147:(e,t,n)=>{const{SymbolDispose:r}=n(4134),{AbortError:i,codes:o}=n(6371),{isNodeStream:a,isWebStream:s,kControllerErrorFunction:l}=n(6115),c=n(6238),{ERR_INVALID_ARG_TYPE:u}=o;let d;e.exports.addAbortSignal=function(t,n){if((e=>{if("object"!=typeof e||!("aborted"in e))throw new u("signal","AbortSignal",e)})(t),!a(n)&&!s(n))throw new u("stream",["ReadableStream","WritableStream","Stream"],n);return e.exports.addAbortSignalNoValidate(t,n)},e.exports.addAbortSignalNoValidate=function(e,t){if("object"!=typeof e||!("aborted"in e))return t;const o=a(t)?()=>{t.destroy(new i(void 0,{cause:e.reason}))}:()=>{t[l](new i(void 0,{cause:e.reason}))};if(e.aborted)o();else{d=d||n(7760).addAbortListener;const i=d(e,o);c(t,i[r])}return t}},345:(e,t,n)=>{const{StringPrototypeSlice:r,SymbolIterator:i,TypedArrayPrototypeSet:o,Uint8Array:a}=n(4134),{Buffer:s}=n(8287),{inspect:l}=n(7760);e.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){const t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){const t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}shift(){if(0===this.length)return;const e=this.head.data;return 1===this.length?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(0===this.length)return"";let t=this.head,n=""+t.data;for(;null!==(t=t.next);)n+=e+t.data;return n}concat(e){if(0===this.length)return s.alloc(0);const t=s.allocUnsafe(e>>>0);let n=this.head,r=0;for(;n;)o(t,n.data,r),r+=n.data.length,n=n.next;return t}consume(e,t){const n=this.head.data;if(e<n.length){const t=n.slice(0,e);return this.head.data=n.slice(e),t}return e===n.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[i](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let t="",n=this.head,i=0;do{const o=n.data;if(!(e>o.length)){e===o.length?(t+=o,++i,n.next?this.head=n.next:this.head=this.tail=null):(t+=r(o,0,e),this.head=n,n.data=r(o,e));break}t+=o,e-=o.length,++i}while(null!==(n=n.next));return this.length-=i,t}_getBuffer(e){const t=s.allocUnsafe(e),n=e;let r=this.head,i=0;do{const s=r.data;if(!(e>s.length)){e===s.length?(o(t,s,n-e),++i,r.next?this.head=r.next:this.head=this.tail=null):(o(t,new a(s.buffer,s.byteOffset,e),n-e),this.head=r,r.data=s.slice(e));break}o(t,s,n-e),e-=s.length,++i}while(null!==(r=r.next));return this.length-=i,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return l(this,{...t,depth:0,customInspect:!1})}}},7830:(e,t,n)=>{const{pipeline:r}=n(7758),i=n(3370),{destroyer:o}=n(5896),{isNodeStream:a,isReadable:s,isWritable:l,isWebStream:c,isTransformStream:u,isWritableStream:d,isReadableStream:h}=n(6115),{AbortError:f,codes:{ERR_INVALID_ARG_VALUE:p,ERR_MISSING_ARGS:g}}=n(6371),y=n(6238);e.exports=function(...e){if(0===e.length)throw new g("streams");if(1===e.length)return i.from(e[0]);const t=[...e];if("function"==typeof e[0]&&(e[0]=i.from(e[0])),"function"==typeof e[e.length-1]){const t=e.length-1;e[t]=i.from(e[t])}for(let n=0;n<e.length;++n)if(a(e[n])||c(e[n])){if(n<e.length-1&&!(s(e[n])||h(e[n])||u(e[n])))throw new p(`streams[${n}]`,t[n],"must be readable");if(n>0&&!(l(e[n])||d(e[n])||u(e[n])))throw new p(`streams[${n}]`,t[n],"must be writable")}let n,m,b,v,w;const _=e[0],x=r(e,(function(e){const t=v;v=null,t?t(e):e?w.destroy(e):j||S||w.destroy()})),S=!!(l(_)||d(_)||u(_)),j=!!(s(x)||h(x)||u(x));if(w=new i({writableObjectMode:!(null==_||!_.writableObjectMode),readableObjectMode:!(null==x||!x.readableObjectMode),writable:S,readable:j}),S){if(a(_))w._write=function(e,t,r){_.write(e,t)?r():n=r},w._final=function(e){_.end(),m=e},_.on("drain",(function(){if(n){const e=n;n=null,e()}}));else if(c(_)){const e=(u(_)?_.writable:_).getWriter();w._write=async function(t,n,r){try{await e.ready,e.write(t).catch((()=>{})),r()}catch(e){r(e)}},w._final=async function(t){try{await e.ready,e.close().catch((()=>{})),m=t}catch(e){t(e)}}}const e=u(x)?x.readable:x;y(e,(()=>{if(m){const e=m;m=null,e()}}))}if(j)if(a(x))x.on("readable",(function(){if(b){const e=b;b=null,e()}})),x.on("end",(function(){w.push(null)})),w._read=function(){for(;;){const e=x.read();if(null===e)return void(b=w._read);if(!w.push(e))return}};else if(c(x)){const e=(u(x)?x.readable:x).getReader();w._read=async function(){for(;;)try{const{value:t,done:n}=await e.read();if(!w.push(t))return;if(n)return void w.push(null)}catch{return}}}return w._destroy=function(e,t){e||null===v||(e=new f),b=null,n=null,m=null,null===v?t(e):(v=t,a(x)&&o(x,e))},w}},5896:(e,t,n)=>{const r=n(5606),{aggregateTwoErrors:i,codes:{ERR_MULTIPLE_CALLBACK:o},AbortError:a}=n(6371),{Symbol:s}=n(4134),{kIsDestroyed:l,isDestroyed:c,isFinished:u,isServerRequest:d}=n(6115),h=s("kDestroy"),f=s("kConstruct");function p(e,t,n){e&&(e.stack,t&&!t.errored&&(t.errored=e),n&&!n.errored&&(n.errored=e))}function g(e,t,n){let i=!1;function o(t){if(i)return;i=!0;const o=e._readableState,a=e._writableState;p(t,a,o),a&&(a.closed=!0),o&&(o.closed=!0),"function"==typeof n&&n(t),t?r.nextTick(y,e,t):r.nextTick(m,e)}try{e._destroy(t||null,o)}catch(t){o(t)}}function y(e,t){b(e,t),m(e)}function m(e){const t=e._readableState,n=e._writableState;n&&(n.closeEmitted=!0),t&&(t.closeEmitted=!0),(null!=n&&n.emitClose||null!=t&&t.emitClose)&&e.emit("close")}function b(e,t){const n=e._readableState,r=e._writableState;null!=r&&r.errorEmitted||null!=n&&n.errorEmitted||(r&&(r.errorEmitted=!0),n&&(n.errorEmitted=!0),e.emit("error",t))}function v(e,t,n){const i=e._readableState,o=e._writableState;if(null!=o&&o.destroyed||null!=i&&i.destroyed)return this;null!=i&&i.autoDestroy||null!=o&&o.autoDestroy?e.destroy(t):t&&(t.stack,o&&!o.errored&&(o.errored=t),i&&!i.errored&&(i.errored=t),n?r.nextTick(b,e,t):b(e,t))}function w(e){let t=!1;function n(n){if(t)return void v(e,null!=n?n:new o);t=!0;const i=e._readableState,a=e._writableState,s=a||i;i&&(i.constructed=!0),a&&(a.constructed=!0),s.destroyed?e.emit(h,n):n?v(e,n,!0):r.nextTick(_,e)}try{e._construct((e=>{r.nextTick(n,e)}))}catch(e){r.nextTick(n,e)}}function _(e){e.emit(f)}function x(e){return(null==e?void 0:e.setHeader)&&"function"==typeof e.abort}function S(e){e.emit("close")}function j(e,t){e.emit("error",t),r.nextTick(S,e)}e.exports={construct:function(e,t){if("function"!=typeof e._construct)return;const n=e._readableState,i=e._writableState;n&&(n.constructed=!1),i&&(i.constructed=!1),e.once(f,t),e.listenerCount(f)>1||r.nextTick(w,e)},destroyer:function(e,t){e&&!c(e)&&(t||u(e)||(t=new a),d(e)?(e.socket=null,e.destroy(t)):x(e)?e.abort():x(e.req)?e.req.abort():"function"==typeof e.destroy?e.destroy(t):"function"==typeof e.close?e.close():t?r.nextTick(j,e,t):r.nextTick(S,e),e.destroyed||(e[l]=!0))},destroy:function(e,t){const n=this._readableState,r=this._writableState,o=r||n;return null!=r&&r.destroyed||null!=n&&n.destroyed?("function"==typeof t&&t(),this):(p(e,r,n),r&&(r.destroyed=!0),n&&(n.destroyed=!0),o.constructed?g(this,e,t):this.once(h,(function(n){g(this,i(n,e),t)})),this)},undestroy:function(){const e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=!1===e.readable,e.endEmitted=!1===e.readable),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=!1===t.writable,t.ending=!1===t.writable,t.finished=!1===t.writable)},errorOrDestroy:v}},3370:(e,t,n)=>{const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:i,ObjectKeys:o,ObjectSetPrototypeOf:a}=n(4134);e.exports=c;const s=n(7576),l=n(8584);a(c.prototype,s.prototype),a(c,s);{const e=o(l.prototype);for(let t=0;t<e.length;t++){const n=e[t];c.prototype[n]||(c.prototype[n]=l.prototype[n])}}function c(e){if(!(this instanceof c))return new c(e);s.call(this,e),l.call(this,e),e?(this.allowHalfOpen=!1!==e.allowHalfOpen,!1===e.readable&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===e.writable&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}let u,d;function h(){return void 0===u&&(u={}),u}r(c.prototype,{writable:{__proto__:null,...i(l.prototype,"writable")},writableHighWaterMark:{__proto__:null,...i(l.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...i(l.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...i(l.prototype,"writableBuffer")},writableLength:{__proto__:null,...i(l.prototype,"writableLength")},writableFinished:{__proto__:null,...i(l.prototype,"writableFinished")},writableCorked:{__proto__:null,...i(l.prototype,"writableCorked")},writableEnded:{__proto__:null,...i(l.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...i(l.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}}),c.fromWeb=function(e,t){return h().newStreamDuplexFromReadableWritablePair(e,t)},c.toWeb=function(e){return h().newReadableWritablePairFromDuplex(e)},c.from=function(e){return d||(d=n(6706)),d(e,"body")}},6706:(e,t,n)=>{const r=n(5606),i=n(8287),{isReadable:o,isWritable:a,isIterable:s,isNodeStream:l,isReadableNodeStream:c,isWritableNodeStream:u,isDuplexNodeStream:d,isReadableStream:h,isWritableStream:f}=n(6115),p=n(6238),{AbortError:g,codes:{ERR_INVALID_ARG_TYPE:y,ERR_INVALID_RETURN_VALUE:m}}=n(6371),{destroyer:b}=n(5896),v=n(3370),w=n(7576),_=n(8584),{createDeferredPromise:x}=n(7760),S=n(6532),j=globalThis.Blob||i.Blob,I=void 0!==j?function(e){return e instanceof j}:function(e){return!1},E=globalThis.AbortController||n(5568).AbortController,{FunctionPrototypeCall:N}=n(4134);class T extends v{constructor(e){super(e),!1===(null==e?void 0:e.readable)&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===(null==e?void 0:e.writable)&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}function R(e){const t=e.readable&&"function"!=typeof e.readable.read?w.wrap(e.readable):e.readable,n=e.writable;let r,i,s,l,c,u=!!o(t),d=!!a(n);function h(e){const t=l;l=null,t?t(e):e&&c.destroy(e)}return c=new T({readableObjectMode:!(null==t||!t.readableObjectMode),writableObjectMode:!(null==n||!n.writableObjectMode),readable:u,writable:d}),d&&(p(n,(e=>{d=!1,e&&b(t,e),h(e)})),c._write=function(e,t,i){n.write(e,t)?i():r=i},c._final=function(e){n.end(),i=e},n.on("drain",(function(){if(r){const e=r;r=null,e()}})),n.on("finish",(function(){if(i){const e=i;i=null,e()}}))),u&&(p(t,(e=>{u=!1,e&&b(t,e),h(e)})),t.on("readable",(function(){if(s){const e=s;s=null,e()}})),t.on("end",(function(){c.push(null)})),c._read=function(){for(;;){const e=t.read();if(null===e)return void(s=c._read);if(!c.push(e))return}}),c._destroy=function(e,o){e||null===l||(e=new g),s=null,r=null,i=null,null===l?o(e):(l=o,b(n,e),b(t,e))},c}e.exports=function e(t,n){if(d(t))return t;if(c(t))return R({readable:t});if(u(t))return R({writable:t});if(l(t))return R({writable:!1,readable:!1});if(h(t))return R({readable:w.fromWeb(t)});if(f(t))return R({writable:_.fromWeb(t)});if("function"==typeof t){const{value:e,write:i,final:o,destroy:a}=function(e){let{promise:t,resolve:n}=x();const i=new E,o=i.signal;return{value:e(async function*(){for(;;){const e=t;t=null;const{chunk:i,done:a,cb:s}=await e;if(r.nextTick(s),a)return;if(o.aborted)throw new g(void 0,{cause:o.reason});({promise:t,resolve:n}=x()),yield i}}(),{signal:o}),write(e,t,r){const i=n;n=null,i({chunk:e,done:!1,cb:r})},final(e){const t=n;n=null,t({done:!0,cb:e})},destroy(e,t){i.abort(),t(e)}}}(t);if(s(e))return S(T,e,{objectMode:!0,write:i,final:o,destroy:a});const l=null==e?void 0:e.then;if("function"==typeof l){let t;const n=N(l,e,(e=>{if(null!=e)throw new m("nully","body",e)}),(e=>{b(t,e)}));return t=new T({objectMode:!0,readable:!1,write:i,final(e){o((async()=>{try{await n,r.nextTick(e,null)}catch(t){r.nextTick(e,t)}}))},destroy:a})}throw new m("Iterable, AsyncIterable or AsyncFunction",n,e)}if(I(t))return e(t.arrayBuffer());if(s(t))return S(T,t,{objectMode:!0,writable:!1});if(h(null==t?void 0:t.readable)&&f(null==t?void 0:t.writable))return T.fromWeb(t);if("object"==typeof(null==t?void 0:t.writable)||"object"==typeof(null==t?void 0:t.readable))return R({readable:null!=t&&t.readable?c(null==t?void 0:t.readable)?null==t?void 0:t.readable:e(t.readable):void 0,writable:null!=t&&t.writable?u(null==t?void 0:t.writable)?null==t?void 0:t.writable:e(t.writable):void 0});const i=null==t?void 0:t.then;if("function"==typeof i){let e;return N(i,t,(t=>{null!=t&&e.push(t),e.push(null)}),(t=>{b(e,t)})),e=new T({objectMode:!0,writable:!1,read(){}})}throw new y(n,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],t)}},6238:(e,t,n)=>{const r=n(5606),{AbortError:i,codes:o}=n(6371),{ERR_INVALID_ARG_TYPE:a,ERR_STREAM_PREMATURE_CLOSE:s}=o,{kEmptyObject:l,once:c}=n(7760),{validateAbortSignal:u,validateFunction:d,validateObject:h,validateBoolean:f}=n(277),{Promise:p,PromisePrototypeThen:g,SymbolDispose:y}=n(4134),{isClosed:m,isReadable:b,isReadableNodeStream:v,isReadableStream:w,isReadableFinished:_,isReadableErrored:x,isWritable:S,isWritableNodeStream:j,isWritableStream:I,isWritableFinished:E,isWritableErrored:N,isNodeStream:T,willEmitClose:R,kIsClosedPromise:O}=n(6115);let k;const L=()=>{};function A(e,t,o){var f,p;if(2===arguments.length?(o=t,t=l):null==t?t=l:h(t,"options"),d(o,"callback"),u(t.signal,"options.signal"),o=c(o),w(e)||I(e))return function(e,t,o){let a=!1,s=L;if(t.signal)if(s=()=>{a=!0,o.call(e,new i(void 0,{cause:t.signal.reason}))},t.signal.aborted)r.nextTick(s);else{k=k||n(7760).addAbortListener;const r=k(t.signal,s),i=o;o=c(((...t)=>{r[y](),i.apply(e,t)}))}const l=(...t)=>{a||r.nextTick((()=>o.apply(e,t)))};return g(e[O].promise,l,l),L}(e,t,o);if(!T(e))throw new a("stream",["ReadableStream","WritableStream","Stream"],e);const A=null!==(f=t.readable)&&void 0!==f?f:v(e),C=null!==(p=t.writable)&&void 0!==p?p:j(e),D=e._writableState,M=e._readableState,P=()=>{e.writable||F()};let $=R(e)&&v(e)===A&&j(e)===C,B=E(e,!1);const F=()=>{B=!0,e.destroyed&&($=!1),(!$||e.readable&&!A)&&(A&&!q||o.call(e))};let q=_(e,!1);const U=()=>{q=!0,e.destroyed&&($=!1),(!$||e.writable&&!C)&&(C&&!B||o.call(e))},G=t=>{o.call(e,t)};let H=m(e);const V=()=>{H=!0;const t=N(e)||x(e);return t&&"boolean"!=typeof t?o.call(e,t):A&&!q&&v(e,!0)&&!_(e,!1)?o.call(e,new s):!C||B||E(e,!1)?void o.call(e):o.call(e,new s)},W=()=>{H=!0;const t=N(e)||x(e);if(t&&"boolean"!=typeof t)return o.call(e,t);o.call(e)},z=()=>{e.req.on("finish",F)};!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?C&&!D&&(e.on("end",P),e.on("close",P)):(e.on("complete",F),$||e.on("abort",V),e.req?z():e.on("request",z)),$||"boolean"!=typeof e.aborted||e.on("aborted",V),e.on("end",U),e.on("finish",F),!1!==t.error&&e.on("error",G),e.on("close",V),H?r.nextTick(V):null!=D&&D.errorEmitted||null!=M&&M.errorEmitted?$||r.nextTick(W):(A||$&&!b(e)||!B&&!1!==S(e))&&(C||$&&!S(e)||!q&&!1!==b(e))?M&&e.req&&e.aborted&&r.nextTick(W):r.nextTick(W);const J=()=>{o=L,e.removeListener("aborted",V),e.removeListener("complete",F),e.removeListener("abort",V),e.removeListener("request",z),e.req&&e.req.removeListener("finish",F),e.removeListener("end",P),e.removeListener("close",P),e.removeListener("finish",F),e.removeListener("end",U),e.removeListener("error",G),e.removeListener("close",V)};if(t.signal&&!H){const a=()=>{const n=o;J(),n.call(e,new i(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)r.nextTick(a);else{k=k||n(7760).addAbortListener;const r=k(t.signal,a),i=o;o=c(((...t)=>{r[y](),i.apply(e,t)}))}}return J}e.exports=A,e.exports.finished=function(e,t){var n;let r=!1;return null===t&&(t=l),null!==(n=t)&&void 0!==n&&n.cleanup&&(f(t.cleanup,"cleanup"),r=t.cleanup),new p(((n,i)=>{const o=A(e,t,(e=>{r&&o(),e?i(e):n()}))}))}},6532:(e,t,n)=>{const r=n(5606),{PromisePrototypeThen:i,SymbolAsyncIterator:o,SymbolIterator:a}=n(4134),{Buffer:s}=n(8287),{ERR_INVALID_ARG_TYPE:l,ERR_STREAM_NULL_VALUES:c}=n(6371).codes;e.exports=function(e,t,n){let u,d;if("string"==typeof t||t instanceof s)return new e({objectMode:!0,...n,read(){this.push(t),this.push(null)}});if(t&&t[o])d=!0,u=t[o]();else{if(!t||!t[a])throw new l("iterable",["Iterable"],t);d=!1,u=t[a]()}const h=new e({objectMode:!0,highWaterMark:1,...n});let f=!1;return h._read=function(){f||(f=!0,async function(){for(;;){try{const{value:e,done:t}=d?await u.next():u.next();if(t)h.push(null);else{const t=e&&"function"==typeof e.then?await e:e;if(null===t)throw f=!1,new c;if(h.push(t))continue;f=!1}}catch(e){h.destroy(e)}break}}())},h._destroy=function(e,t){i(async function(e){const t=null!=e,n="function"==typeof u.throw;if(t&&n){const{value:t,done:n}=await u.throw(e);if(await t,n)return}if("function"==typeof u.return){const{value:e}=await u.return();await e}}(e),(()=>r.nextTick(t,e)),(n=>r.nextTick(t,n||e)))},h}},4259:(e,t,n)=>{const{ArrayIsArray:r,ObjectSetPrototypeOf:i}=n(4134),{EventEmitter:o}=n(7007);function a(e){o.call(this,e)}function s(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?r(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}i(a.prototype,o.prototype),i(a,o),a.prototype.pipe=function(e,t){const n=this;function r(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function i(){n.readable&&n.resume&&n.resume()}n.on("data",r),e.on("drain",i),e._isStdio||t&&!1===t.end||(n.on("end",l),n.on("close",c));let a=!1;function l(){a||(a=!0,e.end())}function c(){a||(a=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){d(),0===o.listenerCount(this,"error")&&this.emit("error",e)}function d(){n.removeListener("data",r),e.removeListener("drain",i),n.removeListener("end",l),n.removeListener("close",c),n.removeListener("error",u),e.removeListener("error",u),n.removeListener("end",d),n.removeListener("close",d),e.removeListener("close",d)}return s(n,"error",u),s(e,"error",u),n.on("end",d),n.on("close",d),e.on("close",d),e.emit("pipe",n),e},e.exports={Stream:a,prependListener:s}},823:(e,t,n)=>{const r=globalThis.AbortController||n(5568).AbortController,{codes:{ERR_INVALID_ARG_VALUE:i,ERR_INVALID_ARG_TYPE:o,ERR_MISSING_ARGS:a,ERR_OUT_OF_RANGE:s},AbortError:l}=n(6371),{validateAbortSignal:c,validateInteger:u,validateObject:d}=n(277),h=n(4134).Symbol("kWeak"),f=n(4134).Symbol("kResistStopPropagation"),{finished:p}=n(6238),g=n(7830),{addAbortSignalNoValidate:y}=n(4147),{isWritable:m,isNodeStream:b}=n(6115),{deprecate:v}=n(7760),{ArrayPrototypePush:w,Boolean:_,MathFloor:x,Number:S,NumberIsNaN:j,Promise:I,PromiseReject:E,PromiseResolve:N,PromisePrototypeThen:T,Symbol:R}=n(4134),O=R("kEmpty"),k=R("kEof");function L(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&c(t.signal,"options.signal");let r=1;null!=(null==t?void 0:t.concurrency)&&(r=x(t.concurrency));let i=r-1;return null!=(null==t?void 0:t.highWaterMark)&&(i=x(t.highWaterMark)),u(r,"options.concurrency",1),u(i,"options.highWaterMark",0),i+=r,async function*(){const o=n(7760).AbortSignalAny([null==t?void 0:t.signal].filter(_)),a=this,s=[],c={signal:o};let u,d,h=!1,f=0;function p(){h=!0,g()}function g(){f-=1,y()}function y(){d&&!h&&f<r&&s.length<i&&(d(),d=null)}!async function(){try{for await(let t of a){if(h)return;if(o.aborted)throw new l;try{if(t=e(t,c),t===O)continue;t=N(t)}catch(e){t=E(e)}f+=1,T(t,g,p),s.push(t),u&&(u(),u=null),!h&&(s.length>=i||f>=r)&&await new I((e=>{d=e}))}s.push(k)}catch(e){const t=E(e);T(t,g,p),s.push(t)}finally{h=!0,u&&(u(),u=null)}}();try{for(;;){for(;s.length>0;){const e=await s[0];if(e===k)return;if(o.aborted)throw new l;e!==O&&(yield e),s.shift(),y()}await new I((e=>{u=e}))}}finally{h=!0,d&&(d(),d=null)}}.call(this)}async function A(e,t=void 0){for await(const n of C.call(this,e,t))return!0;return!1}function C(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);return L.call(this,(async function(t,n){return await e(t,n)?t:O}),t)}class D extends a{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}function M(e){if(e=S(e),j(e))return 0;if(e<0)throw new s("number",">= 0",e);return e}e.exports.streamReturningOperators={asIndexedPairs:v((function(e=void 0){return null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&c(e.signal,"options.signal"),async function*(){let t=0;for await(const r of this){var n;if(null!=e&&null!==(n=e.signal)&&void 0!==n&&n.aborted)throw new l({cause:e.signal.reason});yield[t++,r]}}.call(this)}),"readable.asIndexedPairs will be removed in a future version."),drop:function(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&c(t.signal,"options.signal"),e=M(e),async function*(){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new l;for await(const n of this){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new l;e--<=0&&(yield n)}}.call(this)},filter:C,flatMap:function(e,t){const n=L.call(this,e,t);return async function*(){for await(const e of n)yield*e}.call(this)},map:L,take:function(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&c(t.signal,"options.signal"),e=M(e),async function*(){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new l;for await(const n of this){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new l;if(e-- >0&&(yield n),e<=0)return}}.call(this)},compose:function(e,t){if(null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&c(t.signal,"options.signal"),b(e)&&!m(e))throw new i("stream",e,"must be writable");const n=g(this,e);return null!=t&&t.signal&&y(t.signal,n),n}},e.exports.promiseReturningOperators={every:async function(e,t=void 0){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);return!await A.call(this,(async(...t)=>!await e(...t)),t)},forEach:async function(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);for await(const n of L.call(this,(async function(t,n){return await e(t,n),O}),t));},reduce:async function(e,t,n){var i;if("function"!=typeof e)throw new o("reducer",["Function","AsyncFunction"],e);null!=n&&d(n,"options"),null!=(null==n?void 0:n.signal)&&c(n.signal,"options.signal");let a=arguments.length>1;if(null!=n&&null!==(i=n.signal)&&void 0!==i&&i.aborted){const e=new l(void 0,{cause:n.signal.reason});throw this.once("error",(()=>{})),await p(this.destroy(e)),e}const s=new r,u=s.signal;if(null!=n&&n.signal){const e={once:!0,[h]:this,[f]:!0};n.signal.addEventListener("abort",(()=>s.abort()),e)}let g=!1;try{for await(const r of this){var y;if(g=!0,null!=n&&null!==(y=n.signal)&&void 0!==y&&y.aborted)throw new l;a?t=await e(t,r,{signal:u}):(t=r,a=!0)}if(!g&&!a)throw new D}finally{s.abort()}return t},toArray:async function(e){null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&c(e.signal,"options.signal");const t=[];for await(const r of this){var n;if(null!=e&&null!==(n=e.signal)&&void 0!==n&&n.aborted)throw new l(void 0,{cause:e.signal.reason});w(t,r)}return t},some:A,find:async function(e,t){for await(const n of C.call(this,e,t))return n}}},6524:(e,t,n)=>{const{ObjectSetPrototypeOf:r}=n(4134);e.exports=o;const i=n(5001);function o(e){if(!(this instanceof o))return new o(e);i.call(this,e)}r(o.prototype,i.prototype),r(o,i),o.prototype._transform=function(e,t,n){n(null,e)}},7758:(e,t,n)=>{const r=n(5606),{ArrayIsArray:i,Promise:o,SymbolAsyncIterator:a,SymbolDispose:s}=n(4134),l=n(6238),{once:c}=n(7760),u=n(5896),d=n(3370),{aggregateTwoErrors:h,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:p,ERR_MISSING_ARGS:g,ERR_STREAM_DESTROYED:y,ERR_STREAM_PREMATURE_CLOSE:m},AbortError:b}=n(6371),{validateFunction:v,validateAbortSignal:w}=n(277),{isIterable:_,isReadable:x,isReadableNodeStream:S,isNodeStream:j,isTransformStream:I,isWebStream:E,isReadableStream:N,isReadableFinished:T}=n(6115),R=globalThis.AbortController||n(5568).AbortController;let O,k,L;function A(e,t,n){let r=!1;return e.on("close",(()=>{r=!0})),{destroy:t=>{r||(r=!0,u.destroyer(e,t||new y("pipe")))},cleanup:l(e,{readable:t,writable:n},(e=>{r=!e}))}}function C(e){if(_(e))return e;if(S(e))return async function*(e){k||(k=n(7576)),yield*k.prototype[a].call(e)}(e);throw new f("val",["Readable","Iterable","AsyncIterable"],e)}async function D(e,t,n,{end:r}){let i,a=null;const s=e=>{if(e&&(i=e),a){const e=a;a=null,e()}},c=()=>new o(((e,t)=>{i?t(i):a=()=>{i?t(i):e()}}));t.on("drain",s);const u=l(t,{readable:!1},s);try{t.writableNeedDrain&&await c();for await(const n of e)t.write(n)||await c();r&&(t.end(),await c()),n()}catch(e){n(i!==e?h(i,e):e)}finally{u(),t.off("drain",s)}}async function M(e,t,n,{end:r}){I(t)&&(t=t.writable);const i=t.getWriter();try{for await(const t of e)await i.ready,i.write(t).catch((()=>{}));await i.ready,r&&await i.close(),n()}catch(e){try{await i.abort(e),n(e)}catch(e){n(e)}}}function P(e,t,o){if(1===e.length&&i(e[0])&&(e=e[0]),e.length<2)throw new g("streams");const a=new R,l=a.signal,c=null==o?void 0:o.signal,u=[];function h(){F(new b)}let y,m,v;w(c,"options.signal"),L=L||n(7760).addAbortListener,c&&(y=L(c,h));const T=[];let k,P=0;function B(e){F(e,0==--P)}function F(e,n){var i;if(!e||m&&"ERR_STREAM_PREMATURE_CLOSE"!==m.code||(m=e),m||n){for(;T.length;)T.shift()(m);null===(i=y)||void 0===i||i[s](),a.abort(),n&&(m||u.forEach((e=>e())),r.nextTick(t,m,v))}}for(let G=0;G<e.length;G++){const H=e[G],V=G<e.length-1,W=G>0,z=V||!1!==(null==o?void 0:o.end),J=G===e.length-1;if(j(H)){if(z){const{destroy:X,cleanup:K}=A(H,V,W);T.push(X),x(H)&&J&&u.push(K)}function Q(e){e&&"AbortError"!==e.name&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code&&B(e)}H.on("error",Q),x(H)&&J&&u.push((()=>{H.removeListener("error",Q)}))}if(0===G)if("function"==typeof H){if(k=H({signal:l}),!_(k))throw new p("Iterable, AsyncIterable or Stream","source",k)}else k=_(H)||S(H)||I(H)?H:d.from(H);else if("function"==typeof H){var q;if(k=I(k)?C(null===(q=k)||void 0===q?void 0:q.readable):C(k),k=H(k,{signal:l}),V){if(!_(k,!0))throw new p("AsyncIterable",`transform[${G-1}]`,k)}else{var U;O||(O=n(6524));const Y=new O({objectMode:!0}),Z=null===(U=k)||void 0===U?void 0:U.then;if("function"==typeof Z)P++,Z.call(k,(e=>{v=e,null!=e&&Y.write(e),z&&Y.end(),r.nextTick(B)}),(e=>{Y.destroy(e),r.nextTick(B,e)}));else if(_(k,!0))P++,D(k,Y,B,{end:z});else{if(!N(k)&&!I(k))throw new p("AsyncIterable or Promise","destination",k);{const ne=k.readable||k;P++,D(ne,Y,B,{end:z})}}k=Y;const{destroy:ee,cleanup:te}=A(k,!1,!0);T.push(ee),J&&u.push(te)}}else if(j(H)){if(S(k)){P+=2;const re=$(k,H,B,{end:z});x(H)&&J&&u.push(re)}else if(I(k)||N(k)){const ie=k.readable||k;P++,D(ie,H,B,{end:z})}else{if(!_(k))throw new f("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],k);P++,D(k,H,B,{end:z})}k=H}else if(E(H)){if(S(k))P++,M(C(k),H,B,{end:z});else if(N(k)||_(k))P++,M(k,H,B,{end:z});else{if(!I(k))throw new f("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],k);P++,M(k.readable,H,B,{end:z})}k=H}else k=d.from(H)}return(null!=l&&l.aborted||null!=c&&c.aborted)&&r.nextTick(h),k}function $(e,t,n,{end:i}){let o=!1;if(t.on("close",(()=>{o||n(new m)})),e.pipe(t,{end:!1}),i){function a(){o=!0,t.end()}T(e)?r.nextTick(a):e.once("end",a)}else n();return l(e,{readable:!0,writable:!1},(t=>{const r=e._readableState;t&&"ERR_STREAM_PREMATURE_CLOSE"===t.code&&r&&r.ended&&!r.errored&&!r.errorEmitted?e.once("end",n).once("error",n):n(t)})),l(t,{readable:!1,writable:!0},n)}e.exports={pipelineImpl:P,pipeline:function(...e){return P(e,c(function(e){return v(e[e.length-1],"streams[stream.length - 1]"),e.pop()}(e)))}}},7576:(e,t,n)=>{const r=n(5606),{ArrayPrototypeIndexOf:i,NumberIsInteger:o,NumberIsNaN:a,NumberParseInt:s,ObjectDefineProperties:l,ObjectKeys:c,ObjectSetPrototypeOf:u,Promise:d,SafeSet:h,SymbolAsyncDispose:f,SymbolAsyncIterator:p,Symbol:g}=n(4134);e.exports=z,z.ReadableState=W;const{EventEmitter:y}=n(7007),{Stream:m,prependListener:b}=n(4259),{Buffer:v}=n(8287),{addAbortSignal:w}=n(4147),_=n(6238);let x=n(7760).debuglog("stream",(e=>{x=e}));const S=n(345),j=n(5896),{getHighWaterMark:I,getDefaultHighWaterMark:E}=n(5291),{aggregateTwoErrors:N,codes:{ERR_INVALID_ARG_TYPE:T,ERR_METHOD_NOT_IMPLEMENTED:R,ERR_OUT_OF_RANGE:O,ERR_STREAM_PUSH_AFTER_EOF:k,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:L},AbortError:A}=n(6371),{validateObject:C}=n(277),D=g("kPaused"),{StringDecoder:M}=n(3141),P=n(6532);u(z.prototype,m.prototype),u(z,m);const $=()=>{},{errorOrDestroy:B}=j,F=1,q=16,U=32,G=2048,H=4096;function V(e){return{enumerable:!1,get(){return!!(this.state&e)},set(t){t?this.state|=e:this.state&=~e}}}function W(e,t,r){"boolean"!=typeof r&&(r=t instanceof n(3370)),this.state=G|H|q|U,e&&e.objectMode&&(this.state|=F),r&&e&&e.readableObjectMode&&(this.state|=F),this.highWaterMark=e?I(this,e,"readableHighWaterMark",r):E(!1),this.buffer=new S,this.length=0,this.pipes=[],this.flowing=null,this[D]=null,e&&!1===e.emitClose&&(this.state&=~G),e&&!1===e.autoDestroy&&(this.state&=~H),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new M(e.encoding),this.encoding=e.encoding)}function z(e){if(!(this instanceof z))return new z(e);const t=this instanceof n(3370);this._readableState=new W(e,this,t),e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&!t&&w(e.signal,this)),m.call(this,e),j.construct(this,(()=>{this._readableState.needReadable&&Z(this,this._readableState)}))}function J(e,t,n,r){x("readableAddChunk",t);const i=e._readableState;let o;if(i.state&F||("string"==typeof t?(n=n||i.defaultEncoding,i.encoding!==n&&(r&&i.encoding?t=v.from(t,n).toString(i.encoding):(t=v.from(t,n),n=""))):t instanceof v?n="":m._isUint8Array(t)?(t=m._uint8ArrayToBuffer(t),n=""):null!=t&&(o=new T("chunk",["string","Buffer","Uint8Array"],t))),o)B(e,o);else if(null===t)i.state&=-9,function(e,t){if(x("onEofChunk"),!t.ended){if(t.decoder){const e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?K(e):(t.needReadable=!1,t.emittedReadable=!0,Y(e))}}(e,i);else if(i.state&F||t&&t.length>0)if(r)if(4&i.state)B(e,new L);else{if(i.destroyed||i.errored)return!1;Q(e,i,t,!0)}else if(i.ended)B(e,new k);else{if(i.destroyed||i.errored)return!1;i.state&=-9,i.decoder&&!n?(t=i.decoder.write(t),i.objectMode||0!==t.length?Q(e,i,t,!1):Z(e,i)):Q(e,i,t,!1)}else r||(i.state&=-9,Z(e,i));return!i.ended&&(i.length<i.highWaterMark||0===i.length)}function Q(e,t,n,r){t.flowing&&0===t.length&&!t.sync&&e.listenerCount("data")>0?(65536&t.state?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),64&t.state&&K(e)),Z(e,t)}function X(e,t){return e<=0||0===t.length&&t.ended?0:t.state&F?1:a(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}function K(e){const t=e._readableState;x("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(x("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(Y,e))}function Y(e){const t=e._readableState;x("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||t.errored||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,ie(e)}function Z(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,r.nextTick(ee,e,t))}function ee(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){const n=t.length;if(x("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function te(e){const t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!1===t[D]?t.flowing=!0:e.listenerCount("data")>0?e.resume():t.readableListening||(t.flowing=null)}function ne(e){x("readable nexttick read 0"),e.read(0)}function re(e,t){x("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),ie(e),t.flowing&&!t.reading&&e.read(0)}function ie(e){const t=e._readableState;for(x("flow",t.flowing);t.flowing&&null!==e.read(););}function oe(e,t){"function"!=typeof e.read&&(e=z.wrap(e,{objectMode:!0}));const n=async function*(e,t){let n,r=$;function i(t){this===e?(r(),r=$):r=t}e.on("readable",i);const o=_(e,{writable:!1},(e=>{n=e?N(n,e):null,r(),r=$}));try{for(;;){const t=e.destroyed?null:e.read();if(null!==t)yield t;else{if(n)throw n;if(null===n)return;await new d(i)}}}catch(e){throw n=N(n,e),n}finally{!n&&!1===(null==t?void 0:t.destroyOnReturn)||void 0!==n&&!e._readableState.autoDestroy?(e.off("readable",i),o()):j.destroyer(e,null)}}(e,t);return n.stream=e,n}function ae(e,t){if(0===t.length)return null;let n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}function se(e){const t=e._readableState;x("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(le,t,e))}function le(e,t){if(x("endReadableNT",e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&0===e.length)if(e.endEmitted=!0,t.emit("end"),t.writable&&!1===t.allowHalfOpen)r.nextTick(ce,t);else if(e.autoDestroy){const e=t._writableState;(!e||e.autoDestroy&&(e.finished||!1===e.writable))&&t.destroy()}}function ce(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}let ue;function de(){return void 0===ue&&(ue={}),ue}l(W.prototype,{objectMode:V(F),ended:V(2),endEmitted:V(4),reading:V(8),constructed:V(q),sync:V(U),needReadable:V(64),emittedReadable:V(128),readableListening:V(256),resumeScheduled:V(512),errorEmitted:V(1024),emitClose:V(G),autoDestroy:V(H),destroyed:V(8192),closed:V(16384),closeEmitted:V(32768),multiAwaitDrain:V(65536),readingMore:V(1<<17),dataEmitted:V(1<<18)}),z.prototype.destroy=j.destroy,z.prototype._undestroy=j.undestroy,z.prototype._destroy=function(e,t){t(e)},z.prototype[y.captureRejectionSymbol]=function(e){this.destroy(e)},z.prototype[f]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new A,this.destroy(e)),new d(((t,n)=>_(this,(r=>r&&r!==e?n(r):t(null)))))},z.prototype.push=function(e,t){return J(this,e,t,!1)},z.prototype.unshift=function(e,t){return J(this,e,t,!0)},z.prototype.isPaused=function(){const e=this._readableState;return!0===e[D]||!1===e.flowing},z.prototype.setEncoding=function(e){const t=new M(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;const n=this._readableState.buffer;let r="";for(const e of n)r+=t.write(e);return n.clear(),""!==r&&n.push(r),this._readableState.length=r.length,this},z.prototype.read=function(e){x("read",e),void 0===e?e=NaN:o(e)||(e=s(e,10));const t=this._readableState,n=e;if(e>t.highWaterMark&&(t.highWaterMark=function(e){if(e>1073741824)throw new O("size","<= 1GiB",e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,++e}(e)),0!==e&&(t.state&=-129),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return x("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?se(this):K(this),null;if(0===(e=X(e,t))&&t.ended)return 0===t.length&&se(this),null;let r,i=!!(64&t.state);if(x("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&(i=!0,x("length less than watermark",i)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)i=!1,x("reading, ended or constructing",i);else if(i){x("do read"),t.state|=8|U,0===t.length&&(t.state|=64);try{this._read(t.highWaterMark)}catch(e){B(this,e)}t.state&=~U,t.reading||(e=X(n,t))}return r=e>0?ae(e,t):null,null===r?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&se(this)),null===r||t.errorEmitted||t.closeEmitted||(t.dataEmitted=!0,this.emit("data",r)),r},z.prototype._read=function(e){throw new R("_read()")},z.prototype.pipe=function(e,t){const n=this,i=this._readableState;1===i.pipes.length&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new h(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),x("pipe count=%d opts=%j",i.pipes.length,t);const o=t&&!1===t.end||e===r.stdout||e===r.stderr?g:a;function a(){x("onend"),e.end()}let s;i.endEmitted?r.nextTick(o):n.once("end",o),e.on("unpipe",(function t(r,o){x("onunpipe"),r===n&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,x("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),s&&e.removeListener("drain",s),e.removeListener("error",d),e.removeListener("unpipe",t),n.removeListener("end",a),n.removeListener("end",g),n.removeListener("data",u),l=!0,s&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&s())}));let l=!1;function c(){l||(1===i.pipes.length&&i.pipes[0]===e?(x("false write response, pause",0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(x("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),n.pause()),s||(s=function(e,t){return function(){const n=e._readableState;n.awaitDrainWriters===t?(x("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(x("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(t)),n.awaitDrainWriters&&0!==n.awaitDrainWriters.size||!e.listenerCount("data")||e.resume()}}(n,e),e.on("drain",s))}function u(t){x("ondata");const n=e.write(t);x("dest.write",n),!1===n&&c()}function d(t){if(x("onerror",t),g(),e.removeListener("error",d),0===e.listenerCount("error")){const n=e._writableState||e._readableState;n&&!n.errorEmitted?B(e,t):e.emit("error",t)}}function f(){e.removeListener("finish",p),g()}function p(){x("onfinish"),e.removeListener("close",f),g()}function g(){x("unpipe"),n.unpipe(e)}return n.on("data",u),b(e,"error",d),e.once("close",f),e.once("finish",p),e.emit("pipe",n),!0===e.writableNeedDrain?c():i.flowing||(x("pipe resume"),n.resume()),e},z.prototype.unpipe=function(e){const t=this._readableState;if(0===t.pipes.length)return this;if(!e){const e=t.pipes;t.pipes=[],this.pause();for(let t=0;t<e.length;t++)e[t].emit("unpipe",this,{hasUnpiped:!1});return this}const n=i(t.pipes,e);return-1===n||(t.pipes.splice(n,1),0===t.pipes.length&&this.pause(),e.emit("unpipe",this,{hasUnpiped:!1})),this},z.prototype.on=function(e,t){const n=m.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,x("on readable",i.length,i.reading),i.length?K(this):i.reading||r.nextTick(ne,this))),n},z.prototype.addListener=z.prototype.on,z.prototype.removeListener=function(e,t){const n=m.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(te,this),n},z.prototype.off=z.prototype.removeListener,z.prototype.removeAllListeners=function(e){const t=m.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(te,this),t},z.prototype.resume=function(){const e=this._readableState;return e.flowing||(x("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(re,e,t))}(this,e)),e[D]=!1,this},z.prototype.pause=function(){return x("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(x("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[D]=!0,this},z.prototype.wrap=function(e){let t=!1;e.on("data",(n=>{!this.push(n)&&e.pause&&(t=!0,e.pause())})),e.on("end",(()=>{this.push(null)})),e.on("error",(e=>{B(this,e)})),e.on("close",(()=>{this.destroy()})),e.on("destroy",(()=>{this.destroy()})),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};const n=c(e);for(let t=1;t<n.length;t++){const r=n[t];void 0===this[r]&&"function"==typeof e[r]&&(this[r]=e[r].bind(e))}return this},z.prototype[p]=function(){return oe(this)},z.prototype.iterator=function(e){return void 0!==e&&C(e,"options"),oe(this,e)},l(z.prototype,{readable:{__proto__:null,get(){const e=this._readableState;return!(!e||!1===e.readable||e.destroyed||e.errorEmitted||e.endEmitted)},set(e){this._readableState&&(this._readableState.readable=!!e)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!(!1===this._readableState.readable||!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(e){this._readableState&&(this._readableState.flowing=e)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.objectMode}},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}},destroyed:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.destroyed},set(e){this._readableState&&(this._readableState.destroyed=e)}},readableEnded:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.endEmitted}}}),l(W.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return!1!==this[D]},set(e){this[D]=!!e}}}),z._fromList=ae,z.from=function(e,t){return P(z,e,t)},z.fromWeb=function(e,t){return de().newStreamReadableFromReadableStream(e,t)},z.toWeb=function(e,t){return de().newReadableStreamFromStreamReadable(e,t)},z.wrap=function(e,t){var n,r;return new z({objectMode:null===(n=null!==(r=e.readableObjectMode)&&void 0!==r?r:e.objectMode)||void 0===n||n,...t,destroy(t,n){j.destroyer(e,t),n(t)}}).wrap(e)}},5291:(e,t,n)=>{const{MathFloor:r,NumberIsInteger:i}=n(4134),{validateInteger:o}=n(277),{ERR_INVALID_ARG_VALUE:a}=n(6371).codes;let s=16384,l=16;function c(e){return e?l:s}e.exports={getHighWaterMark:function(e,t,n,o){const s=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,o,n);if(null!=s){if(!i(s)||s<0)throw new a(o?`options.${n}`:"options.highWaterMark",s);return r(s)}return c(e.objectMode)},getDefaultHighWaterMark:c,setDefaultHighWaterMark:function(e,t){o(t,"value",0),e?l=t:s=t}}},5001:(e,t,n)=>{const{ObjectSetPrototypeOf:r,Symbol:i}=n(4134);e.exports=c;const{ERR_METHOD_NOT_IMPLEMENTED:o}=n(6371).codes,a=n(3370),{getHighWaterMark:s}=n(5291);r(c.prototype,a.prototype),r(c,a);const l=i("kCallback");function c(e){if(!(this instanceof c))return new c(e);const t=e?s(this,e,"readableHighWaterMark",!0):null;0===t&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),a.call(this,e),this._readableState.sync=!1,this[l]=null,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",d)}function u(e){"function"!=typeof this._flush||this.destroyed?(this.push(null),e&&e()):this._flush(((t,n)=>{t?e?e(t):this.destroy(t):(null!=n&&this.push(n),this.push(null),e&&e())}))}function d(){this._final!==u&&u.call(this)}c.prototype._final=u,c.prototype._transform=function(e,t,n){throw new o("_transform()")},c.prototype._write=function(e,t,n){const r=this._readableState,i=this._writableState,o=r.length;this._transform(e,t,((e,t)=>{e?n(e):(null!=t&&this.push(t),i.ended||o===r.length||r.length<r.highWaterMark?n():this[l]=n)}))},c.prototype._read=function(){if(this[l]){const e=this[l];this[l]=null,e()}}},6115:(e,t,n)=>{const{SymbolAsyncIterator:r,SymbolIterator:i,SymbolFor:o}=n(4134),a=o("nodejs.stream.destroyed"),s=o("nodejs.stream.errored"),l=o("nodejs.stream.readable"),c=o("nodejs.stream.writable"),u=o("nodejs.stream.disturbed"),d=o("nodejs.webstream.isClosedPromise"),h=o("nodejs.webstream.controllerErrorFunction");function f(e,t=!1){var n;return!(!e||"function"!=typeof e.pipe||"function"!=typeof e.on||t&&("function"!=typeof e.pause||"function"!=typeof e.resume)||e._writableState&&!1===(null===(n=e._readableState)||void 0===n?void 0:n.readable)||e._writableState&&!e._readableState)}function p(e){var t;return!(!e||"function"!=typeof e.write||"function"!=typeof e.on||e._readableState&&!1===(null===(t=e._writableState)||void 0===t?void 0:t.writable))}function g(e){return e&&(e._readableState||e._writableState||"function"==typeof e.write&&"function"==typeof e.on||"function"==typeof e.pipe&&"function"==typeof e.on)}function y(e){return!(!e||g(e)||"function"!=typeof e.pipeThrough||"function"!=typeof e.getReader||"function"!=typeof e.cancel)}function m(e){return!(!e||g(e)||"function"!=typeof e.getWriter||"function"!=typeof e.abort)}function b(e){return!(!e||g(e)||"object"!=typeof e.readable||"object"!=typeof e.writable)}function v(e){if(!g(e))return null;const t=e._writableState,n=e._readableState,r=t||n;return!!(e.destroyed||e[a]||null!=r&&r.destroyed)}function w(e){if(!p(e))return null;if(!0===e.writableEnded)return!0;const t=e._writableState;return(null==t||!t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)}function _(e,t){if(!f(e))return null;const n=e._readableState;return(null==n||!n.errored)&&("boolean"!=typeof(null==n?void 0:n.endEmitted)?null:!!(n.endEmitted||!1===t&&!0===n.ended&&0===n.length))}function x(e){return e&&null!=e[l]?e[l]:"boolean"!=typeof(null==e?void 0:e.readable)?null:!v(e)&&f(e)&&e.readable&&!_(e)}function S(e){return e&&null!=e[c]?e[c]:"boolean"!=typeof(null==e?void 0:e.writable)?null:!v(e)&&p(e)&&e.writable&&!w(e)}function j(e){return"boolean"==typeof e._closed&&"boolean"==typeof e._defaultKeepAlive&&"boolean"==typeof e._removedConnection&&"boolean"==typeof e._removedContLen}function I(e){return"boolean"==typeof e._sent100&&j(e)}e.exports={isDestroyed:v,kIsDestroyed:a,isDisturbed:function(e){var t;return!(!e||!(null!==(t=e[u])&&void 0!==t?t:e.readableDidRead||e.readableAborted))},kIsDisturbed:u,isErrored:function(e){var t,n,r,i,o,a,l,c,u,d;return!(!e||!(null!==(t=null!==(n=null!==(r=null!==(i=null!==(o=null!==(a=e[s])&&void 0!==a?a:e.readableErrored)&&void 0!==o?o:e.writableErrored)&&void 0!==i?i:null===(l=e._readableState)||void 0===l?void 0:l.errorEmitted)&&void 0!==r?r:null===(c=e._writableState)||void 0===c?void 0:c.errorEmitted)&&void 0!==n?n:null===(u=e._readableState)||void 0===u?void 0:u.errored)&&void 0!==t?t:null===(d=e._writableState)||void 0===d?void 0:d.errored))},kIsErrored:s,isReadable:x,kIsReadable:l,kIsClosedPromise:d,kControllerErrorFunction:h,kIsWritable:c,isClosed:function(e){if(!g(e))return null;if("boolean"==typeof e.closed)return e.closed;const t=e._writableState,n=e._readableState;return"boolean"==typeof(null==t?void 0:t.closed)||"boolean"==typeof(null==n?void 0:n.closed)?(null==t?void 0:t.closed)||(null==n?void 0:n.closed):"boolean"==typeof e._closed&&j(e)?e._closed:null},isDuplexNodeStream:function(e){return!(!e||"function"!=typeof e.pipe||!e._readableState||"function"!=typeof e.on||"function"!=typeof e.write)},isFinished:function(e,t){return g(e)?!(!v(e)&&(!1!==(null==t?void 0:t.readable)&&x(e)||!1!==(null==t?void 0:t.writable)&&S(e))):null},isIterable:function(e,t){return null!=e&&(!0===t?"function"==typeof e[r]:!1===t?"function"==typeof e[i]:"function"==typeof e[r]||"function"==typeof e[i])},isReadableNodeStream:f,isReadableStream:y,isReadableEnded:function(e){if(!f(e))return null;if(!0===e.readableEnded)return!0;const t=e._readableState;return!(!t||t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)},isReadableFinished:_,isReadableErrored:function(e){var t,n;return g(e)?e.readableErrored?e.readableErrored:null!==(t=null===(n=e._readableState)||void 0===n?void 0:n.errored)&&void 0!==t?t:null:null},isNodeStream:g,isWebStream:function(e){return y(e)||m(e)||b(e)},isWritable:S,isWritableNodeStream:p,isWritableStream:m,isWritableEnded:w,isWritableFinished:function(e,t){if(!p(e))return null;if(!0===e.writableFinished)return!0;const n=e._writableState;return(null==n||!n.errored)&&("boolean"!=typeof(null==n?void 0:n.finished)?null:!!(n.finished||!1===t&&!0===n.ended&&0===n.length))},isWritableErrored:function(e){var t,n;return g(e)?e.writableErrored?e.writableErrored:null!==(t=null===(n=e._writableState)||void 0===n?void 0:n.errored)&&void 0!==t?t:null:null},isServerRequest:function(e){var t;return"boolean"==typeof e._consuming&&"boolean"==typeof e._dumped&&void 0===(null===(t=e.req)||void 0===t?void 0:t.upgradeOrConnect)},isServerResponse:I,willEmitClose:function(e){if(!g(e))return null;const t=e._writableState,n=e._readableState,r=t||n;return!r&&I(e)||!!(r&&r.autoDestroy&&r.emitClose&&!1===r.closed)},isTransformStream:b}},8584:(e,t,n)=>{const r=n(5606),{ArrayPrototypeSlice:i,Error:o,FunctionPrototypeSymbolHasInstance:a,ObjectDefineProperty:s,ObjectDefineProperties:l,ObjectSetPrototypeOf:c,StringPrototypeToLowerCase:u,Symbol:d,SymbolHasInstance:h}=n(4134);e.exports=C,C.WritableState=L;const{EventEmitter:f}=n(7007),p=n(4259).Stream,{Buffer:g}=n(8287),y=n(5896),{addAbortSignal:m}=n(4147),{getHighWaterMark:b,getDefaultHighWaterMark:v}=n(5291),{ERR_INVALID_ARG_TYPE:w,ERR_METHOD_NOT_IMPLEMENTED:_,ERR_MULTIPLE_CALLBACK:x,ERR_STREAM_CANNOT_PIPE:S,ERR_STREAM_DESTROYED:j,ERR_STREAM_ALREADY_FINISHED:I,ERR_STREAM_NULL_VALUES:E,ERR_STREAM_WRITE_AFTER_END:N,ERR_UNKNOWN_ENCODING:T}=n(6371).codes,{errorOrDestroy:R}=y;function O(){}c(C.prototype,p.prototype),c(C,p);const k=d("kOnFinished");function L(e,t,r){"boolean"!=typeof r&&(r=t instanceof n(3370)),this.objectMode=!(!e||!e.objectMode),r&&(this.objectMode=this.objectMode||!(!e||!e.writableObjectMode)),this.highWaterMark=e?b(this,e,"writableHighWaterMark",r):v(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const i=!(!e||!1!==e.decodeStrings);this.decodeStrings=!i,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=$.bind(void 0,t),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,A(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!e||!1!==e.emitClose,this.autoDestroy=!e||!1!==e.autoDestroy,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[k]=[]}function A(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0}function C(e){const t=this instanceof n(3370);if(!t&&!a(C,this))return new C(e);this._writableState=new L(e,this,t),e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&m(e.signal,this)),p.call(this,e),y.construct(this,(()=>{const e=this._writableState;e.writing||U(this,e),H(this,e)}))}function D(e,t,n,i){const o=e._writableState;if("function"==typeof n)i=n,n=o.defaultEncoding;else{if(n){if("buffer"!==n&&!g.isEncoding(n))throw new T(n)}else n=o.defaultEncoding;"function"!=typeof i&&(i=O)}if(null===t)throw new E;if(!o.objectMode)if("string"==typeof t)!1!==o.decodeStrings&&(t=g.from(t,n),n="buffer");else if(t instanceof g)n="buffer";else{if(!p._isUint8Array(t))throw new w("chunk",["string","Buffer","Uint8Array"],t);t=p._uint8ArrayToBuffer(t),n="buffer"}let a;return o.ending?a=new N:o.destroyed&&(a=new j("write")),a?(r.nextTick(i,a),R(e,a,!0),a):(o.pendingcb++,function(e,t,n,r,i){const o=t.objectMode?1:n.length;t.length+=o;const a=t.length<t.highWaterMark;return a||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:n,encoding:r,callback:i}),t.allBuffers&&"buffer"!==r&&(t.allBuffers=!1),t.allNoop&&i!==O&&(t.allNoop=!1)):(t.writelen=o,t.writecb=i,t.writing=!0,t.sync=!0,e._write(n,r,t.onwrite),t.sync=!1),a&&!t.errored&&!t.destroyed}(e,o,t,n,i))}function M(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new j("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function P(e,t,n,r){--t.pendingcb,r(n),q(t),R(e,n)}function $(e,t){const n=e._writableState,i=n.sync,o=n.writecb;"function"==typeof o?(n.writing=!1,n.writecb=null,n.length-=n.writelen,n.writelen=0,t?(t.stack,n.errored||(n.errored=t),e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),i?r.nextTick(P,e,n,t,o):P(e,n,t,o)):(n.buffered.length>n.bufferedIndex&&U(e,n),i?null!==n.afterWriteTickInfo&&n.afterWriteTickInfo.cb===o?n.afterWriteTickInfo.count++:(n.afterWriteTickInfo={count:1,cb:o,stream:e,state:n},r.nextTick(B,n.afterWriteTickInfo)):F(e,n,1,o))):R(e,new x)}function B({stream:e,state:t,count:n,cb:r}){return t.afterWriteTickInfo=null,F(e,t,n,r)}function F(e,t,n,r){for(!t.ending&&!e.destroyed&&0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"));n-- >0;)t.pendingcb--,r();t.destroyed&&q(t),H(e,t)}function q(e){if(e.writing)return;for(let n=e.bufferedIndex;n<e.buffered.length;++n){var t;const{chunk:r,callback:i}=e.buffered[n],o=e.objectMode?1:r.length;e.length-=o,i(null!==(t=e.errored)&&void 0!==t?t:new j("write"))}const n=e[k].splice(0);for(let t=0;t<n.length;t++){var r;n[t](null!==(r=e.errored)&&void 0!==r?r:new j("end"))}A(e)}function U(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;const{buffered:n,bufferedIndex:r,objectMode:o}=t,a=n.length-r;if(!a)return;let s=r;if(t.bufferProcessing=!0,a>1&&e._writev){t.pendingcb-=a-1;const r=t.allNoop?O:e=>{for(let t=s;t<n.length;++t)n[t].callback(e)},o=t.allNoop&&0===s?n:i(n,s);o.allBuffers=t.allBuffers,M(e,t,!0,t.length,o,"",r),A(t)}else{do{const{chunk:r,encoding:i,callback:a}=n[s];n[s++]=null,M(e,t,!1,o?1:r.length,r,i,a)}while(s<n.length&&!t.writing);s===n.length?A(t):s>256?(n.splice(0,s),t.bufferedIndex=0):t.bufferedIndex=s}t.bufferProcessing=!1}function G(e){return e.ending&&!e.destroyed&&e.constructed&&0===e.length&&!e.errored&&0===e.buffered.length&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function H(e,t,n){G(t)&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.finalCalled=!0,function(e,t){let n=!1;function i(i){if(n)R(e,null!=i?i:x());else if(n=!0,t.pendingcb--,i){const n=t[k].splice(0);for(let e=0;e<n.length;e++)n[e](i);R(e,i,t.sync)}else G(t)&&(t.prefinished=!0,e.emit("prefinish"),t.pendingcb++,r.nextTick(V,e,t))}t.sync=!0,t.pendingcb++;try{e._final(i)}catch(e){i(e)}t.sync=!1}(e,t)))}(e,t),0===t.pendingcb&&(n?(t.pendingcb++,r.nextTick(((e,t)=>{G(t)?V(e,t):t.pendingcb--}),e,t)):G(t)&&(t.pendingcb++,V(e,t))))}function V(e,t){t.pendingcb--,t.finished=!0;const n=t[k].splice(0);for(let e=0;e<n.length;e++)n[e]();if(e.emit("finish"),t.autoDestroy){const t=e._readableState;(!t||t.autoDestroy&&(t.endEmitted||!1===t.readable))&&e.destroy()}}L.prototype.getBuffer=function(){return i(this.buffered,this.bufferedIndex)},s(L.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}}),s(C,h,{__proto__:null,value:function(e){return!!a(this,e)||this===C&&e&&e._writableState instanceof L}}),C.prototype.pipe=function(){R(this,new S)},C.prototype.write=function(e,t,n){return!0===D(this,e,t,n)},C.prototype.cork=function(){this._writableState.corked++},C.prototype.uncork=function(){const e=this._writableState;e.corked&&(e.corked--,e.writing||U(this,e))},C.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=u(e)),!g.isEncoding(e))throw new T(e);return this._writableState.defaultEncoding=e,this},C.prototype._write=function(e,t,n){if(!this._writev)throw new _("_write()");this._writev([{chunk:e,encoding:t}],n)},C.prototype._writev=null,C.prototype.end=function(e,t,n){const i=this._writableState;let a;if("function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e){const n=D(this,e,t);n instanceof o&&(a=n)}return i.corked&&(i.corked=1,this.uncork()),a||(i.errored||i.ending?i.finished?a=new I("end"):i.destroyed&&(a=new j("end")):(i.ending=!0,H(this,i,!0),i.ended=!0)),"function"==typeof n&&(a||i.finished?r.nextTick(n,a):i[k].push(n)),this},l(C.prototype,{closed:{__proto__:null,get(){return!!this._writableState&&this._writableState.closed}},destroyed:{__proto__:null,get(){return!!this._writableState&&this._writableState.destroyed},set(e){this._writableState&&(this._writableState.destroyed=e)}},writable:{__proto__:null,get(){const e=this._writableState;return!(!e||!1===e.writable||e.destroyed||e.errored||e.ending||e.ended)},set(e){this._writableState&&(this._writableState.writable=!!e)}},writableFinished:{__proto__:null,get(){return!!this._writableState&&this._writableState.finished}},writableObjectMode:{__proto__:null,get(){return!!this._writableState&&this._writableState.objectMode}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return!!this._writableState&&this._writableState.ending}},writableNeedDrain:{__proto__:null,get(){const e=this._writableState;return!!e&&!e.destroyed&&!e.ending&&e.needDrain}},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!(!1===this._writableState.writable||!this._writableState.destroyed&&!this._writableState.errored||this._writableState.finished)}}});const W=y.destroy;let z;function J(){return void 0===z&&(z={}),z}C.prototype.destroy=function(e,t){const n=this._writableState;return!n.destroyed&&(n.bufferedIndex<n.buffered.length||n[k].length)&&r.nextTick(q,n),W.call(this,e,t),this},C.prototype._undestroy=y.undestroy,C.prototype._destroy=function(e,t){t(e)},C.prototype[f.captureRejectionSymbol]=function(e){this.destroy(e)},C.fromWeb=function(e,t){return J().newStreamWritableFromWritableStream(e,t)},C.toWeb=function(e){return J().newWritableStreamFromStreamWritable(e)}},277:(e,t,n)=>{const{ArrayIsArray:r,ArrayPrototypeIncludes:i,ArrayPrototypeJoin:o,ArrayPrototypeMap:a,NumberIsInteger:s,NumberIsNaN:l,NumberMAX_SAFE_INTEGER:c,NumberMIN_SAFE_INTEGER:u,NumberParseInt:d,ObjectPrototypeHasOwnProperty:h,RegExpPrototypeExec:f,String:p,StringPrototypeToUpperCase:g,StringPrototypeTrim:y}=n(4134),{hideStackFrames:m,codes:{ERR_SOCKET_BAD_PORT:b,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:w,ERR_OUT_OF_RANGE:_,ERR_UNKNOWN_SIGNAL:x}}=n(6371),{normalizeEncoding:S}=n(7760),{isAsyncFunction:j,isArrayBufferView:I}=n(7760).types,E={},N=/^[0-7]+$/,T=m(((e,t,n=u,r=c)=>{if("number"!=typeof e)throw new v(t,"number",e);if(!s(e))throw new _(t,"an integer",e);if(e<n||e>r)throw new _(t,`>= ${n} && <= ${r}`,e)})),R=m(((e,t,n=-2147483648,r=2147483647)=>{if("number"!=typeof e)throw new v(t,"number",e);if(!s(e))throw new _(t,"an integer",e);if(e<n||e>r)throw new _(t,`>= ${n} && <= ${r}`,e)})),O=m(((e,t,n=!1)=>{if("number"!=typeof e)throw new v(t,"number",e);if(!s(e))throw new _(t,"an integer",e);const r=n?1:0,i=4294967295;if(e<r||e>i)throw new _(t,`>= ${r} && <= ${i}`,e)}));function k(e,t){if("string"!=typeof e)throw new v(t,"string",e)}const L=m(((e,t,n)=>{if(!i(n,e)){const r=o(a(n,(e=>"string"==typeof e?`'${e}'`:p(e))),", ");throw new w(t,e,"must be one of: "+r)}}));function A(e,t){if("boolean"!=typeof e)throw new v(t,"boolean",e)}function C(e,t,n){return null!=e&&h(e,t)?e[t]:n}const D=m(((e,t,n=null)=>{const i=C(n,"allowArray",!1),o=C(n,"allowFunction",!1);if(!C(n,"nullable",!1)&&null===e||!i&&r(e)||"object"!=typeof e&&(!o||"function"!=typeof e))throw new v(t,"Object",e)})),M=m(((e,t)=>{if(null!=e&&"object"!=typeof e&&"function"!=typeof e)throw new v(t,"a dictionary",e)})),P=m(((e,t,n=0)=>{if(!r(e))throw new v(t,"Array",e);if(e.length<n)throw new w(t,e,`must be longer than ${n}`)})),$=m(((e,t="buffer")=>{if(!I(e))throw new v(t,["Buffer","TypedArray","DataView"],e)})),B=m(((e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new v(t,"AbortSignal",e)})),F=m(((e,t)=>{if("function"!=typeof e)throw new v(t,"Function",e)})),q=m(((e,t)=>{if("function"!=typeof e||j(e))throw new v(t,"Function",e)})),U=m(((e,t)=>{if(void 0!==e)throw new v(t,"undefined",e)})),G=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function H(e,t){if(void 0===e||!f(G,e))throw new w(t,e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}e.exports={isInt32:function(e){return e===(0|e)},isUint32:function(e){return e===e>>>0},parseFileMode:function(e,t,n){if(void 0===e&&(e=n),"string"==typeof e){if(null===f(N,e))throw new w(t,e,"must be a 32-bit unsigned integer or an octal string");e=d(e,8)}return O(e,t),e},validateArray:P,validateStringArray:function(e,t){P(e,t);for(let n=0;n<e.length;n++)k(e[n],`${t}[${n}]`)},validateBooleanArray:function(e,t){P(e,t);for(let n=0;n<e.length;n++)A(e[n],`${t}[${n}]`)},validateAbortSignalArray:function(e,t){P(e,t);for(let n=0;n<e.length;n++){const r=e[n],i=`${t}[${n}]`;if(null==r)throw new v(i,"AbortSignal",r);B(r,i)}},validateBoolean:A,validateBuffer:$,validateDictionary:M,validateEncoding:function(e,t){const n=S(t),r=e.length;if("hex"===n&&r%2!=0)throw new w("encoding",t,`is invalid for data of length ${r}`)},validateFunction:F,validateInt32:R,validateInteger:T,validateNumber:function(e,t,n=void 0,r){if("number"!=typeof e)throw new v(t,"number",e);if(null!=n&&e<n||null!=r&&e>r||(null!=n||null!=r)&&l(e))throw new _(t,`${null!=n?`>= ${n}`:""}${null!=n&&null!=r?" && ":""}${null!=r?`<= ${r}`:""}`,e)},validateObject:D,validateOneOf:L,validatePlainFunction:q,validatePort:function(e,t="Port",n=!0){if("number"!=typeof e&&"string"!=typeof e||"string"==typeof e&&0===y(e).length||+e!=+e>>>0||e>65535||0===e&&!n)throw new b(t,e,n);return 0|e},validateSignalName:function(e,t="signal"){if(k(e,t),void 0===E[e]){if(void 0!==E[g(e)])throw new x(e+" (signals must use all capital letters)");throw new x(e)}},validateString:k,validateUint32:O,validateUndefined:U,validateUnion:function(e,t,n){if(!i(n,e))throw new v(t,`('${o(n,"|")}')`,e)},validateAbortSignal:B,validateLinkHeaderValue:function(e){if("string"==typeof e)return H(e,"hints"),e;if(r(e)){const t=e.length;let n="";if(0===t)return n;for(let r=0;r<t;r++){const i=e[r];H(i,"hints"),n+=i,r!==t-1&&(n+=", ")}return n}throw new w("hints",e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}}},9198:(e,t,n)=>{const r=n(5506),i=n(3095),o=r.Readable.destroy;e.exports=r.Readable,e.exports._uint8ArrayToBuffer=r._uint8ArrayToBuffer,e.exports._isUint8Array=r._isUint8Array,e.exports.isDisturbed=r.isDisturbed,e.exports.isErrored=r.isErrored,e.exports.isReadable=r.isReadable,e.exports.Readable=r.Readable,e.exports.Writable=r.Writable,e.exports.Duplex=r.Duplex,e.exports.Transform=r.Transform,e.exports.PassThrough=r.PassThrough,e.exports.addAbortSignal=r.addAbortSignal,e.exports.finished=r.finished,e.exports.destroy=r.destroy,e.exports.destroy=o,e.exports.pipeline=r.pipeline,e.exports.compose=r.compose,Object.defineProperty(r,"promises",{configurable:!0,enumerable:!0,get:()=>i}),e.exports.Stream=r.Stream,e.exports.default=e.exports},6371:(e,t,n)=>{const{format:r,inspect:i,AggregateError:o}=n(7760),a=globalThis.AggregateError||o,s=Symbol("kIsNodeError"),l=["string","function","number","object","Function","Object","boolean","bigint","symbol"],c=/^([A-Z][a-z0-9]*)+$/,u={};function d(e,t){if(!e)throw new u.ERR_INTERNAL_ASSERTION(t)}function h(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function f(e,t,n){n||(n=Error);class i extends n{constructor(...n){super(function(e,t,n){if("function"==typeof t)return d(t.length<=n.length,`Code: ${e}; The provided arguments length (${n.length}) does not match the required ones (${t.length}).`),t(...n);const i=(t.match(/%[dfijoOs]/g)||[]).length;return d(i===n.length,`Code: ${e}; The provided arguments length (${n.length}) does not match the required ones (${i}).`),0===n.length?t:r(t,...n)}(e,t,n))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:n.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=e,i.prototype[s]=!0,u[e]=i}function p(e){const t="__node_internal_"+e.name;return Object.defineProperty(e,"name",{value:t}),e}class g extends Error{constructor(e="The operation was aborted",t=void 0){if(void 0!==t&&"object"!=typeof t)throw new u.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError"}}f("ERR_ASSERTION","%s",Error),f("ERR_INVALID_ARG_TYPE",((e,t,n)=>{d("string"==typeof e,"'name' must be a string"),Array.isArray(t)||(t=[t]);let r="The ";e.endsWith(" argument")?r+=`${e} `:r+=`"${e}" ${e.includes(".")?"property":"argument"} `,r+="must be ";const o=[],a=[],s=[];for(const e of t)d("string"==typeof e,"All expected entries have to be of type string"),l.includes(e)?o.push(e.toLowerCase()):c.test(e)?a.push(e):(d("object"!==e,'The value "object" should be written as "Object"'),s.push(e));if(a.length>0){const e=o.indexOf("object");-1!==e&&(o.splice(o,e,1),a.push("Object"))}if(o.length>0){switch(o.length){case 1:r+=`of type ${o[0]}`;break;case 2:r+=`one of type ${o[0]} or ${o[1]}`;break;default:{const e=o.pop();r+=`one of type ${o.join(", ")}, or ${e}`}}(a.length>0||s.length>0)&&(r+=" or ")}if(a.length>0){switch(a.length){case 1:r+=`an instance of ${a[0]}`;break;case 2:r+=`an instance of ${a[0]} or ${a[1]}`;break;default:{const e=a.pop();r+=`an instance of ${a.join(", ")}, or ${e}`}}s.length>0&&(r+=" or ")}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(r+="an "),r+=`${s[0]}`;break;case 2:r+=`one of ${s[0]} or ${s[1]}`;break;default:{const e=s.pop();r+=`one of ${s.join(", ")}, or ${e}`}}if(null==n)r+=`. Received ${n}`;else if("function"==typeof n&&n.name)r+=`. Received function ${n.name}`;else if("object"==typeof n){var u;null!==(u=n.constructor)&&void 0!==u&&u.name?r+=`. Received an instance of ${n.constructor.name}`:r+=`. Received ${i(n,{depth:-1})}`}else{let e=i(n,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),r+=`. Received type ${typeof n} (${e})`}return r}),TypeError),f("ERR_INVALID_ARG_VALUE",((e,t,n="is invalid")=>{let r=i(t);return r.length>128&&(r=r.slice(0,128)+"..."),`The ${e.includes(".")?"property":"argument"} '${e}' ${n}. Received ${r}`}),TypeError),f("ERR_INVALID_RETURN_VALUE",((e,t,n)=>{var r;return`Expected ${e} to be returned from the "${t}" function but got ${null!=n&&null!==(r=n.constructor)&&void 0!==r&&r.name?`instance of ${n.constructor.name}`:"type "+typeof n}.`}),TypeError),f("ERR_MISSING_ARGS",((...e)=>{let t;d(e.length>0,"At least one arg needs to be specified");const n=e.length;switch(e=(Array.isArray(e)?e:[e]).map((e=>`"${e}"`)).join(" or "),n){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const n=e.pop();t+=`The ${e.join(", ")}, and ${n} arguments`}}return`${t} must be specified`}),TypeError),f("ERR_OUT_OF_RANGE",((e,t,n)=>{let r;return d(t,'Missing "range" argument'),Number.isInteger(n)&&Math.abs(n)>2**32?r=h(String(n)):"bigint"==typeof n?(r=String(n),(n>2n**32n||n<-(2n**32n))&&(r=h(r)),r+="n"):r=i(n),`The value of "${e}" is out of range. It must be ${t}. Received ${r}`}),RangeError),f("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),f("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),f("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),f("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),f("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),f("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),f("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),f("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),f("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),f("ERR_STREAM_WRITE_AFTER_END","write after end",Error),f("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),e.exports={AbortError:g,aggregateTwoErrors:p((function(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;const n=new a([t,e],t.message);return n.code=t.code,n}return e||t})),hideStackFrames:p,codes:u}},4134:e=>{e.exports={ArrayIsArray:e=>Array.isArray(e),ArrayPrototypeIncludes:(e,t)=>e.includes(t),ArrayPrototypeIndexOf:(e,t)=>e.indexOf(t),ArrayPrototypeJoin:(e,t)=>e.join(t),ArrayPrototypeMap:(e,t)=>e.map(t),ArrayPrototypePop:(e,t)=>e.pop(t),ArrayPrototypePush:(e,t)=>e.push(t),ArrayPrototypeSlice:(e,t,n)=>e.slice(t,n),Error,FunctionPrototypeCall:(e,t,...n)=>e.call(t,...n),FunctionPrototypeSymbolHasInstance:(e,t)=>Function.prototype[Symbol.hasInstance].call(e,t),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:(e,t)=>Object.defineProperties(e,t),ObjectDefineProperty:(e,t,n)=>Object.defineProperty(e,t,n),ObjectGetOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(e,t),ObjectKeys:e=>Object.keys(e),ObjectSetPrototypeOf:(e,t)=>Object.setPrototypeOf(e,t),Promise,PromisePrototypeCatch:(e,t)=>e.catch(t),PromisePrototypeThen:(e,t,n)=>e.then(t,n),PromiseReject:e=>Promise.reject(e),PromiseResolve:e=>Promise.resolve(e),ReflectApply:Reflect.apply,RegExpPrototypeTest:(e,t)=>e.test(t),SafeSet:Set,String,StringPrototypeSlice:(e,t,n)=>e.slice(t,n),StringPrototypeToLowerCase:e=>e.toLowerCase(),StringPrototypeToUpperCase:e=>e.toUpperCase(),StringPrototypeTrim:e=>e.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:(e,t,n)=>e.set(t,n),Boolean,Uint8Array}},7760:(e,t,n)=>{const r=n(8287),{kResistStopPropagation:i,SymbolDispose:o}=n(4134),a=globalThis.AbortSignal||n(5568).AbortSignal,s=globalThis.AbortController||n(5568).AbortController,l=Object.getPrototypeOf((async function(){})).constructor,c=globalThis.Blob||r.Blob,u=void 0!==c?function(e){return e instanceof c}:function(e){return!1},d=(e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new ERR_INVALID_ARG_TYPE(t,"AbortSignal",e)};class h extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t="";for(let n=0;n<e.length;n++)t+=` ${e[n].stack}\n`;super(t),this.name="AggregateError",this.errors=e}}e.exports={AggregateError:h,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...n){t||(t=!0,e.apply(this,n))}},createDeferredPromise:function(){let e,t;return{promise:new Promise(((n,r)=>{e=n,t=r})),resolve:e,reject:t}},promisify:e=>new Promise(((t,n)=>{e(((e,...r)=>e?n(e):t(...r)))})),debuglog:()=>function(){},format:(e,...t)=>e.replace(/%([sdifj])/g,(function(...[e,n]){const r=t.shift();return"f"===n?r.toFixed(6):"j"===n?JSON.stringify(r):"s"===n&&"object"==typeof r?`${r.constructor!==Object?r.constructor.name:""} {}`.trim():r.toString()})),inspect(e){switch(typeof e){case"string":if(e.includes("'")){if(!e.includes('"'))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case"number":return isNaN(e)?"NaN":Object.is(e,-0)?String(e):e;case"bigint":return`${String(e)}n`;case"boolean":case"undefined":return String(e);case"object":return"{}"}},types:{isAsyncFunction:e=>e instanceof l,isArrayBufferView:e=>ArrayBuffer.isView(e)},isBlob:u,deprecate:(e,t)=>e,addAbortListener:n(7007).addAbortListener||function(e,t){if(void 0===e)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);let n;return d(e,"signal"),(e=>{if("function"!=typeof e)throw new ERR_INVALID_ARG_TYPE("listener","Function",e)})(t),e.aborted?queueMicrotask((()=>t())):(e.addEventListener("abort",t,{__proto__:null,once:!0,[i]:!0}),n=()=>{e.removeEventListener("abort",t)}),{__proto__:null,[o](){var e;null===(e=n)||void 0===e||e()}}},AbortSignalAny:a.any||function(e){if(1===e.length)return e[0];const t=new s,n=()=>t.abort();return e.forEach((e=>{d(e,"signals"),e.addEventListener("abort",n,{once:!0})})),t.signal.addEventListener("abort",(()=>{e.forEach((e=>e.removeEventListener("abort",n)))}),{once:!0}),t.signal}},e.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")},5506:(e,t,n)=>{const{Buffer:r}=n(8287),{ObjectDefineProperty:i,ObjectKeys:o,ReflectApply:a}=n(4134),{promisify:{custom:s}}=n(7760),{streamReturningOperators:l,promiseReturningOperators:c}=n(823),{codes:{ERR_ILLEGAL_CONSTRUCTOR:u}}=n(6371),d=n(7830),{setDefaultHighWaterMark:h,getDefaultHighWaterMark:f}=n(5291),{pipeline:p}=n(7758),{destroyer:g}=n(5896),y=n(6238),m=n(3095),b=n(6115),v=e.exports=n(4259).Stream;v.isDestroyed=b.isDestroyed,v.isDisturbed=b.isDisturbed,v.isErrored=b.isErrored,v.isReadable=b.isReadable,v.isWritable=b.isWritable,v.Readable=n(7576);for(const _ of o(l)){const x=l[_];function S(...e){if(new.target)throw u();return v.Readable.from(a(x,this,e))}i(S,"name",{__proto__:null,value:x.name}),i(S,"length",{__proto__:null,value:x.length}),i(v.Readable.prototype,_,{__proto__:null,value:S,enumerable:!1,configurable:!0,writable:!0})}for(const j of o(c)){const I=c[j];function E(...e){if(new.target)throw u();return a(I,this,e)}i(E,"name",{__proto__:null,value:I.name}),i(E,"length",{__proto__:null,value:I.length}),i(v.Readable.prototype,j,{__proto__:null,value:E,enumerable:!1,configurable:!0,writable:!0})}v.Writable=n(8584),v.Duplex=n(3370),v.Transform=n(5001),v.PassThrough=n(6524),v.pipeline=p;const{addAbortSignal:w}=n(4147);v.addAbortSignal=w,v.finished=y,v.destroy=g,v.compose=d,v.setDefaultHighWaterMark=h,v.getDefaultHighWaterMark=f,i(v,"promises",{__proto__:null,configurable:!0,enumerable:!0,get:()=>m}),i(p,s,{__proto__:null,enumerable:!0,get:()=>m.pipeline}),i(y,s,{__proto__:null,enumerable:!0,get:()=>m.finished}),v.Stream=v,v._isUint8Array=function(e){return e instanceof Uint8Array},v._uint8ArrayToBuffer=function(e){return r.from(e.buffer,e.byteOffset,e.byteLength)}},3095:(e,t,n)=>{const{ArrayPrototypePop:r,Promise:i}=n(4134),{isIterable:o,isNodeStream:a,isWebStream:s}=n(6115),{pipelineImpl:l}=n(7758),{finished:c}=n(6238);n(5506),e.exports={finished:c,pipeline:function(...e){return new i(((t,n)=>{let i,c;const u=e[e.length-1];if(u&&"object"==typeof u&&!a(u)&&!o(u)&&!s(u)){const t=r(e);i=t.signal,c=t.end}l(e,((e,r)=>{e?n(e):t(r)}),{signal:i,end:c})}))}}},2791:function(e,t,n){!function(e){if(!e.setImmediate){var t,n,r,i,o,a=1,s={},l=!1,c=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?t=function(e){process.nextTick((function(){h(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?(i="setImmediate$"+Math.random()+"$",o=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(i)&&h(+t.data.slice(i.length))},e.addEventListener?e.addEventListener("message",o,!1):e.attachEvent("onmessage",o),t=function(t){e.postMessage(i+t,"*")}):e.MessageChannel?((r=new MessageChannel).port1.onmessage=function(e){h(e.data)},t=function(e){r.port2.postMessage(e)}):c&&"onreadystatechange"in c.createElement("script")?(n=c.documentElement,t=function(e){var t=c.createElement("script");t.onreadystatechange=function(){h(e),t.onreadystatechange=null,n.removeChild(t),t=null},n.appendChild(t)}):t=function(e){setTimeout(h,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var n=new Array(arguments.length-1),r=0;r<n.length;r++)n[r]=arguments[r+1];var i={callback:e,args:n};return s[a]=i,t(a),a++},u.clearImmediate=d}function d(e){delete s[e]}function h(e){if(l)setTimeout(h,0,e);else{var t=s[e];if(t){l=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(void 0,n)}}(t)}finally{d(e),l=!1}}}}}("undefined"==typeof self?void 0===n.g?this:n.g:self)},3141:(e,t,n)=>{var r=n(5003).Buffer,i=r.isEncoding||function(e){switch((e=""+e)&&e.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 o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=c,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=u,this.end=d,t=3;break;default:return this.write=h,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,n=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function l(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function u(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function f(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var n=function(e,t,n){var r=t.length-1;if(r<n)return 0;var i=a(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||-2===i?0:(i=a(t[r]))>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||-2===i?0:(i=a(t[r]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},5003:(e,t,n)=>{var r=n(8287),i=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},259:e=>{e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},8799:(e,t,n)=>{function r(e){var t=this;if(t instanceof r||(t=new r),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var n=0,i=arguments.length;n<i;n++)t.push(arguments[n]);return t}function i(e,t,n){var r=t===e.head?new s(n,null,t,e):new s(n,t,t.next,e);return null===r.next&&(e.tail=r),null===r.prev&&(e.head=r),e.length++,r}function o(e,t){e.tail=new s(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function a(e,t){e.head=new s(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function s(e,t,n,r){if(!(this instanceof s))return new s(e,t,n,r);this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}e.exports=r,r.Node=s,r.create=r,r.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t},r.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},r.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},r.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)o(this,arguments[e]);return this.length},r.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)a(this,arguments[e]);return this.length},r.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},r.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},r.prototype.forEach=function(e,t){t=t||this;for(var n=this.head,r=0;null!==n;r++)e.call(t,n.value,r,this),n=n.next},r.prototype.forEachReverse=function(e,t){t=t||this;for(var n=this.tail,r=this.length-1;null!==n;r--)e.call(t,n.value,r,this),n=n.prev},r.prototype.get=function(e){for(var t=0,n=this.head;null!==n&&t<e;t++)n=n.next;if(t===e&&null!==n)return n.value},r.prototype.getReverse=function(e){for(var t=0,n=this.tail;null!==n&&t<e;t++)n=n.prev;if(t===e&&null!==n)return n.value},r.prototype.map=function(e,t){t=t||this;for(var n=new r,i=this.head;null!==i;)n.push(e.call(t,i.value,this)),i=i.next;return n},r.prototype.mapReverse=function(e,t){t=t||this;for(var n=new r,i=this.tail;null!==i;)n.push(e.call(t,i.value,this)),i=i.prev;return n},r.prototype.reduce=function(e,t){var n,r=this.head;if(arguments.length>1)n=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");r=this.head.next,n=this.head.value}for(var i=0;null!==r;i++)n=e(n,r.value,i),r=r.next;return n},r.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");r=this.tail.prev,n=this.tail.value}for(var i=this.length-1;null!==r;i--)n=e(n,r.value,i),r=r.prev;return n},r.prototype.toArray=function(){for(var e=new Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},r.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},r.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new r;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,o=this.head;null!==o&&i<e;i++)o=o.next;for(;null!==o&&i<t;i++,o=o.next)n.push(o.value);return n},r.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new r;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,o=this.tail;null!==o&&i>t;i--)o=o.prev;for(;null!==o&&i>e;i--,o=o.prev)n.push(o.value);return n},r.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var r=0,o=this.head;null!==o&&r<e;r++)o=o.next;var a=[];for(r=0;o&&r<t;r++)a.push(o.value),o=this.removeNode(o);for(null===o&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev),r=0;r<n.length;r++)o=i(this,o,n[r]);return a},r.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;null!==n;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=t,this.tail=e,this};try{n(259)(r)}catch(e){}},7789:()=>{}},n={};function r(e){var i=n[e];if(void 0!==i)return i.exports;var o=n[e]={exports:{}};return t[e].call(o.exports,o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};r.d(i,{TS:()=>dt,aH:()=>lt,k_:()=>xe,a6:()=>Gr,nt:()=>ae,Sx:()=>se,E7:()=>K,F3:()=>_e,WW:()=>ct});var o={};r.r(o),r.d(o,{anyAtomicType:()=>Hn,anySimpleType:()=>Gn,anyURI:()=>dr,base64Binary:()=>ur,boolean:()=>Xn,byte:()=>xr,date:()=>rr,dateTime:()=>tr,dateTimeStamp:()=>kr,dayTimeDuration:()=>Or,decimal:()=>Kn,double:()=>Zn,duration:()=>er,float:()=>Yn,gDay:()=>sr,gMonth:()=>lr,gMonthDay:()=>ar,gYear:()=>or,gYearMonth:()=>ir,hexBinary:()=>cr,int:()=>wr,integer:()=>yr,language:()=>gr,long:()=>vr,negativeInteger:()=>br,nonNegativeInteger:()=>Sr,nonPositiveInteger:()=>mr,normalizedString:()=>fr,positiveInteger:()=>Tr,short:()=>_r,string:()=>Qn,time:()=>nr,token:()=>pr,unsignedByte:()=>Nr,unsignedInt:()=>Ir,unsignedLong:()=>jr,unsignedShort:()=>Er,yearMonthDuration:()=>Rr});const a="http://www.w3.org/1999/02/22-rdf-syntax-ns#",s="http://www.w3.org/2001/XMLSchema#",l="http://www.w3.org/2000/10/swap/",c={xsd:{decimal:`${s}decimal`,boolean:`${s}boolean`,double:`${s}double`,integer:`${s}integer`,string:`${s}string`},rdf:{type:`${a}type`,nil:`${a}nil`,first:`${a}first`,rest:`${a}rest`,langString:`${a}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${l}reify#forSome`,forAll:`${l}reify#forAll`},log:{implies:`${l}log#implies`}},{rdf:u,xsd:d}=c;let h,f=0;const p={namedNode:j,blankNode:I,variable:N,literal:E,defaultGraph:function(){return h},quad:T,triple:T,fromTerm:R,fromQuad:O},g=p;class y{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof y?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}class m extends y{get termType(){return"NamedNode"}}class b extends y{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const e=this.id;let t=e.lastIndexOf('"')+1;return t<e.length&&"@"===e[t++]?e.substr(t).toLowerCase():""}get datatype(){return new m(this.datatypeString)}get datatypeString(){const e=this.id,t=e.lastIndexOf('"')+1,n=t<e.length?e[t]:"";return"^"===n?e.substr(t+2):"@"!==n?d.string:u.langString}equals(e){return e instanceof b?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&this.datatype.value===e.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}}class v extends y{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}}class w extends y{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}}function _(e,t,n){if(t=t||p,!e)return t.defaultGraph();switch(e[0]){case"?":return t.variable(e.substr(1));case"_":return t.blankNode(e.substr(2));case'"':if(t===p)return new b(e);if('"'===e[e.length-1])return t.literal(e.substr(1,e.length-2));const r=e.lastIndexOf('"',e.length-1);return t.literal(e.substr(1,r-1),"@"===e[r+1]?e.substr(r+2):t.namedNode(e.substr(r+3)));case"[":e=JSON.parse(e);break;default:if(!n||!Array.isArray(e))return t.namedNode(e)}return t.quad(_(e[0],t,!0),_(e[1],t,!0),_(e[2],t,!0),e[3]&&_(e[3],t,!0))}function x(e,t){if("string"==typeof e)return e;if(e instanceof y&&"Quad"!==e.termType)return e.id;if(!e)return h.id;switch(e.termType){case"NamedNode":return e.value;case"BlankNode":return`_:${e.value}`;case"Variable":return`?${e.value}`;case"DefaultGraph":return"";case"Literal":return`"${e.value}"${e.language?`@${e.language}`:e.datatype&&e.datatype.value!==d.string?`^^${e.datatype.value}`:""}`;case"Quad":const n=[x(e.subject,!0),x(e.predicate,!0),x(e.object,!0)];return e.graph&&"DefaultGraph"!==e.graph.termType&&n.push(x(e.graph,!0)),t?n:JSON.stringify(n);default:throw new Error(`Unexpected termType: ${e.termType}`)}}h=new class extends y{constructor(){return super(""),h||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};class S extends y{constructor(e,t,n,r){super(""),this._subject=e,this._predicate=t,this._object=n,this._graph=r||h}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 j(e){return new m(e)}function I(e){return new v(e||"n3-"+f++)}function E(e,t){if("string"==typeof t)return new b(`"${e}"@${t.toLowerCase()}`);let n=t?t.value:"";return""===n&&("boolean"==typeof e?n=d.boolean:"number"==typeof e&&(Number.isFinite(e)?n=Number.isInteger(e)?d.integer:d.double:(n=d.double,Number.isNaN(e)||(e=e>0?"INF":"-INF")))),""===n||n===d.string?new b(`"${e}"`):new b(`"${e}"^^${n}`)}function N(e){return new w(e)}function T(e,t,n,r){return new S(e,t,n,r)}function R(e){if(e instanceof y)return e;switch(e.termType){case"NamedNode":return j(e.value);case"BlankNode":return I(e.value);case"Variable":return N(e.value);case"DefaultGraph":return h;case"Literal":return E(e.value,e.language||e.datatype);case"Quad":return O(e);default:throw new Error(`Unexpected termType: ${e.termType}`)}}function O(e){if(e instanceof S)return e;if("Quad"!==e.termType)throw new Error(`Unexpected termType: ${e.termType}`);return T(R(e.subject),R(e.predicate),R(e.object),R(e.graph))}const k="http://www.w3.org/ns/shacl#",L="http://datashapes.org/dash#",A="http://www.w3.org/2001/XMLSchema#",C="http://www.w3.org/1999/02/22-rdf-syntax-ns#",D="http://www.w3.org/2000/01/rdf-schema#",M="http://www.w3.org/2004/02/skos/core#",P="http://www.w3.org/2002/07/owl#",$=g.namedNode("shapes"),B=g.namedNode(C+"type"),F=g.namedNode("http://purl.org/dc/terms/conformsTo"),q=g.namedNode(D+"subClassOf"),U=g.namedNode(M+"broader"),G=g.namedNode(P+"imports"),H=g.namedNode(P+"NamedIndividual"),V=g.namedNode(k+"NodeShape"),W=g.namedNode(k+"IRI"),z=g.namedNode(k+"class"),J=g.namedNode(k+"targetClass"),Q=g.namedNode(k+"nodeKind");function X(e,t,n=k,r){let i="";const o=function(e,t,n=k,r){let i;const o=n+t;if(null==r?void 0:r.length){for(const t of r)for(const n of e)if(n.predicate.value===o){if(n.object.id.endsWith(`@${t}`))return n.object;n.object.id.indexOf("@")<0?i=n.object:i||(i=n.object)}}else for(const t of e)if(t.predicate.value===o)return t.object;return i}(e,t,n,r);return o&&(i=o.value),i}function K(e,t){return X(e,"prefLabel",M,t)||X(e,"label",D,t)}function Y(e,t,n,r){const i=[];for(const o of e)i.push({value:o,label:K(t.getQuads(o,null,null,null),n),indent:r});return i}function Z(e,t){for(const n in t)e=e.replace(t[n],"");return e}function ee(e,t,n,r,i=new Set){for(const o of t.owlImports)i.has(o.id)||(i.add(o.id),r.push(...n.getSubjects(B,e,o)));t.parent&&ee(e,t.parent,n,r,i)}function te(e,t,n=0){const r=t.config.shapesGraph.getSubjects(B,e,$);r.push(...t.config.dataGraph.getSubjects(B,e,null)),ee(e,t,t.config.shapesGraph,r);const i=Y(r,t.config.shapesGraph,t.config.languages,n);for(const r of t.config.shapesGraph.getSubjects(q,e,null))i.push(...te(r,t,n+1));if(t.config.shapesGraph.getQuads(e,B,H,null).length>0){i.push(...Y([e],t.config.shapesGraph,t.config.languages,n));for(const r of t.config.shapesGraph.getSubjects(U,e,null))i.push(...te(r,t,n+1))}return i}function ne(e){let t;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}function re(e,t,n){if(void 0===t)return n;if(void 0===n)return t;const r=e.indexOf(t.language);if(r<0)return n;const i=e.indexOf(n.language);return i<0||i>r?t:n}function ie(e,t,n){const r=document.createElement("div");r.classList.add("shacl-or-constraint");const i=[];if(i.push({label:"--- please choose ---",value:""}),t instanceof Ce){const o=[];for(let r=0;r<e.length;r++){const a=new Se(e[r],t,n);o.push(a),i.push({label:a.template.label,value:r.toString()})}const a=n.theme.createListEditor("Please choose",null,!1,i),s=a.querySelector(".editor");s.onchange=()=>{s.value&&r.replaceWith(o[parseInt(s.value)])},r.appendChild(a)}else{const o=[];for(let t=0;t<e.length;t++){const r=n.shapesGraph.getQuads(e[t],null,null,null);r.length&&(o.push(r),i.push({label:K(r,n.languages)||Z(r[0].predicate.value,n.prefixes)+" = "+Z(r[0].object.value,n.prefixes),value:t.toString()}))}const a=n.theme.createListEditor(t.template.label+"?",null,!1,i,t.template),s=a.querySelector(".editor");s.onchange=()=>{s.value&&r.replaceWith(je(t.template.clone().merge(o[parseInt(s.value)]),void 0,!0))},r.appendChild(a)}return r}const oe={[`${k}name`]:(e,t)=>{const n=t;e.name=re(e.config.languages,e.name,n)},[`${k}description`]:(e,t)=>{const n=t;e.description=re(e.config.languages,e.description,n)},[`${k}path`]:(e,t)=>{e.path=t.value},[`${k}node`]:(e,t)=>{e.node=t},[`${k}datatype`]:(e,t)=>{e.datatype=t},[`${k}nodeKind`]:(e,t)=>{e.nodeKind=t},[`${k}minCount`]:(e,t)=>{e.minCount=parseInt(t.value)},[`${k}maxCount`]:(e,t)=>{e.maxCount=parseInt(t.value)},[`${k}minLength`]:(e,t)=>{e.minLength=parseInt(t.value)},[`${k}maxLength`]:(e,t)=>{e.maxLength=parseInt(t.value)},[`${k}minInclusive`]:(e,t)=>{e.minInclusive=parseInt(t.value)},[`${k}maxInclusive`]:(e,t)=>{e.maxInclusive=parseInt(t.value)},[`${k}minExclusive`]:(e,t)=>{e.minExclusive=parseInt(t.value)},[`${k}maxExclusive`]:(e,t)=>{e.maxExclusive=parseInt(t.value)},[`${k}pattern`]:(e,t)=>{e.pattern=t.value},[`${k}order`]:(e,t)=>{e.order=parseInt(t.value)},[`${L}singleLine`]:(e,t)=>{e.singleLine="true"===t.value},[`${L}readonly`]:(e,t)=>{e.readonly="true"===t.value},"http://www.w3.org/ns/oa#styleClass":(e,t)=>{e.cssClass=t.value},[`${k}and`]:(e,t)=>{e.shaclAnd=t.value},[`${k}in`]:(e,t)=>{e.shaclIn=t.value},[`${k}languageIn`]:(e,t)=>{e.languageIn=e.config.lists[t.value],e.datatype=g.namedNode(C+"langString")},[`${k}defaultValue`]:(e,t)=>{e.defaultValue=t},[`${k}hasValue`]:(e,t)=>{e.hasValue=t},[G.id]:(e,t)=>{e.owlImports.push(t)},[z.id]:(e,t)=>{e.class=t;const n=e.config.shapesGraph.getSubjects(J,t,null);n.length>0&&(e.node=n[0])},[`${k}or`]:(e,t)=>{const n=e.config.lists[t.value];(null==n?void 0:n.length)?e.shaclOr=n:console.error("list not found:",t.value,"existing lists:",e.config.lists)}};class ae{constructor(e,t,n){this.label="",this.owlImports=[],this.parent=t,this.config=n,this.merge(e)}merge(e){var t,n;for(const n of e)null===(t=oe[n.predicate.id])||void 0===t||t.call(this,this,n.object);if(this.label=(null===(n=this.name)||void 0===n?void 0:n.value)||K(e,this.config.languages),this.label||this.shaclAnd||(this.label=this.path?Z(this.path,this.config.prefixes):"unknown"),(this.node||this.shaclAnd)&&(this.extendedShapes=[],this.node&&this.extendedShapes.push(this.node),this.shaclAnd)){const e=this.config.lists[this.shaclAnd];if(null==e?void 0:e.length)for(const t of e)this.extendedShapes.push(t)}return this}clone(){const e=Object.assign({},this);return e.owlImports=[...this.owlImports],this.languageIn&&(e.languageIn=[...this.languageIn]),this.shaclOr&&(e.shaclOr=[...this.shaclOr]),e.merge=this.merge.bind(e),e.clone=this.clone.bind(e),e}}class se{constructor(e){let t="form { box-sizing: border-box; display:block; --label-width: 8em; --caret-size: 10px; }\nform.mode-edit { padding-left: 1em; }\nform *, form ::after, form ::before { box-sizing: inherit; }\nshacl-node, .shacl-group { display: flex; flex-direction: column; width: 100%; position: relative; }\nshacl-node .control-button { text-decoration: none; cursor: pointer; border: 1px solid transparent; border-radius: 4px; padding: 2px 4px; }\nshacl-node .control-button:hover { border-color: inherit; }\nshacl-node .remove-button { margin-left: 4px; }\nshacl-node .add-button { font-size: 0.8rem; color: #555; margin: 4px 24px 0 0; }\nshacl-node .add-button:before { content: '+'; margin-right: 0.2em; }\nshacl-node .add-button:hover { color: inherit; }\nshacl-node h1 { font-size: 1.1rem; border-bottom: 1px solid; margin-top: 4px; color: #555; }\nshacl-property { display: flex; flex-direction: column; align-items: end; position: relative; }\nshacl-property:not(.may-add) > .add-button { display: none; }\nshacl-property:not(.may-remove) > .property-instance > .remove-button:not(.persistent) { visibility: hidden; }\nshacl-property:not(.may-remove) > .shacl-or-constraint > .remove-button:not(.persistent) { visibility: hidden; }\n.shacl-group { margin-bottom: 1em; padding-bottom: 1em; }\n.mode-view .shacl-group:not(:has(shacl-property)) { display: none; }\n.property-instance, .shacl-or-constraint { display: flex; align-items: flex-start; padding: 4px 0; width: 100%; position: relative; }\n.shacl-or-constraint label { display: inline-block; word-break: break-word; width: var(--label-width); line-height: 1em; padding-top: 0.15em; padding-right: 1em; flex-shrink: 0; position: relative; }\n.property-instance label[title] { cursor: help; text-decoration: underline dashed #AAA; }\n.mode-edit .property-instance label.required::before { color: red; content: '\\2736'; font-size: 0.6rem; position: absolute; left: -1.4em; top: 0.15rem; }\n.property-instance.valid::before { position: absolute; left: calc(var(--label-width) - 1em); top: 6px; color: green; content: '\\2713'; }\n.editor:not([type='checkbox']), .shacl-or-constraint select { flex-grow: 1; }\n.shacl-or-constraint select { border: 1px solid #DDD; padding: 2px 4px; }\nselect { overflow: hidden; text-overflow: ellipsis; }\ntextarea.editor { resize: vertical; }\n.lang-chooser { position: absolute; top: 5px; right: 24px; border: 0; background-color: #e9e9ed; padding: 2px 4px; max-width: 40px; width: 40px; box-sizing: content-box; }\n.lang-chooser+.editor { padding-right: 55px; }\n.validation-error { position: absolute; left: calc(var(--label-width) - 1em); top: 6px; color: red; cursor: help; }\n.validation-error::before { content: '\\26a0' }\n.validation-error.node { left: -1em; }\n.invalid > .editor { border-color: red !important; }\n.ml-0 { margin-left: 0 !important; }\n.pr-0 { padding-right: 0 !important; }\n.mode-view .property-instance:not(:first-child) > label { visibility: hidden; }\n.mode-view .property-instance label { width: var(--label-width); }\n\n.d-flex { display: flex; }\n.lang { opacity: 0.65; font-size: 0.6em; }\na, a:visited { color: inherit; }\n\n.fadeIn, .fadeOut { animation: fadeIn 0.2s ease-out; }\n.fadeOut { animation-direction: reverse; animation-timing-function: ease-out;}\n@keyframes fadeIn {\n 0% { opacity: 0; transform: scaleY(0.8); }\n 100% { opacity: 1; transform: scaleY(1); }\n}\n \n.collapsible > .activator { display: flex; justify-content: space-between; align-items: center; cursor: pointer; width: 100%; border: 0; padding: 8px 0; transition: 0.2s; }\n.collapsible > .activator:hover, .collapsible.open > .activator { background-color: #F5F5F5; }\n.collapsible > .activator::after { content:''; width: var(--caret-size); height: var(--caret-size); border-style: none solid solid none; border-width: calc(0.3 * var(--caret-size)); transform: rotate(45deg); transition: transform .15s ease-out; margin-right: calc(0.5 * var(--caret-size)); }\n.collapsible.open > .activator::after { transform: rotate(225deg); }\n.collapsible > *:not(.activator) { transition: all 0.2s ease-out; opacity: 1; }\n.collapsible:not(.open) > *:not(.activator) { max-height: 0; padding: 0; opacity: 0; overflow: hidden; }\n.collapsible > .property-instance > shacl-node > h1 { display: none; }\n.collapsible.open > .property-instance:nth-child(odd) { background-color: #F5F5F5; }\n.ref-link { cursor: pointer; }\n.ref-link:hover { text-decoration: underline; }\n.node-id-display { color: #999; font-size: 11px; }";e&&(t+="\n"+e),this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t)}apply(e){}createViewer(e,t,n){const r=document.createElement("div"),i=document.createElement("label");i.innerHTML=e+":",n.description&&i.setAttribute("title",n.description.value),r.appendChild(i);let o,a=t.value,s=null;if(t instanceof m){const e=n.config.shapesGraph.getQuads(a,null,null,null);if(e.length){const t=K(e,n.config.languages);t&&(a=t)}}else t instanceof b&&(t.language?(s=document.createElement("span"),s.classList.add("lang"),s.innerText=`@${t.language}`):t.datatype.value===`${A}date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`${A}dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));return ne(t.value)?(o=document.createElement("a"),o.setAttribute("href",t.value)):o=document.createElement("div"),o.classList.add("d-flex"),o.innerText=a,s&&o.appendChild(s),r.appendChild(o),r}}function le(e){return!!e&&"DefaultGraph"===e.termType}const ce=g.defaultGraph(),{rdf:ue,xsd:de}=c,he=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,fe=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,pe={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class ge extends y{equals(e){return e===this}}class ye{constructor(e,t){if(this._prefixRegex=/$0^/,e&&"function"!=typeof e.write&&(t=e,e=null),t=t||{},this._lists=t.lists,e)this._outputStream=e,this._endStream=void 0===t.end||!!t.end;else{let e="";this._outputStream={write(t,n,r){e+=t,r&&r()},end:t=>{t&&t(null,e)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=ce,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseMatcher=new RegExp(`^${be(t.baseIRI)}${t.baseIRI.endsWith("/")?"":"[#?]"}`),this._baseLength=t.baseIRI.length))}get _inDefaultGraph(){return ce.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t)}_writeQuad(e,t,n,r,i){try{r.equals(this._graph)||(this._write((null===this._subject?"":this._inDefaultGraph?".\n":"\n}\n")+(ce.equals(r)?"":`${this._encodeIriOrBlank(r)} {\n`)),this._graph=r,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(`, ${this._encodeObject(n)}`,i):this._write(`;\n ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(n)}`,i):this._write(`${(null===this._subject?"":".\n")+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(n)}`,i)}catch(e){i&&i(e)}}_writeQuadLine(e,t,n,r,i){delete this._prefixMatch,this._write(this.quadToString(e,t,n,r),i)}quadToString(e,t,n,r){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(n)}${r&&r.value?` ${this._encodeIriOrBlank(r)} .\n`:" .\n"}`}quadsToString(e){let t="";for(const n of e)t+=this.quadToString(n.subject,n.predicate,n.object,n.graph);return t}_encodeSubject(e){return"Quad"===e.termType?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if("NamedNode"!==e.termType)return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let t=e.value;this._baseMatcher&&this._baseMatcher.test(t)&&(t=t.substr(this._baseLength)),he.test(t)&&(t=t.replace(fe,me));const n=this._prefixRegex.exec(t);return n?n[1]?this._prefixIRIs[n[1]]+n[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(he.test(t)&&(t=t.replace(fe,me)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===de.string)return`"${t}"`}else switch(e.datatype.value){case de.string:return`"${t}"`;case de.boolean:if("true"===t||"false"===t)return t;break;case de.integer:if(/^[+-]?\d+$/.test(t))return t;break;case de.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case de.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===ue.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:t,object:n,graph:r}){return`<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(n)}${le(r)?"":` ${this._encodeIriOrBlank(r)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,n,r,i){void 0===n?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):"function"==typeof r?this._writeQuad(e,t,n,ce,r):this._writeQuad(e,t,n,r||ce,i)}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}addPrefix(e,t,n){const r={};r[e]=t,this.addPrefixes(r,n)}addPrefixes(e,t){if(!this._prefixIRIs)return t&&t();let n=!1;for(let t in e){let r=e[t];"string"!=typeof r&&(r=r.value),n=!0,null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null,this._graph=""),this._prefixIRIs[r]=t+=":",this._write(`@prefix ${t} <${r}>.\n`)}if(n){let e="",t="";for(const n in this._prefixIRIs)e+=e?`|${n}`:n,t+=(t?"|":"")+this._prefixIRIs[n];e=be(e),this._prefixRegex=new RegExp(`^(?:${t})[^/]*$|^(${e})([_a-zA-Z][\\-_a-zA-Z0-9]*)$`)}this._write(n?"\n":"",t)}blank(e,t){let n,r,i=e;switch(void 0===e?i=[]:e.termType?i=[{predicate:e,object:t}]:"length"in e||(i=[e]),r=i.length){case 0:return new ge("[]");case 1:if(n=i[0],!(n.object instanceof ge))return new ge(`[ ${this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)} ]`);default:let t="[";for(let o=0;o<r;o++)n=i[o],n.predicate.equals(e)?t+=`, ${this._encodeObject(n.object)}`:(t+=`${(o?";\n ":"\n ")+this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)}`,e=n.predicate);return new ge(`${t}\n]`)}}list(e){const t=e&&e.length||0,n=new Array(t);for(let r=0;r<t;r++)n[r]=this._encodeObject(e[r]);return new ge(`(${n.join(" ")})`)}end(e){null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null),this._write=this._blockedWrite;let t=e&&((n,r)=>{t=null,e(n,r)});if(this._endStream)try{return this._outputStream.end(t)}catch(e){}t&&t()}}function me(e){let t=pe[e];return void 0===t&&(1===e.length?(t=e.charCodeAt(0).toString(16),t="\\u0000".substr(0,6-t.length)+t):(t=(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)+9216).toString(16),t="\\U00000000".substr(0,10-t.length)+t)),t}function be(e){return e.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}function ve(e){let t=e.shaclDatatype,n=e.value;return n?e.dataset.class||e.dataset.nodeKind===k+"IRI"?g.namedNode(n):(e.dataset.lang?t=e.dataset.lang:"number"===e.type?n=parseFloat(n):"file"===e.type&&e.binaryData?n=e.binaryData:"datetime-local"===e.type&&(n=new Date(n).toISOString().slice(0,19)),g.literal(n,t)):"checkbox"!==e.type&&"checkbox"!==e.getAttribute("type")||!(e.checked||parseInt(e.dataset.minCount||"0")>0)?void 0:g.literal(e.checked?"true":"false",t)}const we={};function _e(e){void 0===e.predicate&&void 0===e.datatype?console.warn('not registering plugin because it does neither define "predicate" nor "datatype"',e):we[`${e.predicate}^${e.datatype}`]=e}class xe{constructor(e,t){this.predicate=e.predicate,this.datatype=e.datatype,t&&(this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t))}createViewer(e,t){return e.config.theme.createViewer(e.label,t,e)}}class Se extends HTMLElement{constructor(e,t,n,r){var i;if(super(),this.template=new ae(n.shapesGraph.getQuads(e,null,null,null),t,n),void 0!==this.template.order&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),n.editMode&&(this.addButton=document.createElement("a"),this.addButton.innerText=this.template.label,this.addButton.title="Add "+this.template.label,this.addButton.classList.add("control-button","add-button"),this.addButton.addEventListener("click",(e=>{const t=this.addPropertyInstance();t.classList.add("fadeIn"),this.updateControls(),function(e){var t;null===(t=e.querySelector("input,select,textarea"))||void 0===t||t.focus()}(t),setTimeout((()=>{t.classList.remove("fadeIn")}),200)})),this.appendChild(this.addButton)),this.template.path){const e=r?n.dataGraph.getQuads(r,this.template.path,null,null):[];let t=!1;for(const n of e)this.addPropertyInstance(n.object),this.template.hasValue&&n.object.equals(this.template.hasValue)&&(t=!0);n.editMode&&this.template.hasValue&&!t&&this.addPropertyInstance(this.template.hasValue)}if(n.editMode&&(this.addEventListener("change",(()=>{this.updateControls()})),this.updateControls()),(null===(i=this.template.extendedShapes)||void 0===i?void 0:i.length)&&null!==this.template.config.attributes.collapse&&(!this.template.maxCount||this.template.maxCount>1)&&(n.editMode||this.childElementCount>0)){const e=this;e.classList.add("collapsible"),"open"===this.template.config.attributes.collapse&&e.classList.add("open");const t=document.createElement("h1");t.classList.add("activator"),t.innerText=this.template.label,t.addEventListener("click",(()=>{e.classList.toggle("open")})),this.prepend(t)}}addPropertyInstance(e){var t;let n;return(null===(t=this.template.shaclOr)||void 0===t?void 0:t.length)?e?n=je(function(e,t){if(!e.shaclOr)return console.warn("can't resolve sh:or because template has no options",e),e;if(t instanceof b){const n=t.datatype;for(const t of e.shaclOr){const r=e.config.shapesGraph.getQuads(t,null,null,null);for(const t of r)if(t.predicate.value===`${k}datatype`&&t.object.equals(n))return e.clone().merge(r)}}else{let n=e.config.dataGraph.getObjects(t,B,null);n.push(...e.config.shapesGraph.getObjects(t,B,null));for(const t of e.shaclOr){const r=e.config.shapesGraph.getQuads(t,null,null,null);for(const t of r)if(n.length>0){if(t.predicate.value===`${k}node`)for(const i of n)if(e.config.shapesGraph.getQuads(t.object,J,i,null).length>0)return e.clone().merge(r);if(t.predicate.equals(z))for(const i of n)if(t.object.equals(i))return e.clone().merge(r)}else if(t.predicate.equals(Q)&&t.object.equals(W))return e.clone().merge(r)}}return console.error("couldn't resolve sh:or for value",t),e}(this.template,e),e,!0):(n=ie(this.template.shaclOr,this,this.template.config),Ie(n,"")):n=je(this.template,e),this.template.config.editMode?this.insertBefore(n,this.addButton):this.appendChild(n),n}updateControls(){var e;let t,n=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length;0===n&&(!(null===(e=this.template.extendedShapes)||void 0===e?void 0:e.length)||void 0!==this.template.minCount&&this.template.minCount>0)&&(this.addPropertyInstance(),n=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length),t=void 0!==this.template.minCount?n>this.template.minCount:this.template.extendedShapes&&this.template.extendedShapes.length>0||n>1;const r=void 0===this.template.maxCount||n<this.template.maxCount;this.classList.toggle("may-remove",t),this.classList.toggle("may-add",r)}toRDF(e,t){for(const n of this.querySelectorAll(":scope > .property-instance")){const r=g.namedNode(n.dataset.path);if(n.firstChild instanceof Ce){const i=n.firstChild.toRDF(e);e.addQuad(t,r,i,this.template.config.valuesGraph)}else{const i=ve(n.querySelector(".editor"));i&&e.addQuad(t,r,i,this.template.config.valuesGraph)}}}}function je(e,t,n=!1){var r,i;let o;if(null===(r=e.extendedShapes)||void 0===r?void 0:r.length){o=document.createElement("div"),o.classList.add("property-instance");for(const n of e.extendedShapes)o.appendChild(new Ce(n,e.config,t,e.parent,e.nodeKind,e.label))}else{const n=function(e,t){let n=we[`${e}^${t}`];return n||(n=we[`${e}^undefined`],n||we[`undefined^${t}`])}(e.path,null===(i=e.datatype)||void 0===i?void 0:i.value);o=n?e.config.editMode?n.createEditor(e,t):n.createViewer(e,t):function(e,t){var n,r,i;if(e.config.editMode){const o=void 0!==e.minCount&&e.minCount>0;if(e.class)return e.config.theme.createListEditor(e.label,t,o,te(e.class,e),e);if(e.shaclIn){const n=e.config.lists[e.shaclIn];if(null==n?void 0:n.length){const r=Y(n,e.config.shapesGraph,e.config.languages);return e.config.theme.createListEditor(e.label,t,o,r,e)}console.error("list not found:",e.shaclIn,"existing lists:",e.config.lists)}if((null===(n=e.datatype)||void 0===n?void 0:n.value)===`${C}langString`||(null===(r=e.languageIn)||void 0===r?void 0:r.length))return e.config.theme.createLangStringEditor(e.label,t,o,e);switch(null===(i=e.datatype)||void 0===i?void 0:i.value.replace(A,"")){case"integer":case"float":case"double":case"decimal":return e.config.theme.createNumberEditor(e.label,t,o,e);case"date":case"dateTime":return e.config.theme.createDateEditor(e.label,t,o,e);case"boolean":return e.config.theme.createBooleanEditor(e.label,t,o,e);case"base64Binary":return e.config.theme.createFileEditor(e.label,t,o,e)}return e.config.theme.createTextEditor(e.label,t,o,e)}{if(t)return e.config.theme.createViewer(e.label,t,e);const n=document.createElement("div");return n.innerHTML="No value",n}}(e,t||null),o.classList.add("property-instance")}return e.config.editMode&&Ie(o,e.label,n),o.dataset.path=e.path,o}function Ie(e,t,n=!1){const r=document.createElement("a");r.innerText="×",r.classList.add("control-button","btn","remove-button"),r.title="Remove "+t,r.addEventListener("click",(t=>{e.classList.remove("fadeIn"),e.classList.add("fadeOut"),setTimeout((()=>{const t=e.parentElement;e.remove(),null==t||t.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))}),200)})),n&&r.classList.add("persistent"),e.appendChild(r)}function Ee(e,t){const n=document.createElement("div");n.dataset.subject=e,n.classList.add("shacl-group");let r=e;const i=t.shapesGraph.getQuads(e,null,null,null),o=X(i,"label",D,t.languages);o&&(r=o);const a=X(i,"order");a&&(n.style.order=a);const s=document.createElement("h1");return s.innerText=r,n.appendChild(s),null!==t.attributes.collapse&&(n.classList.add("collapsible"),"open"===t.attributes.collapse&&n.classList.add("open"),s.classList.add("activator"),s.addEventListener("click",(()=>{n.classList.toggle("open")}))),n}window.customElements.define("shacl-property",Se);const Ne={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};var Te,Re=new Uint8Array(16);function Oe(){if(!Te&&!(Te="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Te(Re)}for(var ke=[],Le=0;Le<256;++Le)ke.push((Le+256).toString(16).slice(1));const Ae=function(e,t,n){if(Ne.randomUUID&&!t&&!e)return Ne.randomUUID();var r=(e=e||{}).random||(e.rng||Oe)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return function(e,t=0){return(ke[e[t+0]]+ke[e[t+1]]+ke[e[t+2]]+ke[e[t+3]]+"-"+ke[e[t+4]]+ke[e[t+5]]+"-"+ke[e[t+6]]+ke[e[t+7]]+"-"+ke[e[t+8]]+ke[e[t+9]]+"-"+ke[e[t+10]]+ke[e[t+11]]+ke[e[t+12]]+ke[e[t+13]]+ke[e[t+14]]+ke[e[t+15]]).toLowerCase()}(r)};class Ce extends HTMLElement{constructor(e,t,n,r,i,o){super(),this.owlImports=[],this.parent=r,this.config=t,this.shaclSubject=e;let a=n;if(!a){if(!i){const n=t.shapesGraph.getObjects(e,`${k}nodeKind`,null);n.length&&(i=n[0])}a=void 0===i&&t.attributes.valuesNamespace||(null==i?void 0:i.id)===`${k}IRI`?g.namedNode(t.attributes.valuesNamespace+Ae()):g.blankNode(Ae())}this.nodeId=a;const s=JSON.stringify([e,n]);if(n&&t.renderedNodes.has(s)){if(o&&null===t.attributes.collapse){const e=document.createElement("label");e.innerText=o,this.appendChild(e)}const e=document.createElement("a");e.innerText=n.id,e.classList.add("ref-link"),e.onclick=()=>{var e;null===(e=this.config.form.querySelector(`shacl-node[data-node-id='${this.nodeId.id}']`))||void 0===e||e.scrollIntoView()},this.appendChild(e),this.style.flexDirection="row"}else{n&&t.renderedNodes.add(s),this.dataset.nodeId=this.nodeId.id;const r=t.shapesGraph.getQuads(e,null,null,null);let i;if(null!==this.config.attributes.showNodeIds){const e=document.createElement("div");e.innerText=`id: ${this.nodeId.id}`,e.classList.add("node-id-display"),this.appendChild(e)}for(const e of r)switch(e.predicate.id){case`${k}property`:let r=this;const o=t.shapesGraph.getQuads(e.object,`${k}group`,null,null);if(o.length>0){const e=o[0].object.value;if(t.groups.indexOf(e)>-1){let n=this.querySelector(`:scope > .shacl-group[data-subject='${e}']`);n||(n=Ee(e,t),this.appendChild(n)),r=n}else console.warn("ignoring unknown group reference",o[0],"existing groups:",t.groups)}setTimeout((()=>{const i=new Se(e.object,this,t,n);i.childElementCount>0&&r.appendChild(i)}));break;case`${k}and`:if(i=t.lists[e.object.value],null==i?void 0:i.length)for(const e of i)this.prepend(new Ce(e,t,n,this));else console.error("list not found:",e.object.value,"existing lists:",t.lists);break;case`${k}node`:this.prepend(new Ce(e.object,t,n,this));break;case`${k}targetClass`:this.targetClass=e.object;break;case G.id:this.owlImports.push(e.object);break;case`${k}or`:i=t.lists[e.object.value],(null==i?void 0:i.length)?this.appendChild(ie(i,this,t)):console.error("list not found:",e.object.value,"existing lists:",t.lists)}if(o){const e=document.createElement("h1");e.innerText=o,this.prepend(e)}}}toRDF(e,t){t||(t=this.nodeId);for(const n of this.querySelectorAll(":scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property"))n.toRDF(e,t);return this.targetClass&&e.addQuad(t,B,this.targetClass,this.config.valuesGraph),this.config.attributes.generateNodeShapeReference&&!this.parent&&e.addQuad(t,g.namedNode(this.config.attributes.generateNodeShapeReference),this.shaclSubject,this.config.valuesGraph),t}}window.customElements.define("shacl-node",Ce);var De=r(9198);const Me=Symbol("iter");function Pe(e,t,n=4){if(0===n)return Object.assign(e,t);for(const r in t)e[r]=Pe(e[r]||Object.create(null),t[r],n-1);return e}function $e(e,t,n=4){let r=!1;for(const i in e)if(i in t){const o=0===n?null:$e(e[i],t[i],n-1);if(!1!==o)r=r||Object.create(null),r[i]=o;else if(3===n)return!1}return r}class Be{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||g}_termFromId(e){if("."===e[0]){const t=this._entities,n=e.split(".");return this._factory.quad(this._termFromId(t[n[1]]),this._termFromId(t[n[2]]),this._termFromId(t[n[3]]),n[4]&&this._termFromId(t[n[4]]))}return _(e,this._factory)}_termToNumericId(e){if("Quad"===e.termType){const t=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),r=this._termToNumericId(e.object);let i;return t&&n&&r&&(le(e.graph)||(i=this._termToNumericId(e.graph)))&&this._ids[i?`.${t}.${n}.${r}.${i}`:`.${t}.${n}.${r}`]}return this._ids[x(e)]}_termToNewNumericId(e){const t=e&&"Quad"===e.termType?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${le(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:x(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,n;if(e)for(t=e=`_:${e}`,n=1;this._ids[t];)t=e+n++;else do{t="_:b"+this._blankNodeIndex++}while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}}class Fe{constructor(e,t){this._size=0,this._graphs=Object.create(null),t||!e||e[0]||(t=e,e=null),t=t||{},this._factory=t.factory||g,this._entityIndex=t.entityIndex||new Be({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.addQuads(e)}get size(){let e=this._size;if(null!==e)return e;e=0;const t=this._graphs;let n,r;for(const i in t)for(const o in n=t[i].subjects)for(const t in r=n[o])e+=Object.keys(r[t]).length;return this._size=e}_addToIndex(e,t,n,r){const i=e[t]||(e[t]={}),o=i[n]||(i[n]={}),a=r in o;return a||(o[r]=null),!a}_removeFromIndex(e,t,n,r){const i=e[t],o=i[n];delete o[r];for(const e in o)return;delete i[n];for(const e in i)return;delete e[t]}*_findInIndex(e,t,n,r,i,o,a,s){let l,c,u;const d=this._entities,h=this._termFromId(d[s]),f={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const t in e)if(c=e[t]){f[i]=this._termFromId(d[t]),n&&((l=c,c={})[n]=l[n]);for(const e in c)if(u=c[e]){f[o]=this._termFromId(d[e]);const t=r?r in u?[r]:[]:Object.keys(u);for(let e=0;e<t.length;e++)f[a]=this._termFromId(d[t[e]]),yield this._factory.quad(f.subject,f.predicate,f.object,h)}}}_loop(e,t){for(const n in e)t(n)}_loopByKey0(e,t,n){let r,i;if(r=e[t])for(i in r)n(i)}_loopByKey1(e,t,n){let r,i;for(r in e)i=e[r],i[t]&&n(r)}_loopBy2Keys(e,t,n,r){let i,o,a;if((i=e[t])&&(o=i[n]))for(a in o)r(a)}_countInIndex(e,t,n,r){let i,o,a,s=0;t&&((i=e,e={})[t]=i[t]);for(const t in e)if(o=e[t]){n&&((i=o,o={})[n]=i[n]);for(const e in o)(a=o[e])&&(r?r in a&&s++:s+=Object.keys(a).length)}return s}_getGraphs(e){return"number"!=typeof(e=""===e?1:e&&(this._termToNumericId(e)||-1))?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){const t=Object.create(null);return n=>{n in t||(t[n]=!0,e(this._termFromId(this._entities[n],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,n,r){t||(r=e.graph,n=e.object,t=e.predicate,e=e.subject),r=r?this._termToNewNumericId(r):1;let i=this._graphs[r];return i||(i=this._graphs[r]={subjects:{},predicates:{},objects:{}},Object.freeze(i)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),n=this._termToNewNumericId(n),!!this._addToIndex(i.subjects,e,t,n)&&(this._addToIndex(i.predicates,t,n,e),this._addToIndex(i.objects,n,e,t),this._size=null,!0)}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}delete(e){return this.removeQuad(e),this}has(e,t,n,r){return e&&e.subject&&({subject:e,predicate:t,object:n,graph:r}=e),!this.readQuads(e,t,n,r).next().done}import(e){return e.on("data",(e=>{this.addQuad(e)})),e}removeQuad(e,t,n,r){t||({subject:e,predicate:t,object:n,graph:r}=e),r=r?this._termToNumericId(r):1;const i=this._graphs;let o,a,s;if(!((e=e&&this._termToNumericId(e))&&(t=t&&this._termToNumericId(t))&&(n=n&&this._termToNumericId(n))&&(o=i[r])&&(a=o.subjects[e])&&(s=a[t])&&n in s))return!1;for(e in this._removeFromIndex(o.subjects,e,t,n),this._removeFromIndex(o.predicates,t,n,e),this._removeFromIndex(o.objects,n,e,t),null!==this._size&&this._size--,o.subjects)return!0;return delete i[r],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t])}remove(e){return e.on("data",(e=>{this.removeQuad(e)})),e}removeMatches(e,t,n,r){const i=new De.Readable({objectMode:!0}),o=this.readQuads(e,t,n,r);return i._read=e=>{for(;--e>=0;){const{done:e,value:t}=o.next();if(e)return void i.push(null);i.push(t)}},this.remove(i)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,n,r){return[...this.readQuads(e,t,n,r)]}*readQuads(e,t,n,r){const i=this._getGraphs(r);let o,a,s,l;if(!(e&&!(a=this._termToNumericId(e))||t&&!(s=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n))))for(const e in i)(o=i[e])&&(a?l?yield*this._findInIndex(o.objects,l,a,s,"object","subject","predicate",e):yield*this._findInIndex(o.subjects,a,s,null,"subject","predicate","object",e):s?yield*this._findInIndex(o.predicates,s,l,null,"predicate","object","subject",e):l?yield*this._findInIndex(o.objects,l,null,null,"object","subject","predicate",e):yield*this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",e))}match(e,t,n,r){return new Ue(this,e,t,n,r,{entityIndex:this._entityIndex})}countQuads(e,t,n,r){const i=this._getGraphs(r);let o,a,s,l,c=0;if(e&&!(a=this._termToNumericId(e))||t&&!(s=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n)))return 0;for(const r in i)(o=i[r])&&(c+=e?n?this._countInIndex(o.objects,l,a,s):this._countInIndex(o.subjects,a,s,l):t?this._countInIndex(o.predicates,s,l,a):this._countInIndex(o.objects,l,a,s));return c}forEach(e,t,n,r,i){this.some((t=>(e(t,this),!1)),t,n,r,i)}every(e,t,n,r,i){return!this.some((t=>!e(t,this)),t,n,r,i)}some(e,t,n,r,i){for(const o of this.readQuads(t,n,r,i))if(e(o))return!0;return!1}getSubjects(e,t,n){const r=[];return this.forSubjects((e=>{r.push(e)}),e,t,n),r}forSubjects(e,t,n,r){const i=this._getGraphs(r);let o,a,s;if(e=this._uniqueEntities(e),!(t&&!(a=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(o=i[r])&&(a?s?this._loopBy2Keys(o.predicates,a,s,e):this._loopByKey1(o.subjects,a,e):s?this._loopByKey0(o.objects,s,e):this._loop(o.subjects,e))}getPredicates(e,t,n){const r=[];return this.forPredicates((e=>{r.push(e)}),e,t,n),r}forPredicates(e,t,n,r){const i=this._getGraphs(r);let o,a,s;if(e=this._uniqueEntities(e),!(t&&!(a=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(o=i[r])&&(a?s?this._loopBy2Keys(o.objects,s,a,e):this._loopByKey0(o.subjects,a,e):s?this._loopByKey1(o.predicates,s,e):this._loop(o.predicates,e))}getObjects(e,t,n){const r=[];return this.forObjects((e=>{r.push(e)}),e,t,n),r}forObjects(e,t,n,r){const i=this._getGraphs(r);let o,a,s;if(e=this._uniqueEntities(e),!(t&&!(a=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(o=i[r])&&(a?s?this._loopBy2Keys(o.subjects,a,s,e):this._loopByKey1(o.objects,a,e):s?this._loopByKey0(o.predicates,s,e):this._loop(o.objects,e))}getGraphs(e,t,n){const r=[];return this.forGraphs((e=>{r.push(e)}),e,t,n),r}forGraphs(e,t,n,r){for(const i in this._graphs)this.some((t=>(e(t.graph),!0)),t,n,r,this._termFromId(this._entities[i]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const n={},r=t?()=>!0:(e,t)=>{throw new Error(`${e.value} ${t}`)},i=this.getQuads(null,c.rdf.rest,c.rdf.nil,null),o=e?[...i]:[];return i.forEach((t=>{const i=[];let a,s,l=!1;const u=t.graph;let d=t.subject;for(;d&&!l;){const e=this.getQuads(null,null,d,null),t=this.getQuads(d,null,null,null);let n,h=null,f=null,p=null;for(let i=0;i<t.length&&!l;i++)n=t[i],n.graph.equals(u)?a?l=r(d,"has non-list arcs out"):n.predicate.value===c.rdf.first?h?l=r(d,"has multiple rdf:first arcs"):o.push(h=n):n.predicate.value===c.rdf.rest?f?l=r(d,"has multiple rdf:rest arcs"):o.push(f=n):e.length?l=r(d,"can't be subject and object"):(a=n,s="subject"):l=r(d,"not confined to single graph");for(let t=0;t<e.length&&!l;++t)n=e[t],a?l=r(d,"can't have coreferences"):n.predicate.value===c.rdf.rest?p?l=r(d,"has incoming rdf:rest arcs"):p=n:(a=n,s="object");h?i.unshift(h.object):l=r(d,"has no list head"),d=p&&p.subject}l?e=!1:a&&(n[a[s].value]=i)})),e&&this.removeQuads(o),n}addAll(e){if(Array.isArray(e))this.addQuads(e);else if(e instanceof Fe&&e._entityIndex===this._entityIndex)0!==e._size&&(this._graphs=Pe(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e===this)return!0;if(!(e instanceof Fe)||this._entityIndex!==e._entityIndex)return e.every((e=>this.has(e)));const t=this._graphs,n=e._graphs;let r,i,o,a,s;for(const e in n){if(!(r=t[e]))return!1;r=r.subjects;for(const t in i=n[e].subjects){if(!(o=r[t]))return!1;for(const e in a=i[t]){if(!(s=o[e]))return!1;for(const t in a[e])if(!(t in s))return!1}}}return!0}deleteMatches(e,t,n,r){for(const i of this.match(e,t,n,r))this.removeQuad(i);return this}difference(e){return e===this?new Fe({entityIndex:this._entityIndex}):this.filter((t=>!e.has(t)))}equals(e){return e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new Fe({entityIndex:this._entityIndex});for(const n of this)e(n,this)&&t.add(n);return t}intersection(e){if(e===this){const e=new Fe({entityIndex:this._entityIndex});return e._graphs=Pe(Object.create(null),this._graphs),e._size=this._size,e}if(e instanceof Fe&&this._entityIndex===e._entityIndex){const t=new Fe({entityIndex:this._entityIndex}),n=$e(e._graphs,this._graphs);return n&&(t._graphs=n,t._size=null),t}return this.filter((t=>e.has(t)))}map(e){const t=new Fe({entityIndex:this._entityIndex});for(const n of this)t.add(e(n,this));return t}reduce(e,t){const n=this.readQuads();let r=void 0===t?n.next().value:t;for(const t of n)r=e(r,t,this);return r}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return(new ye).quadsToString(this)}union(e){const t=new Fe({entityIndex:this._entityIndex});return t._graphs=Pe(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function qe(e,t,n=0){const r=t[n];if(r&&!(r in e))return!1;let i=!1;for(const o in r?{[r]:e[r]}:e){const r=2===n?null:qe(e[o],t,n+1);!1!==r&&(i=i||Object.create(null),i[o]=r)}return i}class Ue extends De.Readable{constructor(e,t,n,r,i,o){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:n,object:r,graph:i,options:o})}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:n,predicate:r,subject:i}=this,o=this._filtered=new Fe({factory:e._factory,entityIndex:this.options.entityIndex}),a=e._getGraphs(t);let s,l,c;if(i&&!(s=o._termToNumericId(i))||r&&!(l=o._termToNumericId(r))||n&&!(c=o._termToNumericId(n)))return o;for(const e in a){const t=qe(a[e].subjects,[s,l,c]);t&&(o._graphs[e]={subjects:t,predicates:qe(a[e].predicates,[l,c,s]),objects:qe(a[e].objects,[c,s,l])})}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Me]&&(this[Me]=this[Symbol.iterator]());const t=this[Me];for(;--e>=0;){const{done:e,value:n}=t.next();if(e)return void this.push(null);this.push(n)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,n,r){return this.filtered.deleteMatches(e,t,n,r)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,n,r,i){return this.filtered.every(e,t,n,r,i)}filter(e){return this.filtered.filter(e)}forEach(e,t,n,r,i){return this.filtered.forEach(e,t,n,r,i)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,t,n,r,i){return this.filtered.some(e,t,n,r,i)}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,t){return this.filtered.reduce(e,t)}toString(){return(new ye).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,t,n,r){return new Ue(this.filtered,e,t,n,r,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}var Ge=r(8287),He=r(9596),Ve=r.n(He);const{xsd:We}=c,ze=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Je={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Qe=/[\x00-\x20<>\\"\{\}\|\^\`]/,Xe={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},Ke=/$0^/;class Ye{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._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._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|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._lineMode=!!e.lineMode){this._n3Mode=!1;for(const e in this)!(e in Xe)&&this[e]instanceof RegExp&&(this[e]=Ke)}else this._n3Mode=!1!==e.n3;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let n=this._input,r=n.length;for(;;){let e,a;for(;e=this._newline.exec(n);)this.comments&&(a=this._comment.exec(e[0]))&&i("comment",a[1],"",this._line,e[0].length),n=n.substr(e[0].length,n.length),r=n.length,this._line++;if(!e&&(e=this._whitespace.exec(n))&&(n=n.substr(e[0].length,n.length)),this._endOfFile.test(n))return t&&(this.comments&&(a=this._comment.exec(n))&&i("comment",a[1],"",this._line,n.length),n=null,i("eof","","",this._line,0)),this._input=n;const s=this._line,l=n[0];let c="",u="",d="",h=null,f=0,p=!1;switch(l){case"^":if(n.length<3)break;if("^"!==n[1]){this._n3Mode&&(f=1,c="^");break}if(this._previousMarker="^^",n=n.substr(2),"<"!==n[0]){p=!0;break}case"<":if(h=this._unescapedIri.exec(n))c="IRI",u=h[1];else if(h=this._iri.exec(n)){if(u=this._unescape(h[1]),null===u||Qe.test(u))return o(this);c="IRI"}else n.length>1&&"<"===n[1]?(c="<<",f=2):this._n3Mode&&n.length>1&&"="===n[1]&&(c="inverse",f=2,u=">");break;case">":n.length>1&&">"===n[1]&&(c=">>",f=2);break;case"_":((h=this._blank.exec(n))||t&&(h=this._blank.exec(`${n} `)))&&(c="blank",d="_",u=h[1]);break;case'"':if(h=this._simpleQuotedString.exec(n))u=h[1];else if(({value:u,matchLength:f}=this._parseLiteral(n)),null===u)return o(this);null===h&&0===f||(c="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(h=this._simpleApostropheString.exec(n))u=h[1];else if(({value:u,matchLength:f}=this._parseLiteral(n)),null===u)return o(this);null===h&&0===f||(c="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(h=this._variable.exec(n))&&(c="var",u=h[0]);break;case"@":"literal"===this._previousMarker&&(h=this._langcode.exec(n))?(c="langcode",u=h[1]):(h=this._keyword.exec(n))&&(c=h[0]);break;case".":if(1===n.length?t:n[1]<"0"||n[1]>"9"){c=".",f=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(h=this._number.exec(n)||t&&(h=this._number.exec(`${n} `)))&&(c="literal",u=h[0],d="string"==typeof h[1]?We.double:"string"==typeof h[2]?We.decimal:We.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(h=this._sparqlKeyword.exec(n))?c=h[0].toUpperCase():p=!0;break;case"f":case"t":(h=this._boolean.exec(n))?(c="literal",u=h[0],d=We.boolean):p=!0;break;case"a":(h=this._shortPredicates.exec(n))?(c="abbreviation",u="a"):p=!0;break;case"=":this._n3Mode&&n.length>1&&(c="abbreviation",">"!==n[1]?(f=1,u="="):(f=2,u=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(f=1,c=l);break;case"{":!this._lineMode&&n.length>=2&&("|"===n[1]?(c="{|",f=2):(c=l,f=1));break;case"|":n.length>=2&&"}"===n[1]&&(c="|}",f=2);break;default:p=!0}if(p&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(h=this._prefix.exec(n))?((h=this._prefixed.exec(n))||t&&(h=this._prefixed.exec(`${n} `)))&&(c="prefixed",d=h[1]||"",u=this._unescape(h[2])):(c="prefix",u=h[1]||"")),"^^"===this._previousMarker)switch(c){case"prefixed":c="type";break;case"IRI":c="typeIRI";break;default:c=""}if(!c)return t||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?o(this):this._input=n;const g=f||h[0].length,y=i(c,u,d,s,g);this.previousToken=y,this._previousMarker=c,n=n.substr(g,n.length)}function i(t,i,o,a,s){const l=n?r-n.length:r,c={type:t,value:i,prefix:o,line:a,start:l,end:l+s};return e(null,c),c}function o(t){e(t._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(e){let t=!1;const n=e.replace(ze,((e,n,r,i)=>{if("string"==typeof n)return String.fromCharCode(Number.parseInt(n,16));if("string"==typeof r){let e=Number.parseInt(r,16);return e<=65535?String.fromCharCode(Number.parseInt(r,16)):String.fromCharCode(55296+((e-=65536)>>10),56320+(1023&e))}return i in Je?Je[i]:(t=!0,"")}));return t?null:n}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],n=t.length;let r=Math.max(this._literalClosingPos,n);for(;(r=e.indexOf(t,r))>0;){let t=0;for(;"\\"===e[r-t-1];)t++;if(t%2==0){const t=e.substring(n,r),i=t.split(/\r\n|\r|\n/).length-1,o=r+n;if(1===n&&0!==i||3===n&&this._lineMode)break;return this._line+=i,{value:this._unescape(t),matchLength:o}}r++}this._literalClosingPos=e.length-n+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;const t=new Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith("\ufeff")?e.substr(1):e}tokenize(e,t){if(this._line=1,"string"==typeof e){if(this._input=this._readStartingBom(e),"function"!=typeof t){const e=[];let t;if(this._tokenizeToEnd(((n,r)=>n?t=n:e.push(r)),!0),t)throw t;return e}Ve()((()=>this._tokenizeToEnd(t,!0)))}else this._pendingBuffer=null,"function"==typeof e.setEncoding&&e.setEncoding("utf8"),e.on("data",(e=>{null!==this._input&&0!==e.length&&(this._pendingBuffer&&(e=Ge.Buffer.concat([this._pendingBuffer,e]),this._pendingBuffer=null),128&e[e.length-1]?this._pendingBuffer=e:(void 0===this._input?this._input=this._readStartingBom("string"==typeof e?e:e.toString()):this._input+=e,this._tokenizeToEnd(t,!1)))})),e.on("end",(()=>{"string"==typeof this._input&&this._tokenizeToEnd(t,!0)})),e.on("error",t)}}let Ze=0;class et{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&nt(this,e.factory);const t="string"==typeof e.format?e.format.match(/\w*$/)[0].toLowerCase():"",n=/turtle/.test(t),r=/trig/.test(t),i=/triple/.test(t),o=/quad/.test(t),a=this._n3Mode=/n3/.test(t),s=i||o;(this._supportsNamedGraphs=!(n||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(n||r||i||a),this._supportsRDFStar=""===t||/star|\*$/.test(t),s&&(this._resolveRelativeIRI=e=>null),this._blankNodePrefix="string"!=typeof e.blankNodePrefix?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new Ye({lineMode:s,n3:a}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){Ze=0}_setBase(e){if(e){const t=e.indexOf("#");t>=0&&(e=e.substr(0,t)),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]}else this._base="",this._basePath=""}_saveContext(e,t,n,r,i){const o=this._n3Mode;this._contextStack.push({type:e,subject:n,predicate:r,object:i,graph:t,inverse:!!o&&this._inversePredicate,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,t){const n=this._contextStack.pop();if(!n||n.type!==e)return this._error(`Unexpected ${t.type}`,t);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)}_readInTopContext(e){switch(e.type){case"eof":return null!==this._graph?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"{":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,t){let n;switch(e.type){case"IRI":case"typeIRI":const t=this._resolveIRI(e.value);if(null===t)return this._error("Invalid IRI",e);n=this._namedNode(t);break;case"type":case"prefixed":const r=this._prefixes[e.prefix];if(void 0===r)return this._error(`Undefined prefix "${e.prefix}:"`,e);n=this._namedNode(r+e.value);break;case"blank":n=this._blankNode(this._prefixes[e.prefix]+e.value);break;case"var":n=this._variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!t&&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._blankNode(),null,null),this._readBlankNodeHead;case"(":return 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._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=this._blankNode,this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier=this._variable,this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(0===e.prefix.length)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._literal(e.value,this._namedNode(e.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",e);default:if(void 0===(this._subject=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){const t=e.type;switch(t){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${t}`,e):(this._subject=null,"]"===t?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",e);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if(void 0===(this._predicate=this._readEntity(e)))return}return this._readObject}_readObject(e){switch(e.type){case"literal":if(0===e.prefix.length)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._literal(e.value,this._namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._blankNode()),this._readBlankNodeHead;case"(":return 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._blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",e);default:if(void 0===(this._object=this._readEntity(e)))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){return"]"===e.type?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if("]"!==e.type)return this._readBlankNodePunctuation(e);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const t=null===this._predicate;return this._restoreContext("blank",e),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:t?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 t=null,n=null,r=this._readListItem;const i=this._subject,o=this._contextStack,a=o[o.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,n=this._blankNode(),this.RDF_FIRST,this._subject=t=this._blankNode()),r=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,n=this._blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),0!==o.length&&"list"===o[o.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(r=this._readPredicate,this._subject===this.RDF_NIL)return r}else if(r=this._getContextEndReader(),this._object===this.RDF_NIL)return r;n=this.RDF_NIL;break;case"literal":0===e.prefix.length?(this._literalValue=e.value,r=this._readListItemDataTypeOrLang):(t=this._literal(e.value,this._namedNode(e.prefix)),r=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if(void 0===(t=this._readEntity(e)))return}if(null===n&&(this._subject=n=this._blankNode()),null===i?null===a.predicate?a.subject=n:a.object=n:this._emit(i,this.RDF_REST,n,this._graph),null!==t){if(this._n3Mode&&("IRI"===e.type||"prefixed"===e.type))return this._saveContext("item",this._graph,n,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(n,this.RDF_FIRST,t,this._graph)}return r}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let t=this._literal(this._literalValue);switch(e.type){case"type":case"typeIRI":const n=this._readEntity(e);if(void 0===n)return;t=this._literal(this._literalValue,n),e=null;break;case"langcode":t=this._literal(this._literalValue,e.value),e=null}return{token:e,literal:t}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,t){const n=this._completeLiteral(e);if(n)return this._object=n.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),null===n.token?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(n.token))}_readFormulaTail(e){return"}"!==e.type?this._readPunctuation(e):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let t,n=this._graph;const r=this._subject,i=this._inversePredicate;switch(e.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,i&&(this._inversePredicate=!1);break;case";":t=this._readPredicate;break;case",":t=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF-star syntax",e);const o=this._predicate,a=this._object;this._subject=this._quad(r,o,a,this.DEFAULTGRAPH),t=this._readPredicate;break;case"|}":if("Quad"!==this._subject.termType)return this._error("Unexpected asserted triple closing",e);this._subject=null,t=this._readPunctuation;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(n=this._readEntity(e))){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(null!==r){const e=this._predicate,t=this._object;i?this._emit(t,e,r,n):this._emit(r,e,t,n)}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case";":t=this._readPredicate;break;case",":t=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),t}_readQuadPunctuation(e){return"."!==e.type?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return"prefix"!==e.type?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if("IRI"!==e.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);const t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){const t="IRI"===e.type&&this._resolveIRI(e.value);return t?(this._setBase(t),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",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._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 t;switch(e.type){case"IRI":case"prefixed":if(void 0!==(t=this._readEntity(e,!0)))break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._quantifier(this._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:const t=this._contextStack,n=t.length&&t[t.length-1];if(n&&"item"===n.type){const t=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,t,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let t,n;const r=this._blankNode();if(void 0!==(n=this._readEntity(e)))return null===this._predicate?(t=this._subject,this._subject=r):(t=this._object,this._object=r),this._emit(t,n,r,this._graph),this._readPath}_readBackwardPath(e){const t=this._blankNode();let n,r;if(void 0!==(n=this._readEntity(e)))return null===this._predicate?(r=this._subject,this._subject=t):(r=this._object,this._object=t),this._emit(t,n,r,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return">>"!==e.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(e))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e):this._readRDFStarTail(e)}_readRDFStarTail(e){if(">>"!==e.type)return this._error(`Expected >> but got ${e.type}`,e);const t=this._quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",e),null===this._subject?(this._subject=t,this._readPredicate):(this._object=t,this._getContextEndReader())}_getContextEndReader(){const 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._readRDFStarTailOrGraph}}_emit(e,t,n,r){this._callback(null,this._quad(e,t,n,r||this.DEFAULTGRAPH))}_error(e,t){const n=new Error(`${e} on line ${t.line}.`);n.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=tt}_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;const t=e.length;let n="",r=-1,i=-1,o=0,a="/";for(;r<t;){switch(a){case":":if(i<0&&"/"===e[++r]&&"/"===e[++r])for(;(i=r+1)<t&&"/"!==e[i];)r=i;break;case"?":case"#":r=t;break;case"/":if("."===e[r+1])switch(a=e[1+ ++r],a){case"/":n+=e.substring(o,r-1),o=r+1;break;case void 0:case"?":case"#":return n+e.substring(o,r)+e.substr(r+1);case".":if(a=e[1+ ++r],void 0===a||"/"===a||"?"===a||"#"===a){if(n+=e.substring(o,r-2),(o=n.lastIndexOf("/"))>=i&&(n=n.substr(0,o)),"/"!==a)return`${n}/${e.substr(r+1)}`;o=r+1}}}a=e[++r]}return n+e.substring(o)}parse(e,t,n){let r,i,o;if(t&&(t.onQuad||t.onPrefix||t.onComment)?(r=t.onQuad,i=t.onPrefix,o=t.onComment):(r=t,i=n),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Ze++}_`,this._prefixCallback=i||tt,this._inversePredicate=!1,this._quantified=Object.create(null),!r){const t=[];let n;if(this._callback=(e,r)=>{e?n=e:r&&t.push(r)},this._lexer.tokenize(e).every((e=>this._readCallback=this._readCallback(e))),n)throw n;return t}let a=(e,t)=>{null!==e?(this._callback(e),this._callback=tt):this._readCallback&&(this._readCallback=this._readCallback(t))};o&&(this._lexer.comments=!0,a=(e,t)=>{null!==e?(this._callback(e),this._callback=tt):this._readCallback&&("comment"===t.type?o(t.value):this._readCallback=this._readCallback(t))}),this._callback=r,this._lexer.tokenize(e,a)}}function tt(){}function nt(e,t){const n=t.namedNode;e._namedNode=n,e._blankNode=t.blankNode,e._literal=t.literal,e._variable=t.variable,e._quad=t.quad,e.DEFAULTGRAPH=t.defaultGraph(),e.RDF_FIRST=n(c.rdf.first),e.RDF_REST=n(c.rdf.rest),e.RDF_NIL=n(c.rdf.nil),e.N3_FORALL=n(c.r.forAll),e.N3_FORSOME=n(c.r.forSome),e.ABBREVIATIONS={a:n(c.rdf.type),"=":n(c.owl.sameAs),">":n(c.log.implies)},e.QUANTIFIERS_GRAPH=n("urn:n3:quantifiers")}nt(et.prototype,g);var rt=r(4841),it=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};const ot={},at={};let st;class lt{constructor(e){this.loadedExternalUrls=[],this.loadedClasses=[],this.config=e}loadGraphs(){return it(this,void 0,void 0,(function*(){this.loadedExternalUrls=[],this.loadedClasses=[];let e=st;const t=new Fe;this.config.prefixes={};const n=[this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?this.fetchRDF(this.config.attributes.valuesUrl):"",t,void 0,new et({blankNodePrefix:""}))];if(e||(e=new Fe,n.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?this.fetchRDF(this.config.attributes.shapesUrl):"",e,$))),yield Promise.all(n),!st&&0==(null==e?void 0:e.size)&&this.config.attributes.valuesSubject){const n=[...t.getObjects(this.config.attributes.valuesSubject,B,null),...t.getObjects(this.config.attributes.valuesSubject,F,null)],r=[];for(const t of n){const n=this.toURL(t.value);n&&this.loadedExternalUrls.indexOf(n)<0&&(this.loadedExternalUrls.push(n),r.push(this.importRDF(this.fetchRDF(n),e,$)))}try{yield Promise.allSettled(r)}catch(e){console.warn(e)}}this.config.shapesGraph=e,this.config.dataGraph=t}))}importRDF(e,t,n,r){return it(this,void 0,void 0,(function*(){const i=r||new et,o=e=>it(this,void 0,void 0,(function*(){const o=[];yield new Promise(((a,s)=>{i.parse(e,((e,i,l)=>{if(e)return s(e);if(i){if(t.add(new S(i.subject,i.predicate,i.object,n)),null===this.config.attributes.ignoreOwlImports&&G.equals(i.predicate)){const e=this.toURL(i.object.value);e&&this.loadedExternalUrls.indexOf(e)<0&&(this.loadedExternalUrls.push(e),o.push(this.importRDF(this.fetchRDF(e),t,g.namedNode(e),r)))}if(this.config.classInstanceProvider&&z.equals(i.predicate)){const e=i.object.value;if(this.loadedClasses.indexOf(e)<0){let i;e in at?i=at[e]:(i=this.config.classInstanceProvider(e),at[e]=i),this.loadedClasses.push(e),o.push(this.importRDF(i,t,n,r))}}}else l&&this.config.registerPrefixes(l),a(null)}))}));try{yield Promise.allSettled(o)}catch(e){console.warn(e)}}));if(e instanceof Promise&&(e=yield e),e){try{e=yield(0,rt.toRDF)(JSON.parse(e),{format:"application/n-quads"})}catch(e){}yield o(e)}}))}fetchRDF(e){return it(this,void 0,void 0,(function*(){if(e in ot)return ot[e];const t=fetch(e,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then((e=>e.text()));return ot[e]=t,t}))}toURL(e){if(ne(e))return e;if(this.config.prefixes){const t=e.split(":");if(2===t.length){const n=this.config.prefixes[t[0]];if(n&&ne(e=e.replace(`${t[0]}:`,n)))return e}}return null}}function ct(e){st=e}class ut{constructor(){this.shapes=null,this.shapesUrl=null,this.shapeSubject=null,this.values=null,this.valuesUrl=null,this.valueSubject=null,this.valuesSubject=null,this.valuesNamespace="",this.valuesGraph=null,this.view=null,this.language=null,this.loading="Loading…",this.ignoreOwlImports=null,this.collapse=null,this.submitButton=null,this.generateNodeShapeReference=null,this.showNodeIds=null}}class dt{constructor(e,t){this.attributes=new ut,this.loader=new lt(this),this.prefixes={},this.editMode=!0,this.dataGraph=new Fe,this.lists={},this.groups=[],this.renderedNodes=new Set,this._shapesGraph=new Fe,this.theme=e,this.form=t,this.languages=[...new Set(navigator.languages.flatMap((e=>e.length>2?[e.toLocaleLowerCase(),e.substring(0,2)]:e))),""]}updateAttributes(e){const t=new ut;if(Object.keys(t).forEach((n=>{const r=e.dataset[n];void 0!==r&&(t[n]=r)})),this.editMode=null===t.view,this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){const e=this.languages.indexOf(t.language);e>-1&&this.languages.splice(e,1),this.languages.unshift(t.language)}this.valuesGraph=t.valuesGraph?g.namedNode(t.valuesGraph):void 0}static dataAttributes(){const e=new ut;return Object.keys(e).map((e=>"data-"+e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))))}get shapesGraph(){return this._shapesGraph}set shapesGraph(e){this._shapesGraph=e,this.lists=e.extractLists(),this.groups=[],e.forSubjects((e=>{this.groups.push(e.id)}),B,`${k}PropertyGroup`,null)}registerPrefixes(e){for(const t in e)t&&(this.prefixes[t]=e[t])}}const ht=function(e){return"<"+e.value+">"},ft=/["\\\\\n\r]/,pt=/["\\\\\n\r]/g,gt={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function yt(e){return gt[e]}const mt=function e(t){if(!t)return null;if("BlankNode"===t.termType)return function(e){return"_:"+e.value}(t);if("DefaultGraph"===t.termType)return"";if("Literal"===t.termType)return function(e){const t=(n=e.value,ft.test(n)?n.replace(pt,yt):n);var n;return"http://www.w3.org/2001/XMLSchema#string"===e.datatype.value?'"'+t+'"':"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"===e.datatype.value?'"'+t+'"@'+e.language:'"'+t+'"^^'+ht(e.datatype)}(t);if("NamedNode"===t.termType)return ht(t);if("Quad"===t.termType||t.subject&&t.predicate&&t.object&&t.graph)return function(e,t){const n=t(e.subject),r=t(e.predicate),i=t(e.object),o=t(e.graph);return`${n} ${r} ${i} ${o?o+" ":""}.`}(t,e);if("Variable"===t.termType)return function(e){return"?"+e.value}(t);if(t[Symbol.iterator])return function(e,t){return[...e].map((e=>t(e))).join("\n")+"\n"}(t,e);throw new Error(`unknown termType ${t.termType}`)};class bt{constructor(e){if(this.index=new Map,e)for(const[t,n]of e)this.set(t,n)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(mt(e))}*entries(){for(const[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(const n of this.entries())e.call(t,n[1],n[0],this)}get(e){const t=this.index.get(mt(e));return t&&t.value}has(e){return this.index.has(mt(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const n=mt(e);return this.index.set(n,{term:e,value:t}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}const vt=bt;function wt(e){try{return mt(e)}catch(e){return null}}class _t{constructor(e){if(this.index=new Map,e)for(const t of e)this.add(t)}get size(){return this.index.size}add(e){const t=mt(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return!!e&&this.index.delete(wt(e))}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return!!e&&this.index.has(wt(e))}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}const xt=_t,St=class{constructor({dataset:e,end:t,quad:n,start:r}){this.dataset=e,this.end=t,this.quad=n,this.start=r}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}};class jt{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}jt.prototype.termType="BlankNode";const It=jt;class Et{equals(e){return!!e&&e.termType===this.termType}}Et.prototype.termType="DefaultGraph",Et.prototype.value="";const Nt=Et,Tt=function(e,t){if(!t)return null;if("BlankNode"===t.termType)return e.blankNode(t.value);if("DefaultGraph"===t.termType)return e.defaultGraph();if("Literal"===t.termType)return e.literal(t.value,t.language||e.namedNode(t.datatype.value));if("NamedNode"===t.termType)return e.namedNode(t.value);if("Quad"===t.termType){const n=e.fromTerm(t.subject),r=e.fromTerm(t.predicate),i=e.fromTerm(t.object),o=e.fromTerm(t.graph);return e.quad(n,r,i,o)}if("Variable"===t.termType)return e.variable(t.value);throw new Error(`unknown termType ${t.termType}`)};class Rt{constructor(e,t,n){this.value=e,this.language=t,this.datatype=n}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value&&e.language===this.language&&e.datatype.equals(this.datatype)}}Rt.prototype.termType="Literal";const Ot=Rt;class kt{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}kt.prototype.termType="NamedNode";const Lt=kt;class At{constructor(e,t,n,r){this.subject=e,this.predicate=t,this.object=n,this.graph=r}equals(e){return!!e&&("Quad"===e.termType||!e.termType)&&e.subject.equals(this.subject)&&e.predicate.equals(this.predicate)&&e.object.equals(this.object)&&e.graph.equals(this.graph)}}At.prototype.termType="Quad",At.prototype.value="";const Ct=At;class Dt{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Dt.prototype.termType="Variable";const Mt=Dt,Pt=new Lt("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),$t=new Lt("http://www.w3.org/2001/XMLSchema#string");class Bt{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new Nt}}namedNode(e){return new Lt(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new It(e)}literal(e,t){return"string"==typeof t?new Ot(e,t,Pt):new Ot(e,"",t||$t)}variable(e){return new Mt(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,n,r=this.defaultGraph()){return new Ct(e,t,n,r)}fromTerm(e){return Tt(this,e)}fromQuad(e){return Tt(this,e)}}Bt.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const Ft=new Bt,qt={apply:(e,t,n)=>e(n[0]),get:(e,t)=>e(t)},Ut=function(e,{factory:t=Ft}={}){const n=(n="")=>t.namedNode(`${e}${n.raw||n}`);return"undefined"==typeof Proxy?n:new Proxy(n,qt)},Gt=(Ut("http://www.w3.org/2001/XMLSchema#"),Ut("http://www.w3.org/1999/02/22-rdf-syntax-ns#"));Ut("http://www.w3.org/2000/01/rdf-schema#");class Ht{static add({ptr:e,start:t,end:n,subjects:r=[null],predicates:i=[null],objects:o=[null],graphs:a,callback:s}={}){if(!e.factory)throw new Error("add operation requires a factory");let l=()=>{};s&&(l=r=>{s(new St({dataset:e.dataset,start:t,end:n,quad:r}))});for(const n of r)for(const r of i)for(const i of o)for(const o of a){const a={subject:n,predicate:r,object:i,graph:o};a[t]=e.term;const s=e.factory.quad(a.subject,a.predicate,a.object,a.graph);e.dataset.add(s),l(s)}return e}static addList({ptr:e,predicates:t,items:n,graphs:r}){if(e.isAny())throw new Error("can't attach a list to an any ptr");for(const i of t)for(const t of r){const r=n.map((()=>e.factory.blankNode()));e.dataset.add(e.factory.quad(e.term,i,r[0]||Gt.nil,t));for(let i=0;i<r.length;i++)e.dataset.add(e.factory.quad(r[i],Gt.first,n[i],t)),e.dataset.add(e.factory.quad(r[i],Gt.rest,r[i+1]||Gt.nil,t))}return e}static delete({ptr:e,start:t,subjects:n=[null],predicates:r=[null],objects:i=[null]}){for(const o of n)for(const n of r)for(const r of i){const i={subject:o,predicate:n,object:r};i[t]=e.term;const a=e.dataset.match(i.subject,i.predicate,i.object);for(const t of a)e.dataset.delete(t)}return e}static deleteList({ptr:e,predicates:t}){const n=[];for(const r of t)for(const t of e.dataset.match(e.term,r)){let r=t.object;for(n.push(t);!Gt.nil.equals(r);){r=n[n.length-1].object;const t=e.dataset.match(r);if(0===t.size)break;for(const e of t)n.push(e)}}for(const t of n)e.dataset.delete(t);return e}static execute({ptr:e,operation:t="traverse",quantifier:n,start:r,end:i,subjects:o,predicates:a,objects:s,graphs:l,items:c,callback:u}={}){if("add"===t)return Ht.add({ptr:e,start:r,end:i,subjects:o,predicates:a,objects:s,graphs:l,callback:u});if("addList"===t)return Ht.addList({ptr:e,predicates:a,items:c,graphs:l});if("delete"===t)return Ht.delete({ptr:e,start:r,subjects:o,predicates:a,objects:s});if("deleteList"===t)return Ht.deleteList({ptr:e,predicates:a});if("isList"===t)return Ht.isList({ptr:e});if("list"===t)return Ht.list({ptr:e});if("traverse"===t)return Ht.traverse({ptr:e,quantifier:n,start:r,end:i,subjects:o,predicates:a,objects:s,graphs:l});throw new Error(`unknown operation ${t}`)}static isList({ptr:e}){return!e.isAny()&&(!!Gt.nil.equals(e.term)||1===Ht.traverse({ptr:e,predicates:[Gt.first]}).length)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(Gt.nil);){const t=e.out([Gt.first]);if(1!==t.length)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const n=e.out([Gt.rest]);if(1!==n.length)throw new Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=n[0]}}}}static traverse({ptr:e,quantifier:t="one",start:n="subject",end:r="object",subjects:i=[null],predicates:o=[null],objects:a=[null],graphs:s=[null],callback:l}){if("one"===t)return Ht.traverseOne({ptr:e,start:n,end:r,subjects:i,predicates:o,objects:a,graphs:s,callback:l});if("oneOrMore"===t){const t=Ht.traverse({ptr:e,end:r,start:n,subjects:i,predicates:o,objects:a,graphs:s,callback:l});return Ht.traverseMore({ptrs:t,end:r,start:n,subjects:i,predicates:o,objects:a,graphs:s,callback:l})}if("zeroOrMore"===t)return Ht.traverseMore({ptrs:[e],end:r,start:n,subjects:i,predicates:o,objects:a,graphs:s,callback:l});if("zeroOrOne"===t)return[e,...Ht.traverse({ptr:e,end:r,start:n,subjects:i,predicates:o,objects:a,graphs:s,callback:l})];throw new Error(`unknown quantifier ${t}`)}static traverseMore({ptrs:e,end:t,start:n,subjects:r,predicates:i,objects:o,graphs:a,callback:s}={}){let l,c,u=[...e];do{l=[];for(const c of e)l=[...l,...Ht.traverseOne({ptr:c,end:t,start:n,subjects:r,predicates:i,objects:o,graphs:a,callback:s})];c&&(l=l.filter((e=>!c.has(e.term)))),e=l,u=[...u,...l],c=new xt(u.map((e=>e.term)))}while(l.length>0);return u}static traverseOne({ptr:e,start:t,end:n,subjects:r,predicates:i,objects:o,graphs:a,callback:s=(e,t)=>t.extend(e)}={}){const l=[];for(const c of r)for(const r of i)for(const i of o)for(const o of a){const a={subject:c,predicate:r,object:i,graph:o};a[t]=e.term;for(const r of e.dataset.match(a.subject,a.predicate,a.object,a.graph))l.push(s(new St({dataset:e.dataset,end:n,quad:r,start:t}),e))}return l}}const Vt=Ht;function Wt(e,t){return t?n=>t(e.extend(n)):()=>{}}const zt=class{constructor({dataset:e,edges:t=[],factory:n,graph:r,term:i}){if(!e&&0===t.length)throw new Error("dataset or edges is required");if(0===t.length&&void 0===i)throw new Error("edges or term must be given");if(t.length>0&&i)throw new Error("edges or term must be given");this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=n,this._graph=r,0===t.length&&(this._term=i)}get edge(){return this.edges[this.edges.length-1]}get graph(){return"object"==typeof this._graph?this._graph:this.edge&&this.edge.graph}get length(){return void 0!==this._term?1:this.edges.length+1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return void 0!==this._term?this._term:this.edge.term}get value(){const e=this.term;return null===e?void 0:e.value}addIn(e,t,n){return Vt.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:Wt(this,n)})}addList(e,t){return Vt.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,n){return Vt.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:Wt(this,n)})}deleteIn(e,t){return Vt.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return Vt.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return Vt.delete({ptr:this,start:"subject",predicates:e,objects:t})}execute({operation:e,quantifier:t,start:n,end:r,subjects:i,predicates:o,objects:a,graphs:s,items:l,callback:c}){return Vt.execute({ptr:this,operation:e,quantifier:t,start:n,end:r,subjects:i,predicates:o,objects:a,graphs:s,items:l,callback:c})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return Vt.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return Vt.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return Vt.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return Vt.isList({ptr:this})}list(){return Vt.list({ptr:this})}nodes(){const e=this,t=e=>void 0!==this._term?{dataset:this.dataset,term:this._term}:this.edges.length>e?{dataset:this.edges[e].dataset,term:this.edges[e].startTerm}:this.edges.length===e?{dataset:this.edges[e-1].dataset,term:this.edges[e-1].term}:void 0;return{*[Symbol.iterator](){for(let n=0;n<e.length;n++)yield t(n)}}}out(e,t){return Vt.traverse({ptr:this,predicates:e,objects:t,graphs:[this.graph]})}quads(){const e=this;return{*[Symbol.iterator](){for(const t of e.edges)yield t.quad}}}trim(){return new this.constructor({dataset:this.dataset,factory:this.factory,graph:this.graph,term:this.term})}},Jt=function(e,t){return e?e.equals(t):e===t};function Qt(e,t){return t?n=>t(new e.constructor({factory:e.factory,ptrs:[n]})):()=>{}}class Xt{constructor({dataset:e,factory:t,ptrs:n,terms:r,graphs:i}){if(this.factory=t,n)this.ptrs=[...n];else{this.ptrs=[];for(const n of r||[null])for(const r of i||[null])this.ptrs.push(new zt({dataset:e,factory:t,graph:r,term:n}))}}get dataset(){const e=new Set(this.datasets);return 1!==e.size?null:e[Symbol.iterator]().next().value}get datasets(){return this.ptrs.map((e=>e.dataset))}get term(){const e=new xt(this.terms);if(1===e.size)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map((e=>e.term))}get value(){const e=this.term;return null==e?void 0:e.value}get values(){return this.ptrs.map((e=>e.value))}addIn(e,t,n){const r=Qt(this,n);for(const n of this.ptrs)n.addIn(e,t,r);return this}addList(e,t){if(this.isAny())throw new Error("can't attach a list to an any ptr");for(const n of this.ptrs)n.addList(e,t);return this}addOut(e,t,n){const r=Qt(this,n);for(const n of this.ptrs)n.addOut(e,t,r);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(const n of this.ptrs)n.deleteIn(e,t);return this}deleteList(e){for(const t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(const n of this.ptrs)n.deleteOut(e,t);return this}distinct(){const e=this.ptrs.reduce(((e,t)=>(e.some((e=>{return r=t,(n=e).dataset===r.dataset&&!!Jt(n.graph,r.graph)&&!!Jt(n.term,r.term);var n,r}))||e.push(t.trim()),e)),[]);return this.clone({ptrs:e})}execute(e){return this.clone({ptrs:this.ptrs.flatMap((t=>t.execute(e)))})}executeAll(e){let t=this;for(const n of e)t=t.execute(n);return t}filter(e){return this.clone({ptrs:[...this].filter(e).map((e=>e.ptrs[0]))})}hasIn(e,t){return this.clone({ptrs:this.ptrs.flatMap((n=>n.hasIn(e,t)))})}hasOut(e,t){return this.clone({ptrs:this.ptrs.flatMap((n=>n.hasOut(e,t)))})}in(e,t){return this.clone({ptrs:this.ptrs.flatMap((n=>n.in(e,t)))})}isAny(){return this.ptrs.length>0&&this.ptrs.some((e=>e.isAny()))}isList(){return 1===this.ptrs.length&&this.ptrs[0].isList()}list(){if(!this.isList())return;const e=this.ptrs[0].list()[Symbol.iterator](),t=()=>{const{done:t,value:n}=e.next();return t?{done:!0}:{done:!1,value:this.clone({ptrs:[n]})}};return{[Symbol.iterator]:()=>({next:t})}}map(e){return[...this].map(e)}node(e){const t=this.dataset,n=[...e].map((e=>new zt({dataset:t,factory:this.factory,term:e})));return this.clone({ptrs:n})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap((n=>n.out(e,t)))})}quads(){const e=this;return{*[Symbol.iterator](){for(const t of e.ptrs)for(const e of t.edges)yield e.quad}}}trim(){return this.clone({ptrs:this.ptrs.map((e=>e.trim()))})}*[Symbol.iterator](){for(const e of this.ptrs)yield this.clone({ptrs:[e]})}}const Kt=Xt;Ut("http://www.w3.org/2002/07/owl#");const Yt=Ut("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),Zt=Ut("http://www.w3.org/2000/01/rdf-schema#"),en=Ut("http://www.w3.org/ns/shacl#"),tn=Ut("https://schemas.link/shacl-next#"),nn=Ut("http://www.w3.org/2001/XMLSchema#");var rn=r(8059);const on=class{constructor({details:e,factory:t,options:n,results:r=[]}={}){this.details=e,this.factory=t,this.options=n,this.results=r,this._conforms=rn((()=>!this.results.some((e=>e.severity.equals(en.Info)||e.severity.equals(en.Violation)||e.severity.equals(en.Warning))))),this._ptr=rn((()=>this.build()))}get conforms(){return this._conforms()}get dataset(){return this.ptr.dataset}get ptr(){return this._ptr()}get term(){return this.ptr.term}build(){const e=new Kt({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([Yt.type],[en.ValidationReport]).addOut([en.conforms],[this.factory.literal(this.conforms.toString(),nn.boolean)]);for(const t of this.results)e.addOut([en.result],[this.factory.blankNode()],(e=>{t.build(e,this.options)}));return e}coverage(){return this.results.flatMap((e=>e.coverage()))}},an=class{constructor({args:e={},constraintComponent:t,factory:n,focusNode:r,message:i=[],path:o,results:a=[],severity:s,shape:l,source:c=[],value:u,valuePaths:d=[]}={}){this.args=e,this.constraintComponent=t,this.factory=n,this.focusNode=r,this.path=o||l.path,this.results=a,this.severity=s,this.shape=l,this.source=c,this.value=u,this.valuePaths=d,this._message=rn((()=>(this.shape.message.length>0&&(i=this.shape.message),0===i.length&&(i=this.shape.ptr.node([this.constraintComponent]).out([en.message]).terms),i.map((t=>n.literal(function(e,t){return Object.entries(t).reduce(((e,[t,n])=>(n&&n.termType&&(n=mt(n)),e.replace(`{$${t}}`,n).replace(`{?${t}}`,n))),e)}(t.value,e),t.language||null))))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([Yt.type],[en.ValidationResult]).addOut([en.focusNode],this.focusNode.terms).addOut([en.resultSeverity],[this.severity]).addOut([en.sourceConstraint],this.source).addOut([en.sourceConstraintComponent],[this.constraintComponent]).addOut([en.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([en.resultMessage],this.message);const n=t=>"one"===t.quantifier?t.predicates.length>1?e.node([this.factory.blankNode()]).addList([en.alternativePath],t.predicates):"object"===t.start?e.node([this.factory.blankNode()]).addOut([en.inversePath],[t.predicates[0]]):e.node([t.predicates[0]]):"oneOrMore"===t.quantifier?e.node([this.factory.blankNode()]).addOut([en.oneOrMorePath],[t.predicates[0]]):"zeroOrMore"===t.quantifier?e.node([this.factory.blankNode()]).addOut([en.zeroOrMorePath],[t.predicates[0]]):"zeroOrOne"===t.quantifier?e.node([this.factory.blankNode()]).addOut([en.zeroOrOnePath],[t.predicates[0]]):void 0;if(this.path&&(1===this.path.length?e.addOut([en.resultPath],n(this.path[0]).terms):e.addList([en.resultPath],this.path.map((e=>n(e).term)))),void 0!==this.value&&e.addOut([en.value],this.value.terms),t)for(const n of this.results)e.addOut([en.detail],[this.factory.blankNode()],(e=>{n.build(e,{details:t})}))}coverage(){return[...this.valuePaths.flatMap((e=>[...e.quads()])),...this.results.flatMap((e=>e.coverage()))]}};class sn{constructor({factory:e,focusNode:t,options:n={debug:!1,details:!1},processed:r=new Set,report:i=new on({factory:e,options:n}),results:o=new Map,shape:a,value:s,valueOrNode:l,valuePaths:c,values:u}={}){this.factory=e,this.focusNode=t,this.options=n,this.processed=r,this.report=i,this.results=o,this.shape=a,this.value=s,this.valuePaths=c,this.valueOrNode=l,this.values=u}create({child:e,focusNode:t=this.focusNode,shape:n=this.shape,value:r=this.value,valueOrNode:i=this.valueOrNode,valuePaths:o=this.valuePaths,values:a=this.values}={}){return new sn({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new on({factory:this.factory,options:this.options}):this.report,results:this.results,shape:n,value:r,valueOrNode:i,valuePaths:o,values:a})}id({shape:e=this.shape}={}){return`${mt(e.ptr.term)} - ${mt(this.focusNode.term)} - ${t=this.valuePaths,t?`{${t.map((e=>function(e){return e?`{${[...e.quads()].map((e=>mt(e))).join(" ")}}`:"{}"}(e))).join(" ")}}`:"{}"}`;var t}result(e){const t=new an({factory:this.factory,focusNode:this.focusNode,shape:this.shape,value:this.value,valuePaths:this.valuePaths,...e}),n=this.id();this.results.has(n)?this.results.get(n).add(t):this.results.set(n,new Set([t])),this.report.results.push(t)}debug(e,t){this.options.debug&&this.result({severity:tn.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:tn.Trace,constraintComponent:e,...t})}test(e,t,n){e?this.debug(t,n):this.violation(t,n)}violation(e,t){this.result({constraintComponent:e,severity:this.shape.severity||en.Violation,...t})}}const ln=sn;function cn(){return{generic:e=>{e.trace(tn.TraversalConstraintComponent,{args:{},message:[e.factory.literal("Traversal")],value:e.valueOrNode})}}}const un=class{constructor(e){this.validations=new vt(e)}compile(e){const t=e.validator.options.coverage;if(e.deactivated)return[];let n=!1;const r=new Set;for(const t of e.ptr.execute({start:"subject",end:"predicate"})){const e=this.validations.get(t.term);e&&(r.add(e),t.term.equals(en.property)&&(n=!0))}return t&&e.isPropertyShape&&!n&&r.add(cn),[...r].map((t=>t(e))).filter(Boolean)}};var dn=r(9349);function hn(e){if("BlankNode"!==e.term.termType)return{quantifier:"one",start:"subject",end:"object",predicates:[e.term]};const t=e.out([en.alternativePath]);if(1===t.ptrs.length&&t.ptrs[0].isList())return{quantifier:"one",start:"subject",end:"object",predicates:[...t.list()].map((e=>e.term))};const n=e.out([en.inversePath]);if(n.term)return{quantifier:"one",start:"object",end:"subject",predicates:[n.term]};const r=e.out([en.oneOrMorePath]);if(r.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[r.term]};const i=e.out([en.zeroOrMorePath]);if(i.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[i.term]};const o=e.out([en.zeroOrOnePath]);return o.term?{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[o.term]}:void 0}const fn=class{constructor(e){this.shape=e,this._compiled=rn((()=>this.shape.validator.registry.compile(e)))}get compiled(){return this._compiled()}async validate(e){return 0===e.focusNode.dataset.size||(this.shape.isPropertyShape?await this.validateProperty(e):await this.validateNode(e)),e}async validateNode(e){const t=e.create({shape:this.shape,valueOrNode:e.value||e.focusNode});for(const e of this.compiled)e.node&&await e.node(t),e.generic&&await e.generic(t)}async validateProperty(e){let t;t=this.shape.isSparqlShape?e.focusNode:e.focusNode.executeAll(this.shape.path);const n=t.node(new xt(t.terms)),r=[...t].reduce(((e,n)=>{const r=n.term,i=t.node([r]);return e.has(r)||e.set(r,{value:i,valuePaths:[]}),e.get(r).valuePaths.push(n),e}),new vt).values(),i=e.create({shape:this.shape,values:n});for(const e of this.compiled)e.property&&await e.property(i);for(const{value:t,valuePaths:n}of r){const r=e.create({shape:this.shape,value:t,valueOrNode:t,valuePaths:n});for(const e of this.compiled)e.generic&&await e.generic(r)}}},pn=function(e){const t=new xt,n=new Kt({dataset:e.dataset,terms:e.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[Zt.subClassOf]});for(const e of n.ptrs)for(const{term:n}of e.nodes())t.add(n);return t},gn=class{constructor(e){this.targetClass=new xt([...pn(e.hasOut([Yt.type],[en.NodeShape])),...pn(e.out([en.targetClass]))]),this.targetNode=e.out([en.targetNode]).terms,this.targetObjectsOf=e.out([en.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([en.targetSubjectsOf]).terms}resolve(e){const t=e.focusNode.node([null]),n=[...e.focusNode.hasOut([Yt.type],this.targetClass).ptrs,...e.focusNode.node(this.targetNode).ptrs,...t.execute({start:"object",end:"object",predicates:this.targetObjectsOf}).ptrs,...t.execute({start:"subject",end:"subject",predicates:this.targetSubjectsOf}).ptrs],r=e.focusNode.clone({ptrs:n});return r.node([...new xt(r.terms)])}},yn=class{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=rn((()=>{const e=this.ptr.out([en.deactivated]).term;return e&&(0,dn.fromRdf)(e)})),this._message=rn((()=>this.ptr.out([en.message]).terms)),this._path=rn((()=>function(e){return 0===e.terms.length?null:e.ptrs[0].isList()?[...e.list()].map((e=>hn(e))):[hn(e)]}(this.ptr.out([en.path])))),this._severity=rn((()=>this.ptr.out([en.severity]).term)),this._shapeValidator=rn((()=>new fn(this))),this._sparql=rn((()=>this.ptr.out([en.sparql]))),this._targetResolver=rn((()=>new gn(this.ptr)))}get deactivated(){return this._deactivated()}get isPropertyShape(){return Boolean(this.path)}get isSparqlShape(){return this.sparql.terms.length>0}get path(){return this._path()}get targetResolver(){return this._targetResolver()}get message(){return this._message()}get severity(){return this._severity()}get shapeValidator(){return this._shapeValidator()}get sparql(){return this._sparql()}resolveTargets(e){return this.targetResolver.resolve(e)}async validate(e){const t=e.id({shape:this});if(e.processed.has(t)){if(e.results.has(t))for(const n of e.results.get(t))e.report.results.push(n);return e}return e.processed.add(t),this.shapeValidator.validate(e)}};async function mn(e,t){return Promise.all(e.map(t))}function bn(e){return t=>{t.test(e.equals(t.valueOrNode.term),en.HasValueConstraintComponent,{args:{hasValue:e},message:[t.factory.literal("Value must be {$hasValue}")]})}}function vn(e){return t=>{const n=[...t.values].some((t=>e.equals(t.term)));t.test(n,en.HasValueConstraintComponent,{args:{hasValue:e},message:[t.factory.literal("Missing expected value {$hasValue}")]})}}function wn(e){return nn.dateTime.equals(e.datatype)&&/^.*(((\+|-)\d{2}:\d{2})|Z)$/.test(e.value)}const _n=function(e,t){if(!e||"Literal"!==e.termType)return null;if(!t||"Literal"!==t.termType)return null;if(wn(e)!==wn(t))return null;const n=(0,dn.fromRdf)(e),r=(0,dn.fromRdf)(t);return typeof n!=typeof r?null:"string"==typeof n?n.localeCompare(r):n-r};function xn(e){return t=>{const n=t.focusNode.out([e]),r=n.filter((e=>!e.term.equals(t.focusNode.term))),i=0!==n.terms.length&&0===r.terms.length;t.test(i,en.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal("Must have same values as {$equals}")],value:r.terms[0]&&t.focusNode.node([r.terms[0]])||t.focusNode})}}function Sn(e){return t=>{const n=new xt(t.focusNode.out([e]).terms),r=new xt(t.values.terms),i=[...[...r].filter((e=>!n.has(e))),...[...n].filter((e=>!r.has(e)))];for(const n of i)t.violation(en.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal("Must have same values as {$equals}")],value:t.focusNode.node([n])});0===i.length&&t.debug(en.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal("Must have same values as {$equals}")]})}}function jn(e,t,n,r){return async i=>{const o=[];let a=[];t&&(a=new Set(i.shape.ptr.in([en.property]).out([en.property]).out([en.qualifiedValueShape]).filter((t=>!t.term.equals(e.ptr.term))).map((e=>i.shape.validator.shape(e)))));const s=(await async function(t){return(await Promise.all(t.map((t=>(async t=>{const n=(await e.validate(i.create({child:!0,focusNode:t}))).report;if(o.push(n.results),!n.conforms)return!1;if(0===a.length)return!0;if(i.options.debug||i.options.details){const e=await mn([...a],(async e=>(await e.validate(i.create({child:!0,focusNode:t}))).report));return o.push(e.flatMap((e=>e.results))),!e.every((e=>e.conforms))}return!await async function(e,t){for(const n of e)if(!await t(n))return!1;return!0}([...a],(async e=>(await e.validate(i.create({child:!0,focusNode:t}))).report.conforms))})(t))))).filter(Boolean)}(i.values)).length;null!==n&&i.test(s<=n,en.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:n,qualifiedValueShape:e.ptr.term,qualifiedValueShapesDisjoint:t},message:[i.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:o.flat()}),null!==r&&i.test(s>=r,en.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:r,qualifiedValueShape:e.ptr.term,qualifiedValueShapesDisjoint:t},message:[i.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:o.flat()})}}function In(e,t,n){return r=>{r.test(n.test(r.valueOrNode.term.value),en.PatternConstraintComponent,{args:{flags:t,pattern:e},message:[r.factory.literal('Value does not match pattern "{$pattern}"')],value:r.valueOrNode})}}const En=Ut("http://www.w3.org/ns/shacl#"),Nn=Ut("https://schemas.link/shacl-next#"),Tn=class{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some((e=>e.severity.equals(En.Info)||e.severity.equals(En.Violation)||e.severity.equals(En.Warning)))}},Rn=class{constructor({args:e={},factory:t,message:n=[],severity:r=En.Violation}={}){this.severity=r,this.message=n.map((n=>t.literal(function(e,t){return Object.entries(t).reduce(((e,[t,n])=>(n&&n.termType&&(n=mt(n)),e.replace(`{$${t}}`,n).replace(`{?${t}}`,n))),e)}(n.value,e),n.language||null)))}};class On{constructor({factory:e=Ft}={}){this.factory=e}clone({factory:e}={}){return new On({factory:e||this.factory})}validate(){return new Tn}validateSimple(){return!0}}const kn=On;class Ln extends kn{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(const t of Array.isArray(e)?e:[e])t&&this.datatypes.push(this.factory.fromTerm(t))}clone({factory:e}={}){return new Ln({datatypes:this.datatypes,factory:e||this.factory})}}const An=Ln,Cn=class{constructor({factory:e=Ft,validations:t}={}){if(this.factory=e,this.validations=new vt,t)for(const e of Object.values(t)){const t=e.clone({factory:this.factory});for(const e of t.datatypes)this.validations.set(e,t)}}validate(e){const t=this.validations.get(e.datatype);return t?t.validate(e):new Tn}validateSimple(e){const t=this.validations.get(e.datatype);return!t||t.validateSimple(e)}};class Dn extends An{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.message=[this.factory.literal("term value {$this} matches pattern {$pattern}")],this.patterns=Array.isArray(e)?e:[e]}clone({factory:e}={}){return new Dn(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map((t=>{let n;t.test(e.value)&&(n=Nn.Debug);const r={pattern:this.factory.literal(t.toString()),this:e};return new Rn({args:r,factory:this.factory,message:this.message,severity:n})}));return new Tn({results:t})}validateSimple(e){return this.patterns.every((t=>t.test(e.value)))}}const Mn=Dn,Pn=/^([-+]?[0-9]+)$/;class $n extends Mn{constructor(e=null,t=null,n,{factory:r}={}){super(Pn,n,{factory:r}),this.maxInclusive=null,this.minInclusive=null,"string"==typeof t&&(this.maxInclusive=BigInt(t)),"string"==typeof e&&(this.minInclusive=BigInt(e))}clone({factory:e}={}){return new $n(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!Nn.Debug.equals(t[0].severity))return new Tn({results:t});const n=BigInt(e.value);if(null!==this.minInclusive&&n<this.minInclusive){const n=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,r=[this.factory.literal(n)];t.push(new Rn({factory:this.factory,message:r}))}if(null!==this.maxInclusive&&n>this.maxInclusive){const n=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,r=[this.factory.literal(n)];t.push(new Rn({factory:this.factory,message:r}))}return new Tn({results:t})}validateSimple(e){if(!super.validateSimple(e))return!1;const t=BigInt(e.value);return!(null!==this.minInclusive&&t<this.minInclusive||null!==this.maxInclusive&&t>this.maxInclusive)}}const Bn=$n;class Fn extends An{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.values=new Set(e)}clone({factory:e}={}){return new Fn(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const n=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,r=[this.factory.literal(n)];t.push(new Rn({factory:this.factory,message:r}))}return new Tn({results:t})}validateSimple(e){return this.values.has(e.value)}}const qn=Fn,Un={xsd:Ut("http://www.w3.org/2001/XMLSchema#")},Gn=new An({datatypes:Un.xsd.anySimpleType}),Hn=new An({datatypes:Un.xsd.anyAtomicType}),Vn=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,Wn=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,zn=/^(-?P((([0-9]+Y([0-9]+M)?([0-9]+D)?|([0-9]+M)([0-9]+D)?|([0-9]+D))(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))?)|(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))))$/,Jn=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Qn=new Mn(Vn,Un.xsd.string),Xn=new qn(["1","true","0","false"],Un.xsd.boolean),Kn=new Mn(/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,Un.xsd.decimal),Yn=new Mn(Wn,Un.xsd.float),Zn=new Mn(Wn,Un.xsd.double),er=new Mn(zn,Un.xsd.duration),tr=new Mn(Jn,Un.xsd.dateTime),nr=new Mn(/^((([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Un.xsd.time),rr=new Mn(/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Un.xsd.date),ir=new Mn(/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Un.xsd.gYearMonth),or=new Mn(/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Un.xsd.gYear),ar=new Mn(/^(--(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Un.xsd.gMonthDay),sr=new Mn(/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Un.xsd.gDay),lr=new Mn(/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Un.xsd.gMonth),cr=new Mn(/^(([0-9a-fA-F]{2})*)$/,Un.xsd.hexBinary),ur=new Mn(/^(((([A-Za-z0-9+/] ?){4})*(([A-Za-z0-9+/] ?){3}[A-Za-z0-9+/]|([A-Za-z0-9+/] ?){2}[AEIMQUYcgkosw048] ?=|[A-Za-z0-9+/] ?[AQgw] ?= ?=))?)$/,Un.xsd.base64Binary),dr=new Mn(Vn,Un.xsd.anyURI),hr=/^([^\u000d\u000a\u0009]*)$/,fr=new Mn([Vn,hr],Un.xsd.normalizedString),pr=new Mn([Vn,hr,/^([^ ]+( [^ ]+)*)*$/],Un.xsd.token),gr=new Mn(/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,Un.xsd.language),yr=new Bn(null,null,Un.xsd.integer),mr=new Bn(null,"0",Un.xsd.nonPositiveInteger),br=new Bn(null,"-1",Un.xsd.negativeInteger),vr=new Bn("-9223372036854775808","9223372036854775807",Un.xsd.long),wr=new Bn("-2147483648","2147483647",Un.xsd.int),_r=new Bn("-32768","32767",Un.xsd.short),xr=new Bn("-128","127",Un.xsd.byte),Sr=new Bn("0",null,Un.xsd.nonNegativeInteger),jr=new Bn("0","18446744073709551615",Un.xsd.unsignedLong),Ir=new Bn("0","4294967295",Un.xsd.unsignedInt),Er=new Bn("0","65535",Un.xsd.unsignedShort),Nr=new Bn("0","255",Un.xsd.unsignedByte),Tr=new Bn("1",null,Un.xsd.positiveInteger),Rr=new Mn([zn,/^([^DT]*)$/],Un.xsd.yearMonthDuration),Or=new Mn([zn,/^([^YM]*[DT].*)$/],Un.xsd.dayTimeDuration),kr=new Mn([Jn,/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/],Un.xsd.dateTimeStamp),Lr=class extends Cn{constructor({factory:e}={}){super({factory:e,validations:{...o}})}},Ar=new vt([[en.BlankNode,new Set(["BlankNode"])],[en.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[en.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[en.IRI,new Set(["NamedNode"])],[en.IRIOrLiteral,new Set(["NamedNode","Literal"])],[en.Literal,new Set(["Literal"])]]);function Cr(e,t){return n=>{n.test(t.has(n.valueOrNode.term.termType),en.NodeKindConstraintComponent,{args:{nodeKind:e},message:[n.factory.literal("Value does not have node kind {$nodeKind}")],value:n.valueOrNode})}}const Dr=new vt([[en.maxCount,function(e){return{property:(t=parseInt(e.ptr.out([en.maxCount]).value),e=>{e.test(e.values.terms.length<=t,en.MaxCountConstraintComponent,{args:{maxCount:t},message:[e.factory.literal("More than {$maxCount} values")]})})};var t}],[en.minCount,function(e){return{property:(t=parseInt(e.ptr.out([en.minCount]).value),e=>{e.test(e.values.terms.length>=t,en.MinCountConstraintComponent,{args:{minCount:t},message:[e.factory.literal("Less than {$minCount} values")]})})};var t}],[en.and,function(e){return{generic:(t=[...e.ptr.out([en.and])].flatMap((e=>[...e.list()])).map((t=>e.validator.shape(t))),async e=>{const n=await mn(t,(async t=>(await t.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report)),r=n.every((e=>e.conforms));e.test(r,en.AndConstraintComponent,{results:n.flatMap((e=>e.results)),value:e.valueOrNode})})};var t}],[en.not,function(e){return{generic:(t=e.validator.shape(e.ptr.out([en.not])),async e=>{const n=(await t.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,r=!n.conforms;e.test(r,en.NotConstraintComponent,{args:{not:t.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:n.results,value:e.valueOrNode})})};var t}],[en.or,function(e){return{generic:(t=[...e.ptr.out([en.or])].flatMap((e=>[...e.list()])).map((t=>e.validator.shape(t))),async e=>{let n,r=[];if(e.options.debug||e.options.details){const i=await mn(t,(async t=>(await t.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report));r=i.flatMap((e=>e.results)),n=i.some((e=>e.conforms))}else n=await async function(e,t){for(const n of e)if(await t(n))return!0;return!1}(t,(async t=>(await t.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms));e.test(n,en.OrConstraintComponent,{results:r,value:e.valueOrNode})})};var t}],[en.xone,function(e){return{generic:(t=[...e.ptr.out([en.xone])].flatMap((e=>[...e.list()])).map((t=>e.validator.shape(t))),async e=>{const n=await mn(t,(async t=>(await t.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report)),r=1===n.filter((e=>e.conforms)).length;e.test(r,en.XoneConstraintComponent,{results:n.flatMap((e=>e.results)),value:e.valueOrNode})})};var t}],[en.closed,function(e){if(!(0,dn.fromRdf)(e.ptr.out([en.closed]).term))return null;const t=e.ptr.out([en.property]).map((t=>e.validator.shape(t)));return{node:(n=new xt(t.filter((e=>!e.deactivated)).map((e=>e.path[0].predicates[0]))),r=new xt([...e.ptr.out([en.ignoredProperties]).list()||[]].map((e=>e.term))),e=>{const t=e.focusNode.execute({start:"subject",end:"predicate"}).filter((e=>!r.has(e.term)&&!n.has(e.term)));if(t.ptrs.length>0)for(const n of t)e.violation(en.ClosedConstraintComponent,{message:[e.factory.literal("Predicate is not allowed (closed shape)")],path:[{quantifier:"one",start:"subject",end:"object",predicates:[n.term]}],value:e.focusNode.node([[...n.quads()][0].object])});else e.debug(en.ClosedConstraintComponent)})};var n,r}],[en.hasValue,function(e){const t=e.ptr.out([en.hasValue]).term;return{node:bn(t),property:vn(t)}}],[en.in,function(e){return{generic:(t=new xt([...e.ptr.out([en.in]).list()].map((e=>e.term))),e=>{e.test(t.has(e.valueOrNode.term),en.InConstraintComponent,{args:{in:[...t].map((e=>e.value)).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})})};var t}],[en.disjoint,function(e){return{generic:(t=e.ptr.out([en.disjoint]).term,e=>{const n=e.focusNode.dataset.match(e.focusNode.term,t,e.valueOrNode.term);e.test(0===n.size,en.DisjointConstraintComponent,{args:{disjoint:t},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})})};var t}],[en.equals,function(e){const t=e.ptr.out([en.equals]).term;return{node:xn(t),property:Sn(t)}}],[en.lessThan,function(e){return{property:(t=e.ptr.out([en.lessThan]).term,e=>{const n=e.focusNode.out([t]).terms;for(const r of e.values)for(const i of n){const n=_n(r.term,i);null===n||n>=0?e.violation(en.LessThanConstraintComponent,{args:{lessThan:t},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:r}):e.debug(en.LessThanConstraintComponent,{args:{lessThan:t},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:r})}})};var t}],[en.lessThanOrEquals,function(e){return{property:(t=e.ptr.out([en.lessThanOrEquals]).term,e=>{const n=e.focusNode.out([t]).terms;for(const r of e.values)for(const i of n){const n=_n(r.term,i);null===n||n>0?e.violation(en.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:t},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:r}):e.debug(en.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:t},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:r})}})};var t}],[en.maxExclusive,function(e){return{generic:(t=e.ptr.out([en.maxExclusive]).term,e=>{const n=_n(e.valueOrNode.term,t);e.test(null!==n&&n<0,en.MaxExclusiveConstraintComponent,{args:{maxExclusive:t},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})})};var t}],[en.maxInclusive,function(e){return{generic:(t=e.ptr.out([en.maxInclusive]).term,e=>{const n=_n(e.valueOrNode.term,t);e.test(null!==n&&n<=0,en.MaxInclusiveConstraintComponent,{args:{maxInclusive:t},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})})};var t}],[en.minExclusive,function(e){return{generic:(t=e.ptr.out([en.minExclusive]).term,e=>{const n=_n(e.valueOrNode.term,t);e.test(null!==n&&n>0,en.MinExclusiveConstraintComponent,{args:{minExclusive:t},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})})};var t}],[en.minInclusive,function(e){return{generic:(t=e.ptr.out([en.minInclusive]).term,e=>{const n=_n(e.valueOrNode.term,t);e.test(null!==n&&n>=0,en.MinInclusiveConstraintComponent,{args:{minInclusive:t},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})})};var t}],[en.node,function(e){return{generic:(t=[...e.ptr.out([en.node])].map((t=>e.validator.shape(t))),async e=>{for(const n of t){const t=await n.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(t.report.conforms,en.NodeConstraintComponent,{args:{node:n.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:t.report.results,value:e.valueOrNode})}})};var t}],[en.property,function(e){return{generic:(t=[...e.ptr.out([en.property])].map((t=>e.validator.shape(t))),async e=>{const n=e.create({focusNode:e.valueOrNode});for(const e of t)await e.validate(n)})};var t}],[en.qualifiedValueShape,function(e){const t=e.validator.shape(e.ptr.out([en.qualifiedValueShape])),n=e.ptr.out([en.qualifiedValueShapesDisjoint]).term,r=!!n&&(0,dn.fromRdf)(n),i=e.ptr.out([en.qualifiedMaxCount]).term,o=i?parseInt(i.value):null,a=e.ptr.out([en.qualifiedMinCount]).term;return{property:jn(t,r,o,a?parseInt(a.value):null)}}],[en.languageIn,function(e){return{generic:(t=[...new Set([...e.ptr.out([en.languageIn]).list()].map((e=>e.value)))],e=>{const n=t.some((t=>function(e,t){return!!t&&t.slice(0,e.length)===e}(t,e.valueOrNode.term.language)));e.test(n,en.LanguageInConstraintComponent,{args:{languageIn:t.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})})};var t}],[en.maxLength,function(e){return{generic:(t=parseInt(e.ptr.out([en.maxLength]).value),e=>{const n="BlankNode"!==e.valueOrNode.term.termType&&e.valueOrNode.value.length<=t;e.test(n,en.MaxLengthConstraintComponent,{args:{maxLength:t},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})})};var t}],[en.minLength,function(e){return{generic:(t=parseInt(e.ptr.out([en.minLength]).value),e=>{const n="BlankNode"!==e.valueOrNode.term.termType&&e.valueOrNode.value.length>=t;e.test(n,en.MinLengthConstraintComponent,{args:{minLength:t},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})})};var t}],[en.pattern,function(e){const t=e.ptr.out([en.pattern]).value,n=e.ptr.out([en.flags]).value;return{generic:In(t,n,new RegExp(t,n))}}],[en.uniqueLang,function(e){const t=e.ptr.out([en.uniqueLang]).term;return"true"===t.value&&nn.boolean.equals(t.datatype)?{property:e=>{const t=Object.entries(e.values.terms.reduce(((e,t)=>(t.language&&(e[t.language]=(e[t.language]||0)+1),e)),{})),n=t.filter((([,e])=>e>1));for(const[t]of n)e.violation(en.UniqueLangConstraintComponent,{args:{lang:t},message:[e.factory.literal('Language "{?lang}" used more than once')]});0===n.length&&e.debug(en.UniqueLangConstraintComponent)}}:null}],[en.class,function(e){return{generic:(t=e.ptr.out([en.class]).map((e=>pn(e))),e=>{const n=new xt(e.valueOrNode.out([Yt.type]).terms);for(const r of t){const t=[...n].some((e=>r.has(e)));e.test(t,en.ClassConstraintComponent,{value:e.valueOrNode})}})};var t}],[en.datatype,function(e){return{generic:(t=e.ptr.out([en.datatype]).term,n=new Lr,e=>{const r=t.equals(e.valueOrNode.term.datatype)&&n.validateSimple(e.valueOrNode.term);e.test(r,en.DatatypeConstraintComponent,{args:{datatype:t},message:[e.factory.literal("Value does not have datatype {$datatype}")],value:e.valueOrNode})})};var t,n}],[en.nodeKind,function(e){const t=e.ptr.out([en.nodeKind]).term;return{generic:Cr(t,Ar.get(t))}}]]),Mr=class{constructor(e,{factory:t,...n}){if(this.factory=t,this.options=n,this.registry=new un(Dr),this.shapesPtr=new Kt({dataset:e,factory:t}),this.shapes=new vt,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0),this.options.validations)for(const[e,t]of this.options.validations)this.registry.validations.set(e,t);const r=[...this.shapesPtr.hasOut([en.targetClass]),...this.shapesPtr.hasOut([en.targetNode]),...this.shapesPtr.hasOut([en.targetObjectsOf]),...this.shapesPtr.hasOut([en.targetSubjectsOf]),...this.shapesPtr.hasOut([Yt.type],[en.NodeShape]),...this.shapesPtr.hasOut([Yt.type],[en.PropertyShape])];for(const e of r)this.shape(e)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new yn(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const n=new Kt({...e,factory:this.factory}),r=new ln({factory:this.factory,focusNode:n,options:this.options,validator:this});t=t?t.map((e=>this.shape(this.shapesPtr.node(e.terms)))):this.shapes.values();for(const e of t){const t=r.create({shape:e});let i;i=n.isAny()?e.resolveTargets(t):n;for(const n of i)await e.validate(t.create({focusNode:n}))}return r.report}};var Pr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class $r extends HTMLElement{static get observedAttributes(){return dt.dataAttributes()}constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new dt(e,this.form),this.form.addEventListener("change",(e=>{e.stopPropagation(),this.config.editMode&&this.validate(!0).then((e=>{this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:e}}))})).catch((e=>{console.warn(e)}))}))}connectedCallback(){this.shadowRoot.prepend(this.form)}attributeChangedCallback(){this.config.updateAttributes(this),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.initDebounceTimeout=setTimeout((()=>Pr(this,void 0,void 0,(function*(){this.form.replaceChildren(document.createTextNode(this.config.attributes.loading));try{yield this.config.loader.loadGraphs(),this.form.replaceChildren(),this.config.renderedNodes.clear();const e=this.findRootShaclShapeSubject();if(e){this.form.classList.forEach((e=>{this.form.classList.remove(e)})),this.form.classList.toggle("mode-edit",this.config.editMode),this.form.classList.toggle("mode-view",!this.config.editMode),this.config.theme.apply(this.form);const t=[this.config.theme.stylesheet];for(const e of Object.entries(we).map((e=>e[1])))e.stylesheet&&t.push(e.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new Ce(e,this.config,this.config.attributes.valuesSubject?g.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.editMode){if(null!==this.config.attributes.submitButton){const e=this.config.theme.createButton(this.config.attributes.submitButton||"Submit",!0);e.addEventListener("click",(e=>{e.preventDefault(),this.form.reportValidity()&&this.validate().then((e=>{var t;e?this.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0})):null===(t=this.form.querySelector(":scope .invalid > .editor"))||void 0===t||t.focus()}))})),this.form.appendChild(e)}yield this.validate(!0)}}else if(this.config.shapesGraph.size>0)throw new Error("shacl root node shape not found")}catch(e){console.error(e);const t=document.createElement("div");t.innerText=String(e),this.form.replaceChildren(t)}}))),200)}serialize(e="text/turtle",t=this.toRDF()){return function(e,t,n){if("application/ld+json"===t)return function(e){const t=[];for(const n of e){const e={"@id":n.subject.id};if(n.predicate===B)e["@type"]=n.object.id;else{let t=n.object.value;n.object instanceof b?n.object.language?t={"@language":n.object.language,"@value":n.object.value}:n.object.datatype&&n.object.datatype.value!==`${A}#string`&&(t={"@type":n.object.datatype.value,"@value":n.object.value}):t={"@id":n.object.id},e[n.predicate.value]=t}t.push(e)}return JSON.stringify(t)}(e);{const r=new ye({format:t,prefixes:n});r.addQuads(e);let i="";return r.end(((e,t)=>{e&&console.error(e),i=t})),i}}(t.getQuads(null,null,null,null),e,this.config.prefixes)}toRDF(e=new Fe){var t;return null===(t=this.shape)||void 0===t||t.toRDF(e),e}registerPlugin(e){_e(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setSharedShapesGraph(e){ct(e),this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}validate(){return Pr(this,arguments,void 0,(function*(e=!1){var t,n,r,i,o,a;for(const e of this.form.querySelectorAll(":scope .validation-error"))e.remove();for(const e of this.form.querySelectorAll(":scope .property-instance"))e.classList.remove("invalid"),(null===(t=e.querySelector(":scope > .editor"))||void 0===t?void 0:t.value)?e.classList.add("valid"):e.classList.remove("valid");this.config.shapesGraph.deleteGraph(""),null===(n=this.shape)||void 0===n||n.toRDF(this.config.shapesGraph);try{const t=this.config.shapesGraph,n=yield new Mr(t,{details:!0,factory:g}).validate({dataset:t});for(const t of n.results)if(null===(i=null===(r=t.focusNode)||void 0===r?void 0:r.ptrs)||void 0===i?void 0:i.length)for(const n of t.focusNode.ptrs){const r=n._term;if(null===(o=t.path)||void 0===o?void 0:o.length){const n=t.path[0].predicates[0];let i=this.form.querySelectorAll(`:scope [data-node-id='${r.id}'] [data-path='${n.id}'] > .editor`);0===i.length&&(i=this.form.querySelectorAll(`:scope [data-node-id='${r.id}'] [data-path='${n.id}']`));for(const n of i)if(n.classList.contains("editor")){if(!e||n.value){let e=n.parentElement;e.classList.add("invalid"),e.classList.remove("valid"),e.appendChild(this.createValidationErrorDisplay(t));do{e.classList.contains("collapsible")&&e.classList.add("open"),e=e.parentElement}while(e)}}else e||(n.classList.add("invalid"),n.classList.remove("valid"),n.appendChild(this.createValidationErrorDisplay(t,"node")))}else e||null===(a=this.form.querySelector(`:scope [data-node-id='${r.id}']`))||void 0===a||a.prepend(this.createValidationErrorDisplay(t,"node"))}return n.conforms}catch(e){return console.error(e),!1}}))}createValidationErrorDisplay(e,t){var n,r;const i=document.createElement("span");if(i.classList.add("validation-error"),t&&i.classList.add(t),e)if((null===(n=e.message)||void 0===n?void 0:n.length)>0)for(const t of e.message)i.title+=t.value+"\n";else i.title=null===(r=e.sourceConstraintComponent)||void 0===r?void 0:r.value;return i}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=g.namedNode(this.config.attributes.shapeSubject),0===this.config.shapesGraph.getQuads(e,B,V,null).length)return void console.warn(`shapes graph does not contain requested root shape ${this.config.attributes.shapeSubject}`)}else if(this.config.attributes.valuesSubject&&this.config.dataGraph.size>0){const t=g.namedNode(this.config.attributes.valuesSubject),n=[...this.config.dataGraph.getQuads(t,B,null,null),...this.config.dataGraph.getQuads(t,F,null,null)];if(0===n.length)return void console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${B.id} nor ${F.id} statement`);for(const t of n)if(this.config.shapesGraph.getQuads(t.object,B,V,null).length>0){e=t.object;break}if(!e){const t=this.config.shapesGraph.getQuads(null,J,n[0].object,null);if(0===t.length)return void console.error(`value subject '${this.config.attributes.valuesSubject}' has no shacl shape definition in the shapes graph`);if(t.length>1&&console.warn(`value subject '${this.config.attributes.valuesSubject}' has multiple shacl shape definitions in the shapes graph, choosing the first found (${t[0].subject})`),0===this.config.shapesGraph.getQuads(t[0].subject,B,V,null).length)return void console.error(`value subject '${this.config.attributes.valuesSubject}' references a shape which is not a NodeShape (${t[0].subject})`);e=t[0].subject}}else{const t=this.config.shapesGraph.getQuads(null,B,V,null);if(0==t.length)return void console.warn("shapes graph does not contain any root shapes");t.length>1&&(console.warn("shapes graph contains",t.length,"root shapes. choosing first found which is",t[0].subject.value),console.info('hint: set the shape to use with attribute "data-shape-subject"')),e=t[0].subject}return e}}const Br=(Fr={Button:()=>e.Button,Checkbox:()=>e.Checkbox,MenuItem:()=>e.MenuItem,Select:()=>e.Select,TextField:()=>e.TextField},qr={},r.d(qr,Fr),qr);var Fr,qr;class Ur extends se{constructor(){super(":host {\n --mdui-color-primary-light: var(--mdui-color-primary-light);\n --mdui-color-primary-dark: var(--mdui-color-primary-dark);\n --mdui-color-background-light: var(--mdui-color-background-light);\n}\n/* this prevents hiding the date picker icon and number controls */\nmdui-text-field::part(input) {\n clip-path: none;\n appearance: inherit;\n}\nform.mode-edit { --label-width: 0em; }\n.property-instance { margin-bottom:14px; }\n.mode-edit .property-instance *[required]::part(icon) { align-self: flex-start; padding-top: 0.7em; }\n.mode-edit .property-instance *[required]::part(icon)::before { color: red; content: '\\2736'; font-size: 0.6em; }")}createDefaultTemplate(e,t,n,r,i){var o;r.classList.add("editor"),(null==i?void 0:i.datatype)&&(r.shaclDatatype=i.datatype),void 0!==(null==i?void 0:i.minCount)&&(r.dataset.minCount=String(i.minCount)),(null==i?void 0:i.class)&&(r.dataset.class=i.class.value),(null==i?void 0:i.nodeKind)&&(r.dataset.nodeKind=i.nodeKind.value),((null==i?void 0:i.hasValue)||(null==i?void 0:i.readonly))&&(r.disabled=!0),r.value=(null==t?void 0:t.value)||(null===(o=null==i?void 0:i.defaultValue)||void 0===o?void 0:o.value)||"";const a=(null==i?void 0:i.description)?i.description.value:(null==i?void 0:i.pattern)?i.pattern:null;a&&r.setAttribute("placeholder",a),n&&r.setAttribute("required","true");const s=document.createElement("div");if(e){const t=document.createElement("label");t.htmlFor=r.id,t.innerText=e,s.appendChild(t)}return s.appendChild(r),s}createTextEditor(e,t,n,r){const i=new Br.TextField;return i.variant="outlined",i.label=e,i.type="text",r.description&&(i.helper=r.description.value),!1===r.singleLine&&(i.rows=5),r.pattern&&(i.pattern=r.pattern),this.createDefaultTemplate("",t,n,i,r)}createNumberEditor(e,t,n,r){var i,o;const a=new Br.TextField;a.variant="outlined",a.type="number",a.label=e,a.helper=(null===(i=r.description)||void 0===i?void 0:i.value)||"";const s=void 0!==r.minInclusive?r.minInclusive:void 0!==r.minExclusive?r.minExclusive+1:void 0,l=void 0!==r.maxInclusive?r.maxInclusive:void 0!==r.maxExclusive?r.maxExclusive-1:void 0;return void 0!==s&&a.setAttribute("min",String(s)),void 0!==l&&a.setAttribute("max",String(l)),(null===(o=r.datatype)||void 0===o?void 0:o.value)!==A+"integer"&&a.setAttribute("step","0.1"),this.createDefaultTemplate("",t,n,a,r)}createListEditor(e,t,n,r,i){var o;const a=new Br.Select;a.variant="outlined",a.label=e,a.helper=null===(o=null==i?void 0:i.description)||void 0===o?void 0:o.value,a.clearable=!0;const s=this.createDefaultTemplate("",null,n,a,i);let l=!0;for(const e of r){const t=new Br.MenuItem,n="string"==typeof e.value?e.value:e.value.value,r=e.label?e.label:n;if(t.value=n,t.textContent=r||n,e.indent)for(let n=0;n<e.indent;n++)t.innerHTML="&#160;&#160;"+t.innerHTML;""===n&&(l=!1,t.ariaLabel="blank"),a.appendChild(t)}if(l){const e=new Br.MenuItem;e.ariaLabel="blank",a.prepend(e)}return t&&(a.value=t.value),s}createBooleanEditor(e,t,n,r){const i=new Br.Checkbox,o=this.createDefaultTemplate("",t,n,i,r);return i.removeAttribute("required"),t instanceof b&&(i.checked="true"===t.value),i.innerText=e,o}createDateEditor(e,t,n,r){var i,o,a;const s=new Br.TextField;s.variant="outlined",s.helper=(null===(i=null==r?void 0:r.description)||void 0===i?void 0:i.value)||(null==r?void 0:r.label)||"",(null===(o=r.datatype)||void 0===o?void 0:o.value)===A+"dateTime"?(s.type="datetime-local",s.setAttribute("step","1")):s.type="date",s.classList.add("pr-0");const l=this.createDefaultTemplate("",null,n,s,r);if(t)try{let e=new Date(t.value).toISOString();e=(null===(a=r.datatype)||void 0===a?void 0:a.value)===A+"dateTime"?e.slice(0,19):e.slice(0,10),s.value=e}catch(e){console.error(e,t)}return l}createLangStringEditor(e,t,n,r){var i;const o=this.createTextEditor(e,t,n,r),a=o.querySelector(":scope .editor");let s;if(null===(i=r.languageIn)||void 0===i?void 0:i.length){s=document.createElement("select");for(const e of r.languageIn){const t=document.createElement("option");t.innerText=e.value,s.appendChild(t)}}else s=document.createElement("input"),s.maxLength=5,s.placeholder="lang?";return s.title="Language of the text",s.classList.add("lang-chooser"),s.addEventListener("change",(e=>{e.stopPropagation(),a&&(a.dataset.lang=s.value,a.dispatchEvent(new Event("change",{bubbles:!0})))})),t instanceof b&&(s.value=t.language),a.dataset.lang=s.value,a.after(s),o}createFileEditor(e,t,n,r){const i=document.createElement("input");return i.type="file",i.addEventListener("change",(e=>{var t;if(null===(t=i.files)||void 0===t?void 0:t.length){e.stopPropagation();const t=new FileReader;t.readAsDataURL(i.files[0]),t.onload=()=>{var e;i.binaryData=btoa(t.result),null===(e=i.parentElement)||void 0===e||e.dispatchEvent(new Event("change",{bubbles:!0}))}}else i.binaryData=void 0})),this.createDefaultTemplate(e,t,n,i,r)}createButton(e,t){let n;return t?(n=new Br.Button,n.classList.add("primary")):(n=new Br.Button,n.classList.add("secondary")),n.innerHTML=e,n}}class Gr extends $r{constructor(){super(new Ur)}}window.customElements.define("shacl-form",Gr);var Hr=i.TS,Vr=i.aH,Wr=i.k_,zr=i.a6,Jr=i.nt,Qr=i.Sx,Xr=i.E7,Kr=i.F3,Yr=i.WW;export{Hr as Config,Vr as Loader,Wr as Plugin,zr as ShaclForm,Jr as ShaclPropertyTemplate,Qr as Theme,Xr as findLabel,Kr as registerPlugin,Yr as setSharedShapesGraph};